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.2.tar.gz (6.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.2-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: messygit-0.1.2.tar.gz
  • Upload date:
  • Size: 6.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.2.tar.gz
Algorithm Hash digest
SHA256 814a1429ad3d7a42b0a79377d799bb156a054d2aa031ad37bde1621b5e04ee99
MD5 03090726318b27733be755150830798a
BLAKE2b-256 a0c008c765598cb0b8d3be55c4e41b393842a2f757ce7af15b117950e1aa280f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: messygit-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.9 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 87d6137d90c946758758eb49821858b3d7c067e33fc410bbac987a9653d91c81
MD5 8d4f9af9378fcc15954a0d87533d793b
BLAKE2b-256 c7e99468ffd4a9c56916ff5919aa225137d5d42d65f126718b9a63df64b7242e

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