You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"_comment": "Copy this file to config.local.json to disable individual hooks locally. config.local.json is gitignored. Each key is a hook script filename; set it to false to bail that hook. Any hook not listed (or with no config file at all) is enabled.",
3
-
"php-review-track.sh": true,
4
-
"php-review-stop.sh": true
2
+
"_comment": "Copy this file to config.local.json to disable individual hooks locally.",
3
+
4
+
"_info-php-review": "Disable the hooks that trigger a code review after editing PHP files.",
Copy file name to clipboardExpand all lines: .claude/hooks/php-review-stop.sh
+10-5Lines changed: 10 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -12,13 +12,16 @@
12
12
# unchanged file is never nudged twice and the loop terminates cleanly once edits
13
13
# stop changing content. Silent (exit 0) when there is nothing new to review.
14
14
15
-
# Local opt-out: hooks/config.local.json maps each hook filename to a boolean.
16
-
# A script set to false here bails immediately. No config file (the default) or a
15
+
# Everything below parses JSON with jq. Without it, bail silently.
16
+
command -v jq >/dev/null 2>&1||exit 0
17
+
18
+
# Local opt-out: hooks/config.local.json maps each "feature" to a boolean.
19
+
# A disabled feature bails immediately. No config file (the default) or a
17
20
# missing key means enabled.
21
+
feature="php-review"
18
22
config="$(dirname "$0")/config.local.json"
19
23
if [ -f"$config" ];then
20
-
self="$(basename "$0")"
21
-
enabled=$(jq -r --arg k "$self"'if has($k) then .[$k] else true end'"$config"2>/dev/null)
24
+
enabled=$(jq -r --arg k "$feature"'if has($k) then .[$k] else true end'"$config"2>/dev/null)
22
25
[ "$enabled"="false" ] &&exit 0
23
26
fi
24
27
@@ -41,6 +44,8 @@ content_hash() {
41
44
list=""
42
45
formarkerin"$dir"/touched-*;do
43
46
[ -e"$marker" ] ||continue
47
+
# The glob also matches the ".reviewed" sidecars we write below; skip them.
48
+
case"$marker"in*.reviewed) continue ;; esac
44
49
file=$(cat "$marker"2>/dev/null)
45
50
[ -n"$file" ] && [ -f"$file" ] ||continue
46
51
@@ -55,6 +60,6 @@ done
55
60
56
61
[ -n"$list" ] ||exit 0
57
62
58
-
reason="Before finishing this turn, review your PHP changes. Dispatch the \`php-review\` agent once for each file below (in parallel is fine), then apply any fixes it reports. Files needing review:${list}"
63
+
reason="Before finishing this turn, review your PHP changes. Dispatch the \`php-review\` agent once for each file below (in parallel is fine), each with the prompt \`review CHANGES in <file>\`, then apply any fixes it reports. Files needing review:${list}"
59
64
60
65
jq -n --arg r "$reason"'{decision: "block", reason: $r}'
0 commit comments