ai-git-wizard
v1.0.1
Published
AI-powered commit wizard for automatic commit messages and PR creation
Downloads
9
Maintainers
Readme
Commit Wizard 🔮
An AI-powered commit wizard that automatically generates commit messages, creates branches, and makes pull requests.
Features
- 🤖 AI-generated commit messages using OpenRouter API
- 🌿 Automatic branch name generation
- 📄 PR creation with detailed descriptions
- ⚡ Parallel commit message generation for better performance
- 🔧 Global configuration management
- 📦 Works with any GitHub repository
Installation
Global Installation (Recommended)
npm install -g ai-git-wizardLocal Installation
npm install ai-git-wizardSetup
Before using the CLI, you need to configure your API keys:
ai-git-wizard config setupThis will prompt you for:
- OpenRouter API key (for AI features)
- GitHub personal access token (for PR creation)
- Preferred AI model
- Max concurrency for API requests
Getting API Keys
OpenRouter API Key
- Sign up at openrouter.ai
- Go to Keys section
- Create a new API key
GitHub Personal Access Token
- Go to GitHub Settings → Developer settings → Personal access tokens
- Generate a new token with
reposcope - Copy the token
Usage
Quick Workflow
Run the complete workflow (generates commits, creates branch, makes PR):
ai-git-wizard workflowJust Commit
Generate AI commit messages and commit staged files:
ai-git-wizard commitCommit and Push
Generate commit messages and push to remote:
ai-git-wizard commit --pushSpecify Branch Name
ai-git-wizard workflow -b feature/my-featureSkip PR Creation
ai-git-wizard workflow --no-prConfiguration Management
# Interactive setup
ai-git-wizard config setup
# List all configuration
ai-git-wizard config list
# Set individual values
ai-git-wizard config set openRouterApiKey YOUR_KEY
ai-git-wizard config set githubToken YOUR_TOKEN
# Get a specific value
ai-git-wizard config get defaultModelWorkflow Steps
The complete workflow performs these steps:
- Detect Repository: Automatically detects GitHub repository info
- Get Staged Files: Finds all staged changes
- Generate Commit Messages: Creates AI-powered commit messages for each file
- Create/Switch Branch: Creates a new branch or uses specified branch
- Create Commits: Makes individual commits for each file
- Push Branch: Pushes the branch to GitHub
- Create PR: Creates or updates a pull request with AI-generated description
Configuration
Configuration is stored in ~/.ai-git-wizard/config.json
Available Settings
openRouterApiKey: Your OpenRouter API key (required)githubToken: Your GitHub personal access token (required)defaultModel: AI model to use (default: "google/gemini-flash-2.5")maxConcurrency: Max parallel API requests (default: 3)
Supported AI Models
Any model available on OpenRouter is supported! Some popular options include:
google/gemini-flash-2.5(Recommended - Fast & Reliable)anthropic/claude-3.5-sonnet(High Quality)google/gemini-flash-1.5(Very Fast)openai/gpt-4o-mini(Good Balance)openai/gpt-4o(Highest Quality)meta-llama/llama-3.1-8b-instruct(Open Source)mistralai/mistral-7b-instruct(Open Source)
You can browse all available models at openrouter.ai/models
Examples
Basic Usage
# Stage some files
git add src/components/Button.tsx
git add src/utils/helpers.ts
# Run AI workflow
ai-git-wizard workflow
### Advanced Usage
```bash
# Specify branch and base branch
ai-git-wizard workflow --branch feat/authentication --base-branch develop
# Just generate commits without PR
ai-git-wizard workflow --no-pr
# Only commit (no branch creation or PR)
ai-git-wizard commit
# Commit and push to remote
ai-git-wizard commit --pushRequirements
- Node.js 18+
- Git repository with GitHub remote
- OpenRouter API key
- GitHub personal access token
Contributing
- Clone the repository
- Install dependencies:
npm install - Build:
npm run build - Test locally:
npm link
License
MIT
Support
For issues and questions, please open an issue on GitHub.
