fleetbo-cockpit-cli 1.0.108 → 1.0.109

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 -57
  2. package/package.json +4 -3
package/cli.js CHANGED
@@ -12,7 +12,7 @@ const axios = require('axios');
12
12
  const dotenv = require('dotenv');
13
13
  const os = require('os');
14
14
  const archiver = require('archiver');
15
- const readline = require('readline');
15
+ // readline remplacé par @inquirer/prompts (gestion paste + single Enter)
16
16
 
17
17
  // ============================================
18
18
  // FLEETBO CLI - Centralized Package
@@ -630,72 +630,52 @@ if (command === 'alex') {
630
630
  console.log(' \x1b[32m Alex ❯\x1b[0m Describe your feature.');
631
631
  console.log('');
632
632
 
633
- const rl = readline.createInterface({
634
- input: process.stdin,
635
- output: process.stdout,
636
- prompt: `\x1b[34m${dynamicUsername} \x1b[0m`
637
- });
638
-
639
- // Active le curseur clignotant (séquence ANSI standard)
640
- process.stdout.write('\x1b[?12h');
641
- process.stdout.write('\n\x1b[F');
642
- rl.prompt();
633
+ // ── Boucle interactive avec @inquirer/prompts ──
634
+ // Soumet sur une seule Entrée, gère le paste multi-lignes correctement,
635
+ // curseur clignotant natif du terminal.
636
+ const { input } = await import('@inquirer/prompts');
643
637
 
644
- let inputBuffer = "";
645
638
  let isProcessing = false;
646
- let submitTimer = null;
647
-
648
- const submitBuffer = async () => {
649
- if (submitTimer) { clearTimeout(submitTimer); submitTimer = null; }
650
- if (isProcessing || inputBuffer.trim() === "") return;
651
639
 
652
- const finalPrompt = inputBuffer.trim();
653
- inputBuffer = "";
640
+ const runLoop = async () => {
641
+ while (true) {
642
+ let answer;
643
+ try {
644
+ answer = await input({
645
+ message: `\x1b[34m${dynamicUsername} ❯\x1b[0m`,
646
+ theme: {
647
+ prefix: '',
648
+ style: { answer: (t) => `\x1b[0m${t}` }
649
+ }
650
+ });
651
+ } catch (e) {
652
+ // Ctrl+C ou Ctrl+D
653
+ console.log('\n\x1b[90m Alex session closed.\x1b[0m');
654
+ process.exit(0);
655
+ }
654
656
 
655
- if (finalPrompt.length > 1000) {
656
- console.log(`\n\x1b[31m⛔ [Alex Safety] Mission rejected: Excessive size (${finalPrompt.length}/1000 characters).\x1b[0m`);
657
- rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
658
- rl.prompt();
659
- return;
660
- }
657
+ const trimmed = answer.trim();
661
658
 
662
- isProcessing = true;
663
- rl.setPrompt("");
664
- await processAlexRequest(finalPrompt);
665
- isProcessing = false;
659
+ if (!trimmed) continue;
666
660
 
667
- console.log('');
668
- rl.setPrompt(`\x1b[34m${dynamicUsername} \x1b[0m`);
669
- rl.prompt();
670
- };
671
-
672
- rl.on('line', async (line) => {
673
- if (isProcessing) return;
661
+ if (['exit', 'quit'].includes(trimmed.toLowerCase())) {
662
+ console.log('\n\x1b[90m Alex session closed.\x1b[0m');
663
+ process.exit(0);
664
+ }
674
665
 
675
- const trimmedLine = line.trim();
666
+ if (trimmed.length > 1000) {
667
+ console.log(`\n\x1b[31m⛔ [Alex Safety] Mission rejected: Excessive size (${trimmed.length}/1000 characters).\x1b[0m`);
668
+ continue;
669
+ }
676
670
 
677
- if (['exit', 'quit'].includes(trimmedLine.toLowerCase())) {
678
- console.log('\n\x1b[90m Alex session closed.\x1b[0m');
679
- rl.close();
680
- return;
671
+ isProcessing = true;
672
+ await processAlexRequest(trimmed);
673
+ isProcessing = false;
674
+ console.log('');
681
675
  }
676
+ };
682
677
 
683
- if (trimmedLine !== "") {
684
- // Ligne avec contenu → accumule et arme un timer de 600ms
685
- if (submitTimer) { clearTimeout(submitTimer); submitTimer = null; }
686
- inputBuffer += (inputBuffer ? "\n" : "") + line;
687
- rl.setPrompt("");
688
- submitTimer = setTimeout(() => submitBuffer(), 600);
689
- } else {
690
- // Ligne vide → soumet immédiatement si buffer non vide, sinon prompt
691
- if (inputBuffer.trim() !== "") {
692
- submitBuffer();
693
- } else {
694
- rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
695
- rl.prompt();
696
- }
697
- }
698
- });
678
+ runLoop();
699
679
  };
700
680
 
701
681
  if (!initialPrompt || initialPrompt === '?') startAlexSession();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbo-cockpit-cli",
3
- "version": "1.0.108",
3
+ "version": "1.0.109",
4
4
  "description": "Fleetbo CLI - Build native mobile apps with React",
5
5
  "author": "Fleetbo",
6
6
  "license": "MIT",
@@ -26,9 +26,10 @@
26
26
  "url": "https://github.com/FleetFleetbo/fleetbo-cockpit-cli.git"
27
27
  },
28
28
  "dependencies": {
29
+ "@inquirer/prompts": "^8.3.2",
30
+ "archiver": "^7.0.0",
29
31
  "axios": "^1.6.0",
30
- "dotenv": "^16.3.0",
31
- "archiver": "^7.0.0"
32
+ "dotenv": "^16.3.0"
32
33
  },
33
34
  "engines": {
34
35
  "node": ">=16.0.0"