create-agent now adds agent to ide agents list also

This commit is contained in:
Brian Madison
2025-10-09 23:07:12 -05:00
parent 9ba4805aa7
commit b4cc579009
7 changed files with 108 additions and 6 deletions

View File

@@ -8,11 +8,13 @@ const fs = require('fs-extra');
async function getAgentsFromBmad(bmadDir, selectedModules = []) {
const agents = [];
// Get core agents
if (await fs.pathExists(path.join(bmadDir, 'core', 'agents'))) {
const coreAgents = await getAgentsFromDir(path.join(bmadDir, 'core', 'agents'), 'core');
agents.push(...coreAgents);
}
// Get module agents
for (const moduleName of selectedModules) {
const agentsPath = path.join(bmadDir, moduleName, 'agents');
@@ -22,6 +24,35 @@ async function getAgentsFromBmad(bmadDir, selectedModules = []) {
}
}
// Get standalone agents from bmad/agents/ directory
const standaloneAgentsDir = path.join(bmadDir, 'agents');
if (await fs.pathExists(standaloneAgentsDir)) {
const agentDirs = await fs.readdir(standaloneAgentsDir, { withFileTypes: true });
for (const agentDir of agentDirs) {
if (!agentDir.isDirectory()) continue;
const agentDirPath = path.join(standaloneAgentsDir, agentDir.name);
const agentFiles = await fs.readdir(agentDirPath);
for (const file of agentFiles) {
if (!file.endsWith('.md')) continue;
if (file.includes('.customize.')) continue;
const filePath = path.join(agentDirPath, file);
const content = await fs.readFile(filePath, 'utf8');
if (content.includes('localskip="true"')) continue;
agents.push({
path: filePath,
name: file.replace('.md', ''),
module: 'standalone', // Mark as standalone agent
});
}
}
}
return agents;
}