@scuton/ai-commit
v1.1.0
Published
AI-powered git commit message generator. Conventional commits from your diff.
Maintainers
Readme
Stop writing "fix stuff" and "update things". Let AI analyze your diff and generate meaningful conventional commits.
Highlights
- Analyzes your
git diffand generates conventional commit messages - Supports Claude (Anthropic) and GPT (OpenAI)
- Interactive — approve, regenerate, or edit before committing
- Auto-detect provider from environment variables
- Emoji support, multiple languages, configurable style
- Install as git hook for fully automatic commits
- Filters lock files and truncates large diffs
- TypeScript, programmatic API available
Install
npm install -g @scuton/ai-commitSetup
Set your API key (one of):
# Claude (recommended)
export ANTHROPIC_API_KEY=sk-ant-...
# Or OpenAI
export OPENAI_API_KEY=sk-...Usage
# Stage changes and generate commit
git add .
aic
# Auto-commit without confirmation
aic --yes
# Preview without committing
aic --dry-run
# Use specific provider
aic --provider openai
# Include emoji
aic --emoji
# Simple style (no conventional commit prefix)
aic --style simple
# Turkish commit messages
aic --language trHow it works
- Reads your staged git diff
- Filters lock files, truncates large diffs
- Sends diff + file list to AI with commit conventions
- Shows suggested message in a box
- You choose: Y (commit) / n (regenerate) / e (edit) / q (quit)
Commands
| Command | Description |
|---------|-------------|
| aic | Generate and commit (default) |
| aic config --show | Show current config |
| aic config --provider anthropic | Set default provider |
| aic hook | Install as git hook |
| aic hook --remove | Remove git hook |
Options
| Flag | Description | Default |
|------|-------------|---------|
| -p, --provider | AI provider (anthropic/openai) | auto-detect |
| -s, --style | conventional or simple | conventional |
| -l, --language | Message language (en, tr, etc.) | en |
| -e, --emoji | Include emoji | false |
| -y, --yes | Auto-commit, no prompt | false |
| -n, --dry-run | Don't commit | false |
| -r, --regenerate | Keep regenerating | false |
Git Hook
Install as automatic commit message generator:
aic hookNow every git commit will auto-generate a message. Remove with aic hook --remove.
Programmatic API
import { generateCommitMessage } from '@scuton/ai-commit';
const { message, provider } = await generateCommitMessage({
provider: 'anthropic',
style: 'conventional',
emoji: true,
});
console.log(message); // "feat(auth): add JWT refresh token flow"FAQ
Which provider should I use?
Claude (Anthropic) generally produces better conventional commit messages. GPT-4o-mini is faster and cheaper for simple commits.
Does it send my code to the AI?
It sends the git diff (staged changes only) and file names. Lock files are filtered out. Large diffs are truncated to ~8000 chars.
Can I use it without an API key?
No. You need either an Anthropic or OpenAI API key. The cost is ~$0.001 per commit.
Related
- @scuton/gpulse — GitHub CLI toolkit
- readme-forge — AI README generator
License
MIT © Scuton Technology
