fleetbo-cockpit-cli 1.0.137 → 1.0.139
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 +26 -23
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -621,9 +621,9 @@ if (command === 'alex') {
|
|
|
621
621
|
console.log('');
|
|
622
622
|
console.log('\x1b[36mEXAMPLES\x1b[0m');
|
|
623
623
|
console.log('');
|
|
624
|
-
console.log('\x1b[33m›\x1b[0m \x1b[90m"\x1b[33mforge\x1b[90m a camera to scan receipts for my expense tracker"\x1b[0m');
|
|
625
|
-
console.log('\x1b[33m›\x1b[0m \x1b[90m"\x1b[33mcreate\x1b[90m a form to add products with photos to my catalog"\x1b[0m');
|
|
626
|
-
console.log('\x1b[33m›\x1b[0m \x1b[90m"\x1b[33mupdate\x1b[90m CloudCamera to save in the collection orders"\x1b[0m');
|
|
624
|
+
console.log('\x1b[33m›\x1b[0m \x1b[90m"\x1b[33mforge\x1b[90m a camera module to scan receipts for my expense tracker"\x1b[0m');
|
|
625
|
+
console.log('\x1b[33m›\x1b[0m \x1b[90m"\x1b[33mcreate\x1b[90m a form module to add products with photos to my catalog"\x1b[0m');
|
|
626
|
+
console.log('\x1b[33m›\x1b[0m \x1b[90m"\x1b[33mupdate\x1b[90m the CloudCamera module to save in the collection orders"\x1b[0m');
|
|
627
627
|
|
|
628
628
|
// READY
|
|
629
629
|
console.log('');
|
|
@@ -641,30 +641,31 @@ if (command === 'alex') {
|
|
|
641
641
|
|
|
642
642
|
let inputBuffer = "";
|
|
643
643
|
let isProcessing = false;
|
|
644
|
-
|
|
644
|
+
let pasteTimeout = null;
|
|
645
645
|
|
|
646
646
|
rl.on('line', async (line) => {
|
|
647
647
|
if (isProcessing) return;
|
|
648
648
|
|
|
649
|
-
|
|
649
|
+
// 1. On accumule les lignes (utile pour le copier-coller rapide)
|
|
650
|
+
inputBuffer += (inputBuffer ? "\n" : "") + line;
|
|
650
651
|
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
652
|
+
// 2. On annule le timer précédent si une nouvelle ligne arrive
|
|
653
|
+
if (pasteTimeout) clearTimeout(pasteTimeout);
|
|
654
|
+
|
|
655
|
+
// 3. On lance un micro-timer de 30ms
|
|
656
|
+
pasteTimeout = setTimeout(async () => {
|
|
657
|
+
const finalPrompt = inputBuffer.trim();
|
|
658
|
+
inputBuffer = ""; // On vide le buffer pour la prochaine fois
|
|
656
659
|
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
if (inputBuffer.trim() !== "") {
|
|
664
|
-
// 🟢 MAGIE : ON SOUMET IMMÉDIATEMENT ! Plus besoin d'attendre 2 fois.
|
|
665
|
-
const finalPrompt = inputBuffer.trim();
|
|
666
|
-
inputBuffer = "";
|
|
660
|
+
// Gestion de la sortie
|
|
661
|
+
if (['exit', 'quit'].includes(finalPrompt.toLowerCase())) {
|
|
662
|
+
console.log('\n\x1b[90m Alex session closed.\x1b[0m');
|
|
663
|
+
rl.close();
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
667
666
|
|
|
667
|
+
// Envoi si le texte final n'est pas vide
|
|
668
|
+
if (finalPrompt !== "") {
|
|
668
669
|
if (finalPrompt.length > 4000) {
|
|
669
670
|
console.log(`\n\x1b[31m⛔ [Alex Safety] Mission rejected: Excessive size (${finalPrompt.length}/4000 characters).\x1b[0m`);
|
|
670
671
|
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
@@ -672,19 +673,21 @@ if (command === 'alex') {
|
|
|
672
673
|
return;
|
|
673
674
|
}
|
|
674
675
|
|
|
676
|
+
// On verrouille et on envoie
|
|
675
677
|
isProcessing = true;
|
|
676
678
|
rl.setPrompt("");
|
|
679
|
+
|
|
677
680
|
await processAlexRequest(finalPrompt);
|
|
681
|
+
|
|
682
|
+
// On libère
|
|
678
683
|
isProcessing = false;
|
|
679
|
-
|
|
680
684
|
console.log('');
|
|
681
685
|
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
682
686
|
rl.prompt();
|
|
683
687
|
} else {
|
|
684
|
-
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
685
688
|
rl.prompt();
|
|
686
689
|
}
|
|
687
|
-
}
|
|
690
|
+
}, 30); // ⏱️ 30 millisecondes d'attente
|
|
688
691
|
});
|
|
689
692
|
};
|
|
690
693
|
|