fleetbo-cockpit-cli 1.0.212 → 1.0.213

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 +38 -3
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -496,9 +496,44 @@ if (command === 'alex') {
496
496
  rawMsg = rawMsg.message || rawMsg.text || "Module generated.";
497
497
  }
498
498
 
499
- // On supprime le wrapText(85)
500
- // On laisse Xterm.js et le FitAddon utiliser 100% de la largeur du panneau !
501
- console.log('\x1b[32mAlex ❯\x1b[0m ' + rawMsg);
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
502
+
503
+ const wrapDynamic = (text, max) => {
504
+ 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
+
508
+ const words = line.split(' ');
509
+ let wrapped = [];
510
+ let currentLine = '';
511
+
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)
515
+ const spaceNeeded = currentLine.length > 0 ? 1 : 0;
516
+
517
+ 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;
521
+ } else {
522
+ // Il y a de la place : on ajoute le mot à la ligne courante
523
+ currentLine += (spaceNeeded ? ' ' : '') + word;
524
+ }
525
+ });
526
+
527
+ // On n'oublie pas d'ajouter la toute dernière ligne
528
+ if (currentLine) wrapped.push(currentLine);
529
+
530
+ return wrapped.join('\n');
531
+ }).join('\n');
532
+ };
533
+
534
+ const formattedMsg = wrapDynamic(rawMsg, maxWidth);
535
+
536
+ console.log('\x1b[32mAlex ❯\x1b[0m \n' + formattedMsg);
502
537
  }
503
538
 
504
539
  // --- FILE CREATION LOGIC ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbo-cockpit-cli",
3
- "version": "1.0.212",
3
+ "version": "1.0.213",
4
4
  "description": "Fleetbo CLI - Build native mobile apps with React",
5
5
  "author": "Fleetbo",
6
6
  "license": "MIT",