only copy rules specifically listed in fileMap

This commit is contained in:
Joe Danziger
2025-05-13 13:48:27 -04:00
parent ae4d072572
commit 998749b895
4 changed files with 22 additions and 7 deletions

View File

@@ -214,11 +214,11 @@ function convertAllRulesToBrandRules(projectDir, profile) {
let success = 0; let success = 0;
let failed = 0; let failed = 0;
// Process each file in the Cursor rules directory // Only copy files listed in fileMap (main rules folder)
const getTargetRuleFilename = profile.getTargetRuleFilename || ((f) => f); const getTargetRuleFilename = profile.getTargetRuleFilename || ((f) => f);
fs.readdirSync(cursorRulesDir).forEach((file) => { Object.keys(profile.fileMap).forEach((file) => {
if (file.endsWith('.mdc')) { const sourcePath = path.join(cursorRulesDir, file);
const sourcePath = path.join(cursorRulesDir, file); if (fs.existsSync(sourcePath)) {
const targetFilename = getTargetRuleFilename(file); const targetFilename = getTargetRuleFilename(file);
const targetPath = path.join(brandRulesDir, targetFilename); const targetPath = path.join(brandRulesDir, targetFilename);
@@ -228,6 +228,11 @@ function convertAllRulesToBrandRules(projectDir, profile) {
} else { } else {
failed++; failed++;
} }
} else {
log(
'warn',
`File listed in fileMap not found in rules dir: ${sourcePath}`
);
} }
}); });

View File

@@ -6,7 +6,11 @@ const rulesDir = '.cursor/rules';
// File name mapping (specific files with naming changes) // File name mapping (specific files with naming changes)
const fileMap = { const fileMap = {
// No explicit mappings; keep original .mdc filenames 'cursor_rules.mdc': 'cursor_rules.mdc',
'dev_workflow.mdc': 'dev_workflow.mdc',
'self_improve.mdc': 'self_improve.mdc',
'taskmaster.mdc': 'taskmaster.mdc'
// Add other mappings as needed
}; };
const globalReplacements = [ const globalReplacements = [

View File

@@ -12,7 +12,10 @@ 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
}; };

View File

@@ -6,7 +6,10 @@ 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
}; };