Skip to main content

Use LLM to create git commits

Project description

cai

cai is a Git extension written in Python that automates commit message creation. It allows you to run git cai to automatically generate a commit message based on changes and new additions in your repository.

cai leverages a large language model (LLM) to generate meaningful and context-aware commit messages. Currently, it supports the OpenAI and Gemini API for generating commit messages.

Table of Contents

About

cai is designed to simplify your Git workflow by automatically generating commit messages using an LLM. No more struggling to summarize changes — git cai does it for you.

Currently, the only supported backend are the OpenAI and Gemini API, but additional LLM integrations may be added in the future.

Prerequisites

  • Python 3.10 or higher
  • Pipx or Pip if installed in a virtual environment
  • API key, currently supported
    • OpenAI
    • Gemini

Features

  • Automatically detects added, modified, and deleted files
  • Generates meaningful commit messages using an LLM
  • Seamless integration with Git as a plugin/extension
  • Written in Python for easy customization

Installation

Install by

pipx install git-cai-cli

Afterwards set cai to PATH by

pipx ensurepath

Restart your shell by executing bash or zsh or whatever else is your used shell.

Usage

Once installed, you can use cai like a normal Git command:

git cai

cai automatically creates a configuration file at: ~/.config/cai/token.yml This file stores your OpenAI API key, which is used every time you run git cai. Open ~/.config/cai/token.yml and store your token from OpenAI. If a cai_config.yml file exists in the root of your repository, cai will use the settings defined there. Otherwise, it falls back to default settings, which are automatically created in the same directory as token.yml if they don’t already exist. Currently, the only configurable options are:

  • LLM model
  • Temperature

cai uses Git’s diff output as input for generating commit messages.
To exclude specific files or directories from being included in the generated commit message, create a .caiignore file in the root of your repository. This file works like a .gitignore.

  • Files listed in .gitignore are always excluded.
  • .caiignore is only needed for files that are tracked by Git but should not be included in the commit message.

License

This project is licensed under the MIT License.

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

git_cai_cli-0.1.0.tar.gz (57.5 kB view details)

Uploaded Source

Built Distribution

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

git_cai_cli-0.1.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for git_cai_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0e73223408f190396cf6b083740fa8433f7148e6f03a36cb8d295ccea88b9897
MD5 06993b138abf00642b31b8853b1ad276
BLAKE2b-256 35d6965735af58ff6774222bd974f60a1bbb35681269d31bc79a36e191c233e1

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for git_cai_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b2191aa07c6a16d04af8e10383dd7d580b0b6079e7cf2b01c45ad46e31ed47a0
MD5 574209d69a8b0d2351b8f6edf34e098a
BLAKE2b-256 0afb31e182e99a30e21747720ca656b595d30b59114de8063b026f4206d7c319

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