diff --git a/CLAUDE.md b/CLAUDE.md index e8c040402..3982ec81c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -17,8 +17,8 @@ ## Git Worktree Shared Dependencies ### How It Works The `conductor.json` setup script (`scripts/conductor-setup.sh`) automatically: -1. Creates a shared `.shared-deps/` directory in the main repository -2. Creates symlinks from `node_modules` and `vendor` to the shared location +1. Creates symlinks from worktree's `node_modules` and `vendor` to the main repository's directories +2. All worktrees share the same dependencies from the main repository 3. This happens automatically when Conductor creates a new worktree ### Benefits @@ -27,6 +27,7 @@ ### Benefits - **Faster setup**: No need to run `npm install` or `composer install` for each worktree - **Consistent versions**: All worktrees use the same dependency versions - **Auto-configured**: Handled by Conductor's setup script +- **Simple**: Uses the main repo's existing directories, no extra folders ### Manual Setup (If Needed) @@ -34,18 +35,15 @@ ### Manual Setup (If Needed) ```bash # From the worktree directory -SHARED_DEPS="../../.shared-deps" -mkdir -p "$SHARED_DEPS/node_modules" "$SHARED_DEPS/vendor" rm -rf node_modules vendor -ln -sf "$SHARED_DEPS/node_modules" node_modules -ln -sf "$SHARED_DEPS/vendor" vendor +ln -sf ../../node_modules node_modules +ln -sf ../../vendor vendor ``` ### Important Notes -- Dependencies are shared at `$CONDUCTOR_ROOT_PATH/.shared-deps/` -- Run `npm install` or `composer install` from any worktree to update all -- Ensure `.shared-deps/` is in `.gitignore` (should already be there) +- Dependencies are shared from the main repository (`$CONDUCTOR_ROOT_PATH`) +- Run `npm install` or `composer install` from the main repo or any worktree to update all - If different branches need different dependency versions, this won't work - remove symlinks and use separate directories ## Development Commands diff --git a/scripts/conductor-setup.sh b/scripts/conductor-setup.sh index 963c8e808..a1172e0d0 100755 --- a/scripts/conductor-setup.sh +++ b/scripts/conductor-setup.sh @@ -4,23 +4,22 @@ set -e # Copy .env file cp $CONDUCTOR_ROOT_PATH/.env .env -# Setup shared dependencies via symlinks +# Setup shared dependencies via symlinks to main repo echo "Setting up shared node_modules and vendor directories..." -# Create shared-deps directory in main repository if it doesn't exist -SHARED_DEPS="$CONDUCTOR_ROOT_PATH/.shared-deps" -mkdir -p "$SHARED_DEPS/node_modules" -mkdir -p "$SHARED_DEPS/vendor" +# Ensure main repo has the directories +mkdir -p "$CONDUCTOR_ROOT_PATH/node_modules" +mkdir -p "$CONDUCTOR_ROOT_PATH/vendor" # Remove existing directories if they exist and are not symlinks [ -d "node_modules" ] && [ ! -L "node_modules" ] && rm -rf node_modules [ -d "vendor" ] && [ ! -L "vendor" ] && rm -rf vendor -# Calculate relative path from worktree to shared deps +# Calculate relative path from worktree to main repo WORKTREE_PATH=$(pwd) -RELATIVE_PATH=$(python3 -c "import os.path; print(os.path.relpath('$SHARED_DEPS', '$WORKTREE_PATH'))") +RELATIVE_PATH=$(python3 -c "import os.path; print(os.path.relpath('$CONDUCTOR_ROOT_PATH', '$WORKTREE_PATH'))") -# Create symlinks +# Create symlinks to main repo's node_modules and vendor ln -sf "$RELATIVE_PATH/node_modules" node_modules ln -sf "$RELATIVE_PATH/vendor" vendor