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.
Files changed (77) hide show
  1. package/CHANGELOG.md +196 -388
  2. package/LICENSE +21 -21
  3. package/README.md +420 -1264
  4. package/bin/create-byan-agent-backup.js +220 -220
  5. package/bin/create-byan-agent-fixed.js +301 -301
  6. package/bin/create-byan-agent-v2.js +492 -0
  7. package/bin/create-byan-agent.js +296 -561
  8. package/package.json +68 -64
  9. package/templates/.github/agents/bmad-agent-bmad-master.md +15 -15
  10. package/templates/.github/agents/bmad-agent-bmb-agent-builder.md +15 -15
  11. package/templates/.github/agents/bmad-agent-bmb-module-builder.md +15 -15
  12. package/templates/.github/agents/bmad-agent-bmb-workflow-builder.md +15 -15
  13. package/templates/.github/agents/bmad-agent-bmm-analyst.md +15 -15
  14. package/templates/.github/agents/bmad-agent-bmm-architect.md +15 -15
  15. package/templates/.github/agents/bmad-agent-bmm-dev.md +15 -15
  16. package/templates/.github/agents/bmad-agent-bmm-pm.md +15 -15
  17. package/templates/.github/agents/bmad-agent-bmm-quick-flow-solo-dev.md +15 -15
  18. package/templates/.github/agents/bmad-agent-bmm-quinn.md +15 -15
  19. package/templates/.github/agents/bmad-agent-bmm-sm.md +15 -15
  20. package/templates/.github/agents/bmad-agent-bmm-tech-writer.md +15 -15
  21. package/templates/.github/agents/bmad-agent-bmm-ux-designer.md +15 -15
  22. package/templates/.github/agents/bmad-agent-byan-test.md +32 -32
  23. package/templates/.github/agents/bmad-agent-byan.md +224 -224
  24. package/templates/.github/agents/bmad-agent-carmack.md +18 -18
  25. package/templates/.github/agents/bmad-agent-cis-brainstorming-coach.md +15 -15
  26. package/templates/.github/agents/bmad-agent-cis-creative-problem-solver.md +15 -15
  27. package/templates/.github/agents/bmad-agent-cis-design-thinking-coach.md +15 -15
  28. package/templates/.github/agents/bmad-agent-cis-innovation-strategist.md +15 -15
  29. package/templates/.github/agents/bmad-agent-cis-presentation-master.md +15 -15
  30. package/templates/.github/agents/bmad-agent-cis-storyteller.md +15 -15
  31. package/templates/.github/agents/bmad-agent-marc.md +48 -48
  32. package/templates/.github/agents/bmad-agent-patnote.md +48 -48
  33. package/templates/.github/agents/bmad-agent-rachid.md +47 -47
  34. package/templates/.github/agents/bmad-agent-tea-tea.md +15 -15
  35. package/templates/.github/agents/bmad-agent-test-dynamic.md +21 -21
  36. package/templates/.github/agents/franck.md +379 -379
  37. package/templates/_bmad/bmb/agents/agent-builder.md +59 -59
  38. package/templates/_bmad/bmb/agents/byan-test.md +116 -116
  39. package/templates/_bmad/bmb/agents/byan.md +215 -215
  40. package/templates/_bmad/bmb/agents/marc.md +303 -303
  41. package/templates/_bmad/bmb/agents/module-builder.md +60 -60
  42. package/templates/_bmad/bmb/agents/patnote.md +495 -495
  43. package/templates/_bmad/bmb/agents/rachid.md +184 -184
  44. package/templates/_bmad/bmb/agents/workflow-builder.md +61 -61
  45. package/templates/_bmad/bmb/workflows/byan/data/mantras.yaml +272 -272
  46. package/templates/_bmad/bmb/workflows/byan/data/templates.yaml +59 -59
  47. package/templates/_bmad/bmb/workflows/byan/delete-agent-workflow.md +657 -657
  48. package/templates/_bmad/bmb/workflows/byan/edit-agent-workflow.md +688 -688
  49. package/templates/_bmad/bmb/workflows/byan/interview-workflow.md +753 -753
  50. package/templates/_bmad/bmb/workflows/byan/quick-create-workflow.md +450 -450
  51. package/templates/_bmad/bmb/workflows/byan/templates/base-agent-template.md +79 -79
  52. package/templates/_bmad/bmb/workflows/byan/validate-agent-workflow.md +676 -676
  53. package/templates/_bmad/core/agents/carmack.md +238 -238
  54. package/lib/errors.js +0 -61
  55. package/lib/exit-codes.js +0 -54
  56. package/lib/platforms/claude-code.js +0 -113
  57. package/lib/platforms/codex.js +0 -92
  58. package/lib/platforms/copilot-cli.js +0 -123
  59. package/lib/platforms/index.js +0 -14
  60. package/lib/platforms/vscode.js +0 -51
  61. package/lib/utils/config-loader.js +0 -79
  62. package/lib/utils/file-utils.js +0 -117
  63. package/lib/utils/git-detector.js +0 -35
  64. package/lib/utils/logger.js +0 -64
  65. package/lib/utils/node-detector.js +0 -58
  66. package/lib/utils/os-detector.js +0 -74
  67. package/lib/utils/yaml-utils.js +0 -87
  68. package/lib/yanstaller/backuper.js +0 -308
  69. package/lib/yanstaller/detector.js +0 -141
  70. package/lib/yanstaller/index.js +0 -93
  71. package/lib/yanstaller/installer.js +0 -226
  72. package/lib/yanstaller/interviewer.js +0 -301
  73. package/lib/yanstaller/recommender.js +0 -308
  74. package/lib/yanstaller/troubleshooter.js +0 -498
  75. package/lib/yanstaller/validator.js +0 -602
  76. package/lib/yanstaller/wizard.js +0 -229
  77. package/templates/.github/agents/expert-merise-agile.md +0 -1
@@ -1,602 +0,0 @@
1
- /**
2
- * VALIDATOR Module
3
- *
4
- * Validates BYAN installation with 10 automated checks.
5
- *
6
- * Phase 4: 32h development
7
- *
8
- * @module yanstaller/validator
9
- */
10
-
11
- const path = require('path');
12
- const fileUtils = require('../utils/file-utils');
13
- const yamlUtils = require('../utils/yaml-utils');
14
- const { execSync } = require('child_process');
15
- const fs = require('fs-extra');
16
-
17
- /**
18
- * @typedef {Object} ValidationResult
19
- * @property {boolean} success - All checks passed
20
- * @property {CheckResult[]} checks - Individual check results
21
- * @property {string[]} errors - Critical errors
22
- * @property {string[]} warnings - Non-critical issues
23
- */
24
-
25
- /**
26
- * @typedef {Object} CheckResult
27
- * @property {string} id - Check identifier
28
- * @property {string} name - Human-readable check name
29
- * @property {boolean} passed
30
- * @property {string} [message] - Error/warning message if failed
31
- * @property {string} severity - 'critical' | 'warning'
32
- */
33
-
34
- /**
35
- * Validate BYAN installation
36
- *
37
- * @param {import('./installer').InstallConfig} config - Installation config
38
- * @returns {Promise<ValidationResult>}
39
- */
40
- async function validate(config) {
41
- const checks = [];
42
- const errors = [];
43
- const warnings = [];
44
-
45
- // Run all 10 checks in sequence
46
- checks.push(await checkBmadStructure(config));
47
- checks.push(await checkAgentFiles(config));
48
- checks.push(await checkStubsYamlFrontmatter(config));
49
- checks.push(await checkConfigFiles(config));
50
- checks.push(await checkPlatformDetection(config));
51
- checks.push(await checkFilePermissions(config));
52
- checks.push(await checkManifests(config));
53
- checks.push(await checkWorkflows(config));
54
- checks.push(await checkTemplates(config));
55
- checks.push(await checkDependencies(config));
56
-
57
- // Collect errors and warnings
58
- for (const check of checks) {
59
- if (!check.passed) {
60
- if (check.severity === 'critical') {
61
- errors.push(`[${check.id}] ${check.message}`);
62
- } else {
63
- warnings.push(`[${check.id}] ${check.message}`);
64
- }
65
- }
66
- }
67
-
68
- const allPassed = checks.every(c => c.passed || c.severity === 'warning');
69
-
70
- return {
71
- success: allPassed,
72
- checks,
73
- errors,
74
- warnings
75
- };
76
- }
77
-
78
- /**
79
- * Check 1: _bmad/ structure exists
80
- */
81
- async function checkBmadStructure(config) {
82
- const projectRoot = config.projectRoot || process.cwd();
83
- const requiredDirs = [
84
- '_bmad',
85
- '_bmad/_config',
86
- '_bmad/_memory',
87
- '_bmad/_output',
88
- '_bmad/core/agents',
89
- '_bmad/bmm/agents',
90
- '_bmad/bmb/agents',
91
- '_bmad/tea/agents',
92
- '_bmad/cis/agents'
93
- ];
94
-
95
- const missingDirs = [];
96
- for (const dir of requiredDirs) {
97
- const dirPath = path.join(projectRoot, dir);
98
- if (!await fileUtils.exists(dirPath)) {
99
- missingDirs.push(dir);
100
- }
101
- }
102
-
103
- if (missingDirs.length > 0) {
104
- return {
105
- id: 'bmad-structure',
106
- name: '_bmad/ structure',
107
- passed: false,
108
- message: `Missing directories: ${missingDirs.join(', ')}`,
109
- severity: 'critical'
110
- };
111
- }
112
-
113
- return {
114
- id: 'bmad-structure',
115
- name: '_bmad/ structure',
116
- passed: true,
117
- severity: 'critical'
118
- };
119
- }
120
-
121
- /**
122
- * Check 2: Agent files copied correctly
123
- */
124
- async function checkAgentFiles(config) {
125
- const projectRoot = config.projectRoot || process.cwd();
126
- const agents = config.agents || [];
127
-
128
- if (agents.length === 0) {
129
- return {
130
- id: 'agent-files',
131
- name: 'Agent files',
132
- passed: true,
133
- message: 'No agents to check',
134
- severity: 'critical'
135
- };
136
- }
137
-
138
- const modules = ['core', 'bmm', 'bmb', 'tea', 'cis'];
139
- const missingAgents = [];
140
-
141
- for (const agentName of agents) {
142
- let found = false;
143
- for (const module of modules) {
144
- const agentPath = path.join(projectRoot, '_bmad', module, 'agents', `${agentName}.md`);
145
- if (await fileUtils.exists(agentPath)) {
146
- found = true;
147
- break;
148
- }
149
- }
150
- if (!found) {
151
- missingAgents.push(agentName);
152
- }
153
- }
154
-
155
- if (missingAgents.length > 0) {
156
- return {
157
- id: 'agent-files',
158
- name: 'Agent files',
159
- passed: false,
160
- message: `Missing agents: ${missingAgents.join(', ')}`,
161
- severity: 'critical'
162
- };
163
- }
164
-
165
- return {
166
- id: 'agent-files',
167
- name: 'Agent files',
168
- passed: true,
169
- severity: 'critical'
170
- };
171
- }
172
-
173
- /**
174
- * Check 3: Platform stubs have valid YAML frontmatter
175
- */
176
- async function checkStubsYamlFrontmatter(config) {
177
- const projectRoot = config.projectRoot || process.cwd();
178
- const targetPlatforms = config.targetPlatforms || [];
179
-
180
- if (targetPlatforms.length === 0) {
181
- return {
182
- id: 'yaml-frontmatter',
183
- name: 'YAML frontmatter',
184
- passed: true,
185
- message: 'No platforms to check',
186
- severity: 'critical'
187
- };
188
- }
189
-
190
- const invalidStubs = [];
191
-
192
- // Check Copilot CLI / VSCode stubs
193
- if (targetPlatforms.includes('copilot-cli') || targetPlatforms.includes('vscode')) {
194
- const stubsDir = path.join(projectRoot, '.github', 'agents');
195
- if (await fileUtils.exists(stubsDir)) {
196
- const files = await fileUtils.readDir(stubsDir);
197
- for (const file of files) {
198
- if (file.endsWith('.md')) {
199
- const content = await fileUtils.readFile(path.join(stubsDir, file), 'utf8');
200
- if (!content.startsWith('---')) {
201
- invalidStubs.push(`.github/agents/${file}`);
202
- }
203
- }
204
- }
205
- }
206
- }
207
-
208
- // Check Codex stubs
209
- if (targetPlatforms.includes('codex')) {
210
- const stubsDir = path.join(projectRoot, '.codex', 'prompts');
211
- if (await fileUtils.exists(stubsDir)) {
212
- const files = await fileUtils.readDir(stubsDir);
213
- for (const file of files) {
214
- if (file.endsWith('.md')) {
215
- const content = await fileUtils.readFile(path.join(stubsDir, file), 'utf8');
216
- if (!content.includes('<agent-activation')) {
217
- invalidStubs.push(`.codex/prompts/${file}`);
218
- }
219
- }
220
- }
221
- }
222
- }
223
-
224
- if (invalidStubs.length > 0) {
225
- return {
226
- id: 'yaml-frontmatter',
227
- name: 'YAML frontmatter',
228
- passed: false,
229
- message: `Invalid stubs: ${invalidStubs.join(', ')}`,
230
- severity: 'critical'
231
- };
232
- }
233
-
234
- return {
235
- id: 'yaml-frontmatter',
236
- name: 'YAML frontmatter',
237
- passed: true,
238
- severity: 'critical'
239
- };
240
- }
241
-
242
- /**
243
- * Check 4: Module config files valid
244
- */
245
- async function checkConfigFiles(config) {
246
- const projectRoot = config.projectRoot || process.cwd();
247
- const modules = ['bmb']; // For now only bmb has config
248
-
249
- const invalidConfigs = [];
250
-
251
- for (const module of modules) {
252
- const configPath = path.join(projectRoot, '_bmad', module, 'config.yaml');
253
- if (await fileUtils.exists(configPath)) {
254
- try {
255
- const configContent = await fileUtils.readFile(configPath, 'utf8');
256
- const parsedConfig = yamlUtils.parse(configContent);
257
-
258
- // Validate required fields
259
- if (!parsedConfig.user_name) {
260
- invalidConfigs.push(`${module}/config.yaml: missing user_name`);
261
- }
262
- if (!parsedConfig.communication_language) {
263
- invalidConfigs.push(`${module}/config.yaml: missing communication_language`);
264
- }
265
- } catch (error) {
266
- invalidConfigs.push(`${module}/config.yaml: parse error - ${error.message}`);
267
- }
268
- } else {
269
- invalidConfigs.push(`${module}/config.yaml: file not found`);
270
- }
271
- }
272
-
273
- if (invalidConfigs.length > 0) {
274
- return {
275
- id: 'config-files',
276
- name: 'Config files',
277
- passed: false,
278
- message: invalidConfigs.join(', '),
279
- severity: 'critical'
280
- };
281
- }
282
-
283
- return {
284
- id: 'config-files',
285
- name: 'Config files',
286
- passed: true,
287
- severity: 'critical'
288
- };
289
- }
290
-
291
- /**
292
- * Check 5: Platform detection works
293
- */
294
- async function checkPlatformDetection(config) {
295
- const targetPlatforms = config.targetPlatforms || [];
296
-
297
- if (targetPlatforms.length === 0) {
298
- return {
299
- id: 'platform-detection',
300
- name: 'Platform detection',
301
- passed: true,
302
- message: 'No platforms configured',
303
- severity: 'critical'
304
- };
305
- }
306
-
307
- const failedPlatforms = [];
308
-
309
- for (const platformName of targetPlatforms) {
310
- try {
311
- const platform = require(`../platforms/${platformName}`);
312
- const detected = await platform.detect();
313
-
314
- // If detection failed or returned error object
315
- if (!detected || (typeof detected === 'object' && !detected.detected)) {
316
- failedPlatforms.push(platformName);
317
- }
318
- } catch (error) {
319
- failedPlatforms.push(`${platformName} (${error.message})`);
320
- }
321
- }
322
-
323
- if (failedPlatforms.length > 0) {
324
- return {
325
- id: 'platform-detection',
326
- name: 'Platform detection',
327
- passed: false,
328
- message: `Failed platforms: ${failedPlatforms.join(', ')}`,
329
- severity: 'warning' // Warning because platform may be installed but not detected
330
- };
331
- }
332
-
333
- return {
334
- id: 'platform-detection',
335
- name: 'Platform detection',
336
- passed: true,
337
- severity: 'critical'
338
- };
339
- }
340
-
341
- /**
342
- * Check 6: File permissions correct
343
- */
344
- async function checkFilePermissions(config) {
345
- const projectRoot = config.projectRoot || process.cwd();
346
- const testPaths = [
347
- '_bmad',
348
- '_bmad/_config',
349
- '_bmad/bmb/config.yaml'
350
- ];
351
-
352
- const permissionIssues = [];
353
-
354
- for (const testPath of testPaths) {
355
- const fullPath = path.join(projectRoot, testPath);
356
- if (await fileUtils.exists(fullPath)) {
357
- try {
358
- // Test read permission
359
- await fileUtils.access(fullPath, fileUtils.constants.R_OK);
360
-
361
- // Test write permission (only for directories and config files)
362
- await fileUtils.access(fullPath, fileUtils.constants.W_OK);
363
- } catch (error) {
364
- permissionIssues.push(testPath);
365
- }
366
- }
367
- }
368
-
369
- if (permissionIssues.length > 0) {
370
- return {
371
- id: 'file-permissions',
372
- name: 'File permissions',
373
- passed: false,
374
- message: `Permission issues: ${permissionIssues.join(', ')}`,
375
- severity: 'warning'
376
- };
377
- }
378
-
379
- return {
380
- id: 'file-permissions',
381
- name: 'File permissions',
382
- passed: true,
383
- severity: 'warning'
384
- };
385
- }
386
-
387
- /**
388
- * Check 7: Manifest files valid
389
- */
390
- async function checkManifests(config) {
391
- const projectRoot = config.projectRoot || process.cwd();
392
- const manifestFiles = [
393
- '_bmad/_config/agent-manifest.csv',
394
- '_bmad/_config/workflow-manifest.csv',
395
- '_bmad/_config/task-manifest.csv'
396
- ];
397
-
398
- const issues = [];
399
-
400
- for (const manifestFile of manifestFiles) {
401
- const manifestPath = path.join(projectRoot, manifestFile);
402
- if (await fileUtils.exists(manifestPath)) {
403
- try {
404
- const content = await fileUtils.readFile(manifestPath, 'utf8');
405
- const lines = content.split('\n').filter(l => l.trim());
406
-
407
- // Check header exists
408
- if (lines.length === 0 || !lines[0].includes(',')) {
409
- issues.push(`${manifestFile}: invalid format`);
410
- }
411
- } catch (error) {
412
- issues.push(`${manifestFile}: ${error.message}`);
413
- }
414
- } else {
415
- // Manifests are optional, don't fail if missing
416
- // issues.push(`${manifestFile}: not found`);
417
- }
418
- }
419
-
420
- if (issues.length > 0) {
421
- return {
422
- id: 'manifests',
423
- name: 'Manifest files',
424
- passed: false,
425
- message: issues.join(', '),
426
- severity: 'warning'
427
- };
428
- }
429
-
430
- return {
431
- id: 'manifests',
432
- name: 'Manifest files',
433
- passed: true,
434
- severity: 'warning'
435
- };
436
- }
437
-
438
- /**
439
- * Check 8: Workflows accessible
440
- */
441
- async function checkWorkflows(config) {
442
- const projectRoot = config.projectRoot || process.cwd();
443
- const workflowDirs = [
444
- '_bmad/core/workflows',
445
- '_bmad/bmm/workflows',
446
- '_bmad/bmb/workflows',
447
- '_bmad/tea/workflows',
448
- '_bmad/cis/workflows'
449
- ];
450
-
451
- let workflowCount = 0;
452
- const issues = [];
453
-
454
- for (const workflowDir of workflowDirs) {
455
- const dirPath = path.join(projectRoot, workflowDir);
456
- if (await fileUtils.exists(dirPath)) {
457
- try {
458
- const workflows = await fileUtils.readDir(dirPath);
459
- workflowCount += workflows.length;
460
- } catch (error) {
461
- issues.push(`${workflowDir}: ${error.message}`);
462
- }
463
- }
464
- }
465
-
466
- if (issues.length > 0) {
467
- return {
468
- id: 'workflows',
469
- name: 'Workflow files',
470
- passed: false,
471
- message: issues.join(', '),
472
- severity: 'warning'
473
- };
474
- }
475
-
476
- return {
477
- id: 'workflows',
478
- name: 'Workflow files',
479
- passed: true,
480
- message: `${workflowCount} workflows found`,
481
- severity: 'warning'
482
- };
483
- }
484
-
485
- /**
486
- * Check 9: Templates valid
487
- */
488
- async function checkTemplates(config) {
489
- const templatesDir = path.join(__dirname, '..', '..', 'templates', '_bmad');
490
-
491
- if (!await fileUtils.exists(templatesDir)) {
492
- return {
493
- id: 'templates',
494
- name: 'Template files',
495
- passed: false,
496
- message: 'Templates directory not found',
497
- severity: 'warning'
498
- };
499
- }
500
-
501
- const entries = await fileUtils.readDir(templatesDir);
502
- const modules = [];
503
- for (const entry of entries) {
504
- const entryPath = path.join(templatesDir, entry);
505
- try {
506
- const stat = await fs.stat(entryPath);
507
- if (stat.isDirectory()) {
508
- modules.push(entry);
509
- }
510
- } catch {
511
- // Ignore unreadable entries
512
- }
513
- }
514
-
515
- if (modules.length === 0) {
516
- return {
517
- id: 'templates',
518
- name: 'Template files',
519
- passed: false,
520
- message: 'No template modules found',
521
- severity: 'warning'
522
- };
523
- }
524
-
525
- const issues = [];
526
-
527
- for (const module of modules) {
528
- const agentsDir = path.join(templatesDir, module, 'agents');
529
- if (!await fileUtils.exists(agentsDir)) {
530
- issues.push(`${module}/agents missing`);
531
- }
532
- }
533
-
534
- if (issues.length > 0) {
535
- return {
536
- id: 'templates',
537
- name: 'Template files',
538
- passed: false,
539
- message: issues.join(', '),
540
- severity: 'warning'
541
- };
542
- }
543
-
544
- return {
545
- id: 'templates',
546
- name: 'Template files',
547
- passed: true,
548
- severity: 'warning'
549
- };
550
- }
551
-
552
- /**
553
- * Check 10: Dependencies installed
554
- */
555
- async function checkDependencies(config) {
556
- const requiredDeps = [
557
- 'fs-extra',
558
- 'js-yaml',
559
- 'chalk'
560
- ];
561
-
562
- const missingDeps = [];
563
-
564
- for (const dep of requiredDeps) {
565
- try {
566
- require.resolve(dep);
567
- } catch {
568
- missingDeps.push(dep);
569
- }
570
- }
571
-
572
- if (missingDeps.length > 0) {
573
- return {
574
- id: 'dependencies',
575
- name: 'Dependencies',
576
- passed: false,
577
- message: `Missing: ${missingDeps.join(', ')}. Run: npm install`,
578
- severity: 'critical'
579
- };
580
- }
581
-
582
- return {
583
- id: 'dependencies',
584
- name: 'Dependencies',
585
- passed: true,
586
- severity: 'critical'
587
- };
588
- }
589
-
590
- module.exports = {
591
- validate,
592
- checkBmadStructure,
593
- checkAgentFiles,
594
- checkStubsYamlFrontmatter,
595
- checkConfigFiles,
596
- checkPlatformDetection,
597
- checkFilePermissions,
598
- checkManifests,
599
- checkWorkflows,
600
- checkTemplates,
601
- checkDependencies
602
- };