aicommit
A lightweight CLI that generates Conventional Commits messages and branch names from staged git diffs using AI.
English | 简体中文
Quick Start
Requires Node.js >= 20.
# 1. Install globally
npm install -g unique-aicommit
# 2. Run interactive setup (or configure manually / via env vars)
aicommit setup
# 3. Stage your changes and generate a commit message
git add .
aicommit
Usage
Generate a commit message
git add <files...>
aicommit
# Stage modified tracked files and commit immediately
aicommit -a -y
# Provide extra context for the AI
aicommit -c "fix Safari date parsing"
Interactive actions:
- Accept — commit directly with the generated message
- Edit — modify the message before committing
- Regenerate — request a new suggestion
- Cancel — abort
Generate and checkout a branch
aicommit branch
# shorthand
aicommit b
Pick a prefix (feat, fix, docs, chore, refactor, or none), preview the full branch name, and confirm to run git checkout -b.
Supported Providers
If an API key is not set in ~/.aicommitrc, aicommit falls back to the corresponding environment variable. If AI_PROVIDER is unset, it auto-detects the first provider with a configured key.
| Provider | Default Model | Config Key | Env Fallback | Get Key |
|---|---|---|---|---|
deepseek |
deepseek-chat |
DEEPSEEK_KEY |
DEEPSEEK_API_KEY |
DeepSeek |
moonshot |
moonshot-v1-8k |
MOONSHOT_KEY |
MOONSHOT_API_KEY |
Moonshot |
siliconflow |
Qwen/Qwen2.5-7B-Instruct |
SILICONFLOW_KEY |
SILICONFLOW_API_KEY |
SiliconFlow |
openai |
gpt-4o-mini |
OPENAI_KEY |
OPENAI_API_KEY |
OpenAI |
openrouter |
openai/gpt-4o-mini |
OPENROUTER_KEY |
OPENROUTER_API_KEY |
OpenRouter |
gemini |
gemini-2.0-flash |
GEMINI_KEY |
GEMINI_API_KEY / GOOGLE_API_KEY |
Google AI Studio |
groq |
llama-3.3-70b-versatile |
GROQ_KEY |
GROQ_API_KEY |
Groq |
anthropic |
claude-3-5-haiku-latest |
ANTHROPIC_KEY |
ANTHROPIC_API_KEY |
Anthropic |
ollama |
llama3.2 |
Not required | - | Ollama |
Local models with Ollama (no API key required)
aicommit config set AI_PROVIDER=ollama
aicommit config set AI_MODEL=llama3.2
Custom OpenAI-compatible endpoints (OneAPI, LM Studio, proxies)
aicommit config set AI_BASE_URL=https://api.example.com/v1
aicommit config set AI_MODEL=<model_name>
Configuration
Settings are stored in ~/.aicommitrc with 0600 file permissions.
aicommit config list # Show active configuration (keys are masked)
aicommit config get <key> # Read a single config value
aicommit config set <key>=<value> # Set a config value
aicommit config unset <key> # Remove a config value
Common options:
AI_PROVIDER— active provider (automatically resetsAI_MODELto that provider's default)AI_MODEL— override the default modelAI_BASE_URL— override the default API base URLAI_LOCALE— commit description language (default:en, e.g.zhfor Simplified Chinese)MAX_DIFF_CHARS— maximum diff characters sent to the model (default:32000)
Development
npm test
License
ISC · Inspired by aicommits