Event Hooks

cc-best

11 events · 21 hooks

From cc-best
Install
1
Run in your terminal
$
npx claudepluginhub xiaobei930/cc-best --plugin cc-best
Risk Indicators
Executes bash commandsModifies files
Source

Defined in hooks/hooks.json

Configuration
{
  "Stop": [
    {
      "hooks": [
        {
          "type": "command",
          "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/stop-check.js\"",
          "timeout": 5
        }
      ],
      "matcher": ".*",
      "description": "遗漏检查: 响应完成时检查 progress.md 中未完成任务"
    }
  ],
  "PreCompact": [
    {
      "hooks": [
        {
          "type": "command",
          "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/pre-compact.js\"",
          "timeout": 10,
          "statusMessage": "保存压缩前状态..."
        }
      ],
      "matcher": ".*",
      "description": "压缩前保存: 压缩前保存 git 状态、任务列表等到 .pre-compact-state.json"
    }
  ],
  "PreToolUse": [
    {
      "hooks": [
        {
          "type": "command",
          "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/validate-command.js\"",
          "timeout": 5
        }
      ],
      "matcher": "Bash",
      "description": "命令验证: 阻止危险命令 (rm -rf /, git push --force 等)"
    },
    {
      "hooks": [
        {
          "type": "command",
          "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/pause-before-push.js\"",
          "timeout": 5
        }
      ],
      "matcher": "Bash",
      "description": "推送确认: git push 前暂停确认"
    },
    {
      "hooks": [
        {
          "type": "command",
          "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/check-secrets.js\"",
          "timeout": 10,
          "statusMessage": "检查密钥泄露..."
        }
      ],
      "matcher": "Bash",
      "description": "密钥检测: 检查命令中是否包含 API 密钥等敏感信息"
    },
    {
      "hooks": [
        {
          "type": "command",
          "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/protect-files.js\"",
          "timeout": 3
        }
      ],
      "matcher": "Write|Edit",
      "description": "文件保护: 阻止修改敏感文件 (.env, .key, .git/ 等)"
    },
    {
      "hooks": [
        {
          "type": "command",
          "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/block-random-md.js\"",
          "timeout": 3
        }
      ],
      "matcher": "Write",
      "description": "Markdown 文件保护: 阻止在根目录创建随机 .md 文件"
    },
    {
      "hooks": [
        {
          "type": "command",
          "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/long-running-warning.js\"",
          "timeout": 5
        }
      ],
      "matcher": "Bash",
      "description": "长时间命令警告: 检测开发服务器、watch 等长时间运行命令"
    }
  ],
  "SessionEnd": [
    {
      "hooks": [
        {
          "type": "command",
          "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/evaluate-session.js\"",
          "timeout": 30
        }
      ],
      "matcher": ".*",
      "description": "会话评估: 会话结束时评估并提取可学习的模式"
    }
  ],
  "PostToolUse": [
    {
      "hooks": [
        {
          "type": "command",
          "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/format-file.js\"",
          "timeout": 60,
          "statusMessage": "格式化代码..."
        }
      ],
      "matcher": "Write|Edit",
      "description": "自动格式化: 文件写入后自动格式化代码"
    },
    {
      "hooks": [
        {
          "type": "command",
          "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/auto-archive.js\"",
          "timeout": 5
        }
      ],
      "matcher": "Write|Edit",
      "description": "自动归档: progress.md 超过 300 行时提醒归档"
    },
    {
      "hooks": [
        {
          "type": "command",
          "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/observe-patterns.js\"",
          "timeout": 3
        }
      ],
      "matcher": "Write|Edit|Bash",
      "description": "模式观察: 追踪工具调用模式,写入 memory-bank/observations.jsonl 供 /learn 消费"
    },
    {
      "hooks": [
        {
          "type": "command",
          "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/suggest-compact.js\"",
          "timeout": 3
        }
      ],
      "matcher": ".*",
      "description": "压缩提醒: 工具调用达到阈值时提醒压缩上下文 (官方 auto-compact bug 的 workaround)"
    },
    {
      "hooks": [
        {
          "type": "command",
          "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/check-console-log.js\"",
          "timeout": 3
        }
      ],
      "matcher": "Write|Edit",
      "description": "调试日志检查: 检查 JS/TS 文件中的 console.log 语句"
    },
    {
      "hooks": [
        {
          "type": "command",
          "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/typescript-check.js\"",
          "timeout": 30,
          "statusMessage": "TypeScript 类型检查..."
        }
      ],
      "matcher": "Write|Edit",
      "description": "TypeScript 类型检查: .ts 文件编辑后运行 tsc --noEmit"
    }
  ],
  "Notification": [
    {
      "hooks": [
        {
          "type": "command",
          "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/notification-handler.js\"",
          "timeout": 3
        }
      ],
      "matcher": ".*",
      "description": "通知处理: 记录和处理 Claude Code 通知事件"
    }
  ],
  "SessionStart": [
    {
      "hooks": [
        {
          "type": "command",
          "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/session-check.js\"",
          "timeout": 5
        }
      ],
      "matcher": ".*",
      "description": "会话检查: 启动时检查文件更新状态和项目配置"
    }
  ],
  "SubagentStop": [
    {
      "hooks": [
        {
          "type": "command",
          "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/subagent-stop.js\"",
          "timeout": 3
        }
      ],
      "matcher": ".*",
      "description": "子代理追踪: 子代理完成时记录任务状态"
    }
  ],
  "SubagentStart": [
    {
      "hooks": [
        {
          "type": "command",
          "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/subagent-start.js\"",
          "timeout": 3
        }
      ],
      "matcher": ".*",
      "description": "子代理启动: 记录子代理启动信息,与 SubagentStop 配对追踪生命周期"
    }
  ],
  "UserPromptSubmit": [
    {
      "hooks": [
        {
          "type": "command",
          "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/user-prompt-submit.js\"",
          "timeout": 3
        }
      ],
      "matcher": ".*",
      "description": "上下文注入: 用户提交提示时注入项目状态信息"
    }
  ],
  "PostToolUseFailure": [
    {
      "hooks": [
        {
          "type": "command",
          "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/post-tool-failure.js\"",
          "timeout": 3
        }
      ],
      "matcher": ".*",
      "description": "失败追踪: 工具调用失败后记录错误模式,检测重复失败(红旗增强)"
    }
  ]
}
Summary
{
  "riskFlags": {
    "touchesBash": true,
    "matchAllTools": false,
    "touchesFileWrites": true
  },
  "typeStats": {
    "command": 21
  },
  "eventStats": {
    "Stop": 1,
    "PreCompact": 1,
    "PreToolUse": 6,
    "SessionEnd": 1,
    "PostToolUse": 6,
    "Notification": 1,
    "SessionStart": 1,
    "SubagentStop": 1,
    "SubagentStart": 1,
    "UserPromptSubmit": 1,
    "PostToolUseFailure": 1
  },
  "originCounts": {
    "absolutePaths": 0,
    "pluginScripts": 21,
    "projectScripts": 0
  },
  "timeoutStats": {
    "commandsWithoutTimeout": 0
  }
}
Stats
Stars34
Forks2
Last CommitMar 16, 2026