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:
parent
a7beab59b9
commit
4a76289b35
|
|
@ -58,11 +58,7 @@ class Installer {
|
||||||
// Collect configurations for official modules
|
// Collect configurations for official modules
|
||||||
const moduleConfigs = await this._collectConfigs(config, paths);
|
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);
|
const customModulePaths = await this.customModules.discoverPaths(config, paths);
|
||||||
|
|
||||||
// Wire configs into managers
|
|
||||||
this.customModules.setPaths(customModulePaths);
|
|
||||||
this.ideManager.setBmadFolderName(BMAD_FOLDER_NAME);
|
this.ideManager.setBmadFolderName(BMAD_FOLDER_NAME);
|
||||||
|
|
||||||
// Tool selection will be collected after we determine if it's a reinstall/update/new install
|
// 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
|
// customModulePaths is this.customModules.paths — .set() above updates it in place
|
||||||
this.customModules.setPaths(customModulePaths);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there are custom files, back them up temporarily
|
// If there are custom files, back them up temporarily
|
||||||
|
|
@ -304,9 +299,6 @@ class Installer {
|
||||||
customModulePaths.set(moduleId, cachedPath);
|
customModulePaths.set(moduleId, cachedPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update module manager with the new custom module paths from cache
|
|
||||||
this.customModules.setPaths(customModulePaths);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Back up custom files
|
// Back up custom files
|
||||||
|
|
@ -495,8 +487,6 @@ class Installer {
|
||||||
customModulePaths.set(moduleId, cachedInfo.cachePath);
|
customModulePaths.set(moduleId, cachedInfo.cachePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update module manager with the cached paths
|
|
||||||
this.customModules.setPaths(customModulePaths);
|
|
||||||
addResult('Custom modules cached', 'ok');
|
addResult('Custom modules cached', 'ok');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1031,7 +1021,6 @@ class Installer {
|
||||||
|
|
||||||
if (!customModulePaths.has(moduleName) && customInfo.path) {
|
if (!customModulePaths.has(moduleName) && customInfo.path) {
|
||||||
customModulePaths.set(moduleName, customInfo.path);
|
customModulePaths.set(moduleName, customInfo.path);
|
||||||
this.customModules.setPaths(customModulePaths);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const collectedModuleConfig = moduleConfigs[moduleName] || {};
|
const collectedModuleConfig = moduleConfigs[moduleName] || {};
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,6 @@ class CustomModules {
|
||||||
this.paths = new Map();
|
this.paths = new Map();
|
||||||
}
|
}
|
||||||
|
|
||||||
setPaths(customModulePaths) {
|
|
||||||
this.paths = customModulePaths;
|
|
||||||
}
|
|
||||||
|
|
||||||
has(moduleCode) {
|
has(moduleCode) {
|
||||||
return this.paths.has(moduleCode);
|
return this.paths.has(moduleCode);
|
||||||
}
|
}
|
||||||
|
|
@ -29,15 +25,15 @@ class CustomModules {
|
||||||
* @returns {Map<string, string>} Map of module ID to source path
|
* @returns {Map<string, string>} Map of module ID to source path
|
||||||
*/
|
*/
|
||||||
async discoverPaths(config, paths) {
|
async discoverPaths(config, paths) {
|
||||||
const result = new Map();
|
this.paths = new Map();
|
||||||
|
|
||||||
if (config._quickUpdate) {
|
if (config._quickUpdate) {
|
||||||
if (config._customModuleSources) {
|
if (config._customModuleSources) {
|
||||||
for (const [moduleId, customInfo] of 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)
|
// From manifest (regular updates)
|
||||||
|
|
@ -54,7 +50,7 @@ class CustomModules {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (absoluteSourcePath) {
|
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) {
|
for (const customFile of config.customContent.selectedFiles) {
|
||||||
const customInfo = await customHandler.getCustomInfo(customFile, paths.projectRoot);
|
const customInfo = await customHandler.getCustomInfo(customFile, paths.projectRoot);
|
||||||
if (customInfo && customInfo.id) {
|
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
|
// From UI: sources
|
||||||
if (config.customContent && config.customContent.sources) {
|
if (config.customContent && config.customContent.sources) {
|
||||||
for (const source of 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) {
|
for (const cachedModule of config.customContent.cachedModules) {
|
||||||
if (cachedModule.id && cachedModule.cachePath && (shouldIncludeAll || selectedCachedIds.includes(cachedModule.id))) {
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue