genai-commit
v1.13.0
Published
AI-powered commit message generator using Claude Code or Cursor CLI
Maintainers
Readme
genai-commit
AI-powered commit message generator using Claude Code, Cursor CLI, or Codex CLI.
Read in other languages: 한국어
Features
- AI-powered commit messages - Generate meaningful commit messages using Claude Code, Cursor CLI, or Codex CLI
- Conventional Commits - Automatically follows the Conventional Commits specification
- Multi-language support - Generate titles and messages in English or Korean
- Jira integration - Assign Jira tickets to commits and auto-merge related changes
- Interactive workflow - Review, provide feedback, and refine before committing
- Smart file grouping - Intelligently splits changes into logical commits
- Cluster-aware chunking - For large changesets, builds an import graph and groups related files into chunks so each AI call sees a coherent slice
- Cross-chunk semantic merge - When chunks produce commits describing the same logical change, a merge pass unifies them with validation rollback (false splits over false merges)
- Automatic staging - Stages all changes (including untracked, renamed, and deleted files) before diff analysis
- Works with empty repositories - Generates commits even without prior commit history
- Remote sync protection - Aborts early if the branch is behind or diverged from remote
- Gitignore-aware - Respects
.gitignoreand works correctly from subdirectories
Supported File Changes
| Change Type | Supported | |-------------|-----------| | Added files | Yes | | Modified files | Yes | | Deleted files | Yes | | Renamed files | Yes | | Untracked files | Yes (auto-staged) | | Files in subdirectories | Yes | | Empty repositories (no commits yet) | Yes |
How It Works
flowchart TD
A[Start: genai-commit] --> A1{Remote Status}
A1 -->|behind/diverged| A2[Exit: pull required]
A1 -->|ok| A3[Stage All Changes]
A3 --> B[Collect Git Changes]
B --> C{Changes Found?}
C -->|No| D[Exit: No changes]
C -->|Yes| E[Load Diffs and Source]
E --> F[Build Import Graph]
F --> G{Strategy}
G -->|edges > 0| G1[Cluster: WCC + FFD bin pack]
G -->|no edges| G2[Directory-based chunking]
G1 --> H[Per-chunk AI Generation]
G2 --> H
H --> I{Chunks > 1?}
I -->|yes| J[Cross-chunk Semantic Merge]
I -->|no| K[Skip merge]
J --> J1{Validate: coverage + title}
J1 -->|ok| L[Display Proposed Commits]
J1 -->|fail| K
K --> L
L --> M{User Action}
M -->|y| N[Execute git add + commit]
M -->|n| O[Cancel]
M -->|f| P[Get Feedback]
M -->|t| Q[Assign Jira Tickets]
P --> H
Q --> R[Merge Same-Ticket Commits]
R --> L
N --> S[Done]Architecture Principle
Deterministic logic stays in code; only the truly non-deterministic parts go to the LLM.
- Deterministic (program-based)
- Import graph extraction (regex per language: ts/js/py/go/rust/java)
- Weakly-Connected-Components clustering of related files
- First-Fit Decreasing bin packing into chunk-size budgets
- Coverage validation, title-length checks, file-path verbatim enforcement
- Non-deterministic (LLM-based)
- Writing natural-language titles and messages from a grouped file set
- Judging when files in different chunks describe the same logical change
- Rejected outputs roll back to per-chunk results — no retry doubling AI cost
Prerequisites
You need at least one of these AI CLI tools installed:
- Claude Code CLI - Anthropic's official CLI (command:
claude) - Cursor Agent CLI - Cursor's agent CLI (command:
agent) - OpenAI Codex CLI - OpenAI's Codex CLI (command:
codex)
Providers
Each provider can be referenced by its canonical name or short alias:
| Canonical | Short Alias | Underlying CLI |
|-----------|-------------|----------------|
| claude-code | claude | claude |
| cursor-cli | cursor | agent |
| codex-cli | codex | codex |
Installation
# Global installation
npm install -g genai-commit
# Or use directly with npx (no installation required)
npx genai-commit claudeUsage
Generate Commit Messages
# Canonical names
genai-commit claude-code
genai-commit cursor-cli
genai-commit codex-cli
# Short aliases (equivalent)
genai-commit claude
genai-commit cursor
genai-commit codex
# With specific model
genai-commit cursor --model claude-4.5-sonnet
genai-commit claude --model sonnet
genai-commit codex --model gpt-5.4
# Set language for both title and message
genai-commit claude --lang ko
# Set languages separately
genai-commit claude --title-lang en --message-lang koAuthentication
# Login
genai-commit login cursor
genai-commit login claude
genai-commit login codex
# Check status
genai-commit status claude
genai-commit status cursor
genai-commit status codexList Supported Models
genai-commit models cursor
genai-commit models claude
genai-commit models codexInteractive Options
After generating commit messages, you'll see an interactive menu:
| Option | Description |
|--------|-------------|
| [y] | Commit all proposed commits |
| [n] | Cancel |
| [f] | Provide feedback to regenerate |
| [t] | Assign Jira tickets and regroup commits |
Options
| Option | Description | Default |
|--------|-------------|---------|
| --lang <lang> | Set both title and message language (en|ko) | - |
| --title-lang <lang> | Language for commit title | en |
| --message-lang <lang> | Language for commit message | ko |
| --model <model> | Model to use | haiku (Claude) / claude-4.5-sonnet (Cursor) / gpt-5.4 (Codex) |
Examples
Basic Usage
# Navigate to your git repository
cd my-project
# Make some changes
echo "console.log('hello');" >> src/index.js
# Generate and create commits
genai-commit claudeWith Jira Integration
- Run
genai-commit claude - Review proposed commits
- Press
tto assign Jira tickets - Enter Jira URLs for each commit
- Commits with the same Jira ticket are automatically merged
- Press
yto commit
Providing Feedback
- Run
genai-commit cursor - Review proposed commits
- Press
fto provide feedback - Enter your feedback (e.g., "Split the auth changes into separate commits")
- AI regenerates based on your feedback
- Press
yto commit
Supported Commit Types
Following the Conventional Commits specification:
| Type | Description |
|------|-------------|
| feat | New feature |
| fix | Bug fix |
| docs | Documentation |
| style | Formatting (no code change) |
| refactor | Code restructuring |
| test | Adding tests |
| chore | Maintenance |
| perf | Performance improvement |
| ci | CI/CD changes |
| build | Build system changes |
Configuration
The tool uses sensible defaults but can be configured:
| Setting | Default | Description |
|---------|---------|-------------|
| maxInputSize | 30000 | Per-chunk input budget in characters; drives clustering and bin-packing |
| maxDiffSize | 15000 | Maximum diff size per file in bytes (larger diffs are summarized) |
| timeout | 120000 | AI request timeout in ms |
| maxRetries | 2 | Per-chunk AI retry count on failure |
Requirements
- Node.js >= 18.0.0
- Git repository
- Claude Code CLI, Cursor CLI, or Codex CLI installed and authenticated
License
MIT
