Skip to content

Seungwoo321/genai-commit

Repository files navigation

genai-commit

AI-powered commit message generator using Claude Code or Cursor CLI.

npm version License: MIT GitHub

Features

  • AI-powered commit messages - Generate meaningful commit messages using Claude Code or Cursor 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

How It Works

flowchart TD
    A[Start: genai-commit] --> B[Collect Git Changes]
    B --> C{Changes Found?}
    C -->|No| D[Exit: No changes]
    C -->|Yes| E[Generate Tree Summary]
    E --> F[Build AI Prompt]
    F --> G{Select Provider}
    G -->|Claude Code| H[Claude Code CLI]
    G -->|Cursor CLI| I[Cursor CLI]
    H --> J[Parse JSON Response]
    I --> K[Parse Delimiter Response]
    J --> L[Display Proposed Commits]
    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 --> F
    Q --> R[Merge Same-Ticket Commits]
    R --> L
    N --> S[Done]
Loading

Prerequisites

You need at least one of these AI CLI tools installed:

Installation

# Global installation
npm install -g genai-commit

# Or use directly with npx (no installation required)
npx genai-commit claude-code

Usage

Generate Commit Messages

# Using Claude Code
genai-commit claude-code

# Using Cursor Agent
genai-commit cursor-cli

# With specific model
genai-commit cursor-cli --model claude-4.5-sonnet
genai-commit claude-code --model sonnet

# Set language for both title and message
genai-commit claude-code --lang ko

# Set languages separately
genai-commit claude-code --title-lang en --message-lang ko

Authentication

# Login to Cursor Agent
genai-commit login cursor-cli

# Setup Claude token
genai-commit login claude-code

# Check status
genai-commit status claude-code
genai-commit status cursor-cli

List Supported Models

# List models for Cursor Agent
genai-commit models cursor-cli

# List models for Claude Code
genai-commit models claude-code

Interactive 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 claude-4.5-sonnet (Cursor) / haiku (Claude)

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 claude-code

With Jira Integration

  1. Run genai-commit claude-code
  2. Review proposed commits
  3. Press t to assign Jira tickets
  4. Enter Jira URLs for each commit
  5. Commits with the same Jira ticket are automatically merged
  6. Press y to commit

Providing Feedback

  1. Run genai-commit cursor-cli
  2. Review proposed commits
  3. Press f to provide feedback
  4. Enter your feedback (e.g., "Split the auth changes into separate commits")
  5. AI regenerates based on your feedback
  6. Press y to 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 Maximum input size in bytes
maxDiffSize 15000 Maximum diff size in bytes
timeout 120000 AI request timeout in ms
treeDepth 3 Directory depth for tree compression

Requirements

  • Node.js >= 18.0.0
  • Git repository
  • Claude Code CLI or Cursor CLI installed and authenticated

License

MIT

About

AI-powered commit message generator using Claude Code or Cursor CLI

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors