| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- {
- "_comment": "通用示例配置(占位符模板 hooks.json)。command 用 {{PYTHON_BIN}} 与 {{HOOKS_DIR}} 占位符,由运行时环境变量替换(方式 A),或经 hooks/install_hooks.py 预处理生成 hooks.installed.json(方式 B)。本模板不写死任何机器路径,换机/换项目只改环境变量或重跑安装器即可。matcher 已并集 write_to_file|replace_in_file|Write|Edit,跨工具(CodeBuddy CN / Trae / Cursor 等)通用。",
- "hooks": {
- "PreToolUse": [
- {
- "matcher": "write_to_file|replace_in_file|Write|Edit",
- "hooks": [
- {
- "type": "command",
- "command": "{{PYTHON_BIN}} \"{{HOOKS_DIR}}/backup_on_write.py\"",
- "timeout": 10
- }
- ]
- },
- {
- "matcher": "write_to_file|replace_in_file|Write|Edit",
- "hooks": [
- {
- "type": "command",
- "command": "{{PYTHON_BIN}} \"{{HOOKS_DIR}}/guard_dirs.py\"",
- "timeout": 10
- }
- ]
- },
- {
- "matcher": "write_to_file|replace_in_file|Write|Edit",
- "hooks": [
- {
- "type": "command",
- "command": "{{PYTHON_BIN}} \"{{HOOKS_DIR}}/plan_guard.py\"",
- "timeout": 10
- }
- ]
- }
- ],
- "PostToolUse": [
- {
- "matcher": "write_to_file|replace_in_file|Write|Edit",
- "hooks": [
- {
- "type": "command",
- "command": "{{PYTHON_BIN}} \"{{HOOKS_DIR}}/lint_on_write.py\"",
- "timeout": 30
- }
- ]
- },
- {
- "matcher": "write_to_file|replace_in_file|Write|Edit",
- "hooks": [
- {
- "type": "command",
- "command": "{{PYTHON_BIN}} \"{{HOOKS_DIR}}/php8_compat.py\"",
- "timeout": 20
- }
- ]
- },
- {
- "matcher": "write_to_file|replace_in_file|Write|Edit",
- "hooks": [
- {
- "type": "command",
- "command": "{{PYTHON_BIN}} \"{{HOOKS_DIR}}/security_scan.py\"",
- "timeout": 20
- }
- ]
- },
- {
- "matcher": "write_to_file|replace_in_file|Write|Edit",
- "hooks": [
- {
- "type": "command",
- "command": "{{PYTHON_BIN}} \"{{HOOKS_DIR}}/secret_scan.py\"",
- "timeout": 20
- }
- ]
- },
- {
- "matcher": "write_to_file|replace_in_file|Write|Edit",
- "hooks": [
- {
- "type": "command",
- "command": "{{PYTHON_BIN}} \"{{HOOKS_DIR}}/utf8_check.py\"",
- "timeout": 10
- }
- ]
- },
- {
- "matcher": "write_to_file|replace_in_file|Write|Edit",
- "hooks": [
- {
- "type": "command",
- "command": "{{PYTHON_BIN}} \"{{HOOKS_DIR}}/debug_residue.py\"",
- "timeout": 10
- }
- ]
- },
- {
- "matcher": "write_to_file|replace_in_file|Write|Edit",
- "hooks": [
- {
- "type": "command",
- "command": "{{PYTHON_BIN}} \"{{HOOKS_DIR}}/select_star.py\"",
- "timeout": 10
- }
- ]
- },
- {
- "matcher": "write_to_file|replace_in_file|Write|Edit",
- "hooks": [
- {
- "type": "command",
- "command": "{{PYTHON_BIN}} \"{{HOOKS_DIR}}/dep_scan.py\"",
- "timeout": 10
- }
- ]
- },
- {
- "matcher": "write_to_file|replace_in_file|Write|Edit",
- "hooks": [
- {
- "type": "command",
- "command": "{{PYTHON_BIN}} \"{{HOOKS_DIR}}/sql_injection_check.py\"",
- "timeout": 15
- }
- ]
- },
- {
- "matcher": "write_to_file|replace_in_file|Write|Edit",
- "hooks": [
- {
- "type": "command",
- "command": "{{PYTHON_BIN}} \"{{HOOKS_DIR}}/cms_risk_check.py\"",
- "timeout": 15
- }
- ]
- },
- {
- "matcher": "write_to_file|replace_in_file|Write|Edit|Bash|execute_command|run_command|run_in_terminal|terminal",
- "hooks": [
- {
- "type": "command",
- "command": "{{PYTHON_BIN}} \"{{HOOKS_DIR}}/capture_learning.py\"",
- "timeout": 15
- }
- ]
- }
- ],
- "PreCompact": [
- {
- "matcher": "*",
- "hooks": [
- {
- "type": "command",
- "command": "{{PYTHON_BIN}} \"{{HOOKS_DIR}}/handoff_snapshot.py\"",
- "timeout": 20
- }
- ]
- }
- ]
- }
- }
|