fix(cli): a query is not a path, and a dash is not a flag (#178)
Two ways a correct search died before searching: Bug A — a query containing '/' alongside -e. The path-vs-query heuristic treated any slash-bearing query as a misplaced PATH argument, so colgrep 'proxy auth on retries/redirects' -e Client -k 10 hard-errored with 'Path does not exist'. The reclassification now fires only when the token could really be a path: it exists on disk, or it is a whitespace-free path-shaped token (kept so a mistyped ./sr still gets the path error instead of silently becoming a search). Bug B — a query starting with '-'. The query positional rejected hyphen values, so colgrep '--glob flag option' -k 5 aborted with 'unexpected argument'. Both query positionals now take allow_hyphen_values; defined flags still parse as flags, and the '--' separator still works. The trade-off: a mistyped long flag becomes a search instead of an error — right for a tool whose callers include agents emitting queries about flags. Unit tests cover both parses and the classifier; a 22-case stress battery (slashes, leading dashes, --, quotes, unicode, newlines, long queries, path-typo error preservation) passes against a live index.
R
Raphael Sourty committed
005e12b181bcc32385bb4ac36a3964e005cf065c
Parent: e94cb54
Committed by GitHub <noreply@github.com>
on 8/18/2026, 3:18:55 PM