Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Toolchain and CLI

Installed tools

The checked-in Rust toolchain pin is Rust 1.98.0. Cargo uses the workspace lockfile and the CLI package is formasl-cli, whose executable is named formasl.

cargo build -p formasl-cli --locked
./target/debug/formasl --version
./target/debug/formasl --help

Use the debug path while developing, or build the same binary with cargo build --release -p formasl-cli --locked and use ./target/release/formasl. The command-line interface has four source verbs — check, inspect, run, and realize — plus the analysis facade analyze, the application host verb serve (see Serving a FormaSL application), and the project verbs test and package (seal/verify/source-rebind/source-new), documented in Projects, packages and the release store.

The ordinary user workflow needs Rust and Cargo. The repository’s Agda formalization is a separate toolchain: formal/toolchain.env pins Agda 2.8.0 and Agda stdlib 2.4. It is not required to check or run a .fsl file.

Command forms

File mode (explicit .fsl operands):

formasl check SOURCE.fsl... [--format text|json] [--schema-revision 0|1]
formasl inspect SOURCE.fsl... --view VIEW [--format text|json] [--schema-revision 0|1]
formasl run SOURCE.fsl... --gas N [--app NAME] [--for PLAN.fsp]
            [--format text|json] [--schema-revision 0|1]
formasl realize SOURCE.fsl... --for PLAN.fsp [--format text|json]
                [--schema-revision 0|1]
formasl analyze SOURCE.fsl... --app NAME --gas N [--format text|json]
                [--schema-revision 0|1]

Project mode (zero .fsl operands; resolved from forma.toml/forma.lock):

formasl check   [--manifest-path PATH] [--target NAME] [--root MODULE[@sel]] [--package]
                [--locked | --offline | --frozen]
formasl inspect [--manifest-path PATH] --view VIEW [--target NAME] [--root MODULE[@sel]]
formasl run     [--manifest-path PATH] --gas N [--app NAME] [--target NAME] [--root MODULE[@sel]]
formasl realize [--manifest-path PATH] --for PLAN.fsp [--target NAME] [--root MODULE[@sel]]
formasl test FILTER... --receipt PATH [--manifest-path PATH] [--locked|--offline|--frozen]
formasl package seal [--manifest-path PATH] [--locked|--offline|--frozen]
formasl package verify <sealed-release-dir>
formasl package source-rebind --reference <urn> --path <path>
formasl package source-new --path <path>

The project-mode forms are specified in Projects, packages and the release store.

All .fsl source operands are explicit. When a module imports another module, pass both sources on the same command line; the CLI does not resolve an import by searching the directory. realize requires exactly one .fsp plan. run may receive a plan with --for so that the same checked binding is carried into the run.

Option applicability

OptionApplies toMeaning
`–format textjson`file-mode verbs
`–schema-revision 01`JSON rendering
--viewinspect onlyone of summary, declarations, claims, applications, or subtypes
--gas Nrun, analyze (both required)unsigned resource budget for applicable reasoning work
--app NAMErun, analyzeselect one exact application or composition name
--for PLAN.fsprun, realizerealization plan; mandatory for realize
--manifest-path PATHproject modeselect the package manifest at exactly that path
--target NAME / --root M[@sel]project modeoverride the default subject/root selection
--packagecheck onlycheck the whole active package (completeness), not the default target
--locked / --offline / --frozenproject modelock-fidelity and offline resolution discipline
--port Nserve onlyloopback port for the application host (default: OS-assigned)

Options do not silently fall through to another verb. For example, --gas on check, --view on run, and project flags on serve are usage errors. Explicit .fsl operands and project flags are mutually exclusive (PROJECT_MODE_CONFLICT, exit 2); test operands are case filters, never file operands. --store and --ledger are not part of the v0.1 contract and always reject. The human-readable renderer is called text.

inspect does report a composition count in its summary, but compositions is not an inspect-view selector. The valid selectors are the five names in the table above:

$ formasl inspect examples/hello.fsl --view compositions
usage: unknown view `compositions`

Inputs, source sets, and selectors

Every source operand is an explicitly named UTF-8 .fsl unit. A single operand may not satisfy an import merely because the imported file sits beside it; provide the complete import closure as additional operands. For example:

./target/debug/formasl check \
  examples/F06-dag-composition-realization/artifact-model.fsl \
  examples/F06-dag-composition-realization/canonical.fsl

The driver captures each supplied file once and retains the caller’s exact path string as the operational source reference. It does not normalize that path into a module identity, select a “latest” revision, or fetch/import missing modules.

--app NAME selects one checked application or composition by exact name. Without it, run selects all run-addressable applications and compositions in the checked program. Use inspect --view applications to obtain application names; a composition is selected by its declared name even though the current inspect view has no separate compositions selector.

realize needs exactly one --for PLAN.fsp. run may take one --for plan as an optional binding input. The plan is admitted before the selected application runs; a successful binding is not an instruction to invoke the named external capability.

--schema-revision is valid only together with --format json; a revision selector with text output is a usage error. The only accepted revisions are 0 and 1. help and version take no source operands or operation options.

Text and JSON results

Text output is for an interactive terminal. JSON output is the machine surface:

./target/debug/formasl check examples/hello.fsl --format json --schema-revision 1

The machine output is a canonical formasl.machine envelope with an operation, subject, outcome, schema version, and schema revision. Revision 0 remains available for the frozen projection but fails closed — with the driver exit class (3) and a projection-refusal diagnostic — when a run outcome belongs to a family it cannot represent. A JSON consumer should request revision 1 deliberately and validate the returned envelope rather than parsing text output.

Exit behavior

ExitMeaning
0accepted check/inspect/realize result, a run aggregate of COMPLETE, a passing test suite, or a completed package operation
1semantic/product rejection, including a rejected run aggregate or a test mismatch
2invalid command, operand, option, option combination, option value, or invalid test/filter
3driver failure such as source/plan I/O, UTF-8/input handling, receipt write failure, or a failed machine projection
4a selected run aggregate is UNSUPPORTED
5a selected run aggregate is RESOURCE_EXHAUSTED

In the CLI vocabulary, exit 0 is a completed public operation, exit 1 is a rejection, exit 2 is a usage error, exit 3 is a driver error, exit 4 is unsupported execution, and exit 5 is resource exhaustion.

The aggregate precedence is REJECTED > RESOURCE_EXHAUSTED > UNSUPPORTED

COMPLETE. Read the output diagnostic or structured application result; an exit value is a coarse category, not a replacement for it.

A deliberate option error is useful for checking the installed binary:

$ formasl check examples/hello.fsl --format pretty
usage: --format must be text or json

It must exit with status 2; use --format text instead.

Runtime selection and realization

run evaluates every selected application unless --app NAME selects a single one. It requires --gas N even when the selected application ultimately does not consume gas, because the command boundary does not invent a default budget. For an R1/R2/R3 inference, insufficient gas is an outcome, not a successful partial answer.

realize validates a plan against the checked program and reports bindings. The plan must identify existing application targets and valid requirements. Successful binding does not perform the external action named by a plan.

See Getting started for known-good local commands, Errors and exits for recovery, and Support and limitations for the semantic boundary.