@snapcommit/cli 3.11.2 → 3.11.3
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.
|
@@ -391,16 +391,22 @@ const WORKFLOWS = [
|
|
|
391
391
|
`Title: ${title}`,
|
|
392
392
|
testResult ? `Tests: ${testResult}` : 'Tests: not provided',
|
|
393
393
|
]);
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
394
|
+
try {
|
|
395
|
+
const pr = await github.createPullRequest({
|
|
396
|
+
title: title || defaultTitle,
|
|
397
|
+
body: body || defaultBody,
|
|
398
|
+
});
|
|
399
|
+
ctx.recordInsight('pullRequest', `#${pr.number} ${pr.title}`);
|
|
400
|
+
ctx.recordInsight('prUrl', pr.html_url);
|
|
401
|
+
(0, ui_1.displaySuccess)('Pull request created.', [
|
|
402
|
+
`#${pr.number} ${pr.title}`,
|
|
403
|
+
pr.html_url,
|
|
404
|
+
]);
|
|
405
|
+
}
|
|
406
|
+
catch (error) {
|
|
407
|
+
ctx.recordInsight('pullRequest', 'Failed to open PR');
|
|
408
|
+
throw new Error(formatGitHubError(error));
|
|
409
|
+
}
|
|
404
410
|
},
|
|
405
411
|
},
|
|
406
412
|
],
|
|
@@ -744,3 +750,22 @@ function buildPRBody(summary, tests) {
|
|
|
744
750
|
lines.push('- [ ] Updated documentation (if needed)');
|
|
745
751
|
return lines.join('\n');
|
|
746
752
|
}
|
|
753
|
+
function formatGitHubError(error) {
|
|
754
|
+
const raw = (error?.message || String(error) || '').trim();
|
|
755
|
+
if (!raw) {
|
|
756
|
+
return 'GitHub request failed. Verify your connection with `snap github status`.';
|
|
757
|
+
}
|
|
758
|
+
if (/not connected/i.test(raw) || /github connect/i.test(raw)) {
|
|
759
|
+
return 'GitHub not connected. Run `snap github connect` and try again.';
|
|
760
|
+
}
|
|
761
|
+
if (/bad credentials/i.test(raw)) {
|
|
762
|
+
return 'GitHub authentication failed. Re-authorize with `snap github connect`.';
|
|
763
|
+
}
|
|
764
|
+
if (/not a github repository/i.test(raw)) {
|
|
765
|
+
return 'Origin remote is missing or not a GitHub repo. Add a GitHub remote and retry.';
|
|
766
|
+
}
|
|
767
|
+
if (/resource not accessible/i.test(raw)) {
|
|
768
|
+
return `${raw} — check that your GitHub user has access to this repository.`;
|
|
769
|
+
}
|
|
770
|
+
return raw;
|
|
771
|
+
}
|
|
@@ -41,6 +41,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
41
41
|
};
|
|
42
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
43
|
exports.executeCursorStyle = executeCursorStyle;
|
|
44
|
+
exports.showStatus = showStatus;
|
|
44
45
|
const chalk_1 = __importDefault(require("chalk"));
|
|
45
46
|
const fs_1 = __importDefault(require("fs"));
|
|
46
47
|
const child_process_1 = require("child_process");
|
|
@@ -19,6 +19,7 @@ exports.switchBranch = switchBranch;
|
|
|
19
19
|
exports.mergeBranch = mergeBranch;
|
|
20
20
|
exports.showLog = showLog;
|
|
21
21
|
exports.showDiff = showDiff;
|
|
22
|
+
exports.showDiffForFile = showDiffForFile;
|
|
22
23
|
const child_process_1 = require("child_process");
|
|
23
24
|
const chalk_1 = __importDefault(require("chalk"));
|
|
24
25
|
const readline_1 = __importDefault(require("readline"));
|
|
@@ -294,6 +295,21 @@ function showDiff(cached = false) {
|
|
|
294
295
|
console.log(chalk_1.default.red(`\n❌ Failed to show diff: ${error.message}\n`));
|
|
295
296
|
}
|
|
296
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* Show diff for a specific file
|
|
300
|
+
*/
|
|
301
|
+
function showDiffForFile(filePath, cached = false) {
|
|
302
|
+
try {
|
|
303
|
+
const flag = cached ? '--cached' : '';
|
|
304
|
+
const escapedPath = escapeFilePath(filePath.trim());
|
|
305
|
+
console.log(chalk_1.default.bold(`\n📄 Changes in ${filePath.trim()}:\n`));
|
|
306
|
+
(0, child_process_1.execSync)(`git diff ${flag} -- "${escapedPath}"`, { stdio: 'inherit' });
|
|
307
|
+
console.log('');
|
|
308
|
+
}
|
|
309
|
+
catch (error) {
|
|
310
|
+
console.log(chalk_1.default.red(`\n❌ Failed to show diff for ${filePath.trim()}: ${error.message}\n`));
|
|
311
|
+
}
|
|
312
|
+
}
|
|
297
313
|
/**
|
|
298
314
|
* Helper: Confirm action
|
|
299
315
|
*/
|
|
@@ -309,3 +325,6 @@ async function confirmAction(message) {
|
|
|
309
325
|
});
|
|
310
326
|
});
|
|
311
327
|
}
|
|
328
|
+
function escapeFilePath(path) {
|
|
329
|
+
return path.replace(/(["\\$`])/g, '\\$1');
|
|
330
|
+
}
|
package/dist/commands/stats.js
CHANGED
|
@@ -88,6 +88,7 @@ function formatEventLabel(eventId) {
|
|
|
88
88
|
const table = {
|
|
89
89
|
'autopilot:conflict-crusher': 'Autopilot – Conflict Crusher',
|
|
90
90
|
'autopilot:release-ready': 'Autopilot – Release Ready',
|
|
91
|
+
'autopilot:pr-polish': 'Autopilot – PR Polish',
|
|
91
92
|
'commit:interactive': 'Interactive AI commits',
|
|
92
93
|
'commit:quick': 'Quick commits',
|
|
93
94
|
'conflict:auto': 'AI conflict resolution',
|
package/dist/repl/interpreter.js
CHANGED
|
@@ -210,13 +210,12 @@ async function tryQuickCommands(input, context) {
|
|
|
210
210
|
// Status commands
|
|
211
211
|
if (lower === 'status' || lower === 'show status' || lower === 'what changed') {
|
|
212
212
|
try {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
console.log('');
|
|
213
|
+
const { showStatus } = await Promise.resolve().then(() => __importStar(require('../commands/cursor-style')));
|
|
214
|
+
await showStatus();
|
|
216
215
|
return true;
|
|
217
216
|
}
|
|
218
217
|
catch (error) {
|
|
219
|
-
console.log(chalk_1.default.red(
|
|
218
|
+
console.log(chalk_1.default.red(`\n❌ Failed to get status: ${error.message}\n`));
|
|
220
219
|
return true;
|
|
221
220
|
}
|
|
222
221
|
}
|
|
@@ -345,7 +344,23 @@ async function tryQuickCommands(input, context) {
|
|
|
345
344
|
gitAdvanced.showLog();
|
|
346
345
|
return true;
|
|
347
346
|
}
|
|
348
|
-
// Git Advanced: Show diff
|
|
347
|
+
// Git Advanced: Show diff for specific file
|
|
348
|
+
const diffFileMatch = input.match(/(?:show|what).*(?:diff|changed).*(?:in|for|of)\s+(.+)/i) ||
|
|
349
|
+
input.match(/show diff (?:for|of|on)\s+(.+)/i) ||
|
|
350
|
+
input.match(/diff (?:for|of|on)\s+(.+)/i);
|
|
351
|
+
if (diffFileMatch) {
|
|
352
|
+
const raw = diffFileMatch[1]
|
|
353
|
+
.trim()
|
|
354
|
+
.replace(/^the\s+/i, '')
|
|
355
|
+
.replace(/^(file|files)\s+/i, '')
|
|
356
|
+
.replace(/\s+please$/i, '')
|
|
357
|
+
.replace(/[?]+$/g, '');
|
|
358
|
+
if (raw.length > 0) {
|
|
359
|
+
gitAdvanced.showDiffForFile(raw);
|
|
360
|
+
return true;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
// Git Advanced: Show diff (general)
|
|
349
364
|
if (lower === 'diff' || lower === 'show diff' || lower === 'what changed' || lower === 'changes') {
|
|
350
365
|
gitAdvanced.showDiff();
|
|
351
366
|
return true;
|