AI Powered Commit Message Normalization Tool
Project description
CMAI - AI-Powered Commit Message Normalizer
CMAI is a CLI tool that uses AI to transform informal commit descriptions into standardized, professional Git commit messages based on your staged changes.
🚀 Quick Start
1. Installation
Install via uv (recommended) or pip:
# Install with all providers support
uv tool install cmai[all-providers]
# OR
pip install cmai[all-providers]
# For specific providers only: cmai[openai], cmai[ollama], cmai[anthropic], etc.
2. Configuration
Create the configuration file at ~/.config/cmai/settings.env:
# --- Remote Provider Example (OpenAI, DeepSeek, Zai, etc.) ---
PROVIDER=openai
API_KEY=your_api_key_here
MODEL=gpt-4o-mini
# API_BASE=... (Optional: Only needed for non-standard endpoints)
# --- Anthropic (Claude) Provider Example ---
# PROVIDER=anthropic
# API_KEY=your_anthropic_api_key_here
# MODEL=claude-3-5-sonnet-20241022
# ENABLE_THINKING=true
# THINKING_BUDGET=1024
# --- Local Provider Example (Ollama) ---
# PROVIDER=ollama
# OLLAMA_HOST=http://localhost:11434
# MODEL=qwen2.5:7b
Supported Providers: openai, bailian, deepseek, siliconflow, anthropic, claude, zai (智谱), ollama.
Tip: You can also set CMAI_API_KEY or ANTHROPIC_API_KEY as environment variables instead of putting them in the config file.
3. Usage
Stage your changes and run cmai:
git add .
cmai "fix a bug"
The tool will output a normalized message and prompt for action:
- [c]ommit: Execute git commit.
- [e]dit: Edit the message manually.
- [a]bort: Cancel.
If a commit error occurs, an appropriate error message will be displayed and retained here. You can open a new terminal to fix these issues and then input 'c' to proceed with the commit.
🛠 CLI Options
cmai [MESSAGE] [OPTIONS]
Options:
-c, --config TEXT Path to a custom configuration file
-r, --repo TEXT Path to the git repository (default: current dir)
-l, --language TEXT Target language for the commit message (e.g., "Chinese")
📦 Development
git clone [https://github.com/yumuzhihan/cmai.git](https://github.com/yumuzhihan/cmai.git)
cd cmai
uv sync --all-extras # Or other groups
python -m pytest # Run tests
📄 License
This project is licensed under the MIT License.
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 cmai-0.2.4.tar.gz.
File metadata
- Download URL: cmai-0.2.4.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d477b199490383b80479a61a2139bcfa9c04830fc008ce3fcfcb43cc0ba813b9
|
|
| MD5 |
c8f0a198551290c9438b833cee8c4723
|
|
| BLAKE2b-256 |
2952c384abd9f747b8f4ffdd28177783c05994efb15c892a270047027d369fe1
|
File details
Details for the file cmai-0.2.4-py3-none-any.whl.
File metadata
- Download URL: cmai-0.2.4-py3-none-any.whl
- Upload date:
- Size: 22.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9699dded71511c76e93160d8b9670cfec30d71e233a6e55ae45d0aedda133ea6
|
|
| MD5 |
9b72657edb4e4606ef8a7dce029fe6f6
|
|
| BLAKE2b-256 |
3223c9b58ae451ba8bf316bba4bd3a232d95bb665937754830678d1abb4e1609
|