feat: Pre-Commit Hooks for AI Agent Execution (Alpha) #62
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pre-Commit Hooks - Initial Implementation (Alpha)
Summary
Implements the foundation for running PRPM agents as git pre-commit hooks. This PR establishes the architecture, commands, and configuration system. Agent execution is NOT yet implemented - this is a POC/alpha release to validate the approach.
What's Included ✅
Core Commands
prpm hooks install- Install git hooks in repositoryprpm hooks uninstall- Remove git hooksprpm hooks status- Show hook installation statusprpm hooks run <hook-type>- Execute hooks (called by git)Configuration System
schemas/hooks.json).prpm/hooks.jsonwith templateGit Integration
Documentation
packages/cli/docs/HOOKS.mdpackages/cli/docs/PRE_COMMIT_HOOKS_CHECKLIST.mdIDEAS.mdwith full concept explorationWhat's NOT Implemented ⏳
See PRE_COMMIT_HOOKS_CHECKLIST.md for full details:
git diff --cached)Currently,
prpm hooks run pre-commitjust prints what would be executed.Testing
Manual Testing
Expected Behavior
Architecture
File Structure
Execution Flow (When Complete)
Configuration Example
.prpm/hooks.json:{ "hooks": { "pre-commit": { "enabled": true, "agents": [ { "name": "@pre-commit/security-scanner", "files": "**/*.{js,ts,py}", "severity": "error", "autoFix": false } ] } }, "settings": { "anthropicApiKey": null, "enabled": true, "timeout": 30000, "cache": { "enabled": true, "ttl": 3600 } } }Next Steps (Follow-up PRs)
v0.2.0 - Agent Execution
v0.3.0 - Polish & Testing
v1.0.0 - Stable Release
Related
IDEAS.md- AI-Powered Code Review AgentsBreaking Changes
None - this is a new feature.
Checklist
npm run build)Notes for Reviewers
This is intentionally incomplete. The goal is to:
Key Questions:
Demo Output
$ prpm hooks install ✓ Created hooks configuration at .prpm/hooks.json ✓ Git hooks installed successfully Installed hooks: - pre-commit → /path/to/.git/hooks/pre-commit Configuration: .prpm/hooks.json Run prpm hooks uninstall to remove hooks. $ prpm hooks status 📋 PRPM Hooks Status ✓ Git hooks: Installed ✓ Configuration: .prpm/hooks.json Enabled: yes Configured hooks: - pre-commit: enabled, 1 agent(s)Ready for review! Comments and suggestions welcome before proceeding with agent execution implementation.