Skip to content

Conversation

@hannesrudolph
Copy link
Collaborator

@hannesrudolph hannesrudolph commented Jul 1, 2025

Pull Request for Issue #5210

image

Changes Made

  • Implemented two-phase deletion process to check for rules folder existence before showing confirmation dialog.
  • Added confirmation dialog in the webview that displays the actual path of the rules folder, if it exists.
  • Updated path resolution to handle both global and project-specific rules folders.
  • Added necessary translations for the rules folder deletion confirmation in all supported languages.
  • Improved error handling during folder deletion to provide feedback if the deletion fails.

Verification

  • All existing tests pass successfully (2589 tests).
  • Verified that deleting custom modes appropriately deletes their corresponding .roo/rules-{mode} folders.
  • Confirmed translation keys display correctly across all languages.
  • Ensured appropriate error handling during folder deletion.

Related Issues

Resolves #5210: Deleting a custom mode now deletes its corresponding .roo/rules-{mode} folder.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Comments added for complex logic
  • Documentation updated (if needed)
  • No breaking changes (or documented if any)
  • Accessibility checked (for UI changes)

Important

This PR adds functionality to delete the .roo/rules-{mode} folder when a custom mode is deleted, including UI updates, error handling improvements, and translations.

  • Behavior:
    • Implements two-phase deletion process in webviewMessageHandler.ts to check for rules folder existence before confirming deletion.
    • Adds confirmation dialog in DeleteModeDialog.tsx showing the path of the rules folder if it exists.
    • Updates path resolution for global and project-specific rules folders.
    • Improves error handling during folder deletion, logging errors and notifying users.
  • Tests:
    • Adds tests in webviewMessageHandler.spec.ts for deleting modes and handling errors.
  • Translations:
    • Adds translations for deletion confirmation in common.json across multiple languages including ca, de, en, es, fr, hi, id, it, ja, ko, nl, pl, pt-BR, ru, tr, vi, zh-CN, zh-TW.
  • Misc:
    • Adds deleteCustomModeCheck message type in ExtensionMessage.ts and WebviewMessage.ts.

This description was created by Ellipsis for 34fffef. You can customize this summary. It will automatically update as commits are pushed.

Copilot AI review requested due to automatic review settings July 1, 2025 19:02
@hannesrudolph hannesrudolph requested review from cte, jr and mrubens as code owners July 1, 2025 19:02
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. enhancement New feature or request labels Jul 1, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds a two-step deletion flow for custom modes that ensures any associated .roo/rules-{mode} folder is discovered and confirmed in the UI before removal.

  • Introduce a checkOnly flag in webview messages to fetch and relay the rules-folder path.
  • Update the WebView component (ModesView.tsx) to show a confirmation dialog with the actual folder path.
  • Extend message handler in webviewMessageHandler.ts to detect, report, and delete the rules folder, with translations and error handling.
  • Add new translation keys and update existing ones across all locales.
  • Expand unit tests to cover deletion and folder-removal behaviors.

Reviewed Changes

Copilot reviewed 41 out of 41 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
webview-ui/src/i18n/locales/*/prompts.json Added deleteMode dialog keys in all languages
webview-ui/src/components/modes/ModesView.tsx Implemented AlertDialog for delete confirmation
src/shared/WebviewMessage.ts Added checkOnly to the webview message interface
src/shared/ExtensionMessage.ts Added deleteCustomModeCheck, rulesFolderExists and rulesFolderPath
src/core/webview/webviewMessageHandler.ts Handle checkOnly, determine folder existence and perform deletion
src/core/webview/tests/webviewMessageHandler.spec.ts Added tests for delete-mode logic and folder deletion
src/i18n/locales/*/common.json Updated confirmation strings with rules-folder placeholders
Comments suppressed due to low confidence (3)

webview-ui/src/components/modes/ModesView.tsx:1440

  • When there's no rules folder path, the generic message is still shown. To improve clarity, render t("prompts:deleteMode.descriptionNoRules") instead of the message key when rulesFolderPath is undefined.
									{t("prompts:deleteMode.message", { modeName: modeToDelete.name })}

src/core/webview/webviewMessageHandler.ts:1521

  • The new confirmation translation in common.json uses {scope} and {rulesFolderPath}, but the rest of the UI uses {{scope}}/{{rulesFolderPath}} interpolation syntax. For consistency with other i18n keys, update these placeholders to double braces.
						type: "deleteCustomModeCheck",

src/core/webview/tests/webviewMessageHandler.spec.ts:366

  • There are tests for the full deletion path, but none that simulate a checkOnly: true message. Add a test to assert that when checkOnly is sent, postMessageToWebview is called with deleteCustomModeCheck and the correct folder info.
describe("webviewMessageHandler - deleteCustomMode", () => {

@delve-auditor
Copy link

delve-auditor bot commented Jul 1, 2025

No security or compliance issues detected. Reviewed everything up to 34fffef.

Security Overview
  • 🔎 Scanned files: 42 changed file(s)
Detected Code Changes
Change Type Relevant files
Bug Fix ► webviewMessageHandler.spec.ts
    Update tests to match fs import style
Enhancement ► webviewMessageHandler.ts
    Enhance mode deletion with rules folder handling
► DeleteModeDialog.tsx
    Add new delete mode confirmation dialog
► ModesView.tsx
    Implement enhanced mode deletion flow
Configuration changes ► locales/*.json
    Add new translations for mode deletion

Reply to this PR with @delve-auditor followed by a description of what change you want and we'll auto-submit a change to this PR to implement it.

@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Jul 1, 2025
@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Needs Review] in Roo Code Roadmap Jul 1, 2025
Copy link
Member

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 1, 2025
@mrubens
Copy link
Collaborator

mrubens commented Jul 3, 2025

Looks like we got some conflicts, sorry!

@daniel-lxs daniel-lxs moved this from PR [Needs Review] to PR [Changes Requested] in Roo Code Roadmap Jul 3, 2025
@daniel-lxs daniel-lxs force-pushed the feat/issue-5210-mode-deletion branch from d056c7b to 5cc6a86 Compare July 3, 2025 16:34
@mrubens mrubens merged commit 329690c into main Jul 3, 2025
11 checks passed
@mrubens mrubens deleted the feat/issue-5210-mode-deletion branch July 3, 2025 17:00
@github-project-automation github-project-automation bot moved this from PR [Changes Requested] to Done in Roo Code Roadmap Jul 3, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer PR - Changes Requested size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Delete mode should also delete the corresponding rules folder within .roo

4 participants