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

Uploaded Python 3

File details

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

File metadata

  • Download URL: git_cai_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 74.1 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.tar.gz
Algorithm Hash digest
SHA256 36fb55223ad430b7d3dc6bf60fd4e04f6ac567acee5546d5aa8c2df781061461
MD5 786a0ebbdb2773f834f6722ca4b495c7
BLAKE2b-256 e6c399bb2d87c16628017468c9ae6dd18ee2e63644109150bee0450a9f22b83f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: git_cai_cli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.2 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 77704310aba9ec21c2791878f58ea8355d738b9034cccc2a4f44896d7b452673
MD5 e67ecdfbe158a2bab2370907ac1619bf
BLAKE2b-256 854e6c5e521211554090a935beaf7d3ebd382c3657033c210d42262be4df1f2c

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