🚀 AI-Powered Git Commit Assistant with 🦜️🔗 LangChain
CommitBuddy is an AI-powered assistant that analyzes your code changes and generates meaningful commit messages following conventional commit standards. It analyzes git diffs, breaks changes into logical units, and creates semantic commit messages that clearly describe what changed and why.
- 🔍 Intelligent Analysis: Analyzes git diffs to understand code changes
- 🧩 Logical Grouping: Splits changes into logical units for atomic commits
- 💬 Semantic Messages: Generates commit messages in conventional format
- 🔄 Multi-Stage Workflow: Option for full analysis or quick generation
- 🚀 GPU Acceleration: Support for Metal (Apple Silicon) and CUDA (NVIDIA)
pip install commit-buddy
For Apple Silicon (Metal):
pip install "commit-buddy[metal]"
For NVIDIA GPUs (CUDA):
pip install "commit-buddy[cuda]"
- Download an LLM model file (GGUF format) for local inference
- Place it in
~/.commitbuddy/models/
- Run with
commitbuddy --show-config
to check your configuration
# For already staged changes (git add)
commitbuddy
# For unstaged changes
commitbuddy --unstaged
usage: commitbuddy [-h] [--config CONFIG] [--model MODEL] [--analyze] [--unstaged] [--auto-commit] [--verbose] [--show-config] [--gpu-layers GPU_LAYERS]
AI-Powered Git Commit Assistant with LangChain
options:
-h, --help show this help message and exit
--config CONFIG, -c CONFIG
Path to config file
--model MODEL, -m MODEL
Path to LLM model file
--analyze, -a Analyze git diff without making any commits
--unstaged, -u Include unstaged changes in the analysis
--auto-commit, -ac Automatically commit changes without confirmation
--verbose, -v Enable verbose output
--show-config Show configuration and exit
--gpu-layers GPU_LAYERS, -g GPU_LAYERS
Number of layers to run on GPU (for Metal/CUDA acceleration)
CommitBuddy creates a default configuration file at ~/.commitbuddy/config.yaml
. You can customize this file to change settings:
# LLM settings
model_path: ~/.commitbuddy/models/your-model.gguf
context_length: 4096
temperature: 0.2
max_tokens: 1024
n_gpu_layers: 1
n_batch: 512
n_threads: 4
# Git settings
git_command: git
auto_commit: false
# LangChain settings
chain_verbose: false
# Commit message settings
commit_types:
- feat
- fix
- docs
- style
- refactor
- perf
- test
- build
- ci
- chore
- revert
commit_scopes: []
CommitBuddy works best with coding-specialized language models. Here are some recommended options:
Download the quantized model (Q4_K_M recommended for good balance of speed/quality) and place it in your ~/.commitbuddy/models/
directory.
$ git add src/core/utils.py src/api/routes.py
$ commitbuddy
$ commitbuddy --unstaged
$ commitbuddy --analyze
CommitBuddy uses a multi-stage LangChain pipeline:
- Diff Analysis: Analyzes git diffs to understand what changed
- Change Splitting: Groups related files into logical units
- Message Generation: Creates conventional commit messages
Each stage feeds into the next, creating a comprehensive analysis that results in meaningful commit messages.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'feat: add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- LangChain for the LLM integration
- llama-cpp-python for local inference
- Rich for terminal formatting
- GitPython for git operations