fix: scope every flag lookup to the region the tool actually parses
A review round found the same defect wearing four different shapes, so the fixes are structural rather than per-site. The tool's own args end at `--`. Msbuild keeps classifying past the boundary because it forwards arguments, so every dotnet lookup read what the user meant for the test runner: `dotnet test -- --logger trx` suppressed RTK's own logger injection and `dotnet build -- -bl` its binlog. `before_dashdash` now scopes the five dotnet lookup primitives at once, and `--report-trx` -- legitimate in either region -- says so where it reads both. Injected flags belong before that boundary too. `dotnet format -- ./src` put `--verify-no-changes` after it, where dotnet parks it unread: format rewrote the tree while RTK reported check mode. `git diff --stat` had the same shape. Both go through `injection_point` now. Detection and the action on it have to share one rule. `--no-compact` was detected as a token and stripped as a string, deleting a pathspec of that name; `--write` was detected bare-and-unforwarded but stripped everywhere. They now strip the tokens detection actually saw. `stash` broke restore_double_dash's precondition: clap carves its subcommand out of the same trailing region, so restoring from the remainder sliced one token short -- `git stash -- -p` ran an interactive `push -p` where real git errors on the pathspec. The region is reassembled before restoring. Also from the round, each verified against the real tool: `-f`/`--file` supplies patterns like `-e`, so `grep -f pats.txt a.txt` no longer answers "no matches" (or hangs) by stealing the path as the pattern; grep's `-NUM` is `--context=NUM`, so its blocks keep their `--` separators; a single matching file found by walking the cwd keeps its name, as real rg prints it; `git diff -p` stopped printing the patch raw and then again compacted, 2.4x the raw output; `/Other.csproj` is a path, not an MSBuild switch, so it no longer adopts an unrelated project's runner mode; and `/l:trx` is MSBuild's logger assembly, not dotnet's `--logger`, which the tokenizer now records as `Token::slash`. git's remaining string-scanning handlers move to the tokenizer with the rest: `git status --` keeps its compact path, a blob spec is a free positional rather than any arg containing a colon, and a worktree action is the subcommand rather than any arg spelling one. The two stdin regressions move to tests/ where CI actually runs them -- they were `#[ignore]`d, and CI never passes `--ignored` -- and the show_line/context tests now drive the production detector instead of test-only twins of it, which let a deleted production arm stay green. The twins are gone. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
N
Nicolas Le Cam committed
f897c7bca80a3b9d478d9d48cbb14019a64b1245
Parent: 92c6755