AI Commit Message Generator
Generate meaningful commit messages automatically using AI. Analyzes your staged changes and creates Conventional Commits formatted messages in seconds.


Features
- Multi-provider support - Choose from OpenAI, Groq, Google Gemini, or Ollama (offline)
- 3 commit message candidates - Pick the best one from AI-generated options
- PR description generation - Auto-generate structured PR descriptions from your changes
- Pre-commit impact & risk review - Show affected areas, security review, remediation guidance, and a fix prompt before commit
- Optional validation checks - Detect and run lint/test/typecheck commands before PR description generation
- PR copy helpers - Copy PR title, copy PR body, copy all markdown, or save
PR.md
- Suggested commit split - Warn when a diff looks like it should be split into smaller commits
- Deployment checklist - Add pre-deploy checklist items for high-risk changes
- Security review & fix prompt - Generate security review points, remediation guidance, and an AI-ready fix prompt
- Issue linking - Auto-detect issue numbers from branch names (GitHub, GitLab, JIRA)
- Korean language support - Generate commit messages in Korean
- Conventional Commits format for consistent, semantic versioning friendly messages
- Sensitive information masking - Automatically masks API keys, passwords, tokens before sending to AI
- Smart diff summarization - AI summarizes large diffs for better commit messages
- Team ruleset support - Enforce commit conventions via
.commitrc.json
- Team ruleset wizard - Create
.commitrc.json from VS Code command palette
- Release notes draft - Generate a simple draft from recent Conventional Commits
- Multi-repo workspace support with repository picker
- Secure API key storage using VS Code's built-in SecretStorage
- Configurable exclusions to filter out noise from diffs (lock files, build artifacts, etc.)
- Smart handling of existing commit messages (overwrite/append options)
- CLI version - Use from terminal with
commitcraft command
What's New in v0.2.0
Ollama Support (Offline Mode)
Run AI commit message generation completely offline using local LLMs via Ollama. No API key required!
Automatically detects and masks sensitive data before sending to AI:
- API keys (OpenAI, AWS, GitHub, Stripe, etc.)
- Passwords and secrets in config files
- Connection strings and tokens
- Private keys
Smart Diff Summarization
For large diffs (>8000 chars by default), the extension first summarizes the changes using AI, then generates commit messages from the summary for better results.
Team Ruleset Support
Create a .commitrc.json file in your project root to enforce team conventions:
- Allowed commit types and scopes
- Required scopes
- Max subject length
- Custom prompts for AI
- Language override
Pre-Commit Review
When you run AI Commit: Generate, CommitCraft now opens a Markdown review before you commit:
- Uses the staged diff, so the feedback appears at commit time rather than only during PR creation
- Includes
Impact, Risk, Security Review, Suggested Remediation, Testing, and Fix Prompt
- Lets you copy the selected commit message, copy the fix prompt, save
PRE_COMMIT_REVIEW.md, or save FIX_PROMPT.md
- Helps catch risky auth, database, config, dependency, API, or deployment changes before they become commits
PR Description Generation
Automatically generate well-structured PR descriptions with:
- Title (max 50 chars)
- Summary section
- Changes bullet list
- Impact and risk sections
- Review focus and testing suggestions
- Optional validation command results
- Suggested commit split when the change mixes unrelated areas
- Deployment checklist for risky changes
- Security review, suggested remediation, and AI-ready fix prompt
- Testing instructions
Opens in a new editor tab with actions for Copy PR Title, Copy PR Body, Copy All, Save PR.md, Copy Fix Prompt, and Save FIX_PROMPT.md when a fix prompt is available.
Impact & Risk Analysis
Commit generation and PR descriptions can include local impact and risk analysis before you commit or publish a PR:
- Detects risky areas such as auth, database migrations, deployment/infra, CI/CD, dependencies, and API contracts
- Scores risk as Low, Medium, or High based on file blast radius, changed lines, and risk signals
- Suggests review focus points and test scenarios
- Suggests commit splits when the diff spans unrelated areas
- Adds deployment checklist items for high-risk or deployment-sensitive changes
- Adds security review points, suggested remediation, and a copyable fix prompt for AI-assisted follow-up
- Warns in VS Code when a high-risk change is detected
Optional Validation Checks
Configure commands such as lint, tests, or type checks to run before generating a PR description:
- Disabled by default for safety
- Uses
aiCommit.validationCommands when configured
- If no commands are configured, detects common
package.json scripts such as lint, test, typecheck, and check-types
- Prompts before running detected commands
- Includes pass/fail results in the generated PR description
Issue Linking
Automatically extract issue numbers from branch names and include them in commit messages:
- Configure
issueBranchPattern to extract issue from branch (e.g., feature/(\d+) extracts 123 from feature/123-login)
- Configure
issuePrefix to format the reference (e.g., # → #123)
- Works with GitHub, GitLab, JIRA, and custom issue systems
Example: Branch feature/123-add-login → Commit: feat(auth): add login validation [#123](https://github.com/youngsikkk/ai-commit-msg/issues/123)
Installation
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X / Cmd+Shift+X)
- Search for "AI Commit Message Generator"
- Click Install
Usage
- Stage your changes with
git add
- Run the command:
- Press
Ctrl+Shift+G (Windows/Linux) or Cmd+Shift+G (Mac)
- Or open Command Palette (
Ctrl+Shift+P) and type "AI Commit: Generate"
- Enter your API key when prompted (first time only, not required for Ollama)
- Choose from 3 generated candidates or click "Regenerate" for new options
- The selected message appears in the Source Control input box
- A Pre-Commit Review Markdown tab opens with
Security Review, Suggested Remediation, and Fix Prompt
- Review risks, copy the fix prompt if needed, then commit
Configuration
| Setting |
Type |
Default |
Description |
aiCommit.provider |
string |
openai |
AI provider: openai, groq, gemini, or ollama |
aiCommit.model |
string |
(auto) |
Model to use. Leave empty for provider defaults |
aiCommit.language |
string |
english |
Language: english or korean |
aiCommit.maxDiffChars |
number |
12000 |
Maximum diff characters to send to AI |
aiCommit.exclude |
array |
[...] |
Glob patterns to exclude from diff |
aiCommit.ollamaUrl |
string |
http://localhost:11434 |
Ollama server URL |
aiCommit.maskSensitiveInfo |
boolean |
true |
Mask sensitive info in diff before sending to AI |
aiCommit.summarizeLargeDiff |
boolean |
true |
Summarize large diffs before generating messages |
aiCommit.largeDiffThreshold |
number |
8000 |
Character threshold for diff summarization |
aiCommit.issuePrefix |
string |
"" |
Prefix for issue references (e.g., #, JIRA-) |
aiCommit.issueBranchPattern |
string |
"" |
Regex to extract issue from branch name |
aiCommit.includeImpactRiskAnalysis |
boolean |
true |
Include local impact/risk analysis in PR descriptions |
aiCommit.runValidationBeforePR |
boolean |
false |
Run configured validation commands before PR generation |
aiCommit.validationCommands |
array |
[] |
Commands to run, e.g. ["npm.cmd run lint", "npm.cmd test"] |
aiCommit.validationTimeoutMs |
number |
120000 |
Timeout per validation command |
aiCommit.maxValidationOutputChars |
number |
4000 |
Max output chars captured per validation command |
Default Models by Provider
| Provider |
Default Model |
| OpenAI |
gpt-4o-mini |
| Groq |
llama-3.1-8b-instant |
| Gemini |
gemini-2.5-flash |
| Ollama |
llama3.2 |
Default Exclusions
["node_modules", "*.lock", "dist", "build", "*.min.*"]
PR Risk & Validation Example
{
"aiCommit.includeImpactRiskAnalysis": true,
"aiCommit.runValidationBeforePR": true,
"aiCommit.validationCommands": [
"npm.cmd run lint",
"npm.cmd run check-types"
]
}
When enabled, generated PR descriptions include Impact, Risk, Security Review, Review Focus, Suggested Remediation, Testing, Validation, Suggested Commit Split, Deployment Checklist, and Fix Prompt sections when applicable.
Team Ruleset (.commitrc.json)
Create a .commitrc.json file in your project root to enforce team conventions:
{
"allowedTypes": ["feat", "fix", "docs", "refactor", "test"],
"requireScope": true,
"allowedScopes": ["api", "ui", "core", "config"],
"maxSubjectLength": 72,
"language": "english",
"customPrompt": "Always mention the ticket number if visible in the diff"
}
Ruleset Options
| Option |
Type |
Description |
allowedTypes |
string[] |
Restrict commit types (e.g., ["feat", "fix"]) |
requireScope |
boolean |
Require a scope in commit messages |
allowedScopes |
string[] |
Restrict allowed scopes |
maxSubjectLength |
number |
Maximum subject line length |
subjectPrefix |
string |
Prefix to add to subject (e.g., ticket number) |
language |
string |
Override language setting (english or korean) |
customPrompt |
string |
Additional instructions for AI |
When a generated commit doesn't match the ruleset, you'll get options to:
- Use Anyway - Use the commit message as-is
- Regenerate - Generate new candidates
- Cancel - Abort the operation
Ollama Setup
- Install Ollama
- Pull a model:
ollama pull llama3.2
- Start Ollama (runs automatically on install)
- Set provider to
ollama in VS Code settings
- (Optional) Set custom URL with
AI Commit: Set Ollama URL
Issue Linking Setup
Configure issue extraction from branch names:
GitHub/GitLab Issues
// settings.json
{
"aiCommit.issuePrefix": "#",
"aiCommit.issueBranchPattern": "feature/(\\d+)"
}
Branch feature/123-add-login → #123
JIRA Issues
{
"aiCommit.issuePrefix": "",
"aiCommit.issueBranchPattern": "(PROJ-\\d+)"
}
Branch feature/PROJ-456-fix-bug → PROJ-456
Custom Pattern Examples
| Branch Pattern |
Regex |
Result |
feature/123-desc |
feature/(\\d+) |
123 |
JIRA-456-feature |
(JIRA-\\d+) |
JIRA-456 |
issue-789/fix |
issue-(\\d+) |
789 |
GH-101-bugfix |
(GH-\\d+) |
GH-101 |
CLI Version
Use CommitCraft from your terminal without VS Code!
Installation
npm install -g commitcraft-cli
Quick Usage
# Stage changes and generate commit message
git add .
commitcraft
# Auto-commit with selected message
commitcraft --commit
# Use specific provider
commitcraft -p groq
commitcraft -p ollama
# Korean language
commitcraft -l korean
# Generate PR markdown from staged + unstaged changes
commitcraft pr
commitcraft pr --copy
commitcraft pr --output PR.md
CLI Options
commitcraft generate [options]
commitcraft pr [options]
Options:
-p, --provider <provider> AI provider (openai, groq, gemini, ollama)
-m, --model <model> Model to use
-l, --language <language> Language (english, korean)
-c, --commit Auto-commit with selected message
--issue-pattern <pattern> Regex to extract issue from branch
--issue-prefix <prefix> Prefix for issue (e.g., #)
PR options:
--copy Copy generated PR markdown to clipboard
-o, --output <file> Save generated PR markdown to a file
--validate Run detected validation commands without prompting
--no-validation-prompt Skip detected validation command prompt
CLI Configuration
# Interactive configuration
commitcraft config
# Or set environment variables
export OPENAI_API_KEY="sk-..."
export GROQ_API_KEY="gsk_..."
See CLI README for detailed documentation.
Supported Commit Types
| Type |
Description |
feat |
New feature |
fix |
Bug fix |
docs |
Documentation changes |
style |
Code style changes (formatting, semicolons, etc.) |
refactor |
Code refactoring |
perf |
Performance improvements |
test |
Adding or updating tests |
build |
Build system or dependencies |
ci |
CI/CD configuration |
chore |
Other changes (maintenance, tooling) |
Commands
| Command |
Description |
AI Commit: Generate |
Generate commit message from staged changes |
AI Commit: Generate PR Description |
Generate PR description from uncommitted changes |
AI Commit: Create Team Ruleset |
Create .commitrc.json with guided options |
AI Commit: Generate Release Notes |
Draft release notes from recent commits |
AI Commit: Set OpenAI API Key |
Set/update OpenAI API key |
AI Commit: Set Groq API Key |
Set/update Groq API key |
AI Commit: Set Gemini API Key |
Set/update Gemini API key |
AI Commit: Set Ollama URL |
Set custom Ollama server URL |
Keybindings
| Command |
Windows/Linux |
Mac |
| AI Commit: Generate |
Ctrl+Shift+G |
Cmd+Shift+G |
| AI Commit: Generate PR Description |
Ctrl+Shift+R |
Cmd+Shift+R |
Requirements
- VS Code 1.107.0 or higher
- Git installed and repository initialized
- API key for your chosen provider (not required for Ollama):
Security
Your API keys are stored securely using VS Code's SecretStorage API. They are never exposed in settings, logs, or transmitted anywhere except to the respective AI provider's API.
Sensitive Information Masking (enabled by default) automatically detects and masks:
- API keys (OpenAI, AWS, GitHub, Stripe, Google, Azure, etc.)
- Passwords and secrets in configuration files
- Database connection strings
- JWT tokens and bearer tokens
- Private keys (RSA, SSH, PGP)
This ensures your sensitive data is never sent to AI providers.
License
MIT License - see LICENSE for details.
Happy committing!