Skip to content

feat: add Windows support (amd64 + arm64) - #14

Merged
simonnordberg merged 5 commits into
mainfrom
worktree-windows-support
Sep 17, 2026
Merged

simonnordberg merged 5 commits into
mainfrom
worktree-windows-support

Conversation

@simonnordberg

Copy link
Copy Markdown
Contributor

Summary

  • Add windows to goreleaser build matrix (amd64 + arm64)
  • Extract duplicated openBrowser into shared internal/browser package, add cmd /c start for Windows
  • Self-update: append .exe to binary name on Windows, handle locked-exe replacement (rename aside, clean up .old on next run)
  • Switch config/cache dir fallbacks to os.UserConfigDir() / os.UserCacheDir() (returns %AppData% / %LocalAppData% on Windows, unchanged on Unix)
  • Add PowerShell install script (install.ps1) for irm .../install.ps1 | iex
  • Update upload-release.sh to handle .exe binaries and upload install.ps1

Test plan

  • go test ./... passes (all packages)
  • GOOS=windows GOARCH=amd64 go build cross-compiles cleanly
  • GOOS=windows GOARCH=arm64 go build cross-compiles cleanly
  • TestFindChecksum_WithExeSuffix: .exe entries found in checksums.txt
  • TestReplaceBinary_CleansUpOldFile: .old cleanup works
  • TestConfigDir_Default / TestCacheDir_Default: use native OS dirs
  • On Windows: irm .../install.ps1 | iex installs, codebahn version runs, codebahn update self-updates

Build and distribute the CLI for Windows alongside Linux and macOS.

- Add windows to goreleaser build matrix
- Extract shared internal/browser package (deduplicate openBrowser),
  add Windows case (cmd /c start)
- Self-update: append .exe to download binary name on Windows, handle
  locked-exe replacement by renaming the running binary aside first,
  clean up .old file on next run
- Switch config/cache dir fallbacks from hardcoded ~/.config and
  ~/.cache to os.UserConfigDir() / os.UserCacheDir() (returns
  %AppData% / %LocalAppData% on Windows, unchanged on Unix)
- Add PowerShell install script (install.ps1) mirroring install.sh
- Update upload-release.sh to handle .exe binaries and upload
  install.ps1
- browser.Open: add empty title arg to cmd /c start to prevent &
  in OAuth URLs from being interpreted as command separators
- config/cache dirs: only use os.UserConfigDir() / os.UserCacheDir()
  on Windows; keep ~/.config and ~/.cache on Linux/macOS to avoid
  orphaning existing config files (macOS would move to ~/Library)
- selfupdate: rollback the .old rename if the final rename fails,
  and clean up .old on success
Use rundll32 instead of cmd /c start to avoid URL truncation on &.
Match test expectations to actual code paths (hardcoded .config/.cache,
not os.UserConfigDir/os.UserCacheDir which differ on macOS).
Add [Net.ServicePointManager]::SecurityProtocol = Tls12 before HTTPS
calls in install.ps1 for PS 5.1 on older Windows.

Append .exe to binary name in test helpers so Update tests resolve the
correct path on Windows (matching production selfupdate.go logic).
- Add PGP signature verification to PowerShell installer (uses gpg
  when available, warns when not)
- Surface rollback error with recovery path in selfupdate on Windows
- Make TestConfigDir_Default platform-aware for Windows
@simonnordberg
simonnordberg merged commit 546b539 into main Sep 17, 2026
1 check passed
@simonnordberg
simonnordberg deleted the worktree-windows-support branch September 23, 2026 07:47
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.

1 participant