Skip to content

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

Description

@github-actions

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

  1. Grep pkg/cli/ for WithTheme(styles.HuhTheme) to find all callsites.
  2. Implement the wrapper(s) in pkg/console/, mirroring the pattern already used by pkg/console/confirm.go and pkg/console/input.go.
  3. Replace each callsite in pkg/cli/ with the new wrapper.
  4. 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

  • pkg/console/ exports one or more wrapper functions/helpers for huh form construction
  • No .WithTheme(styles.HuhTheme).WithAccessible(console.IsAccessibleMode()) chains remain in pkg/cli/
  • Build passes and existing tests pass

Generated by 📋 Plan Command · 25.5 AIC · ⌖ 8.2 AIC · ⊞ 4.9K ·
Comment /plan to run again

  • expires on Jul 7, 2026, 7:23 AM UTC-08:00

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions