Objective
Add thin wrapper functions PromptInput, PromptSelect, PromptMultiSelect, and PromptText to pkg/console/ that bake in .WithTheme(styles.HuhTheme).WithAccessible(console.IsAccessibleMode()) automatically, then migrate all pkg/cli/ call sites to use the new wrappers.
Context
Identified in Terminal Stylist analysis: discussion #43520. The codebase has 16 copy-pasted .WithTheme(styles.HuhTheme).WithAccessible(console.IsAccessibleMode()) chains spread across pkg/cli/ (e.g., add_interactive_auth.go, add_interactive_git.go). Centralising this in pkg/console/ enforces consistent form behavior and reduces boilerplate.
Implementation Plan
Files to Create / Modify
- Create or extend
pkg/console/prompt.go (or similar) with helper constructors:
console.PromptInput(field *huh.Input) *huh.Input
console.PromptSelect[T any](field *huh.Select[T]) *huh.Select[T]
console.PromptMultiSelect[T any](field *huh.MultiSelect[T]) *huh.MultiSelect[T]
console.PromptText(field *huh.Text) *huh.Text
- (Or a single
console.WithFormDefaults(form *huh.Form) *huh.Form that applies both options to any form.)
- Update all
pkg/cli/ files that currently call .WithTheme(styles.HuhTheme).WithAccessible(console.IsAccessibleMode()) directly to use the new wrappers instead.
Approach
- Grep
pkg/cli/ for WithTheme(styles.HuhTheme) to find all callsites.
- Implement the wrapper(s) in
pkg/console/, mirroring the pattern already used by pkg/console/confirm.go and pkg/console/input.go.
- Replace each callsite in
pkg/cli/ with the new wrapper.
- Run
make build and existing tests.
Notes
pkg/console/confirm.go and pkg/console/input.go already use this pattern and can serve as a reference.
- Do not change how the underlying huh fields work; only remove duplicated theme/accessibility chaining.
Acceptance Criteria
Generated by 📋 Plan Command · 25.5 AIC · ⌖ 8.2 AIC · ⊞ 4.9K · ◷
Comment /plan to run again
Objective
Add thin wrapper functions
PromptInput,PromptSelect,PromptMultiSelect, andPromptTexttopkg/console/that bake in.WithTheme(styles.HuhTheme).WithAccessible(console.IsAccessibleMode())automatically, then migrate allpkg/cli/call sites to use the new wrappers.Context
Identified in Terminal Stylist analysis: discussion #43520. The codebase has 16 copy-pasted
.WithTheme(styles.HuhTheme).WithAccessible(console.IsAccessibleMode())chains spread acrosspkg/cli/(e.g.,add_interactive_auth.go,add_interactive_git.go). Centralising this inpkg/console/enforces consistent form behavior and reduces boilerplate.Implementation Plan
Files to Create / Modify
pkg/console/prompt.go(or similar) with helper constructors:console.PromptInput(field *huh.Input) *huh.Inputconsole.PromptSelect[T any](field *huh.Select[T]) *huh.Select[T]console.PromptMultiSelect[T any](field *huh.MultiSelect[T]) *huh.MultiSelect[T]console.PromptText(field *huh.Text) *huh.Textconsole.WithFormDefaults(form *huh.Form) *huh.Formthat applies both options to any form.)pkg/cli/files that currently call.WithTheme(styles.HuhTheme).WithAccessible(console.IsAccessibleMode())directly to use the new wrappers instead.Approach
pkg/cli/forWithTheme(styles.HuhTheme)to find all callsites.pkg/console/, mirroring the pattern already used bypkg/console/confirm.goandpkg/console/input.go.pkg/cli/with the new wrapper.make buildand existing tests.Notes
pkg/console/confirm.goandpkg/console/input.goalready use this pattern and can serve as a reference.Acceptance Criteria
pkg/console/exports one or more wrapper functions/helpers for huh form construction.WithTheme(styles.HuhTheme).WithAccessible(console.IsAccessibleMode())chains remain inpkg/cli/