Auto-generate meaningful git commit messages from your staged diff using AI (Claude or Gemini).
npx commitcraft initnpm install -g @syedfahadandrabi/commitcraftOr use without installing:
npx commitcraft genConfigure your API keys:
commitcraft setupOr set them manually:
# Claude (Anthropic) — recommended, best quality
commitcraft config set ANTHROPIC_API_KEY "sk-ant-..."
# Gemini (Google) — free tier available
commitcraft config set GEMINI_API_KEY "AIza..."Keys are stored securely in ~/.config/commitcraft/keys.json. Environment variables take precedence over stored keys.
Works automatically on every git commit:
cd your-project
commitcraft initNow just stage your changes and commit as usual:
git add .
git commit # ← message is auto-generatedBypasses the editor entirely:
git add .
commitcraft commitcommitcraft gencommitcraft gen --hint "fixing the broken login redirect"commitcraft gen --verbosecommitcraft gen --provider claude
commitcraft gen --provider geminicommitcraft config list # Show stored keys (masked)
commitcraft config delete GEMINI_API_KEY # Remove a keycommitcraft uninstallfeat(auth): add JWT refresh token rotation
- Replace single-use tokens with rotating refresh token strategy
- Store token family in Redis to detect reuse attacks
- Invalidate entire family on suspicious reuse detection
| Command | Description |
|---|---|
commitcraft init |
Install git hook in current repo |
commitcraft uninstall |
Remove git hook from current repo |
commitcraft commit |
Generate message and commit directly |
commitcraft gen |
Generate a commit message (dry run) |
commitcraft setup |
Interactive API key setup |
commitcraft config |
Manage stored API keys (set/list/delete) |
| Flag | Description |
|---|---|
--hint <text> |
Give the AI a hint about what you changed |
--verbose |
Include a commit body with bullet points |
--provider <name> |
Force provider: claude or gemini |
commitcraft initinstalls aprepare-commit-msggit hook in your repo- On every
git commit, git runs the hook automatically - The hook calls
commitcraft gen --write, which:- Runs
git diff --cachedto get your staged changes - Sends the diff to AI (Claude Haiku or Gemini Flash)
- Writes the generated message to your commit file
- Runs
- Your editor opens pre-filled — edit or accept and save
If no --provider flag is given, commitcraft picks the first available:
ANTHROPIC_API_KEY→ ClaudeGEMINI_API_KEY→ Gemini
npm install
npm run build # Compile TypeScript
npm test # Run testsMIT