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
package/bin/create-byan-agent.js
CHANGED
|
@@ -1,322 +1,155 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
${chalk.blue('
|
|
22
|
-
${chalk.blue('
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
//
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
{
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
{
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
if (await fs.pathExists(agentsSource)) {
|
|
157
|
-
await fs.copy(agentsSource, agentsDest, { overwrite: true });
|
|
158
|
-
copySpinner.text = 'Copied agent files...';
|
|
159
|
-
console.log(chalk.green(` ā Agents: ${agentsSource} ā ${agentsDest}`));
|
|
160
|
-
} else {
|
|
161
|
-
copySpinner.warn(`ā Agent source not found: ${agentsSource}`);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// ā
FIX #5: Copy workflow files from _bmad/bmb/workflows/byan
|
|
165
|
-
const workflowsSource = path.join(templateDir, '_bmad', 'bmb', 'workflows', 'byan');
|
|
166
|
-
const workflowsDest = path.join(bmbDir, 'workflows', 'byan');
|
|
167
|
-
|
|
168
|
-
if (await fs.pathExists(workflowsSource)) {
|
|
169
|
-
await fs.copy(workflowsSource, workflowsDest, { overwrite: true });
|
|
170
|
-
copySpinner.text = 'Copied workflow files...';
|
|
171
|
-
console.log(chalk.green(` ā Workflows: ${workflowsSource} ā ${workflowsDest}`));
|
|
172
|
-
} else {
|
|
173
|
-
copySpinner.warn(`ā Workflow source not found: ${workflowsSource}`);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// ā
FIX #6: Copy .github/agents files (stubs for Copilot CLI detection)
|
|
177
|
-
const githubAgentsSource = path.join(templateDir, '.github', 'agents');
|
|
178
|
-
|
|
179
|
-
if (await fs.pathExists(githubAgentsSource)) {
|
|
180
|
-
await fs.copy(githubAgentsSource, githubAgentsDir, { overwrite: true });
|
|
181
|
-
copySpinner.text = 'Copied Copilot CLI agent stubs...';
|
|
182
|
-
console.log(chalk.green(` ā GitHub agents: ${githubAgentsSource} ā ${githubAgentsDir}`));
|
|
183
|
-
} else {
|
|
184
|
-
copySpinner.warn(`ā GitHub agents source not found: ${githubAgentsSource}`);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
copySpinner.succeed('BYAN files installed');
|
|
188
|
-
} catch (error) {
|
|
189
|
-
copySpinner.fail('Error copying files');
|
|
190
|
-
console.error(chalk.red('Details:'), error.message);
|
|
191
|
-
console.error(chalk.red('Stack:'), error.stack);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// Step 6: Create config.yaml
|
|
195
|
-
const configSpinner = ora('Generating configuration...').start();
|
|
196
|
-
|
|
197
|
-
const configContent = {
|
|
198
|
-
bmb_creations_output_folder: "{project-root}/_bmad-output/bmb-creations",
|
|
199
|
-
user_name: config.userName,
|
|
200
|
-
communication_language: config.language,
|
|
201
|
-
document_output_language: config.language,
|
|
202
|
-
output_folder: "{project-root}/_bmad-output",
|
|
203
|
-
platform: platform
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
const configPath = path.join(bmbDir, 'config.yaml');
|
|
207
|
-
await fs.writeFile(configPath, yaml.dump(configContent), 'utf8');
|
|
208
|
-
|
|
209
|
-
configSpinner.succeed('Configuration generated');
|
|
210
|
-
|
|
211
|
-
// Step 7: Create package.json script
|
|
212
|
-
const shortcutSpinner = ora('Creating shortcuts...').start();
|
|
213
|
-
|
|
214
|
-
if (hasPackageJson) {
|
|
215
|
-
const pkgPath = path.join(projectRoot, 'package.json');
|
|
216
|
-
const pkg = await fs.readJson(pkgPath);
|
|
217
|
-
|
|
218
|
-
if (!pkg.scripts) pkg.scripts = {};
|
|
219
|
-
|
|
220
|
-
if (!pkg.scripts.byan) {
|
|
221
|
-
pkg.scripts.byan = 'echo "BYAN agent installed. Use: copilot and type /agent"';
|
|
222
|
-
await fs.writeJson(pkgPath, pkg, { spaces: 2 });
|
|
223
|
-
shortcutSpinner.succeed('NPM script added');
|
|
224
|
-
} else {
|
|
225
|
-
shortcutSpinner.info('NPM script already exists');
|
|
226
|
-
}
|
|
227
|
-
} else {
|
|
228
|
-
shortcutSpinner.succeed('Shortcuts created');
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// Step 8: Verification
|
|
232
|
-
const verifySpinner = ora('Verifying installation...').start();
|
|
233
|
-
|
|
234
|
-
const checks = [
|
|
235
|
-
{ name: 'Agents directory', path: path.join(bmbDir, 'agents') },
|
|
236
|
-
{ name: 'BYAN agent', path: path.join(bmbDir, 'agents', 'byan.md') },
|
|
237
|
-
{ name: 'RACHID agent', path: path.join(bmbDir, 'agents', 'rachid.md') },
|
|
238
|
-
{ name: 'MARC agent', path: path.join(bmbDir, 'agents', 'marc.md') },
|
|
239
|
-
{ name: 'Workflows', path: path.join(bmbDir, 'workflows', 'byan') },
|
|
240
|
-
{ name: 'Config', path: configPath },
|
|
241
|
-
{ name: 'GitHub agents dir', path: githubAgentsDir },
|
|
242
|
-
{ name: 'BYAN stub', path: path.join(githubAgentsDir, 'bmad-agent-byan.md') },
|
|
243
|
-
{ name: 'RACHID stub', path: path.join(githubAgentsDir, 'bmad-agent-rachid.md') },
|
|
244
|
-
{ name: 'MARC stub', path: path.join(githubAgentsDir, 'bmad-agent-marc.md') }
|
|
245
|
-
];
|
|
246
|
-
|
|
247
|
-
let passed = 0;
|
|
248
|
-
let failed = [];
|
|
249
|
-
|
|
250
|
-
for (const check of checks) {
|
|
251
|
-
if (await fs.pathExists(check.path)) {
|
|
252
|
-
passed++;
|
|
253
|
-
} else {
|
|
254
|
-
failed.push(check.name);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
if (passed === checks.length) {
|
|
259
|
-
verifySpinner.succeed(`Verification: ${passed}/${checks.length} checks passed ā
`);
|
|
260
|
-
} else {
|
|
261
|
-
verifySpinner.warn(`Verification: ${passed}/${checks.length} checks passed`);
|
|
262
|
-
if (failed.length > 0) {
|
|
263
|
-
console.log(chalk.yellow(' Missing:'), failed.join(', '));
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
// Success message
|
|
268
|
-
console.log('');
|
|
269
|
-
console.log(chalk.green('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā'));
|
|
270
|
-
console.log(chalk.green('ā ā'));
|
|
271
|
-
console.log(chalk.green('ā ā
BYAN INSTALLATION COMPLETE! ā'));
|
|
272
|
-
console.log(chalk.green('ā ā'));
|
|
273
|
-
console.log(chalk.green('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā'));
|
|
274
|
-
console.log('');
|
|
275
|
-
|
|
276
|
-
console.log(chalk.bold('Installation Summary:'));
|
|
277
|
-
console.log(` ⢠Platform: ${chalk.cyan(platform)}`);
|
|
278
|
-
console.log(` ⢠Installation Directory: ${chalk.cyan(bmbDir)}`);
|
|
279
|
-
console.log(` ⢠Configuration: ${chalk.cyan(configPath)}`);
|
|
280
|
-
console.log(` ⢠User: ${chalk.cyan(config.userName)}`);
|
|
281
|
-
console.log(` ⢠Language: ${chalk.cyan(config.language)}`);
|
|
282
|
-
console.log(` ⢠Agents Installed: ${chalk.cyan('BYAN, RACHID, MARC')}`);
|
|
283
|
-
console.log('');
|
|
284
|
-
|
|
285
|
-
console.log(chalk.bold('Next Steps:'));
|
|
286
|
-
console.log('');
|
|
287
|
-
console.log(chalk.yellow('1. Activate agents in GitHub Copilot CLI:'));
|
|
288
|
-
console.log(` ${chalk.blue('copilot')}`);
|
|
289
|
-
console.log(` Then type: ${chalk.blue('/agent')}`);
|
|
290
|
-
console.log(` Select: ${chalk.cyan('byan')} (create agents)`);
|
|
291
|
-
console.log(` ${chalk.cyan('rachid')} (NPM deployment)`);
|
|
292
|
-
console.log(` ${chalk.cyan('marc')} (Copilot CLI integration)`);
|
|
293
|
-
console.log('');
|
|
294
|
-
|
|
295
|
-
console.log(chalk.yellow('2. Create your first agent with BYAN:'));
|
|
296
|
-
console.log(' [INT] Start Intelligent Interview (30-45 min)');
|
|
297
|
-
console.log(' [QC] Quick Create (10 min)');
|
|
298
|
-
console.log('');
|
|
299
|
-
|
|
300
|
-
console.log(chalk.yellow('3. Deploy with RACHID:'));
|
|
301
|
-
console.log(' Use RACHID to publish BYAN to npm');
|
|
302
|
-
console.log(' Validate package.json and dependencies');
|
|
303
|
-
console.log('');
|
|
304
|
-
|
|
305
|
-
console.log(chalk.yellow('4. Integrate with MARC:'));
|
|
306
|
-
console.log(' Use MARC to test /agent detection');
|
|
307
|
-
console.log(' Validate .github/agents/ structure');
|
|
308
|
-
console.log('');
|
|
309
|
-
|
|
310
|
-
console.log(chalk.gray('Need help? Type \'/bmad-help\' when BYAN is active'));
|
|
311
|
-
console.log('');
|
|
312
|
-
console.log(chalk.blue('Happy agent building! šļø'));
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
// CLI Program
|
|
316
|
-
program
|
|
317
|
-
.name('create-byan-agent')
|
|
318
|
-
.description('Install BYAN - Builder of YAN agent creator with RACHID and MARC')
|
|
319
|
-
.version(BYAN_VERSION)
|
|
320
|
-
.action(install);
|
|
321
|
-
|
|
322
|
-
program.parse(process.argv);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const { program } = require('commander');
|
|
5
|
+
const chalk = require('chalk');
|
|
6
|
+
|
|
7
|
+
// YANSTALLER Modules
|
|
8
|
+
const detector = require('../lib/yanstaller/detector');
|
|
9
|
+
const recommender = require('../lib/yanstaller/recommender');
|
|
10
|
+
const interviewer = require('../lib/yanstaller/interviewer');
|
|
11
|
+
const installer = require('../lib/yanstaller/installer');
|
|
12
|
+
const validator = require('../lib/yanstaller/validator');
|
|
13
|
+
const wizard = require('../lib/yanstaller/wizard');
|
|
14
|
+
const backuper = require('../lib/yanstaller/backuper');
|
|
15
|
+
const logger = require('../lib/utils/logger');
|
|
16
|
+
|
|
17
|
+
const YANSTALLER_VERSION = '1.2.0';
|
|
18
|
+
|
|
19
|
+
// ASCII Art Banner
|
|
20
|
+
const banner = `
|
|
21
|
+
${chalk.blue('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā')}
|
|
22
|
+
${chalk.blue('ā')} ${chalk.blue('ā')}
|
|
23
|
+
${chalk.blue('ā')} ${chalk.bold('šļø YANSTALLER v' + YANSTALLER_VERSION)} ${chalk.blue('ā')}
|
|
24
|
+
${chalk.blue('ā')} ${chalk.gray('Intelligent BYAN Installer')} ${chalk.blue('ā')}
|
|
25
|
+
${chalk.blue('ā')} ${chalk.blue('ā')}
|
|
26
|
+
${chalk.blue('ā')} ${chalk.gray('Methodology: Merise Agile + TDD + 64 Mantras')} ${chalk.blue('ā')}
|
|
27
|
+
${chalk.blue('ā')} ${chalk.gray('29 Agents ⢠Multi-Platform ⢠Auto-Fix')} ${chalk.blue('ā')}
|
|
28
|
+
${chalk.blue('ā')} ${chalk.blue('ā')}
|
|
29
|
+
${chalk.blue('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā')}
|
|
30
|
+
`;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Main YANSTALLER Installation Flow
|
|
34
|
+
*
|
|
35
|
+
* Orchestrates the 7-step intelligent installation:
|
|
36
|
+
* 1. DETECT - Platform & project analysis
|
|
37
|
+
* 2. RECOMMEND - Intelligent agent recommendations
|
|
38
|
+
* 3. INTERVIEW - 7-question personalization
|
|
39
|
+
* 4. BACKUP - Pre-install safety (optional)
|
|
40
|
+
* 5. INSTALL - Core installation
|
|
41
|
+
* 6. VALIDATE - 10 automated checks
|
|
42
|
+
* 7. WIZARD - Post-install actions
|
|
43
|
+
*/
|
|
44
|
+
async function main() {
|
|
45
|
+
try {
|
|
46
|
+
console.clear();
|
|
47
|
+
console.log(banner);
|
|
48
|
+
|
|
49
|
+
const projectRoot = process.cwd();
|
|
50
|
+
|
|
51
|
+
// STEP 1: DETECT - Platform & Project Analysis
|
|
52
|
+
logger.info(chalk.bold('\nš STEP 1/7: Detection\n'));
|
|
53
|
+
const detection = await detector.detect({ projectRoot });
|
|
54
|
+
|
|
55
|
+
logger.info(`ā Platforms detected: ${chalk.cyan(detection.platforms.join(', ') || 'none')}`);
|
|
56
|
+
if (detection.projectType) {
|
|
57
|
+
logger.info(`ā Project type: ${chalk.cyan(detection.projectType)}`);
|
|
58
|
+
}
|
|
59
|
+
if (detection.framework) {
|
|
60
|
+
logger.info(`ā Framework: ${chalk.cyan(detection.framework)}`);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// STEP 2: RECOMMEND - Intelligent Agent Selection
|
|
64
|
+
logger.info(chalk.bold('\nšÆ STEP 2/7: Recommendations\n'));
|
|
65
|
+
const recommendations = await recommender.recommend({
|
|
66
|
+
projectRoot,
|
|
67
|
+
detection
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
if (recommendations.agents && recommendations.agents.length > 0) {
|
|
71
|
+
logger.info(`ā Recommended agents: ${chalk.cyan(recommendations.agents.join(', '))}`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// STEP 3: INTERVIEW - 7-Question Personalization
|
|
75
|
+
logger.info(chalk.bold('\nšļø STEP 3/7: Interview\n'));
|
|
76
|
+
const answers = await interviewer.ask(recommendations);
|
|
77
|
+
|
|
78
|
+
// STEP 4: BACKUP (optional)
|
|
79
|
+
if (answers.createBackup) {
|
|
80
|
+
logger.info(chalk.bold('\nš¾ STEP 4/7: Backup\n'));
|
|
81
|
+
try {
|
|
82
|
+
const backup = await backuper.backup({ projectRoot });
|
|
83
|
+
logger.info(`ā Backup created: ${chalk.cyan(backup.backupPath)}`);
|
|
84
|
+
} catch (error) {
|
|
85
|
+
logger.warn(`ā Backup failed (non-critical): ${error.message}`);
|
|
86
|
+
}
|
|
87
|
+
} else {
|
|
88
|
+
logger.info(chalk.bold('\nāļø STEP 4/7: Backup (skipped)\n'));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// STEP 5: INSTALL - Core Installation
|
|
92
|
+
logger.info(chalk.bold('\nš STEP 5/7: Installation\n'));
|
|
93
|
+
const installResult = await installer.install({
|
|
94
|
+
projectRoot,
|
|
95
|
+
agents: answers.agents,
|
|
96
|
+
platforms: answers.targetPlatforms,
|
|
97
|
+
userName: answers.userName,
|
|
98
|
+
language: answers.language,
|
|
99
|
+
mode: answers.mode
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
logger.info(`ā Installed ${chalk.cyan(installResult.installedAgents.length)} agents`);
|
|
103
|
+
logger.info(`ā Created ${chalk.cyan(installResult.createdDirectories)} directories`);
|
|
104
|
+
logger.info(`ā Generated ${chalk.cyan(installResult.generatedStubs)} platform stubs`);
|
|
105
|
+
|
|
106
|
+
// STEP 6: VALIDATE - 10 Automated Checks
|
|
107
|
+
logger.info(chalk.bold('\nā
STEP 6/7: Validation\n'));
|
|
108
|
+
const validation = await validator.validate({ projectRoot });
|
|
109
|
+
|
|
110
|
+
if (validation.valid) {
|
|
111
|
+
logger.info(chalk.green('ā All validation checks passed!'));
|
|
112
|
+
} else {
|
|
113
|
+
logger.warn(chalk.yellow(`ā ${validation.errors.length} errors, ${validation.warnings.length} warnings`));
|
|
114
|
+
if (validation.errors.length > 0) {
|
|
115
|
+
validation.errors.forEach(err => logger.error(` ā ${err}`));
|
|
116
|
+
}
|
|
117
|
+
if (validation.warnings.length > 0) {
|
|
118
|
+
validation.warnings.forEach(warn => logger.warn(` ā ${warn}`));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// STEP 7: WIZARD - Post-Install Actions
|
|
123
|
+
logger.info(chalk.bold('\nš§ STEP 7/7: Post-Install Wizard\n'));
|
|
124
|
+
await wizard.show({
|
|
125
|
+
installedAgents: installResult.installedAgents,
|
|
126
|
+
platforms: answers.targetPlatforms,
|
|
127
|
+
userName: answers.userName,
|
|
128
|
+
language: answers.language
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
} catch (error) {
|
|
132
|
+
logger.error(chalk.red('\nā Installation failed:\n'));
|
|
133
|
+
logger.error(error.message);
|
|
134
|
+
if (error.stack) {
|
|
135
|
+
logger.error(chalk.gray(error.stack));
|
|
136
|
+
}
|
|
137
|
+
process.exit(1);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// CLI Program
|
|
142
|
+
program
|
|
143
|
+
.name('create-byan-agent')
|
|
144
|
+
.description('YANSTALLER - Intelligent installer for BYAN ecosystem (29 agents, multi-platform)')
|
|
145
|
+
.version(YANSTALLER_VERSION)
|
|
146
|
+
.option('--silent', 'Silent installation (no prompts)')
|
|
147
|
+
.option('--agents <agents>', 'Comma-separated list of agents to install')
|
|
148
|
+
.option('--platforms <platforms>', 'Comma-separated list of platforms (copilot-cli,vscode,claude-code,codex)')
|
|
149
|
+
.option('--mode <mode>', 'Installation mode: recommended, custom, minimal, full')
|
|
150
|
+
.option('--no-backup', 'Skip pre-install backup')
|
|
151
|
+
.option('--dry-run', 'Simulate installation without making changes')
|
|
152
|
+
.option('--verbose', 'Verbose logging')
|
|
153
|
+
.action(main);
|
|
154
|
+
|
|
155
|
+
program.parse(process.argv);
|
package/lib/errors.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom Error Classes
|
|
3
|
+
*
|
|
4
|
+
* @module errors
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
class YanInstallerError extends Error {
|
|
8
|
+
constructor(message, options) {
|
|
9
|
+
super(message, options);
|
|
10
|
+
this.name = 'YanInstallerError';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
class NodeVersionError extends YanInstallerError {
|
|
15
|
+
constructor(required, current) {
|
|
16
|
+
super(`Node.js ${required}+ required, got ${current}`);
|
|
17
|
+
this.name = 'NodeVersionError';
|
|
18
|
+
this.required = required;
|
|
19
|
+
this.current = current;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
class PlatformNotFoundError extends YanInstallerError {
|
|
24
|
+
constructor(platform) {
|
|
25
|
+
super(`Platform not found: ${platform}`);
|
|
26
|
+
this.name = 'PlatformNotFoundError';
|
|
27
|
+
this.platform = platform;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
class PermissionError extends YanInstallerError {
|
|
32
|
+
constructor(path) {
|
|
33
|
+
super(`Permission denied: ${path}`);
|
|
34
|
+
this.name = 'PermissionError';
|
|
35
|
+
this.path = path;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
class ValidationError extends YanInstallerError {
|
|
40
|
+
constructor(message, failures) {
|
|
41
|
+
super(message);
|
|
42
|
+
this.name = 'ValidationError';
|
|
43
|
+
this.failures = failures;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
class BackupError extends YanInstallerError {
|
|
48
|
+
constructor(message, options) {
|
|
49
|
+
super(message, options);
|
|
50
|
+
this.name = 'BackupError';
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
module.exports = {
|
|
55
|
+
YanInstallerError,
|
|
56
|
+
NodeVersionError,
|
|
57
|
+
PlatformNotFoundError,
|
|
58
|
+
PermissionError,
|
|
59
|
+
ValidationError,
|
|
60
|
+
BackupError
|
|
61
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exit Codes
|
|
3
|
+
*
|
|
4
|
+
* Standard exit codes for YANSTALLER CLI.
|
|
5
|
+
*
|
|
6
|
+
* @module exit-codes
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
module.exports = {
|
|
10
|
+
/**
|
|
11
|
+
* Success - Installation completed without errors
|
|
12
|
+
*/
|
|
13
|
+
SUCCESS: 0,
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Node.js version too old (< 18.0.0)
|
|
17
|
+
*/
|
|
18
|
+
NODE_VERSION_ERROR: 1,
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Permission denied (file system access)
|
|
22
|
+
*/
|
|
23
|
+
PERMISSION_ERROR: 2,
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Post-installation validation failed
|
|
27
|
+
*/
|
|
28
|
+
VALIDATION_FAILED: 3,
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Installation process failed
|
|
32
|
+
*/
|
|
33
|
+
INSTALLATION_FAILED: 4,
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Backup operation failed
|
|
37
|
+
*/
|
|
38
|
+
BACKUP_FAILED: 5,
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Platform not found or not supported
|
|
42
|
+
*/
|
|
43
|
+
PLATFORM_ERROR: 6,
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* User cancelled installation
|
|
47
|
+
*/
|
|
48
|
+
USER_CANCELLED: 7,
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Unknown error
|
|
52
|
+
*/
|
|
53
|
+
UNKNOWN_ERROR: 99
|
|
54
|
+
};
|