Skip to content

feat: introduce --compute-indices flag to codex-file-search - #1419

Merged
bolinfest merged 1 commit into
mainfrom
pr1419
Jun 28, 2025
Merged

bolinfest merged 1 commit into
mainfrom
pr1419

Conversation

@bolinfest

@bolinfest bolinfest commented Jun 28, 2025 •

Copy link
Copy Markdown
Collaborator

This is a small quality-of-life feature, the addition of --compute-indices to the CLI, which, if enabled, will compute and set the indices field for each FileMatch returned by run(). Note we only bother to compute indices once we have the top N results because there could be a lot of intermediate "top N" results during the search that are ultimately discarded.

When set, the indices are included in the JSON output when --json is specified and the matching indices are displayed in bold when --json is not specified.

@bolinfest bolinfest added the code-review Issues relating to code reviews performed by codex label Jun 28, 2025
@github-actions github-actions Bot added codex-review-in-progress and removed code-review Issues relating to code reviews performed by codex labels Jun 28, 2025
@github-actions

Copy link
Copy Markdown
Contributor

Summary
Adds an optional --compute-indices flag to file-search, introducing a new FileMatch struct that can embed matched-character indices, JSON serialization, and on-the-fly highlighted output. CLI, reporter traits, TUI bridge, and Cargo manifests are updated; serde is now a dependency.

Review
Great quality-of-life improvement for both machine and human consumers of the search results. A few light suggestions:

  • MSRV bumps to require std::io::IsTerminal (≥ 1.70); consider documenting this.
  • You build a fresh Matcher per run—moving it outside the loop could save some work.
  • Highlighting runs only when stdout is a TTY; good, but maybe suppress ANSI when NO_COLOR is set.
  • cargo fmt to wrap a couple of >100-char lines.

Otherwise, code looks solid—merge once the nits are addressed!


View workflow run

@bolinfest
bolinfest merged commit e2efe8d into main Jun 28, 2025
@bolinfest
bolinfest deleted the pr1419 branch June 28, 2025 21:39
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant