Skip to content

Phase 5: Update prompt helper package for huh

Overview

Refactor internal/prompt/prompt.go to use huh instead of survey.

Why After Phase 1-4?

After migrating direct usages, we understand patterns and can create better abstractions.

Current Functions to Migrate

func AskQuestionWithInput(...)  // survey.Input wrapper
func MultiSelect(...)           // survey.MultiSelect wrapper  
func AskMultiline(...)          // survey.Multiline wrapper
var AskOne = survey.AskOne      // Direct alias
var Ask = survey.Ask            // Direct alias

New Huh-Based API

// Simpler, type-safe helpers
func Confirm(message string, defaultVal bool) (bool, error)
func Select[T comparable](title string, options []huh.Option[T]) (T, error)
func Input(title, placeholder string, required bool) (string, error)
func Password(title string, required bool) (string, error)
func MultiSelect[T comparable](title string, options []huh.Option[T]) ([]T, error)

Benefits

  • Type-safe generic helpers
  • Consistent API across codebase
  • Easier to add new prompts
  • Better documentation

Effort: 2 days

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information