Smart conventional commit messages with a rule engine + minimal-context LLM
Project description
commitcraft
Smart conventional commit messages — a rule engine decides when AI is even needed.
What makes it different
Most "AI commit message" tools blindly send your entire diff to an LLM. commitcraft doesn't.
It first runs a local rule engine on your diff. README-only change? Lockfile bump? Single test file? Those get a conventional commit message generated instantly, locally, with zero AI cost. Only when changes are genuinely complex does it reach out to an LLM — and even then it sends a condensed summary, not the full diff.
The story isn't "I used AI." It's "I built a system that decides when AI should be used."
Pipeline
git diff (staged)
│
▼
Parser → extract changed files, line counts, file types
│
▼
Filter → strip lockfiles, dist/, build/, *.min.js, etc.
│
▼
Rule Engine → simple change? generate commit locally (zero cost)
│ e.g. README-only → "docs: update README"
│ lockfile-only → "chore: update lockfile"
│
▼ (complex change only)
Classifier → complexity score 0-100 from:
• file count and directory spread
• function/class definition changes (regex)
• test files alongside source files
• total line count
│
▼
Context Builder → condensed summary (not the full diff)
│ ~100-500 tokens instead of thousands
▼
Your chosen Provider (Ollama / OpenAI / Gemini / Anthropic)
│
▼
Conventional commit message
Installation
pip install commitcraft
commitcraft init # one-time setup: choose your provider
Quickstart
# Make some changes, then:
commitcraft commit
# Generate a PR description for the current branch:
commitcraft pr
# Generate release notes between two tags:
commitcraft release-notes v1.0.0..v1.1.0
# Analyze your commit history:
commitcraft history
Provider setup
On first run (commitcraft init), you choose your provider:
| Provider | Cost | Requires |
|---|---|---|
| Ollama | Free (local) | Ollama installed + a model pulled |
| OpenAI | Your API key | openai_api_key in config |
| Anthropic Claude | Your API key | anthropic_api_key in config |
| Google Gemini | Your API key | gemini_api_key in config |
Your API key is stored locally at ~/.commitcraft/config.yaml. It never leaves your machine except to call your chosen provider directly.
Contributing
See CONTRIBUTING.md and docs/adding_a_provider.md.
License
MIT © mavesensei
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file commitcraft_cli-0.1.0.tar.gz.
File metadata
- Download URL: commitcraft_cli-0.1.0.tar.gz
- Upload date:
- Size: 158.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
706acfebedf17d8fe96ae152642bce21d0d95b8c3f1e6fd09ef5382d7b38571e
|
|
| MD5 |
994efded7a96d1fc91145f82bfe6493a
|
|
| BLAKE2b-256 |
6ecc61a38cdae7cdfb4ab56585de7d444cd6a9106e357403b44033f8e59f246b
|
File details
Details for the file commitcraft_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: commitcraft_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
069cb3db45fe3733468f763c6c141752a03b32b9a5bcbf2319b5d3aae354be33
|
|
| MD5 |
f38ef0166c6f299bce4afc9abdff9183
|
|
| BLAKE2b-256 |
792fb971742b14fc53c8671d3a7ab4cb4f0e0069a18bdaf3f7ef0b4c8e86549a
|