Summary
cdidx index --verbose writes human-readable status lines ([SKIP] foo.cs (matched filter), [DEL] bar.cs) to stdout. When the same invocation also passes --json, the JSON output is contaminated with non-JSON lines, breaking any parser on the receiving end.
Evidence
src/CodeIndex/Cli/IndexCommandRunner.cs:785, 797, 814 — Console.WriteLine(...) calls inside the verbose paths, regardless of whether options.Json is set.
Impact
cdidx index --verbose --json | jq . fails to parse.
- Agents that always pass
--json for machine consumption cannot also enable verbose status without breaking themselves.
Proposed direction
- When
options.Json is true, route verbose status lines to stderr (Console.Error.WriteLine) instead of stdout.
- Stdout becomes a clean JSON-only stream; stderr carries human-readable progress.
- Apply the same rule to any other
--json-friendly subcommand that emits verbose progress.
Repro env
- Branch:
main @ 2ee912d (release v1.21.0)
Summary
cdidx index --verbosewrites human-readable status lines ([SKIP] foo.cs (matched filter),[DEL] bar.cs) to stdout. When the same invocation also passes--json, the JSON output is contaminated with non-JSON lines, breaking any parser on the receiving end.Evidence
src/CodeIndex/Cli/IndexCommandRunner.cs:785, 797, 814—Console.WriteLine(...)calls inside the verbose paths, regardless of whetheroptions.Jsonis set.Impact
cdidx index --verbose --json | jq .fails to parse.--jsonfor machine consumption cannot also enable verbose status without breaking themselves.Proposed direction
options.Jsonis true, route verbose status lines to stderr (Console.Error.WriteLine) instead of stdout.--json-friendly subcommand that emits verbose progress.Repro env
main@ 2ee912d (release v1.21.0)