Skip to content

cmdio: replace promptui with bubbletea-backed Prompt and Select#5232

Open
pietern wants to merge 6 commits into
mainfrom
replace-promptui
Open

cmdio: replace promptui with bubbletea-backed Prompt and Select#5232
pietern wants to merge 6 commits into
mainfrom
replace-promptui

Conversation

@pietern
Copy link
Copy Markdown
Contributor

@pietern pietern commented May 11, 2026

Summary

  • Reimplement RunPrompt and RunSelect as bubbletea models that reproduce promptui's rendering and key handling end-to-end. RunPrompt supports cursor editing, mask, validate (with inline glyph and >> <err> line surfaced after a failed Enter), HideEntered, Delete/Ctrl+D as EOF, and the Ctrl+B/F/H/J aliases. RunSelect supports templated rows, viewport scroll, filter with / toggle and vim-style nav, Ctrl+P/N item nav and Ctrl+B/F page nav, and an empty post-submit frame when HideSelected is set.
  • Drop manifoldco/promptui and the transitive chzyer/readline dependency.
  • Move the SupportsPrompt capability check into the primitives themselves so callers no longer have to gate on IsPromptSupported; SelectOrdered drops its now-redundant guard. SelectOptions.Items is validated at construction and normalized to []any so the render path doesn't reflect on every row.

Test plan

  • Behavior is verified against the cmdiotest pty/vt10x baseline suite developed in cmdiotest: pin promptui baselines for bubbletea migration (reference) #5231. That suite is kept on a separate branch and not merged here because it pulls in test-only deps (creack/pty, hinshun/vt10x) we'd prefer not to land in the main module.
  • Side-by-side check of databricks selftest tui commands against the released CLI: same visible output, same exit codes.

Drops the manifoldco/promptui (and transitive chzyer/readline)
dependency in favor of hand-rolled bubbletea models that reproduce
promptui's rendering and key handling.

RunPrompt and Secret share a single-line editor that pins the
cursor-block visuals, mask, validate (with inline "✗" glyph and a
red ">> <err>" line surfaced after a failed Enter), HideEntered
post-submit clearing, Ctrl+B/F as left/right, Ctrl+H as backspace,
Ctrl+J as Enter, and Delete/Ctrl+D as EOF.

RunSelect, Select, and SelectOrdered share a templated list with
viewport scroll and ↑/↓ gutters, a search filter with vim-style
nav and "/" toggle, Ctrl+P/N as item-up/down, Ctrl+B/F (and the
left/right arrows) as page-up/down, default Active / Inactive /
Selected templates that match promptui's defaults, and an empty
final frame when HideSelected is set.

Both primitives refuse to draw on a non-interactive terminal so
callers no longer have to gate on IsPromptSupported themselves;
SelectOrdered drops its now-redundant guard. SelectOptions.Items
is now validated at construction and normalized to []any so the
render path doesn't reflect on every row.

The behavior pinned above is verified against the cmdiotest pty-
and vt10x-based baseline suite developed in #5231. That suite is
kept on a separate branch — and not merged here — because it pulls
in test-only dependencies (creack/pty, hinshun/vt10x, x/term) that
we'd prefer not to land in the main module.

Co-authored-by: Isaac
@pietern pietern temporarily deployed to test-trigger-is May 11, 2026 14:27 — with GitHub Actions Inactive
@pietern pietern temporarily deployed to test-trigger-is May 11, 2026 14:27 — with GitHub Actions Inactive
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 11, 2026

Approval status: pending

/libs/cmdio/ - needs approval

5 files changed
Suggested: @simonfaltum
Also eligible: @tanmay-db, @renaudhartert-db, @hectorcast-db, @parthban-db, @Divyansh-db, @tejaskochar-db, @mihaimitrea-db, @chrisst, @rauchy

/libs/databrickscfg/ - needs approval

Files: libs/databrickscfg/cfgpickers/clusters.go
Suggested: @simonfaltum
Also eligible: @tanmay-db, @renaudhartert-db, @hectorcast-db, @parthban-db, @Divyansh-db, @tejaskochar-db, @mihaimitrea-db, @chrisst, @rauchy

/libs/template/ - needs approval

Files: libs/template/config.go
Suggested: @lennartkats-db
Also eligible: @denik, @shreyas-goenka, @anton-107, @andrewnester, @janniklasrose

General files (require maintainer)

4 files changed
Based on git history:

  • @simonfaltum -- recent work in ./, libs/cmdio/, experimental/ssh/internal/setup/

Any maintainer (@andrewnester, @anton-107, @denik, @shreyas-goenka, @simonfaltum, @renaudhartert-db) can approve all areas.
See OWNERS for ownership rules.

@pietern pietern force-pushed the replace-promptui branch from c44f70e to 118ef1d Compare May 11, 2026 15:38
@pietern pietern temporarily deployed to test-trigger-is May 11, 2026 15:38 — with GitHub Actions Inactive
@pietern pietern temporarily deployed to test-trigger-is May 11, 2026 15:38 — with GitHub Actions Inactive
After the PR was opened, sweep through prompt.go and select.go and
remove comments that name-drop promptui without saying anything the
code doesn't already convey. Keep the comments that document a
non-obvious behavior (post-submit "\n", Alt-rune dropping, Delete-as-
EOF, "/" toggle batching, ">>" validation line); drop the ones that
just trace where a particular spec came from.

Co-authored-by: Isaac
@pietern pietern force-pushed the replace-promptui branch from 118ef1d to 32253f2 Compare May 11, 2026 15:39
@pietern pietern temporarily deployed to test-trigger-is May 11, 2026 15:40 — with GitHub Actions Inactive
@pietern pietern temporarily deployed to test-trigger-is May 11, 2026 15:40 — with GitHub Actions Inactive
Follow-up to the comment sweep: a few of the trimmed comments were
load-bearing — they justified intentionally-surprising behavior the
baseline tests pin. Without the "why", a future reader (or refactor)
might assume the code is incidental and "fix" it.

Restored on:

  - Delete / Ctrl+D exits with EOF even on a non-empty buffer.
  - Alt+<rune> word-nav combos are dropped instead of inserted (both
    the prompt buffer and the select filter).

Also gave libs/cmdio/capabilities.go the same trim that the previous
commit applied to prompt.go and select.go — the Git Bash gate
comment was still naming promptui and pointing at upstream issue
links that no longer reflect why we keep the carve-out.

Co-authored-by: Isaac
@pietern pietern temporarily deployed to test-trigger-is May 11, 2026 15:45 — with GitHub Actions Inactive
@pietern pietern temporarily deployed to test-trigger-is May 11, 2026 15:45 — with GitHub Actions Inactive
pietern added 2 commits May 11, 2026 20:02
libs/template/config.go and libs/databrickscfg/cfgpickers/clusters.go
each had a one-line comment naming promptui to explain a constraint
that still applies (single-line labels in RunSelect, ctx-free
template helpers). Reword them to describe the constraint in terms
of the current API instead of the removed dependency.

Co-authored-by: Isaac
Final stray reference outside the cmdiotest test branch — reword to
describe what the stub avoids (spawning a TUI) instead of naming
the removed dependency.

Co-authored-by: Isaac
@pietern pietern force-pushed the replace-promptui branch from 09fff32 to 0d8675d Compare May 11, 2026 19:03
Follow the earlier convention: describe what the stub avoids
("prompting") rather than the mechanism being avoided.

Co-authored-by: Isaac
@pietern pietern force-pushed the replace-promptui branch from 0d8675d to 0759cf0 Compare May 11, 2026 19:04
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.

1 participant