@snapcommit/cli 3.9.3 → 3.9.5
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.
|
@@ -324,8 +324,10 @@ async function executeCommitWithAI(intent) {
|
|
|
324
324
|
console.log(chalk_1.default.red(`\n❌ Commit failed: ${error.message}\n`));
|
|
325
325
|
return;
|
|
326
326
|
}
|
|
327
|
-
// Push if requested
|
|
328
|
-
const shouldPush = intent.shouldPush ||
|
|
327
|
+
// Push if requested (always push when user says "push", even if AI action is "commit")
|
|
328
|
+
const shouldPush = intent.shouldPush ||
|
|
329
|
+
intent.action === 'push' ||
|
|
330
|
+
intent.gitCommands?.some((cmd) => cmd.includes('push'));
|
|
329
331
|
if (shouldPush) {
|
|
330
332
|
// STEP 1: Pull first to avoid conflicts (like Cursor does!)
|
|
331
333
|
try {
|
|
@@ -396,6 +398,19 @@ async function executeCommitWithAI(intent) {
|
|
|
396
398
|
}
|
|
397
399
|
catch (pushError) {
|
|
398
400
|
const errorMsg = pushError.message.toLowerCase();
|
|
401
|
+
// Auto-fix: No upstream branch - set it automatically!
|
|
402
|
+
if (errorMsg.includes('no upstream') || errorMsg.includes('has no upstream branch')) {
|
|
403
|
+
console.log(chalk_1.default.blue('⚡ Setting upstream branch...'));
|
|
404
|
+
try {
|
|
405
|
+
const currentBranch = (0, child_process_1.execSync)('git rev-parse --abbrev-ref HEAD', { encoding: 'utf-8' }).trim();
|
|
406
|
+
(0, child_process_1.execSync)(`git push --set-upstream origin ${currentBranch}`, { encoding: 'utf-8', stdio: 'pipe' });
|
|
407
|
+
console.log(chalk_1.default.green('✓ Pushed and set upstream\n'));
|
|
408
|
+
}
|
|
409
|
+
catch (upstreamError) {
|
|
410
|
+
console.log(chalk_1.default.red(`\n❌ Failed to set upstream: ${upstreamError.message}\n`));
|
|
411
|
+
}
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
399
414
|
if (errorMsg.includes('no configured push destination')) {
|
|
400
415
|
console.log(chalk_1.default.gray('✓ Committed locally (no remote)\n'));
|
|
401
416
|
}
|