fleetbo-cockpit-cli 1.0.103 → 1.0.105

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.
Files changed (2) hide show
  1. package/cli.js +52 -25
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -5,41 +5,67 @@
5
5
  process.stdout.write("\x1b[1A\x1b[2K".repeat(4));
6
6
  console.clear();
7
7
 
8
- const { spawn, execSync } = require('child_process');
9
- const fs = require('fs');
10
- const path = require('path');
11
- const axios = require('axios');
12
- const dotenv = require('dotenv');
13
- const os = require('os');
14
- const archiver = require('archiver');
15
- const readline = require('readline');
16
-
17
8
  // ============================================
18
- // OS SPINNER (Terminal Animation Engine)
9
+ // 1. MOTEUR D'ANIMATION PRÉ-BOOT (Zéro dépendance)
19
10
  // ============================================
20
11
  class FleetboSpinner {
21
12
  constructor() {
22
13
  this.frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
23
14
  this.idx = 0;
24
15
  this.timer = null;
16
+ this.currentMessage = ""; // Garde le texte en mémoire
25
17
  }
26
18
  start(message) {
27
- if (this.timer) return;
28
- process.stdout.write('\x1b[?25l'); // Cache le curseur natif
19
+ this.currentMessage = message; // Met à jour le texte
20
+
21
+ if (this.timer) {
22
+ // Si déjà lancé, on affiche tout de suite le nouveau texte
23
+ process.stdout.write(`\r\x1b[2K \x1b[32m${this.frames[this.idx]}\x1b[0m ${this.currentMessage}`);
24
+ return;
25
+ }
26
+
27
+ process.stdout.write('\x1b[?25l'); // 🔴 CACHE LE CURSEUR XTERM INSTANTANÉMENT
28
+
29
+ // ⚡ DESSIN SYNCHRONE IMMÉDIAT (Avant que Node ne freeze pour charger axios)
30
+ process.stdout.write(`\r\x1b[2K \x1b[32m${this.frames[this.idx]}\x1b[0m ${this.currentMessage}`);
31
+ this.idx = (this.idx + 1) % this.frames.length;
32
+
29
33
  this.timer = setInterval(() => {
30
- // \r revient au début, \x1b[2K efface la ligne
31
- process.stdout.write(`\r\x1b[2K \x1b[36m${this.frames[this.idx]}\x1b[0m \x1b[90m${message}\x1b[0m`);
34
+ process.stdout.write(`\r\x1b[2K \x1b[32m${this.frames[this.idx]}\x1b[0m ${this.currentMessage}`);
32
35
  this.idx = (this.idx + 1) % this.frames.length;
33
36
  }, 80);
34
37
  }
35
38
  stop() {
36
- if (this.timer) clearInterval(this.timer);
37
- this.timer = null;
38
- process.stdout.write('\x1b[?25h\r\x1b[2K'); // Réaffiche le curseur et nettoie la ligne
39
+ if (this.timer) {
40
+ clearInterval(this.timer);
41
+ this.timer = null;
42
+ }
43
+ process.stdout.write('\x1b[?25h\r\x1b[2K'); // Réaffiche le curseur
39
44
  }
40
45
  }
41
46
  const osSpinner = new FleetboSpinner();
42
47
 
48
+ // ============================================
49
+ // 2. INTERCEPTION PRÉ-BOOT (Masque le délai de chargement)
50
+ // ============================================
51
+ const args = process.argv.slice(2);
52
+ const command = args[0];
53
+
54
+ if (command === 'alex' || !command) {
55
+ // Se lance avant même que Node n'ait chargé le reste du fichier !
56
+ osSpinner.start("\x1b[32m⚡ Booting Fleetbo Engine...\x1b[0m");
57
+ }
58
+
59
+ const { spawn, execSync } = require('child_process');
60
+ const fs = require('fs');
61
+ const path = require('path');
62
+ const axios = require('axios');
63
+ const dotenv = require('dotenv');
64
+ const os = require('os');
65
+ const archiver = require('archiver');
66
+ const readline = require('readline');
67
+
68
+
43
69
  // ============================================
44
70
  // FLEETBO CLI - Centralized Package
45
71
  // ============================================
@@ -53,8 +79,6 @@ const CACHE_URL = "https://getmodulecache-jqycakhlxa-uc.a.run.app";
53
79
  const PORT = 3000;
54
80
 
55
81
  let uplinkProcess = null;
56
- const args = process.argv.slice(2);
57
- const command = args[0];
58
82
 
59
83
  // ============================================
60
84
  // CONFIGURATION (.env du projet dev)
@@ -299,7 +323,7 @@ if (command === 'alex') {
299
323
  return;
300
324
  }
301
325
 
302
- osSpinner.start("\x1b[33m🧠 Alex is processing your request...\x1b[0m");
326
+ osSpinner.start("\x1b[32m🧠 Alex is processing your request...\x1b[0m");
303
327
 
304
328
  try {
305
329
  // --- MEMORY SYSTEM (SMART CACHE SCANNER V3 - SOUVERAINETÉ DU MÉTAL) ---
@@ -382,7 +406,7 @@ if (command === 'alex') {
382
406
  const promptWithTime = prompt + `\n\n[SYSTEM INFO: The exact current timestamp is ${exactTime}. Use it STRICTLY for your signature '// ⚡ Forged by Alex on...' at the bottom of your files.]`;
383
407
 
384
408
  // On met à jour le texte du spinner existant
385
- osSpinner.start("Neural Link active. Alex is forging...");
409
+ osSpinner.start("\x1b[32m Alex is forging...\x1b[0m");
386
410
 
387
411
  const result = await axios.post(ALEX_ENGINE_URL, { prompt: promptWithTime, projectType: 'android' }, {
388
412
  headers: { 'x-project-id': projectId }
@@ -536,9 +560,9 @@ if (command === 'alex') {
536
560
  console.log(`\n\x1b[31m⚠️ Error: Alex replied, but source code could not be extracted. Try the command again.\x1b[0m\n`);
537
561
  }
538
562
  } catch (error) {
539
- // 🛑 SÉCURITÉ : Arrête le spinner s'il y a un crash
540
- if (spinnerTimer) clearInterval(spinnerTimer);
541
-
563
+ // 🛑 SÉCURITÉ : Arrête le moteur global s'il y a un crash
564
+ osSpinner.stop();
565
+
542
566
  process.stdout.write('\r' + ' '.repeat(50) + '\r');
543
567
  console.error('\n\x1b[31m Alex Error:\x1b[0m ' + (error.response?.data?.message || error.message));
544
568
  }
@@ -554,7 +578,7 @@ if (command === 'alex') {
554
578
  // ============================================================
555
579
 
556
580
  const startAlexSession = async () => {
557
- process.stdout.write('\x1b[33m🛡️ Alex is checking runtime state...\x1b[0m\r');
581
+ osSpinner.start("\x1b[32m🛡️ Alex is checking runtime state...\x1b[0m");
558
582
  let attempts = 0;
559
583
  const maxAttempts = 5;
560
584
  let isReady = false;
@@ -584,6 +608,9 @@ if (command === 'alex') {
584
608
  await new Promise(r => setTimeout(r, 2000));
585
609
  }
586
610
  }
611
+
612
+ // 🛑 ON ARRÊTE L'ANIMATION DE DÉMARRAGE ICI
613
+ osSpinner.stop();
587
614
 
588
615
  if (!isReady) {
589
616
  console.error('\n\x1b[31m⚠️ ENGINE OFFLINE:\x1b[0m Start Fleetbo runtime first: "npm run fleetbo" ');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbo-cockpit-cli",
3
- "version": "1.0.103",
3
+ "version": "1.0.105",
4
4
  "description": "Fleetbo CLI - Build native mobile apps with React",
5
5
  "author": "Fleetbo",
6
6
  "license": "MIT",