fleetbo-cockpit-cli 1.0.213 → 1.0.215

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 +26 -17
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -496,44 +496,53 @@ if (command === 'alex') {
496
496
  rawMsg = rawMsg.message || rawMsg.text || "Module generated.";
497
497
  }
498
498
 
499
- // LE SYSTÈME DE WRAP INTELLIGENT (Garantit les mots entiers !)
500
- const termWidth = process.stdout.columns || 100;
501
- const maxWidth = Math.max(20, Math.floor(termWidth * 0.90)); // Prend 90% de la largeur
499
+ // 🟢 LE SYSTÈME DE WRAP ANTI-COUPURE (Ultra Robuste)
500
+ // 1. On récupère la vraie largeur, ou 80 par défaut (standard des terminaux)
501
+ const termWidth = process.stdout.columns || 80;
502
+ // 2. On prend 85% de l'espace pour un confort de lecture optimal
503
+ const maxWidth = Math.max(40, Math.floor(termWidth * 0.85));
502
504
 
503
505
  const wrapDynamic = (text, max) => {
504
506
  return text.split('\n').map(line => {
505
- // On ne casse pas l'indentation du code ou des listes
506
- if (/^[\s]*[-*•\d]/.test(line) || line.startsWith(" ")) return line;
507
+ // On ignore les lignes de code, les listes, ou les lignes déjà courtes
508
+ if (/^[\s]*[-*•\d]/.test(line) || line.startsWith(" ") || line.length <= max) {
509
+ return line;
510
+ }
507
511
 
508
512
  const words = line.split(' ');
509
513
  let wrapped = [];
510
514
  let currentLine = '';
511
515
 
512
- words.forEach(word => {
513
- // On vérifie si l'ajout du mot va dépasser la limite
514
- // (+1 pour simuler l'espace, sauf si c'est le 1er mot de la ligne)
516
+ for (let i = 0; i < words.length; i++) {
517
+ const word = words[i];
518
+
519
+ // Sécurité : Si un mot est IMMENSE (ex: un long lien HTTP), on le force sur sa propre ligne
520
+ if (word.length > max) {
521
+ if (currentLine) wrapped.push(currentLine);
522
+ wrapped.push(word);
523
+ currentLine = '';
524
+ continue;
525
+ }
526
+
515
527
  const spaceNeeded = currentLine.length > 0 ? 1 : 0;
516
528
 
529
+ // Est-ce que le mot rentre sur la ligne courante ?
517
530
  if (currentLine.length + word.length + spaceNeeded > max) {
518
- // Limite atteinte : on sauvegarde la ligne terminée et on met le mot sur la nouvelle
519
- if (currentLine) wrapped.push(currentLine);
520
- currentLine = word;
531
+ wrapped.push(currentLine); // Non -> on sauvegarde la ligne
532
+ currentLine = word; // On commence une nouvelle ligne avec ce mot
521
533
  } else {
522
- // Il y a de la place : on ajoute le mot à la ligne courante
523
- currentLine += (spaceNeeded ? ' ' : '') + word;
534
+ currentLine += (spaceNeeded ? ' ' : '') + word; // Oui -> on l'ajoute
524
535
  }
525
- });
536
+ }
526
537
 
527
- // On n'oublie pas d'ajouter la toute dernière ligne
528
538
  if (currentLine) wrapped.push(currentLine);
529
-
530
539
  return wrapped.join('\n');
531
540
  }).join('\n');
532
541
  };
533
542
 
534
543
  const formattedMsg = wrapDynamic(rawMsg, maxWidth);
535
544
 
536
- console.log('\x1b[32mAlex ❯\x1b[0m \n' + formattedMsg);
545
+ console.log('\x1b[32mAlex ❯\x1b[0m ' + formattedMsg);
537
546
  }
538
547
 
539
548
  // --- FILE CREATION LOGIC ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbo-cockpit-cli",
3
- "version": "1.0.213",
3
+ "version": "1.0.215",
4
4
  "description": "Fleetbo CLI - Build native mobile apps with React",
5
5
  "author": "Fleetbo",
6
6
  "license": "MIT",