Skip to main content

stagepen

Writes a clean conventional-commit message from your staged diff. Run it as a CLI or wire it into a git hook so you never stare at a blank commit prompt again.

CI Python 3.9+ License: MIT

I write a lot of commits, and I noticed I either dashed off a lazy "fix stuff" message or wasted a minute crafting the perfect conventional-commit line. Pasting every diff into a chat window each time isn't it either. So I built stagepen: it reads what you've staged and proposes a proper message, right there in the terminal.

$ git add .
$ stagepen

✍  Proposed commit message:

  feat(auth): add refresh-token rotation

  - rotate the refresh token on every use
  - revoke the prior token family when reuse is detected

The point isn't "ask an AI to write a commit." It's that this lives in your flow — one command, or a hook that fires on every commit — so you don't context-switch at all.

Why it's a tool and not just ChatGPT

Because you'd never paste every diff into a chat window. The value is that it runs where you already are:

  • one command in the repo, no copy-paste
  • can auto-create the commit (-c)
  • works offline with --provider mock or a local model, so nothing has to leave your machine
  • reads only your staged diff, and redacts secrets before sending anything

Install

git clone https://github.com/jay-tank/stagepen.git
cd stagepen
pip install .
# for the Claude / OpenAI providers:
pip install '.[claude]'   # or '.[openai]'

Using it

# stage something, then:
stagepen                     # prints the proposed message
stagepen -c                  # prints it, asks, then commits
stagepen -c -y               # commit without the confirmation prompt
stagepen --provider mock     # offline demo, no key
stagepen --provider ollama   # local model, no key

If you like it, drop it in a git hook so it runs on its own — see docs/USAGE.md.

Providers

Defaults to Claude, but it's provider-agnostic: claude, openai, ollama (local, no key), or mock (offline). Details in docs/PROVIDERS.md.

A note on your secrets

Diffs sometimes contain a stray key or password. stagepen redacts common secret patterns before the diff is ever sent to a model, and it only ever reads your staged changes.

Limitations

  • It writes the message from the diff, so a huge diff gets truncated to keep the prompt sane. For sprawling commits the message is a strong starting point, not gospel.
  • Quality tracks the diff quality: tiny, focused commits get the best messages (which is how you should be committing anyway).

License

MIT — see LICENSE.

Metadata

Release files for stagepen 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stagepen 0.1.0
File Size Uploaded
stagepen-0.1.0.tar.gz 12.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for stagepen 0.1.0
File Interpreter ABI Platform
stagepen-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.6 kB

Release files / stagepen-0.1.0.tar.gz

Download URL stagepen-0.1.0.tar.gz
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ed91d108d2a36e6eb1c9f0c983b8fe237fcecf84a62af4d3957762f1bd1c4bb7
BLAKE2b-256 checksum
How to use checksums
ca1b835cac8428d25a20ece91df03e72c9e6b1ad4912730fd98d7a238d45f7fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / stagepen-0.1.0-py3-none-any.whl

Download URL stagepen-0.1.0-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7bb4e8a76c27eb8b1b27246c885e0c3b123905a59ca3daf61c06e22ba02142ca
BLAKE2b-256 checksum
How to use checksums
0efb79c6424eb413d7447ea2f82333d6a24c0103bd8cdada99f4a6baa719ebeb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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