Promote parent-scoped persistent flags into FLAGS section#307
Merged
Conversation
Leaf commands like `chat post` inherit parent-defined persistent flags (--chat, --project, --in) but the help renderer placed them in INHERITED FLAGS alongside root globals, where they're easy to miss. Promote non-root parent-scoped flags into the primary FLAGS section so they're immediately visible. This is a renderer-wide policy change: any leaf whose parent defines persistent flags (chat, messages, timesheet, etc.) will now show those flags in FLAGS. INHERITED FLAGS becomes root globals only.
Test both halves of the parent-scoped flag promotion contract: - Parent-scoped flags (--chat, --project) appear in FLAGS, not INHERITED - Root globals (--json, --quiet) stay in INHERITED FLAGS, not FLAGS - Campfire alias path promotes --chat identically Adds extractSection helper for placement-aware assertions.
There was a problem hiding this comment.
Pull request overview
Updates the CLI help renderer so leaf-command help output surfaces parent-defined persistent flags (like --project, --chat, --in) in the primary FLAGS section, keeping INHERITED FLAGS for curated root globals only. This improves discoverability for commonly required context flags across the command tree.
Changes:
- Merge parent-scoped inherited persistent flags into the rendered FLAGS section for subcommand help.
- Restrict INHERITED FLAGS to the curated subset of root-level global flags.
- Add/adjust help tests to assert section placement for promoted flags, root globals, and alias paths.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/cli/help.go | Implements the renderer policy change by promoting non-root inherited persistent flags into FLAGS and filtering INHERITED FLAGS to root globals only. |
| internal/cli/help_test.go | Updates existing tests and adds new coverage to ensure correct section placement (including the campfire alias path). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
chat post,messages create,timesheet report, etc.) inherit parent-defined persistent flags (--chat,--project,--in) but the help renderer placed them in INHERITED FLAGS alongside root globals — a less prominent section users scan pastTest plan
TestLeafCommandShowsParentScopedFlagsInFLAGS— parent-scoped flags appear in FLAGS section for messages, chat, timesheetTestCampfirePostHelpShowsChatFlag— alias path promotes--chatidenticallyTestLeafCommandKeepsRootGlobalsInInheritedFlags—--json/--quietstay in INHERITED FLAGS, not FLAGSTestGroupCommandShowsPersistentLocalFlags— group commands still show their own persistent flags in FLAGSchat post --help,campfire post --help,chat --help,messages create --helpSummary by cubic
Promotes parent-scoped persistent flags (e.g., --chat, --project, --in) into the main FLAGS section for leaf commands so they’re easier to discover. INHERITED FLAGS now shows only curated root globals (e.g., --json, --quiet); this applies renderer-wide, including the
campfirealias path.Written for commit 80e3be0. Summary will update on new commits.