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

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.
This commit is contained in:
Michael Bolin
2025-06-28 14:39:29 -07:00
committed by GitHub
parent 5a0f236ca4
commit e2efe8da9c
6 changed files with 102 additions and 11 deletions

View File

@@ -20,6 +20,10 @@ pub struct Cli {
#[clap(long, short = 'C')]
pub cwd: Option<PathBuf>,
/// Include matching file indices in the output.
#[arg(long, default_value = "false")]
pub compute_indices: bool,
// While it is common to default to the number of logical CPUs when creating
// a thread pool, empirically, the I/O of the filetree traversal offers
// limited parallelism and is the bottleneck, so using a smaller number of