Skip to content

Instantly share code, notes, and snippets.

@stevekinney
Created July 30, 2025 12:20
Show Gist options
  • Save stevekinney/a26a8f339c7b9fdf0b215e9bebb03355 to your computer and use it in GitHub Desktop.
Save stevekinney/a26a8f339c7b9fdf0b215e9bebb03355 to your computer and use it in GitHub Desktop.
{
"hooks": {
"PreToolUse": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "CLAUDE_HOOK_TYPE=PreToolUse bun run ./scripts/claude-hooks.ts"
}
]
}
],
"PostToolUse": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "CLAUDE_HOOK_TYPE=PostToolUse bun run ./scripts/claude-hooks.ts"
}
]
},
{
"matcher": "Edit|MultiEdit|Write",
"hooks": [
{
"type": "command",
"command": "bash -c 'f=\"$(.tool_input.file_path)\"; if [[ \"$f\" == *.ts ]]; then if ! bunx prettier --write \"$f\"; then echo \"Prettier failed on $f\"; exit 2; fi; fi'"
}
]
},
{
"matcher": "Edit|MultiEdit|Write",
"hooks": [
{
"type": "command",
"command": "bash -c 'f=\"$(.tool_input.file_path)\"; if [[ \"$f\" == *.ts ]]; then if ! bunx eslint --max-warnings=0 \"$f\"; then echo \"ESLint failed on $f\"; exit 2; fi; fi'"
}
]
},
{
"matcher": "Edit|MultiEdit|Write",
"hooks": [
{
"type": "command",
"command": "bash -c 'f=\"$(.tool_input.file_path)\"; if [[ \"$f\" == *.ts ]]; then tmp=$(mktemp); bunx tsc 2>&1 | tee \"$tmp\" >/dev/null; if grep -F -- \"$f\" \"$tmp\" >/dev/null; then echo \"TypeScript compiler reported issues in $f\"; exit 2; fi; fi'"
}
]
},
{
"matcher": "Edit|MultiEdit|Write",
"hooks": [
{
"type": "command",
"command": "bash -c 'f=\"$(.tool_input.file_path)\"; if [[ \"$f\" == *.tool.ts ]]; then if ! bun run generate:tools; then echo \"generate:tools failed\"; exit 2; fi; fi'"
}
]
}
],
"UserPromptSubmit": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "CLAUDE_HOOK_TYPE=UserPromptSubmit bun run ./scripts/claude-hooks.ts"
}
]
}
],
"Notification": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "CLAUDE_HOOK_TYPE=Notification bun run ./scripts/claude-hooks.ts"
}
]
}
],
"SubagentStop": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "CLAUDE_HOOK_TYPE=SubagentStop bun run ./scripts/claude-hooks.ts"
}
]
}
],
"PreCompact": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "CLAUDE_HOOK_TYPE=Precompact bun run ./scripts/claude-hooks.ts"
}
]
}
],
"Stop": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "CLAUDE_HOOK_TYPE=Stop bun run ./scripts/claude-hooks.ts"
}
]
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment