JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8
  • Score
    100M100P100Q62004F
  • License MIT

Generate commit messages using local LLMs (Ollama)

Package Exports

  • @vavasilva/git-commit-ai
  • @vavasilva/git-commit-ai/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@vavasilva/git-commit-ai) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

git-commit-ai

Generate commit messages using local LLMs (Ollama).

A CLI tool that analyzes your staged changes and generates Karma-style commit messages using a local LLM.

Features

  • Local LLM - Uses Ollama (llama3.1:8b by default), no API keys needed
  • Karma Convention - Generates type(scope): subject format commits
  • Interactive Flow - Confirm, Edit, Regenerate, or Abort before committing
  • Individual Commits - Option to commit each file separately
  • Git Hook - Auto-generate messages on git commit
  • Summarize - Preview changes in plain English before committing
  • Debug Mode - Troubleshoot LLM responses
  • Configurable - Customize model, temperature, and more via config file

Installation

# Requires Node.js 20+
npm install -g git-commit-ai

# Make sure Ollama is running
brew install ollama
brew services start ollama
ollama pull llama3.1:8b

Quick Start

# 1. Make changes to your code
echo "console.log('hello')" > hello.js

# 2. Stage your changes
git add hello.js

# 3. Generate commit message and commit
git-commit-ai

# Output:
# 📝 Generated commit message
#   feat: add hello.js script
# [C]onfirm  [E]dit  [R]egenerate  [A]bort? c
# ✓ Committed: feat: add hello.js script

Usage

# Basic: stage + generate + confirm + commit
git add .
git-commit-ai

# Auto-commit without confirmation
git add .
git-commit-ai -y

# Commit and push in one command
git add .
git-commit-ai --push

# Commit each modified file separately
git-commit-ai --individual

# Preview changes before committing
git add .
git-commit-ai summarize

# Enable debug output for troubleshooting
git-commit-ai --debug

# Show current config
git-commit-ai config

# Create/edit config file
git-commit-ai config --edit

Git Hook (Auto-generate on commit)

Install a git hook to automatically generate commit messages:

# Install the hook
git-commit-ai hook --install

# Now just use git commit normally!
git add .
git commit
# Message is auto-generated and opens in your editor

# Check hook status
git-commit-ai hook --status

# Remove the hook
git-commit-ai hook --remove

Interactive Flow

📝 Generated commit message

  feat(auth): add login validation

[C]onfirm  [E]dit  [R]egenerate  [A]bort? _

Configuration

Config file location: ~/.config/git-commit-ai/config.toml

model = "llama3.1:8b"
ollama_url = "http://localhost:11434"
temperature = 0.7
retry_temperatures = [0.5, 0.3, 0.2]

Commit Types (Karma Convention)

Type Description
feat New feature
fix Bug fix
docs Documentation
style Formatting (no code change)
refactor Code restructuring
test Adding tests
build Build system or dependencies
chore Maintenance tasks

License

MIT