mirror of
https://github.com/bmadcode/BMAD-METHOD.git
synced 2025-12-17 17:55:34 +00:00
Major Changes: - Add sample custom agents demonstrating installable agent system - commit-poet: Generates semantic commit messages (BMAD Method repo sample) - toolsmith: Development tooling expert with knowledge base covering bundlers, deployment, docs, installers, modules, and tests (BMAD Method repo sample) - Both agents demonstrate custom agent architecture and are installable to projects via BMAD installer system - Include comprehensive installation guides and sidecar knowledge bases - Add bmad-quick-flow methodology for rapid development - create-tech-spec: Direct technical specification workflow - quick-dev: Flexible execution workflow supporting both tech-spec-driven and direct instruction development - quick-flow-solo-dev (Barry): 1 man show agent specialized in bmad-quick-flow methodology - Comprehensive documentation for quick-flow approach and solo development - Remove deprecated tech-spec workflow track - Delete entire tech-spec workflow directory and templates - Remove quick-spec-flow.md documentation (replaced by quick-flow docs) - Clean up unused epic and story templates - Fix custom agent installation across IDE installers - Repair antigravity and multiple IDE installers to properly support custom agents - Enable custom agent installation via quick installer, agent installer, regular installer, and special agent installer - All installation methods now accessible via npx with full documentation Infrastructure: - Update BMM module configurations and team setups - Modify workflow status paths to support quick-flow integration - Reorganize documentation with new agent and workflow guides - Add custom/ directory for user customizations - Update platform codes and installer configurations
173 lines
5.2 KiB
JavaScript
173 lines
5.2 KiB
JavaScript
const path = require('node:path');
|
|
const fs = require('fs-extra');
|
|
const { BaseIdeSetup } = require('./_base-ide');
|
|
const chalk = require('chalk');
|
|
const { AgentCommandGenerator } = require('./shared/agent-command-generator');
|
|
|
|
/**
|
|
* iFlow CLI setup handler
|
|
* Creates commands in .iflow/commands/ directory structure
|
|
*/
|
|
class IFlowSetup extends BaseIdeSetup {
|
|
constructor() {
|
|
super('iflow', 'iFlow CLI');
|
|
this.configDir = '.iflow';
|
|
this.commandsDir = 'commands';
|
|
}
|
|
|
|
/**
|
|
* Setup iFlow CLI configuration
|
|
* @param {string} projectDir - Project directory
|
|
* @param {string} bmadDir - BMAD installation directory
|
|
* @param {Object} options - Setup options
|
|
*/
|
|
async setup(projectDir, bmadDir, options = {}) {
|
|
console.log(chalk.cyan(`Setting up ${this.name}...`));
|
|
|
|
// Create .iflow/commands/bmad directory structure
|
|
const iflowDir = path.join(projectDir, this.configDir);
|
|
const commandsDir = path.join(iflowDir, this.commandsDir, 'bmad');
|
|
const agentsDir = path.join(commandsDir, 'agents');
|
|
const tasksDir = path.join(commandsDir, 'tasks');
|
|
|
|
await this.ensureDir(agentsDir);
|
|
await this.ensureDir(tasksDir);
|
|
|
|
// 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 artifact of agentArtifacts) {
|
|
const commandContent = await this.createAgentCommand(artifact);
|
|
|
|
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) {
|
|
const content = await this.readFile(task.path);
|
|
const commandContent = this.createTaskCommand(task, content);
|
|
|
|
const targetPath = path.join(tasksDir, `${task.module}-${task.name}.md`);
|
|
await this.writeFile(targetPath, commandContent);
|
|
taskCount++;
|
|
}
|
|
|
|
console.log(chalk.green(`✓ ${this.name} configured:`));
|
|
console.log(chalk.dim(` - ${agentCount} agent commands created`));
|
|
console.log(chalk.dim(` - ${taskCount} task commands created`));
|
|
console.log(chalk.dim(` - Commands directory: ${path.relative(projectDir, commandsDir)}`));
|
|
|
|
return {
|
|
success: true,
|
|
agents: agentCount,
|
|
tasks: taskCount,
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Create agent command content
|
|
*/
|
|
async createAgentCommand(artifact) {
|
|
// The launcher content is already complete - just return it as-is
|
|
return artifact.content;
|
|
}
|
|
|
|
/**
|
|
* Create task command content
|
|
*/
|
|
createTaskCommand(task, content) {
|
|
// Extract task name
|
|
const nameMatch = content.match(/<name>([^<]+)<\/name>/);
|
|
const taskName = nameMatch ? nameMatch[1] : this.formatTitle(task.name);
|
|
|
|
let commandContent = `# /task-${task.name} Command
|
|
|
|
When this command is used, execute the following task:
|
|
|
|
## ${taskName} Task
|
|
|
|
${content}
|
|
|
|
## Usage
|
|
|
|
This command executes the ${taskName} task from the BMAD ${task.module.toUpperCase()} module.
|
|
|
|
## Module
|
|
|
|
Part of the BMAD ${task.module.toUpperCase()} module.
|
|
`;
|
|
|
|
return commandContent;
|
|
}
|
|
|
|
/**
|
|
* Cleanup iFlow configuration
|
|
*/
|
|
async cleanup(projectDir) {
|
|
const fs = require('fs-extra');
|
|
const bmadCommandsDir = path.join(projectDir, this.configDir, this.commandsDir, 'bmad');
|
|
|
|
if (await fs.pathExists(bmadCommandsDir)) {
|
|
await fs.remove(bmadCommandsDir);
|
|
console.log(chalk.dim(`Removed BMAD commands from iFlow CLI`));
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Install a custom agent launcher for iFlow
|
|
* @param {string} projectDir - Project directory
|
|
* @param {string} agentName - Agent name (e.g., "fred-commit-poet")
|
|
* @param {string} agentPath - Path to compiled agent (relative to project root)
|
|
* @param {Object} metadata - Agent metadata
|
|
* @returns {Object} Installation result
|
|
*/
|
|
async installCustomAgentLauncher(projectDir, agentName, agentPath, metadata) {
|
|
const iflowDir = path.join(projectDir, this.configDir);
|
|
const bmadCommandsDir = path.join(iflowDir, this.commandsDir, 'bmad');
|
|
|
|
// Create .iflow/commands/bmad directory if it doesn't exist
|
|
await fs.ensureDir(bmadCommandsDir);
|
|
|
|
// Create custom agent launcher
|
|
const launcherContent = `# ${agentName} Custom Agent
|
|
|
|
**⚠️ IMPORTANT**: Run @${agentPath} first to load the complete agent!
|
|
|
|
This is a launcher for the custom BMAD agent "${agentName}".
|
|
|
|
## Usage
|
|
1. First run: \`${agentPath}\` to load the complete agent
|
|
2. Then use this command to activate ${agentName}
|
|
|
|
The agent will follow the persona and instructions from the main agent file.
|
|
|
|
---
|
|
|
|
*Generated by BMAD Method*`;
|
|
|
|
const fileName = `custom-${agentName.toLowerCase()}.md`;
|
|
const launcherPath = path.join(bmadCommandsDir, fileName);
|
|
|
|
// Write the launcher file
|
|
await fs.writeFile(launcherPath, launcherContent, 'utf8');
|
|
|
|
return {
|
|
ide: 'iflow',
|
|
path: path.relative(projectDir, launcherPath),
|
|
command: agentName,
|
|
type: 'custom-agent-launcher',
|
|
};
|
|
}
|
|
}
|
|
|
|
module.exports = { IFlowSetup };
|