From c30c38a4e5a8ecc35640e45b27723c199e1d0ade Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Wed, 29 Apr 2026 03:11:45 -0500 Subject: chore(hooks): skip out-of-tree .el files in validate-el.sh This PostToolUse hook validates .el edits via check-parens and byte-compile-file. It was firing on edits to files outside the project root too, which meant byte-compiling without the foreign package's load-path set up and leaving .elc droppings in the wrong tree. Added a four-line PROJECT_ROOT guard so out-of-tree files exit silently. --- .claude/hooks/validate-el.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to '.claude') diff --git a/.claude/hooks/validate-el.sh b/.claude/hooks/validate-el.sh index 803badf8..b811bcc2 100755 --- a/.claude/hooks/validate-el.sh +++ b/.claude/hooks/validate-el.sh @@ -35,6 +35,13 @@ f="$(jq -r '.tool_input.file_path // .tool_response.filePath // empty')" [ -z "$f" ] && exit 0 [ "${f##*.}" = "el" ] || exit 0 +# Only validate in-tree files. Files outside PROJECT_ROOT are owned by +# their own project's hooks (when a Claude session runs there). +case "$f" in + "$PROJECT_ROOT"/*) ;; # in-tree, continue + *) exit 0 ;; # out-of-tree, skip +esac + MAX_AUTO_TEST_FILES=20 # skip if more matches than this (large test suites) # --- Phase 1: syntax + byte-compile --- -- cgit v1.2.3