Skip to content

Commit 5507f5a

Browse files
roomote-v0[bot]roomotebrunobergher
authored
feat: extract translation and merge resolver modes into reusable skills (#11215)
* feat: extract translation and merge resolver modes into reusable skills - Add roo-translation skill with comprehensive i18n guidelines - Add roo-conflict-resolution skill for intelligent merge conflict resolution - Add /roo-translate slash command as shortcut for translation skill - Add /roo-resolve-conflicts slash command as shortcut for conflict resolution skill The existing translate and merge-resolver modes are preserved. These new skills and commands provide reusable access to the same functionality. Closes CLO-722 * feat: add guidances directory with translator guidance file - Add .roo/guidances/roo-translator.md for brand voice, tone, and word choice guidance - Update roo-translation skill to reference the guidance file The guidance file serves as a placeholder for translation style guidelines that will be interpolated at runtime. * fix: rename guidances directory to guidance (singular) * fix: remove language-specific section from translator guidance The guidance file should focus on brand voice, tone, and word choice only. * fix: remove language-specific guidelines section from skill file * Update .roo/skills/roo-translation/SKILL.md Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com> --------- Co-authored-by: Roo Code <roomote@roocode.com> Co-authored-by: Bruno Bergher <bruno@roocode.com> Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>
1 parent b4d9f92 commit 5507f5a

5 files changed

Lines changed: 544 additions & 0 deletions

File tree

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
description: "Resolve merge conflicts intelligently using git history analysis"
3+
argument-hint: "#PR-number"
4+
mode: merge-resolver
5+
---
6+
7+
Resolve merge conflicts for a specific pull request by analyzing git history, commit messages, and code changes to make intelligent resolution decisions.
8+
9+
## Quick Start
10+
11+
1. **Provide a PR number** (e.g., `#123` or just `123`)
12+
13+
2. The workflow will automatically:
14+
- Fetch PR information (title, description, branches)
15+
- Checkout the PR branch
16+
- Rebase onto the target branch to reveal conflicts
17+
- Analyze and resolve conflicts using git history
18+
19+
## Workflow Steps
20+
21+
### 1. Initialize PR Resolution
22+
23+
```bash
24+
# Fetch PR info
25+
gh pr view [PR_NUMBER] --json title,body,headRefName,baseRefName
26+
27+
# Checkout and rebase
28+
gh pr checkout [PR_NUMBER] --force
29+
git fetch origin main
30+
GIT_EDITOR=true git rebase origin/main
31+
```
32+
33+
### 2. Identify Conflicts
34+
35+
```bash
36+
git status --porcelain | grep "^UU"
37+
```
38+
39+
### 3. Analyze Each Conflict
40+
41+
For each conflicted file:
42+
- Read the conflict markers
43+
- Run `git blame` on conflicting sections
44+
- Fetch commit messages for context
45+
- Determine the intent behind each change
46+
47+
### 4. Apply Resolution Strategy
48+
49+
Based on the analysis:
50+
- **Bugfixes** generally take precedence over features
51+
- **Recent changes** are often more relevant (unless older is a security fix)
52+
- **Combine** non-conflicting changes when possible
53+
- **Preserve** test updates alongside code changes
54+
55+
### 5. Complete Resolution
56+
57+
```bash
58+
git add [resolved-files]
59+
GIT_EDITOR=true git rebase --continue
60+
```
61+
62+
## Key Guidelines
63+
64+
- Always escape conflict markers with `\` when using `apply_diff`
65+
- Document resolution decisions in the summary
66+
- Verify no syntax errors after resolution
67+
- Preserve valuable changes from both sides when possible
68+
69+
## Examples
70+
71+
- `/roo-resolve-conflicts #123` - Resolve conflicts for PR #123
72+
- `/roo-resolve-conflicts 456` - Resolve conflicts for PR #456

.roo/commands/roo-translate.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
description: "Translate and localize strings in the Roo Code extension"
3+
argument-hint: "[language-code or 'all'] [string-key or file-path]"
4+
mode: translate
5+
---
6+
7+
Perform translation and localization tasks for the Roo Code extension. This command activates the translation workflow with comprehensive i18n guidelines.
8+
9+
## Quick Start
10+
11+
1. **Identify the translation scope:**
12+
- If a specific language code is provided (e.g., `de`, `zh-CN`), focus on that language
13+
- If `all` is specified, translate to all supported languages
14+
- If a string key is provided, locate and translate that specific string
15+
- If a file path is provided, work with that translation file
16+
17+
2. **Supported languages:** ca, de, en, es, fr, hi, id, it, ja, ko, nl, pl, pt-BR, ru, tr, vi, zh-CN, zh-TW
18+
19+
3. **Translation locations:**
20+
- Core Extension: `src/i18n/locales/`
21+
- WebView UI: `webview-ui/src/i18n/locales/`
22+
23+
## Workflow
24+
25+
1. If adding new strings:
26+
- Add the English string first
27+
- Ask for confirmation before translating to other languages
28+
- Use `apply_diff` for efficient file updates
29+
30+
2. If updating existing strings:
31+
- Identify all affected language files
32+
- Update English first, then propagate changes
33+
34+
3. Validate your changes:
35+
```bash
36+
node scripts/find-missing-translations.js
37+
```
38+
39+
## Key Guidelines
40+
41+
- Use informal speech (e.g., "du" not "Sie" in German)
42+
- Keep technical terms like "token", "Prompt" in English
43+
- Preserve all `{{variable}}` placeholders exactly
44+
- Use `apply_diff` instead of `write_to_file` for existing files
45+
46+
## Examples
47+
48+
- `/roo-translate de` - Focus on German translations
49+
- `/roo-translate all welcome.title` - Translate a specific key to all languages
50+
- `/roo-translate zh-CN src/i18n/locales/zh-CN/core.json` - Work on specific file

.roo/guidance/roo-translator.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Roo Code Translation Guidance
2+
3+
This file contains brand voice, tone, and word choice guidelines for Roo Code translations.
4+
5+
## Brand Voice
6+
7+
<!-- Add brand voice guidelines here -->
8+
9+
## Tone
10+
11+
<!-- Add tone guidelines here -->
12+
13+
## Word Choice
14+
15+
<!-- Add word choice preferences here -->
Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
---
2+
name: roo-conflict-resolution
3+
description: Provides comprehensive guidelines for resolving merge conflicts intelligently using git history and commit context. Use when tasks involve merge conflicts, rebasing, PR conflicts, or git conflict resolution. This skill analyzes commit messages, git blame, and code intent to make intelligent resolution decisions.
4+
---
5+
6+
# Roo Code Conflict Resolution Skill
7+
8+
## When to Use This Skill
9+
10+
Use this skill when the task involves:
11+
12+
- Resolving merge conflicts for a specific pull request
13+
- Rebasing a branch that has conflicts with the target branch
14+
- Understanding and analyzing conflicting code changes
15+
- Making intelligent decisions about which changes to keep, merge, or discard
16+
- Using git history to inform conflict resolution decisions
17+
18+
## When NOT to Use This Skill
19+
20+
Do NOT use this skill when:
21+
22+
- There are no merge conflicts to resolve
23+
- The task is about general code review without conflicts
24+
- You're working on fresh code without any merge scenarios
25+
26+
## Workflow Overview
27+
28+
This skill resolves merge conflicts by analyzing git history, commit messages, and code changes to make intelligent resolution decisions. Given a PR number (e.g., "#123"), it handles the entire conflict resolution process.
29+
30+
## Initialization Steps
31+
32+
### Step 1: Parse PR Number
33+
34+
Extract the PR number from input like "#123" or "PR #123". Validate that a PR number was provided.
35+
36+
### Step 2: Fetch PR Information
37+
38+
```bash
39+
gh pr view [PR_NUMBER] --json title,body,headRefName,baseRefName
40+
```
41+
42+
Get PR title and description to understand the intent and identify the source and target branches.
43+
44+
### Step 3: Checkout PR Branch and Prepare for Rebase
45+
46+
```bash
47+
gh pr checkout [PR_NUMBER] --force
48+
git fetch origin main
49+
GIT_EDITOR=true git rebase origin/main
50+
```
51+
52+
- Force checkout the PR branch to ensure clean state
53+
- Fetch the latest main branch
54+
- Attempt to rebase onto main to reveal conflicts
55+
- Use `GIT_EDITOR=true` to ensure non-interactive rebase
56+
57+
### Step 4: Check for Merge Conflicts
58+
59+
```bash
60+
git status --porcelain
61+
git diff --name-only --diff-filter=U
62+
```
63+
64+
Identify files with merge conflicts (marked with 'UU') and create a list of files that need resolution.
65+
66+
## Main Workflow Phases
67+
68+
### Phase 1: Conflict Analysis
69+
70+
Analyze each conflicted file to understand the changes:
71+
72+
1. Read the conflicted file to identify conflict markers
73+
2. Extract the conflicting sections between `<<<<<<<` and `>>>>>>>`
74+
3. Run git blame on both sides of the conflict
75+
4. Fetch commit messages and diffs for relevant commits
76+
5. Analyze the intent behind each change
77+
78+
### Phase 2: Resolution Strategy
79+
80+
Determine the best resolution strategy for each conflict:
81+
82+
1. Categorize changes by intent (bugfix, feature, refactor, etc.)
83+
2. Evaluate recency and relevance of changes
84+
3. Check for structural overlap vs formatting differences
85+
4. Identify if changes can be combined or if one should override
86+
5. Consider test updates and related changes
87+
88+
### Phase 3: Conflict Resolution
89+
90+
Apply the resolution strategy to resolve conflicts:
91+
92+
1. For each conflict, apply the chosen resolution
93+
2. Ensure proper escaping of conflict markers in diffs
94+
3. Validate that resolved code is syntactically correct
95+
4. Stage resolved files with `git add`
96+
97+
### Phase 4: Validation
98+
99+
Verify the resolution and prepare for commit:
100+
101+
1. Run `git status` to confirm all conflicts are resolved
102+
2. Check for any compilation or syntax errors
103+
3. Review the final diff to ensure sensible resolutions
104+
4. Prepare a summary of resolution decisions
105+
106+
## Git Commands Reference
107+
108+
| Command | Purpose |
109+
|---------|---------|
110+
| `gh pr checkout [PR_NUMBER] --force` | Force checkout the PR branch |
111+
| `git fetch origin main` | Get the latest main branch |
112+
| `GIT_EDITOR=true git rebase origin/main` | Rebase current branch onto main (non-interactive) |
113+
| `git blame -L [start],[end] [commit] -- [file]` | Get commit information for specific lines |
114+
| `git show --format="%H%n%an%n%ae%n%ad%n%s%n%b" --no-patch [sha]` | Get commit metadata |
115+
| `git show [sha] -- [file]` | Get the actual changes made in a commit |
116+
| `git ls-files -u` | List unmerged files with stage information |
117+
| `GIT_EDITOR=true git rebase --continue` | Continue rebase after resolving conflicts |
118+
119+
## Best Practices
120+
121+
### Intent-Based Resolution (High Priority)
122+
123+
Always prioritize understanding the intent behind changes rather than just looking at the code differences. Commit messages, PR descriptions, and issue references provide crucial context.
124+
125+
**Example:** When there's a conflict between a bugfix and a refactor, apply the bugfix logic within the refactored structure rather than simply choosing one side.
126+
127+
### Preserve All Valuable Changes (High Priority)
128+
129+
When possible, combine non-conflicting changes from both sides rather than discarding one side entirely. Both sides of a conflict often contain valuable changes that can coexist if properly integrated.
130+
131+
### Escape Conflict Markers (High Priority)
132+
133+
When using `apply_diff`, always escape merge conflict markers with backslashes to prevent parsing errors:
134+
135+
- Correct: `\<<<<<<< HEAD`
136+
- Wrong: `<<<<<<< HEAD`
137+
138+
### Consider Related Changes (Medium Priority)
139+
140+
Look beyond the immediate conflict to understand related changes in tests, documentation, or dependent code. A change might seem isolated but could be part of a larger feature or fix.
141+
142+
## Resolution Heuristics
143+
144+
| Category | Rule | Exception |
145+
|----------|------|-----------|
146+
| Bugfix vs Feature | Bugfixes generally take precedence | When features include the fix |
147+
| Recent vs Old | More recent changes are often more relevant | When older changes are security patches |
148+
| Test Updates | Changes with test updates are likely more complete | - |
149+
| Formatting vs Logic | Logic changes take precedence over formatting | - |
150+
151+
## Common Pitfalls
152+
153+
### Blindly Choosing One Side
154+
155+
**Problem:** You might lose important changes or introduce regressions.
156+
**Solution:** Always analyze both sides using git blame and commit history.
157+
158+
### Ignoring PR Context
159+
160+
**Problem:** The PR description often explains the why behind changes.
161+
**Solution:** Always fetch and read the PR information before resolving.
162+
163+
### Not Validating Resolved Code
164+
165+
**Problem:** Merged code might be syntactically incorrect or introduce logical errors.
166+
**Solution:** Always check for syntax errors and review the final diff.
167+
168+
### Unescaped Conflict Markers in Diffs
169+
170+
**Problem:** Unescaped conflict markers (`<<<<<<`, `=======`, `>>>>>>`) will be interpreted as diff syntax.
171+
**Solution:** Always escape with backslash (`\`) when they appear in content.
172+
173+
## Apply Diff Example
174+
175+
When resolving conflicts with `apply_diff`, use this pattern:
176+
177+
```
178+
<<<<<<< SEARCH
179+
:start_line:45
180+
-------
181+
\<<<<<<< HEAD
182+
function oldImplementation() {
183+
return "old";
184+
}
185+
\=======
186+
function newImplementation() {
187+
return "new";
188+
}
189+
\>>>>>>> feature-branch
190+
=======
191+
function mergedImplementation() {
192+
// Combining both approaches
193+
return "merged";
194+
}
195+
>>>>>>> REPLACE
196+
```
197+
198+
## Quality Checklist
199+
200+
### Before Resolution
201+
202+
- [ ] Fetch PR title and description for context
203+
- [ ] Identify all files with conflicts
204+
- [ ] Understand the overall change being merged
205+
206+
### During Resolution
207+
208+
- [ ] Run git blame on conflicting sections
209+
- [ ] Read commit messages for intent
210+
- [ ] Consider if changes can be combined
211+
- [ ] Escape conflict markers in diffs
212+
213+
### After Resolution
214+
215+
- [ ] Verify no conflict markers remain
216+
- [ ] Check for syntax/compilation errors
217+
- [ ] Review the complete diff
218+
- [ ] Document resolution decisions
219+
220+
## Completion Criteria
221+
222+
- All merge conflicts have been resolved
223+
- Resolved files have been staged
224+
- No syntax errors in resolved code
225+
- Resolution decisions are documented
226+
227+
## Communication Guidelines
228+
229+
When reporting resolution progress:
230+
231+
- Be direct and technical when explaining resolution decisions
232+
- Focus on the rationale behind each conflict resolution
233+
- Provide clear summaries of what was merged and why
234+
235+
### Progress Update Format
236+
237+
```
238+
Conflict in [file]:
239+
- HEAD: [brief description of changes]
240+
- Incoming: [brief description of changes]
241+
- Resolution: [what was decided and why]
242+
```
243+
244+
### Completion Message Format
245+
246+
```
247+
Successfully resolved merge conflicts for PR #[number] "[title]".
248+
249+
Resolution Summary:
250+
- [file1]: [brief description of resolution]
251+
- [file2]: [brief description of resolution]
252+
253+
[Key decision explanation if applicable]
254+
255+
All conflicts have been resolved and files have been staged for commit.
256+
```

0 commit comments

Comments
 (0)