feat(cli): live-capture subcommand — studio capture (--ndjson) (closes #57)#65
Merged
Conversation
Wires the S5 flagship proxy into the headless CLI as `studio capture` — the
second face's live command.
- maybeRun dispatches `capture`; cmdCapture parses --listen host:port /
--upstream ws://host:port / --ndjson, resolves the addresses, and calls
proxy.run(io, ..., .{ .wall = init.io }) for one CP<->CSMS session.
- --ndjson streams each captured event as a JSONL line to stdout (redirect to
save a trace); otherwise a one-line summary is printed. The Sink now flushes
each record so the stream is live (a no-op for the fixed-buffer test writers).
- A pure parseCaptureArgs (unit-tested) does the parsing; wss:// is rejected
(TLS is post-0.5), IP addresses only for now (hostname resolution deferred).
- docs/cli-parity.md gains the Studio-only `capture` row + notes.
Wiring run() into the CLI also brings its socket path into the app build's
analysis (it was previously test-only). Verified on the built binary: usage /
error / help paths, no regression on existing commands, and run() binds its
listen socket and waits on accept.
Closes #57.
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.
Closes #57. Wires the S5 flagship proxy into the headless CLI — the terminal face of live capture.
What's here
studio capture --listen H:P --upstream ws://H:P [--ndjson]maybeRungainscapture;cmdCaptureparses the flags, resolves the addresses, and callsproxy.run(io, …, .{ .wall = init.io })for one CP↔CSMS session. TheTimeSource.wallpath built in feat(capture): MITM proxy — streaming detection + record-to-trace #56 drops straight in.--ndjsonstreams each captured event as a JSONL line to stdout as it arrives (studio capture … --ndjson > session.jsonlsaves the trace — consistent with the CLI's stdout-only house style). Without it, a one-line summary is printed. TheSinknow flushes each record so the stream is genuinely live (a no-op for the fixed-buffer writers in tests).parseCaptureArgs(unit-tested) handles parsing;wss://is rejected (TLS is post-0.5, ADR-0008); IP addresses only for now (hostname resolution deferred).docs/cli-parity.mdgains the Studio-onlycapturerow + notes (the toolkit is offline by charter).Verification
native test -Dplatform=null→ 152/152 (2 new arg-parser tests).native build(ReleaseFast) → clean. Wiringrun()into the CLI brings its socket path into the app build's analysis (it was test-only before) — sonative buildnow compiles it too.zig fmt --checkclean.missing --listen→ exit 2,wss://rejected, etc.), no regression on existing commands (studio ci→ exit 0), andstudio capture --listen 127.0.0.1:38765 …binds and waits on accept (run() starts correctly).Coverage note (honest)
The relay core (
relayStreams: handshake + concurrent pump + record + detect) is proven end-to-end by #56's in-memory integration test;run()'s thin socket glue is compiled and shown to bind/wait on the real binary. A full live CP↔proxy↔CSMS socket smoke needs a real CP/CSMS harness — a reasonable follow-up (the CP-sim / CSMS-mock are post-0.5 anyway).Deferred (noted in cli-parity.md)
wss://(TLS, post-0.5), hostname resolution (IPs for now), single session per invocation.