fix: addressed PR comment

This commit is contained in:
murat 2026-03-19 10:58:05 -05:00
parent e06fa7646c
commit 584f24134f
2 changed files with 31 additions and 6 deletions

View File

@ -1722,6 +1722,21 @@ async function runTests() {
const rescannedModules29 = await generator29.scanInstalledModules(tempFixture29); const rescannedModules29 = await generator29.scanInstalledModules(tempFixture29);
assert(rescannedModules29.includes('agent-only-mod'), 'scanInstalledModules recognizes native-agent-only module'); assert(rescannedModules29.includes('agent-only-mod'), 'scanInstalledModules recognizes native-agent-only module');
// Test scanInstalledModules recognizes multi-entry manifests keyed under SKILL.md
const multiEntryModDir29 = path.join(tempFixture29, 'multi-entry-mod');
await fs.ensureDir(path.join(multiEntryModDir29, 'deep', 'nested', 'bmad-tea'));
await fs.writeFile(
path.join(multiEntryModDir29, 'deep', 'nested', 'bmad-tea', 'bmad-skill-manifest.yaml'),
'SKILL.md:\n type: agent\n canonicalId: bmad-tea\n',
);
await fs.writeFile(
path.join(multiEntryModDir29, 'deep', 'nested', 'bmad-tea', 'SKILL.md'),
'---\nname: bmad-tea\ndescription: desc\n---\n\nAgent menu.\n',
);
const rescannedModules29b = await generator29.scanInstalledModules(tempFixture29);
assert(rescannedModules29b.includes('multi-entry-mod'), 'scanInstalledModules recognizes multi-entry native-agent module');
// skill-manifest.csv should include the native agent entrypoint // skill-manifest.csv should include the native agent entrypoint
const skillManifestCsv29 = await fs.readFile(path.join(tempFixture29, '_config', 'skill-manifest.csv'), 'utf8'); const skillManifestCsv29 = await fs.readFile(path.join(tempFixture29, '_config', 'skill-manifest.csv'), 'utf8');
assert(skillManifestCsv29.includes('bmad-tea'), 'skill-manifest.csv includes native type:agent SKILL.md entrypoint'); assert(skillManifestCsv29.includes('bmad-tea'), 'skill-manifest.csv includes native type:agent SKILL.md entrypoint');

View File

@ -60,6 +60,19 @@ class ManifestGenerator {
return artifactType === 'skill' || artifactType === 'agent'; return artifactType === 'skill' || artifactType === 'agent';
} }
/**
* Check whether a loaded bmad-skill-manifest.yaml declares a native
* SKILL.md entrypoint, either as a single-entry manifest or a multi-entry map.
* @param {Object|null} manifest - Loaded manifest
* @returns {boolean} True when the manifest contains a native skill/agent entrypoint
*/
hasNativeSkillManifest(manifest) {
if (!manifest) return false;
if (manifest.__single) return this.isNativeSkillDirType(manifest.__single.type);
return Object.values(manifest).some((entry) => this.isNativeSkillDirType(entry?.type));
}
/** /**
* Clean text for CSV output by normalizing whitespace. * Clean text for CSV output by normalizing whitespace.
* Note: Quote escaping is handled by escapeCsv() at write time. * Note: Quote escaping is handled by escapeCsv() at write time.
@ -1391,8 +1404,8 @@ class ManifestGenerator {
} }
/** /**
* Recursively check if a directory tree contains a bmad-skill-manifest.yaml with * Recursively check if a directory tree contains a bmad-skill-manifest.yaml that
* type: skill or type: agent. * declares a native SKILL.md entrypoint (type: skill or type: agent).
* Skips directories starting with . or _. * Skips directories starting with . or _.
* @param {string} dir - Directory to search * @param {string} dir - Directory to search
* @returns {boolean} True if a skill manifest is found * @returns {boolean} True if a skill manifest is found
@ -1407,10 +1420,7 @@ class ManifestGenerator {
// Check for manifest in this directory // Check for manifest in this directory
const manifest = await this.loadSkillManifest(dir); const manifest = await this.loadSkillManifest(dir);
if (manifest) { if (this.hasNativeSkillManifest(manifest)) return true;
const type = this.getArtifactType(manifest, 'workflow.md');
if (this.isNativeSkillDirType(type)) return true;
}
// Recurse into subdirectories // Recurse into subdirectories
for (const entry of entries) { for (const entry of entries) {