feat: add Windows platform support#106
Merged
stephenleo merged 4 commits intostephenleo:mainfrom Mar 28, 2026
Merged
Conversation
- Add home_dir() helper that resolves home directory cross-platform (CLAUDE_HOME > HOME > USERPROFILE) for Windows compatibility - Add Windows get_oauth_token() that reads ~/.claude/.credentials.json directly (no keychain/secret-tool needed on Windows) - Remove compile_error! that rejected non-macOS/Linux targets - Gate Unix-only helpers and tests behind cfg(not(target_os = "windows")) - Update config.rs global fallback to use platform::home_dir() instead of hardcoded $HOME env var - Update uninstall.rs to use home_dir() and Windows binary paths (.exe) - Add install.ps1 PowerShell installer for Windows (downloads binary, configures PATH, writes default config, registers statusline) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
|
@tkm3d1a Thanks for your submission! Give me sometime to test this out on a windows PC. Can you please look into the CI error? https://github.com/stephenleo/cship/actions/runs/23118985383/job/67521158086?pr=106 |
Contributor
Author
|
@stephenleo Of course - I fixed the CI error, it was a |
- uninstall: use platform-appropriate binary name (cship.exe on Windows) - passthrough/cli: gate fake-starship tests with #[cfg(unix)] since Command::new resolves only .exe, not .cmd/.bat on Windows Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
stephenleo
approved these changes
Mar 28, 2026
Owner
stephenleo
left a comment
There was a problem hiding this comment.
lgtm. tested on windows powershell
Owner
|
thank you for your submission! I had some trouble from my own in experience with powershell but tested it fine. I'll update docs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
home_dir()helper toplatform.rsthat resolves the user's home directory viaCLAUDE_HOME>HOME>USERPROFILE, enabling Windows compatibility without breaking existing Linux/macOS behaviorget_oauth_token()for Windows that reads~/.claude/.credentials.jsondirectly (Claude Code on Windows stores credentials as a JSON file, no keychain needed)compile_error!that previously rejected non-macOS/Linux build targetsget_oauth_token_with_cmd,install_hint) and their tests behindcfg(not(target_os = "windows"))config.rsglobal config discovery to useplatform::home_dir()instead of hardcoded$HOMEenv varuninstall.rsto usehome_dir()and platform-appropriate binary paths (.exesuffix on Windows)install.ps1PowerShell installer that downloads the release binary, optionally adds to PATH, writes a defaultcship.toml, and registers the statusline in Claude Code'ssettings.jsonMotivation
cship currently only compiles on macOS and Linux. Claude Code runs on Windows (natively and via Git Bash), and Windows users have no way to use cship. This PR adds first-class Windows support with minimal changes to existing code paths — all Linux/macOS behavior is unchanged.
CI / Release considerations
This PR does not modify CI configuration. To fully support Windows users, the following would also be needed:
windows-latestto the CI test matrixx86_64-pc-windows-msvc(and optionallyaarch64-pc-windows-msvc) to the release build targets soinstall.ps1can download a binaryThese can be done in a follow-up PR or added to this one if preferred.
Test plan
cargo check --target x86_64-pc-windows-msvccompiles cleanlycargo testpasses on Linux/macOS (no regressions — Unix-only tests are cfg-gated)cargo testpasses on Windows (platform-gated tests are skipped)install.ps1downloads binary, writes config, and registers statusline on a fresh Windows machinecship uninstallcorrectly removes Windows binary paths (.exe)USERPROFILEwhenHOMEis unset (native Windows shell)🤖 Generated with Claude Code