Skip to content

feat: generate CLI reference docs on release - #1033

Open
u9g wants to merge 3 commits into
mainfrom
jason/generate-docs
Open

u9g wants to merge 3 commits into
mainfrom
jason/generate-docs

Conversation

@u9g

@u9g u9g commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

docs.livekit.io's CLI reference is hand-written, so every flag or subcommand change in lk has to be re-documented separately and drifts almost immediately. This makes the CLI's own help text the source of truth for that reference.

  • lk generate-docs <command path> (hidden) prints a command's usage line, its subcommands, and its options as markdown, in the format the docs.livekit.io CLI reference already uses:

    ```shell
    lk agent deploy [options] [working-dir]
    ```
    
    Options for `deploy`:
    
    - `--deployment NAME` (alias `-d`): NAME of the deployment. Defaults to production.
    

    It reads the same flag data --help prints: the first backticked word in a flag's usage is its value placeholder, defaults come from the flag's value, and hidden commands, hidden flags, and the --help flag are left out. The heading, description, and examples around it stay hand-written on the docs page.

  • Help text aligned with the docs: the CLI reference's current descriptions for the agent, simulate, debugger, private-link, cloud auth, project, and docs commands are ported into their help text, and every value flag gets a placeholder (--region REGION rather than --region string). Switching the docs to generated output then changes little on the page, and --help gets the docs' wording. cloud auth --revoke gets the usage text it was missing.

  • notify-docs.yaml runs when a release is published (prereleases are skipped). It dispatches livekit-cli-released with the tag to livekit/internal-actions, which forwards it to livekit/web. That workflow downloads the release's lk, regenerates the reference with lk generate-docs, and opens a docs PR. It uses the existing org secret SYNC_DISPATCH_TOKEN, the same relay agent-skills uses, so no credential that writes to livekit/web lives in this public repo.

To change wording on docs.livekit.io, edit the command's help text here; the next published release updates the docs.

Related:

How to verify

make build
./bin/lk generate-docs agent deploy
./bin/lk generate-docs agent simulate
./bin/lk agent deploy --help
./bin/lk generate-docs nope   # unknown command: lk nope, exit 1
./bin/lk --help | grep -c generate-docs   # 0, hidden
go test ./cmd/lk

@u9g

u9g commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

lk generate-docs printing agent deploy and agent simulate in the docs.livekit.io CLI reference format, the same help text in lk agent deploy --help with placeholders, the update banner staying on stderr when captured to a file, an unknown command failing, and the command staying hidden from lk --help.

generate-docs.mp4

u9g added 3 commits October 12, 2026 16:24
Prints a command's usage line, subcommands, and options as markdown in
the format docs.livekit.io's CLI reference uses (e.g.
`lk generate-docs agent deploy`). docs.livekit.io regenerates its CLI
reference from this on every release.
Ports the CLI reference's descriptions for the agent, simulate, debugger,
private-link, cloud auth, project, and docs commands into their flag and
subcommand help, and gives every value flag a placeholder, so the
generated reference reads like the current hand-written one.
@u9g
u9g force-pushed the jason/generate-docs branch from 48c59b8 to 3c9fe72 Compare October 12, 2026 20:32
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.

2 participants