fleetbo-cockpit-cli 1.0.202 → 1.0.204
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 +12 -38
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -640,11 +640,6 @@ if (command === 'alex') {
|
|
|
640
640
|
let hasAiKey = false;
|
|
641
641
|
let aiProvider = null;
|
|
642
642
|
let aiModel = null;
|
|
643
|
-
|
|
644
|
-
// ASTUCE : On demande gentiment à l'IDE de noter qu'Alex est en cours de démarrage
|
|
645
|
-
if (process.env.VITE_FLEETBO_DEV === 'true' || true) { // Force l'exécution en dev
|
|
646
|
-
process.stdout.write('[ALEX_BOOTING]\n');
|
|
647
|
-
}
|
|
648
643
|
|
|
649
644
|
while (attempts < maxAttempts && !isReady) {
|
|
650
645
|
try {
|
|
@@ -654,7 +649,7 @@ if (command === 'alex') {
|
|
|
654
649
|
|
|
655
650
|
if (validation.data?.isRunning) {
|
|
656
651
|
isReady = true;
|
|
657
|
-
//
|
|
652
|
+
// ASTUCE : On confirme que le moteur est allumé
|
|
658
653
|
process.stdout.write('[ALEX_ONLINE]\n');
|
|
659
654
|
dynamicUsername = validation.data.username || 'Pilot';
|
|
660
655
|
hasAiKey = validation.data.hasAiKey || false;
|
|
@@ -753,88 +748,67 @@ if (command === 'alex') {
|
|
|
753
748
|
|
|
754
749
|
// READY
|
|
755
750
|
console.log('');
|
|
756
|
-
console.log('\x1b[32mAlex ❯\x1b[0m Describe your feature
|
|
751
|
+
console.log('\x1b[32mAlex ❯\x1b[0m Describe your feature using the Compose panel...');
|
|
757
752
|
console.log('');
|
|
758
753
|
|
|
754
|
+
// 1. ON SUPPRIME LE PROMPT VISUEL (Plus de "Pilot ❯")
|
|
759
755
|
const rl = readline.createInterface({
|
|
760
756
|
input: process.stdin,
|
|
761
|
-
output: process.stdout
|
|
762
|
-
prompt: `\x1b[34m${dynamicUsername} ❯ \x1b[0m`
|
|
757
|
+
output: process.stdout
|
|
763
758
|
});
|
|
764
|
-
|
|
765
|
-
process.stdout.write('\n\x1b[F');
|
|
766
|
-
rl.prompt();
|
|
767
759
|
|
|
768
760
|
// LE BOUCLIER ANTI CTRL+C (SIGINT)
|
|
769
761
|
rl.on('SIGINT', () => {
|
|
770
762
|
console.log('\n\x1b[90m Alex session aborted (Ctrl+C).\x1b[0m');
|
|
771
763
|
process.stdout.write('[ALEX_OFFLINE]\n'); // Prévient React !
|
|
772
764
|
rl.close();
|
|
773
|
-
process.exit(0);
|
|
765
|
+
process.exit(0);
|
|
774
766
|
});
|
|
775
767
|
|
|
776
768
|
let standardBuffer = [];
|
|
777
769
|
let isProcessing = false;
|
|
778
|
-
let isPasteMode = false;
|
|
779
|
-
let pasteBlockerTimer = null;
|
|
780
770
|
|
|
781
771
|
const executePrompt = async (text) => {
|
|
782
772
|
if (['exit', 'quit'].includes(text.toLowerCase())) {
|
|
783
773
|
console.log('\n\x1b[90m Alex session closed.\x1b[0m');
|
|
784
|
-
process.stdout.write('[ALEX_OFFLINE]\n');
|
|
774
|
+
process.stdout.write('[ALEX_OFFLINE]\n');
|
|
785
775
|
rl.close();
|
|
786
776
|
return;
|
|
787
777
|
}
|
|
778
|
+
|
|
788
779
|
if (text !== "") {
|
|
789
780
|
if (text.length > 4000) {
|
|
790
781
|
console.log(`\n\x1b[31m⛔ [Alex Safety] Mission rejected: Excessive size (${text.length}/4000 characters).\x1b[0m`);
|
|
791
|
-
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
792
|
-
rl.prompt();
|
|
793
782
|
return;
|
|
794
783
|
}
|
|
795
|
-
isProcessing = true;
|
|
796
|
-
rl.setPrompt("");
|
|
797
784
|
|
|
798
|
-
|
|
799
|
-
//process.stdout.write('[START_LOAD]\n');
|
|
785
|
+
isProcessing = true;
|
|
800
786
|
|
|
787
|
+
// 2. On exécute la requête sans faire de "rl.setPrompt()"
|
|
801
788
|
await processAlexRequest(text);
|
|
802
789
|
|
|
803
|
-
// 🛑 FIN DU PROCESSUS : On éteint l'overlay
|
|
804
|
-
//process.stdout.write('[END_LOAD]\n');
|
|
805
|
-
|
|
806
790
|
isProcessing = false;
|
|
807
|
-
console.log('');
|
|
808
|
-
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
809
|
-
rl.prompt();
|
|
810
|
-
} else {
|
|
811
|
-
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
812
|
-
rl.prompt();
|
|
791
|
+
console.log(''); // Petit saut de ligne esthétique quand Alex a fini
|
|
813
792
|
}
|
|
814
793
|
};
|
|
815
794
|
|
|
816
|
-
//
|
|
795
|
+
// 3. RÉCEPTEUR SILENCIEUX (Plus de "rl.prompt()" qui pollue l'écran)
|
|
817
796
|
let pasteTimer = null;
|
|
818
797
|
|
|
819
798
|
rl.on('line', async (line) => {
|
|
820
799
|
if (isProcessing) return;
|
|
821
800
|
|
|
822
|
-
// On empile toutes les lignes reçues (qu'elles viennent du clavier ou de React)
|
|
823
801
|
standardBuffer.push(line);
|
|
824
802
|
|
|
825
803
|
if (pasteTimer) clearTimeout(pasteTimer);
|
|
826
804
|
|
|
827
|
-
// Si plusieurs lignes arrivent en moins de 30ms (vitesse d'envoi de React),
|
|
828
|
-
// on les fusionne silencieusement en un seul gros prompt !
|
|
829
805
|
pasteTimer = setTimeout(async () => {
|
|
830
806
|
pasteTimer = null;
|
|
831
807
|
|
|
832
808
|
const finalPrompt = standardBuffer.join('\n').trim();
|
|
833
809
|
standardBuffer = [];
|
|
834
810
|
|
|
835
|
-
if (finalPrompt
|
|
836
|
-
rl.prompt();
|
|
837
|
-
} else {
|
|
811
|
+
if (finalPrompt !== "") {
|
|
838
812
|
await executePrompt(finalPrompt);
|
|
839
813
|
}
|
|
840
814
|
}, 30);
|