@snapcommit/cli 3.9.5 ā 3.9.7
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.
|
@@ -87,7 +87,7 @@ async function handleAICommand(userInput) {
|
|
|
87
87
|
// Commit/push flow
|
|
88
88
|
if (intent.action === 'commit' || intent.action === 'push' ||
|
|
89
89
|
(intent.gitCommands && intent.gitCommands.some((cmd) => cmd.includes('commit')))) {
|
|
90
|
-
await executeCommitWithAI(intent);
|
|
90
|
+
await executeCommitWithAI(intent, userInput);
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
93
|
// Other git commands (branch, merge, etc.)
|
|
@@ -131,7 +131,7 @@ async function showStatus() {
|
|
|
131
131
|
* Execute commit - EXACTLY like Cursor!
|
|
132
132
|
* Minimal friction, one prompt, instant feel
|
|
133
133
|
*/
|
|
134
|
-
async function executeCommitWithAI(intent) {
|
|
134
|
+
async function executeCommitWithAI(intent, originalInput = '') {
|
|
135
135
|
const status = (0, git_1.getGitStatus)();
|
|
136
136
|
const hasChanges = status.staged > 0 || status.unstaged > 0 || status.untracked > 0;
|
|
137
137
|
// Check if there are unpushed commits (even if working tree is clean)
|
|
@@ -324,9 +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 (
|
|
327
|
+
// Push if requested (ALWAYS push when user says "push", even if AI just says "commit")
|
|
328
328
|
const shouldPush = intent.shouldPush ||
|
|
329
329
|
intent.action === 'push' ||
|
|
330
|
+
originalInput.toLowerCase().includes('push') ||
|
|
330
331
|
intent.gitCommands?.some((cmd) => cmd.includes('push'));
|
|
331
332
|
if (shouldPush) {
|
|
332
333
|
// STEP 1: Pull first to avoid conflicts (like Cursor does!)
|
|
@@ -1312,6 +1313,8 @@ async function getAIInterpretation(userInput, token) {
|
|
|
1312
1313
|
try {
|
|
1313
1314
|
const currentBranch = (0, git_1.getCurrentBranch)();
|
|
1314
1315
|
const status = (0, git_1.getGitStatus)();
|
|
1316
|
+
// Show loading indicator for slow AI responses
|
|
1317
|
+
console.log(chalk_1.default.blue('š¤ Understanding your command...'));
|
|
1315
1318
|
const response = await fetch('https://www.snapcommit.dev/api/ai/interpret', {
|
|
1316
1319
|
method: 'POST',
|
|
1317
1320
|
headers: { 'Content-Type': 'application/json' },
|
|
@@ -1325,6 +1328,8 @@ async function getAIInterpretation(userInput, token) {
|
|
|
1325
1328
|
remoteBranch: (0, child_process_1.execSync)('git rev-parse --abbrev-ref @{upstream} 2>/dev/null || echo ""', { encoding: 'utf-8' }).trim(),
|
|
1326
1329
|
},
|
|
1327
1330
|
}),
|
|
1331
|
+
// Increase timeout to 30 seconds for AI processing
|
|
1332
|
+
signal: AbortSignal.timeout(30000),
|
|
1328
1333
|
});
|
|
1329
1334
|
if (!response.ok) {
|
|
1330
1335
|
const errorData = await response.json().catch(() => ({ error: 'Unknown error' }));
|