@jaleeson11/commitguard
v0.1.8
Published
Git pre-commit hook for AI agent code review against project guidelines
Maintainers
Readme
CommitGuard
A git pre-commit hook that enables AI agents to review code changes against project guidelines before committing.
Features
Automated code review — Blocks commits and presents staged changes for AI agent review against your project's coding standards.
Zero configuration — Installs automatically via npm postinstall. Just add your
COMMITGUARD.mdand you're ready to go.Framework agnostic — Works with any project that uses git. No API calls or external services required.
Non-intrusive workflow — Agents can bypass the hook with
--no-verifyafter reviewing, or fix issues and re-commit.
Getting Started
Prerequisites
- Node.js 18+
- Git
Installation
- Install the package as a dev dependency:
npm install @jaleeson11/commitguard --save-dev- Create a
COMMITGUARD.mdin your project root with your coding standards:
touch COMMITGUARD.mdThe hook will automatically be installed to .git/hooks/pre-commit.
Usage
When an AI agent (or developer) attempts to commit:
git commit -m "add new feature"The hook will:
- Display the project's
COMMITGUARD.md - Show the staged diff
- Block the commit with review instructions
After reviewing, the agent can either:
Approve and commit:
git commit --no-verify -m "add new feature"Fix issues and retry:
# Make fixes git add . git commit -m "add new feature"
Guidelines Location
The hook searches for COMMITGUARD.md in these locations (in order):
./COMMITGUARD.md./.github/COMMITGUARD.md./docs/COMMITGUARD.md
License
This project is licensed under the MIT License.
