Aicommit2
A Reactive CLI that generates commit messages for Git and Jujutsu with Ollama, ChatGPT, Gemini, Claude, Mistral and other AI
Install / Use
/learn @tak-bro/Aicommit2Quality Score
Category
Development & EngineeringSupported Platforms
README
Table of Contents
- Quick start
- Introduction
- Key features
- Supported providers
- Setup
- How it works
- Version Control Systems
- Usage
- Integrations
- Configuration
- General Settings
- Logging
- Custom Prompt Template
- Code Review
- Watch Commit Mode
- Upgrading
- Contributing
Quick start
# Install via Homebrew (macOS/Linux)
brew install aicommit2
# Or install via npm
npm install -g aicommit2
# Set up AI providers (interactive wizard)
aicommit2 setup
# Or configure manually
aicommit2 config set OPENAI.key=<your-key>
# Use in your Git repository
git add .
aicommit2
# Also works with YADM and Jujutsu repositories (auto-detected)
yadm add <file>
aicommit2
Introduction
aicommit2 automatically generates commit messages using AI. It supports Git, YADM (Yet Another Dotfiles Manager), and Jujutsu (jj) repositories with automatic detection. AICommits inspired the core functionalities and architecture of this project.
Key features
- VCS Support: Works with Git, YADM, and Jujutsu repositories
- Multi-AI Support: Integrates with OpenAI, Anthropic Claude, Google Gemini, Mistral AI, Cohere, Groq, Ollama and more
- OpenAI API Compatibility: Support for any service that implements the OpenAI API specification
- Reactive CLI: Enables simultaneous requests to multiple AIs and selection of the best commit message
- Code Review: AI-powered structured code review with severity levels before committing
- Git Hook Integration: Can be used as a prepare-commit-msg hook
- Custom Prompt: Supports user-defined system prompt templates
Supported Providers
| Provider | Default Model | Documentation |
|----------|---------------|---------------|
| OpenAI | gpt-4o-mini | Guide |
| Anthropic | claude-sonnet-4-20250514 | Guide |
| Gemini | gemini-3-flash-preview | Guide |
| Mistral | mistral-small-latest | Guide |
| Codestral | codestral-latest | Guide |
| Cohere | command-a-03-2025 | Guide |
| Groq | llama-3.3-70b-versatile | Guide |
| Perplexity | sonar | Guide |
| DeepSeek | deepseek-chat | Guide |
| GitHub Models | gpt-4o-mini | Guide |
| Bedrock | anthropic.claude-haiku-4-5-20251001-v1:0 | Guide |
| Ollama | (user configured) | Guide |
📘 For OpenAI-compatible APIs, see Compatibility Guide
Setup
- Install aicommit2:
Via Homebrew (recommended for macOS/Linux):
brew install aicommit2
Via npm:
npm install -g aicommit2
⚠️ For npm installation, the minimum supported version of Node.js is v18. Check your Node.js version with
node --version.
- Configure your AI provider(s) (at least ONE provider must be configured):
Option A: Interactive setup wizard (recommended)
aicommit2 setup
👉 The setup wizard guides you through provider selection, API key entry, and model configuration in one step.
Option B: Manual configuration
aicommit2 config set OPENAI.key=<your key>
aicommit2 config set ANTHROPIC.key=<your key>
# ... (similar commands for other providers)
- Run aicommit2 in your Git or Jujutsu repository:
# For Git repositories
git add <files...>
aicommit2
# Works with Jujutsu too (auto-detected, no staging needed)
aicommit2
👉 Tip: Use the
aic2alias ifaicommit2is too long for you.
Alternative Installation Methods
Nix Installation
If you use the Nix package manager, aicommit2 can be installed directly using the provided flake:
# Install temporarily in your current shell
nix run github:tak-bro/aicommit2
# Install permanently to your profile
nix profile install github:tak-bro/aicommit2
# Use the shorter alias
nix run github:tak-bro/aic2 -- --help
Using in a Flake-based Project
Add aicommit2 to your flake inputs:
{
# flake.nix configuration file
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
aicommit2.url = "github:tak-bro/aicommit2";
};
# Rest of your flake.nix file
}
# Somewhere where you define your packages
{pkgs, inputs, ...}:{
environment.systemPackages = [inputs.aicommit2.packages.x86_64-linux.default];
# Or home packages
home.packages = [inputs.aicommit2.packages.x86_64-linux.default];
}
Development Environment
To enter a development shell with all dependencies:
nix develop github:tak-bro/aicommit2
After setting up with Nix, you'll still need to configure API keys as described in the Setup section.
From Source
git clone https://github.com/tak-bro/aicommit2.git
cd aicommit2
npm run build
npm install -g .
Via VSCode Devcontainer
Add feature to
your devcontainer.json file:
"features": {
"ghcr.io/kvokka/features/aicommit2:1": {}
}
How it works
This CLI tool runs git diff to grab all your latest code changes, sends them to configured AI, then returns the AI generated commit message.
If the diff becomes too large, AI will not function properly. If you encounter an error saying the message is too long or it's not a valid commit message, try reducing the commit unit.
Version Control Systems
Git (Primary)
# Standard Git workflow
git add <files>
aicommit2
- Uses
git diff --cachedfor staged changes - Supports all Git features and hooks
- Requires staging changes before commit
YADM Support
aicommit2 supports YADM (Yet Another Dotfiles Manager) for managing dotfiles:
# Standard YADM workflow
yadm add <files>
aicommit2
Features:
- Automatic detection of YADM repositories (prioritized before Git)
- Uses
yadmcommands instead ofgitfor all operations - Supports all YADM features including encryption and alternate files
- Works with dotfiles in
$HOMEdirectory - Hook installation:
aicommit2 hook install(installs to~/.config/yadm/hooks/) - Note: Watch mode (
--watch-commit) is not supported for YADM repositories
Installation:
# macOS
brew install yadm
# Linux
apt-get install yadm # Debian/Ubuntu
dnf install yadm # Fedora
# Initialize repository
yadm init
# or clone existing dotfiles
yadm clone <url>
Jujutsu Support
aicommit2 also supports Jujutsu (jj) repositories:
# Automatic jj detection (no staging needed)
aicommit2
# Force Git when both .jj and .git exist (for colocated repos)
FORCE_GIT=true aicommit2
# or
aicommit2 config set forceGit=true
Features:
- Automatic detection of
.jjrepositories (prioritized over Git since jj v0.34.0+ uses colocated repos) - Uses
jj describeto set commit message (does NOT runjj newby default) - Supports Jujutsu's fileset syntax for file exclusions
- Works seamlessly with colocated Git repositories
jj new Behavior:
By default, aicommit2 only runs jj describe to set the commit message, without creating a new changeset. This matches the workflow of many Jujutsu users who prefer to manually control when to run jj new.
To automatically run jj new after describing (mimics jj commit behavior):
# Via CLI flag
aicommit2 --jj-auto-new
# Or via config (persistent)
aicommit2 config set jjAutoNew=true
Installation:
# macOS
brew install jj
# Linux/Windows
cargo install jj-cli
# Initialize repository
jj init
Detection Priority
- CLI flags (highest priority - overrides everything):
--git: Force use Git--yadm: Force use YADM--jj: Force use Jujutsu
- Environment variables:
FORCE_GIT=true: Forces GitFORCE_YADM=true: Forces YADMFORCE_JJ=true: Forces Jujutsu 3
Related Skills
node-connect
335.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
82.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
335.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
triage-issue
82.5kTriage GitHub issues by analyzing and applying labels
