fleetbo-cockpit-cli 1.0.46 → 1.0.47
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 +21 -22
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -151,26 +151,6 @@ const extractPotentialModules = (text) => {
|
|
|
151
151
|
return [...new Set(matches)]; // Dédoublonne les résultats
|
|
152
152
|
};
|
|
153
153
|
|
|
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`);
|
|
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
154
|
|
|
175
155
|
// Sert uniquement à définir le TON du contexte envoyé à Alex
|
|
176
156
|
const getContextIntent = (text) => {
|
|
@@ -191,10 +171,10 @@ const getContextIntent = (text) => {
|
|
|
191
171
|
|
|
192
172
|
const getModuleCache = async ({ projectId, moduleName }) => {
|
|
193
173
|
try {
|
|
194
|
-
if (!moduleName) return { found: false };
|
|
195
174
|
const res = await axios.post(CACHE_URL, { projectId, moduleName });
|
|
196
175
|
if (res.data && res.data.found) {
|
|
197
|
-
|
|
176
|
+
// On renvoie à la fois "module" (pour un seul) et "modules" (pour la liste)
|
|
177
|
+
return { found: true, module: res.data.module, modules: res.data.modules };
|
|
198
178
|
}
|
|
199
179
|
return { found: false };
|
|
200
180
|
} catch (e) {
|
|
@@ -239,6 +219,25 @@ if (command === 'alex') {
|
|
|
239
219
|
console.log('\x1b[90mAlex prefers concise instructions. Please summarize.\x1b[0m');
|
|
240
220
|
return;
|
|
241
221
|
}
|
|
222
|
+
|
|
223
|
+
// 📋 INTERCEPTION : LISTER LES MODULES (Maintenant dans un bloc Async sécurisé !)
|
|
224
|
+
const isListingRequest = /^(liste|list|quels modules|montre les modules)/i.test(prompt);
|
|
225
|
+
if (isListingRequest) {
|
|
226
|
+
process.stdout.write(` \x1b[90m🔍 Scanning Kernel Cache...\x1b[0m\n`);
|
|
227
|
+
const cacheRes = await getModuleCache({ projectId, moduleName: null });
|
|
228
|
+
|
|
229
|
+
if (cacheRes.found !== false && cacheRes.modules && cacheRes.modules.length > 0) {
|
|
230
|
+
console.log(`\n\x1b[36m⚡ FLEETBO KERNEL MODULES (${cacheRes.modules.length}):\x1b[0m`);
|
|
231
|
+
cacheRes.modules.forEach(m => {
|
|
232
|
+
const metalColor = m.platform === 'android' ? '\x1b[32m' : '\x1b[34m';
|
|
233
|
+
console.log(` ${metalColor}■\x1b[0m \x1b[1m${m.moduleName}\x1b[0m \x1b[90m(${m.platform})\x1b[0m`);
|
|
234
|
+
});
|
|
235
|
+
} else {
|
|
236
|
+
console.log(`\n \x1b[90mAucun module trouvé dans l'infrastructure de ce projet.\x1b[0m`);
|
|
237
|
+
}
|
|
238
|
+
return; // 🛑 On arrête l'exécution ici, on ne gaspille pas le quota d'Alex
|
|
239
|
+
}
|
|
240
|
+
|
|
242
241
|
console.log('\x1b[33m🧠 Alex is thinking...\x1b[0m');
|
|
243
242
|
|
|
244
243
|
try {
|