Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mostly useless. An agent SKILL is probably a better fit for this problem. But ey, it was fun to make!

ai-commit

A CLI tool that generates git commit messages using AI. It reads your staged changes, sends context to an AI agent with read-only repository access, and proposes a commit message for your approval.

Supports GitHub Copilot CLI and Claude Code as AI backends.

Prerequisites

Installation

Homebrew

brew install torryt/tap/ai-commit

Go

go install github.com/torryt/ai-commit@latest

From source

git clone https://github.com/torryt/ai-commit.git
cd ai-commit
go build -o ai-commit .

Then place the resulting binary somewhere on your PATH.

Usage

# Generate a commit message for already-staged changes
ai-commit

# Stage all changes first, then generate a commit message
ai-commit -A
ai-commit --all

# Use Claude Code instead of Copilot
ai-commit --provider claude

# Use a specific AI model
ai-commit --model claude-opus-4

# Print version
ai-commit --version

Flags

Flag Description
-A, --all Stage all changes (git add -A) before generating the message
--provider AI provider: copilot or claude (default from config or copilot)
--model AI model to use (default: claude-haiku-4.5 for copilot, haiku for claude)
--max-turns Maximum number of agentic turns (default: 3)
--debug Enable verbose debug output
--version Print version and exit

Configuration

You can set a default AI provider in ~/.config/ai-commit/config.json:

{
  "ai_provider": "claude"
}
Field Values Description
ai_provider "copilot", "claude" Default AI provider. Overridden by --provider flag.

Provider resolution order:

  1. --provider flag (if set)
  2. ai_provider from config file
  3. "copilot" (built-in default)

Workflow

  1. Stage your changes (or use -A to auto-stage).
  2. Run ai-commit.
  3. The tool collects the file list and diff stats, then invokes the AI with read-only git access to generate a message.
  4. Review the proposed commit message.
  5. Confirm with y or yes to commit, or anything else to abort.

How It Works

The tool sends the list of changed files and diff statistics to an AI agent. The agent has read-only access to a limited set of git commands (git diff, git log, git show, git blame, git status) so it can inspect the actual changes and commit history for additional context. It then produces a commit message wrapped in <COMMIT_MSG> markers, which the tool extracts and presents for confirmation.

All agent permissions are deny-by-default -- only explicitly whitelisted read-only operations are allowed. For Copilot this uses --allow-tool; for Claude Code this uses --allowedTools.

Releasing

Releases are automated via GoReleaser. To create a new release:

  1. Tag a version: git tag v0.1.0
  2. Push the tag: git push origin v0.1.0
  3. Create a GitHub release from the tag.

The release workflow builds cross-platform binaries and publishes to the Homebrew tap.

Required secrets: HOMEBREW_TAP_TOKEN (a GitHub PAT with repo access to torryt/homebrew-tap).

Project Structure

ai-commit/
├── main.go                          # Entire application
├── go.mod                           # Go module (no external dependencies)
├── .goreleaser.yml                  # GoReleaser config (cross-build + Homebrew)
├── .github/workflows/
│   ├── ci.yml                       # CI: vet + build on push/PR
│   └── release.yml                  # Release: goreleaser on published release
└── .gitignore

About

Let AI write your git commit messages

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages