agent/hooks/hooks.json

58 lines
No EOL
2 KiB
JSON

{
"hooks": {
"PreToolUse": [
{
"matcher": "run_shell_command",
"hooks": [
{
"type": "command",
"command": "${extensionPath}/claude/code/hooks/prefer-core.sh"
}
],
"description": "Block destructive commands (rm -rf, sed -i, xargs rm) and enforce core CLI"
},
{
"matcher": "write_to_file",
"hooks": [
{
"type": "command",
"command": "${extensionPath}/claude/code/scripts/block-docs.sh"
}
],
"description": "Block random .md file creation"
}
],
"PostToolUse": [
{
"matcher": "replace_file_content && tool_input.TargetFile matches \"\\.go$\"",
"hooks": [
{
"type": "command",
"command": "${extensionPath}/claude/code/scripts/go-format.sh"
}
],
"description": "Auto-format Go files after edits"
},
{
"matcher": "replace_file_content && tool_input.TargetFile matches \"\\.php$\"",
"hooks": [
{
"type": "command",
"command": "${extensionPath}/claude/code/scripts/php-format.sh"
}
],
"description": "Auto-format PHP files after edits"
},
{
"matcher": "replace_file_content",
"hooks": [
{
"type": "command",
"command": "${extensionPath}/claude/code/scripts/check-debug.sh"
}
],
"description": "Warn about debug statements (dd, dump, fmt.Println)"
}
]
}
}