@tokenade/cli 0.7.2 → 0.7.3

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.
Files changed (2) hide show
  1. package/README.md +11 -121
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -160,6 +160,8 @@ When reporting, please include your OS, `tokenade --version`, your coding agent,
160
160
  | **System & network** | `table` · `disk` · `netstat` · `dns` · `vmstat` · `filelist` · `grep` |
161
161
  | **Web & docs** | `web` · `serp` (aliases `google`/`bing`/`ddg`) · `snapshot` · `stealth` · `curl` · `docs` · `pdf` · `notebook` |
162
162
 
163
+ **Your own compactors.** `add-compactor --file <rules.toml>` teaches Tokenade to fold output from a command it doesn't cover yet (alias `add-filter`); `add-compactor --list` shows the ones you've added, and `add-compactor --help` prints the file format.
164
+
163
165
  ### Savings, receipts & reporting
164
166
 
165
167
  | Command | What it does |
@@ -348,132 +350,20 @@ $ tokenade execute --lang python --script 'print(sum(range(101)))'
348
350
  $ eval "$(tokenade shell-init)" # add to ~/.zshrc — git/cargo/kubectl/… auto-compact
349
351
  ```
350
352
 
351
- ### Format compactors
352
-
353
- `tokenade auto <file|->` auto-detects and dispatches — **the one to reach for**. Or call a format directly. All read a file or `-` (stdin).
354
-
355
- **`json`** — folds arrays of objects into a compact TOON table.
356
- ```text
357
- $ tokenade json api.json
358
- { "page": 1, "total": 20, "users": "<see [fold @ users] block below>" }
359
-
360
- [fold @ users] [×20 rows · toon] active,id,name,role
361
- true,1,"u1","user"
362
-
363
- ```
364
-
365
- **`logs`** — collapses runs of templated-equal lines (timestamps/IDs normalised).
366
- ```text
367
- $ tokenade logs app.log # 200 lines →
368
- <TS> INFO worker job=<N> status=done ms=<N> [×200 lines · e.g. job=1, ms=11]
369
- ```
370
-
371
- **`diff`** — caps context, folds multi-file patches.
372
- ```text
373
- $ git diff | tokenade diff -
374
- diff --git a/redact.rs b/redact.rs
375
- @@ -175,17 +175,24 @@ fn patterns() …
376
- …2 context line(s) elided…
377
- + r#"…(?:'[^']*'|"[^"]*"|[^\s]+)"#,
378
- ```
379
-
380
- **`csv` / `tsv`** — drop empty columns, cap rows, truncate cells.
381
- ```text
382
- $ tokenade csv users.csv
383
- id,name,email,signup,plan
384
- 1,Ada,ada@x.io,2024-01-02,pro
385
- # 1 empty column(s) dropped
386
- ```
387
-
388
- **`yaml`** — strips `managedFields`, `lastTransitionTime`, and other k8s noise.
389
- ```text
390
- $ kubectl get deploy web -o yaml | tokenade yaml -
391
- metadata:
392
- name: web
393
- managedFields: <dropped>
394
- status:
395
- conditions:
396
- - type: Available
397
- lastTransitionTime: <dropped>
398
- ```
353
+ ### Format & output compactors
399
354
 
400
- **`env`** compact an env dump **and redact secrets**.
401
- ```text
402
- $ env | tokenade env -
403
- AWS_SECRET_ACCESS_KEY=<redacted 17 chars>
404
- DATABASE_URL=<redacted 21 chars>
405
- # [tokenade:env] 2 secret(s) redacted
406
- ```
355
+ Tokenade includes a family of format-aware compactors the full list is in
356
+ the [CLI reference](#-cli-reference--every-command) above. Each reads a file or
357
+ `-` (stdin); when unsure, let Tokenade pick:
407
358
 
408
- **`table`** — any columnar CLI output (`docker ps`, `kubectl get`, `ps aux`).
409
- ```text
410
- $ docker ps | tokenade table -
411
- IMAGE STATUS PORTS NAMES
412
- nginx:latest Up 2 hours 0.0.0.0:80->80/tcp web
413
- ```
414
-
415
- **`stack`** — fold framework frames in a stack trace, keep your code + the error.
416
- ```text
417
- $ tokenade stack trace.txt
418
- /app/main.py:42 in <module> run()
419
- /app/db.py:17 in query raise ValueError("bad row")
420
- ValueError: bad row
421
- ```
422
-
423
- **`dns`** — keep the ANSWER section of `dig`/`host`, drop the pseudo-sections.
424
- ```text
425
- $ dig example.com | tokenade dns -
426
- example.com A NOERROR: 2 answers
427
- example.com. IN A 93.184.216.34
428
- ```
359
+ ```sh
360
+ tokenade auto <file> # auto-detect and compact
361
+ some-noisy-cmd | tokenade auto - # …or pipe stdin
429
362
 
430
- **`access`** group an nginx/Apache log by method + path + status.
431
- ```text
432
- $ tokenade access access.log
433
- 3 request(s) · status counts: 200=2, 500=1
434
- 2× GET /api/users [200]
435
- 1× POST /api/pay [500]
363
+ tokenade add-compactor --file my-rules.toml # teach Tokenade a new compactor
364
+ tokenade add-compactor --list # list the ones you've added
436
365
  ```
437
366
 
438
- The full family — same shape (`tokenade <name> file|-`), each tuned to one format:
439
-
440
- | Command | Common use → output |
441
- |---|---|
442
- | `md` | Markdown → drop front-matter, fold huge code blocks, strip ref-links |
443
- | `ndjson` | JSONL cloud logs → severity histogram + key-union schema |
444
- | `lock` | `Cargo.lock`/`yarn.lock` → flat `name@version` list |
445
- | `sql` | psql/mysql result table → capped, borderless rows |
446
- | `openapi` / `graphql` | API spec → endpoint / type + field list, no bodies |
447
- | `sourcemap` | `.map` → sources list, drop mappings blob |
448
- | `gitlog` | `git log` → `hash author subject` per commit |
449
- | `archive` | `tar -tvf`/`unzip -l` → names only, perms/size dropped |
450
- | `terraform` | `terraform plan` → fold "Refreshing state", drop unchanged attrs |
451
- | `k8s-manifest` | `helm template` → per-kind summary, drop spec bodies |
452
- | `describe` | `kubectl describe` → identity + status + warnings |
453
- | `systemd` | `systemctl status` → Active + Mem/CPU + ERR/WARN tail |
454
- | `journal` | `journalctl`/`dmesg` → group by service, surface ERR/WARN |
455
- | `container-logs` | `kubectl logs --prefix` → per-stream fold |
456
- | `grep` | `grep -r`/`rg` → group by file, top hits |
457
- | `filelist` | `find`/`tree`/`ls -laR` → per-dir counts + ext histogram |
458
- | `disk` | `du -h` → top entries by size |
459
- | `netstat` | `ss`/`netstat -an` → per-state counts, top LISTEN |
460
- | `vmstat` | `vmstat 1 N` → per-column min/mean/max + peaks |
461
- | `strace` | `strace`/`ltrace` → syscall counts + error summary |
462
- | `tcpdump` | `tcpdump` text → per-flow aggregation |
463
- | `metrics` | Prometheus `/metrics` → grouped, capped label combos |
464
- | `curl` | `curl -v` → fold TLS handshake + cert chain |
465
- | `cargo-bench` | criterion output → Δ-vs-baseline + regressions |
466
- | `jvmbuild` (`mvn`/`gradle`) | Maven/Gradle build → per-phase outcome |
467
- | `pkginstall` | pip/npm/cargo install → drop progress, keep installed list |
468
- | `ghactions` | GH Actions log → strip timestamps, keep `##[error]` |
469
- | `ansible` | `ansible-playbook` → per-task outcome, failures verbatim |
470
- | `web` | HTML page → clean markdown |
471
- | `serp` (`google`/`bing`/`ddg`) | raw search-results HTML → title/url/snippet |
472
- | `snapshot` | Playwright a11y-tree → compact tree |
473
- | `stealth` | page → detect Cloudflare/hCaptcha + remediation |
474
- | `docs` / `pdf` | `.docx`/`.xlsx`/`.pptx`/`.pdf` → plain text |
475
- | `notebook` | Jupyter `.ipynb` → code + outputs, strip base64 images |
476
-
477
367
  ### Savings, receipts & reporting
478
368
 
479
369
  **`gain`** — how many tokens you've saved.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenade/cli",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "Tokenade — cut your AI coding agent's token bill. Installs the Tokenade CLI (a local, paid token-reduction tool; activate via your browser).",
5
5
  "homepage": "https://tokenade.net",
6
6
  "license": "UNLICENSED",