Skip to content

Centralize interactive huh form setup in pkg/console and remove CLI duplication#43587

Draft
pelikhan with Copilot wants to merge 3 commits into
mainfrom
copilot/plan-centralise-huh-form-functions
Draft

Centralize interactive huh form setup in pkg/console and remove CLI duplication#43587
pelikhan with Copilot wants to merge 3 commits into
mainfrom
copilot/plan-centralise-huh-form-functions

Conversation

Copilot AI commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

This change centralizes interactive huh form construction behind pkg/console helpers so theme/accessibility defaults are applied consistently. It removes repeated .WithTheme(styles.HuhTheme).WithAccessible(console.IsAccessibleMode()) chains across pkg/cli.

  • What changed

    • Added non-wasm form wrappers in pkg/console:
      • PromptForm
      • PromptInput
      • PromptSelect
      • PromptMultiSelect
      • PromptText
      • PromptConfirm (for parity across confirm prompts)
    • Wrappers now bake in:
      • WithTheme(styles.HuhTheme)
      • WithAccessible(console.IsAccessibleMode())
  • CLI migration

    • Updated interactive callsites in pkg/cli to use console wrappers instead of local huh.NewForm(...).WithTheme(...).WithAccessible(...) chains.
    • Kept existing prompt behavior and field definitions intact; only construction path changed.
  • Console alignment

    • Updated existing pkg/console prompt implementations (confirm, input, list) to use the same wrappers, ensuring one construction path for themed/accessible forms.
  • Focused coverage

    • Added wrapper-focused test coverage in pkg/console/prompt_form_test.go for wrapper construction behavior.
// before
form := huh.NewForm(
    huh.NewGroup(
        huh.NewSelect[string]().
            Title("Select a workflow to run").
            Options(options...).
            Value(&selected),
    ),
).WithTheme(styles.HuhTheme).WithAccessible(console.IsAccessibleMode())

// after
form := console.PromptSelect(
    huh.NewSelect[string]().
        Title("Select a workflow to run").
        Options(options...).
        Value(&selected),
)

Copilot AI and others added 2 commits July 5, 2026 16:42
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add wrappers for Huh form construction in pkg/console Centralize interactive huh form setup in pkg/console and remove CLI duplication Jul 5, 2026
Copilot AI requested a review from pelikhan July 5, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[plan] Centralise huh form construction behind pkg/console wrappers (PromptInput, PromptSelect, etc.)

2 participants