diff --git a/scripts/modules/rule-transformer.js b/scripts/modules/rule-transformer.js index 130ef641..3828b9b5 100644 --- a/scripts/modules/rule-transformer.js +++ b/scripts/modules/rule-transformer.js @@ -219,8 +219,17 @@ function convertAllRulesToBrandRules(projectDir, profile) { if (file.endsWith('.mdc')) { const sourcePath = path.join(cursorRulesDir, file); - // Determine target file name (either from mapping or by replacing extension) - const targetFilename = fileMap[file] || file; + // Determine target file name + let targetFilename; + if (fileMap[file]) { // If an explicit mapping exists, use it + targetFilename = fileMap[file]; + } else if (brandName === 'Roo' || brandName === 'Windsurf') { + // For Roo and Windsurf, change .mdc to .md if not in fileMap + targetFilename = file.replace(/\.mdc$/, '.md'); + } else { + // For Cursor (and potentially others), keep original if not in fileMap + targetFilename = file; + } const targetPath = path.join(brandRulesDir, targetFilename); // Convert the file diff --git a/scripts/profiles/roo.js b/scripts/profiles/roo.js index 7062eab7..b05cb61f 100644 --- a/scripts/profiles/roo.js +++ b/scripts/profiles/roo.js @@ -122,8 +122,7 @@ const conversionConfig = { export function onAddBrandRules(targetDir) { const sourceDir = path.resolve(__dirname, '../../assets/roocode'); - const rulesDir = path.join(sourceDir, '.roo', 'rules'); - copyRecursiveSync(sourceDir, targetDir, rulesDir, fileMap); + copyRecursiveSync(sourceDir, targetDir); const rooModesDir = path.join(sourceDir, '.roo'); const rooModes = ['architect', 'ask', 'boomerang', 'code', 'debug', 'test']; @@ -160,26 +159,17 @@ export function onAddBrandRules(targetDir) { } } -function copyRecursiveSync(src, dest, rulesDir = null, fileMap = {}) { +function copyRecursiveSync(src, dest) { const exists = fs.existsSync(src); const stats = exists && fs.statSync(src); const isDirectory = exists && stats.isDirectory(); if (isDirectory) { if (!fs.existsSync(dest)) fs.mkdirSync(dest, { recursive: true }); fs.readdirSync(src).forEach((childItemName) => { - const childSrc = path.join(src, childItemName); - let childDest = path.join(dest, childItemName); - - // If we're under the rules directory, apply .mdc -> .md renaming - if (rulesDir && childSrc.includes(rulesDir)) { - const mapped = fileMap[childItemName]; - if (mapped) { - childDest = path.join(dest, mapped); - } else if (childItemName.endsWith('.mdc')) { - childDest = path.join(dest, childItemName.replace(/\.mdc$/, '.md')); - } - } - copyRecursiveSync(childSrc, childDest, rulesDir, fileMap); + copyRecursiveSync( + path.join(src, childItemName), + path.join(dest, childItemName) + ); }); } else { fs.copyFileSync(src, dest);