fleetbo-cockpit-cli 1.0.105 → 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 +4 -66
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -5,57 +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 (Zéro dépendance)
|
|
10
|
-
// ============================================
|
|
11
|
-
class FleetboSpinner {
|
|
12
|
-
constructor() {
|
|
13
|
-
this.frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
14
|
-
this.idx = 0;
|
|
15
|
-
this.timer = null;
|
|
16
|
-
this.currentMessage = ""; // Garde le texte en mémoire
|
|
17
|
-
}
|
|
18
|
-
start(message) {
|
|
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
|
-
|
|
33
|
-
this.timer = setInterval(() => {
|
|
34
|
-
process.stdout.write(`\r\x1b[2K \x1b[32m${this.frames[this.idx]}\x1b[0m ${this.currentMessage}`);
|
|
35
|
-
this.idx = (this.idx + 1) % this.frames.length;
|
|
36
|
-
}, 80);
|
|
37
|
-
}
|
|
38
|
-
stop() {
|
|
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
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const osSpinner = new FleetboSpinner();
|
|
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
8
|
const { spawn, execSync } = require('child_process');
|
|
60
9
|
const fs = require('fs');
|
|
61
10
|
const path = require('path');
|
|
@@ -65,7 +14,6 @@ const os = require('os');
|
|
|
65
14
|
const archiver = require('archiver');
|
|
66
15
|
const readline = require('readline');
|
|
67
16
|
|
|
68
|
-
|
|
69
17
|
// ============================================
|
|
70
18
|
// FLEETBO CLI - Centralized Package
|
|
71
19
|
// ============================================
|
|
@@ -79,6 +27,8 @@ const CACHE_URL = "https://getmodulecache-jqycakhlxa-uc.a.run.app";
|
|
|
79
27
|
const PORT = 3000;
|
|
80
28
|
|
|
81
29
|
let uplinkProcess = null;
|
|
30
|
+
const args = process.argv.slice(2);
|
|
31
|
+
const command = args[0];
|
|
82
32
|
|
|
83
33
|
// ============================================
|
|
84
34
|
// CONFIGURATION (.env du projet dev)
|
|
@@ -323,7 +273,7 @@ if (command === 'alex') {
|
|
|
323
273
|
return;
|
|
324
274
|
}
|
|
325
275
|
|
|
326
|
-
|
|
276
|
+
console.log('\x1b[33m🧠 Alex is thinking...\x1b[0m');
|
|
327
277
|
|
|
328
278
|
try {
|
|
329
279
|
// --- MEMORY SYSTEM (SMART CACHE SCANNER V3 - SOUVERAINETÉ DU MÉTAL) ---
|
|
@@ -405,16 +355,10 @@ if (command === 'alex') {
|
|
|
405
355
|
|
|
406
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.]`;
|
|
407
357
|
|
|
408
|
-
// On met à jour le texte du spinner existant
|
|
409
|
-
osSpinner.start("\x1b[32m Alex is forging...\x1b[0m");
|
|
410
|
-
|
|
411
358
|
const result = await axios.post(ALEX_ENGINE_URL, { prompt: promptWithTime, projectType: 'android' }, {
|
|
412
359
|
headers: { 'x-project-id': projectId }
|
|
413
360
|
});
|
|
414
361
|
|
|
415
|
-
// 🛑 ARRÊT DE L'ANIMATION
|
|
416
|
-
osSpinner.stop();
|
|
417
|
-
|
|
418
362
|
let aiData = result.data;
|
|
419
363
|
|
|
420
364
|
// 🛡️ ROBUST PARSER: Unwrap all nesting levels until we find a valid aiData object
|
|
@@ -560,9 +504,6 @@ if (command === 'alex') {
|
|
|
560
504
|
console.log(`\n\x1b[31m⚠️ Error: Alex replied, but source code could not be extracted. Try the command again.\x1b[0m\n`);
|
|
561
505
|
}
|
|
562
506
|
} catch (error) {
|
|
563
|
-
// 🛑 SÉCURITÉ : Arrête le moteur global s'il y a un crash
|
|
564
|
-
osSpinner.stop();
|
|
565
|
-
|
|
566
507
|
process.stdout.write('\r' + ' '.repeat(50) + '\r');
|
|
567
508
|
console.error('\n\x1b[31m Alex Error:\x1b[0m ' + (error.response?.data?.message || error.message));
|
|
568
509
|
}
|
|
@@ -578,7 +519,7 @@ if (command === 'alex') {
|
|
|
578
519
|
// ============================================================
|
|
579
520
|
|
|
580
521
|
const startAlexSession = async () => {
|
|
581
|
-
|
|
522
|
+
process.stdout.write('\x1b[33m🛡️ Alex is checking runtime state...\x1b[0m\r');
|
|
582
523
|
let attempts = 0;
|
|
583
524
|
const maxAttempts = 5;
|
|
584
525
|
let isReady = false;
|
|
@@ -608,9 +549,6 @@ if (command === 'alex') {
|
|
|
608
549
|
await new Promise(r => setTimeout(r, 2000));
|
|
609
550
|
}
|
|
610
551
|
}
|
|
611
|
-
|
|
612
|
-
// 🛑 ON ARRÊTE L'ANIMATION DE DÉMARRAGE ICI
|
|
613
|
-
osSpinner.stop();
|
|
614
552
|
|
|
615
553
|
if (!isReady) {
|
|
616
554
|
console.error('\n\x1b[31m⚠️ ENGINE OFFLINE:\x1b[0m Start Fleetbo runtime first: "npm run fleetbo" ');
|