
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
aicommit2
Advanced tools
A Reactive CLI that generates commit messages for Git and Jujutsu with various AI
A Reactive CLI that generates commit messages for Git, YADM, and Jujutsu with Ollama, ChatGPT, Gemini, Claude, Mistral, and other AI
# 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
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.
| Provider | Default Model | Documentation |
|---|---|---|
| OpenAI | gpt-4o-mini | Guide |
| OpenRouter | openrouter/auto | 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
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.
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)
# 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.
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
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];
}
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.
git clone https://github.com/tak-bro/aicommit2.git
cd aicommit2
npm run build
npm install -g .
Add feature to
your devcontainer.json file:
"features": {
"ghcr.io/kvokka/features/aicommit2:1": {}
}
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.
# Standard Git workflow
git add <files>
aicommit2
git diff --cached for staged changesaicommit2 supports YADM (Yet Another Dotfiles Manager) for managing dotfiles:
# Standard YADM workflow
yadm add <files>
aicommit2
Features:
yadm commands instead of git for all operations$HOME directoryaicommit2 hook install (installs to ~/.config/yadm/hooks/)--watch-commit) is not supported for YADM repositoriesInstallation:
# 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>
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:
.jj repositories (prioritized over Git since jj v0.34.0+ uses colocated repos)jj describe to set commit message (does NOT run jj new by default)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
--git: Force use Git--yadm: Force use YADM--jj: Force use JujutsuFORCE_GIT=true: Forces GitFORCE_YADM=true: Forces YADMFORCE_JJ=true: Forces Jujutsuaicommit2 config set forceGit=true (forces Git)Sometimes you may want to use a specific VCS even when multiple are available:
# Use YADM in a directory that has both .git and YADM tracking
cd ~/my-project # Has .git directory
aicommit2 --yadm # Forces YADM usage instead of Git
# Use Git explicitly
aicommit2 --git
# Use Jujutsu explicitly
aicommit2 --jj
You can call aicommit2 directly to generate a commit message for your staged changes:
git add <files...>
aicommit2
aicommit2 passes down unknown flags to git commit, so you can pass in commit flags.
For example, you can stage all changes in tracked files as you commit:
aicommit2 --all # or -a
Run aicommit2 --help to see all available options grouped by category.
--locale or -l: Locale to use for the generated commit messages (default: en)--generate or -g: Number of messages to generate (default: 1)
--type or -t: Git commit message format (default: conventional). It supports conventional and gitmoji--prompt or -p: Custom prompt to fine-tune the AI generation--include-body or -i: Force include commit body in all generated messages (default: false)--all or -a: Automatically stage changes in tracked files for the commit (default: false)--confirm or -y: Skip confirmation when committing after message generation (default: false)--auto-select or -s: Automatically select when only one message is generated (default: false)--edit or -e: Open the AI-generated commit message in your default editor (default: false)--clipboard or -c: Copy the selected message to clipboard and exit without committing (default: false)--dry-run or -d: Generate commit message without committing (default: false)
--output or -o: Output format for non-interactive mode (default: none)
--output json for LazyGit integration--git: Force use Git (overrides auto-detection)--yadm: Force use YADM (overrides auto-detection)--jj: Force use Jujutsu (overrides auto-detection)--jj-auto-new: Run jj new after jj describe (default: false)--hook-mode: Run as a Git hook with prepare-commit-msg (default: false)--pre-commit: Run in pre-commit framework mode (default: false)--exclude or -x: Files to exclude from AI analysis--disable-lowercase: Preserve original casing of commit messages (default: false)--verbose or -v: Enable verbose logging for debugging (default: false)Examples:
# Generate multiple commit messages with clipboard and file exclusions
aicommit2 --locale "jp" --all --type "conventional" --generate 3 --clipboard --exclude "*.json" --exclude "*.ts"
# Generate and edit a commit message
aicommit2 --edit --type conventional # or gitmoji
# Generate message without committing (dry-run)
aicommit2 --dry-run # or -d
# Dry-run with clipboard (generate, select, then copy)
aicommit2 -d -c
# Enable verbose logging for debugging
aicommit2 --verbose # or -v
In addition to the main commit message generation, aicommit2 provides several utility commands:
| Command | Description |
|---|---|
aicommit2 setup | Interactive setup wizard for configuring AI providers |
aicommit2 config | Manage configuration (get, set, list, del) |
aicommit2 doctor | Check health status of AI providers |
aicommit2 stats | View usage statistics and performance metrics |
aicommit2 hook | Install/uninstall Git prepare-commit-msg hook |
aicommit2 log | Manage log files |
aicommit2 github-login | Login to GitHub for GitHub Models access |
# Interactive setup wizard
aicommit2 setup
# Configuration management
aicommit2 config set OPENAI.key=<your-key>
aicommit2 config get OPENAI
aicommit2 config list
# Health check
aicommit2 doctor
# Statistics
aicommit2 stats
aicommit2 stats -d 7 # Last 7 days
aicommit2 stats clear # Clear all stats
# Git hook
aicommit2 hook install
aicommit2 hook uninstall
aicommit2 supports non-interactive JSON output mode for seamless integration with LazyGit.
Use the --output json flag to get AI-generated commit messages in JSON Lines format:
aicommit2 --output json
# Output: {"subject":"feat: add user authentication","body":""}
# Output: {"subject":"fix: resolve login bug","body":"Fixes issue with session handling"}
Each line is a separate JSON object with subject and body fields, compatible with LazyGit's menuFromCommand prompt type.
Add the following to your LazyGit config file (~/.config/lazygit/config.yml or ~/Library/Application Support/lazygit/config.yml on macOS):
customCommands:
# Quick commit with AI-generated subject (c in files panel)
- key: "c"
context: "files"
description: "Generate commit message with aicommit2"
prompts:
- type: "menuFromCommand"
title: "Select commit message"
key: "Commit"
command: "aicommit2 --output json"
filter: '"subject":"(?P<subject>[^"]+)","body":"(?P<body>[^"]*)"'
valueFormat: '{{ .subject }}<SEP>{{ .body }}'
labelFormat: '{{ .subject }}'
output: "terminal"
command: bash -c 'MSG="{{ .Form.Commit }}" && SUBJ="${MSG%%<SEP>*}" && BODY="${MSG#*<SEP>}" && git commit -e -m "$SUBJ" ${BODY:+-m "$BODY"}'
Note: This overrides LazyGit's default
c(commit) key. You can change the key to another value (e.g.,<c-a>) if you prefer to keep the default behavior.
c to generate AI commit messages and select oneFor detailed commit messages with subject + body, use the fzf-based approach. This uses --include-body (-i) flag to generate detailed body content and shows a preview window before committing.
Requirements: jq and fzf must be installed (brew install jq fzf).
First, create the script file at ~/.config/lazygit/scripts/aicommit_fzf.sh (or ~/Library/Application Support/lazygit/scripts/ on macOS):
#!/usr/bin/env bash
set -euo pipefail
for cmd in aicommit2 jq fzf; do
if ! command -v "$cmd" >/dev/null 2>&1; then
echo "$cmd is required"
exit 1
fi
done
results_file="$(mktemp -t lazygit-aicommit-results.XXXXXX)"
trap 'rm -f "$results_file"' EXIT INT TERM
selected="$(
echo | fzf \
--prompt="AI commit> " \
--header="Select a message" \
--height=100% \
--layout=reverse \
--info=inline \
--with-nth=2.. \
--delimiter=$'\t' \
--with-shell="bash --noprofile --norc -c" \
--preview-window="right:60%:wrap" \
--preview "jq -r '.[ {1} ] | \"\(.subject)\n\n\(.body)\"' $results_file" \
--bind "load:unbind(load)+reload-sync#aicommit2 -i --output json 2>/dev/null | jq -s '.' > $results_file && jq -r 'to_entries[] | \"\\(.key)\\t\\(.value.subject)\"' $results_file#"
)" || exit 0
[ -n "$selected" ] || exit 0
index="${selected%%$'\t'*}"
subject="$(jq -r ".[$index].subject" "$results_file")"
body="$(jq -r ".[$index].body" "$results_file")"
git commit -e -m "$subject" -m "$body"
Make it executable: chmod +x ~/.config/lazygit/scripts/aicommit_fzf.sh
Then add this to your LazyGit config:
customCommands:
# Long commit with fzf preview (Shift+C in files panel)
- key: "C"
context: "files"
description: "Generate commit message (long) with aicommit2"
output: "terminal"
command: "/path/to/aicommit_fzf.sh" # Update with your script path
Thanks to @peinan for this configuration! See the original discussion and dotfiles (config.yml, aicommit_fzf.sh) for reference.
You can integrate aicommit2 with Git via the prepare-commit-msg hook. This lets you use Git like you normally would, and edit the commit message before committing.
In the Git repository you want to install the hook in:
aicommit2 hook install
If you prefer to set up the hook manually, create or edit the .git/hooks/prepare-commit-msg file:
#!/bin/sh
# your-other-hook "$@"
aicommit2 --hook-mode "$@"
Make the hook executable:
chmod +x .git/hooks/prepare-commit-msg
core.hooksPathIf you are using husky or have configured a custom core.hooksPath, update the corresponding hooks file instead. For Husky users, this file is .husky/prepare-commit-message.
If you're using the pre-commit framework, you can add aicommit2 to your .pre-commit-config.yaml:
repos:
- repo: local
hooks:
- id: aicommit2
name: AI Commit Message Generator
entry: aicommit2 --pre-commit
language: node
stages: [prepare-commit-msg]
always_run: true
Make sure you have:
brew install pre-commitnpm install -g aicommit2pre-commit install --hook-type prepare-commit-msg to set up the hookNote: The
--pre-commitflag is specifically designed for use with the pre-commit framework and ensures proper integration with other pre-commit hooks.
In the Git repository you want to uninstall the hook from:
aicommit2 hook uninstall
Or manually delete the .git/hooks/prepare-commit-msg file.
Use the doctor command to check the status of your configured AI providers:
aicommit2 doctor
Example output:
π©Ί aicommit2 Health Check
Providers:
β
OPENAI API key configured
β
OLLAMA Running (Host: http://localhost:11434)
βοΈ ANTHROPIC Not configured
β οΈ GEMINI API key configured
Summary: 2 healthy, 0 error, 1 warning, 1 skipped
Status icons:
Use the stats command to view AI request statistics and performance metrics:
aicommit2 stats
Example output:
π aicommit2 Statistics
Period: 3/16/2026 - 3/17/2026
Overview:
Total requests: 144
Success rate: 60.4%
Avg response time: 1.3s
Provider Usage:
Provider Rate Bar Cnt Selected Time
GROQ 100% ββββββββββββββββββββ 48 1 (2.1%) 732ms
OPENAI 0% ββββββββββββββββββββ 46 0 514ms
GITHUB_MODELS 96% ββββββββββββββββββββ 25 0 2.0s
GEMINI 29% ββββββββββββββββββββ 14 0 2.8s
Columns:
Options:
aicommit2 stats -d 7 - Show statistics for the last 7 daysaicommit2 stats clear - Clear all statisticsStatistics are stored locally at ~/.config/aicommit2/stats.json. Use aicommit2 stats clear to reset.
aicommit2 supports configuration via command-line arguments, environment variables, and a configuration file. Settings are resolved in the following order of precedence:
aicommit2 follows the XDG Base Directory Specification for its configuration file. The configuration file is named config.ini and is in INI format. It is resolved in the following order of precedence:
AICOMMIT_CONFIG_PATH environment variable: If this environment variable is set, its value is used as the direct path to the configuration file.$XDG_CONFIG_HOME/aicommit2/config.ini: This is the primary XDG-compliant location. If $XDG_CONFIG_HOME is not set, it defaults to ~/.config/aicommit2/config.ini.~/.aicommit2: This is a legacy location maintained for backward compatibility.The first existing file found in this order will be used. If no configuration file is found, aicommit2 will default to creating a new config.ini file in the $XDG_CONFIG_HOME/aicommit2/ directory.
You can find the path of the currently loaded configuration file using the config path command:
aicommit2 config path
You can use environment variables in your configuration file values. Both $VAR and ${VAR} syntax are supported.
Example config.ini:
[OPENAI]
key=$OPENAI_API_KEY
url=${CUSTOM_API_URL}/v1
OpenRouter example:
logging=true
generate=1
locale=ru
maxTokens=4096
temperature=0.2
[OPENROUTER]
envKey=OPENROUTER_BASE_TOKEN
model=stepfun/step-3.5-flash:free
url=https://openrouter.ai
path=/api/v1/chat/completions
systemPromptPath=prompts/aicommit_prompt.txt
responseFormat.type=json_object
provider.allow_fallbacks=true
provider.require_parameters=false
If systemPromptPath is relative, it is resolved relative to the config file
location.
Nested OpenRouter objects such as responseFormat and provider can be written
directly in config.ini using dotted keys, or set with JSON via aicommit2 config set.
aicommit2 config get [<key> [<key> ...]]aicommit2 config set <key>=<value>aicommit2 config del <config-name>Example:
# Get all configurations
aicommit2 config get
# Get specific configuration
aicommit2 config get OPENAI
aicommit2 config get GEMINI.key
# Set configurations
aicommit2 config set OPENAI.generate=3 GEMINI.temperature=0.5
# Delete a configuration setting or section
aicommit2 config del OPENAI.key
aicommit2 config del GEMINI
aicommit2 config del timeout
You can configure API keys using environment variables. This is particularly useful for CI/CD environments or when you don't want to store keys in the configuration file.
# OpenAI
OPENAI_API_KEY="your-openai-key"
# Anthropic
ANTHROPIC_API_KEY="your-anthropic-key"
# Google
GEMINI_API_KEY="your-gemini-key"
# Mistral AI
MISTRAL_API_KEY="your-mistral-key"
CODESTRAL_API_KEY="your-codestral-key"
# Other Providers
COHERE_API_KEY="your-cohere-key"
GROQ_API_KEY="your-groq-key"
PERPLEXITY_API_KEY="your-perplexity-key"
DEEPSEEK_API_KEY="your-deepseek-key"
Note: You can customize the environment variable name used for the API key with the
envKeyconfiguration property for each service.
Usage Example:
OPENAI_API_KEY="your-openai-key" ANTHROPIC_API_KEY="your-anthropic-key" aicommit2
Note: Environment variables take precedence over configuration file settings.
aicommit2 offers flexible configuration options for all AI services, including support for specifying multiple models. You can configure settings via command-line arguments, environment variables, or a configuration file.
Command-line arguments: Use the format --[Model].[Key]=value.
To specify multiple models, use the --[Model].model=model1,model2 format.
aicommit2 --OPENAI.locale="jp" --GEMINI.temperature="0.5" --OPENAI.model="gpt-4o-mini,gpt-3.5-turbo"
Configuration file: Refer to Configuration File Location or use the set command.
For array-like values like model, you can use either the model=model1,model2 comma-separated syntax or the model[]= syntax for multiple entries. This applies to all AI services.
# General Settings
logging=true
generate=2
temperature=1.0
# Model-Specific Settings
[OPENAI]
key="<your-api-key>"
temperature=0.8
generate=1
model="gpt-4o-mini,gpt-3.5-turbo"
systemPromptPath="<your-prompt-path>"
[GEMINI]
key="<your-api-key>"
generate=5
includeBody=true
model="gemini-3-flash-preview,gemini-3.1-pro-preview"
[OLLAMA]
temperature=0.7
model[]=llama3.2
model[]=codestral
The priority of settings is: Command-line Arguments > Environment Variables > Model-Specific Settings > General Settings > Default Values.
aicommit2 config set \
generate=2 \
topP=0.8 \
maxTokens=1024 \
temperature=0.7 \
OPENAI.key="sk-..." OPENAI.model="gpt-4o-mini" OPENAI.temperature=0.5 \
ANTHROPIC.key="sk-..." ANTHROPIC.model="claude-sonnet-4-20250514" ANTHROPIC.maxTokens=2000 \
MISTRAL.key="your-key" MISTRAL.model="mistral-small-latest" \
OLLAMA.model="llama3.2" OLLAMA.numCtx=4096 OLLAMA.watchMode=true
π Detailed Support Info: Check each provider's documentation for specific limits and behaviors:
For detailed information about all available settings, see the General Settings documentation.
| Setting | Description | Default |
|---|---|---|
locale | Locale for the generated commit messages | en |
generate | Number of commit messages to generate | 1 |
type | Type of commit message (conventional / gitmoji) | conventional |
maxLength | Maximum character length of the commit subject | 50 |
timeout | Request timeout (milliseconds) | 10000 |
temperature | Model's creativity (0.0 - 2.0) | 0.7 |
maxTokens | Maximum number of tokens to generate | 1024 |
includeBody | Whether the commit message includes body | false |
codeReview | Enable automated code review before commit | false |
codeReviewPromptPath | Path to custom code review prompt file | - |
autoCopy | Auto-copy commit message to clipboard (commits normally) | false |
useStats | Enable usage statistics tracking | true |
statsDays | Days to retain statistics data (auto-cleanup) | 30 |
systemPromptPath | Path to custom system prompt file | - |
stream | Experimental. Enable streaming for real-time commit message generation | false |
# Example: Set settings for a specific model
aicommit2 config set OPENAI.locale="jp"
aicommit2 config set GEMINI.temperature=0.5
aicommit2 config set ANTHROPIC.includeBody=true
π For all settings and detailed explanations, see docs/settings.md
| timeout | temperature | maxTokens | topP | stream | |
|---|---|---|---|---|---|
| OpenAI | β | β | β | β | β |
| Anthropic Claude | β | β | β | β | β |
| Gemini | β | β | β | β | |
| Mistral AI | β | β | β | β | |
| Codestral | β | β | β | β | |
| Cohere | β | β | β | β | |
| Groq | β | β | β | β | β |
| Perplexity | β | β | β | β | |
| DeepSeek | β | β | β | β | β |
| Github Models | β | β | β | β | |
| Ollama | β | β | β | β | |
| OpenAI API-Compatible | β | β | β | β | β |
The application utilizes two distinct logging systems to provide comprehensive insights into its operations:
This system handles general application logs and exceptions. Its behavior can be configured through the following settings in your config.ini file:
logLevel:
logLevel will be captured.infoerror, warn, info, http, verbose, debug, sillylogFilePath:
%DATE%) to automatically rotate log files daily.logs/aicommit2-%DATE%.log (relative to the application's state directory, typically ~/.local/state/aicommit2/logs on Linux or ~/Library/Application Support/aicommit2/logs on macOS).exceptionLogFilePath:
logFilePath, it supports date patterns for daily rotation.logs/exceptions-%DATE%.log (relative to the application's state directory, typically ~/.local/state/aicommit2/logs on Linux or ~/Library/Application Support/aicommit2/logs on macOS).This system is specifically designed to log the prompts and responses exchanged with AI models for review and commit generation. These logs are stored in the application's dedicated logs directory.
~/.local/state/aicommit2/logs on Linux or ~/Library/Application Support/aicommit2/logs on macOS).YYYY-MM-DD_HH-MM-SS) and a hash of the git diff content, ensuring easy identification and chronological order.The logging setting controls whether log files are generated. It can be configured both globally and for individual AI services:
logging setting: When set in the general configuration, it controls the overall application logging (handled by Winston) and acts as a default for AI request/response logging.logging setting: You can override the global logging setting for a particular AI service. If logging is set to false for a specific service, AI request/response logs will not be generated for that service, regardless of the global setting.aicommit2 generates detailed logs for debugging and tracking AI requests. You can manage these log files using the built-in log commands:
# List all log files with details
aicommit2 log list
# Show logs directory path
aicommit2 log path
# Open logs directory in your file manager
aicommit2 log open
# Remove all log files
aicommit2 log removeAll
~/.local/state/aicommit2/logs on Linux/macOS)aicommit2 supports custom prompt templates through the systemPromptPath option. This feature allows you to define your own prompt structure, giving you more control over the commit message generation process.
To use a custom prompt template, specify the path to your template file when running the tool:
aicommit2 config set systemPromptPath="/path/to/user/prompt.txt"
aicommit2 config set OPENAI.systemPromptPath="/path/to/another-prompt.txt"
For the above command, OpenAI uses the prompt in the another-prompt.txt file, and the rest of the model uses prompt.txt.
NOTE: For the
systemPromptPathoption, set the template path, not the template content
Your custom template can include placeholders for various commit options.
Use curly braces {} to denote these placeholders for options. The following placeholders are supported:
{locale}: The language for the commit message (default: en){maxLength}: The maximum length for the commit message (default: 50){type}: The type of the commit message (conventional or gitmoji){generate}: The number of commit messages to generate (default: 1)Here's an example of how your custom template might look:
Generate a {type} commit message in {locale}.
The message should not exceed {maxLength} characters.
Please provide {generate} messages.
Remember to follow these guidelines:
1. Use the imperative mood
2. Be concise and clear
3. Explain the 'why' behind the change
Please note that the following text will ALWAYS be appended to the end of your custom prompt:
Lastly, Provide your response as a JSON array containing exactly {generate} object, each with the following keys:
- "subject": The main commit message using the {type} style. It should be a concise summary of the changes.
- "body": An optional detailed explanation of the changes. If not needed, use an empty string.
- "footer": An optional footer for metadata like BREAKING CHANGES. If not needed, use an empty string.
The array must always contain {generate} element, no more and no less.
Example response format:
[
{
"subject": "fix: fix bug in user authentication process",
"body": "- Update login function to handle edge cases\n- Add additional error logging for debugging",
"footer": ""
}
]
Ensure you generate exactly {generate} commit message, even if it requires creating slightly varied versions for similar changes.
The response should be valid JSON that can be parsed without errors.
This ensures that the output is consistently formatted as a JSON array, regardless of the custom template used.
aicommit2 includes an AI-powered code review feature that analyzes your staged changes before generating commit messages. When enabled, it provides structured feedback with severity levels and actionable suggestions.
# Enable globally
aicommit2 config set codeReview=true
# Or enable for specific providers only
aicommit2 config set OPENAI.codeReview=true
aicommit2 config set ANTHROPIC.codeReview=true
When codeReview is enabled, the commit flow becomes:
git add)Reviews are organized by severity and category:
critical, warning, suggestion, praisebug, security, performance, style, maintainability, otherEach review item includes a title, description, file reference, and concrete suggestion for improvement. When critical issues are found, the confirmation prompt defaults to "No" to encourage fixing before committing.
You can customize the code review prompt using a template file:
aicommit2 config set codeReviewPromptPath="/path/to/review-prompt.txt"
aicommit2 config set OPENAI.codeReviewPromptPath="/path/to/another-prompt.txt"
The template supports the same {locale}, {type}, {generate}, {maxLength} placeholders as the commit prompt.
NOTE: When using a custom review prompt, the response format is plain text (not structured JSON). The structured severity/category output is only available with the default prompt.
WARNING: Code review runs in addition to commit message generation, which means API token usage roughly doubles per commit. If multiple providers have
codeReviewenabled, each provider performs its own review. Monitor your token usage carefully, especially with large diffs.

Watch Commit mode allows you to monitor Git commits in real-time and automatically perform AI code reviews using the --watch-commit flag.
aicommit2 --watch-commit
This feature only works within Git repository directories and automatically triggers whenever a commit event occurs. When a new commit is detected, it automatically:
For detailed configuration of the code review feature, please refer to the codeReview section. The settings in that section are shared with this feature.
β οΈ CAUTION
aicommit2 config set [MODEL].watchMode="true"
Check the installed version with:
aicommit2 --version
If it's not the latest version, run:
# Via Homebrew
brew upgrade aicommit2
# Via npm
npm update -g aicommit2
This project uses functionalities from external APIs but is not officially affiliated with or endorsed by their providers. Users are responsible for complying with API terms, rate limits, and policies.
For bug fixes or feature implementations, please check the Contribution Guide.
Thanks goes to these wonderful people (emoji key):
If this project has been helpful, please consider giving it a Star βοΈ!
Maintainer: @tak-bro
FAQs
A Reactive CLI that generates commit messages for Git and Jujutsu with various AI
We found that aicommit2 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the projectβs GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.