fleetbo-cockpit-cli 1.0.144 → 1.0.145

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 +29 -37
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -641,8 +641,7 @@ if (command === 'alex') {
641
641
 
642
642
  let inputBuffer = [];
643
643
  let isProcessing = false;
644
- let burstTimer = null;
645
- let isPastingMode = false;
644
+ let isPasteMode = false;
646
645
 
647
646
  const executePrompt = async (text) => {
648
647
  if (['exit', 'quit'].includes(text.toLowerCase())) {
@@ -670,47 +669,40 @@ if (command === 'alex') {
670
669
  }
671
670
  };
672
671
 
673
- rl.on('line', (line) => {
672
+ rl.on('line', async (line) => {
674
673
  if (isProcessing) return;
675
674
 
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);
675
+ // 1. SI LE MODE COLLAGE EST ACTIF
676
+ if (isPasteMode) {
677
+ // Dès que tu tapes EOF, on assemble tout le texte et on l'envoie à Alex
678
+ if (line.trim().toUpperCase() === "EOF") {
679
+ const finalPrompt = inputBuffer.join('\n').trim();
680
+ inputBuffer = [];
681
+ isPasteMode = false;
682
+ await executePrompt(finalPrompt);
683
+ } else {
684
+ // On accumule le texte collé silencieusement
685
+ inputBuffer.push(line);
686
+ }
682
687
  return;
683
688
  }
684
689
 
685
- // 2. ACCUMULATION
686
- inputBuffer.push(line);
687
-
688
- if (burstTimer) clearTimeout(burstTimer);
689
-
690
- // 3. ANALYSE (100ms après la dernière ligne reçue)
691
- burstTimer = setTimeout(() => {
692
- burstTimer = null;
693
-
694
- // Si on a DÉJÀ basculé en mode collage, on reste silencieux !
695
- if (isPastingMode) return;
690
+ // 2. ACTIVATION DU MODE COLLAGE
691
+ if (line.trim().toLowerCase() === "/paste") {
692
+ isPasteMode = true;
693
+ console.log('\x1b[36m [Mode Éditeur] Collez votre long texte ici. Tapez EOF sur une nouvelle ligne pour envoyer.\x1b[0m');
694
+ // On efface le prompt "jojo ❯" pour que ton code collé s'affiche parfaitement !
695
+ rl.setPrompt("");
696
+ return;
697
+ }
696
698
 
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
- }
707
- } else {
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;
712
- }
713
- }, 100);
699
+ // 3. MODE CHAT CLASSIQUE (1 Entrée = 1 Envoi)
700
+ const finalPrompt = line.trim();
701
+ if (finalPrompt === "") {
702
+ rl.prompt(); // Touche Entrée dans le vide
703
+ } else {
704
+ await executePrompt(finalPrompt); // Envoi instantané
705
+ }
714
706
  });
715
707
  };
716
708
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbo-cockpit-cli",
3
- "version": "1.0.144",
3
+ "version": "1.0.145",
4
4
  "description": "Fleetbo CLI - Build native mobile apps with React",
5
5
  "author": "Fleetbo",
6
6
  "license": "MIT",