Skip to content

docs(v2): PROTOTYPE — generate the CLI reference from the stash CLI#45

Draft
coderdan wants to merge 3 commits into
v2from
docs/v2-cli-generator
Draft

docs(v2): PROTOTYPE — generate the CLI reference from the stash CLI#45
coderdan wants to merge 3 commits into
v2from
docs/v2-cli-generator

Conversation

@coderdan

@coderdan coderdan commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Generates /reference/cli from the shipped stash CLI so the reference can't drift, per our discussion. Draft — approach review, not final content.

Pipeline

scripts/generate-cli-docs.ts (bun run generate-docs:cli, wired into prebuild):

  • Always tracks the latest published version — resolves npm view stash version, runs that version's --help live, stamps every page (verifiedAgainst.cli + banner). Offline → cached fixture. A new stash release refreshes the docs on the next build.
  • One page per top-level command, grouped Setup · Auth · Database · Schema · Encrypt · Deployment; [cli]/[cli, eql] by the content-model rule; db flags resolved per-subcommand.

Hybrid content (rich prose + examples)

The bare --help is thin. So the generator merges an optional hand-authored supplement (scripts/cli-supplements/<command>.md) after the generated skeleton — rich narrative + curated examples authored now, without waiting on the CLI. Demonstrated on auth (device-code flow + keyset binding). Supplements live outside content/ (never wiped/routed).

Data source: bootstrap → target

Today we parse stash --help (hand-written string in the CLI, the drift source; per-command --help is inconsistent — auth has it, db doesn't). Target: add stash manifest --json + proper per-command long-help/examples to the CLI (GitHub-CLI/cobra model), then swap loadManifest() to read it and delete the parser — page format unchanged. The Manifest type here is the contract for that command. (Tracked separately for the stack repo.)

Notes surfaced

Open for review

  1. Reference vs guide split — deferred per your call (lifecycle narratives fold into Getting started / Migration guides later).
  2. Reconcile with docs(v2): rename dbeql CLI commands and move the CLI reference into /reference/cli #41's hand-moved CLI pages (these supersede them).
  3. Stack-repo contribution for per-command help + manifest --json — scope TBD.

https://claude.ai/code/session_01CqDNqLSEEkCi7xAJFq7HJA

PROTOTYPE for review. Generates /reference/cli from the shipped `stash` CLI
so the reference can't drift from the actual command surface, and stamps
every page with the CLI version it was generated from.

- scripts/generate-cli-docs.ts — parses `stash --help` (captured to a
  fixture) into a manifest, then renders one page per top-level command
  (grouped Setup/Auth/Database/Schema/Encrypt/Deployment) with a
  "Generated from stash v0.16.0" banner, a verifiedAgainst.cli facet, and
  [cli] / [cli, eql] components per the content-model tagging rule.
- `bun run generate-docs:cli` (package.json).
- scripts/fixtures/stash-help-0.16.0.txt — captured input.
- content/docs/reference/cli/* — generated output (10 command pages + index).

Bootstrap note: `stash` 0.16.0 is a hand-rolled TS CLI with no machine-readable
output and no per-command --help, so we parse the single top-level --help.
Target: add `stash manifest --json` to the CLI, then swap loadManifest() to
read it and delete the parser — the page format stays identical. Today's
--help is thin (no args, no per-command examples, auth/encrypt subcommands
undetailed); those gaps are exactly what the JSON manifest fills.

Surfaces the drift too: 0.16.0 uses `db install` (not `eql install`) and has
~15 commands the hand-written pages never documented.

Claude-Session: https://claude.ai/code/session_01CqDNqLSEEkCi7xAJFq7HJA
@vercel

vercel Bot commented Jul 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
public-docs Ready Ready Preview, Comment Jul 5, 2026 1:31pm

Request Review

…build

- Resolve the latest published version via `npm view stash version` and run
  that exact version live, so a new `stash` release refreshes the docs the
  next time the script runs (offline: falls back to the cached fixture).
  Removes the pinned CLI_VERSION constant.
- Wire `generate-docs:cli` into `prebuild`, next to the EQL/TypeDoc generators,
  so every production build regenerates the CLI reference from the latest CLI.
- Rename the fixture to a version-agnostic cache (scripts/fixtures/stash-help.txt).

Claude-Session: https://claude.ai/code/session_01CqDNqLSEEkCi7xAJFq7HJA
…amples

Adds a supplement hook to the CLI generator: an optional
scripts/cli-supplements/<command>.md is merged after the generated reference
(synopsis + flags), so the rich per-command narrative and curated examples the
thin `stash --help` can't provide can be authored now, without waiting on the
CLI. Supplements live outside content/ so they're never treated as pages or
wiped by the clean step. Demonstrated on `auth` (device-code flow + keyset
binding, grounded in the CLI source).

Content-model direction: per-command reference detail (examples, flag help)
should migrate into the CLI itself (long-help + examples, GitHub-CLI/cobra
style) and be generated from there; cross-command conceptual narrative (the
profile / workspace model) belongs in a linked CLI concept page. The
supplement hook is the interim bridge and the seam for both.

Claude-Session: https://claude.ai/code/session_01CqDNqLSEEkCi7xAJFq7HJA
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