Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"ghcr.io/anthropics/devcontainer-features/claude-code:1.0": {},
"ghcr.io/devcontainers/features/copilot-cli:latest": {},
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/git-lfs:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/node:1": {
"version": "24"
}
Expand Down
71 changes: 71 additions & 0 deletions cmd/gh-aw/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,77 @@ func init() {
// Set version template to match the version subcommand format
rootCmd.SetVersionTemplate(string(constants.CLIExtensionPrefix) + " version {{.Version}}\n")

// Fix usage lines so subcommands show "gh aw <cmd>" instead of "gh <cmd>".
// Cobra derives the root name from the first word of Use ("gh" from "gh aw"),
// so CommandPath() for subcommands omits "aw". We use SetUsageFunc to
// post-process the default output, replacing "gh " with "gh aw " in the
// two lines that reference the command path.
Comment on lines +471 to +473
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The comment says this “post-process[es] the default output”, but the implementation fully re-renders the usage output (Available Commands/Flags/etc.) rather than modifying Cobra’s default output. This is misleading and also makes it easy for this usage text to drift from upstream Cobra behavior; either update the comment to match what the code does, or prefer wrapping the existing usage output and only rewriting the affected command-path substrings.

Suggested change
// so CommandPath() for subcommands omits "aw". We use SetUsageFunc to
// post-process the default output, replacing "gh " with "gh aw " in the
// two lines that reference the command path.
// so CommandPath() for subcommands omits "aw". We install a custom usage
// renderer via SetUsageFunc that prints the usage text itself, adjusting
// command paths from "gh" to "gh aw" where needed.

Copilot uses AI. Check for mistakes.
rootCmd.SetUsageFunc(func(cmd *cobra.Command) error {
fixPath := func(s string) string {
if s == "gh" {
return "gh aw"
}
if strings.HasPrefix(s, "gh ") && !strings.HasPrefix(s, "gh aw") {
return "gh aw " + s[3:]
}
return s
}
out := cmd.OutOrStderr()
fmt.Fprint(out, "Usage:")
if cmd.Runnable() {
fmt.Fprintf(out, "\n %s", fixPath(cmd.UseLine()))
}
if cmd.HasAvailableSubCommands() {
fmt.Fprintf(out, "\n %s [command]", fixPath(cmd.CommandPath()))
}
if len(cmd.Aliases) > 0 {
fmt.Fprintf(out, "\n\nAliases:\n %s", cmd.NameAndAliases())
}
if cmd.HasExample() {
fmt.Fprintf(out, "\n\nExamples:\n%s", cmd.Example)
}
if cmd.HasAvailableSubCommands() {
cmds := cmd.Commands()
if len(cmd.Groups()) == 0 {
fmt.Fprint(out, "\n\nAvailable Commands:")
for _, sub := range cmds {
if sub.IsAvailableCommand() || sub.Name() == "help" {
fmt.Fprintf(out, "\n %-11s %s", sub.Name(), sub.Short)
}
Comment on lines +500 to +505
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The Available Commands rendering uses a hard-coded padding width (%-11s). This breaks alignment for longer command names (e.g., hash-frontmatter) and can drift as commands are added/renamed. Consider using Cobra’s dynamic padding (cmd.NamePadding()) or computing the max subcommand name length for the current command when formatting the list.

Copilot uses AI. Check for mistakes.
}
} else {
for _, group := range cmd.Groups() {
fmt.Fprintf(out, "\n\n%s", group.Title)
for _, sub := range cmds {
if sub.GroupID == group.ID && (sub.IsAvailableCommand() || sub.Name() == "help") {
fmt.Fprintf(out, "\n %-11s %s", sub.Name(), sub.Short)
}
}
}
if !cmd.AllChildCommandsHaveGroup() {
fmt.Fprint(out, "\n\nAdditional Commands:")
for _, sub := range cmds {
if sub.GroupID == "" && (sub.IsAvailableCommand() || sub.Name() == "help") {
fmt.Fprintf(out, "\n %-11s %s", sub.Name(), sub.Short)
}
}
}
}
}
if cmd.HasAvailableLocalFlags() {
fmt.Fprintf(out, "\n\nFlags:\n%s", strings.TrimRight(cmd.LocalFlags().FlagUsages(), " \t\n"))
}
if cmd.HasAvailableInheritedFlags() {
fmt.Fprintf(out, "\n\nGlobal Flags:\n%s", strings.TrimRight(cmd.InheritedFlags().FlagUsages(), " \t\n"))
}
if cmd.HasAvailableSubCommands() {
fmt.Fprintf(out, "\n\nUse \"%s [command] --help\" for more information about a command.\n", fixPath(cmd.CommandPath()))
} else {
fmt.Fprintln(out)
}
return nil
})
Comment on lines +469 to +538
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

This introduces custom usage rendering to fix the gh vs gh aw command path in help output, but there’s no test asserting the corrected prefix in --help output (only that “Usage:” exists). Since this behavior is user-facing and easy to regress, please add/extend a CLI help/usage test to verify usage lines include gh aw for at least one subcommand (e.g., pr or trial).

Copilot uses AI. Check for mistakes.

// Create custom help command that supports "all" subcommand
customHelpCmd := &cobra.Command{
Use: "help [command]",
Expand Down
1 change: 0 additions & 1 deletion pkg/cli/pr_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ The command will:
}

addRepoFlag(cmd)
cmd.Flags().BoolP("verbose", "v", false, "Verbose output")

return cmd
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/cli/tokens_bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ Only required secrets are prompted for. Optional secrets are not shown.

For full details, including precedence rules, see the GitHub Tokens
reference in the documentation.`,
Example: ` gh aw secrets bootstrap # Check and set up all required secrets
gh aw secrets bootstrap --non-interactive # Display missing secrets without prompting
gh aw secrets bootstrap --engine copilot # Check secrets for a specific engine`,
RunE: func(cmd *cobra.Command, args []string) error {
repo, _ := cmd.Flags().GetString("repo")
return runTokensBootstrap(engineFlag, repo, nonInteractiveFlag)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/trial_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Repository mode examples:
Repeat and cleanup examples:
` + string(constants.CLIExtensionPrefix) + ` trial githubnext/agentics/my-workflow --repeat 3 # Run 3 times total
` + string(constants.CLIExtensionPrefix) + ` trial githubnext/agentics/my-workflow --delete-host-repo-after # Delete repo after completion
` + string(constants.CLIExtensionPrefix) + ` trial githubnext/agentics/my-workflow --quiet --host-repo my-trial # Custom host repo
` + string(constants.CLIExtensionPrefix) + ` trial githubnext/agentics/my-workflow --host-repo my-trial # Custom host repo
` + string(constants.CLIExtensionPrefix) + ` trial githubnext/agentics/my-workflow --dry-run # Show what would be done without changes

Auto-merge examples:
Expand Down
Loading