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

@@ -1 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Discord Community Support
url: https://discord.gg/gk8jAdXWmj
about: Please join our Discord server for general questions and community discussion before opening an issue.

View File

@@ -1,6 +1,6 @@
---
name: V5 Idea Submission
about: Suggest an idea for v5
name: V6 Idea Submission
about: Suggest an idea for v6
title: ''
labels: ''
assignees: ''

View File

@@ -1282,6 +1282,28 @@ class Installer {
}
}
// Regenerate manifests after compilation
spinner.start('Regenerating manifests...');
const installedModules = entries
.filter((e) => e.isDirectory() && e.name !== '_cfg' && e.name !== 'docs' && e.name !== 'agents' && e.name !== 'core')
.map((e) => e.name);
const manifestGen = new ManifestGenerator();
// Get existing IDE list from manifest
const existingManifestPath = path.join(bmadDir, '_cfg', 'manifest.yaml');
let existingIdes = [];
if (await fs.pathExists(existingManifestPath)) {
const manifestContent = await fs.readFile(existingManifestPath, 'utf8');
const yaml = require('js-yaml');
const manifest = yaml.load(manifestContent);
existingIdes = manifest.ides || [];
}
await manifestGen.generateManifests(bmadDir, installedModules, [], {
ides: existingIdes,
});
spinner.succeed('Manifests regenerated');
// Ask for IDE to update
spinner.stop();
// Note: UI lives in tools/cli/lib/ui.js; from installers/lib/core use '../../../lib/ui'
@@ -1295,7 +1317,7 @@ class Installer {
for (const ide of toolConfig.ides) {
spinner.text = `Updating ${ide}...`;
await this.ideManager.setup(ide, projectDir, bmadDir, {
selectedModules: entries.filter((e) => e.isDirectory() && e.name !== '_cfg').map((e) => e.name),
selectedModules: installedModules,
skipModuleInstall: true, // Skip module installation, just update IDE files
verbose: config.verbose,
});

View File

@@ -179,6 +179,20 @@ class ManifestGenerator {
this.agents.push(...moduleAgents);
}
}
// Get standalone agents from bmad/agents/ directory
const standaloneAgentsDir = path.join(this.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 standaloneAgents = await this.getAgentsFromDir(agentDirPath, 'standalone');
this.agents.push(...standaloneAgents);
}
}
}
/**

View File

@@ -105,7 +105,7 @@ class BaseIdeSetup {
// Get module agents
const entries = await fs.readdir(bmadDir, { withFileTypes: true });
for (const entry of entries) {
if (entry.isDirectory() && entry.name !== 'core' && entry.name !== '_cfg') {
if (entry.isDirectory() && entry.name !== 'core' && entry.name !== '_cfg' && entry.name !== 'agents') {
const moduleAgentsPath = path.join(bmadDir, entry.name, 'agents');
if (await fs.pathExists(moduleAgentsPath)) {
const moduleAgents = await this.scanDirectory(moduleAgentsPath, '.md');
@@ -119,6 +119,37 @@ class BaseIdeSetup {
}
}
// 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({
name: file.replace('.md', ''),
path: filePath,
relativePath: path.relative(standaloneAgentsDir, filePath),
filename: file,
module: 'standalone', // Mark as standalone agent
});
}
}
}
return agents;
}
@@ -145,7 +176,7 @@ class BaseIdeSetup {
// Get module tasks
const entries = await fs.readdir(bmadDir, { withFileTypes: true });
for (const entry of entries) {
if (entry.isDirectory() && entry.name !== 'core' && entry.name !== '_cfg') {
if (entry.isDirectory() && entry.name !== 'core' && entry.name !== '_cfg' && entry.name !== 'agents') {
const moduleTasksPath = path.join(bmadDir, entry.name, 'tasks');
if (await fs.pathExists(moduleTasksPath)) {
const moduleTasks = await this.scanDirectory(moduleTasksPath, '.md');

View File

@@ -104,7 +104,7 @@ class ClaudeCodeSetup extends BaseIdeSetup {
const agents = await getAgentsFromBmad(bmadDir, options.selectedModules || []);
const tasks = await getTasksFromBmad(bmadDir, options.selectedModules || []);
// Create directories for each module
// Create directories for each module (including standalone)
const modules = new Set();
for (const item of [...agents, ...tasks]) modules.add(item.module);

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;
}