fleetbo-cockpit-cli 1.0.143 → 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 +26 -41
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -639,10 +639,9 @@ if (command === 'alex') {
|
|
|
639
639
|
process.stdout.write('\n\x1b[F');
|
|
640
640
|
rl.prompt();
|
|
641
641
|
|
|
642
|
-
let inputBuffer = [];
|
|
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,54 +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. SI
|
|
677
|
-
if (
|
|
678
|
-
|
|
679
|
-
|
|
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") {
|
|
680
679
|
const finalPrompt = inputBuffer.join('\n').trim();
|
|
681
|
-
inputBuffer = [];
|
|
682
|
-
|
|
683
|
-
executePrompt(finalPrompt);
|
|
680
|
+
inputBuffer = [];
|
|
681
|
+
isPasteMode = false;
|
|
682
|
+
await executePrompt(finalPrompt);
|
|
684
683
|
} else {
|
|
685
|
-
//
|
|
684
|
+
// On accumule le texte collé silencieusement
|
|
686
685
|
inputBuffer.push(line);
|
|
687
686
|
}
|
|
688
687
|
return;
|
|
689
688
|
}
|
|
690
689
|
|
|
691
|
-
// 2.
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
burstTimer = null;
|
|
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
|
+
}
|
|
700
698
|
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
rl.prompt(); // Entrée dans le vide
|
|
709
|
-
} else {
|
|
710
|
-
executePrompt(finalPrompt); // Envoi direct !
|
|
711
|
-
}
|
|
712
|
-
} else {
|
|
713
|
-
// 👉 CAS B : Le panier contient PLUSIEURS lignes d'un coup.
|
|
714
|
-
// C'est mathématiquement un copier-coller (même avec des sauts de lignes dedans).
|
|
715
|
-
isPastingMode = true;
|
|
716
|
-
// On ajoute un petit indicateur visuel ultra-propre pour te prévenir
|
|
717
|
-
console.log('\x1b[90m [Copier-coller détecté. Appuyez sur Entrée (ligne vide) pour valider]\x1b[0m');
|
|
718
|
-
rl.prompt();
|
|
719
|
-
}
|
|
720
|
-
}, 30);
|
|
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
|
+
}
|
|
721
706
|
});
|
|
722
707
|
};
|
|
723
708
|
|