Summary
The QueryCommandRunner argument parser (QueryCommandRunner.cs:3001-3009) routes unknown flags to a default branch that, when allowNamedQuery is true, treats the unknown flag as a positional query literal. So cdidx search foo --dapth 3 (typo for --depth) is parsed as a query for the literal --dapth followed by 3 — a near-zero-result silent failure rather than an "unknown flag" error. Users believe they passed --depth and get a nonsense answer.
Where
src/CodeIndex/Cli/QueryCommandRunner.cs:3001-3009 (parser default branch)
Suggested approach
(1) Reject any token starting with -- in the default branch with a clear "unknown option --dapth" error, regardless of allowNamedQuery. Positional queries that legitimately start with -- can be supported via the explicit -- separator. (2) Cross-reference with #1582 (did-you-mean for flags) — once unknown flags are surfaced, the suggester can run. (3) Add a regression test for cdidx search foo --dapth 3 asserting an error exit and an unknown-flag message. (4) Apply the same fix to other command runners with default-branch positional fallthrough. (5) Document under "Argument parsing rules".
Summary
The
QueryCommandRunnerargument parser (QueryCommandRunner.cs:3001-3009) routes unknown flags to adefaultbranch that, whenallowNamedQueryis true, treats the unknown flag as a positional query literal. Socdidx search foo --dapth 3(typo for--depth) is parsed as a query for the literal--dapthfollowed by3— a near-zero-result silent failure rather than an "unknown flag" error. Users believe they passed--depthand get a nonsense answer.Where
src/CodeIndex/Cli/QueryCommandRunner.cs:3001-3009(parser default branch)Suggested approach
(1) Reject any token starting with
--in the default branch with a clear "unknown option--dapth" error, regardless ofallowNamedQuery. Positional queries that legitimately start with--can be supported via the explicit--separator. (2) Cross-reference with #1582 (did-you-mean for flags) — once unknown flags are surfaced, the suggester can run. (3) Add a regression test forcdidx search foo --dapth 3asserting an error exit and an unknown-flag message. (4) Apply the same fix to other command runners withdefault-branch positional fallthrough. (5) Document under "Argument parsing rules".