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>/);
|
||||
|
||||
// Build relative path for installation
|
||||
const fileRelativePath = relativePath ? `${relativePath}/${file}` : file;
|
||||
const fileRelativePath = relativePath ? `${relativePath}/${entry.name}` : entry.name;
|
||||
const installPath =
|
||||
moduleName === 'core'
|
||||
? `${this.bmadFolderName}/core/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
|
||||
const cleanForCSV = (text) => {
|
||||
|
|
|
|||
|
|
@ -83,39 +83,42 @@ async function getAgentsFromDir(dirPath, moduleName) {
|
|||
return agents;
|
||||
}
|
||||
|
||||
const files = await fs.readdir(dirPath);
|
||||
const entries = await fs.readdir(dirPath, { withFileTypes: true });
|
||||
|
||||
for (const file of files) {
|
||||
if (!file.endsWith('.md')) {
|
||||
continue;
|
||||
for (const entry of entries) {
|
||||
const fullPath = path.join(dirPath, entry.name);
|
||||
|
||||
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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue