@xcelera/cli 1.2.1 → 1.3.0
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/action.js +59 -18
- package/dist/action.js.map +1 -1
- package/dist/cli.js +348 -0
- package/dist/cli.js.map +1 -0
- package/package.json +9 -4
- package/.commitlintrc.json +0 -3
- package/.devcontainer/devcontainer.json +0 -41
- package/.env.example +0 -61
- package/.gitattributes +0 -3
- package/.github/dependabot.yml +0 -30
- package/.github/workflows/check-dist.yml +0 -72
- package/.github/workflows/ci.yml +0 -70
- package/.github/workflows/codeql-analysis.yml +0 -48
- package/.github/workflows/licensed.yml +0 -74
- package/.github/workflows/linter.yml +0 -53
- package/.github/workflows/release.yml +0 -53
- package/.licensed.yml +0 -18
- package/.licenses/npm/@actions/core.dep.yml +0 -20
- package/.licenses/npm/@actions/exec.dep.yml +0 -20
- package/.licenses/npm/@actions/http-client.dep.yml +0 -32
- package/.licenses/npm/@actions/io.dep.yml +0 -20
- package/.licenses/npm/@fastify/busboy.dep.yml +0 -30
- package/.licenses/npm/tunnel.dep.yml +0 -35
- package/.licenses/npm/undici.dep.yml +0 -34
- package/.markdown-lint.yml +0 -24
- package/.node-version +0 -1
- package/.nvmrc +0 -1
- package/.prettierignore +0 -5
- package/.prettierrc.yml +0 -16
- package/.vscode/launch.json +0 -15
- package/.yaml-lint.yml +0 -14
- package/CODEOWNERS +0 -7
- package/action.yml +0 -29
- package/badges/coverage.svg +0 -1
- package/eslint.config.mjs +0 -81
- package/jest.config.js +0 -40
- package/release.config.mjs +0 -12
- package/rollup.config.ts +0 -30
- package/script/release +0 -133
- package/src/action.ts +0 -35
- package/src/api.ts +0 -46
- package/src/cli.ts +0 -79
- package/src/git.ts +0 -66
- package/src/types/git.ts +0 -5
- package/src/types/parse-github-url.d.ts +0 -12
- package/tsconfig.base.json +0 -23
- package/tsconfig.eslint.json +0 -18
- package/tsconfig.json +0 -11
package/dist/cli.js
ADDED
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { parseArgs } from 'node:util';
|
|
3
|
+
import { execSync } from 'node:child_process';
|
|
4
|
+
import require$$0 from 'url';
|
|
5
|
+
|
|
6
|
+
const objectToString = Object.prototype.toString;
|
|
7
|
+
|
|
8
|
+
const isError = value => objectToString.call(value) === '[object Error]';
|
|
9
|
+
|
|
10
|
+
const errorMessages = new Set([
|
|
11
|
+
'network error', // Chrome
|
|
12
|
+
'Failed to fetch', // Chrome
|
|
13
|
+
'NetworkError when attempting to fetch resource.', // Firefox
|
|
14
|
+
'The Internet connection appears to be offline.', // Safari 16
|
|
15
|
+
'Load failed', // Safari 17+
|
|
16
|
+
'Network request failed', // `cross-fetch`
|
|
17
|
+
'fetch failed', // Undici (Node.js)
|
|
18
|
+
'terminated', // Undici (Node.js)
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
function isNetworkError(error) {
|
|
22
|
+
const isValid = error
|
|
23
|
+
&& isError(error)
|
|
24
|
+
&& error.name === 'TypeError'
|
|
25
|
+
&& typeof error.message === 'string';
|
|
26
|
+
|
|
27
|
+
if (!isValid) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// We do an extra check for Safari 17+ as it has a very generic error message.
|
|
32
|
+
// Network errors in Safari have no stack.
|
|
33
|
+
if (error.message === 'Load failed') {
|
|
34
|
+
return error.stack === undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return errorMessages.has(error.message);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function requestAudit(url, token, github) {
|
|
41
|
+
const apiUrl = `${getApiBaseUrl()}/api/v1/audit`;
|
|
42
|
+
try {
|
|
43
|
+
const response = await fetch(apiUrl, {
|
|
44
|
+
method: 'POST',
|
|
45
|
+
headers: {
|
|
46
|
+
'Content-Type': 'application/json',
|
|
47
|
+
Authorization: `Bearer ${token}`
|
|
48
|
+
},
|
|
49
|
+
body: JSON.stringify({
|
|
50
|
+
url,
|
|
51
|
+
github
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
if (!response.ok) {
|
|
55
|
+
const errorText = await response.text();
|
|
56
|
+
throw new Error(`API request failed: ${response.status} ${response.statusText} - ${errorText}`);
|
|
57
|
+
}
|
|
58
|
+
const data = await response.json();
|
|
59
|
+
return data;
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
if (isNetworkError(error)) {
|
|
63
|
+
throw new Error('Network error', { cause: error });
|
|
64
|
+
}
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function getApiBaseUrl() {
|
|
69
|
+
if (process.env.NODE_ENV === 'development') {
|
|
70
|
+
return 'http://localhost:3000';
|
|
71
|
+
}
|
|
72
|
+
return 'https://xcelera.dev';
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function getDefaultExportFromCjs (x) {
|
|
76
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/*!
|
|
80
|
+
* parse-github-url <https://github.com/jonschlinkert/parse-github-url>
|
|
81
|
+
*
|
|
82
|
+
* Copyright (c) 2015-2017, Jon Schlinkert.
|
|
83
|
+
* Released under the MIT License.
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
var parseGithubUrl$1;
|
|
87
|
+
var hasRequiredParseGithubUrl;
|
|
88
|
+
|
|
89
|
+
function requireParseGithubUrl () {
|
|
90
|
+
if (hasRequiredParseGithubUrl) return parseGithubUrl$1;
|
|
91
|
+
hasRequiredParseGithubUrl = 1;
|
|
92
|
+
|
|
93
|
+
var url = require$$0;
|
|
94
|
+
var cache = { __proto__: null };
|
|
95
|
+
|
|
96
|
+
function isChecksum(str) {
|
|
97
|
+
return (/^[a-f0-9]{40}$/i).test(str);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function getBranch(str, obj) {
|
|
101
|
+
var segs = str.split('#');
|
|
102
|
+
var branch;
|
|
103
|
+
if (segs.length > 1) {
|
|
104
|
+
branch = segs[segs.length - 1];
|
|
105
|
+
}
|
|
106
|
+
if (!branch && obj.hash && obj.hash.charAt(0) === '#') {
|
|
107
|
+
branch = obj.hash.slice(1);
|
|
108
|
+
}
|
|
109
|
+
return branch || 'master';
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function trimSlash(path) {
|
|
113
|
+
return path.charAt(0) === '/' ? path.slice(1) : path;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function name(str) {
|
|
117
|
+
return str ? str.replace(/\.git$/, '') : null;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function owner(str) {
|
|
121
|
+
if (!str) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
var idx = str.indexOf(':');
|
|
125
|
+
if (idx > -1) {
|
|
126
|
+
return str.slice(idx + 1);
|
|
127
|
+
}
|
|
128
|
+
return str;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function parse(str) {
|
|
132
|
+
if (typeof str !== 'string' || !str.length) {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (str.indexOf('git@gist') !== -1 || str.indexOf('//gist') !== -1) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// parse the URL
|
|
141
|
+
var obj = url.parse(str);
|
|
142
|
+
if (typeof obj.path !== 'string' || !obj.path.length || typeof obj.pathname !== 'string' || !obj.pathname.length) {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (!obj.host && (/^git@/).test(str) === true) {
|
|
147
|
+
// return the correct host for git@ URLs
|
|
148
|
+
obj.host = url.parse('http://' + str.replace(/git@([^:]+):/, '$1/')).host;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
obj.path = trimSlash(obj.path);
|
|
152
|
+
obj.pathname = trimSlash(obj.pathname);
|
|
153
|
+
obj.filepath = null;
|
|
154
|
+
|
|
155
|
+
if (obj.path.indexOf('repos') === 0) {
|
|
156
|
+
obj.path = obj.path.slice(6);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
var seg = obj.path.split('/').filter(Boolean);
|
|
160
|
+
var hasBlob = seg[2] === 'blob';
|
|
161
|
+
if (hasBlob && !isChecksum(seg[3])) {
|
|
162
|
+
obj.branch = seg[3];
|
|
163
|
+
if (seg.length > 4) {
|
|
164
|
+
obj.filepath = seg.slice(4).join('/');
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
var blob = str.indexOf('blob');
|
|
169
|
+
if (hasBlob && blob !== -1) {
|
|
170
|
+
obj.blob = str.slice(blob + 5);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
var hasTree = seg[2] === 'tree';
|
|
174
|
+
var tree = str.indexOf('tree');
|
|
175
|
+
if (hasTree && tree !== -1) {
|
|
176
|
+
var idx = tree + 5;
|
|
177
|
+
var branch = str.slice(idx);
|
|
178
|
+
var slash = branch.indexOf('/');
|
|
179
|
+
if (slash !== -1) {
|
|
180
|
+
branch = branch.slice(0, slash);
|
|
181
|
+
}
|
|
182
|
+
obj.branch = branch;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
obj.owner = owner(seg[0]);
|
|
186
|
+
obj.name = name(seg[1]);
|
|
187
|
+
|
|
188
|
+
if (seg.length > 1 && obj.owner && obj.name) {
|
|
189
|
+
obj.repo = obj.owner + '/' + obj.name;
|
|
190
|
+
} else {
|
|
191
|
+
var href = obj.href.split(':');
|
|
192
|
+
if (href.length === 2 && obj.href.indexOf('//') === -1) {
|
|
193
|
+
obj.repo = obj.repo || href[href.length - 1];
|
|
194
|
+
var repoSegments = obj.repo.split('/');
|
|
195
|
+
obj.owner = repoSegments[0];
|
|
196
|
+
obj.name = repoSegments[1];
|
|
197
|
+
|
|
198
|
+
} else {
|
|
199
|
+
var match = obj.href.match(/\/([^/]*)$/);
|
|
200
|
+
obj.owner = match ? match[1] : null;
|
|
201
|
+
obj.repo = null;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (obj.repo && (!obj.owner || !obj.name)) {
|
|
205
|
+
var segs = obj.repo.split('/');
|
|
206
|
+
if (segs.length === 2) {
|
|
207
|
+
obj.owner = segs[0];
|
|
208
|
+
obj.name = segs[1];
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (!obj.branch) {
|
|
214
|
+
obj.branch = seg[2] || getBranch(obj.path, obj);
|
|
215
|
+
if (seg.length > 3) {
|
|
216
|
+
obj.filepath = seg.slice(3).join('/');
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
obj.host = obj.host || 'github.com';
|
|
221
|
+
obj.owner = obj.owner || null;
|
|
222
|
+
obj.name = obj.name || null;
|
|
223
|
+
obj.repository = obj.repo;
|
|
224
|
+
return obj;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
parseGithubUrl$1 = function parseGithubUrl(str) {
|
|
228
|
+
if (!cache[str]) {
|
|
229
|
+
cache[str] = parse(str);
|
|
230
|
+
}
|
|
231
|
+
return cache[str];
|
|
232
|
+
};
|
|
233
|
+
return parseGithubUrl$1;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
var parseGithubUrlExports = requireParseGithubUrl();
|
|
237
|
+
var parseGithubUrl = /*@__PURE__*/getDefaultExportFromCjs(parseGithubUrlExports);
|
|
238
|
+
|
|
239
|
+
function inferGitContext() {
|
|
240
|
+
if (!isGitRepository()) {
|
|
241
|
+
throw new Error('Not git repository detected.');
|
|
242
|
+
}
|
|
243
|
+
const remoteUrl = getRemoteUrl();
|
|
244
|
+
const parsed = parseGithubUrl(remoteUrl);
|
|
245
|
+
if (!parsed || !parsed.owner || !parsed.repo) {
|
|
246
|
+
throw new Error(`Could not parse GitHub URL: ${remoteUrl}. Expected format: https://github.com/owner/repo or git@github.com:owner/repo`);
|
|
247
|
+
}
|
|
248
|
+
const { owner, repo } = parsed;
|
|
249
|
+
const sha = getCurrentSha();
|
|
250
|
+
// repo is parsed as owner/repo but we want to use just the repo name
|
|
251
|
+
const repoName = repo.replace(`${owner}/`, '');
|
|
252
|
+
return { owner, repo: repoName, sha };
|
|
253
|
+
}
|
|
254
|
+
function isGitRepository() {
|
|
255
|
+
try {
|
|
256
|
+
execSync('git rev-parse --git-dir', { stdio: 'ignore' });
|
|
257
|
+
return true;
|
|
258
|
+
}
|
|
259
|
+
catch {
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
function getRemoteUrl() {
|
|
264
|
+
try {
|
|
265
|
+
const remoteUrl = execSync('git remote get-url origin', {
|
|
266
|
+
encoding: 'utf8',
|
|
267
|
+
stdio: 'pipe'
|
|
268
|
+
}).trim();
|
|
269
|
+
if (!remoteUrl) {
|
|
270
|
+
throw new Error('No origin remote found');
|
|
271
|
+
}
|
|
272
|
+
return remoteUrl;
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
throw new Error('Could not determine git remote URL. Please ensure you have an origin remote configured.');
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
function getCurrentSha() {
|
|
279
|
+
try {
|
|
280
|
+
return execSync('git rev-parse HEAD', {
|
|
281
|
+
encoding: 'utf8',
|
|
282
|
+
stdio: 'pipe'
|
|
283
|
+
}).trim();
|
|
284
|
+
}
|
|
285
|
+
catch {
|
|
286
|
+
throw new Error('Could not determine current commit SHA');
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const options = {
|
|
291
|
+
url: {
|
|
292
|
+
type: 'string',
|
|
293
|
+
required: true
|
|
294
|
+
},
|
|
295
|
+
token: {
|
|
296
|
+
type: 'string',
|
|
297
|
+
required: true,
|
|
298
|
+
default: process.env.XCELERA_TOKEN
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
const { positionals, values } = parseArgs({
|
|
302
|
+
options,
|
|
303
|
+
allowPositionals: true,
|
|
304
|
+
args: process.argv.slice(2)
|
|
305
|
+
});
|
|
306
|
+
const command = positionals[0];
|
|
307
|
+
if (!command) {
|
|
308
|
+
console.error('A command is required. Only "audit" is currently supported.');
|
|
309
|
+
printHelp();
|
|
310
|
+
process.exit(1);
|
|
311
|
+
}
|
|
312
|
+
if (command === 'help') {
|
|
313
|
+
printHelp();
|
|
314
|
+
}
|
|
315
|
+
if (command !== 'audit') {
|
|
316
|
+
console.error('Invalid command. Only "audit" is currently supported.');
|
|
317
|
+
printHelp();
|
|
318
|
+
process.exit(1);
|
|
319
|
+
}
|
|
320
|
+
const { url, token } = values;
|
|
321
|
+
if (!url) {
|
|
322
|
+
console.error('URL is required. Use --url <url> to specify the URL to audit.');
|
|
323
|
+
process.exit(1);
|
|
324
|
+
}
|
|
325
|
+
if (!token) {
|
|
326
|
+
console.error('A token is required. Use --token or set XCELERA_TOKEN environment variable.');
|
|
327
|
+
process.exit(1);
|
|
328
|
+
}
|
|
329
|
+
try {
|
|
330
|
+
const githubContext = inferGitContext();
|
|
331
|
+
await requestAudit(url, token, githubContext);
|
|
332
|
+
console.log('✅ Audit scheduled successfully!');
|
|
333
|
+
}
|
|
334
|
+
catch (error) {
|
|
335
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
336
|
+
console.error(`❌ ${errorMessage}`);
|
|
337
|
+
process.exit(1);
|
|
338
|
+
}
|
|
339
|
+
function printHelp() {
|
|
340
|
+
console.log('Usage: xcelera audit --url <url> [--token <token>]');
|
|
341
|
+
console.log('');
|
|
342
|
+
console.log('Options:');
|
|
343
|
+
console.log(' --token <token> The xcelera API token to use for authentication.');
|
|
344
|
+
console.log('Can also be set with the XCELERA_TOKEN environment variable.');
|
|
345
|
+
console.log(' --url <url> The URL to audit.');
|
|
346
|
+
console.log('');
|
|
347
|
+
}
|
|
348
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sources":["../node_modules/is-network-error/index.js","../src/api.ts","../node_modules/parse-github-url/index.js","../src/git.ts","../src/cli.ts"],"sourcesContent":["const objectToString = Object.prototype.toString;\n\nconst isError = value => objectToString.call(value) === '[object Error]';\n\nconst errorMessages = new Set([\n\t'network error', // Chrome\n\t'Failed to fetch', // Chrome\n\t'NetworkError when attempting to fetch resource.', // Firefox\n\t'The Internet connection appears to be offline.', // Safari 16\n\t'Load failed', // Safari 17+\n\t'Network request failed', // `cross-fetch`\n\t'fetch failed', // Undici (Node.js)\n\t'terminated', // Undici (Node.js)\n]);\n\nexport default function isNetworkError(error) {\n\tconst isValid = error\n\t\t&& isError(error)\n\t\t&& error.name === 'TypeError'\n\t\t&& typeof error.message === 'string';\n\n\tif (!isValid) {\n\t\treturn false;\n\t}\n\n\t// We do an extra check for Safari 17+ as it has a very generic error message.\n\t// Network errors in Safari have no stack.\n\tif (error.message === 'Load failed') {\n\t\treturn error.stack === undefined;\n\t}\n\n\treturn errorMessages.has(error.message);\n}\n","import isNetworkError from 'is-network-error'\n\nimport type { GitContext } from './types/git.js'\n\nexport interface AuditResponse {\n auditId: string\n status: string\n}\n\nexport async function requestAudit(\n url: string,\n token: string,\n github: GitContext\n): Promise<AuditResponse> {\n const apiUrl = `${getApiBaseUrl()}/api/v1/audit`\n\n try {\n const response = await fetch(apiUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${token}`\n },\n body: JSON.stringify({\n url,\n github\n })\n })\n if (!response.ok) {\n const errorText = await response.text()\n throw new Error(\n `API request failed: ${response.status} ${response.statusText} - ${errorText}`\n )\n }\n\n const data = await response.json()\n return data as AuditResponse\n } catch (error) {\n if (isNetworkError(error)) {\n throw new Error('Network error', { cause: error })\n }\n throw error\n }\n}\n\nfunction getApiBaseUrl(): string {\n if (process.env.NODE_ENV === 'development') {\n return 'http://localhost:3000'\n }\n return 'https://xcelera.dev'\n}\n","/*!\n * parse-github-url <https://github.com/jonschlinkert/parse-github-url>\n *\n * Copyright (c) 2015-2017, Jon Schlinkert.\n * Released under the MIT License.\n */\n\n'use strict';\n\nvar url = require('url');\nvar cache = { __proto__: null };\n\nfunction isChecksum(str) {\n\treturn (/^[a-f0-9]{40}$/i).test(str);\n}\n\nfunction getBranch(str, obj) {\n\tvar segs = str.split('#');\n\tvar branch;\n\tif (segs.length > 1) {\n\t\tbranch = segs[segs.length - 1];\n\t}\n\tif (!branch && obj.hash && obj.hash.charAt(0) === '#') {\n\t\tbranch = obj.hash.slice(1);\n\t}\n\treturn branch || 'master';\n}\n\nfunction trimSlash(path) {\n\treturn path.charAt(0) === '/' ? path.slice(1) : path;\n}\n\nfunction name(str) {\n\treturn str ? str.replace(/\\.git$/, '') : null;\n}\n\nfunction owner(str) {\n\tif (!str) {\n\t\treturn null;\n\t}\n\tvar idx = str.indexOf(':');\n\tif (idx > -1) {\n\t\treturn str.slice(idx + 1);\n\t}\n\treturn str;\n}\n\nfunction parse(str) {\n\tif (typeof str !== 'string' || !str.length) {\n\t\treturn null;\n\t}\n\n\tif (str.indexOf('git@gist') !== -1 || str.indexOf('//gist') !== -1) {\n\t\treturn null;\n\t}\n\n\t// parse the URL\n\tvar obj = url.parse(str);\n\tif (typeof obj.path !== 'string' || !obj.path.length || typeof obj.pathname !== 'string' || !obj.pathname.length) {\n\t\treturn null;\n\t}\n\n\tif (!obj.host && (/^git@/).test(str) === true) {\n\t\t// return the correct host for git@ URLs\n\t\tobj.host = url.parse('http://' + str.replace(/git@([^:]+):/, '$1/')).host;\n\t}\n\n\tobj.path = trimSlash(obj.path);\n\tobj.pathname = trimSlash(obj.pathname);\n\tobj.filepath = null;\n\n\tif (obj.path.indexOf('repos') === 0) {\n\t\tobj.path = obj.path.slice(6);\n\t}\n\n\tvar seg = obj.path.split('/').filter(Boolean);\n\tvar hasBlob = seg[2] === 'blob';\n\tif (hasBlob && !isChecksum(seg[3])) {\n\t\tobj.branch = seg[3];\n\t\tif (seg.length > 4) {\n\t\t\tobj.filepath = seg.slice(4).join('/');\n\t\t}\n\t}\n\n\tvar blob = str.indexOf('blob');\n\tif (hasBlob && blob !== -1) {\n\t\tobj.blob = str.slice(blob + 5);\n\t}\n\n\tvar hasTree = seg[2] === 'tree';\n\tvar tree = str.indexOf('tree');\n\tif (hasTree && tree !== -1) {\n\t\tvar idx = tree + 5;\n\t\tvar branch = str.slice(idx);\n\t\tvar slash = branch.indexOf('/');\n\t\tif (slash !== -1) {\n\t\t\tbranch = branch.slice(0, slash);\n\t\t}\n\t\tobj.branch = branch;\n\t}\n\n\tobj.owner = owner(seg[0]);\n\tobj.name = name(seg[1]);\n\n\tif (seg.length > 1 && obj.owner && obj.name) {\n\t\tobj.repo = obj.owner + '/' + obj.name;\n\t} else {\n\t\tvar href = obj.href.split(':');\n\t\tif (href.length === 2 && obj.href.indexOf('//') === -1) {\n\t\t\tobj.repo = obj.repo || href[href.length - 1];\n\t\t\tvar repoSegments = obj.repo.split('/');\n\t\t\tobj.owner = repoSegments[0];\n\t\t\tobj.name = repoSegments[1];\n\n\t\t} else {\n\t\t\tvar match = obj.href.match(/\\/([^/]*)$/);\n\t\t\tobj.owner = match ? match[1] : null;\n\t\t\tobj.repo = null;\n\t\t}\n\n\t\tif (obj.repo && (!obj.owner || !obj.name)) {\n\t\t\tvar segs = obj.repo.split('/');\n\t\t\tif (segs.length === 2) {\n\t\t\t\tobj.owner = segs[0];\n\t\t\t\tobj.name = segs[1];\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!obj.branch) {\n\t\tobj.branch = seg[2] || getBranch(obj.path, obj);\n\t\tif (seg.length > 3) {\n\t\t\tobj.filepath = seg.slice(3).join('/');\n\t\t}\n\t}\n\n\tobj.host = obj.host || 'github.com';\n\tobj.owner = obj.owner || null;\n\tobj.name = obj.name || null;\n\tobj.repository = obj.repo;\n\treturn obj;\n}\n\nmodule.exports = function parseGithubUrl(str) {\n\tif (!cache[str]) {\n\t\tcache[str] = parse(str);\n\t}\n\treturn cache[str];\n};\n","import { execSync } from 'node:child_process'\nimport parseGithubUrl from 'parse-github-url'\nimport type { GitContext } from './types/git.js'\n\nexport function inferGitContext(): GitContext {\n if (!isGitRepository()) {\n throw new Error('Not git repository detected.')\n }\n\n const remoteUrl = getRemoteUrl()\n\n const parsed = parseGithubUrl(remoteUrl)\n if (!parsed || !parsed.owner || !parsed.repo) {\n throw new Error(\n `Could not parse GitHub URL: ${remoteUrl}. Expected format: https://github.com/owner/repo or git@github.com:owner/repo`\n )\n }\n\n const { owner, repo } = parsed\n\n const sha = getCurrentSha()\n\n // repo is parsed as owner/repo but we want to use just the repo name\n const repoName = repo.replace(`${owner}/`, '')\n\n return { owner, repo: repoName, sha }\n}\n\nfunction isGitRepository(): boolean {\n try {\n execSync('git rev-parse --git-dir', { stdio: 'ignore' })\n return true\n } catch {\n return false\n }\n}\n\nfunction getRemoteUrl(): string {\n try {\n const remoteUrl = execSync('git remote get-url origin', {\n encoding: 'utf8',\n stdio: 'pipe'\n }).trim()\n\n if (!remoteUrl) {\n throw new Error('No origin remote found')\n }\n\n return remoteUrl\n } catch {\n throw new Error(\n 'Could not determine git remote URL. Please ensure you have an origin remote configured.'\n )\n }\n}\n\nfunction getCurrentSha(): string {\n try {\n return execSync('git rev-parse HEAD', {\n encoding: 'utf8',\n stdio: 'pipe'\n }).trim()\n } catch {\n throw new Error('Could not determine current commit SHA')\n }\n}\n","#!/usr/bin/env node\n\nimport { parseArgs } from 'node:util'\n\nimport { requestAudit } from './api.js'\nimport { inferGitContext } from './git.js'\n\nconst options = {\n url: {\n type: 'string' as const,\n required: true\n },\n token: {\n type: 'string' as const,\n required: true,\n default: process.env.XCELERA_TOKEN\n }\n}\n\nconst { positionals, values } = parseArgs({\n options,\n allowPositionals: true,\n args: process.argv.slice(2)\n})\n\nconst command = positionals[0]\n\nif (!command) {\n console.error('A command is required. Only \"audit\" is currently supported.')\n printHelp()\n process.exit(1)\n}\n\nif (command === 'help') {\n printHelp()\n}\n\nif (command !== 'audit') {\n console.error('Invalid command. Only \"audit\" is currently supported.')\n printHelp()\n process.exit(1)\n}\n\nconst { url, token } = values\n\nif (!url) {\n console.error('URL is required. Use --url <url> to specify the URL to audit.')\n process.exit(1)\n}\n\nif (!token) {\n console.error(\n 'A token is required. Use --token or set XCELERA_TOKEN environment variable.'\n )\n process.exit(1)\n}\n\ntry {\n const githubContext = inferGitContext()\n await requestAudit(url, token, githubContext)\n console.log('✅ Audit scheduled successfully!')\n} catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'Unknown error occurred'\n console.error(`❌ ${errorMessage}`)\n process.exit(1)\n}\n\nfunction printHelp() {\n console.log('Usage: xcelera audit --url <url> [--token <token>]')\n console.log('')\n console.log('Options:')\n console.log(\n ' --token <token> The xcelera API token to use for authentication.'\n )\n console.log('Can also be set with the XCELERA_TOKEN environment variable.')\n console.log(' --url <url> The URL to audit.')\n console.log('')\n}\n"],"names":["parseGithubUrl"],"mappings":";;;;;AAAA,MAAM,cAAc,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ;;AAEhD,MAAM,OAAO,GAAG,KAAK,IAAI,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,gBAAgB;;AAExE,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;AAC9B,CAAC,eAAe;AAChB,CAAC,iBAAiB;AAClB,CAAC,iDAAiD;AAClD,CAAC,gDAAgD;AACjD,CAAC,aAAa;AACd,CAAC,wBAAwB;AACzB,CAAC,cAAc;AACf,CAAC,YAAY;AACb,CAAC,CAAC;;AAEa,SAAS,cAAc,CAAC,KAAK,EAAE;AAC9C,CAAC,MAAM,OAAO,GAAG;AACjB,KAAK,OAAO,CAAC,KAAK;AAClB,KAAK,KAAK,CAAC,IAAI,KAAK;AACpB,KAAK,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ;;AAEtC,CAAC,IAAI,CAAC,OAAO,EAAE;AACf,EAAE,OAAO,KAAK;AACd,C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era.dev",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0",
|
|
5
5
|
"author": "",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"repository": {
|
|
@@ -21,14 +21,17 @@
|
|
|
21
21
|
".": "./dist/action.js"
|
|
22
22
|
},
|
|
23
23
|
"bin": {
|
|
24
|
-
"xcelera": "
|
|
24
|
+
"xcelera": "dist/cli.js"
|
|
25
25
|
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"LICENSE",
|
|
29
|
+
"README.md"
|
|
30
|
+
],
|
|
26
31
|
"engines": {
|
|
27
32
|
"node": ">=20"
|
|
28
33
|
},
|
|
29
34
|
"scripts": {
|
|
30
|
-
"bundle": "npm run format:write && npm run package",
|
|
31
|
-
"ci-test": "NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 npx jest --passWithNoTests",
|
|
32
35
|
"coverage": "npx make-coverage-badge --output-path ./badges/coverage.svg",
|
|
33
36
|
"format:write": "npx prettier --write .",
|
|
34
37
|
"format:check": "npx prettier --check .",
|
|
@@ -42,6 +45,7 @@
|
|
|
42
45
|
"license": "MIT",
|
|
43
46
|
"dependencies": {
|
|
44
47
|
"@actions/core": "^1.11.1",
|
|
48
|
+
"is-network-error": "^1.1.0",
|
|
45
49
|
"parse-github-url": "^1.0.3"
|
|
46
50
|
},
|
|
47
51
|
"devDependencies": {
|
|
@@ -65,6 +69,7 @@
|
|
|
65
69
|
"eslint-plugin-prettier": "^5.5.1",
|
|
66
70
|
"jest": "^30.0.4",
|
|
67
71
|
"make-coverage-badge": "^1.2.0",
|
|
72
|
+
"msw": "^2.10.5",
|
|
68
73
|
"prettier": "^3.6.2",
|
|
69
74
|
"prettier-eslint": "^16.4.2",
|
|
70
75
|
"rollup": "^4.44.2",
|
package/.commitlintrc.json
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "GitHub Actions (TypeScript)",
|
|
3
|
-
"image": "mcr.microsoft.com/devcontainers/typescript-node:20",
|
|
4
|
-
"postCreateCommand": "npm install",
|
|
5
|
-
"customizations": {
|
|
6
|
-
"codespaces": {
|
|
7
|
-
"openFiles": ["README.md"]
|
|
8
|
-
},
|
|
9
|
-
"vscode": {
|
|
10
|
-
"extensions": [
|
|
11
|
-
"bierner.markdown-preview-github-styles",
|
|
12
|
-
"davidanson.vscode-markdownlint",
|
|
13
|
-
"dbaeumer.vscode-eslint",
|
|
14
|
-
"esbenp.prettier-vscode",
|
|
15
|
-
"github.copilot",
|
|
16
|
-
"github.copilot-chat",
|
|
17
|
-
"github.vscode-github-actions",
|
|
18
|
-
"github.vscode-pull-request-github",
|
|
19
|
-
"me-dutour-mathieu.vscode-github-actions",
|
|
20
|
-
"redhat.vscode-yaml",
|
|
21
|
-
"rvest.vs-code-prettier-eslint",
|
|
22
|
-
"yzhang.markdown-all-in-one"
|
|
23
|
-
],
|
|
24
|
-
"settings": {
|
|
25
|
-
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
26
|
-
"editor.tabSize": 2,
|
|
27
|
-
"editor.formatOnSave": true,
|
|
28
|
-
"markdown.extension.list.indentationSize": "adaptive",
|
|
29
|
-
"markdown.extension.italic.indicator": "_",
|
|
30
|
-
"markdown.extension.orderedList.marker": "one"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"remoteEnv": {
|
|
35
|
-
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}"
|
|
36
|
-
},
|
|
37
|
-
"features": {
|
|
38
|
-
"ghcr.io/devcontainers/features/github-cli:1": {},
|
|
39
|
-
"ghcr.io/devcontainers-community/npm-features/prettier:1": {}
|
|
40
|
-
}
|
|
41
|
-
}
|
package/.env.example
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
# dotenv-linter:off IncorrectDelimiter
|
|
2
|
-
|
|
3
|
-
# Do not commit your actual .env file to Git! This may contain secrets or other
|
|
4
|
-
# private information.
|
|
5
|
-
|
|
6
|
-
# Enable/disable step debug logging (default: `false`). For local debugging, it
|
|
7
|
-
# may be useful to set it to `true`.
|
|
8
|
-
ACTIONS_STEP_DEBUG=true
|
|
9
|
-
|
|
10
|
-
# GitHub Actions inputs should follow `INPUT_<name>` format (case-sensitive).
|
|
11
|
-
# Hyphens should not be converted to underscores!
|
|
12
|
-
INPUT_MILLISECONDS=2400
|
|
13
|
-
|
|
14
|
-
# GitHub Actions default environment variables. These are set for every run of a
|
|
15
|
-
# workflow and can be used in your actions. Setting the value here will override
|
|
16
|
-
# any value set by the local-action tool.
|
|
17
|
-
# https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
|
|
18
|
-
|
|
19
|
-
# CI="true"
|
|
20
|
-
# GITHUB_ACTION=""
|
|
21
|
-
# GITHUB_ACTION_PATH=""
|
|
22
|
-
# GITHUB_ACTION_REPOSITORY=""
|
|
23
|
-
# GITHUB_ACTIONS=""
|
|
24
|
-
# GITHUB_ACTOR=""
|
|
25
|
-
# GITHUB_ACTOR_ID=""
|
|
26
|
-
# GITHUB_API_URL=""
|
|
27
|
-
# GITHUB_BASE_REF=""
|
|
28
|
-
# GITHUB_ENV=""
|
|
29
|
-
# GITHUB_EVENT_NAME=""
|
|
30
|
-
# GITHUB_EVENT_PATH=""
|
|
31
|
-
# GITHUB_GRAPHQL_URL=""
|
|
32
|
-
# GITHUB_HEAD_REF=""
|
|
33
|
-
# GITHUB_JOB=""
|
|
34
|
-
# GITHUB_OUTPUT=""
|
|
35
|
-
# GITHUB_PATH=""
|
|
36
|
-
# GITHUB_REF=""
|
|
37
|
-
# GITHUB_REF_NAME=""
|
|
38
|
-
# GITHUB_REF_PROTECTED=""
|
|
39
|
-
# GITHUB_REF_TYPE=""
|
|
40
|
-
# GITHUB_REPOSITORY=""
|
|
41
|
-
# GITHUB_REPOSITORY_ID=""
|
|
42
|
-
# GITHUB_REPOSITORY_OWNER=""
|
|
43
|
-
# GITHUB_REPOSITORY_OWNER_ID=""
|
|
44
|
-
# GITHUB_RETENTION_DAYS=""
|
|
45
|
-
# GITHUB_RUN_ATTEMPT=""
|
|
46
|
-
# GITHUB_RUN_ID=""
|
|
47
|
-
# GITHUB_RUN_NUMBER=""
|
|
48
|
-
# GITHUB_SERVER_URL=""
|
|
49
|
-
# GITHUB_SHA=""
|
|
50
|
-
# GITHUB_STEP_SUMMARY=""
|
|
51
|
-
# GITHUB_TRIGGERING_ACTOR=""
|
|
52
|
-
# GITHUB_WORKFLOW=""
|
|
53
|
-
# GITHUB_WORKFLOW_REF=""
|
|
54
|
-
# GITHUB_WORKFLOW_SHA=""
|
|
55
|
-
# GITHUB_WORKSPACE=""
|
|
56
|
-
# RUNNER_ARCH=""
|
|
57
|
-
# RUNNER_DEBUG=""
|
|
58
|
-
# RUNNER_NAME=""
|
|
59
|
-
# RUNNER_OS=""
|
|
60
|
-
# RUNNER_TEMP=""
|
|
61
|
-
# RUNNER_TOOL_CACHE=""
|
package/.gitattributes
DELETED
package/.github/dependabot.yml
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
version: 2
|
|
2
|
-
updates:
|
|
3
|
-
- package-ecosystem: github-actions
|
|
4
|
-
directory: /
|
|
5
|
-
schedule:
|
|
6
|
-
interval: weekly
|
|
7
|
-
groups:
|
|
8
|
-
actions-minor:
|
|
9
|
-
update-types:
|
|
10
|
-
- minor
|
|
11
|
-
- patch
|
|
12
|
-
|
|
13
|
-
- package-ecosystem: npm
|
|
14
|
-
directory: /
|
|
15
|
-
schedule:
|
|
16
|
-
interval: weekly
|
|
17
|
-
ignore:
|
|
18
|
-
- dependency-name: '@types/node'
|
|
19
|
-
update-types:
|
|
20
|
-
- 'version-update:semver-major'
|
|
21
|
-
groups:
|
|
22
|
-
npm-development:
|
|
23
|
-
dependency-type: development
|
|
24
|
-
update-types:
|
|
25
|
-
- minor
|
|
26
|
-
- patch
|
|
27
|
-
npm-production:
|
|
28
|
-
dependency-type: production
|
|
29
|
-
update-types:
|
|
30
|
-
- patch
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
# In TypeScript actions, `dist/` is a special directory. When you reference
|
|
2
|
-
# an action with the `uses:` property, `dist/action.js` is the code that will be
|
|
3
|
-
# run. For this project, the `dist/action.js` file is transpiled from other
|
|
4
|
-
# source files. This workflow ensures the `dist/` directory contains the
|
|
5
|
-
# expected transpiled code.
|
|
6
|
-
#
|
|
7
|
-
# If this workflow is run from a feature branch, it will act as an additional CI
|
|
8
|
-
# check and fail if the checked-in `dist/` directory does not match what is
|
|
9
|
-
# expected from the build.
|
|
10
|
-
name: Check Transpiled JavaScript
|
|
11
|
-
|
|
12
|
-
on:
|
|
13
|
-
pull_request:
|
|
14
|
-
branches:
|
|
15
|
-
- main
|
|
16
|
-
push:
|
|
17
|
-
branches:
|
|
18
|
-
- main
|
|
19
|
-
|
|
20
|
-
permissions:
|
|
21
|
-
contents: read
|
|
22
|
-
|
|
23
|
-
jobs:
|
|
24
|
-
check-dist:
|
|
25
|
-
name: Check dist/
|
|
26
|
-
runs-on: ubuntu-latest
|
|
27
|
-
|
|
28
|
-
steps:
|
|
29
|
-
- name: Checkout
|
|
30
|
-
id: checkout
|
|
31
|
-
uses: actions/checkout@v4
|
|
32
|
-
|
|
33
|
-
- name: Setup Node.js
|
|
34
|
-
id: setup-node
|
|
35
|
-
uses: actions/setup-node@v4
|
|
36
|
-
with:
|
|
37
|
-
node-version-file: .node-version
|
|
38
|
-
cache: npm
|
|
39
|
-
|
|
40
|
-
- name: Install Dependencies
|
|
41
|
-
id: install
|
|
42
|
-
run: npm ci
|
|
43
|
-
|
|
44
|
-
- name: Build dist/ Directory
|
|
45
|
-
id: build
|
|
46
|
-
run: npm run bundle
|
|
47
|
-
|
|
48
|
-
# This will fail the workflow if the `dist/` directory is different than
|
|
49
|
-
# expected.
|
|
50
|
-
- name: Compare Directories
|
|
51
|
-
id: diff
|
|
52
|
-
run: |
|
|
53
|
-
if [ ! -d dist/ ]; then
|
|
54
|
-
echo "Expected dist/ directory does not exist. See status below:"
|
|
55
|
-
ls -la ./
|
|
56
|
-
exit 1
|
|
57
|
-
fi
|
|
58
|
-
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
|
|
59
|
-
echo "Detected uncommitted changes after build. See status below:"
|
|
60
|
-
git diff --ignore-space-at-eol --text dist/
|
|
61
|
-
exit 1
|
|
62
|
-
fi
|
|
63
|
-
|
|
64
|
-
# If `dist/` was different than expected, upload the expected version as a
|
|
65
|
-
# workflow artifact.
|
|
66
|
-
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
|
|
67
|
-
name: Upload Artifact
|
|
68
|
-
id: upload
|
|
69
|
-
uses: actions/upload-artifact@v4
|
|
70
|
-
with:
|
|
71
|
-
name: dist
|
|
72
|
-
path: dist/
|