@rob-c/pi-managed-tools 0.16.0 → 0.23.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.
- package/BUSYBOX-CONTRACT.md +440 -0
- package/CHANGELOG.md +441 -0
- package/README.md +464 -35
- package/package.json +7 -4
- package/skills/busybox-applets/SKILL.md +142 -15
- package/skills/managed-tools/SKILL.md +201 -25
- package/skills/managed-tools-reference/SKILL.md +206 -38
- package/src/agentops.ts +813 -0
- package/src/agenttools.ts +391 -0
- package/src/bashtool.ts +103 -0
- package/src/build.ts +142 -0
- package/src/context.ts +157 -0
- package/src/display.ts +79 -0
- package/src/extension.ts +817 -28
- package/src/guard.ts +437 -0
- package/src/jobs.ts +1052 -0
- package/src/timing.ts +364 -0
- package/src/tools.ts +525 -42
- package/src/userstdin.ts +524 -0
- package/src/wrap.ts +683 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
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
|
|
3
|
+
description: "Exact flags and worked examples for the pinned fd, rg, bat, just, gron, shellcheck, ast-grep, ninja, prek and busybox binaries. Load before invoking any of them, especially for structural edits (ast-grep), build invocation (ninja, just) or reducing a long log (brief)."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Managed tools — exact reference
|
|
@@ -9,26 +9,17 @@ Versions are fixed by `pi-managed-tools`; every flag listed exists in the
|
|
|
9
9
|
installed build and nothing else is needed.
|
|
10
10
|
|
|
11
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
|
|
12
|
+
shellcheck 0.11.0 · ast-grep 0.51.3 · ninja 1.13.2 · prek 0.5.11
|
|
13
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
14
|
agent-browser 0.43.0 · ruff 0.17.6 · mise 2026.11.11
|
|
15
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
16
|
|
|
17
17
|
## Policy
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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.
|
|
19
|
+
Order: these binaries over the system ones, then `brief` when a log is long. Nothing
|
|
20
|
+
here decides *for* you what to keep: `brief -d` collapses identical records and `-k` keeps
|
|
21
|
+
the ones you name verbatim, and `busybox_run` keeps the full capture in an artifact, so a
|
|
22
|
+
reduction never destroys the evidence.
|
|
32
23
|
|
|
33
24
|
Precedence for every other task: `rg` over `grep`, `fd` over `find`, `bat` over
|
|
34
25
|
`cat`, `ast-grep` over regex on code, `gron` over ad-hoc JSON parsing, `just -l`
|
|
@@ -94,7 +85,6 @@ Dry-run when unsure: `just -n` · `ninja -n` · `uv --dry-run` · `mise -n` ·
|
|
|
94
85
|
| 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
86
|
| 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
87
|
| 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
88
|
| 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
89
|
| 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
90
|
|
|
@@ -259,24 +249,6 @@ prek run ruff --files src/x.py
|
|
|
259
249
|
|
|
260
250
|
`install` writes `.git/hooks` — confirm with the user before running it.
|
|
261
251
|
|
|
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
252
|
## jq — JSON
|
|
281
253
|
|
|
282
254
|
`jq [opts] FILTER [file...]` · input from stdin or files.
|
|
@@ -360,7 +332,7 @@ gh api repos/{owner}/{repo}/pulls --jq '.[].title'
|
|
|
360
332
|
gh pr diff 123
|
|
361
333
|
```
|
|
362
334
|
|
|
363
|
-
`gh pr diff` is content you must read
|
|
335
|
+
`gh pr diff` is content you must read as written.
|
|
364
336
|
|
|
365
337
|
## bd — issue tracker
|
|
366
338
|
|
|
@@ -530,13 +502,13 @@ echo 'x=1' | sd 'x' 'y'
|
|
|
530
502
|
|
|
531
503
|
Always preview with `-p` first: without it the matched files are rewritten.
|
|
532
504
|
|
|
533
|
-
## busybox —
|
|
505
|
+
## busybox — 276 applets in one binary
|
|
534
506
|
|
|
535
507
|
`busybox <applet> [args]` · v1.39.0, statically linked. Dispatches on **argv[0]**, so
|
|
536
508
|
the installed file must stay named `busybox`.
|
|
537
509
|
|
|
538
510
|
```bash
|
|
539
|
-
busybox --list # all
|
|
511
|
+
busybox --list # all 276 applet names
|
|
540
512
|
busybox hexdump -C file.bin
|
|
541
513
|
busybox sha256sum file
|
|
542
514
|
busybox unzip archive.zip
|
|
@@ -548,12 +520,208 @@ write, is in the `busybox-applets` skill — load it before running any applet t
|
|
|
548
520
|
is not obviously an inspection command.
|
|
549
521
|
|
|
550
522
|
**Do not run `busybox --install -s <dir>`.** In pi's bin directory (first on `PATH`)
|
|
551
|
-
it would put
|
|
523
|
+
it would put 276 applets ahead of the real coreutils, and busybox `sed`, `grep`,
|
|
552
524
|
`find`, `tar` and `awk` are not GNU-compatible. Prefer this package's dedicated
|
|
553
525
|
tools (`rg`, `fd`, `bat`, `jq`, `scc`, `difft`) and use busybox for what nothing
|
|
554
526
|
else covers: `hexdump`, `xxd`, `unzip`, `gzip`, `patch`, `cpio`, `dpkg-deb`,
|
|
555
527
|
`sha*sum`, `date`, `hostname`.
|
|
556
528
|
|
|
529
|
+
### The three pi tools, and which applet each wraps
|
|
530
|
+
|
|
531
|
+
The tools are registered by this package; `/managed-tools status` says whether the wrapper is
|
|
532
|
+
on and at which verbosity/pty mode.
|
|
533
|
+
|
|
534
|
+
| tool | wraps | use it when |
|
|
535
|
+
|---|---|---|
|
|
536
|
+
| `busybox_peek` | `peek PATH --lines/--around … --format json` | you need the file's `sha256` to guard an edit, lines around a literal match, or a byte-bounded read with a continuation cursor |
|
|
537
|
+
| `busybox_replace` | `busybox replace` (single edit) or `busybox replace --request` (a batch) | you have a version from `busybox_peek` and want stale-input rejection, `dry_run` diffs, and all edits validated before any write |
|
|
538
|
+
| `busybox_run` | `busybox run --timestamps --pty-split --format json`, and `busybox log RUN` when `run_id` is given | you need the structured record rather than the timeline: separate stdout/stderr, artifacts, `--stream timeline`, or a retrieval by `lines`/`match` |
|
|
539
|
+
|
|
540
|
+
Both `--sha256` and the tools' `sha256` accept the 12-character prefix `peek` prints. A
|
|
541
|
+
`match` with no `stream` searches stdout and then stderr before reporting NOT_FOUND.
|
|
542
|
+
|
|
543
|
+
### brief — reduce a log to its shape, without cutting it
|
|
544
|
+
|
|
545
|
+
`brief [OPTS] [FILE]` · stdin or a file · text by default, `-F json` for schema 1.
|
|
546
|
+
It reduces **records**, and a record is one line — or, with `-R STR`, every line up to the
|
|
547
|
+
next match, so a stack trace, a commit or a test failure is one record. A record is shown
|
|
548
|
+
whole or not at all: the byte budget drops records, it never truncates one.
|
|
549
|
+
|
|
550
|
+
| flag | effect |
|
|
551
|
+
|---|---|
|
|
552
|
+
| `-d` | group identical records, print `Nx <line>` |
|
|
553
|
+
| `-s` | group records equal **after masking digits** (implies `-d`) — the flag that fires on real logs |
|
|
554
|
+
| `-t N` | order groups by count, highest first |
|
|
555
|
+
| `-m N` | only groups seen at least N times |
|
|
556
|
+
| `-o STR` / `-x STR` | show only / drop records containing STR (repeatable, OR) |
|
|
557
|
+
| `-R STR` | a record *starts* at each line containing STR — **literal, not a regex**; `-R '^FAILED'` matches nothing |
|
|
558
|
+
| `-k STR` | keep records containing STR verbatim, never merged |
|
|
559
|
+
| `-c LIST` | group by these 1-based fields (`1`, `3-4`) and count them |
|
|
560
|
+
| `-f LIST` | show only these fields; `-i SEP` input separators, `-S SEP` join |
|
|
561
|
+
| `-q` | bare records: no `Nx ` and no `+ ` prefix (for piping on) |
|
|
562
|
+
| `-B N` | output budget, default 8000 bytes. Must exceed the body you want: `-B 0` shows **nothing** in this build, so use a number larger than the input for "everything" |
|
|
563
|
+
| `-n N` | maximum distinct records kept, default 2000 |
|
|
564
|
+
| `-a N` | samples per group, 1–8, printed with a `+ ` prefix so they cannot read as repeats |
|
|
565
|
+
|
|
566
|
+
```bash
|
|
567
|
+
brief -o error -o FAILED build.log # the failures, whole, nothing merged
|
|
568
|
+
brief -s -t 10 pytest.log # the ten most frequent shapes
|
|
569
|
+
brief -s -k FAILED pytest.log # collapse repeats, keep failures verbatim
|
|
570
|
+
brief -R FAILED pytest.log # each failure with its traceback and summary (literal match)
|
|
571
|
+
brief -o error -c 1 -t 10 -i : tsc.log # ten files with the most errors
|
|
572
|
+
brief -B 500000 -q build.log | sort -u # hand the whole body to another command (note: -B 0 shows nothing)
|
|
573
|
+
brief -s -F json pytest.log # numbers, a summary sentence, and hints
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
Measured on a 646-line pytest log (33 500 B): `-s` returned 8 records in 381 B
|
|
577
|
+
(`merged=638`); `-d` alone left 162 records and hit the budget, because every line had a
|
|
578
|
+
different index. `-o error` returned the 40 diagnostic lines exactly (`truncated_by=selection`).
|
|
579
|
+
|
|
580
|
+
Two build behaviours to know before trusting a number: `-R` matches **literal** text, so an anchored pattern reports `matched=1, shown_lines=0` and shows nothing, and `-B 0` is a *zero* budget — it prints the marker and no records, even though the JSON hint calls it "no limit". Verify with the marker rather than the hint.
|
|
581
|
+
|
|
582
|
+
**The marker line is the honest part.** `[brief] lines_in=… records=… kept=… shown_lines=…
|
|
583
|
+
merged=… dropped_records=… dropped_lines=… nul=… bytes=… truncated=… shown_groups=…
|
|
584
|
+
projected=… bare=… top=… min=… matched=… in_bytes=… truncated_by=…`. Read `merged` (what
|
|
585
|
+
collapsed), `dropped_records` (what was not shown, including records before the first `-R`
|
|
586
|
+
match), and `truncated_by`: `budget` (raise `-B`), `selection` (that *is* everything that
|
|
587
|
+
matched), `record_size` (a single record did not fit or had no match) or `-` (nothing cut).
|
|
588
|
+
|
|
589
|
+
**`-F json`** adds `schema`, a one-sentence `summary` ("646 lines in, 8 records, all shown,
|
|
590
|
+
381 of 33500 body bytes, complete"), `pct_of_input`, and `hints[]` that name the flag which
|
|
591
|
+
would change the answer ("638 lines are repeats of a shown record: -t 10 ranks them first").
|
|
592
|
+
Per-group objects are `items[]: {n, lines, kept, line}`; `records` is a count, not the list.
|
|
593
|
+
|
|
594
|
+
Rules of thumb: `-s` before `-d`; `-t` when you want the shape rather than the list; `-k`
|
|
595
|
+
for anything you must see verbatim; never reduce the only copy of the evidence; and never
|
|
596
|
+
`brief` output you are about to parse or diff — that is what `command` and `busybox_run` are
|
|
597
|
+
for.
|
|
598
|
+
|
|
599
|
+
### The other agent-facing applets: waitfor, doctor, json, snapshot, patchcheck, bench, why, mark, outline, patchapply
|
|
600
|
+
|
|
601
|
+
The six applets with a full section above (`peek`, `replace`, `run`, `log`, `brief`) and the
|
|
602
|
+
three pi tools cover reads, edits and runs. These ten cover everything else a session
|
|
603
|
+
tends to hand-roll:
|
|
604
|
+
|
|
605
|
+
| applet | what it is for | example |
|
|
606
|
+
|---|---|---|
|
|
607
|
+
| `waitfor` | bounded readiness: `--file`, `--tcp host:port`, `--unix`, `--http url --expect 200`; `-T` deadline, `-i` poll interval | `busybox waitfor --tcp 127.0.0.1:8080 --timeout 20` |
|
|
608
|
+
| `doctor` | what this CLI is: `platform`, `cwd`, `exe`, `shell`, `tmp` writability, `--deps a,b` paths | `busybox doctor --deps git,python3` |
|
|
609
|
+
| `json` | query without `jq` (`-f FILE`, `-g '.a.b[2]'`, `-k`/`-t`/`-n`, `-c` validate) and now **edit guarded**: `-g PATH --set --value S` or `--json-value JSON`, `-g PATH --delete`, `--dry-run` previews; parses first, a missing parent is refused (exit 1), temp+rename | `busybox json -f pkg.json -g '.version' --set --json-value '"2.0.0"'`, `busybox json -f d.json -g '.stale' --delete --dry-run` |
|
|
610
|
+
| `snapshot` | hash a tree in one pass (`<sha256> <bytes> <path>` per file), `-o FILE`, `--diff A B` | `busybox snapshot -d src -o before.txt`, then `--diff before.txt after.txt` |
|
|
611
|
+
| `patchcheck` | every `*.patch` in a directory parses: `ok <file>` + `checked=N bad=M` | `busybox patchcheck -d patches` |
|
|
612
|
+
| `bench` | time a command N times after warmup: `run=1 ms=5.530 status=0` + `min/median/max` | `busybox bench -n 5 -w 1 -- ./build.sh` |
|
|
613
|
+
| `why` | is this applet in the binary, and which config line decided it (`-C .config`, `-p prune`) | `busybox why grep --format json` |
|
|
614
|
+
| `mark` | name a moment inside the current run's timeline (`<run>/marks`, µs + name) | `busybox mark built-ok` inside a script, then `busybox log <R> --marks` |
|
|
615
|
+
| `outline` | a file's definitions with line, byte offset and a version each — the index to `peek`/`busybox_replace` | `busybox outline -f json src/tools.ts` |
|
|
616
|
+
| `patchapply` | apply a unified diff with every hunk verified first; `-c PATH=HASH` refuses on drift; `-n` dry-run | `busybox patchapply -c src/a.ts=<sha256> fix.patch` |
|
|
617
|
+
|
|
618
|
+
Each takes `--format json` (schema 1) and follows the same exit codes (0 ok, 1 refused, 2
|
|
619
|
+
usage, 3 timeout). Details worth knowing before trusting an answer:
|
|
620
|
+
|
|
621
|
+
- `busybox json -c` prints nothing on success and `INVALID_JSON at byte N: …` with exit 1 on
|
|
622
|
+
failure — validation, not a parse-then-report.
|
|
623
|
+
- `snapshot --diff` reports `added` / `removed` / `changed` counts and the paths; it compares
|
|
624
|
+
content hashes, so it cannot say *what* changed inside a file.
|
|
625
|
+
- `patchcheck` checks that each patch **parses**. A patch that parses but would conflict
|
|
626
|
+
still reports `ok`, so use it as a format gate, not an apply test.
|
|
627
|
+
- `bench` discards the command's output and reports timing only; `-w` warmup runs are not
|
|
628
|
+
counted.
|
|
629
|
+
- `why` needs a `.config` (`-C`). With none it answers `unknown <applet>` plus `symbol=…` and
|
|
630
|
+
`config: (no <APPLET> entry in .config)`, and exits **0** even though the JSON payload
|
|
631
|
+
carries `"status":"error","code":"NOT_FOUND"` — read the payload, not the exit code.
|
|
632
|
+
- `waitfor --tcp` proves the port accepts connections, not that the application behind it is
|
|
633
|
+
ready; `--http` is implemented for `http://` only.
|
|
634
|
+
|
|
635
|
+
### Agent-facing applets: peek, replace, run, log, waitfor, doctor
|
|
636
|
+
|
|
637
|
+
Six applets with one contract: text by default, `--format json` (`"schema":1`) on
|
|
638
|
+
request, byte budgets, and `shown_bytes`/`truncated` reported. Exit codes are the
|
|
639
|
+
same everywhere: **0** ok (truncation is still 0), **1** refused/failed, **2** usage,
|
|
640
|
+
**3** timeout or cancellation. Error codes in the payload decide the message
|
|
641
|
+
(`STALE_INPUT`, `AMBIGUOUS_MATCH`, `NOT_FOUND`, `INVALID_ARGUMENT`, `TIMEOUT`,
|
|
642
|
+
`CANCELLED`, `CAPTURE_INCOMPLETE`, `UNSUPPORTED`). Exit 3 from a kill is **not** the
|
|
643
|
+
command failing: every wrapped bash call has a 120s default deadline, and when it fires the
|
|
644
|
+
result says `TIMEOUT — not a failure of the command` and points at `busybox log <R>` for
|
|
645
|
+
the partial capture — recover (extend `timeout`, narrow the command) rather than debug.
|
|
646
|
+
|
|
647
|
+
`peek` — numbered lines plus the file's version; ranges are 1-based and inclusive:
|
|
648
|
+
|
|
649
|
+
```bash
|
|
650
|
+
busybox peek src/server.ts --lines 120:180 # 120 through 180
|
|
651
|
+
busybox peek src/server.ts --around handleConnection --context 20
|
|
652
|
+
busybox peek src/server.ts --around 'def \w+' --regex --context 5
|
|
653
|
+
busybox peek big.log --from-byte 2841 --max-bytes 16000 # continue a truncated read
|
|
654
|
+
busybox peek --request reads.json --format json # batch, one shared budget
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
`replace` — literal, validated-before-write, atomic; `--expect` defaults to 1 and a
|
|
658
|
+
mismatch leaves the file byte-identical:
|
|
659
|
+
|
|
660
|
+
```bash
|
|
661
|
+
busybox replace a.ts --old 'const timeout = 1000;' --new 'const timeout = 5000;' --dry-run
|
|
662
|
+
busybox replace a.ts --old 'timeout = 1000' --new 'timeout = 5000' --sha256 <hex from peek>
|
|
663
|
+
busybox replace a.ts --old 'x' --new 'y' --expect 3
|
|
664
|
+
busybox replace --request edits.json --format json # {"edits":[{"path","old","new","expect"}]}
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
`run`/`log` — argv is exec'd verbatim, or `--shell` for a shell line; stdout and
|
|
668
|
+
stderr are separate 0600 artifacts and the view is a bounded head+tail. `-t` is the
|
|
669
|
+
timeline (`[0.011354789 out] line`, ns stamps with `-n`, interleaved by arrival; a truncated view keeps the head and the tail and marks the cut between them), `-q` drops the summary,
|
|
670
|
+
`-b WHICH` reduces a stream through `brief`, `-e NAME=VALUE` sets one variable for the
|
|
671
|
+
child, `-P` prints the child's process group, `-i FILE` feeds stdin, `-r N` prunes old runs, `-W SECS` is an idle timeout (kill after silence; the wrapper always applies 120s), `-C N` bounds capture bytes per stream, `-d DIR` sets the child's cwd, `-x/--effects` reports files created/changed/removed under the run's cwd (**JSON output only** — text mode does not print it in this build), and `--format json` reports what the command *did*: `cpu_user_ms`/`cpu_sys_ms`, `max_rss_kb`, `binary`, `dropped_bytes`, `final_newline`, `cwd_start`, `argv`, `effects` and a re-runnable `replay` line
|
|
672
|
+
runs. `--timestamps` overrides `--brief` in this build. **Do not use `2>&1` in any command
|
|
673
|
+
here**: it points the child's fd 2 at stdout before the wrapper ever sees the bytes, so
|
|
674
|
+
stderr arrives tagged `[out]` and the timeline cannot tell a warning from program output
|
|
675
|
+
(`echo err >&2` alone is fine — that is a *demonstration* of the `err` tag; it is the merge
|
|
676
|
+
that destroys the fact). The two reflexes and their replacements, benchmarked on real
|
|
677
|
+
sessions: silencing noise → `cmd >/dev/null` or `cmd 2>/dev/null` (drop one stream, keep
|
|
678
|
+
the other tagged) instead of `cmd >/dev/null 2>&1`; filtering stderr → run plainly, read
|
|
679
|
+
the `[err]` lines, or `busybox log <R> --stream stderr --match <literal>` instead of
|
|
680
|
+
`cmd 2>&1 | grep …`; a background server's logs — `cmd >srv.log 2>srv.err &`, never
|
|
681
|
+
`>srv.log 2>&1 &`, so a crash read back from the log still reads as what it is:
|
|
682
|
+
|
|
683
|
+
The wrapper blocks a merge found in the command's *tail* (last two lines, ~24 chars each)
|
|
684
|
+
before running it — the blocked call returns the rewrite guidance above. Deep scripting is
|
|
685
|
+
out of its scope by design; declare a deliberate merge with `# pitime-safe` and the result
|
|
686
|
+
will say its tags are not evidence. Results also state their own holes: a discarded
|
|
687
|
+
stream, a backgrounded process, or a fully `command`-escaped call each earn a note saying
|
|
688
|
+
what is unknowable from them:
|
|
689
|
+
|
|
690
|
+
```bash
|
|
691
|
+
busybox run --timeout 120 -- python -m pytest -q
|
|
692
|
+
busybox run -t --pty-split --max-bytes 48000 -- sh -c 'make -j8; echo done >&2'
|
|
693
|
+
busybox run -q -t --env PYTHONUNBUFFERED=1 -- python3 app.py
|
|
694
|
+
busybox run --brief both --max-bytes 12000 -- pytest -q # one call, both streams reduced
|
|
695
|
+
busybox run --format json -- sh -c 'echo out; echo err >&2'
|
|
696
|
+
busybox log R7 --stream timeline
|
|
697
|
+
busybox log R7 --match FAILED --context 8
|
|
698
|
+
busybox log R7 --lines 200:280 --stream stderr
|
|
699
|
+
busybox log R7 --meta
|
|
700
|
+
busybox log --diff R7:R8
|
|
701
|
+
busybox brief -d -t 5 -- less /tmp/build.log
|
|
702
|
+
```
|
|
703
|
+
|
|
704
|
+
`waitfor` — one deadline, poll interval backing off 20 ms → 200 ms; TCP means the
|
|
705
|
+
port accepts connections, not that the app is ready:
|
|
706
|
+
|
|
707
|
+
```bash
|
|
708
|
+
busybox waitfor --tcp 127.0.0.1:8080 --timeout 20
|
|
709
|
+
busybox waitfor --http http://127.0.0.1:8080/health --expect 200 --timeout 20
|
|
710
|
+
busybox waitfor --file /tmp/ready --timeout 5
|
|
711
|
+
```
|
|
712
|
+
|
|
713
|
+
`doctor` and `--caps` — what this build actually is, without dumping secrets:
|
|
714
|
+
|
|
715
|
+
```bash
|
|
716
|
+
busybox --caps --format json
|
|
717
|
+
busybox doctor --deps git,make,python3
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
**Known build bug:** `run --format json` prints an invalid payload when the view is
|
|
721
|
+
truncated (head and tail become two adjacent quoted strings). The metadata is intact
|
|
722
|
+
and the capture is complete — read the fields, then `busybox log RUN` for the view.
|
|
723
|
+
Never re-run the command to get a parseable answer.
|
|
724
|
+
|
|
557
725
|
## difftastic — structural diffs
|
|
558
726
|
|
|
559
727
|
`difft [OPTIONS] OLD-PATH NEW-PATH` · compares syntax trees; unknown languages fall
|