DEV Community

Cover image for Stop writing bad commit messages — I built a free AI CLI for that
Sabahattin Kalkan
Sabahattin Kalkan

Posted on

Stop writing bad commit messages — I built a free AI CLI for that

We've all done it.

git commit -m "fix"
git commit -m "wip"
git commit -m "asdfgh"
git commit -m "changes"
Enter fullscreen mode Exit fullscreen mode

You're deep in flow, you just want to save progress, and writing a meaningful commit message feels like a speed bump. So you write something meaningless and move on.

The problem? Three months later, you (or your teammate) is trying to understand why a change was made. The git log is full of "fix" and "update" and tells you nothing.

The solution: let AI read the diff

I built ai-commit — a CLI that reads your staged git diff and generates 3 Conventional Commit suggestions for you to pick from.

npm install -g @scuton/ai-commit
Enter fullscreen mode Exit fullscreen mode

Then just:

git add .
aic
Enter fullscreen mode Exit fullscreen mode

You get something like:
? Pick a commit message:
❯ feat(auth): add JWT refresh token rotation
feat(auth): implement rotating refresh token with replay protection
chore(auth): update token lifecycle and Redis TTL strategy
✎ Write my own
✗ Cancel

Pick one, hit enter, done. The whole thing takes 3 seconds.

Free option: Ollama (no API key needed)

This is the part I'm most excited about. You can run it completely free using Ollama — a local LLM runner.

# Install Ollama and pull a model
ollama pull llama3.2

# Use ai-commit with Ollama
aic -p ollama
Enter fullscreen mode Exit fullscreen mode

No API key. No cost per commit. Everything stays on your machine.

Supports Claude and GPT-4o too

If you prefer cloud models:

# Claude (best quality)
export ANTHROPIC_API_KEY=sk-ant-...
aic

# GPT-4o
export OPENAI_API_KEY=sk-...
aic -p openai
Enter fullscreen mode Exit fullscreen mode

Cost is around $0.001 per commit with cloud models — basically free.

Install as a git hook

If you want it to run automatically on every git commit:

aic hook
Enter fullscreen mode Exit fullscreen mode

Remove it anytime:

aic hook --remove
Enter fullscreen mode Exit fullscreen mode

Other useful flags

aic --dry-run        # Preview suggestions without committing
aic --count 5        # Get 5 suggestions instead of 3
aic --lang tr        # Generate in Turkish (or any language)
aic --emoji          # Add emoji to commit type
Enter fullscreen mode Exit fullscreen mode

Programmatic API

You can also use it in your own tools:

import { generateCommitMessages } from '@scuton/ai-commit';

const suggestions = await generateCommitMessages({
  provider: 'anthropic',
  count: 3,
});
console.log(suggestions[0].message);
// "feat(auth): add JWT refresh token rotation"
Enter fullscreen mode Exit fullscreen mode

Try it

MIT licensed, open source. PRs welcome — especially for new provider integrations.

Happy committing.

Top comments (0)