Skip to content

Commit ecad9c1

Browse files
committed
feat: add translation orchestration to PR Fixer mode
- Added step to delegate translation updates when i18n files are affected - Uses new_task tool to invoke translate mode for user-facing content changes - Maintains non-interactive command usage (--force, --json flags) - Minimal implementation without adding unnecessary complexity
1 parent 24eb6e4 commit ecad9c1

File tree

4 files changed

+249
-26
lines changed

4 files changed

+249
-26
lines changed

.roo/rules-pr-fixer/1_workflow.xml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,26 @@
3939
</phase>
4040

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

5154
<phase name="validation">
52-
<description>Verify that the pushed changes resolve the issues.</description>
55+
<description>Verify that the pushed changes resolve the issues using non-interactive commands.</description>
5356
<steps>
54-
<step>Use 'gh pr checks --watch' to monitor the CI/CD pipeline and ensure all workflows execute successfully.</step>
57+
<step>Use 'gh pr checks --json' to get current check status without interactive monitoring.</step>
58+
<step>Check specific workflow runs with 'gh run list --pr' to verify CI/CD pipeline status.</step>
59+
<step>Use polling approach: wait briefly, then re-check status until all checks complete.</step>
60+
<step>Verify that all translation updates (if any) have been completed and committed.</step>
61+
<step>Confirm PR is ready for review by checking mergeable state with 'gh pr view --json'.</step>
5562
</steps>
5663
</phase>
5764
</main_workflow>
@@ -60,5 +67,6 @@
6067
<criterion>All actionable review comments have been addressed.</criterion>
6168
<criterion>All tests are passing.</criterion>
6269
<criterion>The PR is free of merge conflicts.</criterion>
70+
<criterion>All required translations have been completed and committed (if changes affect user-facing content).</criterion>
6371
</completion_criteria>
6472
</workflow_instructions>

.roo/rules-pr-fixer/3_common_patterns.xml

Lines changed: 57 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,75 @@
2424
</command>
2525
</template>
2626
</pattern>
27-
<pattern name="resolving_conflicts_rebase">
28-
<usage>A sequence of commands to resolve merge conflicts locally using rebase.</usage>
27+
<pattern name="detecting_conflicts">
28+
<usage>Commands to detect merge conflicts without interactive operations.</usage>
2929
<template>
3030
<command tool="git">git checkout main</command>
3131
<command tool="git">git pull origin main</command>
32+
<command tool="git">git checkout <pr_branch></command>
33+
<command tool="git">git merge-base main HEAD</command>
34+
<command tool="git">git diff --name-only main...HEAD</command>
35+
<comment>Check if rebase would create conflicts (dry run)</comment>
36+
<command tool="git">git rebase --dry-run main</command>
37+
</template>
38+
</pattern>
39+
40+
<pattern name="non_interactive_rebase">
41+
<usage>Non-interactive rebase operations for when no conflicts are detected.</usage>
42+
<template>
3243
<command tool="git">git checkout <pr_branch></command>
3344
<command tool="git">git rebase main</command>
34-
<comment>After resolving conflicts manually, continue the rebase.</comment>
35-
<command tool="git">git rebase --continue</command>
36-
<comment>Force push with lease is preferred for safety.</comment>
37-
<command tool="git">git push --force-with-lease</command>
38-
<comment>If force-with-lease fails, a regular force push can be used.</comment>
39-
<command tool="git">git push --force</command>
45+
<comment>Only proceed if rebase succeeds without conflicts</comment>
46+
<command tool="git">git push --force-with-lease origin <pr_branch></command>
47+
</template>
48+
</pattern>
49+
50+
<pattern name="conflict_status_check">
51+
<usage>Check current conflict status without interactive input.</usage>
52+
<template>
53+
<command tool="git">git status --porcelain</command>
54+
<command tool="git">git diff --name-only --diff-filter=U</command>
55+
<comment>List files with unresolved conflicts</comment>
56+
<command tool="git">git ls-files --unmerged</command>
4057
</template>
4158
</pattern>
4259
<pattern name="checking_out_pr">
43-
<usage>Command to check out a pull request branch locally.</usage>
60+
<usage>Command to check out a pull request branch locally without interactive prompts.</usage>
61+
<template>
62+
<command tool="gh">gh pr checkout <pr_number_or_url> --force</command>
63+
<comment>Alternative: Use git commands if gh checkout fails</comment>
64+
<command tool="git">git fetch origin pull/<pr_number>/head:<branch_name></command>
65+
<command tool="git">git checkout <branch_name></command>
66+
</template>
67+
</pattern>
68+
69+
<pattern name="non_interactive_checks">
70+
<usage>Check PR status without interactive monitoring.</usage>
71+
<template>
72+
<command tool="gh">gh pr checks <pr_number> --json state,conclusion,name,detailsUrl</command>
73+
<comment>Get specific check details without interactive watch</comment>
74+
<command tool="gh">gh run list --pr <pr_number> --json databaseId,status,conclusion</command>
75+
</template>
76+
</pattern>
77+
78+
<pattern name="safe_push_operations">
79+
<usage>Push operations that avoid interactive prompts and credential issues.</usage>
4480
<template>
45-
<command tool="gh">gh pr checkout <pr_number_or_url></command>
81+
<command tool="git">git push --force-with-lease origin <branch_name></command>
82+
<comment>If force-with-lease fails, check remote state first</comment>
83+
<command tool="git">git fetch origin <branch_name></command>
84+
<command tool="git">git status --porcelain</command>
85+
<command tool="git">git push --force origin <branch_name></command>
4686
</template>
4787
</pattern>
48-
<pattern name="watching_pr_checks">
49-
<usage>After pushing changes, use this command to monitor the CI/CD pipeline in real-time.</usage>
88+
89+
<pattern name="automated_commit_operations">
90+
<usage>Commit operations that work in automated environments.</usage>
5091
<template>
51-
<command tool="gh">gh pr checks --watch</command>
92+
<command tool="git">git add .</command>
93+
<command tool="git">git -c user.name="PR Fixer" -c user.email="pr-fixer@local" commit -m "<commit_message>"</command>
94+
<comment>Alternative with explicit author if needed</comment>
95+
<command tool="git">git commit --author="PR Fixer <pr-fixer@local>" -m "<commit_message>"</command>
5296
</template>
5397
</pattern>
5498
</common_patterns>

.roo/rules-pr-fixer/4_tool_usage.xml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
<why>Quickly identifies if there are failing automated checks that need investigation.</why>
1212
</priority>
1313
<priority level="3">
14+
<tool>new_task (mode: translate)</tool>
15+
<when>When changes affect user-facing content, i18n files, or UI components that require translation.</when>
16+
<why>Ensures translation consistency across all supported languages when PR fixes involve user-facing changes.</why>
17+
</priority>
18+
<priority level="4">
1419
<tool>gh pr checks --watch</tool>
1520
<when>After pushing a fix, to confirm that the changes have resolved the CI/CD failures.</when>
1621
<why>Provides real-time feedback on whether the fix was successful.</why>
@@ -35,6 +40,45 @@
3540
<best_practices>
3641
<practice>Use this command to get the exact error messages from failing tests.</practice>
3742
<practice>Search the log for keywords like 'error', 'failed', or 'exception' to quickly find the root cause.</practice>
43+
<practice>Always specify run ID explicitly to avoid interactive selection prompts.</practice>
44+
</best_practices>
45+
</tool>
46+
47+
<tool name="gh pr checkout">
48+
<best_practices>
49+
<practice>Always use --force flag to avoid interactive branch selection.</practice>
50+
<practice>Format: 'gh pr checkout <pr_number> --force'</practice>
51+
<practice>If gh checkout fails, fallback to git fetch + checkout pattern.</practice>
52+
</best_practices>
53+
<non_interactive_alternatives>
54+
<alternative>git fetch origin pull/<pr_number>/head:<branch_name></alternative>
55+
<alternative>git checkout <branch_name></alternative>
56+
</non_interactive_alternatives>
57+
</tool>
58+
59+
<tool name="git operations">
60+
<best_practices>
61+
<practice>Use explicit git configuration for automated commits.</practice>
62+
<practice>Format: 'git -c user.name="PR Fixer" -c user.email="pr-fixer@local" commit'</practice>
63+
<practice>Use --force-with-lease for safer force pushing.</practice>
64+
<practice>Check git status programmatically with --porcelain flag.</practice>
65+
<practice>Use git rebase --dry-run to detect conflicts before attempting rebase.</practice>
66+
</best_practices>
67+
<conflict_resolution>
68+
<step>Use 'git rebase --dry-run main' to detect conflicts</step>
69+
<step>If conflicts detected, resolve manually via file editing</step>
70+
<step>Use 'git status --porcelain' to identify conflicted files</step>
71+
<step>Edit files to resolve conflicts, removing conflict markers</step>
72+
<step>Use 'git add .' and commit with explicit author info</step>
73+
</conflict_resolution>
74+
</tool>
75+
76+
<tool name="gh pr checks">
77+
<best_practices>
78+
<practice>Use --json flag to get structured output instead of interactive watch.</practice>
79+
<practice>Format: 'gh pr checks <pr_number> --json state,conclusion,name'</practice>
80+
<practice>Poll periodically instead of using --watch for automated workflows.</practice>
81+
<practice>Use 'gh run list --pr <pr_number>' to get detailed workflow status.</practice>
3882
</best_practices>
3983
</tool>
4084

@@ -45,5 +89,34 @@
4589
<practice>Example suggestions: "Address review comments first.", "Tackle the failing tests.", "Resolve merge conflicts."</practice>
4690
</best_practices>
4791
</tool>
92+
93+
<tool name="new_task (mode: translate)">
94+
<best_practices>
95+
<practice>Use when PR fixes involve changes to user-facing strings, i18n files, or UI components.</practice>
96+
<practice>Provide specific details about what content needs translation in the message.</practice>
97+
<practice>Include file paths and descriptions of the changes made.</practice>
98+
<practice>List all affected languages that need updates.</practice>
99+
<practice>Wait for translation completion before proceeding to validation phase.</practice>
100+
</best_practices>
101+
<when_to_use>
102+
<trigger>Changes to webview-ui/src/i18n/locales/en/*.json files</trigger>
103+
<trigger>Changes to src/i18n/locales/en/*.json files</trigger>
104+
<trigger>Modifications to UI components with user-facing text</trigger>
105+
<trigger>Updates to announcement files or documentation requiring localization</trigger>
106+
<trigger>Addition of new error messages or user notifications</trigger>
107+
</when_to_use>
108+
<example_usage><![CDATA[
109+
<new_task>
110+
<mode>translate</mode>
111+
<message>Translation updates needed for PR #1234 fixes. Please translate the following changes:
112+
113+
Files modified:
114+
- webview-ui/src/i18n/locales/en/common.json: Added new error message "connection_failed"
115+
- webview-ui/src/components/settings/ApiSettings.tsx: Updated button text from "Save" to "Save Configuration"
116+
117+
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>
118+
</new_task>
119+
]]></example_usage>
120+
</tool>
48121
</tool_specific_guidance>
49122
</tool_usage_guide>

.roo/rules-pr-fixer/5_examples.xml

Lines changed: 104 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@
5959
</step>
6060

6161
<step number="4">
62-
<description>Check out the pull request branch.</description>
62+
<description>Check out the pull request branch using non-interactive command.</description>
6363
<tool_use>
6464
<execute_command>
65-
<command>gh pr checkout 4365</command>
65+
<command>gh pr checkout 4365 --force</command>
6666
</execute_command>
6767
</tool_use>
68-
<analysis>The PR branch is now ready for local edits.</analysis>
68+
<analysis>The PR branch is now ready for local edits. Using --force avoids interactive prompts.</analysis>
6969
</step>
7070

7171
<step number="5">
@@ -82,13 +82,13 @@
8282
</tool_use>
8383
</step>
8484
<step number="6">
85-
<description>After pushing the changes, watch the PR checks to confirm the fix.</description>
85+
<description>After pushing the changes, check PR status using non-interactive commands.</description>
8686
<tool_use>
8787
<execute_command>
88-
<command>gh pr checks --watch</command>
88+
<command>gh pr checks 4365 --json state,conclusion,name</command>
8989
</execute_command>
9090
</tool_use>
91-
<analysis>Confirm that all checks are passing after the fix.</analysis>
91+
<analysis>Check status without interactive monitoring. Poll periodically if needed until all checks complete.</analysis>
9292
</step>
9393
</workflow>
9494

@@ -97,4 +97,102 @@
9797
<takeaway>Use a combination of the GitHub MCP server and the `gh` CLI to get a complete picture of the PR's status.</takeaway>
9898
</key_takeaways>
9999
</example>
100+
101+
<example name="fix_pr_with_translation_requirements">
102+
<scenario>
103+
A pull request has review comments requesting UI text changes that require translation updates across all supported languages.
104+
</scenario>
105+
106+
<user_request>
107+
Fix PR #1234 in RooCodeInc/Roo-Code - the reviewer asked to change button text and there are some failing tests.
108+
</user_request>
109+
110+
<workflow>
111+
<step number="1">
112+
<description>Get PR details and analyze changes.</description>
113+
<tool_use>
114+
<use_mcp_tool>
115+
<server_name>github</server_name>
116+
<tool_name>get_pull_request</tool_name>
117+
<arguments>
118+
{
119+
"owner": "RooCodeInc",
120+
"repo": "Roo-Code",
121+
"pullNumber": 1234
122+
}
123+
</arguments>
124+
</use_mcp_tool>
125+
</tool_use>
126+
<expected_outcome>Identify the files changed and review feedback requiring UI text modifications.</expected_outcome>
127+
</step>
128+
129+
<step number="2">
130+
<description>Check out PR and apply the requested changes.</description>
131+
<tool_use>
132+
<execute_command>
133+
<command>gh pr checkout 1234 --force</command>
134+
</execute_command>
135+
</tool_use>
136+
<analysis>Make the requested button text changes in the UI components. Using --force to avoid interactive prompts.</analysis>
137+
</step>
138+
139+
<step number="3">
140+
<description>Identify translation requirements and delegate to translate mode.</description>
141+
<tool_use>
142+
<new_task>
143+
<mode>translate</mode>
144+
<message>Translation updates needed for PR #1234 fixes. The following changes were made based on review feedback:
145+
146+
Files modified:
147+
- webview-ui/src/components/settings/ApiSettings.tsx: Changed button text from "Save" to "Save Configuration"
148+
- webview-ui/src/i18n/locales/en/common.json: Updated key "save_button" to "save_config_button"
149+
150+
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:
151+
- New key "save_config_button" with translation equivalent to "Save Configuration"
152+
- Any other text changes that affect user-facing content
153+
154+
Ensure consistency across all language files and maintain the same context and tone as existing translations.</message>
155+
</new_task>
156+
</tool_use>
157+
<expected_outcome>Translation subtask created and all language files updated.</expected_outcome>
158+
</step>
159+
160+
<step number="4">
161+
<description>Commit all changes including translations with automated git configuration.</description>
162+
<tool_use>
163+
<execute_command>
164+
<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>
165+
</execute_command>
166+
</tool_use>
167+
<analysis>All code changes and translation updates are now committed with explicit author info.</analysis>
168+
</step>
169+
170+
<step number="5">
171+
<description>Push changes and check CI status using non-interactive commands.</description>
172+
<tool_use>
173+
<execute_command>
174+
<command>git push --force-with-lease</command>
175+
</execute_command>
176+
</tool_use>
177+
<analysis>Push changes safely, then check status programmatically.</analysis>
178+
</step>
179+
180+
<step number="6">
181+
<description>Verify CI status without interactive monitoring.</description>
182+
<tool_use>
183+
<execute_command>
184+
<command>gh pr checks 1234 --json state,conclusion,name</command>
185+
</execute_command>
186+
</tool_use>
187+
<analysis>Check that all tests pass and translation completeness is maintained using structured output.</analysis>
188+
</step>
189+
</workflow>
190+
191+
<key_takeaways>
192+
<takeaway>Always check if PR fixes involve user-facing content that requires translation.</takeaway>
193+
<takeaway>Use new_task with translate mode to ensure consistent translation updates.</takeaway>
194+
<takeaway>Include detailed context about what changed and why in translation requests.</takeaway>
195+
<takeaway>Verify translation completeness before considering the PR fix complete.</takeaway>
196+
</key_takeaways>
197+
</example>
100198
</complete_examples>

0 commit comments

Comments
 (0)