fix: nested agents now appear in CLI commands
- Fix getAgentsFromDir in bmad-artifacts.js to recursively scan subdirectories - This ensures agents like cbt-coach and wellness-companion that are in subdirectories are properly found - Agents now correctly get slash commands in .claude/commands/bmad/mwm/agents/ - All agents from the manifest now have corresponding IDE commands
This commit is contained in:
parent
86e2daabba
commit
74d071708d
|
|
@ -260,13 +260,13 @@ class ManifestGenerator {
|
||||||
const principlesMatch = content.match(/<principles>([\s\S]*?)<\/principles>/);
|
const principlesMatch = content.match(/<principles>([\s\S]*?)<\/principles>/);
|
||||||
|
|
||||||
// Build relative path for installation
|
// Build relative path for installation
|
||||||
const fileRelativePath = relativePath ? `${relativePath}/${file}` : file;
|
const fileRelativePath = relativePath ? `${relativePath}/${entry.name}` : entry.name;
|
||||||
const installPath =
|
const installPath =
|
||||||
moduleName === 'core'
|
moduleName === 'core'
|
||||||
? `${this.bmadFolderName}/core/agents/${fileRelativePath}`
|
? `${this.bmadFolderName}/core/agents/${fileRelativePath}`
|
||||||
: `${this.bmadFolderName}/${moduleName}/agents/${fileRelativePath}`;
|
: `${this.bmadFolderName}/${moduleName}/agents/${fileRelativePath}`;
|
||||||
|
|
||||||
const agentName = file.replace('.md', '');
|
const agentName = entry.name.replace('.md', '');
|
||||||
|
|
||||||
// Helper function to clean and escape CSV content
|
// Helper function to clean and escape CSV content
|
||||||
const cleanForCSV = (text) => {
|
const cleanForCSV = (text) => {
|
||||||
|
|
|
||||||
|
|
@ -83,39 +83,42 @@ async function getAgentsFromDir(dirPath, moduleName) {
|
||||||
return agents;
|
return agents;
|
||||||
}
|
}
|
||||||
|
|
||||||
const files = await fs.readdir(dirPath);
|
const entries = await fs.readdir(dirPath, { withFileTypes: true });
|
||||||
|
|
||||||
for (const file of files) {
|
for (const entry of entries) {
|
||||||
if (!file.endsWith('.md')) {
|
const fullPath = path.join(dirPath, entry.name);
|
||||||
continue;
|
|
||||||
|
if (entry.isDirectory()) {
|
||||||
|
// Recurse into subdirectories
|
||||||
|
const subDirAgents = await getAgentsFromDir(fullPath, moduleName);
|
||||||
|
agents.push(...subDirAgents);
|
||||||
|
} else if (entry.name.endsWith('.md')) {
|
||||||
|
// Skip README files and other non-agent files
|
||||||
|
if (entry.name.toLowerCase() === 'readme.md' || entry.name.toLowerCase().startsWith('readme-')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entry.name.includes('.customize.')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const content = await fs.readFile(fullPath, 'utf8');
|
||||||
|
|
||||||
|
if (content.includes('localskip="true"')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only include files that have agent-specific content (compiled agents have <agent> tag)
|
||||||
|
if (!content.includes('<agent')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
agents.push({
|
||||||
|
path: fullPath,
|
||||||
|
name: entry.name.replace('.md', ''),
|
||||||
|
module: moduleName,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip README files and other non-agent files
|
|
||||||
if (file.toLowerCase() === 'readme.md' || file.toLowerCase().startsWith('readme-')) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file.includes('.customize.')) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const filePath = path.join(dirPath, file);
|
|
||||||
const content = await fs.readFile(filePath, 'utf8');
|
|
||||||
|
|
||||||
if (content.includes('localskip="true"')) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only include files that have agent-specific content (compiled agents have <agent> tag)
|
|
||||||
if (!content.includes('<agent')) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
agents.push({
|
|
||||||
path: filePath,
|
|
||||||
name: file.replace('.md', ''),
|
|
||||||
module: moduleName,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return agents;
|
return agents;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue