Repository navigation
Conversation
|
generate-docs.mp4 |
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.
48c59b8 to
3c9fe72
Compare
#1040) * fix: describe --deployment for agent delete and promote agent delete deletes the whole agent when --deployment is unset, and agent promote rejects an unset --deployment, so the shared flag's "Defaults to production" was wrong for both. They now have their own flag, and promote requires it. * feat: list command aliases in generate-docs output Each alias gets its own usage line and joins the options label, the way the docs.livekit.io CLI reference wrote them by hand (lk agent logs / lk agent tail). * feat: add generate-docs --list Prints every command under a path that the reference documents: commands that are run, and groups with their own options. docs.livekit.io generates a partial for each, so a new command can't go missing from the reference.
… options The docs reference lost three things --help shows: which flags are required (lk agent promote --deployment, lk agent rollback --version), the environment variable a flag reads (LIVEKIT_AGENT_DEPLOYMENT on lk agent dev), and that lk agent simulate text and audio take the options on lk agent simulate.
…reate Neither flag is read: lk agent create always deploys to production, and lk agent deploy keeps the region the agent was created in. Both still parse, hidden, so existing scripts keep working.
Comparing the generated reference with the hand-written docs.livekit.io pages found help text that was wrong or dropped what the pages said: - agent rollback --version is required; it never defaulted to the previous version. - agent update-secrets --overwrite replaces every secret, not only the keys given. - agent deploy --image and --image-tar ignore --deployment. - agent versions --attribute and --attributes filter versions instead of recording attributes. - project list --json includes each project's API key and secret. - agent init: when --lang, --install, --skills, and --region prompt or fall back, that --region is used only with --deploy, and that --deploy implies --install. - --log-level accepts CRITICAL for Python and FATAL for Node.js. - Each debugger subcommand's --json says what it prints (NDJSON for events), and debugger logs has no --json. - simulate --samples accepts 1 or 3, --pass-rate needs more than one sample, and export takes any finished run. - private-link create --endpoint accepts an Azure Private Link Service alias.
|
generate-docs-fixes.mp4 |
- `lk generate-docs` with no command path panicked; it now errors and points to --list. --list no longer prints a blank line for the root. - Required and Default markers come only from the flag definition. The generator no longer skips them when the usage text happens to contain "Required" or "Default", private-link drops its hand-written "Required.", and --help now marks required flags with "(required)". - The generator prints duration defaults as 30m, not 30m0s, and honors HideDefault. The debugger's DefaultText derives from its constants. - `project add` shows its arguments as optional, since the CLI asks for any that are missing. - `debugger stop --metrics` says it requires --chat-history. - Help text says "non-interactive mode" instead of "with --yes or without a terminal". - notify-docs fires on `released`, so promoting a prerelease to a full release also regenerates the docs. Prereleases still don't trigger it. - Add generate_docs_test.go, including a pass over the real command tree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I made some small changes: some rephrasing, reusing default values, and adding a test. I changed the github action to |
| &cli.StringFlag{ | ||
| Name: "name", | ||
| Usage: "Private link name", | ||
| Usage: "`NAME` for the private link. Required.", |
There was a problem hiding this comment.
Sometimes "required" is in the usage text and sometimes it's not (for example, endpoint). It would be preferable to not include it in the text consistently and just use the Required field to document it.
docs.livekit.io's CLI reference is hand-written, so every flag or subcommand change in
lkhas 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:It reads the same flag data
--helpprints: 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--helpflag 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 REGIONrather than--region string). Switching the docs to generated output then changes little on the page, and--helpgets the docs' wording.cloud auth --revokegets the usage text it was missing.What
--helpknows but the docs dropped:generate-docsnow marks required flags ("Required."), names the environment variable a flag reads (LIVEKIT_AGENT_DEPLOYMENTonagent dev,LK_SESSION_PORTon the debugger), and sayssimulate textandaudiotake thesimulateoptions.Help text fixed after comparing it with the current docs.livekit.io pages:
rollback --versionis required (it never defaulted to the previous version);deploy --regionandcreate --deploymentwere never read, so they're hidden (still accepted);update-secrets --overwritereplaces every secret;deploy --image/--image-tarignore--deployment;versions --attribute(s)filter;project list --jsonincludes API secrets;initsays when--lang,--install,--skills, and--regionprompt or fall back; each debugger--jsonsays what it prints;--samplesaccepts 1 or 3;exporttakes any finished run;private-link create --endpointtakes an Azure Private Link Service alias.notify-docs.yamlruns when a release is published (prereleases are skipped). It dispatcheslivekit-cli-releasedwith the tag to livekit/internal-actions, which forwards it to livekit/web. That workflow downloads the release'slk, regenerates the reference withlk generate-docs, and opens a docs PR. It uses the existing org secretSYNC_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