fix formatting

This commit is contained in:
Joe Danziger
2025-05-09 02:11:01 -04:00
parent d1d76c6bcb
commit 89ed121c5a
3 changed files with 256 additions and 232 deletions

View File

@@ -494,33 +494,48 @@ function registerCommands(programInstance) {
// Add/remove brand rules command // Add/remove brand rules command
programInstance programInstance
.command('rules <action> [brands...]') .command('rules <action> [brands...]')
.description('Add or remove rules for one or more brands (e.g., task-master rules add windsurf roo)') .description(
'Add or remove rules for one or more brands (e.g., task-master rules add windsurf roo)'
)
.action(async (action, brands) => { .action(async (action, brands) => {
const projectDir = process.cwd(); const projectDir = process.cwd();
if (!brands || brands.length === 0) { if (!brands || brands.length === 0) {
console.error('Please specify at least one brand (e.g., windsurf, roo).'); console.error(
'Please specify at least one brand (e.g., windsurf, roo).'
);
process.exit(1); process.exit(1);
} }
// Support both space- and comma-separated brand lists // Support both space- and comma-separated brand lists
const expandedBrands = brands.flatMap(b => b.split(',').map(s => s.trim())).filter(Boolean); const expandedBrands = brands
.flatMap((b) => b.split(',').map((s) => s.trim()))
.filter(Boolean);
for (const brand of expandedBrands) { for (const brand of expandedBrands) {
let profile; let profile;
try { try {
// Use pathToFileURL for correct ESM dynamic import // Use pathToFileURL for correct ESM dynamic import
const { pathToFileURL } = await import('url'); const { pathToFileURL } = await import('url');
const profilePath = path.resolve(process.cwd(), 'scripts', 'profiles', `${brand}.js`); const profilePath = path.resolve(
process.cwd(),
'scripts',
'profiles',
`${brand}.js`
);
const profileModule = await import(pathToFileURL(profilePath).href); const profileModule = await import(pathToFileURL(profilePath).href);
profile = profileModule.default || profileModule; profile = profileModule.default || profileModule;
} catch (e) { } catch (e) {
console.warn(`Rules profile for brand "${brand}" not found. Skipping.`); console.warn(
`Rules profile for brand "${brand}" not found. Skipping.`
);
console.warn(`Import error: ${e && e.message ? e.message : e}`); console.warn(`Import error: ${e && e.message ? e.message : e}`);
continue; continue;
} }
if (action === 'add') { if (action === 'add') {
const { convertAllCursorRulesToBrandRules } = await import('./rule-transformer.js'); const { convertAllCursorRulesToBrandRules } = await import(
'./rule-transformer.js'
);
convertAllCursorRulesToBrandRules(projectDir, profile); convertAllCursorRulesToBrandRules(projectDir, profile);
if (typeof profile.onAddBrandRules === 'function') { if (typeof profile.onAddBrandRules === 'function') {
profile.onAddBrandRules(projectDir); profile.onAddBrandRules(projectDir);

View File

@@ -11,170 +11,173 @@ 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', 'dev_workflow.mdc': 'dev_workflow.md',
'self_improve.mdc': 'self_improve.md', 'self_improve.mdc': 'self_improve.md',
'taskmaster.mdc': 'taskmaster.md' 'taskmaster.mdc': 'taskmaster.md'
// Add other mappings as needed // Add other mappings as needed
}; };
const globalReplacements = [ const globalReplacements = [
// 1. Handle cursor.so in any possible context // 1. Handle cursor.so in any possible context
{ from: /cursor\.so/gi, to: 'roocode.com' }, { from: /cursor\.so/gi, to: 'roocode.com' },
// Edge case: URL with different formatting // Edge case: URL with different formatting
{ from: /cursor\s*\.\s*so/gi, to: 'roocode.com' }, { from: /cursor\s*\.\s*so/gi, to: 'roocode.com' },
{ from: /https?:\/\/cursor\.so/gi, to: 'https://roocode.com' }, { from: /https?:\/\/cursor\.so/gi, to: 'https://roocode.com' },
{ from: /https?:\/\/www\.cursor\.so/gi, to: 'https://www.roocode.com' }, { from: /https?:\/\/www\.cursor\.so/gi, to: 'https://www.roocode.com' },
// 2. Handle tool references - even partial ones // 2. Handle tool references - even partial ones
{ from: /\bedit_file\b/gi, to: 'apply_diff' }, { from: /\bedit_file\b/gi, to: 'apply_diff' },
{ from: /\bsearch tool\b/gi, to: 'search_files tool' }, { from: /\bsearch tool\b/gi, to: 'search_files tool' },
{ from: /\bSearch Tool\b/g, to: 'Search_Files Tool' }, { from: /\bSearch Tool\b/g, to: 'Search_Files Tool' },
// 3. Handle basic terms (with case handling) // 3. Handle basic terms (with case handling)
{ from: /\bcursor\b/gi, to: (match) => (match.charAt(0) === 'C' ? 'Roo Code' : 'roo') }, {
{ from: /Cursor/g, to: 'Roo Code' }, from: /\bcursor\b/gi,
{ from: /CURSOR/g, to: 'ROO CODE' }, to: (match) => (match.charAt(0) === 'C' ? 'Roo Code' : 'roo')
// 4. Handle file extensions },
{ from: /\.mdc\b/g, to: '.md' }, { from: /Cursor/g, to: 'Roo Code' },
// 5. Handle any missed URL patterns { from: /CURSOR/g, to: 'ROO CODE' },
{ from: /docs\.cursor\.com/gi, to: 'docs.roocode.com' }, // 4. Handle file extensions
{ from: /docs\.roo\.com/gi, to: 'docs.roocode.com' } { from: /\.mdc\b/g, to: '.md' },
// 5. Handle any missed URL patterns
{ from: /docs\.cursor\.com/gi, to: 'docs.roocode.com' },
{ from: /docs\.roo\.com/gi, to: 'docs.roocode.com' }
]; ];
const conversionConfig = { const conversionConfig = {
// Product and brand name replacements // Product and brand name replacements
brandTerms: [ brandTerms: [
{ from: /cursor\.so/g, to: 'roocode.com' }, { from: /cursor\.so/g, to: 'roocode.com' },
{ from: /\[cursor\.so\]/g, to: '[roocode.com]' }, { from: /\[cursor\.so\]/g, to: '[roocode.com]' },
{ from: /href="https:\/\/cursor\.so/g, to: 'href="https://roocode.com' }, { from: /href="https:\/\/cursor\.so/g, to: 'href="https://roocode.com' },
{ from: /\(https:\/\/cursor\.so/g, to: '(https://roocode.com' }, { from: /\(https:\/\/cursor\.so/g, to: '(https://roocode.com' },
{ {
from: /\bcursor\b/gi, from: /\bcursor\b/gi,
to: (match) => (match === 'Cursor' ? 'Roo Code' : 'roo') to: (match) => (match === 'Cursor' ? 'Roo Code' : 'roo')
}, },
{ from: /Cursor/g, to: 'Roo Code' } { from: /Cursor/g, to: 'Roo Code' }
], ],
// File extension replacements // File extension replacements
fileExtensions: [{ from: /\.mdc\b/g, to: '.md' }], fileExtensions: [{ from: /\.mdc\b/g, to: '.md' }],
// Documentation URL replacements // Documentation URL replacements
docUrls: [ docUrls: [
{ {
from: /https:\/\/docs\.cursor\.com\/[^\s)'\"]+/g, from: /https:\/\/docs\.cursor\.com\/[^\s)'\"]+/g,
to: (match) => match.replace('docs.cursor.com', 'docs.roocode.com') to: (match) => match.replace('docs.cursor.com', 'docs.roocode.com')
}, },
{ from: /https:\/\/docs\.roo\.com\//g, to: 'https://docs.roocode.com/' } { from: /https:\/\/docs\.roo\.com\//g, to: 'https://docs.roocode.com/' }
], ],
// Tool references - direct replacements // Tool references - direct replacements
toolNames: { toolNames: {
search: 'search_files', search: 'search_files',
read_file: 'read_file', read_file: 'read_file',
edit_file: 'apply_diff', edit_file: 'apply_diff',
create_file: 'write_to_file', create_file: 'write_to_file',
run_command: 'execute_command', run_command: 'execute_command',
terminal_command: 'execute_command', terminal_command: 'execute_command',
use_mcp: 'use_mcp_tool', use_mcp: 'use_mcp_tool',
switch_mode: 'switch_mode' switch_mode: 'switch_mode'
}, },
// Tool references in context - more specific replacements // Tool references in context - more specific replacements
toolContexts: [ toolContexts: [
{ from: /\bsearch tool\b/g, to: 'search_files tool' }, { from: /\bsearch tool\b/g, to: 'search_files tool' },
{ from: /\bedit_file tool\b/g, to: 'apply_diff tool' }, { from: /\bedit_file tool\b/g, to: 'apply_diff tool' },
{ from: /\buse the search\b/g, to: 'use the search_files' }, { from: /\buse the search\b/g, to: 'use the search_files' },
{ from: /\bThe edit_file\b/g, to: 'The apply_diff' }, { from: /\bThe edit_file\b/g, to: 'The apply_diff' },
{ from: /\brun_command executes\b/g, to: 'execute_command executes' }, { from: /\brun_command executes\b/g, to: 'execute_command executes' },
{ from: /\buse_mcp connects\b/g, to: 'use_mcp_tool connects' }, { from: /\buse_mcp connects\b/g, to: 'use_mcp_tool connects' },
{ from: /\bCursor search\b/g, to: 'Roo Code search_files' }, { from: /\bCursor search\b/g, to: 'Roo Code search_files' },
{ from: /\bCursor edit\b/g, to: 'Roo Code apply_diff' }, { from: /\bCursor edit\b/g, to: 'Roo Code apply_diff' },
{ from: /\bCursor create\b/g, to: 'Roo Code write_to_file' }, { from: /\bCursor create\b/g, to: 'Roo Code write_to_file' },
{ from: /\bCursor run\b/g, to: 'Roo Code execute_command' } { from: /\bCursor run\b/g, to: 'Roo Code execute_command' }
], ],
// Tool group and category names // Tool group and category names
toolGroups: [ toolGroups: [
{ from: /\bSearch tools\b/g, to: 'Read Group tools' }, { from: /\bSearch tools\b/g, to: 'Read Group tools' },
{ from: /\bEdit tools\b/g, to: 'Edit Group tools' }, { from: /\bEdit tools\b/g, to: 'Edit Group tools' },
{ from: /\bRun tools\b/g, to: 'Command Group tools' }, { from: /\bRun tools\b/g, to: 'Command Group tools' },
{ from: /\bMCP servers\b/g, to: 'MCP Group tools' }, { from: /\bMCP servers\b/g, to: 'MCP Group tools' },
{ from: /\bSearch Group\b/g, to: 'Read Group' }, { from: /\bSearch Group\b/g, to: 'Read Group' },
{ from: /\bEdit Group\b/g, to: 'Edit Group' }, { from: /\bEdit Group\b/g, to: 'Edit Group' },
{ from: /\bRun Group\b/g, to: 'Command Group' } { from: /\bRun Group\b/g, to: 'Command Group' }
], ],
// File references in markdown links // File references in markdown links
fileReferences: { fileReferences: {
pathPattern: /\[(.+?)\]\(mdc:\.cursor\/rules\/(.+?)\.mdc\)/g, pathPattern: /\[(.+?)\]\(mdc:\.cursor\/rules\/(.+?)\.mdc\)/g,
replacement: (match, text, filePath) => { replacement: (match, text, filePath) => {
// Get the base filename // Get the base filename
const baseName = path.basename(filePath, '.mdc'); const baseName = path.basename(filePath, '.mdc');
// Get the new filename (either from mapping or by replacing extension) // Get the new filename (either from mapping or by replacing extension)
const newFileName = fileMap[`${baseName}.mdc`] || `${baseName}.md`; const newFileName = fileMap[`${baseName}.mdc`] || `${baseName}.md`;
// Return the updated link // Return the updated link
return `[${text}](mdc:.roo/rules/${newFileName})`; return `[${text}](mdc:.roo/rules/${newFileName})`;
} }
} }
}; };
// Recursively copy everything from assets/roocode to the project root // Recursively copy everything from assets/roocode to the project root
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); copyRecursiveSync(sourceDir, targetDir);
} }
function copyRecursiveSync(src, dest) { function copyRecursiveSync(src, dest) {
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( copyRecursiveSync(
path.join(src, childItemName), path.join(src, childItemName),
path.join(dest, childItemName) path.join(dest, childItemName)
); );
}); });
} else { } else {
fs.copyFileSync(src, dest); fs.copyFileSync(src, dest);
} }
} }
export function onRemoveBrandRules(targetDir) { export function onRemoveBrandRules(targetDir) {
const sourceDir = path.resolve(__dirname, '../../assets/roocode'); const sourceDir = path.resolve(__dirname, '../../assets/roocode');
// Remove all files/folders that exist in assets/roocode from the project root // Remove all files/folders that exist in assets/roocode from the project root
removeRecursiveSync(sourceDir, targetDir); removeRecursiveSync(sourceDir, targetDir);
// After removing, check if .roo exists and is empty; if so, remove it // After removing, check if .roo exists and is empty; if so, remove it
const rooDir = path.join(targetDir, '.roo'); const rooDir = path.join(targetDir, '.roo');
if (fs.existsSync(rooDir) && isDirectoryEmpty(rooDir)) { if (fs.existsSync(rooDir) && isDirectoryEmpty(rooDir)) {
fs.rmSync(rooDir, { recursive: true, force: true }); fs.rmSync(rooDir, { recursive: true, force: true });
} }
} }
function removeRecursiveSync(src, destRoot) { function removeRecursiveSync(src, destRoot) {
if (!fs.existsSync(src)) return; if (!fs.existsSync(src)) return;
const stats = fs.statSync(src); const stats = fs.statSync(src);
if (stats.isDirectory()) { if (stats.isDirectory()) {
const destDir = path.join(destRoot, path.basename(src)); const destDir = path.join(destRoot, path.basename(src));
if (fs.existsSync(destDir)) { if (fs.existsSync(destDir)) {
fs.rmSync(destDir, { recursive: true, force: true }); fs.rmSync(destDir, { recursive: true, force: true });
} }
// Also walk subfolders in src to remove nested structure // Also walk subfolders in src to remove nested structure
fs.readdirSync(src).forEach(child => { fs.readdirSync(src).forEach((child) => {
removeRecursiveSync(path.join(src, child), destRoot); removeRecursiveSync(path.join(src, child), destRoot);
}); });
} else { } else {
const destFile = path.join(destRoot, path.basename(src)); const destFile = path.join(destRoot, path.basename(src));
if (fs.existsSync(destFile)) { if (fs.existsSync(destFile)) {
fs.rmSync(destFile, { force: true }); fs.rmSync(destFile, { force: true });
} }
} }
} }
function isDirectoryEmpty(dirPath) { function isDirectoryEmpty(dirPath) {
return fs.readdirSync(dirPath).length === 0; return fs.readdirSync(dirPath).length === 0;
} }
export { conversionConfig, fileMap, globalReplacements, brandName, rulesDir }; export { conversionConfig, fileMap, globalReplacements, brandName, rulesDir };

View File

@@ -6,110 +6,116 @@ 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', 'dev_workflow.mdc': 'dev_workflow.md',
'self_improve.mdc': 'self_improve.md', 'self_improve.mdc': 'self_improve.md',
'taskmaster.mdc': 'taskmaster.md' 'taskmaster.mdc': 'taskmaster.md'
// Add other mappings as needed // Add other mappings as needed
}; };
const globalReplacements = [ const globalReplacements = [
// 1. Handle cursor.so in any possible context // 1. Handle cursor.so in any possible context
{ from: /cursor\.so/gi, to: 'windsurf.com' }, { from: /cursor\.so/gi, to: 'windsurf.com' },
// Edge case: URL with different formatting // Edge case: URL with different formatting
{ from: /cursor\s*\.\s*so/gi, to: 'windsurf.com' }, { from: /cursor\s*\.\s*so/gi, to: 'windsurf.com' },
{ from: /https?:\/\/cursor\.so/gi, to: 'https://windsurf.com' }, { from: /https?:\/\/cursor\.so/gi, to: 'https://windsurf.com' },
{ from: /https?:\/\/www\.cursor\.so/gi, to: 'https://www.windsurf.com' }, { from: /https?:\/\/www\.cursor\.so/gi, to: 'https://www.windsurf.com' },
// 2. Handle tool references - even partial ones // 2. Handle tool references - even partial ones
{ from: /\bedit_file\b/gi, to: 'apply_diff' }, { from: /\bedit_file\b/gi, to: 'apply_diff' },
{ from: /\bsearch tool\b/gi, to: 'search_files tool' }, { from: /\bsearch tool\b/gi, to: 'search_files tool' },
{ from: /\bSearch Tool\b/g, to: 'Search_Files Tool' }, { from: /\bSearch Tool\b/g, to: 'Search_Files Tool' },
// 3. Handle basic terms (with case handling) // 3. Handle basic terms (with case handling)
{ from: /\bcursor\b/gi, to: (match) => (match.charAt(0) === 'C' ? 'Windsurf' : 'windsurf') }, {
{ from: /Cursor/g, to: 'Windsurf' }, from: /\bcursor\b/gi,
{ from: /CURSOR/g, to: 'WINDSURF' }, to: (match) => (match.charAt(0) === 'C' ? 'Windsurf' : 'windsurf')
// 4. Handle file extensions },
{ from: /\.mdc\b/g, to: '.md' }, { from: /Cursor/g, to: 'Windsurf' },
// 5. Handle any missed URL patterns { from: /CURSOR/g, to: 'WINDSURF' },
{ from: /docs\.cursor\.com/gi, to: 'docs.windsurf.com' }, // 4. Handle file extensions
{ from: /docs\.windsurf\.com/gi, to: 'docs.windsurf.com' } { from: /\.mdc\b/g, to: '.md' },
// 5. Handle any missed URL patterns
{ from: /docs\.cursor\.com/gi, to: 'docs.windsurf.com' },
{ from: /docs\.windsurf\.com/gi, to: 'docs.windsurf.com' }
]; ];
const conversionConfig = { const conversionConfig = {
// Product and brand name replacements // Product and brand name replacements
brandTerms: [ brandTerms: [
{ from: /cursor\.so/g, to: 'windsurf.com' }, { from: /cursor\.so/g, to: 'windsurf.com' },
{ from: /\[cursor\.so\]/g, to: '[windsurf.com]' }, { from: /\[cursor\.so\]/g, to: '[windsurf.com]' },
{ from: /href="https:\/\/cursor\.so/g, to: 'href="https://windsurf.com' }, { from: /href="https:\/\/cursor\.so/g, to: 'href="https://windsurf.com' },
{ from: /\(https:\/\/cursor\.so/g, to: '(https://windsurf.com' }, { from: /\(https:\/\/cursor\.so/g, to: '(https://windsurf.com' },
{ {
from: /\bcursor\b/gi, from: /\bcursor\b/gi,
to: (match) => (match === 'Cursor' ? 'Windsurf' : 'windsurf') to: (match) => (match === 'Cursor' ? 'Windsurf' : 'windsurf')
}, },
{ from: /Cursor/g, to: 'Windsurf' } { from: /Cursor/g, to: 'Windsurf' }
], ],
// File extension replacements // File extension replacements
fileExtensions: [{ from: /\.mdc\b/g, to: '.md' }], fileExtensions: [{ from: /\.mdc\b/g, to: '.md' }],
// Documentation URL replacements // Documentation URL replacements
docUrls: [ docUrls: [
{ {
from: /https:\/\/docs\.cursor\.com\/[\^\s)\'"\\]+/g, from: /https:\/\/docs\.cursor\.com\/[\^\s)\'"\\]+/g,
to: (match) => match.replace('docs.cursor.com', 'docs.windsurf.com') to: (match) => match.replace('docs.cursor.com', 'docs.windsurf.com')
}, },
{ from: /https:\/\/docs\.windsurf\.com\//g, to: 'https://docs.windsurf.com/' } {
], from: /https:\/\/docs\.windsurf\.com\//g,
to: 'https://docs.windsurf.com/'
}
],
// Tool references - direct replacements // Tool references - direct replacements
toolNames: { toolNames: {
search: 'search_files', search: 'search_files',
read_file: 'read_file', read_file: 'read_file',
edit_file: 'apply_diff', edit_file: 'apply_diff',
create_file: 'write_to_file', create_file: 'write_to_file',
run_command: 'execute_command', run_command: 'execute_command',
terminal_command: 'execute_command', terminal_command: 'execute_command',
use_mcp: 'use_mcp_tool', use_mcp: 'use_mcp_tool',
switch_mode: 'switch_mode' switch_mode: 'switch_mode'
}, },
// Tool references in context - more specific replacements // Tool references in context - more specific replacements
toolContexts: [ toolContexts: [
{ from: /\bsearch tool\b/g, to: 'search_files tool' }, { from: /\bsearch tool\b/g, to: 'search_files tool' },
{ from: /\bedit_file tool\b/g, to: 'apply_diff tool' }, { from: /\bedit_file tool\b/g, to: 'apply_diff tool' },
{ from: /\buse the search\b/g, to: 'use the search_files' }, { from: /\buse the search\b/g, to: 'use the search_files' },
{ from: /\bThe edit_file\b/g, to: 'The apply_diff' }, { from: /\bThe edit_file\b/g, to: 'The apply_diff' },
{ from: /\brun_command executes\b/g, to: 'execute_command executes' }, { from: /\brun_command executes\b/g, to: 'execute_command executes' },
{ from: /\buse_mcp connects\b/g, to: 'use_mcp_tool connects' }, { from: /\buse_mcp connects\b/g, to: 'use_mcp_tool connects' },
{ from: /\bCursor search\b/g, to: 'Windsurf search_files' }, { from: /\bCursor search\b/g, to: 'Windsurf search_files' },
{ from: /\bCursor edit\b/g, to: 'Windsurf apply_diff' }, { from: /\bCursor edit\b/g, to: 'Windsurf apply_diff' },
{ from: /\bCursor create\b/g, to: 'Windsurf write_to_file' }, { from: /\bCursor create\b/g, to: 'Windsurf write_to_file' },
{ from: /\bCursor run\b/g, to: 'Windsurf execute_command' } { from: /\bCursor run\b/g, to: 'Windsurf execute_command' }
], ],
// Tool group and category names // Tool group and category names
toolGroups: [ toolGroups: [
{ from: /\bSearch tools\b/g, to: 'Read Group tools' }, { from: /\bSearch tools\b/g, to: 'Read Group tools' },
{ from: /\bEdit tools\b/g, to: 'Edit Group tools' }, { from: /\bEdit tools\b/g, to: 'Edit Group tools' },
{ from: /\bRun tools\b/g, to: 'Command Group tools' }, { from: /\bRun tools\b/g, to: 'Command Group tools' },
{ from: /\bMCP servers\b/g, to: 'MCP Group tools' }, { from: /\bMCP servers\b/g, to: 'MCP Group tools' },
{ from: /\bSearch Group\b/g, to: 'Read Group' }, { from: /\bSearch Group\b/g, to: 'Read Group' },
{ from: /\bEdit Group\b/g, to: 'Edit Group' }, { from: /\bEdit Group\b/g, to: 'Edit Group' },
{ from: /\bRun Group\b/g, to: 'Command Group' } { from: /\bRun Group\b/g, to: 'Command Group' }
], ],
// File references in markdown links // File references in markdown links
fileReferences: { fileReferences: {
pathPattern: /\[(.+?)\]\(mdc:\.cursor\/rules\/(.+?)\.mdc\)/g, pathPattern: /\[(.+?)\]\(mdc:\.cursor\/rules\/(.+?)\.mdc\)/g,
replacement: (match, text, filePath) => { replacement: (match, text, filePath) => {
// Get the base filename // Get the base filename
const baseName = path.basename(filePath, '.mdc'); const baseName = path.basename(filePath, '.mdc');
// Get the new filename (either from mapping or by replacing extension) // Get the new filename (either from mapping or by replacing extension)
const newFileName = fileMap[`${baseName}.mdc`] || `${baseName}.md`; const newFileName = fileMap[`${baseName}.mdc`] || `${baseName}.md`;
// Return the updated link // Return the updated link
return `[${text}](mdc:.windsurf/rules/${newFileName})`; return `[${text}](mdc:.windsurf/rules/${newFileName})`;
} }
} }
}; };
export { conversionConfig, fileMap, globalReplacements, brandName, rulesDir }; export { conversionConfig, fileMap, globalReplacements, brandName, rulesDir };