Uh oh!
There was an error while loading. Please reload this page.
ci: add -subdir flag to gen-docs to support cloud CLI extension docs - #980
ci: add -subdir flag to gen-docs to support cloud CLI extension docs#980lennessyy wants to merge 11 commits into
Conversation
Add a `-split` flag that specifies command names whose subcommands
should each get their own file in a subdirectory rather than all being
combined into a single file.
This is needed for the cloud CLI extension, which has ~130 commands
that would produce an unmanageably large single page. With `-split
cloud`, gen-docs produces cloud/namespace.mdx, cloud/user.mdx, etc.
Also fixes the encodeJSONExample regex to catch standalone JSON objects
in single quotes (e.g., '{"key":"value"}'), not just key=value patterns.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>Leaf commands (e.g., cloud login) that have no subcommands no longer reference a nonexistent #global-flags anchor. Instead they render their description and options directly on the page. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
gen-docs now produces an index.mdx that lists all command reference pages with links, including split commands like cloud/*. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Each split parent (e.g., cloud) now gets its own index.mdx listing its subcommand pages. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The leafParts were joined with an empty string, producing headings like "cert-cacreate" instead of "cert-ca create". Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
chaptersix
commented
Apr 30, 2026
Suggestion: rename
This also reads more naturally as the flag gets used alongside go run ./cmd/gen-docs \
-input internal/temporalcli/commands.yaml \
-input cliext/option-sets.yaml \
-input ../cloud-cli/temporalcloudcli/commands.yml \
-output dist/docs \
-subdir cloudAlso suggest updating the flag description from:
to:
|
The flag name now describes the output structure rather than the internal transformation, making usage in Makefiles and CI more immediately understandable. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…lio/cli into docs/gen-docs-split-flag
…#1112) ## Summary This consolidates the excellent groundwork in #980, #1076, and #981 into a single change, and verifies the result against a real Docusaurus 3.10.1 build. Huge thanks to @lennessyy — the approach here is entirely built on those PRs; this just stitches them together and irons out a few interactions between them. gen-docs now escapes the patterns that break Docusaurus MDX (JSX) compilation, on **every** path that writes a command description (including the new split paths): - bare angle-bracket placeholders in prose (e.g. `<base64-encoded-cert>`, `<key>`) → `\<...\>` - single-quoted JSON examples (e.g. `'{"a":"b"}'`, `'Key={"a":"b"}'`) → braces escaped in body text, backticked in option tables - custom heading IDs (e.g. `## Heading {#id}`) → `{/* #id */}`, the form that compiles under Docusaurus 3.10 and still produces the custom anchor Fenced code blocks and inline code spans are left untouched. It also adds the `-subdir` flag (subcommands of the named command are written to a subdirectory, e.g. `-subdir cloud` → `cloud/*.mdx`, with deeper subcommands nested as headings), and a generic auto-generated notice. ## What changed relative to the existing PRs All three PRs were on the right track. The differences here are about how they interact: - **#1076 (MDX escaping):** kept as the core of this change, including the `{#id}` → `{/* #id */}` heading conversion — which I confirmed is exactly right for the 3.10 upgrade (see verification below). Escaping is now also applied to the `-subdir` split output, so cloud docs get the same treatment. Re-added unit tests for the escaping logic. - **#980 (`-subdir`):** kept the split mechanism. Unified the `encodeJSONExample` regex so it matches both `'{...}'` and `'Key={...}'` (the standalone-vs-key-value cases the two PRs handled separately). Intentionally did **not** carry over #980's index-page generation: `command-reference/index.mdx` and `cloud/index.mdx` are hand-maintained on the docs site (custom ordering, the `ReleaseNoteHeader` component), so gen-docs deliberately does not emit them — generating them would overwrite that curated content. The companion docs PR restores those files after each regeneration. - **#981 (generic notice):** folded in — the previous notice pointed at paths that no longer exist and don't hold for cloud-cli inputs. ## Companion PR temporalio/documentation#4836
Summary
The Temporal Cloud CLI extension needs auto-generated command reference documentation, just like the core CLI commands. The extension has ~130 commands across 10 top-level groups (namespace, user, apikey, account, etc.), and the documentation repo's workflow already uses
gen-docswith multiple-inputflags to generate docs from YAML command definitions.The problem is that
gen-docscurrently produces one file per top-level command. Since all cloud commands share thecloudroot, they'd all land in a singlecloud.mdxfile (~2800 lines), which is too large to be useful.This PR adds a
-splitflag that tellsgen-docsto output a command's subcommands as separate files in a subdirectory. The documentation repo's workflow will pass-split cloudto produce individual pages:No changes are needed in the cloud-cli repo. The split is controlled entirely by the documentation workflow:
Also fixes the
encodeJSONExampleregex to catch standalone JSON objects in single quotes (e.g.,'{"key":"value"}'), which caused MDX rendering errors.Test plan
-split cloudproducescloud/subdirectory with correct file splits🤖 Generated with Claude Code