Skip to main content

AI-powered Git commit message generator using Claude

Project description

CommitAid

AI-powered Git commit message generator using Claude AI.

Overview

CommitAid is a CLI tool that uses Claude AI to generate intelligent, context-aware commit messages based on your staged changes. It analyzes your git status and diff, generates a commit message, and lets you edit it before committing.

Features

  • 🤖 AI-generated commit messages using Claude
  • ✏️ Interactive editing before committing
  • 📝 Conventional Commits format by default
  • 🎨 Custom commit specifications/guidelines (optional)
  • ✍️ Optional automatic Signed-off-by line
  • ⚙️ Simple configuration management

Installation

Prerequisites

  1. Python 3.8+
  2. Git - Must be installed and in PATH
  3. Claude CLI - Install from Claude Code documentation

Install CommitAid

pip install commitaid

Or install from source:

git clone https://github.com/yourusername/commitaid.git
cd commitaid
pip install -e .

Usage

Generate a Commit Message

Navigate to your git repository and run:

commitaid

This will:

  1. Check if you're in a git repository
  2. Verify Claude CLI is installed
  3. Install the /commitaid command if needed
  4. Generate a commit message using Claude AI
  5. Open your editor to review/edit the message
  6. Create the git commit

Configuration

Set Commit Specification

By default, CommitAid uses the Conventional Commits specification. You can override this with custom guidelines:

commitaid config set commit-spec "Use Angular commit style with type(scope): description and detailed body"

To view the current specification:

commitaid config view commit-spec

Enable Auto Sign-off

Automatically add a Signed-off-by line to commits:

commitaid config set auto-signoff enabled

To disable:

commitaid config set auto-signoff disabled

View Configuration

View all configuration:

commitaid config view

View specific configuration:

commitaid config view commit-spec

Help

Display help information:

commitaid help

Configuration Keys

Key Type Description
commit-spec string Custom commit message specification/guidelines for Claude (defaults to Conventional Commits)
auto-signoff enabled/disabled Automatically add Signed-off-by line to commits

How It Works

  1. Validation: CommitAid checks that you're in a git repository and that required tools (git, claude) are installed

  2. Command Installation: If the /commitaid Claude command doesn't exist, it's automatically downloaded and installed to ~/.claude/commands/

  3. AI Generation: Claude analyzes your git status and diff to generate a contextual commit message following the Conventional Commits specification (or your custom commit-spec if configured)

  4. Interactive Editing: The generated message opens in your preferred editor ($EDITOR or $VISUAL, defaults to vim)

  5. Commit: After you save and close the editor, CommitAid creates the git commit with your message (and optional sign-off)

Environment Variables

  • EDITOR or VISUAL - Preferred text editor (defaults to vim)
  • COMMITAID_SPEC - Commit specification (set automatically from config)

File Locations

  • Configuration: ~/.config/commitaid/config.json
  • Claude command: ~/.claude/commands/commitaid.md
  • Temporary edit file: .git/COMMIT_EDITMSG_*.txt

Examples

Basic Usage

# Stage your changes
git add .

# Generate and create commit
commitaid

With Custom Specification

# Set your commit style
commitaid config set commit-spec "
- Use conventional commits (feat:, fix:, docs:, etc.)
- Keep first line under 72 characters
- Include ticket number if available
- Add detailed explanation in commit body
"

# Generate commits following your specification
commitaid

With Auto Sign-off

# Enable sign-off
commitaid config set auto-signoff enabled

# All commits will include Signed-off-by line
commitaid

Troubleshooting

Claude CLI not found

Install Claude CLI from the official documentation.

Not in a git repository

Ensure you're running commitaid from within a git repository:

git rev-parse --git-dir

Editor not opening

Set your preferred editor:

export EDITOR=nano  # or vim, emacs, code --wait, etc.

Development

Setup Development Environment

# Clone repository
git clone https://github.com/yourusername/commitaid.git
cd commitaid

# Install in editable mode
pip install -e .

Project Structure

commitaid/
├── src/
│   └── commitaid/
│       ├── __init__.py      # Package initialization
│       ├── cli.py           # CLI entry point and argument parsing
│       ├── config.py        # Configuration management
│       └── workflow.py      # Main workflow logic
├── pyproject.toml           # Package configuration
└── README.md               # This file

License

MIT License - See LICENSE file for details

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Acknowledgments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

commitaid-0.1.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

commitaid-0.1.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file commitaid-0.1.0.tar.gz.

File metadata

  • Download URL: commitaid-0.1.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for commitaid-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b8193fc66af7cae24551ca2e6b5bca54853cfff227c4d15cb49009fa7878c72f
MD5 b07722a6707d73b094b24677d0ca6cd1
BLAKE2b-256 a1d58261a7b11c0885dbc86253306f279a9bf746989b37994a81ec8018e2bdaf

See more details on using hashes here.

File details

Details for the file commitaid-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: commitaid-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for commitaid-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8e36ebe84ef222b01db061fbb28bc605849ca151f5d9c3411a3fc1aab74b87b2
MD5 b8079ae450247223ee486fb2fc1ea6fd
BLAKE2b-256 1939516d3dced6d8f9c1875f0c9c15fa8ecbe7ce4979ee11972626d31be29e82

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page