Skip to content

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Jun 27, 2025

Closes #5180
Closes #5139

Summary

Refactors the parseYamlSafely method to eliminate code duplication when handling JSON fallback for .roomodes files.

Changes

  • Consolidated two separate JSON parsing blocks into a single flow
  • Introduced needsJsonFallback variable for clearer logic
  • Maintained proper error messages for different failure scenarios

Testing

  • ✅ All tests passing (14 edge cases + 18 CustomModesManager tests)
  • ✅ Linting and type checking pass

Important

Refactor parseYamlSafely in CustomModesManager.ts to consolidate JSON fallback logic, improving clarity and reducing duplication.

  • Refactor parseYamlSafely in CustomModesManager.ts:
    • Consolidates JSON fallback logic into a single flow, reducing code duplication.
    • Introduces needsJsonFallback variable for clearer logic.
    • Maintains distinct error messages for YAML and JSON parsing failures.
  • Function Usage:
    • Updates calls to parseYamlSafely to include tryJsonFallback option in loadModesFromFile() and other relevant methods.
  • Testing:
    • All tests pass, including 14 edge cases and 18 CustomModesManager tests.

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

- Eliminate code duplication in parseYamlSafely method
- Combine YAML error and non-object cases into single JSON fallback flow
- Improve code maintainability and readability
- All tests passing (14 edge case tests, 18 total CustomModesManager tests)
@daniel-lxs daniel-lxs requested review from cte, jr and mrubens as code owners June 27, 2025 17:20
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jun 27, 2025
@delve-auditor
Copy link

delve-auditor bot commented Jun 27, 2025

No security or compliance issues detected. Reviewed everything up to 77b0bda.

Security Overview
  • 🔎 Scanned files: 1 changed file(s)
Detected Code Changes
Change Type Relevant files
Refactor ► CustomModesManager.ts
    Consolidate JSON fallback logic in parseYamlSafely method
    Combine YAML error and non-object cases into single flow
    Improve error handling for YAML/JSON parsing

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 Review] in Roo Code Roadmap Jun 27, 2025
@daniel-lxs daniel-lxs closed this Jun 27, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Jun 27, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR - Needs Review size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Mode selector is missing after 06/26/25 update. After updating to v3.22.0, the previous .roomodes report an invalid YAML format error.

3 participants