Skip to main content

CLI that drafts Conventional Commits from staged git diffs with Claude, then commit, cancel, or edit.

Project description

messygit

messygit is a command-line tool that reads your staged Git changes, asks Claude (via the Anthropic API) to suggest a Conventional Commits subject line, and then lets you commit, cancel, or edit the message before running git commit.

Why use it

  • Keeps commit subjects consistent (feat(scope): describe the change) without thinking up wording from scratch.
  • Only the staged diff is sent to the model—what you git add is what gets summarized.
  • The API key is never printed in full; show uses a masked preview.
  • Clear errors for missing keys, rejected keys, and billing or zero-balance situations.

Requirements

  • Python 3.10 or newer
  • Git (run inside a repository)
  • An Anthropic API key with access to the Messages API

Installation

pip install messygit

This installs the messygit command (see [project.scripts] in pyproject.toml).

Install from source

From a checkout of this project:

cd messygit
python -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -e .

API key

messygit resolves the key in this order:

  1. Environment variable ANTHROPIC_API_KEY
  2. Config file ~/.messygit/config.json (written by messygit config)

If neither is set, the default command exits with a short message explaining how to fix it.

Save a key to the config file:

messygit config --key YOUR_ANTHROPIC_API_KEY

Show a masked key (which source is active, without revealing the secret):

messygit show

Usage

Typical flow:

git add .
messygit
  1. If there is nothing staged, messygit tells you to run git add first.
  2. Otherwise it sends the staged diff to Claude and prints a suggested one-line message.
  3. You are prompted: commit (default), no (cancel), or edit (open $EDITOR to change the message).
  4. On confirmation, it runs git commit -m "..." with your chosen text.

Commands

Command Description
messygit Generate a message from git diff --staged, then prompt to commit / cancel / edit.
messygit config --key KEY Store the Anthropic API key under ~/.messygit/config.json.
messygit show Print a masked API key and whether it comes from the environment or config file.

Commit message style

The model is instructed to follow Conventional Commits, for example:

feat(auth): validate refresh tokens

Allowed types include: feat, fix, docs, style, refactor, test, chore. Subjects are one line, imperative, lowercase, no trailing period, and kept within a reasonable length (see your prompts in the package if you customize behavior).

Development

Without installing the package, from the repository root (the directory that contains the messygit package folder):

.venv/bin/python -m messygit.cli

Subcommands:

python -m messygit.cli config --key YOUR_KEY
python -m messygit.cli show

License

MIT (see pyproject.toml).

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

messygit-0.1.3.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

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

messygit-0.1.3-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file messygit-0.1.3.tar.gz.

File metadata

  • Download URL: messygit-0.1.3.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.5 cpython/3.13.5 HTTPX/0.28.1

File hashes

Hashes for messygit-0.1.3.tar.gz
Algorithm Hash digest
SHA256 236f071e118eb40f44eee6d2502fa8445a8dc2537f2d61640af2ac1f5e6aadc4
MD5 2a1b974d9493dbb3e81f1b32e7e8fa5c
BLAKE2b-256 99d0afa0d955585c106900be58b7b3d49111639bd3da9bd23230274d0c8303df

See more details on using hashes here.

File details

Details for the file messygit-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: messygit-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.5 cpython/3.13.5 HTTPX/0.28.1

File hashes

Hashes for messygit-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 55756482ad15b5de1bd493b6a83668d0a3a1ba26f9709389572377bf51e8fb5a
MD5 4846f4aa053d9d7a5392978985373ae5
BLAKE2b-256 f03be513178f9beec74e11997cb79eb97c3e8db15c2462fb35465d00a3ec6c48

See more details on using hashes here.

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