mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
feat: add global/local scope option to Mode Writer mode
- Updated mode-writer fileRegex to allow writing to any XML/YAML files - Added scope selection as first step in mode creation workflow - Updated workflow to handle different file paths for global vs local modes - Created new instruction file for global mode path guidance - Fixes #5972
This commit is contained in:
parent
de13d8a5cf
commit
4ecb332ebc
3 changed files with 171 additions and 12 deletions
|
|
@ -6,6 +6,31 @@
|
|||
|
||||
<detailed_steps>
|
||||
<step number="1">
|
||||
<title>Choose Mode Scope</title>
|
||||
<description>
|
||||
Determine whether the mode should be global (available in all projects) or local (specific to current project)
|
||||
</description>
|
||||
<actions>
|
||||
<action>Ask user to choose between global and local scope</action>
|
||||
<action>Store the choice to determine file paths throughout the workflow</action>
|
||||
</actions>
|
||||
<example>
|
||||
<ask_followup_question>
|
||||
<question>Should this be a global mode (available in all projects) or a local mode (only for this project)?</question>
|
||||
<follow_up>
|
||||
<suggest>Global mode - available in all projects</suggest>
|
||||
<suggest>Local mode - only for this project</suggest>
|
||||
</follow_up>
|
||||
</ask_followup_question>
|
||||
</example>
|
||||
<important_note>
|
||||
The user's choice here determines where all files will be written:
|
||||
- Global: Uses the system's global settings directory
|
||||
- Local: Uses the current project's .roomodes and .roo/ directories
|
||||
</important_note>
|
||||
</step>
|
||||
|
||||
<step number="2">
|
||||
<title>Gather Requirements</title>
|
||||
<description>
|
||||
Understand what the user wants the mode to accomplish
|
||||
|
|
@ -29,7 +54,7 @@
|
|||
</example>
|
||||
</step>
|
||||
|
||||
<step number="2">
|
||||
<step number="3">
|
||||
<title>Design Mode Configuration</title>
|
||||
<description>
|
||||
Create the mode definition with all required fields
|
||||
|
|
@ -46,7 +71,7 @@
|
|||
<field name="roleDefinition">
|
||||
<description>Detailed description of the mode's role and expertise</description>
|
||||
<best_practice>
|
||||
Start with "You are Roo Code, a [specialist type]..."
|
||||
Start with "You are Roo, a [specialist type]..."
|
||||
List specific areas of expertise
|
||||
Mention key technologies or methodologies
|
||||
</best_practice>
|
||||
|
|
@ -69,13 +94,36 @@
|
|||
</field>
|
||||
</recommended_fields>
|
||||
<important_note>
|
||||
Do not include customInstructions in the .roomodes configuration.
|
||||
Do not include customInstructions in the mode configuration.
|
||||
All detailed instructions should be placed in XML files within
|
||||
the .roo/rules-[mode-slug]/ directory instead.
|
||||
the appropriate rules directory instead.
|
||||
</important_note>
|
||||
</step>
|
||||
|
||||
<step number="3">
|
||||
<step number="4">
|
||||
<title>Write Mode Configuration</title>
|
||||
<description>
|
||||
Save the mode configuration to the appropriate location based on scope
|
||||
</description>
|
||||
<scope_based_paths>
|
||||
<global_mode>
|
||||
<description>For global modes, write to the system's custom_modes.yaml file</description>
|
||||
<path_logic>
|
||||
Use the SYSTEM INFORMATION context to get the Home Directory,
|
||||
then construct the path to the global settings directory.
|
||||
The exact path varies by OS but follows patterns like:
|
||||
- Windows: C:\Users\[username]\AppData\Roaming\Code\User\globalStorage\rooveterinaryinc.roo-cline\settings\custom_modes.yaml
|
||||
- macOS/Linux: ~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/custom_modes.yaml
|
||||
</path_logic>
|
||||
</global_mode>
|
||||
<local_mode>
|
||||
<description>For local modes, write to the project's .roomodes file</description>
|
||||
<path>.roomodes</path>
|
||||
</local_mode>
|
||||
</scope_based_paths>
|
||||
</step>
|
||||
|
||||
<step number="5">
|
||||
<title>Implement File Restrictions</title>
|
||||
<description>
|
||||
Configure appropriate file access permissions
|
||||
|
|
@ -98,11 +146,21 @@ groups:
|
|||
</guidelines>
|
||||
</step>
|
||||
|
||||
<step number="4">
|
||||
<step number="6">
|
||||
<title>Create XML Instruction Files</title>
|
||||
<description>
|
||||
Design structured instruction files in .roo/rules-[mode-slug]/
|
||||
Design structured instruction files in the appropriate rules directory
|
||||
</description>
|
||||
<scope_based_directories>
|
||||
<global_mode>
|
||||
<description>For global modes, create rules in the global .roo directory</description>
|
||||
<path_pattern>[global-settings-dir]/.roo/rules-[mode-slug]/</path_pattern>
|
||||
</global_mode>
|
||||
<local_mode>
|
||||
<description>For local modes, create rules in the project's .roo directory</description>
|
||||
<path_pattern>.roo/rules-[mode-slug]/</path_pattern>
|
||||
</local_mode>
|
||||
</scope_based_directories>
|
||||
<file_structure>
|
||||
<file name="1_workflow.xml">Main workflow and step-by-step processes</file>
|
||||
<file name="2_best_practices.xml">Guidelines and conventions</file>
|
||||
|
|
@ -118,7 +176,7 @@ groups:
|
|||
</xml_best_practices>
|
||||
</step>
|
||||
|
||||
<step number="5">
|
||||
<step number="7">
|
||||
<title>Test and Refine</title>
|
||||
<description>
|
||||
Verify the mode works as intended
|
||||
|
|
@ -129,14 +187,18 @@ groups:
|
|||
<item>Instructions are clear and actionable</item>
|
||||
<item>Mode integrates well with Orchestrator</item>
|
||||
<item>All examples are accurate and helpful</item>
|
||||
<item>For global modes: Verify the mode is available in other projects</item>
|
||||
</checklist>
|
||||
</step>
|
||||
</detailed_steps>
|
||||
|
||||
<quick_reference>
|
||||
<command>Create mode in .roomodes for project-specific modes</command>
|
||||
<command>Create mode in global custom_modes.yaml for system-wide modes</command>
|
||||
<command>Use list_files to verify .roo folder structure</command>
|
||||
<command>Always ask for scope (global/local) before creating a mode</command>
|
||||
<command>Global modes: Write to system's custom_modes.yaml file</command>
|
||||
<command>Local modes: Write to project's .roomodes file</command>
|
||||
<command>Global rules: Create in [global-settings-dir]/.roo/rules-[slug]/</command>
|
||||
<command>Local rules: Create in project's .roo/rules-[slug]/</command>
|
||||
<command>Use list_files to verify folder structure</command>
|
||||
<command>Test file regex patterns with search_files</command>
|
||||
</quick_reference>
|
||||
</mode_creation_workflow>
|
||||
97
.roo/rules-mode-writer/7_global_mode_paths.xml
Normal file
97
.roo/rules-mode-writer/7_global_mode_paths.xml
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
<global_mode_path_guidance>
|
||||
<overview>
|
||||
This file provides specific guidance for creating global modes that are available across all projects.
|
||||
Global modes require special handling of file paths that vary by operating system.
|
||||
</overview>
|
||||
|
||||
<path_construction>
|
||||
<description>
|
||||
When creating a global mode, you need to construct the correct path to the global settings directory.
|
||||
This path varies by operating system and must be determined from the SYSTEM INFORMATION context.
|
||||
</description>
|
||||
|
||||
<steps>
|
||||
<step number="1">
|
||||
<title>Get System Information</title>
|
||||
<description>
|
||||
Check the SYSTEM INFORMATION section for:
|
||||
- Operating System (Windows, macOS, Linux)
|
||||
- Home Directory path
|
||||
</description>
|
||||
</step>
|
||||
|
||||
<step number="2">
|
||||
<title>Construct Global Settings Path</title>
|
||||
<os_specific_patterns>
|
||||
<windows>
|
||||
<pattern>C:\Users\[username]\AppData\Roaming\Code\User\globalStorage\rooveterinaryinc.roo-cline\settings\</pattern>
|
||||
<example>C:\Users\VooDoo\AppData\Roaming\Code\User\globalStorage\rooveterinaryinc.roo-cline\settings\</example>
|
||||
<custom_modes_file>custom_modes.yaml</custom_modes_file>
|
||||
</windows>
|
||||
<macos>
|
||||
<pattern>~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/</pattern>
|
||||
<example>/Users/username/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/</example>
|
||||
<custom_modes_file>custom_modes.yaml</custom_modes_file>
|
||||
</macos>
|
||||
<linux>
|
||||
<pattern>~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/</pattern>
|
||||
<example>/home/username/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/</example>
|
||||
<custom_modes_file>custom_modes.yaml</custom_modes_file>
|
||||
</linux>
|
||||
</os_specific_patterns>
|
||||
</step>
|
||||
|
||||
<step number="3">
|
||||
<title>Create Global Rules Directory</title>
|
||||
<description>
|
||||
For global modes, the rules directory follows the same pattern but in a .roo subdirectory
|
||||
</description>
|
||||
<pattern>[global-settings-dir]/.roo/rules-[mode-slug]/</pattern>
|
||||
<example>
|
||||
Windows: C:\Users\VooDoo\AppData\Roaming\Code\User\globalStorage\rooveterinaryinc.roo-cline\settings\.roo\rules-api-dev\
|
||||
macOS/Linux: ~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/.roo/rules-api-dev/
|
||||
</example>
|
||||
</step>
|
||||
</steps>
|
||||
</path_construction>
|
||||
|
||||
<implementation_example>
|
||||
<scenario>Creating a global mode called "api-dev"</scenario>
|
||||
<workflow>
|
||||
<action>Read SYSTEM INFORMATION to determine OS and home directory</action>
|
||||
<action>Construct the global custom_modes.yaml path based on OS</action>
|
||||
<action>Read existing custom_modes.yaml content (if it exists)</action>
|
||||
<action>Add the new mode configuration to the customModes array</action>
|
||||
<action>Write the updated content back to custom_modes.yaml</action>
|
||||
<action>Create the global rules directory at [global-settings-dir]/.roo/rules-api-dev/</action>
|
||||
<action>Write XML instruction files to the global rules directory</action>
|
||||
</workflow>
|
||||
</implementation_example>
|
||||
|
||||
<important_notes>
|
||||
<note priority="high">
|
||||
Always use absolute paths when working with global mode files.
|
||||
The write_to_file tool will automatically create parent directories if they don't exist.
|
||||
</note>
|
||||
<note priority="high">
|
||||
The Mode Writer mode now has permission to write to any .yaml or .xml file,
|
||||
which enables it to write to the global custom_modes.yaml file.
|
||||
</note>
|
||||
<note priority="medium">
|
||||
When reading the global custom_modes.yaml file, handle the case where it might not exist yet.
|
||||
The file should be created with an empty customModes array if it doesn't exist.
|
||||
</note>
|
||||
</important_notes>
|
||||
|
||||
<testing_global_modes>
|
||||
<description>
|
||||
After creating a global mode, verify it works correctly
|
||||
</description>
|
||||
<checklist>
|
||||
<item>The mode appears in the mode list in the current project</item>
|
||||
<item>Switch to a different project and verify the mode appears there too</item>
|
||||
<item>The global rules are loaded correctly from the global .roo directory</item>
|
||||
<item>The mode's file restrictions work as expected</item>
|
||||
</checklist>
|
||||
</testing_global_modes>
|
||||
</global_mode_path_guidance>
|
||||
|
|
@ -22,7 +22,7 @@ customModes:
|
|||
groups:
|
||||
- read
|
||||
- - edit
|
||||
- fileRegex: (\.roomodes$|\.roo/.*\.xml$|\.yaml$)
|
||||
- fileRegex: (\.roomodes$|.*\.xml$|.*\.yaml$)
|
||||
description: Mode configuration files and XML instructions
|
||||
- command
|
||||
- mcp
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue