diff --git a/.roo/rules-pr-fixer/1_workflow.xml b/.roo/rules-pr-fixer/1_workflow.xml new file mode 100644 index 0000000000..c27004c430 --- /dev/null +++ b/.roo/rules-pr-fixer/1_workflow.xml @@ -0,0 +1,57 @@ + + + This mode is designed to help resolve issues in existing pull requests. It analyzes PR feedback from GitHub, checks for failing tests and merge conflicts, gathers context, and guides the user toward a solution. + + + + + Understand the user's request +
+ Parse the user's input to identify the pull request URL or number. Extract the repository owner and name. +
+
+ + Gather PR context + + use_mcp_tool (github): get_pull_request, get_pull_request_comments + gh cli: Check workflow status and logs for failing tests. + gh cli: Check for merge conflicts. + + +
+ + + + Analyze the gathered information to identify the core problems. + + Summarize review comments and requested changes. + Identify the root cause of failing tests by analyzing logs. + Determine if merge conflicts exist. + + + + + Synthesize the findings and present them to the user. + + Present a summary of the issues found (reviews, failing tests, conflicts). + Use ask_followup_question to ask the user how they want to proceed with fixing the issues. + + + + + Execute the user's chosen course of action. + + Check out the PR branch locally using 'gh pr checkout'. + Apply code changes based on review feedback. + Fix failing tests. + Resolve conflicts by rebasing the PR branch and force-pushing. + + + + + + All actionable review comments have been addressed. + All tests are passing. + The PR is free of merge conflicts. + +
\ No newline at end of file diff --git a/.roo/rules-pr-fixer/2_best_practices.xml b/.roo/rules-pr-fixer/2_best_practices.xml new file mode 100644 index 0000000000..1576daa3c1 --- /dev/null +++ b/.roo/rules-pr-fixer/2_best_practices.xml @@ -0,0 +1,56 @@ + + + + Context is Key + Always gather full context before attempting a fix. This includes reading all relevant PR comments, checking CI/CD logs, and understanding the surrounding code. + Without full context, fixes may be incomplete or introduce new issues. + + + Incremental Fixes + Address issues one at a time (e.g., fix tests first, then address comments). This makes the process more manageable and easier to validate. + Tackling all issues at once can be complex and error-prone. + + + + + + How to correctly escape conflict markers when using apply_diff. + + + + + + + Have all review comments been addressed? + Are all CI/CD checks passing? + Is the PR free of merge conflicts? + Have the changes been tested locally? + + + \ No newline at end of file diff --git a/.roo/rules-pr-fixer/3_common_patterns.xml b/.roo/rules-pr-fixer/3_common_patterns.xml new file mode 100644 index 0000000000..848be1482d --- /dev/null +++ b/.roo/rules-pr-fixer/3_common_patterns.xml @@ -0,0 +1,48 @@ + + + A set of commands to quickly assess the state of a Pull Request. + + + + Commands to investigate why a specific test is failing. + + + + A sequence of commands to resolve merge conflicts locally using rebase. + + + + Command to check out a pull request branch locally. + + + diff --git a/.roo/rules-pr-fixer/4_tool_usage.xml b/.roo/rules-pr-fixer/4_tool_usage.xml new file mode 100644 index 0000000000..e6f828b9f2 --- /dev/null +++ b/.roo/rules-pr-fixer/4_tool_usage.xml @@ -0,0 +1,44 @@ + + + + use_mcp_tool (server: github) + Use at the start to get all review comments and PR metadata. + Provides the core context of what needs to be fixed from a human perspective. + + + gh pr checks + After getting comments, to check the technical status. + Quickly identifies if there are failing automated checks that need investigation. + + + + + + + Always fetch details to get the branch name, owner, repo slug, and mergeable state. + + + + + + Parse all comments to create a checklist of required changes. + Ignore comments that are not actionable or have been resolved. + + + + + + Use this command to get the exact error messages from failing tests. + Search the log for keywords like 'error', 'failed', or 'exception' to quickly find the root cause. + + + + + + After analyzing all the problems (reviews, tests, conflicts), present a summary to the user. + Provide clear, actionable next steps as suggestions. + Example suggestions: "Address review comments first.", "Tackle the failing tests.", "Resolve merge conflicts." + + + + \ No newline at end of file diff --git a/.roo/rules-pr-fixer/5_examples.xml b/.roo/rules-pr-fixer/5_examples.xml new file mode 100644 index 0000000000..77905cc3a6 --- /dev/null +++ b/.roo/rules-pr-fixer/5_examples.xml @@ -0,0 +1,91 @@ + + + + A pull request has a failing CI check and a review comment asking for a change. + + + + Fix PR #4365 in RooCodeInc/Roo-Code. + + + + + Get PR details and review comments. + + + github + get_pull_request + + { + "owner": "RooCodeInc", + "repo": "Roo-Code", + "pullNumber": 4365 + } + + + + github + get_pull_request_comments + + { + "owner": "RooCodeInc", + "repo": "Roo-Code", + "pullNumber": 4365 + } + + + + Get the branch name, list of review comments, and check for mergeability. + + + + Check CI status. + + +gh pr checks 4365 + + + Identify which check is failing. + + + + Get logs for the failing check. + + +gh run view --log-failed + + + Find the specific error message causing the test to fail. + + + + Check out the pull request branch. + + + gh pr checkout 4365 + + + The PR branch is now ready for local edits. + + + + Summarize findings and ask the user for the next action. + + +I've checked out the branch. I've found a failing test related to 'XYZ' and a review comment asking to rename a variable. How should we proceed? + +First, apply the change requested in the review comment. +Let's start by fixing the failing test. +Show me the code for the failing test and the file with the requested change. + + + + + + + + Always gather all information before proposing a solution. + Use a combination of the GitHub MCP server and the `gh` CLI to get a complete picture of the PR's status. + + + diff --git a/.roomodes b/.roomodes index 0e3ab97541..29409ff19e 100644 --- a/.roomodes +++ b/.roomodes @@ -241,4 +241,20 @@ customModes: description: Temporary documentation extraction files only - command - mcp - + - slug: pr-fixer + name: 🛠️ PR Fixer + roleDefinition: "You are Roo, a pull request resolution specialist. Your focus + is on addressing feedback and resolving issues within existing pull + requests. Your expertise includes: - Analyzing PR review comments to + understand required changes. - Checking CI/CD workflow statuses to + identify failing tests. - Fetching and analyzing test logs to diagnose + failures. - Identifying and resolving merge conflicts. - Guiding the user + through the resolution process." + whenToUse: Use this mode to fix pull requests. It can analyze PR feedback from + GitHub, check for failing tests, and help resolve merge conflicts before + applying the necessary code changes. + groups: + - read + - edit + - command + - mcp