fleetbo-cockpit-cli 1.0.215 → 1.0.216
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 +3 -48
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -489,60 +489,15 @@ if (command === 'alex') {
|
|
|
489
489
|
}
|
|
490
490
|
|
|
491
491
|
if (aiData.status === 'success' || aiData.status === 'message' || aiData.status === 'complex_refusal') {
|
|
492
|
-
console.log('');
|
|
493
492
|
let rawMsg = aiData.message || "I'm ready.";
|
|
494
493
|
|
|
495
494
|
if (typeof rawMsg === 'object') {
|
|
496
495
|
rawMsg = rawMsg.message || rawMsg.text || "Module generated.";
|
|
497
496
|
}
|
|
498
497
|
|
|
499
|
-
//
|
|
500
|
-
//
|
|
501
|
-
|
|
502
|
-
// 2. On prend 85% de l'espace pour un confort de lecture optimal
|
|
503
|
-
const maxWidth = Math.max(40, Math.floor(termWidth * 0.85));
|
|
504
|
-
|
|
505
|
-
const wrapDynamic = (text, max) => {
|
|
506
|
-
return text.split('\n').map(line => {
|
|
507
|
-
// On ignore les lignes de code, les listes, ou les lignes déjà courtes
|
|
508
|
-
if (/^[\s]*[-*•\d]/.test(line) || line.startsWith(" ") || line.length <= max) {
|
|
509
|
-
return line;
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
const words = line.split(' ');
|
|
513
|
-
let wrapped = [];
|
|
514
|
-
let currentLine = '';
|
|
515
|
-
|
|
516
|
-
for (let i = 0; i < words.length; i++) {
|
|
517
|
-
const word = words[i];
|
|
518
|
-
|
|
519
|
-
// Sécurité : Si un mot est IMMENSE (ex: un long lien HTTP), on le force sur sa propre ligne
|
|
520
|
-
if (word.length > max) {
|
|
521
|
-
if (currentLine) wrapped.push(currentLine);
|
|
522
|
-
wrapped.push(word);
|
|
523
|
-
currentLine = '';
|
|
524
|
-
continue;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
const spaceNeeded = currentLine.length > 0 ? 1 : 0;
|
|
528
|
-
|
|
529
|
-
// Est-ce que le mot rentre sur la ligne courante ?
|
|
530
|
-
if (currentLine.length + word.length + spaceNeeded > max) {
|
|
531
|
-
wrapped.push(currentLine); // Non -> on sauvegarde la ligne
|
|
532
|
-
currentLine = word; // On commence une nouvelle ligne avec ce mot
|
|
533
|
-
} else {
|
|
534
|
-
currentLine += (spaceNeeded ? ' ' : '') + word; // Oui -> on l'ajoute
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
if (currentLine) wrapped.push(currentLine);
|
|
539
|
-
return wrapped.join('\n');
|
|
540
|
-
}).join('\n');
|
|
541
|
-
};
|
|
542
|
-
|
|
543
|
-
const formattedMsg = wrapDynamic(rawMsg, maxWidth);
|
|
544
|
-
|
|
545
|
-
console.log('\x1b[32mAlex ❯\x1b[0m ' + formattedMsg);
|
|
498
|
+
// ON DÉLÈGUE L'AFFICHAGE AU FRONTEND (Xterm.jsx)
|
|
499
|
+
// On envoie le texte pur entouré de balises invisibles
|
|
500
|
+
console.log(`[ALEX_START]${rawMsg}[ALEX_END]`);
|
|
546
501
|
}
|
|
547
502
|
|
|
548
503
|
// --- FILE CREATION LOGIC ---
|