Getting Started Guide
Relevant source files
The following files were used as context for generating this wiki page:
- README.md
- scripts/autofix.py
- .github/workflows/pr_agent.yml
- .pr_agent.toml
- scripts/utils.py (Integrated logic from autofix utility functions)
The pr-agent-settings repository centralizes configuration and automated repair tools for the PR-Agent across all repositories owned by @JWEB0689. This system enables global settings inheritance, repository-specific overrides, and autonomous code repair based on review findings or CI failures.
Sources: README.md:1-5, scripts/autofix.py:5-11
Configuration Management
PR-Agent uses a hierarchical configuration structure. The central .pr_agent.toml file in this repository provides global defaults for all child repositories.
Global Inheritance and Overrides
- Global Settings: PR-Agent loads
.pr_agent.tomlfromJWEB0689/pr-agent-settingsfor every pull request. - Local Overrides: You can define a
.pr_agent.tomlin individual repositories to override global settings.
Sources: README.md:7-14
Interactive Commands
You trigger PR-Agent features by commenting on a Pull Request.
| Command | Action |
|---|---|
/review | Performs code review, security, and test analysis. |
/describe | Generates a PR description and changelog. |
/improve | Provides commit-ready code suggestions. |
/ask <question> | Answers specific questions about the changes. |
Sources: README.md:20-25
Autonomous Repair System
The autofix.py script acts as an autonomous engineer. It fixes issues flagged by PR-Agent or repairs the codebase when CI builds fail.
Operational Modes
The script operates in two distinct modes depending on the PR state:
- Review-Fix Mode: Processes inline comments and review summaries left by PR-Agent. It sends findings to Gemini to generate updated file contents.
- CI-Fix Mode: Runs when no review findings exist but CI checks fail. It executes local test commands and attempts to repair the specific errors found in the logs.
Sources: scripts/autofix.py:7-13, scripts/autofix.py:284-307
Repair Workflow
The following diagram illustrates the decision logic and execution flow of the autonomous fixer:
The script prioritizes review findings before falling back to CI failure repairs.
Sources: scripts/autofix.py:284-315, scripts/autofix.py:228-260
Environment Configuration
The autonomous fixer requires specific environment variables to interact with the GitHub API and Gemini AI services.
| Variable | Requirement | Description |
|---|---|---|
GEMINI_API_KEY | Required | Google AI Studio key for Gemini models. |
GEMINI_MODEL | Optional | Defaults to gemini-3.8-flash. |
GH_TOKEN | Required | GitHub token for the gh CLI and REST API calls. |
REPO | Required | The owner/repo string for the target project. |
PR_NUMBER | Required | The ID of the pull request to process. |
HEAD_REF | Required | The branch name for pushing repairs. |
Sources: scripts/autofix.py:17-25, scripts/autofix.py:302-306
Integration Procedures
To integrate these settings into a new repository, follow these steps:
- Configure Workflow: Reference the reusable workflow located at
.github/workflows/pr_agent.ymlin your repository's workflow directory. - Define Tests: Ensure your repository contains a supported manifest file (e.g.,
package.json,Cargo.toml,pyproject.toml) so the script can detect and run your test suite. - Set Secrets: Add
GEMINI_API_KEYandGH_TOKENto your repository secrets to enable autonomous repairs. - Trigger Repairs: Use the
/autofixcommand (implied by script logic) or let the CI workflow triggerautofix.pyon failure.
Sources: README.md:16-18, scripts/autofix.py:59-78
The central configuration system ensures consistent AI-assisted code reviews and self-healing CI pipelines across the @JWEB0689 organization by utilizing global defaults and autonomous repair scripts.