๐ง 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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
commitwise_cli-0.1.1.tar.gz
(478.3 kB
view details)
File details
Details for the file commitwise_cli-0.1.1.tar.gz.
File metadata
- Download URL: commitwise_cli-0.1.1.tar.gz
- Upload date:
- Size: 478.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
516867e9a16f8ee505fea8d7b3d17718bb333f2ff9b14a710d52e76a7620941f
|
|
| MD5 |
9c0fd9f9f73f6e8e4ac73e211a101a0a
|
|
| BLAKE2b-256 |
6a9dd52b5af45a362c4824f04f38f5af88e0cb48b6a3be876e6c0dedf8d1e259
|