fleetbo-cockpit-cli 1.0.99 → 1.0.101

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 +28 -12
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -295,30 +295,46 @@ if (command === 'alex') {
295
295
  modName = modName.replace('Schema', '');
296
296
  }
297
297
 
298
- process.stdout.write(` \x1b[90m🔍 Checking OS cache for ${modName}...\x1b[0m`);
298
+ process.stdout.write(` \x1b[90m🔍 Checking OS cache & local files for ${modName}...\x1b[0m`);
299
299
  const cache = await getModuleCache({ projectId, moduleName: modName });
300
300
 
301
- if (cache.found) {
302
- process.stdout.write(` \x1b[32mFOUND METAL\x1b[0m\n`);
301
+ // 💡 LECTURE LOCALE DU VRAI CODE KOTLIN (La Vérité Absolue)
302
+ const localKtPath = path.join(process.cwd(), 'public', 'native', 'android', `${modName}.kt`);
303
+ let actualMetalCode = "";
304
+
305
+ if (fs.existsSync(localKtPath)) {
306
+ actualMetalCode = fs.readFileSync(localKtPath, 'utf8');
307
+ } else if (cache.found && cache.module.code) {
308
+ actualMetalCode = cache.module.code; // Fallback sur le cache si le fichier local n'est pas trouvé
309
+ }
310
+
311
+ if (actualMetalCode) {
312
+ const sourceText = fs.existsSync(localKtPath) ? "LOCAL" : "CACHE";
313
+ process.stdout.write(` \x1b[32mFOUND METAL (${sourceText})\x1b[0m\n`);
303
314
 
304
- // NOUVEAU BLOC : INJECTION DE LA DOUBLE MÉMOIRE
315
+ // Extraction des schémas mémoires (uniquement dispo dans le cache cloud)
305
316
  let memoryScript = "";
306
- if (cache.module.dataSchema) memoryScript += `\n[SCRIPT MÉMOIRE DONNÉES]\n${cache.module.dataSchema}\n`;
307
- if (cache.module.uiSchema) memoryScript += `\n[SCRIPT MÉMOIRE UI NATIF]\n${cache.module.uiSchema}\n`;
317
+ if (cache.found && cache.module.dataSchema) memoryScript += `\n[SCRIPT MÉMOIRE DONNÉES]\n${cache.module.dataSchema}\n`;
318
+ if (cache.found && cache.module.uiSchema) memoryScript += `\n[SCRIPT MÉMOIRE UI NATIF]\n${cache.module.uiSchema}\n`;
308
319
 
309
320
  if (!memoryScript) memoryScript = `\n[SCRIPT MÉMOIRE DU MODULE ${modName}]\nAucun schéma enregistré pour ce module.\n`;
310
321
 
322
+ // 🤖 PRÉ-ANALYSE DÉTERMINISTE DU CLI (Le bouclier anti-amnésie d'Alex)
323
+ const isTabModule = actualMetalCode.includes('action == "tab"');
324
+ const levelWarning = isTabModule
325
+ ? "\n🚨 ALERTE CRITIQUE DU SYSTÈME : Ce code natif contient 'action == \"tab\"'. Il s'agit DÉFINITIVEMENT d'un NIVEAU 5 (Fleetbo View / Sovereign Tab). Tu as l'INTERDICTION ABSOLUE de proposer Fleetbo.exec() pour ce module. Tu DOIS obligatoirement utiliser Fleetbo.openView('NomDuModule', true) dans un useEffect() pour l'intégrer, sous peine de détruire l'application.\n"
326
+ : "";
327
+
311
328
  if (isReferenceOnly) {
312
- // 🚨 CAS A : INSPIRATION (Lecture seule)
313
- referenceContexts += `\n--- CONTEXTE : MODULE DE RÉFÉRENCE (${modName}) ---\nDOGME : Ne modifie pas ce module (Lecture seule). Tu dois l'utiliser comme modèle. Aligne-toi sur ses Scripts Mémoires (Données et/ou UI) et sur son Code Natif en fonction de ce que le Pilote te demande d'imiter.\n${memoryScript}\n[CODE NATIF DE RÉFÉRENCE]\n${cache.module.code}\n`;
329
+ // 🚨 CAS A : INSPIRATION
330
+ referenceContexts += `\n--- CONTEXTE : MODULE DE RÉFÉRENCE (${modName}) ---\nDOGME : Ne modifie pas ce module. Aligne-toi sur ses Scripts Mémoires et son Code Natif.\n${memoryScript}\n[CODE NATIF DE RÉFÉRENCE]\n${actualMetalCode}\n`;
314
331
  } else if (!targetModuleContext) {
315
- // 🚨 CAS B : CIBLE PRINCIPALE (Modification)
316
- // LE MOCK EST BANI ! Le Métal est la seule source de vérité.
332
+ // 🚨 CAS B : CIBLE PRINCIPALE
317
333
  const intent = getContextIntent(prompt);
318
334
  if (intent === "MODIFICATION") {
319
- targetModuleContext = `\n--- CONTEXTE : MÉTAL EXISTANT À MODIFIER (${modName}) ---\nDOGME: Tu dois modifier ce code Natif. Ensuite, tu forgeras un Mock JSX entièrement neuf basé UNIQUEMENT sur ton nouveau code Natif.\n${memoryScript}\n[CODE NATIF EXISTANT]\n${cache.module.code}\n--- FIN DU CONTEXTE ---\n`;
335
+ targetModuleContext = `\n--- CONTEXTE : MÉTAL EXISTANT À MODIFIER (${modName}) ---\nDOGME: Tu dois modifier ce code Natif. Ensuite, tu forgeras un Mock JSX neuf basé UNIQUEMENT sur ton nouveau code Natif.${levelWarning}\n${memoryScript}\n[CODE NATIF EXISTANT]\n${actualMetalCode}\n--- FIN DU CONTEXTE ---\n`;
320
336
  } else {
321
- targetModuleContext = `\n--- CONTEXTE : BASE DE TRAVAIL (${modName}) ---\n${memoryScript}\n`;
337
+ targetModuleContext = `\n--- CONTEXTE : LECTURE SEULE (${modName}) ---\nPour information, voici l'état actuel du module. Ne le modifie pas, utilise-le pour répondre précisément au Pilote.${levelWarning}\n${memoryScript}\n[CODE NATIF]\n${actualMetalCode}\n`;
322
338
  }
323
339
  }
324
340
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbo-cockpit-cli",
3
- "version": "1.0.99",
3
+ "version": "1.0.101",
4
4
  "description": "Fleetbo CLI - Build native mobile apps with React",
5
5
  "author": "Fleetbo",
6
6
  "license": "MIT",