feat/clawctl json - #69
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 18, 2026, 12:35 AM ET / 04:35 UTC (Revision 5). ClawSweeper reviewWhat this changesAdds opt-in, versioned JSON output for clawctl management commands, including structured failures, color suppression, documentation, and regression coverage. Merge readiness✅ Ready for maintainer review The JSON capability remains absent from main and the latest release. All five earlier findings are addressed, and no new blocking defect was found. Likely related people: paulcam206 (high-confidence routing from prior merged launcher work). Priority: P2 Review scores
Verification
How this fits togetherclawctl manages the Windows package’s isolated session, runtime, gateway, and diagnostics. This change converts management results into JSON for scripts while preserving the existing human output by default. flowchart TD
A[Management command] --> B[Parse output option]
B --> C[Existing session and gateway operations]
C --> D[Command result]
D --> E{JSON requested?}
E --> F[Versioned JSON on stdout]
E --> G[Human-readable output]
D --> H[Existing exit code]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Keep machine output as an opt-in, versioned projection of existing command results, with human presentation and lifecycle behavior preserved. Do we have a high-confidence way to reproduce the issue? Not applicable: this adds an output mode rather than reporting an existing-behavior bug; source inspection confirms main lacks that mode. Is this the best way to solve the issue? Yes. Reusing semantic command results with explicit, source-generated DTOs is a focused approach that separates the machine contract from human formatting and supports NativeAOT. AGENTS.md: not found in the target repository. Codex review notes: model internal, reasoning medium; reviewed against b904c90c1439. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
a6f47a4 to
a5bbc3e
Compare
a5bbc3e to
ceb7b20
Compare
clawctl reported readiness only as prose, so a script had to parse human
output that this stack had just rewritten. Scripts need a contract that can
change independently of how the text reads.
Add --json to every non-interactive command.
- Emit a versioned document: success is {"ok": true, "schemaVersion": 1, ...}
and failure is {"ok": false, "schemaVersion": 1, "error": {...}}, so a
caller can branch before it knows the command.
- Project explicit DTOs instead of serialising internal records, which keeps
the published contract separate from runtime types and avoids reflection.
Serialisation is source-generated so it survives NativeAOT.
- Keep identifiers the human output deliberately omits, such as the sandbox
id, because that is exactly what automation and support need.
- Reserve stdout for the document: human diagnostics stay on stderr, exit
codes are unchanged, and JSON never carries terminal escape sequences.
- Reject clawctl pwsh --json, because the command hands the terminal to an
interactive shell and can produce no stable document.
Verified with the managed suite, static analysis, and a NativeAOT scenario
that parses the failure envelope from an ahead-of-time binary.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f472f437-3ee7-41f3-a501-81ae01590103
ceb7b20 to
95dc7ac
Compare
Impact
Adds
--jsonto every non-interactiveclawctlcommand, with one versioned document on stdout and stable nonzero exit codes for failures.Why This Change Was Made
Automation should consume a typed contract rather than parse human-oriented output. Failure documents preserve the selected command, status failures retain their state details, and teardown confirmation produces valid JSON.
Evidence
Validated at
95dc7ac:.\scripts\Test-DotNetQuality.ps1.\scripts\Test-NativeAotCli.Tests.ps1: 17 intended scenarios passedStack