From cb777ad02592c3ca5647b1094356cffbded432a7 Mon Sep 17 00:00:00 2001 From: Joe Danziger Date: Sun, 11 May 2025 14:37:01 -0400 Subject: [PATCH] update fileMap --- scripts/profiles/roo.js | 27 +++++++++++++++++---------- scripts/profiles/windsurf.js | 5 +---- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/scripts/profiles/roo.js b/scripts/profiles/roo.js index c937ca68..7062eab7 100644 --- a/scripts/profiles/roo.js +++ b/scripts/profiles/roo.js @@ -12,10 +12,7 @@ const rulesDir = '.roo/rules'; // File name mapping (specific files with naming changes) const fileMap = { - 'cursor_rules.mdc': 'roo_rules.md', - 'dev_workflow.mdc': 'dev_workflow.md', - 'self_improve.mdc': 'self_improve.md', - 'taskmaster.mdc': 'taskmaster.md' + 'cursor_rules.mdc': 'roo_rules.md' // Add other mappings as needed }; @@ -125,7 +122,8 @@ const conversionConfig = { export function onAddBrandRules(targetDir) { const sourceDir = path.resolve(__dirname, '../../assets/roocode'); - copyRecursiveSync(sourceDir, targetDir); + const rulesDir = path.join(sourceDir, '.roo', 'rules'); + copyRecursiveSync(sourceDir, targetDir, rulesDir, fileMap); const rooModesDir = path.join(sourceDir, '.roo'); const rooModes = ['architect', 'ask', 'boomerang', 'code', 'debug', 'test']; @@ -162,17 +160,26 @@ export function onAddBrandRules(targetDir) { } } -function copyRecursiveSync(src, dest) { +function copyRecursiveSync(src, dest, rulesDir = null, fileMap = {}) { 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) => { - copyRecursiveSync( - path.join(src, childItemName), - path.join(dest, 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); }); } else { fs.copyFileSync(src, dest); diff --git a/scripts/profiles/windsurf.js b/scripts/profiles/windsurf.js index b1e3a14c..21512162 100644 --- a/scripts/profiles/windsurf.js +++ b/scripts/profiles/windsurf.js @@ -6,10 +6,7 @@ const rulesDir = '.windsurf/rules'; // File name mapping (specific files with naming changes) const fileMap = { - 'cursor_rules.mdc': 'windsurf_rules.md', - 'dev_workflow.mdc': 'dev_workflow.md', - 'self_improve.mdc': 'self_improve.md', - 'taskmaster.mdc': 'taskmaster.md' + 'cursor_rules.mdc': 'windsurf_rules.md' // Add other mappings as needed };