use base profile with modifications for each brand

This commit is contained in:
Joe Danziger
2025-05-26 21:20:41 -04:00
parent 0ebd746232
commit db623bc553
10 changed files with 356 additions and 516 deletions

View File

@@ -1,85 +1,26 @@
// Cursor conversion profile for rule-transformer
import path from 'path';
import { createProfile, COMMON_TOOL_MAPPINGS } from './base-profile.js';
const profileName = 'Cursor';
const profileDir = '.cursor';
const rulesDir = '.cursor/rules';
const mcpConfig = true;
const mcpConfigName = 'mcp.json';
const mcpConfigPath = `${profileDir}/${mcpConfigName}`;
// File name mapping (specific files with naming changes)
const fileMap = {
'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 = [
// 1. Handle cursor.so in any possible context
{ from: /cursor\.so/gi, to: 'cursor.so' },
// Edge case: URL with different formatting
{ from: /cursor\s*\.\s*so/gi, to: 'cursor.so' },
{ from: /https?:\/\/cursor\.so/gi, to: 'https://cursor.so' },
{ from: /https?:\/\/www\.cursor\.so/gi, to: 'https://www.cursor.so' },
// 2. Handle tool references - even partial ones
{ from: /\bedit_file\b/gi, to: 'edit_file' },
{ from: /\bsearch tool\b/gi, to: 'search tool' },
{ from: /\bSearch Tool\b/g, to: 'Search Tool' },
// 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: /CURSOR/g, to: 'CURSOR' },
// 5. Handle any missed URL patterns
{ from: /docs\.cursor\.com/gi, to: 'docs.cursor.com' }
];
const conversionConfig = {
// Profile name replacements
profileTerms: [
{ 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: /\(https:\/\/cursor\.so/g, to: '(https://cursor.so' },
{
from: /\bcursor\b/gi,
to: (match) => (match === 'Cursor' ? 'Cursor' : 'cursor')
},
{ from: /Cursor/g, to: 'Cursor' }
],
// File extension replacements
fileExtensions: [],
// Documentation URL replacements
docUrls: [
{
from: /https:\/\/docs\.cursor\.com\/[\^\s)\'"\\]+/g,
to: (match) => match
},
{ from: /https:\/\/docs\.cursor\.com\//g, to: 'https://docs.cursor.com/' }
],
// Required for transformer compatibility
toolNames: {},
toolContexts: [],
toolGroups: [],
fileReferences: {
pathPattern: /$^/, // matches nothing
replacement: ''
// Create cursor profile using the base factory
const cursorProfile = createProfile({
name: 'cursor',
displayName: 'Cursor',
url: 'cursor.so',
docsUrl: 'docs.cursor.com',
profileDir: '.cursor',
rulesDir: '.cursor/rules',
mcpConfig: true,
mcpConfigName: 'mcp.json',
fileExtension: '.mdc',
targetExtension: '.mdc', // Cursor keeps .mdc extension
toolMappings: COMMON_TOOL_MAPPINGS.STANDARD,
customFileMap: {
'cursor_rules.mdc': 'cursor_rules.mdc' // Keep the same name for cursor
}
};
});
function getTargetRuleFilename(sourceFilename) {
return fileMap[sourceFilename] || sourceFilename;
}
export {
// Export all the standard profile properties
export const {
conversionConfig,
fileMap,
globalReplacements,
@@ -90,4 +31,4 @@ export {
mcpConfigName,
mcpConfigPath,
getTargetRuleFilename
};
} = cursorProfile;