Repository navigation
fix: use cross-platform wrapper for wt CLI in Claude Code integration
#1754
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
Merged
Merged
Changes from 11 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
9be3764
fix: use cross-platform wrapper for wt CLI in plugin hooks
lucaspimentel 7908858
fix: prefer git-wt.exe on Windows, fall back to wt
worktrunk-bot 5e46cc0
refactor: condense wt.sh Windows detection into single if-statement
lucaspimentel b24c364
fix: skip Windows Terminal alias when resolving wt on Windows
lucaspimentel faa0f7c
Apply suggestion from @worktrunk-bot
lucaspimentel e93b4bd
fix: remove duplicate wt invocation and clarify error message
lucaspimentel 987af81
bump plugin's patch version
lucaspimentel 78f85b8
fix: simplify wt.sh binary resolution and improve error messages
lucaspimentel c706a17
docs: update wt.sh header comments to match simplified logic
lucaspimentel 64d4c92
refactor: restore OS check in wt.sh for fast path on non-Windows
lucaspimentel f531f04
fix: skip wt.sh early when not inside a git repository
lucaspimentel 31e2fb1
Merge branch 'max-sixty:main' into main
lucaspimentel 5645394
feat: honor WORKTRUNK_BIN env var in wt.sh wrapper
lucaspimentel 36a84dd
don't check in bash script for git repository
lucaspimentel a3407ae
tweak comment and error message
lucaspimentel d3da440
Merge remote-tracking branch 'origin/main' into lucaspimentel-main-merge
worktrunk-bot de3cd47
fix(plugin): wrap WorktreeCreate and WorktreeRemove hooks in wt.sh
worktrunk-bot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| #!/usr/bin/env bash | ||
| # Cross-platform wrapper for the worktrunk CLI. | ||
| # On Windows (MSYS/Cygwin), prefers git-wt.exe over wt and rejects wt if | ||
| # it resolves to Windows Terminal (WindowsApps/wt.exe). | ||
| # On other platforms, uses wt directly. | ||
| # Exits silently if git is unavailable or not inside a git repository. | ||
| # Usage: wt.sh [args...] | ||
|
|
||
| # bail early if git is not available or not inside a git repository | ||
| if ! command -v git >/dev/null 2>&1 || ! git rev-parse --git-dir >/dev/null 2>&1; then | ||
| exit 0 | ||
| fi | ||
|
|
||
| # check for bash on Windows (on Windows, Claude Code defaults to Git Bash) | ||
| if [[ "$(uname -o 2>/dev/null)" =~ ^(Msys|Cygwin)$ ]]; then | ||
| if command -v git-wt.exe >/dev/null 2>&1; then | ||
| # prefer git-wt over wt if available | ||
| WT=git-wt.exe | ||
| elif command -v wt >/dev/null 2>&1; then | ||
| # reject wt if it's the Windows Terminal alias | ||
| if [[ "$(command -v wt)" == *WindowsApps* ]]; then | ||
| echo "worktrunk: 'wt' resolves to Windows Terminal; install worktrunk as git-wt.exe or remove the Windows Terminal alias — see https://worktrunk.dev/worktrunk/#install" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| WT=wt | ||
| fi | ||
| else | ||
| # non-Windows, always use wt | ||
| WT=wt | ||
| fi | ||
|
|
||
| if [[ -z "$WT" ]] || ! command -v "$WT" >/dev/null 2>&1; then | ||
| echo "worktrunk: could not find 'wt' in PATH" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| "$WT" "$@" | ||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.