Safety Net — Destructive Command Guard
HooksCatches destructive git and filesystem commands before they execute. Prevents force pushes, hard resets, and rm -rf.
1703/26/2026
json1 file
hooks.json438 B
{
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "CMD=$(jq -r '.tool_input.command // empty'); if echo "$CMD" | grep -qE '(git push --force|git push -f|git reset --hard|rm -rf /|rm -rf ~|DROP TABLE|DROP DATABASE|truncate )'; then echo 'BLOCKED: Destructive command detected. Please confirm before executing.'; exit 1; fi; exit 0"
}
]
}
]
}