After this chapter you can choose commands and interpret their exit status. Run examples from the checkout root.
Help and version
Section titled “Help and version”rastok --help | -h | helprastok --version | -V | versionHelp prints to stdout and exits successfully.
rastok --version, rastok -V and rastok version print the same package version. Global help and version reject extra
arguments. rastok <command> --help prints that command’s usage and options on
stdout and exits successfully; -h is the same.
Run rastok <command> --help for the options of one command.
Brackets mean optional, | separates alternatives, and ... accepts multiple
files in one compilation unit.
Create a program: new
Section titled “Create a program: new”rastok new <name>rastok new hello creates hello.rkg: an App, a typed Operator and a Lab
scenario. Names exclude paths and extensions. Existing files are never
overwritten; follow-up commands are printed, not executed.
Check a program: check
Section titled “Check a program: check”rastok check <file.rkg>...rastok check examples/echo.rkgChecks types, wiring and Contracts, then prints the Node count and semantic hash. It neither executes the App nor writes a plan file. Success does not prove partner availability or compatible physical Drivers.
Run scenarios: simulate
Section titled “Run scenarios: simulate”rastok simulate <file.rkg>... [--deployment <profile.json>] [--compare <dir> | --save <dir>] [--ui [--ui-port <port>]]rastok simulate examples/echo.rkg --compare examples/traces/echoSimulation uses mocks and virtual time, not physical Drivers. Without --ui,
it prints each scenario’s PASS or FAIL, simulation.scenario, then totals.
Direct scenarios use their Lab’s name.
A unit without a Lab refuses.
--comparereports each scenario’s first difference from reviewed traces. Missing references fail.--savecreates or replaces reference files named<simulation>.<scenario>.rkc. Review the semantic reason for the change; saving is not proof that expectations pass.- These options are exclusive. Neither selected: check expectations without reading or writing reference traces.
--deploymentsupplies the graph’s boot values and attestations even with mocks.
--ui requires hosted-ui, prints a token-bearing loopback URL and starts
paused. --ui-port requires --ui and selects a nonzero TCP port;
otherwise the OS chooses one.
Execute the App: run
Section titled “Execute the App: run”rastok run <file.rkg>... [--file-root <dir>] [--deployment <profile.json>] [--json-logs] [--record <file.rkr>]printf 'hello\n' | rastok run examples/echo.rkg --record echo.rkrEach stdin line enters app.in as a string, selecting the exact string branch
of a union. Stdin does not decode JSON. An incompatible port and its type
are reported before stdin is read. Drivers perform real I/O; the Lab does not run.
A string prints bare. Any other value prints as one line of JSON, the
same projection the Lab uses in its reports. Protected fields remain redacted.
Raw payloads without a materialized value retain their byte-to-text rendering.
With several declared output ports, every line keeps its port: value prefix.
After EOF, run waits for open Calls and Sessions, not deadlines alone.
An HttpServer keeps listening; read listen in the source.
Ctrl-C stops it without a message.
--file-rootenables the physical File Driver within an explicit root.--deploymentreads typed boot settings, secret coordinates, attestations and any Driver selection from a deployment JSON file. Secret material is supplied out of band, never as a CLI argument.--json-logsexports structured events on stderr; outputs stay on stdout. The bounded exporter can drop observations; these logs are not a complete journal. Other diagnostics use stderr.--recordwrites a diagnostic recording and refuses an existing path. Personal-data plans, nonempty deployment attestations and boot-dependent Connector settings refuse. Recordings are sensitive evidence, not durable restart storage.
run --ui is not supported. Inspect a supported recording afterward instead.
Inspect a recording: replay
Section titled “Inspect a recording: replay”rastok replay <file.rkr> [--ui [--ui-port <port>]]rastok replay echo.rkr prints App outputs in run’s format on stdout and a
record-count/seal summary on stderr, without Driver I/O.
--ui uses simulation’s port rules and opens read-only recorded history.
Missing source lines are explicit. Replay needs no original source and cannot
execute the program or create a Lab scenario.
Inspect capabilities: connectors
Section titled “Inspect capabilities: connectors”rastok connectors [--json]Lists Contracts, modes, ports, settings, implementations, Lab bindings and
untested cases, as text or --json on stdout. It constructs no Driver and
probes no service; checker support does not prove deployment support.
Resolve project schemas: —resolve-open-api
Section titled “Resolve project schemas: —resolve-open-api”rastok --resolve-open-api <project-dir> [--check]This matches static HTTP endpoints to OpenAPI 3.0/3.1 documents and writes
openapi.generated.rkg types, leaving authored sources untouched. --check
writes nothing and refuses missing or stale output. Unsupported or ambiguous
schemas refuse. Generation cannot prove a live API honors its schema.
The leading double dash is required.
Exit status and streams
Section titled “Exit status and streams”0: the requested operation succeeded, including explicit help or version.1: compilation, execution, scenario, comparison or file operation failed.2: a recognized usage error, such as a missing command or invalid option combination.
Usage errors go to stderr, including a bare rastok invocation. Scenario
failure details remain in the simulation report on stdout; do not detect
success solely by whether stderr is empty.
File formats
Section titled “File formats”.rkg: program and Lab source..rkp: compiled plan package..rkc: causal reference forsimulate --compare..rkr: execution recording forreplay, without repeating external effects.
Summary
Section titled “Summary”Check, then simulate before contacting partners; save only intentional baselines.
Read the alpha limits, docs/spec/ui.md
and docs/spec/schema-projections.md §5.
Practice with Echo. Next: When the answer is lost. Previous: Privacy. Deployment: Running for real.