Generate Conventional Commits messages from git changes in Claude Code.
Two installation methods available:
- MCP Server - Full integration with tools for analyzing changes, generating messages, and executing commits
- Slash Command - Lightweight
/autocommitcommand that works directly in Claude Code
Install the /autocommit slash command:
# Install globally
npm install -g @theoribbi/claude-code-autocommit
# Add the slash command to your user commands
claude-code-autocommit-slash install
# Or install for a specific project only
claude-code-autocommit-slash install --projectThen use in Claude Code:
/autocommit # Commit staged changes
/autocommit --all # Stage all changes and commit
/autocommit "message" # Commit with custom message
The MCP server provides three tools for more granular control over the commit process.
Add to your settings file (~/.claude/settings.json for global, or .claude/settings.json for project):
{
"mcpServers": {
"autocommit": {
"command": "npx",
"args": ["-y", "@theoribbi/claude-code-autocommit"]
}
}
}npm install -g @theoribbi/claude-code-autocommitThen add to your settings file:
{
"mcpServers": {
"autocommit": {
"command": "claude-code-autocommit"
}
}
}Note: After modifying the settings file, restart Claude Code for the changes to take effect.
The /autocommit command analyzes your staged changes and generates a conventional commit message.
/autocommit # Generate commit for staged changes
/autocommit --all # Stage all changes first, then commit
/autocommit "fix typo" # Use custom message instead of generating one
The command will:
- Analyze the git diff
- Determine the appropriate commit type (feat, fix, docs, etc.)
- Detect the scope from directory structure
- Generate a descriptive commit message
- Show you the proposed message and ask for confirmation
- Execute the commit
Analyzes git changes and returns a token-efficient summary.
Parameters:
include_staged(boolean, default: true) - Include staged changesinclude_unstaged(boolean, default: false) - Include unstaged changescwd(string, optional) - Working directory
Returns:
- File paths with status (A/M/D/R) and change counts
- Total additions/deletions
- File extensions and top directories
- Suggested commit type and scope
Generates a Conventional Commits message based on the changes.
Parameters:
type(string, optional) - Override commit type (feat, fix, docs, etc.)scope(string, optional) - Override scopedescription(string, optional) - Override descriptionbreaking(boolean, default: false) - Mark as breaking changeinclude_staged(boolean, default: true) - Include staged changesinclude_unstaged(boolean, default: false) - Include unstaged changescwd(string, optional) - Working directory
Returns:
- Full commit message
- Message components (type, scope, description)
- Confidence level (high/medium/low)
Executes a git commit with the provided message.
Parameters:
message(string, required) - The commit messageconfirmed(boolean, required) - Must betrueto execute (safety check)cwd(string, optional) - Working directory
Returns:
- Success status
- Commit hash (on success)
- Error message (on failure)
| Pattern | Type |
|---|---|
*.test.ts, __tests__/ |
test |
*.md, docs/, README |
docs |
.github/workflows/ |
ci |
package.json, tsconfig.json |
build |
*.css, .prettier* |
style |
.gitignore, *.lock |
chore |
New files in src/ |
feat |
| Modifications | fix |
Scopes are extracted from directory structure:
src/auth/login.ts→ scope:authpackages/core/→ scope:core- Multiple directories → no scope
// MCP Server entry point
import "@theoribbi/claude-code-autocommit/mcp-server"
// Slash command installer
import "@theoribbi/claude-code-autocommit/slash-command"# Remove from user commands
claude-code-autocommit-slash uninstall
# Remove from project commands
claude-code-autocommit-slash uninstall --project# Install dependencies
npm install
# Build
npm run build
# Run MCP server locally
node dist/mcp/index.js
# Test slash command installer
node dist/slash-command/install.js --helpMIT