Defined in hooks/hooks.json
{
"PreToolUse": [
{
"hooks": [
{
"type": "command",
"command": "if [ -f 'sites/common_site_config.json' ]; then echo '✓ Frappe bench detected'; else echo '⚠ Not in Frappe bench directory'; fi"
}
],
"matcher": "Bash|Write|Edit"
},
{
"hooks": [
{
"type": "command",
"command": "jq -r '.tool_input.file_path' | { read file_path; if [[ \"$file_path\" == *test_*.py ]]; then if [[ \"$file_path\" != */doctype/* ]] && [[ \"$file_path\" != */tests/* ]]; then echo '⚠ Test files should be in doctype/ or tests/ directory'; fi; fi; }"
}
],
"matcher": "Write"
}
],
"PostToolUse": [
{
"hooks": [
{
"type": "command",
"command": "jq -r '.tool_input.file_path' | { read file_path; if [[ \"$file_path\" == *.json ]] && [[ \"$file_path\" == */doctype/* ]]; then echo '💡 Reminder: Run migrations with /frappe-migrate'; fi; }"
}
],
"matcher": "Write|Edit"
},
{
"hooks": [
{
"type": "command",
"command": "jq -r '.tool_input.file_path' | { read file_path; if [[ \"$file_path\" == *.py ]] && [[ \"$file_path\" == */doctype/*.py ]] && [[ \"$file_path\" != *test_*.py ]]; then echo '✓ Code updated. Consider running tests with /frappe-test'; fi; }"
}
],
"matcher": "Write|Edit"
},
{
"hooks": [
{
"type": "command",
"command": "jq -r '.tool_input.file_path' | { read file_path; if [[ \"$file_path\" == *.js ]] && [[ \"$file_path\" == */doctype/*.js ]]; then echo '💡 Reminder: Clear cache with /frappe-cache for JS changes to take effect'; fi; }"
}
],
"matcher": "Write|Edit"
}
],
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "echo '🔍 Checking Frappe bench setup...'; if [ -f 'sites/common_site_config.json' ]; then echo '✓ Valid bench directory'; bench --version 2>/dev/null || echo '⚠ Bench command not found'; else echo '❌ Not a Frappe bench directory'; fi"
}
],
"matcher": "",
"keywords": [
"frappe",
"bench",
"doctype",
"migrate"
]
},
{
"hooks": [
{
"type": "command",
"command": "if [ -f 'sites/common_site_config.json' ]; then site_count=$(ls -d sites/*/ 2>/dev/null | wc -l); if [ $site_count -gt 0 ]; then echo \"✓ Found $site_count site(s)\"; else echo '⚠ No sites found. Create one with /frappe-new-site'; fi; fi"
}
],
"matcher": "",
"keywords": [
"site",
"test",
"migrate",
"backup",
"console"
]
},
{
"hooks": [
{
"type": "command",
"command": "if command -v redis-cli >/dev/null 2>&1; then if redis-cli ping >/dev/null 2>&1; then echo '✓ Redis is running'; else echo '⚠ Redis is not responding. Start with: sudo systemctl start redis-server'; fi; fi"
}
],
"matcher": "",
"keywords": [
"cache",
"redis",
"clear cache"
]
}
]
}{
"riskFlags": {
"touchesBash": true,
"matchAllTools": false,
"touchesFileWrites": true
},
"typeStats": {
"command": 8
},
"eventStats": {
"PreToolUse": 2,
"PostToolUse": 3,
"UserPromptSubmit": 3
},
"originCounts": {
"absolutePaths": 0,
"pluginScripts": 0,
"projectScripts": 0
},
"timeoutStats": {
"commandsWithoutTimeout": 8
}
}