less verbose final output during install

This commit is contained in:
Brian Madison
2025-12-15 15:55:28 +08:00
parent 5716282898
commit c7827bf031
9 changed files with 125 additions and 182 deletions

View File

@@ -254,6 +254,26 @@ class ConfigCollector {
const configKeys = Object.keys(moduleConfig).filter((key) => key !== 'prompt');
const existingKeys = this.existingConfig && this.existingConfig[moduleName] ? Object.keys(this.existingConfig[moduleName]) : [];
// Check if this module has no configuration keys at all (like CIS)
// Filter out metadata fields and only count actual config objects
const metadataFields = new Set(['code', 'name', 'header', 'subheader', 'default_selected']);
const actualConfigKeys = configKeys.filter((key) => !metadataFields.has(key));
const hasNoConfig = actualConfigKeys.length === 0;
// If module has no config keys at all, handle it specially
if (hasNoConfig && moduleConfig.subheader) {
// Add blank line for better readability (matches other modules)
console.log();
const moduleDisplayName = moduleConfig.header || `${moduleName.toUpperCase()} Module`;
// Display the module name in color first (matches other modules)
console.log(chalk.cyan('?') + ' ' + chalk.magenta(moduleDisplayName));
// Show the subheader since there's no configuration to ask about
console.log(chalk.dim(`${moduleConfig.subheader}`));
return false; // No new fields
}
// Find new interactive fields (with prompt)
const newKeys = configKeys.filter((key) => {
const item = moduleConfig[key];
@@ -302,11 +322,12 @@ class ConfigCollector {
this.allAnswers[`${moduleName}_user_name`] = this.getDefaultUsername();
}
}
// Show "no config" message for modules with no new questions
console.log(chalk.dim(`${moduleName.toUpperCase()} module already up to date`));
return false; // No new fields
}
// Show "no config" message for modules with no new questions (that have config keys)
console.log(chalk.dim(`${moduleName.toUpperCase()} module already up to date`));
return false; // No new fields
// If we have new fields (interactive or static), process them
if (newKeys.length > 0 || newStaticKeys.length > 0) {
const questions = [];
@@ -710,8 +731,43 @@ class ConfigCollector {
// No longer display completion boxes - keep output clean
} else {
// No questions for this module - show completion message
console.log(chalk.dim(`${moduleName.toUpperCase()} module configured`));
// No questions for this module - show completion message with header if available
const moduleDisplayName = moduleConfig.header || `${moduleName.toUpperCase()} Module`;
// Check if this module has NO configuration keys at all (like CIS)
// Filter out metadata fields and only count actual config objects
const metadataFields = new Set(['code', 'name', 'header', 'subheader', 'default_selected']);
const actualConfigKeys = configKeys.filter((key) => !metadataFields.has(key));
const hasNoConfig = actualConfigKeys.length === 0;
if (hasNoConfig && (moduleConfig.subheader || moduleConfig.header)) {
// Module explicitly has no configuration - show with special styling
// Add blank line for better readability (matches other modules)
console.log();
// Display the module name in color first (matches other modules)
console.log(chalk.cyan('?') + ' ' + chalk.magenta(moduleDisplayName));
// Ask user if they want to accept defaults or customize on the next line
const { customize } = await inquirer.prompt([
{
type: 'confirm',
name: 'customize',
message: 'Accept Defaults (no to customize)?',
default: true,
},
]);
// Show the subheader if available, otherwise show a default message
if (moduleConfig.subheader) {
console.log(chalk.dim(`${moduleConfig.subheader}`));
} else {
console.log(chalk.dim(` ✓ No custom configuration required`));
}
} else {
// Module has config but just no questions to ask
console.log(chalk.dim(`${moduleName.toUpperCase()} module configured`));
}
}
// If we have no collected config for this module, but we have a module schema,

View File

@@ -1248,9 +1248,9 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
console.log = originalLog;
if (spinner.isSpinning) {
spinner.succeed(`Configured ${validIdes.length} IDE${validIdes.length > 1 ? 's' : ''}`);
spinner.succeed(`Configured: ${validIdes.join(', ')}`);
} else {
console.log(chalk.green(`✓ Configured ${validIdes.length} IDE${validIdes.length > 1 ? 's' : ''}`));
console.log(chalk.green(`✓ Configured: ${validIdes.join(', ')}`));
}
}
@@ -1266,6 +1266,14 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
// Run module-specific installers after IDE setup
spinner.start('Running module-specific installers...');
// Create a conditional logger based on verbose mode
const verboseMode = process.env.BMAD_VERBOSE_INSTALL === 'true' || config.verbose;
const moduleLogger = {
log: (msg) => (verboseMode ? console.log(msg) : {}), // Only log in verbose mode
error: (msg) => console.error(msg), // Always show errors
warn: (msg) => console.warn(msg), // Always show warnings
};
// Run core module installer if core was installed
if (config.installCore || resolution.byModule.core) {
spinner.text = 'Running core module installer...';
@@ -1274,11 +1282,7 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
installedIDEs: config.ides || [],
moduleConfig: moduleConfigs.core || {},
coreConfig: moduleConfigs.core || {},
logger: {
log: (msg) => console.log(msg),
error: (msg) => console.error(msg),
warn: (msg) => console.warn(msg),
},
logger: moduleLogger,
});
}
@@ -1292,11 +1296,7 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
installedIDEs: config.ides || [],
moduleConfig: moduleConfigs[moduleName] || {},
coreConfig: moduleConfigs.core || {},
logger: {
log: (msg) => console.log(msg),
error: (msg) => console.error(msg),
warn: (msg) => console.warn(msg),
},
logger: moduleLogger,
});
}
}
@@ -1942,7 +1942,10 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
const genericTemplatePath = getSourcePath('utility', 'agent-components', 'agent.customize.template.yaml');
if (await fs.pathExists(genericTemplatePath)) {
await this.copyFileWithPlaceholderReplacement(genericTemplatePath, customizePath, this.bmadFolderName || 'bmad');
console.log(chalk.dim(` Created customize: ${moduleName}-${agentName}.customize.yaml`));
// Only show customize creation in verbose mode
if (process.env.BMAD_VERBOSE_INSTALL === 'true') {
console.log(chalk.dim(` Created customize: ${moduleName}-${agentName}.customize.yaml`));
}
}
}
}