pi-rust-cli-tools0.1.4
Pi extension that detects which modern CLI tools are installed (rg, fd, lsd, eza, ...), tells the agent, and rewrites grep -r, find -name and ls -l to rg, fd and lsd before they run.
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
pi-rust-cli-tools
A pi extension that steers the agent to fast modern CLI tools (rg, fd, lsd, ...) only when they are installed.
What it does
- Detects which of
rg fd bat lsd eza sd dust procs hyperfine tokei delta difft jq just rtkare onPATH(once per session). - Tells the agent which are installed, in a few lines of the system prompt.
- Rewrites a bash call that has an installed replacement, before it runs, so the agent never pays for a retry:
| Agent runs | Runs instead | Needs |
|---|---|---|
grep -rn foo src (also -R, --recursive, egrep, fgrep) |
rg -n foo src |
rg |
find . -name '*.ts' -type f (also -iname, -maxdepth, -mindepth) |
fd -t f -g '*.ts' . |
fd |
ls -la src |
lsd -la src |
lsd |
Details that keep the meaning intact:
rgandfdskip hidden and git-ignored files,grep -randfinddo not. That is the point (nonode_modules, notarget/), but search an ignored path with/rust-cli-tools mode offorgrep off.grep flags map one to one (
-i -w -l -c -v -F -P -o -q,-A/-B/-C N,-m N,-e,-f,--include/--exclude/--exclude-dirto-g),-nis added so the output has line numbers, and a path is always named (rgwould read stdin otherwise).Only the command is rewritten: quotes, redirections, pipes,
cd x &&and the rest of the line stay as they were.A basic regex (grep without
-E) is spelled for rg:grep -rn 'fn main()'becomesrg -n 'fn main\(\)', since( ) + ? | { }are plain characters to grep and operators to rg.-x/--line-regexpmaps to-x.What cannot be said the same way (a GNU regex like
\(a\|b\), a back-reference, patterns from-fin a basic regex,find -o,-path, an unknown flag) is blocked with a hint instead, and the agent retries by hand.Plain
ls,du,ps,grepwithout-r,find -exec/-delete/-mtime/...and anything inside a quote, a heredoc or$(...)are left alone.ls -l | wc -lis left alone too (ls -lprints atotalline).
Modes and settings
| Command | |
|---|---|
/rust-cli-tools status |
settings, installed tools, how many commands were rewritten |
/rust-cli-tools mode [rewrite|block|hint|off] |
rewrite (default) runs the modern tool; block refuses with a hint; hint only tells the model; off does nothing |
/rust-cli-tools on / off |
the same as mode rewrite / mode off |
/rust-cli-tools [grep|find|ls] [on|off] |
switch one rule |
Settings are saved in <agent dir>/rust-cli-tools.json (the agent dir is PI_CODING_AGENT_DIR, then $XDG_CONFIG_HOME/pi/agent, then ~/.pi/agent). The status line shows cli: N rewritten.
Works together with pi-squeeze: this plugin decides which command runs, pi-squeeze shrinks its output (rg -n, fd and lsd -l results are compacted).
Install
pi install npm:pi-rust-cli-tools
Install the tools themselves, for example: brew install ripgrep fd lsd.
Development
bun install
just check # typecheck + tests (95% coverage gate) + pack check + nu script tests
Releases run in CI: Actions → Release → Run workflow with a bump (patch, minor, major), or
just release-ci minor. The workflow runs the quality gate, bumps package.json, regenerates
CHANGELOG.md with git-cliff, commits, tags, pushes and publishes to npm (secret NPM_TOKEN).
License
MIT