feat(cli): headless CLI subcommands + parity table#52
Merged
Conversation
Add src/cli.zig: the Studio binary's second face. maybeRun dispatches on argv and, for a known subcommand, runs it and exits before any window opens (called from main before runWithOptions — no runner eject needed, per the spike). A bare trace path still opens the GUI. Subcommands mirror the toolkit CLI: inspect, report (markdown/html), diff (text/json), anonymize, ci (exit 0/1), and scenario (list / run) — thin glue over the already-built pure engines. The render core is pure (bytes in, bytes out) and unit-tested with fixtures; the argv / init.io / stdout shell is thin. Refactor conformance/harness.zig to expose a callable runAll / runNamed / scenarioNames (shared by the conformance test and the ci/scenario commands). Document parity and the intentional differences (stdout-only, embedded-contract ci) in docs/cli-parity.md. Closes #45.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
feat(cli): the headless CLI (S4 #45) — the Studio binary's second face.Closes #45 and completes S4.
Changes
src/cli.zig—maybeRun(init)dispatches on argv; a known subcommand runsand returns an exit code, and
mainexits before opening a window (a bare tracepath opens the GUI). Subcommands mirror the toolkit CLI:
inspect <file>— counts + failures summary.report <file> [-f markdown|html]— report to stdout.diff <a> <b> [--format text|json]— trace diff.anonymize <file>— anonymized JSON to stdout.ci— run the vendored conformance scenarios; exit 0 (all pass) / 1.scenario list/scenario run <name>.render*(bytes) → bytesare pure and unit-tested withfixtures; the argv /
init.io/ stdout shell is thin.conformance/harness.zigrefactored to exposerunAll/runNamed/scenarioNames(shared by the conformance test andci/scenario).main.zig—if (cli.maybeRun(init)) |code| std.process.exit(code);beforeany GUI setup.
docs/cli-parity.md— the parity table + intentional differences.Intentional differences (documented)
-o <file>yet (redirect:studio report t.json > out.md).ciruns the embedded contract, not a user directory (Studio vendors the15
contract-v1scenarios).Verification
native test -Dplatform=null→ 123/123;native check --strictclean;zig fmtclean.native build(ReleaseFast) succeeds, and I ran the binary end-to-end:studio ci→ 15× PASS, exit 0;inspect/report/diff(text + json) /anonymize/scenario list|runall correct; error paths exit 1 (bad file) /2 (bad usage). Both
testandbuildpass — the full app path is analyzed,not just the Debug test build.
Note
Real wall-clock replay auto-play stays deferred to #33 (no runner timer effect) —
a replay-UI concern, not a CLI one.