create-byan-agent 1.1.3 → 1.2.1
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 +273 -202
- package/LICENSE +21 -21
- package/README.md +1251 -421
- package/bin/create-byan-agent-backup.js +220 -220
- package/bin/create-byan-agent-fixed.js +301 -301
- package/bin/create-byan-agent.js +155 -322
- package/lib/errors.js +61 -0
- package/lib/exit-codes.js +54 -0
- package/lib/platforms/claude-code.js +113 -0
- package/lib/platforms/codex.js +92 -0
- package/lib/platforms/copilot-cli.js +123 -0
- package/lib/platforms/index.js +14 -0
- package/lib/platforms/vscode.js +51 -0
- package/lib/utils/config-loader.js +79 -0
- package/lib/utils/file-utils.js +104 -0
- package/lib/utils/git-detector.js +35 -0
- package/lib/utils/logger.js +64 -0
- package/lib/utils/node-detector.js +58 -0
- package/lib/utils/os-detector.js +74 -0
- package/lib/utils/yaml-utils.js +87 -0
- package/lib/yanstaller/backuper.js +308 -0
- package/lib/yanstaller/detector.js +141 -0
- package/lib/yanstaller/index.js +93 -0
- package/lib/yanstaller/installer.js +225 -0
- package/lib/yanstaller/interviewer.js +250 -0
- package/lib/yanstaller/recommender.js +298 -0
- package/lib/yanstaller/troubleshooter.js +498 -0
- package/lib/yanstaller/validator.js +578 -0
- package/lib/yanstaller/wizard.js +211 -0
- package/package.json +61 -55
- package/templates/.github/agents/bmad-agent-bmad-master.md +15 -15
- package/templates/.github/agents/bmad-agent-bmb-agent-builder.md +15 -15
- package/templates/.github/agents/bmad-agent-bmb-module-builder.md +15 -15
- package/templates/.github/agents/bmad-agent-bmb-workflow-builder.md +15 -15
- package/templates/.github/agents/bmad-agent-bmm-analyst.md +15 -15
- package/templates/.github/agents/bmad-agent-bmm-architect.md +15 -15
- package/templates/.github/agents/bmad-agent-bmm-dev.md +15 -15
- package/templates/.github/agents/bmad-agent-bmm-pm.md +15 -15
- package/templates/.github/agents/bmad-agent-bmm-quick-flow-solo-dev.md +15 -15
- package/templates/.github/agents/bmad-agent-bmm-quinn.md +15 -15
- package/templates/.github/agents/bmad-agent-bmm-sm.md +15 -15
- package/templates/.github/agents/bmad-agent-bmm-tech-writer.md +15 -15
- package/templates/.github/agents/bmad-agent-bmm-ux-designer.md +15 -15
- package/templates/.github/agents/bmad-agent-byan-test.md +32 -0
- package/templates/.github/agents/bmad-agent-byan.md +224 -224
- package/templates/.github/agents/bmad-agent-carmack.md +18 -0
- package/templates/.github/agents/bmad-agent-cis-brainstorming-coach.md +15 -15
- package/templates/.github/agents/bmad-agent-cis-creative-problem-solver.md +15 -15
- package/templates/.github/agents/bmad-agent-cis-design-thinking-coach.md +15 -15
- package/templates/.github/agents/bmad-agent-cis-innovation-strategist.md +15 -15
- package/templates/.github/agents/bmad-agent-cis-presentation-master.md +15 -15
- package/templates/.github/agents/bmad-agent-cis-storyteller.md +15 -15
- package/templates/.github/agents/bmad-agent-marc.md +48 -48
- package/templates/.github/agents/bmad-agent-patnote.md +48 -0
- package/templates/.github/agents/bmad-agent-rachid.md +47 -47
- package/templates/.github/agents/bmad-agent-tea-tea.md +15 -15
- package/templates/.github/agents/bmad-agent-test-dynamic.md +21 -0
- package/templates/.github/agents/expert-merise-agile.md +1 -0
- package/templates/.github/agents/franck.md +379 -0
- package/templates/_bmad/bmb/agents/agent-builder.md +59 -59
- package/templates/_bmad/bmb/agents/byan-test.md +116 -116
- package/templates/_bmad/bmb/agents/byan.md +215 -215
- package/templates/_bmad/bmb/agents/marc.md +303 -303
- package/templates/_bmad/bmb/agents/module-builder.md +60 -60
- package/templates/_bmad/bmb/agents/patnote.md +495 -495
- package/templates/_bmad/bmb/agents/rachid.md +184 -184
- package/templates/_bmad/bmb/agents/workflow-builder.md +61 -61
- package/templates/_bmad/bmb/workflows/byan/data/mantras.yaml +272 -272
- package/templates/_bmad/bmb/workflows/byan/data/templates.yaml +59 -59
- package/templates/_bmad/bmb/workflows/byan/delete-agent-workflow.md +657 -657
- package/templates/_bmad/bmb/workflows/byan/edit-agent-workflow.md +688 -688
- package/templates/_bmad/bmb/workflows/byan/interview-workflow.md +753 -753
- package/templates/_bmad/bmb/workflows/byan/quick-create-workflow.md +450 -450
- package/templates/_bmad/bmb/workflows/byan/templates/base-agent-template.md +79 -79
- package/templates/_bmad/bmb/workflows/byan/validate-agent-workflow.md +676 -676
- package/templates/_bmad/core/agents/carmack.md +238 -238
|
@@ -1,301 +1,301 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const fs = require('fs-extra');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const { program } = require('commander');
|
|
6
|
-
const inquirer = require('inquirer');
|
|
7
|
-
const chalk = require('chalk');
|
|
8
|
-
const ora = require('ora');
|
|
9
|
-
const yaml = require('js-yaml');
|
|
10
|
-
|
|
11
|
-
const BYAN_VERSION = '1.0.2';
|
|
12
|
-
|
|
13
|
-
// ASCII Art Banner
|
|
14
|
-
const banner = `
|
|
15
|
-
${chalk.blue('╔════════════════════════════════════════════════════════════╗')}
|
|
16
|
-
${chalk.blue('║')} ${chalk.blue('║')}
|
|
17
|
-
${chalk.blue('║')} ${chalk.bold('🏗️ BYAN INSTALLER v' + BYAN_VERSION)} ${chalk.blue('║')}
|
|
18
|
-
${chalk.blue('║')} ${chalk.gray('Builder of YAN - Agent Creator')} ${chalk.blue('║')}
|
|
19
|
-
${chalk.blue('║')} ${chalk.blue('║')}
|
|
20
|
-
${chalk.blue('║')} ${chalk.gray('Methodology: Merise Agile + TDD + 64 Mantras')} ${chalk.blue('║')}
|
|
21
|
-
${chalk.blue('║')} ${chalk.blue('║')}
|
|
22
|
-
${chalk.blue('╚════════════════════════════════════════════════════════════╝')}
|
|
23
|
-
`;
|
|
24
|
-
|
|
25
|
-
// Source template directory (where BYAN package files are)
|
|
26
|
-
const getTemplateDir = () => {
|
|
27
|
-
// Check if running from npm package
|
|
28
|
-
const nodeModulesPath = path.join(__dirname, '..', '..', 'create-byan-agent', 'templates');
|
|
29
|
-
if (fs.existsSync(nodeModulesPath)) {
|
|
30
|
-
return nodeModulesPath;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Check if running from local installation
|
|
34
|
-
const localPath = path.join(__dirname, '..', 'templates');
|
|
35
|
-
if (fs.existsSync(localPath)) {
|
|
36
|
-
return localPath;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Fallback: assume we're in development
|
|
40
|
-
return path.join(__dirname, '..', '_bmad');
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// Main installer
|
|
44
|
-
async function install() {
|
|
45
|
-
console.clear();
|
|
46
|
-
console.log(banner);
|
|
47
|
-
|
|
48
|
-
const projectRoot = process.cwd();
|
|
49
|
-
|
|
50
|
-
// Step 1: Detect project type
|
|
51
|
-
const spinner = ora('Detecting project type...').start();
|
|
52
|
-
|
|
53
|
-
const isGitRepo = await fs.pathExists(path.join(projectRoot, '.git'));
|
|
54
|
-
const hasPackageJson = await fs.pathExists(path.join(projectRoot, 'package.json'));
|
|
55
|
-
const hasPyProject = await fs.pathExists(path.join(projectRoot, 'pyproject.toml'));
|
|
56
|
-
|
|
57
|
-
if (!isGitRepo && !hasPackageJson && !hasPyProject) {
|
|
58
|
-
spinner.warn('Not in a recognized project directory');
|
|
59
|
-
|
|
60
|
-
const { continueAnyway } = await inquirer.prompt([
|
|
61
|
-
{
|
|
62
|
-
type: 'confirm',
|
|
63
|
-
name: 'continueAnyway',
|
|
64
|
-
message: 'BYAN works best in a project with version control. Continue anyway?',
|
|
65
|
-
default: false
|
|
66
|
-
}
|
|
67
|
-
]);
|
|
68
|
-
|
|
69
|
-
if (!continueAnyway) {
|
|
70
|
-
console.log(chalk.yellow('Installation cancelled.'));
|
|
71
|
-
process.exit(0);
|
|
72
|
-
}
|
|
73
|
-
} else {
|
|
74
|
-
spinner.succeed('Project detected');
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Step 2: Platform selection
|
|
78
|
-
const { platform } = await inquirer.prompt([
|
|
79
|
-
{
|
|
80
|
-
type: 'list',
|
|
81
|
-
name: 'platform',
|
|
82
|
-
message: 'Select platform to install for:',
|
|
83
|
-
choices: [
|
|
84
|
-
{ name: 'GitHub Copilot CLI', value: 'copilot' },
|
|
85
|
-
{ name: 'VSCode', value: 'vscode' },
|
|
86
|
-
{ name: 'Claude Code', value: 'claude' },
|
|
87
|
-
{ name: 'Codex', value: 'codex' },
|
|
88
|
-
{ name: 'All platforms', value: 'all' }
|
|
89
|
-
]
|
|
90
|
-
}
|
|
91
|
-
]);
|
|
92
|
-
|
|
93
|
-
// Step 3: User configuration
|
|
94
|
-
const config = await inquirer.prompt([
|
|
95
|
-
{
|
|
96
|
-
type: 'input',
|
|
97
|
-
name: 'userName',
|
|
98
|
-
message: 'Your name:',
|
|
99
|
-
default: 'Developer'
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
type: 'list',
|
|
103
|
-
name: 'language',
|
|
104
|
-
message: 'Communication language:',
|
|
105
|
-
choices: ['Francais', 'English'],
|
|
106
|
-
default: 'English'
|
|
107
|
-
}
|
|
108
|
-
]);
|
|
109
|
-
|
|
110
|
-
// Step 4: Create directory structure
|
|
111
|
-
const installSpinner = ora('Creating directory structure...').start();
|
|
112
|
-
|
|
113
|
-
const bmadDir = path.join(projectRoot, '_bmad');
|
|
114
|
-
const bmbDir = path.join(bmadDir, 'bmb');
|
|
115
|
-
const githubAgentsDir = path.join(projectRoot, '.github', 'agents');
|
|
116
|
-
|
|
117
|
-
await fs.ensureDir(path.join(bmadDir, 'bmb', 'agents'));
|
|
118
|
-
await fs.ensureDir(path.join(bmadDir, 'bmb', 'workflows', 'byan', 'steps'));
|
|
119
|
-
await fs.ensureDir(path.join(bmadDir, 'bmb', 'workflows', 'byan', 'templates'));
|
|
120
|
-
await fs.ensureDir(path.join(bmadDir, 'bmb', 'workflows', 'byan', 'data'));
|
|
121
|
-
await fs.ensureDir(path.join(bmadDir, 'core'));
|
|
122
|
-
await fs.ensureDir(path.join(bmadDir, '_config'));
|
|
123
|
-
await fs.ensureDir(path.join(bmadDir, '_memory'));
|
|
124
|
-
await fs.ensureDir(path.join(bmadDir, '_output'));
|
|
125
|
-
await fs.ensureDir(githubAgentsDir);
|
|
126
|
-
|
|
127
|
-
installSpinner.succeed('Directory structure created');
|
|
128
|
-
|
|
129
|
-
// Step 5: Copy BYAN files from template
|
|
130
|
-
const copySpinner = ora('Installing BYAN files...').start();
|
|
131
|
-
|
|
132
|
-
const templateDir = getTemplateDir();
|
|
133
|
-
|
|
134
|
-
try {
|
|
135
|
-
// Copy agent files
|
|
136
|
-
const agentsSource = path.join(templateDir, 'bmb', 'agents');
|
|
137
|
-
const agentsDest = path.join(bmbDir, 'agents');
|
|
138
|
-
|
|
139
|
-
if (await fs.pathExists(agentsSource)) {
|
|
140
|
-
await fs.copy(agentsSource, agentsDest, { overwrite: true });
|
|
141
|
-
copySpinner.text = 'Copied agent files...';
|
|
142
|
-
} else {
|
|
143
|
-
copySpinner.warn(`Agent source not found: ${agentsSource}`);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// Copy workflow files
|
|
147
|
-
const workflowsSource = path.join(templateDir, 'bmb', 'workflows', 'byan');
|
|
148
|
-
const workflowsDest = path.join(bmbDir, 'workflows', 'byan');
|
|
149
|
-
|
|
150
|
-
if (await fs.pathExists(workflowsSource)) {
|
|
151
|
-
await fs.copy(workflowsSource, workflowsDest, { overwrite: true });
|
|
152
|
-
copySpinner.text = 'Copied workflow files...';
|
|
153
|
-
} else {
|
|
154
|
-
copySpinner.warn(`Workflow source not found: ${workflowsSource}`);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// Copy .github/agents files for Copilot CLI detection
|
|
158
|
-
const githubAgentsSource = path.join(templateDir, '..', '.github', 'agents');
|
|
159
|
-
|
|
160
|
-
if (await fs.pathExists(githubAgentsSource)) {
|
|
161
|
-
await fs.copy(githubAgentsSource, githubAgentsDir, { overwrite: true });
|
|
162
|
-
copySpinner.text = 'Copied Copilot CLI agent stubs...';
|
|
163
|
-
} else {
|
|
164
|
-
copySpinner.warn(`GitHub agents source not found: ${githubAgentsSource}`);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
copySpinner.succeed('BYAN files installed');
|
|
168
|
-
} catch (error) {
|
|
169
|
-
copySpinner.fail('Error copying files');
|
|
170
|
-
console.error(chalk.red('Details:'), error.message);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// Step 6: Create config.yaml
|
|
174
|
-
const configSpinner = ora('Generating configuration...').start();
|
|
175
|
-
|
|
176
|
-
const configContent = {
|
|
177
|
-
bmb_creations_output_folder: "{project-root}/_bmad-output/bmb-creations",
|
|
178
|
-
user_name: config.userName,
|
|
179
|
-
communication_language: config.language,
|
|
180
|
-
document_output_language: config.language,
|
|
181
|
-
output_folder: "{project-root}/_bmad-output",
|
|
182
|
-
platform: platform
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
const configPath = path.join(bmbDir, 'config.yaml');
|
|
186
|
-
await fs.writeFile(configPath, yaml.dump(configContent), 'utf8');
|
|
187
|
-
|
|
188
|
-
configSpinner.succeed('Configuration generated');
|
|
189
|
-
|
|
190
|
-
// Step 7: Create package.json script
|
|
191
|
-
const shortcutSpinner = ora('Creating shortcuts...').start();
|
|
192
|
-
|
|
193
|
-
if (hasPackageJson) {
|
|
194
|
-
const pkgPath = path.join(projectRoot, 'package.json');
|
|
195
|
-
const pkg = await fs.readJson(pkgPath);
|
|
196
|
-
|
|
197
|
-
if (!pkg.scripts) pkg.scripts = {};
|
|
198
|
-
|
|
199
|
-
if (!pkg.scripts.byan) {
|
|
200
|
-
pkg.scripts.byan = 'echo "BYAN agent installed. Use: copilot and type /agent"';
|
|
201
|
-
await fs.writeJson(pkgPath, pkg, { spaces: 2 });
|
|
202
|
-
shortcutSpinner.succeed('NPM script added');
|
|
203
|
-
} else {
|
|
204
|
-
shortcutSpinner.info('NPM script already exists');
|
|
205
|
-
}
|
|
206
|
-
} else {
|
|
207
|
-
shortcutSpinner.succeed('Shortcuts created');
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// Step 8: Verification
|
|
211
|
-
const verifySpinner = ora('Verifying installation...').start();
|
|
212
|
-
|
|
213
|
-
const checks = [
|
|
214
|
-
{ name: 'Agents directory', path: path.join(bmbDir, 'agents') },
|
|
215
|
-
{ name: 'BYAN agent', path: path.join(bmbDir, 'agents', 'byan.md') },
|
|
216
|
-
{ name: 'RACHID agent', path: path.join(bmbDir, 'agents', 'rachid.md') },
|
|
217
|
-
{ name: 'MARC agent', path: path.join(bmbDir, 'agents', 'marc.md') },
|
|
218
|
-
{ name: 'Workflows', path: path.join(bmbDir, 'workflows', 'byan') },
|
|
219
|
-
{ name: 'Config', path: configPath },
|
|
220
|
-
{ name: 'GitHub agents dir', path: githubAgentsDir },
|
|
221
|
-
{ name: 'BYAN stub', path: path.join(githubAgentsDir, 'bmad-agent-byan.md') },
|
|
222
|
-
{ name: 'RACHID stub', path: path.join(githubAgentsDir, 'bmad-agent-rachid.md') },
|
|
223
|
-
{ name: 'MARC stub', path: path.join(githubAgentsDir, 'bmad-agent-marc.md') }
|
|
224
|
-
];
|
|
225
|
-
|
|
226
|
-
let passed = 0;
|
|
227
|
-
let failed = [];
|
|
228
|
-
|
|
229
|
-
for (const check of checks) {
|
|
230
|
-
if (await fs.pathExists(check.path)) {
|
|
231
|
-
passed++;
|
|
232
|
-
} else {
|
|
233
|
-
failed.push(check.name);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
if (passed === checks.length) {
|
|
238
|
-
verifySpinner.succeed(`Verification: ${passed}/${checks.length} checks passed ✅`);
|
|
239
|
-
} else {
|
|
240
|
-
verifySpinner.warn(`Verification: ${passed}/${checks.length} checks passed`);
|
|
241
|
-
if (failed.length > 0) {
|
|
242
|
-
console.log(chalk.yellow(' Missing:'), failed.join(', '));
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
// Success message
|
|
247
|
-
console.log('');
|
|
248
|
-
console.log(chalk.green('╔════════════════════════════════════════════════════════════╗'));
|
|
249
|
-
console.log(chalk.green('║ ║'));
|
|
250
|
-
console.log(chalk.green('║ ✅ BYAN INSTALLATION COMPLETE! ║'));
|
|
251
|
-
console.log(chalk.green('║ ║'));
|
|
252
|
-
console.log(chalk.green('╚════════════════════════════════════════════════════════════╝'));
|
|
253
|
-
console.log('');
|
|
254
|
-
|
|
255
|
-
console.log(chalk.bold('Installation Summary:'));
|
|
256
|
-
console.log(` • Platform: ${chalk.cyan(platform)}`);
|
|
257
|
-
console.log(` • Installation Directory: ${chalk.cyan(bmbDir)}`);
|
|
258
|
-
console.log(` • Configuration: ${chalk.cyan(configPath)}`);
|
|
259
|
-
console.log(` • User: ${chalk.cyan(config.userName)}`);
|
|
260
|
-
console.log(` • Language: ${chalk.cyan(config.language)}`);
|
|
261
|
-
console.log(` • Agents Installed: ${chalk.cyan('BYAN, RACHID, MARC')}`);
|
|
262
|
-
console.log('');
|
|
263
|
-
|
|
264
|
-
console.log(chalk.bold('Next Steps:'));
|
|
265
|
-
console.log('');
|
|
266
|
-
console.log(chalk.yellow('1. Activate agents in GitHub Copilot CLI:'));
|
|
267
|
-
console.log(` ${chalk.blue('copilot')}`);
|
|
268
|
-
console.log(` Then type: ${chalk.blue('/agent')}`);
|
|
269
|
-
console.log(` Select: ${chalk.cyan('byan')} (create agents)`);
|
|
270
|
-
console.log(` ${chalk.cyan('rachid')} (NPM deployment)`);
|
|
271
|
-
console.log(` ${chalk.cyan('marc')} (Copilot CLI integration)`);
|
|
272
|
-
console.log('');
|
|
273
|
-
|
|
274
|
-
console.log(chalk.yellow('2. Create your first agent with BYAN:'));
|
|
275
|
-
console.log(' [INT] Start Intelligent Interview (30-45 min)');
|
|
276
|
-
console.log(' [QC] Quick Create (10 min)');
|
|
277
|
-
console.log('');
|
|
278
|
-
|
|
279
|
-
console.log(chalk.yellow('3. Deploy with RACHID:'));
|
|
280
|
-
console.log(' Use RACHID to publish BYAN to npm');
|
|
281
|
-
console.log(' Validate package.json and dependencies');
|
|
282
|
-
console.log('');
|
|
283
|
-
|
|
284
|
-
console.log(chalk.yellow('4. Integrate with MARC:'));
|
|
285
|
-
console.log(' Use MARC to test /agent detection');
|
|
286
|
-
console.log(' Validate .github/agents/ structure');
|
|
287
|
-
console.log('');
|
|
288
|
-
|
|
289
|
-
console.log(chalk.gray('Need help? Type \'/bmad-help\' when BYAN is active'));
|
|
290
|
-
console.log('');
|
|
291
|
-
console.log(chalk.blue('Happy agent building! 🏗️'));
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
// CLI Program
|
|
295
|
-
program
|
|
296
|
-
.name('create-byan-agent')
|
|
297
|
-
.description('Install BYAN - Builder of YAN agent creator with RACHID and MARC')
|
|
298
|
-
.version(BYAN_VERSION)
|
|
299
|
-
.action(install);
|
|
300
|
-
|
|
301
|
-
program.parse(process.argv);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs-extra');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { program } = require('commander');
|
|
6
|
+
const inquirer = require('inquirer');
|
|
7
|
+
const chalk = require('chalk');
|
|
8
|
+
const ora = require('ora');
|
|
9
|
+
const yaml = require('js-yaml');
|
|
10
|
+
|
|
11
|
+
const BYAN_VERSION = '1.0.2';
|
|
12
|
+
|
|
13
|
+
// ASCII Art Banner
|
|
14
|
+
const banner = `
|
|
15
|
+
${chalk.blue('╔════════════════════════════════════════════════════════════╗')}
|
|
16
|
+
${chalk.blue('║')} ${chalk.blue('║')}
|
|
17
|
+
${chalk.blue('║')} ${chalk.bold('🏗️ BYAN INSTALLER v' + BYAN_VERSION)} ${chalk.blue('║')}
|
|
18
|
+
${chalk.blue('║')} ${chalk.gray('Builder of YAN - Agent Creator')} ${chalk.blue('║')}
|
|
19
|
+
${chalk.blue('║')} ${chalk.blue('║')}
|
|
20
|
+
${chalk.blue('║')} ${chalk.gray('Methodology: Merise Agile + TDD + 64 Mantras')} ${chalk.blue('║')}
|
|
21
|
+
${chalk.blue('║')} ${chalk.blue('║')}
|
|
22
|
+
${chalk.blue('╚════════════════════════════════════════════════════════════╝')}
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
// Source template directory (where BYAN package files are)
|
|
26
|
+
const getTemplateDir = () => {
|
|
27
|
+
// Check if running from npm package
|
|
28
|
+
const nodeModulesPath = path.join(__dirname, '..', '..', 'create-byan-agent', 'templates');
|
|
29
|
+
if (fs.existsSync(nodeModulesPath)) {
|
|
30
|
+
return nodeModulesPath;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Check if running from local installation
|
|
34
|
+
const localPath = path.join(__dirname, '..', 'templates');
|
|
35
|
+
if (fs.existsSync(localPath)) {
|
|
36
|
+
return localPath;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Fallback: assume we're in development
|
|
40
|
+
return path.join(__dirname, '..', '_bmad');
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Main installer
|
|
44
|
+
async function install() {
|
|
45
|
+
console.clear();
|
|
46
|
+
console.log(banner);
|
|
47
|
+
|
|
48
|
+
const projectRoot = process.cwd();
|
|
49
|
+
|
|
50
|
+
// Step 1: Detect project type
|
|
51
|
+
const spinner = ora('Detecting project type...').start();
|
|
52
|
+
|
|
53
|
+
const isGitRepo = await fs.pathExists(path.join(projectRoot, '.git'));
|
|
54
|
+
const hasPackageJson = await fs.pathExists(path.join(projectRoot, 'package.json'));
|
|
55
|
+
const hasPyProject = await fs.pathExists(path.join(projectRoot, 'pyproject.toml'));
|
|
56
|
+
|
|
57
|
+
if (!isGitRepo && !hasPackageJson && !hasPyProject) {
|
|
58
|
+
spinner.warn('Not in a recognized project directory');
|
|
59
|
+
|
|
60
|
+
const { continueAnyway } = await inquirer.prompt([
|
|
61
|
+
{
|
|
62
|
+
type: 'confirm',
|
|
63
|
+
name: 'continueAnyway',
|
|
64
|
+
message: 'BYAN works best in a project with version control. Continue anyway?',
|
|
65
|
+
default: false
|
|
66
|
+
}
|
|
67
|
+
]);
|
|
68
|
+
|
|
69
|
+
if (!continueAnyway) {
|
|
70
|
+
console.log(chalk.yellow('Installation cancelled.'));
|
|
71
|
+
process.exit(0);
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
spinner.succeed('Project detected');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Step 2: Platform selection
|
|
78
|
+
const { platform } = await inquirer.prompt([
|
|
79
|
+
{
|
|
80
|
+
type: 'list',
|
|
81
|
+
name: 'platform',
|
|
82
|
+
message: 'Select platform to install for:',
|
|
83
|
+
choices: [
|
|
84
|
+
{ name: 'GitHub Copilot CLI', value: 'copilot' },
|
|
85
|
+
{ name: 'VSCode', value: 'vscode' },
|
|
86
|
+
{ name: 'Claude Code', value: 'claude' },
|
|
87
|
+
{ name: 'Codex', value: 'codex' },
|
|
88
|
+
{ name: 'All platforms', value: 'all' }
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
]);
|
|
92
|
+
|
|
93
|
+
// Step 3: User configuration
|
|
94
|
+
const config = await inquirer.prompt([
|
|
95
|
+
{
|
|
96
|
+
type: 'input',
|
|
97
|
+
name: 'userName',
|
|
98
|
+
message: 'Your name:',
|
|
99
|
+
default: 'Developer'
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
type: 'list',
|
|
103
|
+
name: 'language',
|
|
104
|
+
message: 'Communication language:',
|
|
105
|
+
choices: ['Francais', 'English'],
|
|
106
|
+
default: 'English'
|
|
107
|
+
}
|
|
108
|
+
]);
|
|
109
|
+
|
|
110
|
+
// Step 4: Create directory structure
|
|
111
|
+
const installSpinner = ora('Creating directory structure...').start();
|
|
112
|
+
|
|
113
|
+
const bmadDir = path.join(projectRoot, '_bmad');
|
|
114
|
+
const bmbDir = path.join(bmadDir, 'bmb');
|
|
115
|
+
const githubAgentsDir = path.join(projectRoot, '.github', 'agents');
|
|
116
|
+
|
|
117
|
+
await fs.ensureDir(path.join(bmadDir, 'bmb', 'agents'));
|
|
118
|
+
await fs.ensureDir(path.join(bmadDir, 'bmb', 'workflows', 'byan', 'steps'));
|
|
119
|
+
await fs.ensureDir(path.join(bmadDir, 'bmb', 'workflows', 'byan', 'templates'));
|
|
120
|
+
await fs.ensureDir(path.join(bmadDir, 'bmb', 'workflows', 'byan', 'data'));
|
|
121
|
+
await fs.ensureDir(path.join(bmadDir, 'core'));
|
|
122
|
+
await fs.ensureDir(path.join(bmadDir, '_config'));
|
|
123
|
+
await fs.ensureDir(path.join(bmadDir, '_memory'));
|
|
124
|
+
await fs.ensureDir(path.join(bmadDir, '_output'));
|
|
125
|
+
await fs.ensureDir(githubAgentsDir);
|
|
126
|
+
|
|
127
|
+
installSpinner.succeed('Directory structure created');
|
|
128
|
+
|
|
129
|
+
// Step 5: Copy BYAN files from template
|
|
130
|
+
const copySpinner = ora('Installing BYAN files...').start();
|
|
131
|
+
|
|
132
|
+
const templateDir = getTemplateDir();
|
|
133
|
+
|
|
134
|
+
try {
|
|
135
|
+
// Copy agent files
|
|
136
|
+
const agentsSource = path.join(templateDir, 'bmb', 'agents');
|
|
137
|
+
const agentsDest = path.join(bmbDir, 'agents');
|
|
138
|
+
|
|
139
|
+
if (await fs.pathExists(agentsSource)) {
|
|
140
|
+
await fs.copy(agentsSource, agentsDest, { overwrite: true });
|
|
141
|
+
copySpinner.text = 'Copied agent files...';
|
|
142
|
+
} else {
|
|
143
|
+
copySpinner.warn(`Agent source not found: ${agentsSource}`);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Copy workflow files
|
|
147
|
+
const workflowsSource = path.join(templateDir, 'bmb', 'workflows', 'byan');
|
|
148
|
+
const workflowsDest = path.join(bmbDir, 'workflows', 'byan');
|
|
149
|
+
|
|
150
|
+
if (await fs.pathExists(workflowsSource)) {
|
|
151
|
+
await fs.copy(workflowsSource, workflowsDest, { overwrite: true });
|
|
152
|
+
copySpinner.text = 'Copied workflow files...';
|
|
153
|
+
} else {
|
|
154
|
+
copySpinner.warn(`Workflow source not found: ${workflowsSource}`);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Copy .github/agents files for Copilot CLI detection
|
|
158
|
+
const githubAgentsSource = path.join(templateDir, '..', '.github', 'agents');
|
|
159
|
+
|
|
160
|
+
if (await fs.pathExists(githubAgentsSource)) {
|
|
161
|
+
await fs.copy(githubAgentsSource, githubAgentsDir, { overwrite: true });
|
|
162
|
+
copySpinner.text = 'Copied Copilot CLI agent stubs...';
|
|
163
|
+
} else {
|
|
164
|
+
copySpinner.warn(`GitHub agents source not found: ${githubAgentsSource}`);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
copySpinner.succeed('BYAN files installed');
|
|
168
|
+
} catch (error) {
|
|
169
|
+
copySpinner.fail('Error copying files');
|
|
170
|
+
console.error(chalk.red('Details:'), error.message);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Step 6: Create config.yaml
|
|
174
|
+
const configSpinner = ora('Generating configuration...').start();
|
|
175
|
+
|
|
176
|
+
const configContent = {
|
|
177
|
+
bmb_creations_output_folder: "{project-root}/_bmad-output/bmb-creations",
|
|
178
|
+
user_name: config.userName,
|
|
179
|
+
communication_language: config.language,
|
|
180
|
+
document_output_language: config.language,
|
|
181
|
+
output_folder: "{project-root}/_bmad-output",
|
|
182
|
+
platform: platform
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
const configPath = path.join(bmbDir, 'config.yaml');
|
|
186
|
+
await fs.writeFile(configPath, yaml.dump(configContent), 'utf8');
|
|
187
|
+
|
|
188
|
+
configSpinner.succeed('Configuration generated');
|
|
189
|
+
|
|
190
|
+
// Step 7: Create package.json script
|
|
191
|
+
const shortcutSpinner = ora('Creating shortcuts...').start();
|
|
192
|
+
|
|
193
|
+
if (hasPackageJson) {
|
|
194
|
+
const pkgPath = path.join(projectRoot, 'package.json');
|
|
195
|
+
const pkg = await fs.readJson(pkgPath);
|
|
196
|
+
|
|
197
|
+
if (!pkg.scripts) pkg.scripts = {};
|
|
198
|
+
|
|
199
|
+
if (!pkg.scripts.byan) {
|
|
200
|
+
pkg.scripts.byan = 'echo "BYAN agent installed. Use: copilot and type /agent"';
|
|
201
|
+
await fs.writeJson(pkgPath, pkg, { spaces: 2 });
|
|
202
|
+
shortcutSpinner.succeed('NPM script added');
|
|
203
|
+
} else {
|
|
204
|
+
shortcutSpinner.info('NPM script already exists');
|
|
205
|
+
}
|
|
206
|
+
} else {
|
|
207
|
+
shortcutSpinner.succeed('Shortcuts created');
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Step 8: Verification
|
|
211
|
+
const verifySpinner = ora('Verifying installation...').start();
|
|
212
|
+
|
|
213
|
+
const checks = [
|
|
214
|
+
{ name: 'Agents directory', path: path.join(bmbDir, 'agents') },
|
|
215
|
+
{ name: 'BYAN agent', path: path.join(bmbDir, 'agents', 'byan.md') },
|
|
216
|
+
{ name: 'RACHID agent', path: path.join(bmbDir, 'agents', 'rachid.md') },
|
|
217
|
+
{ name: 'MARC agent', path: path.join(bmbDir, 'agents', 'marc.md') },
|
|
218
|
+
{ name: 'Workflows', path: path.join(bmbDir, 'workflows', 'byan') },
|
|
219
|
+
{ name: 'Config', path: configPath },
|
|
220
|
+
{ name: 'GitHub agents dir', path: githubAgentsDir },
|
|
221
|
+
{ name: 'BYAN stub', path: path.join(githubAgentsDir, 'bmad-agent-byan.md') },
|
|
222
|
+
{ name: 'RACHID stub', path: path.join(githubAgentsDir, 'bmad-agent-rachid.md') },
|
|
223
|
+
{ name: 'MARC stub', path: path.join(githubAgentsDir, 'bmad-agent-marc.md') }
|
|
224
|
+
];
|
|
225
|
+
|
|
226
|
+
let passed = 0;
|
|
227
|
+
let failed = [];
|
|
228
|
+
|
|
229
|
+
for (const check of checks) {
|
|
230
|
+
if (await fs.pathExists(check.path)) {
|
|
231
|
+
passed++;
|
|
232
|
+
} else {
|
|
233
|
+
failed.push(check.name);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (passed === checks.length) {
|
|
238
|
+
verifySpinner.succeed(`Verification: ${passed}/${checks.length} checks passed ✅`);
|
|
239
|
+
} else {
|
|
240
|
+
verifySpinner.warn(`Verification: ${passed}/${checks.length} checks passed`);
|
|
241
|
+
if (failed.length > 0) {
|
|
242
|
+
console.log(chalk.yellow(' Missing:'), failed.join(', '));
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Success message
|
|
247
|
+
console.log('');
|
|
248
|
+
console.log(chalk.green('╔════════════════════════════════════════════════════════════╗'));
|
|
249
|
+
console.log(chalk.green('║ ║'));
|
|
250
|
+
console.log(chalk.green('║ ✅ BYAN INSTALLATION COMPLETE! ║'));
|
|
251
|
+
console.log(chalk.green('║ ║'));
|
|
252
|
+
console.log(chalk.green('╚════════════════════════════════════════════════════════════╝'));
|
|
253
|
+
console.log('');
|
|
254
|
+
|
|
255
|
+
console.log(chalk.bold('Installation Summary:'));
|
|
256
|
+
console.log(` • Platform: ${chalk.cyan(platform)}`);
|
|
257
|
+
console.log(` • Installation Directory: ${chalk.cyan(bmbDir)}`);
|
|
258
|
+
console.log(` • Configuration: ${chalk.cyan(configPath)}`);
|
|
259
|
+
console.log(` • User: ${chalk.cyan(config.userName)}`);
|
|
260
|
+
console.log(` • Language: ${chalk.cyan(config.language)}`);
|
|
261
|
+
console.log(` • Agents Installed: ${chalk.cyan('BYAN, RACHID, MARC')}`);
|
|
262
|
+
console.log('');
|
|
263
|
+
|
|
264
|
+
console.log(chalk.bold('Next Steps:'));
|
|
265
|
+
console.log('');
|
|
266
|
+
console.log(chalk.yellow('1. Activate agents in GitHub Copilot CLI:'));
|
|
267
|
+
console.log(` ${chalk.blue('copilot')}`);
|
|
268
|
+
console.log(` Then type: ${chalk.blue('/agent')}`);
|
|
269
|
+
console.log(` Select: ${chalk.cyan('byan')} (create agents)`);
|
|
270
|
+
console.log(` ${chalk.cyan('rachid')} (NPM deployment)`);
|
|
271
|
+
console.log(` ${chalk.cyan('marc')} (Copilot CLI integration)`);
|
|
272
|
+
console.log('');
|
|
273
|
+
|
|
274
|
+
console.log(chalk.yellow('2. Create your first agent with BYAN:'));
|
|
275
|
+
console.log(' [INT] Start Intelligent Interview (30-45 min)');
|
|
276
|
+
console.log(' [QC] Quick Create (10 min)');
|
|
277
|
+
console.log('');
|
|
278
|
+
|
|
279
|
+
console.log(chalk.yellow('3. Deploy with RACHID:'));
|
|
280
|
+
console.log(' Use RACHID to publish BYAN to npm');
|
|
281
|
+
console.log(' Validate package.json and dependencies');
|
|
282
|
+
console.log('');
|
|
283
|
+
|
|
284
|
+
console.log(chalk.yellow('4. Integrate with MARC:'));
|
|
285
|
+
console.log(' Use MARC to test /agent detection');
|
|
286
|
+
console.log(' Validate .github/agents/ structure');
|
|
287
|
+
console.log('');
|
|
288
|
+
|
|
289
|
+
console.log(chalk.gray('Need help? Type \'/bmad-help\' when BYAN is active'));
|
|
290
|
+
console.log('');
|
|
291
|
+
console.log(chalk.blue('Happy agent building! 🏗️'));
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// CLI Program
|
|
295
|
+
program
|
|
296
|
+
.name('create-byan-agent')
|
|
297
|
+
.description('Install BYAN - Builder of YAN agent creator with RACHID and MARC')
|
|
298
|
+
.version(BYAN_VERSION)
|
|
299
|
+
.action(install);
|
|
300
|
+
|
|
301
|
+
program.parse(process.argv);
|