only run rules interactive setup if not provided via command line
This commit is contained in:
@@ -399,7 +399,12 @@ async function initializeProject(options = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// === Brand Rules Selection (via shared module) ===
|
// === Brand Rules Selection (via shared module) ===
|
||||||
const selectedBrandRules = await runInteractiveRulesSetup();
|
// Only run interactive rules setup if rules weren't explicitly provided via command line
|
||||||
|
if (options.rulesExplicitlyProvided) {
|
||||||
|
log('info', `Using rules provided via command line: ${selectedBrandRules.join(', ')}`);
|
||||||
|
} else {
|
||||||
|
selectedBrandRules = await runInteractiveRulesSetup();
|
||||||
|
}
|
||||||
|
|
||||||
const dryRun = options.dryRun || false;
|
const dryRun = options.dryRun || false;
|
||||||
|
|
||||||
@@ -418,21 +423,6 @@ async function initializeProject(options = {}) {
|
|||||||
// Create structure using only necessary values
|
// Create structure using only necessary values
|
||||||
createProjectStructure(addAliasesPrompted, dryRun, selectedBrandRules);
|
createProjectStructure(addAliasesPrompted, dryRun, selectedBrandRules);
|
||||||
|
|
||||||
for (const rule of selectedBrandRules) {
|
|
||||||
const profile = BRAND_PROFILES[rule];
|
|
||||||
if (profile) {
|
|
||||||
convertAllRulesToBrandRules(targetDir, profile);
|
|
||||||
// Ensure MCP config is set up under the correct brand folder
|
|
||||||
if (rule === 'windsurf' || rule === 'roo') {
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log('warn', `Unknown rules profile: ${rule}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// fallback for safety if selectedBrandRules is not an array
|
|
||||||
if (!Array.isArray(selectedBrandRules)) {
|
|
||||||
convertAllRulesToBrandRules(targetDir, BRAND_PROFILES['cursor']);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
rl.close();
|
rl.close();
|
||||||
log('error', `Error during initialization process: ${error.message}`);
|
log('error', `Error during initialization process: ${error.message}`);
|
||||||
|
|||||||
@@ -2126,6 +2126,7 @@ function registerCommands(programInstance) {
|
|||||||
// cmdOptions contains parsed arguments
|
// cmdOptions contains parsed arguments
|
||||||
// Parse rules: accept space or comma separated, default to all available rules
|
// Parse rules: accept space or comma separated, default to all available rules
|
||||||
let selectedBrands = BRAND_NAMES;
|
let selectedBrands = BRAND_NAMES;
|
||||||
|
let rulesExplicitlyProvided = false;
|
||||||
|
|
||||||
if (cmdOptions.rules && Array.isArray(cmdOptions.rules)) {
|
if (cmdOptions.rules && Array.isArray(cmdOptions.rules)) {
|
||||||
const userSpecifiedBrands = cmdOptions.rules
|
const userSpecifiedBrands = cmdOptions.rules
|
||||||
@@ -2135,17 +2136,14 @@ function registerCommands(programInstance) {
|
|||||||
// Only override defaults if user specified valid rules
|
// Only override defaults if user specified valid rules
|
||||||
if (userSpecifiedBrands.length > 0) {
|
if (userSpecifiedBrands.length > 0) {
|
||||||
selectedBrands = userSpecifiedBrands;
|
selectedBrands = userSpecifiedBrands;
|
||||||
|
rulesExplicitlyProvided = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdOptions.rules = selectedBrands;
|
cmdOptions.rules = selectedBrands;
|
||||||
|
cmdOptions.rulesExplicitlyProvided = rulesExplicitlyProvided;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log('DEBUG: Running init command action in commands.js');
|
|
||||||
console.log(
|
|
||||||
'DEBUG: Options received by action:',
|
|
||||||
JSON.stringify(cmdOptions)
|
|
||||||
);
|
|
||||||
// Directly call the initializeProject function, passing the parsed options
|
// Directly call the initializeProject function, passing the parsed options
|
||||||
await initializeProject(cmdOptions);
|
await initializeProject(cmdOptions);
|
||||||
// initializeProject handles its own flow, including potential process.exit()
|
// initializeProject handles its own flow, including potential process.exit()
|
||||||
|
|||||||
Reference in New Issue
Block a user