Skip to content

rtk grep calls system grep instead of ripgrep — breaks -g/--glob flags #2167

@jbgutierrez

Description

@jbgutierrez

Environment

  • rtk 0.42.0 (Homebrew, macOS arm64)
  • ripgrep 14.x installed at ~/homebrew/bin/rg

Reproduction

rtk grep -i "compact" ~/.pi/agent/ -g "*.md" -l

Expected: filters files by glob using ripgrep internally
Actual: calls /usr/bin/grep which does not support -g or --glob

grep: invalid option -- g
usage: grep [-abcdDEFGHhIiJLlMmnOopqRSsUVvwXxZz] ...

Also fails with --glob:

rtk grep -i "compact" ~/.pi/agent/ --glob "*.md"
# grep: unrecognized option `--glob`

Context

rtk rewrite correctly rewrites rgrtk grep, but rtk grep delegates to system grep instead of ripgrep. Since the rewrite assumes ripgrep semantics, any rg-specific flags break.

Expected behavior

rtk grep should either:

  1. Use ripgrep internally (since it rewrites rg commands to itself), or
  2. Not rewrite rg commands that use flags incompatible with its own interface

Workaround

RTK_DISABLED=1 rg ... bypasses the rewrite.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions