Status: In Progress
Priority: High
Component: lib/wsl/manager.ps1, lib/wsl/commands.ps1, tools/wsl-manager/wsl-manager.ps1
Depends on: SC-029
Blocks: SC-030, SC-031
Summary: As a user, I want the WSL Manager to have a modern, beautiful terminal interface with arrow-key navigation, rich tables, and instant input so that the interactive experience feels responsive and professional.
Description:
The current TUI uses Write-Host with basic colors, Read-Host for all input (requires typing + Enter), and Clear-Host on each loop iteration (causes screen flicker). This item replaces the TUI layer with PwshSpectreConsole v2, a PowerShell wrapper around Spectre.Console that provides rich terminal UI primitives.
This is a significant expansion of the original SC-016 scope (which only covered instant key input and Esc-to-menu). The original acceptance criteria are preserved and extended.
PwshSpectreConsole was selected over alternatives for these reasons:
- Idiomatic PowerShell: cmdlets like
Read-SpectreSelection,Format-SpectreTable- not raw .NET interop - Right level of abstraction: selection prompts, tables, progress are exactly what the WSL manager needs
- Best testability: cmdlets can be mocked in Pester; event-driven .NET types (Terminal.Gui) cannot
- Low dependency risk: single PSGallery module, actively maintained
- Incremental adoption: can replace one UI element at a time
- Replace
Read-Hostmenu selection withRead-SpectreSelection(arrow-key navigation, instant selection, Esc to cancel) - Replace
Write-Hostdistro table withFormat-SpectreTable(borders, colored status columns, alignment) - Replace
Read-Hostdistro selection withRead-SpectreSelectionfor distro picker lists - Add
Read-SpectreConfirmfor destructive operations (remove, terminate, shutdown) - Color-coded status with Spectre markup:
[green]Running[/],[red]Stopped[/],[yellow]Installing...[/] - Add PwshSpectreConsole as a module dependency (PSGallery install, documented in README)
- Add
PwshSpectreConsolemodule installation to the setup process (after Scoop installspwsh) - Build a
Show-WslMenufunction usingRead-SpectreSelectionwith the current menu options - Build a
Show-WslDistroTablefunction usingFormat-SpectreTable - Build a
Select-WslDistrofunction usingRead-SpectreSelectionfor distro picker - Existing
commands.ps1action functions remain unchanged - only the TUI layer changes - Original key-letter shortcuts preserved as accelerators alongside arrow-key navigation
This story is broken into five independently UAT-able subtasks:
- SC-016a - Add PwshSpectreConsole module dependency to setup process
- SC-016b - Replace main menu with
Read-SpectreSelection - SC-016c - Replace distro table with
Format-SpectreTable - SC-016d - Replace distro selection with
Read-SpectreSelection - SC-016e - Add
Read-SpectreConfirmfor destructive operations
SC-016a is the foundation; SC-016b/c/d can proceed in any order after it. SC-016e depends on SC-016d (needs the Spectre-based distro picker).
Acceptance Criteria:
- PwshSpectreConsole module is installed as part of the setup process
- Main menu uses
Read-SpectreSelectionwith arrow-key navigation - Menu options respond immediately to selection (no Enter + letter required)
- Pressing Ctrl+C at any interactive step returns to the main menu
- Distro table rendered with
Format-SpectreTable(borders, colored status) - Distro selection uses
Read-SpectreSelectioninstead ofRead-Host - Destructive operations (remove, terminate, shutdown) use
Read-SpectreConfirm - Existing command functions in
commands.ps1are not structurally changed - All existing tests continue to pass
- New TUI functions have Pester unit tests with mocked Spectre cmdlets