fleetbo-cockpit-cli 1.0.36 → 1.0.38

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 +40 -28
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -199,7 +199,7 @@ const removeRouteFromAppJs = (moduleName) => {
199
199
 
200
200
  if (content !== originalContent) {
201
201
  fs.writeFileSync(appJsPath, content);
202
- console.log(` \x1b[32m[Unrouted]\x1b[0m ${moduleName} supprimé de App.js.`);
202
+ console.log(` \x1b[32m[Unrouted]\x1b[0m ${moduleName} removed from App.js.`);
203
203
  return true;
204
204
  }
205
205
  return false;
@@ -462,41 +462,53 @@ if (command === 'alex') {
462
462
  // --- LOGIQUE DE BUFFER MULTILIGNE ---
463
463
  let inputBuffer = ""; // La "salle d'attente" du texte
464
464
 
465
+ let isProcessing = false;
466
+ let pasteDebounceTimer = null;
467
+
465
468
  rl.on('line', async (line) => {
469
+ if (isProcessing) return; // Blocage de sécurité pendant qu'Alex forge
470
+
466
471
  const trimmedLine = line.trim();
467
472
 
468
- // 1. Sortie de session (exit/quit)
473
+ // 1. EXIT COMMANDS
469
474
  if (['exit', 'quit'].includes(trimmedLine.toLowerCase())) {
470
475
  console.log('\n\x1b[90m Alex session closed.\x1b[0m');
471
476
  rl.close();
472
477
  return;
473
478
  }
474
479
 
475
- // 2. ACCUMULATION OU VALIDATION
480
+ // 2. ACCUMULATION
476
481
  if (trimmedLine !== "") {
477
- // Si la ligne contient du texte, on l'ajoute au buffer
478
482
  inputBuffer += (inputBuffer ? "\n" : "") + line;
479
-
480
- // On change le prompt visuel pour montrer qu'on attend la suite (ligne suivante)
481
483
  rl.setPrompt(`\x1b[34m > \x1b[0m`);
482
- } else {
483
- // Si la ligne est VIDE (Touche Entrée sur une ligne vide)
484
- if (inputBuffer.trim() !== "") {
485
- // On a du texte accumulé -> On envoie tout d'un coup à Alex
484
+ }
485
+
486
+ // 3. SMART DETECTION (PASTE vs ENTER)
487
+ // On annule le timer précédent si une nouvelle ligne arrive trop vite (< 50ms)
488
+ if (pasteDebounceTimer) clearTimeout(pasteDebounceTimer);
489
+
490
+ pasteDebounceTimer = setTimeout(async () => {
491
+ // On ne déclenche la forge QUE si :
492
+ // - La dernière touche pressée était "Entrée" sur une ligne VIDE
493
+ // - ET que le buffer n'est pas vide
494
+ if (trimmedLine === "" && inputBuffer.trim() !== "") {
486
495
  const finalPrompt = inputBuffer.trim();
487
- inputBuffer = ""; // Reset du buffer pour la prochaine mission
496
+ inputBuffer = ""; // Reset immédiat
488
497
 
489
- // Remise à zéro du prompt visuel d'origine
490
498
  rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
491
499
 
492
- // Lancement unique de la forge
500
+ isProcessing = true; // Verrouille l'entrée
493
501
  await processAlexRequest(finalPrompt);
502
+ isProcessing = false; // Libère l'entrée
503
+
494
504
  console.log('');
495
505
  }
496
- }
497
-
498
- process.stdout.write('\n\x1b[F'); // Nettoyage visuel de la ligne
499
- rl.prompt();
506
+
507
+ // Rafraîchissement visuel du prompt
508
+ process.stdout.write('\n\x1b[F');
509
+ rl.prompt();
510
+
511
+ }, 50); // Pause de 50ms pour absorber les "Coller" massifs
500
512
  });
501
513
  };
502
514
 
@@ -506,46 +518,46 @@ if (command === 'alex') {
506
518
  }
507
519
 
508
520
  // ============================================
509
- // COMMAND: rm (ANNIHILATION MODULE)
521
+ // COMMAND: rm (MODULE ANNIHILATION)
510
522
  // ============================================
511
523
  else if (command === 'rm') {
512
524
  const moduleName = args[1];
513
525
  if (!moduleName) {
514
- console.error('\n\x1b[31m❌ Erreur : Nom du module requis.\x1b[0m');
526
+ console.error('\n\x1b[31m❌ Error: Module name required.\x1b[0m');
515
527
  console.log('\x1b[90mUsage: npm run fleetbo rm [ModuleName]\x1b[0m\n');
516
528
  process.exit(1);
517
529
  }
518
530
 
519
- console.log(`\n\x1b[33m🗑️ Annihilation du module : ${moduleName}...\x1b[0m`);
531
+ console.log(`\n\x1b[33m🗑️ Annihilating module: ${moduleName}...\x1b[0m`);
520
532
 
521
- // 1. Définition des chemins physiques
533
+ // 1. Define physical paths
522
534
  const ktPath = path.join(process.cwd(), 'public', 'native', 'android', `${moduleName}.kt`);
523
535
  const jsxPath = path.join(process.cwd(), 'src', 'app', 'mocks', `${moduleName}.jsx`);
524
536
 
525
537
  let actionsDone = 0;
526
538
 
527
- // 2. Suppression du Moteur (Kotlin)
539
+ // 2. Eradicate Metal Engine (Kotlin)
528
540
  if (fs.existsSync(ktPath)) {
529
541
  fs.unlinkSync(ktPath);
530
- console.log(` \x1b[32m[Deleted]\x1b[0m Fichier Métal (.kt) supprimé.`);
542
+ console.log(` \x1b[32m[Deleted]\x1b[0m Metal file (.kt) eradicated.`);
531
543
  actionsDone++;
532
544
  }
533
545
 
534
- // 3. Suppression du Jumeau Numérique (Mock JSX)
546
+ // 3. Eradicate Virtual Twin (Mock JSX)
535
547
  if (fs.existsSync(jsxPath)) {
536
548
  fs.unlinkSync(jsxPath);
537
- console.log(` \x1b[32m[Deleted]\x1b[0m Fichier Virtuel (.jsx) supprimé.`);
549
+ console.log(` \x1b[32m[Deleted]\x1b[0m Virtual Twin (.jsx) eradicated.`);
538
550
  actionsDone++;
539
551
  }
540
552
 
541
- // 4. Nettoyage du noyau (App.js)
553
+ // 4. Disinfect System Core (App.js)
542
554
  const unrouted = removeRouteFromAppJs(moduleName);
543
555
  if (unrouted) actionsDone++;
544
556
 
545
557
  if (actionsDone === 0) {
546
- console.log(`\n\x1b[31m⚠️ Aucune trace du module "${moduleName}" trouvée.\x1b[0m\n`);
558
+ console.log(`\n\x1b[31m⚠️ No trace of module "${moduleName}" found in the OS.\x1b[0m\n`);
547
559
  } else {
548
- console.log(`\n\x1b[32m✅ Module ${moduleName} éradiqué avec succès.\x1b[0m\n`);
560
+ console.log(`\n\x1b[32m✅ Module ${moduleName} successfully eradicated from the kernel.\x1b[0m\n`);
549
561
  }
550
562
  }
551
563
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbo-cockpit-cli",
3
- "version": "1.0.36",
3
+ "version": "1.0.38",
4
4
  "description": "Fleetbo CLI - Build native mobile apps with React",
5
5
  "author": "Fleetbo",
6
6
  "license": "MIT",