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

Uploaded Python 3

File details

Details for the file git_cai_cli-0.1.1.dev0.tar.gz.

File metadata

  • Download URL: git_cai_cli-0.1.1.dev0.tar.gz
  • Upload date:
  • Size: 58.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.1.dev0.tar.gz
Algorithm Hash digest
SHA256 398e93bdcf65384d7b4a7dd63bf45b998331d3373fec0f28578489e48f253f8a
MD5 2c6920c8f5805ccbc3804850bbd837db
BLAKE2b-256 346c5fa954d3610d601f85d99afb039b01be532c309025cd09ab6c6168ffd40e

See more details on using hashes here.

File details

Details for the file git_cai_cli-0.1.1.dev0-py3-none-any.whl.

File metadata

File hashes

Hashes for git_cai_cli-0.1.1.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 d393b42704501b5e4dc47ae070d5b3d23792824aef6a942d59a3eadcff51a7e9
MD5 49f2a80cc8e1699e88008992769867ad
BLAKE2b-256 ca19be9706ede5aebb35b531feebaaaba118fa359a24f0be2c1e4bd072d777fe

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