Download the PHP package mi-lopez/claude-git-hook without Composer
On this page you can find all versions of the php package mi-lopez/claude-git-hook. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mi-lopez/claude-git-hook
More information about mi-lopez/claude-git-hook
Files in mi-lopez/claude-git-hook
Package claude-git-hook
Short Description Git hook that uses Claude AI to automatically generate commit messages with issue extraction
License MIT
Homepage https://github.com/mi-lopez/claude-git-hook
Informations about the package claude-git-hook
Claude Git Hook
Automatically generate intelligent commit messages using Claude AI. This package installs a git hook that analyzes your code changes and creates descriptive commit messages following conventional commit standards with automatic issue extraction from branch names.
Features
- 🤖 AI-powered: Uses Claude AI to analyze code changes
- 📝 Conventional commits: Follows standard commit message format
- 🎯 Issue extraction: Automatically extracts issue numbers from branch names
- 🔄 Fallback system: Works even when API is unavailable
- 🚀 Easy installation: Simple Composer package
- ⚡ Fast setup: Automatic installation via Composer scripts
- 🐍 No Python dependency: Works with basic Unix tools
Commit Message Format
Generated messages follow this format:
Examples
Input: Branch feature/CAM-942-implement-auth
with authentication code changes
Output:
Installation
Via Composer (Recommended)
The hook will be automatically installed after Composer finishes.
Manual Installation
- Clone this repository
- Run the installer:
Configuration
1. Get Claude API Key
- Visit Anthropic Console
- Create an account or sign in
- Generate an API key
2. Configure API Key
Or set manually:
Usage
Once installed and configured, the hook works automatically:
Manual Commands
Branch Name Patterns
The hook automatically extracts issue numbers from branch names:
- ✅
feature/CAM-942-implement-auth
→CAM-942
- ✅
CAM-942-implement-auth
→CAM-942
- ✅
TRIGB2B-42141-fix-login
→TRIGB2B-42141
- ✅
bugfix/PROJ-123-memory-leak
→PROJ-123
- ❌
feature-branch
→ No issue extracted
How It Works
- Code Analysis: When you run
git commit
, the hook captures your staged changes - Branch Analysis: Extracts issue number from current branch name
- AI Processing: Sends the diff to Claude AI for analysis
- Message Generation: Claude generates a structured commit message
- Fallback: If API fails, generates a basic message based on file analysis
Commit Message Types
The generated messages use conventional commit types:
feat
: New featuresfix
: Bug fixesdocs
: Documentation changesstyle
: Code style changesrefactor
: Code refactoringtest
: Test changeschore
: Maintenance tasks
Configuration Options
Environment Variables
CLAUDE_API_KEY
: Your Claude API key (required)
Custom Configuration
You can modify the hook behavior by editing .git/hooks/prepare-commit-msg
directly.
Requirements
- Git repository
- curl (for API calls)
- Basic Unix tools (grep, sed, tr)
- Claude API key
Troubleshooting
Hook Not Working
API Key Issues
Permission Issues
Debug Information
Development
Project Structure
Running Tests
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Run the test suite
- Submit a pull request
Code Style
This project follows PSR-12 coding standards:
License
MIT License. See LICENSE file for details.
Support
- 📖 Documentation
- 🐛 Issues
- 💬 Discussions
Changelog
v1.0.0
- Initial release
- Basic commit message generation
- Issue extraction from branch names
- Composer package support
- CLI interface
- Fallback system
- No Python dependency
Made with ❤️ and AI by mi-lopez