-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat: add hidden submodes functionality for complex Roo modes #9447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Add hidden and parent fields to ModeConfig type - Update getAllModes to support filtering hidden modes - Hide submodes from mode selector dropdowns - Add parent mode validation in switch_mode tool - Include hidden modes in settings view for management - Add comprehensive tests for hidden mode functionality - Create example .roomodes file demonstrating usage Closes #9446
Review complete. Found 2 issues that should be addressed:
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
| hidden: z.boolean().optional(), | ||
| parent: z.string().optional(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The schema allows hidden: true without requiring parent, which would create modes that are completely inaccessible. If a mode is hidden but has no parent, there's no way to switch to it. The schema should enforce that if hidden is true, then parent must be provided.
Consider adding a .refine() validation like:
.refine(
(data) => !data.hidden || data.parent,
{ message: "Hidden modes must specify a parent mode" }
)Fix it with Roo Code or mention @roomote and request a fix.
| // Check if the target mode is hidden | ||
| if (targetMode.hidden) { | ||
| // Hidden modes can only be accessed by their parent mode | ||
| if (!targetMode.parent || targetMode.parent !== currentMode) { | ||
| task.recordToolError("switch_mode") | ||
| pushToolResult( | ||
| formatResponse.toolError( | ||
| `Mode '${mode_slug}' is not accessible from the current mode '${currentMode}'.`, | ||
| ), | ||
| ) | ||
| return | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code checks if targetMode.parent equals currentMode, but it doesn't verify that the parent mode actually exists in the available modes. If someone defines a hidden mode with a non-existent parent slug, this validation would pass (assuming you're in that non-existent mode somehow), but the parent-child relationship would be invalid.
Consider adding validation to ensure the parent mode exists:
if (targetMode.hidden) {
if (!targetMode.parent) {
// error: hidden mode must have parent
}
const parentMode = getModeBySlug(targetMode.parent, customModes)
if (!parentMode) {
// error: parent mode does not exist
}
if (targetMode.parent !== currentMode) {
// error: can only be accessed by parent
}
}Fix it with Roo Code or mention @roomote and request a fix.
This PR attempts to address Issue #9446. Feedback and guidance are welcome.
Summary
This implementation adds support for hidden submodes that are not shown in the mode selector dropdown but can be accessed programmatically by their parent mode. This allows complex Roo modes to delegate to focused submodes without cluttering the mode dropdown list.
Changes
hiddenandparentoptional fields toModeConfigtypegetAllModes()function to support filtering hidden modes with anincludeHiddenparameterswitch_modetool to ensure hidden modes can only be accessed by their parent mode.roomodesfile demonstrating the featureHow it works
.roomodeswithhidden: trueandparent: <parent-slug>switch_modetoolExample Usage
Testing
Closes #9446
Important
Adds hidden submodes for complex Roo modes, allowing programmatic access by parent modes while excluding them from UI dropdowns, with updates to mode configuration, UI components, and validation logic.
hiddenandparentfields toModeConfiginmode.ts.getAllModes()inmodes.tsto filter hidden modes unlessincludeHiddenis true.SwitchModeToolinSwitchModeTool.tsto validate parent access for hidden modes.ChatTextArea.tsx,ChatView.tsx,ModeSelector.tsx.ModesView.tsx.modes.hidden.spec.ts.This description was created by
for 4fc71f7. You can customize this summary. It will automatically update as commits are pushed.