-
Notifications
You must be signed in to change notification settings - Fork 8
Add Windows support for Git Bash and PowerShell #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds Windows support across CI/release, PowerShell completion/hooks and shell-init, cross-platform path handling and tests, and documentation for Windows installation and usage. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
"it worked on my machine"... |
- Add Windows (amd64/arm64) to CI workflow and GoReleaser config - Fix shell detection and hook scripts for Git Bash and PowerShell - Fix path separator handling in worktree management (git returns forward slashes on Windows, Go uses backslashes) - Skip tests with hardcoded Unix paths on Windows 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
I just force pushed a fix for a number of things --
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
cmd/wtp/hook.go (1)
171-227: PowerShell hook implementation is solid with minor suggestions.The PowerShell hook correctly:
- Stores
$__wtpPathto prevent recursion- Checks for
--generate-shell-completionflag- Implements
cdfunctionality matching other shellsHowever, the executable discovery (lines 176-194) searches PATH then falls back to the current directory. While this works for testing, users who install wtp to a custom location outside PATH and without running from the install directory may encounter issues.
Consider documenting this discovery behavior in the PowerShell setup section of the README, or add a warning when
$__wtpPathis not found:function wtp { if (-not $__wtpPath) { - Write-Error "wtp executable not found. Please ensure wtp is in your PATH or current directory." + Write-Error "wtp executable not found. Please ensure wtp is in your PATH or current directory. Run 'Get-Command wtp' to verify installation." return 1 }README.md (1)
315-322: Clarify the WarningPreference workaround.The PowerShell setup silences warnings with
$WarningPreference = 'SilentlyContinue'. While this prevents noise, it might hide legitimate warnings from the shell-init script.Consider adding a brief explanation of why this is needed, or investigate if the underlying warnings can be fixed:
**PowerShell:** Add to your PowerShell profile (`$PROFILE` - typically `~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1` or `~\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1`): ```powershell # Add wtp shell integration (completion + cd functionality) +# Note: Suppress warnings during initialization to avoid PowerShell module loading messages $WarningPreference = 'SilentlyContinue' Invoke-Expression -Command (& wtp shell-init pwsh | Out-String) $WarningPreference = 'Continue'</blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used**: CodeRabbit UI **Review profile**: CHILL **Plan**: Pro <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between ffd7a2bc5e0b442da6e1dfc3e0eaddd471ad0c2c and 5c6f136f726e00df5bb01509276c35c164338fbe. </details> <details> <summary>📒 Files selected for processing (11)</summary> * `.github/workflows/ci.yml` (2 hunks) * `.goreleaser.yml` (2 hunks) * `README.md` (3 hunks) * `cmd/wtp/add_test.go` (6 hunks) * `cmd/wtp/cd_test.go` (2 hunks) * `cmd/wtp/completion_config.go` (2 hunks) * `cmd/wtp/hook.go` (4 hunks) * `cmd/wtp/list_test.go` (3 hunks) * `cmd/wtp/shell_init.go` (4 hunks) * `cmd/wtp/testhelpers_test.go` (1 hunks) * `cmd/wtp/worktree_managed.go` (1 hunks) </details> <details> <summary>🚧 Files skipped from review as they are similar to previous changes (4)</summary> * cmd/wtp/testhelpers_test.go * cmd/wtp/completion_config.go * .github/workflows/ci.yml * .goreleaser.yml </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>📓 Path-based instructions (2)</summary> <details> <summary>**/*.go</summary> **📄 CodeRabbit inference engine (AGENTS.md)** > `**/*.go`: Follow standard Go style with tabs and gofmt; package names must be short and lowercase > Keep import groups tidy; use goimports for organization with local prefix following module path `github.com/satococoa/wtp/v2` > Adhere to linting rules in `.golangci.yml` (vet, staticcheck, gosec, mnd, lll=120) > Wrap errors with context; avoid ignoring errors in Go code > Use snake_case for Go filenames (e.g., `remove.go`, `shell_integration.go`) > Document exported items in Go when non-trivial; follow godoc conventions Files: - `cmd/wtp/worktree_managed.go` - `cmd/wtp/shell_init.go` - `cmd/wtp/list_test.go` - `cmd/wtp/cd_test.go` - `cmd/wtp/add_test.go` - `cmd/wtp/hook.go` </details> <details> <summary>**/*_test.go</summary> **📄 CodeRabbit inference engine (AGENTS.md)** > `**/*_test.go`: Unit tests must be placed alongside packages as `*_test.go` files in the same directory > Target 70% code coverage with unit tests focusing on fast feedback and mocked git interactions using table-driven test cases Files: - `cmd/wtp/list_test.go` - `cmd/wtp/cd_test.go` - `cmd/wtp/add_test.go` </details> </details><details> <summary>🧠 Learnings (14)</summary> <details> <summary>📚 Learning: 2025-12-02T13:33:48.693Z</summary>Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-02T13:33:48.693Z
Learning: Update README and CLI help text when user-facing behavior changes**Applied to files:** - `README.md` </details> <details> <summary>📚 Learning: 2025-12-02T13:33:48.693Z</summary>Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-02T13:33:48.693Z
Learning: Usego run ./cmd/wtp <args>for rapid feedback during development instead of building binaries**Applied to files:** - `README.md` - `cmd/wtp/add_test.go` </details> <details> <summary>📚 Learning: 2025-12-02T13:33:48.693Z</summary>Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-02T13:33:48.693Z
Learning: CLI entrypoint is located atcmd/wtp; new command implementations must integrate with the main CLI structure**Applied to files:** - `README.md` - `cmd/wtp/shell_init.go` - `cmd/wtp/list_test.go` - `cmd/wtp/cd_test.go` - `cmd/wtp/add_test.go` - `cmd/wtp/hook.go` </details> <details> <summary>📚 Learning: 2025-12-02T13:33:48.693Z</summary>Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-02T13:33:48.693Z
Learning: Shell integration must separate completion and hooks for clarity;wtp cdoutputs absolute worktree path with no side effects**Applied to files:** - `README.md` - `cmd/wtp/worktree_managed.go` - `cmd/wtp/shell_init.go` - `cmd/wtp/cd_test.go` - `cmd/wtp/hook.go` </details> <details> <summary>📚 Learning: 2025-12-02T13:33:48.693Z</summary>Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-02T13:33:48.693Z
Learning: Toggle shell integration paths withWTP_SHELL_INTEGRATION=1when testing cd behavior**Applied to files:** - `README.md` </details> <details> <summary>📚 Learning: 2025-12-02T13:33:48.693Z</summary>Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-02T13:33:48.693Z
Learning: Run commands from inside a worktree to mimic real usage (e.g.,go run ../cmd/wtp add feature/new-feature)**Applied to files:** - `README.md` - `cmd/wtp/worktree_managed.go` - `cmd/wtp/shell_init.go` - `cmd/wtp/list_test.go` - `cmd/wtp/cd_test.go` - `cmd/wtp/add_test.go` </details> <details> <summary>📚 Learning: 2025-12-02T13:33:48.693Z</summary>Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-02T13:33:48.693Z
Learning: Applies to **/*.go : Keep import groups tidy; use goimports for organization with local prefix following module pathgithub.com/satococoa/wtp/v2**Applied to files:** - `cmd/wtp/worktree_managed.go` - `cmd/wtp/list_test.go` - `cmd/wtp/add_test.go` </details> <details> <summary>📚 Learning: 2025-12-02T13:33:48.693Z</summary>Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-02T13:33:48.693Z
Learning: Applies to **/*_test.go : Target 70% code coverage with unit tests focusing on fast feedback and mocked git interactions using table-driven test cases**Applied to files:** - `cmd/wtp/list_test.go` - `cmd/wtp/cd_test.go` - `cmd/wtp/add_test.go` </details> <details> <summary>📚 Learning: 2025-12-02T13:33:48.693Z</summary>Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-02T13:33:48.693Z
Learning: The root module isgithub.com/satococoa/wtp/v2running on Go 1.24; maintain module path consistency**Applied to files:** - `cmd/wtp/list_test.go` - `cmd/wtp/add_test.go` </details> <details> <summary>📚 Learning: 2025-12-02T13:33:48.693Z</summary>Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-02T13:33:48.693Z
Learning: Applies to **/*.go : Wrap errors with context; avoid ignoring errors in Go code**Applied to files:** - `cmd/wtp/list_test.go` </details> <details> <summary>📚 Learning: 2025-12-02T13:33:48.693Z</summary>Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-02T13:33:48.693Z
Learning: Applies to test/e2e/**/*.go : End-to-end tests must be placed intest/e2eand exercise real git workflows using the built binary**Applied to files:** - `cmd/wtp/cd_test.go` - `cmd/wtp/add_test.go` </details> <details> <summary>📚 Learning: 2025-12-02T13:33:48.693Z</summary>Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-02T13:33:48.693Z
Learning: Applies to **/*_test.go : Unit tests must be placed alongside packages as*_test.gofiles in the same directory**Applied to files:** - `cmd/wtp/add_test.go` </details> <details> <summary>📚 Learning: 2025-12-02T13:33:48.693Z</summary>Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-02T13:33:48.693Z
Learning: Rungo tool task devbefore committing to ensure code is formatted, linted, and tests pass**Applied to files:** - `cmd/wtp/add_test.go` </details> <details> <summary>📚 Learning: 2025-12-02T13:33:48.693Z</summary>Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-02T13:33:48.693Z
Learning: Applies to .wtp.yml : Project hooks must be defined in.wtp.yml; keep commands deterministic and safe, avoiding destructive steps by default**Applied to files:** - `cmd/wtp/hook.go` </details> </details><details> <summary>🧬 Code graph analysis (4)</summary> <details> <summary>cmd/wtp/worktree_managed.go (2)</summary><blockquote> <details> <summary>internal/git/repository_integration_test.go (1)</summary> * `TestGetMainWorktreePath` (11-32) </details> <details> <summary>internal/config/config.go (1)</summary> * `c` (167-173) </details> </blockquote></details> <details> <summary>cmd/wtp/shell_init.go (2)</summary><blockquote> <details> <summary>cmd/wtp/shell_init_test.go (2)</summary> * `TestNewShellInitCommand` (12-32) * `TestShellInitCommand_OutputsValidScripts` (34-79) </details> <details> <summary>test/e2e/shell_test.go (1)</summary> * `TestShellEnvironment` (167-191) </details> </blockquote></details> <details> <summary>cmd/wtp/cd_test.go (1)</summary><blockquote> <details> <summary>internal/hooks/executor_test.go (1)</summary> * `TestExecutePostCreateHooks_Command` (103-140) </details> </blockquote></details> <details> <summary>cmd/wtp/hook.go (1)</summary><blockquote> <details> <summary>internal/command/types.go (1)</summary> * `Command` (4-8) </details> </blockquote></details> </details> </details> <details> <summary>🔇 Additional comments (6)</summary><blockquote> <details> <summary>cmd/wtp/cd_test.go (1)</summary><blockquote> `20-22`: **Appropriate Windows guard for Unix-specific paths.** The test skip is correct—this test uses hardcoded Unix paths (`/Users/dev/project/main`) that won't work on Windows. </blockquote></details> <details> <summary>cmd/wtp/worktree_managed.go (1)</summary><blockquote> `29-51`: **Robust cross-platform path normalization.** The changes correctly handle Windows-specific path issues: - `filepath.Clean` normalizes Git's forward slashes to OS-native separators - `EvalSymlinks` resolves symlinks and Windows junction points with safe fallback - The approach is backward-compatible with Unix systems </blockquote></details> <details> <summary>cmd/wtp/add_test.go (1)</summary><blockquote> `286-288`: **Consistent Windows test guards across multiple test cases.** All five Windows guards correctly skip tests that use Unix-specific hardcoded paths. The TODO comments indicate these will be addressed in future work. Also applies to: 335-337, 477-479, 567-569, 762-764 </blockquote></details> <details> <summary>README.md (1)</summary><blockquote> `117-139`: **Comprehensive Windows installation instructions.** The installation steps for both PowerShell and Git Bash are clear and well-structured. </blockquote></details> <details> <summary>cmd/wtp/shell_init.go (1)</summary><blockquote> `67-72`: **PowerShell shell-init follows established patterns.** The implementation correctly mirrors bash/zsh/fish structure: outputs completion first, then the hook. Test coverage for PowerShell functionality in shell_init_test.go must be verified to confirm this implementation is fully tested. </blockquote></details> <details> <summary>cmd/wtp/list_test.go (1)</summary><blockquote> `681-683`: **Test skipping with TODO tracking is appropriate.** The Windows guard correctly skips this test that relies on Unix-specific path conventions, allowing the test suite to maintain appropriate coverage targets while acknowledging the platform limitation. The TODO comment provides inline tracking of this limitation. </blockquote></details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
This commit enables comprehensive Windows support with both Git Bash and PowerShell shell integration, providing Windows users with the same seamless worktree management experience as macOS and Linux users.
Changes:
PowerShell Integration:
Git Bash Integration:
Testing:
🚀 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation
Chores
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.