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

Method promptForConfiguration

pkg/cli/interactive.go:149–283  ·  view source on GitHub ↗

promptForConfiguration organizes all prompts into logical groups with titles and descriptions

()

Source from the content-addressed store, hash-verified

147
148// promptForConfiguration organizes all prompts into logical groups with titles and descriptions
149func (b *InteractiveWorkflowBuilder) promptForConfiguration() error {
150 if !tty.IsStderrTerminal() {
151 return b.promptForConfigurationFrom(os.Stdin)
152 }
153
154 // Prepare trigger options
155 triggerOptions := []huh.Option[string]{
156 huh.NewOption("Manual trigger (workflow_dispatch)", "workflow_dispatch"),
157 huh.NewOption("Issue opened or reopened", "issues"),
158 huh.NewOption("Pull request opened or synchronized", "pull_request"),
159 huh.NewOption("Push to main branch", "push"),
160 huh.NewOption("Issue comment created", "issue_comment"),
161 huh.NewOption("Schedule (daily, scattered execution time)", "schedule_daily"),
162 huh.NewOption("Schedule (weekly on Monday, scattered execution time)", "schedule_weekly"),
163 huh.NewOption("Command trigger (/bot-name)", "command"),
164 }
165
166 // Prepare engine options
167 engineOptions := []huh.Option[string]{
168 huh.NewOption("copilot - GitHub Copilot CLI", "copilot"),
169 huh.NewOption("claude - Anthropic Claude Code coding agent", "claude"),
170 huh.NewOption("codex - OpenAI Codex engine", "codex"),
171 huh.NewOption("gemini - Google Gemini CLI", "gemini"),
172 }
173
174 // Prepare tool options
175 toolOptions := []huh.Option[string]{
176 huh.NewOption("github - GitHub API tools (issues, PRs, comments, repos)", "github"),
177 huh.NewOption("edit - File editing tools", "edit"),
178 huh.NewOption("bash - Shell command tools", "bash"),
179 huh.NewOption("web-fetch - Web content fetching tools", "web-fetch"),
180 huh.NewOption("web-search - Web search tools", "web-search"),
181 huh.NewOption("playwright - Browser automation tools", "playwright"),
182 }
183
184 // Prepare safe output options programmatically from safe_outputs_tools.json
185 outputOptions := buildSafeOutputOptions()
186
187 // Pre-detect network access based on repo contents
188 detectedNetworks := detectNetworkFromRepo()
189 interactiveLog.Printf("Pre-detected networks from repo: %v", detectedNetworks)
190
191 // Prepare network options
192 networkOptions := []huh.Option[string]{
193 huh.NewOption("defaults - Basic infrastructure only", "defaults"),
194 huh.NewOption("ecosystem - Common development ecosystems (Python, Node.js, Go, etc.)", "ecosystem"),
195 }
196 if len(detectedNetworks) > 0 {
197 // Build a custom option that reflects what was auto-detected
198 label := "detected - Auto-detected ecosystems: " + strings.Join(detectedNetworks, ", ")
199 networkOptions = append([]huh.Option[string]{huh.NewOption(label, strings.Join(append([]string{"defaults"}, detectedNetworks...), ","))}, networkOptions...)
200 }
201
202 // Set default network access
203 b.NetworkAccess = "defaults"
204 if len(detectedNetworks) > 0 {
205 b.NetworkAccess = strings.Join(append([]string{"defaults"}, detectedNetworks...), ",")
206 }

Callers 1

Calls 7

IsStderrTerminalFunction · 0.92
IsAccessibleModeFunction · 0.92
buildSafeOutputOptionsFunction · 0.85
detectNetworkFromRepoFunction · 0.85
PrintfMethod · 0.45
ValidateMethod · 0.45

Tested by

no test coverage detected