create-byan-agent 1.2.6 → 2.0.0-alpha.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 +196 -388
- package/LICENSE +21 -21
- package/README.md +420 -1264
- package/bin/create-byan-agent-backup.js +220 -220
- package/bin/create-byan-agent-fixed.js +301 -301
- package/bin/create-byan-agent-v2.js +492 -0
- package/bin/create-byan-agent.js +296 -561
- package/package.json +68 -64
- 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 -32
- package/templates/.github/agents/bmad-agent-byan.md +224 -224
- package/templates/.github/agents/bmad-agent-carmack.md +18 -18
- 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 -48
- 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 -21
- package/templates/.github/agents/franck.md +379 -379
- 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
- package/lib/errors.js +0 -61
- package/lib/exit-codes.js +0 -54
- package/lib/platforms/claude-code.js +0 -113
- package/lib/platforms/codex.js +0 -92
- package/lib/platforms/copilot-cli.js +0 -123
- package/lib/platforms/index.js +0 -14
- package/lib/platforms/vscode.js +0 -51
- package/lib/utils/config-loader.js +0 -79
- package/lib/utils/file-utils.js +0 -117
- package/lib/utils/git-detector.js +0 -35
- package/lib/utils/logger.js +0 -64
- package/lib/utils/node-detector.js +0 -58
- package/lib/utils/os-detector.js +0 -74
- package/lib/utils/yaml-utils.js +0 -87
- package/lib/yanstaller/backuper.js +0 -308
- package/lib/yanstaller/detector.js +0 -141
- package/lib/yanstaller/index.js +0 -93
- package/lib/yanstaller/installer.js +0 -226
- package/lib/yanstaller/interviewer.js +0 -301
- package/lib/yanstaller/recommender.js +0 -308
- package/lib/yanstaller/troubleshooter.js +0 -498
- package/lib/yanstaller/validator.js +0 -602
- package/lib/yanstaller/wizard.js +0 -229
- package/templates/.github/agents/expert-merise-agile.md +0 -1
|
@@ -0,0 +1,492 @@
|
|
|
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 = '2.0.0-alpha.1';
|
|
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('Architecture: 4 Pilliers + v2.0 Runtime')} ${chalk.blue('║')}
|
|
21
|
+
${chalk.blue('║')} ${chalk.gray('Methodology: Merise Agile + TDD + 64 Mantras')} ${chalk.blue('║')}
|
|
22
|
+
${chalk.blue('║')} ${chalk.blue('║')}
|
|
23
|
+
${chalk.blue('╚════════════════════════════════════════════════════════════╝')}
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
// Source template directory
|
|
27
|
+
const getTemplateDir = () => {
|
|
28
|
+
const npmPackagePath = path.join(__dirname, '..', 'templates');
|
|
29
|
+
if (fs.existsSync(npmPackagePath)) {
|
|
30
|
+
console.log(chalk.gray(`[DEBUG] Template dir found: ${npmPackagePath}`));
|
|
31
|
+
return npmPackagePath;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const devPath = path.join(__dirname, '..', '..');
|
|
35
|
+
if (fs.existsSync(devPath)) {
|
|
36
|
+
console.log(chalk.gray(`[DEBUG] Dev template dir found: ${devPath}`));
|
|
37
|
+
return devPath;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
console.error(chalk.red('⚠️ WARNING: Template directory not found!'));
|
|
41
|
+
console.error(chalk.red(` Searched: ${npmPackagePath}`));
|
|
42
|
+
console.error(chalk.red(` Also searched: ${devPath}`));
|
|
43
|
+
return null;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// Detect if v2.0 structure exists in template
|
|
47
|
+
async function detectV2Structure(templateDir) {
|
|
48
|
+
const srcPath = path.join(templateDir, 'src');
|
|
49
|
+
const testsPath = path.join(templateDir, '__tests__');
|
|
50
|
+
const indexPath = path.join(templateDir, 'src', 'index.js');
|
|
51
|
+
|
|
52
|
+
const hasSrc = await fs.pathExists(srcPath);
|
|
53
|
+
const hasTests = await fs.pathExists(testsPath);
|
|
54
|
+
const hasIndex = await fs.pathExists(indexPath);
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
isV2Available: hasSrc && hasTests && hasIndex,
|
|
58
|
+
hasSrc,
|
|
59
|
+
hasTests,
|
|
60
|
+
hasIndex
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Copy v2.0 runtime structure
|
|
65
|
+
async function copyV2Runtime(templateDir, projectRoot, spinner) {
|
|
66
|
+
const v2Files = [
|
|
67
|
+
{ src: 'src', dest: 'src', desc: 'v2.0 Core Components' },
|
|
68
|
+
{ src: '__tests__', dest: '__tests__', desc: 'v2.0 Tests' }
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
let copiedCount = 0;
|
|
72
|
+
|
|
73
|
+
for (const file of v2Files) {
|
|
74
|
+
const sourcePath = path.join(templateDir, file.src);
|
|
75
|
+
const destPath = path.join(projectRoot, file.dest);
|
|
76
|
+
|
|
77
|
+
if (await fs.pathExists(sourcePath)) {
|
|
78
|
+
await fs.copy(sourcePath, destPath, { overwrite: false });
|
|
79
|
+
spinner.text = `Installing ${file.desc}...`;
|
|
80
|
+
console.log(chalk.green(` ✓ ${file.desc}: ${file.src} → ${file.dest}`));
|
|
81
|
+
copiedCount++;
|
|
82
|
+
} else {
|
|
83
|
+
console.log(chalk.yellow(` ⚠ Skipping ${file.desc} (not found in template)`));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return copiedCount;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Merge package.json with v2.0 dependencies
|
|
91
|
+
async function mergePackageJson(templateDir, projectRoot, spinner) {
|
|
92
|
+
const templatePkgPath = path.join(templateDir, 'package.json');
|
|
93
|
+
const projectPkgPath = path.join(projectRoot, 'package.json');
|
|
94
|
+
|
|
95
|
+
if (!(await fs.pathExists(templatePkgPath))) {
|
|
96
|
+
spinner.warn('Template package.json not found, skipping dependency merge');
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const templatePkg = await fs.readJson(templatePkgPath);
|
|
101
|
+
|
|
102
|
+
if (await fs.pathExists(projectPkgPath)) {
|
|
103
|
+
const projectPkg = await fs.readJson(projectPkgPath);
|
|
104
|
+
|
|
105
|
+
// Merge devDependencies (Jest)
|
|
106
|
+
if (templatePkg.devDependencies) {
|
|
107
|
+
projectPkg.devDependencies = projectPkg.devDependencies || {};
|
|
108
|
+
Object.assign(projectPkg.devDependencies, templatePkg.devDependencies);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Add Jest config if not present
|
|
112
|
+
if (templatePkg.jest && !projectPkg.jest) {
|
|
113
|
+
projectPkg.jest = templatePkg.jest;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Add main entry point
|
|
117
|
+
if (templatePkg.main && !projectPkg.main) {
|
|
118
|
+
projectPkg.main = templatePkg.main;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Add test scripts
|
|
122
|
+
projectPkg.scripts = projectPkg.scripts || {};
|
|
123
|
+
if (templatePkg.scripts) {
|
|
124
|
+
if (templatePkg.scripts.test && !projectPkg.scripts.test) {
|
|
125
|
+
projectPkg.scripts.test = templatePkg.scripts.test;
|
|
126
|
+
}
|
|
127
|
+
if (templatePkg.scripts['test:coverage'] && !projectPkg.scripts['test:coverage']) {
|
|
128
|
+
projectPkg.scripts['test:coverage'] = templatePkg.scripts['test:coverage'];
|
|
129
|
+
}
|
|
130
|
+
if (templatePkg.scripts['test:watch'] && !projectPkg.scripts['test:watch']) {
|
|
131
|
+
projectPkg.scripts['test:watch'] = templatePkg.scripts['test:watch'];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
await fs.writeJson(projectPkgPath, projectPkg, { spaces: 2 });
|
|
136
|
+
spinner.text = 'Updated package.json with v2.0 dependencies';
|
|
137
|
+
console.log(chalk.green(' ✓ package.json merged with v2.0 config'));
|
|
138
|
+
return true;
|
|
139
|
+
} else {
|
|
140
|
+
// Create new package.json based on template
|
|
141
|
+
const newPkg = {
|
|
142
|
+
name: path.basename(projectRoot),
|
|
143
|
+
version: '1.0.0',
|
|
144
|
+
description: 'BYAN v2.0 enabled project',
|
|
145
|
+
main: templatePkg.main,
|
|
146
|
+
scripts: templatePkg.scripts,
|
|
147
|
+
devDependencies: templatePkg.devDependencies,
|
|
148
|
+
jest: templatePkg.jest
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
await fs.writeJson(projectPkgPath, newPkg, { spaces: 2 });
|
|
152
|
+
spinner.text = 'Created package.json with v2.0 config';
|
|
153
|
+
console.log(chalk.green(' ✓ package.json created'));
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Main installer
|
|
159
|
+
async function install() {
|
|
160
|
+
console.clear();
|
|
161
|
+
console.log(banner);
|
|
162
|
+
|
|
163
|
+
const projectRoot = process.cwd();
|
|
164
|
+
|
|
165
|
+
// Step 1: Detect project type
|
|
166
|
+
const spinner = ora('Detecting project type...').start();
|
|
167
|
+
|
|
168
|
+
const isGitRepo = await fs.pathExists(path.join(projectRoot, '.git'));
|
|
169
|
+
const hasPackageJson = await fs.pathExists(path.join(projectRoot, 'package.json'));
|
|
170
|
+
const hasPyProject = await fs.pathExists(path.join(projectRoot, 'pyproject.toml'));
|
|
171
|
+
|
|
172
|
+
if (!isGitRepo && !hasPackageJson && !hasPyProject) {
|
|
173
|
+
spinner.warn('Not in a recognized project directory');
|
|
174
|
+
|
|
175
|
+
const { continueAnyway } = await inquirer.prompt([
|
|
176
|
+
{
|
|
177
|
+
type: 'confirm',
|
|
178
|
+
name: 'continueAnyway',
|
|
179
|
+
message: 'BYAN works best in a project with version control. Continue anyway?',
|
|
180
|
+
default: false
|
|
181
|
+
}
|
|
182
|
+
]);
|
|
183
|
+
|
|
184
|
+
if (!continueAnyway) {
|
|
185
|
+
console.log(chalk.yellow('Installation cancelled.'));
|
|
186
|
+
process.exit(0);
|
|
187
|
+
}
|
|
188
|
+
} else {
|
|
189
|
+
spinner.succeed('Project detected');
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Step 2: Detect v2.0 structure availability
|
|
193
|
+
const detectSpinner = ora('Detecting BYAN version...').start();
|
|
194
|
+
const templateDir = getTemplateDir();
|
|
195
|
+
|
|
196
|
+
if (!templateDir) {
|
|
197
|
+
detectSpinner.fail('Template directory not found! Cannot proceed.');
|
|
198
|
+
console.error(chalk.red('\nInstallation failed: Missing template files.'));
|
|
199
|
+
console.error(chalk.yellow('This usually means the package was not installed correctly.'));
|
|
200
|
+
process.exit(1);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const v2Detection = await detectV2Structure(templateDir);
|
|
204
|
+
|
|
205
|
+
if (v2Detection.isV2Available) {
|
|
206
|
+
detectSpinner.succeed('BYAN v2.0 detected (Runtime + Platform)');
|
|
207
|
+
console.log(chalk.cyan(' ℹ Architecture 4 Pilliers + v2.0 Core Components'));
|
|
208
|
+
} else {
|
|
209
|
+
detectSpinner.succeed('BYAN v1.0 detected (Platform only)');
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Step 3: Platform selection
|
|
213
|
+
const { platform } = await inquirer.prompt([
|
|
214
|
+
{
|
|
215
|
+
type: 'list',
|
|
216
|
+
name: 'platform',
|
|
217
|
+
message: 'Select platform to install for:',
|
|
218
|
+
choices: [
|
|
219
|
+
{ name: 'GitHub Copilot CLI', value: 'copilot' },
|
|
220
|
+
{ name: 'VSCode', value: 'vscode' },
|
|
221
|
+
{ name: 'Claude Code', value: 'claude' },
|
|
222
|
+
{ name: 'Codex', value: 'codex' },
|
|
223
|
+
{ name: 'All platforms', value: 'all' }
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
]);
|
|
227
|
+
|
|
228
|
+
// Step 4: User configuration
|
|
229
|
+
const config = await inquirer.prompt([
|
|
230
|
+
{
|
|
231
|
+
type: 'input',
|
|
232
|
+
name: 'userName',
|
|
233
|
+
message: 'Your name:',
|
|
234
|
+
default: 'Developer'
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
type: 'list',
|
|
238
|
+
name: 'language',
|
|
239
|
+
message: 'Communication language:',
|
|
240
|
+
choices: ['Francais', 'English'],
|
|
241
|
+
default: 'English'
|
|
242
|
+
}
|
|
243
|
+
]);
|
|
244
|
+
|
|
245
|
+
// Step 5: Install v2.0 structure (if available)
|
|
246
|
+
let v2Installed = false;
|
|
247
|
+
|
|
248
|
+
if (v2Detection.isV2Available) {
|
|
249
|
+
const { installV2 } = await inquirer.prompt([
|
|
250
|
+
{
|
|
251
|
+
type: 'confirm',
|
|
252
|
+
name: 'installV2',
|
|
253
|
+
message: 'Install BYAN v2.0 runtime components (src/, tests)?',
|
|
254
|
+
default: true
|
|
255
|
+
}
|
|
256
|
+
]);
|
|
257
|
+
|
|
258
|
+
if (installV2) {
|
|
259
|
+
const v2Spinner = ora('Installing v2.0 runtime...').start();
|
|
260
|
+
|
|
261
|
+
try {
|
|
262
|
+
const copiedCount = await copyV2Runtime(templateDir, projectRoot, v2Spinner);
|
|
263
|
+
await mergePackageJson(templateDir, projectRoot, v2Spinner);
|
|
264
|
+
|
|
265
|
+
v2Spinner.succeed(`v2.0 runtime installed (${copiedCount} components)`);
|
|
266
|
+
v2Installed = true;
|
|
267
|
+
} catch (error) {
|
|
268
|
+
v2Spinner.fail('Error installing v2.0 runtime');
|
|
269
|
+
console.error(chalk.red('Details:'), error.message);
|
|
270
|
+
v2Installed = false;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// Step 6: Create directory structure (Platform - _bmad)
|
|
276
|
+
const installSpinner = ora('Creating directory structure...').start();
|
|
277
|
+
|
|
278
|
+
const bmadDir = path.join(projectRoot, '_bmad');
|
|
279
|
+
const bmbDir = path.join(bmadDir, 'bmb');
|
|
280
|
+
const githubAgentsDir = path.join(projectRoot, '.github', 'agents');
|
|
281
|
+
|
|
282
|
+
await fs.ensureDir(path.join(bmadDir, 'bmb', 'agents'));
|
|
283
|
+
await fs.ensureDir(path.join(bmadDir, 'bmb', 'workflows', 'byan', 'steps'));
|
|
284
|
+
await fs.ensureDir(path.join(bmadDir, 'bmb', 'workflows', 'byan', 'templates'));
|
|
285
|
+
await fs.ensureDir(path.join(bmadDir, 'bmb', 'workflows', 'byan', 'data'));
|
|
286
|
+
await fs.ensureDir(path.join(bmadDir, 'core'));
|
|
287
|
+
await fs.ensureDir(path.join(bmadDir, '_config'));
|
|
288
|
+
await fs.ensureDir(path.join(bmadDir, '_memory'));
|
|
289
|
+
await fs.ensureDir(path.join(bmadDir, '_output'));
|
|
290
|
+
await fs.ensureDir(githubAgentsDir);
|
|
291
|
+
|
|
292
|
+
installSpinner.succeed('Directory structure created');
|
|
293
|
+
|
|
294
|
+
// Step 7: Copy BYAN platform files from template
|
|
295
|
+
const copySpinner = ora('Installing BYAN platform files...').start();
|
|
296
|
+
|
|
297
|
+
try {
|
|
298
|
+
// Copy agent files
|
|
299
|
+
const agentsSource = path.join(templateDir, '_bmad', 'bmb', 'agents');
|
|
300
|
+
const agentsDest = path.join(bmbDir, 'agents');
|
|
301
|
+
|
|
302
|
+
if (await fs.pathExists(agentsSource)) {
|
|
303
|
+
await fs.copy(agentsSource, agentsDest, { overwrite: true });
|
|
304
|
+
copySpinner.text = 'Copied agent files...';
|
|
305
|
+
console.log(chalk.green(` ✓ Agents: ${agentsSource} → ${agentsDest}`));
|
|
306
|
+
} else {
|
|
307
|
+
copySpinner.warn(`⚠ Agent source not found: ${agentsSource}`);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Copy workflow files
|
|
311
|
+
const workflowsSource = path.join(templateDir, '_bmad', 'bmb', 'workflows', 'byan');
|
|
312
|
+
const workflowsDest = path.join(bmbDir, 'workflows', 'byan');
|
|
313
|
+
|
|
314
|
+
if (await fs.pathExists(workflowsSource)) {
|
|
315
|
+
await fs.copy(workflowsSource, workflowsDest, { overwrite: true });
|
|
316
|
+
copySpinner.text = 'Copied workflow files...';
|
|
317
|
+
console.log(chalk.green(` ✓ Workflows: ${workflowsSource} → ${workflowsDest}`));
|
|
318
|
+
} else {
|
|
319
|
+
copySpinner.warn(`⚠ Workflow source not found: ${workflowsSource}`);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// Copy .github/agents files
|
|
323
|
+
const githubAgentsSource = path.join(templateDir, '.github', 'agents');
|
|
324
|
+
|
|
325
|
+
if (await fs.pathExists(githubAgentsSource)) {
|
|
326
|
+
await fs.copy(githubAgentsSource, githubAgentsDir, { overwrite: true });
|
|
327
|
+
copySpinner.text = 'Copied Copilot CLI agent stubs...';
|
|
328
|
+
console.log(chalk.green(` ✓ GitHub agents: ${githubAgentsSource} → ${githubAgentsDir}`));
|
|
329
|
+
} else {
|
|
330
|
+
copySpinner.warn(`⚠ GitHub agents source not found: ${githubAgentsSource}`);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
copySpinner.succeed('BYAN platform files installed');
|
|
334
|
+
} catch (error) {
|
|
335
|
+
copySpinner.fail('Error copying files');
|
|
336
|
+
console.error(chalk.red('Details:'), error.message);
|
|
337
|
+
console.error(chalk.red('Stack:'), error.stack);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// Step 8: Create config.yaml
|
|
341
|
+
const configSpinner = ora('Generating configuration...').start();
|
|
342
|
+
|
|
343
|
+
const configContent = {
|
|
344
|
+
bmb_creations_output_folder: "{project-root}/_bmad-output/bmb-creations",
|
|
345
|
+
user_name: config.userName,
|
|
346
|
+
communication_language: config.language,
|
|
347
|
+
document_output_language: config.language,
|
|
348
|
+
output_folder: "{project-root}/_bmad-output",
|
|
349
|
+
platform: platform,
|
|
350
|
+
byan_version: v2Installed ? '2.0.0-alpha.1' : '1.0.0'
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
const configPath = path.join(bmbDir, 'config.yaml');
|
|
354
|
+
await fs.writeFile(configPath, yaml.dump(configContent), 'utf8');
|
|
355
|
+
|
|
356
|
+
configSpinner.succeed('Configuration generated');
|
|
357
|
+
|
|
358
|
+
// Step 9: Create package.json script
|
|
359
|
+
const shortcutSpinner = ora('Creating shortcuts...').start();
|
|
360
|
+
|
|
361
|
+
if (hasPackageJson || v2Installed) {
|
|
362
|
+
const pkgPath = path.join(projectRoot, 'package.json');
|
|
363
|
+
const pkg = await fs.readJson(pkgPath);
|
|
364
|
+
|
|
365
|
+
if (!pkg.scripts) pkg.scripts = {};
|
|
366
|
+
|
|
367
|
+
if (!pkg.scripts.byan) {
|
|
368
|
+
pkg.scripts.byan = 'echo "BYAN agent installed. Use: copilot and type /agent"';
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
await fs.writeJson(pkgPath, pkg, { spaces: 2 });
|
|
372
|
+
shortcutSpinner.succeed('NPM script added');
|
|
373
|
+
} else {
|
|
374
|
+
shortcutSpinner.succeed('Shortcuts created');
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// Step 10: Verification
|
|
378
|
+
const verifySpinner = ora('Verifying installation...').start();
|
|
379
|
+
|
|
380
|
+
const checks = [
|
|
381
|
+
{ name: 'Agents directory', path: path.join(bmbDir, 'agents') },
|
|
382
|
+
{ name: 'BYAN agent', path: path.join(bmbDir, 'agents', 'byan.md') },
|
|
383
|
+
{ name: 'Workflows', path: path.join(bmbDir, 'workflows', 'byan') },
|
|
384
|
+
{ name: 'Config', path: configPath },
|
|
385
|
+
{ name: 'GitHub agents dir', path: githubAgentsDir }
|
|
386
|
+
];
|
|
387
|
+
|
|
388
|
+
// Add v2.0 checks if installed
|
|
389
|
+
if (v2Installed) {
|
|
390
|
+
checks.push(
|
|
391
|
+
{ name: 'v2.0 src/', path: path.join(projectRoot, 'src') },
|
|
392
|
+
{ name: 'v2.0 tests', path: path.join(projectRoot, '__tests__') },
|
|
393
|
+
{ name: 'v2.0 entry point', path: path.join(projectRoot, 'src', 'index.js') },
|
|
394
|
+
{ name: 'package.json', path: path.join(projectRoot, 'package.json') }
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
let passed = 0;
|
|
399
|
+
let failed = [];
|
|
400
|
+
|
|
401
|
+
for (const check of checks) {
|
|
402
|
+
if (await fs.pathExists(check.path)) {
|
|
403
|
+
passed++;
|
|
404
|
+
} else {
|
|
405
|
+
failed.push(check.name);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
if (passed === checks.length) {
|
|
410
|
+
verifySpinner.succeed(`Verification: ${passed}/${checks.length} checks passed ✅`);
|
|
411
|
+
} else {
|
|
412
|
+
verifySpinner.warn(`Verification: ${passed}/${checks.length} checks passed`);
|
|
413
|
+
if (failed.length > 0) {
|
|
414
|
+
console.log(chalk.yellow(' Missing:'), failed.join(', '));
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// Success message
|
|
419
|
+
console.log('');
|
|
420
|
+
console.log(chalk.green('╔════════════════════════════════════════════════════════════╗'));
|
|
421
|
+
console.log(chalk.green('║ ║'));
|
|
422
|
+
console.log(chalk.green('║ ✅ BYAN INSTALLATION COMPLETE! ║'));
|
|
423
|
+
console.log(chalk.green('║ ║'));
|
|
424
|
+
console.log(chalk.green('╚════════════════════════════════════════════════════════════╝'));
|
|
425
|
+
console.log('');
|
|
426
|
+
|
|
427
|
+
console.log(chalk.bold('Installation Summary:'));
|
|
428
|
+
console.log(` • Platform: ${chalk.cyan(platform)}`);
|
|
429
|
+
console.log(` • Version: ${chalk.cyan(v2Installed ? 'v2.0.0-alpha.1 (Runtime + Platform)' : 'v1.0.0 (Platform only)')}`);
|
|
430
|
+
console.log(` • Installation Directory: ${chalk.cyan(bmbDir)}`);
|
|
431
|
+
console.log(` • Configuration: ${chalk.cyan(configPath)}`);
|
|
432
|
+
console.log(` • User: ${chalk.cyan(config.userName)}`);
|
|
433
|
+
console.log(` • Language: ${chalk.cyan(config.language)}`);
|
|
434
|
+
|
|
435
|
+
if (v2Installed) {
|
|
436
|
+
console.log(chalk.cyan('\n v2.0 Components Installed:'));
|
|
437
|
+
console.log(chalk.cyan(' ✓ Core: Context, Cache, Dispatcher, Worker Pool, Workflow'));
|
|
438
|
+
console.log(chalk.cyan(' ✓ Observability: Logger, Metrics, Dashboard'));
|
|
439
|
+
console.log(chalk.cyan(' ✓ Tests: 9 test suites with 364 tests'));
|
|
440
|
+
console.log(chalk.cyan(' ✓ Entry Point: src/index.js'));
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
console.log('');
|
|
444
|
+
|
|
445
|
+
console.log(chalk.bold('Next Steps:'));
|
|
446
|
+
console.log('');
|
|
447
|
+
|
|
448
|
+
if (v2Installed) {
|
|
449
|
+
console.log(chalk.yellow('1. Install dependencies:'));
|
|
450
|
+
console.log(` ${chalk.blue('npm install')}`);
|
|
451
|
+
console.log('');
|
|
452
|
+
|
|
453
|
+
console.log(chalk.yellow('2. Run tests:'));
|
|
454
|
+
console.log(` ${chalk.blue('npm test')}`);
|
|
455
|
+
console.log('');
|
|
456
|
+
|
|
457
|
+
console.log(chalk.yellow('3. Test entry point:'));
|
|
458
|
+
console.log(` ${chalk.blue('node -e "const byan = require(\'./src/index.js\'); console.log(byan.createByanInstance)"')}`);
|
|
459
|
+
console.log('');
|
|
460
|
+
|
|
461
|
+
console.log(chalk.yellow('4. Activate BYAN agent:'));
|
|
462
|
+
} else {
|
|
463
|
+
console.log(chalk.yellow('1. Activate BYAN agent:'));
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
if (platform === 'copilot') {
|
|
467
|
+
console.log(` ${chalk.blue('copilot')}`);
|
|
468
|
+
console.log(` Then type: ${chalk.blue('/agent')}`);
|
|
469
|
+
console.log(` Select: ${chalk.cyan('byan')} (create agents)`);
|
|
470
|
+
} else if (platform === 'vscode') {
|
|
471
|
+
console.log(' Open VSCode Command Palette (Ctrl+Shift+P)');
|
|
472
|
+
console.log(' Type: \'Activate BYAN Agent\'');
|
|
473
|
+
} else if (platform === 'claude') {
|
|
474
|
+
console.log(` ${chalk.blue('claude chat --agent byan')}`);
|
|
475
|
+
} else {
|
|
476
|
+
console.log(' Follow your platform\'s agent activation procedure');
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
console.log('');
|
|
480
|
+
console.log(chalk.gray('Need help? Type \'/bmad-help\' when BYAN is active'));
|
|
481
|
+
console.log('');
|
|
482
|
+
console.log(chalk.blue('Happy agent building! 🏗️'));
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
// CLI Program
|
|
486
|
+
program
|
|
487
|
+
.name('create-byan-agent')
|
|
488
|
+
.description('Install BYAN v2.0 - Builder of YAN agent creator with v2.0 runtime support')
|
|
489
|
+
.version(BYAN_VERSION)
|
|
490
|
+
.action(install);
|
|
491
|
+
|
|
492
|
+
program.parse(process.argv);
|