create-byan-agent 2.2.1 → 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.
@@ -0,0 +1,328 @@
1
+ /**
2
+ * PLATFORM SELECTOR Module
3
+ *
4
+ * Interactive platform selection for BYAN installation.
5
+ * Detects available platforms and lets user choose target(s).
6
+ *
7
+ * @module yanstaller/platform-selector
8
+ */
9
+
10
+ const inquirer = require('inquirer');
11
+ const logger = require('../utils/logger');
12
+ const platforms = require('../platforms');
13
+
14
+ /**
15
+ * @typedef {Object} PlatformChoice
16
+ * @property {string} name - Display name
17
+ * @property {string} id - Platform ID ('copilot-cli' | 'vscode' | 'claude' | 'codex')
18
+ * @property {boolean} detected - Is platform installed?
19
+ * @property {string} [path] - Installation path if detected
20
+ * @property {boolean} native - Native integration available?
21
+ * @property {string} [agentSpecialist] - Agent specialist for this platform
22
+ */
23
+
24
+ /**
25
+ * @typedef {Object} PlatformSelectionResult
26
+ * @property {string[]} platforms - Selected platform IDs
27
+ * @property {string} mode - 'native' | 'conversational' | 'auto'
28
+ * @property {string} [specialist] - Agent specialist to use
29
+ */
30
+
31
+ const PLATFORM_INFO = {
32
+ 'copilot-cli': {
33
+ displayName: 'GitHub Copilot CLI',
34
+ native: true,
35
+ specialist: 'marc',
36
+ icon: 'šŸ¤–'
37
+ },
38
+ 'claude': {
39
+ displayName: 'Claude Code',
40
+ native: true,
41
+ specialist: 'claude',
42
+ icon: 'šŸŽ­'
43
+ },
44
+ 'codex': {
45
+ displayName: 'OpenCode/Codex',
46
+ native: true, // NOW NATIVE!
47
+ specialist: 'codex',
48
+ icon: 'šŸ“'
49
+ },
50
+ 'vscode': {
51
+ displayName: 'VS Code',
52
+ native: false,
53
+ specialist: null,
54
+ icon: 'šŸ’»'
55
+ }
56
+ };
57
+
58
+ /**
59
+ * Detect and select platforms interactively
60
+ *
61
+ * @param {Object} detectionResult - Result from detector.detect()
62
+ * @returns {Promise<PlatformSelectionResult>}
63
+ */
64
+ async function select(detectionResult) {
65
+ logger.info('\nšŸŽÆ Platform Selection\n');
66
+
67
+ // Build platform choices from detection
68
+ const choices = buildChoices(detectionResult.platforms);
69
+
70
+ // Check if any native integration available
71
+ const hasNative = choices.some(c => c.native && c.detected);
72
+
73
+ if (choices.length === 0) {
74
+ logger.warn('No platforms detected. Will create _byan/ structure only.');
75
+ return {
76
+ platforms: [],
77
+ mode: 'manual'
78
+ };
79
+ }
80
+
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)
133
+ const answer = await inquirer.prompt([
134
+ {
135
+ type: 'list',
136
+ name: 'selection',
137
+ message: 'Choose installation target:',
138
+ choices: [
139
+ {
140
+ name: `šŸš€ Auto (detect & install all available) - ${choices.length} platform(s)`,
141
+ value: 'auto'
142
+ },
143
+ ...choices.map(c => ({
144
+ name: formatPlatformChoice(c),
145
+ value: `single:${c.id}`
146
+ })),
147
+ {
148
+ name: 'šŸ”§ Custom (select multiple)',
149
+ value: 'custom'
150
+ }
151
+ ]
152
+ }
153
+ ]);
154
+
155
+ if (answer.selection === 'auto') {
156
+ return handleAutoMode(choices);
157
+ }
158
+
159
+ if (answer.selection === 'custom') {
160
+ return handleCustomMode(choices);
161
+ }
162
+
163
+ // Single platform selection
164
+ const platformId = answer.selection.replace('single:', '');
165
+ return handleSinglePlatform(platformId, choices);
166
+ }
167
+
168
+ /**
169
+ * Build platform choices from detection result
170
+ *
171
+ * @param {Array} detectedPlatforms - From detector
172
+ * @returns {PlatformChoice[]}
173
+ */
174
+ function buildChoices(detectedPlatforms) {
175
+ return detectedPlatforms
176
+ .filter(p => p.detected)
177
+ .map(p => {
178
+ const info = PLATFORM_INFO[p.name] || {
179
+ displayName: p.name,
180
+ native: false,
181
+ specialist: null,
182
+ icon: 'ā“'
183
+ };
184
+
185
+ return {
186
+ name: info.displayName,
187
+ id: p.name,
188
+ detected: p.detected,
189
+ path: p.path,
190
+ native: info.native,
191
+ agentSpecialist: info.specialist,
192
+ icon: info.icon
193
+ };
194
+ });
195
+ }
196
+
197
+ /**
198
+ * Format platform choice for display
199
+ *
200
+ * @param {PlatformChoice} choice
201
+ * @returns {string}
202
+ */
203
+ function formatPlatformChoice(choice) {
204
+ const nativeBadge = choice.native ? '✨ Native' : 'šŸ’¬ Conversational';
205
+ const statusBadge = choice.detected ? 'āœ“' : 'āœ—';
206
+
207
+ return `${choice.icon} ${choice.name} (${nativeBadge}) ${statusBadge}`;
208
+ }
209
+
210
+ /**
211
+ * Handle auto mode - install on all detected platforms
212
+ *
213
+ * @param {PlatformChoice[]} choices
214
+ * @returns {Promise<PlatformSelectionResult>}
215
+ */
216
+ async function handleAutoMode(choices) {
217
+ const nativePlatforms = choices.filter(c => c.native);
218
+
219
+ if (nativePlatforms.length > 0) {
220
+ // Use native integration for first platform (or all?)
221
+ return {
222
+ platforms: choices.map(c => c.id),
223
+ mode: 'native',
224
+ specialist: nativePlatforms[0].agentSpecialist
225
+ };
226
+ }
227
+
228
+ return {
229
+ platforms: choices.map(c => c.id),
230
+ mode: 'conversational'
231
+ };
232
+ }
233
+
234
+ /**
235
+ * Handle custom mode - user selects multiple platforms
236
+ *
237
+ * @param {PlatformChoice[]} choices
238
+ * @returns {Promise<PlatformSelectionResult>}
239
+ */
240
+ async function handleCustomMode(choices) {
241
+ const answer = await inquirer.prompt([
242
+ {
243
+ type: 'checkbox',
244
+ name: 'platforms',
245
+ message: 'Select platforms to install on:',
246
+ choices: choices.map(c => ({
247
+ name: formatPlatformChoice(c),
248
+ value: c.id,
249
+ checked: c.detected
250
+ }))
251
+ }
252
+ ]);
253
+
254
+ if (answer.platforms.length === 0) {
255
+ logger.warn('No platforms selected. Installation cancelled.');
256
+ return {
257
+ platforms: [],
258
+ mode: 'manual'
259
+ };
260
+ }
261
+
262
+ // Check if any selected platform has native integration
263
+ const selectedChoices = choices.filter(c => answer.platforms.includes(c.id));
264
+ const nativePlatform = selectedChoices.find(c => c.native);
265
+
266
+ if (nativePlatform) {
267
+ return {
268
+ platforms: answer.platforms,
269
+ mode: 'native',
270
+ specialist: nativePlatform.agentSpecialist
271
+ };
272
+ }
273
+
274
+ return {
275
+ platforms: answer.platforms,
276
+ mode: 'conversational'
277
+ };
278
+ }
279
+
280
+ /**
281
+ * Handle single platform selection
282
+ *
283
+ * @param {string} platformId
284
+ * @param {PlatformChoice[]} choices
285
+ * @returns {PlatformSelectionResult}
286
+ */
287
+ function handleSinglePlatform(platformId, choices) {
288
+ const choice = choices.find(c => c.id === platformId);
289
+
290
+ if (!choice) {
291
+ throw new Error(`Platform ${platformId} not found`);
292
+ }
293
+
294
+ return {
295
+ platforms: [platformId],
296
+ mode: choice.native ? 'native' : 'conversational',
297
+ specialist: choice.agentSpecialist
298
+ };
299
+ }
300
+
301
+ /**
302
+ * Get specialist agent for platform
303
+ *
304
+ * @param {string} platformId
305
+ * @returns {string|null}
306
+ */
307
+ function getSpecialist(platformId) {
308
+ const info = PLATFORM_INFO[platformId];
309
+ return info?.specialist || null;
310
+ }
311
+
312
+ /**
313
+ * Check if platform has native integration
314
+ *
315
+ * @param {string} platformId
316
+ * @returns {boolean}
317
+ */
318
+ function hasNativeIntegration(platformId) {
319
+ const info = PLATFORM_INFO[platformId];
320
+ return info?.native || false;
321
+ }
322
+
323
+ module.exports = {
324
+ select,
325
+ getSpecialist,
326
+ hasNativeIntegration,
327
+ PLATFORM_INFO
328
+ };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-byan-agent",
3
- "version": "2.0.2",
4
- "description": "Create custom AI agents in 15 minutes through intelligent interviews. GitHub Copilot CLI, VSCode, Claude Code compatible. 64 quality mantras applied automatically.",
3
+ "version": "2.2.2",
4
+ "description": "BYAN v2.2.2 - Intelligent AI agent installer with multi-platform native support (GitHub Copilot CLI, Claude Code, Codex/OpenCode)",
5
5
  "bin": {
6
6
  "create-byan-agent": "bin/create-byan-agent-v2.js"
7
7
  },
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: 'claude'
3
+ description: 'Claude Code integration specialist for BYAN agents'
4
+ ---
5
+
6
+ You must fully embody this agent's persona and follow all activation instructions exactly as specified. NEVER break character until given an exit command.
7
+
8
+ <agent-activation CRITICAL="TRUE">
9
+ 1. LOAD the FULL agent file from {project-root}/_byan/bmb/agents/claude.md
10
+ 2. READ its entire contents - this contains the complete agent persona, menu, and instructions
11
+ 3. FOLLOW every step in the <activation> section precisely
12
+ 4. DISPLAY the welcome/greeting as instructed
13
+ 5. PRESENT the numbered menu
14
+ 6. WAIT for user input before proceeding
15
+ </agent-activation>
16
+
17
+ ```xml
18
+ <agent id="claude.agent.yaml" name="CLAUDE" title="Claude Code Integration Specialist" icon="šŸŽ­">
19
+ <activation critical="MANDATORY">
20
+ <step n="1">Load persona from {project-root}/_byan/bmb/agents/claude.md</step>
21
+ <step n="2">Load config from {project-root}/_byan/bmb/config.yaml</step>
22
+ <step n="3">Show greeting and menu in {communication_language}</step>
23
+ <step n="4">WAIT for user input</step>
24
+ <rules>
25
+ <r>Expert in Claude Code, MCP servers, and agent configuration</r>
26
+ <r>Validate MCP server config JSON structure</r>
27
+ <r>Test MCP server detection before deployment</r>
28
+ <r>Handle platform-specific paths (macOS/Linux/Windows)</r>
29
+ </rules>
30
+ </activation>
31
+
32
+ <persona>
33
+ <role>Claude Code Expert + MCP Server Integration Specialist</role>
34
+ <identity>Elite Claude Code specialist who masters MCP servers, agent configuration, and native BYAN integration. Ensures agents are properly configured as MCP servers and detected by Claude Desktop.</identity>
35
+ </persona>
36
+
37
+ <capabilities>
38
+ - Validate claude_desktop_config.json structure
39
+ - Configure MCP servers for BYAN agents
40
+ - Test MCP server detection and connectivity
41
+ - Handle platform-specific config paths
42
+ - Troubleshoot MCP server loading issues
43
+ - Optimize context usage for Claude
44
+ - Create native Claude Code workflows
45
+ - Map BYAN agents to MCP commands
46
+ </capabilities>
47
+ </agent>
48
+ ```
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: 'codex'
3
+ description: 'OpenCode/Codex integration specialist for BYAN skills'
4
+ ---
5
+
6
+ You must fully embody this agent's persona and follow all activation instructions exactly as specified. NEVER break character until given an exit command.
7
+
8
+ <agent-activation CRITICAL="TRUE">
9
+ 1. LOAD the FULL agent file from {project-root}/_byan/bmb/agents/codex.md
10
+ 2. READ its entire contents - this contains the complete agent persona, menu, and instructions
11
+ 3. FOLLOW every step in the <activation> section precisely
12
+ 4. DISPLAY the welcome/greeting as instructed
13
+ 5. PRESENT the numbered menu
14
+ 6. WAIT for user input before proceeding
15
+ </agent-activation>
16
+
17
+ ```xml
18
+ <agent id="codex.agent.yaml" name="CODEX" title="OpenCode/Codex Integration Specialist" icon="šŸ“">
19
+ <activation critical="MANDATORY">
20
+ <step n="1">Load persona from {project-root}/_byan/bmb/agents/codex.md</step>
21
+ <step n="2">Load config from {project-root}/_byan/bmb/config.yaml</step>
22
+ <step n="3">Show greeting and menu in {communication_language}</step>
23
+ <step n="4">WAIT for user input</step>
24
+ <rules>
25
+ <r>Expert in OpenCode/Codex, skills system, and prompt configuration</r>
26
+ <r>Validate .codex/prompts/ structure</r>
27
+ <r>Test skill detection before deployment</r>
28
+ <r>Handle Codex-specific terminology (skills not agents)</r>
29
+ </rules>
30
+ </activation>
31
+
32
+ <persona>
33
+ <role>OpenCode/Codex Expert + Skills Integration Specialist</role>
34
+ <identity>Elite Codex specialist who masters skills system, prompt files, and native BYAN integration. Ensures BYAN agents are properly exposed as Codex skills and detected by OpenCode CLI.</identity>
35
+ </persona>
36
+
37
+ <capabilities>
38
+ - Validate .codex/prompts/ structure
39
+ - Configure Codex skills for BYAN agents
40
+ - Test skill detection and invocation
41
+ - Create skill prompt files
42
+ - Troubleshoot skill loading issues
43
+ - Map BYAN agents to Codex skills
44
+ - Optimize prompts for Codex
45
+ - Handle Codex CLI commands
46
+ </capabilities>
47
+ </agent>
48
+ ```