Skip to content

Repository files navigation

aic

AI-powered git commit message generator. Analyzes your staged or unstaged changes and writes conventional commit messages for you.

🌐 Website: https://caicoleung.github.io/aic-web/

CI Release License: MIT Changelog

Features

  • Multi-provider — OpenAI, Anthropic, Gemini, DeepSeek, Groq, xAI, Mistral, OpenRouter, Perplexity, Together, Ollama, and any OpenAI-compatible server
  • Batch commits — no staged files? aic splits your unstaged changes into logical atomic commits
  • Conflict resolution — mid-merge? aic resolve proposes per-file resolutions you review and approve, then finalizes the merge
  • Interactive setupaic setup walks you through provider, API key, and model selection
  • Conventional Commits — messages follow the Conventional Commits v1.0.0 spec
  • Configurable — config file, environment variables, or per-override

Installation

Binary (recommended)

macOS / Linux:

curl --proto '=https' --tlsv1.2 -sSfL https://github.com/CaicoLeung/aic/releases/latest/download/aic-installer.sh | sh

Windows (PowerShell):

irm https://github.com/CaicoLeung/aic/releases/latest/download/aic-installer.ps1 | iex

Homebrew

macOS / Linux:

brew tap CaicoLeung/aic
brew install aic

Update with brew upgrade aic. Homebrew installs are detected automatically, so aic update will redirect you to brew without modifying anything.

Build from source

git clone https://github.com/CaicoLeung/aic.git
cd aic
cargo build --release
# binary at target/release/aic

Quick Start

# 1. Configure your LLM provider
aic setup

# 2. Stage some files and commit
git add src/main.rs
aic
# → feat: add CLI argument parsing
#   Created commit abc1234

# Or run with no staging — aic batches unstaged changes automatically
aic

Usage

Command Description
aic Generate commit messages for staged files. If nothing is staged, batch-plan all unstaged changes into logical commits.
aic resolve Resolve git merge conflicts via the LLM. Proposes per-file resolutions to review, then finalizes the merge.
aic setup Interactive wizard to pick provider, enter API key, and select model.
aic list Show resolved config: provider, model, and where each value comes from (env / config / default).
aic update Update aic to the latest version from GitHub Releases.

Configuration

Config file: ~/.config/aic/config.toml

Environment variables

Variable Purpose Default
LLM_BACKEND Provider name openai
LLM_API_KEY API key (falls back to provider-specific vars)
LLM_MODEL Model ID override Provider default
LLM_BASE_URL Endpoint base URL (Ollama / OpenAI-compatible) Provider default
AIC_SYSTEM_PROMPT Override the commit message system prompt Built-in prompt

Provider-specific API key env vars (OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.) are also recognized.

Resolution order

For each of backend, api_key, model, and base_url:

  1. Generic env var (LLM_BACKEND, LLM_API_KEY, LLM_MODEL)
  2. Provider-specific env var (API key only)
  3. Config file (~/.config/aic/config.toml)
  4. Built-in default

Supported providers

Provider Default model Env key
OpenAI gpt-5-mini OPENAI_API_KEY
Anthropic claude-haiku-4-5 ANTHROPIC_API_KEY
Gemini gemini-2.5-flash GEMINI_API_KEY
DeepSeek deepseek-v4-flash DEEPSEEK_API_KEY
Groq llama-3.3-70b-versatile GROQ_API_KEY
xAI grok-4.3 XAI_API_KEY
Mistral mistral-small-latest MISTRAL_API_KEY
OpenRouter (model required) OPENROUTER_API_KEY
Perplexity sonar PERPLEXITY_API_KEY
Together meta-llama/Llama-3.3-70B-Instruct-Turbo TOGETHER_API_KEY
Ollama llama3.3 (no key; override URL via LLM_BASE_URL)
OpenAI-compatible (model required) (optional; set LLM_BASE_URL + LLM_MODEL)

OpenRouter and the OpenAI-compatible provider have no default model — set LLM_MODEL explicitly. The OpenAI-compatible provider also requires LLM_BASE_URL and routes through the OpenAI client against any server that speaks the OpenAI chat-completions API (LM Studio, vLLM, gateways).

How It Works

aic
  ├─ staged files? → diff staged files → LLM generates message → commit
  └─ no staged?    → diff workdir → LLM splits into batches → for each batch:
                        git add → LLM generates message → commit

aic resolve
  └─ conflicted repo? → for each conflicted file:
        LLM proposes a resolution → validate markers (retry once)
        → review diff → apply? [y/n] → git add
        → finalize (git --continue) when all resolved

All commit messages follow Conventional Commits (feat:, fix:, refactor:, etc.) with an optional body.

Resolving merge conflicts

Run aic resolve when your repo is mid-merge. It reads each conflicted file, proposes a marker-free resolution, shows you the diff, and asks apply? per file. Approve the ones you trust; the rest stay untouched. When nothing is left unmerged, it runs the merge's --continue for you.

You can also run plain aic in a conflicted repo — it notices and offers to hand off to resolve, and a commit guard blocks any commit that still carries conflict markers.

v1 limits: aic resolve handles conflicted merge state — a rebase or am in flight is detected and refused. Binary, oversized, and delete/modify conflicts are skipped with a reason for you to resolve by hand. Finalize is all-or-nothing: --continue blocks on any unmerged path, and the hand-off tells you exactly what's left.

Contributing

  • Run cargo fmt before committing
  • Run cargo clippy -- -D warnings and fix all warnings
  • Add tests for new behaviour in src/ or as integration tests in tests/

License

MIT

About

An AI-powered Rust CLI for generating git commit messages in bulk.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages