fix: ManifestGenerator now scans for all installed modules

- Previously only scanned selectedModules, missing modules installed from custom locations
- Now scans the bmad directory to find all actually installed modules
- Any module with agents/workflows/tasks/tools will be included in manifests
- This fixes issue where MWM workflows weren't getting slash commands
- All modules now get equal treatment in IDE integration
This commit is contained in:
Brian Madison 2025-12-06 16:16:48 -06:00
parent f052967f65
commit aad7a71718

View File

@ -34,9 +34,13 @@ class ManifestGenerator {
// Store modules list (all modules including preserved ones)
const preservedModules = options.preservedModules || [];
// Scan the bmad directory to find all actually installed modules
const installedModules = await this.scanInstalledModules(bmadDir);
// Deduplicate modules list to prevent duplicates
this.modules = [...new Set(['core', ...selectedModules, ...preservedModules])];
this.updatedModules = [...new Set(['core', ...selectedModules])]; // Only these get rescanned
this.modules = [...new Set(['core', ...selectedModules, ...preservedModules, ...installedModules])];
this.updatedModules = [...new Set(['core', ...selectedModules, ...installedModules])]; // All installed modules get rescanned
this.preservedModules = preservedModules; // These stay as-is in CSVs
this.bmadDir = bmadDir;
this.bmadFolderName = path.basename(bmadDir); // Get the actual folder name (e.g., '.bmad' or 'bmad')
@ -700,6 +704,42 @@ class ManifestGenerator {
await fs.writeFile(csvPath, csv);
return csvPath;
}
/**
* Scan the bmad directory to find all installed modules
* @param {string} bmadDir - Path to bmad directory
* @returns {Array} List of module names
*/
async scanInstalledModules(bmadDir) {
const modules = [];
try {
const entries = await fs.readdir(bmadDir, { withFileTypes: true });
for (const entry of entries) {
// Skip if not a directory or is a special directory
if (!entry.isDirectory() || entry.name.startsWith('.') || entry.name === '_cfg') {
continue;
}
// Check if this looks like a module (has agents, workflows, or tasks directory)
const modulePath = path.join(bmadDir, entry.name);
const hasAgents = await fs.pathExists(path.join(modulePath, 'agents'));
const hasWorkflows = await fs.pathExists(path.join(modulePath, 'workflows'));
const hasTasks = await fs.pathExists(path.join(modulePath, 'tasks'));
const hasTools = await fs.pathExists(path.join(modulePath, 'tools'));
// If it has any of these directories, it's likely a module
if (hasAgents || hasWorkflows || hasTasks || hasTools) {
modules.push(entry.name);
}
}
} catch (error) {
console.warn(`Warning: Could not scan for installed modules: ${error.message}`);
}
return modules;
}
}
module.exports = { ManifestGenerator };