Repository navigation
Use the gh aw prefix in CLI errors and help - #78463
Conversation
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
gh aw prefix in CLI errors and help
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review. PR Code Quality ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
Comment MemoryPeek at saved memory (spec-review-history)History |
There was a problem hiding this comment.
🟢 Approval recommended
The changes address the reported CLI error-path and help-alignment inconsistencies with targeted updates and regression tests across the affected commands, with no active issues identified.
No open issues 🎉
What changed in this PR
This PR standardizes user-facing CLI errors on the canonical gh aw prefix and replaces tab-based alignment in the root help’s Common Tasks section.
Changes:
- Added command-path normalization for workflow argument, unknown-subcommand, legacy-command, and generic Cobra errors.
- Updated root help alignment to use spaces.
- Added and updated regression tests for error paths and help formatting.
| File | Description |
|---|---|
| pkg/cli/trial_command.go | Uses the canonical gh aw trial path in missing-argument errors. |
| pkg/cli/trial_command_test.go | Verifies trial errors use the canonical command path. |
| pkg/cli/secrets_command.go | Normalizes unknown-subcommand errors for secrets. |
| pkg/cli/secrets_command_test.go | Updates expected secrets error paths. |
| pkg/cli/mcp.go | Normalizes unknown-subcommand errors for mcp. |
| pkg/cli/mcp_command_test.go | Updates expected MCP error paths. |
| pkg/cli/gh_guard_subcommand.go | Adds shared command-path formatting and applies it to legacy-command errors. |
| pkg/cli/deploy_command.go | Uses the canonical gh aw deploy path in validation errors. |
| pkg/cli/deploy_command_test.go | Verifies deploy errors use the canonical command path. |
| pkg/cli/cli_consistency_help_test.go | Tests normalized command paths and legacy-command errors. |
| pkg/cli/add_no_args_test.go | Verifies add errors use the canonical command path. |
| pkg/cli/add_command.go | Uses the canonical gh aw add path in missing-argument errors. |
| cmd/gh-aw/main.go | Rewrites generic Cobra unknown-command errors and aligns root help text with spaces. |
| cmd/gh-aw/main_help_text_test.go | Adds regression tests for help alignment and generic error-path normalization. |
Review effort: Lite (adaptive)
There was a problem hiding this comment.
Found one correctness issue in the path normalization: the prefix check is not token-boundary-aware, so command paths beginning with gh aw... can be mistaken for already-normalized paths. Please tighten the boundary check before merging. No tests were run per the static-review instructions.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.5K
Comment /review to run again
| return message | ||
| } | ||
| const marker = ` for "` | ||
| start := strings.LastIndex(message, marker) |
There was a problem hiding this comment.
strings.HasPrefix(s, "gh aw") treats any path beginning with that byte sequence as already normalized. For example, an unknown command path of gh awesome remains gh awesome instead of becoming gh aw awesome, so the canonical prefix is still wrong for valid command names beginning with aw. Check the token boundary (e.g. s == "gh aw" or strings.HasPrefix(s, "gh aw ")) before skipping the rewrite.
Comment MemoryPeek at saved memory (review-history)History |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /tdd and /codebase-design. Requesting changes because the gh aw path rewrite misses Cobra's invalid argument errors, which the PR description says it covers.
📋 Key Themes & Highlights
Key Themes
- Incomplete coverage:
fixCommandPathInErroronly handlesunknown command. Cobra'sinvalid argumenterror (fromcobra.OnlyValidArgs) still showsgh completion. Verified on the built binary. - Duplicated path rule:
cliCommandPathrepeats theghtogh awnormalization already infixPathForCommand.
Positive Highlights
- ✅ Root Common Tasks block now aligns; verified with
--help. - ✅ Unknown-command errors for
secretsandmcpnow showgh aw; verified on the built binary. - ✅ Targeted tests pass in
cmd/gh-awandpkg/cli, and gofmt is clean.
Process Note
Triage was not run as a separate agent. I classified the change directly from the pre-fetched diff, which was small enough to read in full.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~4 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again
| } | ||
|
|
||
| func fixCommandPathInError(message string) string { | ||
| if !strings.HasPrefix(message, "unknown command ") { |
There was a problem hiding this comment.
[/tdd] The rewrite only covers unknown command messages, but Cobra's invalid argument %q for %q (args.go:61, emitted by cobra.OnlyValidArgs) also embeds CommandPath(). Verified on the built binary: gh aw completion bogus still prints ✗ invalid argument "bogus" for "gh completion", so the PR's "including generic Cobra errors" goal is only partly met. Not a regression, but worth fixing here.
💡 Suggested change
Accept the invalid argument prefix too, and add a regression test next to TestUnknownCommandErrorUsesExtensionPath:
func fixCommandPathInError(message string) string {
if !strings.HasPrefix(message, "unknown command ") && !strings.HasPrefix(message, "invalid argument ") {
return message
}
// rest unchangedassert.Equal(t, `invalid argument "bar" for "gh aw completion"`,
fixCommandPathInError(`invalid argument "bar" for "gh completion"`))The existing first-quote scan stops at the path's closing quote, so suggestion text appended by findSuggestions is preserved.
@copilot please address this.
| "github.com/spf13/cobra" | ||
| ) | ||
|
|
||
| func cliCommandPath(cmd *cobra.Command) string { |
There was a problem hiding this comment.
[/codebase-design] cliCommandPath duplicates the gh to gh aw normalization already done by fixPathForCommand in cmd/gh-aw/main.go. Two copies of the same rule can drift, so a future fix to one would silently miss the other.
💡 Suggested change
Move the string rule into one shared helper (for example in pkg/constants, next to CLIExtensionPrefix) and have both call sites use it. cliCommandPath would then only handle the root-name check and delegate the rewrite.
@copilot please address this.
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "f4e40f70b277d238feb5c882d94a1bf8fe622aee",
"kind": "requested",
"schema_version": "1",
"state": "1c822742880b48e36b49ff7c78cafd1a8e6f9ddb1258393ba1f9ecf8c9969ecf",
"work": [
"0523a02227aba8f4eea998e32428a34a3bf2e6c96da8dfe5d8a98735b5a66fa3",
"3088be964b47f52248c167c5cca093809d4c5af309ca3e714c5e97126acab07c",
"9b4fcc6f75f4c68f753a32b05ce6d63bc7365eb9ec5268c68690ca9f077056d2"
],
"workflow": "pr-sous-chef"
}
|
|
🎉 This pull request is included in a new release. Release: |
Some command errors showed Cobra’s shortened
gh <command>path instead ofgh aw <command>, and root help used tabs in its Common Tasks block.gh awprefix, including generic Cobra errors.