diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b7e2b86566..82e0cfa4a9 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -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" } diff --git a/cmd/gh-aw/main.go b/cmd/gh-aw/main.go index 417550b78e..f0922f4a32 100644 --- a/cmd/gh-aw/main.go +++ b/cmd/gh-aw/main.go @@ -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 " instead of "gh ". + // 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. + 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) + } + } + } 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 + }) + // Create custom help command that supports "all" subcommand customHelpCmd := &cobra.Command{ Use: "help [command]", diff --git a/pkg/cli/pr_command.go b/pkg/cli/pr_command.go index 83a8d636b5..c941ea2f0f 100644 --- a/pkg/cli/pr_command.go +++ b/pkg/cli/pr_command.go @@ -98,7 +98,6 @@ The command will: } addRepoFlag(cmd) - cmd.Flags().BoolP("verbose", "v", false, "Verbose output") return cmd } diff --git a/pkg/cli/tokens_bootstrap.go b/pkg/cli/tokens_bootstrap.go index 659312b818..2315033499 100644 --- a/pkg/cli/tokens_bootstrap.go +++ b/pkg/cli/tokens_bootstrap.go @@ -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) diff --git a/pkg/cli/trial_command.go b/pkg/cli/trial_command.go index 0e5096050b..09663e9a44 100644 --- a/pkg/cli/trial_command.go +++ b/pkg/cli/trial_command.go @@ -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: