CLI reference
This page is the exact command reference for the public pyfcstm command.
It records option names, accepted values, output channels, side effects, and
failure boundaries. Use CLI workflows for task recipes and
Visualization options reference for the shared PlantUML option
schema.
The synchronization markers below are comments consumed by
tools/check_cli_reference_docs.py. They keep this reference aligned with the
Click command tree and with the documented human-only boundary facts.
Top-level command
pyfcstm [OPTIONS] COMMAND [ARGS]...
Option |
Meaning |
Notes |
|---|---|---|
|
Show pyfcstm version information. |
Read-only, exits after printing version text. |
|
Show help and exit. |
Available on the top-level command and every subcommand. |
Command |
Primary input |
Primary output |
Use when |
|---|---|---|---|
|
FCSTM DSL file |
Interactive console transcript or batch transcript |
You want to execute model semantics without generating target code. |
|
FCSTM DSL file |
Human text, JSON, LLM JSON, or LLM Markdown |
You want parser/model facts, diagnostics, and optional structural or SMT-local verify diagnostics. |
|
FCSTM DSL file plus one FBMCQ query file |
Polarity-aware human property verdict or versioned JSON |
You want bounded reachability, safety, response, coverage, or call evidence with mandatory SAT replay. |
|
FCSTM DSL file plus a built-in or custom template |
Rendered files under an output directory |
You want target-language runtime artifacts. |
|
FCSTM DSL file |
PlantUML source text |
You want a deterministic diagram source file. |
|
FCSTM DSL file or renderer check request |
Rendered |
You want pyfcstm to call a PlantUML renderer. |
Common command contract
The CLI is intentionally split between source-producing commands and commands that may depend on external tools:
simulate,inspect,bmc,generate, andplantumlread DSL and use Python-side pyfcstm functionality. They do not require Java, a PlantUML jar, or a network renderer.visualizefirst builds PlantUML source and then callsplantumlcli. It may require Java and a PlantUML jar for local rendering or a reachable PlantUML server for remote rendering.Most successful commands exit with status
0. BMC additionally uses property-aware exit statuses1,3, and4for a negative bounded verdict, an inconclusive result, and replay mismatch respectively. Click validation failures, missing files, parse errors, model validation errors, rendering failures, and policy violations exit non-zero.User-facing progress and success messages are written to standard output; Click-formatted errors are written to standard error.
Commands that write files create or replace only the requested output path or directory.
generate --clearis the only command option here that intentionally removes existing output-directory contents before writing.
Reference-grade command examples
The examples in individual command sections use machine.fcstm as a compact
placeholder. The table below anchors the same command contracts to one concrete
repository source file so reviewers can reproduce success and failure behavior
without inventing inputs.
Command family |
Valid example |
Expected success evidence |
Common invalid example |
Expected failure boundary |
|---|---|---|---|---|
|
|
Standard output includes |
|
Simulator-command or event handling fails after parsing/model import, not during rendering. |
|
|
The output file contains |
|
Click rejects the closed |
|
|
The first line is |
|
Query-file reading fails before compilation and emits no partial report. |
|
|
The output directory is replaced and populated from the packaged Python template. |
|
Command validation rejects using built-in and custom template sources together. |
|
|
The requested file starts with |
|
Input-file reading fails before any renderer is involved. |
|
|
The command reports local/remote backend availability and does not read a DSL file. |
|
On a machine without a local jar configuration, renderer availability fails without parsing a model. |
|
|
The requested image file exists after successful backend rendering. |
|
Click rejects the closed render-type choice before rendering. |
These examples are not a replacement for the exhaustive option tables below. They show the contract shape: a valid example, the observable success signal, an invalid example, and the layer that owns the failure.
bmc
The BMC command has a separate exhaustive protocol reference because SAT/UNSAT must be translated through property polarity and every SAT result crosses a witness/replay trust boundary. See BMC CLI and Result Protocol Reference for all options, color behavior, streams, property verdicts, timing, exits, JSON fields, diagnostics, witness/replay records, and packaging. See FBMCQ Language Reference for the FBMCQ language.
simulate
pyfcstm simulate -i <input-code> [-e "current; cycle; current"] [--no-color]
simulate constructs the model and runs the Python simulator. Without
-e it starts the interactive console. With -e it executes a
semicolon-separated command script and exits.
Option |
Required |
Value |
Meaning |
|---|---|---|---|
|
yes |
path |
FCSTM DSL entry file. |
|
no |
string |
Batch simulator commands such as |
|
no |
flag |
Disable color in interactive/human console output. |
|
no |
flag |
Show command help. |
Output and failure facts:
Interactive mode prints prompts and state/runtime information to standard output and waits for user commands.
Batch mode prints the command results to standard output and returns after the script finishes.
The command has no file side effects unless invoked from shell redirection.
Input, parse, and model-validation failures exit non-zero before the simulator command layer runs.
Simulator command-layer failures in batch mode, such as an unknown batch command or an unresolvable event name, are transcript-level failures today: they are printed to standard output and the batch process still exits with status
0.Typical failures are unreadable input, parse errors, model validation errors, unknown simulator commands, invalid event names, or invalid hot-start state and variable assignments.
Typical examples:
pyfcstm simulate -i machine.fcstm
pyfcstm simulate -i machine.fcstm -e "current; cycle; current"
pyfcstm simulate -i machine.fcstm -e "init System.Active counter=10; cycle 5"
inspect
pyfcstm inspect -i <input-code> [-o <output>] [--format human|json|llm-json|llm-md]
inspect reports what the parser and model importer know about a DSL file.
It is diagnostic and fact-oriented: it does not execute a simulator trace and it
does not prove generated target code.
Option |
Default |
Values |
Meaning |
|---|---|---|---|
|
required |
path |
FCSTM DSL entry file. |
|
standard output |
path |
Output file. A suffix mismatch may produce a warning, not a different format. |
|
|
|
Output format. Use |
|
|
|
ANSI color policy for |
|
off |
flag |
Include inspect-eligible verification diagnostics. |
|
|
|
Maximum structural or SMT-local verify complexity accepted by inspect. |
|
|
|
Maximum model-derived verify call-count scaling accepted by inspect. |
|
unset |
integer |
Optional Z3 timeout in milliseconds. |
|
n/a |
flag |
Show command help. |
Output and failure facts:
humanis for terminals and humans;jsonis the full structured report;llm-jsonandllm-mdare stable, compact repair-oriented views.Machine formats never include ANSI color. Human output written to a file is also colorless even if
--color alwaysis requested.Successful file output writes exactly the requested report file. Standard output is used when
-ois omitted.Verify policy knobs are validated before the input file is parsed. This makes forbidden expensive modes fail fast instead of doing hidden heavy work.
Typical examples:
pyfcstm inspect -i machine.fcstm
pyfcstm inspect -i machine.fcstm --format json -o machine.inspect.json
pyfcstm inspect -i machine.fcstm --format llm-md -o machine.inspect.md
pyfcstm inspect -i machine.fcstm --enable-verify --smt-timeout-ms 2000
generate
pyfcstm generate -i <input-code> --template <name> -o <output-dir> [--clear]
pyfcstm generate -i <input-code> -t <template-dir> -o <output-dir> [--clear]
generate renders target artifacts from the semantic model. It accepts either
a packaged built-in template name or an explicit custom template directory.
Do not pass both --template and --template-dir.
Option |
Required |
Values |
Meaning |
|---|---|---|---|
|
yes |
path |
FCSTM DSL entry file. |
|
one of template name or template directory |
|
Packaged built-in template. |
|
one of template name or template directory |
path |
Custom template directory maintained by the caller. |
|
yes |
path |
Destination directory for rendered files. |
|
no |
flag |
Remove existing output-directory contents before rendering. |
|
no |
flag |
Show command help. |
Output and failure facts:
Standard output is normally limited to CLI progress/errors from Click and the renderer; the generated artifacts are written under
--output-dir.Built-in templates are extracted from packaged template assets first, then rendered through the same renderer path as custom templates.
--clearis destructive for the output directory. Use it only for a generated directory that is safe to replace.Typical failures are missing input, parse/model errors, a missing or invalid template, Jinja rendering errors, invalid output permissions, or mutually inconsistent template arguments.
Typical examples:
pyfcstm generate -i machine.fcstm --template python -o generated/python --clear
pyfcstm generate -i machine.fcstm --template c -o generated/c
pyfcstm generate -i machine.fcstm -t ./my_template -o generated/custom --clear
plantuml
pyfcstm plantuml -i <input-code> [-o <output>] [-l minimal|normal|full] [-c key=value]
plantuml emits PlantUML source text only. It does not render images, does
not call Java, and does not contact a remote PlantUML service.
Option |
Default |
Values |
Meaning |
|---|---|---|---|
|
required |
path |
FCSTM DSL entry file. |
|
standard output |
path |
Output file for PlantUML source. |
|
|
|
Detail preset shared with |
|
none |
|
Fine-grained PlantUML option override. |
|
n/a |
flag |
Show command help. |
Output and failure facts:
With
-o, the command writes PlantUML source to the requested file. Without-o, it prints source to standard output.-caccepts the typed value grammar in Visualization options reference.Typical failures are unreadable input, parse/model errors, unknown PlantUML option keys, value parsing errors, or invalid
PlantUMLOptionsvalues.
Typical examples:
pyfcstm plantuml -i machine.fcstm -o machine.puml
pyfcstm plantuml -i machine.fcstm -l full -o machine.full.puml
pyfcstm plantuml -i machine.fcstm -c show_events=true -c max_depth=2
visualize
pyfcstm visualize -i <input-code> [-o <output>] [-t png|svg|pdf] [--renderer auto|local|remote]
pyfcstm visualize --check [--renderer auto|local|remote]
visualize builds PlantUML source and asks plantumlcli to render a final
file. Use it for local preview or documentation artifacts when the renderer
backend is part of the workflow.
Option |
Default |
Values |
Meaning |
|---|---|---|---|
|
required unless |
path |
FCSTM DSL entry file. |
|
cache path |
path |
Rendered output file. If omitted, pyfcstm writes under its visualize cache directory. |
|
|
|
Detail preset shared with |
|
none |
|
Fine-grained PlantUML option override. |
|
|
|
Rendered diagram type. |
|
|
|
Backend selection. |
|
|
path |
Java executable for local rendering. |
|
|
path |
PlantUML jar path for local rendering. |
|
|
URL |
Remote PlantUML server base URL. |
|
off |
flag |
Check renderer availability and exit without reading a DSL file. |
|
|
flag pair |
Open or do not open the rendered file with the system default viewer. |
|
off |
flag |
Treat viewer-launch failure as an error. |
|
n/a |
flag |
Show command help. |
Output and failure facts:
A successful render prints the effective renderer and output path.
If
-ois omitted, the output file is created in a platform cache directory:$XDG_CACHE_HOME/pyfcstm/visualizeor~/.cache/pyfcstm/visualizeon Linux,~/Library/Caches/pyfcstm/visualizeon macOS, and%LOCALAPPDATA%\\pyfcstm\\visualizeon Windows.If
-ohas a suffix, the suffix must match--type. A suffixless output path receives the selected suffix automatically.--checkexits0when the requested backend is available. For--renderer auto, either local or remote availability is enough.--openis skipped automatically in headless environments such as CI,PYFCSTM_NO_GUItruthy environments, or Linux sessions without display variables. With--strict-open, that skip becomes a command failure.Remote rendering sends generated PlantUML text to the configured PlantUML server. Use
--renderer localfor diagrams that must not leave the machine.
Typical examples:
pyfcstm visualize --check --renderer auto
pyfcstm visualize -i machine.fcstm -t svg -o machine.svg --no-open
pyfcstm visualize -i machine.fcstm --renderer local -p ./plantuml.jar --no-open
pyfcstm visualize -i machine.fcstm --renderer remote -r http://www.plantuml.com/plantuml --no-open
Command evidence cards
The tables below are deliberately example-heavy. They show short, reproducible commands and the evidence each command produces. Use them together with the option tables above: the option tables define exact forms, while these cards show how those forms behave in normal and failing runs.
Top-level command evidence
Scenario |
Command |
Expected signal |
Side effect or reason |
|---|---|---|---|
Confirm the console script |
|
Help starts with Usage and lists all public commands. |
None |
Confirm module fallback |
|
Help starts with Usage: python -m pyfcstm. |
None |
Record version |
|
Output includes Pyfcstm, version and maintainer contact. |
None |
Situation |
Example |
Expected signal |
First repair |
|---|---|---|---|
Console script missing |
|
Shell command-not-found before pyfcstm starts. |
Run python -m pyfcstm –help with the intended interpreter. |
Unknown subcommand |
|
Click reports no such command. |
Use pyfcstm –help and choose a public command. |
Option on wrong command |
|
Click reports unknown top-level option. |
Move command options after the subcommand. |
- Evidence rule:
Treat these examples as behavior probes. If implementation output changes, update the short signal here and keep the option marker checker green.
simulate evidence
Scenario |
Command |
Expected signal |
Side effect or reason |
|---|---|---|---|
Deterministic batch trace |
|
Transcript includes Cycle: 0, then Cycle: 1 and the active state. |
No file side effect. |
Explicit event cycle |
|
Transcript records the event-bearing cycle and resulting active path. |
No file side effect. |
Hot start |
|
Run starts from the requested active path and variable values. |
No file side effect. |
Situation |
Example |
Expected signal |
First repair |
|---|---|---|---|
Missing input |
|
Click reports Missing option ‘-i’ / ‘–input-code’. |
Pass the DSL file with -i. |
Unknown batch command |
|
Simulator command layer prints the unknown command in the transcript; batch mode still exits with status |
Use the simulation command reference. |
Invalid hot-start values |
|
Hot-start validation rejects invalid assignments. |
Provide every required variable with a typed value. |
- Evidence rule:
Treat these examples as behavior probes. If implementation output changes, update the short signal here and keep the option marker checker green.
inspect evidence
Scenario |
Command |
Expected signal |
Side effect or reason |
|---|---|---|---|
Human report |
|
Output begins with [OK] FCSTM Inspect Report and count summary. |
No file side effect. |
JSON report |
|
JSON includes metrics, diagnostics, states, transitions, and graph sections. |
Writes the requested JSON file. |
LLM Markdown report |
|
File contains compact repair-oriented facts and diagnostics. |
Writes the requested Markdown file. |
Structural and SMT-local verify report |
|
Report includes inspect-eligible verification diagnostics. |
No file side effect unless -o is used. |
Situation |
Example |
Expected signal |
First repair |
|---|---|---|---|
Missing input |
|
Click reports Missing option ‘-i’ / ‘–input-code’. |
Pass the DSL file explicitly. |
Invalid format |
|
Click reports xml is not one of human/json/llm-json/llm-md. |
Choose a documented format. |
Suffix mismatch warning |
|
Format remains json; suffix warning is informational. |
Use a matching suffix for clarity. |
- Evidence rule:
Treat these examples as behavior probes. If implementation output changes, update the short signal here and keep the option marker checker green.
generate evidence
Scenario |
Command |
Expected signal |
Side effect or reason |
|---|---|---|---|
Python built-in template |
|
Directory contains machine.py, README.md, README_zh.md. |
Clears and rewrites target directory. |
C built-in template |
|
Directory contains C artifacts described by generated README. |
Writes files; does not compile. |
Custom template |
|
Files follow config.yaml and .j2 output paths. |
Writes custom output tree. |
Situation |
Example |
Expected signal |
First repair |
|---|---|---|---|
Both template inputs |
|
Command rejects conflicting template arguments. |
Use exactly one template source. |
Unknown built-in template |
|
Template lookup reports unavailable name. |
Use a documented built-in name. |
Dangerous clear |
|
Request is destructive even if accepted. |
Use a dedicated generated directory. |
Broken custom template |
|
Renderer reports config, import, Jinja, or filesystem error. |
Debug custom template before blaming DSL. |
- Evidence rule:
Treat these examples as behavior probes. If implementation output changes, update the short signal here and keep the option marker checker green.
plantuml evidence
Scenario |
Command |
Expected signal |
Side effect or reason |
|---|---|---|---|
Write source file |
|
File begins with @startuml and includes the root state block. |
Writes requested .puml file. |
Print source |
|
stdout begins with @startuml. |
No file side effect unless redirected. |
Dense review source |
|
Source includes allowed lifecycle/action details. |
Writes source only. |
Situation |
Example |
Expected signal |
First repair |
|---|---|---|---|
Unknown config key |
|
PlantUMLOptions construction rejects the key. |
Use the closed option list. |
Invalid typed value |
|
Value parser reports the offending key. |
Use an integer or omit the option. |
Expecting image output |
|
Command writes source text to that path, not SVG image data. |
Use visualize -t svg for rendered images. |
- Evidence rule:
Treat these examples as behavior probes. If implementation output changes, update the short signal here and keep the option marker checker green.
visualize evidence
Scenario |
Command |
Expected signal |
Side effect or reason |
|---|---|---|---|
Check backend |
|
Reports local and/or remote renderer availability. |
Does not parse DSL or write a diagram. |
Render SVG in CI |
|
Reports renderer and output path on success. |
Writes SVG file. |
Force local renderer |
|
Uses Java plus supplied PlantUML jar. |
Writes requested or cache output. |
Force remote renderer |
|
Sends generated PlantUML source to configured service. |
Writes rendered artifact. |
Situation |
Example |
Expected signal |
First repair |
|---|---|---|---|
Suffix/type conflict |
|
Fails before rendering because .svg does not match png. |
Align suffix and –type. |
Missing local jar |
|
Local check names missing PlantUML jar or Java/path failure. |
Set PLANTUML_JAR or pass -p. |
Headless open |
|
Normal open is skipped in CI/headless; strict-open makes it fatal. |
Use –no-open for scripts. |
Remote unreachable |
|
Remote check reports backend/network failure. |
Fix network/host or use local. |
- Evidence rule:
Treat these examples as behavior probes. If implementation output changes, update the short signal here and keep the option marker checker green.
Per-option decision cards
The command examples above show whole-command behavior. The cards below zoom in on option-level decisions so reviewers can check whether a command line is using the right knob. Each row includes at least one legal form, one boundary or counterexample, and the evidence that should be inspected after the run.
Option |
Legal forms |
Boundary or counterexample |
Evidence to inspect |
|---|---|---|---|
|
|
|
Help lists |
|
|
|
Standard output contains the project version and maintainer line, then exits before any subcommand runs. |
Option |
Legal forms |
Boundary or counterexample |
Evidence to inspect |
|---|---|---|---|
|
|
Omitting it is a Click error before simulator startup. |
The first transcript lines identify the entered command and cycle state; no output files are created. |
|
|
Shell quoting errors split semicolon scripts before pyfcstm receives them. |
Batch mode exits after the script and prints a deterministic transcript suitable for logs. |
|
|
It does not change simulator semantics or active-state selection. |
ANSI escape sequences should be absent from the terminal transcript. |
Option |
Legal forms |
Boundary or counterexample |
Evidence to inspect |
|---|---|---|---|
|
|
Missing or unreadable paths are reported as controlled CLI errors. |
The report names the root state or the read/parse failure before any output file is trusted. |
|
|
Missing parent directories cause write errors; a mismatched suffix may warn but does not change the selected format. |
The target file contains exactly the selected inspect text, while warnings go to stderr. |
|
|
Values such as |
Machine formats contain no ANSI color and are stable enough for scripts to parse. |
|
|
Color is ignored for |
Inspect stdout for ANSI sequences only in human stdout mode. |
|
Add it when structural or SMT-local verify facts are intentionally requested. |
It is disabled by default; enabling it does not load |
The diagnostic sections may include verification-derived entries, but inspect remains policy-bounded. |
|
|
Click rejects values outside the documented choices before model parsing. |
CLI help lists the exact accepted tiers; successful reports contain only algorithms within the selected tier. |
|
|
Click rejects values outside the documented choices before model parsing. |
CLI help lists the exact accepted scaling values; verify results remain within the selected call-count budget. |
|
|
Negative values are rejected by Click’s integer range validation. |
SMT-local checks receive the timeout; structural-only runs do not become exhaustive verification. |
Option |
Legal forms |
Boundary or counterexample |
Evidence to inspect |
|---|---|---|---|
|
|
Parse or model errors stop generation before template output is authoritative. |
The output directory should not be treated as current until the command exits successfully. |
|
|
Unknown names are rejected by Click because choices come from packaged template metadata. |
Built-in templates are extracted to a temporary directory before rendering. |
|
|
It is mutually exclusive with |
Rendering reads the directory’s |
|
|
Permission errors or missing parents surface as filesystem/template errors. |
The directory contains generated artifacts only after successful render completion. |
|
Use with a dedicated generated directory such as |
Do not point it at a source tree, repository root, or hand-maintained directory. |
Previous output is removed before rendering; reviewers should inspect the target path before accepting the command. |
Option |
Legal forms |
Boundary or counterexample |
Evidence to inspect |
|---|---|---|---|
|
|
Invalid DSL prevents PlantUML source export. |
Successful output begins with |
|
|
The suffix is not interpreted as a render type; |
Inspect the file as text, not as an image. |
|
|
Misspelled presets are rejected by Click. |
The generated source changes only the visible PlantUML facts, not model semantics. |
|
|
Unknown keys, malformed |
The output source should reflect the intended option, for example hidden events or collapsed depth. |
Option |
Legal forms |
Boundary or counterexample |
Evidence to inspect |
|---|---|---|---|
|
Required for rendering: |
|
Render runs first build PlantUML source from the same input path used by |
|
|
A suffix/type mismatch such as |
Suffixless paths receive the selected suffix; omitted paths use a platform cache directory. |
|
Same source-shaping options as |
They do not control renderer backend, file type, cache path, or viewer behavior. |
Compare the generated image or PlantUML source to ensure the intended facts are visible. |
|
|
Values such as |
The backend writes an artifact with the selected extension and format. |
|
|
|
The success message names the effective renderer used for that run. |
|
|
It matters only for local rendering, not remote rendering. |
Local failures mention Java/path issues when the executable cannot run PlantUML. |
|
|
A missing or invalid jar makes local rendering unavailable. |
|
|
|
Remote rendering sends generated PlantUML source to that service. |
Use local rendering for confidential diagrams or record the allowed host in project policy. |
|
|
It does not read |
Exit status reports backend availability only. |
|
|
Headless environments skip viewer launch unless |
Rendering success is separate from viewer-launch success. |
|
Pair with |
Do not use it in CI unless a GUI opener is intentionally available. |
Failure changes a non-fatal GUI skip into a command error after rendering. |
Failure taxonomy
Area |
Example cause |
Typical signal |
First fix |
|---|---|---|---|
Input file |
File path does not exist or cannot be read. |
Non-zero exit with a Click error or Python parse/read error. |
Check the path and working directory. |
DSL syntax |
Invalid FCSTM grammar. |
Grammar parse diagnostics with source location. |
Run |
Model import |
Duplicate state names, invalid transitions, unresolved refs, or invalid declarations. |
Model validation diagnostics. |
Fix semantic issues in the DSL before rendering/generation. |
Simulator command layer |
Unknown batch command or event name after the model has loaded. |
Transcript-level failure on standard output; batch mode currently exits with status |
Fix the simulator command script and do not rely on exit status alone for these failures. |
Output path |
Permission denied, suffix mismatch, or unsafe |
Non-zero exit before or during file write. |
Use a writable path and align |
Template rendering |
Missing template, bad |
Non-zero |
Prefer built-in |
Verify policy |
|
Policy error before model parsing. |
Keep automatic inspect checks within structural/linear budgets. |
Renderer backend |
Missing |
|
Configure local rendering or use an allowed remote renderer. |