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.4.tar.gz (8.6 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.4-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: messygit-0.1.4.tar.gz
  • Upload date:
  • Size: 8.6 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.4.tar.gz
Algorithm Hash digest
SHA256 e11855265f1dc997821e30f06a2f198e8ed5af935760f2ff55fadc067d3f13be
MD5 efa4630ee80eb71280df838addb4f87b
BLAKE2b-256 f6ebf75a95a2ec585f8a5ae5aed4c1066f1f15af67a7c4cc39190d3f8c68256e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: messygit-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 11.0 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d6df4c907432143c860ba6608edbd95248087e256c21a85ef1a2305f0d68ef56
MD5 0fda5bc2e64e539b66a0871005b809ee
BLAKE2b-256 093741aa6baa8e170e5e08ea560b61e1b714b5576d29b052eef6fcb562822574

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