refactor: simplify core module path handling per PR review

- Use getModulePath('core') instead of getSourcePath('core') for API consistency
- Remove redundant core module special-case check in runModuleInstaller()
  since findModuleSource() now properly handles core modules
This commit is contained in:
Scott Jennings 2025-12-07 21:30:57 -06:00
parent fcfbcd1b49
commit e8d4257593
1 changed files with 5 additions and 11 deletions

View File

@ -302,7 +302,7 @@ class ModuleManager {
async findModuleSource(moduleName) { async findModuleSource(moduleName) {
// Special handling for core module - it's in src/core not src/modules // Special handling for core module - it's in src/core not src/modules
if (moduleName === 'core') { if (moduleName === 'core') {
const corePath = getSourcePath('core'); const corePath = getModulePath('core');
if (await fs.pathExists(corePath)) { if (await fs.pathExists(corePath)) {
return corePath; return corePath;
} }
@ -1080,17 +1080,11 @@ class ModuleManager {
* @param {Object} options - Installation options * @param {Object} options - Installation options
*/ */
async runModuleInstaller(moduleName, bmadDir, options = {}) { async runModuleInstaller(moduleName, bmadDir, options = {}) {
// Special handling for core module - it's in src/core not src/modules const sourcePath = await this.findModuleSource(moduleName);
let sourcePath;
if (moduleName === 'core') {
sourcePath = getSourcePath('core');
} else {
sourcePath = await this.findModuleSource(moduleName);
if (!sourcePath) { if (!sourcePath) {
// No source found, skip module installer // No source found, skip module installer
return; return;
} }
}
const installerPath = path.join(sourcePath, '_module-installer', 'installer.js'); const installerPath = path.join(sourcePath, '_module-installer', 'installer.js');