Skip to content

Command line

After this chapter you can choose commands and interpret their exit status. Run examples from the checkout root.

rastok --help | -h | help
rastok --version | -V | version

Help 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.

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.

rastok check <file.rkg>...
Terminal window
rastok check examples/echo.rkg

Checks 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.

rastok simulate <file.rkg>... [--deployment <profile.json>] [--compare <dir> | --save <dir>] [--ui [--ui-port <port>]]
Terminal window
rastok simulate examples/echo.rkg --compare examples/traces/echo

Simulation 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.

  • --compare reports each scenario’s first difference from reviewed traces. Missing references fail.
  • --save creates 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.
  • --deployment supplies 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.

rastok run <file.rkg>... [--file-root <dir>] [--deployment <profile.json>] [--json-logs] [--record <file.rkr>]
Terminal window
printf 'hello\n' | rastok run examples/echo.rkg --record echo.rkr

Each 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-root enables the physical File Driver within an explicit root.
  • --deployment reads 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-logs exports 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.
  • --record writes 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.

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.

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.

  • 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.

  • .rkg: program and Lab source.
  • .rkp: compiled plan package.
  • .rkc: causal reference for simulate --compare.
  • .rkr: execution recording for replay, without repeating external effects.

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.

Diagram