generate-pr-cli
v1.0.0
Published
CLI tool to automatically generate Pull Request descriptions based on Git diffs
Maintainers
Readme
Generate PR CLI

Generate professional Pull Request descriptions automatically using Git diffs and AI. Built with TypeScript and powered by Google Gemini.
Features
- Automatic Git diff detection - Analyzes changes between branches
- Bilingual Support - English & Spanish (Español) interface
- Smart Templates - Frontend, Backend, Custom + User templates
- AI-powered - Google Gemini generates professional PR descriptions
- Interactive refinement - Iteratively adjust with AI
- Copy & save - Clipboard integration + file export
- Ticket integration - Optional Jira/VSTS ticket support
- Persistent config - Save API key and preferences locally
Quick Start
Option 1: Use instantly with npx (Recommended)
# Get your API key first: https://aistudio.google.com/app/apikey
npx generate-pr-cli main --template frontend --ticket "[FE-123] New feature"
# The CLI will prompt you for API key on first run
npx generate-pr-cli develop --template backend --ticket "[BE-456] Fix endpoint"Option 2: Install globally
# Install once, use everywhere
npm install -g generate-pr-cli
# Then just run:
generate-pr main --template frontend --ticket "[FE-123] New feature"Command Reference
| Action | Command | Example |
|------------|-------------|-------------|
| Template | --template <type>-t <type> | --template frontend |
| Ticket | --ticket "<number>" | --ticket "[FE-123] Feature" |
| Language | --language <lang>-l <lang> | --language en |
| Output | --output <type>-o <type> | --output clipboard |
| Filename | --filename <name>-f <name> | --filename pr.txt |
| API Key | --set-api-key | Save Gemini API key |
| Help | --help-h | Show help |
Quick Reference:
- Templates:
frontend,backend,custom - Languages:
en,es - Output:
clipboard,file,console
First-Time Setup
Get API key: Google AI Studio
Run any command - CLI guides you:
npx generate-pr-cli main --template frontend
# Will prompt: "Enter your Gemini API key:"
# Enter your API key → Done! Saved for future useQuick Commands
# One-liner commands with npx
npx generate-pr-cli main --template frontend # Frontend PR
npx generate-pr-cli develop --template backend --ticket BE-123 # Backend PR with ticket
npx generate-pr-cli main --language en --output clipboard # English + clipboard
# Shortened flags for speed
npx generate-pr-cli main -t frontend # Template selection
npx generate-pr-cli develop --ticket FE-456 # Ticket specification
npx generate-pr-cli main -l en -o clipboard # Language + output
# Or if installed globally:
generate-pr main --template frontend # Same commands, installed versionHow It Works
- Detect Branch → Automatically finds your current Git branch
- Generate Diff → Creates diff between your branch and target branch
- Select Template → Choose Frontend, Backend, or Custom template
- AI Generation → Gemini analyzes diff and generates professional PR description
- Interactive Menu → Refine, copy, save, or finish
Requirements
- Node.js 20+
- Git repository
- Google Gemini API key (free)
Ready to Get Started?
npx generate-pr-cli main --template frontend --ticket "[FE-123] Your feature"Report Issues → | View on npm →
Made with love for developers who love automation
