@vedanshsharma/commit-gen
v1.0.6
Published
CLI to generate Conventional Commits using local LLMs or Gemini
Maintainers
Readme
🚀 Commit Message Generator (commitgen)
A lightning-fast, offline-first CLI tool that reads your staged git diffs and automatically generates professional Conventional Commits using locally running LLMs (via Ollama).
(Replace this text with a Demo GIF once recorded)
✨ Why this tool?
- 100% Offline & Private: Uses local LLMs. Your source code never leaves your machine.
- Zero API Costs: No OpenAI/Anthropic API keys needed.
- Professional History: Strictly adheres to the Conventional Commits specification.
- Gitmoji Support: Optional built-in support for prepending emojis (✨, 🐛, ♻️) to your commits.
- Smart Issue Linking: Automatically appends
Closes #ISSUEto your commits based on your current branch name. - Lightning Fast: Generates and commits in seconds without disrupting your terminal flow.
🛠 Prerequisites
- Node.js (v18+ recommended for native
fetch). - Ollama - You must have Ollama installed and running locally.
- LLM Model - Download your preferred model (default is
mistral):ollama pull mistral
📦 Installation
To install this tool globally on your machine so you can use it in any repository:
npm install -g @vedanshsharma/commit-gen🚀 Usage
Whenever you have changes ready to commit:
Stage your files as usual:
git add <files>Run the CLI:
commitgenThe AI-generated commit message will be presented in a styled box. You can then:
- Accept and Commit instantly
- Regenerate if you want a different variation
- Edit Manually to tweak the generated message inline
- Cancel to abort without committing
Command Options
Change Model: Specify a different Ollama model (defaults to
mistral).commitgen --model llama3.2Dry Run: Generate and preview the message without actually running
git commit.commitgen --dry-runGemini Fallback: Use the Gemini API instead of local Ollama (requires the
GEMINI_API_KEYenvironment variable).commitgen --geminiConfigure Defaults: Interactively set your default model so you don't have to pass the
--modelflag every time. This saves your preference to~/.commitgen/config.json.commitgen configGit Hook Integration: Automatically run the AI whenever you type
git commitin your terminal! Run this command inside any git repository to install theprepare-commit-msghook:commitgen install-hook
🏗 Tech Stack
- JavaScript / Node.js ES Modules
- Commander.js - CLI command orchestration
- Inquirer.js (Classic) - Interactive prompts
- Chalk - Premium terminal styling
- Native Node Fetch & Child_Process - Zero bloat system integration
