# Installation
import { Tabs, Tab } from 'fumadocs-ui/components/tabs';
import { Callout } from 'fumadocs-ui/components/callout';
Prerequisites [#prerequisites]
LazyPR requires **Node.js version 20 or higher**. Check your version:
```bash
node --version
```
If you need to update Node.js, visit [nodejs.org](https://nodejs.org).
Install LazyPR [#install-lazypr]
Install LazyPR globally using your preferred package manager:
```bash
npm install -g lazypr
```
```bash
pnpm add -g lazypr
```
```bash
yarn global add lazypr
```
```bash
bun add -g lazypr
```
Verify Installation [#verify-installation]
Confirm LazyPR is installed correctly:
```bash
lazypr --version
```
You can also use the shorter alias:
```bash
lzp --version
```
First-Time Setup [#first-time-setup]
Before generating your first PR, configure your AI provider API key. LazyPR uses Groq by default:
```bash
lazypr config set GROQ_API_KEY=your_api_key_here
```
Get your free Groq API key at [console.groq.com](https://console.groq.com).
You're now ready to generate your first PR! Continue to the [Quick Start](/docs/quick-start) guide.
# Quick Start
import { Card, Cards } from 'fumadocs-ui/components/card';
import { Steps, Step } from 'fumadocs-ui/components/steps';
import { Callout } from 'fumadocs-ui/components/callout';
What is LazyPR? [#what-is-lazypr]
LazyPR is a command-line tool that analyzes your git commits and uses AI to generate professional pull request titles and descriptions. Say goodbye to writing PR descriptions manually - let AI do the heavy lifting.
npm
pnpm
yarn
bun
```bash
npm install -g lazypr
```
```bash
pnpm add -g lazypr
```
```bash
yarn global add lazypr
```
```bash
bun add --global lazypr
```
Key Features [#key-features]
* **AI-Powered Generation**: Leverages cloud AI (Groq, Cerebras, OpenAI) or local models (Ollama, LM Studio) to create clear, consistent PR content
* **Smart Commit Filtering**: Automatically excludes merge commits, dependency updates, and formatting changes
* **Multi-Language Support**: Generate PRs in 13 different languages
* **GitHub CLI Integration**: Create pull requests directly with the `--gh` flag
* **Template Support**: Works seamlessly with your existing PR templates
Quick Start [#quick-start]
Get your first AI-generated PR in seconds:
```bash
# Configure your API key
lazypr config set GROQ_API_KEY=your_key_here
# Generate PR content
lazypr main
```
Use the short alias `lzp` instead of `lazypr` for faster typing.
Your First PR Generation [#your-first-pr-generation]
Follow these steps to create your first AI-generated pull request:
Navigate to Your Git Repository [#navigate-to-your-git-repository]
Open your terminal and navigate to a git repository with a feature branch:
```bash
cd your-project
git checkout your-feature-branch
```
Run LazyPR [#run-lazypr]
Generate PR content by specifying your target branch (usually `main` or `master`):
```bash
lazypr main
```
LazyPR will analyze all commits unique to your current branch.
Review the Generated Content [#review-the-generated-content]
LazyPR will display:
* A concise, professional PR title
* A markdown-formatted description with bullet points
* Summary of changes based on your commits
Copy to Clipboard [#copy-to-clipboard]
An interactive menu appears with options:
* **Copy title**: Copy just the PR title
* **Copy description**: Copy just the description
* **Copy both**: Copy title and description together
* **Exit**: Close without copying
Use arrow keys to select and press Enter.
Example Output [#example-output]
When you run `lazypr main`, you'll see output like this:
```
Analyzing commits...
Found 5 commits ahead of main
Generated PR Content:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
feat: Add user authentication with OAuth support
## Changes
- Implement OAuth 2.0 authentication flow
- Add user session management
- Create login and logout endpoints
- Add JWT token generation and validation
## Testing
Tested OAuth flow with Google and GitHub providers
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
? What would you like to copy?
❯ Copy title
Copy description
Copy both
Exit
```
Default Target Branch [#default-target-branch]
If you don't specify a target branch, LazyPR defaults to `main`:
```bash
lazypr # same as: lazypr main
```
Next Steps [#next-steps]
Now that you've generated your first PR, explore more features:
* [Configure settings](/docs/config/settings) to customize behavior
* [Use templates](/docs/usage/templates) for consistent PR formatting
* [Try GitHub integration](/docs/usage/github-integration) to create PRs directly
Explore the Docs [#explore-the-docs]
# What is LazyPR?
import { Callout } from 'fumadocs-ui/components/callout';
Overview [#overview]
LazyPR is a command-line tool that automatically generates professional pull request titles and descriptions by analyzing your git commits using AI. It eliminates the tedious task of writing PR descriptions manually, saving time while maintaining consistency and quality.
The Problem [#the-problem]
Writing good pull requests is time-consuming:
* **Manual effort**: Developers spend 5-10 minutes per PR summarizing changes
* **Inconsistent quality**: PR descriptions vary wildly between team members
* **Context switching**: Breaking coding flow to write documentation
* **Repetitive work**: Explaining the same commits you already wrote
The Solution [#the-solution]
LazyPR automates PR creation in seconds:
```bash
lazypr main
```
That's it. LazyPR analyzes your commits, understands the changes, and generates a professional PR with:
* A clear, concise title following conventional commits
* Structured description with bullet points
* Testing information derived from your commits
* Proper formatting ready to paste into GitHub
How It Works [#how-it-works]
1. **Analyze Commits**: LazyPR reads all commits between your feature branch and target branch
2. **Smart Filtering**: Automatically excludes merge commits, dependency updates, and noise
3. **AI Generation**: Sends commit data to your chosen provider (cloud or local AI)
4. **Professional Output**: Receives a formatted PR title and description
5. **Easy Copy**: Interactive menu to copy to clipboard or create PR directly
Key Benefits [#key-benefits]
Save Time [#save-time]
Generate PRs in **10-15 seconds** instead of 5-10 minutes. For teams creating multiple PRs daily, that's hours saved per week.
Consistent Quality [#consistent-quality]
Every PR follows the same professional format, making code reviews faster and more efficient.
Team Collaboration [#team-collaboration]
International teams can generate PRs in 13 different languages while maintaining the same structure.
Focus on Coding [#focus-on-coding]
Spend less time documenting and more time building. LazyPR handles the PR writing so you can stay in flow.
Who Uses LazyPR? [#who-uses-lazypr]
**Individual Developers**: Save time and create professional PRs effortlessly.
**Development Teams**: Standardize PR quality across the team with templates and shared configuration.
**Open Source Projects**: Help contributors create consistent, high-quality PRs regardless of their experience level.
**International Teams**: Generate PRs in each developer's native language while maintaining consistency.
Features at a Glance [#features-at-a-glance]
* **Multi-Provider Support**: Choose between cloud providers (Groq, Cerebras, OpenAI) or run locally (Ollama, LM Studio)
* **Smart Filtering**: Excludes irrelevant commits automatically
* **Template Support**: Works with your existing `.github` PR templates
* **Multilingual**: Generate PRs in 13 languages
* **GitHub Integration**: Create PRs directly with `gh` CLI integration
* **Customizable**: Add context guidance to match your team's style
* **Fast**: Most PRs generated in 1-3 seconds
LazyPR is free and open source. Get started in under 2 minutes.
Example Output [#example-output]
**Your commits**:
```
feat: implement OAuth flow
feat: add JWT tokens
fix: handle token expiration
test: add auth tests
```
**Generated PR**:
```
feat: Implement OAuth 2.0 authentication
## Changes
- Implement OAuth 2.0 authorization flow
- Add JWT token generation and validation
- Handle token expiration gracefully
- Add comprehensive authentication tests
## Testing
Unit and integration tests added for auth flow
Manual testing with Google and GitHub providers
```
Clean, professional, and ready to submit.
Getting Started [#getting-started]
Ready to transform your PR workflow?
1. [Install LazyPR](/docs/installation) in under 1 minute
2. [Create your first PR](/docs/quick-start) in seconds
3. [Configure providers](/docs/config/providers) to match your needs
LazyPR is actively maintained and open source. Contributions welcome on [GitHub](https://github.com/R4ULtv/lazypr)!
# Commit Filtering
import { Callout } from 'fumadocs-ui/components/callout';
What is Commit Filtering? [#what-is-commit-filtering]
Commit filtering is LazyPR's intelligent feature that automatically excludes noise from your PR descriptions. It analyzes commit messages and patterns to focus on meaningful changes.
What Gets Filtered? [#what-gets-filtered]
By default, LazyPR excludes:
Merge Commits [#merge-commits]
```
Merge branch 'main' into feature-branch
Merge pull request #123 from user/branch
```
Merge commits add no meaningful information about your changes.
Dependency Updates [#dependency-updates]
```
chore: update dependencies
chore: bump package.json versions
build: upgrade eslint to 8.0.0
```
Version bumps and dependency updates clutter PR descriptions without adding context about your work.
Formatting Changes [#formatting-changes]
```
style: fix linting errors
style: run prettier
chore: format code
```
Code formatting and style fixes don't represent functional changes.
Build and CI Changes [#build-and-ci-changes]
```
ci: update GitHub Actions workflow
build: modify webpack config
```
Infrastructure changes are often less important than feature work.
Why Filter? [#why-filter]
**Cleaner Descriptions**: Focus on what matters - your actual feature work and bug fixes.
**Better AI Output**: Filtering helps the AI generate more focused, relevant descriptions.
**Reduced Token Usage**: Fewer commits mean fewer tokens consumed and faster generation.
**Professional PRs**: Your PRs highlight important changes, not noise.
Disabling Filtering [#disabling-filtering]
Sometimes you want to include all commits:
Per-Run Disable [#per-run-disable]
Use the `--no-filter` flag:
```bash
lazypr main --no-filter
```
This includes all commits for this single run.
Global Disable [#global-disable]
Turn off filtering permanently:
```bash
lazypr config set FILTER_COMMITS=false
```
Re-enable anytime:
```bash
lazypr config set FILTER_COMMITS=true
```
Disabling filtering may result in verbose, cluttered PR descriptions. Use sparingly.
When to Disable Filtering [#when-to-disable-filtering]
Consider disabling filtering when:
**Dependency update PRs**: If the PR is specifically about dependency updates:
```bash
lazypr main --no-filter
```
**Infrastructure changes**: When build/CI modifications are the main focus.
**Small refactors**: When formatting or style changes are the primary work.
**Debugging**: To see exactly which commits are being analyzed.
How Filtering Works [#how-filtering-works]
LazyPR uses pattern matching on commit messages to identify filtered commits. It looks for:
1. **Keywords**: merge, dependency, deps, bump, format, prettier, eslint, ci, build
2. **Patterns**: Version numbers, package names, automated commit signatures
3. **Conventional commits**: Specific types like `chore:`, `style:`, `build:`, `ci:`
Example: Filtered vs Unfiltered [#example-filtered-vs-unfiltered]
**Commits in branch**:
```
feat: add user authentication
fix: resolve login redirect bug
chore: update dependencies
Merge branch 'main' into feature
style: format auth module
test: add auth integration tests
```
**With filtering** (default):
```
LazyPR analyzes:
- feat: add user authentication
- fix: resolve login redirect bug
- test: add auth integration tests
```
**Without filtering** (`--no-filter`):
```
LazyPR analyzes all 6 commits including:
- chore: update dependencies
- Merge branch 'main' into feature
- style: format auth module
```
Smart Filtering [#smart-filtering]
LazyPR's filtering is smart enough to:
* Preserve important chore commits that add significant value
* Include dependency updates if they fix security issues
* Keep formatting commits if they're part of a larger refactor
The AI considers context, not just keywords.
Custom Filtering Logic [#custom-filtering-logic]
Currently, LazyPR doesn't support custom filtering rules. The built-in logic covers most common cases. If you need specific commits excluded, consider:
1. Using `--no-filter` and manually editing the output
2. Structuring commit messages to match filtering patterns
3. Creating separate branches for filtered vs. important commits
Best Practices [#best-practices]
Write Clear Commit Messages [#write-clear-commit-messages]
Use conventional commits to help filtering work effectively:
```bash
# Will be included
feat: add login feature
fix: resolve security bug
# Will be filtered
chore: update packages
style: run formatter
```
Separate Concerns [#separate-concerns]
Keep infrastructure and feature work in separate branches when possible:
```bash
# Feature branch - filtering works great
git checkout -b feature/auth
[make feature commits]
# Separate dependency update branch
git checkout -b chore/deps
[update dependencies]
```
Review Before Submitting [#review-before-submitting]
Always review the generated PR description. If important commits were filtered, regenerate with `--no-filter` and manually edit.
Filtering is enabled by default because it produces better results 95% of the time. Disable only when needed.
# Context Guidance
import { Callout } from 'fumadocs-ui/components/callout';
What is Context? [#what-is-context]
Context is custom style guidance you provide to influence how LazyPR generates PR descriptions. It's like giving the AI a "personality" or "instructions" for writing PRs.
Maximum length: **200 characters**
Setting Global Context [#setting-global-context]
Configure context that applies to all PR generations:
```bash
lazypr config set CONTEXT="Use conventional commits format and keep descriptions concise"
```
Every time you run `lazypr`, this guidance influences the output.
Per-Run Context [#per-run-context]
Override global context for a single generation:
```bash
lazypr main -c "Focus on security improvements"
lazypr main -c "Emphasize performance benefits"
lazypr main -c "Keep it brief, max 3 bullet points"
```
Per-run context takes precedence over global context.
Effective Context Examples [#effective-context-examples]
Focus on Style [#focus-on-style]
```bash
# Concise, bullet-point style
lazypr main -c "Keep descriptions concise with bullet points"
# Detailed explanations
lazypr main -c "Provide detailed explanations for each change"
# Technical focus
lazypr main -c "Use technical terminology and avoid simplification"
```
Emphasize Specific Aspects [#emphasize-specific-aspects]
```bash
# Business value
lazypr main -c "Emphasize business value and user impact"
# Technical implementation
lazypr main -c "Focus on technical implementation details"
# Testing and quality
lazypr main -c "Highlight testing approach and quality improvements"
```
Audience-Specific [#audience-specific]
```bash
# Non-technical stakeholders
lazypr main -c "Write for non-technical stakeholders"
# Senior developers
lazypr main -c "Assume senior developer audience"
# Product managers
lazypr main -c "Focus on product features and user value"
```
Team Standards [#team-standards]
```bash
# Conventional commits
lazypr main -c "Follow conventional commits specification"
# Include ticket numbers
lazypr main -c "Reference ticket numbers and user stories"
# Testing requirements
lazypr main -c "Always mention testing strategy"
```
Context Best Practices [#context-best-practices]
Be Specific [#be-specific]
**Good** (specific):
```bash
"Focus on security improvements and mention any vulnerabilities addressed"
```
**Less effective** (vague):
```bash
"Make it good"
```
Keep It Short [#keep-it-short]
Remember the 200-character limit. Be concise:
**Good** (concise):
```bash
"Emphasize performance gains and include metrics"
```
**Too long**:
```bash
"I want you to really emphasize the performance gains we've made and include specific metrics wherever possible and also mention any trade-offs we had to make and explain the reasoning behind technical decisions"
```
Match Your Team's Voice [#match-your-teams-voice]
Analyze your team's existing PRs and create context that matches:
```bash
# Formal, corporate
lazypr main -c "Professional tone, formal language"
# Casual, startup
lazypr main -c "Casual tone, focus on impact"
# Technical, open-source
lazypr main -c "Technical detail, community-friendly"
```
Great context guidance aligns AI output with your team's existing PR style and standards.
Examples with Output [#examples-with-output]
Without Context [#without-context]
```bash
lazypr main
```
**Output**:
```markdown
feat: Add user authentication
## Changes
- Implement OAuth 2.0 authentication flow
- Add JWT token management
- Create login and logout endpoints
- Add session persistence
```
With "Keep it brief" Context [#with-keep-it-brief-context]
```bash
lazypr main -c "Keep descriptions very brief, max 3 points"
```
**Output**:
```markdown
feat: Add user authentication
## Changes
- Implement OAuth 2.0 flow
- Add JWT token management
- Create authentication endpoints
```
With "Business focus" Context [#with-business-focus-context]
```bash
lazypr main -c "Emphasize business value and user impact"
```
**Output**:
```markdown
feat: Add user authentication
## Changes
- Enable secure user login via OAuth 2.0, improving security and user trust
- Implement session management for seamless user experience
- Support multiple OAuth providers, increasing user convenience
## Impact
Provides enterprise-grade security while reducing friction in the login process.
```
With "Technical detail" Context [#with-technical-detail-context]
```bash
lazypr main -c "Include technical implementation details"
```
**Output**:
```markdown
feat: Add user authentication
## Changes
- Implement OAuth 2.0 authorization code flow with PKCE
- Add JWT token generation using RS256 algorithm
- Create RESTful endpoints: POST /auth/login, POST /auth/logout
- Implement Redis-based session store with 24h TTL
```
Common Use Cases [#common-use-cases]
Security PRs [#security-prs]
```bash
lazypr main -c "Highlight security improvements and vulnerabilities fixed"
```
Performance PRs [#performance-prs]
```bash
lazypr main -c "Focus on performance gains with specific metrics"
```
Refactoring PRs [#refactoring-prs]
```bash
lazypr main -c "Explain refactoring rationale and benefits"
```
Bug Fix PRs [#bug-fix-prs]
```bash
lazypr main -c "Describe the bug, root cause, and fix approach"
```
Combining with Other Features [#combining-with-other-features]
Context works alongside other LazyPR features:
```bash
# Context + Template + Language
lazypr main --template -l es -c "Enfoque en seguridad"
# Context + GitHub CLI + Token usage
lazypr main --gh -c "Keep it brief" -u
```
Managing Context [#managing-context]
View Current Context [#view-current-context]
```bash
lazypr config get CONTEXT
```
Clear Context [#clear-context]
Remove global context:
```bash
lazypr config set CONTEXT=""
```
Or just use per-run context to override:
```bash
lazypr main -c "Different guidance for this PR"
```
Limitations [#limitations]
**Character limit**: 200 characters maximum. LazyPR truncates longer context.
**Not instructions**: Context is guidance, not strict instructions. The AI interprets context creatively.
**Commit-dependent**: Output quality still depends on your commit messages. Great context can't fix vague commits.
Context influences but doesn't guarantee specific output. Review and edit generated PRs as needed.
Tips for Success [#tips-for-success]
1. **Experiment**: Try different context styles to see what works for your team
2. **Iterate**: Refine your context based on results
3. **Be consistent**: Use similar context for similar types of PRs
4. **Combine approaches**: Use global context for team standards, per-run for special cases
5. **Document**: Share effective context examples with your team
Troubleshooting [#troubleshooting]
**Context not working**: Ensure your context is clear and specific. Vague guidance produces minimal change.
**Output too different**: Your context may be too prescriptive. Try more general guidance.
**Character limit**: If truncated, prioritize the most important guidance first.
# Multilingual Support
import { Callout } from 'fumadocs-ui/components/callout';
Supported Languages [#supported-languages]
LazyPR can generate pull request descriptions in 13 languages:
| Code | Language | Native Name | Flag |
| ---- | ---------- | ----------- | ---- |
| `en` | English | English | 🇬🇧 |
| `es` | Spanish | Español | 🇪🇸 |
| `pt` | Portuguese | Português | 🇵🇹 |
| `fr` | French | Français | 🇫🇷 |
| `de` | German | Deutsch | 🇩🇪 |
| `it` | Italian | Italiano | 🇮🇹 |
| `ja` | Japanese | 日本語 | 🇯🇵 |
| `ko` | Korean | 한국어 | 🇰🇷 |
| `zh` | Chinese | 中文 | 🇨🇳 |
| `ru` | Russian | Русский | 🇷🇺 |
| `nl` | Dutch | Nederlands | 🇳🇱 |
| `pl` | Polish | Polski | 🇵🇱 |
| `tr` | Turkish | Türkçe | 🇹🇷 |
**Default language**: English (`en`)
Setting Default Language [#setting-default-language]
Configure your preferred language globally:
```bash
lazypr config set LOCALE=es # Spanish
lazypr config set LOCALE=ja # Japanese
lazypr config set LOCALE=de # German
```
All subsequent PR generations will use your configured language:
```bash
lazypr main # Uses your configured locale
```
One-Time Language Override [#one-time-language-override]
Generate a PR in a different language without changing your config:
```bash
lazypr main -l fr # French for this run only
lazypr main -l zh # Chinese for this run only
```
This is useful when:
* Working on international projects
* Collaborating with non-native speakers
* Creating PRs for specific regional teams
Example Outputs [#example-outputs]
English (en) [#english-en]
```markdown
feat: Add user authentication
## Changes
- Implement OAuth 2.0 authentication flow
- Add JWT token management
- Create login and logout endpoints
```
Spanish (es) [#spanish-es]
```markdown
feat: Agregar autenticación de usuario
## Cambios
- Implementar flujo de autenticación OAuth 2.0
- Agregar gestión de tokens JWT
- Crear endpoints de inicio y cierre de sesión
```
Japanese (ja) [#japanese-ja]
```markdown
feat: ユーザー認証を追加
## 変更内容
- OAuth 2.0認証フローの実装
- JWTトークン管理の追加
- ログイン・ログアウトエンドポイントの作成
```
French (fr) [#french-fr]
```markdown
feat: Ajouter l'authentification utilisateur
## Modifications
- Implémenter le flux d'authentification OAuth 2.0
- Ajouter la gestion des tokens JWT
- Créer les endpoints de connexion et déconnexion
```
Use Cases [#use-cases]
International Teams [#international-teams]
Teams distributed across regions can use their preferred language:
```bash
# Developer in Spain
lazypr config set LOCALE=es
# Developer in Japan
lazypr config set LOCALE=ja
# Developer in Germany
lazypr config set LOCALE=de
```
Everyone works in their native language, improving clarity and reducing miscommunication.
Localized Projects [#localized-projects]
Projects with language-specific branches or repositories:
```bash
# Feature for English market
git checkout feature/us-payments
lazypr main -l en
# Feature for Japanese market
git checkout feature/jp-payments
lazypr main -l ja
```
Learning and Documentation [#learning-and-documentation]
Non-native English speakers can read and understand PR descriptions in their language, accelerating onboarding and collaboration.
Best Practices [#best-practices]
Be Consistent [#be-consistent]
Pick a language for your project and stick to it. Mixed-language PRs can be confusing:
**Good** (consistent):
```
All PRs in English
All PRs in Spanish
```
**Confusing** (mixed):
```
Some PRs in English, some in French
```
Consider Your Audience [#consider-your-audience]
Choose the language your reviewers and stakeholders understand best. If your team is international but uses English, stick with English.
Use Context for Better Results [#use-context-for-better-results]
Adding context in the target language can improve output quality:
```bash
lazypr main -l es -c "Enfocarse en cambios de seguridad"
```
Conventional Commit Titles [#conventional-commit-titles]
Keep commit prefixes (`feat:`, `fix:`) in English even when descriptions are in other languages. This maintains compatibility with tooling:
```markdown
# Good
feat: Añadir autenticación de usuario
# Less compatible with tooling
característica: Añadir autenticación de usuario
```
LazyPR will automatically use English conventional commit prefixes in titles even when the description is in another language.
Limitations [#limitations]
**Code examples**: Code snippets, variable names, and technical terms remain in their original language/format. Only descriptive text is translated.
**Quality varies**: Output quality for less common languages may vary. English and major European/Asian languages typically produce excellent results.
**Context understanding**: The AI understands commit messages in any language but works best when commits are in English or the target language.
Troubleshooting [#troubleshooting]
**Strange characters**: Ensure your terminal supports UTF-8 encoding for proper display of non-Latin characters.
**Poor translation quality**: Try being more explicit in commit messages or adding context with the `-c` flag.
**Language not working**: Verify you're using the correct language code from the supported list above.
Checking Current Language [#checking-current-language]
View your configured language:
```bash
lazypr config get LOCALE
```
If not set, LazyPR defaults to English (`en`).
# AI Providers
import { Callout } from 'fumadocs-ui/components/callout';
import { Tabs, Tab } from 'fumadocs-ui/components/tabs';
Overview [#overview]
LazyPR uses AI providers to analyze your commits and generate professional PR descriptions. Choose the provider that best fits your needs based on speed, cost, and availability.
**Structured Output Requirement**: LazyPR requires models that support structured output (JSON mode). Not all models or providers support this feature. Always verify your chosen model supports structured output before configuring it.
Provider Comparison [#provider-comparison]
| Provider | Speed | Free Tier | Reliability | Model Options | Setup | Status |
| ------------------ | ----------------- | ------------ | ----------- | -------------------- | ----- | ----------- |
| Groq (Default) | Fast (1-3s) | Generous | High | Multiple | Easy | ✅ Available |
| Cerebras | Ultra-fast (\<1s) | Varies | High | Multiple | Easy | ✅ Available |
| OpenAI | Fast (2-4s) | Limited | High | GPT-4o, o1, o3-mini | Easy | ✅ Available |
| Ollama | Variable | Free (Local) | High | Llama, Mistral, etc. | Easy | ✅ Available |
| LM Studio | Variable | Free (Local) | High | Various quantized | Easy | ✅ Available |
| Anthropic (Claude) | Fast (2-4s) | Limited | High | Opus, Sonnet, Haiku | Easy | 🚧 Soon |
| Google AI (Gemini) | Fast (2-4s) | Generous | High | Gemini Pro, Flash | Easy | 🚧 Soon |
Want to see a specific provider added sooner? Let us know on [GitHub](https://github.com/R4ULtv/lazypr/issues)!
Getting Started [#getting-started]
Setting Up Groq (Default) [#setting-up-groq-default]
Get Your API Key [#get-your-api-key]
1. Visit [console.groq.com](https://console.groq.com)
2. Sign up or log in to your account
3. Navigate to API Keys section
4. Create a new API key
Configure LazyPR [#configure-lazypr]
```bash
lazypr config set GROQ_API_KEY=gsk_your_api_key_here
```
Groq offers generous free tier limits, perfect for getting started. All Groq models support structured output.
Setting Up Cerebras [#setting-up-cerebras]
Get Your API Key [#get-your-api-key-1]
1. Visit the Cerebras platform
2. Create an account and generate an API key
Configure LazyPR [#configure-lazypr-1]
```bash
# Set the API key
lazypr config set CEREBRAS_API_KEY=your_cerebras_key_here
# Switch to Cerebras provider
lazypr config set PROVIDER=cerebras
```
Cerebras models support structured output. Verify your specific model choice supports this feature.
Setting Up OpenAI [#setting-up-openai]
Get Your API Key [#get-your-api-key-2]
1. Visit [platform.openai.com](https://platform.openai.com)
2. Sign up or log in to your account
3. Navigate to API Keys section
4. Create a new API key
Configure LazyPR [#configure-lazypr-2]
```bash
# Set the API key
lazypr config set OPENAI_API_KEY=sk-your_openai_key_here
# Switch to OpenAI provider
lazypr config set PROVIDER=openai
```
OpenAI provides access to GPT-4o, o1, and o3-mini models for high-quality PR generation. GPT-4o and newer models support structured output. Verify your specific model choice supports this feature.
Setting Up Ollama (Local AI) [#setting-up-ollama-local-ai]
Ollama lets you run AI models locally on your machine - completely free and private.
Install and Start Ollama [#install-and-start-ollama]
1. Visit [ollama.com](https://ollama.com) and download Ollama for your platform
2. Install and start the Ollama service
3. Pull a model (e.g., Llama 3.3):
```bash
ollama pull llama3.3
```
Configure LazyPR [#configure-lazypr-3]
```bash
# Set provider to openai (Ollama uses OpenAI-compatible API)
lazypr config set PROVIDER=openai
# Point to local Ollama server
lazypr config set OPENAI_BASE_URL=http://localhost:11434/v1
# Set the model you pulled
lazypr config set MODEL=llama3.3
# No API key needed for local Ollama
lazypr config set OPENAI_API_KEY=ollama
```
Ollama is completely free, runs offline, and keeps your code private!
**Important**: Not all Ollama models support structured output (JSON mode). Check the model's documentation on [ollama.com/library](https://ollama.com/library) before using it with LazyPR. Models without structured output support will fail to generate PRs.
Recommended Models [#recommended-models]
* **[deepseek-r1](https://ollama.com/library/deepseek-r1)** - Great balance of speed and quality
* **[gemma3](https://ollama.com/library/gemma3)** - Faster, good for quick PRs
* **[gpt-oss:20b](https://ollama.com/library/gpt-oss)** - Excellent alternative with good performance
* **[qwen3](https://ollama.com/library/qwen3)** - Optimized for code understanding
Always test a new Ollama model with a small PR first to verify it supports structured output.
Setting Up LM Studio (Local AI) [#setting-up-lm-studio-local-ai]
LM Studio provides a user-friendly interface for running local AI models.
Install and Setup [#install-and-setup]
1. Download LM Studio from [lmstudio.ai](https://lmstudio.ai)
2. Install and launch the application
3. Download a model from the built-in model browser
4. Start the local server (click "Start Server" in LM Studio)
Configure LazyPR [#configure-lazypr-4]
```bash
# Set provider to openai (LM Studio uses OpenAI-compatible API)
lazypr config set PROVIDER=openai
# Point to LM Studio local server (default port is 1234)
lazypr config set OPENAI_BASE_URL=http://localhost:1234/v1
# Set the model name as shown in LM Studio
lazypr config set MODEL=your-model-name
# No API key needed for local LM Studio
lazypr config set OPENAI_API_KEY=lmstudio
```
LM Studio supports many quantized models that run efficiently on consumer hardware.
**Important**: Not all models in LM Studio support structured output (JSON mode). Check the model's capabilities before using it with LazyPR. Models without structured output support will fail to generate PRs.
Switching Providers [#switching-providers]
Change between providers anytime:
```bash
lazypr config set PROVIDER=groq
```
```bash
lazypr config set PROVIDER=cerebras
```
```bash
lazypr config set PROVIDER=openai
# Make sure to unset OPENAI_BASE_URL if switching from local providers
lazypr config set OPENAI_BASE_URL=
```
```bash
lazypr config set PROVIDER=openai
lazypr config set OPENAI_BASE_URL=http://localhost:11434/v1
```
```bash
lazypr config set PROVIDER=openai
lazypr config set OPENAI_BASE_URL=http://localhost:1234/v1
```
Don't forget to set the appropriate API key for your chosen provider (see Getting Started section above).
**OpenAI-Compatible Providers**: Ollama, LM Studio, and any other OpenAI-compatible API can be used by setting `PROVIDER=openai` and pointing `OPENAI_BASE_URL` to the server endpoint.
Model Selection [#model-selection]
Configure which AI model to use:
```bash
lazypr config set MODEL=llama-3.3-70b
```
**Default model**: `llama-3.3-70b`
Different providers support different models. Check your provider's documentation for available options.
The default model provides an excellent balance of quality and speed for PR generation.
Token Usage Tracking [#token-usage-tracking]
Monitor how many tokens your requests consume with the `-u` flag:
```bash
lazypr main -u
```
**Output**:
```
Generated PR Content
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[PR content here]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Token Usage: 347 tokens
```
This helps you:
* Track API costs
* Optimize commit message lengths
* Stay within rate limits
Performance Considerations [#performance-considerations]
Response Time [#response-time]
Both providers typically respond in 1-3 seconds for standard PRs. Response time depends on:
* Number of commits
* Commit message length
* Provider load
* Network latency
Quality vs Speed [#quality-vs-speed]
The default model (`llama-3.3-70b`) balances quality and speed. If you need faster responses and don't mind slightly shorter descriptions, you might experiment with smaller models (if your provider supports them).
Rate Limits [#rate-limits]
Each provider has rate limits:
* **Free tiers**: Typically sufficient for individual developers (dozens of PRs per day)
* **Paid tiers**: Higher limits for teams and heavy users
Check your provider's documentation for specific limits.
Cost Optimization [#cost-optimization]
Use Commit Filtering [#use-commit-filtering]
Enable filtering to reduce token usage by excluding irrelevant commits:
```bash
lazypr config set FILTER_COMMITS=true # Default
```
Learn more in the [Commit Filtering](/docs/advanced/commit-filtering) guide.
Write Concise Commit Messages [#write-concise-commit-messages]
Shorter, clearer commit messages consume fewer tokens while maintaining quality:
**Good** (concise):
```
feat: add OAuth login
```
**Less optimal** (verbose):
```
feat: implemented a complete OAuth 2.0 authentication system with support for multiple providers including detailed error handling and logging
```
Track Usage [#track-usage]
Regularly use the `-u` flag to monitor consumption and adjust your usage patterns.
Troubleshooting [#troubleshooting]
**Invalid API Key Error**: Double-check your key is correctly copied and hasn't expired. Generate a new key from your provider's console if needed.
**Rate Limiting**: Free tier accounts may have usage limits. Upgrade your plan or wait for the limit to reset.
**Slow responses**: Check your network connection. If persistent, try switching providers.
**Model not found**: Verify the model name is correct for your chosen provider. Reset to default with:
```bash
lazypr config set MODEL=llama-3.3-70b
```
# Settings
import { Callout } from 'fumadocs-ui/components/callout';
Configuration Options [#configuration-options]
LazyPR stores all settings in `~/.lazypr`. You can modify settings using the config command:
```bash
lazypr config set SETTING_NAME=value
```
Available Settings [#available-settings]
PROVIDER [#provider]
The AI provider to use for generating PR content.
* **Values**: `groq`, `cerebras`, or `openai`
* **Default**: `groq`
```bash
lazypr config set PROVIDER=groq
```
LOCALE [#locale]
Default language for generated PR content.
* **Default**: `en` (English)
* **Supported**: en, es, pt, fr, de, it, ja, ko, zh, ru, nl, pl, tr
```bash
lazypr config set LOCALE=es
```
You can override the locale for a single run using the `-l` flag.
MODEL [#model]
The AI model to use for generation.
* **Default**: `llama-3.3-70b`
* **Provider-specific**: Check your provider's documentation for available models
```bash
lazypr config set MODEL=llama-3.3-70b
```
MAX_RETRIES [#max_retries]
Number of retry attempts if a request fails.
* **Default**: `2`
* **Range**: 0-5
```bash
lazypr config set MAX_RETRIES=3
```
TIMEOUT [#timeout]
Request timeout in milliseconds.
* **Default**: `10000` (10 seconds)
```bash
lazypr config set TIMEOUT=15000
```
FILTER_COMMITS [#filter_commits]
Enable or disable automatic commit filtering.
* **Default**: `true`
* **Values**: `true` or `false`
When enabled, LazyPR excludes merge commits, dependency updates, and formatting-only changes.
```bash
lazypr config set FILTER_COMMITS=false
```
CONTEXT [#context]
Global style guidance for PR generation (max 200 characters).
* **Default**: None
* **Example**: "Use conventional commits format and keep descriptions concise"
```bash
lazypr config set CONTEXT="Focus on business impact in descriptions"
```
Context helps AI tailor the PR style to your team's preferences.
OPENAI_BASE_URL [#openai_base_url]
Custom endpoint for OpenAI-compatible APIs. Use this to connect to local AI providers like Ollama or LM Studio.
* **Default**: None (uses OpenAI's official API)
* **Common values**:
* Ollama: `http://localhost:11434/v1`
* LM Studio: `http://localhost:1234/v1`
```bash
# For Ollama
lazypr config set OPENAI_BASE_URL=http://localhost:11434/v1
# For LM Studio
lazypr config set OPENAI_BASE_URL=http://localhost:1234/v1
# Reset to use official OpenAI
lazypr config set OPENAI_BASE_URL=
```
This setting enables you to use any OpenAI-compatible API, including local models that are completely free and private!
CUSTOM_LABELS [#custom_labels]
Define custom labels to be suggested when creating pull requests.
* **Default**: None
* **Format**: Comma-separated list of label names
* **Maximum**: 17 custom labels (20 total including 3 default labels)
* **Validation rules**:
* Must start with a letter
* Can contain letters, numbers, hyphens, and underscores
* Maximum 50 characters per label
```bash
# Add custom labels
lazypr config set CUSTOM_LABELS=security,performance,breaking-change
# Add multiple labels
lazypr config set CUSTOM_LABELS=ui,backend,docs,tests
```
Custom labels are shown in both interactive mode and included in generated `gh pr create` commands. Make sure the labels exist in your GitHub repository before using them.
**Usage**:
```bash
# Interactive mode - labels are displayed for you to apply
lazypr main
# GitHub CLI mode - labels are included in the command
lazypr main --gh
# Output includes: --label security --label performance --label breaking-change
```
Managing Configuration [#managing-configuration]
View All Settings [#view-all-settings]
```bash
lazypr config list
```
View Specific Setting [#view-specific-setting]
```bash
lazypr config get LOCALE
```
Reset to Defaults [#reset-to-defaults]
Delete the configuration file to reset all settings:
```bash
rm ~/.lazypr
```
Then reconfigure your API key:
```bash
lazypr config set GROQ_API_KEY=your_key_here
```
Environment-Specific Configurations [#environment-specific-configurations]
You can maintain different configurations for different projects or environments by:
1. Storing project-specific settings in a script
2. Setting values before running LazyPR
```bash
# Example: Use Spanish for international team
lazypr config set LOCALE=es
lazypr main
# Then switch back
lazypr config set LOCALE=en
```
Or use command-line flags for one-time overrides without changing stored config:
```bash
lazypr main -l es -c "Keep it brief"
```
# CLI Usage
import { Callout } from 'fumadocs-ui/components/callout';
import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
Basic Usage [#basic-usage]
The simplest way to use LazyPR is to run it in your repository:
```bash
lazypr
```
This analyzes commits between your current branch and main, generates a professional title and description, and offers to copy the result to your clipboard.
Branch Targeting [#branch-targeting]
Specify a different target branch to compare against:
```bash
lazypr develop # Compare against develop
lazypr production # Compare against production
lazypr release-v2 # Compare against release branch
```
Using PR Templates [#using-pr-templates]
LazyPR automatically searches for templates in standard locations:
* `.github/pull_request_template.md`
* `.github/PULL_REQUEST_TEMPLATE/`
Enable template usage with the `--template` flag:
```bash
lazypr main --template
```
If multiple templates exist, LazyPR shows an interactive selector.
Common Workflows [#common-workflows]
Generate and copy to clipboard immediately:
```bash
lazypr main
# Select "Copy to clipboard" when prompted
```
Save to a file for review before using:
```bash
lazypr main > pr-description.txt
# Review and edit pr-description.txt
# Then create PR manually
```
Create a git alias for faster access:
```bash
git config --global alias.pr '!lazypr'
# Now use: git pr main
```
Advanced Options [#advanced-options]
Commit Filtering [#commit-filtering]
By default, LazyPR filters out merge commits, dependency updates, and formatting changes to focus on meaningful content:
```bash
# Include all commits without filtering
lazypr main --no-filter
```
Locale Support [#locale-support]
Generate PR descriptions in multiple languages:
```bash
lazypr main -l es # Spanish
lazypr main -l fr # French
lazypr main -l ja # Japanese
lazypr main -l de # German
lazypr main -l zh # Chinese
lazypr main -l pt # Portuguese
lazypr main -l ru # Russian
lazypr main -l ko # Korean
```
Custom Models [#custom-models]
Switch between providers and models for different use cases:
```bash
# Default model
lazypr main --provider groq
# Specify model
lazypr config set MODEL=llama-3.3-70b-versatile
lazypr config set MODEL=llama-3.1-8b-instant # Faster
```
```bash
lazypr main --provider cerebras
```
```bash
# Use OpenAI provider
lazypr main --provider openai
# Specify model
lazypr config set MODEL=gpt-4o
lazypr config set MODEL=o1
lazypr config set MODEL=o3-mini
```
Adding Context [#adding-context]
Guide the AI with additional context about your PR:
```bash
# Explain the purpose
lazypr main -c "This PR fixes a critical security vulnerability"
# Note breaking changes
lazypr main -c "Breaking change: API v1 is deprecated"
# Specify audience
lazypr main -c "Written for external contributors"
```
Context is limited to 200 characters. Use it for high-level guidance.
Scripting & Automation [#scripting--automation]
Output Redirection [#output-redirection]
Save output directly to a file:
```bash
lazypr main > pr.txt
```
Conditional Generation [#conditional-generation]
Only generate if there are commits to process:
```bash
if git log main..HEAD --oneline | grep -q .; then
lazypr main
fi
```
Batch Processing [#batch-processing]
Process multiple branches:
```bash
for branch in feature/auth feature/api feature/ui; do
git checkout "$branch"
lazypr main > "pr-${branch##*/}.txt"
done
```
Multiple Templates [#multiple-templates]
Organize templates by PR type in `.github/PULL_REQUEST_TEMPLATE/`:
```
.github/
PULL_REQUEST_TEMPLATE/
feature.md
bugfix.md
hotfix.md
release.md
```
When using `--template`, LazyPR will prompt you to select the appropriate template.
Git Hooks Integration [#git-hooks-integration]
Pre-push Hook [#pre-push-hook]
Auto-generate PR description before pushing:
```bash
# .git/hooks/pre-push
#!/bin/bash
if [[ $(git rev-parse --abbrev-ref HEAD) != "main" ]]; then
lazypr main > .pr-description.txt
echo "PR description saved to .pr-description.txt"
fi
```
Prepare-commit-msg Hook [#prepare-commit-msg-hook]
Add PR-ready summaries to commits:
```bash
# .git/hooks/prepare-commit-msg
#!/bin/bash
# Only for feature branches
if [[ $(git rev-parse --abbrev-ref HEAD) == feature/* ]]; then
# Your hook logic here
fi
```
Troubleshooting [#troubleshooting]
"Not a git repository" [#not-a-git-repository]
Make sure you're inside a git repository:
```bash
git status # Should not error
```
"No commits found" [#no-commits-found]
Your branch needs commits that differ from the target:
```bash
git log main..HEAD --oneline # Should show commits
```
API Key Issues [#api-key-issues]
Verify your API key is configured:
```bash
lazypr config list # Check GROQ_API_KEY, CEREBRAS_API_KEY, or OPENAI_API_KEY
```
Rate Limiting [#rate-limiting]
If you hit rate limits, wait a few minutes or switch providers:
```bash
lazypr main --provider cerebras # Try alternate provider
```
# Configuration
import { Callout } from 'fumadocs-ui/components/callout';
import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
Configuration File [#configuration-file]
LazyPR stores configuration in `~/.lazypr`. You can edit this file directly or use the `lazypr config` commands.
Minimal Configuration [#minimal-configuration]
The simplest setup to get started. Perfect for personal projects and first-time users.
```bash title="~/.lazypr"
# LazyPR Minimal Configuration
# The only required setting is your API key
GROQ_API_KEY=your-groq-api-key-here
# Provider defaults to groq if not specified
# PROVIDER=groq
# Alternative: Use OpenAI
# OPENAI_API_KEY=sk-your-openai-api-key-here
# PROVIDER=openai
# Alternative: Use Ollama (local)
# PROVIDER=openai
# OPENAI_BASE_URL=http://localhost:11434/v1
# OPENAI_API_KEY=ollama
# MODEL=llama3.3
# Alternative: Use LM Studio (local)
# PROVIDER=openai
# OPENAI_BASE_URL=http://localhost:1234/v1
# OPENAI_API_KEY=lmstudio
# MODEL=your-model-name
```
Get a free API key at [console.groq.com](https://console.groq.com)
Setting Up Minimal Config [#setting-up-minimal-config]
```bash
# Set your API key
lazypr config set GROQ_API_KEY=gsk_xxxxxxxxxxxxx
# Verify configuration
lazypr config list
```
Team Configuration [#team-configuration]
Standardized configuration for team environments. Ensures consistent PR descriptions across all team members.
```bash title="~/.lazypr"
# LazyPR Team Configuration
# Recommended settings for team consistency
# API Keys
GROQ_API_KEY=your-groq-api-key-here
CEREBRAS_API_KEY=your-cerebras-api-key-here
# Provider Settings
PROVIDER=groq
MODEL=llama-3.3-70b-versatile
# Team Standards
DEFAULT_BRANCH=main
LOCALE=en
FILTER_COMMITS=true
# Context for consistent style
CONTEXT=Please review this PR carefully and provide feedback
# Reliability Settings
MAX_RETRIES=3
TIMEOUT=30000
```
Team Setup Instructions [#team-setup-instructions]
Each team member configures their own machine:
```bash
# Set required values
lazypr config set GROQ_API_KEY=gsk_xxxxxxxxxxxxx
lazypr config set PROVIDER=groq
lazypr config set MODEL=llama-3.3-70b-versatile
lazypr config set DEFAULT_BRANCH=main
lazypr config set LOCALE=en
lazypr config set FILTER_COMMITS=true
lazypr config set MAX_RETRIES=3
lazypr config set TIMEOUT=30000
```
Distribute a config file to the team:
```bash
# Create config file
cat > ~/.lazypr << 'EOF'
GROQ_API_KEY=YOUR_KEY_HERE
PROVIDER=groq
MODEL=llama-3.3-70b-versatile
DEFAULT_BRANCH=main
LOCALE=en
FILTER_COMMITS=true
MAX_RETRIES=3
TIMEOUT=30000
EOF
# Team members replace the API key
lazypr config set GROQ_API_KEY=their-actual-key
```
Never commit API keys to version control. Each team member should have their own key.
Multi-Provider Configuration [#multi-provider-configuration]
Configuration supporting multiple AI providers with easy switching. Ideal for production environments and cost optimization.
```bash title="~/.lazypr"
# LazyPR Multi-Provider Configuration
# Supports multiple providers for flexibility and fallback
# Provider API Keys
GROQ_API_KEY=your-groq-api-key-here
CEREBRAS_API_KEY=your-cerebras-api-key-here
OPENAI_API_KEY=sk-your-openai-api-key-here
# Active Provider (groq, cerebras, or openai)
PROVIDER=groq
# Optional: For OpenAI-compatible APIs (Ollama, LM Studio, etc.)
# OPENAI_BASE_URL=http://localhost:11434/v1
# Model Selection
MODEL=llama-3.3-70b-versatile
# Common Settings
DEFAULT_BRANCH=main
FILTER_COMMITS=true
# Increased reliability for production
MAX_RETRIES=5
TIMEOUT=45000
```
Switching Providers [#switching-providers]
```bash
# Switch to Cerebras
lazypr config set PROVIDER=cerebras
# Switch to OpenAI
lazypr config set PROVIDER=openai
# Or use flag for one-time override
lazypr main --provider cerebras
lazypr main --provider openai
# Check current provider
lazypr config get PROVIDER
```
Manual Fallback Strategy [#manual-fallback-strategy]
```bash
# Try Groq first, fallback to Cerebras
lazypr main --provider groq || lazypr main --provider cerebras
```
Local AI Configuration [#local-ai-configuration]
Configuration for running AI models locally with Ollama or LM Studio. Perfect for privacy, offline use, and zero API costs.
```bash title="~/.lazypr"
# LazyPR Local AI Configuration
# Run AI models completely offline and free
# Provider (use OpenAI-compatible mode)
PROVIDER=openai
# Local server endpoint
OPENAI_BASE_URL=http://localhost:11434/v1 # Ollama
# OPENAI_BASE_URL=http://localhost:1234/v1 # LM Studio
# Placeholder API key (not validated for local)
OPENAI_API_KEY=ollama
# Model name (must match installed model)
MODEL=llama3.3
# Standard settings
DEFAULT_BRANCH=main
FILTER_COMMITS=true
```
**Benefits of Local AI**:
* 🆓 Completely free - no API costs
* 🔒 Private - your code never leaves your machine
* ⚡ Fast - no network latency
* 📴 Offline - works without internet
Setting Up Local AI [#setting-up-local-ai]
```bash
# 1. Install Ollama from ollama.com
# 2. Pull a model
ollama pull llama3.3
# 3. Configure LazyPR
lazypr config set PROVIDER=openai
lazypr config set OPENAI_BASE_URL=http://localhost:11434/v1
lazypr config set OPENAI_API_KEY=ollama
lazypr config set MODEL=llama3.3
# 4. Generate PR
lazypr main
```
```bash
# 1. Install LM Studio from lmstudio.ai
# 2. Download a model in the app
# 3. Start the local server
# 4. Configure LazyPR
lazypr config set PROVIDER=openai
lazypr config set OPENAI_BASE_URL=http://localhost:1234/v1
lazypr config set OPENAI_API_KEY=lmstudio
lazypr config set MODEL=your-model-name
# 5. Generate PR
lazypr main
```
Configuration Reference [#configuration-reference]
All Available Settings [#all-available-settings]
| Setting | Description | Default |
| ------------------ | --------------------------------------------- | ---------------- |
| `GROQ_API_KEY` | Groq API key | - |
| `CEREBRAS_API_KEY` | Cerebras API key | - |
| `OPENAI_API_KEY` | OpenAI API key (or placeholder for local) | - |
| `OPENAI_BASE_URL` | Custom OpenAI-compatible API endpoint | - |
| `PROVIDER` | AI provider (`groq`, `cerebras`, or `openai`) | `groq` |
| `MODEL` | Model to use | Provider default |
| `DEFAULT_BRANCH` | Target branch for comparison | `main` |
| `LOCALE` | Output language | `en` |
| `FILTER_COMMITS` | Filter merge/dependency commits | `true` |
| `CONTEXT` | Custom context for AI | - |
| `MAX_RETRIES` | Retry attempts on failure | `3` |
| `TIMEOUT` | Request timeout in ms | `30000` |
Config Commands [#config-commands]
```bash
# Set a value
lazypr config set SETTING=value
# Get a value
lazypr config get SETTING
# List all settings
lazypr config list
# Remove a setting
lazypr config set SETTING=
```
Environment Variables [#environment-variables]
You can also configure LazyPR using environment variables. These override config file settings.
```bash
# In your shell profile (~/.bashrc, ~/.zshrc)
export GROQ_API_KEY=gsk_xxxxxxxxxxxxx
export LAZYPR_PROVIDER=groq
export LAZYPR_MODEL=llama-3.3-70b-versatile
```
Environment variables take precedence over config file settings.
Security Best Practices [#security-best-practices]
1. **Never commit API keys** - Use environment variables or local config files
2. **Use separate keys** - Each team member should have their own API key
3. **Rotate keys regularly** - Update keys periodically for security
4. **Limit key permissions** - Use keys with minimal required permissions
Validation [#validation]
Verify your configuration is correct:
```bash
# Check all settings
lazypr config list
# Test with a dry run
lazypr main -u # Shows token usage to verify API connection
```
# GitHub Actions
import { Callout } from 'fumadocs-ui/components/callout';
import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
import { Step, Steps } from 'fumadocs-ui/components/steps';
Overview [#overview]
LazyPR integrates seamlessly with GitHub Actions to automate PR description generation. These workflows help teams maintain consistent, high-quality PR documentation.
Setup [#setup]
Add API Key Secret [#add-api-key-secret]
Go to your repository **Settings > Secrets and variables > Actions** and add:
* `GROQ_API_KEY` - Your Groq API key
* `CEREBRAS_API_KEY` - (Optional) For fallback support
* `OPENAI_API_KEY` - (Optional) For OpenAI provider
Create Workflow File [#create-workflow-file]
Copy one of the workflow examples below to `.github/workflows/` in your repository.
Test the Workflow [#test-the-workflow]
Create a pull request to trigger the workflow and verify it works correctly.
Auto-Update PR [#auto-update-pr]
Updates PR title and description automatically when new commits are pushed.
```yaml title=".github/workflows/auto-update-pr.yml"
name: Auto-Update PR
on:
pull_request:
types: [opened, synchronize]
permissions:
pull-requests: write
contents: read
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm install -g lazypr
- name: Generate and update PR
env:
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
GH_TOKEN: ${{ github.token }}
run: |
cat < ~/.lazypr
GROQ_API_KEY=${GROQ_API_KEY}
PROVIDER=groq
EOF
lazypr ${{ github.event.pull_request.base.ref }} > pr.txt
TITLE=$(head -n 1 pr.txt | sed 's/^# //')
BODY=$(tail -n +2 pr.txt)
gh pr edit ${{ github.event.pull_request.number }} \
--title "$TITLE" \
--body "$BODY"
```
The `fetch-depth: 0` ensures full git history is available for commit analysis.
Auto-Create PR [#auto-create-pr]
Automatically creates pull requests when pushing to feature or fix branches.
```yaml title=".github/workflows/auto-create-pr.yml"
name: Auto-Create PR
on:
push:
branches:
- 'feature/**'
- 'fix/**'
permissions:
pull-requests: write
contents: read
jobs:
create:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm install -g lazypr
- name: Create PR if needed
env:
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
GH_TOKEN: ${{ github.token }}
run: |
cat < ~/.lazypr
GROQ_API_KEY=${GROQ_API_KEY}
PROVIDER=groq
EOF
# Check if PR already exists
EXISTING=$(gh pr list --head "${{ github.ref_name }}" --json number -q '.[0].number')
if [ -n "$EXISTING" ]; then
echo "PR #$EXISTING already exists"
exit 0
fi
lazypr main > pr.txt
TITLE=$(head -n 1 pr.txt | sed 's/^# //')
BODY=$(tail -n +2 pr.txt)
gh pr create \
--title "$TITLE" \
--body "$BODY" \
--base main
```
This workflow only triggers on branches matching `feature/**` or `fix/**`. Adjust the pattern to match your branching strategy.
Multi-Provider Fallback [#multi-provider-fallback]
Tries Groq first, falls back to Cerebras if it fails. Provides resilience for production workflows.
```yaml title=".github/workflows/multi-provider-fallback.yml"
name: PR with Fallback
on:
pull_request:
types: [opened, synchronize]
permissions:
pull-requests: write
contents: read
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm install -g lazypr
- name: Generate with fallback
env:
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
CEREBRAS_API_KEY: ${{ secrets.CEREBRAS_API_KEY }}
GH_TOKEN: ${{ github.token }}
run: |
# Try Groq first
cat < ~/.lazypr
GROQ_API_KEY=${GROQ_API_KEY}
PROVIDER=groq
EOF
if lazypr ${{ github.event.pull_request.base.ref }} > pr.txt 2>/dev/null; then
echo "Generated with Groq"
else
# Fallback to Cerebras
cat < ~/.lazypr
CEREBRAS_API_KEY=${CEREBRAS_API_KEY}
PROVIDER=cerebras
EOF
if lazypr ${{ github.event.pull_request.base.ref }} > pr.txt 2>/dev/null; then
echo "Generated with Cerebras (fallback)"
else
echo "Both providers failed"
exit 1
fi
fi
TITLE=$(head -n 1 pr.txt | sed 's/^# //')
BODY=$(tail -n +2 pr.txt)
gh pr edit ${{ github.event.pull_request.number }} \
--title "$TITLE" \
--body "$BODY"
```
Both `GROQ_API_KEY` and `CEREBRAS_API_KEY` must be configured in repository secrets.
PR Validation [#pr-validation]
Validates PR description quality and suggests improvements if too short.
```yaml title=".github/workflows/pr-validation.yml"
name: PR Validation
on:
pull_request:
types: [opened, edited]
permissions:
pull-requests: write
contents: read
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm install -g lazypr
- name: Validate PR description
env:
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
GH_TOKEN: ${{ github.token }}
run: |
# Get current PR body
BODY=$(gh pr view ${{ github.event.pull_request.number }} --json body -q '.body')
# Check minimum length (100 characters)
if [ ${#BODY} -lt 100 ]; then
echo "PR description is too short"
# Generate suggestion
cat < ~/.lazypr
GROQ_API_KEY=${GROQ_API_KEY}
PROVIDER=groq
EOF
lazypr ${{ github.event.pull_request.base.ref }} > suggestion.txt
# Post comment with suggestion
gh pr comment ${{ github.event.pull_request.number }} \
--body "## Suggested PR Description
Your PR description seems brief. Here's a suggested improvement:
---
$(cat suggestion.txt)
---
*Generated by LazyPR*"
exit 1
fi
echo "PR description looks good!"
```
Customization Tips [#customization-tips]
Adding Context [#adding-context]
Include project-specific context in your workflows:
```yaml
- name: Generate with context
run: |
lazypr main -c "This is a monorepo with shared packages" > pr.txt
```
Using Templates [#using-templates]
Enable template support for consistent formatting:
```yaml
- name: Generate with template
run: |
lazypr main --template > pr.txt
```
Custom Branch Patterns [#custom-branch-patterns]
Adjust triggers for your branching strategy:
```yaml
on:
push:
branches:
- 'feature/**'
- 'bugfix/**'
- 'hotfix/**'
- 'release/**'
```
Troubleshooting [#troubleshooting]
Workflow Not Triggering [#workflow-not-triggering]
* Check branch patterns match your naming convention
* Verify the workflow file is in `.github/workflows/`
* Ensure the workflow has correct permissions
API Key Errors [#api-key-errors]
* Confirm secrets are added to repository settings
* Check secret names match exactly (case-sensitive)
* Verify API keys are valid and not expired
Permission Denied [#permission-denied]
Add required permissions to your workflow:
```yaml
permissions:
pull-requests: write
contents: read
```
Empty PR Description [#empty-pr-description]
* Ensure `fetch-depth: 0` is set for full git history
* Check there are commits between branches
* Verify the base branch name is correct
# Basic Commands
import { Callout } from 'fumadocs-ui/components/callout';
Command Structure [#command-structure]
The basic LazyPR command structure:
```bash
lazypr [target-branch] [options]
```
Or use the short alias:
```bash
lzp [target-branch] [options]
```
Target Branch [#target-branch]
Specify the branch to compare against (typically `main` or `master`):
```bash
lazypr main # Compare against main branch (default)
lazypr develop # Compare against develop branch
lazypr master # Compare against master branch
```
If no branch is specified, LazyPR defaults to `main`:
```bash
lazypr # Same as: lazypr main
```
Command Options [#command-options]
-t, --template [#-t---template]
Use a PR template from your `.github` folder.
```bash
lazypr main --template
```
If multiple templates exist, LazyPR shows an interactive selector.
-l, --locale [#-l---locale]
Override the language for a single run.
```bash
lazypr main -l es # Generate in Spanish
lazypr main -l fr # Generate in French
lazypr main -l ja # Generate in Japanese
```
Supported languages: en, es, pt, fr, de, it, ja, ko, zh, ru, nl, pl, tr
-c, --context [#-c---context]
Provide custom style guidance (max 200 characters) for this run only.
```bash
lazypr main -c "Focus on security improvements"
lazypr main -c "Use bullet points and keep it brief"
```
Context overrides your global CONTEXT setting for this run only.
--gh [#--gh]
Generate a GitHub CLI command instead of interactive menu.
```bash
lazypr main --gh
```
Outputs a ready-to-run `gh pr create` command that you can copy and execute.
--no-filter [#--no-filter]
Include all commits without filtering.
```bash
lazypr main --no-filter
```
By default, LazyPR filters out merge commits, dependency updates, and formatting changes. Use this flag to include everything.
-u, --usage [#-u---usage]
Display token usage statistics after generation.
```bash
lazypr main -u
```
Shows the number of tokens consumed by the AI request.
Combining Options [#combining-options]
You can combine multiple options:
```bash
lazypr main --template -l es -c "Keep descriptions concise" -u
```
This command:
* Compares against `main` branch
* Uses a PR template
* Generates in Spanish
* Applies custom context
* Shows token usage
Configuration Commands [#configuration-commands]
Manage LazyPR settings:
```bash
# Set a configuration value
lazypr config set SETTING_NAME=value
# View all settings
lazypr config list
# View specific setting
lazypr config get SETTING_NAME
```
Help Command [#help-command]
View all available commands and options:
```bash
lazypr --help
```
Examples [#examples]
```bash
# Basic usage with main branch
lazypr main
# Use template and show token usage
lazypr main --template -u
# Generate in French with custom guidance
lazypr develop -l fr -c "Emphasize performance improvements"
# Generate GitHub CLI command without filtering
lazypr main --gh --no-filter
```
# GitHub Integration
import { Callout } from 'fumadocs-ui/components/callout';
import { Steps, Step } from 'fumadocs-ui/components/steps';
Overview [#overview]
LazyPR integrates with GitHub CLI (`gh`) to streamline PR creation. Instead of copying title and description separately, generate a ready-to-execute `gh pr create` command.
Prerequisites [#prerequisites]
You need GitHub CLI installed and authenticated:
```bash
# Install GitHub CLI
# macOS
brew install gh
# Windows
winget install GitHub.cli
# Linux
sudo apt install gh
# Authenticate
gh auth login
```
Using the --gh Flag [#using-the---gh-flag]
Generate a GitHub CLI command instead of the interactive menu:
```bash
lazypr main --gh
```
**Output**:
```bash
gh pr create --title "feat: Add user authentication" --body "## Changes
- Implement OAuth 2.0 flow
- Add JWT token management
- Create authentication middleware
## Testing
Verified OAuth integration with Google provider"
```
Copy the generated command and run it directly to create your PR!
Complete Workflow [#complete-workflow]
Generate the Command [#generate-the-command]
```bash
lazypr main --gh
```
Copy and Execute [#copy-and-execute]
Copy the generated `gh pr create` command and run it:
```bash
gh pr create --title "..." --body "..."
```
PR Created [#pr-created]
GitHub CLI creates the pull request and returns the URL:
```
https://github.com/username/repo/pull/123
```
Combining with Templates [#combining-with-templates]
Use templates with GitHub integration:
```bash
lazypr main --gh --template
```
The generated command will include template-structured content in the body.
Additional gh Options [#additional-gh-options]
Enhance the generated command with GitHub CLI options:
```bash
# Generate base command
lazypr main --gh
# Then add gh options when running
gh pr create --title "..." --body "..." \
--draft \
--assignee @me \
--label enhancement \
--reviewer username
```
LazyPR generates the title and body. You add any extra `gh pr create` options when executing the command.
Workflow Integration [#workflow-integration]
Shell Alias [#shell-alias]
Create an alias for instant PR creation:
```bash
# Add to ~/.bashrc or ~/.zshrc
alias prgh='lazypr main --gh | pbcopy && echo "Command copied to clipboard!"'
```
Usage:
```bash
prgh # Generate and copy to clipboard
```
CI/CD Integration [#cicd-integration]
Automate PR creation in scripts:
```bash
#!/bin/bash
# Generate PR command
PR_CMD=$(lazypr main --gh)
# Execute if successful
if [ $? -eq 0 ]; then
eval $PR_CMD
else
echo "Failed to generate PR content"
exit 1
fi
```
GitHub Actions Example [#github-actions-example]
```yaml
name: Create PR
on:
push:
branches:
- feature/*
jobs:
create-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install LazyPR
run: npm install -g lazypr
- name: Configure API Key
run: lazypr config set GROQ_API_KEY=${{ secrets.GROQ_API_KEY }}
- name: Create PR
run: |
lazypr main --gh | sh
env:
GH_TOKEN: ${{ github.token }}
```
Benefits [#benefits]
**Speed**: Generate and create PRs in one step without switching contexts.
**Consistency**: Same AI-generated quality whether using interactive mode or CLI.
**Automation**: Perfect for scripts and CI/CD pipelines.
Troubleshooting [#troubleshooting]
**gh command not found**: Install GitHub CLI and ensure it's in your PATH.
**Authentication failed**: Run `gh auth login` to authenticate with GitHub.
**Permission denied**: Ensure your GitHub token has `repo` and `workflow` permissions.
# PR Templates
import { Callout } from 'fumadocs-ui/components/callout';
What are PR Templates? [#what-are-pr-templates]
PR templates are markdown files that define the structure and sections of your pull requests. LazyPR can use your existing templates from the `.github` folder to generate consistent, structured PR descriptions.
Using Templates [#using-templates]
Enable template mode with the `-t` or `--template` flag:
```bash
lazypr main --template
```
LazyPR will:
1. Look for template files in `.github/` directory
2. Parse the template structure
3. Fill in the sections with AI-generated content based on your commits
Template Location [#template-location]
LazyPR searches for templates in these locations:
```
.github/pull_request_template.md
.github/PULL_REQUEST_TEMPLATE.md
.github/pull_request_template/
.github/PULL_REQUEST_TEMPLATE/
```
Interactive Selection [#interactive-selection]
If you have multiple templates, LazyPR displays an interactive selector:
```
? Select a PR template:
❯ feature_template.md
bugfix_template.md
hotfix_template.md
```
Use arrow keys to select and press Enter.
Template Format [#template-format]
Templates typically include sections like:
```markdown
## Description
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
## Testing
## Checklist
- [ ] Tests added
- [ ] Documentation updated
```
LazyPR understands these sections and generates appropriate content for each.
Example: Feature Template [#example-feature-template]
**Template file** (`.github/pull_request_template.md`):
```markdown
## Summary
## Changes
## Testing
## Screenshots
```
**LazyPR output**:
```markdown
## Summary
Implement user authentication with OAuth 2.0 support
## Changes
- Add OAuth authentication flow
- Implement JWT token management
- Create login/logout endpoints
- Add session persistence
## Testing
Tested with Google and GitHub OAuth providers
Verified token refresh mechanism
Validated session timeout handling
## Screenshots
N/A - Backend changes only
```
Template Best Practices [#template-best-practices]
Keep Sections Clear [#keep-sections-clear]
Use clear section headers that describe the content:
```markdown
## What Changed
## Why These Changes
## How to Test
```
Use Comments for Guidance [#use-comments-for-guidance]
Add HTML comments to guide contributors:
```markdown
## Description
```
LazyPR removes these comments and fills in the content.
Include Checklists [#include-checklists]
Checklists help ensure PR completeness:
```markdown
## Checklist
- [ ] Code follows style guidelines
- [ ] Tests pass locally
- [ ] Documentation updated
```
LazyPR can intelligently fill in some checklist items based on your commits (e.g., detecting if tests were added).
Without Templates [#without-templates]
If you don't use the `--template` flag, LazyPR generates a clean, structured description automatically:
```bash
lazypr main # No template
```
Output will still be well-formatted with sections like "Changes", "Summary", and "Testing".
Troubleshooting [#troubleshooting]
**Template Not Found**: Ensure your template is in the `.github` directory and named correctly. Check for typos in the filename.
**Empty Sections**: Some template sections may not be relevant to your commits. LazyPR will either fill them with "N/A" or leave them for manual completion.