Safety Net — Destructive Command Guard
HooksCatches destructive git and filesystem commands before they execute. Prevents force pushes, hard resets, and rm -rf.
1803/26/2026
Version 1
PublishedInitial version
Created 3/26/2026
Initial version — no previous version to compare
Hook Script
{
"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"
}
]
}
]
}