MCPcopy Create free account
hub / github.com/github/gh-aw / NewAddWizardCommand

Function NewAddWizardCommand

pkg/cli/add_wizard_command.go:16–127  ·  view source on GitHub ↗

NewAddWizardCommand creates the add-wizard command, which is always interactive.

(validateEngine func(string) error)

Source from the content-addressed store, hash-verified

14
15// NewAddWizardCommand creates the add-wizard command, which is always interactive.
16func NewAddWizardCommand(validateEngine func(string) error) *cobra.Command {
17 cmd := &cobra.Command{
18 Use: "add-wizard <workflow>...",
19 Short: "Interactively add one or more agentic workflows with guided setup",
20 Long: `Interactively add one or more agentic workflows with guided setup.
21
22This command walks you through:
23 - Selecting an AI engine (Copilot, Claude, Codex, Gemini, or Crush)
24 - Configuring API keys and secrets
25 - Creating a pull request with the workflow
26 - Optionally running the workflow immediately
27
28Use 'add' for non-interactive workflow addition.
29
30Workflow specifications:
31 - Two parts: "owner/repo[@version]" (loads repository-root aw.yml package)
32 - Three+ parts without .md: "owner/repo/folder[@version]" (loads nested aw.yml package when present)
33 - Three parts: "owner/repo/workflow-name[@version]" (implicitly looks in workflows/ directory)
34 - Four+ parts: "owner/repo/workflows/workflow-name.md[@version]" (requires explicit .md extension)
35 - GitHub URL: "https://github.com/owner/repo/blob/branch/path/to/workflow.md"
36 - Arbitrary URL: "https://example.com/workflow.md" (fetches and dispatches on Content-Type)
37 - text/markdown → treated as a gh-aw workflow markdown file
38 - application/json → converted from a JSON workflow definition
39 - Local file: "./path/to/workflow.md"
40 - Version can be tag, branch, or SHA (for remote workflows)
41
42Note: Requires an interactive terminal. Use 'add' for CI/automation environments.
43Note: In GitHub Enterprise repos, shorthand source specs resolve on your enterprise host by default.
44 For github/*, githubnext/*, and microsoft/* sources, shorthand resolves on github.com.
45 Use full https://github.com/... source URLs for other public github.com workflows.
46Note: To create a new workflow from scratch, use the 'new' command instead.`,
47 Example: ` ` + string(constants.CLIExtensionPrefix) + ` add-wizard githubnext/agentics # Guided setup for repository-root aw.yml package
48 ` + string(constants.CLIExtensionPrefix) + ` add-wizard githubnext/agentics/packages/repo-assist # Guided setup for nested aw.yml package
49 ` + string(constants.CLIExtensionPrefix) + ` add-wizard githubnext/agentics/daily-repo-status # Guided setup
50 ` + string(constants.CLIExtensionPrefix) + ` add-wizard githubnext/agentics/ci-doctor@v1.0.0 # Guided setup with version
51 ` + string(constants.CLIExtensionPrefix) + ` add-wizard ./my-workflow.md # Guided setup for local workflow
52 ` + string(constants.CLIExtensionPrefix) + ` add-wizard https://example.com/my-workflow.md # Guided setup from any HTTPS URL
53 ` + string(constants.CLIExtensionPrefix) + ` add-wizard https://example.com/workflow.json # Import JSON workflow definition with guided setup
54 ` + string(constants.CLIExtensionPrefix) + ` add-wizard githubnext/agentics/ci-doctor --engine copilot # Pre-select engine
55 ` + string(constants.CLIExtensionPrefix) + ` add-wizard githubnext/agentics/ci-doctor --no-secret # Skip secret prompt
56`,
57 Args: func(cmd *cobra.Command, args []string) error {
58 if len(args) < 1 {
59 return errors.New("missing workflow specification\n\nRun 'gh aw add-wizard --help' for usage information")
60 }
61 return nil
62 },
63 RunE: func(cmd *cobra.Command, args []string) error {
64 workflows := args
65 engineOverride, _ := cmd.Flags().GetString("engine")
66 verbose, _ := cmd.Flags().GetBool("verbose")
67 noGitattributes, _ := cmd.Flags().GetBool("no-gitattributes")
68 workflowDir, _ := cmd.Flags().GetString("dir")
69 noStopAfter, _ := cmd.Flags().GetBool("no-stop-after")
70 stopAfter, _ := cmd.Flags().GetString("stop-after")
71 noSecret, _ := cmd.Flags().GetBool("no-secret")
72 skipSecretLegacy, _ := cmd.Flags().GetBool("skip-secret")
73 skipSecret := noSecret || skipSecretLegacy

Calls 10

IsStdoutTerminalFunction · 0.92
validateEngineFunction · 0.85
RunAddInteractiveFunction · 0.85
addEngineFlagFunction · 0.85
GetenvMethod · 0.80
GetStringMethod · 0.65
PrintfMethod · 0.45
StringMethod · 0.45