Overview
Console Overview
The Cade Console is an interactive REPL (Read-Eval-Print Loop) for debugging and testing the Cade scoring system. It provides real-time inspection of game state, expression evaluation, event triggering, and variable monitoring.
Operating Modes
The console operates in three modes, selected automatically based on terminal capabilities.
TUI Mode
The default mode when running in an interactive terminal. TUI mode provides a full Terminal User Interface with tabbed views, real-time monitoring, tab completion, command history, and color output.
cade console
cade console -d ./my-table/
The console loads every .cade file in the table directory — --table-directory (-d), defaulting to the current directory.
Pipe Mode
The console automatically detects piped input and switches to a non-interactive mode suitable for scripting and automation. Pipe mode activates when stdin is a pipe or file rather than a terminal, or when you pass --no-tui to force it even from an interactive terminal.
echo "eval 2+2" | cade console
cat <<'EOF' | cade console
set var.score 1000
eval var.score * 2
exit
EOF
cade console < my_debug_script.txt
echo "inspect score" | cade console | grep "Value:"
In pipe mode the console reads one command per line from stdin, runs each in order, and prints results to stdout. It is built for scripted debugging and automation:
- Automatic detection — no flag is needed when input is piped or redirected; the console notices stdin is not a terminal and switches modes. Use
--no-tuito force pipe mode from an interactive terminal. - One command per line — each line is a complete command. Blank lines and lines beginning with
#are ignored, so scripts can be commented. - Clean exit — end the script with
exit(orquit), or let it terminate at end-of-input (EOF). Colors are disabled so downstream tools receive plain text. - Pipeline friendly — output flushes after each command, so you can pipe results into
grep,awk, or any other tool.
Exit Codes
Pipe mode returns standard exit codes so scripts and CI jobs can detect failures:
| Exit code | Meaning |
|---|---|
0 | All commands ran; script exited cleanly (via exit, quit, or EOF) |
1 | Input error (for example, an input line that exceeds the size limit) |
2 | An unknown command was encountered — execution stops at that line |
130 | Interrupted with Ctrl+C |
# Fail a CI step if the debug script hits an error
cat checks.debug | cade console || echo "debug script failed with code $?"
Fallback Mode
When the terminal does not support the full TUI, the console falls back to basic line-editing mode. Fallback is triggered when:
- The
TERMenvironment variable is set todumb - No TTY is available (pipes, Docker without
-t, SSH without PTY) - The
CIenvironment variable istrue - The terminal does not support required capabilities
In fallback mode, basic line editing is available but cursor movement within the line, tab completion UI, color output, and Ctrl+R history search are not.
Mode Comparison
| Feature | TUI Mode | Pipe Mode | Fallback Mode |
|---|---|---|---|
| Visual panels | Yes | No | No |
| Color output | Yes | Optional | No |
| Tab completion | Yes | No | No |
| Command history | Yes | No | Stored only |
| Scriptable | No | Yes | No |
| Stdin commands | No | Yes | No |
Terminal Compatibility
Full Support
- Linux – Complete readline with all features in modern terminal emulators (Alacritty, Kitty, GNOME Terminal, Konsole)
- macOS – Full support in Terminal.app and iTerm2
- Windows 10+ – Full support in Windows Terminal
Platform Notes
- On Windows, use
Home/Endinstead ofCtrl+A/Ctrl+EandCtrl+Left/Ctrl+Rightfor word navigation. - On macOS, Meta key combinations may conflict with system shortcuts.
Launching the Console
# Load the .cade files in the current directory
cade console
# Load a specific table directory
cade console -d ./my-table/
# Start the scoring engine immediately on launch
cade console --start
# Force pipe mode (disable the TUI)
cade console --no-tui
Flags
| Flag | Default | Description |
|---|---|---|
--table-directory, -d | current directory | Directory containing the .cade table files |
--start | false | Start the scoring engine automatically on launch |
--no-tui | false | Run in pipe mode, reading commands from stdin |
--theme | dark | Color theme |
--console-config | — | Path to a console config file (.hcl) |
--no-audio | false | Disable the audio subsystem — useful when headless or on WSL |
--replay | — | Load an exported replay JSON file to review recorded cascades |
--scenario | — | Play a .cade.test scenario into the live event tree |
--autoplay | false | Drive synthetic switch activity for a hands-free demo |
--autoplay-speed | 70ms | Tick interval for the autoplay driver |
--autoplay-ball-time | 15s | Minimum time each autoplay ball stays in play |
--pprof | — | Serve Go profiling endpoints on the given address |
Connecting to a platform such as Visual Pinball uses the gRPC flags:
| Flag | Default | Description |
|---|---|---|
--grpc | false | Start a gRPC event service for the loaded table |
--grpc-host | 0.0.0.0 | Bind address |
--grpc-port | 50051 | Port |
--grpc-platform | — | Platform address to connect out to (e.g. localhost:50052) |
--grpc-platform-debug-log | — | Debug log file for platform stream diagnostics |
Note: The global
--configflag points at Cade’s own runtime config file, not at a table. Use-dto choose a table directory, or theloadcommand once the console is running.
Once launched, the console displays the prompt:
cade:debug>Type help for available commands or press Tab for completions.