diff --git a/scripts/profiles/base-profile.js b/scripts/profiles/base-profile.js index b39dd38a..abae3c8c 100644 --- a/scripts/profiles/base-profile.js +++ b/scripts/profiles/base-profile.js @@ -67,7 +67,7 @@ export function createProfile(editorConfig) { ...(targetExtension !== fileExtension ? [ { - from: new RegExp(`\\${fileExtension}\\b`, 'g'), + from: new RegExp(`\\${fileExtension}(?!\\])\\b`, 'g'), to: targetExtension } ] @@ -168,7 +168,14 @@ export function createProfile(editorConfig) { const baseName = path.basename(filePath, '.mdc'); const newFileName = fileMap[`${baseName}.mdc`] || `${baseName}${targetExtension}`; - return `[${text}](mdc:${rulesDir}/${newFileName})`; + // Update the link text to match the new filename + const newLinkText = newFileName; + // For Cursor, keep the mdc: protocol; for others, use standard relative paths + if (name.toLowerCase() === 'cursor') { + return `[${newLinkText}](mdc:${rulesDir}/${newFileName})`; + } else { + return `[${newLinkText}](${rulesDir}/${newFileName})`; + } } } }; diff --git a/src/utils/rule-transformer.js b/src/utils/rule-transformer.js index 95bb6200..daab8ef0 100644 --- a/src/utils/rule-transformer.js +++ b/src/utils/rule-transformer.js @@ -136,12 +136,12 @@ function transformCursorToProfileRules( conversionConfig, globalReplacements = [] ) { - // Apply all transformations in appropriate order let result = content; + // Apply all transformations in appropriate order + result = updateFileReferences(result, conversionConfig); result = replaceBasicTerms(result, conversionConfig); result = replaceToolReferences(result, conversionConfig); result = updateDocReferences(result, conversionConfig); - result = updateFileReferences(result, conversionConfig); // Apply any global/catch-all replacements from the profile // Super aggressive failsafe pass to catch any variations we might have missed