fix cursor init (don't use roo transformation by default)
This commit is contained in:
@@ -477,26 +477,9 @@ function createProjectStructure(addAliases, dryRun) {
|
|||||||
|
|
||||||
// Create directories
|
// Create directories
|
||||||
ensureDirectoryExists(path.join(targetDir, '.cursor', 'rules'));
|
ensureDirectoryExists(path.join(targetDir, '.cursor', 'rules'));
|
||||||
|
|
||||||
// Create Roo directories
|
|
||||||
ensureDirectoryExists(path.join(targetDir, '.roo'));
|
|
||||||
ensureDirectoryExists(path.join(targetDir, '.roo', 'rules'));
|
|
||||||
for (const mode of [
|
|
||||||
'architect',
|
|
||||||
'ask',
|
|
||||||
'boomerang',
|
|
||||||
'code',
|
|
||||||
'debug',
|
|
||||||
'test'
|
|
||||||
]) {
|
|
||||||
ensureDirectoryExists(path.join(targetDir, '.roo', `rules-${mode}`));
|
|
||||||
}
|
|
||||||
|
|
||||||
ensureDirectoryExists(path.join(targetDir, 'scripts'));
|
ensureDirectoryExists(path.join(targetDir, 'scripts'));
|
||||||
ensureDirectoryExists(path.join(targetDir, 'tasks'));
|
ensureDirectoryExists(path.join(targetDir, 'tasks'));
|
||||||
|
|
||||||
// Removed root-level MCP configuration; handled by brand-specific logic only.
|
|
||||||
|
|
||||||
// Copy template files with replacements
|
// Copy template files with replacements
|
||||||
const replacements = {
|
const replacements = {
|
||||||
year: new Date().getFullYear()
|
year: new Date().getFullYear()
|
||||||
@@ -545,32 +528,6 @@ function createProjectStructure(addAliases, dryRun) {
|
|||||||
path.join(targetDir, '.cursor', 'rules', 'self_improve.mdc')
|
path.join(targetDir, '.cursor', 'rules', 'self_improve.mdc')
|
||||||
);
|
);
|
||||||
|
|
||||||
const rooSourceDir = path.join(__dirname, '..', 'assets', 'roocode');
|
|
||||||
const rooModesDir = path.join(rooSourceDir, '.roo');
|
|
||||||
const rooModes = ['architect', 'ask', 'boomerang', 'code', 'debug', 'test'];
|
|
||||||
|
|
||||||
// Copy .roomodes to project root
|
|
||||||
const roomodesSrc = path.join(rooSourceDir, '.roomodes');
|
|
||||||
const roomodesDest = path.join(targetDir, '.roomodes');
|
|
||||||
if (fs.existsSync(roomodesSrc)) {
|
|
||||||
fs.copyFileSync(roomodesSrc, roomodesDest);
|
|
||||||
log('info', `Copied .roomodes to ${roomodesDest}`);
|
|
||||||
} else {
|
|
||||||
log('warn', `.roomodes not found at ${roomodesSrc}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy each <mode>-rules file into the corresponding .roo/rules-<mode>/ folder
|
|
||||||
for (const mode of rooModes) {
|
|
||||||
const src = path.join(rooModesDir, `rules-${mode}`, `${mode}-rules`);
|
|
||||||
const dest = path.join(targetDir, '.roo', `rules-${mode}`, `${mode}-rules`);
|
|
||||||
if (fs.existsSync(src)) {
|
|
||||||
fs.copyFileSync(src, dest);
|
|
||||||
log('info', `Copied ${src} to ${dest}`);
|
|
||||||
} else {
|
|
||||||
log('warn', `Roo rule file not found for mode '${mode}': ${src}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy example_prd.txt
|
// Copy example_prd.txt
|
||||||
copyTemplateFile(
|
copyTemplateFile(
|
||||||
'example_prd.txt',
|
'example_prd.txt',
|
||||||
|
|||||||
@@ -12,13 +12,11 @@ import { log } from './utils.js';
|
|||||||
// Import the shared MCP configuration helper
|
// Import the shared MCP configuration helper
|
||||||
import { setupMCPConfiguration } from './mcp-utils.js';
|
import { setupMCPConfiguration } from './mcp-utils.js';
|
||||||
|
|
||||||
// Import Roo Code conversionConfig and fileMap from profiles
|
|
||||||
import { conversionConfig, fileMap } from '../profiles/roo.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace basic Cursor terms with brand equivalents
|
* Replace basic Cursor terms with brand equivalents
|
||||||
*/
|
*/
|
||||||
function replaceBasicTerms(content) {
|
function replaceBasicTerms(content, conversionConfig) {
|
||||||
let result = content;
|
let result = content;
|
||||||
|
|
||||||
// Apply brand term replacements
|
// Apply brand term replacements
|
||||||
@@ -41,7 +39,7 @@ function replaceBasicTerms(content) {
|
|||||||
/**
|
/**
|
||||||
* Replace Cursor tool references with brand tool equivalents
|
* Replace Cursor tool references with brand tool equivalents
|
||||||
*/
|
*/
|
||||||
function replaceToolReferences(content) {
|
function replaceToolReferences(content, conversionConfig) {
|
||||||
let result = content;
|
let result = content;
|
||||||
|
|
||||||
// Basic pattern for direct tool name replacements
|
// Basic pattern for direct tool name replacements
|
||||||
@@ -72,7 +70,7 @@ function replaceToolReferences(content) {
|
|||||||
/**
|
/**
|
||||||
* Update documentation URLs to point to brand documentation
|
* Update documentation URLs to point to brand documentation
|
||||||
*/
|
*/
|
||||||
function updateDocReferences(content) {
|
function updateDocReferences(content, conversionConfig) {
|
||||||
let result = content;
|
let result = content;
|
||||||
|
|
||||||
// Apply documentation URL replacements
|
// Apply documentation URL replacements
|
||||||
@@ -90,7 +88,7 @@ function updateDocReferences(content) {
|
|||||||
/**
|
/**
|
||||||
* Update file references in markdown links
|
* Update file references in markdown links
|
||||||
*/
|
*/
|
||||||
function updateFileReferences(content) {
|
function updateFileReferences(content, conversionConfig) {
|
||||||
const { pathPattern, replacement } = conversionConfig.fileReferences;
|
const { pathPattern, replacement } = conversionConfig.fileReferences;
|
||||||
return content.replace(pathPattern, replacement);
|
return content.replace(pathPattern, replacement);
|
||||||
}
|
}
|
||||||
@@ -218,6 +216,12 @@ function convertAllCursorRulesToBrandRules(projectDir, profile) {
|
|||||||
'info',
|
'info',
|
||||||
`Rule conversion complete: ${success} successful, ${failed} failed`
|
`Rule conversion complete: ${success} successful, ${failed} failed`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Call post-processing hook if defined (e.g., for Roo's rules-*mode* folders)
|
||||||
|
if (typeof profile.onPostConvertBrandRules === 'function') {
|
||||||
|
profile.onPostConvertBrandRules(projectDir);
|
||||||
|
}
|
||||||
|
|
||||||
return { success, failed };
|
return { success, failed };
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -125,8 +125,46 @@ const conversionConfig = {
|
|||||||
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);
|
||||||
|
|
||||||
|
// Enhanced error checking and logging for .roomodes and rules-*mode* files
|
||||||
|
const rooModesDir = path.join(sourceDir, '.roo');
|
||||||
|
const rooModes = ['architect', 'ask', 'boomerang', 'code', 'debug', 'test'];
|
||||||
|
|
||||||
|
// Copy .roomodes to project root
|
||||||
|
const roomodesSrc = path.join(sourceDir, '.roomodes');
|
||||||
|
const roomodesDest = path.join(targetDir, '.roomodes');
|
||||||
|
if (fs.existsSync(roomodesSrc)) {
|
||||||
|
try {
|
||||||
|
fs.copyFileSync(roomodesSrc, roomodesDest);
|
||||||
|
console.log(`[Roo] Copied .roomodes to ${roomodesDest}`);
|
||||||
|
} catch (err) {
|
||||||
|
console.warn(`[Roo] Failed to copy .roomodes: ${err.message}`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.warn(`[Roo] .roomodes not found at ${roomodesSrc}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy each <mode>-rules file into the corresponding .roo/rules-<mode>/ folder
|
||||||
|
for (const mode of rooModes) {
|
||||||
|
const src = path.join(rooModesDir, `rules-${mode}`, `${mode}-rules`);
|
||||||
|
const dest = path.join(targetDir, '.roo', `rules-${mode}`, `${mode}-rules`);
|
||||||
|
if (fs.existsSync(src)) {
|
||||||
|
try {
|
||||||
|
// Ensure destination directory exists
|
||||||
|
const destDir = path.dirname(dest);
|
||||||
|
if (!fs.existsSync(destDir)) fs.mkdirSync(destDir, { recursive: true });
|
||||||
|
fs.copyFileSync(src, dest);
|
||||||
|
console.log(`[Roo] Copied ${src} to ${dest}`);
|
||||||
|
} catch (err) {
|
||||||
|
console.warn(`[Roo] Failed to copy ${src} to ${dest}: ${err.message}`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.warn(`[Roo] Roo rule file not found for mode '${mode}': ${src}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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);
|
||||||
@@ -180,4 +218,10 @@ function isDirectoryEmpty(dirPath) {
|
|||||||
return fs.readdirSync(dirPath).length === 0;
|
return fs.readdirSync(dirPath).length === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
export { conversionConfig, fileMap, globalReplacements, brandName, rulesDir };
|
function onPostConvertBrandRules(targetDir) {
|
||||||
|
onAddBrandRules(targetDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { conversionConfig, fileMap, globalReplacements, brandName, rulesDir, onPostConvertBrandRules };
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user