@ai-git/cli
v2.9.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
- 🪙 Token Efficient - Uses TOON to minimize prompt size and cost
- 🔌 Multiple Providers - Claude Code, Gemini CLI, Codex, 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 tap 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 gemini-cli --model gemini-3-flash-preview
# Use Codex with reasoning effort baked in
ai-git --provider codex --model gpt-5.3-codex-low
# Use OpenRouter
ai-git --provider openrouter --model anthropic/claude-sonnet-4-6
# 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 |
| Gemini CLI | gemini-cli | CLI | Install CLI |
| Codex | codex | CLI | Install CLI (npm install -g @openai/codex) |
| 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
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",
"defaults": {
"stageAll": false,
"commit": false,
"push": false
}
}{
"$schema": "https://raw.githubusercontent.com/sadiksaifi/ai-git/main/schema.json",
"provider": "openrouter",
"model": "anthropic/claude-sonnet-4-6"
}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": "sonnet",
"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.
