Skip to content

[q] refactor(console): migrate list.go from Bubble Tea to huh Select (#23690)#23700

Merged
pelikhan merged 1 commit intomainfrom
migrate/console-list-to-huh-aff58d0c053fc355
Mar 31, 2026
Merged

[q] refactor(console): migrate list.go from Bubble Tea to huh Select (#23690)#23700
pelikhan merged 1 commit intomainfrom
migrate/console-list-to-huh-aff58d0c053fc355

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Migrates pkg/console/list.go from a custom Bubble Tea listModel/itemDelegate implementation to huh.NewSelect[string], making it consistent with how confirm.go and input.go already use huh forms.

Changes

pkg/console/list.go

  • Removed: listModel, itemDelegate, listHeightPadding (all Bubble Tea-specific)
  • Replaced with huh.NewForm + huh.NewSelect[string] — same pattern as confirm.go
  • Applies styles.HuhTheme() and IsAccessibleMode() automatically (consistent with other console forms)
  • Item descriptions are folded into the option label as "title – description" since huh.Option has a single label field
  • Non-TTY fallback showTextList is unchanged
  • showTextList fallback (non-TTY path) is unchanged

pkg/console/console_types.go

  • Removed FilterValue() string method from ListItem — this was only required to satisfy the charm.land/bubbles/v2/list.Item interface, which is no longer used

pkg/console/list_test.go

  • Removed tests for itemDelegate (type no longer exists)
  • Removed FilterValue assertion (method removed)
  • Updated manual-testing comment (filter/search was a Bubble Tea feature; huh Select handles keyboard navigation differently)

Public API

Unchanged:

  • ShowInteractiveList(title string, items []ListItem) (string, error)
  • ListItem, NewListItem(title, description, value string) ListItem

Callers in pkg/cli/mcp_list.go require no changes.

Motivation

From issue #23690 and discussion #23683: list.go was the only direct Bubble Tea model implementation outside of huh. Migrating it eliminates this inconsistency and removes the charm.land/bubbles dependency footprint from the console package.

Note: .lock.yml files are not included — they will be regenerated after merge via make recompile.

🎩 Equipped by Q ·

  • expires on Apr 2, 2026, 12:46 PM UTC

Replace the custom Bubble Tea listModel/itemDelegate implementation
in pkg/console/list.go with huh.NewSelect[string], consistent with
how confirm.go and input.go use huh forms. The public API
(ShowInteractiveList, ListItem, NewListItem) is unchanged.

- Remove listModel, itemDelegate, listHeightPadding (Bubble Tea specifics)
- Remove ListItem.FilterValue() (only needed by charm.land/bubbles list.Item interface)
- Use huh.NewForm + huh.NewSelect with WithTheme/WithAccessible for
  consistent styling across all interactive console components
- Keep non-TTY fallback showTextList unchanged
- Update tests to remove itemDelegate and FilterValue coverage

Closes #23690

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[plan] Add console package README documenting when to use Bubble Tea list vs Huh Select

1 participant