create-byan-agent 2.2.2 → 2.3.0

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.
@@ -426,6 +426,12 @@ async function install() {
426
426
  name: 'quality',
427
427
  message: '10. Niveau qualité?',
428
428
  choices: ['mvp (speed)', 'balanced', 'production', 'critical']
429
+ },
430
+ {
431
+ type: 'confirm',
432
+ name: 'costOptimizer',
433
+ message: '11. Optimiser coûts LLM automatiquement? (Économise ~54%)',
434
+ default: true
429
435
  }
430
436
  ]);
431
437
 
@@ -858,6 +864,24 @@ async function install() {
858
864
  copySpinner.warn(`⚠ Agent source not found: ${agentsSource}`);
859
865
  }
860
866
 
867
+ // Copy cost optimizer worker if enabled
868
+ if (interviewAnswers && interviewAnswers.costOptimizer) {
869
+ const workersDir = path.join(byanDir, 'workers');
870
+ await fs.ensureDir(workersDir);
871
+
872
+ const workerSource = path.join(templateDir, 'workers', 'cost-optimizer.js');
873
+ const workerDest = path.join(workersDir, 'cost-optimizer.js');
874
+
875
+ if (await fs.pathExists(workerSource)) {
876
+ await fs.copy(workerSource, workerDest, { overwrite: true });
877
+ copySpinner.text = 'Copied cost optimizer worker...';
878
+ console.log(chalk.green(` ✓ Cost Optimizer: ${workerSource} → ${workerDest}`));
879
+ console.log(chalk.cyan(' 💰 Automatic LLM cost optimization enabled (~54% savings)'));
880
+ } else {
881
+ copySpinner.warn(`⚠ Cost optimizer source not found: ${workerSource}`);
882
+ }
883
+ }
884
+
861
885
  // Copy workflow files
862
886
  const workflowsSource = path.join(templateDir, '_byan', 'bmb', 'workflows', 'byan');
863
887
  const workflowsDest = path.join(bmbDir, 'workflows', 'byan');
@@ -78,7 +78,58 @@ async function select(detectionResult) {
78
78
  };
79
79
  }
80
80
 
81
- // Show platform selection menu
81
+ // Show primary platform selection first
82
+ const nativePlatforms = choices.filter(c => c.native && c.detected);
83
+
84
+ // Step 1: Choose primary platform (if native available)
85
+ if (nativePlatforms.length > 0) {
86
+ const primaryAnswer = await inquirer.prompt([
87
+ {
88
+ type: 'list',
89
+ name: 'primary',
90
+ message: '🎯 Choose your PRIMARY platform for native agent invocation:',
91
+ choices: [
92
+ ...nativePlatforms.map(c => ({
93
+ name: `${c.icon} ${c.name} - ${c.agentSpecialist ? `@bmad-agent-${c.agentSpecialist}` : 'No specialist'}`,
94
+ value: c.id,
95
+ short: c.name
96
+ })),
97
+ new inquirer.Separator(),
98
+ {
99
+ name: '🔧 Advanced: Install on multiple platforms',
100
+ value: 'multi'
101
+ },
102
+ {
103
+ name: '⏭️ Skip native integration (manual install only)',
104
+ value: 'skip'
105
+ }
106
+ ]
107
+ }
108
+ ]);
109
+
110
+ // If user chose single platform, return immediately
111
+ if (primaryAnswer.primary !== 'multi' && primaryAnswer.primary !== 'skip') {
112
+ const platform = nativePlatforms.find(c => c.id === primaryAnswer.primary);
113
+ return {
114
+ platforms: [primaryAnswer.primary],
115
+ mode: 'native',
116
+ specialist: platform.agentSpecialist,
117
+ primary: primaryAnswer.primary
118
+ };
119
+ }
120
+
121
+ // If skip, fall through to conversational mode
122
+ if (primaryAnswer.primary === 'skip') {
123
+ return {
124
+ platforms: choices.map(c => c.id),
125
+ mode: 'conversational'
126
+ };
127
+ }
128
+
129
+ // If multi, show full menu
130
+ }
131
+
132
+ // Step 2: Full menu (multi-platform or no native available)
82
133
  const answer = await inquirer.prompt([
83
134
  {
84
135
  type: 'list',
@@ -0,0 +1,308 @@
1
+ # Yanstaller Launcher Workers
2
+
3
+ **Location:** `_byan/workers/launchers/`
4
+ **Type:** Platform-specific launcher workers
5
+ **Version:** 1.0.0
6
+
7
+ ---
8
+
9
+ ## Overview
10
+
11
+ Launcher workers are lightweight, single-purpose components that bridge the gap between platform-specific AI coding assistants and the main Yanstaller agent.
12
+
13
+ **Role:** Launch `npx create-byan-agent` on each platform and hand off to yanstaller.
14
+
15
+ ---
16
+
17
+ ## Architecture
18
+
19
+ ```
20
+ ┌─────────────────────────────────────────────────────────┐
21
+ │ USER INVOKES AGENT │
22
+ │ gh copilot @bmad-agent-marc │
23
+ │ claude --agent claude │
24
+ │ codex skill bmad-byan │
25
+ └─────────────┬───────────────────────────────────────────┘
26
+
27
+
28
+ ┌─────────────────────────────────────────────────────────┐
29
+ │ STUB AGENT (Lightweight) │
30
+ │ - Detects platform │
31
+ │ - Calls appropriate launcher worker │
32
+ └─────────────┬───────────────────────────────────────────┘
33
+
34
+
35
+ ┌─────────────────────────────────────────────────────────┐
36
+ │ LAUNCHER WORKER (Single Task) │
37
+ │ - Verifies prerequisites (npx, Node.js) │
38
+ │ - Executes: npx create-byan-agent │
39
+ │ - Sets platform hint env variable │
40
+ └─────────────┬───────────────────────────────────────────┘
41
+
42
+
43
+ ┌─────────────────────────────────────────────────────────┐
44
+ │ YANSTALLER (Main Agent) │
45
+ │ @bmad-agent-yanstaller │
46
+ │ - Interview (10 questions) │
47
+ │ - Phase 2 Chat │
48
+ │ - BYAN Installation │
49
+ │ - Platform-specific integration │
50
+ └─────────────────────────────────────────────────────────┘
51
+ ```
52
+
53
+ ---
54
+
55
+ ## Workers
56
+
57
+ ### 1. launch-yanstaller-copilot.md
58
+
59
+ **Platform:** GitHub Copilot CLI
60
+ **Icon:** 🤖
61
+ **Command:** `npx create-byan-agent`
62
+ **Called by:** `@bmad-agent-marc`
63
+
64
+ **Purpose:** Launch yanstaller on Copilot CLI platform.
65
+
66
+ ---
67
+
68
+ ### 2. launch-yanstaller-claude.md
69
+
70
+ **Platform:** Claude Code
71
+ **Icon:** 🎭
72
+ **Command:** `npx create-byan-agent`
73
+ **Called by:** `@bmad-agent-claude` (stub)
74
+ **Platform Hint:** `BYAN_PLATFORM_HINT=claude`
75
+
76
+ **Purpose:** Launch yanstaller on Claude Code platform.
77
+
78
+ **Post-Launch:** If user selects Claude integration, yanstaller delegates to Agent Claude (full) for MCP server creation.
79
+
80
+ ---
81
+
82
+ ### 3. launch-yanstaller-codex.md
83
+
84
+ **Platform:** Codex/OpenCode
85
+ **Icon:** 📝
86
+ **Command:** `npx create-byan-agent`
87
+ **Called by:** `@bmad-agent-codex` (stub)
88
+ **Platform Hint:** `BYAN_PLATFORM_HINT=codex`
89
+
90
+ **Purpose:** Launch yanstaller on Codex platform.
91
+
92
+ **Post-Launch:** If user selects Codex integration, yanstaller delegates to Agent Codex (full) for skill file creation.
93
+
94
+ ---
95
+
96
+ ## Design Principles
97
+
98
+ ### Single Responsibility
99
+ Each worker has ONE task: Launch yanstaller command.
100
+
101
+ ### Lightweight
102
+ - No interview logic
103
+ - No installation logic
104
+ - No configuration logic
105
+ - Just command execution + handoff
106
+
107
+ ### Platform Hints
108
+ Workers set environment variables to help yanstaller detect platform:
109
+ ```bash
110
+ BYAN_PLATFORM_HINT=copilot # For Copilot CLI
111
+ BYAN_PLATFORM_HINT=claude # For Claude Code
112
+ BYAN_PLATFORM_HINT=codex # For Codex
113
+ ```
114
+
115
+ ### Idempotent
116
+ Can be run multiple times safely.
117
+
118
+ ---
119
+
120
+ ## Integration Flow
121
+
122
+ ### Example: User chooses Claude
123
+
124
+ 1. **User runs:** `claude --agent claude`
125
+
126
+ 2. **Stub agent (bmad-agent-claude)** detects invocation:
127
+ ```markdown
128
+ "I'll launch yanstaller for you..."
129
+ ```
130
+
131
+ 3. **Launcher worker** executes:
132
+ ```javascript
133
+ process.env.BYAN_PLATFORM_HINT = 'claude';
134
+ spawn('npx', ['create-byan-agent']);
135
+ ```
136
+
137
+ 4. **Yanstaller starts:**
138
+ - Detects platform: Claude Code
139
+ - Runs interview
140
+ - User selects Claude integration
141
+
142
+ 5. **Yanstaller delegates to Agent Claude (full):**
143
+ - Agent Claude creates MCP server
144
+ - Updates `claude_desktop_config.json`
145
+ - Provides activation instructions
146
+
147
+ 6. **User activates:**
148
+ ```bash
149
+ claude --agent byan "create PRD"
150
+ ```
151
+
152
+ ---
153
+
154
+ ## Worker vs Agent
155
+
156
+ | Feature | Worker | Agent |
157
+ |---------|--------|-------|
158
+ | **Size** | Small (< 5 KB) | Large (10-20 KB) |
159
+ | **Responsibility** | Single task | Multiple workflows |
160
+ | **Workflows** | 0 | 6+ |
161
+ | **Knowledge Base** | Minimal | Extensive |
162
+ | **Lifecycle** | Execute & exit | Persistent session |
163
+ | **Complexity** | Simple | Complex |
164
+
165
+ ---
166
+
167
+ ## Separation of Concerns
168
+
169
+ ### Stub Agents (marc/claude/codex)
170
+ - Detect invocation
171
+ - Call launcher worker
172
+ - Minimal logic
173
+
174
+ ### Launcher Workers
175
+ - Execute `npx create-byan-agent`
176
+ - Set platform hints
177
+ - Verify prerequisites
178
+
179
+ ### Yanstaller Agent
180
+ - Interview questions
181
+ - Platform selection
182
+ - Installation orchestration
183
+
184
+ ### Full Specialist Agents
185
+ - Platform-specific integration
186
+ - MCP server creation (Claude)
187
+ - Skill file creation (Codex)
188
+ - GitHub agent installation (Copilot)
189
+
190
+ ---
191
+
192
+ ## File Structure
193
+
194
+ ```
195
+ _byan/
196
+ └── workers/
197
+ └── launchers/
198
+ ├── README.md (this file)
199
+ ├── launch-yanstaller-copilot.md
200
+ ├── launch-yanstaller-claude.md
201
+ └── launch-yanstaller-codex.md
202
+ ```
203
+
204
+ ---
205
+
206
+ ## Testing
207
+
208
+ ### Manual Test
209
+ ```bash
210
+ # Test Copilot launcher
211
+ node -e "require('./_byan/workers/launchers/worker-launch-yanstaller-copilot').launch()"
212
+
213
+ # Test Claude launcher
214
+ node -e "require('./_byan/workers/launchers/worker-launch-yanstaller-claude').launch()"
215
+
216
+ # Test Codex launcher
217
+ node -e "require('./_byan/workers/launchers/worker-launch-yanstaller-codex').launch()"
218
+ ```
219
+
220
+ ### Expected Output
221
+ ```
222
+ 🤖 Launching Yanstaller on Copilot CLI...
223
+ [Yanstaller interview UI appears]
224
+ ```
225
+
226
+ ---
227
+
228
+ ## Error Scenarios
229
+
230
+ ### NPX Not Found
231
+ ```
232
+ Error: npx not found
233
+ Solution: Install Node.js >= 18.0.0 from https://nodejs.org/
234
+ ```
235
+
236
+ ### Network Issues
237
+ ```
238
+ Error: Cannot download create-byan-agent
239
+ Solution:
240
+ 1. Check internet connection
241
+ 2. Or install globally: npm install -g create-byan-agent
242
+ ```
243
+
244
+ ### Platform CLI Not Found
245
+ ```
246
+ Warning: Claude/Codex CLI not detected
247
+ Action: Yanstaller continues with manual installation instructions
248
+ ```
249
+
250
+ ---
251
+
252
+ ## Success Criteria
253
+
254
+ For a worker to succeed:
255
+
256
+ 1. ✅ `npx create-byan-agent` command executed
257
+ 2. ✅ Platform hint set correctly
258
+ 3. ✅ Yanstaller process started
259
+ 4. ✅ No errors during handoff
260
+
261
+ ---
262
+
263
+ ## Maintenance
264
+
265
+ **Update Frequency:** Rarely (workers are stable)
266
+
267
+ **What might change:**
268
+ - Command arguments (if yanstaller CLI changes)
269
+ - Platform detection logic
270
+ - Error messages
271
+
272
+ **What won't change:**
273
+ - Single responsibility principle
274
+ - Lightweight design
275
+ - Simple execution flow
276
+
277
+ ---
278
+
279
+ ## NPM Distribution
280
+
281
+ Launcher workers are included in the `create-byan-agent` NPM package:
282
+
283
+ ```
284
+ install/
285
+ └── templates/
286
+ └── _byan/
287
+ └── workers/
288
+ └── launchers/
289
+ ├── README.md
290
+ ├── launch-yanstaller-copilot.md
291
+ ├── launch-yanstaller-claude.md
292
+ └── launch-yanstaller-codex.md
293
+ ```
294
+
295
+ ---
296
+
297
+ ## Version History
298
+
299
+ - **1.0.0** (2026-02-10): Initial release
300
+ - Copilot launcher
301
+ - Claude launcher
302
+ - Codex launcher
303
+
304
+ ---
305
+
306
+ **Maintainer:** BYAN Core Team
307
+ **Last Updated:** 2026-02-10
308
+ **Status:** ✅ Production Ready
@@ -0,0 +1,204 @@
1
+ ---
2
+ name: launch-yanstaller-claude
3
+ type: worker
4
+ role: yanstaller-launcher
5
+ platform: claude-code
6
+ version: 1.0.0
7
+ ---
8
+
9
+ # Worker: Launch Yanstaller (Claude Code)
10
+
11
+ **Role:** Launch yanstaller on Claude Code platform
12
+ **Type:** Platform Launcher Worker
13
+ **Single Responsibility:** Execute `npx create-byan-agent` and hand off to yanstaller agent
14
+
15
+ ---
16
+
17
+ ## Activation
18
+
19
+ ```xml
20
+ <worker id="launch-yanstaller-claude" type="launcher">
21
+ <activation>
22
+ <step n="1">Detect platform: Claude Code</step>
23
+ <step n="2">Verify npx/npm available</step>
24
+ <step n="3">Execute: npx create-byan-agent</step>
25
+ <step n="4">Hand off to @bmad-agent-yanstaller</step>
26
+ </activation>
27
+ </worker>
28
+ ```
29
+
30
+ ---
31
+
32
+ ## Mission
33
+
34
+ **One task:** Launch yanstaller installer on Claude Code platform.
35
+
36
+ This worker does NOT:
37
+ - ❌ Configure BYAN installation
38
+ - ❌ Run interview questions
39
+ - ❌ Install agents/modules
40
+ - ❌ Create MCP servers
41
+
42
+ This worker ONLY:
43
+ - ✅ Launches `npx create-byan-agent`
44
+ - ✅ Verifies command execution
45
+ - ✅ Hands off to yanstaller agent
46
+
47
+ ---
48
+
49
+ ## Command
50
+
51
+ ```bash
52
+ npx create-byan-agent
53
+ ```
54
+
55
+ **Alternative (if already installed globally):**
56
+ ```bash
57
+ create-byan-agent
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Execution Flow
63
+
64
+ ```
65
+ User: claude --agent claude
66
+
67
+ Claude (stub): "Launching yanstaller..."
68
+
69
+ Worker: launch-yanstaller-claude
70
+
71
+ Command: npx create-byan-agent
72
+
73
+ Yanstaller: @bmad-agent-yanstaller takes over
74
+
75
+ Interview + Installation flow
76
+
77
+ MCP server creation (if selected)
78
+ ```
79
+
80
+ ---
81
+
82
+ ## Platform-Specific Notes
83
+
84
+ **Claude Code Integration:**
85
+ - Yanstaller will detect Claude platform
86
+ - Offers MCP server creation option
87
+ - Agent Claude (specialist) handles MCP setup
88
+ - Desktop config updated automatically
89
+
90
+ **MCP Creation Flow:**
91
+ ```
92
+ Yanstaller → Agent Claude (full) → MCP server
93
+
94
+ claude_desktop_config.json updated
95
+ ```
96
+
97
+ ---
98
+
99
+ ## Error Handling
100
+
101
+ **If npx not available:**
102
+ ```
103
+ Error: npx not found
104
+ Solution: Install Node.js >= 18.0.0
105
+ Command: https://nodejs.org/
106
+ ```
107
+
108
+ **If Claude CLI not in PATH:**
109
+ ```
110
+ Warning: Claude Code not detected
111
+ Solution: Install from https://claude.ai/download
112
+ Note: Yanstaller will continue with manual instructions
113
+ ```
114
+
115
+ ---
116
+
117
+ ## Success Criteria
118
+
119
+ 1. ✅ Command `npx create-byan-agent` executed
120
+ 2. ✅ Yanstaller process started
121
+ 3. ✅ Control handed to @bmad-agent-yanstaller
122
+ 4. ✅ Claude platform detected
123
+
124
+ ---
125
+
126
+ ## Integration
127
+
128
+ **Called by:** Agent Claude stub (`bmad-agent-claude`)
129
+ **Calls:** Yanstaller (`bmad-agent-yanstaller`)
130
+ **Platform:** Claude Code
131
+ **Specialist:** Agent Claude (full) for MCP setup
132
+
133
+ ---
134
+
135
+ ## Code
136
+
137
+ ```javascript
138
+ // worker-launch-yanstaller-claude.js
139
+ const { spawn } = require('child_process');
140
+
141
+ async function launch() {
142
+ console.log('🎭 Launching Yanstaller on Claude Code...');
143
+
144
+ // Set platform hint for yanstaller
145
+ process.env.BYAN_PLATFORM_HINT = 'claude';
146
+
147
+ return new Promise((resolve, reject) => {
148
+ const proc = spawn('npx', ['create-byan-agent'], {
149
+ stdio: 'inherit',
150
+ shell: true,
151
+ env: process.env
152
+ });
153
+
154
+ proc.on('error', (error) => {
155
+ reject(new Error(`Failed to launch: ${error.message}`));
156
+ });
157
+
158
+ proc.on('exit', (code) => {
159
+ if (code === 0) {
160
+ resolve({
161
+ success: true,
162
+ platform: 'claude',
163
+ mcpEnabled: true
164
+ });
165
+ } else {
166
+ reject(new Error(`Yanstaller exited with code ${code}`));
167
+ }
168
+ });
169
+ });
170
+ }
171
+
172
+ module.exports = { launch };
173
+ ```
174
+
175
+ ---
176
+
177
+ ## Testing
178
+
179
+ ```bash
180
+ # Test worker execution
181
+ node _byan/workers/launchers/worker-launch-yanstaller-claude.js
182
+
183
+ # Expected output:
184
+ # 🎭 Launching Yanstaller on Claude Code...
185
+ # [Yanstaller interview starts]
186
+ # [Platform: Claude detected]
187
+ ```
188
+
189
+ ---
190
+
191
+ ## Metadata
192
+
193
+ - **Worker Type:** Launcher
194
+ - **Complexity:** Simple (1 command)
195
+ - **Dependencies:** npx, Node.js >= 18.0.0, claude CLI (optional)
196
+ - **Estimated Duration:** < 5 seconds
197
+ - **Idempotent:** Yes (can be run multiple times)
198
+ - **Platform-Specific:** Sets BYAN_PLATFORM_HINT=claude
199
+
200
+ ---
201
+
202
+ **Status:** ✅ Ready for use
203
+ **Last Updated:** 2026-02-10
204
+ **Maintainer:** BYAN Core Team