mood-msg

Crates.iomood-msg
lib.rsmood-msg
version0.1.0
created_at2025-07-01 13:01:26.801613+00
updated_at2025-07-01 13:01:26.801613+00
descriptionGenerate witty, mood-based git commit messages
homepage
repositoryhttps://github.com/piyush-itis/mood-msg
max_upload_size
id1733196
size51,323
Piyush Sharma (piyush-itis)

documentation

README

mood-msg

Generate witty, mood-based git commit messages from your terminal, powered by local LLMs (Ollama) or a local fallback database.

✨ Features

  • Generate short, witty, sarcastic commit messages based on your mood
  • Uses a local LLM (Ollama) if available, or falls back to a local JSON database
  • Integrates with git globally: just use git commit -m "mood-msg -- tired"
  • Easy installation and setup

🚀 Installation

1. Install Rust (if you don't have it)

Install Rust

2. Install mood-msg globally

From crates.io (recommended):

cargo install mood-msg

Or from the repo:

cargo install --path .

3. (Recommended) Run the install script to set up the global git hook

bash install.sh

This will:

  • Set up a global git hook so you can use git commit -m "mood-msg -- tired" in any repo
  • Ensure your CLI is in your PATH

🛠️ Manual Global Git Hook Setup

If you want to set up the hook manually:

mkdir -p ~/.git-templates/hooks
cat > ~/.git-templates/hooks/commit-msg << 'EOF'
#!/bin/bash
msg=$(cat "$1")
if [[ "$msg" =~ ^mood-msg\ --\ ([a-zA-Z]+)$ ]]; then
    mood="${BASH_REMATCH[1]}"
    new_msg=$(mood-msg "$mood")
    new_msg=$(echo "$new_msg" | sed 's/^\"//;s/\"$//')
    echo "$new_msg" > "$1"
fi
EOF
chmod +x ~/.git-templates/hooks/commit-msg
git config --global core.hooksPath ~/.git-templates/hooks

📝 Usage

Generate a commit message for a mood

mood-msg tired

Use with git (after hook setup)

git commit -m "mood-msg -- tired"

This will automatically replace the commit message with a witty, mood-based message.

💡 How it works

  • Tries to generate a message using a local Ollama LLM (e.g., mistral)
  • If Ollama is unavailable, falls back to a local moods.json file
  • Prints the message in a fun, colored style

📦 Fallback: moods.json

If you want to customize or expand the fallback messages, edit the moods.json file in your project directory.

🧑‍💻 Contributing

Pull requests and issues are welcome!

📄 License

MIT

Commit count: 0

cargo fmt