@snapcommit/cli 3.8.24 → 3.8.25
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.
|
@@ -134,8 +134,31 @@ async function showStatus() {
|
|
|
134
134
|
async function executeCommitWithAI(intent) {
|
|
135
135
|
const status = (0, git_1.getGitStatus)();
|
|
136
136
|
const hasChanges = status.staged > 0 || status.unstaged > 0 || status.untracked > 0;
|
|
137
|
-
if (
|
|
138
|
-
|
|
137
|
+
// Check if there are unpushed commits (even if working tree is clean)
|
|
138
|
+
let hasUnpushedCommits = false;
|
|
139
|
+
try {
|
|
140
|
+
const unpushed = (0, child_process_1.execSync)('git log @{u}.. --oneline 2>/dev/null || echo ""', { encoding: 'utf-8' }).trim();
|
|
141
|
+
hasUnpushedCommits = unpushed.length > 0;
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
// No upstream or other error - assume we need to push
|
|
145
|
+
hasUnpushedCommits = true;
|
|
146
|
+
}
|
|
147
|
+
// If no changes AND no unpushed commits, nothing to do
|
|
148
|
+
if (!hasChanges && !hasUnpushedCommits) {
|
|
149
|
+
console.log(chalk_1.default.gray('\n✓ Branch clean - nothing to commit or push\n'));
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
// If no changes but there are unpushed commits, just push
|
|
153
|
+
if (!hasChanges && hasUnpushedCommits) {
|
|
154
|
+
console.log(chalk_1.default.blue('\n🔄 Pushing unpushed commits...\n'));
|
|
155
|
+
try {
|
|
156
|
+
(0, child_process_1.execSync)('git push', { encoding: 'utf-8', stdio: 'inherit' });
|
|
157
|
+
console.log(chalk_1.default.green('\n✓ Pushed successfully\n'));
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
console.log(chalk_1.default.red(`\n❌ Push failed: ${error.message}\n`));
|
|
161
|
+
}
|
|
139
162
|
return;
|
|
140
163
|
}
|
|
141
164
|
// Count files
|