fleetbo-cockpit-cli 1.0.138 → 1.0.139

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 +33 -37
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -641,57 +641,53 @@ 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 (utile pour le copier-coller rapide)
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. On annule le timer précédent si une nouvelle ligne arrive
653
+ if (pasteTimeout) clearTimeout(pasteTimeout);
656
654
 
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
- }
655
+ // 3. On lance un micro-timer de 30ms
656
+ pasteTimeout = setTimeout(async () => {
657
+ const finalPrompt = inputBuffer.trim();
658
+ inputBuffer = ""; // On vide le buffer pour la prochaine fois
680
659
 
681
- isProcessing = true;
682
- rl.setPrompt("");
683
- await processAlexRequest(finalPrompt);
684
- isProcessing = false;
660
+ // Gestion de la sortie
661
+ if (['exit', 'quit'].includes(finalPrompt.toLowerCase())) {
662
+ console.log('\n\x1b[90m Alex session closed.\x1b[0m');
663
+ rl.close();
664
+ return;
665
+ }
685
666
 
686
- console.log('');
667
+ // Envoi si le texte final n'est pas vide
668
+ if (finalPrompt !== "") {
669
+ if (finalPrompt.length > 4000) {
670
+ console.log(`\n\x1b[31m⛔ [Alex Safety] Mission rejected: Excessive size (${finalPrompt.length}/4000 characters).\x1b[0m`);
687
671
  rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
688
672
  rl.prompt();
673
+ return;
689
674
  }
690
- } else {
675
+
676
+ // On verrouille et on envoie
677
+ isProcessing = true;
678
+ rl.setPrompt("");
679
+
680
+ await processAlexRequest(finalPrompt);
681
+
682
+ // On libère
683
+ isProcessing = false;
684
+ console.log('');
691
685
  rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
686
+ rl.prompt();
687
+ } else {
692
688
  rl.prompt();
693
689
  }
694
- }
690
+ }, 30); // ⏱️ 30 millisecondes d'attente
695
691
  });
696
692
  };
697
693
 
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.139",
4
4
  "description": "Fleetbo CLI - Build native mobile apps with React",
5
5
  "author": "Fleetbo",
6
6
  "license": "MIT",