MCP.so
登录
测试event

Pre-Commit Guard已精选

Hook that runs tests before git commit commands to block commits when the suite is red.

基本信息

分类

测试

目标

block git commits when tests are failing.

检查命令

npm test

退出条件

tests exit 0 before each commit.

支持的智能体

Cursor

启动提示词

Install and run the "Pre-Commit Guard" loop.

Goal: block git commits when tests are failing.
Between iterations run: npm test
Exit when: tests exit 0 before each commit.

Step 1: Before any git commit, run tests. Fix failures before committing.

步骤

  1. 1

    Detect commit intent

    When a git commit command is about to run, pause and run the test suite first.

  2. 2

    Run tests

    Run the full test suite before allowing the commit to proceed.

    npm test
  3. 3

    Block or allow

    If tests fail, fix failures and re-run. Only allow the commit when tests pass.

评论

更多 测试 相关内容