Fix --merge stdout pollution in --json mode
`ana work complete --merge --json <slug>` produces invalid JSON output. Progress messages ("Merging PR...", "PR merged.") and pull-recovery warnings write to stdout before the JSON envelope, breaking any consumer that pipes the output to `jq` or parses it programmatically. The fix guards these messages behind `if (!options?.json)` and adds test coverage for the `--merge --json` interaction.
verdict PASSscore 10 / 10findings 4 (0 risk · 2 debt · 2 obs)duration 2h 27mrejection cycles 0shipped May 15, 2026surface cli
Pipeline timeline
Intent to proven code in 2h 27m across Think, Plan, Build, and Verify.
Think1m
Plan4m
Build4m
Verify4m
Assertion ledger
10 claims, each independently verified. Showing 8 — show all →
| ID | Says | Matcher | |
|---|---|---|---|
| A001 | Completing an already-merged PR with --json produces valid JSON output | verified | ok |
| A002 | The JSON output contains the standard command envelope | verified | ok |
| A003 | The JSON output includes results with the work item slug | verified | ok |
| A004 | The JSON output includes chain metadata | verified | ok |
| A005 | Merging a PR with --json produces valid JSON output | verified | ok |
| A006 | The merge-succeeded JSON output contains the standard command envelope | verified | ok |
| A007 | No progress messages appear before the JSON output on the already-merged path | verified | ok |
| A008 | No progress messages appear before the JSON output on the merge-succeeded path | verified | ok |
Findings 4 total
debtpackages/cli/tests/commands/work-merge.test.ts→ closed
A004 meta assertion uses toBeTypeOf('object') — passes for null
obspackages/cli/tests/commands/work-merge.test.ts→ closed
A009/A010 satisfied by existing tests but lack @ana tags for this contract
debtpackages/cli/src/commands/work.ts→ monitor
Pull-recovery guards (2 of 5) not directly exercised by any test
obspackages/cli/src/commands/work.ts→ closed
JSON.parse on gh pr view stdout has no try/catch — malformed response crashes (pre-existing)
Integrity seal
scopesha256:585a17ff0e7aa...
contractsha256:9e1409911a63e...
plansha256:e0d438dabeeb0...
specsha256:7d95cfccbd0cf...
build-reportsha256:655dbf76c1c74...
build-datasha256:7b7fe5f4f09e1...
verify-reportsha256:bbdbe6152a1eb...
verify-datasha256:8eda1542fe2d9...
audit cmd$ ana proof audit fix-merge-json-pollution → all hashes match