fleetbo-cockpit-cli 1.0.149 → 1.0.151
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 +41 -17
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -627,7 +627,7 @@ if (command === 'alex') {
|
|
|
627
627
|
|
|
628
628
|
// READY
|
|
629
629
|
console.log('');
|
|
630
|
-
console.log(
|
|
630
|
+
console.log("\x1b[34mAlex ❯ Describe your feature (use /p to paste code).\x1b[0m");
|
|
631
631
|
console.log('');
|
|
632
632
|
|
|
633
633
|
const rl = readline.createInterface({
|
|
@@ -639,9 +639,10 @@ if (command === 'alex') {
|
|
|
639
639
|
process.stdout.write('\n\x1b[F');
|
|
640
640
|
rl.prompt();
|
|
641
641
|
|
|
642
|
-
let
|
|
642
|
+
let standardBuffer = [];
|
|
643
643
|
let isProcessing = false;
|
|
644
644
|
let isPasteMode = false;
|
|
645
|
+
let pasteBlockerTimer = null;
|
|
645
646
|
|
|
646
647
|
const executePrompt = async (text) => {
|
|
647
648
|
if (['exit', 'quit'].includes(text.toLowerCase())) {
|
|
@@ -657,8 +658,13 @@ if (command === 'alex') {
|
|
|
657
658
|
return;
|
|
658
659
|
}
|
|
659
660
|
isProcessing = true;
|
|
660
|
-
rl.setPrompt("");
|
|
661
|
+
rl.setPrompt("");
|
|
662
|
+
|
|
663
|
+
// ✨ LE FAMEUX MESSAGE EXECUTING POUR TOUS LES ENVOIS ✨
|
|
664
|
+
console.log('\x1b[90mExecuting...\x1b[0m');
|
|
665
|
+
|
|
661
666
|
await processAlexRequest(text);
|
|
667
|
+
|
|
662
668
|
isProcessing = false;
|
|
663
669
|
console.log('');
|
|
664
670
|
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
@@ -669,40 +675,58 @@ if (command === 'alex') {
|
|
|
669
675
|
}
|
|
670
676
|
};
|
|
671
677
|
|
|
678
|
+
// L'ÉCOUTEUR DE TOUCHES BLINDÉ
|
|
672
679
|
rl.on('line', async (line) => {
|
|
673
680
|
if (isProcessing) return;
|
|
674
681
|
|
|
675
682
|
// 1. SI LE MODE COLLAGE EST ACTIF
|
|
676
683
|
if (isPasteMode) {
|
|
677
|
-
// Dès que tu tapes EOF, on assemble tout le texte et on l'envoie à Alex
|
|
678
684
|
if (['/s', '/send', 'eof'].includes(line.trim().toLowerCase())) {
|
|
679
|
-
const finalPrompt =
|
|
680
|
-
|
|
685
|
+
const finalPrompt = standardBuffer.join('\n').trim();
|
|
686
|
+
standardBuffer = [];
|
|
681
687
|
isPasteMode = false;
|
|
682
688
|
await executePrompt(finalPrompt);
|
|
683
689
|
} else {
|
|
684
|
-
|
|
685
|
-
inputBuffer.push(line);
|
|
690
|
+
standardBuffer.push(line);
|
|
686
691
|
}
|
|
687
692
|
return;
|
|
688
693
|
}
|
|
689
694
|
|
|
690
|
-
// 2. ACTIVATION DU MODE COLLAGE
|
|
695
|
+
// 2. ACTIVATION DU MODE COLLAGE (/p)
|
|
691
696
|
if (['/paste', '/p'].includes(line.trim().toLowerCase())) {
|
|
692
697
|
isPasteMode = true;
|
|
698
|
+
standardBuffer = []; // Sécurité : on vide tout
|
|
693
699
|
console.log('\x1b[36m [MULTILINE MODE] Paste your content below. Type /s on a new line to submit.\x1b[0m');
|
|
694
|
-
// On efface le prompt "jojo ❯" pour que ton code collé s'affiche parfaitement !
|
|
695
700
|
rl.setPrompt("");
|
|
696
701
|
return;
|
|
697
702
|
}
|
|
698
703
|
|
|
699
|
-
// 3.
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
704
|
+
// 3. LE BOUCLIER ANTI-COLLAGE SAUVAGE (Mode Chat Classique)
|
|
705
|
+
standardBuffer.push(line);
|
|
706
|
+
|
|
707
|
+
// On annule et relance le chrono de 15ms à chaque ligne ultra-rapide
|
|
708
|
+
if (pasteBlockerTimer) clearTimeout(pasteBlockerTimer);
|
|
709
|
+
|
|
710
|
+
pasteBlockerTimer = setTimeout(async () => {
|
|
711
|
+
pasteBlockerTimer = null;
|
|
712
|
+
|
|
713
|
+
if (standardBuffer.length > 1) {
|
|
714
|
+
// 🚨 ALERTE : Plus d'une ligne reçue en 15ms = Copier-coller illégal !
|
|
715
|
+
console.log('\n\x1b[31m⚠️ Illegal paste detected! You must type /p before pasting multiple lines of code.\x1b[0m');
|
|
716
|
+
standardBuffer = []; // On détruit la tentative de collage
|
|
717
|
+
rl.prompt();
|
|
718
|
+
} else {
|
|
719
|
+
// ✅ CAS NORMAL : 1 seule touche Entrée humaine
|
|
720
|
+
const finalPrompt = standardBuffer[0].trim();
|
|
721
|
+
standardBuffer = [];
|
|
722
|
+
|
|
723
|
+
if (finalPrompt === "") {
|
|
724
|
+
rl.prompt();
|
|
725
|
+
} else {
|
|
726
|
+
await executePrompt(finalPrompt);
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
}, 15); // 15 millisecondes d'analyse
|
|
706
730
|
});
|
|
707
731
|
};
|
|
708
732
|
|