Repository navigation
Conversation
The docs generator only wrote an option table for leaf commands. A command that has subcommands but also declares its own options lost those options from the docs entirely. Those options are generated as persistent flags, so they apply to the command and every subcommand, and no other page lists them. Today this drops all 10 flags of `temporal workflow reset` (including the required --reason) and the required --task-queue flag of `temporal task-queue versioning`. Write the option table for any command that is a leaf or declares options of its own, and say that a parent's options also apply to its subcommands. Grouping parents with no options of their own are unchanged.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6c99b7730e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if w.isLeafCommand(c) { | ||
| w.writeLeafOptions(fileName) | ||
| if w.hasOptionsSection(c) { | ||
| w.writeOptionsSection(c, fileName) |
There was a problem hiding this comment.
Keep parent-only flags out of the global table
When an option-bearing parent is followed directly by its child, this new call emits the parent's options under its own heading, but processing the child subsequently treats that parent's optionsStack frame as globalOptions and collects it into the same file's Global Flags section. For example, a minimal app thing run / app thing run extra tree lists --target both under run and under Global Flags, where the generated text incorrectly claims it is valid for sibling commands. Intermediate persistent flags need to be excluded from the file-wide globals or otherwise prevented from being emitted a second time.
Useful? React with 👍 / 👎.
Related issues
None filed. The docs team found this while reviewing docs.temporal.io: the
temporal workflow resetreference shows usage examples but has no flags table.What changed?
gen-docswrote an option table only for leaf commands. A command that has subcommands but also declares its ownoptionslost those options from the generated docs.code.goregisters those options as persistent flags, so they apply to the command and all of its subcommands. Because the generator never documented them, they appeared on no page at all.Two commands are affected today:
temporal workflow reset: all 10 flags are missing, including the required--reason, plus--event-id,--type,--workflow-idand--reapply-exclude. Itswith-workflow-update-optionssubcommand is what turns it into a non-leaf command.temporal task-queue versioning: the required--task-queueflag shared by everyversioningsubcommand is missing.The fix:
hasOptionsSection). Parents that only group subcommands, or only pull in option sets, are unchanged.writeLeafOptionstowriteOptionsSection, since it no longer handles only leaf commands.writeSplitCommandandwriteSplitSubcommand) get the same rule. No split command hits this today.Generated output
Before and after, I ran
go run ./cmd/gen-docs -input internal/temporalcli/commands.yaml -input cliext/option-sets.yaml -output …(the same invocation asci.yaml). The diff only adds lines: 15 inworkflow.mdxunder## resetand 6 intask-queue.mdxunder## versioning. Nothing else changes.Separate issue, not fixed here
processOptionspops at most one frame per command, so after a deeper subcommand the options stack stays longer than the current command's depth. Today the stale frames are always empty, so output isn't affected, which is why I left it alone. Fixing it properly also means deciding whether a parent's persistent options should count as "global flags" for a file, so it seemed better as its own change.Checklist
Tests
TestGenerateDocsFilesParentOptions). It covers single-file and-subdiroutput: a parent with its own options gets a table that says it applies to subcommands, and a grouping-only parent gets none. It fails without the fix.Manual tests