Summary
Output for cdidx CLI / MCP commands is fixed: plain text (default), --json (rigid schema), and a handful of human-readable formats. There is no template / custom formatter mechanism: a user cannot say "render search results as CSV", "produce a SARIF report from unused", "format hotspots as a markdown table for a PR comment", or "emit Prometheus-style metric lines from status" without piping through jq and re-serializing. For integrators, the JSON schema is sometimes too narrow (only the documented fields) and sometimes too wide (every nullable metadata column), with no middle ground.
Where
Suggested approach
(1) Define IOutputFormatter { string Format(IReadOnlyList<object> rows, FormatterContext ctx); } with built-in implementations for json, plaintext, tsv, csv. (2) Add --format <name> CLI flag and format MCP tool argument; default remains current behaviour. (3) Allow template-based formatters via .cdidx/formatters/*.tmpl using Scriban or a similarly safe templating engine — no arbitrary code execution. (4) Discover custom formatter DLLs via the same plugin mechanism as C591. (5) Document each built-in DTO as a formatter-accessible variable schema. (6) Cross-link with #1808, C555, C591, C595.
Summary
Output for cdidx CLI / MCP commands is fixed: plain text (default),
--json(rigid schema), and a handful of human-readable formats. There is no template / custom formatter mechanism: a user cannot say "render search results as CSV", "produce a SARIF report fromunused", "format hotspots as a markdown table for a PR comment", or "emit Prometheus-style metric lines fromstatus" without piping throughjqand re-serializing. For integrators, the JSON schema is sometimes too narrow (only the documented fields) and sometimes too wide (every nullable metadata column), with no middle ground.Where
src/CodeIndex/Cli/JsonOutputContracts.cs(rigid DTO surface)src/CodeIndex/Cli/QueryCommandRunner.cs(no--format=flag)Suggested approach
(1) Define
IOutputFormatter { string Format(IReadOnlyList<object> rows, FormatterContext ctx); }with built-in implementations forjson,plaintext,tsv,csv. (2) Add--format <name>CLI flag andformatMCP tool argument; default remains current behaviour. (3) Allow template-based formatters via.cdidx/formatters/*.tmplusing Scriban or a similarly safe templating engine — no arbitrary code execution. (4) Discover custom formatter DLLs via the same plugin mechanism as C591. (5) Document each built-in DTO as a formatter-accessible variable schema. (6) Cross-link with #1808, C555, C591, C595.