Repository navigation
ux(grep): pre-clap intercept routes documented format flags through rg - #16
Merged
Merged
Conversation
…rough (#13) Empirical finding: the tracking DB had 518 parse_failures, dominated by `grep -c`, `grep -ci`, `grep -cE` invocations. CONTEXTCRAWLER.md documents that `-c, -L, -o, -Z` and the long-form equivalents should run raw, but the implementation let clap reject them with `error: unexpected argument '-c'` first; the fallback path then succeeded but stderr was polluted and the parse_failures table grew unboundedly. Fix: add a pre-clap intercept at the top of `run_cli()`. When args[0] is `grep` and any of the documented format flags is present, route directly to a dedicated passthrough that runs raw grep without invoking clap or recording a parse_failure. Short letters (c/L/o/Z) match anywhere in a single-`-` bundle (`-c`, `-ci`, `-cE`, `-iLn`); long forms must match exactly. Numeric tokens like `-5` are ignored. `-l` is intentionally excluded — this app's clap claims `-l` for --max-len. Users wanting standard grep `-l` (list matching files) should use `--files-with-matches` or `contextcrawler proxy grep -l ...`. Tests: 11 new unit tests covering each short letter, bundled short forms, all long forms, the `-l` carve-out, normal `-rn` non-matching, numeric tokens, empty args, and unrelated `--include=`. All 1853 binary tests pass. Closes #13
thehoff
force-pushed
the
fix/grep-format-flags-passthrough
branch
from
May 18, 2026 05:35
b69fa0a to
87ba25c
Compare
This was referenced May 18, 2026
Merged
noogalabs
pushed a commit
to noogalabs/contextcrawler
that referenced
this pull request
Jun 4, 2026
… branding-lint extension **Version bump 0.39.0 → 0.1.7.** The upstream rebase pulled in rtk's `0.39.0` version; restoring the downstream `0.1.x` numbering line per the maintainer's call. `.release-please-manifest.json` updated to match. Last downstream tag was `v0.1.6` (2026-05-15); this is the next in the sequence. **release-please-config.json `package-name: "rtk"` → "contextcrawler".** Caught by manual audit during release prep. Same regression-family as thehoff#19 / thehoff#20 / thehoff#22: a rebrand gap the prior branding-lint (src/-scoped) didn't catch because release-please-config.json lives at repo root. Without this fix, release-please would have produced `rtk-vX.Y.Z` tags and release-PR titles. **Cargo.toml `extended-description` rebrand.** Line 77 still read "rtk filters and compresses..." — same upstream-leak family. Fixed. **Extended `tests/branding_lint.rs`** with a third test — `branding_lint_config_files_pin_canonical_package_name` — that: - Parses Cargo.toml and asserts `[package].name == "contextcrawler"` - Parses release-please-config.json and asserts `packages["."]["package-name"] == "contextcrawler"` This closes the gap that let release-please-config.json silently drift to `"rtk"` post-rebase. Any future rebase that re-introduces an upstream package-name fails `cargo test --test branding_lint` with an explicit error pointing at issues thehoff#19/thehoff#20/thehoff#22 history. **CHANGELOG.md** entry for v0.1.7 added, summarizing all PRs merged today (thehoff#10 thehoff#15 thehoff#16 thehoff#21 thehoff#24 thehoff#25 thehoff#30) plus the deferred follow-ups (thehoff#26 thehoff#27 thehoff#28 thehoff#29). Tests: 2027 bin + 3 branding-lint (1 new) + 1 harness = all pass. Verified: `contextcrawler --version` now prints `contextcrawler 0.1.7`. Refs thehoff#19 thehoff#20 thehoff#22 thehoff#29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Empirical: tracking DB had 518 parse_failures, dominated by
grep -c/grep -ci/grep -cE. The docs say-c, -L, -o, -Zand the long forms should run raw, but the implementation let clap reject them first; the fallback succeeded but stderr was polluted and the parse_failures table grew unboundedly.Fix: pre-clap intercept at the top of
run_cli(). When args[0] isgrepand any documented format flag is present, route directly to a dedicated passthrough that bypasses clap and the parse_failure log entirely. Routes throughrg(systemgrepfallback) so mixed invocations likegrep -c --glob '*.rs' patkeep working — rg natively supports both the format flags AND the rtk-extra options the rg-backed grep path accepts.Short letters (
c/L/o/Z) match anywhere in a single--bundle (-c,-ci,-cE,-iLn). Long forms (--count,--files-with-matches,--files-without-match,--only-matching,--null) match exactly. Numeric tokens (-5) are ignored.-lis intentionally excluded — this app's clap claims-lfor--max-len. Users wanting standard grep-lshould use--files-with-matchesorcontextcrawler proxy grep -l ....Reviewed by Codex
Test plan
cargo test --bin contextcrawler— 1999 passed, 0 failed (+11 new)-lcarve-out, normal-rnnon-matching, numeric tokens, empty args, unrelated--include=Closes #13