AI-powered git commit message suggester with local fallback
Project description
✦ suggit — AI-powered Git Commit CLI
Smart git commit message suggester with pre-filled autocomplete. Uses Google Gemini AI first (free, no credit card), falls back to a local engine if AI is unavailable — works completely offline too.
images
✨ Features
- 🤖 AI suggestion via Google Gemini — free, no credit card needed
- ⚡ Local fallback engine — works offline, zero API needed
- ✏️ Pre-filled prompt — suggestion ready to edit or accept with Enter
- 🔁 Auto git add —
--addand--pushstage files for you - 📋 Conventional Commits format —
type(scope): description - 🛡️ Silent fallback — rate limit, timeout, no key? local engine kicks in instantly
- 🗂️ Modular structure — clean split across 5 files
- 📦 One-command install — single
curlcommand sets everything up
📦 Requirements
- Python 3.8+
- Git
prompt_toolkit
📁 Project structure
suggit/
├── commit.py ← entry point (install this to PATH)
├── git_utils.py ← git helpers (stage, diff, commit, push)
├── ai_suggest.py ← Gemini AI (free API, optional)
├── local_suggest.py ← local engine (offline, always works)
├── ui.py ← spinner + interactive prompt
├── install.sh ← one-command installer
├── setup.py ← pip installable
├── requirements.txt ← dependencies
├── CHANGELOG.md ← version history
└── README.md
🐧 Linux — Installation
Option A — One command (recommended)
curl -sSL https://raw.githubusercontent.com/charitraa/suggit/main/install.sh | bash
That's it. Downloads all files, installs dependencies, adds aliases automatically.
Option B — Manual
# 1. Clone the repo
git clone https://github.com/charitraa/suggit.git
cd suggit
# 2. Install dependencies
pip install -r requirements.txt --break-system-packages
# 3. Copy all files to /usr/local/bin
sudo cp commit.py git_utils.py ai_suggest.py local_suggest.py ui.py /usr/local/bin/
sudo mv /usr/local/bin/commit.py /usr/local/bin/commit
sudo sed -i 's/\r//' /usr/local/bin/commit
sudo chmod +x /usr/local/bin/commit
# 4. (Optional) Set free Gemini AI key
echo 'export GEMINI_API_KEY="AIza..."' >> ~/.zshrc
source ~/.zshrc
Option C — pip install
pip install suggit
🪟 Windows — Installation
Option A — PowerShell
# 1. Clone the repo
git clone https://github.com/charitraa/suggit.git
cd suggit
# 2. Install dependencies
pip install -r requirements.txt
# 3. Create C:\tools\ and copy all files there
mkdir C:\tools
copy *.py C:\tools\
# 4. Create C:\tools\commit.bat with this content:
# @echo off
# python "C:\tools\commit.py" %*
# 5. Add C:\tools to PATH
# Start → "Edit system environment variables"
# → Environment Variables → System variables → Path → Edit → New → C:\tools
# 6. (Optional) Set free Gemini AI key — add to $PROFILE:
# $env:GEMINI_API_KEY = "AIza..."
Option B — WSL
Follow the Linux installation steps inside your WSL terminal. Works identically.
🔑 Free Gemini AI Key (Optional but recommended)
Without a key the local engine runs automatically. With a key you get smarter AI suggestions.
- Go to 👉 aistudio.google.com/apikey
- Sign in with Google → Create API key → copy it
- Add to shell:
Linux / macOS
echo 'export GEMINI_API_KEY="AIza..."' >> ~/.zshrc
source ~/.zshrc
Windows PowerShell
# Add to $PROFILE
$env:GEMINI_API_KEY = "AIza..."
Free tier limits:
| Model | Requests/min | Requests/day |
|---|---|---|
gemini-2.5-flash |
10 | 500 |
gemini-2.5-flash-lite |
15 | 1500 |
For daily commits that's more than enough — completely free, forever.
🚀 Usage
commit # detect unstaged → ask to stage → suggest → commit
commit --add # git add . → suggest → commit
commit --push # git add . → suggest → commit → git push
commit --dry-run # show suggestion only, don't commit
What it looks like
✦ git add . done
apps/notices/views.py | 343 +++++++++++++++
apps/notices/services.py | 211 +++++++------
💡 🤖 AI suggestion — edit or press Enter to commit
✦ commit msg › refactor(notices): restructure service layer with caching
Enter commit Ctrl+A clear Ctrl+C cancel
If AI is unavailable (rate limit / no key / offline):
💡 ⚡ local suggestion — edit or press Enter to commit
✦ commit msg › refactor(notices): refactor notices logic
⚡ Recommended aliases
The installer adds these automatically. To add manually:
Linux — add to ~/.zshrc or ~/.bashrc
alias ca="commit --add"
alias cap="commit --push"
Windows — add to $PROFILE
function ca { commit --add }
function cap { commit --push }
Then just:
ca # stage + commit
cap # stage + commit + push ← full lazy mode
🧠 How the local engine works
When AI is unavailable, your diff is analysed using Conventional Commits rules across 55+ scope patterns:
| What it detects | Example output |
|---|---|
test_ / *.spec.ts files |
test(auth): add unit tests |
*.md / docs/ files |
docs: update readme |
| New functions/classes in patch | feat(api): add get_notice, create_notice |
| More deletions than insertions | refactor(service): clean up logic |
| Empty files added | chore: add empty repository, service files |
| Files deleted | chore: remove unused files |
| Django views/serializers/models | refactor(views): update notices viewset |
| React components/hooks/pages | feat(components): add NoticeCard component |
| Flutter widgets/blocs | feat(widgets): add notice list screen |
Scope is auto-detected from 55+ patterns covering Django, React, Flutter, Node.js and more.
🛠️ Troubleshooting
| Problem | Fix |
|---|---|
feat(<file_name>): ' |
Sometimes ai suggest like that but you need run the command again and again for better suggestion |
ModuleNotFoundError: No module named 'git_utils' |
All 5 .py files must be in the same folder — copy them all to /usr/local/bin/ |
command not found: commit |
Make sure /usr/local/bin is in PATH |
| Script prints garbage on run | Run sudo sed -i 's/\r//' /usr/local/bin/commit (CRLF fix) |
ModuleNotFoundError: prompt_toolkit |
Run pip install prompt_toolkit --break-system-packages |
| AI always falls back to local | Run echo $GEMINI_API_KEY — if empty, run source ~/.zshrc |
commit conflicts with another command |
Rename: sudo mv /usr/local/bin/commit /usr/local/bin/aicommit |
| Gemini key expired | Get a new key at aistudio.google.com/apikey |
📋 Changelog
See CHANGELOG.md for version history.
📄 License
MIT — free to use, modify, and distribute.
Made with ❤️ by Charitra
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 suggit-1.0.3.tar.gz.
File metadata
- Download URL: suggit-1.0.3.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1afa5ed7aff1f1bb24661ad052b5068a94386170c88a71b3e660e78cdf784e8e
|
|
| MD5 |
82bed322d3cb7512d3361dcda83dc698
|
|
| BLAKE2b-256 |
f5dac284aff90d5deb0fe7d93672cdf55a2d96cd32c973f4fa932279d5d2cd19
|
Provenance
The following attestation bundles were made for suggit-1.0.3.tar.gz:
Publisher:
publish.yml on charitraa/suggit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
suggit-1.0.3.tar.gz -
Subject digest:
1afa5ed7aff1f1bb24661ad052b5068a94386170c88a71b3e660e78cdf784e8e - Sigstore transparency entry: 1214782548
- Sigstore integration time:
-
Permalink:
charitraa/suggit@bcbe2cadec3db91e4abc3b7340262ca941f22e65 -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/charitraa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bcbe2cadec3db91e4abc3b7340262ca941f22e65 -
Trigger Event:
push
-
Statement type:
File details
Details for the file suggit-1.0.3-py3-none-any.whl.
File metadata
- Download URL: suggit-1.0.3-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f0d2235cffefdce71663d685a06722c142eaf9dec546d2a105d4e22917dfc78
|
|
| MD5 |
8aa795fea315588b1a25cccd7830421a
|
|
| BLAKE2b-256 |
eb24becd54d6b138c9c9cb681c93cd209f18dc3780b23d294042ef839a522bf0
|
Provenance
The following attestation bundles were made for suggit-1.0.3-py3-none-any.whl:
Publisher:
publish.yml on charitraa/suggit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
suggit-1.0.3-py3-none-any.whl -
Subject digest:
9f0d2235cffefdce71663d685a06722c142eaf9dec546d2a105d4e22917dfc78 - Sigstore transparency entry: 1214782625
- Sigstore integration time:
-
Permalink:
charitraa/suggit@bcbe2cadec3db91e4abc3b7340262ca941f22e65 -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/charitraa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bcbe2cadec3db91e4abc3b7340262ca941f22e65 -
Trigger Event:
push
-
Statement type: