AI-powered Git commit message generator using Google Gemini
Project description
Smart Commit
AI-powered Git commit message generator that follows the Conventional Commits specification using Google Gemini API.
Features
- Generates commit messages using Google Gemini AI
- Follows Conventional Commits 1.0.0 specification
- Interactive editing with Vim
- Regenerate messages on demand
- Supports all conventional commit types
Installation
From PyPI (once published)
pip install smart-gcm
From Source
git clone https://github.com/aakashvarma/smart-gcm.git
cd smart-gcm
pip install -e .
Prerequisites
- Python 3.6 or higher
- Git
- Vim
- Google Gemini API key
Setup
-
Get your Gemini API key from Google AI Studio
-
Set the environment variable:
# Linux/Mac
export GEMINI_API_KEY="your-api-key-here"
# Windows
set GEMINI_API_KEY=your-api-key-here
For permanent setup, add to your shell profile:
# Bash (~/.bashrc or ~/.bash_profile)
echo 'export GEMINI_API_KEY="your-api-key-here"' >> ~/.bashrc
# Zsh (~/.zshrc)
echo 'export GEMINI_API_KEY="your-api-key-here"' >> ~/.zshrc
Usage
- Stage your changes:
git add <files>
- Run Smart Commit:
gcm
-
Follow the interactive prompts:
- Select commit type (feat, fix, refactor, style, test, docs, build, ops, chore, revert)
- Enter optional scope (max 20 characters)
- Review the AI-generated commit message
-
Choose an action:
a- Accept and commite- Edit in Vimr- Regenerate messagec- Cancel
Commit Types
- feat: New feature
- fix: Bug fix
- refactor: Code refactoring (including performance improvements)
- style: Code style changes (formatting, semicolons, etc.)
- test: Adding or updating tests
- docs: Documentation changes
- build: Build system or dependency changes
- ops: Operational/infrastructure changes
- chore: Maintenance tasks
- revert: Revert previous commit
Examples
# Feature with scope
feat(auth): add OAuth2 login support
- Implement Google OAuth2 integration
- Add user session management
# Bug fix
fix(api): resolve null pointer exception in user endpoint
- Add null check for user object
- Update error handling
# Breaking change
feat(api)!: change response format to JSON:API spec
BREAKING CHANGE: all API responses now follow JSON:API specification
Development
Project Structure
smart-gcm/
├── smart_commit/
│ ├── __init__.py
│ ├── cli.py # Command-line interface
│ ├── commit.py # Commit message generation
│ └── utils.py # Utility functions
├── setup.py
├── README.md
├── LICENSE
└── .gitignore
Running from Source
python -m smart_commit.cli
License
MIT License - see LICENSE file for details
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
If you encounter any issues or have questions, please file an issue on GitHub.
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 smart_gcm-0.1.0.tar.gz.
File metadata
- Download URL: smart_gcm-0.1.0.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9bd548209f80001803231820d9f700181b3ac24cb8e86093212c3c9a44485d5
|
|
| MD5 |
4cda90a698dd9b102c19413ad47a21f6
|
|
| BLAKE2b-256 |
e0258fb7d421319e6ac0bda108b41d6e3fd4733854f1b2c4beeaead0d0624a7e
|
File details
Details for the file smart_gcm-0.1.0-py3-none-any.whl.
File metadata
- Download URL: smart_gcm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35c55fcf365c6e2ce32a7bbae3aae6b7c08dc57b525a6eb7896c1c5b9f1ceaa6
|
|
| MD5 |
6e40b947a36296fc8a96aa328cd15e79
|
|
| BLAKE2b-256 |
92b1a24ea9a1221c0114ce7a5b20663166c525569ed4490ffb685daf7e19c549
|