fleetbo-cockpit-cli 1.0.101 → 1.0.103
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 +37 -2
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -14,6 +14,32 @@ const os = require('os');
|
|
|
14
14
|
const archiver = require('archiver');
|
|
15
15
|
const readline = require('readline');
|
|
16
16
|
|
|
17
|
+
// ============================================
|
|
18
|
+
// OS SPINNER (Terminal Animation Engine)
|
|
19
|
+
// ============================================
|
|
20
|
+
class FleetboSpinner {
|
|
21
|
+
constructor() {
|
|
22
|
+
this.frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
23
|
+
this.idx = 0;
|
|
24
|
+
this.timer = null;
|
|
25
|
+
}
|
|
26
|
+
start(message) {
|
|
27
|
+
if (this.timer) return;
|
|
28
|
+
process.stdout.write('\x1b[?25l'); // Cache le curseur natif
|
|
29
|
+
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`);
|
|
32
|
+
this.idx = (this.idx + 1) % this.frames.length;
|
|
33
|
+
}, 80);
|
|
34
|
+
}
|
|
35
|
+
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
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const osSpinner = new FleetboSpinner();
|
|
42
|
+
|
|
17
43
|
// ============================================
|
|
18
44
|
// FLEETBO CLI - Centralized Package
|
|
19
45
|
// ============================================
|
|
@@ -273,7 +299,7 @@ if (command === 'alex') {
|
|
|
273
299
|
return;
|
|
274
300
|
}
|
|
275
301
|
|
|
276
|
-
|
|
302
|
+
osSpinner.start("\x1b[33m🧠 Alex is processing your request...\x1b[0m");
|
|
277
303
|
|
|
278
304
|
try {
|
|
279
305
|
// --- MEMORY SYSTEM (SMART CACHE SCANNER V3 - SOUVERAINETÉ DU MÉTAL) ---
|
|
@@ -295,7 +321,7 @@ if (command === 'alex') {
|
|
|
295
321
|
modName = modName.replace('Schema', '');
|
|
296
322
|
}
|
|
297
323
|
|
|
298
|
-
process.stdout.write(` \x1b[90m🔍 Checking
|
|
324
|
+
process.stdout.write(` \x1b[90m🔍 Checking Alex memory for ${modName} module...\x1b[0m`);
|
|
299
325
|
const cache = await getModuleCache({ projectId, moduleName: modName });
|
|
300
326
|
|
|
301
327
|
// 💡 LECTURE LOCALE DU VRAI CODE KOTLIN (La Vérité Absolue)
|
|
@@ -355,10 +381,16 @@ if (command === 'alex') {
|
|
|
355
381
|
|
|
356
382
|
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.]`;
|
|
357
383
|
|
|
384
|
+
// On met à jour le texte du spinner existant
|
|
385
|
+
osSpinner.start("Neural Link active. Alex is forging...");
|
|
386
|
+
|
|
358
387
|
const result = await axios.post(ALEX_ENGINE_URL, { prompt: promptWithTime, projectType: 'android' }, {
|
|
359
388
|
headers: { 'x-project-id': projectId }
|
|
360
389
|
});
|
|
361
390
|
|
|
391
|
+
// 🛑 ARRÊT DE L'ANIMATION
|
|
392
|
+
osSpinner.stop();
|
|
393
|
+
|
|
362
394
|
let aiData = result.data;
|
|
363
395
|
|
|
364
396
|
// 🛡️ ROBUST PARSER: Unwrap all nesting levels until we find a valid aiData object
|
|
@@ -504,6 +536,9 @@ if (command === 'alex') {
|
|
|
504
536
|
console.log(`\n\x1b[31m⚠️ Error: Alex replied, but source code could not be extracted. Try the command again.\x1b[0m\n`);
|
|
505
537
|
}
|
|
506
538
|
} catch (error) {
|
|
539
|
+
// 🛑 SÉCURITÉ : Arrête le spinner s'il y a un crash
|
|
540
|
+
if (spinnerTimer) clearInterval(spinnerTimer);
|
|
541
|
+
|
|
507
542
|
process.stdout.write('\r' + ' '.repeat(50) + '\r');
|
|
508
543
|
console.error('\n\x1b[31m Alex Error:\x1b[0m ' + (error.response?.data?.message || error.message));
|
|
509
544
|
}
|