Skip to content

sadiksaifi/ai-git

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

136 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AI Git

A CLI tool that leverages AI to automatically generate semantically correct, conventional commits compliant git messages.

Screenshot 2026-01-02 at 03 23 41

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, 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/cli

Also works with bun, pnpm, and yarn.

Homebrew (macOS)

brew tap sadiksaifi/tap/ai-git

Shell Script (macOS/Linux)

curl -fsSL https://ai-git.xyz/install | bash

Build from Source

git clone https://github.com/sadiksaifi/ai-git.git
cd ai-git
bun install
bun run build

Quick Start

Run ai-git in any git repository:

ai-git

On 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 configure Self-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 help

Examples

# 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 -A

Supported 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:

  1. CLI flags (highest priority)
  2. Project config (.ai-git.json)
  3. 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 $schema property 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 examples if 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 build

See CONTRIBUTING.md for contribution guidelines.

License

MIT

About

AI-powered CLI for generating conventional commit messages.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages