feat(cli): give every preview lifecycle op one JSON document - #3309
Draft
miguel-heygen wants to merge 1 commit into
Draft
feat(cli): give every preview lifecycle op one JSON document#3309miguel-heygen wants to merge 1 commit into
miguel-heygen wants to merge 1 commit into
Conversation
miguel-heygen
force-pushed
the
cli-preview-session-ownership
branch
from
August 18, 2026 05:24
d982ef5 to
f68c19a
Compare
`--status`, `--stop`, `--list` and `--kill-all` emit a schema-versioned envelope with an `ok` discriminant under `--json`, from one writer and one failure-payload builder. Human output is unchanged; the JSON path is additive. The value is in the failure paths. An agent that gets a bare error line on stderr and an empty stdout cannot tell a crash from a "not running", so every failure is a document too — including a missing project, which under `--json` resolves through the throwing resolver rather than the human-shaped nudge.
miguel-heygen
force-pushed
the
cli-preview-json-lifecycle
branch
from
August 18, 2026 05:26
3a42f81 to
eea3af8
Compare
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.
--status,--stop,--listand--kill-allemit a schema-versioned envelope with anokdiscriminant under--json, from one writer and one failure-payload builder. Human output is unchanged; the JSON path is additive.{"schemaVersion":1,"operation":"status","ok":true,"result":{"state":"running","mode":"background","port":3002,"pid":1234,...}} {"schemaVersion":1,"operation":"stop","ok":false,"error":{"code":"preview-stop-failed","message":"..."}}Why the failure paths are the point
An agent that gets a bare error line on stderr and an empty stdout cannot tell a crash from a "not running". Every failure is a document too — including a missing project, which under
--jsonresolves through the throwing resolver rather than the human-shaped nudge.Verifying
Start a background preview, then run each of
--status,--list,--stopwith--jsonand pipe stdout through a JSON parser: one document each, with the matchingoperationandstate.Stack
Based on
u4b-preview-session-ownership. Retarget tomainbefore merging.