From 59e4cc7b826d95ca63c24c76bacda4dd78a8af9c Mon Sep 17 00:00:00 2001 From: Brian Madison Date: Tue, 16 Dec 2025 13:09:20 +0800 Subject: [PATCH] minor code cleanup --- tools/cli/installers/lib/core/installer.js | 22 +-- tools/cli/lib/ui.js | 150 +-------------------- 2 files changed, 4 insertions(+), 168 deletions(-) diff --git a/tools/cli/installers/lib/core/installer.js b/tools/cli/installers/lib/core/installer.js index 957d5f94..a0cc46c3 100644 --- a/tools/cli/installers/lib/core/installer.js +++ b/tools/cli/installers/lib/core/installer.js @@ -50,7 +50,6 @@ class Installer { return { bmadDir: path.join(projectDir, '_bmad'), hasLegacyCfg: false }; } - // V6+ strategy: Look for ANY directory with _config/manifest.yaml or legacy _cfg/manifest.yaml let bmadDir = null; let hasLegacyCfg = false; @@ -76,7 +75,7 @@ class Installer { } } } catch { - // Ignore errors, fall through to default + console.log(chalk.red('Error reading project directory for BMAD installation detection')); } // If we found a bmad directory (with or without legacy _cfg) @@ -321,6 +320,7 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice: for (const ide of newlySelectedIdes) { // List of IDEs that have interactive prompts + //TODO: Why is this here, hardcoding this list here is bad, fix me! const needsPrompts = ['claude-code', 'github-copilot', 'roo', 'cline', 'auggie', 'codex', 'qwen', 'gemini', 'rovo-dev'].includes( ide, ); @@ -344,7 +344,6 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice: } else if (ideModule.default) { SetupClass = ideModule.default; } else { - // Skip if no setup class found continue; } @@ -398,10 +397,7 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice: const hasCoreConfig = config.coreConfig && Object.keys(config.coreConfig).length > 0; // Only display logo if core config wasn't already collected (meaning we're not continuing from UI) - if (hasCoreConfig) { - // Core config was already collected in UI, show smooth continuation - // Don't clear screen, just continue flow - } else { + if (!hasCoreConfig) { // Display BMAD logo CLIUtils.displayLogo(); @@ -797,7 +793,6 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice: config.skipIde = toolSelection.skipIde; const ideConfigurations = toolSelection.configurations; - // Check if spinner is already running (e.g., from folder name change scenario) if (spinner.isSpinning) { spinner.text = 'Continuing installation...'; } else { @@ -828,7 +823,6 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice: spinner.succeed('Custom modules cached'); } - // Get project root const projectRoot = getProjectRoot(); // Step 1: Install core module first (if requested) @@ -985,7 +979,6 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice: this.moduleManager.setCustomModulePaths(customModulePaths); } - // Get collected config for this custom module (from module.yaml prompts) const collectedModuleConfig = moduleConfigs[moduleName] || {}; // Use ModuleManager to install the custom module @@ -1002,8 +995,6 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice: }, ); - // ModuleManager installs directly to the target directory, no need to move files - // Create module config (include collected config from module.yaml prompts) await this.generateModuleConfigs(bmadDir, { [moduleName]: { ...config.coreConfig, ...customInfo.config, ...collectedModuleConfig }, @@ -1558,14 +1549,7 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice: async installCoreWithDependencies(bmadDir, coreFiles) { const sourcePath = getModulePath('core'); const targetPath = path.join(bmadDir, 'core'); - - // Install full core await this.installCore(bmadDir); - - // If there are specific dependency files, ensure they're included - if (coreFiles) { - // Already handled by installCore for core module - } } /** diff --git a/tools/cli/lib/ui.js b/tools/cli/lib/ui.js index cd1f0f65..29c376aa 100644 --- a/tools/cli/lib/ui.js +++ b/tools/cli/lib/ui.js @@ -10,8 +10,6 @@ const { CustomHandler } = require('../installers/lib/custom/handler'); * UI utilities for the installer */ class UI { - constructor() {} - /** * Prompt for installation configuration * @returns {Object} Installation configuration @@ -161,14 +159,8 @@ class UI { } } - // Always ask for custom content, but we'll handle it differently for new installs let customContentConfig = { hasCustomContent: false }; - if (hasExistingInstall) { - // Existing installation - prompt to add/update custom content - customContentConfig = await this.promptCustomContentForExisting(); - } else { - // New installation - we'll prompt after creating the directory structure - // For now, set a flag to indicate we should ask later + if (!hasExistingInstall) { customContentConfig._shouldAsk = true; } @@ -1140,146 +1132,6 @@ class UI { return existingInstall.ides || []; } - /** - * Prompt for custom content for existing installations - * @returns {Object} Custom content configuration - */ - async promptCustomContentForExisting() { - try { - // Skip custom content installation - always return false - return { hasCustomContent: false }; - - // TODO: Custom content installation temporarily disabled - // CLIUtils.displaySection('Custom Content', 'Add new custom agents, workflows, or modules to your installation'); - - // const { hasCustomContent } = await inquirer.prompt([ - // { - // type: 'list', - // name: 'hasCustomContent', - // message: 'Do you want to add or update custom content?', - // choices: [ - // { - // name: 'No, continue with current installation only', - // value: false, - // }, - // { - // name: 'Yes, I have custom content to add or update', - // value: true, - // }, - // ], - // default: false, - // }, - // ]); - - // if (!hasCustomContent) { - // return { hasCustomContent: false }; - // } - - // TODO: Custom content installation temporarily disabled - // // Get directory path - // const { customPath } = await inquirer.prompt([ - // { - // type: 'input', - // name: 'customPath', - // message: 'Enter directory to search for custom content (will scan subfolders):', - // default: process.cwd(), - // validate: async (input) => { - // if (!input || input.trim() === '') { - // return 'Please enter a directory path'; - // } - - // // Normalize and check if path exists - // const expandedPath = CLIUtils.expandPath(input.trim()); - // const pathExists = await fs.pathExists(expandedPath); - // if (!pathExists) { - // return 'Directory does not exist'; - // } - - // // Check if it's actually a directory - // const stats = await fs.stat(expandedPath); - // if (!stats.isDirectory()) { - // return 'Path must be a directory'; - // } - - // return true; - // }, - // transformer: (input) => { - // return CLIUtils.expandPath(input); - // }, - // }, - // ]); - - // const resolvedPath = CLIUtils.expandPath(customPath); - - // // Find custom content - // const customHandler = new CustomHandler(); - // const customFiles = await customHandler.findCustomContent(resolvedPath); - - // if (customFiles.length === 0) { - // console.log(chalk.yellow(`\nNo custom content found in ${resolvedPath}`)); - - // const { tryDifferent } = await inquirer.prompt([ - // { - // type: 'confirm', - // name: 'tryDifferent', - // message: 'Try a different directory?', - // default: true, - // }, - // ]); - - // if (tryDifferent) { - // return await this.promptCustomContentForExisting(); - // } - - // return { hasCustomContent: false }; - // } - - // // Display found items - // console.log(chalk.cyan(`\nFound ${customFiles.length} custom content file(s):`)); - // const customContentItems = []; - - // for (const customFile of customFiles) { - // const customInfo = await customHandler.getCustomInfo(customFile); - // if (customInfo) { - // customContentItems.push({ - // name: `${chalk.cyan('✓')} ${customInfo.name} ${chalk.gray(`(${customInfo.relativePath})`)}`, - // value: `__CUSTOM_CONTENT__${customFile}`, - // checked: true, - // }); - // } - // } - - // // Add option to keep existing custom content - // console.log(chalk.yellow('\nExisting custom modules will be preserved unless you remove them')); - - // const { selectedFiles } = await inquirer.prompt([ - // { - // type: 'checkbox', - // name: 'selectedFiles', - // message: 'Select custom content to add:', - // choices: customContentItems, - // pageSize: 15, - // validate: (answer) => { - // if (answer.length === 0) { - // return 'You must select at least one item'; - // } - // return true; - // }, - // }, - // ]); - - // return { - // hasCustomContent: true, - // customPath: resolvedPath, - // selected: true, - // selectedFiles: selectedFiles, - // }; - } catch (error) { - console.error(chalk.red('Error configuring custom content:'), error); - return { hasCustomContent: false }; - } - } - /** * Prompt user for custom content source location * @returns {Object} Custom content configuration