Central Configuration File (.pr_agent.toml)
Relevant source files
The following files were used as context for generating this wiki page:
The .pr_agent.toml file serves as the primary configuration mechanism for the PR-Agent tool across the @JWEB0689 GitHub organization. It defines default behaviors, prompts, and tool-specific parameters that govern how the AI interacts with Pull Requests, providing a standardized set of rules for automated reviews, descriptions, and code improvements.
This configuration architecture supports a hierarchy where global settings defined in the JWEB0689/pr-agent-settings repository are inherited by all other repositories in the organization. Individual repositories maintain the ability to override these global defaults by including their own local .pr_agent.toml file.
Sources: README.md:1-12
Configuration Hierarchy and Inheritance
PR-Agent implements a layered configuration strategy. When a Pull Request is processed, the system first loads the global settings from the centralized repository before applying any repository-specific overrides.
The diagram shows the sequence in which configuration files are resolved to create the final runtime settings.
Sources: README.md:7-15
Core Configuration Sections
The .pr_agent.toml file is organized into functional blocks corresponding to different PR-Agent tools and features.
Pr-Review Settings
This section controls the behavior of the /review command. It determines whether the agent performs security audits, identifies potential bugs, or suggests performance optimizations.
| Option | Type | Description |
|---|---|---|
require_score_review | Boolean | Determines if a numerical score is required for the PR. |
extra_instructions | String | Custom natural language instructions for the LLM during review. |
enable_security_check | Boolean | Enables or disables automated security vulnerability scanning. |
Sources: .pr_agent.toml, README.md:21-22
Pr-Description Settings
These settings define the output format for the /describe command, which generates PR titles, descriptions, and changelogs.
Pr-Improve Settings
Governs the /improve command which provides commit-ready inline code suggestions. The configuration defines the threshold for suggestion importance and the maximum number of suggestions per file.
Integration with Autonomous Workflows
The configuration settings directly influence the behavior of autonomous scripts within the environment, such as the autofix.py utility. This script uses findings generated by PR-Agent (guided by the configuration) to attempt automated repairs of code issues.
Autofix Execution Logic
The autofix.py script operates in two primary modes based on the presence of review findings or CI failures.
The diagram illustrates how the autonomous fixer decides its repair strategy based on the context provided by PR-Agent.
Sources: scripts/autofix.py:382-411
Relevant Functions in autofix.py
detect_test_runner(modified_files): Identifies the project type (Cargo, Npm, Pytest, Go) and selects the appropriate validation command. Sources: scripts/autofix.py:68-91get_review_findings(repo, pr_number): Queries the GitHub API to retrieve comments and summaries generated by PR-Agent. Sources: scripts/autofix.py:165-197call_gemini(api_key, model, prompt): Interfaces with the LLM to generate code repairs based on configuration-defined prompts. Sources: scripts/autofix.py:108-132
Workflow Activation
The configuration is operationalized through a reusable GitHub Action workflow located at .github/workflows/pr_agent.yml. This workflow allows repositories to trigger PR-Agent tools automatically on specific events or manually via comments.
Supported Interactive Commands
Users can interact with the agent using specific commands in PR comments, which are processed according to the .pr_agent.toml specifications:
/review: Executes full code review./describe: Generates PR documentation./improve: Provides code suggestions./ask <question>: Facilitates Q&A regarding changes.
Sources: README.md:20-25, .github/workflows/pr_agent.yml
Summary
The .pr_agent.toml central configuration file is the cornerstone of automated code quality within the @JWEB0689 organization. By centralizing these settings, the project ensures consistent AI behavior across multiple repositories while maintaining the flexibility to handle project-specific requirements through local overrides. This configuration works in tandem with the autofix.py script and GitHub Actions to create an autonomous feedback loop for developers.
Sources: README.md:7-18, scripts/autofix.py:16-35