mirror of
https://github.com/bmadcode/BMAD-METHOD.git
synced 2025-12-29 16:14:59 +00:00
agents now are not duplicated and isntead cli commmands load from installed agent files
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
const path = require('node:path');
|
||||
const { BaseIdeSetup } = require('./_base-ide');
|
||||
const chalk = require('chalk');
|
||||
const { AgentCommandGenerator } = require('./shared/agent-command-generator');
|
||||
|
||||
/**
|
||||
* iFlow CLI setup handler
|
||||
@@ -31,21 +32,23 @@ class IFlowSetup extends BaseIdeSetup {
|
||||
await this.ensureDir(agentsDir);
|
||||
await this.ensureDir(tasksDir);
|
||||
|
||||
// Get agents and tasks
|
||||
const agents = await this.getAgents(bmadDir);
|
||||
const tasks = await this.getTasks(bmadDir);
|
||||
// Generate agent launchers
|
||||
const agentGen = new AgentCommandGenerator(this.bmadFolderName);
|
||||
const { artifacts: agentArtifacts } = await agentGen.collectAgentArtifacts(bmadDir, options.selectedModules || []);
|
||||
|
||||
// Setup agents as commands
|
||||
let agentCount = 0;
|
||||
for (const agent of agents) {
|
||||
const content = await this.readFile(agent.path);
|
||||
const commandContent = await this.createAgentCommand(agent, content);
|
||||
for (const artifact of agentArtifacts) {
|
||||
const commandContent = await this.createAgentCommand(artifact);
|
||||
|
||||
const targetPath = path.join(agentsDir, `${agent.module}-${agent.name}.md`);
|
||||
const targetPath = path.join(agentsDir, `${artifact.module}-${artifact.name}.md`);
|
||||
await this.writeFile(targetPath, commandContent);
|
||||
agentCount++;
|
||||
}
|
||||
|
||||
// Get tasks
|
||||
const tasks = await this.getTasks(bmadDir);
|
||||
|
||||
// Setup tasks as commands
|
||||
let taskCount = 0;
|
||||
for (const task of tasks) {
|
||||
@@ -72,29 +75,9 @@ class IFlowSetup extends BaseIdeSetup {
|
||||
/**
|
||||
* Create agent command content
|
||||
*/
|
||||
async createAgentCommand(agent, content) {
|
||||
// Extract metadata
|
||||
const titleMatch = content.match(/title="([^"]+)"/);
|
||||
const title = titleMatch ? titleMatch[1] : this.formatTitle(agent.name);
|
||||
|
||||
// Get the activation header from central template
|
||||
const activationHeader = await this.getAgentCommandHeader();
|
||||
|
||||
let commandContent = `# /${agent.name} Command
|
||||
|
||||
${activationHeader}
|
||||
|
||||
## ${title} Agent
|
||||
|
||||
${content}
|
||||
|
||||
## Usage
|
||||
|
||||
This command activates the ${title} agent from the BMAD ${agent.module.toUpperCase()} module.
|
||||
|
||||
`;
|
||||
|
||||
return commandContent;
|
||||
async createAgentCommand(artifact) {
|
||||
// The launcher content is already complete - just return it as-is
|
||||
return artifact.content;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user