keep mdc extension for cursor

This commit is contained in:
Joe Danziger
2025-05-09 07:44:47 -04:00
parent 6f3b216be2
commit 8acdc014ea
2 changed files with 45 additions and 46 deletions

View File

@@ -202,7 +202,7 @@ function convertAllCursorRulesToBrandRules(projectDir, profile) {
const sourcePath = path.join(cursorRulesDir, file); const sourcePath = path.join(cursorRulesDir, file);
// Determine target file name (either from mapping or by replacing extension) // Determine target file name (either from mapping or by replacing extension)
const targetFilename = fileMap[file] || file.replace('.mdc', '.md'); const targetFilename = fileMap[file] || file;
const targetPath = path.join(brandRulesDir, targetFilename); const targetPath = path.join(brandRulesDir, targetFilename);
// Convert the file // Convert the file

View File

@@ -6,59 +6,58 @@ const rulesDir = '.cursor/rules';
// File name mapping (specific files with naming changes) // File name mapping (specific files with naming changes)
const fileMap = { const fileMap = {
'cursor_rules.mdc': 'cursor_rules.md', // No explicit mappings; keep original .mdc filenames
'dev_workflow.mdc': 'dev_workflow.md',
'self_improve.mdc': 'self_improve.md',
'taskmaster.mdc': 'taskmaster.md'
// 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: 'cursor.so' }, { from: /cursor\.so/gi, to: 'cursor.so' },
// Edge case: URL with different formatting // Edge case: URL with different formatting
{ from: /cursor\s*\.\s*so/gi, to: 'cursor.so' }, { from: /cursor\s*\.\s*so/gi, to: 'cursor.so' },
{ from: /https?:\/\/cursor\.so/gi, to: 'https://cursor.so' }, { from: /https?:\/\/cursor\.so/gi, to: 'https://cursor.so' },
{ from: /https?:\/\/www\.cursor\.so/gi, to: 'https://www.cursor.so' }, { from: /https?:\/\/www\.cursor\.so/gi, to: 'https://www.cursor.so' },
// 2. Handle tool references - even partial ones // 2. Handle tool references - even partial ones
{ from: /\bedit_file\b/gi, to: 'edit_file' }, { from: /\bedit_file\b/gi, to: 'edit_file' },
{ from: /\bsearch tool\b/gi, to: 'search tool' }, { from: /\bsearch tool\b/gi, to: 'search tool' },
{ from: /\bSearch Tool\b/g, to: 'Search Tool' }, { from: /\bSearch Tool\b/g, to: 'Search 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' ? 'Cursor' : 'cursor') }, {
{ from: /Cursor/g, to: 'Cursor' }, from: /\bcursor\b/gi,
{ from: /CURSOR/g, to: 'CURSOR' }, to: (match) => (match.charAt(0) === 'C' ? 'Cursor' : 'cursor')
// 4. Handle file extensions },
{ from: /\.mdc\b/g, to: '.md' }, { from: /Cursor/g, to: 'Cursor' },
// 5. Handle any missed URL patterns { from: /CURSOR/g, to: 'CURSOR' },
{ from: /docs\.cursor\.com/gi, to: 'docs.cursor.com' } // 4. Handle file extensions
{ from: /\.mdc\b/g, to: '.md' },
// 5. Handle any missed URL patterns
{ from: /docs\.cursor\.com/gi, to: 'docs.cursor.com' }
]; ];
const conversionConfig = { const conversionConfig = {
// Product and brand name replacements // Product and brand name replacements
brandTerms: [ brandTerms: [
{ from: /cursor\.so/g, to: 'cursor.so' }, { from: /cursor\.so/g, to: 'cursor.so' },
{ from: /\[cursor\.so\]/g, to: '[cursor.so]' }, { from: /\[cursor\.so\]/g, to: '[cursor.so]' },
{ from: /href="https:\/\/cursor\.so/g, to: 'href="https://cursor.so' }, { from: /href="https:\/\/cursor\.so/g, to: 'href="https://cursor.so' },
{ from: /\(https:\/\/cursor\.so/g, to: '(https://cursor.so' }, { from: /\(https:\/\/cursor\.so/g, to: '(https://cursor.so' },
{ {
from: /\bcursor\b/gi, from: /\bcursor\b/gi,
to: (match) => (match === 'Cursor' ? 'Cursor' : 'cursor') to: (match) => (match === 'Cursor' ? 'Cursor' : 'cursor')
}, },
{ from: /Cursor/g, to: 'Cursor' } { from: /Cursor/g, to: 'Cursor' }
], ],
// File extension replacements // File extension replacements
fileExtensions: [{ from: /\.mdc\b/g, to: '.md' }], fileExtensions: [],
// 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 to: (match) => match
}, },
{ from: /https:\/\/docs\.cursor\.com\//g, to: 'https://docs.cursor.com/' } { from: /https:\/\/docs\.cursor\.com\//g, to: 'https://docs.cursor.com/' }
] ]
}; };
export { conversionConfig, fileMap, globalReplacements, brandName, rulesDir }; export { conversionConfig, fileMap, globalReplacements, brandName, rulesDir };