Skip to content

Global mode export does not include rules files from global .roo directory #5834

@hannesrudolph

Description

@hannesrudolph

App Version

Development version (n/a)

API Provider

Not Applicable / Other

Model Used

N/A

🔁 Steps to Reproduce

  1. Create a global custom mode or use an existing global mode
  2. Add rules files to the global .roo/rules-{mode-slug}/ directory (located in ~/.roo/rules-{mode-slug}/)
  3. In VSCode, open the Prompts view and select the global mode
  4. Click the "Export Mode" button
  5. Save the exported YAML file and examine its contents

💥 Outcome Summary

Expected: The exported YAML file should contain the rules files from the global ~/.roo/rules-{mode-slug}/ directory
Actual: The exported YAML file does not include any rules files, even though they exist in the global directory

📄 Relevant Logs or Errors

No error messages are shown - the export completes successfully but without the rules files.

Technical Analysis

Based on my investigation:

Root Cause

The issue is in src/core/config/CustomModesManager.ts in the exportModeWithRules method. The code only looks for rules files in the project's workspace directory, not in the global rules directory:

// Line 691: Get workspace path
const workspacePath = getWorkspacePath()
if (!workspacePath) {
    return { success: false, error: "No workspace found" }
}

// Line 697: Check for .roo/rules-{slug}/ directory
const modeRulesDir = path.join(workspacePath, ".roo", `rules-${slug}`)

This means that for global modes, the export function is looking in the wrong location for rules files.

Expected Behavior

For global modes (where mode.source === "global"), the code should check for rules files in the global .roo directory using getGlobalRooDirectory() instead of the workspace path.

Related Code

  • The import functionality correctly handles both global and project rules directories (see lines 872-878 in the same file)
  • The getGlobalRooDirectory() function is already imported and available (line 12)

Proposed Fix: The export function should determine the correct rules directory based on the mode's source:

  • For project modes: Use path.join(workspacePath, ".roo", rules-${slug})
  • For global modes: Use path.join(getGlobalRooDirectory(), rules-${slug})

This would ensure that global mode rules files are correctly included in the export.

Metadata

Metadata

Assignees

Labels

Issue - In ProgressSomeone is actively working on this. Should link to a PR soon.bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions