docs(cli): generated agent-discoverable command & flag reference (DRG-483) - #20
Merged
Conversation
…G-483) Full docs covering every command and flag, generated from the CLI's own commander definitions so they can't drift from what the binary accepts. - `llms.txt` (llms.txt-standard index) + `llms-full.txt` (everything inline) at the repo root, and `docs/` with one page per command plus `global-options.md`. - `src/docs/reference.ts` walks the command tree and renders the docs deterministically (no dates/version); `pnpm docs:generate` writes them and a vitest drift guard fails `pnpm test` when the checked-in copies are stale (CI runs typecheck/build/test, so the guard is enforced there). - Extract a side-effect-free `buildProgram()` into `src/program.ts` so both the entry point and the generator build the same tree; `bin.ts` now imports it. - Give the positional args (`say [text]`, `api <endpoint>`, `voices get [voice-id]`) descriptions so they surface in both `--help` and the docs. - README: link the reference and document `pnpm docs:generate`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds full, agent-discoverable documentation covering every command and flag — generated from the CLI's own Commander definitions, so it can never drift from what the binary actually accepts.
What ships
llms.txt— the llms.txt-standard index (title, summary, links to each command).llms-full.txt— every command and flag inline, in one file.docs/— one page per command (login,logout,whoami,say,voices,voices list/get,api,mcp,mcp install) plusdocs/global-options.md.Each page has usage, arguments, command-specific options (with defaults, choices, required markers), and subcommand links.
How it's built
src/docs/reference.tswalks the Commander tree and renders the docs deterministically (no dates, no version) so a checked-in copy can be diffed.pnpm docs:generatewrites the files. A vitest drift guard failspnpm testwhen the checked-in copies are stale — and CI runstypecheck/build/test(not lint), so the guard is actually enforced.buildProgram()intosrc/program.ts; bothbin.tsand the generator build the same tree.Small CLI improvement
say [text],api <endpoint>,voices get [voice-id]) so they now show up in both--helpand the generated docs.Discovery
Context7 already indexes the repo (
context7.json), anddocs/+ thellms*.txtfiles are not excluded — so these land in the hosted index for answer engines.Testing
tsupbuild all clean.