refactor(installer): make discoverPaths populate this.paths directly

discoverPaths now sets this.paths internally instead of returning
a Map that the caller feeds back via setPaths. Remove setPaths
and all 5 no-op setPaths calls in installer.js.
This commit is contained in:
Alex Verkhovsky 2026-03-21 04:47:46 -06:00
parent a7beab59b9
commit 4a76289b35
2 changed files with 9 additions and 24 deletions

View File

@ -58,11 +58,7 @@ class Installer {
// Collect configurations for official modules
const moduleConfigs = await this._collectConfigs(config, paths);
// Custom module path discovery (will move to its own phase later)
const customModulePaths = await this.customModules.discoverPaths(config, paths);
// Wire configs into managers
this.customModules.setPaths(customModulePaths);
this.ideManager.setBmadFolderName(BMAD_FOLDER_NAME);
// Tool selection will be collected after we determine if it's a reinstall/update/new install
@ -221,8 +217,7 @@ class Installer {
}
}
// Update module manager with the new custom module paths from cache
this.customModules.setPaths(customModulePaths);
// customModulePaths is this.customModules.paths — .set() above updates it in place
}
// If there are custom files, back them up temporarily
@ -304,9 +299,6 @@ class Installer {
customModulePaths.set(moduleId, cachedPath);
}
}
// Update module manager with the new custom module paths from cache
this.customModules.setPaths(customModulePaths);
}
// Back up custom files
@ -495,8 +487,6 @@ class Installer {
customModulePaths.set(moduleId, cachedInfo.cachePath);
}
// Update module manager with the cached paths
this.customModules.setPaths(customModulePaths);
addResult('Custom modules cached', 'ok');
}
@ -1031,7 +1021,6 @@ class Installer {
if (!customModulePaths.has(moduleName) && customInfo.path) {
customModulePaths.set(moduleName, customInfo.path);
this.customModules.setPaths(customModulePaths);
}
const collectedModuleConfig = moduleConfigs[moduleName] || {};

View File

@ -6,10 +6,6 @@ class CustomModules {
this.paths = new Map();
}
setPaths(customModulePaths) {
this.paths = customModulePaths;
}
has(moduleCode) {
return this.paths.has(moduleCode);
}
@ -29,15 +25,15 @@ class CustomModules {
* @returns {Map<string, string>} Map of module ID to source path
*/
async discoverPaths(config, paths) {
const result = new Map();
this.paths = new Map();
if (config._quickUpdate) {
if (config._customModuleSources) {
for (const [moduleId, customInfo] of config._customModuleSources) {
result.set(moduleId, customInfo.sourcePath);
this.paths.set(moduleId, customInfo.sourcePath);
}
}
return result;
return this.paths;
}
// From manifest (regular updates)
@ -54,7 +50,7 @@ class CustomModules {
}
if (absoluteSourcePath) {
result.set(customModule.id, absoluteSourcePath);
this.paths.set(customModule.id, absoluteSourcePath);
}
}
}
@ -65,7 +61,7 @@ class CustomModules {
for (const customFile of config.customContent.selectedFiles) {
const customInfo = await customHandler.getCustomInfo(customFile, paths.projectRoot);
if (customInfo && customInfo.id) {
result.set(customInfo.id, customInfo.path);
this.paths.set(customInfo.id, customInfo.path);
}
}
}
@ -73,7 +69,7 @@ class CustomModules {
// From UI: sources
if (config.customContent && config.customContent.sources) {
for (const source of config.customContent.sources) {
result.set(source.id, source.path);
this.paths.set(source.id, source.path);
}
}
@ -84,12 +80,12 @@ class CustomModules {
for (const cachedModule of config.customContent.cachedModules) {
if (cachedModule.id && cachedModule.cachePath && (shouldIncludeAll || selectedCachedIds.includes(cachedModule.id))) {
result.set(cachedModule.id, cachedModule.cachePath);
this.paths.set(cachedModule.id, cachedModule.cachePath);
}
}
}
return result;
return this.paths;
}
}