PR Generator Command
The aetheris pr-gen command generates GitHub Pull Requests with AI-generated fixes for bugs found in analysis.
Prerequisites
- GitHub CLI installed and authenticated:
gh auth login - AI provider configured (see below)
AI Provider Configuration
Create a .env file in your project root with your API key:
# Option 1: Gemini (recommended, free tier available)
AI_PROVIDER=gemini
GEMINI_API_KEY=your_key_here
# Option 2: OpenAI
AI_PROVIDER=openai
OPENAI_API_KEY=your_key_here
# Option 3: Claude (Anthropic)
AI_PROVIDER=claude
ANTHROPIC_API_KEY=your_key_here
Get your API key: - Gemini: https://ai.google.dev (free tier available) - OpenAI: https://platform.openai.com/api-keys - Anthropic: https://console.anthropic.com/
Important: Add
.envto your.gitignoreto avoid committing API keys.
Usage
Aliases: generate-prs
Options
| Option | Description |
|---|---|
--dry-run | Preview PRs and fixes without creating them |
--base-branch BRANCH | Target base branch for PRs (defaults to repo default) |
--from-report FILE | Process only this specific analysis report |
--bug-index INDEX | Process only the bug at this index (0-based) |
--link-issues | Automatically link PRs to matching GitHub issues (requires aetheris issues to be run first) |
--issue-number NUM | Explicitly link all PRs to this issue number |
Examples
Preview PRs (Recommended First)
Generate All PRs
Link to Issues
⚠️ Prerequisite: Run
aetheris issuesfirst to create GitHub issues from analysis reports. The--link-issuesoption matches PRs to existing issues by bug ID. If issues don't exist, PRs will be created without issue links.
Target Specific Branch
From Specific Report
Single Bug by Index
Link to Specific Issue
How It Works
- Parse Reports: Reads bugs from
docs/analyses/reports - Generate Fixes: Uses AI to generate code fixes
- Create Branch: Creates feature branch per bug
- Apply Fix: Applies the generated fix
- Push Branch: Pushes to remote
- Create PR: Opens PR with detailed description
PR Format
Title
Body Sections
- Summary of the fix
- Bug details (type, severity, location)
- What was changed
- Link to issue (if
--link-issues) - Test plan
Workflow
Typical Flow
Important: Steps must be executed in order. The
--link-issuesoption in step 4 depends on issues created in step 2.
# 1. Analyze codebase
aetheris analysis
# 2. Create GitHub issues (REQUIRED before --link-issues)
aetheris issues
# 3. Preview PRs
aetheris pr-gen --dry-run
# 4. Generate PRs with issue linking
aetheris pr-gen --link-issues
Note: If you skip step 2 and use
--link-issues, PRs will still be created but without issue references. Use--issue-numberto explicitly link to a known issue number.
Single Bug Fix
Branch Naming
Branches are named automatically using a deterministic format:
Where: - <file>: Source filename (without extension) - <bug-type>: Normalized bug type (e.g., null-reference, security) - <short-id>: First 8 characters of the bug's unique ID hash (e.g., BUG-BE2212F2 → be2212f2)
Collision prevention: The short-id is derived from the bug's deterministic hash (Bug ID), which is computed from the bug's file path, line number, type, and description. This ensures: - Same bug always produces same branch name (idempotent) - Different bugs produce unique branch names - Re-running pr-gen detects existing branches and skips them
Example: fix/analyzer-null-reference-be2212f2
Batching Strategies
By default, each bug creates one PR (1 bug = 1 PR). For codebases with many minor bugs, this can result in PR spam. Consider these strategies:
Strategy 1: Filter by Severity
Process only high-priority bugs first:
Strategy 2: Incremental Processing
Process bugs one at a time to control PR volume:
Strategy 3: File-Scoped PRs
Focus on one file at a time:
Strategy 4: Manual Batching Workflow
For maximum control, combine multiple fixes manually:
# 1. Preview all fixes
aetheris pr-gen --dry-run
# 2. Create a single branch for related fixes
git checkout -b fix/batch-minor-issues
# 3. Apply fixes selectively using bug indices
aetheris pr-gen --bug-index 0 --dry-run # Review fix
# Manually apply or cherry-pick desired changes
# 4. Create a single PR with all batched fixes
gh pr create --title "fix: batch of minor issues" --body "Combined fixes for issues #1, #2, #3"
Tip: For large reports (50+ bugs), consider running analysis with stricter filters or addressing bugs in phases by severity level.
Notes
- Default behavior: 1 bug = 1 PR (atomic, reviewable changes)
- Existing branches are detected and skipped
- AI generates fixes based on bug context and code
- Use
--dry-runfirst to preview changes - For batch processing, use the strategies above to control PR volume