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
  • 🎨 Custom commit specifications/guidelines
  • ✍️ 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 Conventional Commits-like 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
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 which can be tailored to a custom specification.

  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
- 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.1.tar.gz (11.0 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.1-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: commitaid-0.1.1.tar.gz
  • Upload date:
  • Size: 11.0 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.1.tar.gz
Algorithm Hash digest
SHA256 3c3c04389d0fd36dbb7559d2e727c6a89ee70d6c834016f76d8dd81d9dfe9497
MD5 a7ea16a133046a86146f1a856aa768b4
BLAKE2b-256 4f6567a2666a3faa1948f8dd872efc2c28c79afc7d283504be3aa1128dfabbf0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: commitaid-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.3 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b7f7a97f36144d6dd9a10227911a1dbee9c0375b2aa8ec37c5827060ab0d9a06
MD5 c3bb1c61b96f239178788b0ba38ba60e
BLAKE2b-256 ecc8e64b5c3be247fbc1f13075ced15ef43613b5436f278e8bce07d0d6c55720

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