Guide: Building CLI apps
X07 is intended to make it easy for agents to build robust command-line tools.
Canonical approach
- Define your CLI spec using
std.cli(or an external CLI spec package). - Parse
argvvia the OS adapter (inrun-os/run-os-sandboxed). - Keep business logic pure so it can be tested in fixture worlds.
Recommended layout
myapp.cli— CLI spec + parsingmyapp.core— pure logicmyapp.adapters— OS I/O (fs/net/db)myapp.main— thin wiring
Deterministic tests
Even for CLI apps, keep tests deterministic:
- feed mocked argv bytes
- run in
solve-pureor fixture worlds - assert exact output bytes
Then separately smoke-test in OS world.