Skip to content

Conversation

@timvw
Copy link
Owner

@timvw timvw commented Dec 3, 2025

Summary

Replace the unmaintained promptui library with Charm Bracelet's huh library to enable Windows ConPTY support and fix interactive prompt issues.

Motivation

The promptui library has several critical issues:

  • Unmaintained: Last commit in 2021, archived status
  • Windows bugs: Multiple unresolved issues (#33, #108, #129)
  • No ConPTY support: Prevents Windows PTY interactive tests from working
  • Blocking Windows testing: Required for enabling PowerShell PTY tests

Changes

  • Replaced github.com/manifoldco/promptui with github.com/charmbracelet/huh
  • Updated all 4 interactive prompt locations:
    • Branch selection in checkout command
    • PR selection in pr command
    • MR selection in mr command
    • Worktree selection in remove command
  • Improved PR/MR selection to map display labels directly to values

Benefits

  • ✅ Active maintenance and modern codebase
  • ✅ Native Windows ConPTY support
  • ✅ Cross-platform compatibility (macOS, Linux, Windows)
  • ✅ Better terminal rendering and accessibility
  • ✅ Part of the Charm Bracelet ecosystem

Testing

  • Non-interactive commands tested on macOS ✅
  • Windows PTY interactive tests will validate in CI

Related

  • Companion to Test go pty #24 (enable-windows-pty-tests)
  • Addresses Windows interactive prompt failures

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

Replace the unmaintained promptui library with Charm Bracelet's huh
library to enable cross-platform interactive prompts, especially on
Windows where promptui has known issues.

## Why the Change?

promptui Issues:
- No longer maintained (issue #229)
- Known Windows bugs: keyboard selection doesn't work (issue #33)
- Screen clearing issues on Windows (issue #108)
- Duplicate prompt lines on Windows (issue #129)
- Incompatible with Windows ConPTY

huh Advantages:
- Actively maintained by Charm Bracelet
- Built on Bubbletea (proven TUI framework)
- Cross-platform support (Unix + Windows)
- Accessibility mode for screen readers
- Modern, clean API with theming support

## Changes

- Replaced promptui.Select with huh.NewSelect in 4 locations:
  1. Branch selection for checkout command
  2. PR selection for pr command
  3. MR selection for mr command
  4. Worktree selection for remove command

- Updated go.mod dependencies:
  - Removed: github.com/manifoldco/promptui
  - Added: github.com/charmbracelet/huh v0.8.0

- Improved PR/MR selection logic:
  - huh.NewOption now maps label to value directly
  - Eliminates index-based mapping (more robust)

## Testing

✅ Builds successfully on macOS
✅ Non-interactive commands work (wt co branch-name)
✅ Interactive prompts ready for Windows testing

This change enables the Windows PTY tests in test-go-pty branch to pass
and makes wt truly cross-platform.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
timvw added a commit that referenced this pull request Dec 3, 2025
This commit combines two critical fixes to enable Windows PTY interactive
tests to pass:

1. **go-pty migration** (from PR #24):
   - Replace creack/pty with aymanbagabas/go-pty
   - Add Windows ConPTY support
   - Enable Windows PTY tests in CI

2. **promptui → huh replacement** (from PR #25):
   - Replace unmaintained promptui with Charm Bracelet's huh
   - Fix Windows interactive prompt issues
   - Enable cross-platform terminal UI

## Problem Statement

Windows PTY interactive tests were failing due to two issues:
- creack/pty doesn't support Windows (no ConPTY)
- promptui has known Windows bugs and doesn't work in ConPTY

## Solution

- **go-pty**: Provides Windows ConPTY + Unix PTY support
- **huh**: Modern, maintained prompt library with Windows support

## Testing

This combined change enables:
- ✅ Windows PTY tests infrastructure (go-pty)
- ✅ Windows interactive prompts (huh)
- ✅ Cross-platform compatibility (macOS, Linux, Windows)

## Dependencies

- Added: github.com/aymanbagabas/go-pty v0.2.2
- Added: github.com/charmbracelet/huh v0.8.0
- Removed: github.com/manifoldco/promptui v0.9.0
- Removed: github.com/creack/pty v1.1.24

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@timvw
Copy link
Owner Author

timvw commented Dec 3, 2025

Closing in favor of merged PR #24

@timvw timvw closed this Dec 3, 2025
@timvw timvw deleted the replace-promptui-with-huh branch December 3, 2025 08:00
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.

2 participants