create-byan-agent 1.0.1 → 1.0.3

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 (43) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +54 -6
  3. package/bin/create-byan-agent-backup.js +220 -0
  4. package/bin/create-byan-agent-fixed.js +301 -0
  5. package/bin/create-byan-agent.js +111 -30
  6. package/package.json +12 -5
  7. package/templates/.github/agents/bmad-agent-bmad-master.md +15 -0
  8. package/templates/.github/agents/bmad-agent-bmb-agent-builder.md +15 -0
  9. package/templates/.github/agents/bmad-agent-bmb-module-builder.md +15 -0
  10. package/templates/.github/agents/bmad-agent-bmb-workflow-builder.md +15 -0
  11. package/templates/.github/agents/bmad-agent-bmm-analyst.md +15 -0
  12. package/templates/.github/agents/bmad-agent-bmm-architect.md +15 -0
  13. package/templates/.github/agents/bmad-agent-bmm-dev.md +15 -0
  14. package/templates/.github/agents/bmad-agent-bmm-pm.md +15 -0
  15. package/templates/.github/agents/bmad-agent-bmm-quick-flow-solo-dev.md +15 -0
  16. package/templates/.github/agents/bmad-agent-bmm-quinn.md +15 -0
  17. package/templates/.github/agents/bmad-agent-bmm-sm.md +15 -0
  18. package/templates/.github/agents/bmad-agent-bmm-tech-writer.md +15 -0
  19. package/templates/.github/agents/bmad-agent-bmm-ux-designer.md +15 -0
  20. package/templates/.github/agents/bmad-agent-byan.md +224 -0
  21. package/templates/.github/agents/bmad-agent-cis-brainstorming-coach.md +15 -0
  22. package/templates/.github/agents/bmad-agent-cis-creative-problem-solver.md +15 -0
  23. package/templates/.github/agents/bmad-agent-cis-design-thinking-coach.md +15 -0
  24. package/templates/.github/agents/bmad-agent-cis-innovation-strategist.md +15 -0
  25. package/templates/.github/agents/bmad-agent-cis-presentation-master.md +15 -0
  26. package/templates/.github/agents/bmad-agent-cis-storyteller.md +15 -0
  27. package/templates/.github/agents/bmad-agent-marc.md +48 -0
  28. package/templates/.github/agents/bmad-agent-rachid.md +47 -0
  29. package/templates/.github/agents/bmad-agent-tea-tea.md +15 -0
  30. package/templates/_bmad/bmb/agents/agent-builder.md +59 -0
  31. package/templates/_bmad/bmb/agents/byan.md +215 -0
  32. package/templates/_bmad/bmb/agents/marc.md +303 -0
  33. package/templates/_bmad/bmb/agents/module-builder.md +60 -0
  34. package/templates/_bmad/bmb/agents/rachid.md +184 -0
  35. package/templates/_bmad/bmb/agents/workflow-builder.md +61 -0
  36. package/templates/_bmad/bmb/workflows/byan/data/mantras.yaml +272 -0
  37. package/templates/_bmad/bmb/workflows/byan/data/templates.yaml +59 -0
  38. package/templates/_bmad/bmb/workflows/byan/delete-agent-workflow.md +657 -0
  39. package/templates/_bmad/bmb/workflows/byan/edit-agent-workflow.md +688 -0
  40. package/templates/_bmad/bmb/workflows/byan/interview-workflow.md +753 -0
  41. package/templates/_bmad/bmb/workflows/byan/quick-create-workflow.md +450 -0
  42. package/templates/_bmad/bmb/workflows/byan/templates/base-agent-template.md +79 -0
  43. package/templates/_bmad/bmb/workflows/byan/validate-agent-workflow.md +676 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,64 @@
1
+ # Changelog - create-byan-agent
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.2] - 2026-02-02
9
+
10
+ ### Added
11
+ - **RACHID Agent**: NPM/NPX deployment specialist
12
+ - Install BYAN via npx create-byan-agent
13
+ - Validate _bmad directory structure
14
+ - Fix npm dependency conflicts
15
+ - Update package.json and scripts
16
+ - Publish to npm registry
17
+ - Test npx installations
18
+ - Security audits
19
+ - NPM best practices guidance
20
+
21
+ - **MARC Agent**: GitHub Copilot CLI integration specialist
22
+ - Validate .github/agents/ structure
23
+ - Test /agent detection in Copilot CLI
24
+ - Create agent stubs for new agents
25
+ - Fix YAML frontmatter issues
26
+ - Configure MCP servers
27
+ - Test agent invocation
28
+ - Optimize context loading
29
+ - Troubleshoot agent loading issues
30
+
31
+ - **Templates Directory**: All BYAN files now packaged
32
+ - Complete _bmad/bmb/ structure
33
+ - All agent definitions (byan.md, rachid.md, marc.md)
34
+ - All workflows with steps
35
+ - Templates and data files
36
+ - .github/agents/ stubs for Copilot CLI
37
+
38
+ ### Changed
39
+ - Installer now copies complete file structure from templates/
40
+ - Version bumped to 1.0.2
41
+ - Enhanced verification checks (10 checks total)
42
+ - Improved post-installation messages with usage for all 3 agents
43
+ - Updated README with RACHID and MARC documentation
44
+
45
+ ### Fixed
46
+ - Template directory resolution in getTemplateDir()
47
+ - File copying logic for production npm packages
48
+ - GitHub agents directory creation
49
+
50
+ ## [1.0.1] - 2026-02-01
51
+
52
+ ### Changed
53
+ - Minor bug fixes
54
+ - Documentation updates
55
+
56
+ ## [1.0.0] - 2026-02-01
57
+
58
+ ### Added
59
+ - Initial release
60
+ - BYAN agent with intelligent interview workflow
61
+ - Multi-platform support (Copilot, VSCode, Claude, Codex)
62
+ - 64 Mantras methodology
63
+ - Merise Agile + TDD approach
64
+ - NPX installer scaffolding
package/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # BYAN - Builder of YAN
2
2
 
3
- **Version:** 1.0.0
4
- **Methodology:** Merise Agile + TDD + 64 Mantras
3
+ **Version:** 1.0.2
4
+ **Methodology:** Merise Agile + TDD + 64 Mantras
5
+ **Agents Included:** BYAN, RACHID, MARC
5
6
 
6
7
  ---
7
8
 
@@ -16,6 +17,8 @@
16
17
  - Multi-platform support (Copilot, VSCode, Claude, Codex)
17
18
  - TDD-driven validation
18
19
  - Consequences evaluation before actions
20
+ - **NEW:** RACHID agent for NPM/NPX deployment
21
+ - **NEW:** MARC agent for GitHub Copilot CLI integration
19
22
 
20
23
  ---
21
24
 
@@ -44,21 +47,31 @@ cd byan
44
47
 
45
48
  ## 📖 Usage
46
49
 
47
- ### Activate BYAN
50
+ ### Activate Agents
48
51
 
49
52
  **GitHub Copilot CLI:**
50
53
  ```bash
51
- gh copilot suggest "activate byan agent"
54
+ copilot
55
+ # In interactive mode:
56
+ /agent
57
+ # Select one of:
58
+ # - byan (create agents)
59
+ # - rachid (NPM deployment)
60
+ # - marc (Copilot CLI integration)
52
61
  ```
53
62
 
54
63
  **VSCode:**
55
64
  1. Open Command Palette (Ctrl+Shift+P)
56
- 2. Type: "Activate BYAN Agent"
57
- 3. Select BYAN from list
65
+ 2. Type: "Activate Agent"
66
+ 3. Select BYAN, RACHID, or MARC from list
58
67
 
59
68
  **Claude Code:**
60
69
  ```bash
61
70
  claude chat --agent byan
71
+ # or
72
+ claude chat --agent rachid
73
+ # or
74
+ claude chat --agent marc
62
75
  ```
63
76
 
64
77
  ### Create Your First Agent
@@ -77,6 +90,41 @@ Best for: Additional agents, clear requirements, existing project context
77
90
 
78
91
  ---
79
92
 
93
+ ## 🎯 Three Specialized Agents
94
+
95
+ ### 1. BYAN - Agent Creator
96
+ **Full Interview (30-45 min):**
97
+ ```
98
+ [INT] Start Intelligent Interview
99
+ ```
100
+ Best for: First agent, critical agents, complex requirements
101
+
102
+ **Quick Create (10 min):**
103
+ ```
104
+ [QC] Quick Create
105
+ ```
106
+ Best for: Additional agents, clear requirements, existing project context
107
+
108
+ ### 2. RACHID - NPM/NPX Specialist
109
+ **Deploy to NPM:**
110
+ ```
111
+ [PUBLISH] Publish to npm
112
+ [VALIDATE] Validate _bmad structure
113
+ [TEST-NPX] Test npx installation
114
+ ```
115
+ Best for: Package deployment, dependency management, npm workflows
116
+
117
+ ### 3. MARC - Copilot CLI Expert
118
+ **Copilot Integration:**
119
+ ```
120
+ [VALIDATE] Validate .github/agents/
121
+ [TEST] Test /agent detection
122
+ [CREATE-STUB] Create agent stub
123
+ ```
124
+ Best for: GitHub Copilot CLI integration, agent detection, MCP configuration
125
+
126
+ ---
127
+
80
128
  ## 🎯 BYAN Menu
81
129
 
82
130
  | Command | Description | Duration |
@@ -0,0 +1,220 @@
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.0';
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
+ // Main installer
26
+ async function install() {
27
+ console.clear();
28
+ console.log(banner);
29
+
30
+ const projectRoot = process.cwd();
31
+
32
+ // Step 1: Detect project type
33
+ const spinner = ora('Detecting project type...').start();
34
+
35
+ const isGitRepo = await fs.pathExists(path.join(projectRoot, '.git'));
36
+ const hasPackageJson = await fs.pathExists(path.join(projectRoot, 'package.json'));
37
+ const hasPyProject = await fs.pathExists(path.join(projectRoot, 'pyproject.toml'));
38
+
39
+ if (!isGitRepo && !hasPackageJson && !hasPyProject) {
40
+ spinner.warn('Not in a recognized project directory');
41
+
42
+ const { continueAnyway } = await inquirer.prompt([
43
+ {
44
+ type: 'confirm',
45
+ name: 'continueAnyway',
46
+ message: 'BYAN works best in a project with version control. Continue anyway?',
47
+ default: false
48
+ }
49
+ ]);
50
+
51
+ if (!continueAnyway) {
52
+ console.log(chalk.yellow('Installation cancelled.'));
53
+ process.exit(0);
54
+ }
55
+ } else {
56
+ spinner.succeed('Project detected');
57
+ }
58
+
59
+ // Step 2: Platform selection
60
+ const { platform } = await inquirer.prompt([
61
+ {
62
+ type: 'list',
63
+ name: 'platform',
64
+ message: 'Select platform to install for:',
65
+ choices: [
66
+ { name: 'GitHub Copilot CLI', value: 'copilot' },
67
+ { name: 'VSCode', value: 'vscode' },
68
+ { name: 'Claude Code', value: 'claude' },
69
+ { name: 'Codex', value: 'codex' },
70
+ { name: 'All platforms', value: 'all' }
71
+ ]
72
+ }
73
+ ]);
74
+
75
+ // Step 3: User configuration
76
+ const config = await inquirer.prompt([
77
+ {
78
+ type: 'input',
79
+ name: 'userName',
80
+ message: 'Your name:',
81
+ default: 'Developer'
82
+ },
83
+ {
84
+ type: 'list',
85
+ name: 'language',
86
+ message: 'Communication language:',
87
+ choices: ['Francais', 'English'],
88
+ default: 'English'
89
+ }
90
+ ]);
91
+
92
+ // Step 4: Create directory structure
93
+ const installSpinner = ora('Creating directory structure...').start();
94
+
95
+ const bmadDir = path.join(projectRoot, '_bmad');
96
+ const bmbDir = path.join(bmadDir, 'bmb');
97
+
98
+ await fs.ensureDir(path.join(bmadDir, 'bmb', 'agents'));
99
+ await fs.ensureDir(path.join(bmadDir, 'bmb', 'workflows', 'byan', 'steps'));
100
+ await fs.ensureDir(path.join(bmadDir, 'bmb', 'workflows', 'byan', 'templates'));
101
+ await fs.ensureDir(path.join(bmadDir, 'bmb', 'workflows', 'byan', 'data'));
102
+ await fs.ensureDir(path.join(bmadDir, 'core'));
103
+ await fs.ensureDir(path.join(bmadDir, '_config'));
104
+ await fs.ensureDir(path.join(bmadDir, '_memory'));
105
+ await fs.ensureDir(path.join(bmadDir, '_output'));
106
+
107
+ installSpinner.succeed('Directory structure created');
108
+
109
+ // Step 5: Copy BYAN files
110
+ const copySpinner = ora('Installing BYAN files...').start();
111
+
112
+ // In production, these would be copied from the package
113
+ // For now, we'll create minimal config
114
+
115
+ const configContent = {
116
+ bmb_creations_output_folder: "{project-root}/_bmad-output/bmb-creations",
117
+ user_name: config.userName,
118
+ communication_language: config.language,
119
+ document_output_language: config.language,
120
+ output_folder: "{project-root}/_bmad-output",
121
+ platform: platform
122
+ };
123
+
124
+ const configPath = path.join(bmbDir, 'config.yaml');
125
+ await fs.writeFile(configPath, yaml.dump(configContent), 'utf8');
126
+
127
+ copySpinner.succeed('BYAN files installed');
128
+
129
+ // Step 6: Create shortcuts
130
+ const shortcutSpinner = ora('Creating shortcuts...').start();
131
+
132
+ // Create package.json scripts if it exists
133
+ if (hasPackageJson) {
134
+ const pkgPath = path.join(projectRoot, 'package.json');
135
+ const pkg = await fs.readJson(pkgPath);
136
+
137
+ if (!pkg.scripts) pkg.scripts = {};
138
+
139
+ if (!pkg.scripts.byan) {
140
+ pkg.scripts.byan = 'echo "BYAN agent installed. Activate in your AI platform."';
141
+ await fs.writeJson(pkgPath, pkg, { spaces: 2 });
142
+ shortcutSpinner.succeed('NPM script added');
143
+ } else {
144
+ shortcutSpinner.info('NPM script already exists');
145
+ }
146
+ } else {
147
+ shortcutSpinner.succeed('Shortcuts created');
148
+ }
149
+
150
+ // Step 7: Verification
151
+ const verifySpinner = ora('Verifying installation...').start();
152
+
153
+ const checks = [
154
+ await fs.pathExists(path.join(bmbDir, 'agents')),
155
+ await fs.pathExists(path.join(bmbDir, 'workflows', 'byan')),
156
+ await fs.pathExists(configPath)
157
+ ];
158
+
159
+ const passed = checks.filter(Boolean).length;
160
+
161
+ if (passed === checks.length) {
162
+ verifySpinner.succeed(`Verification: ${passed}/${checks.length} checks passed`);
163
+ } else {
164
+ verifySpinner.warn(`Verification: ${passed}/${checks.length} checks passed`);
165
+ }
166
+
167
+ // Success message
168
+ console.log('');
169
+ console.log(chalk.green('╔════════════════════════════════════════════════════════════╗'));
170
+ console.log(chalk.green('║ ║'));
171
+ console.log(chalk.green('║ ✅ BYAN INSTALLATION COMPLETE! ║'));
172
+ console.log(chalk.green('║ ║'));
173
+ console.log(chalk.green('╚════════════════════════════════════════════════════════════╝'));
174
+ console.log('');
175
+
176
+ console.log(chalk.bold('Installation Summary:'));
177
+ console.log(` • Platform: ${chalk.cyan(platform)}`);
178
+ console.log(` • Installation Directory: ${chalk.cyan(bmbDir)}`);
179
+ console.log(` • Configuration: ${chalk.cyan(configPath)}`);
180
+ console.log(` • User: ${chalk.cyan(config.userName)}`);
181
+ console.log(` • Language: ${chalk.cyan(config.language)}`);
182
+ console.log('');
183
+
184
+ console.log(chalk.bold('Next Steps:'));
185
+ console.log('');
186
+ console.log(chalk.yellow('1. Activate BYAN:'));
187
+
188
+ if (platform === 'copilot') {
189
+ console.log(` ${chalk.blue('gh copilot suggest "activate byan agent"')}`);
190
+ } else if (platform === 'vscode') {
191
+ console.log(' Open VSCode Command Palette (Ctrl+Shift+P)');
192
+ console.log(' Type: "Activate BYAN Agent"');
193
+ } else if (platform === 'claude') {
194
+ console.log(` ${chalk.blue('claude chat --agent byan')}`);
195
+ }
196
+
197
+ console.log('');
198
+ console.log(chalk.yellow('2. Create your first agent:'));
199
+ console.log(' [INT] Start Intelligent Interview (30-45 min)');
200
+ console.log(' [QC] Quick Create (10 min)');
201
+ console.log('');
202
+
203
+ console.log(chalk.yellow('3. Explore documentation:'));
204
+ console.log(` • Configuration: ${chalk.cyan(configPath)}`);
205
+ console.log(` • Workflows: ${chalk.cyan(path.join(bmbDir, 'workflows', 'byan'))}`);
206
+ console.log('');
207
+
208
+ console.log(chalk.gray('Need help? Type \'/bmad-help\' when BYAN is active'));
209
+ console.log('');
210
+ console.log(chalk.blue('Happy agent building! 🏗️'));
211
+ }
212
+
213
+ // CLI Program
214
+ program
215
+ .name('create-byan-agent')
216
+ .description('Install BYAN - Builder of YAN agent creator')
217
+ .version(BYAN_VERSION)
218
+ .action(install);
219
+
220
+ program.parse(process.argv);
@@ -0,0 +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);