1 line
3.4 KiB
JSON
1 line
3.4 KiB
JSON
{"patterns":{"logging":{"desc":"Log tool usage","struct":{"hooks":{"PreToolUse":[{"matcher":"*","hooks":[{"type":"command","command":"echo \"[$(date)] $CLAUDE_TOOL_NAME\" >> ~/.claude/activity.log"}]}]}}},"backup":{"desc":"Backup before edit","struct":{"hooks":{"PreToolUse":[{"matcher":"Edit|MultiEdit","hooks":[{"type":"command","command":"[[ -f \"$CLAUDE_TOOL_FILE_PATH\" ]] && cp \"$CLAUDE_TOOL_FILE_PATH\" \"$CLAUDE_TOOL_FILE_PATH.$(date +%s).bak\" 2>/dev/null || true"}]}]}}},"format":{"desc":"Auto-format files","struct":{"hooks":{"PostToolUse":[{"matcher":"Edit","hooks":[{"type":"command","command":"if [[ \"$CLAUDE_TOOL_FILE_PATH\" =~ \\.(js|ts)$ ]]; then npx prettier --write \"$CLAUDE_TOOL_FILE_PATH\" 2>/dev/null || true; elif [[ \"$CLAUDE_TOOL_FILE_PATH\" == *.py ]]; then black \"$CLAUDE_TOOL_FILE_PATH\" 2>/dev/null || true; fi"}]}]}}},"git":{"desc":"Git operations","struct":{"hooks":{"PostToolUse":[{"matcher":"Edit|Write","hooks":[{"type":"command","command":"git rev-parse --git-dir >/dev/null 2>&1 && git add \"$CLAUDE_TOOL_FILE_PATH\" 2>/dev/null || true"}]}]}}},"notify":{"desc":"Desktop notifications","struct":{"hooks":{"PostToolUse":[{"matcher":"*","hooks":[{"type":"command","command":"if command -v osascript >/dev/null; then osascript -e 'display notification \"$CLAUDE_TOOL_NAME completed\" with title \"Claude Code\"'; elif command -v notify-send >/dev/null; then notify-send \"Claude Code\" \"$CLAUDE_TOOL_NAME completed\"; fi"}]}]}}},"test":{"desc":"Run tests","struct":{"hooks":{"PostToolUse":[{"matcher":"Edit","hooks":[{"type":"command","command":"if [[ -f package.json ]]; then npm test 2>/dev/null || yarn test 2>/dev/null || true; elif [[ -f pytest.ini ]]; then pytest 2>/dev/null || true; fi"}]}]}}},"build":{"desc":"Auto build","struct":{"hooks":{"PostToolUse":[{"matcher":"Edit","hooks":[{"type":"command","command":"if [[ -f package.json ]] && grep -q '\"build\"' package.json; then npm run build 2>/dev/null || true; elif [[ -f Makefile ]]; then make 2>/dev/null || true; fi"}]}]}}},"security":{"desc":"Security scan","struct":{"hooks":{"PostToolUse":[{"matcher":"Edit|Write","hooks":[{"type":"command","command":"if command -v gitleaks >/dev/null; then gitleaks detect --source=\"$CLAUDE_TOOL_FILE_PATH\" --no-git 2>/dev/null || true; fi; grep -qE '(password|secret|key)\\s*=' \"$CLAUDE_TOOL_FILE_PATH\" && echo \"⚠️ Potential secrets in $CLAUDE_TOOL_FILE_PATH\" || true"}]}]}}},"protect":{"desc":"File protection","struct":{"hooks":{"PreToolUse":[{"matcher":"Edit|Write","hooks":[{"type":"command","command":"for p in '/etc/*' '/usr/bin/*' '*.production.*' '*prod*config*' '/node_modules/*'; do [[ \"$CLAUDE_TOOL_FILE_PATH\" == $p ]] && echo \"Error: Protected file\" >&2 && exit 1; done"}]}]}}}},"commands":{"check_file":"[[ -f \"$CLAUDE_TOOL_FILE_PATH\" ]]","check_git":"git rev-parse --git-dir >/dev/null 2>&1","suppress_errors":"2>/dev/null || true","timestamp":"$(date +%Y%m%d_%H%M%S)","check_package":"[[ -f package.json ]]","file_ext_js":"[[ \"$CLAUDE_TOOL_FILE_PATH\" =~ \\.(js|ts|jsx|tsx)$ ]]","file_ext_py":"[[ \"$CLAUDE_TOOL_FILE_PATH\" == *.py ]]","macos_notify":"osascript -e 'display notification \"$CLAUDE_TOOL_NAME\" with title \"Claude Code\"'","linux_notify":"notify-send \"Claude Code\" \"$CLAUDE_TOOL_NAME\""},"structure":"ALWAYS_USE_ARRAYS_FOR_EVENTS","required_fields":["description","hooks"],"env_vars":{"CLAUDE_TOOL_NAME":"current_tool","CLAUDE_TOOL_FILE_PATH":"file_path","CLAUDE_PROJECT_DIR":"project_root"}} |