Skip to main content

Commitai helps you generate git commit messages using AI

Project description

CommitAi - Your AI-Powered Commit Assistant

CI codecov PyPI Python Version License

CommitAi simplifies the Git commit message creation process by leveraging AI technologies, including GPT-4 and Claude. Designed for developers who value clarity and precision in commit histories, CommitAi offers a streamlined workflow that transforms your staged changes and high-level explanations into informative commit messages. Enhance your project documentation and streamline your development process with commit messages that truly reflect your changes.

Demo

CommitAi Demo

This demo GIF shows CommitAi in action, demonstrating how it generates a commit without any additional input, using Claude 3 Opus.

Features

  • Intelligent Commit Generation: Leverages state-of-the-art AI models to generate meaningful commit messages from your changes.
  • Pre-commit Checks: Automatically runs configured pre-commit hooks to ensure quality and consistency before generating messages.
  • Template Support: Utilizes both global and repository-specific commit message templates to maintain a consistent style across your projects.
  • AI Model Integration: Supports multiple AI models, including GPT-4 by OpenAI and Claude by Anthropic, ensuring versatility in natural language processing capabilities.

Getting Started

Prerequisites

  • Python 3.6 or later
  • API keys for GPT-4 and Claude, as required

Installation

Install CommitAi directly from PyPI:

pip install commitai

Configuration

API Keys

Set the necessary API keys as environment variables:

export OPENAI_API_KEY="your_openai_api_key"
export ANTHROPIC_API_KEY="your_anthropic_api_key"

Commit Templates

Set a global commit template environment variable:

export TEMPLATE_COMMIT="My global custom template: {message}"

Or, create a repository-specific template using:

commitai-create-template "My repository-specific template: {message}"

This creates a hidden template file within the .git directory of your repository.

Usage

To generate a commit message, provide a high-level explanation of your changes:

commitai "This is a high-level explanation of my commit"

Options

  • -a, --add: Stage all changes before generating the commit message.
  • -c, --commit: Automatically create the commit using the generated message.
  • -t, --template: Specify a commit template. Defaults to the global template if available.
  • -m, --model: Choose the AI model (gpt-4 by default).

Additional Commands

  • commitai-create-template: Set a custom template specific to your repository.

Contributing

Contributions are welcome! Feel free to fork the repository, push your changes to a branch, and open a pull request. For bugs, questions, or feature requests, please open an issue through the GitHub issue tracker.

License

CommitAi is open-source software licensed under the MIT License. See the LICENSE file for more details.

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

commitai-0.1.16.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

commitai-0.1.16-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file commitai-0.1.16.tar.gz.

File metadata

  • Download URL: commitai-0.1.16.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for commitai-0.1.16.tar.gz
Algorithm Hash digest
SHA256 ab76df40bf32fedc3e478d4ae2c0f94f5fd431c7c474309f9875cc5a17e9dcc2
MD5 5fbcc9c8d70e0ac576394717fa9d22b5
BLAKE2b-256 92bc607fd7f1df03fe9284f2f0592a6777a571438aed2f0505b3695121a8595d

See more details on using hashes here.

File details

Details for the file commitai-0.1.16-py3-none-any.whl.

File metadata

  • Download URL: commitai-0.1.16-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for commitai-0.1.16-py3-none-any.whl
Algorithm Hash digest
SHA256 39883b8192431bed516729b1db301f161bc61bb90c2588b208be226bfa666501
MD5 3be03a2f8665da2140d6def5d5f72d1d
BLAKE2b-256 be0be35c37f91ada82ec4656c63d4e3a56fb9bdbc06bd2cf4af3971b7a787a0b

See more details on using hashes here.

Supported by

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