Uh oh!
There was an error while loading. Please reload this page.
feat(cmd): add JSON result envelope on stdout for up/build/exec - #199
Conversation
Emit a structured JSON envelope matching the official devcontainer CLI format after successful command execution. The `up` and `build` commands write to stdout; `exec` writes to stderr since stdout belongs to the executed command's output.
✅ Deploy Preview for devsydev canceled.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe PR introduces standardized JSON output envelopes for structured success and error responses across multiple CLI commands. A new ChangesJSON Output Envelope System
Sequence DiagramsequenceDiagram
participant User
participant Command as Build/Exec/Up Command
participant Executor as Execution Handler
participant Envelope as JSON Envelope Writer
participant Output as os.Stdout/stderr
User->>Command: Execute command with args
Command->>Executor: Execute (BuildAgent, execInContainer, etc.)
alt Execution succeeds
Executor-->>Command: result, nil
Command->>Command: Extract containerID, user, workdir
Command->>Envelope: WriteResultJSON(output, containerID, user, workdir)
Envelope->>Envelope: Marshal ResultEnvelope{Outcome: "success", ...}
Envelope->>Output: Write JSON + newline
Envelope-->>Command: nil
Command-->>User: success
else Execution fails
Executor-->>Command: nil, error
Command->>Envelope: WriteErrorJSON(output, error.Error())
Envelope->>Envelope: Marshal ErrorEnvelope{Outcome: "error", Message: msg}
Envelope->>Output: Write JSON + newline
Envelope-->>Command: error
Command-->>User: error
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
Move WriteResultJSON in up command to after configureWorkspace and openIDE succeed, preventing contradictory success output on non-zero exit. Add error envelopes for configureWorkspace and openIDE failures.
Uh oh!
There was an error while loading. Please reload this page.
Summary
Adds structured JSON result output to
up,build, andexeccommands matching the official devcontainer CLI envelope format ({"outcome":"success","containerId":"...","remoteUser":"...","remoteWorkspaceFolder":"..."}).upandbuildemit the envelope to stdout on success (error envelope on failure)execemits to stderr since stdout is reserved for the executed command's outputSummary by CodeRabbit
Release Notes
New Features
Tests