devcommit-cli
v1.1.0
Published
AI-powered Conventional Commit message generator supporting Groq, OpenAI, Anthropic, and Gemini.
Downloads
208
Maintainers
Readme
devcommit-cli 🚀
devcommit is an AI-powered Conventional Commit message generator that understands your code changes.
✨ Features
- Conventional Commits: Automatically chooses the right type (
feat,fix,docs, etc.). - Smart Scoping: Infers the scope from your file changes.
- Shell Integration: Designed to be used in shell scripts and aliases.
- AI-Powered: Supports multiple agents including OpenAI, Anthropic, Google Gemini, and Groq.
🛠 Configuration
devcommit needs an API key to work. You can provide this in two ways:
1. Global Configuration (Recommended)
Create a global config directory and .env file. This allows you to use devcommit in any project without re-configuring.
mkdir -p ~/.devcommit
touch ~/.devcommit/.envAdd your preferred provider and API key to ~/.devcommit/.env:
DEVCOMMIT_PROVIDER=groq # openai, anthropic, google, groq
GROQ_API_KEY=your_key_here2. Local Configuration
Create an .env file in your project root (useful for project-specific settings):
DEVCOMMIT_PROVIDER=openai
OPENAI_API_KEY=your_key_here🛠 Installation
From npm (Recommended)
npm install -g devcommit-cliFrom Source (Development)
# Clone the repo and install dependencies
npm install
npm run build
npm linkNow you can use devcommit anywhere!
🚀 Usage Examples
Header Only
Generate only the conventional commit header.
devcommit --shortForce Fix Type
Force the generator to use 'fix' as the type.
devcommit --type fixInteractive Confirmation
Review and edit the message before it is committed.
devcommit --confirm🔥 Pro Tip: Alias Setup
Add these to your .zshrc, .bashrc, or .fish config for maximum speed:
# Full commit with AI-generated body
alias gca='git commit -m "$(devcommit)"'
# Short header-only commit
alias gcs='git commit -m "$(devcommit --short)"'
# Force fix type for quick bug fixes
alias gcf='git commit -m "$(devcommit --type fix)"'How it works
The devcommit CLI is designed for shell interpolation. It sends progress logs (e.g., "Reading staged changes...") to stderr and only the final commit message to stdout. This ensures that $(devcommit) captures nothing but the commit text.
Built with ❤️ for developers.
