refactor(installer): move isQuickUpdate into clean config

Add isQuickUpdate() to _buildConfig so the official path can check it
without reaching into customConfig. Replace all customConfig._quickUpdate
references with config.isQuickUpdate().
This commit is contained in:
Alex Verkhovsky 2026-03-21 05:28:39 -06:00
parent a9ba16cff5
commit 8d9ea3b95d
1 changed files with 15 additions and 8 deletions

View File

@ -59,6 +59,9 @@ class Installer {
hasCoreConfig() { hasCoreConfig() {
return this.coreConfig && Object.keys(this.coreConfig).length > 0; return this.coreConfig && Object.keys(this.coreConfig).length > 0;
}, },
isQuickUpdate() {
return originalConfig._quickUpdate || false;
},
}; };
} }
@ -76,8 +79,7 @@ class Installer {
const paths = await InstallPaths.create(config); const paths = await InstallPaths.create(config);
// Collect configurations for official modules // Collect configurations for official modules
// Quick update already collected everything — skip const moduleConfigs = await this._collectConfigs(config, paths);
const moduleConfigs = customConfig._quickUpdate ? this.configCollector.collectedConfig : await this._collectConfigs(config, paths);
await this.customModules.discoverPaths(config, paths); await this.customModules.discoverPaths(config, paths);
this.ideManager.setBmadFolderName(BMAD_FOLDER_NAME); this.ideManager.setBmadFolderName(BMAD_FOLDER_NAME);
@ -92,7 +94,7 @@ class Installer {
spinner.message('Checking for existing installation...'); spinner.message('Checking for existing installation...');
const existingInstall = await this.detector.detect(paths.bmadDir); const existingInstall = await this.detector.detect(paths.bmadDir);
if (existingInstall.installed && !config.force && !customConfig._quickUpdate) { if (existingInstall.installed && !config.force && !config.isQuickUpdate()) {
spinner.stop('Existing installation detected'); spinner.stop('Existing installation detected');
// Check if user already decided what to do (from early menu in ui.js) // Check if user already decided what to do (from early menu in ui.js)
@ -274,7 +276,7 @@ class Installer {
customConfig._tempModifiedBackupDir = tempModifiedBackupDir; customConfig._tempModifiedBackupDir = tempModifiedBackupDir;
} }
} }
} else if (existingInstall.installed && customConfig._quickUpdate) { } else if (existingInstall.installed && config.isQuickUpdate()) {
// Quick update mode - automatically treat as update without prompting // Quick update mode - automatically treat as update without prompting
spinner.message('Preparing quick update...'); spinner.message('Preparing quick update...');
customConfig._isUpdate = true; customConfig._isUpdate = true;
@ -358,7 +360,7 @@ class Installer {
// Skip for quick update since we already have the IDE list // Skip for quick update since we already have the IDE list
spinner.stop('Pre-checks complete'); spinner.stop('Pre-checks complete');
let toolSelection; let toolSelection;
if (customConfig._quickUpdate) { if (config.isQuickUpdate()) {
// Quick update already has IDEs configured, use saved configurations // Quick update already has IDEs configured, use saved configurations
const preConfiguredIdes = {}; const preConfiguredIdes = {};
const savedIdeConfigs = customConfig._savedIdeConfigs || {}; const savedIdeConfigs = customConfig._savedIdeConfigs || {};
@ -556,7 +558,7 @@ class Installer {
// ───────────────────────────────────────────────────────────────────────── // ─────────────────────────────────────────────────────────────────────────
// FIRST TASKS BLOCK: Core installation through manifests (non-interactive) // FIRST TASKS BLOCK: Core installation through manifests (non-interactive)
// ───────────────────────────────────────────────────────────────────────── // ─────────────────────────────────────────────────────────────────────────
const isQuickUpdate = customConfig._quickUpdate || false; const isQuickUpdate = config.isQuickUpdate();
// Collect directory creation results for output after tasks() completes // Collect directory creation results for output after tasks() completes
const dirResults = { createdDirs: [], movedDirs: [], createdWdsFolders: [] }; const dirResults = { createdDirs: [], movedDirs: [], createdWdsFolders: [] };
@ -639,14 +641,14 @@ class Installer {
message('Generating manifests...'); message('Generating manifests...');
const manifestGen = new ManifestGenerator(); const manifestGen = new ManifestGenerator();
const allModulesForManifest = customConfig._quickUpdate const allModulesForManifest = config.isQuickUpdate()
? customConfig._existingModules || allModules || [] ? customConfig._existingModules || allModules || []
: customConfig._preserveModules : customConfig._preserveModules
? [...allModules, ...customConfig._preserveModules] ? [...allModules, ...customConfig._preserveModules]
: allModules || []; : allModules || [];
let modulesForCsvPreserve; let modulesForCsvPreserve;
if (customConfig._quickUpdate) { if (config.isQuickUpdate()) {
modulesForCsvPreserve = customConfig._existingModules || allModules || []; modulesForCsvPreserve = customConfig._existingModules || allModules || [];
} else { } else {
modulesForCsvPreserve = customConfig._preserveModules ? [...allModules, ...customConfig._preserveModules] : allModules; modulesForCsvPreserve = customConfig._preserveModules ? [...allModules, ...customConfig._preserveModules] : allModules;
@ -882,6 +884,11 @@ class Installer {
} }
} }
// Quick update already collected everything
if (config.isQuickUpdate()) {
return this.configCollector.collectedConfig;
}
// Modules to collect — skip core if its config was pre-collected // Modules to collect — skip core if its config was pre-collected
const toCollect = config.hasCoreConfig() ? config.modules.filter((m) => m !== 'core') : [...config.modules]; const toCollect = config.hasCoreConfig() ? config.modules.filter((m) => m !== 'core') : [...config.modules];