@snapcommit/cli 3.0.0 ā 3.0.1
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.
- package/dist/commands/cursor-style.js +18 -2
- package/dist/lib/github.js +6 -12
- package/package.json +1 -1
|
@@ -302,8 +302,24 @@ async function executeGitHubCommand(intent) {
|
|
|
302
302
|
break;
|
|
303
303
|
case 'ci_check':
|
|
304
304
|
console.log(chalk_1.default.blue('\nš Checking CI status...'));
|
|
305
|
-
|
|
306
|
-
|
|
305
|
+
try {
|
|
306
|
+
const ciStatus = await github.getCommitStatus();
|
|
307
|
+
const state = ciStatus.status.state;
|
|
308
|
+
const totalChecks = ciStatus.checks.length;
|
|
309
|
+
const failedChecks = ciStatus.checks.filter((c) => c.conclusion === 'failure').length;
|
|
310
|
+
if (state === 'success' || (totalChecks > 0 && failedChecks === 0)) {
|
|
311
|
+
console.log(chalk_1.default.green(`ā All checks passed (${totalChecks} checks)\n`));
|
|
312
|
+
}
|
|
313
|
+
else if (state === 'pending') {
|
|
314
|
+
console.log(chalk_1.default.yellow(`ā³ Checks running (${totalChecks} checks)\n`));
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
console.log(chalk_1.default.red(`ā ${failedChecks}/${totalChecks} checks failed\n`));
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
catch (error) {
|
|
321
|
+
console.log(chalk_1.default.gray(' No CI checks found\n'));
|
|
322
|
+
}
|
|
307
323
|
break;
|
|
308
324
|
case 'issue_create':
|
|
309
325
|
console.log(chalk_1.default.blue('\nš Creating issue...'));
|
package/dist/lib/github.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getCurrentRepo = getCurrentRepo;
|
|
7
4
|
exports.getCurrentBranch = getCurrentBranch;
|
|
@@ -18,12 +15,8 @@ exports.closeIssue = closeIssue;
|
|
|
18
15
|
exports.createRelease = createRelease;
|
|
19
16
|
exports.getRepoInfo = getRepoInfo;
|
|
20
17
|
const child_process_1 = require("child_process");
|
|
21
|
-
const
|
|
22
|
-
const GITHUB_TOKEN = process.env.GITHUB_TOKEN;
|
|
18
|
+
const github_connect_1 = require("../commands/github-connect");
|
|
23
19
|
const GITHUB_API = 'https://api.github.com';
|
|
24
|
-
if (!GITHUB_TOKEN) {
|
|
25
|
-
console.warn(chalk_1.default.yellow('ā ļø GitHub token not found. GitHub features will be disabled.'));
|
|
26
|
-
}
|
|
27
20
|
/**
|
|
28
21
|
* Get current repository info from git remote
|
|
29
22
|
*/
|
|
@@ -64,15 +57,16 @@ function getCurrentBranch() {
|
|
|
64
57
|
}
|
|
65
58
|
}
|
|
66
59
|
/**
|
|
67
|
-
* GitHub API request helper
|
|
60
|
+
* GitHub API request helper - uses locally stored token
|
|
68
61
|
*/
|
|
69
62
|
async function githubRequest(endpoint, options = {}) {
|
|
70
|
-
|
|
71
|
-
|
|
63
|
+
const token = (0, github_connect_1.getGitHubToken)();
|
|
64
|
+
if (!token) {
|
|
65
|
+
throw new Error('GitHub not connected. Run: snap github connect');
|
|
72
66
|
}
|
|
73
67
|
const url = `${GITHUB_API}${endpoint}`;
|
|
74
68
|
const headers = {
|
|
75
|
-
Authorization: `Bearer ${
|
|
69
|
+
Authorization: `Bearer ${token}`,
|
|
76
70
|
Accept: 'application/vnd.github+json',
|
|
77
71
|
'X-GitHub-Api-Version': '2022-11-28',
|
|
78
72
|
'Content-Type': 'application/json',
|