chore: add install-worktree-deps.sh script for dependency installation

This commit is contained in:
Mauricio Siu 2026-08-25 01:20:10 -06:00
parent feccb51287
commit cda047feb2
2 changed files with 22 additions and 2 deletions

View File

@ -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\""

View File

@ -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