Skip to content

v0.4.6 — Windows support fixed end to end

Choose a tag to compare

@PeepSick PeepSick released this 03 Aug 23:17
· 28 commits to main since this release

USB was effectively unusable on Windows. This release fixes that end to end, and adds the regression tests that should have caught it.

What's fixed

Windows launcher. usb wouldn't start at all. npm's global shim resolved the CLI's #!/usr/bin/env bash shebang by looking for bash.exe on PATH, but Git for Windows' default install puts Git\cmd and Git\mingw64\bin on PATH — not Git\usr\bin, where bash.exe actually lives. A standard Windows + Git setup got CommandNotFoundException. The entry point is now a small Node launcher that locates bash properly and execs the real script.

Interactive installer. The runtime picker continuously printed Invalid choice instead of accepting input, then exited as if it had succeeded. Two independent causes:

  • Under curl … | bash — the documented one-liner, and what the CLI itself did — the installer's stdin is the pipe carrying its own script text, not the keyboard, so select consumed those leftover script lines as answers. The installer now reads the prompt from /dev/tty when stdin isn't a terminal, and the CLI downloads the installer to a temp file and runs it as a file argument instead of piping.
  • Windows terminals deliver Enter as CRLF, leaving a trailing \r that stopped select from matching the input to any option. It's now stripped before the option is resolved.

With no terminal available at all (CI, cron, | bash from a script), the picker now selects the first detected runtime and says so, rather than looping. Pass --target=<name> or set USB_TARGET=<name> to choose explicitly.

usb search stdin bug. curl … | python3 - "$query" <<'PY' — the heredoc silently won over the pipe for Python's stdin, so it parsed empty input and fell through to a raw-grep fallback.

Generic / custom-path selection. Choosing generic (custom path) set the install target to that entire label instead of generic. The picker also couldn't accept a two-digit choice, so machines with ten or more detected runtimes couldn't select past the ninth.

Tests

  • PTY regression test added — scripts/check-installer-prompt.py drives the installer over a real pseudo-terminal, feeds CRLF input, and asserts the prompt actually waits and installs. It also asserts the no-TTY path falls back instead of looping.
  • CI now covers the real installer path — the curl … | bash flow users actually take, not a convenient stand-in for it.

Testing note

The original installer test passed because it exercised the wrong execution path (bash install.sh) instead of the real curl | bash flow. A new PTY-based regression test now reproduces the original Windows failure before verifying the fix.

Why this matters

USB now works end to end on Windows.

Upgrading

npm install -g @peepsick/usb-cli

Nothing to migrate — installed skills and their paths are unchanged.