A battle-tested CLI tool that automates your entire Git workflow — from quality checks and AI-generated commit messages to security scanning and automated push.
AI Commit & Deploy is a command-line tool that replaces your manual git add → git commit → git push ritual with a single intelligent command. It enforces quality, prevents secrets from leaking, and uses AI to write meaningful commit messages that actually describe what changed — and why.
No more "fix stuff" commits. No more pushing broken builds. No more exposed API keys in version history.
# Before
git add .
git commit -m "fix stuff" # 😬
git push origin main
# After
git add .
ai-commit # 🚀 one command does it all, intelligently| Feature | Description |
|---|---|
| 🧪 Automated Testing | Runs your test suite before every commit. Fails fast if tests don't pass. |
| 🔍 Intelligent Linting | Auto-detects ESLint, Ruff, Flake8 or any custom linter and enforces code standards. |
| 🤖 AI-Generated Commits | Reads your staged diff and generates a Conventional Commit message using GPT, Claude, DeepSeek, or a local LLM. |
| 🔒 Secret Scanning | Detects leaked API keys, tokens, passwords, and private keys before they ever reach GitHub. |
| 🏗️ Production Build Check | Verifies your app compiles successfully for production before pushing. |
| 🌐 Multi-Provider AI | OpenAI · Anthropic · DeepSeek · Ollama · Any OpenAI-compatible API. |
| 🖥️ Cross-Platform | Works on Linux, macOS, and Windows (Git Bash / WSL). |
| ⚙️ Zero Hardcoding | All configuration lives in .env files. Nothing sensitive ever touches the codebase. |
Before you begin, make sure you have the following installed on your machine:
- Git
v2.30+— with Git Bash if on Windows - Python
v3.9+— with "Add to PATH" enabled - Node.js
v18+— if working on JavaScript/TypeScript projects - An AI Provider API Key — one of the following:
- 🟢 OpenAI API Key
- 🟣 Anthropic API Key
- 🔵 DeepSeek API Key
- 🟡 Ollama (local, completely free — no key needed)
Windows users: Make sure to use Git Bash as your terminal, not CMD or PowerShell.
git clone https://github.com/angelluna03030/AI-Commit
cd ai-commit# Linux / macOS / Windows (Git Bash)
bash install.shThe installer will automatically:
- Copy the
ai-commitscript to~/.local/bin/and add it to your PATH - Create the global config directory at
~/.ai-commit/ - Generate a
~/.ai-commit/.envfile from the template - Add the
gaishortcut alias to your shell
source ~/.bashrc # or ~/.zshrc on macOSai-commit --help
# or using the alias:
gai --helpAll configuration is managed through .env files — never hardcoded. The tool loads config in the following priority order (highest wins):
Shell environment variables > <project>/.env > ~/.ai-commit/.env
nano ~/.ai-commit/.env| Variable | Required | Example | Description |
|---|---|---|---|
AI_COMMIT_PROVIDER |
✅ | custom |
AI backend: openai · anthropic · ollama · custom |
OPENAI_API_KEY |
API_KEY-... |
Required only when provider is openai |
|
ANTHROPIC_API_KEY |
API_KEY-... |
Required only when provider is anthropic |
|
AI_COMMIT_API_KEY |
API_KEY... |
Required when provider is custom (DeepSeek, Groq, etc.) |
|
AI_COMMIT_BASE_URL |
https://api.deepseek.com |
Base URL for custom provider |
|
AI_COMMIT_MODEL |
✅ | deepseek-chat |
Model name to use for generation |
AI_COMMIT_DIFF_MAX_CHARS |
❌ | 8000 |
Max diff characters sent to AI (controls cost) |
| Variable | Default | Example | Description |
|---|---|---|---|
AI_COMMIT_SKIP_QUALITY |
false |
true |
Skip tests and linting entirely |
AI_COMMIT_TEST_CMD |
auto-detect | npm run test |
Override the test command |
AI_COMMIT_LINT_CMD |
auto-detect | npm run lint |
Override the lint command |
| Variable | Default | Example | Description |
|---|---|---|---|
AI_COMMIT_STRICT_SECURITY |
true |
false |
Block commit when secrets are found |
AI_COMMIT_SKIP_SECURITY |
false |
true |
Disable secret scanning entirely |
AI_COMMIT_BUILD_CMD |
auto-detect | npm run build |
Override the build command |
AI_COMMIT_SKIP_BUILD |
false |
true |
Skip the production build check |
| Variable | Default | Example | Description |
|---|---|---|---|
AI_COMMIT_NO_PUSH |
false |
true |
Commit locally without pushing |
AI_COMMIT_PUSH_REMOTE |
origin |
upstream |
Target remote for git push |
AI_COMMIT_PUSH_FLAGS |
(empty) | --force-with-lease |
Extra flags for git push |
AI_COMMIT_NO_CONFIRM |
false |
true |
Skip the Y/n confirmation prompt |
🟢 OpenAI
AI_COMMIT_PROVIDER=openai
OPENAI_API_KEY=API_KEY
AI_COMMIT_MODEL=gpt-4o-mini🟣 Anthropic (Claude)
AI_COMMIT_PROVIDER=anthropic
ANTHROPIC_API_KEY=API_KEY
AI_COMMIT_MODEL=claude-3-5-haiku-20241022🔵 DeepSeek
AI_COMMIT_PROVIDER=custom
AI_COMMIT_BASE_URL=https://api.deepseek.com
AI_COMMIT_API_KEY=API_KEY
AI_COMMIT_MODEL=deepseek-chat🟡 Ollama (Local — Free)
AI_COMMIT_PROVIDER=ollama
OLLAMA_BASE_URL=http://localhost:11434
AI_COMMIT_MODEL=llama3# 1. Stage your changes as usual
git add .
# 2. Run the full AI-powered pipeline
ai-commitai-commit [options]
Options:
--dry-run Run all phases but skip git commit and push (safe preview)
--no-push Commit locally without pushing to remote
--no-quality Skip the tests and linting phase
--no-security Skip the secret scanning phase
--no-build Skip the production build check
--provider X Override AI_COMMIT_PROVIDER on-the-fly# Full pipeline (recommended)
ai-commit
# Preview what commit message the AI would generate — no changes made
ai-commit --dry-run
# Commit only, useful when working with Pull Requests
ai-commit --no-push
# Use a different AI provider just this once
ai-commit --provider ollama
# Skip quality checks for a quick WIP checkpoint (use with caution)
ai-commit --no-quality --no-build
# Use the short alias
gai
gai-dry # dry-run
gai-np # no-push╔══════════════════════════════════════╗
║ AI-COMMIT v1.0 ║
║ Quality · AI · Security · Push ║
╚══════════════════════════════════════╝
──────────────────────────────────────────────────────
PHASE 1 · Quality Validation (Tests & Linting)
──────────────────────────────────────────────────────
→ Running linter: npm run lint
✔ Linter passed
→ Running tests: npm run test
✔ Tests passed
✔ All quality checks passed ✓
──────────────────────────────────────────────────────
PHASE 2 · AI Commit Message Generation
──────────────────────────────────────────────────────
→ Staged files: src/auth/login.ts, src/auth/guards.ts
→ Sending diff to AI — please wait…
Generated commit message:
───────────────────────────────────────────────────────
feat(auth): add JWT refresh token validation guard
Implement a NestJS guard that validates refresh tokens on
protected routes, rejecting expired or tampered tokens with
a 401 response. Centralizes auth logic and removes duplicate
checks from individual controllers.
───────────────────────────────────────────────────────
Accept this message? [Y/n/e(dit)]: Y
──────────────────────────────────────────────────────
PHASE 3 · Production-Ready Check
──────────────────────────────────────────────────────
✔ No secrets detected ✓
✔ Build succeeded ✓
──────────────────────────────────────────────────────
PHASE 4 · Git Commit & Push
──────────────────────────────────────────────────────
✔ Commit created ✓
✔ Pushed to origin/main ✓
═══════════════════════════════════════════════
🚀 All phases passed — code shipped!
═══════════════════════════════════════════════
The tool enforces a strict, sequential 4-phase pipeline. If any phase fails, the process halts immediately — nothing reaches GitHub until your code is clean.
┌─────────────────────────────────────────────────────────────┐
│ │
│ git add . → ai-commit │
│ │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ PHASE 1 · Quality Gate │ │
│ │ ├─ Auto-detects: npm test, pytest, vitest, jest │ │
│ │ ├─ Auto-detects: eslint, ruff, flake8 │ │
│ │ └─ BLOCKS on first failure ✗ │ │
│ └──────────────────────────┬───────────────────────────┘ │
│ │ ✓ all pass │
│ ┌──────────────────────────▼───────────────────────────┐ │
│ │ PHASE 2 · AI Commit Generation │ │
│ │ ├─ Reads git diff --cached │ │
│ │ ├─ Sends to AI provider (OpenAI / Claude / etc.) │ │
│ │ ├─ Generates Conventional Commit message │ │
│ │ └─ Interactive confirm / edit before proceeding │ │
│ └──────────────────────────┬───────────────────────────┘ │
│ │ ✓ accepted │
│ ┌──────────────────────────▼───────────────────────────┐ │
│ │ PHASE 3 · Production-Ready Check │ │
│ │ ├─ Scans staged files for 8+ secret patterns │ │
│ │ ├─ Integrates gitleaks / trufflehog if installed │ │
│ │ ├─ Runs production build (npm build / make / etc.) │ │
│ │ └─ BLOCKS on secrets or build failure ✗ │ │
│ └──────────────────────────┬───────────────────────────┘ │
│ │ ✓ clean & builds │
│ ┌──────────────────────────▼───────────────────────────┐ │
│ │ PHASE 4 · Git Automation │ │
│ │ ├─ git commit -m "<AI generated message>" │ │
│ │ └─ git push origin <current-branch> │ │
│ └──────────────────────────────────────────────────────┘ │
│ │
│ 🚀 Code shipped! │
└─────────────────────────────────────────────────────────────┘
The security scanner checks for over 8 patterns including AWS credentials, GitHub tokens, Stripe keys, JWT tokens, private keys, Slack tokens, and generic API_KEY= / password= assignments.
| Tool | Purpose | Install |
|---|---|---|
| Husky | Git hooks — enforce quality on every commit | npm i -D husky |
| lint-staged | Run linters only on staged files | npm i -D lint-staged |
| Commitlint | Validate conventional commit format | npm i -D @commitlint/cli |
| gitleaks | Advanced secret detection | brew install gitleaks |
| Ollama | Run LLMs locally for free | brew install ollama |
Contributions are what make the open-source community such an amazing place to learn and build. Any contribution you make is greatly appreciated.
- Fork the repository
- Create your feature branch:
git checkout -b feat/amazing-feature - Stage your changes:
git add . - Let the tool do its magic:
ai-commit(yes, use the tool to commit to the tool 🙂) - Open a Pull Request
Please make sure your code follows the existing style and that all tests pass before submitting a PR.
Found a bug? Please open an issue with:
- Your OS and shell (e.g. Windows 11, Git Bash)
- The exact command you ran
- The full error output
Distributed under the MIT License. See LICENSE for full details.
MIT License — Copyright (c) 2025 Angel Stiven Garcia Luna
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files, to deal in the Software
without restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies of the
Software, subject to the standard MIT terms.
Made with ❤️ by Angel Luna · Give it a ⭐ if it saved you time!