feat(headless): add --output=json to opencli run + JSON schema contract eval#239
feat(headless): add --output=json to opencli run + JSON schema contract eval#239zjshen14 wants to merge 1 commit into
Conversation
…ct eval Implements the headless --output=json sub-item of D2 (#234): - src/cli/json-output.ts: defines JsonOutputEvent (stable public schema) and toJsonLine() which serialises every AgentEvent to a newline-terminated JSON line, stripping the provider-internal thoughtSignature from tool_call. - src/cli/index.ts: adds --output <text|json> to opencli run; in json mode every AgentEvent is written as an NDJSON line to stdout instead of the human-readable text rendering. - src/eval/headless/json-schema.test.ts: contract eval with 33 tests asserting parseable JSON, newline termination, required fields per event type, thoughtSignature exclusion, and exhaustive schema coverage. Part of #234 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Review: feat(headless): add --output=json to opencli run + JSON schema contract evalWhat's good: Clean, well-layered addition. Notes1. Text mode writes 2.
Recommendation: Merge. Generated by Claude Code |
Review: feat(headless): add --output=json to opencli runWhat's good: Clean, well-bounded feature. Notes1. The manual 2. In JSON mode all events — including Recommendation: Merge. Note 2 is a docs gap, not a correctness issue. Both notes are optional improvements. Generated by Claude Code |
Summary
--output <text|json>flag toopencli run; injsonmode everyAgentEventis written as a newline-terminated JSON line (NDJSON) to stdout instead of the human-readable text renderingsrc/cli/json-output.tswith the stableJsonOutputEventtype (the public schema) andtoJsonLine()which converts anyAgentEvent→ JSON line, explicitly stripping the provider-internalthoughtSignaturefromtool_calleventssrc/eval/headless/json-schema.test.ts— 33 contract-eval tests asserting parseable NDJSON, newline termination, required fields per event type,thoughtSignatureexclusion, and exhaustive schema coverage across all 7AgentEventtypesRelated issue
Part of #234 (D2 follow-up: headless
--output=jsoncontract eval sub-item)Test plan
npm run typecheck && npm run lint && npm run format:check && npm test— all pass (742 tests, 33 new)toJsonLine()unit-tested for all 7AgentEventtypesthoughtSignaturestripping verified in contract evalAgentEventtype is added without updating the evalhttps://claude.ai/code/session_01TakF9J9FMjjQd6okE7kczu
Generated by Claude Code