Merged
Conversation
Command groups (resource nouns with subcommands) must not set RunE — bare invocation shows help via Cobra's default behavior. A new scripts/check-bare-groups.sh validates this at CI time, with an allowlist for intentional shortcuts (card, search, url, etc.). Wired into `make check` as `check-bare-groups`.
Contributor
There was a problem hiding this comment.
1 issue found across 14 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="scripts/check-bare-groups.sh">
<violation number="1" location="scripts/check-bare-groups.sh:43">
P1: Non-portable BRE alternation (`\|`) silently breaks the check on macOS. BSD grep doesn't support `\|` in basic regex, so the pattern matches nothing and the script always passes — defeating its purpose for developers running `bin/ci` locally on macOS. Use `-Ec` with `|` instead.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Remove `RunE: cmd.Help()` from boost, mcp, and tools — Cobra shows help by default when a parent command has subcommands and no RunE. Add "without subcommand shows help" e2e tests for 8 command groups that were missing coverage: auth, boost, campfire, files, messagetypes, subscriptions, templates, webhooks.
d85a3f9 to
888e775
Compare
There was a problem hiding this comment.
Pull request overview
Codifies the CLI convention that “group” commands (resource nouns with subcommands) should show help when invoked without a subcommand, rather than running a default action.
Changes:
- Document the bare-group-shows-help rule (and shortcut exceptions) in
STYLE.md. - Add a CI-enforced checker script and wire it into the
make checkpipeline. - Add e2e tests ensuring bare invocation shows help for several command groups; remove redundant
RunE: cmd.Help()from a few commands.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| scripts/check-bare-groups.sh | Adds a CI check to detect New*Cmd constructors that set both RunE and AddCommand unless allowlisted. |
| internal/commands/tools.go | Removes redundant parent RunE that only printed help. |
| internal/commands/mcp.go | Removes redundant parent RunE that only printed help. |
| internal/commands/boost.go | Removes redundant parent RunE (and no-op Args) so bare invocation relies on Cobra help behavior. |
| e2e/webhooks.bats | Adds “without subcommand shows help” coverage. |
| e2e/templates.bats | Adds “without subcommand shows help” coverage. |
| e2e/subscriptions.bats | Adds “without subcommand shows help” coverage. |
| e2e/messagetypes.bats | Adds “without subcommand shows help” coverage. |
| e2e/files.bats | Adds “without subcommand shows help” coverage. |
| e2e/campfire.bats | Adds “without subcommand shows help” coverage. |
| e2e/boost.bats | Adds “without subcommand shows help” coverage. |
| e2e/auth.bats | Adds “without subcommand shows help” coverage. |
| STYLE.md | Documents the bare-group-shows-help convention and the shortcut exception. |
| Makefile | Adds check-bare-groups target and includes it in check. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The mcp command lost its RunE (intentionally — bare groups show help via Cobra default), which removes CMD/FLAG/SUB entries from the CLI surface snapshot. Add these to .surface-breaking so the check passes.
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
Command groups (resource nouns with subcommands like
todos,projects,todosets) should show help when invoked bare — not run a default action. This was an unwritten convention that #270 nearly violated. Now it's codified three ways:scripts/check-bare-groups.shscans Go source forNewXxxCmdfunctions with bothRunEandAddCommand, failing unless the function is in an explicit allowlist of intentional shortcuts (card, search, url, etc.)Also removes redundant
RunE: cmd.Help()from boost, mcp, and tools — Cobra already shows help by default when a parent command has subcommands.Test plan
bin/cipasses — newcheck-bare-groupstarget runs greenSummary by cubic
Enforces that bare command groups show help instead of running an action. Adds a CI check, updates the style guide, expands e2e coverage, removes redundant handlers, and acknowledges the
mcpCLI surface change.New Features
card,search,url, etc.).scripts/check-bare-groups.shand wired it intomake checkascheck-bare-groupsto blockRunE + AddCommandon group parents.auth,boost,campfire,files,messagetypes,subscriptions,templates, andwebhooks.Refactors
RunE: cmd.Help()fromboost,mcp, andtools(rely on Cobra’s default help)..surface-breakingentries formcpto acknowledge the CLI surface change from removingRunE.Written for commit fc22351. Summary will update on new commits.