fleetbo-cockpit-cli 1.0.26 → 1.0.28

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 +31 -6
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -145,7 +145,12 @@ const showEnergyTransfer = async () => {
145
145
  };
146
146
 
147
147
  const promptContainsModification = (text) => {
148
- const keywords = ['modifier', 'update', 'change', 'corrige', 'fix', 'ajoute', 'edit', 'refactor'];
148
+ // J'ai ajouté : 'bug', 'crash', 'erreur', 'error', 'fix', 'fail', 'plante'
149
+ const keywords = [
150
+ 'modifier', 'update', 'change', 'corrige', 'fix',
151
+ 'ajoute', 'edit', 'refactor', 'bug', 'crash', 'set',
152
+ 'erreur', 'error', 'fail', 'plante', 'problème'
153
+ ];
149
154
  const lower = text.toLowerCase();
150
155
  return keywords.some(k => lower.includes(k));
151
156
  };
@@ -486,21 +491,41 @@ else if (command === 'android' || command === 'ios') {
486
491
 
487
492
  try {
488
493
  // ==========================================================
489
- // PRE-FLIGHT CHECK QUOTAS
494
+ // PRE-FLIGHT CHECK QUOTAS & TIER
490
495
  // ==========================================================
491
- process.stdout.write(`\x1b[33m[0/3]\x1b[0m Checking Propulsion Quotas... `);
496
+ process.stdout.write(`\x1b[33m[0/3]\x1b[0m Checking Propulsion Access... `);
492
497
  try {
498
+ // On envoie le signal 'x-preflight' pour tester les droits sans builder
493
499
  await axios.post(targetUrl, {}, {
494
500
  headers: {
495
501
  'x-project-id': projectId,
496
502
  'x-preflight': 'true'
497
503
  }
498
504
  });
499
- process.stdout.write(`\x1b[32mOK\x1b[0m\n\n`);
505
+ // Si ça passe (200 OK), c'est un Senior ou un Junior autorisé (si vous changez d'avis)
506
+ process.stdout.write(`\x1b[32mOK (Senior Pilot)\x1b[0m\n\n`);
507
+
500
508
  } catch (preflightError) {
501
509
  process.stdout.write(`\x1b[31mDENIED\x1b[0m\n`);
502
- if (preflightError.response && preflightError.response.data && preflightError.response.data.error) {
503
- throw new Error(preflightError.response.data.error);
510
+
511
+ const errData = preflightError.response?.data;
512
+
513
+ // 🛑 1. INTERCEPTION SPÉCIFIQUE JUNIOR
514
+ // C'est ici qu'on lit le code renvoyé par index.js
515
+ if (errData?.code === 'junior_restriction') {
516
+ console.log(`\n\x1b[31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m`);
517
+ console.log(`\x1b[31m⛔ ACCESS DENIED: JUNIOR PILOT DETECTED\x1b[0m`);
518
+ console.log(`\x1b[31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m`);
519
+ console.log(``);
520
+ console.log(` \x1b[33m This feature is locked for Junior Pilots.\x1b[0m`);
521
+ console.log(` \x1b[32m Upgrade to Senior on fleetbo.io to unlock Propulsion.\x1b[0m`);
522
+ console.log(``);
523
+ process.exit(1); // Arrêt immédiat et propre du script
524
+ }
525
+
526
+ // 2. Gestion des autres erreurs (Quota Senior dépassé, Serveur HS, etc.)
527
+ if (errData && errData.error) {
528
+ throw new Error(errData.error);
504
529
  }
505
530
  throw preflightError;
506
531
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbo-cockpit-cli",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "description": "Fleetbo CLI - Build native mobile apps with React",
5
5
  "author": "Fleetbo",
6
6
  "license": "MIT",