Generate automatic commit messages using AI
Project description
AutoCommitAI 🤖
Automatic commit message generator using AI, with some extra features. But first, why?
❓ Why AutoCommit AI?
Writing commit messages is often a tedious task, and it is not always easy to condense or describe the changes we have made (or the bugs we have introduced), but fortunately this message is not as critical as the code we develop. AI can do a lot of things, although the less important that task is, the better. So for this one, it could help us generate meaningful and descriptive messages automatically, adding those “best practices” that, of course, we all apply in our commit messages. And yes, it creates the title and the description.
🚀 Main features
- 🧠 Multiple AI providers: OpenAI, Google Gemini, Azure OpenAI and Ollama
- 🌍 Multi-language support: Generate commits in Spanish, English, French, German, etc.
- 📋 Interactive staging: Select which files to include in the commit
- 👀 Preview mode: Generate messages without committing. Yes, the “final” message will be different, but you can see an approach
- 📊 Repository information: Status, history, branches
- ✅ User validation: Aks for user validation before committing
⚠️ DISCLAIMER for Ollama: The Ollama integration is experimental and may not work as expected, as there are a lot of models, and some of theme are very limited. It is recommended to use OpenAI or Google Gemini for production use.
📦 Installation
You can install AutoCommit AI directly from PyPI using pip:
pip install auto-commit-ai
Alternatively, you can clone the repository and install directly from source:
git clone https://gitlab.com/tmllull/auto-commit-ai.git
cd auto-commit-ai
pip install .
🔧 Configuration
AutoCommit AI loads its configuration from environment variables file. You can set these variables in a .auto_commit_ai.env file located in your current working directory (where your git repository is) or your home directory (~/.auto_commit_ai.env).
NOTE: If you add the file to your working directory, remember to add it to your .gitignore file.
The contents of the .auto_commit_ai.env can be found in the .auto_commit_ai.env.template file.
🎯 Basic Usage
AutoCommit AI is a command-line tool. Navigate to your Git repository and run one of the following commands:
# Default command
auto-commit-ai
or
# Alias for the default command
acai
This is the default command, and it will generate a commit message for your staged changes only.
Both commands, auto-commit-ai and acai, are equivalent and can be used interchangeably.
Basic commands
# Generates a commit message only for staged changes
auto-commit-ai
# Show help message
auto-commit-ai -h
# Include all changes (staged + unstaged + untracked)
acai --all
# Use specific provider
acai --provider google
# Generate in Spanish
acai --language es
Preview message
# Preview without committing option
auto-commit-ai --preview
# Preview including all changes
acai --preview --all
Interactive staging
# Select files for staging
acai --stage
📊 Repository information
# Repository status
acai --status
# Commit history
auto-commit-ai --history
# Branch information
acai --branches
🛠️ Advanced options
# Specific repository
auto-commit-ai --repo /path/to/repo
# Specific repository
auto-commit-ai --custom-prompts /path/to/custom_prompts.py
⚠️ DISCLAIMER for --custom-prompts flag: Use this flag by your own risk. It allows you to use custom prompts for commit message generation, but it may lead to unexpected results if the prompts are not properly formatted or tested. Check the custom_prompts_example.py file for an example of how to create your own prompts.
Output control
# Don't show status before commit
acai --no-status
# Verbose mode for debugging
acai --verbose
🌍 Supported languages
The system supports ISO 639-1 language codes:
en- English (default)es- Spanishfr- Frenchde- Germanit- Italianpt- Portugueseja- Japanesezh- Chineseru- Russian- And many more... As you use the ISO 639-1 codes, the system will adapt to your needs.
📋 Usage Examples
Typical workflow
# 1. Check repository status
acai --status
# 2. Interactive file staging
acai --stage
# 3. Preview message
acai --preview
# 4. Generate final commit
acai
Working with specific repository
# Work with another repository
acai --repo /path/to/project --status
acai --repo /path/to/project --all
🔄 Workflow
- Analysis: Detects repository changes (staged, unstaged, untracked)
- Generation: Uses AI to analyze diffs and generate descriptive message
- Review: Shows generated message for confirmation
- Commit: Creates commit with generated message
- Optional push: Offers to push automatically
📝 Message format
Generated messages follow best practices:
- Title: Concise line describing the main change
- Description: Additional details when necessary
- Conventions: Follows standards like Conventional Commits when appropriate
🚨 Error handling
The system gracefully handles:
- ❌ Non-Git repositories
- ❌ No changes to commit
- ❌ AI API errors
- ❌ Connectivity issues
- ❌ Incorrect configuration
📄 License
This project is licensed under the GNU General Public License v3.0. See LICENSE file for more details.
🆘 Support
To report bugs or request features, please open an issue on the GitHub repository.
Made with ❤️ for developers who value quality commits
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 auto_commit_ai-0.3.0.tar.gz.
File metadata
- Download URL: auto_commit_ai-0.3.0.tar.gz
- Upload date:
- Size: 36.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e72bd30482c1bf79c22e8a63e22875e37092b1be86b254f148e2b4b56d4cd2c
|
|
| MD5 |
6ba73cac9ca351e21476a404e27ea585
|
|
| BLAKE2b-256 |
a16004c4563547bb2efc1e79c9f262225272a105ad1abc5ef3660c2531df15c4
|
File details
Details for the file auto_commit_ai-0.3.0-py3-none-any.whl.
File metadata
- Download URL: auto_commit_ai-0.3.0-py3-none-any.whl
- Upload date:
- Size: 35.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71232d81d59bf359f45e6c26fe94ad60ad1139f0caa5b438d7690123056bb956
|
|
| MD5 |
0ce0cee41ca413f21d6500cc2e4bf4c6
|
|
| BLAKE2b-256 |
17cb5b4919d8a431a1113cec15180ec14148089749f5af9760c0927c87e85ac8
|