fleetbo-cockpit-cli 1.0.47 → 1.0.49
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.
- package/cli.js +15 -35
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -216,11 +216,10 @@ 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
|
|
222
|
+
// 📋 INTERCEPTION : LISTER LES MODULES
|
|
224
223
|
const isListingRequest = /^(liste|list|quels modules|montre les modules)/i.test(prompt);
|
|
225
224
|
if (isListingRequest) {
|
|
226
225
|
process.stdout.write(` \x1b[90m🔍 Scanning Kernel Cache...\x1b[0m\n`);
|
|
@@ -235,16 +234,15 @@ if (command === 'alex') {
|
|
|
235
234
|
} else {
|
|
236
235
|
console.log(`\n \x1b[90mAucun module trouvé dans l'infrastructure de ce projet.\x1b[0m`);
|
|
237
236
|
}
|
|
238
|
-
return;
|
|
237
|
+
return;
|
|
239
238
|
}
|
|
240
|
-
|
|
239
|
+
|
|
241
240
|
console.log('\x1b[33m🧠 Alex is thinking...\x1b[0m');
|
|
242
241
|
|
|
243
242
|
try {
|
|
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
248
|
process.stdout.write(` \x1b[90m🔍 Checking kernel cache for ${modName}...\x1b[0m`);
|
|
@@ -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,7 +360,7 @@ if (command === 'alex') {
|
|
|
381
360
|
}
|
|
382
361
|
}
|
|
383
362
|
|
|
384
|
-
// ---
|
|
363
|
+
// --- SYNCHRONISATION DU KERNEL ---
|
|
385
364
|
const depsCount = config_offload?.dependencies?.length || 0;
|
|
386
365
|
process.stdout.write(` \x1b[33m[Cloud Inject]\x1b[0m Archiving ${moduleName} to Kernel (${depsCount} libs)...`);
|
|
387
366
|
|
|
@@ -390,12 +369,12 @@ if (command === 'alex') {
|
|
|
390
369
|
projectId: projectId,
|
|
391
370
|
fileData: {
|
|
392
371
|
path: fileName,
|
|
393
|
-
moduleName: moduleName,
|
|
372
|
+
moduleName: moduleName,
|
|
394
373
|
fileName: fileName,
|
|
395
|
-
code: code,
|
|
374
|
+
code: code,
|
|
396
375
|
mockFileName: mockFileName,
|
|
397
|
-
mockCode: mockCode,
|
|
398
|
-
config_offload: config_offload || { dependencies: [], permissions: [] }
|
|
376
|
+
mockCode: mockCode,
|
|
377
|
+
config_offload: config_offload || { dependencies: [], permissions: [] }
|
|
399
378
|
}
|
|
400
379
|
});
|
|
401
380
|
process.stdout.write(` \x1b[32mOK\x1b[0m\n`);
|
|
@@ -403,7 +382,9 @@ if (command === 'alex') {
|
|
|
403
382
|
process.stdout.write(` \x1b[31mFAILED\x1b[0m\n`);
|
|
404
383
|
console.error(` ⚠️ Kernel sync failed: ${err.message}`);
|
|
405
384
|
}
|
|
406
|
-
|
|
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;
|