Skip to main content

ai-commit

Generate clean git commit messages from your staged diff using Codex or OpenCode.

ai-commit is a small Python CLI that works in any git repository. It stages changes by default, asks an AI provider for a Conventional Commit message, shows a preview, and then asks before creating the commit.

Default model:

codex/gpt-5.4-mini

Preview

Files changed:
  M src/foo.ts
  A tests/foo.test.ts

Suggested:
  feat(cli): add provider selection

Install

For local development, use a virtual environment:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e .

If you want to install the CLI from this local checkout as an app, use pipx:

pipx install -e .

After publishing to PyPI, the intended public install path is:

pipx install ai-commit

Usage

Create a commit from all current changes:

ai-commit

Use a model shortcut:

ai-commit gpt
ai-commit kimi
ai-commit qwen
ai-commit glm
ai-commit minimax

Use only files that are already staged:

ai-commit --staged-only

Show the preview without creating a commit:

ai-commit --dry-run

Hide progress messages:

ai-commit --quiet

Force a provider for one run:

ai-commit --provider codex
ai-commit --provider opencode

Force a model for one run:

ai-commit --provider opencode --model opencode-go/kimi-k2.5

Skip the confirmation prompt:

ai-commit --yes

Configuration

Optional global config file:

~/.config/ai-commit/config.json

Example:

{
  "provider": "codex",
  "codex_model": "gpt-5.4-mini",
  "opencode_model": "opencode-go/kimi-k2.5",
  "confirm": true,
  "staged_only": false,
  "max_diff_chars": 120000
}

By default, ai-commit runs git add -A before reading the staged diff. Set "staged_only": true or pass --staged-only to commit only changes you staged manually.

Providers

For Codex, the codex command must be available in PATH.

For OpenCode, the opencode command must be available in PATH.

For OpenCode Go, use model ids like:

ai-commit kimi    -> opencode-go/kimi-k2.5
ai-commit qwen    -> opencode-go/qwen3.6-plus
ai-commit glm     -> opencode-go/glm-5
ai-commit minimax -> opencode-go/minimax-m2.5

Equivalent model ids:

opencode-go/kimi-k2.5
opencode-go/glm-5
opencode-go/minimax-m2.5
opencode-go/qwen3.6-plus

VS Code or Windsurf

You can call the CLI from a global user task:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "AI Commit",
      "type": "shell",
      "command": "ai-commit",
      "options": {
        "cwd": "${workspaceFolder}"
      },
      "presentation": {
        "reveal": "always",
        "panel": "dedicated",
        "focus": true
      },
      "problemMatcher": []
    }
  ]
}

Development

Run tests:

python -m pip install -e .
python -m unittest discover -s tests

Without installing the package:

PYTHONPATH=src python -m unittest discover -s tests

Check the CLI:

ai-commit --version

Metadata

Release files for ai-commit-cli-tool 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ai-commit-cli-tool 0.1.1
File Size Uploaded
ai_commit_cli_tool-0.1.1.tar.gz 13.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ai-commit-cli-tool 0.1.1
File Interpreter ABI Platform
ai_commit_cli_tool-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 26.5 kB

Release files / ai_commit_cli_tool-0.1.1.tar.gz

Download URL ai_commit_cli_tool-0.1.1.tar.gz
Size 13.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4b57ccd3ce9ec6735fbfdbf78c0b51bc4525d61f07657de47280f8d3fbdc353e
BLAKE2b-256 checksum
How to use checksums
986e23cea05954c9ae452cce36ae6ae8f9cffc3a9a09a72f0b6b30fb7e51cd99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 22, 2026.

Transparency log

Release files / ai_commit_cli_tool-0.1.1-py3-none-any.whl

Download URL ai_commit_cli_tool-0.1.1-py3-none-any.whl
Size 13.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3d5aa7ece232a48ac9fd121523491ac8fafda8bbb5b188014b3a91ce6ed3b3e6
BLAKE2b-256 checksum
How to use checksums
15a20e655de1c7af702adedbc0b6f60fd34a12bbe586ef1a5bb814d15f46485b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 22, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page