create-byan-agent 2.3.0 → 2.3.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.
@@ -0,0 +1,410 @@
1
+ # Hermes - Dispatcher Universel BYAN
2
+
3
+ ## Vue d'ensemble
4
+
5
+ **Hermes** est le point d'entrée intelligent de l'écosystème BYAN v2.3.2+. Comme le dieu grec messager, il connaît tous les agents (35+), workflows, et contextes du système et route l'utilisateur vers le bon spécialiste.
6
+
7
+ **Hermes ne fait pas le travail - il dispatch au bon agent.**
8
+
9
+ ## Installation
10
+
11
+ Hermes est automatiquement installé avec BYAN v2.3.2+:
12
+
13
+ ```bash
14
+ npx create-byan-agent
15
+ ```
16
+
17
+ Ou global:
18
+
19
+ ```bash
20
+ npm install -g create-byan-agent
21
+ ```
22
+
23
+ ## Invocation
24
+
25
+ ```bash
26
+ # Via GitHub Copilot CLI
27
+ @hermes
28
+
29
+ # Via Codex
30
+ codex hermes
31
+
32
+ # Via Claude
33
+ claude hermes
34
+ ```
35
+
36
+ ## Menu Principal
37
+
38
+ Quand vous invoquez `@hermes`, vous obtenez un menu interactif:
39
+
40
+ ```
41
+ ╔═══════════════════════════════════════════════════════════════╗
42
+ ║ 🏛️ HERMES - Dispatcher Universel BYAN ║
43
+ ║ Point d'Entrée Intelligent ║
44
+ ╚═══════════════════════════════════════════════════════════════╝
45
+
46
+ Salut {user}! 👋
47
+
48
+ 📋 MENU PRINCIPAL:
49
+
50
+ [1] [LA] Lister les Agents (par module)
51
+ [2] [LW] Lister les Workflows
52
+ [3] [LC] Lister les Contextes Projet
53
+ [4] [REC] Routing Intelligent - Quel agent pour ma tâche?
54
+ [5] [PIPE] Pipeline - Créer une chaîne d'agents
55
+ [6] [?] Aide Rapide sur un agent
56
+ [7] [@] Invoquer un Agent directement
57
+ [8] [EXIT] Quitter Hermes
58
+ [9] [HELP] Afficher ce menu
59
+ ```
60
+
61
+ ## Commandes
62
+
63
+ ### 1. Liste des Agents - [LA]
64
+
65
+ Affiche tous les 35+ agents organisés par module:
66
+
67
+ ```
68
+ 📦 MODULE: core (Foundation)
69
+ ├─ hermes 🏛️ Dispatcher Universel BYAN
70
+ ├─ bmad-master 🧙 Master Executor & Orchestrator
71
+ ├─ yanstaller 📦 Installateur Intelligent
72
+ └─ expert-merise-agile 📐 Expert Conception Merise
73
+
74
+ 🔨 MODULE: bmb (Builders)
75
+ ├─ byan 🤖 Agent Creator (Interview)
76
+ ├─ byan-v2 🤖 BYAN v2 (Optimized)
77
+ ├─ agent-builder 🏗️ Agent Construction Expert
78
+ ├─ marc 🔷 GitHub Copilot Integration
79
+ ├─ rachid 📦 NPM/NPX Deployment
80
+ └─ ... (11 total)
81
+
82
+ 💼 MODULE: bmm (Management - SDLC)
83
+ ├─ analyst 📊 Business Analyst (Mary)
84
+ ├─ architect 🏗️ Software Architect (Winston)
85
+ ├─ dev 💻 Developer (Amelia)
86
+ ├─ pm 📋 Product Manager (John)
87
+ └─ ... (10 total)
88
+
89
+ 🎨 MODULE: cis (Creative & Innovation)
90
+ ├─ brainstorming-coach 🧠 Brainstorming (Carson)
91
+ ├─ storyteller 📖 Storytelling (Sophia)
92
+ └─ ... (6 total)
93
+
94
+ 🧪 MODULE: tea (Testing)
95
+ └─ tea 🧪 Master Test Architect (Murat)
96
+ ```
97
+
98
+ ### 2. Routing Intelligent - [REC]
99
+
100
+ Décris ta tâche, Hermes recommande les meilleurs agents:
101
+
102
+ ```
103
+ Tu: [REC] j'ai besoin de créer un nouveau microservice avec tests
104
+
105
+ Hermes:
106
+ 🎯 RECOMMANDATION INTELLIGENTE:
107
+
108
+ | # | Agent | Module | Pourquoi |
109
+ |---|----------------|--------|------------------------------------|
110
+ | 1 | Architect | bmm | Architecture & design pattern |
111
+ | 2 | Dev (Amelia) | bmm | Implementation microservice |
112
+ | 3 | Tea (Murat) | tea | Test strategy & automation |
113
+
114
+ 💡 Tape @architect pour démarrer
115
+ 💡 Ou [PIPE] pour créer une chaîne complète
116
+ ```
117
+
118
+ ### 3. Pipeline Multi-Agents - [PIPE]
119
+
120
+ Crée une chaîne d'agents pour un objectif complexe:
121
+
122
+ ```
123
+ Tu: [PIPE] feature complète de A à Z
124
+
125
+ Hermes:
126
+ 🔗 PIPELINE PROPOSÉ:
127
+
128
+ | Étape | Agent | Rôle | Livrable |
129
+ |-------|----------------|-----------------------|------------------|
130
+ | 1 | PM (John) | Définir feature | User stories |
131
+ | 2 | Architect | Architecture | Schema technique |
132
+ | 3 | UX Designer | Interface design | Maquettes |
133
+ | 4 | Dev (Amelia) | Implémentation | Code |
134
+ | 5 | Tea (Murat) | Tests | Suite de tests |
135
+
136
+ ✅ Valide ce pipeline?
137
+ 💡 Tape @pm pour démarrer à l'étape 1
138
+ ```
139
+
140
+ ### 4. Aide Rapide - [?agent]
141
+
142
+ Info rapide sur un agent sans le charger:
143
+
144
+ ```
145
+ Tu: ?byan
146
+
147
+ Hermes:
148
+ 📋 AGENT: byan
149
+
150
+ 🏷️ Title: Intelligent Agent Creator
151
+ 📦 Module: bmb
152
+ 👤 Role: Agent Builder via Structured Interview
153
+ 📝 Description: Creates custom BYAN agents through 12-question interview.
154
+ Applies 64 mantras, Merise Agile + TDD methodology.
155
+
156
+ 💡 Tape @byan pour l'invoquer
157
+ 💡 Ou [LA] pour voir tous les agents
158
+ ```
159
+
160
+ ### 5. Invocation Directe - [@agent]
161
+
162
+ Charge et active un agent immédiatement:
163
+
164
+ ```
165
+ Tu: @dev
166
+
167
+ Hermes:
168
+ ✅ Agent dev loaded. Follow its activation instructions.
169
+
170
+ [Dev agent takes over, Hermes exits]
171
+ ```
172
+
173
+ ## Raccourcis
174
+
175
+ Hermes supporte des raccourcis pour aller plus vite:
176
+
177
+ ```bash
178
+ # Invocation directe (sans passer par le menu)
179
+ @hermes @dev # Charge Dev directement
180
+ @hermes ?byan # Aide sur BYAN
181
+ @hermes la # Liste agents
182
+
183
+ # Routing en une commande
184
+ @hermes rec créer API backend
185
+ @hermes pipe feature auth complète
186
+
187
+ # Aliases
188
+ @hermes agents # = [LA]
189
+ @hermes workflows # = [LW]
190
+ @hermes help # = [HELP]
191
+ ```
192
+
193
+ ## Règles de Routage Intelligent
194
+
195
+ Hermes applique ces règles pour recommander des agents:
196
+
197
+ | Mots-clés | Agent(s) Recommandés | Module |
198
+ |-----------|----------------------|--------|
199
+ | create agent, new agent, build agent | BYAN v2 | bmb |
200
+ | npm, publish, package | Rachid | bmb |
201
+ | copilot integration | Marc | bmb |
202
+ | optimize tokens, reduce size | Carmack | bmb |
203
+ | product brief, prd, requirements | PM (John) | bmm |
204
+ | architecture, design system, tech stack | Architect (Winston) | bmm |
205
+ | user stories, sprint, backlog | SM (Bob) | bmm |
206
+ | business analysis, market research | Analyst (Mary) | bmm |
207
+ | ux, ui, interface, design | UX Designer (Sally) | bmm |
208
+ | code, implement, develop, feature | Dev (Amelia) | bmm |
209
+ | quick dev, fast, brownfield | Quick Flow (Barry) | bmm |
210
+ | document, documentation, readme | Tech Writer (Paige) | bmm |
211
+ | test, qa, quality, automation | Tea (Murat) / Quinn | tea / bmm |
212
+ | code review | Dev (Amelia) | bmm |
213
+ | brainstorm, ideation, ideas | Brainstorming Coach (Carson) | cis |
214
+ | problem, stuck, solve | Creative Problem Solver | cis |
215
+ | presentation, slides, pitch | Presentation Master | cis |
216
+ | story, narrative, storytelling | Storyteller (Sophia) | cis |
217
+ | innovation, disrupt | Innovation Strategist | cis |
218
+ | design thinking, empathy | Design Thinking Coach | cis |
219
+ | merise, mcd, mct, conceptual model | Expert Merise Agile | core |
220
+
221
+ ## Pipelines Prédéfinis
222
+
223
+ Hermes connaît ces pipelines courants:
224
+
225
+ 1. **Feature Complete**: PM → Architect → UX → SM → Dev → Tea
226
+ 2. **Idea to Code**: PM → Architect → SM → Quick Flow
227
+ 3. **New Agent**: BYAN (handles entire flow)
228
+ 4. **Refactoring**: Architect → Dev → Tea
229
+ 5. **Bug Fix**: Dev → Quinn
230
+ 6. **Documentation**: Analyst → Tech Writer
231
+ 7. **Quality Complete**: Tea → Quinn → code-review
232
+
233
+ ## Exemples d'Utilisation
234
+
235
+ ### Exemple 1: Nouveau projet
236
+
237
+ ```bash
238
+ @hermes
239
+
240
+ # Menu apparaît
241
+ [4] [REC] # Tu tapes 4 ou REC
242
+
243
+ # Hermes: Décris ta tâche
244
+ Tu: créer un nouveau backend API REST avec auth JWT
245
+
246
+ # Hermes recommande: PM → Architect → Dev → Tea
247
+ # Tu tapes @pm pour démarrer
248
+ ```
249
+
250
+ ### Exemple 2: Exploration agents
251
+
252
+ ```bash
253
+ @hermes
254
+
255
+ # Menu apparaît
256
+ [1] [LA] # Liste tous les agents
257
+
258
+ # Tu vois: dev (Amelia) - Developer
259
+ [6] ?dev # Info rapide sur Dev
260
+
261
+ # Tu décides d'invoquer
262
+ [7] @dev # Charge Dev agent
263
+ ```
264
+
265
+ ### Exemple 3: Pipeline custom
266
+
267
+ ```bash
268
+ @hermes
269
+
270
+ [5] [PIPE] # Créer pipeline
271
+
272
+ # Hermes: Décris l'objectif
273
+ Tu: migration legacy vers microservices avec tests
274
+
275
+ # Hermes propose: Architect → Dev → Tea → Tech Writer
276
+ # Tu valides et commences
277
+ ```
278
+
279
+ ## Architecture Technique
280
+
281
+ ### Manifestes
282
+
283
+ Hermes lit 3 manifestes CSV:
284
+
285
+ ```
286
+ .github/copilot/_config/
287
+ ├── agent-manifest.csv # 35+ agents
288
+ ├── workflow-manifest.csv # Workflows par module
289
+ └── task-manifest.csv # Tasks standalone
290
+ ```
291
+
292
+ ### Activation en 6 Étapes
293
+
294
+ 1. Load persona complet
295
+ 2. **CRITICAL**: Charge config.yaml (user_name, communication_language, etc.)
296
+ 3. Store variables de session
297
+ 4. Display menu
298
+ 5. WAIT for user input
299
+ 6. Process input via handlers
300
+
301
+ ### Handlers
302
+
303
+ - **Number handler**: Commandes numériques (1-9)
304
+ - **Command handler**: Aliases (LA, REC, PIPE, etc.)
305
+ - **Invoke handler**: @agent-name → charge agent
306
+ - **Fuzzy handler**: Texte libre → match partiel → suggère
307
+
308
+ ## Configuration
309
+
310
+ Hermes lit la config globale:
311
+
312
+ ```yaml
313
+ # .github/copilot/config.yaml
314
+ user_name: "Yan"
315
+ communication_language: "Francais"
316
+ document_output_language: "Francais"
317
+ output_folder: "{project-root}/_byan-output"
318
+ project_root: "/home/yan/conception"
319
+ ```
320
+
321
+ ## Mantras Hermes
322
+
323
+ Hermes applique ces mantras BYAN:
324
+
325
+ - **#7 - KISS**: Interface délibérément minimaliste
326
+ - **#37 - Ockham's Razor**: Simplicité d'abord
327
+ - **#4 - Fail Fast**: Erreurs immédiates et actionnables
328
+ - **IA-21 - Self-Aware**: "Je dispatch, je n'exécute pas"
329
+ - **IA-24 - Clean Code**: Communication minimale et claire
330
+
331
+ ## Troubleshooting
332
+
333
+ ### Config non trouvée
334
+
335
+ ```
336
+ ❌ ERROR: Config file not found at {project-root}/.github/copilot/config.yaml
337
+
338
+ Cannot proceed without configuration.
339
+ 💡 Run: npx create-byan-agent
340
+ ```
341
+
342
+ **Solution**: Installer BYAN via Yanstaller
343
+
344
+ ### Agent non trouvé
345
+
346
+ ```
347
+ ❌ Agent 'deev' not found in manifest.
348
+ 💡 Tape [LA] to list all agents
349
+ 💡 Or [REC] for smart recommendation
350
+ ```
351
+
352
+ **Solution**: Vérifie orthographe ou utilise [REC]
353
+
354
+ ### Manifest manquant
355
+
356
+ ```
357
+ ℹ️ Workflow manifest not yet created.
358
+ Workflows are executed by specialized agents.
359
+ Tape [LA] to see agents that run workflows.
360
+ ```
361
+
362
+ **Solution**: Normal, les workflows sont dans les agents
363
+
364
+ ## Intégration avec Cost Optimizer
365
+
366
+ Hermes détecte automatiquement si le Cost Optimizer est installé:
367
+
368
+ ```bash
369
+ # Si byan-copilot-router présent
370
+ @hermes
371
+
372
+ # Hermes note: "💰 Cost Optimizer actif (54% savings)"
373
+ ```
374
+
375
+ Voir: [Cost Optimizer Integration](./cost-optimizer-integration.md)
376
+
377
+ ## Roadmap
378
+
379
+ - **v2.3.2**: Hermes initial (✅ current)
380
+ - **v2.4.0**: Workflow manifest complet
381
+ - **v2.5.0**: Task manifest + contextes dynamiques
382
+ - **v2.6.0**: Machine learning routing (learn from usage)
383
+ - **v3.0.0**: Multi-language support (Python, Go, Rust agents)
384
+
385
+ ## Contribuer
386
+
387
+ Hermes est défini dans:
388
+
389
+ ```
390
+ install/templates/.github/agents/hermes.md (573 lignes XML)
391
+ install/templates/_byan/_config/agent-manifest.csv
392
+ ```
393
+
394
+ Pour ajouter des règles de routage, modifier `<routing_rules>` dans hermes.md.
395
+
396
+ Pour ajouter des pipelines, modifier `<pipelines>` dans hermes.md.
397
+
398
+ ## Liens
399
+
400
+ - [Documentation BYAN](./README.md)
401
+ - [Agent Manifest](../templates/_byan/_config/agent-manifest.csv)
402
+ - [Workflow Manifest](../templates/_byan/_config/workflow-manifest.csv)
403
+ - [Cost Optimizer](./cost-optimizer-integration.md)
404
+
405
+ ---
406
+
407
+ **Hermes - Messenger of the BYAN Gods**
408
+ *Fast, Efficient, Always Knows Where to Find What You Need*
409
+
410
+ 🏛️ @hermes
@@ -526,7 +526,7 @@ async function install() {
526
526
  console.log(chalk.green(` Turbo Whisper: ${interviewResults.turboWhisper.mode} (${interviewResults.turboWhisper.reason})`));
527
527
  }
528
528
  if (interviewResults.agents) {
529
- console.log(chalk.green(` Essential agents: ${interviewResults.agents.essential?.join(', ')}`));
529
+ console.log(chalk.green(` Essential agents: ${interviewResults.agents.essential ? interviewResults.agents.essential.join(', ') : 'none'}`));
530
530
  }
531
531
  if (interviewResults.modules) {
532
532
  console.log(chalk.green(` Modules: ${interviewResults.modules.join(', ')}`));
@@ -626,7 +626,7 @@ async function install() {
626
626
  // Agents recommendation
627
627
  if (interviewResults.agents) {
628
628
  console.log(chalk.cyan(` 📦 Agents essentiels: ${(interviewResults.agents.essential || []).join(', ')}`));
629
- if (interviewResults.agents.optional?.length > 0) {
629
+ if (interviewResults.agents.optional && interviewResults.agents.optional.length > 0) {
630
630
  console.log(chalk.gray(` 📦 Agents optionnels: ${interviewResults.agents.optional.join(', ')}`));
631
631
  }
632
632
  }
@@ -638,6 +638,78 @@ async function install() {
638
638
 
639
639
  console.log('');
640
640
 
641
+ // NEW: Select preferred AI platform for Phase 2 conversation
642
+ let selectedPlatform = null;
643
+ const availablePlatforms = [];
644
+
645
+ if (detectedPlatforms.copilot) availablePlatforms.push({ name: '🤖 GitHub Copilot CLI', value: 'copilot' });
646
+ if (detectedPlatforms.codex) availablePlatforms.push({ name: '🔷 OpenAI Codex', value: 'codex' });
647
+ if (detectedPlatforms.claude) availablePlatforms.push({ name: '🧠 Claude Code (Anthropic)', value: 'claude' });
648
+
649
+ if (availablePlatforms.length > 1) {
650
+ const { platform } = await inquirer.prompt([{
651
+ type: 'list',
652
+ name: 'platform',
653
+ message: 'Quelle plateforme IA utiliser pour Phase 2?',
654
+ choices: availablePlatforms,
655
+ default: 'copilot'
656
+ }]);
657
+ selectedPlatform = platform;
658
+ } else if (availablePlatforms.length === 1) {
659
+ selectedPlatform = availablePlatforms[0].value;
660
+ console.log(chalk.cyan(`🤖 Plateforme détectée: ${availablePlatforms[0].name}`));
661
+ } else {
662
+ console.log(chalk.red('❌ Aucune plateforme IA détectée. Installation en mode AUTO.'));
663
+ installMode = 'auto';
664
+ }
665
+
666
+ // NEW: Verify authentication for selected platform
667
+ if (selectedPlatform && installMode === 'custom') {
668
+ console.log('');
669
+ console.log(chalk.gray('🔐 Vérification de l\'authentification...'));
670
+
671
+ try {
672
+ let checkCmd;
673
+ let loginCmd;
674
+
675
+ if (selectedPlatform === 'copilot') {
676
+ checkCmd = 'copilot --version';
677
+ loginCmd = 'gh auth login';
678
+ } else if (selectedPlatform === 'codex') {
679
+ checkCmd = 'codex --version';
680
+ loginCmd = 'codex login';
681
+ } else if (selectedPlatform === 'claude') {
682
+ checkCmd = 'claude --version';
683
+ loginCmd = 'claude auth';
684
+ }
685
+
686
+ const result = execSync(checkCmd, { encoding: 'utf8', timeout: 5000, stdio: 'pipe' });
687
+ console.log(chalk.green(`✓ ${selectedPlatform} disponible`));
688
+ } catch (error) {
689
+ console.log('');
690
+ console.log(chalk.yellow(`⚠️ ${selectedPlatform} n'est pas authentifié ou non disponible`));
691
+ console.log(chalk.gray(` Pour vous connecter, exécutez: ${chalk.cyan(loginCmd)}`));
692
+ console.log('');
693
+
694
+ const { continueAnyway } = await inquirer.prompt([{
695
+ type: 'confirm',
696
+ name: 'continueAnyway',
697
+ message: 'Continuer avec configuration AUTO (sans conversation)?',
698
+ default: true
699
+ }]);
700
+
701
+ if (!continueAnyway) {
702
+ console.log(chalk.red('Installation annulée. Connectez-vous d\'abord à votre plateforme IA.'));
703
+ process.exit(1);
704
+ }
705
+
706
+ installMode = 'auto';
707
+ selectedPlatform = null;
708
+ }
709
+ }
710
+
711
+ console.log('');
712
+
641
713
  // Phase 2: Interactive Chat with Yanstaller Agent
642
714
  // Ask user if they want to enter Phase 2 conversation
643
715
  const { enterPhase2 } = await inquirer.prompt([{
@@ -654,15 +726,16 @@ async function install() {
654
726
 
655
727
  let phase2Results = null;
656
728
 
657
- if (enterPhase2 === 'chat') {
729
+ if (enterPhase2 === 'chat' && selectedPlatform) {
658
730
  // Launch interactive chat
659
731
  phase2Results = await launchPhase2Chat({
660
732
  interviewAnswers,
661
733
  detectedPlatforms,
734
+ selectedPlatform, // NEW: Pass selected platform
662
735
  projectRoot,
663
736
  templateDir,
664
- userName: null, // Will be asked later
665
- language: 'Francais'
737
+ userName: config.userName || null,
738
+ language: config.language || 'Francais'
666
739
  });
667
740
 
668
741
  // If chat returned null, offer fallback
@@ -693,10 +766,10 @@ async function install() {
693
766
  if (phase2Results.coreAgents) {
694
767
  console.log(chalk.green(` Core: ${phase2Results.coreAgents.map(a => a.name).join(', ')}`));
695
768
  }
696
- if (phase2Results.agentRelationships?.length > 0) {
769
+ if (phase2Results.agentRelationships && phase2Results.agentRelationships.length > 0) {
697
770
  console.log(chalk.gray(` Relations: ${phase2Results.agentRelationships.length} defined`));
698
771
  }
699
- if (phase2Results.customAgentsToCreate?.length > 0) {
772
+ if (phase2Results.customAgentsToCreate && phase2Results.customAgentsToCreate.length > 0) {
700
773
  console.log(chalk.yellow(` À créer: ${phase2Results.customAgentsToCreate.map(a => a.name).join(', ')}`));
701
774
  }
702
775
  console.log('');
@@ -77,11 +77,11 @@ Quand l'utilisateur dit "finaliser", "terminer" ou "c'est bon", génère la conf
77
77
  * @param {string} message User message
78
78
  * @param {string} systemContext System context/preprompt
79
79
  * @param {string} conversationHistory Previous conversation
80
- * @param {Object} detectedPlatforms Available AI platforms
80
+ * @param {string} selectedPlatform Selected AI platform
81
81
  * @param {string} projectRoot Project root directory
82
82
  * @returns {Promise<string>} AI response
83
83
  */
84
- async function sendChatMessage(message, systemContext, conversationHistory, detectedPlatforms, projectRoot) {
84
+ async function sendChatMessage(message, systemContext, conversationHistory, selectedPlatform, projectRoot) {
85
85
  // Build the full prompt with context and history
86
86
  const fullPrompt = `${systemContext}
87
87
 
@@ -98,34 +98,36 @@ Continue la conversation pour comprendre le projet et personnaliser les agents.`
98
98
  let result = '';
99
99
 
100
100
  try {
101
- if (detectedPlatforms.copilot) {
101
+ const escaped = fullPrompt.replace(/"/g, '\\"').replace(/\n/g, '\\n');
102
+
103
+ if (selectedPlatform === 'copilot') {
102
104
  // Use copilot with single prompt mode (-s for silent, no interactive)
103
- const escaped = fullPrompt.replace(/"/g, '\\"').replace(/\n/g, '\\n');
104
105
  result = execSync(`copilot -p "${escaped}" -s 2>/dev/null`, {
105
106
  encoding: 'utf8',
106
107
  cwd: projectRoot,
107
108
  timeout: 60000,
108
109
  maxBuffer: 1024 * 1024
109
110
  });
110
- } else if (detectedPlatforms.codex) {
111
- const escaped = fullPrompt.replace(/"/g, '\\"').replace(/\n/g, '\\n');
111
+ } else if (selectedPlatform === 'codex') {
112
112
  result = execSync(`codex -p "${escaped}" --quiet 2>/dev/null`, {
113
113
  encoding: 'utf8',
114
114
  cwd: projectRoot,
115
115
  timeout: 60000,
116
116
  maxBuffer: 1024 * 1024
117
117
  });
118
- } else if (detectedPlatforms.claude) {
119
- const escaped = fullPrompt.replace(/"/g, '\\"').replace(/\n/g, '\\n');
118
+ } else if (selectedPlatform === 'claude') {
120
119
  result = execSync(`claude -p "${escaped}" --no-input 2>/dev/null`, {
121
120
  encoding: 'utf8',
122
121
  cwd: projectRoot,
123
122
  timeout: 60000,
124
123
  maxBuffer: 1024 * 1024
125
124
  });
125
+ } else {
126
+ throw new Error(`Platform not supported: ${selectedPlatform}`);
126
127
  }
127
128
  } catch (error) {
128
- result = `Désolé, erreur de communication. Réessayez ou tapez "skip".`;
129
+ console.error(chalk.red(`\n❌ Erreur ${selectedPlatform}: ${error.message}`));
130
+ result = `Désolé, erreur de communication avec ${selectedPlatform}. Réessayez ou tapez "skip".`;
129
131
  }
130
132
 
131
133
  // Clean up the response (remove ANSI codes, extra whitespace)
@@ -140,6 +142,7 @@ Continue la conversation pour comprendre le projet et personnaliser les agents.`
140
142
  * @param {Object} options Configuration options
141
143
  * @param {Object} options.interviewAnswers Phase 1 answers
142
144
  * @param {Object} options.detectedPlatforms Detected AI platforms
145
+ * @param {string} options.selectedPlatform Selected AI platform to use
143
146
  * @param {string} options.projectRoot Project root directory
144
147
  * @param {string} options.templateDir Templates directory
145
148
  * @param {string} options.userName User name
@@ -150,6 +153,7 @@ async function launchPhase2Chat(options) {
150
153
  const {
151
154
  interviewAnswers,
152
155
  detectedPlatforms,
156
+ selectedPlatform,
153
157
  projectRoot,
154
158
  templateDir,
155
159
  userName,
@@ -191,9 +195,9 @@ async function launchPhase2Chat(options) {
191
195
  const spinner = ora('Yanstaller réfléchit...').start();
192
196
  let conversationHistory = '';
193
197
 
194
- const initialMessage = `Commence par accueillir l'utilisateur ${context.user_name} avec un résumé de son profil (domaine: ${context.domain}, objectifs: ${context.objectives?.join(', ') || 'non spécifiés'}) et pose ta première question pour personnaliser son installation BYAN.`;
198
+ const initialMessage = `Commence par accueillir l'utilisateur ${context.user_name} avec un résumé de son profil (domaine: ${context.domain}, objectifs: ${context.objectives ? context.objectives.join(', ') : 'non spécifiés'}) et pose ta première question pour personnaliser son installation BYAN.`;
195
199
 
196
- const greeting = await sendChatMessage(initialMessage, systemContext, '', detectedPlatforms, projectRoot);
200
+ const greeting = await sendChatMessage(initialMessage, systemContext, '', selectedPlatform, projectRoot);
197
201
  spinner.stop();
198
202
 
199
203
  console.log(chalk.cyan(' Yanstaller:'));
@@ -265,7 +269,7 @@ IMPORTANT: L'utilisateur veut finaliser. Génère maintenant la configuration JS
265
269
  \`\`\``;
266
270
  }
267
271
 
268
- const response = await sendChatMessage(aiPrompt, systemContext, conversationHistory, detectedPlatforms, projectRoot);
272
+ const response = await sendChatMessage(aiPrompt, systemContext, conversationHistory, selectedPlatform, projectRoot);
269
273
  chatSpinner.stop();
270
274
 
271
275
  console.log('');
@@ -167,8 +167,8 @@ async function launch(options) {
167
167
  const args = platformConfig.args(agent, {
168
168
  prompt,
169
169
  model,
170
- systemPrompt: config?.systemPrompt,
171
- mcpConfig: config?.mcpConfig
170
+ systemPrompt: config ? config.systemPrompt : undefined,
171
+ mcpConfig: config ? config.mcpConfig : undefined
172
172
  });
173
173
 
174
174
  const fullCommand = `${platformConfig.command} ${args.join(' ')}`;
@@ -252,7 +252,7 @@ async function launchWithPrompt(options) {
252
252
  const args = platformConfig.args(agent, {
253
253
  prompt,
254
254
  model,
255
- systemPrompt: config?.systemPrompt
255
+ systemPrompt: config ? config.systemPrompt : undefined
256
256
  });
257
257
 
258
258
  // Add --print flag for Claude to get output
@@ -306,7 +306,7 @@ function handleSinglePlatform(platformId, choices) {
306
306
  */
307
307
  function getSpecialist(platformId) {
308
308
  const info = PLATFORM_INFO[platformId];
309
- return info?.specialist || null;
309
+ return info ? (info.specialist || null) : null;
310
310
  }
311
311
 
312
312
  /**
@@ -317,7 +317,7 @@ function getSpecialist(platformId) {
317
317
  */
318
318
  function hasNativeIntegration(platformId) {
319
319
  const info = PLATFORM_INFO[platformId];
320
- return info?.native || false;
320
+ return info ? (info.native || false) : false;
321
321
  }
322
322
 
323
323
  module.exports = {