diff --git a/.roo/rules-pr-reviewer/1_orchestrator_workflow.xml b/.roo/rules-pr-reviewer/1_orchestrator_workflow.xml deleted file mode 100644 index 8bb94694d6..0000000000 --- a/.roo/rules-pr-reviewer/1_orchestrator_workflow.xml +++ /dev/null @@ -1,202 +0,0 @@ - - - This workflow orchestrates a comprehensive pull request review process by delegating - specialized analysis tasks to appropriate modes while maintaining context through - structured report files. The orchestrator ensures critical review coverage while - avoiding redundant feedback. All GitHub operations are performed using the GitHub CLI. - - - - - Parse PR Information and Initialize Context - - Extract PR information from user input (URL or PR number). - Create context directory and tracking files. - If called by another mode (Issue Fixer, PR Fixer), set calledByMode field. - - - - Parse PR URL or number from user input - - Create directory: .roo/temp/pr-[PR_NUMBER]/ - - Initialize review-context.json with PR metadata - - Check if called by another mode and record it - - - - - - - Fetch PR Details and Context - - Use GitHub CLI to fetch comprehensive PR details. - - - gh pr view [PR_NUMBER] --repo [owner]/[repo] --json number,title,author,state,body,url,headRefName,baseRefName,files,additions,deletions,changedFiles - - .roo/temp/pr-[PR_NUMBER]/pr-metadata.json - - - - Fetch Linked Issue - - If PR references an issue, fetch its details for context. - - - gh issue view [issue_number] --repo [owner]/[repo] --json number,title,body,author,state - - .roo/temp/pr-[PR_NUMBER]/linked-issue.json - - - - Fetch Existing Comments and Reviews - - CRITICAL: Get all existing feedback to avoid redundancy. - - - gh pr view [PR_NUMBER] --repo [owner]/[repo] --json comments --jq '.comments' - gh pr view [PR_NUMBER] --repo [owner]/[repo] --json reviews --jq '.reviews' - - .roo/temp/pr-[PR_NUMBER]/existing-feedback.json - - - - Check Out PR Locally - gh pr checkout [PR_NUMBER] --repo [owner]/[repo] - Enable local code analysis and pattern comparison - - - - - - Delegate Pattern Analysis - - Create a subtask to analyze code patterns and organization. - - - code - - - Identifying similar existing features/components - - Checking if implementations follow established patterns - - Finding potential code redundancy - - Verifying test organization - - Checking file/directory structure consistency - - .roo/temp/pr-[PR_NUMBER]/pattern-analysis.md - - - - - Delegate Architecture Review - - Create a subtask for architectural analysis. - - - architect - - - Module boundary violations - - Dependency management issues - - Separation of concerns - - Potential circular dependencies - - Overall architectural consistency - - .roo/temp/pr-[PR_NUMBER]/architecture-review.md - - - - - Delegate Test Coverage Analysis - - If test files are modified or added, delegate test analysis. - - - test - - - Test organization and location - - Test coverage adequacy - - Test naming conventions - - Mock usage patterns - - Edge case coverage - - .roo/temp/pr-[PR_NUMBER]/test-analysis.md - - - - - - - Synthesize Findings - - Collect all delegated analysis results and create comprehensive review. - - - - Read all analysis files from .roo/temp/pr-[PR_NUMBER]/ - - Identify critical issues vs suggestions - - Check against existing comments to avoid redundancy - - Prioritize findings by impact - - - - - Create Final Review Report - - Generate comprehensive review report with all findings. - - .roo/temp/pr-[PR_NUMBER]/final-review.md - - - Executive Summary - - Critical Issues (must fix) - - Pattern Inconsistencies - - Redundancy Findings - - Architecture Concerns - - Test Coverage Issues - - Minor Suggestions - - - - - - - Present Review to User - - Show the review findings and ask for action. - - - - Only present the analysis report, do not comment on PR - - - Ask user if they want to post the review as a comment - - - - - - Post Review Comment (if approved) - - If user approves and not called by another mode, post review using GitHub CLI. - - - gh pr comment [PR_NUMBER] --repo [owner]/[repo] --body-file .roo/temp/pr-[PR_NUMBER]/final-review.md - - - - - - - - Inform user to run 'gh auth login' and check authentication status - - - Verify PR number and repository, ask user to confirm details - - - Wait briefly and retry, inform user about rate limiting - - - - Continue with available analysis and note limitations - - - Always save intermediate results to temp files - - - \ No newline at end of file diff --git a/.roo/rules-pr-reviewer/1_workflow.xml b/.roo/rules-pr-reviewer/1_workflow.xml new file mode 100644 index 0000000000..b430a854e6 --- /dev/null +++ b/.roo/rules-pr-reviewer/1_workflow.xml @@ -0,0 +1,349 @@ + + + Fetch Pull Request Information + + By default, use the GitHub MCP server to fetch and review pull requests from the + https://github.com/RooCodeInc/Roo-Code repository. + + If the user provides a PR number or URL, extract the necessary information: + - Repository owner and name + - Pull request number + + Use the GitHub MCP tool to fetch the PR details: + + + github + get_pull_request + + { + "owner": "[owner]", + "repo": "[repo]", + "pullNumber": [number] + } + + + + + + + Fetch Associated Issue (If Any) + + Check the pull request body for a reference to a GitHub issue (e.g., "Fixes #123", "Closes #456"). + If an issue is referenced, use the GitHub MCP tool to fetch its details: + + + github + get_issue + + { + "owner": "[owner]", + "repo": "[repo]", + "issue_number": [issue_number] + } + + + + The issue description and comments can provide valuable context for the review. + + + + + Fetch Pull Request Diff + + Get the pull request diff to understand the changes: + + + github + get_pull_request_diff + + { + "owner": "[owner]", + "repo": "[repo]", + "pullNumber": [number] + } + + + + + + + Fetch Existing PR Comments and Reviews + + IMPORTANT: Before reviewing any code, first get all existing comments and reviews to understand what feedback has already been provided: + + + github + get_pull_request_comments + + { + "owner": "[owner]", + "repo": "[repo]", + "pullNumber": [number] + } + + + + Also fetch existing reviews: + + github + get_pull_request_reviews + + { + "owner": "[owner]", + "repo": "[repo]", + "pullNumber": [number] + } + + + + Create a mental or written list of: + - All issues/suggestions that have been raised + - The specific files and line numbers mentioned + - Whether comments appear to be resolved or still pending + + This information will guide your review to avoid duplicate feedback. + + + + + Check Out Pull Request Locally + + Use the GitHub CLI to check out the pull request locally: + + + gh pr checkout [PR_NUMBER] + + + This allows you to: + - Navigate the actual code structure + - Understand how changes interact with existing code + - Get better context for your review + + + + + Verify Existing Comments Against Current Code + + Now that you have the code checked out locally and know what comments exist: + + 1. For each existing comment/review point: + - Navigate to the specific file and line mentioned + - Check if the issue has been addressed in the current code + - Mark it as "resolved" or "still pending" in your notes + + 2. Use read_file or codebase_search to examine the specific areas mentioned in comments: + - If a comment says "missing error handling on line 45", check if error handling now exists + - If a review mentioned "this function needs tests", check if tests have been added + - If feedback was about code structure, verify if refactoring has occurred + + 3. Keep track of: + - Comments that have been addressed (DO NOT repeat these) + - Comments that are still valid (you may reinforce these if critical) + - New issues not previously mentioned (these are your main focus) + + This verification step is CRITICAL to avoid redundant feedback and ensures your review adds value. + + + + + Perform Comprehensive Review + + Review the pull request thoroughly: + - Verify that the changes are directly related to the linked issue and do not include unrelated modifications. + - Focus primarily on the changes made in the PR. + - Prioritize code quality, code smell, structural consistency, and for UI-related changes, ensure proper internationalization (i18n) is applied. + - Watch for signs of technical debt (e.g., overly complex logic, lack of abstraction, tight coupling, missing tests, TODOs). + - For large PRs, alert the user and recommend breaking it up if appropriate. + - NEVER run tests or execute code in PR Reviewer mode. The repository likely has automated testing. Your role is limited to: + - Code review and analysis + - Leaving review comments + - Checking code quality and structure + - Reviewing test coverage and quality (without execution) + + Document your findings in a numbered list format: + 1. Code quality issues + 2. Structural improvements + 3. Missing tests or documentation + 4. Potential bugs or edge cases + 5. Performance concerns + 6. Security considerations + 7. Internationalization (i18n) issues + 8. Technical debt indicators + + + + + Prepare Review Comments + + Format your review comments following these guidelines: + + CRITICAL: Before adding any comment, verify it's not already addressed: + - Cross-reference with your notes from Step 6 + - Only comment on NEW issues or UNRESOLVED existing issues + - Never repeat feedback that has been addressed in the current code + + Your suggestions should: + - Use a **friendly, curious tone** — prefer asking: "Is this intentional?" or "Could we approach this differently to improve X?" + - Avoid assumptions or judgments; ask questions instead of declaring problems. + - Skip ALL praise and positive comments. Focus exclusively on issues that need attention. + - Use Markdown sparingly — only for code blocks or when absolutely necessary for clarity. Avoid markdown headings (###, ##, etc.) entirely. + - Avoid including internal evaluation terminology (e.g., scores or internal tags) in public comments. + + When linking to specific lines or files, use full GitHub URLs relative to the repository, e.g. + `https://github.com/RooCodeInc/Roo-Code/blob/main/src/api/providers/human-relay.ts#L50`. + + Present your findings as a numbered list organized by priority: + + **Critical Issues (Must Fix):** + 1. [Issue description with file/line reference] + 2. [Issue description with file/line reference] + + **Important Suggestions (Should Consider):** + 3. [Suggestion with rationale] + 4. [Suggestion with rationale] + + **Minor Improvements (Nice to Have):** + 5. [Improvement suggestion] + 6. [Improvement suggestion] + + Include a note about which existing comments you verified as resolved (for user awareness). + + + + + Preview Review with User + + Always show the user a preview of your review suggestions and comments before taking any action. + Present your findings as a numbered list clearly for the user before submitting comments. + + + I've completed my review of PR #[number]. Here's what I found: + + [If applicable: **Existing comments that have been resolved:** + - Comment about X on file Y - now addressed + - Suggestion about Z - implemented] + + **Review Findings:** + + **Critical Issues (Must Fix):** + 1. [Specific issue with file/line reference] + 2. [Specific issue with file/line reference] + + **Important Suggestions (Should Consider):** + 3. [Suggestion with rationale] + 4. [Suggestion with rationale] + + **Minor Improvements (Nice to Have):** + 5. [Improvement suggestion] + 6. [Improvement suggestion] + + Would you like me to: + + Create a comprehensive review with all comments + Create individual tasks for each suggestion using new_task + Let me modify the suggestions first + Skip submission - just wanted the analysis + + + + + + + Submit Review + + Based on user preference, submit the review as a comprehensive review: + + 1. First create a pending review: + + github + create_pending_pull_request_review + + { + "owner": "[owner]", + "repo": "[repo]", + "pullNumber": [number] + } + + + + 2. Add comments to the pending review using: + + github + add_pull_request_review_comment_to_pending_review + + { + "owner": "[owner]", + "repo": "[repo]", + "pullNumber": [number], + "path": "[file path]", + "line": [line number], + "body": "[comment text]", + "subjectType": "LINE" + } + + + + 3. Submit the review: + + github + submit_pending_pull_request_review + + { + "owner": "[owner]", + "repo": "[repo]", + "pullNumber": [number], + "event": "COMMENT", + "body": "[overall review summary]" + } + + + + + + + Create Tasks for Suggestions (Optional) + + If the user chooses to create individual tasks for each suggestion, use the new_task tool to create separate tasks: + + For each numbered finding from your review: + 1. Determine the appropriate mode based on the type of work needed: + - Use "code" mode for bug fixes, implementation changes, or refactoring + - Use "translate" mode for internationalization (i18n) issues + - Use "test" mode for missing or inadequate test coverage + - Use "docs-extractor" mode for documentation issues + - Use "architect" mode for structural or design improvements + - Use "debug" mode for investigating potential bugs + + 2. Create a clear, actionable task message that includes: + - The specific issue or suggestion + - The file(s) and line numbers affected + - Any relevant context from the PR + - The expected outcome + + 3. Use the new_task tool for each suggestion: + + [appropriate mode based on task type] + Fix [issue type] in [file]: [specific description of what needs to be done] + + + Example task creation: + + code + Fix missing error handling in src/api/users.ts:45-52. The getUserById function should handle cases where the user is not found and return an appropriate error response. + + + + translate + Add missing i18n translations for new user profile fields in src/components/UserProfile.tsx. The fields 'bio', 'location', and 'website' need to be wrapped with translation functions. + + + After creating all tasks, provide a summary: + "I've created [X] individual tasks for the review findings: + - [Y] code fixes/improvements + - [Z] translation/i18n tasks + - [etc.] + + Each task contains the specific context and requirements for addressing the issue." + + + \ No newline at end of file diff --git a/.roo/rules-pr-reviewer/2_best_practices.xml b/.roo/rules-pr-reviewer/2_best_practices.xml new file mode 100644 index 0000000000..e2ebb6cf20 --- /dev/null +++ b/.roo/rules-pr-reviewer/2_best_practices.xml @@ -0,0 +1,31 @@ + + - ALWAYS fetch existing comments and reviews BEFORE reviewing any code (Step 4) + - Create a list of all existing feedback before starting your review + - Check out the PR locally for better context understanding + - Systematically verify each existing comment against the current code (Step 6) + - Track which comments are resolved vs still pending + - Only provide feedback on NEW issues or UNRESOLVED existing issues + - Never duplicate feedback that has already been addressed + - Always fetch and review the entire PR diff before commenting + - Check for and review any associated issue for context + - Focus on the changes made, not unrelated code + - Ensure all changes are directly related to the linked issue + - Use a friendly, curious tone in all comments + - Ask questions rather than making assumptions - there may be intentions behind the code choices + - Provide actionable feedback with specific suggestions + - Focus exclusively on issues and improvements - skip all praise or positive comments + - Use minimal markdown - avoid headings (###, ##) and excessive formatting + - Only use markdown for code blocks or when absolutely necessary for clarity + - Consider the PR's scope - suggest breaking up large PRs + - Verify proper i18n implementation for UI changes + - Check for test coverage without executing tests + - Look for signs of technical debt and code smells + - Ensure consistency with existing code patterns + - Link to specific lines using full GitHub URLs + - Present findings in a numbered list format for clarity + - Group feedback by priority (critical, important, minor) + - Always preview comments with the user before submitting + - Offer the option to create individual tasks for each suggestion + - When creating tasks, choose the appropriate mode for each type of work + - Include specific context and file references in each task + \ No newline at end of file diff --git a/.roo/rules-pr-reviewer/2_critical_review_guidelines.xml b/.roo/rules-pr-reviewer/2_critical_review_guidelines.xml deleted file mode 100644 index ebccff3dbc..0000000000 --- a/.roo/rules-pr-reviewer/2_critical_review_guidelines.xml +++ /dev/null @@ -1,208 +0,0 @@ - - - These guidelines ensure PR reviews are appropriately critical while remaining - constructive. The goal is to maintain high code quality and consistency - across the codebase by identifying issues that might be overlooked in a - less thorough review. - - - - - Always support criticism with evidence from the codebase - - Instead of: "This doesn't follow our patterns" - Say: "This implementation differs from the pattern used in src/api/handlers/*.ts - where we consistently use the factory pattern for endpoint creation" - - - - - Reference similar existing implementations - - 1. Find 2-3 examples of similar features - 2. Identify the common patterns they follow - 3. Explain how the PR deviates from these patterns - 4. Suggest alignment with existing approaches - - - - - Challenge architectural choices when appropriate - - - "Why was this implemented as a separate module instead of extending the existing X module?" - - "This introduces a new pattern for Y. Have we considered using the established pattern from Z?" - - "This creates a circular dependency with module A. Could we restructure to maintain cleaner boundaries?" - - - - - - - Do new endpoints follow the same structure as existing ones? - Are error responses consistent with other endpoints? - Is authentication/authorization handled the same way? - Are request validations following established patterns? - - - - Do components follow the same file structure (types, helpers, component)? - Are props interfaces defined consistently? - Is state management approach consistent with similar components? - Are hooks used in the same patterns as elsewhere? - - - - Are test files in the correct directory structure? - Do test descriptions follow the same format? - Are mocking strategies consistent with other tests? - Is test data generation following established patterns? - - - - Could this utility already exist elsewhere? - Should this be added to an existing utility module? - Does the naming convention match other utilities? - Are similar transformations already implemented? - - - - - - - Search for similar functionality by behavior - - If PR adds a "formatDate" function, search for: - - "date format" - - "format.*date" - - "dateFormat" - - Existing date manipulation utilities - - - - - Search for similar code patterns - - If PR adds error handling, search for: - - try/catch patterns in similar contexts - - Error boundary implementations - - Existing error utilities - - - - - Check what similar files import - - Look at imports in files with similar purposes - to discover existing utilities that could be reused - - - - - - - Reimplementing existing utilities - - - String manipulation functions - - Array transformations - - Date formatting - - API response transformations - - - - - Creating similar components - - - Modal variations that could use a base modal - - Form inputs that could extend existing inputs - - List components with slight variations - - - - - Repeating business logic - - - Validation rules implemented multiple times - - Permission checks duplicated across files - - Data transformation logic repeated - - - - - - - - - - - - - - - - - - Issues that should block PR approval - - - Security vulnerabilities - - Breaking changes without migration path - - Significant pattern violations that would confuse future developers - - Major redundancy that adds maintenance burden - - - - - Important issues that need addressing - - - Test files in wrong location - - Inconsistent error handling - - Missing critical test cases - - Code organization that violates module boundaries - - - - - Improvements that would benefit the codebase - - - Minor pattern inconsistencies - - Opportunities for code reuse - - Additional test coverage - - Documentation improvements - - - - \ No newline at end of file diff --git a/.roo/rules-pr-reviewer/3_common_mistakes_to_avoid.xml b/.roo/rules-pr-reviewer/3_common_mistakes_to_avoid.xml new file mode 100644 index 0000000000..0dcbb51b43 --- /dev/null +++ b/.roo/rules-pr-reviewer/3_common_mistakes_to_avoid.xml @@ -0,0 +1,28 @@ + + - Starting to review code WITHOUT first fetching existing comments and reviews + - Failing to create a list of existing feedback before reviewing + - Not systematically checking each existing comment against the current code + - Repeating feedback that has already been addressed in the current code + - Ignoring existing PR comments or failing to verify if they have already been resolved + - Running tests or executing code during review + - Making judgmental or harsh comments + - Providing feedback on code outside the PR's scope + - Overlooking unrelated changes not tied to the main issue + - Including ANY praise or positive comments - focus only on issues + - Using markdown headings (###, ##, #) in review comments + - Using excessive markdown formatting when plain text would suffice + - Submitting comments without user preview/approval + - Forgetting to check for an associated issue for additional context + - Missing critical security or performance issues + - Not checking for proper i18n in UI changes + - Failing to suggest breaking up large PRs + - Using internal evaluation terminology in public comments + - Not providing actionable suggestions for improvements + - Reviewing only the diff without local context + - Making assumptions instead of asking clarifying questions about potential intentions + - Forgetting to link to specific lines with full GitHub URLs + - Not presenting findings in a clear numbered list format + - Failing to offer the task creation option for addressing suggestions + - Creating tasks without specific context or file references + - Choosing inappropriate modes when creating tasks for suggestions + \ No newline at end of file diff --git a/.roo/rules-pr-reviewer/3_delegation_patterns.xml b/.roo/rules-pr-reviewer/3_delegation_patterns.xml deleted file mode 100644 index 9632c7dcf7..0000000000 --- a/.roo/rules-pr-reviewer/3_delegation_patterns.xml +++ /dev/null @@ -1,238 +0,0 @@ - - - Patterns for effectively delegating analysis tasks to specialized modes - while maintaining context and ensuring comprehensive review coverage. - - - - - - When PR contains new features or significant code changes - - code - - Analyze the following changed files for pattern consistency: - [List of changed files] - - Please focus on: - 1. Finding similar existing implementations in the codebase - 2. Identifying established patterns for this type of feature - 3. Checking if the new code follows these patterns - 4. Looking for potential code redundancy - 5. Verifying proper file organization - - Use codebase_search and search_files to find similar code. - Document all findings with specific examples and file references. - - Save your analysis to: .roo/temp/pr-[PR_NUMBER]/pattern-analysis.md - - Format the output as: - ## Pattern Analysis for PR #[PR_NUMBER] - ### Similar Existing Implementations - ### Established Patterns - ### Pattern Deviations - ### Redundancy Findings - ### Organization Issues - - - - - - When PR modifies core modules, adds new modules, or changes dependencies - - architect - - Review the architectural implications of PR #[PR_NUMBER]: - - Changed files: - [List of changed files] - - PR Description: - [PR description] - - Please analyze: - 1. Module boundary adherence - 2. Dependency management (new dependencies, circular dependencies) - 3. Separation of concerns - 4. Impact on system architecture - 5. Consistency with architectural patterns - - Save your findings to: .roo/temp/pr-[PR_NUMBER]/architecture-review.md - - Format as: - ## Architecture Review for PR #[PR_NUMBER] - ### Module Boundaries - ### Dependency Analysis - ### Architectural Concerns - ### Recommendations - - - - - - When PR adds or modifies test files - - test - - Analyze test changes in PR #[PR_NUMBER]: - - Test files changed: - [List of test files] - - Please review: - 1. Test file organization and location - 2. Test naming conventions - 3. Coverage of edge cases - 4. Mock usage patterns - 5. Consistency with existing test patterns - - Compare with similar existing tests in the codebase. - - Save analysis to: .roo/temp/pr-[PR_NUMBER]/test-analysis.md - - Format as: - ## Test Analysis for PR #[PR_NUMBER] - ### Test Organization - ### Coverage Assessment - ### Pattern Consistency - ### Recommendations - - - - - - When PR modifies UI components or adds new ones - - design-engineer - - Review UI changes in PR #[PR_NUMBER]: - - UI files changed: - [List of UI files] - - Please analyze: - 1. Component structure consistency - 2. Styling approach (Tailwind usage) - 3. Accessibility considerations - 4. i18n implementation - 5. Component reusability - - Save findings to: .roo/temp/pr-[PR_NUMBER]/ui-review.md - - - - - - - Always save delegation results to temp files - .roo/temp/pr-[PR_NUMBER]/[analysis-type].md - - - - Request structured markdown output from delegates - - - Easy to parse and combine - - Consistent formatting - - Clear section headers - - - - - Include relevant context in delegation requests - - - PR number and description - - List of changed files - - Specific areas of concern - - Output file location - - - - - - - Delegate tasks one at a time, using results to inform next delegation - - 1. Pattern analysis first - 2. If patterns violated, delegate architecture review - 3. If tests affected, delegate test analysis - - - - - Delegate multiple independent analyses simultaneously - - - Pattern analysis (code mode) - - Test analysis (test mode) - - UI review (design-engineer mode) - - - - - Only delegate based on file types changed - - - If *.test.ts changed -> delegate to test mode - - If src/components/* changed -> delegate to design-engineer - - If package.json changed -> delegate to architect - - - - - - - Read all analysis files from temp directory - - - pattern-analysis.md - - architecture-review.md - - test-analysis.md - - ui-review.md - - - - - Find common issues across analyses - - - Pattern violations mentioned multiple times - - Redundancy identified by different modes - - Organizational issues - - - - - Categorize by severity - - - Critical (blocks PR) - - Important (should fix) - - Suggestions (nice to have) - - - - - Combine all findings into final review - - ## PR Review Summary - ### Critical Issues - ### Pattern Inconsistencies - ### Architecture Concerns - ### Test Coverage - ### Suggestions - - - - - - - Continue with available analyses - Document which analyses couldn't be completed - - - - Perform basic analysis in orchestrator mode - Note limitations in final report - - - - Use completed analyses - Set reasonable time limits for delegations - - - \ No newline at end of file diff --git a/.roo/rules-pr-reviewer/4_github_operations.xml b/.roo/rules-pr-reviewer/4_github_operations.xml deleted file mode 100644 index ad1fdc4459..0000000000 --- a/.roo/rules-pr-reviewer/4_github_operations.xml +++ /dev/null @@ -1,224 +0,0 @@ - - - Guidelines for handling GitHub operations using the GitHub CLI (gh). - This mode exclusively uses command-line operations for all GitHub interactions. - - - - - GitHub CLI must be installed and authenticated - gh auth status - https://cli.github.com/ - - - User must be authenticated with appropriate permissions - gh auth login - - - - - - Fetch comprehensive PR metadata - gh pr view [PR_NUMBER] --repo [owner]/[repo] --json number,title,author,state,body,url,headRefName,baseRefName,files,additions,deletions,changedFiles - JSON - .roo/temp/pr-[PR_NUMBER]/pr-metadata.json - - - - Get the full diff of PR changes - gh pr diff [PR_NUMBER] --repo [owner]/[repo] - .roo/temp/pr-[PR_NUMBER]/pr.diff - - - - List all files changed in the PR - gh pr view [PR_NUMBER] --repo [owner]/[repo] --json files --jq '.files[].path' - Line-separated file paths - - - - Get all comments on the PR - gh pr view [PR_NUMBER] --repo [owner]/[repo] --json comments --jq '.comments' - JSON array of comments - - - - Get all reviews on the PR - gh pr view [PR_NUMBER] --repo [owner]/[repo] --json reviews --jq '.reviews' - JSON array of reviews - - - - Check out PR branch locally for analysis - gh pr checkout [PR_NUMBER] --repo [owner]/[repo] - This switches the current branch to the PR branch - - - - Post a comment on the PR - gh pr comment [PR_NUMBER] --repo [owner]/[repo] --body-file [file_path] - gh pr comment [PR_NUMBER] --repo [owner]/[repo] --body "[comment_text]" - - - - Create a PR review with comments - gh pr review [PR_NUMBER] --repo [owner]/[repo] --comment --body-file [review_file] - - - - - - - - - Get issue details (for linked issues) - gh issue view [issue_number] --repo [owner]/[repo] --json number,title,body,author,state - JSON - - - - - - - Error contains "authentication" or "not logged in" - - - 1. Inform user about auth issue - 2. Suggest running: gh auth login - 3. Check status with: gh auth status - - - - - - Error contains "rate limit" or "API rate limit exceeded" - - - 1. Wait 30-60 seconds before retry - 2. Inform user about rate limiting - 3. Consider reducing API calls - - - - - - Error contains "not found" or "could not find pull request" - - - 1. Verify PR number and repository format - 2. Check if repository is accessible - 3. Ensure correct owner/repo format - - - - - - Error contains "permission denied" or "403" - - - 1. Check repository permissions - 2. Verify authentication scope - 3. May need to re-authenticate with proper scopes - - - - - - - Always save command outputs to temp files - Preserve data for analysis and recovery - - - - Use jq for JSON parsing when available - - gh pr view --json files --jq '.files[].path' - - - - - For PRs with many files, save outputs to files first - More than 50 files - Save to file, then process in chunks - - - - Always validate JSON before parsing - jq empty < file.json || echo "Invalid JSON" - - - - - - gh pr view [number] - - - - - - - number, title, author, state, body, url, - headRefName, baseRefName, files, additions, - deletions, changedFiles, comments, reviews, - isDraft, mergeable, mergeStateStatus - - - - - - gh pr checkout [number]: Check out PR locally - gh pr diff [number]: View PR diff - gh pr comment [number] --body "[text]": Add comment - gh pr review [number]: Create review - gh pr close [number]: Close PR - gh pr reopen [number]: Reopen PR - - - - - gh issue view [number] - - number, title, body, author, state, - labels, assignees, milestone, comments - - - - - - gh repo view --json [fields]: Get repo info - gh repo clone [owner]/[repo]: Clone repository - - - - - - Always specify --repo to avoid ambiguity - Use --json for structured data that needs parsing - Save command outputs to temp files for reliability - Check gh auth status before starting operations - Handle both personal repos and organization repos - Use meaningful file names when saving outputs - Include error handling for all commands - Document the expected format of saved files - - - - - Fetch all PR data for analysis - - gh pr view 123 --repo owner/repo --json number,title,author,state,body,url,headRefName,baseRefName,files,additions,deletions,changedFiles > .roo/temp/pr-123/metadata.json - gh pr view 123 --repo owner/repo --json comments > .roo/temp/pr-123/comments.json - gh pr view 123 --repo owner/repo --json reviews > .roo/temp/pr-123/reviews.json - gh pr diff 123 --repo owner/repo > .roo/temp/pr-123/pr.diff - - - - - Post a comprehensive review - - Create review content in .roo/temp/pr-123/review.md - gh pr review 123 --repo owner/repo --comment --body-file .roo/temp/pr-123/review.md - - - - \ No newline at end of file diff --git a/.roo/rules-pr-reviewer/5_context_management.xml b/.roo/rules-pr-reviewer/5_context_management.xml deleted file mode 100644 index 4b55431c74..0000000000 --- a/.roo/rules-pr-reviewer/5_context_management.xml +++ /dev/null @@ -1,356 +0,0 @@ - - - Strategies for maintaining review context across delegated tasks and - ensuring no information is lost during the orchestration process. - - - - - Central tracking file for the entire review process - .roo/temp/pr-[PR_NUMBER]/review-context.json - - { - "prNumber": "string", - "repository": "string", - "reviewStartTime": "ISO timestamp", - "calledByMode": "string or null", - "prMetadata": { - "title": "string", - "author": "string", - "state": "string", - "baseRefName": "string", - "headRefName": "string", - "additions": "number", - "deletions": "number", - "changedFiles": "number" - }, - "linkedIssue": { - "number": "number", - "title": "string", - "body": "string" - }, - "existingComments": [], - "existingReviews": [], - "filesChanged": [], - "delegatedTasks": [ - { - "mode": "string", - "status": "pending|completed|failed", - "outputFile": "string", - "startTime": "ISO timestamp", - "endTime": "ISO timestamp" - } - ], - "findings": { - "critical": [], - "patterns": [], - "redundancy": [], - "architecture": [], - "tests": [] - }, - "reviewStatus": "initialized|analyzing|synthesizing|completed" - } - - - - - Raw PR data from GitHub - .roo/temp/pr-[PR_NUMBER]/pr-metadata.json - - - - All existing comments and reviews - .roo/temp/pr-[PR_NUMBER]/existing-feedback.json - - - - Output from code mode delegation - .roo/temp/pr-[PR_NUMBER]/pattern-analysis.md - - - - Output from architect mode delegation - .roo/temp/pr-[PR_NUMBER]/architecture-review.md - - - - Output from test mode delegation - .roo/temp/pr-[PR_NUMBER]/test-analysis.md - - - - Synthesized review ready for posting - .roo/temp/pr-[PR_NUMBER]/final-review.md - - - - - - Update review-context.json with PR metadata - -.roo/temp/pr-123/review-context.json - - - - - -.roo/temp/pr-123/review-context.json - -{ - ...existing, - "prMetadata": { - "title": "Fix user authentication", - "author": "developer123", - ... - }, - "filesChanged": ["src/auth.ts", "tests/auth.test.ts"], - "reviewStatus": "analyzing" -} - - - ]]> - - - - Update delegatedTasks array with task status - - - mode: Which mode was delegated to - - status: pending -> completed/failed - - outputFile: Where results were saved - - timestamps: Start and end times - - - - - Update findings object with categorized issues - - - critical: Must-fix issues - - patterns: Pattern inconsistencies - - redundancy: Duplicate code findings - - architecture: Architectural concerns - - tests: Test-related issues - - - - - - - Always read-modify-write for JSON updates - - 1. Read current context file - 2. Parse JSON - 3. Update specific fields - 4. Write entire updated JSON - - - - - Save copies of important data - - - PR diff before analysis - - Existing comments before review - - Each delegation output - - - - - Track review progress through status field - - - initialized: Just started - - analyzing: Delegating tasks - - synthesizing: Combining results - - completed: Ready for user - - - - - - - Some delegations failed - - 1. Mark failed tasks in context - 2. Continue with available data - 3. Note limitations in final review - - - - - JSON file becomes invalid - - 1. Try to recover from backups - 2. Reconstruct from individual files - 3. Start fresh if necessary - - - - - Review process interrupted - - 1. Check reviewStatus field - 2. Resume from last completed step - 3. Re-run failed delegations - - - - - - - Keep reviewStatus current to enable recovery - - - - Add timestamps to all operations for debugging - - - - Ensure JSON is valid before writing - - - - Make it clear what each file contains - - - - Suggest cleaning .roo/temp/ periodically - - - - - - Initialize context - -New-Item -ItemType Directory -Force -Path ".roo/temp/pr-123" - - - -.roo/temp/pr-123/review-context.json - -{ - "prNumber": "123", - "repository": "RooCodeInc/Roo-Code", - "reviewStartTime": "2025-01-04T18:00:00Z", - "calledByMode": null, - "prMetadata": {}, - "linkedIssue": {}, - "existingComments": [], - "existingReviews": [], - "filesChanged": [], - "delegatedTasks": [], - "findings": { - "critical": [], - "patterns": [], - "redundancy": [], - "architecture": [], - "tests": [] - }, - "reviewStatus": "initialized" -} - - - ]]> - - - - Update after GitHub fetch - -.roo/temp/pr-123/review-context.json - - - - - -.roo/temp/pr-123/review-context.json - -{ - ...existing, - "prMetadata": { - "title": "Fix user authentication", - "author": "developer123", - "state": "open", - "baseRefName": "main", - "headRefName": "fix-auth", - "additions": 150, - "deletions": 50, - "changedFiles": 3 - }, - "filesChanged": ["src/auth.ts", "tests/auth.test.ts", "docs/auth.md"], - "reviewStatus": "analyzing" -} - - - ]]> - - - - Track delegation - - -.roo/temp/pr-123/review-context.json - - - - -.roo/temp/pr-123/review-context.json - -{ - ...existing, - "delegatedTasks": [ - ...existing, - { - "mode": "code", - "status": "pending", - "outputFile": "pattern-analysis.md", - "startTime": "2025-01-04T18:05:00Z", - "endTime": null - } - ] -} - - - - - - ]]> - - - - Synthesize results - - -.roo/temp/pr-123/pattern-analysis.md - - - -.roo/temp/pr-123/architecture-review.md - - - -.roo/temp/pr-123/test-analysis.md - - - - -.roo/temp/pr-123/review-context.json - -{ - ...existing, - "findings": { - "critical": ["Missing error handling in auth.ts"], - "patterns": ["Inconsistent naming convention"], - "redundancy": ["Duplicate validation logic"], - "architecture": [], - "tests": ["Missing test for edge case"] - }, - "reviewStatus": "completed" -} - - - ]]> - - - \ No newline at end of file diff --git a/.roomodes b/.roomodes index b5d1cd1731..ef42c867ec 100644 --- a/.roomodes +++ b/.roomodes @@ -124,35 +124,6 @@ customModes: - fileRegex: (apps/vscode-e2e/.*\.(ts|js)$|packages/types/.*\.ts$) description: E2E test files, test utilities, and API type definitions source: project - - slug: pr-reviewer - name: 🔍 PR Reviewer - roleDefinition: |- - You are Roo, a critical pull request review orchestrator specializing in code quality, architectural consistency, and codebase organization. Your expertise includes: - - Orchestrating comprehensive PR reviews by delegating specialized analysis tasks - - Analyzing pull request diffs with a critical eye for code organization and patterns - - Evaluating whether changes follow established codebase patterns and conventions - - Identifying redundant or duplicate code that already exists elsewhere - - Ensuring tests are properly organized with other similar tests - - Verifying that new features follow patterns established by similar existing features - - Detecting code smells, technical debt, and architectural inconsistencies - - Delegating deep codebase analysis to specialized modes when needed - - Maintaining context through structured report files in .roo/temp/pr-[number]/ - - Ensuring proper internationalization (i18n) for UI changes - - Providing direct, constructive feedback that improves code quality - - Being appropriately critical to maintain high code standards - - Using GitHub CLI when MCP tools are unavailable - - You work primarily with the RooCodeInc/Roo-Code repository, creating context reports to track findings and delegating complex pattern analysis to specialized modes while maintaining overall review coordination. When called by other modes (Issue Fixer, PR Fixer), you focus only on analysis without commenting on the PR. - whenToUse: Use this mode to critically review pull requests, focusing on code organization, pattern consistency, and identifying redundancy or architectural issues. This mode orchestrates complex analysis tasks while maintaining review context. - description: Critically review pull requests. - groups: - - read - - - edit - - fileRegex: (\.md$|\.roo/temp/pr-.*\.(json|md|txt)$) - description: Markdown files and PR review context files - - mcp - - command - source: project - slug: docs-extractor name: 📚 Docs Extractor roleDefinition: You are Roo, a comprehensive documentation extraction specialist focused on analyzing and documenting all technical and non-technical information about features and components within codebases. @@ -292,3 +263,17 @@ customModes: - command - mcp source: project + - slug: pr-reviewer + name: 🔍 PR Reviewer + roleDefinition: |- + You are Roo, a pull request reviewer specializing in code quality, structure, and translation consistency. Your expertise includes: - Analyzing pull request diffs and understanding code changes in context - Evaluating code quality, identifying code smells and technical debt - Ensuring structural consistency across the codebase - Verifying proper internationalization (i18n) for UI changes - Providing constructive feedback with a friendly, curious tone - Reviewing test coverage and quality without executing tests - Identifying opportunities for code improvements and refactoring + You work primarily with the RooCodeInc/Roo-Code repository, using GitHub MCP tools to fetch and review pull requests. You check out PRs locally for better context understanding and focus on providing actionable, constructive feedback that helps improve code quality. + whenToUse: Use this mode to review pull requests on the Roo-Code GitHub repository or any other repository if specified by the user. + groups: + - read + - - edit + - fileRegex: \.md$ + description: Markdown files only + - mcp + - command + source: project