create-byan-agent 2.4.0 → 2.4.2
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.
- package/CHANGELOG.md +27 -0
- package/install/bin/create-byan-agent-v2.js +92 -42
- package/install/lib/phase2-chat.js +23 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [2.4.2] - 2026-02-11
|
|
11
|
+
|
|
12
|
+
### 🐛 Fixed - Claude Phase 2 System Prompt Separation
|
|
13
|
+
|
|
14
|
+
**Problem:** On Windows 11, Claude Code Phase 2 chat responded with generic "How can I help you today?" instead of acting as Yanstaller persona.
|
|
15
|
+
|
|
16
|
+
**Root Cause:** `claude -p "entire_blob"` treats the argument as a user query, not system instructions. The entire system context (Hermes docs, agent catalog, conversation history, instructions) was passed as `-p` argument. Claude ignored it and responded with its default greeting.
|
|
17
|
+
|
|
18
|
+
**Fix:** Split system prompt from user message using proper Claude Code CLI flags:
|
|
19
|
+
- System context → `--append-system-prompt-file` (temp file, auto-cleaned)
|
|
20
|
+
- User message → `-p` (just the actual user query)
|
|
21
|
+
|
|
22
|
+
```javascript
|
|
23
|
+
// Before (broken): everything as -p argument
|
|
24
|
+
runCliCommand('claude', ['-p', fullPrompt], projectRoot);
|
|
25
|
+
|
|
26
|
+
// After (fixed): proper separation
|
|
27
|
+
runCliCommand('claude', [
|
|
28
|
+
'-p', message, // user query only
|
|
29
|
+
'--append-system-prompt-file', tmpFile // system context in file
|
|
30
|
+
], projectRoot);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Impact:** Claude Code Phase 2 now correctly receives Yanstaller persona, Hermes knowledge, and conversation history as system instructions while treating user input as the actual query.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
10
37
|
## [2.4.0] - 2026-02-11
|
|
11
38
|
|
|
12
39
|
### ✨ Added - Claude Code Native Agent Integration
|
|
@@ -498,7 +498,7 @@ async function install() {
|
|
|
498
498
|
'-s'
|
|
499
499
|
], spawnOpts);
|
|
500
500
|
} else if (detectedPlatforms.codex) {
|
|
501
|
-
res = spawnSync('codex', ['exec'],
|
|
501
|
+
res = spawnSync('codex', ['exec', promptContent], spawnOpts);
|
|
502
502
|
} else if (detectedPlatforms.claude) {
|
|
503
503
|
res = spawnSync('claude', ['-p', promptContent], spawnOpts);
|
|
504
504
|
}
|
|
@@ -684,52 +684,102 @@ async function install() {
|
|
|
684
684
|
}
|
|
685
685
|
}
|
|
686
686
|
|
|
687
|
-
//
|
|
687
|
+
// Verify authentication for selected platform
|
|
688
688
|
if (selectedPlatform && installMode === 'custom') {
|
|
689
689
|
console.log('');
|
|
690
690
|
console.log(chalk.gray('🔐 Vérification de l\'authentification...'));
|
|
691
691
|
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
692
|
+
let isAuthenticated = false;
|
|
693
|
+
|
|
694
|
+
while (!isAuthenticated) {
|
|
695
|
+
try {
|
|
696
|
+
let authCheckCmd, authCheckArgs, loginInstructions;
|
|
697
|
+
const isWindows = process.platform === 'win32';
|
|
698
|
+
const spawnOpts = { encoding: 'utf8', timeout: 15000, stdio: 'pipe' };
|
|
699
|
+
if (isWindows) spawnOpts.shell = true;
|
|
700
|
+
|
|
701
|
+
if (selectedPlatform === 'copilot') {
|
|
702
|
+
// gh auth status returns non-zero if not logged in
|
|
703
|
+
authCheckCmd = 'gh';
|
|
704
|
+
authCheckArgs = ['auth', 'status'];
|
|
705
|
+
loginInstructions = [
|
|
706
|
+
`${chalk.cyan('gh auth login')}`
|
|
707
|
+
];
|
|
708
|
+
} else if (selectedPlatform === 'codex') {
|
|
709
|
+
// codex --version as basic check (no auth status command available)
|
|
710
|
+
authCheckCmd = 'codex';
|
|
711
|
+
authCheckArgs = ['--version'];
|
|
712
|
+
loginInstructions = [
|
|
713
|
+
`${chalk.cyan('codex login')}`
|
|
714
|
+
];
|
|
715
|
+
} else if (selectedPlatform === 'claude') {
|
|
716
|
+
// claude --version checks install; auth errors surface during -p calls
|
|
717
|
+
// Use 'claude -p "test" --max-turns 1' for real auth check
|
|
718
|
+
authCheckCmd = 'claude';
|
|
719
|
+
authCheckArgs = ['-p', 'reply OK', '--max-turns', '1'];
|
|
720
|
+
loginInstructions = [
|
|
721
|
+
`${chalk.cyan('claude login')}`,
|
|
722
|
+
`${chalk.gray('ou:')} ${chalk.cyan('export ANTHROPIC_API_KEY=sk-ant-...')}`,
|
|
723
|
+
`${chalk.gray('ou dans Claude Code:')} ${chalk.cyan('/login')}`
|
|
724
|
+
];
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
const res = spawnSync(authCheckCmd, authCheckArgs, spawnOpts);
|
|
728
|
+
|
|
729
|
+
if (res.error) throw res.error;
|
|
730
|
+
if (res.status !== 0) {
|
|
731
|
+
const stderr = (res.stderr || '').toString().trim();
|
|
732
|
+
throw new Error(stderr || `${selectedPlatform} returned exit code ${res.status}`);
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
isAuthenticated = true;
|
|
736
|
+
console.log(chalk.green(`✓ ${selectedPlatform} authentifié et disponible`));
|
|
737
|
+
|
|
738
|
+
} catch (error) {
|
|
739
|
+
console.log('');
|
|
740
|
+
console.log(chalk.yellow(`⚠️ ${selectedPlatform} n'est pas authentifié ou non disponible`));
|
|
741
|
+
console.log(chalk.gray(` Erreur: ${(error.message || '').substring(0, 120)}`));
|
|
742
|
+
console.log('');
|
|
743
|
+
console.log(chalk.bold(' Pour vous connecter:'));
|
|
744
|
+
|
|
745
|
+
let loginInstructions;
|
|
746
|
+
if (selectedPlatform === 'copilot') {
|
|
747
|
+
loginInstructions = [`${chalk.cyan('gh auth login')}`];
|
|
748
|
+
} else if (selectedPlatform === 'codex') {
|
|
749
|
+
loginInstructions = [`${chalk.cyan('codex login')}`];
|
|
750
|
+
} else if (selectedPlatform === 'claude') {
|
|
751
|
+
loginInstructions = [
|
|
752
|
+
`${chalk.cyan('claude login')}`,
|
|
753
|
+
`${chalk.gray('ou:')} ${chalk.cyan('export ANTHROPIC_API_KEY=sk-ant-...')}`,
|
|
754
|
+
`${chalk.gray('ou dans Claude Code:')} ${chalk.cyan('/login')}`
|
|
755
|
+
];
|
|
756
|
+
}
|
|
757
|
+
loginInstructions.forEach((inst, i) => console.log(` ${i + 1}. ${inst}`));
|
|
758
|
+
console.log('');
|
|
759
|
+
|
|
760
|
+
const { authAction } = await inquirer.prompt([{
|
|
761
|
+
type: 'list',
|
|
762
|
+
name: 'authAction',
|
|
763
|
+
message: 'Que souhaitez-vous faire?',
|
|
764
|
+
choices: [
|
|
765
|
+
{ name: '🔄 Réessayer (après connexion dans un autre terminal)', value: 'retry' },
|
|
766
|
+
{ name: '⚡ Continuer en mode AUTO (sans conversation IA)', value: 'auto' },
|
|
767
|
+
{ name: '❌ Annuler l\'installation', value: 'cancel' }
|
|
768
|
+
]
|
|
769
|
+
}]);
|
|
770
|
+
|
|
771
|
+
if (authAction === 'retry') {
|
|
772
|
+
console.log(chalk.gray('\n🔐 Nouvelle vérification...'));
|
|
773
|
+
continue;
|
|
774
|
+
} else if (authAction === 'auto') {
|
|
775
|
+
installMode = 'auto';
|
|
776
|
+
selectedPlatform = null;
|
|
777
|
+
isAuthenticated = true; // exit loop
|
|
778
|
+
} else {
|
|
779
|
+
console.log(chalk.red('Installation annulée. Connectez-vous d\'abord à votre plateforme IA.'));
|
|
780
|
+
process.exit(1);
|
|
781
|
+
}
|
|
729
782
|
}
|
|
730
|
-
|
|
731
|
-
installMode = 'auto';
|
|
732
|
-
selectedPlatform = null;
|
|
733
783
|
}
|
|
734
784
|
}
|
|
735
785
|
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
const { spawnSync } = require('child_process');
|
|
9
9
|
const path = require('path');
|
|
10
|
+
const os = require('os');
|
|
10
11
|
const fs = require('fs-extra');
|
|
11
12
|
const inquirer = require('inquirer');
|
|
12
13
|
const chalk = require('chalk');
|
|
@@ -32,6 +33,13 @@ function runCliCommand(cmd, args, cwd, stdinInput) {
|
|
|
32
33
|
|
|
33
34
|
const res = spawnSync(cmd, args, opts);
|
|
34
35
|
if (res.error) throw res.error;
|
|
36
|
+
|
|
37
|
+
// Check for non-zero exit code with stderr
|
|
38
|
+
if (res.status !== 0 && res.stderr) {
|
|
39
|
+
const stderr = res.stderr.toString().trim();
|
|
40
|
+
if (stderr) throw new Error(stderr);
|
|
41
|
+
}
|
|
42
|
+
|
|
35
43
|
return (res.stdout || '').toString();
|
|
36
44
|
}
|
|
37
45
|
|
|
@@ -185,9 +193,22 @@ Continue la conversation pour comprendre le projet et personnaliser les agents.`
|
|
|
185
193
|
if (selectedPlatform === 'copilot') {
|
|
186
194
|
result = runCliCommand('copilot', ['-p', fullPrompt, '-s'], projectRoot);
|
|
187
195
|
} else if (selectedPlatform === 'codex') {
|
|
188
|
-
|
|
196
|
+
// Codex takes prompt as argument to exec command
|
|
197
|
+
result = runCliCommand('codex', ['exec', fullPrompt], projectRoot);
|
|
189
198
|
} else if (selectedPlatform === 'claude') {
|
|
190
|
-
|
|
199
|
+
// Claude: separate system prompt from user query
|
|
200
|
+
// -p treats arg as user query; system context goes via --append-system-prompt-file
|
|
201
|
+
const claudeSystemCtx = `${systemContext}\n\n## Historique de conversation:\n${conversationHistory}\n\n## Instructions:\nRéponds de manière concise et naturelle. Si l'utilisateur dit "finaliser", génère le JSON de configuration.\nContinue la conversation pour comprendre le projet et personnaliser les agents.`;
|
|
202
|
+
const tmpFile = path.join(os.tmpdir(), `byan-claude-ctx-${Date.now()}.txt`);
|
|
203
|
+
fs.writeFileSync(tmpFile, claudeSystemCtx, 'utf8');
|
|
204
|
+
try {
|
|
205
|
+
result = runCliCommand('claude', [
|
|
206
|
+
'-p', message,
|
|
207
|
+
'--append-system-prompt-file', tmpFile
|
|
208
|
+
], projectRoot);
|
|
209
|
+
} finally {
|
|
210
|
+
try { fs.unlinkSync(tmpFile); } catch(e) {}
|
|
211
|
+
}
|
|
191
212
|
} else {
|
|
192
213
|
throw new Error(`Platform not supported: ${selectedPlatform}`);
|
|
193
214
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-byan-agent",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.2",
|
|
4
4
|
"description": "BYAN v2.3.2 - Intelligent AI agent ecosystem with Hermes universal dispatcher + Multi-platform support (Copilot CLI, Claude, Codex) + Automatic LLM cost optimization (87.5% savings) + Node 12+ compatible",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|