aicommit

A CLI tool that generates concise and descriptive git commit messages using LLMs (Large Language Models).
Features
Implemented Features
- โ Uses LLMs to generate meaningful commit messages from your changes
- โ Supports multiple LLM providers (OpenRouter, Ollama, OpenAI compatible api)
- โ Custom api keys for services through open router api (for google aistudio and etc) - go to https://openrouter.ai/settings/integrations and paste key from any of them: AI21, Amazon BedRock, Anthropic, AnyScale, Avian.io, Cloudflare, Cohere, DeepInfra, DeepSeek, Fireworks, Google AI Studio, Google Vertex, Hyperbolic, Infermatic, Inflection, Lambda, Lepton, Mancer, Mistral, NovitaAI, OpenAI, Perplexity, Recursal, SambaNova, SF Compute, Together, xAI
- โ Fast and efficient - works directly from your terminal
- โ Easy configuration and customization
- โ Transparent token usage and cost tracking
- โ Version management with automatic incrementation
- โ Version synchronization with Cargo.toml
- โ Version synchronization with package.json
- โ Provider management (add, list, set active)
- โ Interactive configuration setup
- โ Configuration file editing
- โ
Add all to stash functionality (
aicommit --add) - โ
Auto push functionality (
aicommit --push) - โ
Auto pull functionality (
aicommit --pull) - โ
Interactive commit message generation (
aicommit --dry-run) - โ Basic .gitignore file checks and management (create ~/.default_gitignore and use it as template if there is no .gitignore in this directory)
- โ
Watch mode (
aicommit --watch 1m) - โ
Watch with edit delay (
aicommit --watch 1m --wait-for-edit 30s) - โ OpenAI compatible API support
- โ
Help information display (
aicommit --help)
Planned Features
- ๐ง Tests for each feature to prevent breaking changes
- ๐ง Split commits by file (
aicommit --by-file) - ๐ง Split commits by feature (
aicommit --by-feature) - ๐ง Version management for multiple languages (requirements.txt, etc.)
- ๐ง Version management with git tag
- ๐ง Branch safety checks for push operations
- ๐ง Support for cross-compilation (ARM, AARCH64, etc.)
- ๐ง Installation from binary
- ๐ง Publication management
- ๐ง Publication in brew/macports
- ๐ง Publication in apt/apk/yum/pacman
- ๐ง Publication in npm
- ๐ง Publication in other package managers
- ๐ง Support for submodules
- ๐ง Support for mercurial
Legend:
- โ Implemented
- ๐ง Planned
- ๐งช Has tests
Installation
There are several ways to install aicommit:
Using Cargo (Rust package manager)
If you have Rust installed:
Using npm/npx
# Run without installation
# Or install globally
Manual Installation
Download Pre-built Binaries
You can download pre-built binaries from the GitHub Releases page.
Available builds:
- Linux (x86_64, ARM64)
- macOS (Intel x86_64, Apple Silicon ARM64)
- Windows (x86_64, ARM64)
Linux/macOS:
# 1. Download and extract (replace VERSION and ARCH with appropriate values)
# Example for Linux x86_64:
# Example for macOS ARM64:
# Example for macOS x86_64:
# 2. Make it executable
# 3. Move to a directory in your PATH (optional)
Windows:
- Download the ZIP file for your architecture
- Extract the executable
- Add the directory to your PATH or move the executable to a directory in your PATH
Build from Source
If you want to build the latest version from source:
# 1. Clone the repository
# 2. Build and install
Requirements for building from source:
- Rust toolchain (install from rustup.rs)
- A C compiler (gcc, clang, or MSVC)
- OpenSSL development packages (on Linux)
Quick Start
-
Add a provider (choose one method):
Interactive mode:
Non-interactive mode (example with OpenRouter):
-
Make some changes to your code
-
Create a commit:
# Commit only staged changes (files added with git add) # Automatically stage and commit all changes # Stage all changes, commit, and push
Provider Management
Add a provider in interactive mode:
Add providers in non-interactive mode:
# Add OpenRouter provider
# Add Ollama provider
# Add OpenAI compatible provider
Optional parameters for non-interactive mode:
--max-tokens- Maximum number of tokens (default: 50)--temperature- Controls randomness (default: 0.3)
List all configured providers:
Set active provider:
Version Management
aicommit supports automatic version management with the following features:
- Automatic version incrementation using a version file:
- Synchronize version with Cargo.toml:
- Synchronize version with package.json:
- Update version on GitHub (creates a new tag):
You can combine these flags to update multiple files at once:
Configuration
The configuration file is stored at ~/.aicommit.json. You can edit it directly with:
Provider Configuration
Each provider can be configured with the following settings:
max_tokens: Maximum number of tokens in the response (default: 50)temperature: Controls randomness in the response (0.0-1.0, default: 0.3)
For OpenRouter, token costs are automatically fetched from their API. For Ollama, you can specify your own costs if you want to track usage.
Supported LLM Providers
OpenRouter
Recommended Providers through OpenRouter
- ๐ Google AI Studio - 1000000 tokens for free
- "google/gemini-2.0-flash-exp:free"
- ๐ DeepSeek
- "deepseek/deepseek-chat"
Ollama
OpenAI-compatible API
For example, you can use DeepGPTBot's OpenAI-compatible API for generating commit messages. Here's how to set it up:
-
Get your API key from Telegram:
- Open @DeepGPTBot in Telegram
- Use the
/apicommand to get your API key
-
Configure aicommit (choose one method):
Interactive mode:
Select "OpenAI Compatible" and enter:
- API Key: Your key from @DeepGPTBot
- API URL: https://api.deep-foundation.tech/v1/chat/completions
- Model: gpt-4o-mini
- Max tokens: 50 (default)
- Temperature: 0.3 (default)
Non-interactive mode:
-
Start using it:
Usage Information
When generating a commit message, the tool will display:
- Number of tokens used (input and output)
- Total API cost (calculated separately for input and output tokens)
Example output:
Generated commit message: Add support for multiple LLM providers
Tokens: 8โ 32โ
API Cost: $0.0100
You can have multiple providers configured and switch between them by changing the active_provider field to match the desired provider's id.
Staging Changes
By default, aicommit will only commit changes that have been staged using git add. To automatically stage all changes before committing, use the --add flag:
# Only commit previously staged changes
# Automatically stage and commit all changes
# Stage all changes, commit, and push
# Stage all changes, pull before commit, and push after
Watch Mode
The watch mode allows you to automatically commit changes at specified intervals. This is useful for:
- Automatic backups of your work
- Maintaining a detailed history of changes
- Not forgetting to commit your changes
Basic Watch Mode
Watch with Edit Delay
You can add a delay after the last edit before committing. This helps avoid creating commits while you're still actively editing files:
Time Units
s: secondsm: minutesh: hours
Additional Options
You can combine watch mode with other flags:
# Watch with auto-push
# Watch with version increment
# Interactive mode with watch
Tips
- Use shorter intervals (30s-1m) for active development sessions
- Use longer intervals (5m-15m) for longer coding sessions
- Add
--wait-for-editwhen you want to avoid partial commits - Use
Ctrl+Cto stop watching
License
This project is licensed under the MIT License - see the LICENSE file for details.