@rob-c/pi-managed-tools 0.0.0-stage → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,570 @@
1
+ ---
2
+ name: managed-tools-reference
3
+ description: "Exact flags and worked examples for the pinned fd, rg, bat, just, gron, shellcheck, ast-grep, ninja, prek and rtk binaries. Load before invoking any of them, especially for structural edits (ast-grep), build invocation (ninja, just) or output compression (rtk)."
4
+ ---
5
+
6
+ # Managed tools — exact reference
7
+
8
+ Versions are fixed by `pi-managed-tools`; every flag listed exists in the
9
+ installed build and nothing else is needed.
10
+
11
+ fd 10.5.2 · rg 15.2.0 · bat 0.26.1 · just 1.59.0 · gron 0.7.1 ·
12
+ shellcheck 0.11.0 · ast-grep 0.51.3 · ninja 1.13.2 · prek 0.5.11 · rtk 1.2.1
13
+ jq 1.8.2 · yq 4.54.3 · fzf 0.75.0 · uv 0.13.9 · gh 2.105.0 · bd 1.3.4
14
+ agent-browser 0.43.0 · ruff 0.17.6 · mise 2026.11.11
15
+ scc 4.1.0 · duckdb 2.0.1 · miller 6.22.0 · sd 1.1.0 · difftastic 0.72.0 · busybox 1.39.0
16
+
17
+ ## Policy
18
+
19
+ Token order: `rtk` to shrink output, then these binaries over the system ones,
20
+ plain commands last.
21
+
22
+ `rtk` decides *what you need*: the verdict, or the content.
23
+
24
+ - **Verdict** — pass/fail, an error list, a shape. Use rtk: `rtk test <cmd>`,
25
+ `rtk err <cmd>`, `rtk deps`, `rtk env`, `rtk json f --keys-only`, `rtk ls`,
26
+ `rtk find`, `rtk git status`. It is aggressive: `rtk git diff` reduces a diff to
27
+ `a.txt | 1 +` plus a file list, and `rtk err` keeps stderr while discarding
28
+ stdout. Both are correct for "did it work" and wrong for "what changed".
29
+ - **Content** — bytes you will edit, quote or reason about. Do not use rtk: plain
30
+ `git diff`, `bat --paging=never`, `rg`, `gron`, `ast-grep`.
31
+ - When it matters, run plainly once rather than re-running a truncated result.
32
+
33
+ Precedence for every other task: `rg` over `grep`, `fd` over `find`, `bat` over
34
+ `cat`, `ast-grep` over regex on code, `gron` over ad-hoc JSON parsing, `just -l`
35
+ over guessing a recipe, `ninja -t targets`/`-n` over guessing a build step,
36
+ `shellcheck` for shell (advisory), `prek` for hooks.
37
+
38
+ ## Why the bare name resolves to the packaged binary
39
+
40
+ Two independent mechanisms, and one way to defeat both.
41
+
42
+ | Mechanism | Where | Effect |
43
+ |---|---|---|
44
+ | `getShellEnv()` prepends `<agent dir>/bin` | `dist/utils/shell.js` | first entry on `PATH` for every bash call |
45
+ | `getToolPath()` checks `TOOLS_DIR` before `PATH` | `dist/utils/tools-manager.js` | pi's built-in `grep`/`find` use the managed `rg`/`fd` regardless of `PATH` |
46
+
47
+ ```bash
48
+ command -v jq gh rg bat scc # should all print <agent dir>/bin/<tool>
49
+ echo "$PATH" | tr ':' '\n' | head -1 # should be <agent dir>/bin
50
+ ```
51
+
52
+ `getShellEnv()` only prepends **when the directory is not already in `PATH`**. If a
53
+ shell rc appends it (`PATH="$PATH:$HOME/.pi/agent/bin"`), the order is left alone and
54
+ a host copy can win for bash calls — while pi's built-in tools keep using the managed
55
+ ones, so the two paths diverge. Tell the user to prepend and restart pi; an
56
+ `export PATH=…` inside a bash call dies with that call, because each call is a new
57
+ `spawn(shell, [...args, command])`.
58
+
59
+ Never write an absolute binary path (`/usr/bin/jq`, `/opt/homebrew/bin/gh`) to run
60
+ work — it bypasses both mechanisms and pins the host's version forever. The only
61
+ legitimate use is deliberately inspecting the host copy for comparison.
62
+
63
+ ## Read-only vs mutating
64
+
65
+ Assume a bare tool name mutates. `just`, `ninja`, `prek run`, `mise <task>`, `uv run`,
66
+ `sd`, `ruff format`, `agent-browser open`, `duckdb FILE` and any `bd` write verb all
67
+ change something with no flag needed.
68
+
69
+ Dry-run when unsure: `just -n` · `ninja -n` · `uv --dry-run` · `mise -n` ·
70
+ `prek run --dry-run` · `bd --readonly` · `duckdb -readonly` · `ast-grep` without `-U` ·
71
+ `sd -p`.
72
+
73
+ | tool | read-only | mutates (★ = destructive) |
74
+ |---|---|---|
75
+ | fd | everything | nothing itself; `-x`/`-X CMD` runs a child per result |
76
+ | rg | everything (`-r` only changes printed output) | nothing; `--pre CMD` runs a child per file |
77
+ | bat | everything, incl. `--diff` (reads git index) | `cache --build` writes `~/.cache/bat`; ★`cache --clear` deletes it; `--pager CMD` execs |
78
+ | gron | everything (`-u` prints JSON) | nothing |
79
+ | shellcheck | everything (`-f diff` prints a patch only) | nothing |
80
+ | jq | everything (1.8.2 has **no** `-i`) | nothing |
81
+ | mlr | every verb, all format flags | ★`tee FILE` overwrites; ★`split` writes/overwrites `split_*` in cwd; DSL `tee >`/`emit >`; `--prepipe CMD`; `--no-shell` disables |
82
+ | difft | everything (`--check-only` is a pure report) | nothing |
83
+ | fzf | everything, provided no `--history`/`--bind` | `--history FILE` writes; `--bind`/`--preview`/`--info-command` exec; `--listen` allows remote exec |
84
+ | scc | everything except the three below | `-o FILE`, `--format-multi`, `--report=PATH` write (bare `--report` prompts first) |
85
+ | ast-grep | `-p … -r …` only prints; `scan` has **no** `--fix` | ★`-U/--update-all` and `-i/--interactive` rewrite files |
86
+ | sd | `-p/--preview`; stdin to stdout | ★**in place by default** whenever file arguments are given |
87
+ | ruff | `check`, `check --diff`, `format --check`, `format --diff` | ★`format` rewrites by default; `check --fix`/`--unsafe-fixes`; ★`clean` deletes `.ruff_cache` |
88
+ | yq | default prints to stdout | ★`-i/--inplace` rewrites the **first file only**; ★`-s/--split-exp` creates files and dirs (cwd unless `--security-allow-write-any-path`) |
89
+ | duckdb | `-readonly`, `-c` with a plain SELECT | ★`duckdb FILE` creates or opens that db; SQL can CREATE/INSERT/COPY TO; `.shell`, `INSTALL`, `LOAD` |
90
+ | just | `-n/--dry-run`, `-l`, `-s`, `--summary`, `--dump`, `--fmt --check` | ★bare `just` runs the first recipe (arbitrary shell); `--fmt` rewrites the justfile; `--init` creates one; ★`--clean` deletes cached recipe metadata |
91
+ | ninja | `-n` (writes nothing), `-t targets`, `-t commands`, `-t query`, `-t graph`, `-t rules`, `-t deps` | ★bare `ninja` builds (outputs, `.ninja_log`); ★`-t clean`, ★`-t cleandead` delete outputs; `-t restat`, `-t recompact` rewrite the log |
92
+ | prek | `list`, `validate-config`, `validate-manifest`, `run --dry-run`, `cache dir` | `run` executes hooks (often auto-fixers); `install`/`uninstall` write or remove `.git/hooks`; `update` rewrites config revs; ★`cache clean`, ★`cache gc` delete; `self update` replaces the binary |
93
+ | mise | `ls`, `outdated`, `env`, `bin-paths`, `where`, `doctor`, `config ls`, `fmt -c`, any `-n/--dry-run` | `use`/`install` install toolchains and write config; ★`prune`, ★`uninstall --all`, ★`cache clear`, ★`implode` delete; `fmt` rewrites config; `trust`; `self-update`; ★`install-into` wipes the target path |
94
+ | uv | `pip list`, `pip freeze`, `pip tree`, `pip check`, `lock --check`, `python list`, `tree`, `--dry-run` forms | ★`run`/`sync`/`add`/`remove`/`lock` modify env and lockfile with no flag; `pip install`/`pip uninstall`; ★`venv --clear`; `python install`; `tool install`; ★`publish` (remote, irreversible); ★`cache clean`; `auth login`/`auth logout` |
95
+ | gh | subcommand decides; `gh api` is a GET unless `-f`/`-F`/`--input`/`-X` is given | `pr create`/`pr merge`, `issue`, `release`, `run rerun`, `secret set`, `auth login` (writes `hosts.yml`); ★`repo delete`, ★`release delete`, ★`cache delete`, ★`secret delete` |
96
+ | bd | `list`, `show`, `query`, `status`, `count`, `graph`, `history`, `stale`, `lint`; `--readonly` blocks writes | write verbs: `create`, `q`, `update`, `close`, ★`delete`, `comment`, `dep`, `label`; ★`init` also rewrites `AGENTS.md`; writes auto-commit by default |
97
+ | rtk | only-read proxies: `ls`, `tree`, `read`, `json`, `deps`, `env`, `diff` | **it is a proxy that runs the real command**: `test`, `err`, `git`, `gh`, `docker` do whatever you passed them; `init` writes hook files |
98
+ | busybox | applet decides; R/M/M★ for all 236 are in `busybox-applets`. `busybox <applet>` only | ★`busybox --install -s DIR` (236 symlinks), ★`bb <mutating applet>` |
99
+ | agent-browser | `snapshot`, `get`, `read`, `vitals`, `console`, `errors` | `open`/`click`/`fill`/`type`/`eval` drive the live page; ★`screenshot` writes a file even with no path; `pdf`, `download`, `state save`, ★`close --all`; starts a background daemon |
100
+
101
+ ## fd — files
102
+
103
+ `fd [opts] [pattern] [path...]` · regex by default, all entries with no pattern.
104
+
105
+ `-e EXT` · `-t f|d|l|x|e|s|p` type · `-d N` depth · `-H` hidden · `-I` no-ignore
106
+ `-L` follow links · `-g` glob pattern · `-s` case-sensitive · `-i` ignore case
107
+ `-a` absolute · `-0` NUL-separate · `-x CMD` run per result · `-X CMD` run once
108
+ `--exclude GLOB` · `--changed-within DUR`
109
+
110
+ ```bash
111
+ fd -e ts . src # pattern first: '.' = everything, then the path
112
+ fd -td -d 2 # directories to depth 2 — the tree replacement
113
+ fd -H -I '\.env' -d 1 # hidden + ignored
114
+ fd -0 -e json | xargs -0 jq -r .name
115
+ fd -e sh -x shellcheck -f gcc # lint each match
116
+ ```
117
+
118
+ `fd PATTERN PATH` — the first positional is the pattern, so a bare directory
119
+ name becomes a search term. Pass `.` to match everything in a path.
120
+
121
+ ## rg — contents
122
+
123
+ `rg [opts] PATTERN [path...]`
124
+
125
+ `-i` ignore case · `-S` smart case · `-w` word · `-F` fixed string · `-n` line no
126
+ `-c` count · `-l` names only · `-o` match only · `-A/-B/-C N` context
127
+ `-t TYPE` · `-g GLOB` · `--hidden` · `-u` unrestrict (repeatable) · `-U` multiline
128
+ Skips hidden and `.gitignore`d files by default: use `--hidden -I` (or `-uu`) when a
129
+ search must see everything, or results silently go missing.
130
+ `-r REPL` · `-z` inside .gz · `--json` · `--stats` · `--files` · `--type-list`
131
+
132
+ ```bash
133
+ rg -n -C2 'TODO' src
134
+ rg -l -t ts 'deprecated'
135
+ rg -F -f patterns.txt # patterns from a file
136
+ rg --json 'x' | jq -r 'select(.type=="match") | .data.path.text' | sort -u
137
+ ```
138
+
139
+ ## bat — view
140
+
141
+ `bat [opts] FILE...` · always add `--paging=never` here; stdout is not a TTY.
142
+
143
+ `-p` plain · `-pp` plain + no paging · `-n` numbers · `-A` non-printing chars
144
+ `-r A:B` line range · `-H/--highlight-line N:M` highlight lines · `--diff` git diff
145
+ `-l LANG` · `--style plain,numbers,header,grid,changes` (header = filename)
146
+ `--decorations=always` — required, or style is dropped when stdout is a pipe
147
+
148
+ ```bash
149
+ bat --paging=never -r 40:80 src/app.ts
150
+ bat --paging=never --diff --diff-context 3 src/app.ts # vs git index
151
+ bat --paging=never --decorations=always --style header,numbers src/app.ts
152
+ ```
153
+
154
+ `-H` is `--highlight-line`, not a filename header — use `--style header` for that.
155
+
156
+ ## just — task runner
157
+
158
+ `just [opts] [recipe] [args...]`
159
+
160
+ `-l` list recipes · `--summary` names only · `-s RECIPE` show recipe source
161
+ `-n` dry run · `-f FILE` · `-d DIR` · `--set VAR VAL` · `--choose` picker
162
+
163
+ ```bash
164
+ just -l # discover before assuming
165
+ just -s build # read what a recipe does
166
+ just test -- --nocapture # args after -- reach the recipe
167
+ just -n deploy # dry run
168
+ ```
169
+
170
+ ## gron — JSON to greppable
171
+
172
+ `gron [opts] [file|URL|-]`
173
+
174
+ `-u` reverse (assignments → JSON) · `-v` values only · `-s` stream JSONL
175
+ `-j` JSON stream · `-m` monochrome · `--no-sort` · `-k` skip TLS verify
176
+
177
+ ```bash
178
+ gron data.json | rg 'users'
179
+ gron data.json | gron -v | rg -c . # -v reads assignments, so pipe into it
180
+ gron -u out.gron > restored.json
181
+ ```
182
+
183
+ `-v` filters *assignments* on stdin; it does not read a JSON file on its own.
184
+
185
+ ## shellcheck — shell lint, advisory
186
+
187
+ `shellcheck [opts] FILES`
188
+
189
+ `-f checkstyle|diff|gcc|json|json1|quiet|tty` · `-e CODES` exclude
190
+ `-i CODES` include only · `-S error|warning|info|style` · `-s sh|bash|dash|ksh|busybox`
191
+ `-x` follow sources · `-a` include sourced warnings · `-o all` optional checks
192
+ `-P PATH` source path · `--norc` · `--rcfile FILE`
193
+
194
+ ```bash
195
+ shellcheck -f gcc -S warning scripts/*.sh
196
+ shellcheck -s bash -e SC1091 -f json1 script.sh
197
+ ```
198
+
199
+ Never use `-f diff` to rewrite: report findings and let the user decide.
200
+
201
+ ## ast-grep — structural search and rewrite
202
+
203
+ `ast-grep run -p 'PATTERN' -l LANG [paths]` · `$VAR` = one node, `$$$` = many.
204
+
205
+ `-p/--pattern` · `-l/--lang` · `-r/--rewrite` · `-A/-B/-C N` context · `-i` interact
206
+ `--json[=STYLE]` · `--globs GLOB` (there is no `-g`) · `-A/--after N` · `-B/--before N`
207
+ `--strictness cst|smart|ast|relaxed|signature|template` · `--selector KIND`
208
+
209
+ Subcommands: `run` · `scan` (rule files) · `test` · `outline` · `lsp` · `new`
210
+
211
+ ```bash
212
+ ast-grep run -p 'console.log($A)' -l ts src # preview first
213
+ ast-grep run -p 'console.log($A)' -l ts -r 'logger.info($A)' src
214
+ ast-grep run -p 'if ($C) { $$$B }' -l go # multi-statement body
215
+ ast-grep outline src/app.ts # symbols, imports, members
216
+ ```
217
+
218
+ Preview without `-r`, then add `-r`. Never regex a codebase you intend to edit.
219
+
220
+ The archive also installs `sg`, a deprecated alias that **execs `ast-grep`**: it
221
+ only works while `ast-grep` is present and runnable. Use `ast-grep` in new
222
+ commands. `sg` shadows util-linux's `/usr/bin/sg` on Linux; delete
223
+ `<agent dir>/bin/sg` if you need the system one.
224
+
225
+ ## ninja — build
226
+
227
+ `ninja [opts] [targets...]` · no target builds `default`.
228
+
229
+ `-C DIR` · `-f FILE` (default `build.ninja`) · `-j N` · `-k N` · `-l N` load avg
230
+ `-n` dry run · `-v` verbose · `--quiet` · `-t TOOL` subtool · `-d MODE` · `-w FLAG`
231
+
232
+ Subtools: `-t targets` · `-t commands` · `-t query TARGET` · `-t graph`
233
+ `-t compdb RULES` · `-t clean` · `-t list`
234
+
235
+ ```bash
236
+ ninja -t targets all | head
237
+ ninja -n -v # dry run before a real build
238
+ ninja -C build -j8
239
+ ninja -t compdb cc cxx > compile_commands.json
240
+ ```
241
+
242
+ `-t` ends option parsing; later flags belong to the subtool.
243
+
244
+ ## prek — git hooks (pre-commit compatible, Rust)
245
+
246
+ `prek [opts] [HOOK|PROJECT]... [COMMAND]`
247
+
248
+ Commands: `run` · `install` · `list` · `init` · `update` · `prepare-hooks`
249
+ `uninstall` · `validate-config` · `validate-manifest` · `cache` · `try-repo` · `exec`
250
+
251
+ `-a/--all-files` · `--files PATH...` · `--files0-from FILE` · `--last-commit`
252
+ `--skip HOOK` · `--stage STAGE` · `-v`
253
+
254
+ ```bash
255
+ prek list # configured hooks
256
+ prek run --all-files
257
+ prek run ruff --files src/x.py
258
+ ```
259
+
260
+ `install` writes `.git/hooks` — confirm with the user before running it.
261
+
262
+ ## rtk — compress output before it reaches context
263
+
264
+ `rtk <subcommand> [args]` → runs the real tool, returns condensed output.
265
+
266
+ `ls` · `tree` · `read` · `smart` · `git` · `gh` · `glab` · `aws` · `psql` · `pnpm`
267
+ `err CMD...` · `test CMD...` · `json` · `deps` · `env` · `find` · `diff`
268
+
269
+ ```bash
270
+ rtk test cargo test # failures only
271
+ rtk err npm run build # errors and warnings only
272
+ rtk git diff # changed lines only
273
+ rtk json data.json --keys-only
274
+ rtk find -name '*.ts'
275
+ ```
276
+
277
+ Use it when output is noisy and you only need the verdict. When you need exact
278
+ bytes to edit or diff, run the command plainly.
279
+
280
+ ## jq — JSON
281
+
282
+ `jq [opts] FILTER [file...]` · input from stdin or files.
283
+
284
+ `-r` raw output (no quotes) · `-c` compact · `-e` exit status from filter · `-s` slurp
285
+ `-n` null input · `-j` join without newlines · `-S` sort keys · `-f FILE` filter file
286
+ `--arg k v` string var · `--argjson k v` JSON var · `--slurpfile` · `-C` colour · `-M` monochrome
287
+
288
+ ```bash
289
+ jq -r '.items[].name' data.json
290
+ jq -c 'select(.level == "error")' log.jsonl
291
+ jq -e '.ok' <<< '{"ok":true}' >/dev/null && echo pass
292
+ jq -S --arg n "$USER" '. + {user: $n}' in.json
293
+ ```
294
+
295
+ `-r` is the difference between usable and quoted output in a pipeline. Prefer `gron`
296
+ for exploring an unknown document and `jq` for a filter you already know.
297
+
298
+ ## yq — YAML/JSON/XML
299
+
300
+ `yq [opts] EXPRESSION [file...]` · **mikefarah/yq v4** (Go). kislyuk/yq is a
301
+ different Python tool with different flags; do not mix their syntax.
302
+
303
+ `-r` raw · `-o json|yaml|props|xml|csv|tsv` output format · `-i` in place
304
+ `-e` exit status · `-N` no doc separator · `-P` pretty print · `-I N` indent
305
+ `env(NAME)`/`strenv(NAME)` read the environment (there is no `--arg`) · `-n` null input
306
+
307
+ ```bash
308
+ yq '.services.web.image' compose.yaml
309
+ yq -o json '.spec' k8s.yaml | jq .replicas
310
+ yq -i '.version = "2"' chart/Chart.yaml
311
+ yq -r '.users[].email' users.yaml
312
+ ```
313
+
314
+ `-i` writes the file: print first, then re-run with `-i`.
315
+
316
+ ## fzf — fuzzy select
317
+
318
+ `fzf [opts]` · **needs a TTY for interactive use**, which pi's bash does not provide.
319
+ Interactive selection fails; filtering does not.
320
+
321
+ `--filter TEXT` non-interactive match · `-f` alias · `--select-1` · `--exit-0`
322
+ `-1/--first` · `-n` field index · `--delimiter` · `-q` query · `--height` · `--preview`
323
+
324
+ ```bash
325
+ fd -e ts | fzf --filter auth # works without a TTY
326
+ fd -e ts | fzf --filter auth -1 # best single match
327
+ rg -l TODO | fzf --filter '' --select-1
328
+ ```
329
+
330
+ There is no pipe-friendly interactive mode: use `--filter` to narrow, or ask the user.
331
+
332
+ ## uv — Python packaging
333
+
334
+ `uv <cmd>` · also installs `uvx` (run a tool without installing it globally).
335
+
336
+ `uv run` · `uvx` · `uv pip install|sync|compile` · `uv venv` · `uv add|remove`
337
+ `uv lock` · `uv sync --frozen` · `uv python install|pin` · `uv tool install`
338
+
339
+ ```bash
340
+ uv run pytest -q # project env, no activation
341
+ uvx ruff check . # ephemeral tool run
342
+ uv sync --frozen # exactly the lockfile
343
+ uv pip compile requirements.in -o requirements.txt
344
+ ```
345
+
346
+ `uv` creates Python toolchains and caches outside this bin directory. Prefer
347
+ `uv run <cmd>` so the project's own pinned version is used.
348
+
349
+ ## gh — GitHub CLI
350
+
351
+ `gh <cmd>` · **credential-bearing**: it stores an OAuth token in `~/.config/gh/hosts.yml`.
352
+
353
+ `gh pr|issue|repo|run|release|api|search|auth` · `--json FIELDS` · `-q JQ`
354
+ `gh api` for anything the porcelain lacks · `GH_TOKEN` overrides stored auth
355
+
356
+ ```bash
357
+ gh pr list --json number,title --jq '.[].title'
358
+ gh run list --limit 5
359
+ gh api repos/{owner}/{repo}/pulls --jq '.[].title'
360
+ gh pr diff 123
361
+ ```
362
+
363
+ `gh pr diff` is content you must read — do not pipe it through `rtk`.
364
+
365
+ ## bd — issue tracker
366
+
367
+ `bd <cmd>` · gastownhall/beads, a Dolt-backed issue tracker stored in `.beads/`
368
+ in the current project. Dolt is embedded, so the single binary is enough.
369
+
370
+ Reading (safe): `list` · `show <id>` · `status` · `count` · `search TEXT` ·
371
+ `query <expr>` · `graph` · `children <id>` · `stale` · `lint` · `history <id>`
372
+
373
+ Writing: `create` · `q` (quick capture, prints only the ID) · `update` ·
374
+ `close` · `reopen` · `comment` · `note` · `dep` · `label` · `priority` · `assign`
375
+
376
+ Sync: `bd dolt push` / `bd dolt pull`
377
+
378
+ ```bash
379
+ bd list --status open
380
+ bd show bd-42
381
+ bd q "login button does nothing on safari" # prints just the new ID
382
+ bd query 'status=open priority>2'
383
+ bd graph
384
+ bd comment bd-42 --body "reproduced on main"
385
+ ```
386
+
387
+ **`bd init` mutates the project.** It creates `.beads/` with a Dolt database,
388
+ **rewrites `AGENTS.md` by default**, and installs editor/agent integration files
389
+ unless given `--skip-agents` or `--stealth`. `bd setup <tool>` writes those
390
+ integration files too (`--global` writes into your home directory). Ask before
391
+ running either; prefer the read-only commands otherwise.
392
+
393
+ Not present: there is no `.beads/` until someone runs `bd init`, so an empty
394
+ `bd list` usually means "not initialised", not "no issues".
395
+
396
+ `bd` sends **anonymous usage metrics by default** (command names, version, OS —
397
+ not issues, paths or identities). Set `DO_NOT_TRACK=1` to disable it; that is the
398
+ user's call, not something to set for them.
399
+
400
+ ## agent-browser — browser automation
401
+
402
+ `agent-browser <command>` — drives a real browser through a **daemon**, so the
403
+ page survives between separate invocations.
404
+
405
+ `open <url>` · `read [url]` · `snapshot` (accessibility tree with `@eN` refs) ·
406
+ `click @eN` · `fill @eN TEXT` · `type` · `press KEY` · `wait <sel|ms>` ·
407
+ `screenshot [path]` · `pdf <path>` · `eval <js>` · `close [--all]`
408
+ `get text|html|value|attr <name>|title|url|count|box|styles`
409
+ `--session NAME` · `--restore` · `session id|info` · `--profile Default` ·
410
+ `connect <port|url>` (CDP) · `chat "..."`
411
+
412
+ ```bash
413
+ agent-browser open example.com && agent-browser snapshot -i
414
+ agent-browser fill @e1 "user@example.com" && agent-browser click @e2
415
+ agent-browser read https://example.com
416
+ agent-browser screenshot /tmp/shot.png
417
+ ```
418
+
419
+ Snapshot first, then act on the `@eN` refs it returns — do not guess selectors.
420
+
421
+ Three things this build does not give you: it needs a local Chrome/Chromium (or an
422
+ existing browser via `connect`), it leaves a daemon running (stop it with
423
+ `close --all`), and **`agent-browser skills get core` fails** — the release binary
424
+ ships no skills directory despite what `--help` says. No win32-arm64 build.
425
+
426
+ ## ruff — Python lint and format
427
+
428
+ `ruff check [paths]` · `ruff format [paths]`
429
+
430
+ `--select CODE` · `--ignore CODE` · `--fix` · `--diff` (preview) · `--unsafe-fixes`
431
+ `--output-format concise|json|github|gitlab|junit|sarif` · `--statistics` ·
432
+ `--no-cache` · `--line-length N` · `--check` (format only)
433
+
434
+ ```bash
435
+ ruff check --statistics .
436
+ ruff check --diff --fix . # preview the fix, change nothing
437
+ ruff format --check .
438
+ ruff check --select E,F --output-format json .
439
+ ```
440
+
441
+ Most repositories pin ruff in their own environment. Prefer `uv run ruff ...` so
442
+ the pinned version decides the rules; use the managed copy for a quick check
443
+ outside a project environment, and never let it rewrite files the project's own
444
+ version would format differently.
445
+
446
+ ## mise — dev tool and task runner
447
+
448
+ `mise <cmd>` — installs toolchains and runs project tasks. It is a **version
449
+ manager**, and pi's `bash` never sources rc files, so `mise activate` is inert
450
+ here: use `mise exec` instead.
451
+
452
+ `mise exec -- CMD` (alias `x`) · `mise run TASK` · `mise ls` · `mise current` ·
453
+ `mise env` · `mise install` · `mise use` · `mise trust` · `mise doctor` ·
454
+ `mise bin-paths` · `mise tasks`
455
+
456
+ ```bash
457
+ mise exec -- node --version
458
+ mise run test
459
+ mise ls --current
460
+ mise doctor
461
+ ```
462
+
463
+ Ask before `mise install`, `mise use` or `mise trust`: they write `mise.toml` and
464
+ install toolchains under `~/.local/share/mise`, outside this bin directory.
465
+ `mise exec --` is the only form that reliably picks up a project's pins from here.
466
+
467
+ ## scc — lines of code
468
+
469
+ `scc [flags] [paths...]` · ignores vendor/generated files by default.
470
+
471
+ `-f/--format tabular|wide|json|json2|csv|sql|html|openmetrics` · `--by-file` ·
472
+ `-i/--include-ext` · `-x/--exclude-ext` · `--exclude-dir` · `--no-gen` ·
473
+ `-c/--no-complexity` · `--no-cocomo`
474
+
475
+ ```bash
476
+ scc .
477
+ scc --by-file -f csv . | head
478
+ scc -i go,ts --no-gen .
479
+ ```
480
+
481
+ ## duckdb — SQL over files
482
+
483
+ `duckdb [OPTIONS] [FILENAME] [SQL]` · no filename means an in-memory database, and
484
+ CSV/Parquet/JSON are queryable directly by path.
485
+
486
+ `-c COMMAND` run and exit · `-csv` · `-json` · `-jsonlines` · `-header` · `-f FILE` ·
487
+ `-no-agent` · dot-commands via `.help`
488
+
489
+ ```bash
490
+ duckdb -c "select 1"
491
+ duckdb -csv -no-agent -c "select * from 'data.csv' limit 5"
492
+ duckdb -json -c "select count(*) n from read_parquet('x.parquet')"
493
+ duckdb -c "create table t as select * from 'a.csv'; select count(*) from t"
494
+ ```
495
+
496
+ Agent mode prints a banner before every result when `AI_AGENT` is set and stdout is
497
+ not a terminal — i.e. always here — so pass `-no-agent` (or `DUCKDB_AGENT_MODE=0`)
498
+ when the banner would pollute the output.
499
+
500
+ ## miller — CSV, TSV and JSON
501
+
502
+ `mlr [flags] [verb] [verb options] [files...]` · with no verb it behaves like `cat`;
503
+ chain verbs with `then`.
504
+
505
+ `--csv` · `--tsv` · `--json` · `--icsv`/`--ojson` · `--c2j` · `-N` no header ·
506
+ verbs: `cut` `filter` `put` `sort` `join` `stats1` `count-distinct` `nest`
507
+ `flatten` `head` `tail`
508
+
509
+ ```bash
510
+ mlr --csv cut -f name,email users.csv
511
+ mlr --c2j cat data.csv
512
+ mlr --csv filter '$qty > 10' then sort -f sku data.csv
513
+ mlr --csv stats1 -a mean -f price sales.csv
514
+ ```
515
+
516
+ ## sd — find and replace
517
+
518
+ `sd [OPTIONS] <FIND> <REPLACE_WITH> [FILES]...` · regex by default ·
519
+ **rewrites files in place**; with no files it filters stdin to stdout.
520
+
521
+ `-p/--preview` · `-F/--fixed-strings` · `-n/--max-replacements N` · `-f/--flags` ·
522
+ `-A/--across`
523
+
524
+ ```bash
525
+ sd -p '\d+' 'N' file.txt # preview, changes nothing
526
+ sd 'foo' 'bar' src/*.ts # rewrites in place
527
+ sd -F 'a.b' 'a-b' file.txt # literal, not regex
528
+ echo 'x=1' | sd 'x' 'y'
529
+ ```
530
+
531
+ Always preview with `-p` first: without it the matched files are rewritten.
532
+
533
+ ## busybox — 236 applets in one binary
534
+
535
+ `busybox <applet> [args]` · v1.39.0, statically linked. Dispatches on **argv[0]**, so
536
+ the installed file must stay named `busybox`.
537
+
538
+ ```bash
539
+ busybox --list # all 236 applet names
540
+ busybox hexdump -C file.bin
541
+ busybox sha256sum file
542
+ busybox unzip archive.zip
543
+ busybox date -u +%FT%TZ
544
+ ```
545
+
546
+ Per-applet read-only vs mutating classification, including which flags cause a
547
+ write, is in the `busybox-applets` skill — load it before running any applet that
548
+ is not obviously an inspection command.
549
+
550
+ **Do not run `busybox --install -s <dir>`.** In pi's bin directory (first on `PATH`)
551
+ it would put 236 applets ahead of the real coreutils, and busybox `sed`, `grep`,
552
+ `find`, `tar` and `awk` are not GNU-compatible. Prefer this package's dedicated
553
+ tools (`rg`, `fd`, `bat`, `jq`, `scc`, `difft`) and use busybox for what nothing
554
+ else covers: `hexdump`, `xxd`, `unzip`, `gzip`, `patch`, `cpio`, `dpkg-deb`,
555
+ `sha*sum`, `date`, `hostname`.
556
+
557
+ ## difftastic — structural diffs
558
+
559
+ `difft [OPTIONS] OLD-PATH NEW-PATH` · compares syntax trees; unknown languages fall
560
+ back to line diffs.
561
+
562
+ `--display inline|side-by-side|json` · `--color WHEN` · `--background dark|light` ·
563
+ `-c/--context N` · `--skip-unchanged` · `--check-only` · `--list-languages` ·
564
+ `--byte-limit N`
565
+
566
+ ```bash
567
+ difft old.ts new.ts
568
+ difft --display inline --color never a.go b.go
569
+ difft --check-only a.py b.py
570
+ ```