Auto Test Runner Hook
HooksRuns relevant tests automatically after the agent edits source files.
2103/26/2026
Version 1
PublishedInitial version
Created 3/26/2026
Initial version — no previous version to compare
Hook Script
{
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "FILE=$(jq -r '.tool_input.file_path // empty'); if echo "$FILE" | grep -qE '\.(ts|tsx|js|jsx)$' && ! echo "$FILE" | grep -qE '\.(test|spec)\.' ; then echo 'Running affected tests...'; npx vitest related "$FILE" --run 2>&1 | tail -5; fi"
}
]
}
]
}