MCP.so
Sign In
Testingevent

Pre-Commit Guard

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

Kickoff prompt

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.

Basic information

Category

Testing

Goal

block git commits when tests are failing.

Check command

npm test

Exit when

tests exit 0 before each commit.

Supported agents

Cursor

Steps

  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.

More Testing loops