Skip to content

Conversation

@StevenTCramer
Copy link
Contributor

@StevenTCramer StevenTCramer commented Mar 22, 2025

Context

Removed hardcoded filenames from CustomModesManager and moved them to GlobalFileNames constants. This makes the code more maintainable by centralizing filename definitions and removes product-specific prefixes from filenames.

Implementation

  • Added a new entry customModes: "custom_modes.json" to the GlobalFileNames object in src/shared/globalFileNames.ts
  • Updated the CustomModesManager.ts file to use this constant instead of the hardcoded string
  • Updated the test file (CustomModesManager.test.ts) to use the GlobalFileNames constant
  • Also removed the 'cline' prefix from mcpSettings filename, changing it from "cline_mcp_settings.json" to "mcp_settings.json"

This approach makes the code more maintainable by centralizing the filename in the GlobalFileNames constant file, making it easier to change in the future if needed. It also removes product-specific prefixes from filenames, making them more generic.

How to Test

  • Run the tests for CustomModesManager to verify that everything works correctly:
    cd src/core/config/__tests__ && npx jest CustomModesManager.test.ts
    
  • All tests should pass, confirming that the changes work correctly

Get in Touch

I'm available on the Roo Code Discord as @StevenTCramer

Considerations

This change affects two configuration files:

  1. Custom modes file (changed from "cline_custom_modes.json" to "custom_modes.json")
  2. MCP settings file (changed from "cline_mcp_settings.json" to "mcp_settings.json")

Users with existing custom modes or MCP configurations will need to be informed through release notes about these filename changes. They can manually rename their existing files to preserve their configurations:

  • Rename cline_custom_modes.json to custom_modes.json
  • Rename cline_mcp_settings.json to mcp_settings.json

These files are typically located in the VSCode global storage path under the Roo extension settings directory.

Important

Centralized filename definitions in GlobalFileNames and removed product-specific prefixes in CustomModesManager.ts and tests.

  • Behavior:
    • Replaced hardcoded filename cline_custom_modes.json with GlobalFileNames.customModes in CustomModesManager.ts.
    • Changed cline_mcp_settings.json to mcp_settings.json in globalFileNames.ts.
  • Tests:
    • Updated CustomModesManager.test.ts to use GlobalFileNames.customModes instead of hardcoded filename.
  • Constants:
    • Added customModes: "custom_modes.json" to GlobalFileNames in globalFileNames.ts.

This description was created by Ellipsis for 3b351b7. It will automatically update as commits are pushed.

@changeset-bot
Copy link

changeset-bot bot commented Mar 22, 2025

🦋 Changeset detected

Latest commit: a2553e4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
roo-cline Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. enhancement New feature or request labels Mar 22, 2025
@StevenTCramer
Copy link
Contributor Author

We could add function to the activate method to have it look for the old file names and migrate them. Then we could remove that code at some "safe" time later?

@mrubens
Copy link
Collaborator

mrubens commented Mar 22, 2025

We could add function to the activate method to have it look for the old file names and migrate them. Then we could remove that code at some "safe" time later?

Yeah that makes sense to me. I'd rather not make people figure out how to move files around manually within the extension directories. Thanks!

- Implement migrateSettings function to rename legacy settings files to new format
- Migrate cline_custom_modes.json to new custom modes filename
- Migrate cline_mcp_settings.json to new MCP settings filename
- Add TODO to remove migration code in September 2025 (6 months after implementation)
- Make activate function async to support migration on startup
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Mar 23, 2025
Copy link
Collaborator

@mrubens mrubens left a comment

Choose a reason for hiding this comment

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

This looks good, and I think we could use this structure for migrating from .clinerules to .roorules too (which I have been waiting to do for a while!).

Only case that's somewhat on my mind is if someone updates to this version and then decided to go back to an earlier version, they might wonder what happened to their modes and MCP servers. Not sure there's any way around that though?

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 24, 2025
@StevenTCramer
Copy link
Contributor Author

@mrubens I can add that to this one or do another your call.

- Extract migrateSettings function from extension.ts to src/utils/migrateSettings.ts
- Update extension.ts to import and use the extracted function
- Update tests to use the real implementation
- Improve dependency injection by passing outputChannel as parameter
- Enhance maintainability by isolating temporary migration code (to be removed Sept 2025)
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Mar 24, 2025
@StevenTCramer
Copy link
Contributor Author

I pulled the MigrateSettings out into its own file in the util directory so we don't clutter up the main extension.ts

@mrubens I did a search and .clinerules has 119 matches across 23 files so I think we should do a separate PR for that.

@mrubens
Copy link
Collaborator

mrubens commented Mar 24, 2025

I pulled the MigrateSettings out into its own file in the util directory so we don't clutter up the main extension.ts

@mrubens I did a search and .clinerules has 119 matches across 23 files so I think we should do a separate PR for that.

Yeah sounds good. That one is also touching files that the user might have checked into or ignored in version control, so we might want some visible messaging around what's happening.

@mrubens mrubens merged commit 8ad4fff into RooCodeInc:main Mar 24, 2025
10 checks passed
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Mar 24, 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 size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants