Skip to content

kszongic/commitwiz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

commitwiz πŸ€–

npm version npm downloads Node.js License: MIT

AI-powered git commit message generator. Stage your changes, run commitwiz, get perfect Conventional Commits β€” every time.

$ git add -A && commitwiz

πŸ€– Analyzing diff... (3 files changed, +47 -12)

  feat(auth): add JWT refresh token rotation

  Implement automatic refresh token rotation on each access token
  renewal. Expired refresh tokens are now invalidated server-side
  to prevent replay attacks.

? [C]ommit  [E]dit  [R]egenerate  [Q]uit: C
βœ… Committed!

Why?

  • Consistent history β€” No more fix stuff, wip, or asdf. Every commit follows Conventional Commits format.
  • Context-aware β€” Reads your actual diff, not just file names. Understands what changed and why.
  • Fast β€” Uses gpt-4o-mini by default. Most commits generate in under 2 seconds.
  • Works with local models β€” Ollama, LM Studio, or any OpenAI-compatible API. Your code never has to leave your machine.
  • Interactive β€” Review before committing. Edit, regenerate, or bail out.

Install

npm install -g commitwiz

Or run without installing:

npx commitwiz

Quick Start

# 1. Set your API key (or use a local model β€” see below)
export OPENAI_API_KEY=sk-...

# 2. Stage changes
git add -A

# 3. Generate and commit
commitwiz

Usage

# Interactive mode (default) β€” review, edit, regenerate, or quit
commitwiz

# Auto-commit without confirmation
commitwiz --auto

# Use a specific model
commitwiz --model gpt-4o

# Use a local model via Ollama
OPENAI_BASE_URL=http://localhost:11434/v1 commitwiz --model llama3

Features

Feature Details
πŸ€– AI-powered Uses OpenAI (or any compatible API) to analyze your staged diff
πŸ“ Conventional Commits Always generates properly formatted type(scope): description messages
⚑ Fast gpt-4o-mini by default β€” sub-2-second generation
πŸ”„ Interactive Commit, edit, regenerate, or quit β€” you're always in control
🏠 Local models Works with Ollama, LM Studio, or any OpenAI-compatible endpoint
πŸ”’ Private Use local models and your code never leaves your machine

Configuration

OpenAI (default)

export OPENAI_API_KEY=sk-...

Ollama (local, free)

# Install Ollama and pull a model
ollama pull llama3

# Point commitwiz at Ollama
export OPENAI_BASE_URL=http://localhost:11434/v1
commitwiz --model llama3

LM Studio (local, free)

# Start LM Studio's local server, then:
export OPENAI_BASE_URL=http://localhost:1234/v1
export OPENAI_API_KEY=lm-studio
commitwiz

Any OpenAI-compatible API

export OPENAI_BASE_URL=https://your-api.example.com/v1
export OPENAI_API_KEY=your-key
commitwiz --model your-model

Recipes

Git hook (auto-generate on every commit)

# .git/hooks/prepare-commit-msg
#!/bin/sh
if [ -z "$2" ]; then
  MSG=$(commitwiz --auto --stdout 2>/dev/null)
  [ -n "$MSG" ] && echo "$MSG" > "$1"
fi

Team workflow with commitlint

# Install commitlint for validation
npm install -D @commitlint/cli @commitlint/config-conventional

# commitwiz generates β†’ commitlint validates
commitwiz --auto && npx commitlint --edit

CI: Validate commit messages in pull requests

# .github/workflows/commitlint.yml
name: Lint Commits
on: [pull_request]
jobs:
  commitlint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with: { fetch-depth: 0 }
      - run: npx commitlint --from ${{ github.event.pull_request.base.sha }}

Quick alias

# Add to ~/.bashrc or ~/.zshrc
alias gc='git add -A && commitwiz'

Batch commits (monorepo)

# Commit each package separately
for dir in packages/*/; do
  cd "$dir"
  git add -A
  commitwiz --auto
  cd ../..
done

How It Works

  1. Reads your staged diff via git diff --cached
  2. Sends the diff to your configured LLM with a system prompt enforcing Conventional Commits format
  3. Presents the message for review (or auto-commits with --auto)
  4. Commits using git commit -m "..." on confirmation

The prompt ensures:

  • Correct type(scope): description format
  • Imperative mood ("add" not "added")
  • Concise subject line (≀72 chars)
  • Optional body for complex changes

Comparison

Tool AI-Powered Local Models Interactive Conventional Commits Zero Config
commitwiz βœ… βœ… βœ… βœ… βœ…
aicommits βœ… ❌ ❌ ❌ βœ…
cz-cli ❌ N/A βœ… βœ… ❌
commitlint ❌ N/A ❌ βœ… (validation only) ❌
Manual ❌ N/A N/A Sometimes βœ…

Use Cases

  • Solo developers β€” Stop agonizing over commit wording. Let AI draft, you approve.
  • Teams β€” Enforce consistent Conventional Commits without training everyone on the spec.
  • Open source β€” Clean commit history makes changelogs and releases trivial.
  • Monorepos β€” Scope-aware messages help track which package changed.
  • CI/CD β€” Conventional Commits enable automatic versioning with semantic-release.

Related Tools

License

MIT

About

AI-powered git commit message generator. Stage changes, run commitwiz, get perfect conventional commits.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors