feat: add hooks and rules

This commit is contained in:
duthaho
2026-04-19 12:11:56 +07:00
parent 5d87f8c1f3
commit 3103a8da1b
9 changed files with 233 additions and 8 deletions
+35 -8
View File
@@ -1,4 +1,5 @@
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"permissions": {
"allow": [
"Bash(git:*)",
@@ -16,21 +17,47 @@
"Bash(prettier:*)",
"Bash(tsc:*)",
"Bash(docker:*)",
"Bash(gh:*)",
"Read(*)",
"Write(*)",
"Edit(*)"
"Bash(gh:*)"
],
"deny": []
"deny": [
"Read(.env*)",
"Write(.env*)",
"Edit(.env*)",
"Read(**/secrets/**)",
"Write(**/secrets/**)",
"Edit(**/secrets/**)"
]
},
"hooks": {
"PostToolUse": [
"PreToolUse": [
{
"matcher": "Write",
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "if [[ \"$FILE\" == *.py ]]; then ruff check --fix \"$FILE\" 2>/dev/null || true; elif [[ \"$FILE\" == *.ts || \"$FILE\" == *.tsx ]]; then npx eslint --fix \"$FILE\" 2>/dev/null || true; fi"
"command": "node .claude/hooks/block-dangerous-commands.cjs"
}
]
}
],
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "node .claude/hooks/auto-format.cjs"
}
]
}
],
"Notification": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "node .claude/hooks/notify.cjs"
}
]
}