In remote execution environments where node_modules is not installed, npm run typecheck fails with "react-router: not found" rather than a real TypeScript error. This caused the Stop hook to loop the session indefinitely. The guard exits cleanly when react-router is absent. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KiVGo8gSBXe3WuRniVNKsd
28 lines
No EOL
742 B
JSON
28 lines
No EOL
742 B
JSON
{
|
|
"hooks": {
|
|
"PostToolUse": [
|
|
{
|
|
"matcher": "Write|Edit|MultiEdit",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": ".claude/hooks/lint-on-edit.sh",
|
|
"timeout": 30,
|
|
"statusMessage": "Linting..."
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"Stop": [
|
|
{
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "which react-router > /dev/null 2>&1 || exit 0; output=$(npm run typecheck 2>&1); rc=$?; if [ $rc -ne 0 ]; then printf '{\"systemMessage\":\"TypeCheck failed:\\n%s\"}' \"$(echo \"$output\" | tail -30 | sed 's/\"/\\\\\"/g; s/$/\\\\n/' | tr -d '\\n')\"; fi",
|
|
"timeout": 60
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
} |