fleetbo-cockpit-cli 1.0.18 → 1.0.20

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 +15 -4
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -163,10 +163,6 @@ if (command === 'alex') {
163
163
  headers: { 'x-project-id': projectId }
164
164
  });
165
165
  let aiData = result.data;
166
- // --- DEBUG (À SUPPRIMER APRÈS) ---
167
- console.log('\n[DEBUG-1] typeof result.data:', typeof result.data);
168
- console.log('[DEBUG-2] first 120 chars:', JSON.stringify(result.data).substring(0, 120));
169
- // --- FIN DEBUG ---
170
166
  if (typeof aiData === 'string') {
171
167
  try { aiData = JSON.parse(aiData); } catch (_) {}
172
168
  }
@@ -181,6 +177,21 @@ if (command === 'alex') {
181
177
  if (aiData.status === 'success' || aiData.status === 'message' || aiData.status === 'complex_refusal') {
182
178
  console.log('');
183
179
  let rawMsg = aiData.message || "I'm ready.";
180
+
181
+ // 🛡️ FIX: Gemini imbrique parfois le JSON complet dans le champ "message"
182
+ // On détecte et on extrait le vrai message texte
183
+ if (typeof rawMsg === 'string' && rawMsg.trimStart().startsWith('{')) {
184
+ try {
185
+ const nested = JSON.parse(rawMsg);
186
+ if (nested && nested.message) {
187
+ rawMsg = nested.message;
188
+ // Récupérer aussi moduleData si absent du parent
189
+ if (!aiData.moduleData && nested.moduleData) {
190
+ aiData.moduleData = nested.moduleData;
191
+ }
192
+ }
193
+ } catch (_) {}
194
+ }
184
195
 
185
196
  // 🛡️ SAFETY: Si le message est un JSON stringifié ou contient du code brut,
186
197
  // on extrait uniquement la partie lisible pour le terminal.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbo-cockpit-cli",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "Fleetbo CLI - Build native mobile apps with React",
5
5
  "author": "Fleetbo",
6
6
  "license": "MIT",