Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 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 Mar 26, 2026
7908858
fix: prefer git-wt.exe on Windows, fall back to wt
worktrunk-bot Mar 26, 2026
5e46cc0
refactor: condense wt.sh Windows detection into single if-statement
lucaspimentel Mar 26, 2026
b24c364
fix: skip Windows Terminal alias when resolving wt on Windows
lucaspimentel Mar 26, 2026
faa0f7c
Apply suggestion from @worktrunk-bot
lucaspimentel Mar 26, 2026
e93b4bd
fix: remove duplicate wt invocation and clarify error message
lucaspimentel Mar 26, 2026
987af81
bump plugin's patch version
lucaspimentel Mar 26, 2026
78f85b8
fix: simplify wt.sh binary resolution and improve error messages
lucaspimentel Mar 26, 2026
c706a17
docs: update wt.sh header comments to match simplified logic
lucaspimentel Mar 26, 2026
64d4c92
refactor: restore OS check in wt.sh for fast path on non-Windows
lucaspimentel Mar 26, 2026
f531f04
fix: skip wt.sh early when not inside a git repository
lucaspimentel Mar 26, 2026
31e2fb1
Merge branch 'max-sixty:main' into main
lucaspimentel Mar 27, 2026
5645394
feat: honor WORKTRUNK_BIN env var in wt.sh wrapper
lucaspimentel Mar 27, 2026
36a84dd
don't check in bash script for git repository
lucaspimentel Apr 21, 2026
a3407ae
tweak comment and error message
lucaspimentel Apr 21, 2026
d3da440
Merge remote-tracking branch 'origin/main' into lucaspimentel-main-merge
worktrunk-bot Apr 28, 2026
de3cd47
fix(plugin): wrap WorktreeCreate and WorktreeRemove hooks in wt.sh
worktrunk-bot May 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .claude-plugin/hooks/hooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"hooks": [
{
"type": "command",
"command": "wt config state marker set 🤖 || true"
"command": "bash \"${CLAUDE_PLUGIN_ROOT}/.claude-plugin/hooks/wt.sh\" config state marker set 🤖 || true"
}
]
}
Expand All @@ -16,7 +16,7 @@
"hooks": [
{
"type": "command",
"command": "wt config state marker set 💬 || true"
"command": "bash \"${CLAUDE_PLUGIN_ROOT}/.claude-plugin/hooks/wt.sh\" config state marker set 💬 || true"
}
]
}
Expand All @@ -27,7 +27,7 @@
"hooks": [
{
"type": "command",
"command": "wt config state marker clear || true"
"command": "bash \"${CLAUDE_PLUGIN_ROOT}/.claude-plugin/hooks/wt.sh\" config state marker clear || true"
}
]
}
Expand Down
39 changes: 39 additions & 0 deletions .claude-plugin/hooks/wt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Cross-platform wrapper for the worktrunk CLI.
# If WORKTRUNK_BIN is set, uses that path exclusively.
# Otherwise, 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.
# Usage: wt.sh [args...]

if [[ -n "$WORKTRUNK_BIN" ]]; then
if ! command -v "$WORKTRUNK_BIN" >/dev/null 2>&1; then
echo "worktrunk: WORKTRUNK_BIN is set to '$WORKTRUNK_BIN' but it was not found" >&2
exit 1
fi
WT="$WORKTRUNK_BIN"
elif [[ "$(uname -o 2>/dev/null)" =~ ^(Msys|Cygwin)$ ]]; then
# check for bash on Windows (on Windows, Claude Code defaults to Git Bash)
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" "$@"
Loading