fleetbo-cockpit-cli 1.0.20 → 1.0.22

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 +14 -5
  2. package/package.json +2 -2
package/cli.js CHANGED
@@ -178,19 +178,28 @@ if (command === 'alex') {
178
178
  console.log('');
179
179
  let rawMsg = aiData.message || "I'm ready.";
180
180
 
181
- // 🛡️ FIX: Gemini imbrique parfois le JSON complet dans le champ "message"
182
- // On détecte et on extrait le vrai message texte
181
+ // 🛡️ FIX DÉFINITIF: Gemini imbrique parfois le JSON complet dans "message"
182
+ // Le JSON imbriqué peut être tronqué (4000 tokens), donc JSON.parse échoue.
183
+ // On extrait le vrai message par découpe de string.
183
184
  if (typeof rawMsg === 'string' && rawMsg.trimStart().startsWith('{')) {
185
+ // Tentative 1: Parse complet (JSON non tronqué)
184
186
  try {
185
187
  const nested = JSON.parse(rawMsg);
186
188
  if (nested && nested.message) {
187
189
  rawMsg = nested.message;
188
- // Récupérer aussi moduleData si absent du parent
189
190
  if (!aiData.moduleData && nested.moduleData) {
190
191
  aiData.moduleData = nested.moduleData;
191
192
  }
192
193
  }
193
- } catch (_) {}
194
+ } catch (_) {
195
+ // Tentative 2: Extraction par regex (JSON tronqué)
196
+ const msgMatch = rawMsg.match(/"message"\s*:\s*"((?:[^"\\]|\\.)*)"/);
197
+ if (msgMatch && msgMatch[1]) {
198
+ rawMsg = msgMatch[1].replace(/\\n/g, '\n').replace(/\\"/g, '"');
199
+ } else {
200
+ rawMsg = "Module generated. Check files below.";
201
+ }
202
+ }
194
203
  }
195
204
 
196
205
  // 🛡️ SAFETY: Si le message est un JSON stringifié ou contient du code brut,
@@ -259,7 +268,7 @@ if (command === 'alex') {
259
268
  }
260
269
 
261
270
  if (config_offload && (config_offload.dependencies?.length > 0 || config_offload.permissions?.length > 0)) {
262
- process.stdout.write(` \x1b[33m[Cloud Inject]\x1b[0m Syncing ${config_offload.dependencies?.length || 0} libs to Factory...`);
271
+ process.stdout.write(` \x1b[33m[Cloud Inject]\x1b[0m Syncing ${config_offload.dependencies?.length || 0} libs to Factory...`);
263
272
  try {
264
273
  await axios.post(INJECT_DEPS_URL, {
265
274
  projectId: projectId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbo-cockpit-cli",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "description": "Fleetbo CLI - Build native mobile apps with React",
5
5
  "author": "Fleetbo",
6
6
  "license": "MIT",
@@ -28,7 +28,7 @@
28
28
  "dependencies": {
29
29
  "axios": "^1.6.0",
30
30
  "dotenv": "^16.3.0",
31
- "archiver": "^6.0.0"
31
+ "archiver": "^7.0.0"
32
32
  },
33
33
  "engines": {
34
34
  "node": ">=16.0.0"