fleetbo-cockpit-cli 1.0.106 → 1.0.107
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/cli.js +7 -67
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -5,56 +5,6 @@
|
|
|
5
5
|
process.stdout.write("\x1b[1A\x1b[2K".repeat(4));
|
|
6
6
|
console.clear();
|
|
7
7
|
|
|
8
|
-
// ============================================
|
|
9
|
-
// 1. MOTEUR D'ANIMATION PRÉ-BOOT (Blindé)
|
|
10
|
-
// ============================================
|
|
11
|
-
class FleetboSpinner {
|
|
12
|
-
constructor() {
|
|
13
|
-
this.frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
14
|
-
this.idx = 0;
|
|
15
|
-
this.timer = null;
|
|
16
|
-
this.currentMessage = "";
|
|
17
|
-
}
|
|
18
|
-
start(message) {
|
|
19
|
-
this.currentMessage = message;
|
|
20
|
-
|
|
21
|
-
if (this.timer) {
|
|
22
|
-
process.stdout.write(`\r\x1b[2K \x1b[32m${this.frames[this.idx]}\x1b[0m ${this.currentMessage}`);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
process.stdout.write('\x1b[?25l');
|
|
27
|
-
|
|
28
|
-
process.stdout.write(`\r\x1b[2K \x1b[32m${this.frames[this.idx]}\x1b[0m ${this.currentMessage}`);
|
|
29
|
-
this.idx = (this.idx + 1) % this.frames.length;
|
|
30
|
-
|
|
31
|
-
this.timer = setInterval(() => {
|
|
32
|
-
process.stdout.write(`\r\x1b[2K \x1b[32m${this.frames[this.idx]}\x1b[0m ${this.currentMessage}`);
|
|
33
|
-
this.idx = (this.idx + 1) % this.frames.length;
|
|
34
|
-
}, 80);
|
|
35
|
-
}
|
|
36
|
-
stop() {
|
|
37
|
-
if (this.timer) {
|
|
38
|
-
clearInterval(this.timer);
|
|
39
|
-
this.timer = null;
|
|
40
|
-
}
|
|
41
|
-
// 🛡️ HARD-CLEAR : On écrase physiquement avec des espaces pour éviter le Ghosting
|
|
42
|
-
process.stdout.write('\r' + ' '.repeat(60) + '\r\x1b[?25h');
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
const osSpinner = new FleetboSpinner();
|
|
46
|
-
|
|
47
|
-
// ============================================
|
|
48
|
-
// 2. INTERCEPTION PRÉ-BOOT (Masque le délai de chargement)
|
|
49
|
-
// ============================================
|
|
50
|
-
const args = process.argv.slice(2);
|
|
51
|
-
const command = args[0];
|
|
52
|
-
|
|
53
|
-
if (command === 'alex' || !command) {
|
|
54
|
-
// Se lance avant même que Node n'ait chargé le reste du fichier !
|
|
55
|
-
osSpinner.start("\x1b[32m⚡ Booting Fleetbo Engine...\x1b[0m");
|
|
56
|
-
}
|
|
57
|
-
|
|
58
8
|
const { spawn, execSync } = require('child_process');
|
|
59
9
|
const fs = require('fs');
|
|
60
10
|
const path = require('path');
|
|
@@ -64,7 +14,6 @@ const os = require('os');
|
|
|
64
14
|
const archiver = require('archiver');
|
|
65
15
|
const readline = require('readline');
|
|
66
16
|
|
|
67
|
-
|
|
68
17
|
// ============================================
|
|
69
18
|
// FLEETBO CLI - Centralized Package
|
|
70
19
|
// ============================================
|
|
@@ -78,6 +27,8 @@ const CACHE_URL = "https://getmodulecache-jqycakhlxa-uc.a.run.app";
|
|
|
78
27
|
const PORT = 3000;
|
|
79
28
|
|
|
80
29
|
let uplinkProcess = null;
|
|
30
|
+
const args = process.argv.slice(2);
|
|
31
|
+
const command = args[0];
|
|
81
32
|
|
|
82
33
|
// ============================================
|
|
83
34
|
// CONFIGURATION (.env du projet dev)
|
|
@@ -322,7 +273,7 @@ if (command === 'alex') {
|
|
|
322
273
|
return;
|
|
323
274
|
}
|
|
324
275
|
|
|
325
|
-
|
|
276
|
+
console.log('\x1b[33m🧠 Alex is thinking...\x1b[0m');
|
|
326
277
|
|
|
327
278
|
try {
|
|
328
279
|
// --- MEMORY SYSTEM (SMART CACHE SCANNER V3 - SOUVERAINETÉ DU MÉTAL) ---
|
|
@@ -404,16 +355,10 @@ if (command === 'alex') {
|
|
|
404
355
|
|
|
405
356
|
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.]`;
|
|
406
357
|
|
|
407
|
-
// On met à jour le texte du spinner existant
|
|
408
|
-
osSpinner.start("\x1b[32m Alex is forging...\x1b[0m");
|
|
409
|
-
|
|
410
358
|
const result = await axios.post(ALEX_ENGINE_URL, { prompt: promptWithTime, projectType: 'android' }, {
|
|
411
359
|
headers: { 'x-project-id': projectId }
|
|
412
360
|
});
|
|
413
361
|
|
|
414
|
-
// 🛑 ARRÊT DE L'ANIMATION
|
|
415
|
-
osSpinner.stop();
|
|
416
|
-
|
|
417
362
|
let aiData = result.data;
|
|
418
363
|
|
|
419
364
|
// 🛡️ ROBUST PARSER: Unwrap all nesting levels until we find a valid aiData object
|
|
@@ -559,9 +504,6 @@ if (command === 'alex') {
|
|
|
559
504
|
console.log(`\n\x1b[31m⚠️ Error: Alex replied, but source code could not be extracted. Try the command again.\x1b[0m\n`);
|
|
560
505
|
}
|
|
561
506
|
} catch (error) {
|
|
562
|
-
// 🛑 SÉCURITÉ : Arrête le moteur global s'il y a un crash
|
|
563
|
-
osSpinner.stop();
|
|
564
|
-
|
|
565
507
|
process.stdout.write('\r' + ' '.repeat(50) + '\r');
|
|
566
508
|
console.error('\n\x1b[31m Alex Error:\x1b[0m ' + (error.response?.data?.message || error.message));
|
|
567
509
|
}
|
|
@@ -577,7 +519,7 @@ if (command === 'alex') {
|
|
|
577
519
|
// ============================================================
|
|
578
520
|
|
|
579
521
|
const startAlexSession = async () => {
|
|
580
|
-
|
|
522
|
+
process.stdout.write('\x1b[33m🛡️ Alex is checking runtime state...\x1b[0m\r');
|
|
581
523
|
let attempts = 0;
|
|
582
524
|
const maxAttempts = 5;
|
|
583
525
|
let isReady = false;
|
|
@@ -607,9 +549,6 @@ if (command === 'alex') {
|
|
|
607
549
|
await new Promise(r => setTimeout(r, 2000));
|
|
608
550
|
}
|
|
609
551
|
}
|
|
610
|
-
|
|
611
|
-
// 🛑 ON ARRÊTE L'ANIMATION DE DÉMARRAGE ICI
|
|
612
|
-
osSpinner.stop();
|
|
613
552
|
|
|
614
553
|
if (!isReady) {
|
|
615
554
|
console.error('\n\x1b[31m⚠️ ENGINE OFFLINE:\x1b[0m Start Fleetbo runtime first: "npm run fleetbo" ');
|
|
@@ -1050,9 +989,10 @@ else {
|
|
|
1050
989
|
}
|
|
1051
990
|
|
|
1052
991
|
async function runDevEnvironment() {
|
|
1053
|
-
osSpinner.stop(); // 🛑 Tue le spinner Pre-Boot avant le console.log
|
|
1054
992
|
console.log(`[Fleetbo] 🛡️ Initializing Dev Environment...`);
|
|
1055
|
-
|
|
993
|
+
|
|
994
|
+
|
|
995
|
+
|
|
1056
996
|
killNetworkService();
|
|
1057
997
|
killProcessOnPort(PORT);
|
|
1058
998
|
|