@snapcommit/cli 3.9.2 → 3.9.4
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.
|
@@ -396,6 +396,19 @@ async function executeCommitWithAI(intent) {
|
|
|
396
396
|
}
|
|
397
397
|
catch (pushError) {
|
|
398
398
|
const errorMsg = pushError.message.toLowerCase();
|
|
399
|
+
// Auto-fix: No upstream branch - set it automatically!
|
|
400
|
+
if (errorMsg.includes('no upstream') || errorMsg.includes('has no upstream branch')) {
|
|
401
|
+
console.log(chalk_1.default.blue('⚡ Setting upstream branch...'));
|
|
402
|
+
try {
|
|
403
|
+
const currentBranch = (0, child_process_1.execSync)('git rev-parse --abbrev-ref HEAD', { encoding: 'utf-8' }).trim();
|
|
404
|
+
(0, child_process_1.execSync)(`git push --set-upstream origin ${currentBranch}`, { encoding: 'utf-8', stdio: 'pipe' });
|
|
405
|
+
console.log(chalk_1.default.green('✓ Pushed and set upstream\n'));
|
|
406
|
+
}
|
|
407
|
+
catch (upstreamError) {
|
|
408
|
+
console.log(chalk_1.default.red(`\n❌ Failed to set upstream: ${upstreamError.message}\n`));
|
|
409
|
+
}
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
399
412
|
if (errorMsg.includes('no configured push destination')) {
|
|
400
413
|
console.log(chalk_1.default.gray('✓ Committed locally (no remote)\n'));
|
|
401
414
|
}
|
|
@@ -1326,15 +1339,29 @@ async function getAIInterpretation(userInput, token) {
|
|
|
1326
1339
|
console.error(chalk_1.default.red(`\n❌ AI API Error (${response.status}):`), errorData);
|
|
1327
1340
|
return null;
|
|
1328
1341
|
}
|
|
1329
|
-
|
|
1342
|
+
let data;
|
|
1343
|
+
try {
|
|
1344
|
+
data = await response.json();
|
|
1345
|
+
}
|
|
1346
|
+
catch (parseError) {
|
|
1347
|
+
console.error(chalk_1.default.red('\n❌ JSON Parse Error:'), parseError.message);
|
|
1348
|
+
console.error(chalk_1.default.gray('Response was not valid JSON'));
|
|
1349
|
+
return null;
|
|
1350
|
+
}
|
|
1330
1351
|
// Debug: Show what AI returned
|
|
1331
1352
|
if (process.env.DEBUG === 'true') {
|
|
1332
1353
|
console.log(chalk_1.default.gray('[DEBUG] AI Response:'), JSON.stringify(data, null, 2));
|
|
1333
1354
|
}
|
|
1355
|
+
if (!data || !data.intent) {
|
|
1356
|
+
console.error(chalk_1.default.red('\n❌ Invalid AI response structure'));
|
|
1357
|
+
console.error(chalk_1.default.gray('Expected: {intent: {...}}'));
|
|
1358
|
+
console.error(chalk_1.default.gray('Got:'), JSON.stringify(data).substring(0, 200));
|
|
1359
|
+
return null;
|
|
1360
|
+
}
|
|
1334
1361
|
return data.intent;
|
|
1335
1362
|
}
|
|
1336
1363
|
catch (error) {
|
|
1337
|
-
console.error(chalk_1.default.red('\n❌ Network
|
|
1364
|
+
console.error(chalk_1.default.red('\n❌ Network Error:'), error.message);
|
|
1338
1365
|
return null;
|
|
1339
1366
|
}
|
|
1340
1367
|
}
|