Skip to content

ioodev/AI-Commit

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

31 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿค– AI Commit

Language Bahasa License Python

AI-powered automatic commit tool that generates quality commit messages and supports multi-project workspace

AI Commit is a Python utility that leverages AI power (Gemini & ChatGPT) to analyze your code changes and automatically generate commit messages following conventional commits standards.

Available in 2 versions:

  • ๐Ÿ–ฅ๏ธ CLI Version - Command line interface for terminal lovers
  • ๐ŸŽจ GUI Version - Graphical interface with Tkinter (no additional dependencies!)

โœจ Key Features

  • ๐ŸŽฏ Auto-Generate Commit Messages - AI analyzes diff and creates descriptive commit messages
  • ๐Ÿค– Multi AI Provider - Support for Gemini and ChatGPT
  • ๐Ÿ“ Multi-Project Support - Manage multiple git repositories in one workspace
  • ๐Ÿ” Auto-Detect Changes - Scan and display which folders have changes
  • โž• Smart Git Add - Auto-detect changes with selective add option
  • ๐Ÿš€ Auto Push - Automatically push to origin current branch
  • ๐Ÿ“ Interactive Mode - Confirmation and edit before commit
  • ๐ŸŽจ Conventional Commits - Follow conventional commits standard format
  • ๐Ÿ–ผ๏ธ GUI Interface - User-friendly graphical interface
  • ๐ŸŒ™ Dark Mode - Toggle between light and dark theme for eye comfort

๐Ÿ“‚ Supported Folder Structure

This tool is specifically designed to work with workspace structure like this:

workspace/
โ”œโ”€โ”€ Folder1/              # Git Repository 1
โ”‚   โ”œโ”€โ”€ .git/
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ Folder2/              # Git Repository 2
โ”‚   โ”œโ”€โ”€ .git/
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ Folder3/              # Git Repository 3
โ”‚   โ”œโ”€โ”€ .git/
โ”‚   โ””โ”€โ”€ ...
โ””โ”€โ”€ AI-Commit/            # Tool folder (run script from here)
    โ”œโ”€โ”€ ai_commit.py
    โ””โ”€โ”€ ai_commit_gui.py

How it works:

  • Tool runs from inside AI-Commit folder
  • Automatically scans parent directory to find all git repositories (Folder1, Folder2, Folder3)
  • Detects which folders have changes (marked with ๐Ÿ”ด)
  • You choose which folder to commit and push

๐Ÿš€ Installation

Prerequisites

  • Python 3.9 or newer
  • Git installed
  • API Key from Gemini or OpenAI

Install Dependencies

# Clone repository
git clone https://github.com/RyuCode-Digital-Solution/AI-Commit

# Enter AI-Commit folder
cd AI-Commit

# Install required packages
pip install -r requirements.txt

๐Ÿ”‘ Configuration

1. Get API Key

Gemini API Key (Free - Recommended)

  1. Visit Google AI Studio
  2. Login with Google account
  3. Click "Create API Key"
  4. Copy the generated API key

OpenAI API Key (Paid)

  1. Visit OpenAI Platform
  2. Login or create account
  3. Click "Create new secret key"
  4. Copy the generated API key

2. Set Environment Variables

Linux/Mac

Temporary (current session only):

export GEMINI_API_KEY="your-gemini-api-key-here"
export OPENAI_API_KEY="your-openai-api-key-here"

Permanent (add to ~/.bashrc or ~/.zshrc):

echo 'export GEMINI_API_KEY="your-gemini-api-key-here"' >> ~/.bashrc
echo 'export OPENAI_API_KEY="your-openai-api-key-here"' >> ~/.bashrc
source ~/.bashrc

Windows

Command Prompt (Temporary):

set GEMINI_API_KEY=your-gemini-api-key-here
set OPENAI_API_KEY=your-openai-api-key-here

PowerShell (Temporary):

$env:GEMINI_API_KEY="your-gemini-api-key-here"
$env:OPENAI_API_KEY="your-openai-api-key-here"

Permanent (System Environment Variables):

  1. Open "System Properties" โ†’ "Environment Variables"
  2. Click "New" in User Variables
  3. Variable name: GEMINI_API_KEY
  4. Variable value: your-api-key
  5. Repeat for OPENAI_API_KEY

๐ŸŽจ GUI Version (Recommended)

GUI Version

Features

  1. ๐Ÿ” Auto-Scan - Automatically scan repositories on app startup
  2. ๐ŸŽฏ Visual Selection - Choose repository and files with mouse
  3. ๐Ÿค– One-Click AI - Generate commit message with one click
  4. ๐Ÿ“Š Real-time Log - View all activities in log panel
  5. โš™๏ธ Easy Settings - Toggle AI provider and auto-push
  6. โœ… Batch Selection - Select all or clear selection easily
  7. ๐ŸŽจ Modern UI - Clean and intuitive interface
  8. ๐ŸŒ™ Dark Mode - Toggle between light and dark theme
  9. ๐Ÿ“ Smart File Matching - Auto-detect similar files on error
  10. ๐Ÿ”„ Auto Refresh - File list auto-refreshes after staging

How to Use

# Enter AI-Commit folder
cd AI-Commit

# Run GUI version
python ai_commit_gui.py

GUI Workflow

  1. Open app โ†’ Auto-scan runs
  2. Select repository from dropdown (with ๐Ÿ”ด changes indicator)
  3. Toggle Dark Mode if needed (๐ŸŒ™ checkbox top right)
  4. Select files to commit (or Select All)
  5. Click "โž• Add to Stage" to stage files
  6. Click "๐Ÿค– Generate with AI" for AI commit message (or write manually)
  7. Review message in text area
  8. Click "โœ… Commit & Push" to commit and push

Dark Mode

GUI supports light and dark themes for your eye comfort:

How to Activate:

  • Check/Uncheck "๐ŸŒ™ Dark Mode" checkbox in top right corner
  • Theme instantly changes for all components

Dark Theme:

  • Dark background (#1e1e1e) comfortable for eyes
  • Light text (#ffffff) for optimal contrast
  • Gray frames (#2d2d2d) for clear separation
  • Dark blue accent (#0e639c) for highlights
  • Perfect for night work or dark rooms

Light Theme:

  • Light background (#f0f0f0) for bright rooms
  • Black text (#000000) for maximum sharpness
  • White frames (#ffffff) for clean appearance
  • Bright blue accent (#0078d4) for interaction
  • Perfect for daytime work or bright rooms

๐Ÿ–ฅ๏ธ CLI Version

CLI Version

Quick Start

# Enter AI-Commit folder
cd AI-Commit

# Run tool
python ai_commit.py

# Tool will scan parent folder and display repositories
# Choose repository to commit (marked with ๐Ÿ”ด)
# Select files to add
# Review AI-generated commit message
# Confirm and auto push!

Command Line Options

Option Short Description Example
--provider - Choose AI provider (gemini/chatgpt) --provider chatgpt
--dir -d Specify target directory --dir ../Folder1
--all -a Add all files without confirmation --all
--message -m Custom commit message (skip AI) -m "fix: bug"
--no-push - Commit without push --no-push
--help -h Display help message --help

CLI Examples

# Auto-detect and interactive
python ai_commit.py

# Specific folder with ChatGPT
python ai_commit.py --dir ../Folder1 --provider chatgpt

# Quick commit with custom message
python ai_commit.py --dir ../Folder2 -m "docs: update README" --no-push

# Full automation
python ai_commit.py --dir ../Folder3 --all

๐ŸŽฏ GUI vs CLI Comparison

Feature GUI CLI
Ease of Use โญโญโญโญโญ โญโญโญ
Speed โญโญโญ โญโญโญโญโญ
Visual Feedback โญโญโญโญโญ โญโญ
Automation โญโญ โญโญโญโญโญ
Remote Access โŒ โœ…
Beginner Friendly โœ… โš ๏ธ
Dark Mode โœ… โŒ

Recommendation:

  • ๐ŸŽจ Use GUI if: beginner, prefer visual, working locally
  • ๐Ÿ–ฅ๏ธ Use CLI if: power user, automation, remote work

๐Ÿ”ง Troubleshooting

Problem: "GEMINI_API_KEY not found"

Solution:

# Check if already set
echo $GEMINI_API_KEY  # Linux/Mac
echo %GEMINI_API_KEY%  # Windows CMD

# If empty, set again
export GEMINI_API_KEY="your-api-key"  # Linux/Mac
set GEMINI_API_KEY=your-api-key  # Windows

Problem: "No git repositories found"

Solution:

  1. Ensure you run tool from inside AI-Commit folder
  2. Ensure sibling folders (Folder1, Folder2, etc) are git repositories
  3. Check with:
    cd ../Folder1
    ls -la .git  # Linux/Mac
    dir .git  # Windows
  4. If not git repo yet, init first:
    cd ../Folder1
    git init
    git remote add origin <your-repo-url>

Problem: "GUI not appearing / Tkinter Error"

Solution:

Linux:

# Install tkinter
sudo apt-get install python3-tk  # Ubuntu/Debian
sudo yum install python3-tkinter  # CentOS/RHEL

macOS:

# Tkinter already included, but if error:
brew install python-tk

Windows:

  • Tkinter already included in Python installer
  • If missing, reinstall Python and check "tcl/tk" option

โ“ FAQ

Q: How to activate Dark Mode in GUI?

A:

  1. Open GUI app (python ai_commit_gui.py)
  2. Look at top right corner, there's "๐ŸŒ™ Dark Mode" checkbox
  3. Click checkbox to toggle between light and dark theme
  4. Theme instantly changes for all UI components

Dark Mode suitable for:

  • Night work
  • Reducing eye strain
  • Low-light rooms
  • Personal visual preference

Q: Is Dark Mode saved after app closes?

A: No, theme resets to Light Mode each time app opens. This is default behavior for now. If you want Dark Mode as default, edit ai_commit_gui.py:

# Find this line (around line 30):
self.dark_mode = tk.BooleanVar(value=False)

# Change to:
self.dark_mode = tk.BooleanVar(value=True)  # Default Dark Mode

Q: Is this tool free?

A: Tool is 100% free and open source. However for AI:

  • Gemini API: Free with sufficient daily quota (recommended)
  • OpenAI API: Paid, around $0.002 per commit

Q: Is my data safe?

A:

  • โœ… Tool only sends git diff (code changes) to AI
  • โœ… No data stored on server
  • โœ… API key stored locally in your environment variables
  • โš ๏ธ Don't commit files containing secrets/passwords/tokens

Q: GUI or CLI, which is better?

A: Depends on your needs:

  • GUI: Easier for beginners, visual feedback, suitable for daily use
  • CLI: Faster, can be automated, suitable for power users and remote work

You can use both! GUI for regular commits, CLI for scripting.


๐Ÿค Contributing

Contributions always welcome!

How to Contribute:

  1. Fork repository
  2. Create feature branch
    git checkout -b feature/AmazingFeature
  3. Commit changes
    git commit -m 'feat: add amazing feature'
  4. Push to branch
    git push origin feature/AmazingFeature
  5. Create Pull Request

Contributing Ideas:

  • CLI Version
  • GUI Version with Tkinter
  • Dark Mode
  • Smart File Matching
  • PyQt5/PyQt6 version for advanced GUI
  • System tray integration
  • Drag & drop file support in GUI
  • Git graph visualization
  • Multi-repo batch commit
  • Config file support
  • Plugin system

๐Ÿ™ Credits


๐Ÿ“ž Support & Contact

Found a Bug?

  • ๐Ÿ› Create issue in repository with bug label
  • Include error message and reproduction steps

Have a Suggestion?

  • ๐Ÿ’ก Create issue with enhancement label
  • Explain use case and expected behavior

Need Help?

  • ๐Ÿ“– Read FAQ and Troubleshooting above
  • ๐Ÿ’ฌ Create issue with question label
  • ๐Ÿ“ง Email: dev@ryucode.com

Made with โค๏ธ for developers who value clean commit history

โญ Star this repository if helpful!

๐Ÿš€ Happy Committing with AI!


๐Ÿ‡ฎ๐Ÿ‡ฉ Baca dalam Bahasa Indonesia

About

AI-powered automatic commit tool that generates quality commit messages and supports multi-project workspace

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%