Skip to content

Commit 3fb1cf1

Browse files
randclaude
andcommitted
fix: bootstrap venv in plugin cache on first hook invocation
Claude Code expects .venv/bin/activate for Python plugins but doesn't run uv sync after installing/updating to a new version, causing persistent 'no such file or directory' errors on every shell command. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2673b9d commit 3fb1cf1

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

scripts/hook-dispatch.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ PLUGIN_ROOT="${CLAUDE_PLUGIN_ROOT:-$(cd "$(dirname "$0")/.." && pwd)}"
1313
export CLAUDE_PLUGIN_ROOT="$PLUGIN_ROOT"
1414
HOOK_NAME="$1"
1515

16+
# Bootstrap venv if missing (Claude Code expects .venv/bin/activate for Python plugins)
17+
if [ ! -d "$PLUGIN_ROOT/.venv" ] && [ -f "$PLUGIN_ROOT/pyproject.toml" ]; then
18+
if command -v uv &> /dev/null; then
19+
(cd "$PLUGIN_ROOT" && uv sync --quiet 2>/dev/null) || true
20+
fi
21+
fi
22+
1623
if [ -z "$HOOK_NAME" ]; then
1724
echo "Usage: $0 <hook-name>" >&2
1825
exit 1

0 commit comments

Comments
 (0)