A CLI tool that automatically writes commit messages for you.

Overview

banner

Automagically-generated commit messages

A CLI tool that generates commit messages from your staged changes, built in Rust and using OpenAI's Codex.

Installation

You can install auto-commit by running the following command in your terminal.

curl -fsSL https://raw.githubusercontent.com/m1guelpf/auto-commit/main/install.sh | sh -

Or, if you're an arch user, you can download it from the AUR using

yay -S auto-commit

You may need to close and reopen your terminal after installation. Alternatively, you can download the binary corresponding to your OS from the latest release.

Usage

auto-commit uses OpenAI's Codex, which is currently in private beta. To use it, you'll first need to to request access to Codex. Once you get access, grab an API key from your dashboard, and save it to OPENAI_API_KEY as follows (you can also save it in your bash/zsh profile for persistance between sessions).

export OPENAI_API_KEY='sk-XXXXXXXX'

Once you have configured your environment, stage some changes by running, for example, git add ., and then run auto-commit.

Of course, auto-commit also includes some options, for editing the message before commiting, or just printing the message to the terminal.

$ auto-commit --help
Automagically generate commit messages.

Usage: auto-commit [OPTIONS]

Options:
  -v, --verbose...  More output per occurrence
  -q, --quiet...    Less output per occurrence
      --dry-run     Output the generated message, but don't create a commit.
  -r, --review      Edit the generated commit message before committing.
  -h, --help        Print help information
  -V, --version     Print version information

Develop

Make sure you have the latest version of rust installed (use rustup). Then, you can build the project by running cargo build, and run it with cargo run.

License

This project is open-sourced under the MIT license. See the License file for more information.

You might also like...
Log defmt messages over the serial port.
Log defmt messages over the serial port.

defmt-serial A defmt target for logging over a serial port. Messages can e.g. be read using socat and passed through defmt-print, see example-artemis

Searchbuddy is a browser extension that lets you chat with people that are searching for what you're searching for.
Searchbuddy is a browser extension that lets you chat with people that are searching for what you're searching for.

searchbuddy Make friends while searching! Searchbuddy is a browser extension that lets you chat with people that are searching for what you're searchi

Flexcord! A custom Discord client to allow you to do what you want!

Disclaimer Flexcord is NO WHERE near done. Flexcord What is it? Flexcord is a Discord client that flexes for your needs, it allows you to do exactly w

Bongo Copy Cat wants to be involved in everything you do but instead just imitates you hitting your keyboard all day. After all it's just a cat.
Bongo Copy Cat wants to be involved in everything you do but instead just imitates you hitting your keyboard all day. After all it's just a cat.

Bongo Copy Cat Introduction Bongo Copy Cat wants to be involved in everything you do but instead just imitates you hitting your keyboard all day. Afte

Crate of GitHub’s collection of gitignores, embedded, automatically updated

Gitignores GitHub’s collection of gitignores, embedded, automatically updated. API documentation. Public Domain via CC0-1.0 (same as source data). MSR

A git hook to manage derivative files automatically.

git-derivative A git hook to manage derivative files automatically. For example if you checked out to a branch with different yarn.lock, git-derivativ

Automatically build a Rust module tree from the project directory structure

Hypermod An even lazier version of automod and supermod. Searches the src/ directory recursively for .rs files, then builds a module tree using the di

Automatically cross-compiles the sysroot crates core, compiler_builtins, and alloc.

cargo-xbuild Cargo-xbuild is a wrapper for cargo build, which cross compiles the sysroot crates core, compiler_builtins, and alloc for custom targets.

Automatically transform your Next.js Pages to use SuperJSON with SWC

🔌 NEXT SUPERJSON PLUGIN export default function Page({ date }) { return ( div Today is {date.toDateString()} /div ) } // You c

Comments
  • How to reduce prompt/ completion length?

    How to reduce prompt/ completion length?

    auto-commit
    Loading Data...
    ▗ Analyzing Codebase...thread 'main' panicked at 'Couldn't complete prompt.: Api(ErrorMessage { message: "This model's maximum context length is 8001 tokens, however you requested 11523 tokens (9523 in your prompt; 2000 for the completion). Please reduce your prompt; or completion length.", error_type: "invalid_request_error" })', src/main.rs:137:10
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    ▖ Analyzing Codebase...%    
    

    I assume my codebase && commit history is too big and exceeds open AI limitations. Is there a way to reduce codebase analysis?

    opened by metart43 1
  • Add option to skip commit confirmation.

    Add option to skip commit confirmation.

    Currently the prompt asks for a "yes" or "no" to decided whether to make a commit or not. It would be nice to have a flag that skips this question.

    opened by trevorhere 0
  • Read `OPENAI_API_KEY` from config

    Read `OPENAI_API_KEY` from config

    I've used a handful of tools that use codex, and so far most have been able to read the API key from a file, as well as ENV. This is pretty convenient, since I've been able to reference a few of them to the same ~/.config/openaiapirc file, while others have their own folder within ~/.config.

    opened by wallentx 0
  • Common installation expectations

    Common installation expectations

    Hi! Thanks for this cool project.

    I discovered, and installed this tool from the AUR, and after installation, I couldn't identify what files had been installed as a result. Files installed via pacman, or from the AUR via a helper are typically discoverable by running pacman -Qql auto-commit, where you'd see the path of the new binary/lib/service/doc as a result of the installation, but that query returned nothing after installing auto-commit.

    I looked at the PKGBUILD and saw that it was executing install.sh during the package() step. This works fine, but results in some unexpected behavior:

    • New files added to the system are not known to pacman, so the user cannot query them, nor can the files be removed during an uninstall
    • The install.sh script suggests placing the executable binary in ~/.bin, which is not a standard directory (though maybe common? I've always used a ~/bin, and haven't seen ~/.bin used before) installing them)
    • Running makepkg on the PKGBUILD file locally results in a failure, as it appears to contain some errors
    • Installing this from the AUR resulted in a pre-compiled binary being installed, which wasn't what I was expecting (though you could say that I should probably be reviewing every PKGBUILD before

    I normally expect the AUR package name to inform me as to what will be executed:

    • <pkg-name>: I'll be building a tarball of the latest release
    • <pkg-name>-git: I'll be building from the HEAD of the main branch
    • <pkg-name>-bin: I'll be pulling a pre-built binary from the latest release
    • <pkg-name>-bin-git/<pkg-name>-nightly(-bin): I'll be pulling a pre-built binary from some build process that happens more frequently than tagged releases (pre-release/dev/nightly)

    I'm not at all suggesting that any of those things are hard rules or anything, but rather I just wanted to open the conversation. I created a draft PR that contains some possible configurations to see if you felt there was a particular one that you might favor, or all if you'd like. https://github.com/m1guelpf/auto-commit/pull/10 I didn't do any workflow modification since this was more of an exploratory effort.

    opened by wallentx 0
Owner
Miguel Piedrafita
20-year-old maker
Miguel Piedrafita
A git prepare-commit-msg hook for authoring commit messages with GPT-3.

gptcommit A git prepare-commit-msg hook for authoring commit messages with GPT-3. With this tool, you can easily generate clear, comprehensive and des

Roger Zurawicki 3 Jan 19, 2023
A dead-simple AI-powered CLI tool for effortlessly crafting meaningful Git commit messages

AI Commit Message acm A dead-simple AI-powered CLI tool for effortlessly crafting meaningful Git commit messages. Features Effortlessly create meaning

syeijs 3 Nov 5, 2024
A gitmoji interactive client for using gitmojis on commit messages.

gitmoji in Rust This is just an opinionated version of gitmoji-cli written in Rust . A gitmoji interactive client for using gitmojis on commit message

igor 2 Aug 16, 2022
Easily add emojis to your git commit messages 😎

gimoji A CLI tool that makes it easy to add emojis to your git commit messages. It's very similar to (and is based on) gitmoji-cli but written in Rust

Zeeshan Ali Khan 12 May 29, 2023
Spot coupling by finding out which files are always in the same commit

git moves-together This tells you when files in the repository frequently move together. This lets you identify where the coupling is in the system. C

Billie Thompson 14 Oct 31, 2022
Mirror of oxipng for pre-commit.

oxipng pre-commit mirror Mirror of oxipng for pre-commit. Installation Add to your pre-commit config: - repo: https://github.com/adamchainz/pre-comm

Adam Johnson 11 Jan 15, 2022
Openfare - Monetize software with one commit.

OpenFare ?? Monetize software with one commit. ?? OpenFare monetizes any software library with one code change. The goal: fund the next million softwa

null 172 Dec 2, 2022
Universal changelog generator using conventional commit+ with monorepo support. Written in Rust.

chlog Universal changelog generator using conventional commit+ with monorepo support. chlog can generate the changelog from the conventional commits w

Jeff Yang 3 Nov 27, 2022
A partial reimplementation of pre-commit in Rust

preco A partial reimplementation of pre-commit in Rust. Important Heavily just a proof-of-concept and work-in-progress. There are bits that could prob

Aarni Koskela 8 Feb 22, 2024
Better error messages for axum framework.

axum-debug This is a debugging crate that provides better error messages for axum framework. axum is a great framework for developing web applications

Eray Karatay 3 Feb 3, 2022