🧠 CommitWise-CLI
AI-powered git commit message generator
Stop writing generic commit messages. Let AI analyze your staged changes and suggest meaningful, Conventional Commits compliant messages.
✨ Features
- 🔍 Smart Analysis — Reads your
git diff --cachedand understands what changed - 🤖 LLM-Powered — Uses Groq's blazing-fast Llama 3 70B for high-quality suggestions
- 📝 Conventional Commits — Auto-prefixes with
feat:,fix:,refactor:, etc. - 🎨 Beautiful CLI — Rich terminal output with colors and formatting
- ⚡ One Command — Run
commitwise, pick a message, done - 🔒 Privacy-First — Only staged diffs are sent; nothing leaves your machine otherwise
📦 Installation
pip install commitwise-cli
Or install from source:
git clone https://github.com/Md-Shamir-raza/commitwise-cli.git
cd commitwise-cli
pip install -e .
🔑 Setup
You need a free Groq API key.
Option 1: Environment variable
export GROQ_API_KEY=your_api_key_here
Option 2: .env file
Create a .env file in your project root:
GROQ_API_KEY=your_api_key_here
🚀 Usage
# Stage your changes
git add .
# Generate AI commit messages
commitwise
What happens:
- CommitWise reads your staged changes via
git diff --cached - Sends the diff to Groq (Llama 3 70B) for analysis
- Displays 3 commit message suggestions in Conventional Commits format
- You pick one (1/2/3) or type your own custom message
- The commit is automatically applied
🎬 Demo
📖 Example
🧠 CommitWise v0.1.0
⠋ Analyzing changes…
╭─ ✦ Suggested Commit Messages ────────────────────────╮
│ │
│ 1. feat: add user authentication middleware │
│ 2. feat: implement JWT token validation for routes │
│ 3. chore: add auth dependencies to requirements │
│ │
╰───────────────────────────────────────────────────────╯
Enter 1, 2, or 3 to pick a suggestion, or type your own message.
❯ 1
✓ Committed: feat: add user authentication middleware
⚙️ How It Works
┌─────────────┐ ┌──────────────┐ ┌───────────┐ ┌────────────┐
│ git add . │ ──▶ │ commitwise │ ──▶ │ Groq API │ ──▶ │ git commit │
│ (you stage) │ │ (reads diff)│ │ (Llama 3) │ │ (applied) │
└─────────────┘ └──────────────┘ └───────────┘ └────────────┘
🛡️ Edge Cases Handled
| Scenario | Behavior |
|---|---|
| No staged changes | Prints warning and exits gracefully |
| Diff too large (>8000 tokens) | Truncates with a notice |
| API key missing | Clear error with setup instructions |
| LLM returns invalid JSON | Retries once, then falls back to raw output |
| Git not installed | Prints error and exits |
🏗️ Project Structure
commitwise/
├── commitwise/
│ ├── __init__.py # Package metadata
│ ├── cli.py # Click CLI entry point
│ ├── git_utils.py # Git subprocess wrappers
│ ├── llm.py # Groq API integration
│ └── prompt_templates.py # LLM prompt definitions
├── .env.example # API key template
├── pyproject.toml # PyPI packaging config
├── README.md
└── LICENSE
🤝 Contributing
Contributions are welcome! Feel free to open issues or submit pull requests.
# Clone the repo
git clone https://github.com/Md-Shamir-raza/commitwise-cli.git
cd commitwise-cli
# Install in development mode
pip install -e .
# Run locally
commitwise
📄 License
This project is licensed under the MIT License — see the LICENSE file for details.
Made with ❤️ by Md Shamir Raza Thanks
Metadata
Release files for commitwise-cli 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| commitwise_cli-0.1.1.tar.gz | 478.3 kB | Details |
Release files / commitwise_cli-0.1.1.tar.gz
| Download URL | commitwise_cli-0.1.1.tar.gz |
|---|---|
| Size | 478.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
516867e9a16f8ee505fea8d7b3d17718bb333f2ff9b14a710d52e76a7620941f
|
|
BLAKE2b-256 checksum How to use checksums |
6a9dd52b5af45a362c4824f04f38f5af88e0cb48b6a3be876e6c0dedf8d1e259
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|