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.

Think
1m
Plan
4m
Build
4m
Verify
4m

Assertion ledger

10 claims, each independently verified. Showing 8 — show all →

IDSaysMatcher
A001Completing an already-merged PR with --json produces valid JSON outputverifiedok
A002The JSON output contains the standard command envelopeverifiedok
A003The JSON output includes results with the work item slugverifiedok
A004The JSON output includes chain metadataverifiedok
A005Merging a PR with --json produces valid JSON outputverifiedok
A006The merge-succeeded JSON output contains the standard command envelopeverifiedok
A007No progress messages appear before the JSON output on the already-merged pathverifiedok
A008No progress messages appear before the JSON output on the merge-succeeded pathverifiedok

Findings 4 total

debtpackages/cli/tests/commands/work-merge.test.tsclosed
A004 meta assertion uses toBeTypeOf('object') — passes for null
obspackages/cli/tests/commands/work-merge.test.tsclosed
A009/A010 satisfied by existing tests but lack @ana tags for this contract
debtpackages/cli/src/commands/work.tsmonitor
Pull-recovery guards (2 of 5) not directly exercised by any test
obspackages/cli/src/commands/work.tsclosed
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