opencommit 3.2.18 → 3.2.19
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 +7 -1
- package/out/cli.cjs +758 -623
- package/package.json +10 -3
package/out/cli.cjs
CHANGED
|
@@ -9429,7 +9429,7 @@ var require_agent = __commonJS({
|
|
|
9429
9429
|
function deprecate2(message) {
|
|
9430
9430
|
console.log("[agentkeepalive:deprecated] %s", message);
|
|
9431
9431
|
}
|
|
9432
|
-
var
|
|
9432
|
+
var Agent4 = class extends OriginalAgent {
|
|
9433
9433
|
constructor(options) {
|
|
9434
9434
|
options = options || {};
|
|
9435
9435
|
options.keepAlive = options.keepAlive !== false;
|
|
@@ -9719,7 +9719,7 @@ var require_agent = __commonJS({
|
|
|
9719
9719
|
}
|
|
9720
9720
|
socket.on("agentRemove", onRemove);
|
|
9721
9721
|
}
|
|
9722
|
-
module2.exports =
|
|
9722
|
+
module2.exports = Agent4;
|
|
9723
9723
|
function inspect3(obj) {
|
|
9724
9724
|
const res = {};
|
|
9725
9725
|
for (const key in obj) {
|
|
@@ -15596,7 +15596,7 @@ var require_dist = __commonJS({
|
|
|
15596
15596
|
var https_1 = require("https");
|
|
15597
15597
|
__exportStar(require_helpers(), exports2);
|
|
15598
15598
|
var INTERNAL = Symbol("AgentBaseInternalState");
|
|
15599
|
-
var
|
|
15599
|
+
var Agent4 = class extends http3.Agent {
|
|
15600
15600
|
constructor(opts) {
|
|
15601
15601
|
super(opts);
|
|
15602
15602
|
this[INTERNAL] = {};
|
|
@@ -15703,7 +15703,7 @@ var require_dist = __commonJS({
|
|
|
15703
15703
|
}
|
|
15704
15704
|
}
|
|
15705
15705
|
};
|
|
15706
|
-
exports2.Agent =
|
|
15706
|
+
exports2.Agent = Agent4;
|
|
15707
15707
|
}
|
|
15708
15708
|
});
|
|
15709
15709
|
|
|
@@ -47349,494 +47349,6 @@ var require_mistralai = __commonJS({
|
|
|
47349
47349
|
}
|
|
47350
47350
|
});
|
|
47351
47351
|
|
|
47352
|
-
// node_modules/@commitlint/types/lib/ensure.js
|
|
47353
|
-
var require_ensure = __commonJS({
|
|
47354
|
-
"node_modules/@commitlint/types/lib/ensure.js"(exports2) {
|
|
47355
|
-
"use strict";
|
|
47356
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
47357
|
-
}
|
|
47358
|
-
});
|
|
47359
|
-
|
|
47360
|
-
// node_modules/@commitlint/types/lib/format.js
|
|
47361
|
-
var require_format = __commonJS({
|
|
47362
|
-
"node_modules/@commitlint/types/lib/format.js"(exports2) {
|
|
47363
|
-
"use strict";
|
|
47364
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
47365
|
-
}
|
|
47366
|
-
});
|
|
47367
|
-
|
|
47368
|
-
// node_modules/@commitlint/types/lib/is-ignored.js
|
|
47369
|
-
var require_is_ignored = __commonJS({
|
|
47370
|
-
"node_modules/@commitlint/types/lib/is-ignored.js"(exports2) {
|
|
47371
|
-
"use strict";
|
|
47372
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
47373
|
-
}
|
|
47374
|
-
});
|
|
47375
|
-
|
|
47376
|
-
// node_modules/@commitlint/types/lib/lint.js
|
|
47377
|
-
var require_lint = __commonJS({
|
|
47378
|
-
"node_modules/@commitlint/types/lib/lint.js"(exports2) {
|
|
47379
|
-
"use strict";
|
|
47380
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
47381
|
-
}
|
|
47382
|
-
});
|
|
47383
|
-
|
|
47384
|
-
// node_modules/@commitlint/types/lib/load.js
|
|
47385
|
-
var require_load = __commonJS({
|
|
47386
|
-
"node_modules/@commitlint/types/lib/load.js"(exports2) {
|
|
47387
|
-
"use strict";
|
|
47388
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
47389
|
-
}
|
|
47390
|
-
});
|
|
47391
|
-
|
|
47392
|
-
// node_modules/@commitlint/types/lib/parse.js
|
|
47393
|
-
var require_parse3 = __commonJS({
|
|
47394
|
-
"node_modules/@commitlint/types/lib/parse.js"(exports2) {
|
|
47395
|
-
"use strict";
|
|
47396
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
47397
|
-
}
|
|
47398
|
-
});
|
|
47399
|
-
|
|
47400
|
-
// node_modules/@commitlint/types/lib/prompt.js
|
|
47401
|
-
var require_prompt = __commonJS({
|
|
47402
|
-
"node_modules/@commitlint/types/lib/prompt.js"(exports2) {
|
|
47403
|
-
"use strict";
|
|
47404
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
47405
|
-
}
|
|
47406
|
-
});
|
|
47407
|
-
|
|
47408
|
-
// node_modules/@commitlint/types/lib/rules.js
|
|
47409
|
-
var require_rules = __commonJS({
|
|
47410
|
-
"node_modules/@commitlint/types/lib/rules.js"(exports2) {
|
|
47411
|
-
"use strict";
|
|
47412
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
47413
|
-
exports2.RuleConfigQuality = exports2.RuleConfigSeverity = void 0;
|
|
47414
|
-
var RuleConfigSeverity2;
|
|
47415
|
-
(function(RuleConfigSeverity3) {
|
|
47416
|
-
RuleConfigSeverity3[RuleConfigSeverity3["Disabled"] = 0] = "Disabled";
|
|
47417
|
-
RuleConfigSeverity3[RuleConfigSeverity3["Warning"] = 1] = "Warning";
|
|
47418
|
-
RuleConfigSeverity3[RuleConfigSeverity3["Error"] = 2] = "Error";
|
|
47419
|
-
})(RuleConfigSeverity2 || (exports2.RuleConfigSeverity = RuleConfigSeverity2 = {}));
|
|
47420
|
-
var RuleConfigQuality;
|
|
47421
|
-
(function(RuleConfigQuality2) {
|
|
47422
|
-
RuleConfigQuality2[RuleConfigQuality2["User"] = 0] = "User";
|
|
47423
|
-
RuleConfigQuality2[RuleConfigQuality2["Qualified"] = 1] = "Qualified";
|
|
47424
|
-
})(RuleConfigQuality || (exports2.RuleConfigQuality = RuleConfigQuality = {}));
|
|
47425
|
-
}
|
|
47426
|
-
});
|
|
47427
|
-
|
|
47428
|
-
// node_modules/@commitlint/types/lib/index.js
|
|
47429
|
-
var require_lib5 = __commonJS({
|
|
47430
|
-
"node_modules/@commitlint/types/lib/index.js"(exports2) {
|
|
47431
|
-
"use strict";
|
|
47432
|
-
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o3, m5, k7, k22) {
|
|
47433
|
-
if (k22 === void 0) k22 = k7;
|
|
47434
|
-
var desc = Object.getOwnPropertyDescriptor(m5, k7);
|
|
47435
|
-
if (!desc || ("get" in desc ? !m5.__esModule : desc.writable || desc.configurable)) {
|
|
47436
|
-
desc = { enumerable: true, get: function() {
|
|
47437
|
-
return m5[k7];
|
|
47438
|
-
} };
|
|
47439
|
-
}
|
|
47440
|
-
Object.defineProperty(o3, k22, desc);
|
|
47441
|
-
} : function(o3, m5, k7, k22) {
|
|
47442
|
-
if (k22 === void 0) k22 = k7;
|
|
47443
|
-
o3[k22] = m5[k7];
|
|
47444
|
-
});
|
|
47445
|
-
var __exportStar = exports2 && exports2.__exportStar || function(m5, exports3) {
|
|
47446
|
-
for (var p4 in m5) if (p4 !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p4)) __createBinding(exports3, m5, p4);
|
|
47447
|
-
};
|
|
47448
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
47449
|
-
__exportStar(require_ensure(), exports2);
|
|
47450
|
-
__exportStar(require_format(), exports2);
|
|
47451
|
-
__exportStar(require_is_ignored(), exports2);
|
|
47452
|
-
__exportStar(require_lint(), exports2);
|
|
47453
|
-
__exportStar(require_load(), exports2);
|
|
47454
|
-
__exportStar(require_parse3(), exports2);
|
|
47455
|
-
__exportStar(require_prompt(), exports2);
|
|
47456
|
-
__exportStar(require_rules(), exports2);
|
|
47457
|
-
}
|
|
47458
|
-
});
|
|
47459
|
-
|
|
47460
|
-
// node_modules/ignore/index.js
|
|
47461
|
-
var require_ignore = __commonJS({
|
|
47462
|
-
"node_modules/ignore/index.js"(exports2, module2) {
|
|
47463
|
-
function makeArray(subject) {
|
|
47464
|
-
return Array.isArray(subject) ? subject : [subject];
|
|
47465
|
-
}
|
|
47466
|
-
var EMPTY = "";
|
|
47467
|
-
var SPACE = " ";
|
|
47468
|
-
var ESCAPE = "\\";
|
|
47469
|
-
var REGEX_TEST_BLANK_LINE = /^\s+$/;
|
|
47470
|
-
var REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/;
|
|
47471
|
-
var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
|
|
47472
|
-
var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
|
|
47473
|
-
var REGEX_SPLITALL_CRLF = /\r?\n/g;
|
|
47474
|
-
var REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/;
|
|
47475
|
-
var SLASH = "/";
|
|
47476
|
-
var TMP_KEY_IGNORE = "node-ignore";
|
|
47477
|
-
if (typeof Symbol !== "undefined") {
|
|
47478
|
-
TMP_KEY_IGNORE = Symbol.for("node-ignore");
|
|
47479
|
-
}
|
|
47480
|
-
var KEY_IGNORE = TMP_KEY_IGNORE;
|
|
47481
|
-
var define2 = (object, key, value) => Object.defineProperty(object, key, { value });
|
|
47482
|
-
var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
|
|
47483
|
-
var RETURN_FALSE = () => false;
|
|
47484
|
-
var sanitizeRange = (range) => range.replace(
|
|
47485
|
-
REGEX_REGEXP_RANGE,
|
|
47486
|
-
(match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match : EMPTY
|
|
47487
|
-
);
|
|
47488
|
-
var cleanRangeBackSlash = (slashes) => {
|
|
47489
|
-
const { length } = slashes;
|
|
47490
|
-
return slashes.slice(0, length - length % 2);
|
|
47491
|
-
};
|
|
47492
|
-
var REPLACERS = [
|
|
47493
|
-
[
|
|
47494
|
-
// remove BOM
|
|
47495
|
-
// TODO:
|
|
47496
|
-
// Other similar zero-width characters?
|
|
47497
|
-
/^\uFEFF/,
|
|
47498
|
-
() => EMPTY
|
|
47499
|
-
],
|
|
47500
|
-
// > Trailing spaces are ignored unless they are quoted with backslash ("\")
|
|
47501
|
-
[
|
|
47502
|
-
// (a\ ) -> (a )
|
|
47503
|
-
// (a ) -> (a)
|
|
47504
|
-
// (a \ ) -> (a )
|
|
47505
|
-
/\\?\s+$/,
|
|
47506
|
-
(match) => match.indexOf("\\") === 0 ? SPACE : EMPTY
|
|
47507
|
-
],
|
|
47508
|
-
// replace (\ ) with ' '
|
|
47509
|
-
[
|
|
47510
|
-
/\\\s/g,
|
|
47511
|
-
() => SPACE
|
|
47512
|
-
],
|
|
47513
|
-
// Escape metacharacters
|
|
47514
|
-
// which is written down by users but means special for regular expressions.
|
|
47515
|
-
// > There are 12 characters with special meanings:
|
|
47516
|
-
// > - the backslash \,
|
|
47517
|
-
// > - the caret ^,
|
|
47518
|
-
// > - the dollar sign $,
|
|
47519
|
-
// > - the period or dot .,
|
|
47520
|
-
// > - the vertical bar or pipe symbol |,
|
|
47521
|
-
// > - the question mark ?,
|
|
47522
|
-
// > - the asterisk or star *,
|
|
47523
|
-
// > - the plus sign +,
|
|
47524
|
-
// > - the opening parenthesis (,
|
|
47525
|
-
// > - the closing parenthesis ),
|
|
47526
|
-
// > - and the opening square bracket [,
|
|
47527
|
-
// > - the opening curly brace {,
|
|
47528
|
-
// > These special characters are often called "metacharacters".
|
|
47529
|
-
[
|
|
47530
|
-
/[\\$.|*+(){^]/g,
|
|
47531
|
-
(match) => `\\${match}`
|
|
47532
|
-
],
|
|
47533
|
-
[
|
|
47534
|
-
// > a question mark (?) matches a single character
|
|
47535
|
-
/(?!\\)\?/g,
|
|
47536
|
-
() => "[^/]"
|
|
47537
|
-
],
|
|
47538
|
-
// leading slash
|
|
47539
|
-
[
|
|
47540
|
-
// > A leading slash matches the beginning of the pathname.
|
|
47541
|
-
// > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
|
|
47542
|
-
// A leading slash matches the beginning of the pathname
|
|
47543
|
-
/^\//,
|
|
47544
|
-
() => "^"
|
|
47545
|
-
],
|
|
47546
|
-
// replace special metacharacter slash after the leading slash
|
|
47547
|
-
[
|
|
47548
|
-
/\//g,
|
|
47549
|
-
() => "\\/"
|
|
47550
|
-
],
|
|
47551
|
-
[
|
|
47552
|
-
// > A leading "**" followed by a slash means match in all directories.
|
|
47553
|
-
// > For example, "**/foo" matches file or directory "foo" anywhere,
|
|
47554
|
-
// > the same as pattern "foo".
|
|
47555
|
-
// > "**/foo/bar" matches file or directory "bar" anywhere that is directly
|
|
47556
|
-
// > under directory "foo".
|
|
47557
|
-
// Notice that the '*'s have been replaced as '\\*'
|
|
47558
|
-
/^\^*\\\*\\\*\\\//,
|
|
47559
|
-
// '**/foo' <-> 'foo'
|
|
47560
|
-
() => "^(?:.*\\/)?"
|
|
47561
|
-
],
|
|
47562
|
-
// starting
|
|
47563
|
-
[
|
|
47564
|
-
// there will be no leading '/'
|
|
47565
|
-
// (which has been replaced by section "leading slash")
|
|
47566
|
-
// If starts with '**', adding a '^' to the regular expression also works
|
|
47567
|
-
/^(?=[^^])/,
|
|
47568
|
-
function startingReplacer() {
|
|
47569
|
-
return !/\/(?!$)/.test(this) ? "(?:^|\\/)" : "^";
|
|
47570
|
-
}
|
|
47571
|
-
],
|
|
47572
|
-
// two globstars
|
|
47573
|
-
[
|
|
47574
|
-
// Use lookahead assertions so that we could match more than one `'/**'`
|
|
47575
|
-
/\\\/\\\*\\\*(?=\\\/|$)/g,
|
|
47576
|
-
// Zero, one or several directories
|
|
47577
|
-
// should not use '*', or it will be replaced by the next replacer
|
|
47578
|
-
// Check if it is not the last `'/**'`
|
|
47579
|
-
(_7, index, str2) => index + 6 < str2.length ? "(?:\\/[^\\/]+)*" : "\\/.+"
|
|
47580
|
-
],
|
|
47581
|
-
// normal intermediate wildcards
|
|
47582
|
-
[
|
|
47583
|
-
// Never replace escaped '*'
|
|
47584
|
-
// ignore rule '\*' will match the path '*'
|
|
47585
|
-
// 'abc.*/' -> go
|
|
47586
|
-
// 'abc.*' -> skip this rule,
|
|
47587
|
-
// coz trailing single wildcard will be handed by [trailing wildcard]
|
|
47588
|
-
/(^|[^\\]+)(\\\*)+(?=.+)/g,
|
|
47589
|
-
// '*.js' matches '.js'
|
|
47590
|
-
// '*.js' doesn't match 'abc'
|
|
47591
|
-
(_7, p1, p22) => {
|
|
47592
|
-
const unescaped = p22.replace(/\\\*/g, "[^\\/]*");
|
|
47593
|
-
return p1 + unescaped;
|
|
47594
|
-
}
|
|
47595
|
-
],
|
|
47596
|
-
[
|
|
47597
|
-
// unescape, revert step 3 except for back slash
|
|
47598
|
-
// For example, if a user escape a '\\*',
|
|
47599
|
-
// after step 3, the result will be '\\\\\\*'
|
|
47600
|
-
/\\\\\\(?=[$.|*+(){^])/g,
|
|
47601
|
-
() => ESCAPE
|
|
47602
|
-
],
|
|
47603
|
-
[
|
|
47604
|
-
// '\\\\' -> '\\'
|
|
47605
|
-
/\\\\/g,
|
|
47606
|
-
() => ESCAPE
|
|
47607
|
-
],
|
|
47608
|
-
[
|
|
47609
|
-
// > The range notation, e.g. [a-zA-Z],
|
|
47610
|
-
// > can be used to match one of the characters in a range.
|
|
47611
|
-
// `\` is escaped by step 3
|
|
47612
|
-
/(\\)?\[([^\]/]*?)(\\*)($|\])/g,
|
|
47613
|
-
(match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` : close === "]" ? endEscape.length % 2 === 0 ? `[${sanitizeRange(range)}${endEscape}]` : "[]" : "[]"
|
|
47614
|
-
],
|
|
47615
|
-
// ending
|
|
47616
|
-
[
|
|
47617
|
-
// 'js' will not match 'js.'
|
|
47618
|
-
// 'ab' will not match 'abc'
|
|
47619
|
-
/(?:[^*])$/,
|
|
47620
|
-
// WTF!
|
|
47621
|
-
// https://git-scm.com/docs/gitignore
|
|
47622
|
-
// changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)
|
|
47623
|
-
// which re-fixes #24, #38
|
|
47624
|
-
// > If there is a separator at the end of the pattern then the pattern
|
|
47625
|
-
// > will only match directories, otherwise the pattern can match both
|
|
47626
|
-
// > files and directories.
|
|
47627
|
-
// 'js*' will not match 'a.js'
|
|
47628
|
-
// 'js/' will not match 'a.js'
|
|
47629
|
-
// 'js' will match 'a.js' and 'a.js/'
|
|
47630
|
-
(match) => /\/$/.test(match) ? `${match}$` : `${match}(?=$|\\/$)`
|
|
47631
|
-
],
|
|
47632
|
-
// trailing wildcard
|
|
47633
|
-
[
|
|
47634
|
-
/(\^|\\\/)?\\\*$/,
|
|
47635
|
-
(_7, p1) => {
|
|
47636
|
-
const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
|
|
47637
|
-
return `${prefix}(?=$|\\/$)`;
|
|
47638
|
-
}
|
|
47639
|
-
]
|
|
47640
|
-
];
|
|
47641
|
-
var regexCache = /* @__PURE__ */ Object.create(null);
|
|
47642
|
-
var makeRegex = (pattern, ignoreCase) => {
|
|
47643
|
-
let source = regexCache[pattern];
|
|
47644
|
-
if (!source) {
|
|
47645
|
-
source = REPLACERS.reduce(
|
|
47646
|
-
(prev, current) => prev.replace(current[0], current[1].bind(pattern)),
|
|
47647
|
-
pattern
|
|
47648
|
-
);
|
|
47649
|
-
regexCache[pattern] = source;
|
|
47650
|
-
}
|
|
47651
|
-
return ignoreCase ? new RegExp(source, "i") : new RegExp(source);
|
|
47652
|
-
};
|
|
47653
|
-
var isString2 = (subject) => typeof subject === "string";
|
|
47654
|
-
var checkPattern = (pattern) => pattern && isString2(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern) && pattern.indexOf("#") !== 0;
|
|
47655
|
-
var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF);
|
|
47656
|
-
var IgnoreRule = class {
|
|
47657
|
-
constructor(origin2, pattern, negative, regex) {
|
|
47658
|
-
this.origin = origin2;
|
|
47659
|
-
this.pattern = pattern;
|
|
47660
|
-
this.negative = negative;
|
|
47661
|
-
this.regex = regex;
|
|
47662
|
-
}
|
|
47663
|
-
};
|
|
47664
|
-
var createRule = (pattern, ignoreCase) => {
|
|
47665
|
-
const origin2 = pattern;
|
|
47666
|
-
let negative = false;
|
|
47667
|
-
if (pattern.indexOf("!") === 0) {
|
|
47668
|
-
negative = true;
|
|
47669
|
-
pattern = pattern.substr(1);
|
|
47670
|
-
}
|
|
47671
|
-
pattern = pattern.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
|
|
47672
|
-
const regex = makeRegex(pattern, ignoreCase);
|
|
47673
|
-
return new IgnoreRule(
|
|
47674
|
-
origin2,
|
|
47675
|
-
pattern,
|
|
47676
|
-
negative,
|
|
47677
|
-
regex
|
|
47678
|
-
);
|
|
47679
|
-
};
|
|
47680
|
-
var throwError = (message, Ctor) => {
|
|
47681
|
-
throw new Ctor(message);
|
|
47682
|
-
};
|
|
47683
|
-
var checkPath = (path5, originalPath, doThrow) => {
|
|
47684
|
-
if (!isString2(path5)) {
|
|
47685
|
-
return doThrow(
|
|
47686
|
-
`path must be a string, but got \`${originalPath}\``,
|
|
47687
|
-
TypeError
|
|
47688
|
-
);
|
|
47689
|
-
}
|
|
47690
|
-
if (!path5) {
|
|
47691
|
-
return doThrow(`path must not be empty`, TypeError);
|
|
47692
|
-
}
|
|
47693
|
-
if (checkPath.isNotRelative(path5)) {
|
|
47694
|
-
const r3 = "`path.relative()`d";
|
|
47695
|
-
return doThrow(
|
|
47696
|
-
`path should be a ${r3} string, but got "${originalPath}"`,
|
|
47697
|
-
RangeError
|
|
47698
|
-
);
|
|
47699
|
-
}
|
|
47700
|
-
return true;
|
|
47701
|
-
};
|
|
47702
|
-
var isNotRelative = (path5) => REGEX_TEST_INVALID_PATH.test(path5);
|
|
47703
|
-
checkPath.isNotRelative = isNotRelative;
|
|
47704
|
-
checkPath.convert = (p4) => p4;
|
|
47705
|
-
var Ignore2 = class {
|
|
47706
|
-
constructor({
|
|
47707
|
-
ignorecase = true,
|
|
47708
|
-
ignoreCase = ignorecase,
|
|
47709
|
-
allowRelativePaths = false
|
|
47710
|
-
} = {}) {
|
|
47711
|
-
define2(this, KEY_IGNORE, true);
|
|
47712
|
-
this._rules = [];
|
|
47713
|
-
this._ignoreCase = ignoreCase;
|
|
47714
|
-
this._allowRelativePaths = allowRelativePaths;
|
|
47715
|
-
this._initCache();
|
|
47716
|
-
}
|
|
47717
|
-
_initCache() {
|
|
47718
|
-
this._ignoreCache = /* @__PURE__ */ Object.create(null);
|
|
47719
|
-
this._testCache = /* @__PURE__ */ Object.create(null);
|
|
47720
|
-
}
|
|
47721
|
-
_addPattern(pattern) {
|
|
47722
|
-
if (pattern && pattern[KEY_IGNORE]) {
|
|
47723
|
-
this._rules = this._rules.concat(pattern._rules);
|
|
47724
|
-
this._added = true;
|
|
47725
|
-
return;
|
|
47726
|
-
}
|
|
47727
|
-
if (checkPattern(pattern)) {
|
|
47728
|
-
const rule = createRule(pattern, this._ignoreCase);
|
|
47729
|
-
this._added = true;
|
|
47730
|
-
this._rules.push(rule);
|
|
47731
|
-
}
|
|
47732
|
-
}
|
|
47733
|
-
// @param {Array<string> | string | Ignore} pattern
|
|
47734
|
-
add(pattern) {
|
|
47735
|
-
this._added = false;
|
|
47736
|
-
makeArray(
|
|
47737
|
-
isString2(pattern) ? splitPattern(pattern) : pattern
|
|
47738
|
-
).forEach(this._addPattern, this);
|
|
47739
|
-
if (this._added) {
|
|
47740
|
-
this._initCache();
|
|
47741
|
-
}
|
|
47742
|
-
return this;
|
|
47743
|
-
}
|
|
47744
|
-
// legacy
|
|
47745
|
-
addPattern(pattern) {
|
|
47746
|
-
return this.add(pattern);
|
|
47747
|
-
}
|
|
47748
|
-
// | ignored : unignored
|
|
47749
|
-
// negative | 0:0 | 0:1 | 1:0 | 1:1
|
|
47750
|
-
// -------- | ------- | ------- | ------- | --------
|
|
47751
|
-
// 0 | TEST | TEST | SKIP | X
|
|
47752
|
-
// 1 | TESTIF | SKIP | TEST | X
|
|
47753
|
-
// - SKIP: always skip
|
|
47754
|
-
// - TEST: always test
|
|
47755
|
-
// - TESTIF: only test if checkUnignored
|
|
47756
|
-
// - X: that never happen
|
|
47757
|
-
// @param {boolean} whether should check if the path is unignored,
|
|
47758
|
-
// setting `checkUnignored` to `false` could reduce additional
|
|
47759
|
-
// path matching.
|
|
47760
|
-
// @returns {TestResult} true if a file is ignored
|
|
47761
|
-
_testOne(path5, checkUnignored) {
|
|
47762
|
-
let ignored = false;
|
|
47763
|
-
let unignored = false;
|
|
47764
|
-
this._rules.forEach((rule) => {
|
|
47765
|
-
const { negative } = rule;
|
|
47766
|
-
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
|
|
47767
|
-
return;
|
|
47768
|
-
}
|
|
47769
|
-
const matched = rule.regex.test(path5);
|
|
47770
|
-
if (matched) {
|
|
47771
|
-
ignored = !negative;
|
|
47772
|
-
unignored = negative;
|
|
47773
|
-
}
|
|
47774
|
-
});
|
|
47775
|
-
return {
|
|
47776
|
-
ignored,
|
|
47777
|
-
unignored
|
|
47778
|
-
};
|
|
47779
|
-
}
|
|
47780
|
-
// @returns {TestResult}
|
|
47781
|
-
_test(originalPath, cache, checkUnignored, slices) {
|
|
47782
|
-
const path5 = originalPath && checkPath.convert(originalPath);
|
|
47783
|
-
checkPath(
|
|
47784
|
-
path5,
|
|
47785
|
-
originalPath,
|
|
47786
|
-
this._allowRelativePaths ? RETURN_FALSE : throwError
|
|
47787
|
-
);
|
|
47788
|
-
return this._t(path5, cache, checkUnignored, slices);
|
|
47789
|
-
}
|
|
47790
|
-
_t(path5, cache, checkUnignored, slices) {
|
|
47791
|
-
if (path5 in cache) {
|
|
47792
|
-
return cache[path5];
|
|
47793
|
-
}
|
|
47794
|
-
if (!slices) {
|
|
47795
|
-
slices = path5.split(SLASH);
|
|
47796
|
-
}
|
|
47797
|
-
slices.pop();
|
|
47798
|
-
if (!slices.length) {
|
|
47799
|
-
return cache[path5] = this._testOne(path5, checkUnignored);
|
|
47800
|
-
}
|
|
47801
|
-
const parent = this._t(
|
|
47802
|
-
slices.join(SLASH) + SLASH,
|
|
47803
|
-
cache,
|
|
47804
|
-
checkUnignored,
|
|
47805
|
-
slices
|
|
47806
|
-
);
|
|
47807
|
-
return cache[path5] = parent.ignored ? parent : this._testOne(path5, checkUnignored);
|
|
47808
|
-
}
|
|
47809
|
-
ignores(path5) {
|
|
47810
|
-
return this._test(path5, this._ignoreCache, false).ignored;
|
|
47811
|
-
}
|
|
47812
|
-
createFilter() {
|
|
47813
|
-
return (path5) => !this.ignores(path5);
|
|
47814
|
-
}
|
|
47815
|
-
filter(paths) {
|
|
47816
|
-
return makeArray(paths).filter(this.createFilter());
|
|
47817
|
-
}
|
|
47818
|
-
// @returns {TestResult}
|
|
47819
|
-
test(path5) {
|
|
47820
|
-
return this._test(path5, this._testCache, true);
|
|
47821
|
-
}
|
|
47822
|
-
};
|
|
47823
|
-
var factory = (options) => new Ignore2(options);
|
|
47824
|
-
var isPathValid = (path5) => checkPath(path5 && checkPath.convert(path5), path5, RETURN_FALSE);
|
|
47825
|
-
factory.isPathValid = isPathValid;
|
|
47826
|
-
factory.default = factory;
|
|
47827
|
-
module2.exports = factory;
|
|
47828
|
-
if (
|
|
47829
|
-
// Detect `process` so that it can run in browsers.
|
|
47830
|
-
typeof process !== "undefined" && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === "win32")
|
|
47831
|
-
) {
|
|
47832
|
-
const makePosix = (str2) => /^\\\\\?\\/.test(str2) || /["<>|\u0000-\u001F]+/u.test(str2) ? str2 : str2.replace(/\\/g, "/");
|
|
47833
|
-
checkPath.convert = makePosix;
|
|
47834
|
-
const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
47835
|
-
checkPath.isNotRelative = (path5) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path5) || isNotRelative(path5);
|
|
47836
|
-
}
|
|
47837
|
-
}
|
|
47838
|
-
});
|
|
47839
|
-
|
|
47840
47352
|
// node_modules/undici/lib/core/symbols.js
|
|
47841
47353
|
var require_symbols = __commonJS({
|
|
47842
47354
|
"node_modules/undici/lib/core/symbols.js"(exports2, module2) {
|
|
@@ -56409,7 +55921,7 @@ var require_agent2 = __commonJS({
|
|
|
56409
55921
|
function defaultFactory(origin2, opts) {
|
|
56410
55922
|
return opts && opts.connections === 1 ? new Client(origin2, opts) : new Pool(origin2, opts);
|
|
56411
55923
|
}
|
|
56412
|
-
var
|
|
55924
|
+
var Agent4 = class extends DispatcherBase {
|
|
56413
55925
|
constructor({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {
|
|
56414
55926
|
super();
|
|
56415
55927
|
if (typeof factory !== "function") {
|
|
@@ -56500,7 +56012,7 @@ var require_agent2 = __commonJS({
|
|
|
56500
56012
|
await Promise.all(destroyPromises);
|
|
56501
56013
|
}
|
|
56502
56014
|
};
|
|
56503
|
-
module2.exports =
|
|
56015
|
+
module2.exports = Agent4;
|
|
56504
56016
|
}
|
|
56505
56017
|
});
|
|
56506
56018
|
|
|
@@ -58233,7 +57745,7 @@ var require_mock_agent = __commonJS({
|
|
|
58233
57745
|
"node_modules/undici/lib/mock/mock-agent.js"(exports2, module2) {
|
|
58234
57746
|
"use strict";
|
|
58235
57747
|
var { kClients } = require_symbols();
|
|
58236
|
-
var
|
|
57748
|
+
var Agent4 = require_agent2();
|
|
58237
57749
|
var {
|
|
58238
57750
|
kAgent,
|
|
58239
57751
|
kMockAgentSet,
|
|
@@ -58268,7 +57780,7 @@ var require_mock_agent = __commonJS({
|
|
|
58268
57780
|
if (opts && opts.agent && typeof opts.agent.dispatch !== "function") {
|
|
58269
57781
|
throw new InvalidArgumentError("Argument opts.agent must implement Agent");
|
|
58270
57782
|
}
|
|
58271
|
-
const agent = opts && opts.agent ? opts.agent : new
|
|
57783
|
+
const agent = opts && opts.agent ? opts.agent : new Agent4(opts);
|
|
58272
57784
|
this[kAgent] = agent;
|
|
58273
57785
|
this[kClients] = agent[kClients];
|
|
58274
57786
|
this[kOptions] = buildMockOptions(opts);
|
|
@@ -58373,7 +57885,7 @@ var require_proxy_agent = __commonJS({
|
|
|
58373
57885
|
"use strict";
|
|
58374
57886
|
var { kProxy, kClose, kDestroy, kInterceptors } = require_symbols();
|
|
58375
57887
|
var { URL: URL2 } = require("url");
|
|
58376
|
-
var
|
|
57888
|
+
var Agent4 = require_agent2();
|
|
58377
57889
|
var Pool = require_pool();
|
|
58378
57890
|
var DispatcherBase = require_dispatcher_base();
|
|
58379
57891
|
var { InvalidArgumentError, RequestAbortedError } = require_errors3();
|
|
@@ -58406,7 +57918,7 @@ var require_proxy_agent = __commonJS({
|
|
|
58406
57918
|
constructor(opts) {
|
|
58407
57919
|
super(opts);
|
|
58408
57920
|
this[kProxy] = buildProxyOptions(opts);
|
|
58409
|
-
this[kAgent] = new
|
|
57921
|
+
this[kAgent] = new Agent4(opts);
|
|
58410
57922
|
this[kInterceptors] = opts.interceptors && opts.interceptors.ProxyAgent && Array.isArray(opts.interceptors.ProxyAgent) ? opts.interceptors.ProxyAgent : [];
|
|
58411
57923
|
if (typeof opts === "string") {
|
|
58412
57924
|
opts = { uri: opts };
|
|
@@ -58435,7 +57947,7 @@ var require_proxy_agent = __commonJS({
|
|
|
58435
57947
|
const connect = buildConnector({ ...opts.proxyTls });
|
|
58436
57948
|
this[kConnectEndpoint] = buildConnector({ ...opts.requestTls });
|
|
58437
57949
|
this[kClient] = clientFactory(resolvedUrl, { connect });
|
|
58438
|
-
this[kAgent] = new
|
|
57950
|
+
this[kAgent] = new Agent4({
|
|
58439
57951
|
...opts,
|
|
58440
57952
|
connect: async (opts2, callback) => {
|
|
58441
57953
|
let requestedHost = opts2.host;
|
|
@@ -58792,9 +58304,9 @@ var require_global2 = __commonJS({
|
|
|
58792
58304
|
"use strict";
|
|
58793
58305
|
var globalDispatcher = Symbol.for("undici.globalDispatcher.1");
|
|
58794
58306
|
var { InvalidArgumentError } = require_errors3();
|
|
58795
|
-
var
|
|
58307
|
+
var Agent4 = require_agent2();
|
|
58796
58308
|
if (getGlobalDispatcher() === void 0) {
|
|
58797
|
-
setGlobalDispatcher2(new
|
|
58309
|
+
setGlobalDispatcher2(new Agent4());
|
|
58798
58310
|
}
|
|
58799
58311
|
function setGlobalDispatcher2(agent) {
|
|
58800
58312
|
if (!agent || typeof agent.dispatch !== "function") {
|
|
@@ -62948,7 +62460,7 @@ var require_util7 = __commonJS({
|
|
|
62948
62460
|
});
|
|
62949
62461
|
|
|
62950
62462
|
// node_modules/undici/lib/cookies/parse.js
|
|
62951
|
-
var
|
|
62463
|
+
var require_parse3 = __commonJS({
|
|
62952
62464
|
"node_modules/undici/lib/cookies/parse.js"(exports2, module2) {
|
|
62953
62465
|
"use strict";
|
|
62954
62466
|
var { maxNameValuePairSize, maxAttributeValueSize } = require_constants5();
|
|
@@ -63091,7 +62603,7 @@ var require_parse4 = __commonJS({
|
|
|
63091
62603
|
var require_cookies = __commonJS({
|
|
63092
62604
|
"node_modules/undici/lib/cookies/index.js"(exports2, module2) {
|
|
63093
62605
|
"use strict";
|
|
63094
|
-
var { parseSetCookie } =
|
|
62606
|
+
var { parseSetCookie } = require_parse3();
|
|
63095
62607
|
var { stringify: stringify2 } = require_util7();
|
|
63096
62608
|
var { webidl } = require_webidl();
|
|
63097
62609
|
var { Headers: Headers6 } = require_headers();
|
|
@@ -64464,7 +63976,7 @@ var require_undici = __commonJS({
|
|
|
64464
63976
|
var errors = require_errors3();
|
|
64465
63977
|
var Pool = require_pool();
|
|
64466
63978
|
var BalancedPool = require_balanced_pool();
|
|
64467
|
-
var
|
|
63979
|
+
var Agent4 = require_agent2();
|
|
64468
63980
|
var util4 = require_util2();
|
|
64469
63981
|
var { InvalidArgumentError } = errors;
|
|
64470
63982
|
var api = require_api();
|
|
@@ -64491,7 +64003,7 @@ var require_undici = __commonJS({
|
|
|
64491
64003
|
module2.exports.Client = Client;
|
|
64492
64004
|
module2.exports.Pool = Pool;
|
|
64493
64005
|
module2.exports.BalancedPool = BalancedPool;
|
|
64494
|
-
module2.exports.Agent =
|
|
64006
|
+
module2.exports.Agent = Agent4;
|
|
64495
64007
|
module2.exports.ProxyAgent = ProxyAgent2;
|
|
64496
64008
|
module2.exports.RetryHandler = RetryHandler;
|
|
64497
64009
|
module2.exports.DecoratorHandler = DecoratorHandler;
|
|
@@ -64594,6 +64106,494 @@ var require_undici = __commonJS({
|
|
|
64594
64106
|
}
|
|
64595
64107
|
});
|
|
64596
64108
|
|
|
64109
|
+
// node_modules/@commitlint/types/lib/ensure.js
|
|
64110
|
+
var require_ensure = __commonJS({
|
|
64111
|
+
"node_modules/@commitlint/types/lib/ensure.js"(exports2) {
|
|
64112
|
+
"use strict";
|
|
64113
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
64114
|
+
}
|
|
64115
|
+
});
|
|
64116
|
+
|
|
64117
|
+
// node_modules/@commitlint/types/lib/format.js
|
|
64118
|
+
var require_format = __commonJS({
|
|
64119
|
+
"node_modules/@commitlint/types/lib/format.js"(exports2) {
|
|
64120
|
+
"use strict";
|
|
64121
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
64122
|
+
}
|
|
64123
|
+
});
|
|
64124
|
+
|
|
64125
|
+
// node_modules/@commitlint/types/lib/is-ignored.js
|
|
64126
|
+
var require_is_ignored = __commonJS({
|
|
64127
|
+
"node_modules/@commitlint/types/lib/is-ignored.js"(exports2) {
|
|
64128
|
+
"use strict";
|
|
64129
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
64130
|
+
}
|
|
64131
|
+
});
|
|
64132
|
+
|
|
64133
|
+
// node_modules/@commitlint/types/lib/lint.js
|
|
64134
|
+
var require_lint = __commonJS({
|
|
64135
|
+
"node_modules/@commitlint/types/lib/lint.js"(exports2) {
|
|
64136
|
+
"use strict";
|
|
64137
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
64138
|
+
}
|
|
64139
|
+
});
|
|
64140
|
+
|
|
64141
|
+
// node_modules/@commitlint/types/lib/load.js
|
|
64142
|
+
var require_load = __commonJS({
|
|
64143
|
+
"node_modules/@commitlint/types/lib/load.js"(exports2) {
|
|
64144
|
+
"use strict";
|
|
64145
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
64146
|
+
}
|
|
64147
|
+
});
|
|
64148
|
+
|
|
64149
|
+
// node_modules/@commitlint/types/lib/parse.js
|
|
64150
|
+
var require_parse4 = __commonJS({
|
|
64151
|
+
"node_modules/@commitlint/types/lib/parse.js"(exports2) {
|
|
64152
|
+
"use strict";
|
|
64153
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
64154
|
+
}
|
|
64155
|
+
});
|
|
64156
|
+
|
|
64157
|
+
// node_modules/@commitlint/types/lib/prompt.js
|
|
64158
|
+
var require_prompt = __commonJS({
|
|
64159
|
+
"node_modules/@commitlint/types/lib/prompt.js"(exports2) {
|
|
64160
|
+
"use strict";
|
|
64161
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
64162
|
+
}
|
|
64163
|
+
});
|
|
64164
|
+
|
|
64165
|
+
// node_modules/@commitlint/types/lib/rules.js
|
|
64166
|
+
var require_rules = __commonJS({
|
|
64167
|
+
"node_modules/@commitlint/types/lib/rules.js"(exports2) {
|
|
64168
|
+
"use strict";
|
|
64169
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
64170
|
+
exports2.RuleConfigQuality = exports2.RuleConfigSeverity = void 0;
|
|
64171
|
+
var RuleConfigSeverity2;
|
|
64172
|
+
(function(RuleConfigSeverity3) {
|
|
64173
|
+
RuleConfigSeverity3[RuleConfigSeverity3["Disabled"] = 0] = "Disabled";
|
|
64174
|
+
RuleConfigSeverity3[RuleConfigSeverity3["Warning"] = 1] = "Warning";
|
|
64175
|
+
RuleConfigSeverity3[RuleConfigSeverity3["Error"] = 2] = "Error";
|
|
64176
|
+
})(RuleConfigSeverity2 || (exports2.RuleConfigSeverity = RuleConfigSeverity2 = {}));
|
|
64177
|
+
var RuleConfigQuality;
|
|
64178
|
+
(function(RuleConfigQuality2) {
|
|
64179
|
+
RuleConfigQuality2[RuleConfigQuality2["User"] = 0] = "User";
|
|
64180
|
+
RuleConfigQuality2[RuleConfigQuality2["Qualified"] = 1] = "Qualified";
|
|
64181
|
+
})(RuleConfigQuality || (exports2.RuleConfigQuality = RuleConfigQuality = {}));
|
|
64182
|
+
}
|
|
64183
|
+
});
|
|
64184
|
+
|
|
64185
|
+
// node_modules/@commitlint/types/lib/index.js
|
|
64186
|
+
var require_lib5 = __commonJS({
|
|
64187
|
+
"node_modules/@commitlint/types/lib/index.js"(exports2) {
|
|
64188
|
+
"use strict";
|
|
64189
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o3, m5, k7, k22) {
|
|
64190
|
+
if (k22 === void 0) k22 = k7;
|
|
64191
|
+
var desc = Object.getOwnPropertyDescriptor(m5, k7);
|
|
64192
|
+
if (!desc || ("get" in desc ? !m5.__esModule : desc.writable || desc.configurable)) {
|
|
64193
|
+
desc = { enumerable: true, get: function() {
|
|
64194
|
+
return m5[k7];
|
|
64195
|
+
} };
|
|
64196
|
+
}
|
|
64197
|
+
Object.defineProperty(o3, k22, desc);
|
|
64198
|
+
} : function(o3, m5, k7, k22) {
|
|
64199
|
+
if (k22 === void 0) k22 = k7;
|
|
64200
|
+
o3[k22] = m5[k7];
|
|
64201
|
+
});
|
|
64202
|
+
var __exportStar = exports2 && exports2.__exportStar || function(m5, exports3) {
|
|
64203
|
+
for (var p4 in m5) if (p4 !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p4)) __createBinding(exports3, m5, p4);
|
|
64204
|
+
};
|
|
64205
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
64206
|
+
__exportStar(require_ensure(), exports2);
|
|
64207
|
+
__exportStar(require_format(), exports2);
|
|
64208
|
+
__exportStar(require_is_ignored(), exports2);
|
|
64209
|
+
__exportStar(require_lint(), exports2);
|
|
64210
|
+
__exportStar(require_load(), exports2);
|
|
64211
|
+
__exportStar(require_parse4(), exports2);
|
|
64212
|
+
__exportStar(require_prompt(), exports2);
|
|
64213
|
+
__exportStar(require_rules(), exports2);
|
|
64214
|
+
}
|
|
64215
|
+
});
|
|
64216
|
+
|
|
64217
|
+
// node_modules/ignore/index.js
|
|
64218
|
+
var require_ignore = __commonJS({
|
|
64219
|
+
"node_modules/ignore/index.js"(exports2, module2) {
|
|
64220
|
+
function makeArray(subject) {
|
|
64221
|
+
return Array.isArray(subject) ? subject : [subject];
|
|
64222
|
+
}
|
|
64223
|
+
var EMPTY = "";
|
|
64224
|
+
var SPACE = " ";
|
|
64225
|
+
var ESCAPE = "\\";
|
|
64226
|
+
var REGEX_TEST_BLANK_LINE = /^\s+$/;
|
|
64227
|
+
var REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/;
|
|
64228
|
+
var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
|
|
64229
|
+
var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
|
|
64230
|
+
var REGEX_SPLITALL_CRLF = /\r?\n/g;
|
|
64231
|
+
var REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/;
|
|
64232
|
+
var SLASH = "/";
|
|
64233
|
+
var TMP_KEY_IGNORE = "node-ignore";
|
|
64234
|
+
if (typeof Symbol !== "undefined") {
|
|
64235
|
+
TMP_KEY_IGNORE = Symbol.for("node-ignore");
|
|
64236
|
+
}
|
|
64237
|
+
var KEY_IGNORE = TMP_KEY_IGNORE;
|
|
64238
|
+
var define2 = (object, key, value) => Object.defineProperty(object, key, { value });
|
|
64239
|
+
var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
|
|
64240
|
+
var RETURN_FALSE = () => false;
|
|
64241
|
+
var sanitizeRange = (range) => range.replace(
|
|
64242
|
+
REGEX_REGEXP_RANGE,
|
|
64243
|
+
(match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match : EMPTY
|
|
64244
|
+
);
|
|
64245
|
+
var cleanRangeBackSlash = (slashes) => {
|
|
64246
|
+
const { length } = slashes;
|
|
64247
|
+
return slashes.slice(0, length - length % 2);
|
|
64248
|
+
};
|
|
64249
|
+
var REPLACERS = [
|
|
64250
|
+
[
|
|
64251
|
+
// remove BOM
|
|
64252
|
+
// TODO:
|
|
64253
|
+
// Other similar zero-width characters?
|
|
64254
|
+
/^\uFEFF/,
|
|
64255
|
+
() => EMPTY
|
|
64256
|
+
],
|
|
64257
|
+
// > Trailing spaces are ignored unless they are quoted with backslash ("\")
|
|
64258
|
+
[
|
|
64259
|
+
// (a\ ) -> (a )
|
|
64260
|
+
// (a ) -> (a)
|
|
64261
|
+
// (a \ ) -> (a )
|
|
64262
|
+
/\\?\s+$/,
|
|
64263
|
+
(match) => match.indexOf("\\") === 0 ? SPACE : EMPTY
|
|
64264
|
+
],
|
|
64265
|
+
// replace (\ ) with ' '
|
|
64266
|
+
[
|
|
64267
|
+
/\\\s/g,
|
|
64268
|
+
() => SPACE
|
|
64269
|
+
],
|
|
64270
|
+
// Escape metacharacters
|
|
64271
|
+
// which is written down by users but means special for regular expressions.
|
|
64272
|
+
// > There are 12 characters with special meanings:
|
|
64273
|
+
// > - the backslash \,
|
|
64274
|
+
// > - the caret ^,
|
|
64275
|
+
// > - the dollar sign $,
|
|
64276
|
+
// > - the period or dot .,
|
|
64277
|
+
// > - the vertical bar or pipe symbol |,
|
|
64278
|
+
// > - the question mark ?,
|
|
64279
|
+
// > - the asterisk or star *,
|
|
64280
|
+
// > - the plus sign +,
|
|
64281
|
+
// > - the opening parenthesis (,
|
|
64282
|
+
// > - the closing parenthesis ),
|
|
64283
|
+
// > - and the opening square bracket [,
|
|
64284
|
+
// > - the opening curly brace {,
|
|
64285
|
+
// > These special characters are often called "metacharacters".
|
|
64286
|
+
[
|
|
64287
|
+
/[\\$.|*+(){^]/g,
|
|
64288
|
+
(match) => `\\${match}`
|
|
64289
|
+
],
|
|
64290
|
+
[
|
|
64291
|
+
// > a question mark (?) matches a single character
|
|
64292
|
+
/(?!\\)\?/g,
|
|
64293
|
+
() => "[^/]"
|
|
64294
|
+
],
|
|
64295
|
+
// leading slash
|
|
64296
|
+
[
|
|
64297
|
+
// > A leading slash matches the beginning of the pathname.
|
|
64298
|
+
// > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
|
|
64299
|
+
// A leading slash matches the beginning of the pathname
|
|
64300
|
+
/^\//,
|
|
64301
|
+
() => "^"
|
|
64302
|
+
],
|
|
64303
|
+
// replace special metacharacter slash after the leading slash
|
|
64304
|
+
[
|
|
64305
|
+
/\//g,
|
|
64306
|
+
() => "\\/"
|
|
64307
|
+
],
|
|
64308
|
+
[
|
|
64309
|
+
// > A leading "**" followed by a slash means match in all directories.
|
|
64310
|
+
// > For example, "**/foo" matches file or directory "foo" anywhere,
|
|
64311
|
+
// > the same as pattern "foo".
|
|
64312
|
+
// > "**/foo/bar" matches file or directory "bar" anywhere that is directly
|
|
64313
|
+
// > under directory "foo".
|
|
64314
|
+
// Notice that the '*'s have been replaced as '\\*'
|
|
64315
|
+
/^\^*\\\*\\\*\\\//,
|
|
64316
|
+
// '**/foo' <-> 'foo'
|
|
64317
|
+
() => "^(?:.*\\/)?"
|
|
64318
|
+
],
|
|
64319
|
+
// starting
|
|
64320
|
+
[
|
|
64321
|
+
// there will be no leading '/'
|
|
64322
|
+
// (which has been replaced by section "leading slash")
|
|
64323
|
+
// If starts with '**', adding a '^' to the regular expression also works
|
|
64324
|
+
/^(?=[^^])/,
|
|
64325
|
+
function startingReplacer() {
|
|
64326
|
+
return !/\/(?!$)/.test(this) ? "(?:^|\\/)" : "^";
|
|
64327
|
+
}
|
|
64328
|
+
],
|
|
64329
|
+
// two globstars
|
|
64330
|
+
[
|
|
64331
|
+
// Use lookahead assertions so that we could match more than one `'/**'`
|
|
64332
|
+
/\\\/\\\*\\\*(?=\\\/|$)/g,
|
|
64333
|
+
// Zero, one or several directories
|
|
64334
|
+
// should not use '*', or it will be replaced by the next replacer
|
|
64335
|
+
// Check if it is not the last `'/**'`
|
|
64336
|
+
(_7, index, str2) => index + 6 < str2.length ? "(?:\\/[^\\/]+)*" : "\\/.+"
|
|
64337
|
+
],
|
|
64338
|
+
// normal intermediate wildcards
|
|
64339
|
+
[
|
|
64340
|
+
// Never replace escaped '*'
|
|
64341
|
+
// ignore rule '\*' will match the path '*'
|
|
64342
|
+
// 'abc.*/' -> go
|
|
64343
|
+
// 'abc.*' -> skip this rule,
|
|
64344
|
+
// coz trailing single wildcard will be handed by [trailing wildcard]
|
|
64345
|
+
/(^|[^\\]+)(\\\*)+(?=.+)/g,
|
|
64346
|
+
// '*.js' matches '.js'
|
|
64347
|
+
// '*.js' doesn't match 'abc'
|
|
64348
|
+
(_7, p1, p22) => {
|
|
64349
|
+
const unescaped = p22.replace(/\\\*/g, "[^\\/]*");
|
|
64350
|
+
return p1 + unescaped;
|
|
64351
|
+
}
|
|
64352
|
+
],
|
|
64353
|
+
[
|
|
64354
|
+
// unescape, revert step 3 except for back slash
|
|
64355
|
+
// For example, if a user escape a '\\*',
|
|
64356
|
+
// after step 3, the result will be '\\\\\\*'
|
|
64357
|
+
/\\\\\\(?=[$.|*+(){^])/g,
|
|
64358
|
+
() => ESCAPE
|
|
64359
|
+
],
|
|
64360
|
+
[
|
|
64361
|
+
// '\\\\' -> '\\'
|
|
64362
|
+
/\\\\/g,
|
|
64363
|
+
() => ESCAPE
|
|
64364
|
+
],
|
|
64365
|
+
[
|
|
64366
|
+
// > The range notation, e.g. [a-zA-Z],
|
|
64367
|
+
// > can be used to match one of the characters in a range.
|
|
64368
|
+
// `\` is escaped by step 3
|
|
64369
|
+
/(\\)?\[([^\]/]*?)(\\*)($|\])/g,
|
|
64370
|
+
(match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` : close === "]" ? endEscape.length % 2 === 0 ? `[${sanitizeRange(range)}${endEscape}]` : "[]" : "[]"
|
|
64371
|
+
],
|
|
64372
|
+
// ending
|
|
64373
|
+
[
|
|
64374
|
+
// 'js' will not match 'js.'
|
|
64375
|
+
// 'ab' will not match 'abc'
|
|
64376
|
+
/(?:[^*])$/,
|
|
64377
|
+
// WTF!
|
|
64378
|
+
// https://git-scm.com/docs/gitignore
|
|
64379
|
+
// changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)
|
|
64380
|
+
// which re-fixes #24, #38
|
|
64381
|
+
// > If there is a separator at the end of the pattern then the pattern
|
|
64382
|
+
// > will only match directories, otherwise the pattern can match both
|
|
64383
|
+
// > files and directories.
|
|
64384
|
+
// 'js*' will not match 'a.js'
|
|
64385
|
+
// 'js/' will not match 'a.js'
|
|
64386
|
+
// 'js' will match 'a.js' and 'a.js/'
|
|
64387
|
+
(match) => /\/$/.test(match) ? `${match}$` : `${match}(?=$|\\/$)`
|
|
64388
|
+
],
|
|
64389
|
+
// trailing wildcard
|
|
64390
|
+
[
|
|
64391
|
+
/(\^|\\\/)?\\\*$/,
|
|
64392
|
+
(_7, p1) => {
|
|
64393
|
+
const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
|
|
64394
|
+
return `${prefix}(?=$|\\/$)`;
|
|
64395
|
+
}
|
|
64396
|
+
]
|
|
64397
|
+
];
|
|
64398
|
+
var regexCache = /* @__PURE__ */ Object.create(null);
|
|
64399
|
+
var makeRegex = (pattern, ignoreCase) => {
|
|
64400
|
+
let source = regexCache[pattern];
|
|
64401
|
+
if (!source) {
|
|
64402
|
+
source = REPLACERS.reduce(
|
|
64403
|
+
(prev, current) => prev.replace(current[0], current[1].bind(pattern)),
|
|
64404
|
+
pattern
|
|
64405
|
+
);
|
|
64406
|
+
regexCache[pattern] = source;
|
|
64407
|
+
}
|
|
64408
|
+
return ignoreCase ? new RegExp(source, "i") : new RegExp(source);
|
|
64409
|
+
};
|
|
64410
|
+
var isString2 = (subject) => typeof subject === "string";
|
|
64411
|
+
var checkPattern = (pattern) => pattern && isString2(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern) && pattern.indexOf("#") !== 0;
|
|
64412
|
+
var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF);
|
|
64413
|
+
var IgnoreRule = class {
|
|
64414
|
+
constructor(origin2, pattern, negative, regex) {
|
|
64415
|
+
this.origin = origin2;
|
|
64416
|
+
this.pattern = pattern;
|
|
64417
|
+
this.negative = negative;
|
|
64418
|
+
this.regex = regex;
|
|
64419
|
+
}
|
|
64420
|
+
};
|
|
64421
|
+
var createRule = (pattern, ignoreCase) => {
|
|
64422
|
+
const origin2 = pattern;
|
|
64423
|
+
let negative = false;
|
|
64424
|
+
if (pattern.indexOf("!") === 0) {
|
|
64425
|
+
negative = true;
|
|
64426
|
+
pattern = pattern.substr(1);
|
|
64427
|
+
}
|
|
64428
|
+
pattern = pattern.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
|
|
64429
|
+
const regex = makeRegex(pattern, ignoreCase);
|
|
64430
|
+
return new IgnoreRule(
|
|
64431
|
+
origin2,
|
|
64432
|
+
pattern,
|
|
64433
|
+
negative,
|
|
64434
|
+
regex
|
|
64435
|
+
);
|
|
64436
|
+
};
|
|
64437
|
+
var throwError = (message, Ctor) => {
|
|
64438
|
+
throw new Ctor(message);
|
|
64439
|
+
};
|
|
64440
|
+
var checkPath = (path5, originalPath, doThrow) => {
|
|
64441
|
+
if (!isString2(path5)) {
|
|
64442
|
+
return doThrow(
|
|
64443
|
+
`path must be a string, but got \`${originalPath}\``,
|
|
64444
|
+
TypeError
|
|
64445
|
+
);
|
|
64446
|
+
}
|
|
64447
|
+
if (!path5) {
|
|
64448
|
+
return doThrow(`path must not be empty`, TypeError);
|
|
64449
|
+
}
|
|
64450
|
+
if (checkPath.isNotRelative(path5)) {
|
|
64451
|
+
const r3 = "`path.relative()`d";
|
|
64452
|
+
return doThrow(
|
|
64453
|
+
`path should be a ${r3} string, but got "${originalPath}"`,
|
|
64454
|
+
RangeError
|
|
64455
|
+
);
|
|
64456
|
+
}
|
|
64457
|
+
return true;
|
|
64458
|
+
};
|
|
64459
|
+
var isNotRelative = (path5) => REGEX_TEST_INVALID_PATH.test(path5);
|
|
64460
|
+
checkPath.isNotRelative = isNotRelative;
|
|
64461
|
+
checkPath.convert = (p4) => p4;
|
|
64462
|
+
var Ignore2 = class {
|
|
64463
|
+
constructor({
|
|
64464
|
+
ignorecase = true,
|
|
64465
|
+
ignoreCase = ignorecase,
|
|
64466
|
+
allowRelativePaths = false
|
|
64467
|
+
} = {}) {
|
|
64468
|
+
define2(this, KEY_IGNORE, true);
|
|
64469
|
+
this._rules = [];
|
|
64470
|
+
this._ignoreCase = ignoreCase;
|
|
64471
|
+
this._allowRelativePaths = allowRelativePaths;
|
|
64472
|
+
this._initCache();
|
|
64473
|
+
}
|
|
64474
|
+
_initCache() {
|
|
64475
|
+
this._ignoreCache = /* @__PURE__ */ Object.create(null);
|
|
64476
|
+
this._testCache = /* @__PURE__ */ Object.create(null);
|
|
64477
|
+
}
|
|
64478
|
+
_addPattern(pattern) {
|
|
64479
|
+
if (pattern && pattern[KEY_IGNORE]) {
|
|
64480
|
+
this._rules = this._rules.concat(pattern._rules);
|
|
64481
|
+
this._added = true;
|
|
64482
|
+
return;
|
|
64483
|
+
}
|
|
64484
|
+
if (checkPattern(pattern)) {
|
|
64485
|
+
const rule = createRule(pattern, this._ignoreCase);
|
|
64486
|
+
this._added = true;
|
|
64487
|
+
this._rules.push(rule);
|
|
64488
|
+
}
|
|
64489
|
+
}
|
|
64490
|
+
// @param {Array<string> | string | Ignore} pattern
|
|
64491
|
+
add(pattern) {
|
|
64492
|
+
this._added = false;
|
|
64493
|
+
makeArray(
|
|
64494
|
+
isString2(pattern) ? splitPattern(pattern) : pattern
|
|
64495
|
+
).forEach(this._addPattern, this);
|
|
64496
|
+
if (this._added) {
|
|
64497
|
+
this._initCache();
|
|
64498
|
+
}
|
|
64499
|
+
return this;
|
|
64500
|
+
}
|
|
64501
|
+
// legacy
|
|
64502
|
+
addPattern(pattern) {
|
|
64503
|
+
return this.add(pattern);
|
|
64504
|
+
}
|
|
64505
|
+
// | ignored : unignored
|
|
64506
|
+
// negative | 0:0 | 0:1 | 1:0 | 1:1
|
|
64507
|
+
// -------- | ------- | ------- | ------- | --------
|
|
64508
|
+
// 0 | TEST | TEST | SKIP | X
|
|
64509
|
+
// 1 | TESTIF | SKIP | TEST | X
|
|
64510
|
+
// - SKIP: always skip
|
|
64511
|
+
// - TEST: always test
|
|
64512
|
+
// - TESTIF: only test if checkUnignored
|
|
64513
|
+
// - X: that never happen
|
|
64514
|
+
// @param {boolean} whether should check if the path is unignored,
|
|
64515
|
+
// setting `checkUnignored` to `false` could reduce additional
|
|
64516
|
+
// path matching.
|
|
64517
|
+
// @returns {TestResult} true if a file is ignored
|
|
64518
|
+
_testOne(path5, checkUnignored) {
|
|
64519
|
+
let ignored = false;
|
|
64520
|
+
let unignored = false;
|
|
64521
|
+
this._rules.forEach((rule) => {
|
|
64522
|
+
const { negative } = rule;
|
|
64523
|
+
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
|
|
64524
|
+
return;
|
|
64525
|
+
}
|
|
64526
|
+
const matched = rule.regex.test(path5);
|
|
64527
|
+
if (matched) {
|
|
64528
|
+
ignored = !negative;
|
|
64529
|
+
unignored = negative;
|
|
64530
|
+
}
|
|
64531
|
+
});
|
|
64532
|
+
return {
|
|
64533
|
+
ignored,
|
|
64534
|
+
unignored
|
|
64535
|
+
};
|
|
64536
|
+
}
|
|
64537
|
+
// @returns {TestResult}
|
|
64538
|
+
_test(originalPath, cache, checkUnignored, slices) {
|
|
64539
|
+
const path5 = originalPath && checkPath.convert(originalPath);
|
|
64540
|
+
checkPath(
|
|
64541
|
+
path5,
|
|
64542
|
+
originalPath,
|
|
64543
|
+
this._allowRelativePaths ? RETURN_FALSE : throwError
|
|
64544
|
+
);
|
|
64545
|
+
return this._t(path5, cache, checkUnignored, slices);
|
|
64546
|
+
}
|
|
64547
|
+
_t(path5, cache, checkUnignored, slices) {
|
|
64548
|
+
if (path5 in cache) {
|
|
64549
|
+
return cache[path5];
|
|
64550
|
+
}
|
|
64551
|
+
if (!slices) {
|
|
64552
|
+
slices = path5.split(SLASH);
|
|
64553
|
+
}
|
|
64554
|
+
slices.pop();
|
|
64555
|
+
if (!slices.length) {
|
|
64556
|
+
return cache[path5] = this._testOne(path5, checkUnignored);
|
|
64557
|
+
}
|
|
64558
|
+
const parent = this._t(
|
|
64559
|
+
slices.join(SLASH) + SLASH,
|
|
64560
|
+
cache,
|
|
64561
|
+
checkUnignored,
|
|
64562
|
+
slices
|
|
64563
|
+
);
|
|
64564
|
+
return cache[path5] = parent.ignored ? parent : this._testOne(path5, checkUnignored);
|
|
64565
|
+
}
|
|
64566
|
+
ignores(path5) {
|
|
64567
|
+
return this._test(path5, this._ignoreCache, false).ignored;
|
|
64568
|
+
}
|
|
64569
|
+
createFilter() {
|
|
64570
|
+
return (path5) => !this.ignores(path5);
|
|
64571
|
+
}
|
|
64572
|
+
filter(paths) {
|
|
64573
|
+
return makeArray(paths).filter(this.createFilter());
|
|
64574
|
+
}
|
|
64575
|
+
// @returns {TestResult}
|
|
64576
|
+
test(path5) {
|
|
64577
|
+
return this._test(path5, this._testCache, true);
|
|
64578
|
+
}
|
|
64579
|
+
};
|
|
64580
|
+
var factory = (options) => new Ignore2(options);
|
|
64581
|
+
var isPathValid = (path5) => checkPath(path5 && checkPath.convert(path5), path5, RETURN_FALSE);
|
|
64582
|
+
factory.isPathValid = isPathValid;
|
|
64583
|
+
factory.default = factory;
|
|
64584
|
+
module2.exports = factory;
|
|
64585
|
+
if (
|
|
64586
|
+
// Detect `process` so that it can run in browsers.
|
|
64587
|
+
typeof process !== "undefined" && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === "win32")
|
|
64588
|
+
) {
|
|
64589
|
+
const makePosix = (str2) => /^\\\\\?\\/.test(str2) || /["<>|\u0000-\u001F]+/u.test(str2) ? str2 : str2.replace(/\\/g, "/");
|
|
64590
|
+
checkPath.convert = makePosix;
|
|
64591
|
+
const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
64592
|
+
checkPath.isNotRelative = (path5) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path5) || isNotRelative(path5);
|
|
64593
|
+
}
|
|
64594
|
+
}
|
|
64595
|
+
});
|
|
64596
|
+
|
|
64597
64597
|
// node_modules/type-flag/dist/index.mjs
|
|
64598
64598
|
var V = "known-flag";
|
|
64599
64599
|
var k = "unknown-flag";
|
|
@@ -65266,7 +65266,7 @@ function G3(t2, e3) {
|
|
|
65266
65266
|
// package.json
|
|
65267
65267
|
var package_default = {
|
|
65268
65268
|
name: "opencommit",
|
|
65269
|
-
version: "3.2.
|
|
65269
|
+
version: "3.2.19",
|
|
65270
65270
|
description: "Auto-generate impressive commits in 1 second. Killing lame commits with AI \u{1F92F}\u{1F52B}",
|
|
65271
65271
|
keywords: [
|
|
65272
65272
|
"git",
|
|
@@ -65323,8 +65323,15 @@ var package_default = {
|
|
|
65323
65323
|
"test:docker-build": "docker build -t oco-test -f test/Dockerfile .",
|
|
65324
65324
|
"test:unit": "NODE_OPTIONS=--experimental-vm-modules jest test/unit",
|
|
65325
65325
|
"test:unit:docker": "npm run test:docker-build && DOCKER_CONTENT_TRUST=0 docker run --rm oco-test npm run test:unit",
|
|
65326
|
-
"test:e2e": "npm run test:e2e:
|
|
65327
|
-
"test:e2e:
|
|
65326
|
+
"test:e2e": "npm run build && npm run test:e2e:smoke:run && npm run test:e2e:core:run && npm run test:e2e:prompt-module:run",
|
|
65327
|
+
"test:e2e:smoke": "npm run build && npm run test:e2e:smoke:run",
|
|
65328
|
+
"test:e2e:smoke:run": "OCO_TEST_SKIP_VERSION_CHECK=true jest test/e2e/smoke.test.ts",
|
|
65329
|
+
"test:e2e:core": "npm run build && npm run test:e2e:core:run",
|
|
65330
|
+
"test:e2e:core:run": "OCO_TEST_SKIP_VERSION_CHECK=true jest test/e2e/cliBehavior.test.ts test/e2e/gitPush.test.ts test/e2e/oneFile.test.ts test/e2e/noChanges.test.ts",
|
|
65331
|
+
"test:e2e:setup": "npm run test:e2e:prompt-module:setup",
|
|
65332
|
+
"test:e2e:prompt-module:setup": "sh test/e2e/setup.sh",
|
|
65333
|
+
"test:e2e:prompt-module": "npm run build && npm run test:e2e:prompt-module:run",
|
|
65334
|
+
"test:e2e:prompt-module:run": "npm run test:e2e:prompt-module:setup && OCO_TEST_SKIP_VERSION_CHECK=true jest test/e2e/prompt-module",
|
|
65328
65335
|
"test:e2e:docker": "npm run test:docker-build && DOCKER_CONTENT_TRUST=0 docker run --rm oco-test npm run test:e2e",
|
|
65329
65336
|
"mlx:start": "OCO_AI_PROVIDER='mlx' node ./out/cli.cjs"
|
|
65330
65337
|
},
|
|
@@ -67314,6 +67321,7 @@ var CONFIG_KEYS = /* @__PURE__ */ ((CONFIG_KEYS3) => {
|
|
|
67314
67321
|
CONFIG_KEYS3["OCO_OMIT_SCOPE"] = "OCO_OMIT_SCOPE";
|
|
67315
67322
|
CONFIG_KEYS3["OCO_GITPUSH"] = "OCO_GITPUSH";
|
|
67316
67323
|
CONFIG_KEYS3["OCO_HOOK_AUTO_UNCOMMENT"] = "OCO_HOOK_AUTO_UNCOMMENT";
|
|
67324
|
+
CONFIG_KEYS3["OCO_OLLAMA_THINK"] = "OCO_OLLAMA_THINK";
|
|
67317
67325
|
return CONFIG_KEYS3;
|
|
67318
67326
|
})(CONFIG_KEYS || {});
|
|
67319
67327
|
var MODEL_LIST = {
|
|
@@ -67969,7 +67977,7 @@ var configValidators = {
|
|
|
67969
67977
|
["OCO_API_URL" /* OCO_API_URL */](value) {
|
|
67970
67978
|
validateConfig(
|
|
67971
67979
|
"OCO_API_URL" /* OCO_API_URL */,
|
|
67972
|
-
typeof value === "string",
|
|
67980
|
+
typeof value === "string" && /^(https?:\/\/)/.test(value),
|
|
67973
67981
|
`${value} is not a valid URL. It should start with 'http://' or 'https://'.`
|
|
67974
67982
|
);
|
|
67975
67983
|
return value;
|
|
@@ -67977,7 +67985,7 @@ var configValidators = {
|
|
|
67977
67985
|
["OCO_PROXY" /* OCO_PROXY */](value) {
|
|
67978
67986
|
validateConfig(
|
|
67979
67987
|
"OCO_PROXY" /* OCO_PROXY */,
|
|
67980
|
-
typeof value === "string",
|
|
67988
|
+
value === null || typeof value === "string" && /^(https?:\/\/)/.test(value),
|
|
67981
67989
|
`${value} is not a valid URL. It should start with 'http://' or 'https://'.`
|
|
67982
67990
|
);
|
|
67983
67991
|
return value;
|
|
@@ -68074,6 +68082,14 @@ var configValidators = {
|
|
|
68074
68082
|
typeof value === "boolean",
|
|
68075
68083
|
"Must be true or false"
|
|
68076
68084
|
);
|
|
68085
|
+
},
|
|
68086
|
+
["OCO_OLLAMA_THINK" /* OCO_OLLAMA_THINK */](value) {
|
|
68087
|
+
validateConfig(
|
|
68088
|
+
"OCO_OLLAMA_THINK" /* OCO_OLLAMA_THINK */,
|
|
68089
|
+
typeof value === "boolean",
|
|
68090
|
+
"Must be true or false"
|
|
68091
|
+
);
|
|
68092
|
+
return value;
|
|
68077
68093
|
}
|
|
68078
68094
|
};
|
|
68079
68095
|
var OCO_AI_PROVIDER_ENUM = /* @__PURE__ */ ((OCO_AI_PROVIDER_ENUM2) => {
|
|
@@ -68142,10 +68158,6 @@ var DEFAULT_CONFIG = {
|
|
|
68142
68158
|
// todo: deprecate
|
|
68143
68159
|
OCO_HOOK_AUTO_UNCOMMENT: false
|
|
68144
68160
|
};
|
|
68145
|
-
var initGlobalConfig = (configPath = defaultConfigPath) => {
|
|
68146
|
-
(0, import_fs.writeFileSync)(configPath, (0, import_ini.stringify)(DEFAULT_CONFIG), "utf8");
|
|
68147
|
-
return DEFAULT_CONFIG;
|
|
68148
|
-
};
|
|
68149
68161
|
var parseConfigVarValue = (value) => {
|
|
68150
68162
|
try {
|
|
68151
68163
|
return JSON.parse(value);
|
|
@@ -68158,7 +68170,7 @@ var getEnvConfig = (envPath) => {
|
|
|
68158
68170
|
return {
|
|
68159
68171
|
OCO_MODEL: process.env.OCO_MODEL,
|
|
68160
68172
|
OCO_API_URL: process.env.OCO_API_URL,
|
|
68161
|
-
OCO_PROXY: process.env.OCO_PROXY
|
|
68173
|
+
OCO_PROXY: process.env.OCO_PROXY,
|
|
68162
68174
|
OCO_API_KEY: process.env.OCO_API_KEY,
|
|
68163
68175
|
OCO_API_CUSTOM_HEADERS: process.env.OCO_API_CUSTOM_HEADERS,
|
|
68164
68176
|
OCO_AI_PROVIDER: process.env.OCO_AI_PROVIDER,
|
|
@@ -68185,19 +68197,20 @@ var getIsGlobalConfigFileExist = (configPath = defaultConfigPath) => {
|
|
|
68185
68197
|
return (0, import_fs.existsSync)(configPath);
|
|
68186
68198
|
};
|
|
68187
68199
|
var getGlobalConfig = (configPath = defaultConfigPath) => {
|
|
68188
|
-
let globalConfig;
|
|
68189
68200
|
const isGlobalConfigFileExist = getIsGlobalConfigFileExist(configPath);
|
|
68190
|
-
if (!isGlobalConfigFileExist)
|
|
68191
|
-
|
|
68192
|
-
const configFile = (0, import_fs.readFileSync)(configPath, "utf8");
|
|
68193
|
-
globalConfig = (0, import_ini.parse)(configFile);
|
|
68201
|
+
if (!isGlobalConfigFileExist) {
|
|
68202
|
+
return { ...DEFAULT_CONFIG };
|
|
68194
68203
|
}
|
|
68195
|
-
|
|
68204
|
+
const configFile = (0, import_fs.readFileSync)(configPath, "utf8");
|
|
68205
|
+
return (0, import_ini.parse)(configFile);
|
|
68196
68206
|
};
|
|
68197
68207
|
var mergeConfigs = (main, fallback) => {
|
|
68198
68208
|
const allKeys = /* @__PURE__ */ new Set([...Object.keys(main), ...Object.keys(fallback)]);
|
|
68199
68209
|
return Array.from(allKeys).reduce((acc, key) => {
|
|
68200
|
-
|
|
68210
|
+
const mainValue = main[key];
|
|
68211
|
+
acc[key] = parseConfigVarValue(
|
|
68212
|
+
mainValue !== void 0 ? mainValue : fallback[key]
|
|
68213
|
+
);
|
|
68201
68214
|
return acc;
|
|
68202
68215
|
}, {});
|
|
68203
68216
|
};
|
|
@@ -68340,7 +68353,10 @@ function getConfigKeyDetails(key) {
|
|
|
68340
68353
|
case "OCO_PROXY" /* OCO_PROXY */:
|
|
68341
68354
|
return {
|
|
68342
68355
|
description: "HTTP/HTTPS Proxy URL",
|
|
68343
|
-
values: [
|
|
68356
|
+
values: [
|
|
68357
|
+
"URL string (must start with 'http://' or 'https://')",
|
|
68358
|
+
"null (disable proxy even when HTTP_PROXY/HTTPS_PROXY are set)"
|
|
68359
|
+
]
|
|
68344
68360
|
};
|
|
68345
68361
|
case "OCO_MESSAGE_TEMPLATE_PLACEHOLDER" /* OCO_MESSAGE_TEMPLATE_PLACEHOLDER */:
|
|
68346
68362
|
return {
|
|
@@ -74168,7 +74184,27 @@ function isServiceUnavailableError(error) {
|
|
|
74168
74184
|
}
|
|
74169
74185
|
return false;
|
|
74170
74186
|
}
|
|
74171
|
-
function
|
|
74187
|
+
function getCustomEndpointLabel(baseURL) {
|
|
74188
|
+
if (!baseURL) {
|
|
74189
|
+
return null;
|
|
74190
|
+
}
|
|
74191
|
+
try {
|
|
74192
|
+
return new URL(baseURL).host;
|
|
74193
|
+
} catch {
|
|
74194
|
+
return null;
|
|
74195
|
+
}
|
|
74196
|
+
}
|
|
74197
|
+
function getServiceUnavailableMessage(provider, context) {
|
|
74198
|
+
const endpointLabel = getCustomEndpointLabel(context?.baseURL);
|
|
74199
|
+
if (endpointLabel) {
|
|
74200
|
+
return `The configured API endpoint (${endpointLabel}) is temporarily unavailable.`;
|
|
74201
|
+
}
|
|
74202
|
+
if (context?.baseURL) {
|
|
74203
|
+
return "The configured API endpoint is temporarily unavailable.";
|
|
74204
|
+
}
|
|
74205
|
+
return `The ${provider} service is temporarily unavailable.`;
|
|
74206
|
+
}
|
|
74207
|
+
function formatUserFriendlyError(error, provider, context) {
|
|
74172
74208
|
const billingUrl = PROVIDER_BILLING_URLS[provider] || null;
|
|
74173
74209
|
if (error instanceof InsufficientCreditsError) {
|
|
74174
74210
|
return {
|
|
@@ -74190,7 +74226,7 @@ function formatUserFriendlyError(error, provider) {
|
|
|
74190
74226
|
if (error instanceof ServiceUnavailableError) {
|
|
74191
74227
|
return {
|
|
74192
74228
|
title: "Service Unavailable",
|
|
74193
|
-
message:
|
|
74229
|
+
message: getServiceUnavailableMessage(provider, context),
|
|
74194
74230
|
helpUrl: null,
|
|
74195
74231
|
suggestion: "Please try again in a few moments."
|
|
74196
74232
|
};
|
|
@@ -74230,7 +74266,7 @@ function formatUserFriendlyError(error, provider) {
|
|
|
74230
74266
|
if (isServiceUnavailableError(error)) {
|
|
74231
74267
|
return {
|
|
74232
74268
|
title: "Service Unavailable",
|
|
74233
|
-
message:
|
|
74269
|
+
message: getServiceUnavailableMessage(provider, context),
|
|
74234
74270
|
helpUrl: null,
|
|
74235
74271
|
suggestion: "Please try again in a few moments."
|
|
74236
74272
|
};
|
|
@@ -74383,6 +74419,15 @@ function normalizeEngineError(error, provider, model) {
|
|
|
74383
74419
|
return error instanceof Error ? error : new Error(message);
|
|
74384
74420
|
}
|
|
74385
74421
|
|
|
74422
|
+
// src/utils/generateCommitMessageErrors.ts
|
|
74423
|
+
var GenerateCommitMessageErrorEnum = ((GenerateCommitMessageErrorEnum2) => {
|
|
74424
|
+
GenerateCommitMessageErrorEnum2["tooMuchTokens"] = "TOO_MUCH_TOKENS";
|
|
74425
|
+
GenerateCommitMessageErrorEnum2["internalError"] = "INTERNAL_ERROR";
|
|
74426
|
+
GenerateCommitMessageErrorEnum2["emptyMessage"] = "EMPTY_MESSAGE";
|
|
74427
|
+
GenerateCommitMessageErrorEnum2["outputTokensTooHigh"] = `Token limit exceeded, OCO_TOKENS_MAX_OUTPUT must not be much higher than the default ${500 /* DEFAULT_MAX_TOKENS_OUTPUT */} tokens.`;
|
|
74428
|
+
return GenerateCommitMessageErrorEnum2;
|
|
74429
|
+
})(GenerateCommitMessageErrorEnum || {});
|
|
74430
|
+
|
|
74386
74431
|
// src/utils/removeContentTags.ts
|
|
74387
74432
|
function removeContentTags(content, tag) {
|
|
74388
74433
|
if (!content || typeof content !== "string") {
|
|
@@ -74466,7 +74511,7 @@ var AnthropicEngine = class {
|
|
|
74466
74511
|
};
|
|
74467
74512
|
this.config = config8;
|
|
74468
74513
|
const clientOptions = { apiKey: this.config.apiKey };
|
|
74469
|
-
const proxy = config8.proxy
|
|
74514
|
+
const proxy = config8.proxy;
|
|
74470
74515
|
if (proxy) {
|
|
74471
74516
|
clientOptions.httpAgent = new import_https_proxy_agent.HttpsProxyAgent(proxy);
|
|
74472
74517
|
}
|
|
@@ -79227,6 +79272,9 @@ var OllamaEngine = class {
|
|
|
79227
79272
|
options: { temperature: 0, top_p: 0.1 },
|
|
79228
79273
|
stream: false
|
|
79229
79274
|
};
|
|
79275
|
+
if (typeof this.config.ollamaThink === "boolean") {
|
|
79276
|
+
params.think = this.config.ollamaThink;
|
|
79277
|
+
}
|
|
79230
79278
|
try {
|
|
79231
79279
|
const response = await this.client.post(this.chatUrl, params);
|
|
79232
79280
|
const { message } = response.data;
|
|
@@ -83944,6 +83992,28 @@ var { OpenAIError: OpenAIError2, APIError: APIError4, APIConnectionError: APICon
|
|
|
83944
83992
|
|
|
83945
83993
|
// src/engine/openAi.ts
|
|
83946
83994
|
var import_https_proxy_agent3 = __toESM(require_dist2(), 1);
|
|
83995
|
+
|
|
83996
|
+
// src/utils/customHeaders.ts
|
|
83997
|
+
function parseCustomHeaders(headers) {
|
|
83998
|
+
let parsedHeaders = {};
|
|
83999
|
+
if (!headers) {
|
|
84000
|
+
return parsedHeaders;
|
|
84001
|
+
}
|
|
84002
|
+
try {
|
|
84003
|
+
if (typeof headers === "object" && !Array.isArray(headers)) {
|
|
84004
|
+
parsedHeaders = headers;
|
|
84005
|
+
} else {
|
|
84006
|
+
parsedHeaders = JSON.parse(headers);
|
|
84007
|
+
}
|
|
84008
|
+
} catch {
|
|
84009
|
+
console.warn(
|
|
84010
|
+
"Invalid OCO_API_CUSTOM_HEADERS format, ignoring custom headers"
|
|
84011
|
+
);
|
|
84012
|
+
}
|
|
84013
|
+
return parsedHeaders;
|
|
84014
|
+
}
|
|
84015
|
+
|
|
84016
|
+
// src/engine/openAi.ts
|
|
83947
84017
|
var OpenAiEngine = class {
|
|
83948
84018
|
constructor(config8) {
|
|
83949
84019
|
this.generateCommitMessage = async (messages) => {
|
|
@@ -83978,7 +84048,7 @@ var OpenAiEngine = class {
|
|
|
83978
84048
|
if (config8.baseURL) {
|
|
83979
84049
|
clientOptions.baseURL = config8.baseURL;
|
|
83980
84050
|
}
|
|
83981
|
-
const proxy = config8.proxy
|
|
84051
|
+
const proxy = config8.proxy;
|
|
83982
84052
|
if (proxy) {
|
|
83983
84053
|
clientOptions.httpAgent = new import_https_proxy_agent3.HttpsProxyAgent(proxy);
|
|
83984
84054
|
}
|
|
@@ -83993,7 +84063,7 @@ var OpenAiEngine = class {
|
|
|
83993
84063
|
};
|
|
83994
84064
|
|
|
83995
84065
|
// src/engine/mistral.ts
|
|
83996
|
-
var
|
|
84066
|
+
var import_mistralai = __toESM(require_mistralai(), 1);
|
|
83997
84067
|
var MistralAiEngine = class {
|
|
83998
84068
|
// Using any type for Mistral client to avoid TS errors
|
|
83999
84069
|
constructor(config8) {
|
|
@@ -84021,9 +84091,9 @@ var MistralAiEngine = class {
|
|
|
84021
84091
|
};
|
|
84022
84092
|
this.config = config8;
|
|
84023
84093
|
if (!config8.baseURL) {
|
|
84024
|
-
this.client = new Mistral({ apiKey: config8.apiKey });
|
|
84094
|
+
this.client = new import_mistralai.Mistral({ apiKey: config8.apiKey });
|
|
84025
84095
|
} else {
|
|
84026
|
-
this.client = new Mistral({
|
|
84096
|
+
this.client = new import_mistralai.Mistral({
|
|
84027
84097
|
apiKey: config8.apiKey,
|
|
84028
84098
|
serverURL: config8.baseURL
|
|
84029
84099
|
});
|
|
@@ -84160,41 +84230,67 @@ var OpenRouterEngine = class {
|
|
|
84160
84230
|
}
|
|
84161
84231
|
};
|
|
84162
84232
|
|
|
84163
|
-
// src/utils/
|
|
84164
|
-
|
|
84165
|
-
|
|
84166
|
-
|
|
84167
|
-
|
|
84233
|
+
// src/utils/proxy.ts
|
|
84234
|
+
var import_https_proxy_agent4 = __toESM(require_dist2(), 1);
|
|
84235
|
+
var import_undici = __toESM(require_undici(), 1);
|
|
84236
|
+
function resolveProxy(proxySetting) {
|
|
84237
|
+
if (proxySetting === null) {
|
|
84238
|
+
return null;
|
|
84168
84239
|
}
|
|
84240
|
+
if (typeof proxySetting === "string" && proxySetting.trim().length > 0) {
|
|
84241
|
+
return proxySetting;
|
|
84242
|
+
}
|
|
84243
|
+
return process.env.HTTPS_PROXY || process.env.HTTP_PROXY;
|
|
84244
|
+
}
|
|
84245
|
+
function resetProxySetup(disableEnvProxy) {
|
|
84246
|
+
(0, import_undici.setGlobalDispatcher)(new import_undici.Agent());
|
|
84247
|
+
axios_default.defaults.httpAgent = void 0;
|
|
84248
|
+
axios_default.defaults.httpsAgent = void 0;
|
|
84249
|
+
axios_default.defaults.proxy = disableEnvProxy ? false : void 0;
|
|
84250
|
+
}
|
|
84251
|
+
function setupProxy(proxySetting) {
|
|
84169
84252
|
try {
|
|
84170
|
-
if (
|
|
84171
|
-
|
|
84172
|
-
|
|
84173
|
-
|
|
84253
|
+
if (proxySetting === null) {
|
|
84254
|
+
resetProxySetup(true);
|
|
84255
|
+
return;
|
|
84256
|
+
}
|
|
84257
|
+
resetProxySetup(false);
|
|
84258
|
+
if (!proxySetting) {
|
|
84259
|
+
return;
|
|
84174
84260
|
}
|
|
84261
|
+
const dispatcher = new import_undici.ProxyAgent(proxySetting);
|
|
84262
|
+
(0, import_undici.setGlobalDispatcher)(dispatcher);
|
|
84263
|
+
const agent = new import_https_proxy_agent4.HttpsProxyAgent(proxySetting);
|
|
84264
|
+
axios_default.defaults.httpAgent = agent;
|
|
84265
|
+
axios_default.defaults.httpsAgent = agent;
|
|
84266
|
+
axios_default.defaults.proxy = false;
|
|
84175
84267
|
} catch (error) {
|
|
84176
|
-
|
|
84177
|
-
|
|
84178
|
-
);
|
|
84268
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
84269
|
+
console.warn(`[Proxy Error] Failed to set proxy: ${message}`);
|
|
84179
84270
|
}
|
|
84180
|
-
return parsedHeaders;
|
|
84181
84271
|
}
|
|
84272
|
+
|
|
84273
|
+
// src/utils/engine.ts
|
|
84182
84274
|
function getEngine() {
|
|
84183
84275
|
const config8 = getConfig();
|
|
84184
84276
|
const provider = config8.OCO_AI_PROVIDER;
|
|
84185
84277
|
const customHeaders = parseCustomHeaders(config8.OCO_API_CUSTOM_HEADERS);
|
|
84278
|
+
const resolvedProxy = resolveProxy(config8.OCO_PROXY);
|
|
84186
84279
|
const DEFAULT_CONFIG2 = {
|
|
84187
84280
|
model: config8.OCO_MODEL,
|
|
84188
84281
|
maxTokensOutput: config8.OCO_TOKENS_MAX_OUTPUT,
|
|
84189
84282
|
maxTokensInput: config8.OCO_TOKENS_MAX_INPUT,
|
|
84190
84283
|
baseURL: config8.OCO_API_URL,
|
|
84191
|
-
proxy:
|
|
84284
|
+
proxy: resolvedProxy,
|
|
84192
84285
|
apiKey: config8.OCO_API_KEY,
|
|
84193
84286
|
customHeaders
|
|
84194
84287
|
};
|
|
84195
84288
|
switch (provider) {
|
|
84196
84289
|
case "ollama" /* OLLAMA */:
|
|
84197
|
-
return new OllamaEngine(
|
|
84290
|
+
return new OllamaEngine({
|
|
84291
|
+
...DEFAULT_CONFIG2,
|
|
84292
|
+
ollamaThink: config8.OCO_OLLAMA_THINK
|
|
84293
|
+
});
|
|
84198
84294
|
case "anthropic" /* ANTHROPIC */:
|
|
84199
84295
|
return new AnthropicEngine(DEFAULT_CONFIG2);
|
|
84200
84296
|
case "test" /* TEST */:
|
|
@@ -84599,30 +84695,29 @@ var FULL_GITMOJI_SPEC = `${GITMOJI_HELP}
|
|
|
84599
84695
|
\u{1F9F5}, Add or update code related to multithreading or concurrency;
|
|
84600
84696
|
\u{1F9BA}, Add or update code related to validation.`;
|
|
84601
84697
|
var CONVENTIONAL_COMMIT_KEYWORDS = "Do not preface the commit with anything, except for the conventional commit keywords: fix, feat, build, chore, ci, docs, style, refactor, perf, test.";
|
|
84602
|
-
var getCommitConvention = (fullGitMojiSpec) =>
|
|
84698
|
+
var getCommitConvention = (fullGitMojiSpec) => fullGitMojiSpec ? FULL_GITMOJI_SPEC : config4.OCO_EMOJI ? GITMOJI_HELP : CONVENTIONAL_COMMIT_KEYWORDS;
|
|
84603
84699
|
var getDescriptionInstruction = () => config4.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.";
|
|
84604
84700
|
var getOneLineCommitInstruction = () => config4.OCO_ONE_LINE_COMMIT ? "Craft a concise, single sentence, commit message that encapsulates all changes made, with an emphasis on the primary updates. If the modifications share a common theme or scope, mention it succinctly; otherwise, leave the scope out to maintain focus. The goal is to provide a clear and unified overview of the changes in one single message." : "";
|
|
84605
84701
|
var getScopeInstruction = () => config4.OCO_OMIT_SCOPE ? "Do not include a scope in the commit message format. Use the format: <type>: <subject>" : "";
|
|
84606
84702
|
var userInputCodeContext = (context) => {
|
|
84607
|
-
|
|
84608
|
-
|
|
84609
|
-
|
|
84703
|
+
const trimmed = (context ?? "").trim();
|
|
84704
|
+
if (trimmed === "") {
|
|
84705
|
+
return "";
|
|
84610
84706
|
}
|
|
84611
|
-
return
|
|
84707
|
+
return `Additional context provided by the user: <context>${trimmed}</context>
|
|
84708
|
+
Consider this context when generating the commit message, incorporating relevant information when appropriate.`;
|
|
84612
84709
|
};
|
|
84613
|
-
var INIT_MAIN_PROMPT2 = (language, fullGitMojiSpec, context) =>
|
|
84614
|
-
|
|
84615
|
-
|
|
84616
|
-
|
|
84617
|
-
|
|
84618
|
-
|
|
84619
|
-
|
|
84620
|
-
|
|
84621
|
-
|
|
84622
|
-
|
|
84623
|
-
|
|
84624
|
-
const userInputContext = userInputCodeContext(context);
|
|
84625
|
-
return `${missionStatement}
|
|
84710
|
+
var INIT_MAIN_PROMPT2 = (language, fullGitMojiSpec, context) => {
|
|
84711
|
+
const commitConvention = fullGitMojiSpec ? "GitMoji specification" : "Conventional Commit Convention";
|
|
84712
|
+
const missionStatement = `${IDENTITY} Your mission is to create clean and comprehensive commit messages as per the ${commitConvention} and explain WHAT were the changes and mainly WHY the changes were done.`;
|
|
84713
|
+
const diffInstruction = "I'll send you an output of 'git diff --staged' command, and you are to convert it into a commit message.";
|
|
84714
|
+
const conventionGuidelines = getCommitConvention(fullGitMojiSpec);
|
|
84715
|
+
const descriptionGuideline = getDescriptionInstruction();
|
|
84716
|
+
const oneLineCommitGuideline = getOneLineCommitInstruction();
|
|
84717
|
+
const scopeInstruction = getScopeInstruction();
|
|
84718
|
+
const generalGuidelines = `Use the present tense. Lines must not be longer than 74 characters. Use ${language} for the commit message.`;
|
|
84719
|
+
const userInputContext = userInputCodeContext(context);
|
|
84720
|
+
const content = `${missionStatement}
|
|
84626
84721
|
${diffInstruction}
|
|
84627
84722
|
${conventionGuidelines}
|
|
84628
84723
|
${descriptionGuideline}
|
|
@@ -84630,8 +84725,8 @@ ${oneLineCommitGuideline}
|
|
|
84630
84725
|
${scopeInstruction}
|
|
84631
84726
|
${generalGuidelines}
|
|
84632
84727
|
${userInputContext}`;
|
|
84633
|
-
}
|
|
84634
|
-
}
|
|
84728
|
+
return { role: "system", content };
|
|
84729
|
+
};
|
|
84635
84730
|
var INIT_DIFF_PROMPT = {
|
|
84636
84731
|
role: "user",
|
|
84637
84732
|
content: `diff --git a/src/server.ts b/src/server.ts
|
|
@@ -84740,13 +84835,6 @@ var generateCommitMessageChatCompletionPrompt = async (diff, fullGitMojiSpec, co
|
|
|
84740
84835
|
});
|
|
84741
84836
|
return chatContextAsCompletionRequest;
|
|
84742
84837
|
};
|
|
84743
|
-
var GenerateCommitMessageErrorEnum = ((GenerateCommitMessageErrorEnum2) => {
|
|
84744
|
-
GenerateCommitMessageErrorEnum2["tooMuchTokens"] = "TOO_MUCH_TOKENS";
|
|
84745
|
-
GenerateCommitMessageErrorEnum2["internalError"] = "INTERNAL_ERROR";
|
|
84746
|
-
GenerateCommitMessageErrorEnum2["emptyMessage"] = "EMPTY_MESSAGE";
|
|
84747
|
-
GenerateCommitMessageErrorEnum2["outputTokensTooHigh"] = `Token limit exceeded, OCO_TOKENS_MAX_OUTPUT must not be much higher than the default ${500 /* DEFAULT_MAX_TOKENS_OUTPUT */} tokens.`;
|
|
84748
|
-
return GenerateCommitMessageErrorEnum2;
|
|
84749
|
-
})(GenerateCommitMessageErrorEnum || {});
|
|
84750
84838
|
async function handleModelNotFoundError(error, provider, currentModel) {
|
|
84751
84839
|
console.log(source_default.red(`
|
|
84752
84840
|
\u2716 Model '${currentModel}' not found
|
|
@@ -84807,7 +84895,7 @@ async function handleModelNotFoundError(error, provider, currentModel) {
|
|
|
84807
84895
|
...existingConfig,
|
|
84808
84896
|
OCO_MODEL: newModel
|
|
84809
84897
|
});
|
|
84810
|
-
console.log(source_default.green("\
|
|
84898
|
+
console.log(source_default.green("\u221A") + " Model saved as default\n");
|
|
84811
84899
|
}
|
|
84812
84900
|
return newModel;
|
|
84813
84901
|
}
|
|
@@ -84829,7 +84917,8 @@ var generateCommitMessageByDiff = async (diff, fullGitMojiSpec = false, context
|
|
|
84829
84917
|
const commitMessagePromises = await getCommitMsgsPromisesFromFileDiffs(
|
|
84830
84918
|
diff,
|
|
84831
84919
|
MAX_REQUEST_TOKENS,
|
|
84832
|
-
fullGitMojiSpec
|
|
84920
|
+
fullGitMojiSpec,
|
|
84921
|
+
context
|
|
84833
84922
|
);
|
|
84834
84923
|
const commitMessages = [];
|
|
84835
84924
|
for (const promise of commitMessagePromises) {
|
|
@@ -84874,7 +84963,7 @@ var generateCommitMessageByDiff = async (diff, fullGitMojiSpec = false, context
|
|
|
84874
84963
|
throw error;
|
|
84875
84964
|
}
|
|
84876
84965
|
};
|
|
84877
|
-
function getMessagesPromisesByChangesInFile(fileDiff, separator, maxChangeLength, fullGitMojiSpec) {
|
|
84966
|
+
function getMessagesPromisesByChangesInFile(fileDiff, separator, maxChangeLength, fullGitMojiSpec, context) {
|
|
84878
84967
|
const hunkHeaderSeparator = "@@ ";
|
|
84879
84968
|
const [fileHeader, ...fileDiffByLines] = fileDiff.split(hunkHeaderSeparator);
|
|
84880
84969
|
const mergedChanges = mergeDiffs(
|
|
@@ -84896,7 +84985,8 @@ function getMessagesPromisesByChangesInFile(fileDiff, separator, maxChangeLength
|
|
|
84896
84985
|
async (lineDiff) => {
|
|
84897
84986
|
const messages = await generateCommitMessageChatCompletionPrompt(
|
|
84898
84987
|
separator + lineDiff,
|
|
84899
|
-
fullGitMojiSpec
|
|
84988
|
+
fullGitMojiSpec,
|
|
84989
|
+
context
|
|
84900
84990
|
);
|
|
84901
84991
|
return engine.generateCommitMessage(messages);
|
|
84902
84992
|
}
|
|
@@ -84928,7 +85018,7 @@ function splitDiff(diff, maxChangeLength) {
|
|
|
84928
85018
|
}
|
|
84929
85019
|
return splitDiffs;
|
|
84930
85020
|
}
|
|
84931
|
-
var getCommitMsgsPromisesFromFileDiffs = async (diff, maxDiffLength, fullGitMojiSpec) => {
|
|
85021
|
+
var getCommitMsgsPromisesFromFileDiffs = async (diff, maxDiffLength, fullGitMojiSpec, context) => {
|
|
84932
85022
|
const separator = "diff --git ";
|
|
84933
85023
|
const diffByFiles = diff.split(separator).slice(1);
|
|
84934
85024
|
const mergedFilesDiffs = mergeDiffs(diffByFiles, maxDiffLength);
|
|
@@ -84939,13 +85029,15 @@ var getCommitMsgsPromisesFromFileDiffs = async (diff, maxDiffLength, fullGitMoji
|
|
|
84939
85029
|
fileDiff,
|
|
84940
85030
|
separator,
|
|
84941
85031
|
maxDiffLength,
|
|
84942
|
-
fullGitMojiSpec
|
|
85032
|
+
fullGitMojiSpec,
|
|
85033
|
+
context
|
|
84943
85034
|
);
|
|
84944
85035
|
commitMessagePromises.push(...messagesPromises);
|
|
84945
85036
|
} else {
|
|
84946
85037
|
const messages = await generateCommitMessageChatCompletionPrompt(
|
|
84947
85038
|
separator + fileDiff,
|
|
84948
|
-
fullGitMojiSpec
|
|
85039
|
+
fullGitMojiSpec,
|
|
85040
|
+
context
|
|
84949
85041
|
);
|
|
84950
85042
|
const engine = getEngine();
|
|
84951
85043
|
commitMessagePromises.push(engine.generateCommitMessage(messages));
|
|
@@ -85023,25 +85115,22 @@ var gitAdd = async ({ files }) => {
|
|
|
85023
85115
|
await execa("git", ["add", ...files], { cwd: gitDir });
|
|
85024
85116
|
gitAddSpinner.stop(`Staged ${files.length} files`);
|
|
85025
85117
|
};
|
|
85118
|
+
var isFileExcludedFromDiff = (file) => file.includes(".lock") || file.includes("-lock.") || file.includes(".svg") || file.includes(".png") || file.includes(".jpg") || file.includes(".jpeg") || file.includes(".webp") || file.includes(".gif");
|
|
85026
85119
|
var getDiff = async ({ files }) => {
|
|
85027
85120
|
const gitDir = await getGitDir();
|
|
85028
|
-
const
|
|
85029
|
-
|
|
85030
|
-
);
|
|
85031
|
-
if (lockFiles.length) {
|
|
85121
|
+
const excludedFiles = files.filter(isFileExcludedFromDiff);
|
|
85122
|
+
if (excludedFiles.length) {
|
|
85032
85123
|
ce(
|
|
85033
85124
|
`Some files are excluded by default from 'git diff'. No commit messages are generated for this files:
|
|
85034
|
-
${
|
|
85125
|
+
${excludedFiles.join(
|
|
85035
85126
|
"\n"
|
|
85036
85127
|
)}`
|
|
85037
85128
|
);
|
|
85038
85129
|
}
|
|
85039
|
-
const
|
|
85040
|
-
(file) => !file.includes(".lock") && !file.includes("-lock.")
|
|
85041
|
-
);
|
|
85130
|
+
const diffableFiles = files.filter((file) => !isFileExcludedFromDiff(file));
|
|
85042
85131
|
const { stdout: diff } = await execa(
|
|
85043
85132
|
"git",
|
|
85044
|
-
["diff", "--staged", "--", ...
|
|
85133
|
+
["diff", "--staged", "--", ...diffableFiles],
|
|
85045
85134
|
{ cwd: gitDir }
|
|
85046
85135
|
);
|
|
85047
85136
|
return diff;
|
|
@@ -85071,6 +85160,29 @@ var getGitRemotes = async () => {
|
|
|
85071
85160
|
const { stdout } = await execa("git", ["remote"]);
|
|
85072
85161
|
return stdout.split("\n").filter((remote) => Boolean(remote.trim()));
|
|
85073
85162
|
};
|
|
85163
|
+
var hasUpstreamBranch = async () => {
|
|
85164
|
+
try {
|
|
85165
|
+
await execa("git", [
|
|
85166
|
+
"rev-parse",
|
|
85167
|
+
"--abbrev-ref",
|
|
85168
|
+
"--symbolic-full-name",
|
|
85169
|
+
"@{u}"
|
|
85170
|
+
]);
|
|
85171
|
+
return true;
|
|
85172
|
+
} catch {
|
|
85173
|
+
return false;
|
|
85174
|
+
}
|
|
85175
|
+
};
|
|
85176
|
+
var getCurrentBranch = async () => {
|
|
85177
|
+
const { stdout } = await execa("git", ["branch", "--show-current"]);
|
|
85178
|
+
return stdout.trim();
|
|
85179
|
+
};
|
|
85180
|
+
var displayPushUrl = (stderr2) => {
|
|
85181
|
+
const urlMatch = stderr2.match(/https?:\/\/\S+/);
|
|
85182
|
+
if (urlMatch) {
|
|
85183
|
+
ce(`${source_default.cyan("Create a pull request:")} ${urlMatch[0]}`);
|
|
85184
|
+
}
|
|
85185
|
+
};
|
|
85074
85186
|
var checkMessageTemplate = (extraArgs2) => {
|
|
85075
85187
|
for (const key in extraArgs2) {
|
|
85076
85188
|
if (extraArgs2[key].includes(config6.OCO_MESSAGE_TEMPLATE_PLACEHOLDER))
|
|
@@ -85142,8 +85254,13 @@ ${source_default.grey("\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2
|
|
|
85142
85254
|
const remotes = await getGitRemotes();
|
|
85143
85255
|
if (config6.OCO_GITPUSH === false) return;
|
|
85144
85256
|
if (!remotes.length) {
|
|
85145
|
-
const
|
|
85257
|
+
const pushArgs = ["push"];
|
|
85258
|
+
if (!await hasUpstreamBranch()) {
|
|
85259
|
+
pushArgs.push("--set-upstream", "origin", await getCurrentBranch());
|
|
85260
|
+
}
|
|
85261
|
+
const { stdout: stdout2, stderr: stderr2 } = await execa("git", pushArgs);
|
|
85146
85262
|
if (stdout2) ce(stdout2);
|
|
85263
|
+
displayPushUrl(stderr2);
|
|
85147
85264
|
process.exit(0);
|
|
85148
85265
|
}
|
|
85149
85266
|
if (remotes.length === 1) {
|
|
@@ -85154,15 +85271,16 @@ ${source_default.grey("\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2
|
|
|
85154
85271
|
if (isPushConfirmedByUser) {
|
|
85155
85272
|
const pushSpinner = le();
|
|
85156
85273
|
pushSpinner.start(`Running 'git push ${remotes[0]}'`);
|
|
85157
|
-
const
|
|
85158
|
-
|
|
85159
|
-
"--
|
|
85160
|
-
|
|
85161
|
-
|
|
85274
|
+
const pushArgs = ["push", "--verbose", remotes[0]];
|
|
85275
|
+
if (!await hasUpstreamBranch()) {
|
|
85276
|
+
pushArgs.push("--set-upstream", await getCurrentBranch());
|
|
85277
|
+
}
|
|
85278
|
+
const { stdout: stdout2, stderr: stderr2 } = await execa("git", pushArgs);
|
|
85162
85279
|
pushSpinner.stop(
|
|
85163
85280
|
`${source_default.green("\u2714")} Successfully pushed all commits to ${remotes[0]}`
|
|
85164
85281
|
);
|
|
85165
85282
|
if (stdout2) ce(stdout2);
|
|
85283
|
+
displayPushUrl(stderr2);
|
|
85166
85284
|
} else {
|
|
85167
85285
|
ce("`git push` aborted");
|
|
85168
85286
|
process.exit(0);
|
|
@@ -85180,13 +85298,18 @@ ${source_default.grey("\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2
|
|
|
85180
85298
|
if (selectedRemote !== skipOption) {
|
|
85181
85299
|
const pushSpinner = le();
|
|
85182
85300
|
pushSpinner.start(`Running 'git push ${selectedRemote}'`);
|
|
85183
|
-
const
|
|
85301
|
+
const pushArgs = ["push", selectedRemote];
|
|
85302
|
+
if (!await hasUpstreamBranch()) {
|
|
85303
|
+
pushArgs.push("--set-upstream", await getCurrentBranch());
|
|
85304
|
+
}
|
|
85305
|
+
const { stdout: stdout2, stderr: stderr2 } = await execa("git", pushArgs);
|
|
85184
85306
|
if (stdout2) ce(stdout2);
|
|
85185
85307
|
pushSpinner.stop(
|
|
85186
85308
|
`${source_default.green(
|
|
85187
85309
|
"\u2714"
|
|
85188
85310
|
)} successfully pushed all commits to ${selectedRemote}`
|
|
85189
85311
|
);
|
|
85312
|
+
displayPushUrl(stderr2);
|
|
85190
85313
|
}
|
|
85191
85314
|
}
|
|
85192
85315
|
} else {
|
|
@@ -85198,7 +85321,9 @@ ${source_default.grey("\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2
|
|
|
85198
85321
|
await generateCommitMessageFromGitDiff({
|
|
85199
85322
|
diff,
|
|
85200
85323
|
extraArgs: extraArgs2,
|
|
85201
|
-
|
|
85324
|
+
context,
|
|
85325
|
+
fullGitMojiSpec,
|
|
85326
|
+
skipCommitConfirmation
|
|
85202
85327
|
});
|
|
85203
85328
|
}
|
|
85204
85329
|
}
|
|
@@ -85208,7 +85333,9 @@ ${source_default.grey("\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2
|
|
|
85208
85333
|
);
|
|
85209
85334
|
const errorConfig = getConfig();
|
|
85210
85335
|
const provider = errorConfig.OCO_AI_PROVIDER || "openai";
|
|
85211
|
-
const formatted = formatUserFriendlyError(error, provider
|
|
85336
|
+
const formatted = formatUserFriendlyError(error, provider, {
|
|
85337
|
+
baseURL: errorConfig.OCO_API_URL
|
|
85338
|
+
});
|
|
85212
85339
|
ce(printFormattedError(formatted));
|
|
85213
85340
|
process.exit(1);
|
|
85214
85341
|
}
|
|
@@ -85447,24 +85574,6 @@ ${fileContent.toString()}`;
|
|
|
85447
85574
|
}
|
|
85448
85575
|
};
|
|
85449
85576
|
|
|
85450
|
-
// src/utils/proxy.ts
|
|
85451
|
-
var import_undici = __toESM(require_undici(), 1);
|
|
85452
|
-
var import_https_proxy_agent4 = __toESM(require_dist2(), 1);
|
|
85453
|
-
function setupProxy(proxyUrl) {
|
|
85454
|
-
const proxy = proxyUrl || process.env.HTTPS_PROXY || process.env.HTTP_PROXY;
|
|
85455
|
-
if (proxy) {
|
|
85456
|
-
try {
|
|
85457
|
-
const dispatcher = new import_undici.ProxyAgent(proxy);
|
|
85458
|
-
(0, import_undici.setGlobalDispatcher)(dispatcher);
|
|
85459
|
-
const agent = new import_https_proxy_agent4.HttpsProxyAgent(proxy);
|
|
85460
|
-
axios_default.defaults.httpsAgent = agent;
|
|
85461
|
-
axios_default.defaults.proxy = false;
|
|
85462
|
-
} catch (error) {
|
|
85463
|
-
console.warn(`[Proxy Error] Failed to set proxy: ${error.message}`);
|
|
85464
|
-
}
|
|
85465
|
-
}
|
|
85466
|
-
}
|
|
85467
|
-
|
|
85468
85577
|
// src/commands/setup.ts
|
|
85469
85578
|
init_dist2();
|
|
85470
85579
|
|
|
@@ -86033,15 +86142,16 @@ async function runSetup() {
|
|
|
86033
86142
|
return true;
|
|
86034
86143
|
}
|
|
86035
86144
|
function isFirstRun() {
|
|
86145
|
+
const hasGlobalConfig = getIsGlobalConfigFileExist();
|
|
86036
86146
|
const config8 = getConfig();
|
|
86037
86147
|
const provider = config8.OCO_AI_PROVIDER || "openai" /* OPENAI */;
|
|
86038
|
-
if (MODEL_REQUIRED_PROVIDERS.includes(provider)) {
|
|
86039
|
-
return !config8.OCO_MODEL;
|
|
86040
|
-
}
|
|
86041
86148
|
if (provider === "test" /* TEST */) {
|
|
86042
86149
|
return false;
|
|
86043
86150
|
}
|
|
86044
|
-
|
|
86151
|
+
const hasRequiredConfig = MODEL_REQUIRED_PROVIDERS.includes(
|
|
86152
|
+
provider
|
|
86153
|
+
) ? Boolean(config8.OCO_MODEL) : Boolean(config8.OCO_API_KEY);
|
|
86154
|
+
return !hasGlobalConfig && !hasRequiredConfig;
|
|
86045
86155
|
}
|
|
86046
86156
|
async function promptForMissingApiKey() {
|
|
86047
86157
|
const config8 = getConfig();
|
|
@@ -86219,6 +86329,9 @@ var getOpenCommitLatestVersion = async () => {
|
|
|
86219
86329
|
|
|
86220
86330
|
// src/utils/checkIsLatestVersion.ts
|
|
86221
86331
|
var checkIsLatestVersion = async () => {
|
|
86332
|
+
if (process.env.OCO_TEST_SKIP_VERSION_CHECK === "true") {
|
|
86333
|
+
return;
|
|
86334
|
+
}
|
|
86222
86335
|
const latestVersion = await getOpenCommitLatestVersion();
|
|
86223
86336
|
if (latestVersion) {
|
|
86224
86337
|
const currentVersion = package_default.version;
|
|
@@ -86390,8 +86503,30 @@ var runMigrations = async () => {
|
|
|
86390
86503
|
|
|
86391
86504
|
// src/cli.ts
|
|
86392
86505
|
var config7 = getConfig();
|
|
86393
|
-
setupProxy(config7.OCO_PROXY);
|
|
86394
|
-
var
|
|
86506
|
+
setupProxy(resolveProxy(config7.OCO_PROXY));
|
|
86507
|
+
var OCO_FLAGS_WITH_VALUE = /* @__PURE__ */ new Set(["-c", "--context"]);
|
|
86508
|
+
var OCO_BOOLEAN_FLAGS = /* @__PURE__ */ new Set(["-y", "--yes", "--fgm"]);
|
|
86509
|
+
var OCO_EQUALS_PREFIXES = ["-c=", "--context=", "-y=", "--yes=", "--fgm="];
|
|
86510
|
+
var stripOcoFlags = (argv) => {
|
|
86511
|
+
const out = [];
|
|
86512
|
+
for (let i3 = 0; i3 < argv.length; i3++) {
|
|
86513
|
+
const a4 = argv[i3];
|
|
86514
|
+
if (OCO_FLAGS_WITH_VALUE.has(a4)) {
|
|
86515
|
+
i3++;
|
|
86516
|
+
continue;
|
|
86517
|
+
}
|
|
86518
|
+
if (OCO_BOOLEAN_FLAGS.has(a4)) {
|
|
86519
|
+
continue;
|
|
86520
|
+
}
|
|
86521
|
+
if (OCO_EQUALS_PREFIXES.some((prefix) => a4.startsWith(prefix))) {
|
|
86522
|
+
continue;
|
|
86523
|
+
}
|
|
86524
|
+
out.push(a4);
|
|
86525
|
+
}
|
|
86526
|
+
return out;
|
|
86527
|
+
};
|
|
86528
|
+
var rawArgv = process.argv.slice(2);
|
|
86529
|
+
var extraArgs = stripOcoFlags(rawArgv);
|
|
86395
86530
|
Z2(
|
|
86396
86531
|
{
|
|
86397
86532
|
version: package_default.version,
|
|
@@ -86444,7 +86579,7 @@ Z2(
|
|
|
86444
86579
|
}
|
|
86445
86580
|
commit(extraArgs, flags.context, false, flags.fgm, flags.yes);
|
|
86446
86581
|
},
|
|
86447
|
-
|
|
86582
|
+
rawArgv
|
|
86448
86583
|
);
|
|
86449
86584
|
/*! Bundled license information:
|
|
86450
86585
|
|