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);
|
||||
|
||||
Reference in New Issue
Block a user