fix pattern for interactive rule profiles setup

This commit is contained in:
Joe Danziger
2025-06-04 19:40:07 -04:00
parent a294a30342
commit ff76d6cdb0

View File

@@ -16,7 +16,6 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import readline from 'readline'; import readline from 'readline';
import inquirer from 'inquirer';
import { fileURLToPath } from 'url'; import { fileURLToPath } from 'url';
import { dirname } from 'path'; import { dirname } from 'path';
import chalk from 'chalk'; import chalk from 'chalk';
@@ -29,7 +28,7 @@ import {
convertAllRulesToProfileRules, convertAllRulesToProfileRules,
getRulesProfile getRulesProfile
} from '../src/utils/rule-transformer.js'; } from '../src/utils/rule-transformer.js';
import { runInteractiveProfilesSetup } from '../src/utils/profiles.js';
import { execSync } from 'child_process'; import { execSync } from 'child_process';
import { import {
EXAMPLE_PRD_FILE, EXAMPLE_PRD_FILE,
@@ -282,7 +281,7 @@ async function initializeProject(options = {}) {
} }
const skipPrompts = options.yes || (options.name && options.description); const skipPrompts = options.yes || (options.name && options.description);
let selectedRuleProfiles = const selectedRuleProfiles =
options.rules && Array.isArray(options.rules) && options.rules.length > 0 options.rules && Array.isArray(options.rules) && options.rules.length > 0
? options.rules ? options.rules
: RULE_PROFILES; // Default to all profiles : RULE_PROFILES; // Default to all profiles
@@ -340,9 +339,9 @@ async function initializeProject(options = {}) {
chalk.yellow('\nDo you want to continue with these settings? (Y/n): ') chalk.yellow('\nDo you want to continue with these settings? (Y/n): ')
); );
const shouldContinue = confirmInput.trim().toLowerCase() !== 'n'; const shouldContinue = confirmInput.trim().toLowerCase() !== 'n';
rl.close();
if (!shouldContinue) { if (!shouldContinue) {
rl.close();
log('info', 'Project initialization cancelled by user'); log('info', 'Project initialization cancelled by user');
process.exit(0); process.exit(0);
return; return;
@@ -355,7 +354,15 @@ async function initializeProject(options = {}) {
`Using rule profiles provided via command line: ${selectedRuleProfiles.join(', ')}` `Using rule profiles provided via command line: ${selectedRuleProfiles.join(', ')}`
); );
} else { } else {
selectedRuleProfiles = await runInteractiveProfilesSetup(); try {
const targetDir = process.cwd();
execSync('npx task-master rules setup', {
stdio: 'inherit',
cwd: targetDir
});
} catch (error) {
log('error', 'Failed to run interactive rules setup:', error.message);
}
} }
const dryRun = options.dryRun || false; const dryRun = options.dryRun || false;
@@ -379,6 +386,7 @@ async function initializeProject(options = {}) {
options, options,
selectedRuleProfiles selectedRuleProfiles
); );
rl.close();
} catch (error) { } catch (error) {
rl.close(); rl.close();
log('error', `Error during initialization process: ${error.message}`); log('error', `Error during initialization process: ${error.message}`);