fix formatting
This commit is contained in:
@@ -494,33 +494,48 @@ function registerCommands(programInstance) {
|
||||
// Add/remove brand rules command
|
||||
programInstance
|
||||
.command('rules <action> [brands...]')
|
||||
.description('Add or remove rules for one or more brands (e.g., task-master rules add windsurf roo)')
|
||||
.description(
|
||||
'Add or remove rules for one or more brands (e.g., task-master rules add windsurf roo)'
|
||||
)
|
||||
.action(async (action, brands) => {
|
||||
const projectDir = process.cwd();
|
||||
|
||||
if (!brands || brands.length === 0) {
|
||||
console.error('Please specify at least one brand (e.g., windsurf, roo).');
|
||||
console.error(
|
||||
'Please specify at least one brand (e.g., windsurf, roo).'
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Support both space- and comma-separated brand lists
|
||||
const expandedBrands = brands.flatMap(b => b.split(',').map(s => s.trim())).filter(Boolean);
|
||||
const expandedBrands = brands
|
||||
.flatMap((b) => b.split(',').map((s) => s.trim()))
|
||||
.filter(Boolean);
|
||||
for (const brand of expandedBrands) {
|
||||
let profile;
|
||||
try {
|
||||
// Use pathToFileURL for correct ESM dynamic import
|
||||
const { pathToFileURL } = await import('url');
|
||||
const profilePath = path.resolve(process.cwd(), 'scripts', 'profiles', `${brand}.js`);
|
||||
const profilePath = path.resolve(
|
||||
process.cwd(),
|
||||
'scripts',
|
||||
'profiles',
|
||||
`${brand}.js`
|
||||
);
|
||||
const profileModule = await import(pathToFileURL(profilePath).href);
|
||||
profile = profileModule.default || profileModule;
|
||||
} catch (e) {
|
||||
console.warn(`Rules profile for brand "${brand}" not found. Skipping.`);
|
||||
console.warn(
|
||||
`Rules profile for brand "${brand}" not found. Skipping.`
|
||||
);
|
||||
console.warn(`Import error: ${e && e.message ? e.message : e}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (action === 'add') {
|
||||
const { convertAllCursorRulesToBrandRules } = await import('./rule-transformer.js');
|
||||
const { convertAllCursorRulesToBrandRules } = await import(
|
||||
'./rule-transformer.js'
|
||||
);
|
||||
convertAllCursorRulesToBrandRules(projectDir, profile);
|
||||
if (typeof profile.onAddBrandRules === 'function') {
|
||||
profile.onAddBrandRules(projectDir);
|
||||
|
||||
@@ -30,7 +30,10 @@ const globalReplacements = [
|
||||
{ from: /\bsearch tool\b/gi, to: 'search_files tool' },
|
||||
{ from: /\bSearch Tool\b/g, to: 'Search_Files Tool' },
|
||||
// 3. Handle basic terms (with case handling)
|
||||
{ from: /\bcursor\b/gi, to: (match) => (match.charAt(0) === 'C' ? 'Roo Code' : 'roo') },
|
||||
{
|
||||
from: /\bcursor\b/gi,
|
||||
to: (match) => (match.charAt(0) === 'C' ? 'Roo Code' : 'roo')
|
||||
},
|
||||
{ from: /Cursor/g, to: 'Roo Code' },
|
||||
{ from: /CURSOR/g, to: 'ROO CODE' },
|
||||
// 4. Handle file extensions
|
||||
@@ -130,7 +133,7 @@ function copyRecursiveSync(src, dest) {
|
||||
const isDirectory = exists && stats.isDirectory();
|
||||
if (isDirectory) {
|
||||
if (!fs.existsSync(dest)) fs.mkdirSync(dest, { recursive: true });
|
||||
fs.readdirSync(src).forEach(childItemName => {
|
||||
fs.readdirSync(src).forEach((childItemName) => {
|
||||
copyRecursiveSync(
|
||||
path.join(src, childItemName),
|
||||
path.join(dest, childItemName)
|
||||
@@ -162,7 +165,7 @@ function removeRecursiveSync(src, destRoot) {
|
||||
fs.rmSync(destDir, { recursive: true, force: true });
|
||||
}
|
||||
// Also walk subfolders in src to remove nested structure
|
||||
fs.readdirSync(src).forEach(child => {
|
||||
fs.readdirSync(src).forEach((child) => {
|
||||
removeRecursiveSync(path.join(src, child), destRoot);
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -25,7 +25,10 @@ const globalReplacements = [
|
||||
{ from: /\bsearch tool\b/gi, to: 'search_files tool' },
|
||||
{ from: /\bSearch Tool\b/g, to: 'Search_Files Tool' },
|
||||
// 3. Handle basic terms (with case handling)
|
||||
{ from: /\bcursor\b/gi, to: (match) => (match.charAt(0) === 'C' ? 'Windsurf' : 'windsurf') },
|
||||
{
|
||||
from: /\bcursor\b/gi,
|
||||
to: (match) => (match.charAt(0) === 'C' ? 'Windsurf' : 'windsurf')
|
||||
},
|
||||
{ from: /Cursor/g, to: 'Windsurf' },
|
||||
{ from: /CURSOR/g, to: 'WINDSURF' },
|
||||
// 4. Handle file extensions
|
||||
@@ -58,7 +61,10 @@ const conversionConfig = {
|
||||
from: /https:\/\/docs\.cursor\.com\/[\^\s)\'"\\]+/g,
|
||||
to: (match) => match.replace('docs.cursor.com', 'docs.windsurf.com')
|
||||
},
|
||||
{ from: /https:\/\/docs\.windsurf\.com\//g, to: 'https://docs.windsurf.com/' }
|
||||
{
|
||||
from: /https:\/\/docs\.windsurf\.com\//g,
|
||||
to: 'https://docs.windsurf.com/'
|
||||
}
|
||||
],
|
||||
|
||||
// Tool references - direct replacements
|
||||
|
||||
Reference in New Issue
Block a user