Summary
cdidx find --json returns path, line, column, and snippet text, but it does not expose enough span/truncation metadata for clients to highlight matches or group results reliably.
Current source evidence
FileFindResult contains Line, Column, StartLine, EndLine, Snippet, and SnippetTruncated.
PendingFileFindMatch tracks match Length, but that length is not emitted.
LineWidthFormatter.ClampLines returns truncation detail that is collapsed to a boolean in find results.
Proposed improvement
Expose match length, original line length where available, truncation reason/counts, and an optional grouped-per-file JSON format for repeated matches in the same file.
Acceptance notes
- Existing line-delimited JSON remains usable.
- New fields are bounded and documented.
- Tests cover long-line truncation and multiple matches in one file.
Summary
cdidx find --jsonreturns path, line, column, and snippet text, but it does not expose enough span/truncation metadata for clients to highlight matches or group results reliably.Current source evidence
FileFindResultcontainsLine,Column,StartLine,EndLine,Snippet, andSnippetTruncated.PendingFileFindMatchtracks matchLength, but that length is not emitted.LineWidthFormatter.ClampLinesreturns truncation detail that is collapsed to a boolean in find results.Proposed improvement
Expose match length, original line length where available, truncation reason/counts, and an optional grouped-per-file JSON format for repeated matches in the same file.
Acceptance notes