Loading...
Loading...
Configure des hooks Claude Code pour bloquer les commandes git dangereuses (push, force-push, reset --hard, clean, branch -D, checkout/restore) avant leur exécution. Empêche les opérations git destructrices au niveau de l'agent.
npx skill4agent add dedalus-erp-pas/hexagone-foundation-skills git-guardrailsgit pushgit reset --hard| Pattern | Description |
|---|---|
| All push variants (prevents unreviewed pushes) |
| Force push (rewrites remote history) |
| Force push variant |
| Discards all uncommitted changes |
| Deletes untracked files permanently |
| Force-deletes a branch without merge check |
| Discards all working tree changes |
| Discards all working tree changes |
| Prevents rebase of protected branches |
.claude/settings.json~/.claude/settings.json.claude/hooks/block-dangerous-git.sh~/.claude/hooks/block-dangerous-git.shchmod +x <path-to-script>.claude/settings.json{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/block-dangerous-git.sh"
}
]
}
]
}
}~/.claude/settings.json{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "~/.claude/hooks/block-dangerous-git.sh"
}
]
}
]
}
}hooks.PreToolUsegit stash dropgit tag -dgit push--forceecho '{"tool_input":{"command":"git push origin main"}}' | <path-to-script>BLOCKEDecho '{"tool_input":{"command":"git status"}}' | <path-to-script>commandjqgit pushgit push origin main --forcejqjq