Defined in hooks/hooks.json
{
"PreToolUse": [
{
"hooks": [
{
"type": "command",
"command": "bash -lc '\nset -euo pipefail\ninput=$(cat)\nfile_path=$(echo \"$input\" | jq -r \".tool_input.file_path // empty\")\nif [[ -n \"$file_path\" && \"$file_path\" =~ \\\\.(ts|tsx)$ ]]; then\n echo \"📝 TypeScript change: $file_path\" 1>&2\nfi\nprintf \"%s\" \"$input\"\n'"
}
],
"matcher": "Edit|Write"
}
],
"PostToolUse": [
{
"hooks": [
{
"type": "command",
"command": "bash -lc '\nset -euo pipefail\ninput=$(cat)\nfile_path=$(echo \"$input\" | jq -r \".tool_input.file_path // empty\")\nif [[ -n \"$file_path\" && -f \"$file_path\" && \"$file_path\" =~ \\\\.(ts|tsx)$ ]]; then\n echo \"\\n🔍 Running incremental type-check on $file_path...\" 1>&2\n current=$(dirname \"$file_path\")\n tsconfig=\"\"\n while [[ \"$current\" != \"/\" ]]; do\n if [[ -f \"$current/tsconfig.json\" ]]; then\n tsconfig=\"$current/tsconfig.json\"; break\n fi\n current=$(dirname \"$current\")\n done\n if [[ -n \"$tsconfig\" ]]; then\n set -o pipefail\n if npx tsc --noEmit -p \"$tsconfig\" 2>&1 | head -20; then\n echo \"✅ Type-check passed\" 1>&2\n else\n echo \"⚠️ Type errors detected (showing first 20 lines)\" 1>&2\n fi\n else\n echo \"ℹ️ No tsconfig.json found upwards from $(dirname \"$file_path\"). Skipping type-check.\" 1>&2\n fi\nfi\nprintf \"%s\" \"$input\"\n'"
}
],
"matcher": "Edit|Write"
}
],
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "bash -lc '\nset -euo pipefail\ninput=$(cat)\nprompt=$(echo \"$input\" | jq -r \".prompt // empty\")\nif echo \"$prompt\" | grep -qE \"\\\\.(test|spec)\\\\.(ts|tsx|js|jsx)\"; then\n echo \"\\n🧪 Test file mentioned. Tip: execute sua suíte (ex.: pnpm test).\" 1>&2\nfi\nif echo \"$prompt\" | grep -qiE \"(error|TS[0-9]{4}|type.*not.*assignable)\"; then\n echo \"\\n💡 TypeScript error spotted. Use sua skill de explicação de erros.\" 1>&2\nfi\nprintf \"%s\" \"$input\"\n'"
}
],
"matcher": ".*"
}
]
}{
"riskFlags": {
"touchesBash": false,
"matchAllTools": false,
"touchesFileWrites": true
},
"typeStats": {
"command": 3
},
"eventStats": {
"PreToolUse": 1,
"PostToolUse": 1,
"UserPromptSubmit": 1
},
"originCounts": {
"absolutePaths": 0,
"pluginScripts": 0,
"projectScripts": 0
},
"timeoutStats": {
"commandsWithoutTimeout": 3
}
}