Repository navigation
Conversation
`rg` and `grep` shared the `rtk grep` rule, but `rtk grep` is a POSIX-grep passthrough: not recursive, and it rejects ripgrep-only flags (--hidden/--glob/--type/-g). Downgrading `rg …` → `rtk grep …` silently broke ripgrep semantics (flags bomb; bare form reads stdin instead of recursing), which agents mis-read as "rg isn't installed". rtk already ships a faithful `rtk rg`, so route an `rg` invocation there — preserving every flag + recursion. Real `grep` is unaffected. +3 tests.
|
|
|
Thanks for tracking this down and for the clear before and after. develop already routes rg to rtk rg: #2641 (merged 2026-06-26) stopped substituting one search engine for the other, and the registry rule landed with it. On the current build |
Problem
rgandgrepshare thertk greprule (pattern: r"^(rg|rtk rg)\s+"), sortk rewritedowngradesrg …→rtk grep …. Butrtk grepis a POSIX-grep passthrough: it is not recursive and rejects ripgrep-only flags (--hidden,--glob/-g,--type). The result:rg --hidden foo→rtk grep --hidden foo→unrecognised option '--hidden'rg foo(recursive intent) →rtk grep foo→ reads stdin instead of recursingIn agent/LLM tooling this reliably gets mis-read as "rg isn't installed" (it is) and triggers retry loops.
Fix
When the matched prefix is
rg, route tortk rg(rtk's faithful ripgrep wrapper) instead ofrtk grep, preserving every ripgrep flag and rg's recursive/gitignore semantics. A realgrepis unaffected — only thergprefix is rerouted. Per-segment, sorg foo | grep barrewrites only therghalf.Tests
+3 unit tests in
discover::registry::tests:test_rewrite_rg_pattern—rg→rtk rgtest_rewrite_rg_preserves_ripgrep_flags—--hidden/-gsurvivetest_rewrite_grep_still_maps_to_rtk_grep— real grep untouchedSibling to #2453 (compound-
findrewrite); independent change, applies cleanly ondevelop.🤖 Generated with Claude Code