fleetbo-cockpit-cli 1.0.142 → 1.0.144

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 +34 -47
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -639,11 +639,10 @@ 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 submitTimeout = null;
645
- let isPasting = false;
646
- let lastLineTime = Date.now(); // ⏱️ LE CHRONOMÈTRE MAGIQUE
644
+ let burstTimer = null;
645
+ let isPastingMode = false;
647
646
 
648
647
  const executePrompt = async (text) => {
649
648
  if (['exit', 'quit'].includes(text.toLowerCase())) {
@@ -671,59 +670,47 @@ if (command === 'alex') {
671
670
  }
672
671
  };
673
672
 
674
- rl.on('line', async (line) => {
673
+ rl.on('line', (line) => {
675
674
  if (isProcessing) return;
676
675
 
677
- const now = Date.now();
678
- const timeSinceLastLine = now - lastLineTime;
679
- lastLineTime = now;
680
-
681
- // 1. FIN DU MODE COLLAGE : On vérifie que c'est une ligne vide ET qu'elle vient d'un humain (> 150ms)
682
- if (isPasting && line.trim() === "") {
683
- if (timeSinceLastLine > 150) {
684
- const finalPrompt = inputBuffer.trim();
685
- inputBuffer = "";
686
- isPasting = false;
687
- await executePrompt(finalPrompt);
688
- return;
689
- }
690
- // Si c'est < 150ms, c'est juste un paragraphe vide dans le texte copié ! On l'ignore et on accumule.
676
+ // 1. VALIDATION DU MODE MULTI-LIGNES (Ligne vide = Envoi)
677
+ if (isPastingMode && line.trim() === "") {
678
+ const finalPrompt = inputBuffer.join('\n').trim();
679
+ inputBuffer = [];
680
+ isPastingMode = false;
681
+ executePrompt(finalPrompt);
682
+ return;
691
683
  }
692
684
 
693
- // 2. On accumule la donnée
694
- inputBuffer += (inputBuffer ? "\n" : "") + line;
685
+ // 2. ACCUMULATION
686
+ inputBuffer.push(line);
695
687
 
696
- // 3. Si on est DÉJÀ en mode paste, on s'arrête là (accumulation silencieuse)
697
- if (isPasting) return;
688
+ if (burstTimer) clearTimeout(burstTimer);
698
689
 
699
- // 4. DÉTECTEUR DE VITESSE : Si une ligne arrive à la vitesse de la lumière (< 50ms), c'est un copier-coller !
700
- if (timeSinceLastLine < 50) {
701
- if (submitTimeout) {
702
- clearTimeout(submitTimeout);
703
- submitTimeout = null;
704
- }
705
- isPasting = true; // 🚨 Passage en mode manuel !
706
- return;
707
- }
690
+ // 3. ANALYSE (100ms après la dernière ligne reçue)
691
+ burstTimer = setTimeout(() => {
692
+ burstTimer = null;
708
693
 
709
- // 5. FRAPPE NORMALE : On lance le chrono
710
- if (submitTimeout) clearTimeout(submitTimeout);
711
-
712
- submitTimeout = setTimeout(async () => {
713
- submitTimeout = null;
714
-
715
- // Si on a basculé en mode paste entre temps (suite d'un collage), on annule l'envoi auto
716
- if (isPasting) return;
694
+ // Si on a DÉJÀ basculé en mode collage, on reste silencieux !
695
+ if (isPastingMode) return;
717
696
 
718
- const finalPrompt = inputBuffer.trim();
719
- inputBuffer = "";
720
-
721
- if (finalPrompt === "") {
722
- rl.prompt(); // L'utilisateur a juste fait Entrée dans le vide
697
+ if (inputBuffer.length === 1) {
698
+ // 👉 CAS A : Une seule ligne tapée. Envoi immédiat !
699
+ const finalPrompt = inputBuffer[0].trim();
700
+ inputBuffer = [];
701
+
702
+ if (finalPrompt === "") {
703
+ rl.prompt();
704
+ } else {
705
+ executePrompt(finalPrompt);
706
+ }
723
707
  } else {
724
- await executePrompt(finalPrompt); // Envoi direct
708
+ // 👉 CAS B : Plusieurs lignes reçues = Copier-coller.
709
+ // On verrouille le mode multi-lignes TOUT EN SILENCE.
710
+ // Aucun message, aucun 'rl.prompt()', on laisse le terminal respirer.
711
+ isPastingMode = true;
725
712
  }
726
- }, 50);
713
+ }, 100);
727
714
  });
728
715
  };
729
716
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbo-cockpit-cli",
3
- "version": "1.0.142",
3
+ "version": "1.0.144",
4
4
  "description": "Fleetbo CLI - Build native mobile apps with React",
5
5
  "author": "Fleetbo",
6
6
  "license": "MIT",