fleetbo-cockpit-cli 1.0.144 → 1.0.145
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 +29 -37
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -641,8 +641,7 @@ if (command === 'alex') {
|
|
|
641
641
|
|
|
642
642
|
let inputBuffer = [];
|
|
643
643
|
let isProcessing = false;
|
|
644
|
-
let
|
|
645
|
-
let isPastingMode = false;
|
|
644
|
+
let isPasteMode = false;
|
|
646
645
|
|
|
647
646
|
const executePrompt = async (text) => {
|
|
648
647
|
if (['exit', 'quit'].includes(text.toLowerCase())) {
|
|
@@ -670,47 +669,40 @@ if (command === 'alex') {
|
|
|
670
669
|
}
|
|
671
670
|
};
|
|
672
671
|
|
|
673
|
-
rl.on('line', (line) => {
|
|
672
|
+
rl.on('line', async (line) => {
|
|
674
673
|
if (isProcessing) return;
|
|
675
674
|
|
|
676
|
-
// 1.
|
|
677
|
-
if (
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
675
|
+
// 1. SI LE MODE COLLAGE EST ACTIF
|
|
676
|
+
if (isPasteMode) {
|
|
677
|
+
// Dès que tu tapes EOF, on assemble tout le texte et on l'envoie à Alex
|
|
678
|
+
if (line.trim().toUpperCase() === "EOF") {
|
|
679
|
+
const finalPrompt = inputBuffer.join('\n').trim();
|
|
680
|
+
inputBuffer = [];
|
|
681
|
+
isPasteMode = false;
|
|
682
|
+
await executePrompt(finalPrompt);
|
|
683
|
+
} else {
|
|
684
|
+
// On accumule le texte collé silencieusement
|
|
685
|
+
inputBuffer.push(line);
|
|
686
|
+
}
|
|
682
687
|
return;
|
|
683
688
|
}
|
|
684
689
|
|
|
685
|
-
// 2.
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
// Si on a DÉJÀ basculé en mode collage, on reste silencieux !
|
|
695
|
-
if (isPastingMode) return;
|
|
690
|
+
// 2. ACTIVATION DU MODE COLLAGE
|
|
691
|
+
if (line.trim().toLowerCase() === "/paste") {
|
|
692
|
+
isPasteMode = true;
|
|
693
|
+
console.log('\x1b[36m [Mode Éditeur] Collez votre long texte ici. Tapez EOF sur une nouvelle ligne pour envoyer.\x1b[0m');
|
|
694
|
+
// On efface le prompt "jojo ❯" pour que ton code collé s'affiche parfaitement !
|
|
695
|
+
rl.setPrompt("");
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
696
698
|
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
} else {
|
|
705
|
-
executePrompt(finalPrompt);
|
|
706
|
-
}
|
|
707
|
-
} else {
|
|
708
|
-
// 👉 CAS B : Plusieurs lignes reçues = Copier-coller.
|
|
709
|
-
// On verrouille le mode multi-lignes TOUT EN SILENCE.
|
|
710
|
-
// Aucun message, aucun 'rl.prompt()', on laisse le terminal respirer.
|
|
711
|
-
isPastingMode = true;
|
|
712
|
-
}
|
|
713
|
-
}, 100);
|
|
699
|
+
// 3. MODE CHAT CLASSIQUE (1 Entrée = 1 Envoi)
|
|
700
|
+
const finalPrompt = line.trim();
|
|
701
|
+
if (finalPrompt === "") {
|
|
702
|
+
rl.prompt(); // Touche Entrée dans le vide
|
|
703
|
+
} else {
|
|
704
|
+
await executePrompt(finalPrompt); // Envoi instantané
|
|
705
|
+
}
|
|
714
706
|
});
|
|
715
707
|
};
|
|
716
708
|
|