npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@piotr-oles/pi-reflag

v0.3.0

Published

Pi Agent extension: transparently rewrite grep commands to rg (ripgrep) for faster searches

Downloads

382

Readme

pi-reflag

A pi coding agent extension that transparently rewrites grep commands to rg (ripgrep) and find commands to fd before they execute — faster searches with zero agent behavior change.

Install

pi install npm:@piotr-oles/pi-reflag

Requires rg and fd on $PATH:

brew install ripgrep fd      # macOS
apt install ripgrep fd-find  # Debian/Ubuntu

How it works

Intercepts bash tool calls in the tool_call event. When a command segment starts with grep or find (including piped commands), it translates the arguments to their rg/fd equivalents and rewrites the command in place before execution. The agent never sees the rewrite — only a user-visible toast notification is shown.

Subshell constructs ($(…), (…)) are left untouched to avoid misinterpreting nested commands.

grep → rg

What gets translated:

| grep flag | rg equivalent | |---|---| | -r, -R, --recursive | dropped (rg is recursive by default) | | -i, --ignore-case | -i | | -n, --line-number | -n | | -v, --invert-match | -v | | -w, --word-regexp | -w | | -l, --files-with-matches | -l | | -c, --count | -c | | -o, --only-matching | -o | | -E, --extended-regexp | dropped (rg uses ERE by default) | | -G, --basic-regexp | dropped, pattern converted from BRE to ERE | | -F, --fixed-strings | -F | | -P, --perl-regexp | -P | | -A, -B, -C | passed through | | --include=<glob> | -g <glob> | | --exclude=<glob> | -g !<glob> | | --exclude-dir=<dir> | -g !<dir>/ | | -s | --no-messages | | -N (numeric context) | -C N |

Disable per-session:

pi --pi-reflag-grep off

find → fd

What gets translated:

| find expression | fd equivalent | |---|---| | (always) | -H added — fd excludes hidden files by default, find doesn't | | -name <glob> | -g <glob> | | -iname <glob> | -i -g <glob> | | -name a -o -name b | -g {a,b} (brace expansion) | | ! -name <glob> / -not -name <glob> | -E <glob> | | -type f/d/l | -t f/d/l | | -maxdepth N | -d N | | -mindepth N | --min-depth N | | -exec cmd {} \; | -x cmd {} | | -exec cmd {} + | -X cmd {} | | -print0 | -0 | | -print | dropped (fd default) | | -L / -follow | -L | | -path <pat> -prune | -E <pat> (exclude directory) | | -path <pat> | -p <pat> (full-path match) | | -regex <pat> | <pat> (fd regex) | | -iregex <pat> | -i <pat> | | -size <spec> | -S <spec> | | -newer <file> | --newer <file> | | -mtime/-atime/-ctime -N | --changed-within Nd | | -mtime/-atime/-ctime +N | --changed-before Nd | | -mmin/-amin/-cmin -N | --changed-within Nmin | | -mmin/-amin/-cmin +N | --changed-before Nmin | | -user <name> | --owner <name> | | -group <name> | --owner :<name> | | -empty | -t e | | -executable | -t x | | -xdev / -mount | --one-file-system | | -quit | -1 |

Disable per-session:

pi --pi-reflag-find off

Thanks

  • ripgrep by Andrew Gallant
  • fd by David Peter
  • greprip-rs by kaofelix — grep→rg and find→fd translation logic ported from this project (MIT)
  • reflag by kluzzebass — additional find→fd flag mappings referenced from this project (MIT)

Development

pnpm install
pnpm test
pnpm typecheck
pnpm check

To test changes manually:

pi -e packages/pi-reflag/src/index.ts