opencommit 2.0.15 → 2.0.16
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/README.md +98 -47
- package/out/cli.cjs +618 -445
- package/out/github-action.cjs +27337 -0
- package/package.json +7 -2
package/out/cli.cjs
CHANGED
|
@@ -311,6 +311,155 @@ var require_picocolors = __commonJS({
|
|
|
311
311
|
}
|
|
312
312
|
});
|
|
313
313
|
|
|
314
|
+
// node_modules/dotenv/package.json
|
|
315
|
+
var require_package = __commonJS({
|
|
316
|
+
"node_modules/dotenv/package.json"(exports, module2) {
|
|
317
|
+
module2.exports = {
|
|
318
|
+
name: "dotenv",
|
|
319
|
+
version: "16.0.3",
|
|
320
|
+
description: "Loads environment variables from .env file",
|
|
321
|
+
main: "lib/main.js",
|
|
322
|
+
types: "lib/main.d.ts",
|
|
323
|
+
exports: {
|
|
324
|
+
".": {
|
|
325
|
+
require: "./lib/main.js",
|
|
326
|
+
types: "./lib/main.d.ts",
|
|
327
|
+
default: "./lib/main.js"
|
|
328
|
+
},
|
|
329
|
+
"./config": "./config.js",
|
|
330
|
+
"./config.js": "./config.js",
|
|
331
|
+
"./lib/env-options": "./lib/env-options.js",
|
|
332
|
+
"./lib/env-options.js": "./lib/env-options.js",
|
|
333
|
+
"./lib/cli-options": "./lib/cli-options.js",
|
|
334
|
+
"./lib/cli-options.js": "./lib/cli-options.js",
|
|
335
|
+
"./package.json": "./package.json"
|
|
336
|
+
},
|
|
337
|
+
scripts: {
|
|
338
|
+
"dts-check": "tsc --project tests/types/tsconfig.json",
|
|
339
|
+
lint: "standard",
|
|
340
|
+
"lint-readme": "standard-markdown",
|
|
341
|
+
pretest: "npm run lint && npm run dts-check",
|
|
342
|
+
test: "tap tests/*.js --100 -Rspec",
|
|
343
|
+
prerelease: "npm test",
|
|
344
|
+
release: "standard-version"
|
|
345
|
+
},
|
|
346
|
+
repository: {
|
|
347
|
+
type: "git",
|
|
348
|
+
url: "git://github.com/motdotla/dotenv.git"
|
|
349
|
+
},
|
|
350
|
+
keywords: [
|
|
351
|
+
"dotenv",
|
|
352
|
+
"env",
|
|
353
|
+
".env",
|
|
354
|
+
"environment",
|
|
355
|
+
"variables",
|
|
356
|
+
"config",
|
|
357
|
+
"settings"
|
|
358
|
+
],
|
|
359
|
+
readmeFilename: "README.md",
|
|
360
|
+
license: "BSD-2-Clause",
|
|
361
|
+
devDependencies: {
|
|
362
|
+
"@types/node": "^17.0.9",
|
|
363
|
+
decache: "^4.6.1",
|
|
364
|
+
dtslint: "^3.7.0",
|
|
365
|
+
sinon: "^12.0.1",
|
|
366
|
+
standard: "^16.0.4",
|
|
367
|
+
"standard-markdown": "^7.1.0",
|
|
368
|
+
"standard-version": "^9.3.2",
|
|
369
|
+
tap: "^15.1.6",
|
|
370
|
+
tar: "^6.1.11",
|
|
371
|
+
typescript: "^4.5.4"
|
|
372
|
+
},
|
|
373
|
+
engines: {
|
|
374
|
+
node: ">=12"
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
// node_modules/dotenv/lib/main.js
|
|
381
|
+
var require_main = __commonJS({
|
|
382
|
+
"node_modules/dotenv/lib/main.js"(exports, module2) {
|
|
383
|
+
var fs3 = require("fs");
|
|
384
|
+
var path4 = require("path");
|
|
385
|
+
var os3 = require("os");
|
|
386
|
+
var packageJson = require_package();
|
|
387
|
+
var version = packageJson.version;
|
|
388
|
+
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
389
|
+
function parse(src) {
|
|
390
|
+
const obj = {};
|
|
391
|
+
let lines = src.toString();
|
|
392
|
+
lines = lines.replace(/\r\n?/mg, "\n");
|
|
393
|
+
let match;
|
|
394
|
+
while ((match = LINE.exec(lines)) != null) {
|
|
395
|
+
const key = match[1];
|
|
396
|
+
let value = match[2] || "";
|
|
397
|
+
value = value.trim();
|
|
398
|
+
const maybeQuote = value[0];
|
|
399
|
+
value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
|
|
400
|
+
if (maybeQuote === '"') {
|
|
401
|
+
value = value.replace(/\\n/g, "\n");
|
|
402
|
+
value = value.replace(/\\r/g, "\r");
|
|
403
|
+
}
|
|
404
|
+
obj[key] = value;
|
|
405
|
+
}
|
|
406
|
+
return obj;
|
|
407
|
+
}
|
|
408
|
+
function _log(message) {
|
|
409
|
+
console.log(`[dotenv@${version}][DEBUG] ${message}`);
|
|
410
|
+
}
|
|
411
|
+
function _resolveHome(envPath) {
|
|
412
|
+
return envPath[0] === "~" ? path4.join(os3.homedir(), envPath.slice(1)) : envPath;
|
|
413
|
+
}
|
|
414
|
+
function config4(options) {
|
|
415
|
+
let dotenvPath = path4.resolve(process.cwd(), ".env");
|
|
416
|
+
let encoding = "utf8";
|
|
417
|
+
const debug = Boolean(options && options.debug);
|
|
418
|
+
const override = Boolean(options && options.override);
|
|
419
|
+
if (options) {
|
|
420
|
+
if (options.path != null) {
|
|
421
|
+
dotenvPath = _resolveHome(options.path);
|
|
422
|
+
}
|
|
423
|
+
if (options.encoding != null) {
|
|
424
|
+
encoding = options.encoding;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
try {
|
|
428
|
+
const parsed = DotenvModule.parse(fs3.readFileSync(dotenvPath, { encoding }));
|
|
429
|
+
Object.keys(parsed).forEach(function(key) {
|
|
430
|
+
if (!Object.prototype.hasOwnProperty.call(process.env, key)) {
|
|
431
|
+
process.env[key] = parsed[key];
|
|
432
|
+
} else {
|
|
433
|
+
if (override === true) {
|
|
434
|
+
process.env[key] = parsed[key];
|
|
435
|
+
}
|
|
436
|
+
if (debug) {
|
|
437
|
+
if (override === true) {
|
|
438
|
+
_log(`"${key}" is already defined in \`process.env\` and WAS overwritten`);
|
|
439
|
+
} else {
|
|
440
|
+
_log(`"${key}" is already defined in \`process.env\` and was NOT overwritten`);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
return { parsed };
|
|
446
|
+
} catch (e2) {
|
|
447
|
+
if (debug) {
|
|
448
|
+
_log(`Failed to load ${dotenvPath} ${e2.message}`);
|
|
449
|
+
}
|
|
450
|
+
return { error: e2 };
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
var DotenvModule = {
|
|
454
|
+
config: config4,
|
|
455
|
+
parse
|
|
456
|
+
};
|
|
457
|
+
module2.exports.config = DotenvModule.config;
|
|
458
|
+
module2.exports.parse = DotenvModule.parse;
|
|
459
|
+
module2.exports = DotenvModule;
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
|
|
314
463
|
// node_modules/isexe/windows.js
|
|
315
464
|
var require_windows = __commonJS({
|
|
316
465
|
"node_modules/isexe/windows.js"(exports, module2) {
|
|
@@ -1692,8 +1841,8 @@ var require_normalizeHeaderName = __commonJS({
|
|
|
1692
1841
|
var require_enhanceError = __commonJS({
|
|
1693
1842
|
"node_modules/openai/node_modules/axios/lib/core/enhanceError.js"(exports, module2) {
|
|
1694
1843
|
"use strict";
|
|
1695
|
-
module2.exports = function enhanceError(error,
|
|
1696
|
-
error.config =
|
|
1844
|
+
module2.exports = function enhanceError(error, config4, code, request, response) {
|
|
1845
|
+
error.config = config4;
|
|
1697
1846
|
if (code) {
|
|
1698
1847
|
error.code = code;
|
|
1699
1848
|
}
|
|
@@ -1737,9 +1886,9 @@ var require_createError = __commonJS({
|
|
|
1737
1886
|
"node_modules/openai/node_modules/axios/lib/core/createError.js"(exports, module2) {
|
|
1738
1887
|
"use strict";
|
|
1739
1888
|
var enhanceError = require_enhanceError();
|
|
1740
|
-
module2.exports = function createError(message,
|
|
1889
|
+
module2.exports = function createError(message, config4, code, request, response) {
|
|
1741
1890
|
var error = new Error(message);
|
|
1742
|
-
return enhanceError(error,
|
|
1891
|
+
return enhanceError(error, config4, code, request, response);
|
|
1743
1892
|
};
|
|
1744
1893
|
}
|
|
1745
1894
|
});
|
|
@@ -1968,32 +2117,32 @@ var require_xhr = __commonJS({
|
|
|
1968
2117
|
var createError = require_createError();
|
|
1969
2118
|
var transitionalDefaults = require_transitional();
|
|
1970
2119
|
var Cancel2 = require_Cancel();
|
|
1971
|
-
module2.exports = function xhrAdapter(
|
|
2120
|
+
module2.exports = function xhrAdapter(config4) {
|
|
1972
2121
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
1973
|
-
var requestData =
|
|
1974
|
-
var requestHeaders =
|
|
1975
|
-
var responseType =
|
|
2122
|
+
var requestData = config4.data;
|
|
2123
|
+
var requestHeaders = config4.headers;
|
|
2124
|
+
var responseType = config4.responseType;
|
|
1976
2125
|
var onCanceled;
|
|
1977
2126
|
function done() {
|
|
1978
|
-
if (
|
|
1979
|
-
|
|
2127
|
+
if (config4.cancelToken) {
|
|
2128
|
+
config4.cancelToken.unsubscribe(onCanceled);
|
|
1980
2129
|
}
|
|
1981
|
-
if (
|
|
1982
|
-
|
|
2130
|
+
if (config4.signal) {
|
|
2131
|
+
config4.signal.removeEventListener("abort", onCanceled);
|
|
1983
2132
|
}
|
|
1984
2133
|
}
|
|
1985
2134
|
if (utils.isFormData(requestData)) {
|
|
1986
2135
|
delete requestHeaders["Content-Type"];
|
|
1987
2136
|
}
|
|
1988
2137
|
var request = new XMLHttpRequest();
|
|
1989
|
-
if (
|
|
1990
|
-
var username =
|
|
1991
|
-
var password =
|
|
2138
|
+
if (config4.auth) {
|
|
2139
|
+
var username = config4.auth.username || "";
|
|
2140
|
+
var password = config4.auth.password ? unescape(encodeURIComponent(config4.auth.password)) : "";
|
|
1992
2141
|
requestHeaders.Authorization = "Basic " + btoa(username + ":" + password);
|
|
1993
2142
|
}
|
|
1994
|
-
var fullPath = buildFullPath2(
|
|
1995
|
-
request.open(
|
|
1996
|
-
request.timeout =
|
|
2143
|
+
var fullPath = buildFullPath2(config4.baseURL, config4.url);
|
|
2144
|
+
request.open(config4.method.toUpperCase(), buildURL2(fullPath, config4.params, config4.paramsSerializer), true);
|
|
2145
|
+
request.timeout = config4.timeout;
|
|
1997
2146
|
function onloadend() {
|
|
1998
2147
|
if (!request) {
|
|
1999
2148
|
return;
|
|
@@ -2005,7 +2154,7 @@ var require_xhr = __commonJS({
|
|
|
2005
2154
|
status: request.status,
|
|
2006
2155
|
statusText: request.statusText,
|
|
2007
2156
|
headers: responseHeaders,
|
|
2008
|
-
config:
|
|
2157
|
+
config: config4,
|
|
2009
2158
|
request
|
|
2010
2159
|
};
|
|
2011
2160
|
settle2(function _resolve(value) {
|
|
@@ -2034,31 +2183,31 @@ var require_xhr = __commonJS({
|
|
|
2034
2183
|
if (!request) {
|
|
2035
2184
|
return;
|
|
2036
2185
|
}
|
|
2037
|
-
reject(createError("Request aborted",
|
|
2186
|
+
reject(createError("Request aborted", config4, "ECONNABORTED", request));
|
|
2038
2187
|
request = null;
|
|
2039
2188
|
};
|
|
2040
2189
|
request.onerror = function handleError() {
|
|
2041
|
-
reject(createError("Network Error",
|
|
2190
|
+
reject(createError("Network Error", config4, null, request));
|
|
2042
2191
|
request = null;
|
|
2043
2192
|
};
|
|
2044
2193
|
request.ontimeout = function handleTimeout() {
|
|
2045
|
-
var timeoutErrorMessage =
|
|
2046
|
-
var transitional2 =
|
|
2047
|
-
if (
|
|
2048
|
-
timeoutErrorMessage =
|
|
2194
|
+
var timeoutErrorMessage = config4.timeout ? "timeout of " + config4.timeout + "ms exceeded" : "timeout exceeded";
|
|
2195
|
+
var transitional2 = config4.transitional || transitionalDefaults;
|
|
2196
|
+
if (config4.timeoutErrorMessage) {
|
|
2197
|
+
timeoutErrorMessage = config4.timeoutErrorMessage;
|
|
2049
2198
|
}
|
|
2050
2199
|
reject(createError(
|
|
2051
2200
|
timeoutErrorMessage,
|
|
2052
|
-
|
|
2201
|
+
config4,
|
|
2053
2202
|
transitional2.clarifyTimeoutError ? "ETIMEDOUT" : "ECONNABORTED",
|
|
2054
2203
|
request
|
|
2055
2204
|
));
|
|
2056
2205
|
request = null;
|
|
2057
2206
|
};
|
|
2058
2207
|
if (utils.isStandardBrowserEnv()) {
|
|
2059
|
-
var xsrfValue = (
|
|
2208
|
+
var xsrfValue = (config4.withCredentials || isURLSameOrigin(fullPath)) && config4.xsrfCookieName ? cookies.read(config4.xsrfCookieName) : void 0;
|
|
2060
2209
|
if (xsrfValue) {
|
|
2061
|
-
requestHeaders[
|
|
2210
|
+
requestHeaders[config4.xsrfHeaderName] = xsrfValue;
|
|
2062
2211
|
}
|
|
2063
2212
|
}
|
|
2064
2213
|
if ("setRequestHeader" in request) {
|
|
@@ -2070,19 +2219,19 @@ var require_xhr = __commonJS({
|
|
|
2070
2219
|
}
|
|
2071
2220
|
});
|
|
2072
2221
|
}
|
|
2073
|
-
if (!utils.isUndefined(
|
|
2074
|
-
request.withCredentials = !!
|
|
2222
|
+
if (!utils.isUndefined(config4.withCredentials)) {
|
|
2223
|
+
request.withCredentials = !!config4.withCredentials;
|
|
2075
2224
|
}
|
|
2076
2225
|
if (responseType && responseType !== "json") {
|
|
2077
|
-
request.responseType =
|
|
2226
|
+
request.responseType = config4.responseType;
|
|
2078
2227
|
}
|
|
2079
|
-
if (typeof
|
|
2080
|
-
request.addEventListener("progress",
|
|
2228
|
+
if (typeof config4.onDownloadProgress === "function") {
|
|
2229
|
+
request.addEventListener("progress", config4.onDownloadProgress);
|
|
2081
2230
|
}
|
|
2082
|
-
if (typeof
|
|
2083
|
-
request.upload.addEventListener("progress",
|
|
2231
|
+
if (typeof config4.onUploadProgress === "function" && request.upload) {
|
|
2232
|
+
request.upload.addEventListener("progress", config4.onUploadProgress);
|
|
2084
2233
|
}
|
|
2085
|
-
if (
|
|
2234
|
+
if (config4.cancelToken || config4.signal) {
|
|
2086
2235
|
onCanceled = function(cancel) {
|
|
2087
2236
|
if (!request) {
|
|
2088
2237
|
return;
|
|
@@ -2091,9 +2240,9 @@ var require_xhr = __commonJS({
|
|
|
2091
2240
|
request.abort();
|
|
2092
2241
|
request = null;
|
|
2093
2242
|
};
|
|
2094
|
-
|
|
2095
|
-
if (
|
|
2096
|
-
|
|
2243
|
+
config4.cancelToken && config4.cancelToken.subscribe(onCanceled);
|
|
2244
|
+
if (config4.signal) {
|
|
2245
|
+
config4.signal.aborted ? onCanceled() : config4.signal.addEventListener("abort", onCanceled);
|
|
2097
2246
|
}
|
|
2098
2247
|
}
|
|
2099
2248
|
if (!requestData) {
|
|
@@ -3349,15 +3498,15 @@ var require_http = __commonJS({
|
|
|
3349
3498
|
setProxy2(redirection, proxy, redirection.href);
|
|
3350
3499
|
};
|
|
3351
3500
|
}
|
|
3352
|
-
module2.exports = function httpAdapter2(
|
|
3501
|
+
module2.exports = function httpAdapter2(config4) {
|
|
3353
3502
|
return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) {
|
|
3354
3503
|
var onCanceled;
|
|
3355
3504
|
function done() {
|
|
3356
|
-
if (
|
|
3357
|
-
|
|
3505
|
+
if (config4.cancelToken) {
|
|
3506
|
+
config4.cancelToken.unsubscribe(onCanceled);
|
|
3358
3507
|
}
|
|
3359
|
-
if (
|
|
3360
|
-
|
|
3508
|
+
if (config4.signal) {
|
|
3509
|
+
config4.signal.removeEventListener("abort", onCanceled);
|
|
3361
3510
|
}
|
|
3362
3511
|
}
|
|
3363
3512
|
var resolve = function resolve2(value) {
|
|
@@ -3370,8 +3519,8 @@ var require_http = __commonJS({
|
|
|
3370
3519
|
rejected = true;
|
|
3371
3520
|
rejectPromise(value);
|
|
3372
3521
|
};
|
|
3373
|
-
var data =
|
|
3374
|
-
var headers =
|
|
3522
|
+
var data = config4.data;
|
|
3523
|
+
var headers = config4.headers;
|
|
3375
3524
|
var headerNames = {};
|
|
3376
3525
|
Object.keys(headers).forEach(function storeLowerName(name) {
|
|
3377
3526
|
headerNames[name.toLowerCase()] = name;
|
|
@@ -3392,23 +3541,23 @@ var require_http = __commonJS({
|
|
|
3392
3541
|
} else {
|
|
3393
3542
|
return reject(createError(
|
|
3394
3543
|
"Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",
|
|
3395
|
-
|
|
3544
|
+
config4
|
|
3396
3545
|
));
|
|
3397
3546
|
}
|
|
3398
|
-
if (
|
|
3399
|
-
return reject(createError("Request body larger than maxBodyLength limit",
|
|
3547
|
+
if (config4.maxBodyLength > -1 && data.length > config4.maxBodyLength) {
|
|
3548
|
+
return reject(createError("Request body larger than maxBodyLength limit", config4));
|
|
3400
3549
|
}
|
|
3401
3550
|
if (!headerNames["content-length"]) {
|
|
3402
3551
|
headers["Content-Length"] = data.length;
|
|
3403
3552
|
}
|
|
3404
3553
|
}
|
|
3405
3554
|
var auth = void 0;
|
|
3406
|
-
if (
|
|
3407
|
-
var username =
|
|
3408
|
-
var password =
|
|
3555
|
+
if (config4.auth) {
|
|
3556
|
+
var username = config4.auth.username || "";
|
|
3557
|
+
var password = config4.auth.password || "";
|
|
3409
3558
|
auth = username + ":" + password;
|
|
3410
3559
|
}
|
|
3411
|
-
var fullPath = buildFullPath2(
|
|
3560
|
+
var fullPath = buildFullPath2(config4.baseURL, config4.url);
|
|
3412
3561
|
var parsed = url3.parse(fullPath);
|
|
3413
3562
|
var protocol = parsed.protocol || "http:";
|
|
3414
3563
|
if (!auth && parsed.auth) {
|
|
@@ -3421,31 +3570,31 @@ var require_http = __commonJS({
|
|
|
3421
3570
|
delete headers[headerNames.authorization];
|
|
3422
3571
|
}
|
|
3423
3572
|
var isHttpsRequest = isHttps2.test(protocol);
|
|
3424
|
-
var agent = isHttpsRequest ?
|
|
3573
|
+
var agent = isHttpsRequest ? config4.httpsAgent : config4.httpAgent;
|
|
3425
3574
|
try {
|
|
3426
|
-
buildURL2(parsed.path,
|
|
3575
|
+
buildURL2(parsed.path, config4.params, config4.paramsSerializer).replace(/^\?/, "");
|
|
3427
3576
|
} catch (err) {
|
|
3428
3577
|
var customErr = new Error(err.message);
|
|
3429
|
-
customErr.config =
|
|
3430
|
-
customErr.url =
|
|
3578
|
+
customErr.config = config4;
|
|
3579
|
+
customErr.url = config4.url;
|
|
3431
3580
|
customErr.exists = true;
|
|
3432
3581
|
reject(customErr);
|
|
3433
3582
|
}
|
|
3434
3583
|
var options = {
|
|
3435
|
-
path: buildURL2(parsed.path,
|
|
3436
|
-
method:
|
|
3584
|
+
path: buildURL2(parsed.path, config4.params, config4.paramsSerializer).replace(/^\?/, ""),
|
|
3585
|
+
method: config4.method.toUpperCase(),
|
|
3437
3586
|
headers,
|
|
3438
3587
|
agent,
|
|
3439
|
-
agents: { http:
|
|
3588
|
+
agents: { http: config4.httpAgent, https: config4.httpsAgent },
|
|
3440
3589
|
auth
|
|
3441
3590
|
};
|
|
3442
|
-
if (
|
|
3443
|
-
options.socketPath =
|
|
3591
|
+
if (config4.socketPath) {
|
|
3592
|
+
options.socketPath = config4.socketPath;
|
|
3444
3593
|
} else {
|
|
3445
3594
|
options.hostname = parsed.hostname;
|
|
3446
3595
|
options.port = parsed.port;
|
|
3447
3596
|
}
|
|
3448
|
-
var proxy =
|
|
3597
|
+
var proxy = config4.proxy;
|
|
3449
3598
|
if (!proxy && proxy !== false) {
|
|
3450
3599
|
var proxyEnv = protocol.slice(0, -1) + "_proxy";
|
|
3451
3600
|
var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()];
|
|
@@ -3492,28 +3641,28 @@ var require_http = __commonJS({
|
|
|
3492
3641
|
}
|
|
3493
3642
|
var transport;
|
|
3494
3643
|
var isHttpsProxy = isHttpsRequest && (proxy ? isHttps2.test(proxy.protocol) : true);
|
|
3495
|
-
if (
|
|
3496
|
-
transport =
|
|
3497
|
-
} else if (
|
|
3644
|
+
if (config4.transport) {
|
|
3645
|
+
transport = config4.transport;
|
|
3646
|
+
} else if (config4.maxRedirects === 0) {
|
|
3498
3647
|
transport = isHttpsProxy ? https2 : http2;
|
|
3499
3648
|
} else {
|
|
3500
|
-
if (
|
|
3501
|
-
options.maxRedirects =
|
|
3649
|
+
if (config4.maxRedirects) {
|
|
3650
|
+
options.maxRedirects = config4.maxRedirects;
|
|
3502
3651
|
}
|
|
3503
3652
|
transport = isHttpsProxy ? httpsFollow2 : httpFollow2;
|
|
3504
3653
|
}
|
|
3505
|
-
if (
|
|
3506
|
-
options.maxBodyLength =
|
|
3654
|
+
if (config4.maxBodyLength > -1) {
|
|
3655
|
+
options.maxBodyLength = config4.maxBodyLength;
|
|
3507
3656
|
}
|
|
3508
|
-
if (
|
|
3509
|
-
options.insecureHTTPParser =
|
|
3657
|
+
if (config4.insecureHTTPParser) {
|
|
3658
|
+
options.insecureHTTPParser = config4.insecureHTTPParser;
|
|
3510
3659
|
}
|
|
3511
3660
|
var req = transport.request(options, function handleResponse(res) {
|
|
3512
3661
|
if (req.aborted)
|
|
3513
3662
|
return;
|
|
3514
3663
|
var stream4 = res;
|
|
3515
3664
|
var lastRequest = res.req || req;
|
|
3516
|
-
if (res.statusCode !== 204 && lastRequest.method !== "HEAD" &&
|
|
3665
|
+
if (res.statusCode !== 204 && lastRequest.method !== "HEAD" && config4.decompress !== false) {
|
|
3517
3666
|
switch (res.headers["content-encoding"]) {
|
|
3518
3667
|
case "gzip":
|
|
3519
3668
|
case "compress":
|
|
@@ -3527,10 +3676,10 @@ var require_http = __commonJS({
|
|
|
3527
3676
|
status: res.statusCode,
|
|
3528
3677
|
statusText: res.statusMessage,
|
|
3529
3678
|
headers: res.headers,
|
|
3530
|
-
config:
|
|
3679
|
+
config: config4,
|
|
3531
3680
|
request: lastRequest
|
|
3532
3681
|
};
|
|
3533
|
-
if (
|
|
3682
|
+
if (config4.responseType === "stream") {
|
|
3534
3683
|
response.data = stream4;
|
|
3535
3684
|
settle2(resolve, reject, response);
|
|
3536
3685
|
} else {
|
|
@@ -3539,12 +3688,12 @@ var require_http = __commonJS({
|
|
|
3539
3688
|
stream4.on("data", function handleStreamData(chunk) {
|
|
3540
3689
|
responseBuffer.push(chunk);
|
|
3541
3690
|
totalResponseBytes += chunk.length;
|
|
3542
|
-
if (
|
|
3691
|
+
if (config4.maxContentLength > -1 && totalResponseBytes > config4.maxContentLength) {
|
|
3543
3692
|
rejected = true;
|
|
3544
3693
|
stream4.destroy();
|
|
3545
3694
|
reject(createError(
|
|
3546
|
-
"maxContentLength size of " +
|
|
3547
|
-
|
|
3695
|
+
"maxContentLength size of " + config4.maxContentLength + " exceeded",
|
|
3696
|
+
config4,
|
|
3548
3697
|
null,
|
|
3549
3698
|
lastRequest
|
|
3550
3699
|
));
|
|
@@ -3555,25 +3704,25 @@ var require_http = __commonJS({
|
|
|
3555
3704
|
return;
|
|
3556
3705
|
}
|
|
3557
3706
|
stream4.destroy();
|
|
3558
|
-
reject(createError("error request aborted",
|
|
3707
|
+
reject(createError("error request aborted", config4, "ERR_REQUEST_ABORTED", lastRequest));
|
|
3559
3708
|
});
|
|
3560
3709
|
stream4.on("error", function handleStreamError(err) {
|
|
3561
3710
|
if (req.aborted)
|
|
3562
3711
|
return;
|
|
3563
|
-
reject(enhanceError(err,
|
|
3712
|
+
reject(enhanceError(err, config4, null, lastRequest));
|
|
3564
3713
|
});
|
|
3565
3714
|
stream4.on("end", function handleStreamEnd() {
|
|
3566
3715
|
try {
|
|
3567
3716
|
var responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);
|
|
3568
|
-
if (
|
|
3569
|
-
responseData = responseData.toString(
|
|
3570
|
-
if (!
|
|
3717
|
+
if (config4.responseType !== "arraybuffer") {
|
|
3718
|
+
responseData = responseData.toString(config4.responseEncoding);
|
|
3719
|
+
if (!config4.responseEncoding || config4.responseEncoding === "utf8") {
|
|
3571
3720
|
responseData = utils.stripBOM(responseData);
|
|
3572
3721
|
}
|
|
3573
3722
|
}
|
|
3574
3723
|
response.data = responseData;
|
|
3575
3724
|
} catch (err) {
|
|
3576
|
-
reject(enhanceError(err,
|
|
3725
|
+
reject(enhanceError(err, config4, err.code, response.request, response));
|
|
3577
3726
|
}
|
|
3578
3727
|
settle2(resolve, reject, response);
|
|
3579
3728
|
});
|
|
@@ -3582,17 +3731,17 @@ var require_http = __commonJS({
|
|
|
3582
3731
|
req.on("error", function handleRequestError(err) {
|
|
3583
3732
|
if (req.aborted && err.code !== "ERR_FR_TOO_MANY_REDIRECTS")
|
|
3584
3733
|
return;
|
|
3585
|
-
reject(enhanceError(err,
|
|
3734
|
+
reject(enhanceError(err, config4, null, req));
|
|
3586
3735
|
});
|
|
3587
3736
|
req.on("socket", function handleRequestSocket(socket) {
|
|
3588
3737
|
socket.setKeepAlive(true, 1e3 * 60);
|
|
3589
3738
|
});
|
|
3590
|
-
if (
|
|
3591
|
-
var timeout = parseInt(
|
|
3739
|
+
if (config4.timeout) {
|
|
3740
|
+
var timeout = parseInt(config4.timeout, 10);
|
|
3592
3741
|
if (isNaN(timeout)) {
|
|
3593
3742
|
reject(createError(
|
|
3594
3743
|
"error trying to parse `config.timeout` to int",
|
|
3595
|
-
|
|
3744
|
+
config4,
|
|
3596
3745
|
"ERR_PARSE_TIMEOUT",
|
|
3597
3746
|
req
|
|
3598
3747
|
));
|
|
@@ -3601,35 +3750,35 @@ var require_http = __commonJS({
|
|
|
3601
3750
|
req.setTimeout(timeout, function handleRequestTimeout() {
|
|
3602
3751
|
req.abort();
|
|
3603
3752
|
var timeoutErrorMessage = "";
|
|
3604
|
-
if (
|
|
3605
|
-
timeoutErrorMessage =
|
|
3753
|
+
if (config4.timeoutErrorMessage) {
|
|
3754
|
+
timeoutErrorMessage = config4.timeoutErrorMessage;
|
|
3606
3755
|
} else {
|
|
3607
|
-
timeoutErrorMessage = "timeout of " +
|
|
3756
|
+
timeoutErrorMessage = "timeout of " + config4.timeout + "ms exceeded";
|
|
3608
3757
|
}
|
|
3609
|
-
var transitional2 =
|
|
3758
|
+
var transitional2 = config4.transitional || transitionalDefaults;
|
|
3610
3759
|
reject(createError(
|
|
3611
3760
|
timeoutErrorMessage,
|
|
3612
|
-
|
|
3761
|
+
config4,
|
|
3613
3762
|
transitional2.clarifyTimeoutError ? "ETIMEDOUT" : "ECONNABORTED",
|
|
3614
3763
|
req
|
|
3615
3764
|
));
|
|
3616
3765
|
});
|
|
3617
3766
|
}
|
|
3618
|
-
if (
|
|
3767
|
+
if (config4.cancelToken || config4.signal) {
|
|
3619
3768
|
onCanceled = function(cancel) {
|
|
3620
3769
|
if (req.aborted)
|
|
3621
3770
|
return;
|
|
3622
3771
|
req.abort();
|
|
3623
3772
|
reject(!cancel || cancel && cancel.type ? new Cancel2("canceled") : cancel);
|
|
3624
3773
|
};
|
|
3625
|
-
|
|
3626
|
-
if (
|
|
3627
|
-
|
|
3774
|
+
config4.cancelToken && config4.cancelToken.subscribe(onCanceled);
|
|
3775
|
+
if (config4.signal) {
|
|
3776
|
+
config4.signal.aborted ? onCanceled() : config4.signal.addEventListener("abort", onCanceled);
|
|
3628
3777
|
}
|
|
3629
3778
|
}
|
|
3630
3779
|
if (utils.isStream(data)) {
|
|
3631
3780
|
data.on("error", function handleStreamError(err) {
|
|
3632
|
-
reject(enhanceError(err,
|
|
3781
|
+
reject(enhanceError(err, config4, null, req));
|
|
3633
3782
|
}).pipe(req);
|
|
3634
3783
|
} else {
|
|
3635
3784
|
req.end(data);
|
|
@@ -3777,53 +3926,53 @@ var require_dispatchRequest = __commonJS({
|
|
|
3777
3926
|
var isCancel3 = require_isCancel();
|
|
3778
3927
|
var defaults2 = require_defaults();
|
|
3779
3928
|
var Cancel2 = require_Cancel();
|
|
3780
|
-
function throwIfCancellationRequested2(
|
|
3781
|
-
if (
|
|
3782
|
-
|
|
3929
|
+
function throwIfCancellationRequested2(config4) {
|
|
3930
|
+
if (config4.cancelToken) {
|
|
3931
|
+
config4.cancelToken.throwIfRequested();
|
|
3783
3932
|
}
|
|
3784
|
-
if (
|
|
3933
|
+
if (config4.signal && config4.signal.aborted) {
|
|
3785
3934
|
throw new Cancel2("canceled");
|
|
3786
3935
|
}
|
|
3787
3936
|
}
|
|
3788
|
-
module2.exports = function dispatchRequest2(
|
|
3789
|
-
throwIfCancellationRequested2(
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3937
|
+
module2.exports = function dispatchRequest2(config4) {
|
|
3938
|
+
throwIfCancellationRequested2(config4);
|
|
3939
|
+
config4.headers = config4.headers || {};
|
|
3940
|
+
config4.data = transformData2.call(
|
|
3941
|
+
config4,
|
|
3942
|
+
config4.data,
|
|
3943
|
+
config4.headers,
|
|
3944
|
+
config4.transformRequest
|
|
3796
3945
|
);
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3946
|
+
config4.headers = utils.merge(
|
|
3947
|
+
config4.headers.common || {},
|
|
3948
|
+
config4.headers[config4.method] || {},
|
|
3949
|
+
config4.headers
|
|
3801
3950
|
);
|
|
3802
3951
|
utils.forEach(
|
|
3803
3952
|
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
3804
3953
|
function cleanHeaderConfig(method) {
|
|
3805
|
-
delete
|
|
3954
|
+
delete config4.headers[method];
|
|
3806
3955
|
}
|
|
3807
3956
|
);
|
|
3808
|
-
var adapter =
|
|
3809
|
-
return adapter(
|
|
3810
|
-
throwIfCancellationRequested2(
|
|
3957
|
+
var adapter = config4.adapter || defaults2.adapter;
|
|
3958
|
+
return adapter(config4).then(function onAdapterResolution(response) {
|
|
3959
|
+
throwIfCancellationRequested2(config4);
|
|
3811
3960
|
response.data = transformData2.call(
|
|
3812
|
-
|
|
3961
|
+
config4,
|
|
3813
3962
|
response.data,
|
|
3814
3963
|
response.headers,
|
|
3815
|
-
|
|
3964
|
+
config4.transformResponse
|
|
3816
3965
|
);
|
|
3817
3966
|
return response;
|
|
3818
3967
|
}, function onAdapterRejection(reason) {
|
|
3819
3968
|
if (!isCancel3(reason)) {
|
|
3820
|
-
throwIfCancellationRequested2(
|
|
3969
|
+
throwIfCancellationRequested2(config4);
|
|
3821
3970
|
if (reason && reason.response) {
|
|
3822
3971
|
reason.response.data = transformData2.call(
|
|
3823
|
-
|
|
3972
|
+
config4,
|
|
3824
3973
|
reason.response.data,
|
|
3825
3974
|
reason.response.headers,
|
|
3826
|
-
|
|
3975
|
+
config4.transformResponse
|
|
3827
3976
|
);
|
|
3828
3977
|
}
|
|
3829
3978
|
}
|
|
@@ -3840,7 +3989,7 @@ var require_mergeConfig = __commonJS({
|
|
|
3840
3989
|
var utils = require_utils();
|
|
3841
3990
|
module2.exports = function mergeConfig3(config1, config22) {
|
|
3842
3991
|
config22 = config22 || {};
|
|
3843
|
-
var
|
|
3992
|
+
var config4 = {};
|
|
3844
3993
|
function getMergedValue(target, source) {
|
|
3845
3994
|
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|
3846
3995
|
return utils.merge(target, source);
|
|
@@ -3908,9 +4057,9 @@ var require_mergeConfig = __commonJS({
|
|
|
3908
4057
|
utils.forEach(Object.keys(config1).concat(Object.keys(config22)), function computeConfigValue(prop) {
|
|
3909
4058
|
var merge2 = mergeMap[prop] || mergeDeepProperties;
|
|
3910
4059
|
var configValue = merge2(prop);
|
|
3911
|
-
utils.isUndefined(configValue) && merge2 !== mergeDirectKeys || (
|
|
4060
|
+
utils.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config4[prop] = configValue);
|
|
3912
4061
|
});
|
|
3913
|
-
return
|
|
4062
|
+
return config4;
|
|
3914
4063
|
};
|
|
3915
4064
|
}
|
|
3916
4065
|
});
|
|
@@ -3994,22 +4143,22 @@ var require_Axios = __commonJS({
|
|
|
3994
4143
|
response: new InterceptorManager2()
|
|
3995
4144
|
};
|
|
3996
4145
|
}
|
|
3997
|
-
Axios3.prototype.request = function request(configOrUrl,
|
|
4146
|
+
Axios3.prototype.request = function request(configOrUrl, config4) {
|
|
3998
4147
|
if (typeof configOrUrl === "string") {
|
|
3999
|
-
|
|
4000
|
-
|
|
4148
|
+
config4 = config4 || {};
|
|
4149
|
+
config4.url = configOrUrl;
|
|
4001
4150
|
} else {
|
|
4002
|
-
|
|
4151
|
+
config4 = configOrUrl || {};
|
|
4003
4152
|
}
|
|
4004
|
-
|
|
4005
|
-
if (
|
|
4006
|
-
|
|
4153
|
+
config4 = mergeConfig3(this.defaults, config4);
|
|
4154
|
+
if (config4.method) {
|
|
4155
|
+
config4.method = config4.method.toLowerCase();
|
|
4007
4156
|
} else if (this.defaults.method) {
|
|
4008
|
-
|
|
4157
|
+
config4.method = this.defaults.method.toLowerCase();
|
|
4009
4158
|
} else {
|
|
4010
|
-
|
|
4159
|
+
config4.method = "get";
|
|
4011
4160
|
}
|
|
4012
|
-
var transitional2 =
|
|
4161
|
+
var transitional2 = config4.transitional;
|
|
4013
4162
|
if (transitional2 !== void 0) {
|
|
4014
4163
|
validator.assertOptions(transitional2, {
|
|
4015
4164
|
silentJSONParsing: validators3.transitional(validators3.boolean),
|
|
@@ -4020,7 +4169,7 @@ var require_Axios = __commonJS({
|
|
|
4020
4169
|
var requestInterceptorChain = [];
|
|
4021
4170
|
var synchronousRequestInterceptors = true;
|
|
4022
4171
|
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
4023
|
-
if (typeof interceptor.runWhen === "function" && interceptor.runWhen(
|
|
4172
|
+
if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config4) === false) {
|
|
4024
4173
|
return;
|
|
4025
4174
|
}
|
|
4026
4175
|
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
@@ -4035,13 +4184,13 @@ var require_Axios = __commonJS({
|
|
|
4035
4184
|
var chain = [dispatchRequest2, void 0];
|
|
4036
4185
|
Array.prototype.unshift.apply(chain, requestInterceptorChain);
|
|
4037
4186
|
chain = chain.concat(responseInterceptorChain);
|
|
4038
|
-
promise = Promise.resolve(
|
|
4187
|
+
promise = Promise.resolve(config4);
|
|
4039
4188
|
while (chain.length) {
|
|
4040
4189
|
promise = promise.then(chain.shift(), chain.shift());
|
|
4041
4190
|
}
|
|
4042
4191
|
return promise;
|
|
4043
4192
|
}
|
|
4044
|
-
var newConfig =
|
|
4193
|
+
var newConfig = config4;
|
|
4045
4194
|
while (requestInterceptorChain.length) {
|
|
4046
4195
|
var onFulfilled = requestInterceptorChain.shift();
|
|
4047
4196
|
var onRejected = requestInterceptorChain.shift();
|
|
@@ -4062,22 +4211,22 @@ var require_Axios = __commonJS({
|
|
|
4062
4211
|
}
|
|
4063
4212
|
return promise;
|
|
4064
4213
|
};
|
|
4065
|
-
Axios3.prototype.getUri = function getUri(
|
|
4066
|
-
|
|
4067
|
-
return buildURL2(
|
|
4214
|
+
Axios3.prototype.getUri = function getUri(config4) {
|
|
4215
|
+
config4 = mergeConfig3(this.defaults, config4);
|
|
4216
|
+
return buildURL2(config4.url, config4.params, config4.paramsSerializer).replace(/^\?/, "");
|
|
4068
4217
|
};
|
|
4069
4218
|
utils.forEach(["delete", "get", "head", "options"], function forEachMethodNoData3(method) {
|
|
4070
|
-
Axios3.prototype[method] = function(url3,
|
|
4071
|
-
return this.request(mergeConfig3(
|
|
4219
|
+
Axios3.prototype[method] = function(url3, config4) {
|
|
4220
|
+
return this.request(mergeConfig3(config4 || {}, {
|
|
4072
4221
|
method,
|
|
4073
4222
|
url: url3,
|
|
4074
|
-
data: (
|
|
4223
|
+
data: (config4 || {}).data
|
|
4075
4224
|
}));
|
|
4076
4225
|
};
|
|
4077
4226
|
});
|
|
4078
4227
|
utils.forEach(["post", "put", "patch"], function forEachMethodWithData3(method) {
|
|
4079
|
-
Axios3.prototype[method] = function(url3, data,
|
|
4080
|
-
return this.request(mergeConfig3(
|
|
4228
|
+
Axios3.prototype[method] = function(url3, data, config4) {
|
|
4229
|
+
return this.request(mergeConfig3(config4 || {}, {
|
|
4081
4230
|
method,
|
|
4082
4231
|
url: url3,
|
|
4083
4232
|
data
|
|
@@ -5437,7 +5586,7 @@ var require_api = __commonJS({
|
|
|
5437
5586
|
});
|
|
5438
5587
|
|
|
5439
5588
|
// node_modules/openai/package.json
|
|
5440
|
-
var
|
|
5589
|
+
var require_package2 = __commonJS({
|
|
5441
5590
|
"node_modules/openai/package.json"(exports, module2) {
|
|
5442
5591
|
module2.exports = {
|
|
5443
5592
|
name: "openai",
|
|
@@ -14898,7 +15047,7 @@ var require_configuration = __commonJS({
|
|
|
14898
15047
|
"use strict";
|
|
14899
15048
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14900
15049
|
exports.Configuration = void 0;
|
|
14901
|
-
var packageJson =
|
|
15050
|
+
var packageJson = require_package2();
|
|
14902
15051
|
var Configuration = class {
|
|
14903
15052
|
constructor(param = {}) {
|
|
14904
15053
|
this.apiKey = param.apiKey;
|
|
@@ -16123,8 +16272,8 @@ function G3(t, e2) {
|
|
|
16123
16272
|
// package.json
|
|
16124
16273
|
var package_default = {
|
|
16125
16274
|
name: "opencommit",
|
|
16126
|
-
version: "2.0.
|
|
16127
|
-
description: "
|
|
16275
|
+
version: "2.0.15",
|
|
16276
|
+
description: "Auto-generate impressive commits in 1 second. Killing lame commits with AI \u{1F92F}\u{1F52B}",
|
|
16128
16277
|
keywords: [
|
|
16129
16278
|
"git",
|
|
16130
16279
|
"chatgpt",
|
|
@@ -16183,8 +16332,13 @@ var package_default = {
|
|
|
16183
16332
|
typescript: "^4.9.3"
|
|
16184
16333
|
},
|
|
16185
16334
|
dependencies: {
|
|
16335
|
+
"@actions/core": "^1.10.0",
|
|
16336
|
+
"@actions/exec": "^1.1.1",
|
|
16337
|
+
"@actions/github": "^5.1.1",
|
|
16186
16338
|
"@clack/prompts": "^0.6.1",
|
|
16187
16339
|
"@dqbd/tiktoken": "^1.0.2",
|
|
16340
|
+
"@octokit/webhooks-schemas": "^6.11.0",
|
|
16341
|
+
"@octokit/webhooks-types": "^6.11.0",
|
|
16188
16342
|
axios: "^1.3.4",
|
|
16189
16343
|
chalk: "^5.2.0",
|
|
16190
16344
|
cleye: "^1.3.2",
|
|
@@ -17445,6 +17599,8 @@ function getI18nLocal(value) {
|
|
|
17445
17599
|
}
|
|
17446
17600
|
|
|
17447
17601
|
// src/commands/config.ts
|
|
17602
|
+
var dotenv = __toESM(require_main(), 1);
|
|
17603
|
+
dotenv.config();
|
|
17448
17604
|
var validateConfig = (key, condition, validationMessage) => {
|
|
17449
17605
|
if (!condition) {
|
|
17450
17606
|
ce(
|
|
@@ -17454,71 +17610,71 @@ var validateConfig = (key, condition, validationMessage) => {
|
|
|
17454
17610
|
}
|
|
17455
17611
|
};
|
|
17456
17612
|
var configValidators = {
|
|
17457
|
-
["
|
|
17458
|
-
validateConfig("
|
|
17613
|
+
["OCO_OPENAI_API_KEY" /* OCO_OPENAI_API_KEY */](value) {
|
|
17614
|
+
validateConfig("OCO_OPENAI_API_KEY" /* OCO_OPENAI_API_KEY */, value, "Cannot be empty");
|
|
17459
17615
|
validateConfig(
|
|
17460
|
-
"
|
|
17616
|
+
"OCO_OPENAI_API_KEY" /* OCO_OPENAI_API_KEY */,
|
|
17461
17617
|
value.startsWith("sk-"),
|
|
17462
17618
|
'Must start with "sk-"'
|
|
17463
17619
|
);
|
|
17464
17620
|
validateConfig(
|
|
17465
|
-
"
|
|
17621
|
+
"OCO_OPENAI_API_KEY" /* OCO_OPENAI_API_KEY */,
|
|
17466
17622
|
value.length === 51,
|
|
17467
17623
|
"Must be 51 characters long"
|
|
17468
17624
|
);
|
|
17469
17625
|
return value;
|
|
17470
17626
|
},
|
|
17471
|
-
["
|
|
17627
|
+
["OCO_DESCRIPTION" /* OCO_DESCRIPTION */](value) {
|
|
17472
17628
|
validateConfig(
|
|
17473
|
-
"
|
|
17629
|
+
"OCO_DESCRIPTION" /* OCO_DESCRIPTION */,
|
|
17474
17630
|
typeof value === "boolean",
|
|
17475
17631
|
"Must be true or false"
|
|
17476
17632
|
);
|
|
17477
17633
|
return value;
|
|
17478
17634
|
},
|
|
17479
|
-
["
|
|
17635
|
+
["OCO_OPENAI_MAX_TOKENS" /* OCO_OPENAI_MAX_TOKENS */](value) {
|
|
17480
17636
|
if (typeof value === "string") {
|
|
17481
17637
|
value = parseInt(value);
|
|
17482
17638
|
validateConfig(
|
|
17483
|
-
"
|
|
17639
|
+
"OCO_OPENAI_MAX_TOKENS" /* OCO_OPENAI_MAX_TOKENS */,
|
|
17484
17640
|
!isNaN(value),
|
|
17485
17641
|
"Must be a number"
|
|
17486
17642
|
);
|
|
17487
17643
|
}
|
|
17488
17644
|
validateConfig(
|
|
17489
|
-
"
|
|
17645
|
+
"OCO_OPENAI_MAX_TOKENS" /* OCO_OPENAI_MAX_TOKENS */,
|
|
17490
17646
|
typeof value === "number",
|
|
17491
17647
|
"Must be a number"
|
|
17492
17648
|
);
|
|
17493
17649
|
return value;
|
|
17494
17650
|
},
|
|
17495
|
-
["
|
|
17651
|
+
["OCO_EMOJI" /* OCO_EMOJI */](value) {
|
|
17496
17652
|
validateConfig(
|
|
17497
|
-
"
|
|
17653
|
+
"OCO_EMOJI" /* OCO_EMOJI */,
|
|
17498
17654
|
typeof value === "boolean",
|
|
17499
17655
|
"Must be true or false"
|
|
17500
17656
|
);
|
|
17501
17657
|
return value;
|
|
17502
17658
|
},
|
|
17503
|
-
["
|
|
17659
|
+
["OCO_LANGUAGE" /* OCO_LANGUAGE */](value) {
|
|
17504
17660
|
validateConfig(
|
|
17505
|
-
"
|
|
17661
|
+
"OCO_LANGUAGE" /* OCO_LANGUAGE */,
|
|
17506
17662
|
getI18nLocal(value),
|
|
17507
17663
|
`${value} is not supported yet`
|
|
17508
17664
|
);
|
|
17509
17665
|
return getI18nLocal(value);
|
|
17510
17666
|
},
|
|
17511
|
-
["
|
|
17667
|
+
["OCO_OPENAI_BASE_PATH" /* OCO_OPENAI_BASE_PATH */](value) {
|
|
17512
17668
|
validateConfig(
|
|
17513
|
-
"
|
|
17669
|
+
"OCO_OPENAI_BASE_PATH" /* OCO_OPENAI_BASE_PATH */,
|
|
17514
17670
|
typeof value === "string",
|
|
17515
17671
|
"Must be string"
|
|
17516
17672
|
);
|
|
17517
17673
|
return value;
|
|
17518
17674
|
},
|
|
17519
|
-
["
|
|
17675
|
+
["OCO_MODEL" /* OCO_MODEL */](value) {
|
|
17520
17676
|
validateConfig(
|
|
17521
|
-
"
|
|
17677
|
+
"OCO_OPENAI_BASE_PATH" /* OCO_OPENAI_BASE_PATH */,
|
|
17522
17678
|
value === "gpt-3.5-turbo" || value === "gpt-4",
|
|
17523
17679
|
`${value} is not supported yet, use 'gpt-4' or 'gpt-3.5-turbo' (default)`
|
|
17524
17680
|
);
|
|
@@ -17527,21 +17683,41 @@ var configValidators = {
|
|
|
17527
17683
|
};
|
|
17528
17684
|
var configPath = (0, import_path.join)((0, import_os.homedir)(), ".opencommit");
|
|
17529
17685
|
var getConfig = () => {
|
|
17686
|
+
const configFromEnv = {
|
|
17687
|
+
OCO_OPENAI_API_KEY: process.env.OCO_OPENAI_API_KEY,
|
|
17688
|
+
OCO_OPENAI_MAX_TOKENS: Number(process.env.OCO_OPENAI_MAX_TOKENS),
|
|
17689
|
+
OCO_OPENAI_BASE_PATH: process.env.OCO_OPENAI_BASE_PATH,
|
|
17690
|
+
OCO_DESCRIPTION: process.env.OCO_DESCRIPTION === "true" ? true : false,
|
|
17691
|
+
OCO_EMOJI: process.env.OCO_EMOJI === "true" ? true : false,
|
|
17692
|
+
OCO_MODEL: process.env.OCO_MODEL,
|
|
17693
|
+
OCO_LANGUAGE: process.env.OCO_LANGUAGE
|
|
17694
|
+
};
|
|
17530
17695
|
const configExists = (0, import_fs.existsSync)(configPath);
|
|
17531
17696
|
if (!configExists)
|
|
17532
|
-
return
|
|
17697
|
+
return configFromEnv;
|
|
17533
17698
|
const configFile = (0, import_fs.readFileSync)(configPath, "utf8");
|
|
17534
|
-
const
|
|
17535
|
-
for (const configKey of Object.keys(
|
|
17536
|
-
|
|
17537
|
-
|
|
17538
|
-
|
|
17539
|
-
|
|
17699
|
+
const config4 = (0, import_ini.parse)(configFile);
|
|
17700
|
+
for (const configKey of Object.keys(config4)) {
|
|
17701
|
+
try {
|
|
17702
|
+
const validator = configValidators[configKey];
|
|
17703
|
+
const validValue = validator(
|
|
17704
|
+
config4[configKey] ?? configFromEnv[configKey]
|
|
17705
|
+
);
|
|
17706
|
+
config4[configKey] = validValue;
|
|
17707
|
+
} catch (error) {
|
|
17708
|
+
ce(
|
|
17709
|
+
`'${configKey}' name is invalid, it should be either 'OCO_${configKey.toUpperCase()}' or it doesn't exist.`
|
|
17710
|
+
);
|
|
17711
|
+
ce(
|
|
17712
|
+
`Manually fix the '.env' file or global '~/.opencommit' config file.`
|
|
17713
|
+
);
|
|
17714
|
+
process.exit(1);
|
|
17715
|
+
}
|
|
17540
17716
|
}
|
|
17541
|
-
return
|
|
17717
|
+
return config4;
|
|
17542
17718
|
};
|
|
17543
17719
|
var setConfig = (keyValues) => {
|
|
17544
|
-
const
|
|
17720
|
+
const config4 = getConfig() || {};
|
|
17545
17721
|
for (const [configKey, configValue] of keyValues) {
|
|
17546
17722
|
if (!configValidators.hasOwnProperty(configKey)) {
|
|
17547
17723
|
throw new Error(`Unsupported config key: ${configKey}`);
|
|
@@ -17553,9 +17729,9 @@ var setConfig = (keyValues) => {
|
|
|
17553
17729
|
parsedConfigValue = configValue;
|
|
17554
17730
|
}
|
|
17555
17731
|
const validValue = configValidators[configKey](parsedConfigValue);
|
|
17556
|
-
|
|
17732
|
+
config4[configKey] = validValue;
|
|
17557
17733
|
}
|
|
17558
|
-
(0, import_fs.writeFileSync)(configPath, (0, import_ini.stringify)(
|
|
17734
|
+
(0, import_fs.writeFileSync)(configPath, (0, import_ini.stringify)(config4), "utf8");
|
|
17559
17735
|
ce(`${source_default.green("\u2714")} Config successfully set`);
|
|
17560
17736
|
};
|
|
17561
17737
|
var configCommand = G3(
|
|
@@ -17568,9 +17744,9 @@ var configCommand = G3(
|
|
|
17568
17744
|
try {
|
|
17569
17745
|
const { mode: mode2, keyValues } = argv._;
|
|
17570
17746
|
if (mode2 === "get" /* get */) {
|
|
17571
|
-
const
|
|
17747
|
+
const config4 = getConfig() || {};
|
|
17572
17748
|
for (const key of keyValues) {
|
|
17573
|
-
ce(`${key}=${
|
|
17749
|
+
ce(`${key}=${config4[key]}`);
|
|
17574
17750
|
}
|
|
17575
17751
|
} else if (mode2 === "set" /* set */) {
|
|
17576
17752
|
await setConfig(
|
|
@@ -19037,7 +19213,7 @@ var utils_default = {
|
|
|
19037
19213
|
};
|
|
19038
19214
|
|
|
19039
19215
|
// node_modules/axios/lib/core/AxiosError.js
|
|
19040
|
-
function AxiosError(message, code,
|
|
19216
|
+
function AxiosError(message, code, config4, request, response) {
|
|
19041
19217
|
Error.call(this);
|
|
19042
19218
|
if (Error.captureStackTrace) {
|
|
19043
19219
|
Error.captureStackTrace(this, this.constructor);
|
|
@@ -19047,7 +19223,7 @@ function AxiosError(message, code, config3, request, response) {
|
|
|
19047
19223
|
this.message = message;
|
|
19048
19224
|
this.name = "AxiosError";
|
|
19049
19225
|
code && (this.code = code);
|
|
19050
|
-
|
|
19226
|
+
config4 && (this.config = config4);
|
|
19051
19227
|
request && (this.request = request);
|
|
19052
19228
|
response && (this.response = response);
|
|
19053
19229
|
}
|
|
@@ -19088,14 +19264,14 @@ var descriptors2 = {};
|
|
|
19088
19264
|
});
|
|
19089
19265
|
Object.defineProperties(AxiosError, descriptors2);
|
|
19090
19266
|
Object.defineProperty(prototype, "isAxiosError", { value: true });
|
|
19091
|
-
AxiosError.from = (error, code,
|
|
19267
|
+
AxiosError.from = (error, code, config4, request, response, customProps) => {
|
|
19092
19268
|
const axiosError = Object.create(prototype);
|
|
19093
19269
|
utils_default.toFlatObject(error, axiosError, function filter2(obj) {
|
|
19094
19270
|
return obj !== Error.prototype;
|
|
19095
19271
|
}, (prop) => {
|
|
19096
19272
|
return prop !== "isAxiosError";
|
|
19097
19273
|
});
|
|
19098
|
-
AxiosError.call(axiosError, error.message, code,
|
|
19274
|
+
AxiosError.call(axiosError, error.message, code, config4, request, response);
|
|
19099
19275
|
axiosError.cause = error;
|
|
19100
19276
|
axiosError.name = error.name;
|
|
19101
19277
|
customProps && Object.assign(axiosError, customProps);
|
|
@@ -19770,12 +19946,12 @@ var AxiosHeaders_default = AxiosHeaders;
|
|
|
19770
19946
|
|
|
19771
19947
|
// node_modules/axios/lib/core/transformData.js
|
|
19772
19948
|
function transformData(fns, response) {
|
|
19773
|
-
const
|
|
19774
|
-
const context = response ||
|
|
19949
|
+
const config4 = this || defaults_default;
|
|
19950
|
+
const context = response || config4;
|
|
19775
19951
|
const headers = AxiosHeaders_default.from(context.headers);
|
|
19776
19952
|
let data = context.data;
|
|
19777
19953
|
utils_default.forEach(fns, function transform(fn) {
|
|
19778
|
-
data = fn.call(
|
|
19954
|
+
data = fn.call(config4, data, headers.normalize(), response ? response.status : void 0);
|
|
19779
19955
|
});
|
|
19780
19956
|
headers.normalize();
|
|
19781
19957
|
return data;
|
|
@@ -19787,8 +19963,8 @@ function isCancel(value) {
|
|
|
19787
19963
|
}
|
|
19788
19964
|
|
|
19789
19965
|
// node_modules/axios/lib/cancel/CanceledError.js
|
|
19790
|
-
function CanceledError(message,
|
|
19791
|
-
AxiosError_default.call(this, message == null ? "canceled" : message, AxiosError_default.ERR_CANCELED,
|
|
19966
|
+
function CanceledError(message, config4, request) {
|
|
19967
|
+
AxiosError_default.call(this, message == null ? "canceled" : message, AxiosError_default.ERR_CANCELED, config4, request);
|
|
19792
19968
|
this.name = "CanceledError";
|
|
19793
19969
|
}
|
|
19794
19970
|
utils_default.inherits(CanceledError, AxiosError_default, {
|
|
@@ -20295,21 +20471,21 @@ var wrapAsync = (asyncExecutor) => {
|
|
|
20295
20471
|
asyncExecutor(_resolve, _reject, (onDoneHandler) => onDone = onDoneHandler).catch(_reject);
|
|
20296
20472
|
});
|
|
20297
20473
|
};
|
|
20298
|
-
var http_default = isHttpAdapterSupported && function httpAdapter(
|
|
20474
|
+
var http_default = isHttpAdapterSupported && function httpAdapter(config4) {
|
|
20299
20475
|
return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
|
|
20300
|
-
let { data } =
|
|
20301
|
-
const { responseType, responseEncoding } =
|
|
20302
|
-
const method =
|
|
20476
|
+
let { data } = config4;
|
|
20477
|
+
const { responseType, responseEncoding } = config4;
|
|
20478
|
+
const method = config4.method.toUpperCase();
|
|
20303
20479
|
let isDone;
|
|
20304
20480
|
let rejected = false;
|
|
20305
20481
|
let req;
|
|
20306
20482
|
const emitter = new import_events.default();
|
|
20307
20483
|
const onFinished = () => {
|
|
20308
|
-
if (
|
|
20309
|
-
|
|
20484
|
+
if (config4.cancelToken) {
|
|
20485
|
+
config4.cancelToken.unsubscribe(abort);
|
|
20310
20486
|
}
|
|
20311
|
-
if (
|
|
20312
|
-
|
|
20487
|
+
if (config4.signal) {
|
|
20488
|
+
config4.signal.removeEventListener("abort", abort);
|
|
20313
20489
|
}
|
|
20314
20490
|
emitter.removeAllListeners();
|
|
20315
20491
|
};
|
|
@@ -20321,16 +20497,16 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config3) {
|
|
|
20321
20497
|
}
|
|
20322
20498
|
});
|
|
20323
20499
|
function abort(reason) {
|
|
20324
|
-
emitter.emit("abort", !reason || reason.type ? new CanceledError_default(null,
|
|
20500
|
+
emitter.emit("abort", !reason || reason.type ? new CanceledError_default(null, config4, req) : reason);
|
|
20325
20501
|
}
|
|
20326
20502
|
emitter.once("abort", reject);
|
|
20327
|
-
if (
|
|
20328
|
-
|
|
20329
|
-
if (
|
|
20330
|
-
|
|
20503
|
+
if (config4.cancelToken || config4.signal) {
|
|
20504
|
+
config4.cancelToken && config4.cancelToken.subscribe(abort);
|
|
20505
|
+
if (config4.signal) {
|
|
20506
|
+
config4.signal.aborted ? abort() : config4.signal.addEventListener("abort", abort);
|
|
20331
20507
|
}
|
|
20332
20508
|
}
|
|
20333
|
-
const fullPath = buildFullPath(
|
|
20509
|
+
const fullPath = buildFullPath(config4.baseURL, config4.url);
|
|
20334
20510
|
const parsed = new URL(fullPath, "http://localhost");
|
|
20335
20511
|
const protocol = parsed.protocol || supportedProtocols[0];
|
|
20336
20512
|
if (protocol === "data:") {
|
|
@@ -20340,15 +20516,15 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config3) {
|
|
|
20340
20516
|
status: 405,
|
|
20341
20517
|
statusText: "method not allowed",
|
|
20342
20518
|
headers: {},
|
|
20343
|
-
config:
|
|
20519
|
+
config: config4
|
|
20344
20520
|
});
|
|
20345
20521
|
}
|
|
20346
20522
|
try {
|
|
20347
|
-
convertedData = fromDataURI(
|
|
20348
|
-
Blob:
|
|
20523
|
+
convertedData = fromDataURI(config4.url, responseType === "blob", {
|
|
20524
|
+
Blob: config4.env && config4.env.Blob
|
|
20349
20525
|
});
|
|
20350
20526
|
} catch (err) {
|
|
20351
|
-
throw AxiosError_default.from(err, AxiosError_default.ERR_BAD_REQUEST,
|
|
20527
|
+
throw AxiosError_default.from(err, AxiosError_default.ERR_BAD_REQUEST, config4);
|
|
20352
20528
|
}
|
|
20353
20529
|
if (responseType === "text") {
|
|
20354
20530
|
convertedData = convertedData.toString(responseEncoding);
|
|
@@ -20363,21 +20539,21 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config3) {
|
|
|
20363
20539
|
status: 200,
|
|
20364
20540
|
statusText: "OK",
|
|
20365
20541
|
headers: new AxiosHeaders_default(),
|
|
20366
|
-
config:
|
|
20542
|
+
config: config4
|
|
20367
20543
|
});
|
|
20368
20544
|
}
|
|
20369
20545
|
if (supportedProtocols.indexOf(protocol) === -1) {
|
|
20370
20546
|
return reject(new AxiosError_default(
|
|
20371
20547
|
"Unsupported protocol " + protocol,
|
|
20372
20548
|
AxiosError_default.ERR_BAD_REQUEST,
|
|
20373
|
-
|
|
20549
|
+
config4
|
|
20374
20550
|
));
|
|
20375
20551
|
}
|
|
20376
|
-
const headers = AxiosHeaders_default.from(
|
|
20552
|
+
const headers = AxiosHeaders_default.from(config4.headers).normalize();
|
|
20377
20553
|
headers.set("User-Agent", "axios/" + VERSION, false);
|
|
20378
|
-
const onDownloadProgress =
|
|
20379
|
-
const onUploadProgress =
|
|
20380
|
-
const maxRate =
|
|
20554
|
+
const onDownloadProgress = config4.onDownloadProgress;
|
|
20555
|
+
const onUploadProgress = config4.onUploadProgress;
|
|
20556
|
+
const maxRate = config4.maxRate;
|
|
20381
20557
|
let maxUploadRate = void 0;
|
|
20382
20558
|
let maxDownloadRate = void 0;
|
|
20383
20559
|
if (utils_default.isSpecCompliantForm(data)) {
|
|
@@ -20411,15 +20587,15 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config3) {
|
|
|
20411
20587
|
return reject(new AxiosError_default(
|
|
20412
20588
|
"Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",
|
|
20413
20589
|
AxiosError_default.ERR_BAD_REQUEST,
|
|
20414
|
-
|
|
20590
|
+
config4
|
|
20415
20591
|
));
|
|
20416
20592
|
}
|
|
20417
20593
|
headers.setContentLength(data.length, false);
|
|
20418
|
-
if (
|
|
20594
|
+
if (config4.maxBodyLength > -1 && data.length > config4.maxBodyLength) {
|
|
20419
20595
|
return reject(new AxiosError_default(
|
|
20420
20596
|
"Request body larger than maxBodyLength limit",
|
|
20421
20597
|
AxiosError_default.ERR_BAD_REQUEST,
|
|
20422
|
-
|
|
20598
|
+
config4
|
|
20423
20599
|
));
|
|
20424
20600
|
}
|
|
20425
20601
|
}
|
|
@@ -20445,9 +20621,9 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config3) {
|
|
|
20445
20621
|
});
|
|
20446
20622
|
}
|
|
20447
20623
|
let auth = void 0;
|
|
20448
|
-
if (
|
|
20449
|
-
const username =
|
|
20450
|
-
const password =
|
|
20624
|
+
if (config4.auth) {
|
|
20625
|
+
const username = config4.auth.username || "";
|
|
20626
|
+
const password = config4.auth.password || "";
|
|
20451
20627
|
auth = username + ":" + password;
|
|
20452
20628
|
}
|
|
20453
20629
|
if (!auth && parsed.username) {
|
|
@@ -20460,13 +20636,13 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config3) {
|
|
|
20460
20636
|
try {
|
|
20461
20637
|
path4 = buildURL(
|
|
20462
20638
|
parsed.pathname + parsed.search,
|
|
20463
|
-
|
|
20464
|
-
|
|
20639
|
+
config4.params,
|
|
20640
|
+
config4.paramsSerializer
|
|
20465
20641
|
).replace(/^\?/, "");
|
|
20466
20642
|
} catch (err) {
|
|
20467
20643
|
const customErr = new Error(err.message);
|
|
20468
|
-
customErr.config =
|
|
20469
|
-
customErr.url =
|
|
20644
|
+
customErr.config = config4;
|
|
20645
|
+
customErr.url = config4.url;
|
|
20470
20646
|
customErr.exists = true;
|
|
20471
20647
|
return reject(customErr);
|
|
20472
20648
|
}
|
|
@@ -20479,42 +20655,42 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config3) {
|
|
|
20479
20655
|
path: path4,
|
|
20480
20656
|
method,
|
|
20481
20657
|
headers: headers.toJSON(),
|
|
20482
|
-
agents: { http:
|
|
20658
|
+
agents: { http: config4.httpAgent, https: config4.httpsAgent },
|
|
20483
20659
|
auth,
|
|
20484
20660
|
protocol,
|
|
20485
20661
|
beforeRedirect: dispatchBeforeRedirect,
|
|
20486
20662
|
beforeRedirects: {}
|
|
20487
20663
|
};
|
|
20488
|
-
if (
|
|
20489
|
-
options.socketPath =
|
|
20664
|
+
if (config4.socketPath) {
|
|
20665
|
+
options.socketPath = config4.socketPath;
|
|
20490
20666
|
} else {
|
|
20491
20667
|
options.hostname = parsed.hostname;
|
|
20492
20668
|
options.port = parsed.port;
|
|
20493
|
-
setProxy(options,
|
|
20669
|
+
setProxy(options, config4.proxy, protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path);
|
|
20494
20670
|
}
|
|
20495
20671
|
let transport;
|
|
20496
20672
|
const isHttpsRequest = isHttps.test(options.protocol);
|
|
20497
|
-
options.agent = isHttpsRequest ?
|
|
20498
|
-
if (
|
|
20499
|
-
transport =
|
|
20500
|
-
} else if (
|
|
20673
|
+
options.agent = isHttpsRequest ? config4.httpsAgent : config4.httpAgent;
|
|
20674
|
+
if (config4.transport) {
|
|
20675
|
+
transport = config4.transport;
|
|
20676
|
+
} else if (config4.maxRedirects === 0) {
|
|
20501
20677
|
transport = isHttpsRequest ? import_https.default : import_http.default;
|
|
20502
20678
|
} else {
|
|
20503
|
-
if (
|
|
20504
|
-
options.maxRedirects =
|
|
20679
|
+
if (config4.maxRedirects) {
|
|
20680
|
+
options.maxRedirects = config4.maxRedirects;
|
|
20505
20681
|
}
|
|
20506
|
-
if (
|
|
20507
|
-
options.beforeRedirects.config =
|
|
20682
|
+
if (config4.beforeRedirect) {
|
|
20683
|
+
options.beforeRedirects.config = config4.beforeRedirect;
|
|
20508
20684
|
}
|
|
20509
20685
|
transport = isHttpsRequest ? httpsFollow : httpFollow;
|
|
20510
20686
|
}
|
|
20511
|
-
if (
|
|
20512
|
-
options.maxBodyLength =
|
|
20687
|
+
if (config4.maxBodyLength > -1) {
|
|
20688
|
+
options.maxBodyLength = config4.maxBodyLength;
|
|
20513
20689
|
} else {
|
|
20514
20690
|
options.maxBodyLength = Infinity;
|
|
20515
20691
|
}
|
|
20516
|
-
if (
|
|
20517
|
-
options.insecureHTTPParser =
|
|
20692
|
+
if (config4.insecureHTTPParser) {
|
|
20693
|
+
options.insecureHTTPParser = config4.insecureHTTPParser;
|
|
20518
20694
|
}
|
|
20519
20695
|
req = transport.request(options, function handleResponse(res) {
|
|
20520
20696
|
if (req.destroyed)
|
|
@@ -20535,7 +20711,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config3) {
|
|
|
20535
20711
|
}
|
|
20536
20712
|
let responseStream = res;
|
|
20537
20713
|
const lastRequest = res.req || req;
|
|
20538
|
-
if (
|
|
20714
|
+
if (config4.decompress !== false && res.headers["content-encoding"]) {
|
|
20539
20715
|
if (method === "HEAD" || res.statusCode === 204) {
|
|
20540
20716
|
delete res.headers["content-encoding"];
|
|
20541
20717
|
}
|
|
@@ -20568,7 +20744,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config3) {
|
|
|
20568
20744
|
status: res.statusCode,
|
|
20569
20745
|
statusText: res.statusMessage,
|
|
20570
20746
|
headers: new AxiosHeaders_default(res.headers),
|
|
20571
|
-
config:
|
|
20747
|
+
config: config4,
|
|
20572
20748
|
request: lastRequest
|
|
20573
20749
|
};
|
|
20574
20750
|
if (responseType === "stream") {
|
|
@@ -20580,13 +20756,13 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config3) {
|
|
|
20580
20756
|
responseStream.on("data", function handleStreamData(chunk) {
|
|
20581
20757
|
responseBuffer.push(chunk);
|
|
20582
20758
|
totalResponseBytes += chunk.length;
|
|
20583
|
-
if (
|
|
20759
|
+
if (config4.maxContentLength > -1 && totalResponseBytes > config4.maxContentLength) {
|
|
20584
20760
|
rejected = true;
|
|
20585
20761
|
responseStream.destroy();
|
|
20586
20762
|
reject(new AxiosError_default(
|
|
20587
|
-
"maxContentLength size of " +
|
|
20763
|
+
"maxContentLength size of " + config4.maxContentLength + " exceeded",
|
|
20588
20764
|
AxiosError_default.ERR_BAD_RESPONSE,
|
|
20589
|
-
|
|
20765
|
+
config4,
|
|
20590
20766
|
lastRequest
|
|
20591
20767
|
));
|
|
20592
20768
|
}
|
|
@@ -20596,9 +20772,9 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config3) {
|
|
|
20596
20772
|
return;
|
|
20597
20773
|
}
|
|
20598
20774
|
const err = new AxiosError_default(
|
|
20599
|
-
"maxContentLength size of " +
|
|
20775
|
+
"maxContentLength size of " + config4.maxContentLength + " exceeded",
|
|
20600
20776
|
AxiosError_default.ERR_BAD_RESPONSE,
|
|
20601
|
-
|
|
20777
|
+
config4,
|
|
20602
20778
|
lastRequest
|
|
20603
20779
|
);
|
|
20604
20780
|
responseStream.destroy(err);
|
|
@@ -20607,7 +20783,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config3) {
|
|
|
20607
20783
|
responseStream.on("error", function handleStreamError(err) {
|
|
20608
20784
|
if (req.destroyed)
|
|
20609
20785
|
return;
|
|
20610
|
-
reject(AxiosError_default.from(err, null,
|
|
20786
|
+
reject(AxiosError_default.from(err, null, config4, lastRequest));
|
|
20611
20787
|
});
|
|
20612
20788
|
responseStream.on("end", function handleStreamEnd() {
|
|
20613
20789
|
try {
|
|
@@ -20620,7 +20796,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config3) {
|
|
|
20620
20796
|
}
|
|
20621
20797
|
response.data = responseData;
|
|
20622
20798
|
} catch (err) {
|
|
20623
|
-
reject(AxiosError_default.from(err, null,
|
|
20799
|
+
reject(AxiosError_default.from(err, null, config4, response.request, response));
|
|
20624
20800
|
}
|
|
20625
20801
|
settle(resolve, reject, response);
|
|
20626
20802
|
});
|
|
@@ -20637,18 +20813,18 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config3) {
|
|
|
20637
20813
|
req.destroy(err);
|
|
20638
20814
|
});
|
|
20639
20815
|
req.on("error", function handleRequestError(err) {
|
|
20640
|
-
reject(AxiosError_default.from(err, null,
|
|
20816
|
+
reject(AxiosError_default.from(err, null, config4, req));
|
|
20641
20817
|
});
|
|
20642
20818
|
req.on("socket", function handleRequestSocket(socket) {
|
|
20643
20819
|
socket.setKeepAlive(true, 1e3 * 60);
|
|
20644
20820
|
});
|
|
20645
|
-
if (
|
|
20646
|
-
const timeout = parseInt(
|
|
20821
|
+
if (config4.timeout) {
|
|
20822
|
+
const timeout = parseInt(config4.timeout, 10);
|
|
20647
20823
|
if (isNaN(timeout)) {
|
|
20648
20824
|
reject(new AxiosError_default(
|
|
20649
20825
|
"error trying to parse `config.timeout` to int",
|
|
20650
20826
|
AxiosError_default.ERR_BAD_OPTION_VALUE,
|
|
20651
|
-
|
|
20827
|
+
config4,
|
|
20652
20828
|
req
|
|
20653
20829
|
));
|
|
20654
20830
|
return;
|
|
@@ -20656,15 +20832,15 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config3) {
|
|
|
20656
20832
|
req.setTimeout(timeout, function handleRequestTimeout() {
|
|
20657
20833
|
if (isDone)
|
|
20658
20834
|
return;
|
|
20659
|
-
let timeoutErrorMessage =
|
|
20660
|
-
const transitional2 =
|
|
20661
|
-
if (
|
|
20662
|
-
timeoutErrorMessage =
|
|
20835
|
+
let timeoutErrorMessage = config4.timeout ? "timeout of " + config4.timeout + "ms exceeded" : "timeout exceeded";
|
|
20836
|
+
const transitional2 = config4.transitional || transitional_default;
|
|
20837
|
+
if (config4.timeoutErrorMessage) {
|
|
20838
|
+
timeoutErrorMessage = config4.timeoutErrorMessage;
|
|
20663
20839
|
}
|
|
20664
20840
|
reject(new AxiosError_default(
|
|
20665
20841
|
timeoutErrorMessage,
|
|
20666
20842
|
transitional2.clarifyTimeoutError ? AxiosError_default.ETIMEDOUT : AxiosError_default.ECONNABORTED,
|
|
20667
|
-
|
|
20843
|
+
config4,
|
|
20668
20844
|
req
|
|
20669
20845
|
));
|
|
20670
20846
|
abort();
|
|
@@ -20682,7 +20858,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config3) {
|
|
|
20682
20858
|
});
|
|
20683
20859
|
data.on("close", () => {
|
|
20684
20860
|
if (!ended && !errored) {
|
|
20685
|
-
abort(new CanceledError_default("Request stream has been aborted",
|
|
20861
|
+
abort(new CanceledError_default("Request stream has been aborted", config4, req));
|
|
20686
20862
|
}
|
|
20687
20863
|
});
|
|
20688
20864
|
data.pipe(req);
|
|
@@ -20791,32 +20967,32 @@ function progressEventReducer(listener, isDownloadStream) {
|
|
|
20791
20967
|
};
|
|
20792
20968
|
}
|
|
20793
20969
|
var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
|
|
20794
|
-
var xhr_default = isXHRAdapterSupported && function(
|
|
20970
|
+
var xhr_default = isXHRAdapterSupported && function(config4) {
|
|
20795
20971
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
20796
|
-
let requestData =
|
|
20797
|
-
const requestHeaders = AxiosHeaders_default.from(
|
|
20798
|
-
const responseType =
|
|
20972
|
+
let requestData = config4.data;
|
|
20973
|
+
const requestHeaders = AxiosHeaders_default.from(config4.headers).normalize();
|
|
20974
|
+
const responseType = config4.responseType;
|
|
20799
20975
|
let onCanceled;
|
|
20800
20976
|
function done() {
|
|
20801
|
-
if (
|
|
20802
|
-
|
|
20977
|
+
if (config4.cancelToken) {
|
|
20978
|
+
config4.cancelToken.unsubscribe(onCanceled);
|
|
20803
20979
|
}
|
|
20804
|
-
if (
|
|
20805
|
-
|
|
20980
|
+
if (config4.signal) {
|
|
20981
|
+
config4.signal.removeEventListener("abort", onCanceled);
|
|
20806
20982
|
}
|
|
20807
20983
|
}
|
|
20808
20984
|
if (utils_default.isFormData(requestData) && (node_default.isStandardBrowserEnv || node_default.isStandardBrowserWebWorkerEnv)) {
|
|
20809
20985
|
requestHeaders.setContentType(false);
|
|
20810
20986
|
}
|
|
20811
20987
|
let request = new XMLHttpRequest();
|
|
20812
|
-
if (
|
|
20813
|
-
const username =
|
|
20814
|
-
const password =
|
|
20988
|
+
if (config4.auth) {
|
|
20989
|
+
const username = config4.auth.username || "";
|
|
20990
|
+
const password = config4.auth.password ? unescape(encodeURIComponent(config4.auth.password)) : "";
|
|
20815
20991
|
requestHeaders.set("Authorization", "Basic " + btoa(username + ":" + password));
|
|
20816
20992
|
}
|
|
20817
|
-
const fullPath = buildFullPath(
|
|
20818
|
-
request.open(
|
|
20819
|
-
request.timeout =
|
|
20993
|
+
const fullPath = buildFullPath(config4.baseURL, config4.url);
|
|
20994
|
+
request.open(config4.method.toUpperCase(), buildURL(fullPath, config4.params, config4.paramsSerializer), true);
|
|
20995
|
+
request.timeout = config4.timeout;
|
|
20820
20996
|
function onloadend() {
|
|
20821
20997
|
if (!request) {
|
|
20822
20998
|
return;
|
|
@@ -20830,7 +21006,7 @@ var xhr_default = isXHRAdapterSupported && function(config3) {
|
|
|
20830
21006
|
status: request.status,
|
|
20831
21007
|
statusText: request.statusText,
|
|
20832
21008
|
headers: responseHeaders,
|
|
20833
|
-
config:
|
|
21009
|
+
config: config4,
|
|
20834
21010
|
request
|
|
20835
21011
|
};
|
|
20836
21012
|
settle(function _resolve(value) {
|
|
@@ -20859,31 +21035,31 @@ var xhr_default = isXHRAdapterSupported && function(config3) {
|
|
|
20859
21035
|
if (!request) {
|
|
20860
21036
|
return;
|
|
20861
21037
|
}
|
|
20862
|
-
reject(new AxiosError_default("Request aborted", AxiosError_default.ECONNABORTED,
|
|
21038
|
+
reject(new AxiosError_default("Request aborted", AxiosError_default.ECONNABORTED, config4, request));
|
|
20863
21039
|
request = null;
|
|
20864
21040
|
};
|
|
20865
21041
|
request.onerror = function handleError() {
|
|
20866
|
-
reject(new AxiosError_default("Network Error", AxiosError_default.ERR_NETWORK,
|
|
21042
|
+
reject(new AxiosError_default("Network Error", AxiosError_default.ERR_NETWORK, config4, request));
|
|
20867
21043
|
request = null;
|
|
20868
21044
|
};
|
|
20869
21045
|
request.ontimeout = function handleTimeout() {
|
|
20870
|
-
let timeoutErrorMessage =
|
|
20871
|
-
const transitional2 =
|
|
20872
|
-
if (
|
|
20873
|
-
timeoutErrorMessage =
|
|
21046
|
+
let timeoutErrorMessage = config4.timeout ? "timeout of " + config4.timeout + "ms exceeded" : "timeout exceeded";
|
|
21047
|
+
const transitional2 = config4.transitional || transitional_default;
|
|
21048
|
+
if (config4.timeoutErrorMessage) {
|
|
21049
|
+
timeoutErrorMessage = config4.timeoutErrorMessage;
|
|
20874
21050
|
}
|
|
20875
21051
|
reject(new AxiosError_default(
|
|
20876
21052
|
timeoutErrorMessage,
|
|
20877
21053
|
transitional2.clarifyTimeoutError ? AxiosError_default.ETIMEDOUT : AxiosError_default.ECONNABORTED,
|
|
20878
|
-
|
|
21054
|
+
config4,
|
|
20879
21055
|
request
|
|
20880
21056
|
));
|
|
20881
21057
|
request = null;
|
|
20882
21058
|
};
|
|
20883
21059
|
if (node_default.isStandardBrowserEnv) {
|
|
20884
|
-
const xsrfValue = (
|
|
21060
|
+
const xsrfValue = (config4.withCredentials || isURLSameOrigin_default(fullPath)) && config4.xsrfCookieName && cookies_default.read(config4.xsrfCookieName);
|
|
20885
21061
|
if (xsrfValue) {
|
|
20886
|
-
requestHeaders.set(
|
|
21062
|
+
requestHeaders.set(config4.xsrfHeaderName, xsrfValue);
|
|
20887
21063
|
}
|
|
20888
21064
|
}
|
|
20889
21065
|
requestData === void 0 && requestHeaders.setContentType(null);
|
|
@@ -20892,35 +21068,35 @@ var xhr_default = isXHRAdapterSupported && function(config3) {
|
|
|
20892
21068
|
request.setRequestHeader(key, val);
|
|
20893
21069
|
});
|
|
20894
21070
|
}
|
|
20895
|
-
if (!utils_default.isUndefined(
|
|
20896
|
-
request.withCredentials = !!
|
|
21071
|
+
if (!utils_default.isUndefined(config4.withCredentials)) {
|
|
21072
|
+
request.withCredentials = !!config4.withCredentials;
|
|
20897
21073
|
}
|
|
20898
21074
|
if (responseType && responseType !== "json") {
|
|
20899
|
-
request.responseType =
|
|
21075
|
+
request.responseType = config4.responseType;
|
|
20900
21076
|
}
|
|
20901
|
-
if (typeof
|
|
20902
|
-
request.addEventListener("progress", progressEventReducer(
|
|
21077
|
+
if (typeof config4.onDownloadProgress === "function") {
|
|
21078
|
+
request.addEventListener("progress", progressEventReducer(config4.onDownloadProgress, true));
|
|
20903
21079
|
}
|
|
20904
|
-
if (typeof
|
|
20905
|
-
request.upload.addEventListener("progress", progressEventReducer(
|
|
21080
|
+
if (typeof config4.onUploadProgress === "function" && request.upload) {
|
|
21081
|
+
request.upload.addEventListener("progress", progressEventReducer(config4.onUploadProgress));
|
|
20906
21082
|
}
|
|
20907
|
-
if (
|
|
21083
|
+
if (config4.cancelToken || config4.signal) {
|
|
20908
21084
|
onCanceled = (cancel) => {
|
|
20909
21085
|
if (!request) {
|
|
20910
21086
|
return;
|
|
20911
21087
|
}
|
|
20912
|
-
reject(!cancel || cancel.type ? new CanceledError_default(null,
|
|
21088
|
+
reject(!cancel || cancel.type ? new CanceledError_default(null, config4, request) : cancel);
|
|
20913
21089
|
request.abort();
|
|
20914
21090
|
request = null;
|
|
20915
21091
|
};
|
|
20916
|
-
|
|
20917
|
-
if (
|
|
20918
|
-
|
|
21092
|
+
config4.cancelToken && config4.cancelToken.subscribe(onCanceled);
|
|
21093
|
+
if (config4.signal) {
|
|
21094
|
+
config4.signal.aborted ? onCanceled() : config4.signal.addEventListener("abort", onCanceled);
|
|
20919
21095
|
}
|
|
20920
21096
|
}
|
|
20921
21097
|
const protocol = parseProtocol(fullPath);
|
|
20922
21098
|
if (protocol && node_default.protocols.indexOf(protocol) === -1) {
|
|
20923
|
-
reject(new AxiosError_default("Unsupported protocol " + protocol + ":", AxiosError_default.ERR_BAD_REQUEST,
|
|
21099
|
+
reject(new AxiosError_default("Unsupported protocol " + protocol + ":", AxiosError_default.ERR_BAD_REQUEST, config4));
|
|
20924
21100
|
return;
|
|
20925
21101
|
}
|
|
20926
21102
|
request.send(requestData || null);
|
|
@@ -20973,41 +21149,41 @@ var adapters_default = {
|
|
|
20973
21149
|
};
|
|
20974
21150
|
|
|
20975
21151
|
// node_modules/axios/lib/core/dispatchRequest.js
|
|
20976
|
-
function throwIfCancellationRequested(
|
|
20977
|
-
if (
|
|
20978
|
-
|
|
21152
|
+
function throwIfCancellationRequested(config4) {
|
|
21153
|
+
if (config4.cancelToken) {
|
|
21154
|
+
config4.cancelToken.throwIfRequested();
|
|
20979
21155
|
}
|
|
20980
|
-
if (
|
|
20981
|
-
throw new CanceledError_default(null,
|
|
21156
|
+
if (config4.signal && config4.signal.aborted) {
|
|
21157
|
+
throw new CanceledError_default(null, config4);
|
|
20982
21158
|
}
|
|
20983
21159
|
}
|
|
20984
|
-
function dispatchRequest(
|
|
20985
|
-
throwIfCancellationRequested(
|
|
20986
|
-
|
|
20987
|
-
|
|
20988
|
-
|
|
20989
|
-
|
|
21160
|
+
function dispatchRequest(config4) {
|
|
21161
|
+
throwIfCancellationRequested(config4);
|
|
21162
|
+
config4.headers = AxiosHeaders_default.from(config4.headers);
|
|
21163
|
+
config4.data = transformData.call(
|
|
21164
|
+
config4,
|
|
21165
|
+
config4.transformRequest
|
|
20990
21166
|
);
|
|
20991
|
-
if (["post", "put", "patch"].indexOf(
|
|
20992
|
-
|
|
21167
|
+
if (["post", "put", "patch"].indexOf(config4.method) !== -1) {
|
|
21168
|
+
config4.headers.setContentType("application/x-www-form-urlencoded", false);
|
|
20993
21169
|
}
|
|
20994
|
-
const adapter = adapters_default.getAdapter(
|
|
20995
|
-
return adapter(
|
|
20996
|
-
throwIfCancellationRequested(
|
|
21170
|
+
const adapter = adapters_default.getAdapter(config4.adapter || defaults_default.adapter);
|
|
21171
|
+
return adapter(config4).then(function onAdapterResolution(response) {
|
|
21172
|
+
throwIfCancellationRequested(config4);
|
|
20997
21173
|
response.data = transformData.call(
|
|
20998
|
-
|
|
20999
|
-
|
|
21174
|
+
config4,
|
|
21175
|
+
config4.transformResponse,
|
|
21000
21176
|
response
|
|
21001
21177
|
);
|
|
21002
21178
|
response.headers = AxiosHeaders_default.from(response.headers);
|
|
21003
21179
|
return response;
|
|
21004
21180
|
}, function onAdapterRejection(reason) {
|
|
21005
21181
|
if (!isCancel(reason)) {
|
|
21006
|
-
throwIfCancellationRequested(
|
|
21182
|
+
throwIfCancellationRequested(config4);
|
|
21007
21183
|
if (reason && reason.response) {
|
|
21008
21184
|
reason.response.data = transformData.call(
|
|
21009
|
-
|
|
21010
|
-
|
|
21185
|
+
config4,
|
|
21186
|
+
config4.transformResponse,
|
|
21011
21187
|
reason.response
|
|
21012
21188
|
);
|
|
21013
21189
|
reason.response.headers = AxiosHeaders_default.from(reason.response.headers);
|
|
@@ -21021,7 +21197,7 @@ function dispatchRequest(config3) {
|
|
|
21021
21197
|
var headersToObject = (thing) => thing instanceof AxiosHeaders_default ? thing.toJSON() : thing;
|
|
21022
21198
|
function mergeConfig(config1, config22) {
|
|
21023
21199
|
config22 = config22 || {};
|
|
21024
|
-
const
|
|
21200
|
+
const config4 = {};
|
|
21025
21201
|
function getMergedValue(target, source, caseless) {
|
|
21026
21202
|
if (utils_default.isPlainObject(target) && utils_default.isPlainObject(source)) {
|
|
21027
21203
|
return utils_default.merge.call({ caseless }, target, source);
|
|
@@ -21091,9 +21267,9 @@ function mergeConfig(config1, config22) {
|
|
|
21091
21267
|
utils_default.forEach(Object.keys(config1).concat(Object.keys(config22)), function computeConfigValue(prop) {
|
|
21092
21268
|
const merge2 = mergeMap[prop] || mergeDeepProperties;
|
|
21093
21269
|
const configValue = merge2(config1[prop], config22[prop], prop);
|
|
21094
|
-
utils_default.isUndefined(configValue) && merge2 !== mergeDirectKeys || (
|
|
21270
|
+
utils_default.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config4[prop] = configValue);
|
|
21095
21271
|
});
|
|
21096
|
-
return
|
|
21272
|
+
return config4;
|
|
21097
21273
|
}
|
|
21098
21274
|
|
|
21099
21275
|
// node_modules/axios/lib/helpers/validator.js
|
|
@@ -21164,15 +21340,15 @@ var Axios = class {
|
|
|
21164
21340
|
response: new InterceptorManager_default()
|
|
21165
21341
|
};
|
|
21166
21342
|
}
|
|
21167
|
-
request(configOrUrl,
|
|
21343
|
+
request(configOrUrl, config4) {
|
|
21168
21344
|
if (typeof configOrUrl === "string") {
|
|
21169
|
-
|
|
21170
|
-
|
|
21345
|
+
config4 = config4 || {};
|
|
21346
|
+
config4.url = configOrUrl;
|
|
21171
21347
|
} else {
|
|
21172
|
-
|
|
21348
|
+
config4 = configOrUrl || {};
|
|
21173
21349
|
}
|
|
21174
|
-
|
|
21175
|
-
const { transitional: transitional2, paramsSerializer, headers } =
|
|
21350
|
+
config4 = mergeConfig(this.defaults, config4);
|
|
21351
|
+
const { transitional: transitional2, paramsSerializer, headers } = config4;
|
|
21176
21352
|
if (transitional2 !== void 0) {
|
|
21177
21353
|
validator_default.assertOptions(transitional2, {
|
|
21178
21354
|
silentJSONParsing: validators2.transitional(validators2.boolean),
|
|
@@ -21186,11 +21362,11 @@ var Axios = class {
|
|
|
21186
21362
|
serialize: validators2.function
|
|
21187
21363
|
}, true);
|
|
21188
21364
|
}
|
|
21189
|
-
|
|
21365
|
+
config4.method = (config4.method || this.defaults.method || "get").toLowerCase();
|
|
21190
21366
|
let contextHeaders;
|
|
21191
21367
|
contextHeaders = headers && utils_default.merge(
|
|
21192
21368
|
headers.common,
|
|
21193
|
-
headers[
|
|
21369
|
+
headers[config4.method]
|
|
21194
21370
|
);
|
|
21195
21371
|
contextHeaders && utils_default.forEach(
|
|
21196
21372
|
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
@@ -21198,11 +21374,11 @@ var Axios = class {
|
|
|
21198
21374
|
delete headers[method];
|
|
21199
21375
|
}
|
|
21200
21376
|
);
|
|
21201
|
-
|
|
21377
|
+
config4.headers = AxiosHeaders_default.concat(contextHeaders, headers);
|
|
21202
21378
|
const requestInterceptorChain = [];
|
|
21203
21379
|
let synchronousRequestInterceptors = true;
|
|
21204
21380
|
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
21205
|
-
if (typeof interceptor.runWhen === "function" && interceptor.runWhen(
|
|
21381
|
+
if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config4) === false) {
|
|
21206
21382
|
return;
|
|
21207
21383
|
}
|
|
21208
21384
|
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
@@ -21220,14 +21396,14 @@ var Axios = class {
|
|
|
21220
21396
|
chain.unshift.apply(chain, requestInterceptorChain);
|
|
21221
21397
|
chain.push.apply(chain, responseInterceptorChain);
|
|
21222
21398
|
len = chain.length;
|
|
21223
|
-
promise = Promise.resolve(
|
|
21399
|
+
promise = Promise.resolve(config4);
|
|
21224
21400
|
while (i2 < len) {
|
|
21225
21401
|
promise = promise.then(chain[i2++], chain[i2++]);
|
|
21226
21402
|
}
|
|
21227
21403
|
return promise;
|
|
21228
21404
|
}
|
|
21229
21405
|
len = requestInterceptorChain.length;
|
|
21230
|
-
let newConfig =
|
|
21406
|
+
let newConfig = config4;
|
|
21231
21407
|
i2 = 0;
|
|
21232
21408
|
while (i2 < len) {
|
|
21233
21409
|
const onFulfilled = requestInterceptorChain[i2++];
|
|
@@ -21251,25 +21427,25 @@ var Axios = class {
|
|
|
21251
21427
|
}
|
|
21252
21428
|
return promise;
|
|
21253
21429
|
}
|
|
21254
|
-
getUri(
|
|
21255
|
-
|
|
21256
|
-
const fullPath = buildFullPath(
|
|
21257
|
-
return buildURL(fullPath,
|
|
21430
|
+
getUri(config4) {
|
|
21431
|
+
config4 = mergeConfig(this.defaults, config4);
|
|
21432
|
+
const fullPath = buildFullPath(config4.baseURL, config4.url);
|
|
21433
|
+
return buildURL(fullPath, config4.params, config4.paramsSerializer);
|
|
21258
21434
|
}
|
|
21259
21435
|
};
|
|
21260
21436
|
utils_default.forEach(["delete", "get", "head", "options"], function forEachMethodNoData2(method) {
|
|
21261
|
-
Axios.prototype[method] = function(url3,
|
|
21262
|
-
return this.request(mergeConfig(
|
|
21437
|
+
Axios.prototype[method] = function(url3, config4) {
|
|
21438
|
+
return this.request(mergeConfig(config4 || {}, {
|
|
21263
21439
|
method,
|
|
21264
21440
|
url: url3,
|
|
21265
|
-
data: (
|
|
21441
|
+
data: (config4 || {}).data
|
|
21266
21442
|
}));
|
|
21267
21443
|
};
|
|
21268
21444
|
});
|
|
21269
21445
|
utils_default.forEach(["post", "put", "patch"], function forEachMethodWithData2(method) {
|
|
21270
21446
|
function generateHTTPMethod(isForm) {
|
|
21271
|
-
return function httpMethod(url3, data,
|
|
21272
|
-
return this.request(mergeConfig(
|
|
21447
|
+
return function httpMethod(url3, data, config4) {
|
|
21448
|
+
return this.request(mergeConfig(config4 || {}, {
|
|
21273
21449
|
method,
|
|
21274
21450
|
headers: isForm ? {
|
|
21275
21451
|
"Content-Type": "multipart/form-data"
|
|
@@ -21315,11 +21491,11 @@ var CancelToken = class {
|
|
|
21315
21491
|
};
|
|
21316
21492
|
return promise;
|
|
21317
21493
|
};
|
|
21318
|
-
executor(function cancel(message,
|
|
21494
|
+
executor(function cancel(message, config4, request) {
|
|
21319
21495
|
if (token.reason) {
|
|
21320
21496
|
return;
|
|
21321
21497
|
}
|
|
21322
|
-
token.reason = new CanceledError_default(message,
|
|
21498
|
+
token.reason = new CanceledError_default(message, config4, request);
|
|
21323
21499
|
resolvePromise(token.reason);
|
|
21324
21500
|
});
|
|
21325
21501
|
}
|
|
@@ -21497,22 +21673,22 @@ var {
|
|
|
21497
21673
|
|
|
21498
21674
|
// src/api.ts
|
|
21499
21675
|
var import_openai = __toESM(require_dist(), 1);
|
|
21500
|
-
var
|
|
21501
|
-
var maxTokens =
|
|
21502
|
-
var basePath =
|
|
21503
|
-
var apiKey =
|
|
21676
|
+
var config2 = getConfig();
|
|
21677
|
+
var maxTokens = config2?.OCO_OPENAI_MAX_TOKENS;
|
|
21678
|
+
var basePath = config2?.OCO_OPENAI_BASE_PATH;
|
|
21679
|
+
var apiKey = config2?.OCO_OPENAI_API_KEY;
|
|
21504
21680
|
var [command, mode] = process.argv.slice(2);
|
|
21505
21681
|
if (!apiKey && command !== "config" && mode !== "set" /* set */) {
|
|
21506
21682
|
ae("opencommit");
|
|
21507
21683
|
ce(
|
|
21508
|
-
"
|
|
21684
|
+
"OCO_OPENAI_API_KEY is not set, please run `oc config set OCO_OPENAI_API_KEY=<your token>. Make sure you add payment details, so API works.`"
|
|
21509
21685
|
);
|
|
21510
21686
|
ce(
|
|
21511
21687
|
"For help look into README https://github.com/di-sukharev/opencommit#setup"
|
|
21512
21688
|
);
|
|
21513
21689
|
process.exit(1);
|
|
21514
21690
|
}
|
|
21515
|
-
var MODEL =
|
|
21691
|
+
var MODEL = config2?.OCO_MODEL || "gpt-3.5-turbo";
|
|
21516
21692
|
var OpenAi = class {
|
|
21517
21693
|
openAiApiConfiguration = new import_openai.Configuration({
|
|
21518
21694
|
apiKey
|
|
@@ -21525,18 +21701,21 @@ var OpenAi = class {
|
|
|
21525
21701
|
this.openAI = new import_openai.OpenAIApi(this.openAiApiConfiguration);
|
|
21526
21702
|
}
|
|
21527
21703
|
generateCommitMessage = async (messages) => {
|
|
21704
|
+
const params = {
|
|
21705
|
+
model: MODEL,
|
|
21706
|
+
messages,
|
|
21707
|
+
temperature: 0,
|
|
21708
|
+
top_p: 0.1,
|
|
21709
|
+
max_tokens: maxTokens || 500
|
|
21710
|
+
};
|
|
21528
21711
|
try {
|
|
21529
|
-
const { data } = await this.openAI.createChatCompletion(
|
|
21530
|
-
model: MODEL,
|
|
21531
|
-
messages,
|
|
21532
|
-
temperature: 0,
|
|
21533
|
-
top_p: 0.1,
|
|
21534
|
-
max_tokens: maxTokens ?? 196
|
|
21535
|
-
});
|
|
21712
|
+
const { data } = await this.openAI.createChatCompletion(params);
|
|
21536
21713
|
const message = data.choices[0].message;
|
|
21537
21714
|
return message?.content;
|
|
21538
21715
|
} catch (error) {
|
|
21539
|
-
ce(`${source_default.red("\u2716")} ${
|
|
21716
|
+
ce(`${source_default.red("\u2716")} ${JSON.stringify(params)}`);
|
|
21717
|
+
const err = error;
|
|
21718
|
+
ce(`${source_default.red("\u2716")} ${err?.message || err}`);
|
|
21540
21719
|
if (axios_default.isAxiosError(error) && error.response?.status === 401) {
|
|
21541
21720
|
const openAiError = error.response.data.error;
|
|
21542
21721
|
if (openAiError?.message)
|
|
@@ -21545,7 +21724,7 @@ var OpenAi = class {
|
|
|
21545
21724
|
"For help look into README https://github.com/di-sukharev/opencommit#setup"
|
|
21546
21725
|
);
|
|
21547
21726
|
}
|
|
21548
|
-
|
|
21727
|
+
throw err;
|
|
21549
21728
|
}
|
|
21550
21729
|
};
|
|
21551
21730
|
};
|
|
@@ -21586,14 +21765,14 @@ function mergeDiffs(arr, maxStringLength) {
|
|
|
21586
21765
|
}
|
|
21587
21766
|
|
|
21588
21767
|
// src/generateCommitMessageFromGitDiff.ts
|
|
21589
|
-
var
|
|
21590
|
-
var translation = i18n[
|
|
21768
|
+
var config3 = getConfig();
|
|
21769
|
+
var translation = i18n[config3?.OCO_LANGUAGE || "en"];
|
|
21591
21770
|
var INIT_MESSAGES_PROMPT = [
|
|
21592
21771
|
{
|
|
21593
21772
|
role: import_openai2.ChatCompletionRequestMessageRoleEnum.System,
|
|
21594
21773
|
content: `You are to act as the author of a commit message in git. Your mission is to create clean and comprehensive commit messages in the conventional commit convention and explain WHAT were the changes and WHY the changes were done. I'll send you an output of 'git diff --staged' command, and you convert it into a commit message.
|
|
21595
|
-
${
|
|
21596
|
-
${
|
|
21774
|
+
${config3?.OCO_EMOJI ? "Use GitMoji convention to preface the commit." : "Do not preface the commit with anything."}
|
|
21775
|
+
${config3?.OCO_DESCRIPTION ? `Add a short description of WHY the changes are done after the commit message. Don't start it with "This commit", just describe the changes.` : "Don't add any descriptions to the commit, only commit message."}
|
|
21597
21776
|
Use the present tense. Lines must not be longer than 74 characters. Use ${translation.localLanguage} to answer.`
|
|
21598
21777
|
},
|
|
21599
21778
|
{
|
|
@@ -21625,9 +21804,9 @@ app.use((_, res, next) => {
|
|
|
21625
21804
|
},
|
|
21626
21805
|
{
|
|
21627
21806
|
role: import_openai2.ChatCompletionRequestMessageRoleEnum.Assistant,
|
|
21628
|
-
content: `${
|
|
21629
|
-
${
|
|
21630
|
-
${
|
|
21807
|
+
content: `${config3?.OCO_EMOJI ? "\u{1F41B} " : ""}${translation.commitFix}
|
|
21808
|
+
${config3?.OCO_EMOJI ? "\u2728 " : ""}${translation.commitFeat}
|
|
21809
|
+
${config3?.OCO_DESCRIPTION ? translation.commitDescription : ""}`
|
|
21631
21810
|
}
|
|
21632
21811
|
];
|
|
21633
21812
|
var generateCommitMessageChatCompletionPrompt = (diff) => {
|
|
@@ -21641,8 +21820,8 @@ var generateCommitMessageChatCompletionPrompt = (diff) => {
|
|
|
21641
21820
|
var INIT_MESSAGES_PROMPT_LENGTH = INIT_MESSAGES_PROMPT.map(
|
|
21642
21821
|
(msg) => tokenCount(msg.content) + 4
|
|
21643
21822
|
).reduce((a2, b5) => a2 + b5, 0);
|
|
21644
|
-
var MAX_REQ_TOKENS =
|
|
21645
|
-
var
|
|
21823
|
+
var MAX_REQ_TOKENS = 3e3 - INIT_MESSAGES_PROMPT_LENGTH;
|
|
21824
|
+
var generateCommitMessageByDiff = async (diff) => {
|
|
21646
21825
|
try {
|
|
21647
21826
|
if (tokenCount(diff) >= MAX_REQ_TOKENS) {
|
|
21648
21827
|
const commitMessagePromises = getCommitMsgsPromisesFromFileDiffs(
|
|
@@ -21655,11 +21834,11 @@ var generateCommitMessageWithChatCompletion = async (diff) => {
|
|
|
21655
21834
|
const messages = generateCommitMessageChatCompletionPrompt(diff);
|
|
21656
21835
|
const commitMessage = await api.generateCommitMessage(messages);
|
|
21657
21836
|
if (!commitMessage)
|
|
21658
|
-
|
|
21837
|
+
throw new Error("EMPTY_MESSAGE" /* emptyMessage */);
|
|
21659
21838
|
return commitMessage;
|
|
21660
21839
|
}
|
|
21661
21840
|
} catch (error) {
|
|
21662
|
-
|
|
21841
|
+
throw error;
|
|
21663
21842
|
}
|
|
21664
21843
|
};
|
|
21665
21844
|
function getMessagesPromisesByChangesInFile(fileDiff, separator, maxChangeLength) {
|
|
@@ -21727,22 +21906,18 @@ var prepareCommitMessageHook = async (isStageAllFlag = false) => {
|
|
|
21727
21906
|
if (!staged)
|
|
21728
21907
|
return;
|
|
21729
21908
|
ae("opencommit");
|
|
21730
|
-
const
|
|
21731
|
-
if (!
|
|
21909
|
+
const config4 = getConfig();
|
|
21910
|
+
if (!config4?.OCO_OPENAI_API_KEY) {
|
|
21732
21911
|
throw new Error(
|
|
21733
21912
|
"No OPEN_AI_API exists. Set your OPEN_AI_API=<key> in ~/.opencommit"
|
|
21734
21913
|
);
|
|
21735
21914
|
}
|
|
21736
21915
|
const spin = le();
|
|
21737
21916
|
spin.start("Generating commit message");
|
|
21738
|
-
const commitMessage = await
|
|
21917
|
+
const commitMessage = await generateCommitMessageByDiff(
|
|
21739
21918
|
await getDiff({ files: staged })
|
|
21740
21919
|
);
|
|
21741
|
-
|
|
21742
|
-
spin.stop("Error");
|
|
21743
|
-
throw new Error(commitMessage.error);
|
|
21744
|
-
} else
|
|
21745
|
-
spin.stop("Done");
|
|
21920
|
+
spin.stop("Done");
|
|
21746
21921
|
const fileContent = await import_promises2.default.readFile(messageFilePath);
|
|
21747
21922
|
await import_promises2.default.writeFile(
|
|
21748
21923
|
messageFilePath,
|
|
@@ -21775,82 +21950,80 @@ var generateCommitMessageFromGitDiff = async (diff, extraArgs2) => {
|
|
|
21775
21950
|
await assertGitRepo();
|
|
21776
21951
|
const commitSpinner = le();
|
|
21777
21952
|
commitSpinner.start("Generating the commit message");
|
|
21778
|
-
|
|
21779
|
-
|
|
21780
|
-
|
|
21781
|
-
|
|
21782
|
-
|
|
21783
|
-
["TOO_MUCH_TOKENS" /* tooMuchTokens */]: "too much tokens in git diff, stage and commit files in parts"
|
|
21784
|
-
};
|
|
21785
|
-
ce(`${source_default.red("\u2716")} ${errorMessages[commitMessage.error]}`);
|
|
21786
|
-
process.exit(1);
|
|
21787
|
-
}
|
|
21788
|
-
commitSpinner.stop("\u{1F4DD} Commit message generated");
|
|
21789
|
-
ce(
|
|
21790
|
-
`Commit message:
|
|
21953
|
+
try {
|
|
21954
|
+
const commitMessage = await generateCommitMessageByDiff(diff);
|
|
21955
|
+
commitSpinner.stop("\u{1F4DD} Commit message generated");
|
|
21956
|
+
ce(
|
|
21957
|
+
`Commit message:
|
|
21791
21958
|
${source_default.grey("\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014")}
|
|
21792
21959
|
${commitMessage}
|
|
21793
21960
|
${source_default.grey("\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014")}`
|
|
21794
|
-
|
|
21795
|
-
|
|
21796
|
-
|
|
21797
|
-
|
|
21798
|
-
|
|
21799
|
-
|
|
21800
|
-
|
|
21801
|
-
|
|
21802
|
-
|
|
21803
|
-
|
|
21804
|
-
|
|
21805
|
-
|
|
21806
|
-
|
|
21807
|
-
|
|
21808
|
-
|
|
21809
|
-
|
|
21810
|
-
if (stdout2)
|
|
21811
|
-
ce(stdout2);
|
|
21812
|
-
process.exit(0);
|
|
21813
|
-
}
|
|
21814
|
-
if (remotes.length === 1) {
|
|
21815
|
-
const isPushConfirmedByUser = await Q3({
|
|
21816
|
-
message: "Do you want to run `git push`?"
|
|
21817
|
-
});
|
|
21818
|
-
if (isPushConfirmedByUser && !eD2(isPushConfirmedByUser)) {
|
|
21819
|
-
const pushSpinner = le();
|
|
21820
|
-
pushSpinner.start(`Running \`git push ${remotes[0]}\``);
|
|
21821
|
-
const { stdout: stdout2 } = await execa("git", [
|
|
21822
|
-
"push",
|
|
21823
|
-
"--verbose",
|
|
21824
|
-
remotes[0]
|
|
21825
|
-
]);
|
|
21826
|
-
pushSpinner.stop(
|
|
21827
|
-
`${source_default.green("\u2714")} Successfully pushed all commits to ${remotes[0]}`
|
|
21828
|
-
);
|
|
21961
|
+
);
|
|
21962
|
+
const isCommitConfirmedByUser = await Q3({
|
|
21963
|
+
message: "Confirm the commit message?"
|
|
21964
|
+
});
|
|
21965
|
+
if (isCommitConfirmedByUser && !eD2(isCommitConfirmedByUser)) {
|
|
21966
|
+
const { stdout } = await execa("git", [
|
|
21967
|
+
"commit",
|
|
21968
|
+
"-m",
|
|
21969
|
+
commitMessage,
|
|
21970
|
+
...extraArgs2
|
|
21971
|
+
]);
|
|
21972
|
+
ce(`${source_default.green("\u2714")} Successfully committed`);
|
|
21973
|
+
ce(stdout);
|
|
21974
|
+
const remotes = await getGitRemotes();
|
|
21975
|
+
if (!remotes.length) {
|
|
21976
|
+
const { stdout: stdout2 } = await execa("git", ["push"]);
|
|
21829
21977
|
if (stdout2)
|
|
21830
21978
|
ce(stdout2);
|
|
21831
|
-
} else {
|
|
21832
|
-
ce("`git push` aborted");
|
|
21833
21979
|
process.exit(0);
|
|
21834
21980
|
}
|
|
21835
|
-
|
|
21836
|
-
|
|
21837
|
-
|
|
21838
|
-
|
|
21839
|
-
|
|
21840
|
-
|
|
21841
|
-
|
|
21842
|
-
|
|
21843
|
-
|
|
21844
|
-
|
|
21845
|
-
|
|
21846
|
-
|
|
21847
|
-
|
|
21848
|
-
|
|
21849
|
-
|
|
21850
|
-
|
|
21851
|
-
|
|
21852
|
-
|
|
21981
|
+
if (remotes.length === 1) {
|
|
21982
|
+
const isPushConfirmedByUser = await Q3({
|
|
21983
|
+
message: "Do you want to run `git push`?"
|
|
21984
|
+
});
|
|
21985
|
+
if (isPushConfirmedByUser && !eD2(isPushConfirmedByUser)) {
|
|
21986
|
+
const pushSpinner = le();
|
|
21987
|
+
pushSpinner.start(`Running \`git push ${remotes[0]}\``);
|
|
21988
|
+
const { stdout: stdout2 } = await execa("git", [
|
|
21989
|
+
"push",
|
|
21990
|
+
"--verbose",
|
|
21991
|
+
remotes[0]
|
|
21992
|
+
]);
|
|
21993
|
+
pushSpinner.stop(
|
|
21994
|
+
`${source_default.green("\u2714")} Successfully pushed all commits to ${remotes[0]}`
|
|
21995
|
+
);
|
|
21996
|
+
if (stdout2)
|
|
21997
|
+
ce(stdout2);
|
|
21998
|
+
} else {
|
|
21999
|
+
ce("`git push` aborted");
|
|
22000
|
+
process.exit(0);
|
|
22001
|
+
}
|
|
22002
|
+
} else {
|
|
22003
|
+
const selectedRemote = await ee({
|
|
22004
|
+
message: "Choose a remote to push to",
|
|
22005
|
+
options: remotes.map((remote) => ({ value: remote, label: remote }))
|
|
22006
|
+
});
|
|
22007
|
+
if (!eD2(selectedRemote)) {
|
|
22008
|
+
const pushSpinner = le();
|
|
22009
|
+
pushSpinner.start(`Running \`git push ${selectedRemote}\``);
|
|
22010
|
+
const { stdout: stdout2 } = await execa("git", ["push", selectedRemote]);
|
|
22011
|
+
pushSpinner.stop(
|
|
22012
|
+
`${source_default.green(
|
|
22013
|
+
"\u2714"
|
|
22014
|
+
)} Successfully pushed all commits to ${selectedRemote}`
|
|
22015
|
+
);
|
|
22016
|
+
if (stdout2)
|
|
22017
|
+
ce(stdout2);
|
|
22018
|
+
} else
|
|
22019
|
+
ce(`${source_default.gray("\u2716")} process cancelled`);
|
|
22020
|
+
}
|
|
21853
22021
|
}
|
|
22022
|
+
} catch (error) {
|
|
22023
|
+
commitSpinner.stop("\u{1F4DD} Commit message generated");
|
|
22024
|
+
const err = error;
|
|
22025
|
+
ce(`${source_default.red("\u2716")} ${err?.message || err}`);
|
|
22026
|
+
process.exit(1);
|
|
21854
22027
|
}
|
|
21855
22028
|
};
|
|
21856
22029
|
async function commit(extraArgs2 = [], isStageAllFlag = false) {
|