AI-generated Git commits with diff compression pipeline

dogbless1 pts1 comments

GitHub - benS-03/commait: A CLI tool for ai generated commit messages. · GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

benS-03

commait

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>68 Commits<br>68 Commits

demo

demo

dist

dist

src

src

tests

tests

.DS_Store

.DS_Store

.env.example

.env.example

.gitignore

.gitignore

README.md

README.md

commait-1.0.0.tgz

commait-1.0.0.tgz

package-lock.json

package-lock.json

package.json

package.json

tsconfig.json

tsconfig.json

tsconfig.test.json

tsconfig.test.json

View all files

Repository files navigation

Commait

AI-generated commit messages, built to save on tokens and time.

Writing good commit messages is not hard, but why do it if AI can do it faster and better. Commait reads a staged diff and writes one for you in seconds. Includes a compression algorithm to reduce diff tokens.

Install

$npm install commait-cli

Quick Start

Ensure you have an API key for either OpenAI or Anthropic in your .env file. Use standard naming conventions (ex. ANTHROPIC_API_KEY)

Then run

$commait config init

to initialize the configurations to your preferences.

Note: initializing config is not necessary as it will be done automatically if no config file exists.

Usage

To commit staged changes, run:

$commait commit

This will generate a message, commit, and push to remote all in one command. It will either prompt you with options or skip prompts based on config.

Features

One-command workflow : Generate, commit, and push changes with a single command.

Multi-provider support : Generate messages using OpenAI or Anthropic with a simple config change.

Fully configurable automation : Dial in exactly how hands-off you want it: auto-stage changes, auto-commit the generated message, auto-push to your remote, or keep every step interactive with prompts.

Token budget control : Cap the max diff tokens sent per request, so generation cost stays predictable even on large diffs.

Diff compression pipeline : If token budget exceeded by raw diff, a custom staged compression pipeline runs, checking the tokens against the budget at each stage to reduce information loss as much as possible while still getting below budget. See compression section for more details.

Custom prompts : Override the default prompt template to match your team's commit conventions or personal style.

Optional Context : Prompt can be prefixed with custom context line using -c flag with committing.

Interactive model picker : Browse and select models within your chosen provider without needing to memorize exact model name strings.

Configurable remotes : Set a default push target, or get prompted for which remote to use on every commit.

Configuration

To run through edit all config options one by one run:

$commait config init

Or to edit a single option run:

$commait config set [option]

A full list of options can be seen below or gotten by running:

$commait config options

Config Options

provider : Which AI provider to use for generation.

model : which model to use within selected provider.

prompt : What to prompt provider with, a default prompt is provided.

auto_stage : whether or not you want commit to automatically stage all files without prompting.

auto_commit : whether or not you want to automatically commit after generation without prompting.

auto_push : whether or not you want to automatically push after commit without prompting.

max_diff_tokens : the maximum amount of tokens sent to AI.

default_origin : the default remote to push to.

ask_origin : whether or not you want to be asked what remote to push to upon commit.

Diff Compression

The compression pipeline works in stages, each one being increasingly more aggressive. After each stage runs, the new token count is checked against the budget so that unnecessary information loss does not occur. The 4 stages are as follows:

Strip Noise Files : This removes any non user generated files, like package-lock, gemfiles, dist...

commit commait config json diff compression

Related Articles