From 7fdac120efb56d9617d70188a20ca766585ab5e8 Mon Sep 17 00:00:00 2001 From: Roberto Cano <3525807+robercano@users.noreply.github.com> Date: Fri, 3 Jul 2026 17:38:14 +0200 Subject: [PATCH] fix(hooks): resolve gate.sh via $CLAUDE_PROJECT_DIR so hooks work from any cwd The PostToolUse (lint) and Stop (test_affected) hooks invoked gate.sh by a relative path (bash .claude/scripts/gate.sh ...). Hooks run with whatever cwd is current, so from a worktree/subdir/reset shell the path doesn't resolve and the hook dies with 'bash: .claude/scripts/gate.sh: No such file or directory'. Resolve it via $CLAUDE_PROJECT_DIR (always the project root) instead. gate.sh already computes its own repo root, so it runs correctly once found. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_0193Wc7aqPQvNqVZjcndBaf6 --- .claude/settings.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.claude/settings.json b/.claude/settings.json index 1333c92..94c3380 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -8,7 +8,7 @@ "hooks": [ { "type": "command", - "command": "bash .claude/scripts/gate.sh lint" + "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/scripts/gate.sh\" lint" } ] } @@ -18,7 +18,7 @@ "hooks": [ { "type": "command", - "command": "bash .claude/scripts/gate.sh test_affected" + "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/scripts/gate.sh\" test_affected" } ] }