Skip to content

docs(cli): full-contract help for interceptor save#119

Merged
ronaldeddings merged 2 commits into
mainfrom
docs/save-help
Jun 21, 2026
Merged

docs(cli): full-contract help for interceptor save#119
ronaldeddings merged 2 commits into
mainfrom
docs/save-help

Conversation

@ronaldeddings

@ronaldeddings ronaldeddings commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

Makes interceptor save self-describing for agents that run --help mid-task without the skill reference loaded.

interceptor save --help — full contract

Previously a single one-line slice; now a curated block covering everything needed to form a correct invocation in one shot:

  • Flags: --out (required, absolute), --isolated, --chunk-size, --json, --context, --tab
  • Accepted <expr> results: Blob | File | ArrayBuffer | typed array | blob: URL string | { url | blobUrl | href }
  • Response shape: { success, path, bytes, chunks, sha256 }
  • Notes: ordering (save first → WS sink), flags kept out of <expr>, integrity-checked write, strict-CSP support
  • A runnable example

Implemented via a small COMMAND_HELP map checked before the existing line-extraction fallback (extensible to other commands later). The main interceptor help line now points at save --help. No version bump — help text only. Adds a unit test asserting the curated block carries the flags/inputs/response/example.

Incidental CI fix (un-breaks main)

main is currently red: PR #118 (white-label tab-group) merged with failing CI — test/brand-tab-group.test.ts iterated string literals and asserted them against normalizeColor's chrome tabGroups color union, so toBe(c) failed tsc under tsconfig.host.json. This branch marks the array as const (compile-only, no runtime change) so bun run typecheck and CI pass green again.

Summary by CodeRabbit

  • New Features

    • Commands now display curated, detailed help text with standardized formatting for improved clarity.
  • Documentation

    • Updated save command help to clarify output path syntax and document available flags and usage options.

ronaldeddings and others added 2 commits June 21, 2026 07:46
`interceptor save --help` (and `-h`) now returns a curated, full-contract block
— flags (--out/--isolated/--chunk-size/--json/--context/--tab), accepted <expr>
result types, the structured response shape (sha256/bytes/chunks/path), the
ordering/integrity/strict-CSP notes, and a runnable example — instead of the
single one-line slice. The main `interceptor help` line now points at it.

The primary consumer is an AI agent running `save --help` mid-task without the
skill reference loaded, so the binary self-describes enough to form a correct
invocation in one shot. Adds a small COMMAND_HELP map (extensible to other
commands) checked before the existing line-extraction fallback.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
brand-tab-group.test.ts iterated string literals and asserted against
normalizeColor's chrome.tabGroups color union, so `toBe(c)` failed tsc under
tsconfig.host.json — leaving `bun run typecheck` (and CI) red on main. Mark the
array `as const` so the loop variable is the literal color union. Compile-only;
no runtime change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c07e402f-e5ef-47e2-b9c9-7dc243307e6f

📥 Commits

Reviewing files that changed from the base of the PR and between d2c4e7b and 6969b33.

📒 Files selected for processing (3)
  • cli/help.ts
  • test/brand-tab-group.test.ts
  • test/cli-meta-additions.test.ts

📝 Walkthrough

Walkthrough

cli/help.ts gains a COMMAND_HELP map holding curated multi-line help for specific commands (currently save). helpForCommand now checks this map first, returning curated content plus a footer instead of parsing the global HELP string. The save line in HELP is also reworded. A new test verifies the curated output, and an unrelated color validation test adds as const.

Changes

Per-command curated help for save

Layer / File(s) Summary
COMMAND_HELP map and helpForCommand routing
cli/help.ts
Adds COMMAND_HELP constant with curated multi-line help for save. Updates helpForCommand to check COMMAND_HELP first and return curated content plus a standardized footer; falls back to the original HELP-parsing path for unregistered commands. Updates the global HELP save entry wording to describe streaming bytes to disk.
helpForCommand smoke test and color type fix
test/cli-meta-additions.test.ts, test/brand-tab-group.test.ts
Adds a helpForCommand("save") test asserting the curated block includes --out, --isolated, --chunk-size, --json, ArrayBuffer, sha256, and interceptor save --json. Fixes as const cast in the color validation loop to narrow the type of c to color literals.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • Hacker-Valley-Media/Interceptor#61: Modifies the same helpForCommand function in cli/help.ts and corresponding CLI help tests to return per-command help output instead of the full global help string.

Poem

🐇 A map of commands, curated with care,
save now speaks clearly — its flags laid bare!
--out, --json, ArrayBuffer too,
No more parsing the haystack for needles anew.
The rabbit rejoices: help text done right! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'docs(cli): full-contract help for interceptor save' accurately reflects the main change in the PR, which is updating the help documentation for the interceptor save command.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/save-help

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ronaldeddings ronaldeddings merged commit db35d03 into main Jun 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant