opencode moved agents back to agent folder

This commit is contained in:
Brian Madison
2025-10-28 17:18:53 -05:00
parent ee58586f39
commit 3fff30ca61
79 changed files with 8642 additions and 103 deletions

View File

@@ -22,43 +22,45 @@ class GeminiSetup extends BaseIdeSetup {
async setup(projectDir, bmadDir, options = {}) {
console.log(chalk.cyan(`Setting up ${this.name}...`));
// Create .gemini/commands/agents and .gemini/commands/tasks directories
// Create .gemini/commands directory (flat structure with bmad- prefix)
const geminiDir = path.join(projectDir, this.configDir);
const commandsDir = path.join(geminiDir, this.commandsDir);
const agentsDir = path.join(commandsDir, 'agents');
const tasksDir = path.join(commandsDir, 'tasks');
await this.ensureDir(agentsDir);
await this.ensureDir(tasksDir);
await this.ensureDir(commandsDir);
// Clean up any existing BMAD files before reinstalling
await this.cleanup(projectDir);
// Get agents and tasks
const agents = await this.getAgents(bmadDir);
const tasks = await this.getTasks(bmadDir);
// Install agents as TOML files
// Install agents as TOML files with bmad- prefix (flat structure)
let agentCount = 0;
for (const agent of agents) {
const content = await this.readFile(agent.path);
const tomlContent = this.createAgentToml(agent, content, bmadDir);
const tomlPath = path.join(agentsDir, `${agent.name}.toml`);
// Flat structure: bmad-agent-{module}-{name}.toml
const tomlPath = path.join(commandsDir, `bmad-agent-${agent.module}-${agent.name}.toml`);
await this.writeFile(tomlPath, tomlContent);
agentCount++;
console.log(chalk.green(` ✓ Added agent: /bmad:agents:${agent.name}`));
console.log(chalk.green(` ✓ Added agent: /bmad:agents:${agent.module}:${agent.name}`));
}
// Install tasks as TOML files
// Install tasks as TOML files with bmad- prefix (flat structure)
let taskCount = 0;
for (const task of tasks) {
const content = await this.readFile(task.path);
const tomlContent = this.createTaskToml(task, content, bmadDir);
const tomlPath = path.join(tasksDir, `${task.name}.toml`);
// Flat structure: bmad-task-{module}-{name}.toml
const tomlPath = path.join(commandsDir, `bmad-task-${task.module}-${task.name}.toml`);
await this.writeFile(tomlPath, tomlContent);
taskCount++;
console.log(chalk.green(` ✓ Added task: /bmad:tasks:${task.name}`));
console.log(chalk.green(` ✓ Added task: /bmad:tasks:${task.module}:${task.name}`));
}
console.log(chalk.green(`${this.name} configured:`));
@@ -126,34 +128,28 @@ Follow all instructions and complete the task as defined.
}
/**
* Cleanup Gemini configuration
* Cleanup Gemini configuration - surgically remove only BMAD files
*/
async cleanup(projectDir) {
const fs = require('fs-extra');
const commandsDir = path.join(projectDir, this.configDir, this.commandsDir);
const agentsDir = path.join(commandsDir, 'agents');
const tasksDir = path.join(commandsDir, 'tasks');
// Remove BMAD TOML files
if (await fs.pathExists(agentsDir)) {
const files = await fs.readdir(agentsDir);
if (await fs.pathExists(commandsDir)) {
// Only remove files that start with bmad- prefix
const files = await fs.readdir(commandsDir);
let removed = 0;
for (const file of files) {
if (file.endsWith('.toml')) {
await fs.remove(path.join(agentsDir, file));
if (file.startsWith('bmad-') && file.endsWith('.toml')) {
await fs.remove(path.join(commandsDir, file));
removed++;
}
}
}
if (await fs.pathExists(tasksDir)) {
const files = await fs.readdir(tasksDir);
for (const file of files) {
if (file.endsWith('.toml')) {
await fs.remove(path.join(tasksDir, file));
}
if (removed > 0) {
console.log(chalk.dim(` Cleaned up ${removed} existing BMAD files`));
}
}
console.log(chalk.dim(`Removed BMAD configuration from Gemini CLI`));
}
}

View File

@@ -101,20 +101,24 @@ class GitHubCopilotSetup extends BaseIdeSetup {
const chatmodesDir = path.join(githubDir, this.chatmodesDir);
await this.ensureDir(chatmodesDir);
// Clean up any existing BMAD files before reinstalling
await this.cleanup(projectDir);
// Get agents
const agents = await this.getAgents(bmadDir);
// Create chat mode files
// Create chat mode files with bmad- prefix
let modeCount = 0;
for (const agent of agents) {
const content = await this.readFile(agent.path);
const chatmodeContent = this.createChatmodeContent(agent, content);
const targetPath = path.join(chatmodesDir, `${agent.module}-${agent.name}.chatmode.md`);
// Use bmad- prefix: bmad-agent-{module}-{name}.chatmode.md
const targetPath = path.join(chatmodesDir, `bmad-agent-${agent.module}-${agent.name}.chatmode.md`);
await this.writeFile(targetPath, chatmodeContent);
modeCount++;
console.log(chalk.green(` ✓ Created chat mode: ${agent.module}-${agent.name}`));
console.log(chalk.green(` ✓ Created chat mode: bmad-agent-${agent.module}-${agent.name}`));
}
console.log(chalk.green(`${this.name} configured:`));
@@ -258,30 +262,27 @@ Part of the BMAD ${agent.module.toUpperCase()} module.
}
/**
* Cleanup GitHub Copilot configuration
* Cleanup GitHub Copilot configuration - surgically remove only BMAD files
*/
async cleanup(projectDir) {
const fs = require('fs-extra');
const chatmodesDir = path.join(projectDir, this.configDir, this.chatmodesDir);
if (await fs.pathExists(chatmodesDir)) {
// Remove BMAD chat modes
// Only remove files that start with bmad- prefix
const files = await fs.readdir(chatmodesDir);
let removed = 0;
for (const file of files) {
if (file.endsWith('.chatmode.md')) {
const filePath = path.join(chatmodesDir, file);
const content = await fs.readFile(filePath, 'utf8');
if (content.includes('BMAD') && content.includes('Module')) {
await fs.remove(filePath);
removed++;
}
if (file.startsWith('bmad-') && file.endsWith('.chatmode.md')) {
await fs.remove(path.join(chatmodesDir, file));
removed++;
}
}
console.log(chalk.dim(`Removed ${removed} BMAD chat modes from GitHub Copilot`));
if (removed > 0) {
console.log(chalk.dim(` Cleaned up ${removed} existing BMAD chat modes`));
}
}
}
}

View File

@@ -25,11 +25,16 @@ class OpenCodeSetup extends BaseIdeSetup {
const baseDir = path.join(projectDir, this.configDir);
const commandsBaseDir = path.join(baseDir, this.commandsDir);
const agentsBaseDir = path.join(baseDir, this.agentsDir);
await this.ensureDir(commandsBaseDir);
await this.ensureDir(agentsBaseDir);
// Clean up any existing BMAD files before reinstalling
await this.cleanup(projectDir);
// Install primary agents with flat naming: bmad-agent-{module}-{name}.md
// OpenCode puts agents in the command folder, not a separate agent folder
// OpenCode agents go in the agent folder (not command folder)
const agents = await getAgentsFromBmad(bmadDir, options.selectedModules || []);
let agentCount = 0;
@@ -40,8 +45,8 @@ class OpenCodeSetup extends BaseIdeSetup {
});
const agentContent = this.createAgentContent(processed, agent);
// Flat structure in command folder: bmad-agent-{module}-{name}.md
const targetPath = path.join(commandsBaseDir, `bmad-agent-${agent.module}-${agent.name}.md`);
// Flat structure in agent folder: bmad-agent-{module}-{name}.md
const targetPath = path.join(agentsBaseDir, `bmad-agent-${agent.module}-${agent.name}.md`);
await this.writeFile(targetPath, agentContent);
agentCount++;
}
@@ -68,7 +73,7 @@ class OpenCodeSetup extends BaseIdeSetup {
const { tasks, tools } = await this.generateFlatTaskToolCommands(bmadDir, commandsBaseDir);
console.log(chalk.green(`${this.name} configured:`));
console.log(chalk.dim(` - ${agentCount} agents installed to .opencode/command/`));
console.log(chalk.dim(` - ${agentCount} agents installed to .opencode/agent/`));
if (workflowCommandCount > 0) {
console.log(chalk.dim(` - ${workflowCommandCount} workflows installed to .opencode/command/`));
}
@@ -168,6 +173,41 @@ class OpenCodeSetup extends BaseIdeSetup {
return `---\n${yamlText}\n---`;
}
/**
* Cleanup OpenCode configuration - surgically remove only BMAD files
*/
async cleanup(projectDir) {
const agentsDir = path.join(projectDir, this.configDir, this.agentsDir);
const commandsDir = path.join(projectDir, this.configDir, this.commandsDir);
let removed = 0;
// Clean up agent folder
if (await fs.pathExists(agentsDir)) {
const files = await fs.readdir(agentsDir);
for (const file of files) {
if (file.startsWith('bmad-') && file.endsWith('.md')) {
await fs.remove(path.join(agentsDir, file));
removed++;
}
}
}
// Clean up command folder
if (await fs.pathExists(commandsDir)) {
const files = await fs.readdir(commandsDir);
for (const file of files) {
if (file.startsWith('bmad-') && file.endsWith('.md')) {
await fs.remove(path.join(commandsDir, file));
removed++;
}
}
}
if (removed > 0) {
console.log(chalk.dim(` Cleaned up ${removed} existing BMAD files`));
}
}
}
module.exports = { OpenCodeSetup };

View File

@@ -27,52 +27,59 @@ class TraeSetup extends BaseIdeSetup {
await this.ensureDir(rulesDir);
// Clean up any existing BMAD files before reinstalling
await this.cleanup(projectDir);
// Get agents, tasks, tools, and workflows (standalone only)
const agents = await this.getAgents(bmadDir);
const tasks = await this.getTasks(bmadDir, true);
const tools = await this.getTools(bmadDir, true);
const workflows = await this.getWorkflows(bmadDir, true);
// Process agents as rules
// Process agents as rules with bmad- prefix
let agentCount = 0;
for (const agent of agents) {
const content = await this.readFile(agent.path);
const processedContent = this.createAgentRule(agent, content, bmadDir, projectDir);
const targetPath = path.join(rulesDir, `${agent.module}-${agent.name}.md`);
// Use bmad- prefix: bmad-agent-{module}-{name}.md
const targetPath = path.join(rulesDir, `bmad-agent-${agent.module}-${agent.name}.md`);
await this.writeFile(targetPath, processedContent);
agentCount++;
}
// Process tasks as rules
// Process tasks as rules with bmad- prefix
let taskCount = 0;
for (const task of tasks) {
const content = await this.readFile(task.path);
const processedContent = this.createTaskRule(task, content);
const targetPath = path.join(rulesDir, `task-${task.module}-${task.name}.md`);
// Use bmad- prefix: bmad-task-{module}-{name}.md
const targetPath = path.join(rulesDir, `bmad-task-${task.module}-${task.name}.md`);
await this.writeFile(targetPath, processedContent);
taskCount++;
}
// Process tools as rules
// Process tools as rules with bmad- prefix
let toolCount = 0;
for (const tool of tools) {
const content = await this.readFile(tool.path);
const processedContent = this.createToolRule(tool, content);
const targetPath = path.join(rulesDir, `tool-${tool.module}-${tool.name}.md`);
// Use bmad- prefix: bmad-tool-{module}-{name}.md
const targetPath = path.join(rulesDir, `bmad-tool-${tool.module}-${tool.name}.md`);
await this.writeFile(targetPath, processedContent);
toolCount++;
}
// Process workflows as rules
// Process workflows as rules with bmad- prefix
let workflowCount = 0;
for (const workflow of workflows) {
const content = await this.readFile(workflow.path);
const processedContent = this.createWorkflowRule(workflow, content);
const targetPath = path.join(rulesDir, `workflow-${workflow.module}-${workflow.name}.md`);
// Use bmad- prefix: bmad-workflow-{module}-{name}.md
const targetPath = path.join(rulesDir, `bmad-workflow-${workflow.module}-${workflow.name}.md`);
await this.writeFile(targetPath, processedContent);
workflowCount++;
}
@@ -243,31 +250,27 @@ Part of the BMAD ${workflow.module.toUpperCase()} module.
}
/**
* Cleanup Trae configuration
* Cleanup Trae configuration - surgically remove only BMAD files
*/
async cleanup(projectDir) {
const fs = require('fs-extra');
const rulesPath = path.join(projectDir, this.configDir, this.rulesDir);
if (await fs.pathExists(rulesPath)) {
// Only remove BMAD rules
// Only remove files that start with bmad- prefix
const files = await fs.readdir(rulesPath);
let removed = 0;
for (const file of files) {
if (file.endsWith('.md')) {
const filePath = path.join(rulesPath, file);
const content = await fs.readFile(filePath, 'utf8');
// Check if it's a BMAD rule
if (content.includes('BMAD') && content.includes('module')) {
await fs.remove(filePath);
removed++;
}
if (file.startsWith('bmad-') && file.endsWith('.md')) {
await fs.remove(path.join(rulesPath, file));
removed++;
}
}
console.log(chalk.dim(`Removed ${removed} BMAD rules from Trae`));
if (removed > 0) {
console.log(chalk.dim(` Cleaned up ${removed} existing BMAD rules`));
}
}
}
}

View File

@@ -21,11 +21,15 @@ class WindsurfSetup extends BaseIdeSetup {
async setup(projectDir, bmadDir, options = {}) {
console.log(chalk.cyan(`Setting up ${this.name}...`));
// Create .windsurf/workflows directory structure
// Create .windsurf/workflows/bmad directory structure
const windsurfDir = path.join(projectDir, this.configDir);
const workflowsDir = path.join(windsurfDir, this.workflowsDir);
const bmadWorkflowsDir = path.join(workflowsDir, 'bmad');
await this.ensureDir(workflowsDir);
await this.ensureDir(bmadWorkflowsDir);
// Clean up any existing BMAD workflows before reinstalling
await this.cleanup(projectDir);
// Get agents, tasks, tools, and workflows (standalone only)
const agents = await this.getAgents(bmadDir);
@@ -33,16 +37,16 @@ class WindsurfSetup extends BaseIdeSetup {
const tools = await this.getTools(bmadDir, true);
const workflows = await this.getWorkflows(bmadDir, true);
// Create directories for each module
// Create directories for each module under bmad/
const modules = new Set();
for (const item of [...agents, ...tasks, ...tools, ...workflows]) modules.add(item.module);
for (const module of modules) {
await this.ensureDir(path.join(workflowsDir, module));
await this.ensureDir(path.join(workflowsDir, module, 'agents'));
await this.ensureDir(path.join(workflowsDir, module, 'tasks'));
await this.ensureDir(path.join(workflowsDir, module, 'tools'));
await this.ensureDir(path.join(workflowsDir, module, 'workflows'));
await this.ensureDir(path.join(bmadWorkflowsDir, module));
await this.ensureDir(path.join(bmadWorkflowsDir, module, 'agents'));
await this.ensureDir(path.join(bmadWorkflowsDir, module, 'tasks'));
await this.ensureDir(path.join(bmadWorkflowsDir, module, 'tools'));
await this.ensureDir(path.join(bmadWorkflowsDir, module, 'workflows'));
}
// Process agents as workflows with organized structure
@@ -51,8 +55,8 @@ class WindsurfSetup extends BaseIdeSetup {
const content = await this.readFile(agent.path);
const processedContent = this.createWorkflowContent(agent, content);
// Organized path: module/agents/agent-name.md
const targetPath = path.join(workflowsDir, agent.module, 'agents', `${agent.name}.md`);
// Organized path: bmad/module/agents/agent-name.md
const targetPath = path.join(bmadWorkflowsDir, agent.module, 'agents', `${agent.name}.md`);
await this.writeFile(targetPath, processedContent);
agentCount++;
}
@@ -63,8 +67,8 @@ class WindsurfSetup extends BaseIdeSetup {
const content = await this.readFile(task.path);
const processedContent = this.createTaskWorkflowContent(task, content);
// Organized path: module/tasks/task-name.md
const targetPath = path.join(workflowsDir, task.module, 'tasks', `${task.name}.md`);
// Organized path: bmad/module/tasks/task-name.md
const targetPath = path.join(bmadWorkflowsDir, task.module, 'tasks', `${task.name}.md`);
await this.writeFile(targetPath, processedContent);
taskCount++;
}
@@ -75,8 +79,8 @@ class WindsurfSetup extends BaseIdeSetup {
const content = await this.readFile(tool.path);
const processedContent = this.createToolWorkflowContent(tool, content);
// Organized path: module/tools/tool-name.md
const targetPath = path.join(workflowsDir, tool.module, 'tools', `${tool.name}.md`);
// Organized path: bmad/module/tools/tool-name.md
const targetPath = path.join(bmadWorkflowsDir, tool.module, 'tools', `${tool.name}.md`);
await this.writeFile(targetPath, processedContent);
toolCount++;
}
@@ -87,8 +91,8 @@ class WindsurfSetup extends BaseIdeSetup {
const content = await this.readFile(workflow.path);
const processedContent = this.createWorkflowWorkflowContent(workflow, content);
// Organized path: module/workflows/workflow-name.md
const targetPath = path.join(workflowsDir, workflow.module, 'workflows', `${workflow.name}.md`);
// Organized path: bmad/module/workflows/workflow-name.md
const targetPath = path.join(bmadWorkflowsDir, workflow.module, 'workflows', `${workflow.name}.md`);
await this.writeFile(targetPath, processedContent);
workflowCount++;
}
@@ -180,31 +184,16 @@ ${content}`;
}
/**
* Cleanup Windsurf configuration
* Cleanup Windsurf configuration - surgically remove only BMAD files
*/
async cleanup(projectDir) {
const fs = require('fs-extra');
const windsurfPath = path.join(projectDir, this.configDir, this.workflowsDir);
const bmadPath = path.join(projectDir, this.configDir, this.workflowsDir, 'bmad');
if (await fs.pathExists(windsurfPath)) {
// Only remove BMAD workflows, not all workflows
const files = await fs.readdir(windsurfPath);
let removed = 0;
for (const file of files) {
if (file.includes('-') && file.endsWith('.md')) {
const filePath = path.join(windsurfPath, file);
const content = await fs.readFile(filePath, 'utf8');
// Check if it's a BMAD workflow
if (content.includes('tags: [bmad')) {
await fs.remove(filePath);
removed++;
}
}
}
console.log(chalk.dim(`Removed ${removed} BMAD workflows from Windsurf`));
if (await fs.pathExists(bmadPath)) {
// Remove the entire bmad folder - this is our territory
await fs.remove(bmadPath);
console.log(chalk.dim(` Cleaned up existing BMAD workflows`));
}
}
}