fix: move session-end hooks from Stop to SessionEnd

Stop hook fires after every response, SessionEnd fires only when
session actually terminates. This was causing session-end.sh and
evaluate-session.sh to run on every response instead of at session end.

Fixes issue reported by user about hooks triggering every response.
This commit is contained in:
Affaan Mustafa
2026-01-22 21:06:23 -08:00
parent 19345df79d
commit c3f1594acd

View File

@@ -128,8 +128,10 @@
"command": "#!/bin/bash\n# Final check for console.logs in modified files\ninput=$(cat)\n\nif git rev-parse --git-dir > /dev/null 2>&1; then\n modified_files=$(git diff --name-only HEAD 2>/dev/null | grep -E '\\.(ts|tsx|js|jsx)$' || true)\n \n if [ -n \"$modified_files\" ]; then\n has_console=false\n while IFS= read -r file; do\n if [ -f \"$file\" ]; then\n if grep -q \"console\\.log\" \"$file\" 2>/dev/null; then\n echo \"[Hook] WARNING: console.log found in $file\" >&2\n has_console=true\n fi\n fi\n done <<< \"$modified_files\"\n \n if [ \"$has_console\" = true ]; then\n echo \"[Hook] Remove console.log statements before committing\" >&2\n fi\n fi\nfi\n\necho \"$input\""
}
],
"description": "Final audit for console.log in modified files before session ends"
},
"description": "Check for console.log in modified files after each response"
}
],
"SessionEnd": [
{
"matcher": "*",
"hooks": [