bmad-method 6.0.0-Beta.0 → 6.0.0-Beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -1
- package/package.json +1 -1
- package/src/bmm/module-help.csv +31 -31
- package/src/bmm/workflows/bmad-quick-flow/quick-spec/steps/step-04-review.md +1 -1
- package/src/core/module-help.csv +8 -8
- package/tools/cli/installers/install-messages.yaml +11 -10
- package/tools/cli/installers/lib/core/installer.js +26 -40
- package/tools/cli/installers/lib/ide/_config-driven.js +423 -0
- package/tools/cli/installers/lib/ide/codex.js +40 -12
- package/tools/cli/installers/lib/ide/manager.js +65 -38
- package/tools/cli/installers/lib/ide/platform-codes.js +100 -0
- package/tools/cli/installers/lib/ide/platform-codes.yaml +241 -0
- package/tools/cli/installers/lib/ide/shared/agent-command-generator.js +19 -5
- package/tools/cli/installers/lib/ide/shared/bmad-artifacts.js +5 -0
- package/tools/cli/installers/lib/ide/shared/path-utils.js +166 -50
- package/tools/cli/installers/lib/ide/shared/task-tool-command-generator.js +7 -5
- package/tools/cli/installers/lib/ide/shared/workflow-command-generator.js +21 -3
- package/tools/cli/installers/lib/ide/templates/combined/antigravity.md +8 -0
- package/tools/cli/installers/lib/ide/templates/combined/default-agent.md +15 -0
- package/tools/cli/installers/lib/ide/templates/combined/default-workflow-yaml.md +14 -0
- package/tools/cli/installers/lib/ide/templates/combined/default-workflow.md +6 -0
- package/tools/cli/installers/lib/ide/templates/combined/rovodev.md +9 -0
- package/tools/cli/installers/lib/ide/templates/combined/trae.md +9 -0
- package/tools/cli/installers/lib/ide/templates/combined/windsurf-workflow.md +10 -0
- package/tools/cli/installers/lib/ide/templates/split/gemini/body.md +10 -0
- package/tools/cli/installers/lib/ide/templates/split/gemini/header.toml +2 -0
- package/tools/cli/installers/lib/ide/templates/split/opencode/body.md +10 -0
- package/tools/cli/installers/lib/ide/templates/split/opencode/header.md +4 -0
- package/tools/cli/lib/ui.js +19 -75
- package/tools/cli/installers/lib/ide/STANDARDIZATION_PLAN.md +0 -208
- package/tools/cli/installers/lib/ide/antigravity.js +0 -474
- package/tools/cli/installers/lib/ide/auggie.js +0 -244
- package/tools/cli/installers/lib/ide/claude-code.js +0 -506
- package/tools/cli/installers/lib/ide/cline.js +0 -272
- package/tools/cli/installers/lib/ide/crush.js +0 -149
- package/tools/cli/installers/lib/ide/cursor.js +0 -160
- package/tools/cli/installers/lib/ide/gemini.js +0 -301
- package/tools/cli/installers/lib/ide/github-copilot.js +0 -383
- package/tools/cli/installers/lib/ide/iflow.js +0 -191
- package/tools/cli/installers/lib/ide/opencode.js +0 -257
- package/tools/cli/installers/lib/ide/qwen.js +0 -372
- package/tools/cli/installers/lib/ide/roo.js +0 -273
- package/tools/cli/installers/lib/ide/rovo-dev.js +0 -290
- package/tools/cli/installers/lib/ide/trae.js +0 -313
- package/tools/cli/installers/lib/ide/windsurf.js +0 -258
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
const path = require('node:path');
|
|
2
|
-
const fs = require('fs-extra');
|
|
3
|
-
const { BaseIdeSetup } = require('./_base-ide');
|
|
4
|
-
const chalk = require('chalk');
|
|
5
|
-
const { AgentCommandGenerator } = require('./shared/agent-command-generator');
|
|
6
|
-
const { WorkflowCommandGenerator } = require('./shared/workflow-command-generator');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* iFlow CLI setup handler
|
|
10
|
-
* Creates commands in .iflow/commands/ directory structure
|
|
11
|
-
*/
|
|
12
|
-
class IFlowSetup extends BaseIdeSetup {
|
|
13
|
-
constructor() {
|
|
14
|
-
super('iflow', 'iFlow CLI');
|
|
15
|
-
this.configDir = '.iflow';
|
|
16
|
-
this.commandsDir = 'commands';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Setup iFlow CLI configuration
|
|
21
|
-
* @param {string} projectDir - Project directory
|
|
22
|
-
* @param {string} bmadDir - BMAD installation directory
|
|
23
|
-
* @param {Object} options - Setup options
|
|
24
|
-
*/
|
|
25
|
-
async setup(projectDir, bmadDir, options = {}) {
|
|
26
|
-
console.log(chalk.cyan(`Setting up ${this.name}...`));
|
|
27
|
-
|
|
28
|
-
// Create .iflow/commands/bmad directory structure
|
|
29
|
-
const iflowDir = path.join(projectDir, this.configDir);
|
|
30
|
-
const commandsDir = path.join(iflowDir, this.commandsDir, 'bmad');
|
|
31
|
-
const agentsDir = path.join(commandsDir, 'agents');
|
|
32
|
-
const tasksDir = path.join(commandsDir, 'tasks');
|
|
33
|
-
const workflowsDir = path.join(commandsDir, 'workflows');
|
|
34
|
-
|
|
35
|
-
await this.ensureDir(agentsDir);
|
|
36
|
-
await this.ensureDir(tasksDir);
|
|
37
|
-
await this.ensureDir(workflowsDir);
|
|
38
|
-
|
|
39
|
-
// Generate agent launchers
|
|
40
|
-
const agentGen = new AgentCommandGenerator(this.bmadFolderName);
|
|
41
|
-
const { artifacts: agentArtifacts } = await agentGen.collectAgentArtifacts(bmadDir, options.selectedModules || []);
|
|
42
|
-
|
|
43
|
-
// Setup agents as commands
|
|
44
|
-
let agentCount = 0;
|
|
45
|
-
for (const artifact of agentArtifacts) {
|
|
46
|
-
const commandContent = await this.createAgentCommand(artifact);
|
|
47
|
-
|
|
48
|
-
const targetPath = path.join(agentsDir, `${artifact.module}-${artifact.name}.md`);
|
|
49
|
-
await this.writeFile(targetPath, commandContent);
|
|
50
|
-
agentCount++;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Get tasks and workflows (ALL workflows now generate commands)
|
|
54
|
-
const tasks = await this.getTasks(bmadDir);
|
|
55
|
-
|
|
56
|
-
// Get ALL workflows using the new workflow command generator
|
|
57
|
-
const workflowGenerator = new WorkflowCommandGenerator(this.bmadFolderName);
|
|
58
|
-
const { artifacts: workflowArtifacts, counts: workflowCounts } = await workflowGenerator.collectWorkflowArtifacts(bmadDir);
|
|
59
|
-
|
|
60
|
-
// Setup tasks as commands
|
|
61
|
-
let taskCount = 0;
|
|
62
|
-
for (const task of tasks) {
|
|
63
|
-
const content = await this.readFile(task.path);
|
|
64
|
-
const commandContent = this.createTaskCommand(task, content);
|
|
65
|
-
|
|
66
|
-
const targetPath = path.join(tasksDir, `${task.module}-${task.name}.md`);
|
|
67
|
-
await this.writeFile(targetPath, commandContent);
|
|
68
|
-
taskCount++;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Setup workflows as commands (already generated)
|
|
72
|
-
let workflowCount = 0;
|
|
73
|
-
for (const artifact of workflowArtifacts) {
|
|
74
|
-
if (artifact.type === 'workflow-command') {
|
|
75
|
-
const targetPath = path.join(workflowsDir, `${artifact.module}-${path.basename(artifact.relativePath, '.md')}.md`);
|
|
76
|
-
await this.writeFile(targetPath, artifact.content);
|
|
77
|
-
workflowCount++;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
console.log(chalk.green(`✓ ${this.name} configured:`));
|
|
82
|
-
console.log(chalk.dim(` - ${agentCount} agent commands created`));
|
|
83
|
-
console.log(chalk.dim(` - ${taskCount} task commands created`));
|
|
84
|
-
console.log(chalk.dim(` - ${workflowCount} workflow commands created`));
|
|
85
|
-
console.log(chalk.dim(` - Commands directory: ${path.relative(projectDir, commandsDir)}`));
|
|
86
|
-
|
|
87
|
-
return {
|
|
88
|
-
success: true,
|
|
89
|
-
agents: agentCount,
|
|
90
|
-
tasks: taskCount,
|
|
91
|
-
workflows: workflowCount,
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Create agent command content
|
|
97
|
-
*/
|
|
98
|
-
async createAgentCommand(artifact) {
|
|
99
|
-
// The launcher content is already complete - just return it as-is
|
|
100
|
-
return artifact.content;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Create task command content
|
|
105
|
-
*/
|
|
106
|
-
createTaskCommand(task, content) {
|
|
107
|
-
// Extract task name
|
|
108
|
-
const nameMatch = content.match(/<name>([^<]+)<\/name>/);
|
|
109
|
-
const taskName = nameMatch ? nameMatch[1] : this.formatTitle(task.name);
|
|
110
|
-
|
|
111
|
-
let commandContent = `# /task-${task.name} Command
|
|
112
|
-
|
|
113
|
-
When this command is used, execute the following task:
|
|
114
|
-
|
|
115
|
-
## ${taskName} Task
|
|
116
|
-
|
|
117
|
-
${content}
|
|
118
|
-
|
|
119
|
-
## Usage
|
|
120
|
-
|
|
121
|
-
This command executes the ${taskName} task from the BMAD ${task.module.toUpperCase()} module.
|
|
122
|
-
|
|
123
|
-
## Module
|
|
124
|
-
|
|
125
|
-
Part of the BMAD ${task.module.toUpperCase()} module.
|
|
126
|
-
`;
|
|
127
|
-
|
|
128
|
-
return commandContent;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Cleanup iFlow configuration
|
|
133
|
-
*/
|
|
134
|
-
async cleanup(projectDir) {
|
|
135
|
-
const fs = require('fs-extra');
|
|
136
|
-
const bmadCommandsDir = path.join(projectDir, this.configDir, this.commandsDir, 'bmad');
|
|
137
|
-
|
|
138
|
-
if (await fs.pathExists(bmadCommandsDir)) {
|
|
139
|
-
await fs.remove(bmadCommandsDir);
|
|
140
|
-
console.log(chalk.dim(`Removed BMAD commands from iFlow CLI`));
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Install a custom agent launcher for iFlow
|
|
146
|
-
* @param {string} projectDir - Project directory
|
|
147
|
-
* @param {string} agentName - Agent name (e.g., "fred-commit-poet")
|
|
148
|
-
* @param {string} agentPath - Path to compiled agent (relative to project root)
|
|
149
|
-
* @param {Object} metadata - Agent metadata
|
|
150
|
-
* @returns {Object} Installation result
|
|
151
|
-
*/
|
|
152
|
-
async installCustomAgentLauncher(projectDir, agentName, agentPath, metadata) {
|
|
153
|
-
const iflowDir = path.join(projectDir, this.configDir);
|
|
154
|
-
const bmadCommandsDir = path.join(iflowDir, this.commandsDir, 'bmad');
|
|
155
|
-
|
|
156
|
-
// Create .iflow/commands/bmad directory if it doesn't exist
|
|
157
|
-
await fs.ensureDir(bmadCommandsDir);
|
|
158
|
-
|
|
159
|
-
// Create custom agent launcher
|
|
160
|
-
const launcherContent = `# ${agentName} Custom Agent
|
|
161
|
-
|
|
162
|
-
**⚠️ IMPORTANT**: Run @${agentPath} first to load the complete agent!
|
|
163
|
-
|
|
164
|
-
This is a launcher for the custom BMAD agent "${agentName}".
|
|
165
|
-
|
|
166
|
-
## Usage
|
|
167
|
-
1. First run: \`${agentPath}\` to load the complete agent
|
|
168
|
-
2. Then use this command to activate ${agentName}
|
|
169
|
-
|
|
170
|
-
The agent will follow the persona and instructions from the main agent file.
|
|
171
|
-
|
|
172
|
-
---
|
|
173
|
-
|
|
174
|
-
*Generated by BMAD Method*`;
|
|
175
|
-
|
|
176
|
-
const fileName = `custom-${agentName.toLowerCase()}.md`;
|
|
177
|
-
const launcherPath = path.join(bmadCommandsDir, fileName);
|
|
178
|
-
|
|
179
|
-
// Write the launcher file
|
|
180
|
-
await fs.writeFile(launcherPath, launcherContent, 'utf8');
|
|
181
|
-
|
|
182
|
-
return {
|
|
183
|
-
ide: 'iflow',
|
|
184
|
-
path: path.relative(projectDir, launcherPath),
|
|
185
|
-
command: agentName,
|
|
186
|
-
type: 'custom-agent-launcher',
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
module.exports = { IFlowSetup };
|
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
const path = require('node:path');
|
|
2
|
-
const fs = require('fs-extra');
|
|
3
|
-
const os = require('node:os');
|
|
4
|
-
const chalk = require('chalk');
|
|
5
|
-
const yaml = require('yaml');
|
|
6
|
-
const { BaseIdeSetup } = require('./_base-ide');
|
|
7
|
-
const { WorkflowCommandGenerator } = require('./shared/workflow-command-generator');
|
|
8
|
-
const { TaskToolCommandGenerator } = require('./shared/task-tool-command-generator');
|
|
9
|
-
const { AgentCommandGenerator } = require('./shared/agent-command-generator');
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* OpenCode IDE setup handler
|
|
13
|
-
*/
|
|
14
|
-
class OpenCodeSetup extends BaseIdeSetup {
|
|
15
|
-
constructor() {
|
|
16
|
-
super('opencode', 'OpenCode', true); // Mark as preferred/recommended
|
|
17
|
-
this.configDir = '.opencode';
|
|
18
|
-
this.commandsDir = 'command';
|
|
19
|
-
this.agentsDir = 'agent';
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
async setup(projectDir, bmadDir, options = {}) {
|
|
23
|
-
console.log(chalk.cyan(`Setting up ${this.name}...`));
|
|
24
|
-
|
|
25
|
-
const baseDir = path.join(projectDir, this.configDir);
|
|
26
|
-
const commandsBaseDir = path.join(baseDir, this.commandsDir);
|
|
27
|
-
const agentsBaseDir = path.join(baseDir, this.agentsDir);
|
|
28
|
-
|
|
29
|
-
await this.ensureDir(commandsBaseDir);
|
|
30
|
-
await this.ensureDir(agentsBaseDir);
|
|
31
|
-
|
|
32
|
-
// Clean up any existing BMAD files before reinstalling
|
|
33
|
-
await this.cleanup(projectDir);
|
|
34
|
-
|
|
35
|
-
// Generate agent launchers
|
|
36
|
-
const agentGen = new AgentCommandGenerator(this.bmadFolderName);
|
|
37
|
-
const { artifacts: agentArtifacts } = await agentGen.collectAgentArtifacts(bmadDir, options.selectedModules || []);
|
|
38
|
-
|
|
39
|
-
// Install primary agents with flat naming: bmad-agent-{module}-{name}.md
|
|
40
|
-
// OpenCode agents go in the agent folder (not command folder)
|
|
41
|
-
let agentCount = 0;
|
|
42
|
-
for (const artifact of agentArtifacts) {
|
|
43
|
-
const agentContent = artifact.content;
|
|
44
|
-
// Flat structure in agent folder: bmad-agent-{module}-{name}.md
|
|
45
|
-
const targetPath = path.join(agentsBaseDir, `bmad-agent-${artifact.module}-${artifact.name}.md`);
|
|
46
|
-
await this.writeFile(targetPath, agentContent);
|
|
47
|
-
agentCount++;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Install workflow commands with flat naming: bmad-{module}-{workflow-name}
|
|
51
|
-
const workflowGenerator = new WorkflowCommandGenerator(this.bmadFolderName);
|
|
52
|
-
const { artifacts: workflowArtifacts, counts: workflowCounts } = await workflowGenerator.collectWorkflowArtifacts(bmadDir);
|
|
53
|
-
|
|
54
|
-
let workflowCommandCount = 0;
|
|
55
|
-
for (const artifact of workflowArtifacts) {
|
|
56
|
-
if (artifact.type === 'workflow-command') {
|
|
57
|
-
const commandContent = artifact.content;
|
|
58
|
-
// Flat structure: bmad-{module}-{workflow-name}.md
|
|
59
|
-
// artifact.relativePath is like: bmm/workflows/plan-project.md
|
|
60
|
-
const workflowName = path.basename(artifact.relativePath, '.md');
|
|
61
|
-
const targetPath = path.join(commandsBaseDir, `bmad-${artifact.module}-${workflowName}.md`);
|
|
62
|
-
await this.writeFile(targetPath, commandContent);
|
|
63
|
-
workflowCommandCount++;
|
|
64
|
-
}
|
|
65
|
-
// Skip workflow launcher READMEs as they're not needed in flat structure
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Install task and tool commands with flat naming
|
|
69
|
-
const { tasks, tools } = await this.generateFlatTaskToolCommands(bmadDir, commandsBaseDir);
|
|
70
|
-
|
|
71
|
-
console.log(chalk.green(`✓ ${this.name} configured:`));
|
|
72
|
-
console.log(chalk.dim(` - ${agentCount} agents installed to .opencode/agent/`));
|
|
73
|
-
if (workflowCommandCount > 0) {
|
|
74
|
-
console.log(chalk.dim(` - ${workflowCommandCount} workflows installed to .opencode/command/`));
|
|
75
|
-
}
|
|
76
|
-
if (tasks + tools > 0) {
|
|
77
|
-
console.log(chalk.dim(` - ${tasks + tools} tasks/tools installed to .opencode/command/ (${tasks} tasks, ${tools} tools)`));
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return {
|
|
81
|
-
success: true,
|
|
82
|
-
agents: agentCount,
|
|
83
|
-
workflows: workflowCommandCount,
|
|
84
|
-
workflowCounts,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Generate flat task and tool commands for OpenCode
|
|
90
|
-
* OpenCode doesn't support nested command directories
|
|
91
|
-
*/
|
|
92
|
-
async generateFlatTaskToolCommands(bmadDir, commandsBaseDir) {
|
|
93
|
-
const taskToolGen = new TaskToolCommandGenerator();
|
|
94
|
-
const tasks = await taskToolGen.loadTaskManifest(bmadDir);
|
|
95
|
-
const tools = await taskToolGen.loadToolManifest(bmadDir);
|
|
96
|
-
|
|
97
|
-
// Filter to only standalone items
|
|
98
|
-
const standaloneTasks = tasks ? tasks.filter((t) => t.standalone === 'true' || t.standalone === true) : [];
|
|
99
|
-
const standaloneTools = tools ? tools.filter((t) => t.standalone === 'true' || t.standalone === true) : [];
|
|
100
|
-
|
|
101
|
-
// Generate command files for tasks with flat naming: bmad-task-{module}-{name}.md
|
|
102
|
-
for (const task of standaloneTasks) {
|
|
103
|
-
const commandContent = taskToolGen.generateCommandContent(task, 'task');
|
|
104
|
-
const targetPath = path.join(commandsBaseDir, `bmad-task-${task.module}-${task.name}.md`);
|
|
105
|
-
await this.writeFile(targetPath, commandContent);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Generate command files for tools with flat naming: bmad-tool-{module}-{name}.md
|
|
109
|
-
for (const tool of standaloneTools) {
|
|
110
|
-
const commandContent = taskToolGen.generateCommandContent(tool, 'tool');
|
|
111
|
-
const targetPath = path.join(commandsBaseDir, `bmad-tool-${tool.module}-${tool.name}.md`);
|
|
112
|
-
await this.writeFile(targetPath, commandContent);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return {
|
|
116
|
-
tasks: standaloneTasks.length,
|
|
117
|
-
tools: standaloneTools.length,
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
async readAndProcess(filePath, metadata) {
|
|
122
|
-
const content = await fs.readFile(filePath, 'utf8');
|
|
123
|
-
return this.processContent(content, metadata);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
async createAgentContent(content, metadata) {
|
|
127
|
-
const { frontmatter = {}, body } = this.parseFrontmatter(content);
|
|
128
|
-
|
|
129
|
-
frontmatter.description =
|
|
130
|
-
frontmatter.description && String(frontmatter.description).trim().length > 0
|
|
131
|
-
? frontmatter.description
|
|
132
|
-
: `BMAD ${metadata.module} agent: ${metadata.name}`;
|
|
133
|
-
|
|
134
|
-
// OpenCode agents use: 'primary' mode for main agents
|
|
135
|
-
frontmatter.mode = 'primary';
|
|
136
|
-
|
|
137
|
-
const frontmatterString = this.stringifyFrontmatter(frontmatter);
|
|
138
|
-
|
|
139
|
-
// Get the activation header from central template
|
|
140
|
-
const activationHeader = await this.getAgentCommandHeader();
|
|
141
|
-
|
|
142
|
-
return `${frontmatterString}\n\n${activationHeader}\n\n${body}`;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
parseFrontmatter(content) {
|
|
146
|
-
const match = content.match(/^---\s*\n([\s\S]*?)\n---\s*\n?/);
|
|
147
|
-
if (!match) {
|
|
148
|
-
return { data: {}, body: content };
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
const body = content.slice(match[0].length);
|
|
152
|
-
|
|
153
|
-
let frontmatter = {};
|
|
154
|
-
try {
|
|
155
|
-
frontmatter = yaml.parse(match[1]) || {};
|
|
156
|
-
} catch {
|
|
157
|
-
frontmatter = {};
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
return { frontmatter, body };
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
stringifyFrontmatter(frontmatter) {
|
|
164
|
-
const yamlText = yaml
|
|
165
|
-
.dump(frontmatter, {
|
|
166
|
-
indent: 2,
|
|
167
|
-
lineWidth: -1,
|
|
168
|
-
noRefs: true,
|
|
169
|
-
sortKeys: false,
|
|
170
|
-
})
|
|
171
|
-
.trimEnd();
|
|
172
|
-
|
|
173
|
-
return `---\n${yamlText}\n---`;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Cleanup OpenCode configuration - surgically remove only BMAD files
|
|
178
|
-
*/
|
|
179
|
-
async cleanup(projectDir) {
|
|
180
|
-
const agentsDir = path.join(projectDir, this.configDir, this.agentsDir);
|
|
181
|
-
const commandsDir = path.join(projectDir, this.configDir, this.commandsDir);
|
|
182
|
-
let removed = 0;
|
|
183
|
-
|
|
184
|
-
// Clean up agent folder
|
|
185
|
-
if (await fs.pathExists(agentsDir)) {
|
|
186
|
-
const files = await fs.readdir(agentsDir);
|
|
187
|
-
for (const file of files) {
|
|
188
|
-
if (file.startsWith('bmad') && file.endsWith('.md')) {
|
|
189
|
-
await fs.remove(path.join(agentsDir, file));
|
|
190
|
-
removed++;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// Clean up command folder
|
|
196
|
-
if (await fs.pathExists(commandsDir)) {
|
|
197
|
-
const files = await fs.readdir(commandsDir);
|
|
198
|
-
for (const file of files) {
|
|
199
|
-
if (file.startsWith('bmad') && file.endsWith('.md')) {
|
|
200
|
-
await fs.remove(path.join(commandsDir, file));
|
|
201
|
-
removed++;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
if (removed > 0) {
|
|
207
|
-
console.log(chalk.dim(` Cleaned up ${removed} existing BMAD files`));
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Install a custom agent launcher for OpenCode
|
|
213
|
-
* @param {string} projectDir - Project directory
|
|
214
|
-
* @param {string} agentName - Agent name (e.g., "fred-commit-poet")
|
|
215
|
-
* @param {string} agentPath - Path to compiled agent (relative to project root)
|
|
216
|
-
* @param {Object} metadata - Agent metadata
|
|
217
|
-
* @returns {Object|null} Info about created command
|
|
218
|
-
*/
|
|
219
|
-
async installCustomAgentLauncher(projectDir, agentName, agentPath, metadata) {
|
|
220
|
-
const agentsDir = path.join(projectDir, this.configDir, this.agentsDir);
|
|
221
|
-
|
|
222
|
-
if (!(await this.exists(path.join(projectDir, this.configDir)))) {
|
|
223
|
-
return null; // IDE not configured for this project
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
await this.ensureDir(agentsDir);
|
|
227
|
-
|
|
228
|
-
const launcherContent = `---
|
|
229
|
-
name: '${agentName}'
|
|
230
|
-
description: '${metadata.title || agentName} agent'
|
|
231
|
-
mode: 'primary'
|
|
232
|
-
---
|
|
233
|
-
|
|
234
|
-
You must fully embody this agent's persona and follow all activation instructions exactly as specified. NEVER break character until given an exit command.
|
|
235
|
-
|
|
236
|
-
<agent-activation CRITICAL="TRUE">
|
|
237
|
-
1. LOAD the FULL agent file from @${agentPath}
|
|
238
|
-
2. READ its entire contents - this contains the complete agent persona, menu, and instructions
|
|
239
|
-
3. FOLLOW every step in the <activation> section precisely
|
|
240
|
-
4. DISPLAY the welcome/greeting as instructed
|
|
241
|
-
5. PRESENT the numbered menu
|
|
242
|
-
6. WAIT for user input before proceeding
|
|
243
|
-
</agent-activation>
|
|
244
|
-
`;
|
|
245
|
-
|
|
246
|
-
// OpenCode uses flat naming: bmad-agent-custom-{name}.md
|
|
247
|
-
const launcherPath = path.join(agentsDir, `bmad-agent-custom-${agentName}.md`);
|
|
248
|
-
await this.writeFile(launcherPath, launcherContent);
|
|
249
|
-
|
|
250
|
-
return {
|
|
251
|
-
path: launcherPath,
|
|
252
|
-
command: `bmad-agent-custom-${agentName}`,
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
module.exports = { OpenCodeSetup };
|