fix: resolve custom module.yaml from installed location during manifest generation

- resolveInstalledModuleYaml now checks _bmad/<module>/module.yaml first
  so freshly-installed custom/community modules are found immediately
- manifest-generator passes bmadDir to resolveInstalledModuleYaml for lookup
- removes 'could not locate module.yaml' warnings during custom module install
- allows agents declared in custom module.yaml to be registered in config.toml
This commit is contained in:
alexandre.azouri 2026-05-11 13:54:10 +02:00
parent fe6eb043d4
commit 8c0f856839
2 changed files with 11 additions and 3 deletions

View File

@ -244,7 +244,7 @@ class ManifestGenerator {
const debug = process.env.BMAD_DEBUG_MANIFEST === 'true';
for (const moduleName of this.updatedModules) {
const moduleYamlPath = await resolveInstalledModuleYaml(moduleName);
const moduleYamlPath = await resolveInstalledModuleYaml(moduleName, this.bmadDir);
if (!moduleYamlPath) {
// External modules live in ~/.bmad/cache/external-modules, not src/modules.
// Warn rather than silently skip so missing agent rosters don't vanish
@ -439,7 +439,7 @@ class ManifestGenerator {
// from module.yaml, so TOML sections use [modules.<code>] not [modules.<name>].
const codeByModuleName = {};
for (const moduleName of this.updatedModules) {
const moduleYamlPath = await resolveInstalledModuleYaml(moduleName);
const moduleYamlPath = await resolveInstalledModuleYaml(moduleName, this.bmadDir);
if (!moduleYamlPath) {
console.warn(
`[warn] writeCentralConfig: could not locate module.yaml for '${moduleName}'. ` +

View File

@ -99,7 +99,15 @@ function getExternalModuleCachePath(moduleName, ...segments) {
* @param {string} moduleName
* @returns {Promise<string|null>} Absolute path to module.yaml, or null if not found.
*/
async function resolveInstalledModuleYaml(moduleName) {
async function resolveInstalledModuleYaml(moduleName, bmadDir = null) {
// First: check _bmad/<moduleName>/module.yaml (installed location)
// This is written by installFromResolution during install, so check it
// before caches to find freshly-installed custom/community modules.
if (bmadDir) {
const installedPath = path.join(bmadDir, moduleName, 'module.yaml');
if (await fs.pathExists(installedPath)) return installedPath;
}
const builtIn = path.join(getModulePath(moduleName), 'module.yaml');
if (await fs.pathExists(builtIn)) return builtIn;