custom modules install after any non custom modules selected and after the core, manifest tracks custom modules separately to ensure always installed from the custom cache

This commit is contained in:
Brian Madison
2025-12-14 10:03:25 +08:00
parent 9fe79882b2
commit 7f742d4af6
12 changed files with 340 additions and 51 deletions

View File

@@ -29,6 +29,7 @@ class ModuleManager {
this.xmlHandler = new XmlHandler();
this.bmadFolderName = 'bmad'; // Default, can be overridden
this.scanProjectForModules = options.scanProjectForModules !== false; // Default to true for backward compatibility
this.customModulePaths = new Map(); // Initialize custom module paths
}
/**
@@ -47,6 +48,14 @@ class ModuleManager {
this.coreConfig = coreConfig;
}
/**
* Set custom module paths for priority lookup
* @param {Map<string, string>} customModulePaths - Map of module ID to source path
*/
setCustomModulePaths(customModulePaths) {
this.customModulePaths = customModulePaths;
}
/**
* Copy a file and replace _bmad placeholder with actual folder name
* @param {string} sourcePath - Source file path
@@ -340,6 +349,11 @@ class ModuleManager {
async findModuleSource(moduleName) {
const projectRoot = getProjectRoot();
// First check custom module paths if they exist
if (this.customModulePaths && this.customModulePaths.has(moduleName)) {
return this.customModulePaths.get(moduleName);
}
// First, check src/modules
const srcModulePath = path.join(this.modulesSourcePath, moduleName);
if (await fs.pathExists(srcModulePath)) {