Generate beautiful, structured pull request descriptions using AI (GPT or Gemini), straight from your terminal.
This tool analyzes your Git diff, prompts for the PR type, title, and optional ticket ID, and generates a complete, professional-looking PR description.
- π€ Multiple AI Providers: GPT and Gemini with automatic fallback
- π― Smart Context: Analyzes your Git diff automatically
- π¨ Beautiful Output: Markdown format with emojis and structure
- π» Interactive UI: Colored terminal output with arrow key navigation
- π Copy to Clipboard: One-click copy to clipboard
- π One-liner Usage: Quick commands like
genpr feat "Add feature" - π Automatic PR Creation: Create PRs directly in Bitbucket/GitHub (with API credentials)
npm install -g ai-pr-generatorSet up your API keys and AI models:
genpr initThis will guide you through setting up:
- OpenAI API key (GPT)
- Gemini API key
- AI model selection (GPT-4o, Gemini 2.0, etc.)
- Default AI provider preference
- Optional Bitbucket/GitHub credentials for automatic PR creation
# Interactive mode
genpr
# One-liner mode
genpr feat "Add new feature"
genpr fix "Fix bug in login"
genpr docs "Update README"You'll need at least one AI provider:
- Visit OpenAI API Keys
- Sign in and create a new secret key
- Copy your API key
- Visit Google AI Studio
- Sign in with your Google account
- Create an API key
- Copy your API key
The tool supports multiple AI models from OpenAI and Google Gemini:
- GPT-4o Mini (
gpt-4o-mini) - Fast and cost-effective for most use cases - GPT-4o (
gpt-4o) - Best quality for complex tasks - GPT-4 Turbo (
gpt-4-turbo) - Balanced performance and quality - Custom Models - Use any OpenAI-compatible model
- Gemini 2.0 Flash (
gemini-2.0-flash) - Fast and efficient - Gemini 2.0 Pro (
gemini-2.0-pro) - Best quality for complex tasks - Gemini 1.5 Pro (
gemini-1.5-pro) - Balanced performance and quality - Custom Models - Use any Gemini-compatible model
During genpr init, you can configure:
- AI Models: Choose from:
- OpenAI: GPT-4o Mini (Fast & Cheap), GPT-4o (Best Quality), GPT-4 Turbo (Balanced), or custom models
- Gemini: Gemini 2.0 Flash (Fast), Gemini 2.0 Pro (Best Quality), Gemini 1.5 Pro (Balanced), or custom models
- Default Provider: Set your preferred AI provider (OpenAI or Gemini)
- Auto-select: Let the tool automatically choose the best available provider
Use genpr config to:
- View current configuration
- Edit API keys, models, and preferences
- Reset all configuration and start fresh
# Interactive mode - guided prompts
genpr
# One-liner with PR type and title
genpr feat "Add search functionality"
genpr bugfix "Fix responsive layout"
genpr refactor "Extract authentication logic"# Force specific provider
genpr --provider GPT feat "Add feature"
genpr --provider Gemini bugfix "Fix bug"# View current configuration
genpr config
# Edit configuration
genpr config --action edit
# Reset configuration
genpr config --action resetAfter generating, you can:
- Copy to clipboard - Copy the description
- Open in editor - Open in your default editor
- Create PR in Bitbucket - Automatically create PR (if configured)
- Create PR in GitHub - Automatically create PR (if configured)
# π feat(RND-1234): Add search bar to homepage
## π§ Summary
This PR introduces a responsive search bar with autosuggest capabilities on the homepage, improving user navigation and search experience.
## β
Changes
- Added new `SearchBar` component with TypeScript support
- Integrated with backend autocomplete API endpoint
- Updated homepage layout to accommodate search functionality
- Added keyboard navigation support for accessibility
- Implemented debounced search to optimize performanceFor automatic PR creation in Bitbucket or GitHub:
- Visit Bitbucket App Passwords
- Create a new app password with 'Pull requests: Write' permission
- Add your email and app password during
genpr init
- Visit GitHub Personal Access Tokens
- Generate new token with 'repo' scope
- Add your token during
genpr init
To automatically assign reviewers:
- Copy
reviewers.json.exampletoreviewers.json - Update with your team's reviewers:
{
"bitbucket": [
{
"name": "John Doe",
"username": "johndoe"
}
],
"github": [
{
"name": "Jane Smith",
"username": "janesmith"
}
],
"default": [
{
"name": "Default Reviewer",
"username": "default"
}
]
}- Node.js 20+ (for development)
- Git repository with changes
# Clone and install
git clone https://github.com/yairpi165/ai-pr-generator.git
cd ai-pr-generator
npm install
# Build
npm run build
# Run locally
npm start
# Development mode
npm run devnpm run build # Build TypeScript
npm test # Run tests
npm run lint # Check linting
npm run lint:fix # Fix linting issues
npm run format # Format code
npm run check # Run all checks"genpr command not found"
- Restart your terminal after installation
- Or run:
source ~/.zshrc(or your shell config)
"No AI providers available"
- Run
genpr initto set up your API keys - Make sure your API keys are valid
"Provider X failed"
- The tool will automatically try other providers
- Check your API key and usage limits
"Permission denied"
- Make sure you have Node.js 18+ installed
- Check file permissions
# See active provider in output
genpr
# Force specific provider
genpr --provider GPT
genpr --provider Gemininpm install -g ai-pr-generatorThe package will:
- β
Install globally with
genprcommand available - β
Run
postinstallscript to build TypeScript - β Be ready to use immediately
git clone https://github.com/yairpi165/ai-pr-generator.git
cd ai-pr-generator
npm install
npm run buildWe welcome contributions!
- Fork the repository
- Create a feature branch (
feat/,fix/,docs/) - Make your changes
- Test:
npm testandnpm run lint - Build and test:
npm run build && npm start - Open a pull request
MIT Β© 2025 Yair Pinchasi