#git-commit #commit-message #commit #git #ai #openai #openai-api

app aicommits-rs

A CLI that writes your git commit messages for you with AI

4 releases (2 breaking)

0.3.0 Mar 13, 2023
0.2.0 Mar 11, 2023
0.1.1 Mar 9, 2023
0.1.0 Mar 9, 2023

#2950 in Command line utilities

MIT license

19KB
322 lines

aicommits-rs


Crate Status Build Status Docs Status

A CLI that writes your git commit messages for you with AI. This project was inspired by AI Commits and has been ported to Rust.

asciicast

All the commit messages in this repo were generated by this tool.

Installation

Using Cargo

  1. Install Rust and Cargo. Then run:
cargo install aicommits-rs
  1. Retrieve your API key from OpenAI

    Note: If you haven't already, you'll have to create an account and set up billing.

  2. Set your API key as an environment variable:

export OPENAI_API_KEY=<your_api_key>

Homebrew (Mac Only)

Run the following command to install the latest version of the CLI tool:

brew install EtaCassiopeia/tap/aicommits-rs

Linux

run the following command to install the latest version of the CLI tool:

curl -L //TBD

Usage

aicommits-rs

How it works

This CLI tool uses git diff to obtain all of the most recent code changes, and then sends them to OpenAI's GPT-3 to generate a commit message that is returned. If the returned commit message is not satisfactory, you can run the command again to generate a new commit message, otherwise you can use the returned commit message to commit your changes.

Note: An error may occur when the number of changes being made to a file is too large for the OpenAI API to process. To avoid this error, try reducing the number of staged changes or writing your own commit message.

Note: This tool is still in development, and is not guaranteed to work as expected.

Dependencies

~11–27MB
~432K SLoC