Skip to main content

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

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_commit_cli_tool-0.1.1.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_commit_cli_tool-0.1.1-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file ai_commit_cli_tool-0.1.1.tar.gz.

File metadata

  • Download URL: ai_commit_cli_tool-0.1.1.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ai_commit_cli_tool-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4b57ccd3ce9ec6735fbfdbf78c0b51bc4525d61f07657de47280f8d3fbdc353e
MD5 de83c78e98d0e919d48750cea2f7e6ca
BLAKE2b-256 986e23cea05954c9ae452cce36ae6ae8f9cffc3a9a09a72f0b6b30fb7e51cd99

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_commit_cli_tool-0.1.1.tar.gz:

Publisher: publish.yml on matheusz-nied/ai-commit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ai_commit_cli_tool-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ai_commit_cli_tool-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3d5aa7ece232a48ac9fd121523491ac8fafda8bbb5b188014b3a91ce6ed3b3e6
MD5 a9a14d2dc0c53b0ef299433c384c9c34
BLAKE2b-256 15a20e655de1c7af702adedbc0b6f60fd34a12bbe586ef1a5bb814d15f46485b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_commit_cli_tool-0.1.1-py3-none-any.whl:

Publisher: publish.yml on matheusz-nied/ai-commit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page