diff --git a/.claude/settings.json b/.claude/settings.json index 8955e7721..77f39858f 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -1,13 +1,16 @@ { "worktree": { - "baseRef": "fresh", - "symlinkDirectories": ["node_modules"] + "baseRef": "fresh" }, "hooks": { "PostToolUse": [ { "matcher": "EnterWorktree", "hooks": [ + { + "type": "command", + "command": "\"$CLAUDE_PROJECT_DIR/scripts/install-worktree-deps.sh\"" + }, { "type": "command", "command": "\"$CLAUDE_PROJECT_DIR/scripts/assign-worktree-port.sh\"" diff --git a/scripts/install-worktree-deps.sh b/scripts/install-worktree-deps.sh new file mode 100755 index 000000000..2d41f7458 --- /dev/null +++ b/scripts/install-worktree-deps.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +set -euo pipefail + +PAYLOAD=$(cat) +WORKTREE_PATH=$(echo "$PAYLOAD" | jq -r '.tool_response.worktreePath // empty') + +if [ -z "$WORKTREE_PATH" ]; then + exit 0 +fi + +# Turbopack refuses to resolve through anything outside its detected +# workspace root, so a symlinked node_modules (whole dir or per-entry) +# doesn't work for apps/dokploy. A real `pnpm install` is required, but +# since pnpm's global content-addressable store is already warm, this +# only links locally — no network fetch, a few seconds. +cd "$WORKTREE_PATH" +pnpm install --prefer-offline