@ai-git/cli
v3.1.0
Published
AI-powered git commit message generator
Maintainers
Readme
AI Git
A CLI tool that leverages AI to automatically generate semantically correct, conventional commits compliant git messages.
Features
- 🤖 AI-Powered - Analyzes diffs and understands the intent of your changes
- 📝 Conventional Commits - Strictly adheres to v1.0.0 specification
- 🎨 Interactive TUI - Beautiful prompts for staging, editing, and confirming
- 🔌 Multiple Providers - Claude Code, Antigravity CLI, Codex, OpenCode, Pi, OpenRouter, OpenAI, Anthropic, Google AI Studio, Cerebras
- 🔐 Secure - API keys stored in keychain, never in config files
Installation
npm (Recommended)
npm install -g @ai-git/cliAlso works with
bun,pnpm, andyarn.
Homebrew (macOS)
brew install sadiksaifi/tap/ai-gitShell Script (macOS/Linux)
curl -fsSL https://ai-git.xyz/install | bashBuild from Source
git clone https://github.com/sadiksaifi/ai-git.git
cd ai-git
bun install
bun run buildQuick Start
Run ai-git in any git repository:
ai-gitOn first run, you'll be guided through a quick setup wizard to choose your AI provider.
Settings are saved to ~/.config/ai-git/config.json
Reconfigure:
ai-git configureSelf-update:ai-git upgrade
Usage
CLI Reference
$ ai-git --help
Usage:
$ ai-git [command] [options]
AI-powered Conventional Commits
Commands:
configure Set up AI provider and model
upgrade Update ai-git to the latest version
Model:
--provider <id> Use a specific AI provider for this run
--model <id> Use a specific model for this run
Workflow:
-A, --stage-all Stage all changes before generating
-C, --commit Commit without confirmation
-P, --push Push to remote after committing
-H, --hint <text> Guide the AI with additional context
-X, --exclude <pattern> Skip files when staging (glob, regex, or path)
--dangerously-auto-approve Stage, commit, and push without prompts
--dry-run Preview the prompt without calling the AI
Info:
-v, --version Show version
-h, --help Show helpExamples
# Use configured defaults
ai-git
# Override provider for this run
ai-git --provider antigravity-cli --model gemini-3.8-flash-low
# Use Codex with a reasoning effort
ai-git --provider codex --model gpt-6.1-sol#low
# Use Claude Code with an effort level
ai-git --provider claude-code --model haiku#low
# Use Pi with a thinking level
ai-git --provider pi --model openai-codex/gpt-6.1-sol#low
# Use OpenRouter
ai-git --provider openrouter --model anthropic/claude-sonnet-5-5
# Exclude files/directories from staging
ai-git -A --exclude "tests/" --exclude "*.test.ts"
# Automated (Be careful!)
ai-git --dangerously-auto-approve --hint "Refactored authentication module"
# Dry run works without installed provider CLI/API key
ai-git --dry-run -ASupported Providers
| Provider | ID | Type | Requirements |
| :--------------- | :------------------ | :--- | :-------------------------------------------------------------------------------------- |
| Claude Code | claude-code | CLI | Install CLI |
| Antigravity CLI | antigravity-cli | CLI | Install CLI |
| Codex | codex | CLI | Install CLI |
| OpenCode | opencode | CLI | Install CLI |
| Pi | pi | CLI | Install CLI |
| OpenRouter | openrouter | API | Get API Key |
| OpenAI | openai | API | Get API Key |
| Google AI Studio | google-ai-studio | API | Get API Key |
| Anthropic | anthropic | API | Get API Key |
| Cerebras | cerebras | API | Get API Key |
Configure with ai-git configure
AI Git ships with no hardcoded model list. When you run ai-git configure, it asks each tool
what it can run right now, so new models show up without an AI Git release:
- Codex reads
codex debug models, the same catalog Codex uses for its own model picker. It recommends Codex's first-listed model at its lowest effort. - Claude Code has no model listing command, so AI Git builds the choices from the
models.dev Anthropic catalog: one entry per current family alias
(
haiku,sonnet, and so on) for each effort level thatclaude --helpaccepts. It recommends the cheapest family at its lowest effort. - OpenCode lists each model's variants through
opencode api model.list. It needs OpenCode 2.2.6 or newer. - Pi reports each model's thinking levels through its RPC mode.
- Antigravity CLI and the API providers list models from the CLI or API.
Model IDs with an effort or variant use <model>#<effort>. Older Codex and Claude Code IDs such as
gpt-5.6-luna-low and sonnet-high keep working.
Antigravity generation runs with --sandbox in an empty workspace and an isolated temporary
profile. AI Git installs deny-all permissions and a deny-all tool hook for the invocation, disables
slash-command expansion, validates structured output, and removes the temporary conversation data
afterward.
OpenCode generation starts a private OpenCode server in an empty directory under AI Git's cache. AI
Git passes an agent that denies every tool and policies that stop your OpenCode plugins, MCP servers,
and skills from loading. A plugin.use or mcp.use allow policy in your own OpenCode config takes
precedence over AI Git's, so plugins or MCP servers you allow there still load; tools stay denied.
Project config, AGENTS.md instructions, and your OpenCode references are turned off. AI Git deletes
the session once the reply arrives or you press Ctrl-C. If AI Git is killed outright, the next run
deletes the leftover session.
Like any OpenCode server, the private server can run your due OpenCode schedules
(experimental.schedules) when no other OpenCode server is running. If OpenCode's background service
starts while AI Git is generating, it takes over the session and the run fails; run AI Git again.
Configuration
AI Git uses a three-tier configuration system:
- CLI flags (highest priority)
- Project config (
.ai-git.json) - Global config (
~/.config/ai-git/config.json)
Example Configs
{
"$schema": "https://raw.githubusercontent.com/sadiksaifi/ai-git/main/schema.json",
"provider": "claude-code",
"model": "haiku#low",
"defaults": {
"stageAll": false,
"commit": false,
"push": false
}
}{
"$schema": "https://raw.githubusercontent.com/sadiksaifi/ai-git/main/schema.json",
"provider": "openrouter",
"model": "anthropic/claude-sonnet-5-5"
}Tip: Add the
$schemaproperty for autocomplete and validation in your editor.Note: API keys are stored securely in keychain, not in config files.
Advanced: Custom Prompts
The default prompt works excellently for most projects. Customize only for project-specific needs like ticket systems, monorepo scopes, or team style preferences.
Customization Options
| Field | Description | Example |
| :---------------- | :----------------------------------------- | :-------------------------------------------------- |
| prompt.context | Project-specific information | "React Native app. Jira tickets: PROJ-123" |
| prompt.style | Style/format preferences | "Always include scope. Keep body under 5 points." |
| prompt.examples | Custom commit examples (replaces defaults) | Array of commit message strings |
Example: Monorepo with Scopes
{
"$schema": "https://raw.githubusercontent.com/sadiksaifi/ai-git/main/schema.json",
"provider": "claude-code",
"model": "haiku",
"prompt": {
"context": "Monorepo with packages: web, mobile, shared, api, docs, infra.",
"style": "Always use a scope from the valid list. Reference PR numbers in footer."
}
}Example: Custom Commit Format
{
"prompt": {
"examples": [
"feat(auth): add SSO integration\n\n- implement SAML 2.0 authentication\n- add identity provider configuration\n- support multiple IdP connections\n\nRefs: PROJ-456",
"fix(api): resolve rate limiting bypass\n\n- add per-user rate limit tracking\n- implement sliding window algorithm\n- add rate limit headers to responses"
]
}
}Note: Only provide
examplesif you have very specific formatting requirements.
Development
# Install dependencies
bun install
# Run in development
bun run dev
# Test prompt generation without AI call
bun run dev --dry-run -A
# Disable update-check network calls (useful for tests/CI)
AI_GIT_DISABLE_UPDATE_CHECK=1 bun test
# Type check
bun run typecheck
# Build binary
bun run buildSee CONTRIBUTING.md for contribution guidelines.
Releases
Releases are managed by Tagsmith. Use bunx tagsmith@latest to create and validate release tags.
