Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions .roo/rules-pr-fixer/1_workflow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,26 @@
</phase>

<phase name="implementation">
<description>Execute the user's chosen course of action.</description>
<description>Execute the user's chosen course of action using non-interactive commands only.</description>
<steps>
<step>Check out the PR branch locally using 'gh pr checkout'.</step>
<step>Apply code changes based on review feedback.</step>
<step>Fix failing tests.</step>
<step>Resolve conflicts by rebasing the PR branch and force-pushing.</step>
<step>Check out the PR branch locally using 'gh pr checkout --force' to avoid interactive prompts.</step>
<step>Apply code changes based on review feedback using file editing tools.</step>
<step>Fix failing tests by modifying test files or source code as needed.</step>
<step>For conflict resolution: Use automated detection first, then manual resolution via file editing, avoiding interactive rebase.</step>
<step>If changes affect user-facing content (i18n files, UI components, announcements), delegate translation updates using the new_task tool with translate mode.</step>
<step>Commit changes using automated git commands with explicit author information.</step>
<step>Push changes using 'git push --force-with-lease' to avoid interactive authentication prompts.</step>
</steps>
</phase>

<phase name="validation">
<description>Verify that the pushed changes resolve the issues.</description>
<description>Verify that the pushed changes resolve the issues using non-interactive commands.</description>
<steps>
<step>Use 'gh pr checks --watch' to monitor the CI/CD pipeline and ensure all workflows execute successfully.</step>
<step>Use 'gh pr checks --json' to get current check status without interactive monitoring.</step>
<step>Check specific workflow runs with 'gh run list --pr' to verify CI/CD pipeline status.</step>
<step>Use polling approach: wait briefly, then re-check status until all checks complete.</step>
<step>Verify that all translation updates (if any) have been completed and committed.</step>
<step>Confirm PR is ready for review by checking mergeable state with 'gh pr view --json'.</step>
</steps>
</phase>
</main_workflow>
Expand All @@ -60,5 +67,6 @@
<criterion>All actionable review comments have been addressed.</criterion>
<criterion>All tests are passing.</criterion>
<criterion>The PR is free of merge conflicts.</criterion>
<criterion>All required translations have been completed and committed (if changes affect user-facing content).</criterion>
</completion_criteria>
</workflow_instructions>
70 changes: 57 additions & 13 deletions .roo/rules-pr-fixer/3_common_patterns.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,75 @@
</command>
</template>
</pattern>
<pattern name="resolving_conflicts_rebase">
<usage>A sequence of commands to resolve merge conflicts locally using rebase.</usage>
<pattern name="detecting_conflicts">
<usage>Commands to detect merge conflicts without interactive operations.</usage>
<template>
<command tool="git">git checkout main</command>
<command tool="git">git pull origin main</command>
<command tool="git">git checkout <pr_branch></command>
<command tool="git">git merge-base main HEAD</command>
<command tool="git">git diff --name-only main...HEAD</command>
<comment>Check if rebase would create conflicts (dry run)</comment>
<command tool="git">git rebase --dry-run main</command>
</template>
</pattern>

<pattern name="non_interactive_rebase">
<usage>Non-interactive rebase operations for when no conflicts are detected.</usage>
<template>
<command tool="git">git checkout <pr_branch></command>
<command tool="git">git rebase main</command>
<comment>After resolving conflicts manually, continue the rebase.</comment>
<command tool="git">git rebase --continue</command>
<comment>Force push with lease is preferred for safety.</comment>
<command tool="git">git push --force-with-lease</command>
<comment>If force-with-lease fails, a regular force push can be used.</comment>
<command tool="git">git push --force</command>
<comment>Only proceed if rebase succeeds without conflicts</comment>
<command tool="git">git push --force-with-lease origin <pr_branch></command>
</template>
</pattern>

<pattern name="conflict_status_check">
<usage>Check current conflict status without interactive input.</usage>
<template>
<command tool="git">git status --porcelain</command>
<command tool="git">git diff --name-only --diff-filter=U</command>
<comment>List files with unresolved conflicts</comment>
<command tool="git">git ls-files --unmerged</command>
</template>
</pattern>
<pattern name="checking_out_pr">
<usage>Command to check out a pull request branch locally.</usage>
<usage>Command to check out a pull request branch locally without interactive prompts.</usage>
<template>
<command tool="gh">gh pr checkout <pr_number_or_url> --force</command>
<comment>Alternative: Use git commands if gh checkout fails</comment>
<command tool="git">git fetch origin pull/<pr_number>/head:<branch_name></command>
<command tool="git">git checkout <branch_name></command>
</template>
</pattern>

<pattern name="non_interactive_checks">
<usage>Check PR status without interactive monitoring.</usage>
<template>
<command tool="gh">gh pr checks <pr_number> --json state,conclusion,name,detailsUrl</command>
<comment>Get specific check details without interactive watch</comment>
<command tool="gh">gh run list --pr <pr_number> --json databaseId,status,conclusion</command>
</template>
</pattern>

<pattern name="safe_push_operations">
<usage>Push operations that avoid interactive prompts and credential issues.</usage>
<template>
<command tool="gh">gh pr checkout <pr_number_or_url></command>
<command tool="git">git push --force-with-lease origin <branch_name></command>
<comment>If force-with-lease fails, check remote state first</comment>
<command tool="git">git fetch origin <branch_name></command>
<command tool="git">git status --porcelain</command>
<command tool="git">git push --force origin <branch_name></command>
</template>
</pattern>
<pattern name="watching_pr_checks">
<usage>After pushing changes, use this command to monitor the CI/CD pipeline in real-time.</usage>

<pattern name="automated_commit_operations">
<usage>Commit operations that work in automated environments.</usage>
<template>
<command tool="gh">gh pr checks --watch</command>
<command tool="git">git add .</command>
<command tool="git">git -c user.name="PR Fixer" -c user.email="pr-fixer@local" commit -m "<commit_message>"</command>
<comment>Alternative with explicit author if needed</comment>
<command tool="git">git commit --author="PR Fixer <pr-fixer@local>" -m "<commit_message>"</command>
</template>
</pattern>
</common_patterns>
73 changes: 73 additions & 0 deletions .roo/rules-pr-fixer/4_tool_usage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
<why>Quickly identifies if there are failing automated checks that need investigation.</why>
</priority>
<priority level="3">
<tool>new_task (mode: translate)</tool>
<when>When changes affect user-facing content, i18n files, or UI components that require translation.</when>
<why>Ensures translation consistency across all supported languages when PR fixes involve user-facing changes.</why>
</priority>
<priority level="4">
<tool>gh pr checks --watch</tool>
<when>After pushing a fix, to confirm that the changes have resolved the CI/CD failures.</when>
<why>Provides real-time feedback on whether the fix was successful.</why>
Expand All @@ -35,6 +40,45 @@
<best_practices>
<practice>Use this command to get the exact error messages from failing tests.</practice>
<practice>Search the log for keywords like 'error', 'failed', or 'exception' to quickly find the root cause.</practice>
<practice>Always specify run ID explicitly to avoid interactive selection prompts.</practice>
</best_practices>
</tool>

<tool name="gh pr checkout">
<best_practices>
<practice>Always use --force flag to avoid interactive branch selection.</practice>
<practice>Format: 'gh pr checkout <pr_number> --force'</practice>
<practice>If gh checkout fails, fallback to git fetch + checkout pattern.</practice>
</best_practices>
<non_interactive_alternatives>
<alternative>git fetch origin pull/<pr_number>/head:<branch_name></alternative>
<alternative>git checkout <branch_name></alternative>
</non_interactive_alternatives>
</tool>

<tool name="git operations">
<best_practices>
<practice>Use explicit git configuration for automated commits.</practice>
<practice>Format: 'git -c user.name="PR Fixer" -c user.email="pr-fixer@local" commit'</practice>
<practice>Use --force-with-lease for safer force pushing.</practice>
<practice>Check git status programmatically with --porcelain flag.</practice>
<practice>Use git rebase --dry-run to detect conflicts before attempting rebase.</practice>
</best_practices>
<conflict_resolution>
<step>Use 'git rebase --dry-run main' to detect conflicts</step>
<step>If conflicts detected, resolve manually via file editing</step>
<step>Use 'git status --porcelain' to identify conflicted files</step>
<step>Edit files to resolve conflicts, removing conflict markers</step>
<step>Use 'git add .' and commit with explicit author info</step>
</conflict_resolution>
</tool>

<tool name="gh pr checks">
<best_practices>
<practice>Use --json flag to get structured output instead of interactive watch.</practice>
<practice>Format: 'gh pr checks <pr_number> --json state,conclusion,name'</practice>
<practice>Poll periodically instead of using --watch for automated workflows.</practice>
<practice>Use 'gh run list --pr <pr_number>' to get detailed workflow status.</practice>
</best_practices>
</tool>

Expand All @@ -45,5 +89,34 @@
<practice>Example suggestions: "Address review comments first.", "Tackle the failing tests.", "Resolve merge conflicts."</practice>
</best_practices>
</tool>

<tool name="new_task (mode: translate)">
<best_practices>
<practice>Use when PR fixes involve changes to user-facing strings, i18n files, or UI components.</practice>
<practice>Provide specific details about what content needs translation in the message.</practice>
<practice>Include file paths and descriptions of the changes made.</practice>
<practice>List all affected languages that need updates.</practice>
<practice>Wait for translation completion before proceeding to validation phase.</practice>
</best_practices>
<when_to_use>
<trigger>Changes to webview-ui/src/i18n/locales/en/*.json files</trigger>
<trigger>Changes to src/i18n/locales/en/*.json files</trigger>
<trigger>Modifications to UI components with user-facing text</trigger>
<trigger>Updates to announcement files or documentation requiring localization</trigger>
<trigger>Addition of new error messages or user notifications</trigger>
</when_to_use>
<example_usage><![CDATA[
<new_task>
<mode>translate</mode>
<message>Translation updates needed for PR #1234 fixes. Please translate the following changes:

Files modified:
- webview-ui/src/i18n/locales/en/common.json: Added new error message "connection_failed"
- webview-ui/src/components/settings/ApiSettings.tsx: Updated button text from "Save" to "Save Configuration"

Please ensure all supported languages (ca, de, es, fr, hi, id, it, ja, ko, nl, pl, pt-BR, ru, tr, vi, zh-CN, zh-TW) are updated with appropriate translations for these changes.</message>
</new_task>
]]></example_usage>
</tool>
</tool_specific_guidance>
</tool_usage_guide>
110 changes: 104 additions & 6 deletions .roo/rules-pr-fixer/5_examples.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@
</step>

<step number="4">
<description>Check out the pull request branch.</description>
<description>Check out the pull request branch using non-interactive command.</description>
<tool_use>
<execute_command>
<command>gh pr checkout 4365</command>
<command>gh pr checkout 4365 --force</command>
</execute_command>
</tool_use>
<analysis>The PR branch is now ready for local edits.</analysis>
<analysis>The PR branch is now ready for local edits. Using --force avoids interactive prompts.</analysis>
</step>

<step number="5">
Expand All @@ -82,13 +82,13 @@
</tool_use>
</step>
<step number="6">
<description>After pushing the changes, watch the PR checks to confirm the fix.</description>
<description>After pushing the changes, check PR status using non-interactive commands.</description>
<tool_use>
<execute_command>
<command>gh pr checks --watch</command>
<command>gh pr checks 4365 --json state,conclusion,name</command>
</execute_command>
</tool_use>
<analysis>Confirm that all checks are passing after the fix.</analysis>
<analysis>Check status without interactive monitoring. Poll periodically if needed until all checks complete.</analysis>
</step>
</workflow>

Expand All @@ -97,4 +97,102 @@
<takeaway>Use a combination of the GitHub MCP server and the `gh` CLI to get a complete picture of the PR's status.</takeaway>
</key_takeaways>
</example>

<example name="fix_pr_with_translation_requirements">
<scenario>
A pull request has review comments requesting UI text changes that require translation updates across all supported languages.
</scenario>

<user_request>
Fix PR #1234 in RooCodeInc/Roo-Code - the reviewer asked to change button text and there are some failing tests.
</user_request>

<workflow>
<step number="1">
<description>Get PR details and analyze changes.</description>
<tool_use>
<use_mcp_tool>
<server_name>github</server_name>
<tool_name>get_pull_request</tool_name>
<arguments>
{
"owner": "RooCodeInc",
"repo": "Roo-Code",
"pullNumber": 1234
}
</arguments>
</use_mcp_tool>
</tool_use>
<expected_outcome>Identify the files changed and review feedback requiring UI text modifications.</expected_outcome>
</step>

<step number="2">
<description>Check out PR and apply the requested changes.</description>
<tool_use>
<execute_command>
<command>gh pr checkout 1234 --force</command>
</execute_command>
</tool_use>
<analysis>Make the requested button text changes in the UI components. Using --force to avoid interactive prompts.</analysis>
</step>

<step number="3">
<description>Identify translation requirements and delegate to translate mode.</description>
<tool_use>
<new_task>
<mode>translate</mode>
<message>Translation updates needed for PR #1234 fixes. The following changes were made based on review feedback:

Files modified:
- webview-ui/src/components/settings/ApiSettings.tsx: Changed button text from "Save" to "Save Configuration"
- webview-ui/src/i18n/locales/en/common.json: Updated key "save_button" to "save_config_button"

Please update all supported languages (ca, de, es, fr, hi, id, it, ja, ko, nl, pl, pt-BR, ru, tr, vi, zh-CN, zh-TW) with appropriate translations for:
- New key "save_config_button" with translation equivalent to "Save Configuration"
- Any other text changes that affect user-facing content

Ensure consistency across all language files and maintain the same context and tone as existing translations.</message>
</new_task>
</tool_use>
<expected_outcome>Translation subtask created and all language files updated.</expected_outcome>
</step>

<step number="4">
<description>Commit all changes including translations with automated git configuration.</description>
<tool_use>
<execute_command>
<command>git add . && git -c user.name="PR Fixer" -c user.email="pr-fixer@local" commit -m "fix: update button text and translations as requested in review"</command>
</execute_command>
</tool_use>
<analysis>All code changes and translation updates are now committed with explicit author info.</analysis>
</step>

<step number="5">
<description>Push changes and check CI status using non-interactive commands.</description>
<tool_use>
<execute_command>
<command>git push --force-with-lease</command>
</execute_command>
</tool_use>
<analysis>Push changes safely, then check status programmatically.</analysis>
</step>

<step number="6">
<description>Verify CI status without interactive monitoring.</description>
<tool_use>
<execute_command>
<command>gh pr checks 1234 --json state,conclusion,name</command>
</execute_command>
</tool_use>
<analysis>Check that all tests pass and translation completeness is maintained using structured output.</analysis>
</step>
</workflow>

<key_takeaways>
<takeaway>Always check if PR fixes involve user-facing content that requires translation.</takeaway>
<takeaway>Use new_task with translate mode to ensure consistent translation updates.</takeaway>
<takeaway>Include detailed context about what changed and why in translation requests.</takeaway>
<takeaway>Verify translation completeness before considering the PR fix complete.</takeaway>
</key_takeaways>
</example>
</complete_examples>