Skip to main content

๐Ÿง  CommitWise-CLI

AI-powered git commit message generator

PyPI version Python License: MIT

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 --cached and 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.git
cd commitwise
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:

  1. CommitWise reads your staged changes via git diff --cached
  2. Sends the diff to Groq (Llama 3 70B) for analysis
  3. Displays 3 commit message suggestions in Conventional Commits format
  4. You pick one (1/2/3) or type your own custom message
  5. The commit is automatically applied

๐ŸŽฌ Demo

CommitWise 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.git
cd commitwise

# 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

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.0.tar.gz (478.3 kB view details)

Uploaded Source

File details

Details for the file commitwise_cli-0.1.0.tar.gz.

File metadata

  • Download URL: commitwise_cli-0.1.0.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

Hashes for commitwise_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a647958025739c557f33111f415b312438257145526bf25623c36b4053b98599
MD5 7551515fa5089cb2d726fa62f238caa2
BLAKE2b-256 e05419c732dcc8e39549662ccaeac88058e2fbb116b2f1ea3da12a7214fca0ac

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.1

1 file

This release

0.1.0 This release

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page