CLI Reference
CLI Reference
Everything you do with Cade goes through the cade command. This page is the reference for its subcommands and the flags that matter day to day. Every command also has built-in help:
cade --help # list all commands
cade <command> --help # flags and usage for one command
Global flags
These apply to every command:
| Flag | Default | Meaning |
|---|---|---|
-d, --table-directory | current directory | Directory containing your .cade table files |
--config | ./cade.conf, then ~/.config/cade/cade.conf | Path to the runtime config file |
Configuration precedence
Most settings can come from more than one place. Cade resolves them in this order (highest first):
- A command-line flag
- An environment variable —
CADE_plus the setting path in caps with_for.(e.g.CADE_WEB_ENABLED,CADE_LOGGING_LEVEL) - The
cade.conffile (HCL) - The built-in default
A few settings have no flag and are set only via cade.conf or the environment — for example game.max_players, game.balls_per_game, and game.credits_per_player.
Everyday commands
cade — run a table
Run with no subcommand to start the runtime. Cade loads the table, wires devices, scoring, modes, and event handlers, optionally starts the web server, and runs until you stop it (Ctrl-C).
cade -d ./my-table # run the table in ./my-table
cade -d ./my-table -w # also start the web server
With no platform block configured, Cade auto-starts a one-player headless game (handy for CI). With a platform block present, it waits for the hardware start button. Hardware and simulator connections are configured with platform "grpc" { … } blocks in your config, not with flags — see Drivers.
| Flag | Default | Meaning |
|---|---|---|
-r, --recursive | false | Search subdirectories for .cade files |
-w, --web-server | false | Enable the health/debug web server |
--web-host | localhost | Web server bind address |
--web-port | 8080 | Web server port |
--health-enabled | true | Health-monitoring endpoints |
--debug-enabled | false | Debug/visualization endpoints |
--web-logging | false | Web server access logging |
--log-level | info | debug, info, warn, or error |
--log-format | text | text or json |
cade console — interactive console
Open the interactive TUI for debugging a live table — evaluate expressions, trigger events, inspect state, and watch event cascades. When stdin isn’t a terminal (or with --no-tui), it runs in scriptable pipe mode. See Console for the in-console commands and shortcuts.
cade console -d ./my-table
cade console -d ./my-table --start --autoplay # hands-free demo
| Flag | Default | Meaning |
|---|---|---|
--theme | dark | Color theme: dark, light, nord |
--start | false | Start the engine on launch |
--watch | true | Show the watch panel on startup |
--no-tui | false | Pipe mode — read commands from stdin, no TUI |
--no-audio | false | Disable the audio subsystem (useful headless/WSL) |
--autoplay | false | Drive synthetic switch activity (demo mode) |
--autoplay-speed | 70ms | Tick interval for --autoplay |
--autoplay-ball-time | 15s | Minimum time each --autoplay ball plays |
--replay | — | Load an exported session JSON into the console |
--scenario | — | Play a .cade.test file into the live event tree |
--console-config | — | Path to a console config file |
To drive the console from a simulator such as Visual Pinball X, use the gRPC flags (--grpc, --grpc-platform <addr>, --grpc-host, --grpc-port); --grpc-platform implies --grpc. See Visual Pinball and Migrating from Visual Pinball.
cade validate — check a config
Validate HCL syntax, required fields, types, references, circular dependencies, and variable formulas before you run.
cade validate # validate the current directory
cade validate my-table.cade # validate one file
cade validate --strict --dir ./tables -r
cade validate --include-file-org # add advisory file-organization hints
| Flag | Default | Meaning |
|---|---|---|
-s, --strict | false | Strict mode (also enables reserved-word checks) |
-f, --format | text | text, json, or yaml |
--no-color | false | Disable colored output |
--show-graph | false | Print the dependency graph |
--performance | false | Include performance analysis |
--pragma-mode | — | Override pragma mode: strict, normal, relaxed |
--ignore-pragma | false | Ignore the pragma block |
--check-reserved-words | false | Check identifiers against reserved keywords |
--dir | — | Directory to validate (takes precedence over the positional arg) |
-r, --recursive | false | Recurse into subdirectories (directory targets only) |
--include-file-org | false | Add advisory file-organization lint warnings (opt-in) |
File-organization hints
With --include-file-org, validation also runs an advisory linter that suggests
how to lay out device, module, and variable blocks across files. Its
findings are warnings only — they include a file:line and a suggestion, and
they never make validation fail. They appear in text output and in the
json/yaml formats alongside the other warnings. The linter flags:
- a
deviceblock in a file undermodules/ - a
moduleblock in a file underdevices/ - a file that mixes
deviceandmoduleblocks - a top-level
variabledeclared alongsidemoduleblocks - a file longer than the recommended 500 lines
⚠ device block in a file under modules/ (modules/playfield.cade:12)
→ Move device definitions to devices/ or the config root
To silence these hints, add them to disable_checks in the file’s pragma
block — disable_checks = ["file_organization"] turns the whole linter off for
that file, or list an individual rule (such as "device_in_module_dir") to
suppress just one.
cade scenario run — run tests
Run scenario tests (.cade.test files) against the real scoring engine. See Testing & Scenarios for writing them.
cade scenario run my-table.cade.test
cade scenario run ./tests -r --strict
| Flag | Default | Meaning |
|---|---|---|
-f, --format | text | text, json, or yaml |
-o, --output | stdout | Write results to a file |
-s, --strict | false | Fail on any error (implies --fail-on-error) |
--fail-on-error | false | Stop on the first error |
-p, --performance | false | Track performance |
-e, --event-spacing | 10ms | Time between events |
-t, --timing-mode | discrete | discrete (fast), wallclock (real-time), accelerated |
-r, --recursive | false | Run every scenario in a directory |
--scoring-config | — | Scoring config (.cade) to test against |
cade version
Print the version, git commit, build time, Go version, and platform.
cade version
Configuration & migration
cade migrate — fix reserved-word conflicts
Find (and optionally rewrite) identifiers that collide with Cade’s reserved keywords. Without --auto-fix it’s a dry run that reports conflicts and exits non-zero — useful as a CI gate. With --auto-fix it rewrites identifiers and leaves .bak backups. See Reserved Keyword Validation.
cade migrate --reserved-words # dry run, report conflicts
cade migrate --reserved-words --auto-fix # apply fixes (+ .bak backups)
| Flag | Default | Meaning |
|---|---|---|
--reserved-words | false | Scan for reserved-keyword conflicts (required to do anything) |
--auto-fix | false | Apply fixes and write .bak backups |
--format | text | text or json |
--dir | — | Directory to migrate |
-r, --recursive | false | Recurse into subdirectories |
--pragma-mode | normal | Severity: strict, normal, relaxed |
cade pragma — inspect and migrate pragma modes
cade pragma analyze # show effective pragma settings
cade pragma migrate my-table.cade --target-mode strict # preview
cade pragma migrate my-table.cade --target-mode strict --apply # write
cade pragma analyze [config-file]— show the effective pragma settings and their impact (--format text|json).cade pragma migrate <config-file> --target-mode <mode>— preview a move betweenstrict/normal/relaxed; add--applyto write it.
Diagnostics
The diag subcommands inspect a config without running it. Each takes an optional [config-file] (default: current directory) and supports --format and --no-color.
| Command | What it shows |
|---|---|
cade diag deps | Variable dependency graph (--format text|dot|d2|json, --variable, --depth) |
cade diag cycles | Circular dependencies in variable formulas (--max-depth) |
cade diag perf | Performance impact of scoring (--threshold <ms>) |
cade diag vars | Variables with properties and dependencies (--scope game|player|ball, --computed-only) |
cade diag stats | Configuration statistics |
cade diag deps --variable jackpot_value --format d2
cade diag perf --threshold 0.5
cade analyze [config-file] gives a combined validation-and-best-practice report (--verbose, --format, --no-suggestions, --ignore <pattern>).
History & replay
Cade can record game sessions and turn them into replays or scenario tests.
cade history list # list recorded sessions
cade history export --latest -o session.json # export the most recent
cade replay tree session.json # print its event tree
cade replay to-scenario session.json --with-expectations -o regression.cade.test
cade history list— list recorded sessions (--limit,--format table|ids,--db <path>).cade history export— export a session to JSON or event-stream (--session <id>or--latest,--output,--format json|event-stream).cade replay to-scenario <file.json>— convert a replay into a.cade.test(--output/-o,--ball,--scoring-only,--with-expectations).cade replay analyze <file.json>— summary report (--format text|json,--ball <n>); exits non-zero on error-level anomalies (CI gate).cade replay tree <file.json>— print the event tree, the plain-text mirror of the console’s event viewer (--ball <n>).
Most commands accept
--format json(and several addyaml) for piping into other tools.