create-byan-agent 2.56.0 → 2.58.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 CHANGED
@@ -9,6 +9,86 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [2.58.2] - 2026-07-21
13
+
14
+ ### Fixed — l'assistant web plantait a l'ouverture (Cannot find module 'ws')
15
+ - Symptome : `create-byan-agent` (assistant web par defaut) plantait aussitot
16
+ avec `Error: Cannot find module 'ws'` depuis `install/src/webui/server.js`,
17
+ sur une installation globale `npm i -g`.
18
+ - Cause : `ws` (le serveur WebSocket de l'assistant) etait declare uniquement
19
+ dans `install/package.json` (interne, non publie). `npm` installe les
20
+ dependances du `package.json` RACINE ; `ws` en etait absent, donc introuvable
21
+ une fois le paquet installe.
22
+ - Correctif : `ws` (`^8.20.0`) ajoute aux dependances racine, la ou npm
23
+ l'installe reellement.
24
+ - Filet anti-regression : nouveau test `install/__tests__/shipped-deps.test.js`
25
+ qui scanne le code expedie (`install/bin`, `install/lib`, `install/src`) et
26
+ exige que chaque module externe require() soit declare dans les dependances
27
+ racine (ou soit un module natif Node). La derive "declare dans
28
+ install/package.json mais pas racine" echoue desormais au test.
29
+
30
+ ## [2.58.1] - 2026-07-21
31
+
32
+ ### Fixed — l'install auto en terminal gelait au controle des copies globales de skills
33
+ - Symptome : `create-byan-agent --cli` restait bloque en chargement infini sur
34
+ `[6/8] Controle des copies globales de skills` quand des copies globales
35
+ `~/.claude/skills` divergeaient.
36
+ - Cause : l'etape passait une question interactive (`inquirer`) au moteur, mais
37
+ l'install auto garde un indicateur de progression (`ora`) qui tourne pendant
38
+ chaque etape. La question s'affichait SOUS l'indicateur : invisible, en attente
39
+ d'une saisie que l'utilisateur ne voyait pas -> gel apparent.
40
+ - Correctif : l'install automatique n'ouvre plus de question interactive. Par
41
+ defaut, elle SIGNALE les copies divergentes et affiche la commande de
42
+ synchronisation exacte, sans rien ecrire dans `~/.claude` et sans bloquer
43
+ (ligne rouge conservee : pas d'ecriture silencieuse dans le home). Nouveau
44
+ drapeau `--sync-skills` pour synchroniser sans demander (le drapeau EST le
45
+ consentement explicite), en approbation automatique sans prompt.
46
+ - Nouvelle fonction pure `skillsSyncConsent` dans `install/lib/install-mode.js`,
47
+ testee (`install/__tests__/install-mode.test.js`) ; preuve de non-blocage des
48
+ deux branches (signalement seul / synchro opt-in) sur une maquette de
49
+ divergence.
50
+
51
+ ## [2.58.0] - 2026-07-21
52
+
53
+ ### Added — l'assistant par defaut ouvre l'app Desktop si elle est installee
54
+ - `create-byan-agent` (sans argument) tente d'abord d'ouvrir l'app Desktop BYAN
55
+ dans une fenetre native ; si aucune app n'est detectee, il ouvre le meme
56
+ assistant dans le navigateur. Les deux visages partagent le meme serveur webui
57
+ — seule la fenetre change. Aucun blocage quand l'app n'est pas la.
58
+ - Detection par emplacements d'installation concrets (electron-builder,
59
+ productName BYAN) : `/opt/BYAN/byan`, `/usr/bin/byan`, `/usr/local/bin/byan`
60
+ (Linux) ; `BYAN.app` (macOS, systeme et `~/Applications`) ; `BYAN.exe` sous
61
+ `Programs`/`PROGRAMFILES` (Windows). La variable `BYAN_DESKTOP_BIN` surcharge
62
+ pour une AppImage ou un chemin personnalise. Pas de recherche d'un `byan` nu
63
+ sur le PATH (trop de faux positifs).
64
+ - `create-byan-agent web` force desormais le navigateur (echappatoire explicite,
65
+ ignore l'app Desktop).
66
+ - Nouveau module pur `install/lib/desktop-app.js` (`detectDesktopApp`,
67
+ `candidatePaths`), injectable (platform/env/homedir/existsSync) et teste
68
+ (`install/__tests__/desktop-app.test.js`, 7 cas couvrant Linux/macOS/Windows,
69
+ l'override et le repli).
70
+ - Note : les binaires de l'app Desktop ne sont pas encore distribues ; la
71
+ detection tombe donc sur le navigateur aujourd'hui, par conception. Le vrai
72
+ installateur (distribution des binaires) est un chantier separe a venir.
73
+
74
+ ## [2.57.0] - 2026-07-21
75
+
76
+ ### Changed — l'assistant web devient l'installation par defaut
77
+ - `create-byan-agent` (sans argument) lance desormais l'assistant graphique dans
78
+ le navigateur : il demarre le serveur local (lie a `127.0.0.1`) et ouvre la
79
+ page d'installation. C'est l'inversion demandee — le graphique par defaut, le
80
+ terminal en option.
81
+ - Les deux chemins terminal restent accessibles par drapeau :
82
+ - `--cli` : installation automatique en terminal, zero question (le comportement
83
+ qui etait le defaut en 2.56.0).
84
+ - `--legacy` : interview complet d'origine, question par question.
85
+ - `create-byan-agent web` conserve son role d'alias explicite de l'action par
86
+ defaut ; il accepte `--port` et `--dir`.
87
+ - Nouveau module pur `install/lib/install-mode.js` (`chooseInstallMode`) : la
88
+ decision de routage (web / cli / legacy) est isolee et testee
89
+ (`install/__tests__/install-mode.test.js`, 5 cas). `--legacy` prime sur `--cli`
90
+ si les deux sont passes.
91
+
12
92
  ## [2.56.0] - 2026-07-21
13
93
 
14
94
  ### Changed — installation refondue : un moteur, deux visages
package/README.md CHANGED
@@ -76,7 +76,7 @@ Diversifier les personas elargit la surface de competence collective.
76
76
  Aucune installation préalable n'est nécessaire. Lancez simplement :
77
77
 
78
78
  ```bash
79
- # Crée un nouveau projet BYAN (via npx, sans installation préalable)
79
+ # Assistant d'installation graphique dans le navigateur (par défaut)
80
80
  npx create-byan-agent
81
81
 
82
82
  # Ou installation globale
@@ -84,16 +84,32 @@ npm install -g create-byan-agent
84
84
  create-byan-agent
85
85
  ```
86
86
 
87
- L'installeur (Yanstaller) vous guide interactivement à travers le processus :
88
-
89
- ```
90
- ? Nom du projet : mon-projet
91
- ? Langue de communication : Francais
92
- ? Plateforme cible : Claude Code
93
- ? Activer le fact-check scientifique ? [Y/n]
94
- ? Activer le système ELO de confiance ? [Y/n]
95
- ? Optimiser les coûts LLM automatiquement (~54% d'économies) ? [Y/n]
96
- ```
87
+ Par défaut, `create-byan-agent` ouvre l'assistant graphique. S'il détecte l'app
88
+ Desktop BYAN installée, il l'ouvre dans une fenêtre native ; sinon il démarre un
89
+ petit serveur local (lié à `127.0.0.1`) et ouvre la page d'installation dans le
90
+ navigateur. Dans les deux cas c'est le même assistant : vous y choisissez le nom
91
+ du projet, le répertoire et les options.
92
+
93
+ Modes selon vos besoins :
94
+
95
+ | Commande | Mode |
96
+ |----------|------|
97
+ | `create-byan-agent` | Assistant graphique : app Desktop si installée, sinon navigateur (par défaut) |
98
+ | `create-byan-agent web` | Force l'assistant dans le navigateur (ignore l'app Desktop) |
99
+ | `create-byan-agent --cli` | Installation automatique en terminal, zéro question (Claude+Codex, tous les agents, rtk) |
100
+ | `create-byan-agent --cli --sync-skills` | Idem, en synchronisant sans demander les copies globales `~/.claude/skills` divergentes |
101
+ | `create-byan-agent --legacy` | Interview complet d'origine, question par question en terminal |
102
+
103
+ En mode `--cli`, si des copies globales de skills sous `~/.claude/skills`
104
+ divergent de l'installation, l'assistant le signale et affiche la commande de
105
+ synchronisation — sans bloquer et sans rien écrire dans votre home. Ajoutez
106
+ `--sync-skills` pour qu'il les synchronise directement.
107
+
108
+ Détection de l'app Desktop : emplacements d'installation standards par système
109
+ (`/opt/BYAN/byan` et `/usr/bin/byan` sous Linux, `BYAN.app` sous macOS,
110
+ `BYAN.exe` sous Windows). Pour une AppImage ou un chemin personnalisé, pointez la
111
+ variable `BYAN_DESKTOP_BIN` sur l'exécutable. Tant que l'app Desktop n'est pas
112
+ installée, l'assistant s'ouvre dans le navigateur — aucun blocage.
97
113
 
98
114
  ### Structure du projet après installation
99
115
 
@@ -24,6 +24,7 @@ const { setupCodexAutodelegate, DEVICE_FLOW_INSTRUCTION } = require('../lib/code
24
24
  const { setupMcpExtensions } = require('../lib/mcp-extensions');
25
25
  const { setupStagingConsent } = require('../lib/staging-consent');
26
26
  const { getLatestVersion, compareVersions } = require('../lib/utils/version-compare');
27
+ const { chooseInstallMode, skillsSyncConsent } = require('../lib/install-mode');
27
28
 
28
29
  // Version source-of-truth is the root package.json (the one npm publishes).
29
30
  // install/package.json used to be read here, but it carries an unrelated
@@ -1910,15 +1911,16 @@ async function installAuto(options) {
1910
1911
  const engine = require('../lib/install-engine');
1911
1912
  const projectRoot = path.resolve(options.dir || process.cwd());
1912
1913
 
1913
- console.log(chalk.cyan.bold(`\n BYAN ${BYAN_VERSION} — installation automatique`));
1914
+ console.log(chalk.cyan.bold(`\n BYAN ${BYAN_VERSION} — installation automatique (terminal)`));
1914
1915
  console.log(chalk.gray(` Projet : ${options.name || path.basename(projectRoot)} | Repertoire : ${projectRoot}`));
1915
- console.log(chalk.gray(' (interview complete : --legacy ; assistant web : create-byan-agent web)\n'));
1916
+ console.log(chalk.gray(' (assistant web par defaut : create-byan-agent ; interview complet : --legacy)\n'));
1916
1917
 
1917
1918
  let spinner = null;
1918
1919
  const isTTY = Boolean(process.stdout.isTTY);
1919
- const ask = isTTY
1920
- ? async (message) => (await inquirer.prompt([{ type: 'confirm', name: 'ok', message, default: true }])).ok
1921
- : null;
1920
+ // The automatic install never opens an interactive prompt: a question drawn
1921
+ // under the live progress spinner froze the terminal at the skills-sync step.
1922
+ // Default is notice-only ; --sync-skills opts in to an unattended sync.
1923
+ const ask = skillsSyncConsent(options);
1922
1924
 
1923
1925
  try {
1924
1926
  const result = await engine.runInstall({
@@ -1960,18 +1962,72 @@ async function installAuto(options) {
1960
1962
  }
1961
1963
  }
1962
1964
 
1965
+ // Default path since 2.58.0: prefer the native Desktop app when it is installed
1966
+ // (option A), otherwise fall back to the browser wizard. Both wrap the SAME
1967
+ // webui server — the only difference is the window (native shell vs browser
1968
+ // tab). When no Desktop app is found, print a one-line discovery tip and open
1969
+ // the browser without blocking. The `web` subcommand skips this and forces the
1970
+ // browser (explicit escape hatch).
1971
+ function launchDesktopOrWeb(options = {}) {
1972
+ const { detectDesktopApp } = require('../lib/desktop-app');
1973
+ const desktop = detectDesktopApp();
1974
+
1975
+ if (desktop.found) {
1976
+ console.log(chalk.cyan.bold(`\n BYAN ${BYAN_VERSION} — ouverture de l app Desktop\n`));
1977
+ console.log(chalk.gray(` ${desktop.bin}`));
1978
+ try {
1979
+ const { spawn } = require('child_process');
1980
+ const child = spawn(desktop.bin, [], { detached: true, stdio: 'ignore' });
1981
+ child.unref();
1982
+ return;
1983
+ } catch (error) {
1984
+ console.log(chalk.yellow(` Echec du lancement de l app Desktop (${error.message}) — repli navigateur.`));
1985
+ // fall through to the browser wizard
1986
+ }
1987
+ } else {
1988
+ console.log(chalk.gray('\n Astuce : l app Desktop BYAN offre une vraie fenetre native. Une fois installee,'));
1989
+ console.log(chalk.gray(' cette commande l ouvrira automatiquement. Pour l instant, j ouvre le navigateur.'));
1990
+ }
1991
+
1992
+ launchWeb(options);
1993
+ }
1994
+
1995
+ // The browser wizard. Starts the local HTTP + WebSocket server (bound to
1996
+ // loopback) and opens the browser — the server owns the browser launch. Used
1997
+ // as the fallback of launchDesktopOrWeb and as the explicit `web` subcommand.
1998
+ function launchWeb(options = {}) {
1999
+ const ByanWebUI = require('../src/webui/server');
2000
+ const port = parseInt(options.port, 10) || 3000;
2001
+ const projectRoot = path.resolve(options.dir || process.cwd());
2002
+
2003
+ console.log(chalk.cyan.bold(`\n BYAN ${BYAN_VERSION} — assistant d installation (navigateur)\n`));
2004
+ const server = new ByanWebUI({ port, projectRoot });
2005
+ server.start();
2006
+ console.log(chalk.green(` Interface ouverte sur http://localhost:${port}`));
2007
+ console.log(chalk.gray(` Repertoire projet : ${projectRoot}`));
2008
+ console.log(chalk.gray(' Installation en terminal : create-byan-agent --cli | Ctrl+C pour arreter\n'));
2009
+ }
2010
+
1963
2011
  // CLI Program
1964
2012
  program
1965
2013
  .name('create-byan-agent')
1966
- .description('Install BYAN v2.2.0 - Builder of YAN with Model Selector and multi-platform support')
2014
+ .description('Install BYAN - Builder of YAN. Default: graphical web wizard. --cli for the terminal install.')
1967
2015
  .version(BYAN_VERSION)
1968
2016
  .option('--skip-version-check', 'Bypass the npm freshness guard (not recommended)')
2017
+ .option('--cli', 'Installation automatique en terminal (au lieu de l assistant web par defaut)')
2018
+ .option('-p, --port <port>', 'Port de l assistant web (defaut : 3000)', '3000')
1969
2019
  .option('--name <name>', 'Nom du projet (defaut : nom du dossier)')
1970
2020
  .option('--dir <dir>', 'Repertoire d installation (defaut : dossier courant)')
1971
- .option('--no-launch', 'Ne pas lancer Claude Code en fin d installation')
1972
- .option('--no-rtk', 'Ne pas installer rtk automatiquement')
2021
+ .option('--no-launch', 'Ne pas lancer Claude Code en fin d installation (mode --cli)')
2022
+ .option('--no-rtk', 'Ne pas installer rtk automatiquement (mode --cli)')
2023
+ .option('--sync-skills', 'Mode --cli : synchroniser sans demander les copies globales ~/.claude/skills divergentes')
1973
2024
  .option('--legacy', 'Interview complete d origine (l ancien parcours a questions)')
1974
- .action(async (options) => (options.legacy ? install(options) : installAuto(options)));
2025
+ .action(async (options) => {
2026
+ const mode = chooseInstallMode(options);
2027
+ if (mode === 'legacy') return install(options);
2028
+ if (mode === 'cli') return installAuto(options);
2029
+ return launchDesktopOrWeb(options);
2030
+ });
1975
2031
 
1976
2032
  // Update Command (Yanstaller v3)
1977
2033
  program
@@ -2148,20 +2204,13 @@ program
2148
2204
  }
2149
2205
  });
2150
2206
 
2207
+ // Explicit alias for the default action — same graphical wizard, kept for
2208
+ // discoverability and backward compatibility with `create-byan-agent web`.
2151
2209
  program
2152
2210
  .command('web')
2153
- .description('Launch BYAN WebUI installer in the browser')
2211
+ .description('Launch BYAN WebUI installer in the browser (same as the default action)')
2154
2212
  .option('-p, --port <port>', 'Port number', '3000')
2155
- .action(async (options) => {
2156
- const ByanWebUI = require('../src/webui/server');
2157
- const port = parseInt(options.port, 10);
2158
- const projectRoot = process.cwd();
2159
-
2160
- console.log(chalk.cyan.bold('\n BYAN WebUI\n'));
2161
- const server = new ByanWebUI({ port, projectRoot });
2162
- server.start();
2163
- console.log(chalk.green(` Server running at http://localhost:${port}`));
2164
- console.log(chalk.gray(' Press Ctrl+C to stop\n'));
2165
- });
2213
+ .option('--dir <dir>', 'Repertoire d installation (defaut : dossier courant)')
2214
+ .action(async (options) => launchWeb(options));
2166
2215
 
2167
2216
  program.parse(process.argv);
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ const path = require('path');
4
+
5
+ // Detection of an installed BYAN Desktop app (Electron, packaged by
6
+ // electron-builder). productName is "BYAN", appId fr.acadenice.byan. We match
7
+ // CONCRETE executables at the install locations electron-builder produces per
8
+ // OS — NOT a bare `byan` on PATH, which would false-positive on any unrelated
9
+ // binary of that name. The AppImage build has no fixed install path, so it is
10
+ // covered by the BYAN_DESKTOP_BIN override (the user points at their AppImage).
11
+ //
12
+ // Pure and injectable: platform / env / homedir / existsSync are all overridable
13
+ // so the detection is unit-testable without touching the real filesystem.
14
+
15
+ function candidatePaths(platform, env, homedir) {
16
+ const out = [];
17
+
18
+ // Build the TARGET platform's paths, not the host's — so detection is correct
19
+ // and unit-testable regardless of the OS the check runs on.
20
+ const p = platform === 'win32' ? path.win32 : path.posix;
21
+
22
+ // Explicit override always wins (AppImage users, custom install prefixes).
23
+ if (env.BYAN_DESKTOP_BIN) out.push(env.BYAN_DESKTOP_BIN);
24
+
25
+ if (platform === 'darwin') {
26
+ out.push('/Applications/BYAN.app/Contents/MacOS/BYAN');
27
+ out.push(p.join(homedir, 'Applications', 'BYAN.app', 'Contents', 'MacOS', 'BYAN'));
28
+ } else if (platform === 'win32') {
29
+ if (env.LOCALAPPDATA) out.push(p.join(env.LOCALAPPDATA, 'Programs', 'BYAN', 'BYAN.exe'));
30
+ if (env.PROGRAMFILES) out.push(p.join(env.PROGRAMFILES, 'BYAN', 'BYAN.exe'));
31
+ } else {
32
+ // Linux deb/rpm: electron-builder installs to /opt/<productName> and drops
33
+ // a symlink /usr/bin/<executableName> (productName lowercased -> byan).
34
+ out.push('/opt/BYAN/byan');
35
+ out.push('/usr/bin/byan');
36
+ out.push('/usr/local/bin/byan');
37
+ }
38
+
39
+ return out;
40
+ }
41
+
42
+ function detectDesktopApp(opts = {}) {
43
+ const platform = opts.platform || process.platform;
44
+ const env = opts.env || process.env;
45
+ const homedir = opts.homedir || require('os').homedir();
46
+ const existsSync = opts.existsSync || require('fs').existsSync;
47
+
48
+ for (const candidate of candidatePaths(platform, env, homedir)) {
49
+ if (candidate && existsSync(candidate)) {
50
+ const source = env.BYAN_DESKTOP_BIN === candidate ? 'env' : 'path';
51
+ return { found: true, bin: candidate, source };
52
+ }
53
+ }
54
+
55
+ return { found: false, bin: null, source: null };
56
+ }
57
+
58
+ module.exports = { detectDesktopApp, candidatePaths };
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ // Since 2.57.0 the default install experience is the graphical web wizard
4
+ // (create-byan-agent, which starts the local server and opens the browser).
5
+ // Two terminal escape hatches stay reachable by flag:
6
+ // --cli -> the zero-question automatic terminal install (installAuto)
7
+ // --legacy -> the original question-by-question interview (install)
8
+ // --legacy wins over --cli when both are passed: it is the more explicit,
9
+ // older path, so an operator who typed it means it.
10
+ function chooseInstallMode(options = {}) {
11
+ if (options && options.legacy) return 'legacy';
12
+ if (options && options.cli) return 'cli';
13
+ return 'web';
14
+ }
15
+
16
+ // Global-skills consent for the AUTOMATIC terminal install (installAuto).
17
+ //
18
+ // Field bug (2026-07-21): the auto install froze at "[6/8] Controle des copies
19
+ // globales de skills". Root cause — the engine's skills-sync step was handed an
20
+ // inquirer prompt as its `ask`, but installAuto keeps an ora progress spinner
21
+ // spinning during every step. The prompt was drawn UNDER the live spinner:
22
+ // invisible, waiting on input the user could not see -> apparent infinite load.
23
+ //
24
+ // The fix is a rule, not spinner choreography: the automatic install NEVER opens
25
+ // an interactive prompt. Two non-interactive behaviours only:
26
+ // - default -> null : the engine notices the divergence and prints the
27
+ // exact sync command, writes nothing in ~/.claude, does
28
+ // not block (keeps the "no silent home write" red line).
29
+ // - --sync-skills -> an unattended auto-approve (resolves true, no inquirer):
30
+ // the flag itself is the explicit consent, so the engine
31
+ // syncs the stale global copies without a prompt.
32
+ function skillsSyncConsent(options = {}) {
33
+ if (options && options.syncSkills) return async () => true;
34
+ return null;
35
+ }
36
+
37
+ module.exports = { chooseInstallMode, skillsSyncConsent };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-byan-agent",
3
- "version": "2.56.0",
3
+ "version": "2.58.2",
4
4
  "description": "BYAN v2.8 - Intelligent AI agent creator with ELO trust system + scientific fact-check + Hermes universal dispatcher + native Claude Code integration (hooks, skills, MCP server). Multi-platform (Claude Code, Codex). Merise Agile + TDD + 71 Mantras. ~54% LLM cost savings.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -87,7 +87,8 @@
87
87
  "js-yaml": "^4.1.0",
88
88
  "ora": "^5.4.1",
89
89
  "uuid": "^13.0.0",
90
- "winston": "^3.19.0"
90
+ "winston": "^3.19.0",
91
+ "ws": "^8.20.0"
91
92
  },
92
93
  "bundleDependencies": [
93
94
  "byan-platform-config"