fleetbo-cockpit-cli 1.0.48 → 1.0.50

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 +21 -41
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -216,26 +216,25 @@ if (command === 'alex') {
216
216
  const processAlexRequest = async (prompt) => {
217
217
  if (prompt.length > 1000) {
218
218
  console.log('\n\x1b[31m⛔ [Alex Safety] Request too long (' + prompt.length + '/1000 chars).\x1b[0m');
219
- console.log('\x1b[90mAlex prefers concise instructions. Please summarize.\x1b[0m');
220
219
  return;
221
220
  }
222
221
 
223
- // 📋 INTERCEPTION : LISTER LES MODULES (Maintenant dans un bloc Async sécurisé !)
222
+ // 📋 INTERCEPTION : LISTER LES MODULES
224
223
  const isListingRequest = /^(liste|list|quels modules|montre les modules)/i.test(prompt);
225
224
  if (isListingRequest) {
226
- process.stdout.write(` \x1b[90m🔍 Scanning Kernel Cache...\x1b[0m\n`);
225
+ process.stdout.write(` \x1b[90m🔍 Scanning OS Cache...\x1b[0m\n`);
227
226
  const cacheRes = await getModuleCache({ projectId, moduleName: null });
228
227
 
229
228
  if (cacheRes.found !== false && cacheRes.modules && cacheRes.modules.length > 0) {
230
- console.log(`\n\x1b[36m⚡ FLEETBO KERNEL MODULES (${cacheRes.modules.length}):\x1b[0m`);
229
+ console.log(`\n\x1b[36m⚡ FLEETBO OS MODULES (${cacheRes.modules.length}):\x1b[0m`);
231
230
  cacheRes.modules.forEach(m => {
232
231
  const metalColor = m.platform === 'android' ? '\x1b[32m' : '\x1b[34m';
233
232
  console.log(` ${metalColor}■\x1b[0m \x1b[1m${m.moduleName}\x1b[0m \x1b[90m(${m.platform})\x1b[0m`);
234
233
  });
235
234
  } else {
236
- console.log(`\n \x1b[90mNo modules found in this project's OS.\x1b[0m`);
235
+ console.log(`\n \x1b[90mAucun module trouvé dans l'infrastructure de ce projet.\x1b[0m`);
237
236
  }
238
- return; // 🛑 On arrête l'exécution ici, on ne gaspille pas le quota d'Alex
237
+ return;
239
238
  }
240
239
 
241
240
  console.log('\x1b[33m🧠 Alex is thinking...\x1b[0m');
@@ -244,10 +243,9 @@ if (command === 'alex') {
244
243
  // --- SYSTÈME DE MÉMOIRE (SMART CACHE SCANNER) ---
245
244
  let contextInjection = "";
246
245
  const potentialModules = extractPotentialModules(prompt);
247
- let referenceFound = false;
248
246
 
249
247
  for (const modName of potentialModules) {
250
- process.stdout.write(` \x1b[90m🔍 Checking kernel cache for ${modName}...\x1b[0m`);
248
+ process.stdout.write(` \x1b[90m🔍 Checking os cache for ${modName}...\x1b[0m`);
251
249
  const cache = await getModuleCache({ projectId, moduleName: modName });
252
250
 
253
251
  if (cache.found) {
@@ -258,20 +256,9 @@ if (command === 'alex') {
258
256
  ? "MÉTAL EXISTANT (À MODIFIER)"
259
257
  : "MÉTAL DE RÉFÉRENCE (POUR PARITÉ DES DONNÉES)";
260
258
 
261
- contextInjection = `
262
-
263
- --- CONTEXTE SOUVERAIN : ${contextTitle} (${modName}) ---
264
- DOGME: Le Métal est la source de vérité absolue. Le Mock n'est qu'une illusion.
265
- Tu DOIS analyser ce code Natif pour comprendre EXACTEMENT comment les données ont été structurées, nommées (clés JSON) et sauvegardées.
266
-
267
- [CODE NATIF EXISTANT]
268
- ${cache.module.code}
269
-
270
- --- FIN DU CONTEXTE ---
271
- `;
259
+ contextInjection = `\n--- CONTEXTE SOUVERAIN : ${contextTitle} (${modName}) ---\nDOGME: Le Métal est la source de vérité absolue. Le Mock n'est qu'une illusion.\nTu DOIS analyser ce code Natif pour comprendre EXACTEMENT comment les données ont été structurées, nommées (clés JSON) et sauvegardées.\n\n[CODE NATIF EXISTANT]\n${cache.module.code}\n--- FIN DU CONTEXTE ---\n`;
272
260
 
273
261
  prompt = contextInjection + "\n\n[INSTRUCTION DU PILOTE]\n" + prompt;
274
- referenceFound = true;
275
262
  break;
276
263
  } else {
277
264
  process.stdout.write(` \x1b[31mNOT FOUND\x1b[0m\n`);
@@ -309,14 +296,7 @@ if (command === 'alex') {
309
296
  aiData.moduleData = nested.moduleData;
310
297
  }
311
298
  }
312
- } catch (_) {
313
- const msgMatch = rawMsg.match(/"message"\s*:\s*"((?:[^"\\]|\\.)*)"/);
314
- if (msgMatch && msgMatch[1]) {
315
- rawMsg = msgMatch[1].replace(/\\n/g, '\n').replace(/\\"/g, '"');
316
- } else {
317
- rawMsg = "Module generated. Check files below.";
318
- }
319
- }
299
+ } catch (_) {}
320
300
  }
321
301
 
322
302
  if (typeof rawMsg === 'object') {
@@ -338,12 +318,11 @@ if (command === 'alex') {
338
318
  const tierLabel = aiData.tier === 'senior' ? 'SENIOR' : aiData.tier === 'expert' ? 'EXPERT' : 'JUNIOR';
339
319
  const percent = Math.round((remaining / limit) * 100);
340
320
  const energyColor = percent > 20 ? '\x1b[32m' : '\x1b[31m';
341
- console.log('');
342
- console.log(`\x1b[36m⚡ Architect Fuel:\x1b[0m ${energyColor}${percent}%\x1b[0m (${remaining}/${limit} instructions left) [${tierLabel}]`);
343
- console.log('');
321
+ console.log(`\n\x1b[36m⚡ Architect Fuel:\x1b[0m ${energyColor}${percent}%\x1b[0m (${remaining}/${limit} instructions left) [${tierLabel}]\n`);
344
322
  }
345
323
  }
346
324
 
325
+ // --- C'EST ICI QUE LES FICHIERS SONT CRÉÉS ---
347
326
  if (aiData.status === 'success' && aiData.moduleData) {
348
327
  const { fileName, code, mockFileName, mockCode, moduleName, instructions, config_offload } = aiData.moduleData;
349
328
  console.log(` \x1b[90m Architecting: ${moduleName}\x1b[0m`);
@@ -381,29 +360,31 @@ if (command === 'alex') {
381
360
  }
382
361
  }
383
362
 
384
- // --- CORRECTION : SYNCHRONISATION DU KERNEL (Cache + Dépendances INCONDITIONNELLE) ---
363
+ // --- SYNCHRONISATION DU KERNEL ---
385
364
  const depsCount = config_offload?.dependencies?.length || 0;
386
- process.stdout.write(` \x1b[33m[Cloud Inject]\x1b[0m Archiving ${moduleName} to Kernel (${depsCount} libs)...`);
365
+ process.stdout.write(` \x1b[33m[Cloud Inject]\x1b[0m Archiving ${moduleName} to OS (${depsCount} libs)...`);
387
366
 
388
367
  try {
389
368
  await axios.post(INJECT_DEPS_URL, {
390
369
  projectId: projectId,
391
370
  fileData: {
392
371
  path: fileName,
393
- moduleName: moduleName, // INDISPENSABLE POUR LE CACHE
372
+ moduleName: moduleName,
394
373
  fileName: fileName,
395
- code: code, // LE MÉTAL
374
+ code: code,
396
375
  mockFileName: mockFileName,
397
- mockCode: mockCode, // LE MOCK
398
- config_offload: config_offload || { dependencies: [], permissions: [] } // Sécurité
376
+ mockCode: mockCode,
377
+ config_offload: config_offload || { dependencies: [], permissions: [] }
399
378
  }
400
379
  });
401
380
  process.stdout.write(` \x1b[32mOK\x1b[0m\n`);
402
381
  } catch (err) {
403
382
  process.stdout.write(` \x1b[31mFAILED\x1b[0m\n`);
404
- console.error(` ⚠️ Kernel sync failed: ${err.message}`);
383
+ console.error(` ⚠️ OS sync failed: ${err.message}`);
405
384
  }
406
- // --- FIN CORRECTION ---
385
+ } else if (aiData.status === 'success' && !aiData.moduleData) {
386
+ // SÉCURITÉ : Si Alex s'emmêle les pinceaux et renvoie un mauvais format JSON
387
+ console.log(`\n\x1b[31m⚠️ Erreur : Alex a répondu, mais le code source n'a pas pu être extrait. Réessayez la commande.\x1b[0m\n`);
407
388
  }
408
389
  } catch (error) {
409
390
  process.stdout.write('\r' + ' '.repeat(50) + '\r');
@@ -501,7 +482,6 @@ if (command === 'alex') {
501
482
 
502
483
  if (finalPrompt.length > 1000) {
503
484
  console.log(`\n\x1b[31m⛔ [Alex Safety] Mission rejetée : Taille excessive (${finalPrompt.length}/1000 caractères).\x1b[0m`);
504
- console.log(`\x1b[90m Veuillez être plus concis et vous concentrer sur l'essentiel.\x1b[0m\n`);
505
485
  rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
506
486
  rl.prompt();
507
487
  return;
@@ -568,7 +548,7 @@ else if (command === 'rm') {
568
548
  if (actionsDone === 0) {
569
549
  console.log(`\n\x1b[31m⚠️ No trace of module "${moduleName}" found in the OS.\x1b[0m\n`);
570
550
  } else {
571
- console.log(`\n\x1b[32m✅ Module ${moduleName} successfully eradicated from the kernel.\x1b[0m\n`);
551
+ console.log(`\n\x1b[32m✅ Module ${moduleName} successfully eradicated from the OS.\x1b[0m\n`);
572
552
  }
573
553
  }
574
554
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbo-cockpit-cli",
3
- "version": "1.0.48",
3
+ "version": "1.0.50",
4
4
  "description": "Fleetbo CLI - Build native mobile apps with React",
5
5
  "author": "Fleetbo",
6
6
  "license": "MIT",