fleetbo-cockpit-cli 1.0.138 → 1.0.140

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.
Files changed (2) hide show
  1. package/cli.js +37 -36
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -641,57 +641,58 @@ if (command === 'alex') {
641
641
 
642
642
  let inputBuffer = "";
643
643
  let isProcessing = false;
644
- let hintShown = false;
644
+ let pasteTimeout = null;
645
645
 
646
646
  rl.on('line', async (line) => {
647
647
  if (isProcessing) return;
648
648
 
649
- const trimmedLine = line.trim();
649
+ // 1. On accumule les lignes
650
+ inputBuffer += (inputBuffer ? "\n" : "") + line;
650
651
 
651
- if (['exit', 'quit'].includes(trimmedLine.toLowerCase())) {
652
- console.log('\n\x1b[90m Alex session closed.\x1b[0m');
653
- rl.close();
654
- return;
655
- }
652
+ // 🪄 2. LE BOUCLIER VISUEL : On efface immédiatement le prompt.
653
+ // Ça empêche le terminal de spammer "jojo ❯" à chaque ligne du copier-coller !
654
+ rl.setPrompt("");
656
655
 
657
- if (trimmedLine !== "") {
658
- // Accumule silencieusement — pas de hint pendant la frappe/paste
659
- inputBuffer += (inputBuffer ? "\n" : "") + line;
660
- }
661
- else {
662
- if (inputBuffer.trim() !== "") {
663
- if (!hintShown) {
664
- // 1ère ligne vide → affiche le hint, attend la 2ème
665
- hintShown = true;
666
- rl.setPrompt("\x1b[90m ↵ again to send\x1b[0m");
667
- rl.prompt();
668
- } else {
669
- // 2ème ligne vide → soumet
670
- hintShown = false;
671
- const finalPrompt = inputBuffer.trim();
672
- inputBuffer = "";
673
-
674
- if (finalPrompt.length > 4000) {
675
- console.log(`\n\x1b[31m⛔ [Alex Safety] Mission rejected: Excessive size (${finalPrompt.length}/4000 characters).\x1b[0m`);
676
- rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
677
- rl.prompt();
678
- return;
679
- }
656
+ // 3. On annule le timer précédent
657
+ if (pasteTimeout) clearTimeout(pasteTimeout);
680
658
 
681
- isProcessing = true;
682
- rl.setPrompt("");
683
- await processAlexRequest(finalPrompt);
684
- isProcessing = false;
659
+ // 4. Timer légèrement augmenté à 50ms
660
+ pasteTimeout = setTimeout(async () => {
661
+ const finalPrompt = inputBuffer.trim();
662
+ inputBuffer = "";
663
+
664
+ // Gestion de la sortie
665
+ if (['exit', 'quit'].includes(finalPrompt.toLowerCase())) {
666
+ console.log('\n\x1b[90m Alex session closed.\x1b[0m');
667
+ rl.close();
668
+ return;
669
+ }
685
670
 
686
- console.log('');
671
+ // Si le texte final n'est pas vide
672
+ if (finalPrompt !== "") {
673
+ if (finalPrompt.length > 4000) {
674
+ console.log(`\n\x1b[31m⛔ [Alex Safety] Mission rejected: Excessive size (${finalPrompt.length}/4000 characters).\x1b[0m`);
687
675
  rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
688
676
  rl.prompt();
677
+ return;
689
678
  }
679
+
680
+ // On verrouille et on envoie
681
+ isProcessing = true;
682
+ await processAlexRequest(finalPrompt);
683
+
684
+ // On libère et on RESTAURE le prompt
685
+ isProcessing = false;
686
+ console.log('');
687
+ rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
688
+ rl.prompt();
690
689
  } else {
690
+ // Si l'utilisateur appuie juste sur Entrée dans le vide
691
+ // On RESTAURE le prompt proprement
691
692
  rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
692
693
  rl.prompt();
693
694
  }
694
- }
695
+ }, 50);
695
696
  });
696
697
  };
697
698
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbo-cockpit-cli",
3
- "version": "1.0.138",
3
+ "version": "1.0.140",
4
4
  "description": "Fleetbo CLI - Build native mobile apps with React",
5
5
  "author": "Fleetbo",
6
6
  "license": "MIT",