Skip to content

Promote parent-scoped persistent flags into FLAGS section#307

Merged
jeremy merged 2 commits intomainfrom
bc-9679701131
Mar 16, 2026
Merged

Promote parent-scoped persistent flags into FLAGS section#307
jeremy merged 2 commits intomainfrom
bc-9679701131

Conversation

@jeremy
Copy link
Copy Markdown
Member

@jeremy jeremy commented Mar 15, 2026

Summary

  • Leaf commands (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 past
  • Promotes non-root parent-scoped persistent flags into the primary FLAGS section where they're immediately visible; INHERITED FLAGS becomes root globals only
  • This is a renderer-wide policy change affecting all leaf commands with parent-scoped flags, not just chat

Test plan

  • TestLeafCommandShowsParentScopedFlagsInFLAGS — parent-scoped flags appear in FLAGS section for messages, chat, timesheet
  • TestCampfirePostHelpShowsChatFlag — alias path promotes --chat identically
  • TestLeafCommandKeepsRootGlobalsInInheritedFlags--json/--quiet stay in INHERITED FLAGS, not FLAGS
  • TestGroupCommandShowsPersistentLocalFlags — group commands still show their own persistent flags in FLAGS
  • All existing help tests pass, full e2e suite (285 tests) passes
  • Manual verification: chat post --help, campfire post --help, chat --help, messages create --help

Summary 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 campfire alias path.

Written for commit 80e3be0. Summary will update on new commits.

jeremy added 2 commits March 15, 2026 14:58
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.
@jeremy jeremy requested a review from a team as a code owner March 15, 2026 22:00
Copilot AI review requested due to automatic review settings March 15, 2026 22:00
@github-actions github-actions bot added tests Tests (unit and e2e) enhancement New feature or request labels Mar 15, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jeremy jeremy merged commit 58afc7a into main Mar 16, 2026
30 checks passed
@jeremy jeremy deleted the bc-9679701131 branch March 16, 2026 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request tests Tests (unit and e2e)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants