Skip to content

Repository files navigation

English | 中文 | 日本語 | Français | Español | العربية | 한국어 | Português | Русский | Deutsch n

banner

🤖 AI Commit | AI 提交 | AIコミット | Validation IA | Confirmación IA | تأكيد AI

AI writes your commit messages. You just review and confirm.

No API keys. No cloud services. No subscriptions.
Pure on-device intelligence that analyzes your staged changes and generates Conventional Commits instantly.

npm versionCILicense: MITNode.js


✨ Why aic?

Ever stared at git commit wondering what to write? aic ends that forever.

$ git add .
$ aic
🤖 aic — AI Commit Message Generator
─────────────────────────────────────
✓ Found 4 staged file(s)
╭──────────────────────────────────────────────────╮
│ │
│ 🤖 aic │
│ │
│ 📝 Suggested Commit Message │
│ ──────────────────────────────────── │
│ │
│ feat(auth): add OAuth2 login flow │
│ │
│ 📁 Files Changed (4) │
│ ──────────────────────────────────── │
│ 📄 src/auth/oauth.ts │
│ 📄 src/auth/callback.ts │
│ 📄 src/routes/auth.ts │
│ 📦 package.json │
│ │
│ ──────────────────────────────────── │
│ [Enter] Commit [E] Edit [C] Cancel │
│ │
╰──────────────────────────────────────────────────╯

That's it.aic analyzed the diff, detected new files, identified the language, and generated a perfect Conventional Commit — all in milliseconds, all offline.


🚀 Quick Start

One-time use (no install)

npx @liangzhengtao/commit-ai

Global install

npm install -g ai-commit

Then use it anywhere:

git add .
aic

The short alias aic works everywhere — it's the same command as ai-commit.


📖 Usage

Basic

# Stage your changes, then:
aic
# Or use the full name:
ai-commit

With Options

# Force a specific commit type
aic --type feat
# Add a scope
aic --scope auth
# Preview without committing
aic --dry-run
# Use a custom message (bypasses AI)
aic -m "your custom message"# Skip git hooks
aic --no-verify
# Auto-commit without confirmation
aic --yes
# Output as JSON (for CI pipelines)
aic --json

⚙️ Options

OptionShortDescriptionDefault
--type <type>-tForce commit typeAuto-detected
--scope <scope>-sSet commit scopeAuto-detected
--message <msg>-mCustom message (skips AI)
--dry-run-dPreview only, don't commitfalse
--no-verifySkip git hooksfalse
--yes-ySkip confirmation promptfalse
--jsonOutput result as JSONfalse
--version-VShow version
--help-hShow help

🧠 How It Works

aic uses rule-based diff analysis — no API keys, no network calls, no LLMs. Here's what happens when you run it:

┌─────────────────────────────────────────────────────┐
│ 1. Read staged changes (git diff --cached) │
│ 2. Parse diff → detect new/deleted/modified files │
│ 3. Detect languages from file extensions │
│ 4. Classify change type from file patterns: │
│ • New .ts/.tsx/.js/.jsx files → feat │
│ • Test files (*.test.*, __tests__/) → test │
│ • Markdown files → docs │
│ • package.json → chore │
│ • .github/ → ci │
│ • Bug-related patterns → fix │
│ • Default → refactor │
│ 5. Detect scope from common directory │
│ 6. Generate natural language description │
│ 7. Format as Conventional Commit │
│ 8. Display in beautiful terminal UI │
└─────────────────────────────────────────────────────┘

Classification Rules

PatternDetected Type
New .ts, .tsx, .js, .jsx, .py, .go, .rs filesfeat
*.test.*, *.spec.*, __tests__/, test/, tests/test
*.md, *.mdx, docs/, CHANGELOG, LICENSEdocs
package.json, yarn.lock, pnpm-lock.yamlchore
.github/, .gitlab-ci, .circleci/ci
*.css, *.scss, *.sass, *.lessstyle
webpack, rollup, vite, tsconfigbuild
Files with fix, bug, hotfix in namefix
Everything elserefactor

📋 Conventional Commits

aic generates messages following the Conventional Commits specification:

<type>[optional scope]: <description>
[optional body]

Types

TypeWhen to Use
featA new feature
fixA bug fix
docsDocumentation only
styleFormatting, missing semicolons, etc.
refactorCode change that doesn't fix a bug or add a feature
perfPerformance improvement
testAdding or fixing tests
choreBuild process or auxiliary tools
ciCI configuration
buildBuild system changes

Examples

feat(auth): add OAuth2 login flow
fix(api): handle null response from user endpoint
docs: update installation guide
refactor(utils): simplify date formatting functions
test(auth): add integration tests for login flow
chore: update dependencies to latest versions
ci: add Node 20 to test matrix

🔧 CI Integration

Use aic in your CI pipeline to auto-generate commit messages:

# .github/workflows/auto-commit.ymlname: Auto Commiton:
push:
branches: [main]jobs:
format:
runs-on: ubuntu-lateststeps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4with:
node-version: '20'
- name: Install aicrun: npm install -g ai-commit
- name: Run formatterrun: npm run format
- name: Commit changesrun: | git add . aic --yes --jsonenv:
GIT_AUTHOR_NAME: CI BotGIT_COMMITTER_NAME: CI Bot

JSON Output for Pipelines

$ aic --json
{
"message": "feat(auth): add OAuth2 login flow",
"files": ["src/auth/oauth.ts", "src/auth/callback.ts"],
"dryRun": false
}

🛠️ Development

# Clone the repo
git clone https://github.com/Serennity007/ai-commit.git
cd ai-commit
# Install dependencies
npm install
# Run tests
npm test# Try it locally
node bin/cli.js

See Also

ProjectDescription
awesome-ai-rules20 production AI coding rules
vibe-checknpx @liangzhengtao/vibe-check — Score your project's AI-readiness
awesome-mcp-serversMCP servers for Cursor, Claude Code, and Kimi Code

🤝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

# Fork & clone, then:
git checkout -b feat/my-feature
# Make changes...
npm test
git add .
aic # dogfood it! 🐕

📄 License

MIT © Serennity007


❓ FAQ

Does aic send my code to any server?

No.aic is 100% offline. All analysis happens locally using rule-based pattern matching. No API keys, no network requests, no telemetry.

Why rule-based instead of an LLM?

Three reasons:

  1. Speed — Results in milliseconds, not seconds
  2. Privacy — Your code never leaves your machine
  3. Reliability — No rate limits, no API costs, no outages

Future versions may offer optional LLM integration as an enhancement, but the rule-based engine will always be the default.

Can I customize the commit types?

Not yet, but it's on the roadmap. See CHANGELOG.md for planned features.

Does it work with git hooks?

Yes! By default, aic runs git commit which triggers your hooks normally. Use --no-verify to skip them.

What if I want to edit the message before committing?

That's the default behavior! After aic suggests a message, you can:

  • Press Enter to commit as-is
  • Press E to edit the message interactively
  • Press C to cancel

Can I use it in a monorepo?

Yes. aic automatically detects the scope from your file paths. If all changed files are in packages/auth/, it will suggest (auth) as the scope.

What Node.js version do I need?

Node.js 16 or higher.



About

🤖 AI writes commit messages from git diff. No API key. Conventional Commits. npx @liangzhengtao/commit-ai

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages