diff --git a/.claude/hooks/resolve-symlinks.sh b/.claude/hooks/resolve-symlinks.sh deleted file mode 100755 index 31e1585f37..0000000000 --- a/.claude/hooks/resolve-symlinks.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash -# Resolve _ee.rs symlinks to actual files so Claude can read them -# This script runs before each user prompt is processed - -set -e - -PROJECT_DIR="${CLAUDE_PROJECT_DIR:-/home/farhad/windmill}" -MANIFEST_FILE="$PROJECT_DIR/.claude/hooks/.symlink-manifest" - -# Find all _ee.rs symlinks and store their targets -find "$PROJECT_DIR" -name "*_ee.rs" -type l 2>/dev/null | while read -r symlink; do - target=$(readlink -f "$symlink" 2>/dev/null) || continue - - # Only process if target file exists - if [[ -f "$target" ]]; then - # Store symlink path and target in manifest - echo "$symlink|$target" >> "$MANIFEST_FILE.tmp" - - # Replace symlink with actual file content - rm "$symlink" - cp "$target" "$symlink" - fi -done - -# Atomically replace manifest -if [[ -f "$MANIFEST_FILE.tmp" ]]; then - mv "$MANIFEST_FILE.tmp" "$MANIFEST_FILE" -fi - -exit 0 diff --git a/.claude/hooks/restore-symlinks.sh b/.claude/hooks/restore-symlinks.sh deleted file mode 100755 index 162444ea19..0000000000 --- a/.claude/hooks/restore-symlinks.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env bash -# Restore _ee.rs symlinks after Claude finishes processing -# This script runs when Claude stops -# IMPORTANT: Copies any modifications back to the target before restoring symlinks - -set -e - -PROJECT_DIR="${CLAUDE_PROJECT_DIR:-/home/farhad/windmill}" -MANIFEST_FILE="$PROJECT_DIR/.claude/hooks/.symlink-manifest" - -# Check if manifest exists -if [[ ! -f "$MANIFEST_FILE" ]]; then - exit 0 -fi - -# Read manifest and restore symlinks -while IFS='|' read -r symlink target; do - if [[ -n "$symlink" && -n "$target" ]]; then - # If the file exists (not a symlink) and target exists, copy changes back - if [[ -f "$symlink" && ! -L "$symlink" && -e "$target" ]]; then - # Copy the potentially modified file back to the target - cp "$symlink" "$target" - fi - - # Remove the regular file (which was a copy) - rm -f "$symlink" 2>/dev/null || true - - # Recreate the symlink - ln -s "$target" "$symlink" 2>/dev/null || true - fi -done < "$MANIFEST_FILE" - -# Clean up manifest -rm -f "$MANIFEST_FILE" - -exit 0 diff --git a/.claude/settings.json b/.claude/settings.json index eac00f2227..98f7a59c2d 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -1,5 +1,8 @@ { "permissions": { + "additionalDirectories": [ + "../windmill-ee-private" + ], "allow": [ "Bash(ls:*)", "Bash(grep:*)", @@ -63,39 +66,6 @@ }, "enableAllProjectMcpServers": true, "hooks": { - "UserPromptSubmit": [ - { - "hooks": [ - { - "type": "command", - "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/resolve-symlinks.sh", - "timeout": 30 - } - ] - } - ], - "Stop": [ - { - "hooks": [ - { - "type": "command", - "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/restore-symlinks.sh", - "timeout": 30 - } - ] - } - ], - "SessionEnd": [ - { - "hooks": [ - { - "type": "command", - "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/restore-symlinks.sh", - "timeout": 30 - } - ] - } - ], "PostToolUse": [ { "matcher": "Edit|Write", diff --git a/.gitignore b/.gitignore index 2c3dae5c35..8cad7e4df2 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,9 @@ rust-client/Cargo.toml # Worktree-generated port isolation .env.local +# Worktree-specific Claude Code settings (generated by scripts/worktree-env) +.claude/settings.local.json + # Symlinked cache directories (for git worktrees) backend/target frontend/node_modules diff --git a/scripts/worktree-env b/scripts/worktree-env index 4eedd29638..7fb5118b49 100755 --- a/scripts/worktree-env +++ b/scripts/worktree-env @@ -84,4 +84,20 @@ if [ -d "$ee_repo" ]; then elif [ -d "$ee_worktree_dir" ]; then echo "EE worktree already exists at $ee_worktree_dir" fi + + # Point Claude Code additionalDirectories at the EE worktree + if [ -d "$ee_worktree_dir" ]; then + ee_rel=$(python3 -c "import os; print(os.path.relpath('$ee_worktree_dir', '$(pwd)'))" 2>/dev/null || echo "$ee_worktree_dir") + mkdir -p .claude + cat > .claude/settings.local.json <