Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 1.73 KB

File metadata and controls

34 lines (26 loc) · 1.73 KB

<- Back to Backlog

[SC-016b] ✅ DONE - Replace main menu with Read-SpectreSelection

Status: Done (2026-04-03) Priority: High Component: lib/wsl/manager.ps1, lib/wsl/manager.Tests.ps1 Parent: SC-016 Depends on: SC-016a

Summary: As a user, I want the main menu to use arrow-key navigation with instant selection so that I no longer need to type a letter and press Enter.

Description: Replace the current Write-Host menu + Read-Host letter input in Start-InteractiveMode with a Read-SpectreSelection prompt. Pressing Esc exits the menu loop.

Technical approach

  • Extract a new Show-WslMenu function that calls Read-SpectreSelection with menu option labels as choices
  • Returns the selected command string (e.g., "install", "remove") or $null on Esc/cancel
  • Refactor Start-InteractiveMode to call Show-WslMenu instead of the Write-Host block + Read-Host
  • Remove the $menuKeyMap hashtable (letter-key mapping no longer needed)
  • Remove Clear-Host per-loop call (Spectre handles terminal rendering)
  • Remove Read-Host "Press Enter to continue" pause after command execution
  • Update manager.Tests.ps1: mock Read-SpectreSelection instead of Read-Host, test Esc returns $null and exits loop, test valid selection dispatches correct command

Acceptance Criteria:

  • Main menu uses Read-SpectreSelection with arrow-key navigation
  • Menu options respond immediately on selection (no Enter + letter required)
  • Ctrl+C or selecting "Quit" exits the interactive mode
  • Show-WslMenu function has Pester unit tests with mocked Read-SpectreSelection
  • All existing tests continue to pass (updated mocks)

<- Back to Backlog