fleetbo-cockpit-cli 1.0.44 → 1.0.45
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 +72 -50
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -144,28 +144,49 @@ const showEnergyTransfer = async () => {
|
|
|
144
144
|
process.stdout.write('\n');
|
|
145
145
|
};
|
|
146
146
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
'erreur', 'error', 'fail', 'plante', 'problème'
|
|
153
|
-
];
|
|
154
|
-
const lower = text.toLowerCase();
|
|
155
|
-
return keywords.some(k => lower.includes(k));
|
|
147
|
+
// Détecte TOUS les mots en PascalCase (ex: GuestCreator, CameraModule, Tab2)
|
|
148
|
+
const extractPotentialModules = (text) => {
|
|
149
|
+
const regex = /\b[A-Z][a-zA-Z0-9_]{2,}\b/g;
|
|
150
|
+
const matches = text.match(regex) || [];
|
|
151
|
+
return [...new Set(matches)]; // Dédoublonne les résultats
|
|
156
152
|
};
|
|
157
153
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
154
|
+
// 📋 INTERCEPTION : LISTER LES MODULES
|
|
155
|
+
const isListingRequest = /^(liste|list|quels modules|montre les modules)/i.test(finalPrompt);
|
|
156
|
+
if (isListingRequest) {
|
|
157
|
+
process.stdout.write(` \x1b[90m🔍 Scanning Kernel Cache...\x1b[0m\n`);
|
|
158
|
+
const cacheRes = await getModuleCache({ projectId, moduleName: null });
|
|
159
|
+
|
|
160
|
+
if (cacheRes.found !== false && cacheRes.modules) { // Modification de la condition pour matcher l'API
|
|
161
|
+
console.log(`\n\x1b[36m⚡ FLEETBO KERNEL MODULES (${cacheRes.modules.length}):\x1b[0m`);
|
|
162
|
+
cacheRes.modules.forEach(m => {
|
|
163
|
+
const metalColor = m.platform === 'android' ? '\x1b[32m' : '\x1b[34m'; // Vert Android, Bleu iOS
|
|
164
|
+
console.log(` ${metalColor}■\x1b[0m \x1b[1m${m.moduleName}\x1b[0m \x1b[90m(${m.platform})\x1b[0m`);
|
|
165
|
+
});
|
|
166
|
+
} else {
|
|
167
|
+
console.log(`\n \x1b[90mAucun module trouvé dans l'infrastructure de ce projet.\x1b[0m`);
|
|
167
168
|
}
|
|
168
|
-
|
|
169
|
+
console.log('');
|
|
170
|
+
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
171
|
+
rl.prompt();
|
|
172
|
+
return; // On arrête là, pas besoin d'appeler l'IA pour lister !
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Sert uniquement à définir le TON du contexte envoyé à Alex
|
|
176
|
+
const getContextIntent = (text) => {
|
|
177
|
+
const modifierKeywords = [
|
|
178
|
+
'modifier', 'corrige', 'ajoute', 'erreur', 'plante', 'problème', 'bug', 'change',
|
|
179
|
+
'update', 'fix', 'edit', 'error', 'fail', 'crash', 'issue', 'add'
|
|
180
|
+
];
|
|
181
|
+
const inspireKeywords = [
|
|
182
|
+
'inspire', 'base', 'comme', 'modèle', 'reference', 'reprends', 'copie',
|
|
183
|
+
'inspire', 'based on', 'model', 'reference', 'like', 'copy', 'similar'
|
|
184
|
+
];
|
|
185
|
+
|
|
186
|
+
const lower = text.toLowerCase();
|
|
187
|
+
if (modifierKeywords.some(k => lower.includes(k))) return "MODIFICATION";
|
|
188
|
+
if (inspireKeywords.some(k => lower.includes(k))) return "INSPIRATION";
|
|
189
|
+
return "REFERENCE";
|
|
169
190
|
};
|
|
170
191
|
|
|
171
192
|
const getModuleCache = async ({ projectId, moduleName }) => {
|
|
@@ -222,40 +243,41 @@ if (command === 'alex') {
|
|
|
222
243
|
console.log('\x1b[33m🧠 Alex is thinking...\x1b[0m');
|
|
223
244
|
|
|
224
245
|
try {
|
|
225
|
-
// --- DÉBUT MODIFICATION : SYSTÈME DE MÉMOIRE (CACHE) ---
|
|
246
|
+
// --- DÉBUT MODIFICATION : SYSTÈME DE MÉMOIRE (SMART CACHE SCANNER) ---
|
|
226
247
|
let contextInjection = "";
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
248
|
+
const potentialModules = extractPotentialModules(prompt);
|
|
249
|
+
let referenceFound = false;
|
|
250
|
+
|
|
251
|
+
for (const modName of potentialModules) {
|
|
252
|
+
process.stdout.write(` \x1b[90m🔍 Checking kernel cache for ${modName}...\x1b[0m`);
|
|
253
|
+
const cache = await getModuleCache({ projectId, moduleName: modName });
|
|
231
254
|
|
|
232
|
-
if (
|
|
233
|
-
process.stdout.write(`
|
|
234
|
-
const cache = await getModuleCache({ projectId, moduleName });
|
|
255
|
+
if (cache.found) {
|
|
256
|
+
process.stdout.write(` \x1b[32mFOUND METAL\x1b[0m\n`);
|
|
235
257
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
258
|
+
const intent = getContextIntent(prompt);
|
|
259
|
+
const contextTitle = intent === "MODIFICATION"
|
|
260
|
+
? "MÉTAL EXISTANT (À MODIFIER)"
|
|
261
|
+
: "MÉTAL DE RÉFÉRENCE (POUR PARITÉ DES DONNÉES)";
|
|
262
|
+
|
|
263
|
+
// ⚠️ CHANGEMENT MAJEUR : ON N'ENVOIE QUE LE CODE NATIF
|
|
264
|
+
contextInjection = `
|
|
265
|
+
|
|
266
|
+
--- CONTEXTE SOUVERAIN : ${contextTitle} (${modName}) ---
|
|
267
|
+
DOGME: Le Métal est la source de vérité absolue. Le Mock n'est qu'une illusion.
|
|
268
|
+
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.
|
|
269
|
+
|
|
270
|
+
[CODE NATIF EXISTANT]
|
|
271
|
+
${cache.module.code}
|
|
272
|
+
|
|
273
|
+
--- FIN DU CONTEXTE ---
|
|
274
|
+
`;
|
|
275
|
+
|
|
276
|
+
prompt = contextInjection + "\n\n[INSTRUCTION DU PILOTE]\n" + prompt;
|
|
277
|
+
referenceFound = true;
|
|
278
|
+
break;
|
|
279
|
+
} else {
|
|
280
|
+
process.stdout.write(` \x1b[31mNOT FOUND\x1b[0m\n`);
|
|
259
281
|
}
|
|
260
282
|
}
|
|
261
283
|
// --- FIN MODIFICATION ---
|