Improve Windows installation with native PowerShell support and tougher shell installer fallbacks

Merged
RO
7mo ago
+585-39

Summary

Windows users were being funneled into a Unix-first curl | bash flow that can fail before the installer even runs, especially on Windows 10 with Schannel revocation errors like CRYPT_E_NO_REVOCATION_CHECK. This PR makes Windows installation first-class by adding a native PowerShell installer, while also hardening the existing shell installer for Git Bash and other bash-based environments on Windows. The result is a more reliable install experience across native Windows, Git Bash, and WSL2 without regressing Unix users.

Ref: https://3.basecamp.com/2914079/buckets/46292715/card_tables/cards/9751372396

Changes

  • add a native Windows PowerShell installer at scripts/install.ps1
  • update docs to recommend PowerShell for native Windows installs
  • keep install.sh as the installer for macOS, Linux, WSL2, and bash-based Windows environments
  • harden install.sh to better handle Windows Schannel revocation-check failures by retrying with supported curl flags
  • add fallback release resolution via the GitHub API when redirect-based latest-version detection fails
  • make installer bin-dir selection smarter by preferring an already-present PATH location (~/bin or ~/.local/bin) before falling back to platform defaults
  • align scripts/ensure-basecamp.sh with the same smarter path and Windows-friendly behavior

Notes

  • WSL2 continues to be treated as Linux and uses the Unix installer path
  • native Windows is now expected to use the PowerShell installer path
  • Git Bash remains supported via the shell installer as a secondary Windows path

Summary by cubic

Adds a native Windows PowerShell installer and toughens the bash installers across Windows/WSL2/macOS/Linux. Improves latest-version detection (incl. prereleases), SHA‑256 with optional cosign, PATH‑aware bin‑dir defaults, Schannel‑aware curl, and non‑interactive behavior; docs add OS‑specific quick starts, Git Bash callouts, and Windows Schannel guidance.

  • New Features

    • scripts/install.ps1: latest‑version via redirect with GitHub API fallback; SHA‑256 and optional cosign verification; installs to a PATH‑aware bin dir and prepends the user PATH; supports prereleases; clearer non‑interactive flow; actionable install‑failure message if basecamp.exe is in use; hardened downloads with -UseBasicParsing -ErrorAction Stop.
    • Shell installers (scripts/install.sh, scripts/ensure-basecamp.sh): Schannel‑aware curl wrapper that forces --show-error and retries on CRYPT_E_NO_REVOCATION_CHECK; smarter bin‑dir selection using current PATH (prefers ~/bin or ~/.local/bin; defaults to ~/bin on Windows) with exact PATH hints; optional cosign.
  • Bug Fixes

    • Whitespace‑tolerant GitHub API parsing for latest‑version fallback in install.sh and ensure-basecamp.sh to avoid breaks on JSON formatting changes.
    • scripts/ensure-basecamp.sh: after installing to a bin dir not on PATH, export that dir into the current PATH so the post‑install self‑check succeeds without a new shell.