fleetbo-cockpit-cli 1.0.12 → 1.0.13
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 -1
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -172,7 +172,21 @@ if (command === 'alex') {
|
|
|
172
172
|
|
|
173
173
|
if (aiData.status === 'success' || aiData.status === 'message' || aiData.status === 'complex_refusal') {
|
|
174
174
|
console.log('');
|
|
175
|
-
|
|
175
|
+
let rawMsg = aiData.message || "I'm ready.";
|
|
176
|
+
|
|
177
|
+
// 🛡️ SAFETY: Si le message est un JSON stringifié ou contient du code brut,
|
|
178
|
+
// on extrait uniquement la partie lisible pour le terminal.
|
|
179
|
+
if (typeof rawMsg === 'object') {
|
|
180
|
+
rawMsg = rawMsg.message || rawMsg.text || "Module generated.";
|
|
181
|
+
}
|
|
182
|
+
// Détection d'un JSON brut accidentellement injecté dans le message
|
|
183
|
+
try {
|
|
184
|
+
const testParse = JSON.parse(rawMsg);
|
|
185
|
+
if (testParse && typeof testParse === 'object' && testParse.status) {
|
|
186
|
+
rawMsg = testParse.message || "Module generated.";
|
|
187
|
+
}
|
|
188
|
+
} catch (_) { /* Not JSON, continue normally */ }
|
|
189
|
+
|
|
176
190
|
const formattedMsg = wrapText(rawMsg, 85);
|
|
177
191
|
console.log('\x1b[32mAlex ❯\x1b[0m ' + formattedMsg);
|
|
178
192
|
|