fix for filepath at bottom of rule

This commit is contained in:
Joe Danziger
2025-05-27 10:05:26 -04:00
parent d448a7625b
commit 9d25178d12
2 changed files with 11 additions and 4 deletions

View File

@@ -67,7 +67,7 @@ export function createProfile(editorConfig) {
...(targetExtension !== fileExtension ...(targetExtension !== fileExtension
? [ ? [
{ {
from: new RegExp(`\\${fileExtension}\\b`, 'g'), from: new RegExp(`\\${fileExtension}(?!\\])\\b`, 'g'),
to: targetExtension to: targetExtension
} }
] ]
@@ -168,7 +168,14 @@ export function createProfile(editorConfig) {
const baseName = path.basename(filePath, '.mdc'); const baseName = path.basename(filePath, '.mdc');
const newFileName = const newFileName =
fileMap[`${baseName}.mdc`] || `${baseName}${targetExtension}`; 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})`;
}
} }
} }
}; };

View File

@@ -136,12 +136,12 @@ function transformCursorToProfileRules(
conversionConfig, conversionConfig,
globalReplacements = [] globalReplacements = []
) { ) {
// Apply all transformations in appropriate order
let result = content; let result = content;
// Apply all transformations in appropriate order
result = updateFileReferences(result, conversionConfig);
result = replaceBasicTerms(result, conversionConfig); result = replaceBasicTerms(result, conversionConfig);
result = replaceToolReferences(result, conversionConfig); result = replaceToolReferences(result, conversionConfig);
result = updateDocReferences(result, conversionConfig); result = updateDocReferences(result, conversionConfig);
result = updateFileReferences(result, conversionConfig);
// Apply any global/catch-all replacements from the profile // Apply any global/catch-all replacements from the profile
// Super aggressive failsafe pass to catch any variations we might have missed // Super aggressive failsafe pass to catch any variations we might have missed