npx claudepluginhub dobeutech/dobeutech-claude-code-customDefined in hooks/hooks.json
{
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "#!/bin/bash\n# Final check for console.logs in modified files\ninput=$(cat)\n\nif git rev-parse --git-dir > /dev/null 2>&1; then\n modified_files=$(git diff --name-only HEAD 2>/dev/null | grep -E '\\.(ts|tsx|js|jsx)$' || true)\n \n if [ -n \"$modified_files\" ]; then\n has_console=false\n while IFS= read -r file; do\n if [ -f \"$file\" ]; then\n if grep -q \"console\\.log\" \"$file\" 2>/dev/null; then\n echo \"[Hook] WARNING: console.log found in $file\" >&2\n has_console=true\n fi\n fi\n done <<< \"$modified_files\"\n \n if [ \"$has_console\" = true ]; then\n echo \"[Hook] Remove console.log statements before committing\" >&2\n fi\n fi\nfi\n\necho \"$input\""
}
],
"matcher": "*",
"description": "Final audit for console.log in modified files before session ends"
}
],
"PreToolUse": [
{
"hooks": [
{
"type": "command",
"command": "#!/bin/bash\ninput=$(cat)\ncmd=$(echo \"$input\" | jq -r '.tool_input.command // \"\"')\n\n# Block dev servers that aren't run in tmux\necho '[Hook] BLOCKED: Dev server must run in tmux for log access' >&2\necho '[Hook] Use this command instead:' >&2\necho \"[Hook] tmux new-session -d -s dev 'npm run dev'\" >&2\necho '[Hook] Then: tmux attach -t dev' >&2\nexit 1"
}
],
"matcher": "tool == \"Bash\" && tool_input.command matches \"(npm run dev|pnpm( run)? dev|yarn dev|bun run dev)\"",
"description": "Block dev servers outside tmux - ensures you can access logs"
},
{
"hooks": [
{
"type": "command",
"command": "#!/bin/bash\ninput=$(cat)\nif [ -z \"$TMUX\" ]; then\n echo '[Hook] Consider running in tmux for session persistence' >&2\n echo '[Hook] tmux new -s dev | tmux attach -t dev' >&2\nfi\necho \"$input\""
}
],
"matcher": "tool == \"Bash\" && tool_input.command matches \"(npm (install|test)|pnpm (install|test)|yarn (install|test)|bun (install|test)|cargo build|make|docker|pytest|vitest|playwright)\"",
"description": "Reminder to use tmux for long-running commands"
},
{
"hooks": [
{
"type": "command",
"command": "#!/bin/bash\n# Open editor for review before pushing\necho '[Hook] Review changes before push...' >&2\n# Uncomment your preferred editor:\n# zed . 2>/dev/null\n# code . 2>/dev/null\n# cursor . 2>/dev/null\necho '[Hook] Press Enter to continue with push or Ctrl+C to abort...' >&2\nread -r"
}
],
"matcher": "tool == \"Bash\" && tool_input.command matches \"git push\"",
"description": "Pause before git push to review changes"
},
{
"hooks": [
{
"type": "command",
"command": "#!/bin/bash\n# Pre-commit security scan\ninput=$(cat)\n\nif git rev-parse --git-dir > /dev/null 2>&1; then\n staged_files=$(git diff --cached --name-only 2>/dev/null || true)\n \n if [ -n \"$staged_files\" ]; then\n echo \"[Hook] Running pre-commit security checks...\" >&2\n \n # Check for secrets\n secrets_found=false\n while IFS= read -r file; do\n if [ -f \"$file\" ]; then\n # Check for common secret patterns\n if grep -qiE '(api[_-]?key|secret|password|token|private[_-]?key)\\s*[:=]\\s*[\"\\']?[a-zA-Z0-9]{20,}' \"$file\" 2>/dev/null; then\n echo \"[Hook] WARNING: Potential secret found in $file\" >&2\n secrets_found=true\n fi\n fi\n done <<< \"$staged_files\"\n \n if [ \"$secrets_found\" = true ]; then\n echo \"[Hook] BLOCKED: Potential secrets detected. Review before committing.\" >&2\n exit 1\n fi\n \n # Check dependency vulnerabilities\n if [ -f \"package.json\" ] || [ -f \"package-lock.json\" ]; then\n echo \"[Hook] Checking for dependency vulnerabilities...\" >&2\n if command -v npm >/dev/null 2>&1; then\n npm audit --audit-level=moderate 2>&1 | head -20 >&2 || true\n fi\n fi\n fi\nfi\n\necho \"$input\""
}
],
"matcher": "tool == \"Bash\" && tool_input.command matches \"git commit\"",
"description": "Pre-commit security scan and dependency vulnerability check"
},
{
"hooks": [
{
"type": "command",
"command": "#!/bin/bash\n# Block creation of unnecessary documentation files\ninput=$(cat)\nfile_path=$(echo \"$input\" | jq -r '.tool_input.file_path // \"\"')\n\nif [[ \"$file_path\" =~ \\.(md|txt)$ ]] && [[ ! \"$file_path\" =~ (README|CLAUDE|AGENTS|CONTRIBUTING)\\.md$ ]]; then\n echo \"[Hook] BLOCKED: Unnecessary documentation file creation\" >&2\n echo \"[Hook] File: $file_path\" >&2\n echo \"[Hook] Use README.md for documentation instead\" >&2\n exit 1\nfi\n\necho \"$input\""
}
],
"matcher": "tool == \"Write\" && tool_input.file_path matches \"\\\\.(md|txt)$\" && !(tool_input.file_path matches \"README\\\\.md|CLAUDE\\\\.md|AGENTS\\\\.md|CONTRIBUTING\\\\.md\")",
"description": "Block creation of random .md files - keeps docs consolidated"
}
],
"PostToolUse": [
{
"hooks": [
{
"type": "command",
"command": "#!/bin/bash\n# Auto-detect PR creation and log useful info\ninput=$(cat)\ncmd=$(echo \"$input\" | jq -r '.tool_input.command')\n\nif echo \"$cmd\" | grep -qE 'gh pr create'; then\n output=$(echo \"$input\" | jq -r '.tool_output.output // \"\"')\n pr_url=$(echo \"$output\" | grep -oE 'https://github.com/[^/]+/[^/]+/pull/[0-9]+')\n \n if [ -n \"$pr_url\" ]; then\n echo \"[Hook] PR created: $pr_url\" >&2\n echo \"[Hook] Checking GitHub Actions status...\" >&2\n repo=$(echo \"$pr_url\" | sed -E 's|https://github.com/([^/]+/[^/]+)/pull/[0-9]+|\\1|')\n pr_num=$(echo \"$pr_url\" | sed -E 's|.*/pull/([0-9]+)|\\1|')\n echo \"[Hook] To review PR: gh pr review $pr_num --repo $repo\" >&2\n fi\nfi\n\necho \"$input\""
}
],
"matcher": "tool == \"Bash\"",
"description": "Log PR URL and provide review command after PR creation"
},
{
"hooks": [
{
"type": "command",
"command": "#!/bin/bash\n# Auto-format with Prettier after editing JS/TS files\ninput=$(cat)\nfile_path=$(echo \"$input\" | jq -r '.tool_input.file_path // \"\"')\n\nif [ -n \"$file_path\" ] && [ -f \"$file_path\" ]; then\n if command -v prettier >/dev/null 2>&1; then\n prettier --write \"$file_path\" 2>&1 | head -5 >&2\n fi\nfi\n\necho \"$input\""
}
],
"matcher": "tool == \"Edit\" && tool_input.file_path matches \"\\\\.(ts|tsx|js|jsx)$\"",
"description": "Auto-format JS/TS files with Prettier after edits"
},
{
"hooks": [
{
"type": "command",
"command": "#!/bin/bash\n# Run TypeScript check after editing TS files\ninput=$(cat)\nfile_path=$(echo \"$input\" | jq -r '.tool_input.file_path // \"\"')\n\nif [ -n \"$file_path\" ] && [ -f \"$file_path\" ]; then\n dir=$(dirname \"$file_path\")\n project_root=\"$dir\"\n while [ \"$project_root\" != \"/\" ] && [ ! -f \"$project_root/package.json\" ]; do\n project_root=$(dirname \"$project_root\")\n done\n \n if [ -f \"$project_root/tsconfig.json\" ]; then\n cd \"$project_root\" && npx tsc --noEmit --pretty false 2>&1 | grep \"$file_path\" | head -10 >&2 || true\n fi\nfi\n\necho \"$input\""
}
],
"matcher": "tool == \"Edit\" && tool_input.file_path matches \"\\\\.(ts|tsx)$\"",
"description": "TypeScript check after editing .ts/.tsx files"
},
{
"hooks": [
{
"type": "command",
"command": "#!/bin/bash\n# Warn about console.log in edited files\ninput=$(cat)\nfile_path=$(echo \"$input\" | jq -r '.tool_input.file_path // \"\"')\n\nif [ -n \"$file_path\" ] && [ -f \"$file_path\" ]; then\n console_logs=$(grep -n \"console\\\\.log\" \"$file_path\" 2>/dev/null || true)\n \n if [ -n \"$console_logs\" ]; then\n echo \"[Hook] WARNING: console.log found in $file_path\" >&2\n echo \"$console_logs\" | head -5 >&2\n echo \"[Hook] Remove console.log before committing\" >&2\n fi\nfi\n\necho \"$input\""
}
],
"matcher": "tool == \"Edit\" && tool_input.file_path matches \"\\\\.(ts|tsx|js|jsx)$\"",
"description": "Warn about console.log statements after edits"
},
{
"hooks": [
{
"type": "command",
"command": "#!/bin/bash\n# Post-commit automation and reminders\ninput=$(cat)\n\nif git rev-parse --git-dir > /dev/null 2>&1; then\n commit_hash=$(git rev-parse HEAD 2>/dev/null || true)\n commit_message=$(git log -1 --pretty=%B 2>/dev/null || true)\n \n if [ -n \"$commit_hash\" ]; then\n echo \"[Hook] Commit $commit_hash created\" >&2\n \n # Auto-generate changelog reminder\n if [ -f \"CHANGELOG.md\" ]; then\n echo \"[Hook] Consider updating CHANGELOG.md\" >&2\n fi\n \n # Check if documentation needs updating\n if echo \"$commit_message\" | grep -qiE '(api|endpoint|route|function|class)'; then\n echo \"[Hook] Consider updating API documentation\" >&2\n fi\n fi\nfi\n\necho \"$input\""
}
],
"matcher": "tool == \"Bash\" && tool_input.command matches \"git commit\"",
"description": "Post-commit automation and documentation reminders"
}
]
}"Enforces safety on PreToolUse for bash (blocks dangerous), edits (protects files), PRs (requires tests), agents; auto-formats/lints/tests post-Write/Edit; checkpoints on Stop. Uses bash."