improved ui for initial install question intake

This commit is contained in:
Brian Madison 2025-12-15 11:33:01 +08:00
parent ecc2901649
commit 3cbe330b8e

View File

@ -284,26 +284,12 @@ class UI {
// For new installations, ask about content types first // For new installations, ask about content types first
if (!hasExistingInstall) { if (!hasExistingInstall) {
// Ask about custom content first // Ask about official modules first
const { wantsCustomContent } = await inquirer.prompt([
{
type: 'confirm',
name: 'wantsCustomContent',
message: 'Will you be installing any custom content?',
default: false,
},
]);
if (wantsCustomContent) {
customContentConfig = await this.promptCustomContentSource();
}
// Then ask about official modules
const { wantsOfficialModules } = await inquirer.prompt([ const { wantsOfficialModules } = await inquirer.prompt([
{ {
type: 'confirm', type: 'confirm',
name: 'wantsOfficialModules', name: 'wantsOfficialModules',
message: 'Will you be installing any official modules?', message: 'Will you be installing any official modules (BMad Method, BMad Builder, Creative Innovation Suite)?',
default: true, default: true,
}, },
]); ]);
@ -315,6 +301,20 @@ class UI {
selectedOfficialModules = await this.selectModules(moduleChoices); selectedOfficialModules = await this.selectModules(moduleChoices);
} }
// Then ask about custom content
const { wantsCustomContent } = await inquirer.prompt([
{
type: 'confirm',
name: 'wantsCustomContent',
message: 'Will you be installing any locally stored custom content?',
default: false,
},
]);
if (wantsCustomContent) {
customContentConfig = await this.promptCustomContentSource();
}
// Store the selected modules for later // Store the selected modules for later
customContentConfig._selectedOfficialModules = selectedOfficialModules; customContentConfig._selectedOfficialModules = selectedOfficialModules;
} }
@ -474,7 +474,7 @@ class UI {
name: 'ides', name: 'ides',
message: 'Select tools to configure:', message: 'Select tools to configure:',
choices: ideChoices, choices: ideChoices,
pageSize: 15, pageSize: 30,
}, },
]); ]);
@ -799,8 +799,6 @@ class UI {
* @returns {Array} Selected module IDs * @returns {Array} Selected module IDs
*/ */
async selectModules(moduleChoices) { async selectModules(moduleChoices) {
CLIUtils.displaySection('Module Selection', 'Choose the BMAD modules to install');
const moduleAnswer = await inquirer.prompt([ const moduleAnswer = await inquirer.prompt([
{ {
type: 'checkbox', type: 'checkbox',
@ -1302,7 +1300,25 @@ class UI {
// Keep asking for more sources until user is done // Keep asking for more sources until user is done
while (true) { while (true) {
console.log(chalk.cyan('\n📦 Adding Custom Content')); // First ask if user wants to add another module or continue
if (customContentConfig.sources.length > 0) {
const { action } = await inquirer.prompt([
{
type: 'list',
name: 'action',
message: 'Would you like to:',
choices: [
{ name: 'Add another custom module', value: 'add' },
{ name: 'Continue with installation', value: 'continue' },
],
default: 'continue',
},
]);
if (action === 'continue') {
break;
}
}
let sourcePath; let sourcePath;
let isValid = false; let isValid = false;
@ -1312,10 +1328,11 @@ class UI {
{ {
type: 'input', type: 'input',
name: 'path', name: 'path',
message: 'Enter the path to your custom content folder:', message: 'Enter the path to your custom content folder (or press Enter to cancel):',
validate: async (input) => { validate: async (input) => {
// Allow empty input to cancel
if (!input || input.trim() === '') { if (!input || input.trim() === '') {
return 'Path is required'; return true; // Allow empty to exit
} }
try { try {
@ -1359,6 +1376,15 @@ class UI {
}, },
]); ]);
// If user pressed Enter without typing anything, exit the loop
if (!inputPath || inputPath.trim() === '') {
// If we have no modules yet, return false for no custom content
if (customContentConfig.sources.length === 0) {
return { hasCustomContent: false };
}
return customContentConfig;
}
sourcePath = this.expandUserPath(inputPath); sourcePath = this.expandUserPath(inputPath);
isValid = true; isValid = true;
} }
@ -1376,21 +1402,7 @@ class UI {
name: moduleData.name || moduleData.code, name: moduleData.name || moduleData.code,
}); });
console.log(chalk.green(`✓ Added custom module: ${moduleData.name || moduleData.code}`)); console.log(chalk.green(`✓ Confirmed local custom module: ${moduleData.name || moduleData.code}`));
// Ask if user wants to add more
const { addMore } = await inquirer.prompt([
{
type: 'confirm',
name: 'addMore',
message: 'Add another custom module?',
default: false,
},
]);
if (!addMore) {
break;
}
} }
// Ask if user wants to add these to the installation // Ask if user wants to add these to the installation