Skip to main content

cmt-cli logo

cmt-cli

PyPI version Python versions License Tests

AI-powered CLI tool that analyzes your staged Git changes and suggests a professional commit message.

Table of Contents

Features

  • Analyzes staged Git changes (added, modified, deleted, and renamed files, plus diffs)
  • Generates a commit message and description using OpenAI (via LangChain)
  • Summarizes all current working-tree changes (staged and unstaged) with cmt summary
  • Review, edit (in vim), or reject the suggested message before committing
  • Caches suggestions per diff/model to avoid redundant API calls
  • Simple configuration for your OpenAI API key and model

Requirements

  • Python 3.12+
  • Git
  • vim installed and available on your PATH (used for the e / edit option)
  • An OpenAI API key

Installation

uv tool install cmt-cli

Configuration

Before first use, configure your OpenAI API key and model:

cmt config set

If no model is specified, cmt-cli defaults to gpt-4o-mini. Configuration is stored in ~/.config/cmt/config.ini. Note that your API key is saved there in plain text, so keep the file private (for example chmod 600 ~/.config/cmt/config.ini). Logs are written to ~/.config/cmt/logs.

To view your current configuration:

cmt config get

Usage

Stage your changes as usual, then run:

git add .
cmt suggest

You'll be shown a suggested commit message and can choose to:

  • y — commit with the suggested message
  • e — edit the message in vim before committing
  • n — abort

To get an AI-generated summary of all your current changes (staged and unstaged, compared to HEAD) without committing:

cmt summary

Other commands:

cmt --version   # print the installed version
cmt update      # check whether a newer version is available

Updating

cmt update

This checks PyPI for a newer release. If one is available, upgrade it with:

uv tool upgrade cmt-cli

Uninstalling

uv tool uninstall cmt-cli

Privacy & Cost

cmt suggest sends your staged diff (and cmt summary your current diff) to the OpenAI API to generate a commit message, so avoid staging secrets or sensitive data before running it. Each request uses your own OpenAI API key and is subject to OpenAI's standard usage pricing; cmt-cli caches suggestions per diff/model locally (~/.config/cmt/cache) to help avoid redundant, repeat API calls.

Development

Clone the repo and install dependencies with uv:

git clone https://github.com/bijaydas/cmt.git
cd cmt
uv sync --all-groups

Run the test suite and linter:

uv run pytest
uv run ruff check .
uv run ruff format --check .

License

This project is licensed under the terms of the MIT license.

Metadata

Release files for cmt-cli 1.4.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 cmt-cli 1.4.1
File Size Uploaded Provenance Actions
cmt_cli-1.4.1.tar.gz 109.5 kB Without provenance Details for cmt_cli-1.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cmt-cli 1.4.1
File Interpreter ABI Platform Actions
cmt_cli-1.4.1-py3-none-any.whl Python 3 none any Details for cmt_cli-1.4.1-py3-none-any.whl

Total release size: 129.2 kB

Release files / cmt_cli-1.4.1.tar.gz

Download URL cmt_cli-1.4.1.tar.gz
Size 109.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3795d6af05848c47883dec4b3da9bad7e8036e75816d49f58ca06970d3df990a
BLAKE2b-256 checksum
How to use checksums
655254f56d240c88a1c9cc87a13e7e0ee274e7e19a1e1c8c57d46c44635a590c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.13

Release files / cmt_cli-1.4.1-py3-none-any.whl

Download URL cmt_cli-1.4.1-py3-none-any.whl
Size 19.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3067433079c83345840e6b1f39389a7d490027b6bb46e628748a5af988dc589
BLAKE2b-256 checksum
How to use checksums
082c0caca3aa43b0b253b186d8fe4f2e64e8c7054c957d96d9d84af7e5e0c4af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.13

Security for cmt-cli 1.4.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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