commit-muse
v1.0.3
Published
Transform your Git commit messages into poetic or styled text using Gemini.
Downloads
17
Maintainers
Readme
Commit-Muse
A Git commit-message hook installer that rewrites your commit messages in any style using Google’s Gemini AI.
commit-muse hooks into your project’s Git workflow to automatically “bardify” (rewrite) your commit messages in the style of your choice. Powered by Google’s Gemini API, it transforms raw commit text into a single concise sentence in fun or formal styles—all without leaving your terminal.
Features
- 📜 Automated rewriting of Git commit messages
- 🎭 Custom styles: Shakespeare, Haiku, Formal, and more
- 🔧 Easy installation via npm / npx
- 🔒 Configurable via environment variables
- ⚙️ Built‑in installer to place the
commit-msghook
Installation
Install globally:
npm install -g commit-museor install per-project as a dev dependency:
npm install --save-dev commit-museThen run the installer to register the Git hook:
npx commit-museThis copies hook.sh into .git/hooks/commit-msg and makes it executable.
Configuration
Before using, set your Gemini API key and optionally choose a style:
| Variable | Default | Description |
| ---------------- | ------------- | ----------------------------------------------------- |
| GEMINI_API_KEY | (required) | Your Google Gemini API key |
| COMMIT_STYLE | Shakespeare | The writing style to apply (e.g., Shakespeare, Haiku) |
You can set these in your shell:
export GEMINI_API_KEY="YOUR_API_KEY_HERE"
export COMMIT_STYLE="Haiku"To persist these across sessions, add them to ~/.bashrc, ~/.zshrc, or ~/.bash_profile.
set GEMINI_API_KEY=your-api-key-here
set COMMIT_STYLE=HaikuTo make it permanent, use System Environment Variables or setx.
$env:GEMINI_API_KEY="your-api-key-here"
$env:COMMIT_STYLE="Haiku"Usage
Stage your changes:
git add .Commit as usual:
git commit -m "fix user login validation"The hook will automatically run, rewriting your message. To try another style, just set
COMMIT_STYLE:export COMMIT_STYLE="Pirate" git commit -m "add user profile page"Observe the output:
Using style: Haiku ✅ Commit message bardified!Push to remote:
git push
Your AI-enhanced message is now in the commit history.
How It Works
Installer (
bin/install.js): Copieshook.shinto your repo’s.git/hooks/commit-msgand sets the right permissions.Commit Hook (
hook.sh):- Reads your original commit message.
- Sends a prompt (including
COMMIT_STYLE) and the message to the Gemini API. - Overwrites the commit message file with the AI’s single-sentence rewrite.
Requirements
- Node.js v12+ (for the installer script)
jqCLI (for JSON construction and parsing inhook.sh)- A Git repository with a
.gitfolder
Contributing
Contributions, issues, and feature requests are welcome! Fork the repo and send a PR:
- Fork and clone
- Create a feature branch:
git checkout -b feature/new-style - Commit your changes:
git commit -m "feat: add whimsical style option" - Push and open a PR
License
MIT © [Your Name]
Made with ❤️ by Sarita
