update fileMap
This commit is contained in:
@@ -12,10 +12,7 @@ const rulesDir = '.roo/rules';
|
|||||||
|
|
||||||
// File name mapping (specific files with naming changes)
|
// File name mapping (specific files with naming changes)
|
||||||
const fileMap = {
|
const fileMap = {
|
||||||
'cursor_rules.mdc': 'roo_rules.md',
|
'cursor_rules.mdc': 'roo_rules.md'
|
||||||
'dev_workflow.mdc': 'dev_workflow.md',
|
|
||||||
'self_improve.mdc': 'self_improve.md',
|
|
||||||
'taskmaster.mdc': 'taskmaster.md'
|
|
||||||
// Add other mappings as needed
|
// Add other mappings as needed
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -125,7 +122,8 @@ const conversionConfig = {
|
|||||||
|
|
||||||
export function onAddBrandRules(targetDir) {
|
export function onAddBrandRules(targetDir) {
|
||||||
const sourceDir = path.resolve(__dirname, '../../assets/roocode');
|
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 rooModesDir = path.join(sourceDir, '.roo');
|
||||||
const rooModes = ['architect', 'ask', 'boomerang', 'code', 'debug', 'test'];
|
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 exists = fs.existsSync(src);
|
||||||
const stats = exists && fs.statSync(src);
|
const stats = exists && fs.statSync(src);
|
||||||
const isDirectory = exists && stats.isDirectory();
|
const isDirectory = exists && stats.isDirectory();
|
||||||
if (isDirectory) {
|
if (isDirectory) {
|
||||||
if (!fs.existsSync(dest)) fs.mkdirSync(dest, { recursive: true });
|
if (!fs.existsSync(dest)) fs.mkdirSync(dest, { recursive: true });
|
||||||
fs.readdirSync(src).forEach((childItemName) => {
|
fs.readdirSync(src).forEach((childItemName) => {
|
||||||
copyRecursiveSync(
|
const childSrc = path.join(src, childItemName);
|
||||||
path.join(src, childItemName),
|
let childDest = path.join(dest, childItemName);
|
||||||
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 {
|
} else {
|
||||||
fs.copyFileSync(src, dest);
|
fs.copyFileSync(src, dest);
|
||||||
|
|||||||
@@ -6,10 +6,7 @@ const rulesDir = '.windsurf/rules';
|
|||||||
|
|
||||||
// File name mapping (specific files with naming changes)
|
// File name mapping (specific files with naming changes)
|
||||||
const fileMap = {
|
const fileMap = {
|
||||||
'cursor_rules.mdc': 'windsurf_rules.md',
|
'cursor_rules.mdc': 'windsurf_rules.md'
|
||||||
'dev_workflow.mdc': 'dev_workflow.md',
|
|
||||||
'self_improve.mdc': 'self_improve.md',
|
|
||||||
'taskmaster.mdc': 'taskmaster.md'
|
|
||||||
// Add other mappings as needed
|
// Add other mappings as needed
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user