caveat-cli 0.19.13 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/{chunk-PFYFYJNS.js → chunk-G52CLPRY.js} +744 -466
- package/dist/chunk-G52CLPRY.js.map +1 -0
- package/dist/index.js +56 -7
- package/dist/index.js.map +1 -1
- package/dist/{server-JXBPTQNU.js → server-2D6JIHWY.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-PFYFYJNS.js.map +0 -1
- /package/dist/{server-JXBPTQNU.js.map → server-2D6JIHWY.js.map} +0 -0
|
@@ -334,11 +334,11 @@ var require_common = __commonJS({
|
|
|
334
334
|
return target;
|
|
335
335
|
}
|
|
336
336
|
function repeat2(string, count) {
|
|
337
|
-
var
|
|
337
|
+
var result2 = "", cycle;
|
|
338
338
|
for (cycle = 0; cycle < count; cycle += 1) {
|
|
339
|
-
|
|
339
|
+
result2 += string;
|
|
340
340
|
}
|
|
341
|
-
return
|
|
341
|
+
return result2;
|
|
342
342
|
}
|
|
343
343
|
function isNegativeZero2(number) {
|
|
344
344
|
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
|
|
@@ -371,12 +371,12 @@ var require_exception = __commonJS({
|
|
|
371
371
|
YAMLException2.prototype = Object.create(Error.prototype);
|
|
372
372
|
YAMLException2.prototype.constructor = YAMLException2;
|
|
373
373
|
YAMLException2.prototype.toString = function toString2(compact) {
|
|
374
|
-
var
|
|
375
|
-
|
|
374
|
+
var result2 = this.name + ": ";
|
|
375
|
+
result2 += this.reason || "(unknown reason)";
|
|
376
376
|
if (!compact && this.mark) {
|
|
377
|
-
|
|
377
|
+
result2 += " " + this.mark.toString();
|
|
378
378
|
}
|
|
379
|
-
return
|
|
379
|
+
return result2;
|
|
380
380
|
};
|
|
381
381
|
module2.exports = YAMLException2;
|
|
382
382
|
}
|
|
@@ -461,15 +461,15 @@ var require_type = __commonJS({
|
|
|
461
461
|
"mapping"
|
|
462
462
|
];
|
|
463
463
|
function compileStyleAliases2(map2) {
|
|
464
|
-
var
|
|
464
|
+
var result2 = {};
|
|
465
465
|
if (map2 !== null) {
|
|
466
466
|
Object.keys(map2).forEach(function(style) {
|
|
467
467
|
map2[style].forEach(function(alias) {
|
|
468
|
-
|
|
468
|
+
result2[String(alias)] = style;
|
|
469
469
|
});
|
|
470
470
|
});
|
|
471
471
|
}
|
|
472
|
-
return
|
|
472
|
+
return result2;
|
|
473
473
|
}
|
|
474
474
|
function Type2(tag, options2) {
|
|
475
475
|
options2 = options2 || {};
|
|
@@ -506,37 +506,37 @@ var require_schema = __commonJS({
|
|
|
506
506
|
var common2 = require_common();
|
|
507
507
|
var YAMLException2 = require_exception();
|
|
508
508
|
var Type2 = require_type();
|
|
509
|
-
function compileList2(schema2, name,
|
|
509
|
+
function compileList2(schema2, name, result2) {
|
|
510
510
|
var exclude = [];
|
|
511
511
|
schema2.include.forEach(function(includedSchema) {
|
|
512
|
-
|
|
512
|
+
result2 = compileList2(includedSchema, name, result2);
|
|
513
513
|
});
|
|
514
514
|
schema2[name].forEach(function(currentType) {
|
|
515
|
-
|
|
515
|
+
result2.forEach(function(previousType, previousIndex) {
|
|
516
516
|
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
|
|
517
517
|
exclude.push(previousIndex);
|
|
518
518
|
}
|
|
519
519
|
});
|
|
520
|
-
|
|
520
|
+
result2.push(currentType);
|
|
521
521
|
});
|
|
522
|
-
return
|
|
522
|
+
return result2.filter(function(type2, index) {
|
|
523
523
|
return exclude.indexOf(index) === -1;
|
|
524
524
|
});
|
|
525
525
|
}
|
|
526
526
|
function compileMap2() {
|
|
527
|
-
var
|
|
527
|
+
var result2 = {
|
|
528
528
|
scalar: {},
|
|
529
529
|
sequence: {},
|
|
530
530
|
mapping: {},
|
|
531
531
|
fallback: {}
|
|
532
532
|
}, index, length;
|
|
533
533
|
function collectType(type2) {
|
|
534
|
-
|
|
534
|
+
result2[type2.kind][type2.tag] = result2["fallback"][type2.tag] = type2;
|
|
535
535
|
}
|
|
536
536
|
for (index = 0, length = arguments.length; index < length; index += 1) {
|
|
537
537
|
arguments[index].forEach(collectType);
|
|
538
538
|
}
|
|
539
|
-
return
|
|
539
|
+
return result2;
|
|
540
540
|
}
|
|
541
541
|
function Schema2(definition) {
|
|
542
542
|
this.include = definition.include || [];
|
|
@@ -1082,60 +1082,60 @@ var require_binary = __commonJS({
|
|
|
1082
1082
|
return bitlen % 8 === 0;
|
|
1083
1083
|
}
|
|
1084
1084
|
function constructYamlBinary2(data) {
|
|
1085
|
-
var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map2 = BASE64_MAP2, bits = 0,
|
|
1085
|
+
var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map2 = BASE64_MAP2, bits = 0, result2 = [];
|
|
1086
1086
|
for (idx = 0; idx < max; idx++) {
|
|
1087
1087
|
if (idx % 4 === 0 && idx) {
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1088
|
+
result2.push(bits >> 16 & 255);
|
|
1089
|
+
result2.push(bits >> 8 & 255);
|
|
1090
|
+
result2.push(bits & 255);
|
|
1091
1091
|
}
|
|
1092
1092
|
bits = bits << 6 | map2.indexOf(input.charAt(idx));
|
|
1093
1093
|
}
|
|
1094
1094
|
tailbits = max % 4 * 6;
|
|
1095
1095
|
if (tailbits === 0) {
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1096
|
+
result2.push(bits >> 16 & 255);
|
|
1097
|
+
result2.push(bits >> 8 & 255);
|
|
1098
|
+
result2.push(bits & 255);
|
|
1099
1099
|
} else if (tailbits === 18) {
|
|
1100
|
-
|
|
1101
|
-
|
|
1100
|
+
result2.push(bits >> 10 & 255);
|
|
1101
|
+
result2.push(bits >> 2 & 255);
|
|
1102
1102
|
} else if (tailbits === 12) {
|
|
1103
|
-
|
|
1103
|
+
result2.push(bits >> 4 & 255);
|
|
1104
1104
|
}
|
|
1105
1105
|
if (NodeBuffer) {
|
|
1106
|
-
return NodeBuffer.from ? NodeBuffer.from(
|
|
1106
|
+
return NodeBuffer.from ? NodeBuffer.from(result2) : new NodeBuffer(result2);
|
|
1107
1107
|
}
|
|
1108
|
-
return
|
|
1108
|
+
return result2;
|
|
1109
1109
|
}
|
|
1110
1110
|
function representYamlBinary2(object) {
|
|
1111
|
-
var
|
|
1111
|
+
var result2 = "", bits = 0, idx, tail, max = object.length, map2 = BASE64_MAP2;
|
|
1112
1112
|
for (idx = 0; idx < max; idx++) {
|
|
1113
1113
|
if (idx % 3 === 0 && idx) {
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1114
|
+
result2 += map2[bits >> 18 & 63];
|
|
1115
|
+
result2 += map2[bits >> 12 & 63];
|
|
1116
|
+
result2 += map2[bits >> 6 & 63];
|
|
1117
|
+
result2 += map2[bits & 63];
|
|
1118
1118
|
}
|
|
1119
1119
|
bits = (bits << 8) + object[idx];
|
|
1120
1120
|
}
|
|
1121
1121
|
tail = max % 3;
|
|
1122
1122
|
if (tail === 0) {
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1123
|
+
result2 += map2[bits >> 18 & 63];
|
|
1124
|
+
result2 += map2[bits >> 12 & 63];
|
|
1125
|
+
result2 += map2[bits >> 6 & 63];
|
|
1126
|
+
result2 += map2[bits & 63];
|
|
1127
1127
|
} else if (tail === 2) {
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1128
|
+
result2 += map2[bits >> 10 & 63];
|
|
1129
|
+
result2 += map2[bits >> 4 & 63];
|
|
1130
|
+
result2 += map2[bits << 2 & 63];
|
|
1131
|
+
result2 += map2[64];
|
|
1132
1132
|
} else if (tail === 1) {
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1133
|
+
result2 += map2[bits >> 2 & 63];
|
|
1134
|
+
result2 += map2[bits << 4 & 63];
|
|
1135
|
+
result2 += map2[64];
|
|
1136
|
+
result2 += map2[64];
|
|
1137
1137
|
}
|
|
1138
|
-
return
|
|
1138
|
+
return result2;
|
|
1139
1139
|
}
|
|
1140
1140
|
function isBinary2(object) {
|
|
1141
1141
|
return NodeBuffer && NodeBuffer.isBuffer(object);
|
|
@@ -1195,27 +1195,27 @@ var require_pairs = __commonJS({
|
|
|
1195
1195
|
var _toString2 = Object.prototype.toString;
|
|
1196
1196
|
function resolveYamlPairs2(data) {
|
|
1197
1197
|
if (data === null) return true;
|
|
1198
|
-
var index, length, pair, keys,
|
|
1199
|
-
|
|
1198
|
+
var index, length, pair, keys, result2, object = data;
|
|
1199
|
+
result2 = new Array(object.length);
|
|
1200
1200
|
for (index = 0, length = object.length; index < length; index += 1) {
|
|
1201
1201
|
pair = object[index];
|
|
1202
1202
|
if (_toString2.call(pair) !== "[object Object]") return false;
|
|
1203
1203
|
keys = Object.keys(pair);
|
|
1204
1204
|
if (keys.length !== 1) return false;
|
|
1205
|
-
|
|
1205
|
+
result2[index] = [keys[0], pair[keys[0]]];
|
|
1206
1206
|
}
|
|
1207
1207
|
return true;
|
|
1208
1208
|
}
|
|
1209
1209
|
function constructYamlPairs2(data) {
|
|
1210
1210
|
if (data === null) return [];
|
|
1211
|
-
var index, length, pair, keys,
|
|
1212
|
-
|
|
1211
|
+
var index, length, pair, keys, result2, object = data;
|
|
1212
|
+
result2 = new Array(object.length);
|
|
1213
1213
|
for (index = 0, length = object.length; index < length; index += 1) {
|
|
1214
1214
|
pair = object[index];
|
|
1215
1215
|
keys = Object.keys(pair);
|
|
1216
|
-
|
|
1216
|
+
result2[index] = [keys[0], pair[keys[0]]];
|
|
1217
1217
|
}
|
|
1218
|
-
return
|
|
1218
|
+
return result2;
|
|
1219
1219
|
}
|
|
1220
1220
|
module2.exports = new Type2("tag:yaml.org,2002:pairs", {
|
|
1221
1221
|
kind: "sequence",
|
|
@@ -1327,11 +1327,11 @@ var require_regexp = __commonJS({
|
|
|
1327
1327
|
return new RegExp(regexp, modifiers);
|
|
1328
1328
|
}
|
|
1329
1329
|
function representJavascriptRegExp(object) {
|
|
1330
|
-
var
|
|
1331
|
-
if (object.global)
|
|
1332
|
-
if (object.multiline)
|
|
1333
|
-
if (object.ignoreCase)
|
|
1334
|
-
return
|
|
1330
|
+
var result2 = "/" + object.source + "/";
|
|
1331
|
+
if (object.global) result2 += "g";
|
|
1332
|
+
if (object.multiline) result2 += "m";
|
|
1333
|
+
if (object.ignoreCase) result2 += "i";
|
|
1334
|
+
return result2;
|
|
1335
1335
|
}
|
|
1336
1336
|
function isRegExp(object) {
|
|
1337
1337
|
return Object.prototype.toString.call(object) === "[object RegExp]";
|
|
@@ -2607,9 +2607,9 @@ var require_dumper = __commonJS({
|
|
|
2607
2607
|
"OFF"
|
|
2608
2608
|
];
|
|
2609
2609
|
function compileStyleMap2(schema2, map2) {
|
|
2610
|
-
var
|
|
2610
|
+
var result2, keys, index, length, tag, style, type2;
|
|
2611
2611
|
if (map2 === null) return {};
|
|
2612
|
-
|
|
2612
|
+
result2 = {};
|
|
2613
2613
|
keys = Object.keys(map2);
|
|
2614
2614
|
for (index = 0, length = keys.length; index < length; index += 1) {
|
|
2615
2615
|
tag = keys[index];
|
|
@@ -2621,9 +2621,9 @@ var require_dumper = __commonJS({
|
|
|
2621
2621
|
if (type2 && _hasOwnProperty2.call(type2.styleAliases, style)) {
|
|
2622
2622
|
style = type2.styleAliases[style];
|
|
2623
2623
|
}
|
|
2624
|
-
|
|
2624
|
+
result2[tag] = style;
|
|
2625
2625
|
}
|
|
2626
|
-
return
|
|
2626
|
+
return result2;
|
|
2627
2627
|
}
|
|
2628
2628
|
function encodeHex2(character) {
|
|
2629
2629
|
var string, handle, length;
|
|
@@ -2662,7 +2662,7 @@ var require_dumper = __commonJS({
|
|
|
2662
2662
|
this.usedDuplicates = null;
|
|
2663
2663
|
}
|
|
2664
2664
|
function indentString2(string, spaces) {
|
|
2665
|
-
var ind = common2.repeat(" ", spaces), position = 0, next = -1,
|
|
2665
|
+
var ind = common2.repeat(" ", spaces), position = 0, next = -1, result2 = "", line, length = string.length;
|
|
2666
2666
|
while (position < length) {
|
|
2667
2667
|
next = string.indexOf("\n", position);
|
|
2668
2668
|
if (next === -1) {
|
|
@@ -2672,10 +2672,10 @@ var require_dumper = __commonJS({
|
|
|
2672
2672
|
line = string.slice(position, next + 1);
|
|
2673
2673
|
position = next + 1;
|
|
2674
2674
|
}
|
|
2675
|
-
if (line.length && line !== "\n")
|
|
2676
|
-
|
|
2675
|
+
if (line.length && line !== "\n") result2 += ind;
|
|
2676
|
+
result2 += line;
|
|
2677
2677
|
}
|
|
2678
|
-
return
|
|
2678
|
+
return result2;
|
|
2679
2679
|
}
|
|
2680
2680
|
function generateNextLine2(state, level) {
|
|
2681
2681
|
return "\n" + common2.repeat(" ", state.indent * level);
|
|
@@ -2721,7 +2721,7 @@ var require_dumper = __commonJS({
|
|
|
2721
2721
|
var hasFoldableLine = false;
|
|
2722
2722
|
var shouldTrackWidth = lineWidth !== -1;
|
|
2723
2723
|
var previousLineBreak = -1;
|
|
2724
|
-
var
|
|
2724
|
+
var plain3 = isPlainSafeFirst2(string.charCodeAt(0)) && !isWhitespace2(string.charCodeAt(string.length - 1));
|
|
2725
2725
|
if (singleLineOnly) {
|
|
2726
2726
|
for (i2 = 0; i2 < string.length; i2++) {
|
|
2727
2727
|
char = string.charCodeAt(i2);
|
|
@@ -2729,7 +2729,7 @@ var require_dumper = __commonJS({
|
|
|
2729
2729
|
return STYLE_DOUBLE2;
|
|
2730
2730
|
}
|
|
2731
2731
|
prev_char = i2 > 0 ? string.charCodeAt(i2 - 1) : null;
|
|
2732
|
-
|
|
2732
|
+
plain3 = plain3 && isPlainSafe2(char, prev_char);
|
|
2733
2733
|
}
|
|
2734
2734
|
} else {
|
|
2735
2735
|
for (i2 = 0; i2 < string.length; i2++) {
|
|
@@ -2745,12 +2745,12 @@ var require_dumper = __commonJS({
|
|
|
2745
2745
|
return STYLE_DOUBLE2;
|
|
2746
2746
|
}
|
|
2747
2747
|
prev_char = i2 > 0 ? string.charCodeAt(i2 - 1) : null;
|
|
2748
|
-
|
|
2748
|
+
plain3 = plain3 && isPlainSafe2(char, prev_char);
|
|
2749
2749
|
}
|
|
2750
2750
|
hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i2 - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ");
|
|
2751
2751
|
}
|
|
2752
2752
|
if (!hasLineBreak && !hasFoldableLine) {
|
|
2753
|
-
return
|
|
2753
|
+
return plain3 && !testAmbiguousType(string) ? STYLE_PLAIN2 : STYLE_SINGLE2;
|
|
2754
2754
|
}
|
|
2755
2755
|
if (indentPerLevel > 9 && needIndentIndicator2(string)) {
|
|
2756
2756
|
return STYLE_DOUBLE2;
|
|
@@ -2799,7 +2799,7 @@ var require_dumper = __commonJS({
|
|
|
2799
2799
|
}
|
|
2800
2800
|
function foldString2(string, width) {
|
|
2801
2801
|
var lineRe = /(\n+)([^\n]*)/g;
|
|
2802
|
-
var
|
|
2802
|
+
var result2 = (function() {
|
|
2803
2803
|
var nextLF = string.indexOf("\n");
|
|
2804
2804
|
nextLF = nextLF !== -1 ? nextLF : string.length;
|
|
2805
2805
|
lineRe.lastIndex = nextLF;
|
|
@@ -2811,36 +2811,36 @@ var require_dumper = __commonJS({
|
|
|
2811
2811
|
while (match = lineRe.exec(string)) {
|
|
2812
2812
|
var prefix = match[1], line = match[2];
|
|
2813
2813
|
moreIndented = line[0] === " ";
|
|
2814
|
-
|
|
2814
|
+
result2 += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine2(line, width);
|
|
2815
2815
|
prevMoreIndented = moreIndented;
|
|
2816
2816
|
}
|
|
2817
|
-
return
|
|
2817
|
+
return result2;
|
|
2818
2818
|
}
|
|
2819
2819
|
function foldLine2(line, width) {
|
|
2820
2820
|
if (line === "" || line[0] === " ") return line;
|
|
2821
2821
|
var breakRe = / [^ ]/g;
|
|
2822
2822
|
var match;
|
|
2823
2823
|
var start = 0, end, curr = 0, next = 0;
|
|
2824
|
-
var
|
|
2824
|
+
var result2 = "";
|
|
2825
2825
|
while (match = breakRe.exec(line)) {
|
|
2826
2826
|
next = match.index;
|
|
2827
2827
|
if (next - start > width) {
|
|
2828
2828
|
end = curr > start ? curr : next;
|
|
2829
|
-
|
|
2829
|
+
result2 += "\n" + line.slice(start, end);
|
|
2830
2830
|
start = end + 1;
|
|
2831
2831
|
}
|
|
2832
2832
|
curr = next;
|
|
2833
2833
|
}
|
|
2834
|
-
|
|
2834
|
+
result2 += "\n";
|
|
2835
2835
|
if (line.length - start > width && curr > start) {
|
|
2836
|
-
|
|
2836
|
+
result2 += line.slice(start, curr) + "\n" + line.slice(curr + 1);
|
|
2837
2837
|
} else {
|
|
2838
|
-
|
|
2838
|
+
result2 += line.slice(start);
|
|
2839
2839
|
}
|
|
2840
|
-
return
|
|
2840
|
+
return result2.slice(1);
|
|
2841
2841
|
}
|
|
2842
2842
|
function escapeString2(string) {
|
|
2843
|
-
var
|
|
2843
|
+
var result2 = "";
|
|
2844
2844
|
var char, nextChar;
|
|
2845
2845
|
var escapeSeq;
|
|
2846
2846
|
for (var i2 = 0; i2 < string.length; i2++) {
|
|
@@ -2848,15 +2848,15 @@ var require_dumper = __commonJS({
|
|
|
2848
2848
|
if (char >= 55296 && char <= 56319) {
|
|
2849
2849
|
nextChar = string.charCodeAt(i2 + 1);
|
|
2850
2850
|
if (nextChar >= 56320 && nextChar <= 57343) {
|
|
2851
|
-
|
|
2851
|
+
result2 += encodeHex2((char - 55296) * 1024 + nextChar - 56320 + 65536);
|
|
2852
2852
|
i2++;
|
|
2853
2853
|
continue;
|
|
2854
2854
|
}
|
|
2855
2855
|
}
|
|
2856
2856
|
escapeSeq = ESCAPE_SEQUENCES2[char];
|
|
2857
|
-
|
|
2857
|
+
result2 += !escapeSeq && isPrintable2(char) ? string[i2] : escapeSeq || encodeHex2(char);
|
|
2858
2858
|
}
|
|
2859
|
-
return
|
|
2859
|
+
return result2;
|
|
2860
2860
|
}
|
|
2861
2861
|
function writeFlowSequence2(state, level, object) {
|
|
2862
2862
|
var _result = "", _tag = state.tag, index, length;
|
|
@@ -4246,10 +4246,10 @@ var require_dist2 = __commonJS({
|
|
|
4246
4246
|
});
|
|
4247
4247
|
return {
|
|
4248
4248
|
promise,
|
|
4249
|
-
done(
|
|
4249
|
+
done(result2) {
|
|
4250
4250
|
if (status === "pending") {
|
|
4251
4251
|
status = "resolved";
|
|
4252
|
-
done(
|
|
4252
|
+
done(result2);
|
|
4253
4253
|
}
|
|
4254
4254
|
},
|
|
4255
4255
|
fail(error) {
|
|
@@ -5122,10 +5122,10 @@ var require_truncate = __commonJS({
|
|
|
5122
5122
|
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/truncate.js"(exports2, module2) {
|
|
5123
5123
|
"use strict";
|
|
5124
5124
|
var parse2 = require_parse2();
|
|
5125
|
-
var
|
|
5125
|
+
var constants2 = require_constants();
|
|
5126
5126
|
var SemVer = require_semver();
|
|
5127
5127
|
var truncate = (version, truncation, options2) => {
|
|
5128
|
-
if (!
|
|
5128
|
+
if (!constants2.RELEASE_TYPES.includes(truncation)) {
|
|
5129
5129
|
return null;
|
|
5130
5130
|
}
|
|
5131
5131
|
const clonedVersion = cloneInputVersion(version, options2);
|
|
@@ -5302,9 +5302,9 @@ var require_range = __commonJS({
|
|
|
5302
5302
|
if (rangeMap.size > 1 && rangeMap.has("")) {
|
|
5303
5303
|
rangeMap.delete("");
|
|
5304
5304
|
}
|
|
5305
|
-
const
|
|
5306
|
-
cache.set(memoKey,
|
|
5307
|
-
return
|
|
5305
|
+
const result2 = [...rangeMap.values()];
|
|
5306
|
+
cache.set(memoKey, result2);
|
|
5307
|
+
return result2;
|
|
5308
5308
|
}
|
|
5309
5309
|
intersects(range, options2) {
|
|
5310
5310
|
if (!(range instanceof _Range)) {
|
|
@@ -5360,16 +5360,16 @@ var require_range = __commonJS({
|
|
|
5360
5360
|
var isNullSet = (c3) => c3.value === "<0.0.0-0";
|
|
5361
5361
|
var isAny = (c3) => c3.value === "";
|
|
5362
5362
|
var isSatisfiable = (comparators, options2) => {
|
|
5363
|
-
let
|
|
5363
|
+
let result2 = true;
|
|
5364
5364
|
const remainingComparators = comparators.slice();
|
|
5365
5365
|
let testComparator = remainingComparators.pop();
|
|
5366
|
-
while (
|
|
5367
|
-
|
|
5366
|
+
while (result2 && remainingComparators.length) {
|
|
5367
|
+
result2 = remainingComparators.every((otherComparator) => {
|
|
5368
5368
|
return testComparator.intersects(otherComparator, options2);
|
|
5369
5369
|
});
|
|
5370
5370
|
testComparator = remainingComparators.pop();
|
|
5371
5371
|
}
|
|
5372
|
-
return
|
|
5372
|
+
return result2;
|
|
5373
5373
|
};
|
|
5374
5374
|
var parseComparator = (comp, options2) => {
|
|
5375
5375
|
comp = comp.replace(re[t2.BUILD], "");
|
|
@@ -6174,7 +6174,7 @@ var require_semver2 = __commonJS({
|
|
|
6174
6174
|
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/index.js"(exports2, module2) {
|
|
6175
6175
|
"use strict";
|
|
6176
6176
|
var internalRe = require_re();
|
|
6177
|
-
var
|
|
6177
|
+
var constants2 = require_constants();
|
|
6178
6178
|
var SemVer = require_semver();
|
|
6179
6179
|
var identifiers = require_identifiers();
|
|
6180
6180
|
var parse2 = require_parse2();
|
|
@@ -6258,8 +6258,8 @@ var require_semver2 = __commonJS({
|
|
|
6258
6258
|
re: internalRe.re,
|
|
6259
6259
|
src: internalRe.src,
|
|
6260
6260
|
tokens: internalRe.t,
|
|
6261
|
-
SEMVER_SPEC_VERSION:
|
|
6262
|
-
RELEASE_TYPES:
|
|
6261
|
+
SEMVER_SPEC_VERSION: constants2.SEMVER_SPEC_VERSION,
|
|
6262
|
+
RELEASE_TYPES: constants2.RELEASE_TYPES,
|
|
6263
6263
|
compareIdentifiers: identifiers.compareIdentifiers,
|
|
6264
6264
|
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
6265
6265
|
};
|
|
@@ -6299,11 +6299,11 @@ function extend(target, source) {
|
|
|
6299
6299
|
return target;
|
|
6300
6300
|
}
|
|
6301
6301
|
function repeat(string, count) {
|
|
6302
|
-
var
|
|
6302
|
+
var result2 = "", cycle;
|
|
6303
6303
|
for (cycle = 0; cycle < count; cycle += 1) {
|
|
6304
|
-
|
|
6304
|
+
result2 += string;
|
|
6305
6305
|
}
|
|
6306
|
-
return
|
|
6306
|
+
return result2;
|
|
6307
6307
|
}
|
|
6308
6308
|
function isNegativeZero(number) {
|
|
6309
6309
|
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
|
|
@@ -6393,7 +6393,7 @@ function makeSnippet(mark, options2) {
|
|
|
6393
6393
|
}
|
|
6394
6394
|
}
|
|
6395
6395
|
if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
|
|
6396
|
-
var
|
|
6396
|
+
var result2 = "", i2, line;
|
|
6397
6397
|
var lineNoLength = Math.min(mark.line + options2.linesAfter, lineEnds.length).toString().length;
|
|
6398
6398
|
var maxLineLength = options2.maxLength - (options2.indent + lineNoLength + 3);
|
|
6399
6399
|
for (i2 = 1; i2 <= options2.linesBefore; i2++) {
|
|
@@ -6405,11 +6405,11 @@ function makeSnippet(mark, options2) {
|
|
|
6405
6405
|
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i2]),
|
|
6406
6406
|
maxLineLength
|
|
6407
6407
|
);
|
|
6408
|
-
|
|
6408
|
+
result2 = common.repeat(" ", options2.indent) + padStart((mark.line - i2 + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result2;
|
|
6409
6409
|
}
|
|
6410
6410
|
line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
|
|
6411
|
-
|
|
6412
|
-
|
|
6411
|
+
result2 += common.repeat(" ", options2.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
|
6412
|
+
result2 += common.repeat("-", options2.indent + lineNoLength + 3 + line.pos) + "^\n";
|
|
6413
6413
|
for (i2 = 1; i2 <= options2.linesAfter; i2++) {
|
|
6414
6414
|
if (foundLineNo + i2 >= lineEnds.length) break;
|
|
6415
6415
|
line = getLine(
|
|
@@ -6419,9 +6419,9 @@ function makeSnippet(mark, options2) {
|
|
|
6419
6419
|
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i2]),
|
|
6420
6420
|
maxLineLength
|
|
6421
6421
|
);
|
|
6422
|
-
|
|
6422
|
+
result2 += common.repeat(" ", options2.indent) + padStart((mark.line + i2 + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
|
6423
6423
|
}
|
|
6424
|
-
return
|
|
6424
|
+
return result2.replace(/\n$/, "");
|
|
6425
6425
|
}
|
|
6426
6426
|
var snippet = makeSnippet;
|
|
6427
6427
|
var TYPE_CONSTRUCTOR_OPTIONS = [
|
|
@@ -6442,15 +6442,15 @@ var YAML_NODE_KINDS = [
|
|
|
6442
6442
|
"mapping"
|
|
6443
6443
|
];
|
|
6444
6444
|
function compileStyleAliases(map2) {
|
|
6445
|
-
var
|
|
6445
|
+
var result2 = {};
|
|
6446
6446
|
if (map2 !== null) {
|
|
6447
6447
|
Object.keys(map2).forEach(function(style) {
|
|
6448
6448
|
map2[style].forEach(function(alias) {
|
|
6449
|
-
|
|
6449
|
+
result2[String(alias)] = style;
|
|
6450
6450
|
});
|
|
6451
6451
|
});
|
|
6452
6452
|
}
|
|
6453
|
-
return
|
|
6453
|
+
return result2;
|
|
6454
6454
|
}
|
|
6455
6455
|
function Type$1(tag, options2) {
|
|
6456
6456
|
options2 = options2 || {};
|
|
@@ -6481,20 +6481,20 @@ function Type$1(tag, options2) {
|
|
|
6481
6481
|
}
|
|
6482
6482
|
var type = Type$1;
|
|
6483
6483
|
function compileList(schema2, name) {
|
|
6484
|
-
var
|
|
6484
|
+
var result2 = [];
|
|
6485
6485
|
schema2[name].forEach(function(currentType) {
|
|
6486
|
-
var newIndex =
|
|
6487
|
-
|
|
6486
|
+
var newIndex = result2.length;
|
|
6487
|
+
result2.forEach(function(previousType, previousIndex) {
|
|
6488
6488
|
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
|
|
6489
6489
|
newIndex = previousIndex;
|
|
6490
6490
|
}
|
|
6491
6491
|
});
|
|
6492
|
-
|
|
6492
|
+
result2[newIndex] = currentType;
|
|
6493
6493
|
});
|
|
6494
|
-
return
|
|
6494
|
+
return result2;
|
|
6495
6495
|
}
|
|
6496
6496
|
function compileMap() {
|
|
6497
|
-
var
|
|
6497
|
+
var result2 = {
|
|
6498
6498
|
scalar: {},
|
|
6499
6499
|
sequence: {},
|
|
6500
6500
|
mapping: {},
|
|
@@ -6508,16 +6508,16 @@ function compileMap() {
|
|
|
6508
6508
|
}, index, length;
|
|
6509
6509
|
function collectType(type2) {
|
|
6510
6510
|
if (type2.multi) {
|
|
6511
|
-
|
|
6512
|
-
|
|
6511
|
+
result2.multi[type2.kind].push(type2);
|
|
6512
|
+
result2.multi["fallback"].push(type2);
|
|
6513
6513
|
} else {
|
|
6514
|
-
|
|
6514
|
+
result2[type2.kind][type2.tag] = result2["fallback"][type2.tag] = type2;
|
|
6515
6515
|
}
|
|
6516
6516
|
}
|
|
6517
6517
|
for (index = 0, length = arguments.length; index < length; index += 1) {
|
|
6518
6518
|
arguments[index].forEach(collectType);
|
|
6519
6519
|
}
|
|
6520
|
-
return
|
|
6520
|
+
return result2;
|
|
6521
6521
|
}
|
|
6522
6522
|
function Schema$1(definition) {
|
|
6523
6523
|
return this.extend(definition);
|
|
@@ -6551,13 +6551,13 @@ Schema$1.prototype.extend = function extend2(definition) {
|
|
|
6551
6551
|
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
6552
6552
|
}
|
|
6553
6553
|
});
|
|
6554
|
-
var
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
return
|
|
6554
|
+
var result2 = Object.create(Schema$1.prototype);
|
|
6555
|
+
result2.implicit = (this.implicit || []).concat(implicit);
|
|
6556
|
+
result2.explicit = (this.explicit || []).concat(explicit);
|
|
6557
|
+
result2.compiledImplicit = compileList(result2, "implicit");
|
|
6558
|
+
result2.compiledExplicit = compileList(result2, "explicit");
|
|
6559
|
+
result2.compiledTypeMap = compileMap(result2.compiledImplicit, result2.compiledExplicit);
|
|
6560
|
+
return result2;
|
|
6561
6561
|
};
|
|
6562
6562
|
var schema = Schema$1;
|
|
6563
6563
|
var str2 = new type("tag:yaml.org,2002:str", {
|
|
@@ -6918,57 +6918,57 @@ function resolveYamlBinary(data) {
|
|
|
6918
6918
|
return bitlen % 8 === 0;
|
|
6919
6919
|
}
|
|
6920
6920
|
function constructYamlBinary(data) {
|
|
6921
|
-
var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map2 = BASE64_MAP, bits = 0,
|
|
6921
|
+
var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map2 = BASE64_MAP, bits = 0, result2 = [];
|
|
6922
6922
|
for (idx = 0; idx < max; idx++) {
|
|
6923
6923
|
if (idx % 4 === 0 && idx) {
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6924
|
+
result2.push(bits >> 16 & 255);
|
|
6925
|
+
result2.push(bits >> 8 & 255);
|
|
6926
|
+
result2.push(bits & 255);
|
|
6927
6927
|
}
|
|
6928
6928
|
bits = bits << 6 | map2.indexOf(input.charAt(idx));
|
|
6929
6929
|
}
|
|
6930
6930
|
tailbits = max % 4 * 6;
|
|
6931
6931
|
if (tailbits === 0) {
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
|
|
6932
|
+
result2.push(bits >> 16 & 255);
|
|
6933
|
+
result2.push(bits >> 8 & 255);
|
|
6934
|
+
result2.push(bits & 255);
|
|
6935
6935
|
} else if (tailbits === 18) {
|
|
6936
|
-
|
|
6937
|
-
|
|
6936
|
+
result2.push(bits >> 10 & 255);
|
|
6937
|
+
result2.push(bits >> 2 & 255);
|
|
6938
6938
|
} else if (tailbits === 12) {
|
|
6939
|
-
|
|
6939
|
+
result2.push(bits >> 4 & 255);
|
|
6940
6940
|
}
|
|
6941
|
-
return new Uint8Array(
|
|
6941
|
+
return new Uint8Array(result2);
|
|
6942
6942
|
}
|
|
6943
6943
|
function representYamlBinary(object) {
|
|
6944
|
-
var
|
|
6944
|
+
var result2 = "", bits = 0, idx, tail, max = object.length, map2 = BASE64_MAP;
|
|
6945
6945
|
for (idx = 0; idx < max; idx++) {
|
|
6946
6946
|
if (idx % 3 === 0 && idx) {
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6947
|
+
result2 += map2[bits >> 18 & 63];
|
|
6948
|
+
result2 += map2[bits >> 12 & 63];
|
|
6949
|
+
result2 += map2[bits >> 6 & 63];
|
|
6950
|
+
result2 += map2[bits & 63];
|
|
6951
6951
|
}
|
|
6952
6952
|
bits = (bits << 8) + object[idx];
|
|
6953
6953
|
}
|
|
6954
6954
|
tail = max % 3;
|
|
6955
6955
|
if (tail === 0) {
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6956
|
+
result2 += map2[bits >> 18 & 63];
|
|
6957
|
+
result2 += map2[bits >> 12 & 63];
|
|
6958
|
+
result2 += map2[bits >> 6 & 63];
|
|
6959
|
+
result2 += map2[bits & 63];
|
|
6960
6960
|
} else if (tail === 2) {
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6961
|
+
result2 += map2[bits >> 10 & 63];
|
|
6962
|
+
result2 += map2[bits >> 4 & 63];
|
|
6963
|
+
result2 += map2[bits << 2 & 63];
|
|
6964
|
+
result2 += map2[64];
|
|
6965
6965
|
} else if (tail === 1) {
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6966
|
+
result2 += map2[bits >> 2 & 63];
|
|
6967
|
+
result2 += map2[bits << 4 & 63];
|
|
6968
|
+
result2 += map2[64];
|
|
6969
|
+
result2 += map2[64];
|
|
6970
6970
|
}
|
|
6971
|
-
return
|
|
6971
|
+
return result2;
|
|
6972
6972
|
}
|
|
6973
6973
|
function isBinary(obj) {
|
|
6974
6974
|
return Object.prototype.toString.call(obj) === "[object Uint8Array]";
|
|
@@ -7012,27 +7012,27 @@ var omap = new type("tag:yaml.org,2002:omap", {
|
|
|
7012
7012
|
var _toString$1 = Object.prototype.toString;
|
|
7013
7013
|
function resolveYamlPairs(data) {
|
|
7014
7014
|
if (data === null) return true;
|
|
7015
|
-
var index, length, pair, keys,
|
|
7016
|
-
|
|
7015
|
+
var index, length, pair, keys, result2, object = data;
|
|
7016
|
+
result2 = new Array(object.length);
|
|
7017
7017
|
for (index = 0, length = object.length; index < length; index += 1) {
|
|
7018
7018
|
pair = object[index];
|
|
7019
7019
|
if (_toString$1.call(pair) !== "[object Object]") return false;
|
|
7020
7020
|
keys = Object.keys(pair);
|
|
7021
7021
|
if (keys.length !== 1) return false;
|
|
7022
|
-
|
|
7022
|
+
result2[index] = [keys[0], pair[keys[0]]];
|
|
7023
7023
|
}
|
|
7024
7024
|
return true;
|
|
7025
7025
|
}
|
|
7026
7026
|
function constructYamlPairs(data) {
|
|
7027
7027
|
if (data === null) return [];
|
|
7028
|
-
var index, length, pair, keys,
|
|
7029
|
-
|
|
7028
|
+
var index, length, pair, keys, result2, object = data;
|
|
7029
|
+
result2 = new Array(object.length);
|
|
7030
7030
|
for (index = 0, length = object.length; index < length; index += 1) {
|
|
7031
7031
|
pair = object[index];
|
|
7032
7032
|
keys = Object.keys(pair);
|
|
7033
|
-
|
|
7033
|
+
result2[index] = [keys[0], pair[keys[0]]];
|
|
7034
7034
|
}
|
|
7035
|
-
return
|
|
7035
|
+
return result2;
|
|
7036
7036
|
}
|
|
7037
7037
|
var pairs = new type("tag:yaml.org,2002:pairs", {
|
|
7038
7038
|
kind: "sequence",
|
|
@@ -8290,9 +8290,9 @@ var DEPRECATED_BOOLEANS_SYNTAX = [
|
|
|
8290
8290
|
];
|
|
8291
8291
|
var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
8292
8292
|
function compileStyleMap(schema2, map2) {
|
|
8293
|
-
var
|
|
8293
|
+
var result2, keys, index, length, tag, style, type2;
|
|
8294
8294
|
if (map2 === null) return {};
|
|
8295
|
-
|
|
8295
|
+
result2 = {};
|
|
8296
8296
|
keys = Object.keys(map2);
|
|
8297
8297
|
for (index = 0, length = keys.length; index < length; index += 1) {
|
|
8298
8298
|
tag = keys[index];
|
|
@@ -8304,9 +8304,9 @@ function compileStyleMap(schema2, map2) {
|
|
|
8304
8304
|
if (type2 && _hasOwnProperty.call(type2.styleAliases, style)) {
|
|
8305
8305
|
style = type2.styleAliases[style];
|
|
8306
8306
|
}
|
|
8307
|
-
|
|
8307
|
+
result2[tag] = style;
|
|
8308
8308
|
}
|
|
8309
|
-
return
|
|
8309
|
+
return result2;
|
|
8310
8310
|
}
|
|
8311
8311
|
function encodeHex(character) {
|
|
8312
8312
|
var string, handle, length;
|
|
@@ -8350,7 +8350,7 @@ function State(options2) {
|
|
|
8350
8350
|
this.usedDuplicates = null;
|
|
8351
8351
|
}
|
|
8352
8352
|
function indentString(string, spaces) {
|
|
8353
|
-
var ind = common.repeat(" ", spaces), position = 0, next = -1,
|
|
8353
|
+
var ind = common.repeat(" ", spaces), position = 0, next = -1, result2 = "", line, length = string.length;
|
|
8354
8354
|
while (position < length) {
|
|
8355
8355
|
next = string.indexOf("\n", position);
|
|
8356
8356
|
if (next === -1) {
|
|
@@ -8360,10 +8360,10 @@ function indentString(string, spaces) {
|
|
|
8360
8360
|
line = string.slice(position, next + 1);
|
|
8361
8361
|
position = next + 1;
|
|
8362
8362
|
}
|
|
8363
|
-
if (line.length && line !== "\n")
|
|
8364
|
-
|
|
8363
|
+
if (line.length && line !== "\n") result2 += ind;
|
|
8364
|
+
result2 += line;
|
|
8365
8365
|
}
|
|
8366
|
-
return
|
|
8366
|
+
return result2;
|
|
8367
8367
|
}
|
|
8368
8368
|
function generateNextLine(state, level) {
|
|
8369
8369
|
return "\n" + common.repeat(" ", state.indent * level);
|
|
@@ -8431,14 +8431,14 @@ function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, te
|
|
|
8431
8431
|
var hasFoldableLine = false;
|
|
8432
8432
|
var shouldTrackWidth = lineWidth !== -1;
|
|
8433
8433
|
var previousLineBreak = -1;
|
|
8434
|
-
var
|
|
8434
|
+
var plain3 = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1));
|
|
8435
8435
|
if (singleLineOnly || forceQuotes) {
|
|
8436
8436
|
for (i2 = 0; i2 < string.length; char >= 65536 ? i2 += 2 : i2++) {
|
|
8437
8437
|
char = codePointAt(string, i2);
|
|
8438
8438
|
if (!isPrintable(char)) {
|
|
8439
8439
|
return STYLE_DOUBLE;
|
|
8440
8440
|
}
|
|
8441
|
-
|
|
8441
|
+
plain3 = plain3 && isPlainSafe(char, prevChar, inblock);
|
|
8442
8442
|
prevChar = char;
|
|
8443
8443
|
}
|
|
8444
8444
|
} else {
|
|
@@ -8454,13 +8454,13 @@ function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, te
|
|
|
8454
8454
|
} else if (!isPrintable(char)) {
|
|
8455
8455
|
return STYLE_DOUBLE;
|
|
8456
8456
|
}
|
|
8457
|
-
|
|
8457
|
+
plain3 = plain3 && isPlainSafe(char, prevChar, inblock);
|
|
8458
8458
|
prevChar = char;
|
|
8459
8459
|
}
|
|
8460
8460
|
hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i2 - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ");
|
|
8461
8461
|
}
|
|
8462
8462
|
if (!hasLineBreak && !hasFoldableLine) {
|
|
8463
|
-
if (
|
|
8463
|
+
if (plain3 && !forceQuotes && !testAmbiguousType(string)) {
|
|
8464
8464
|
return STYLE_PLAIN;
|
|
8465
8465
|
}
|
|
8466
8466
|
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
@@ -8526,7 +8526,7 @@ function dropEndingNewline(string) {
|
|
|
8526
8526
|
}
|
|
8527
8527
|
function foldString(string, width) {
|
|
8528
8528
|
var lineRe = /(\n+)([^\n]*)/g;
|
|
8529
|
-
var
|
|
8529
|
+
var result2 = (function() {
|
|
8530
8530
|
var nextLF = string.indexOf("\n");
|
|
8531
8531
|
nextLF = nextLF !== -1 ? nextLF : string.length;
|
|
8532
8532
|
lineRe.lastIndex = nextLF;
|
|
@@ -8538,49 +8538,49 @@ function foldString(string, width) {
|
|
|
8538
8538
|
while (match = lineRe.exec(string)) {
|
|
8539
8539
|
var prefix = match[1], line = match[2];
|
|
8540
8540
|
moreIndented = line[0] === " ";
|
|
8541
|
-
|
|
8541
|
+
result2 += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
|
|
8542
8542
|
prevMoreIndented = moreIndented;
|
|
8543
8543
|
}
|
|
8544
|
-
return
|
|
8544
|
+
return result2;
|
|
8545
8545
|
}
|
|
8546
8546
|
function foldLine(line, width) {
|
|
8547
8547
|
if (line === "" || line[0] === " ") return line;
|
|
8548
8548
|
var breakRe = / [^ ]/g;
|
|
8549
8549
|
var match;
|
|
8550
8550
|
var start = 0, end, curr = 0, next = 0;
|
|
8551
|
-
var
|
|
8551
|
+
var result2 = "";
|
|
8552
8552
|
while (match = breakRe.exec(line)) {
|
|
8553
8553
|
next = match.index;
|
|
8554
8554
|
if (next - start > width) {
|
|
8555
8555
|
end = curr > start ? curr : next;
|
|
8556
|
-
|
|
8556
|
+
result2 += "\n" + line.slice(start, end);
|
|
8557
8557
|
start = end + 1;
|
|
8558
8558
|
}
|
|
8559
8559
|
curr = next;
|
|
8560
8560
|
}
|
|
8561
|
-
|
|
8561
|
+
result2 += "\n";
|
|
8562
8562
|
if (line.length - start > width && curr > start) {
|
|
8563
|
-
|
|
8563
|
+
result2 += line.slice(start, curr) + "\n" + line.slice(curr + 1);
|
|
8564
8564
|
} else {
|
|
8565
|
-
|
|
8565
|
+
result2 += line.slice(start);
|
|
8566
8566
|
}
|
|
8567
|
-
return
|
|
8567
|
+
return result2.slice(1);
|
|
8568
8568
|
}
|
|
8569
8569
|
function escapeString(string) {
|
|
8570
|
-
var
|
|
8570
|
+
var result2 = "";
|
|
8571
8571
|
var char = 0;
|
|
8572
8572
|
var escapeSeq;
|
|
8573
8573
|
for (var i2 = 0; i2 < string.length; char >= 65536 ? i2 += 2 : i2++) {
|
|
8574
8574
|
char = codePointAt(string, i2);
|
|
8575
8575
|
escapeSeq = ESCAPE_SEQUENCES[char];
|
|
8576
8576
|
if (!escapeSeq && isPrintable(char)) {
|
|
8577
|
-
|
|
8578
|
-
if (char >= 65536)
|
|
8577
|
+
result2 += string[i2];
|
|
8578
|
+
if (char >= 65536) result2 += string[i2 + 1];
|
|
8579
8579
|
} else {
|
|
8580
|
-
|
|
8580
|
+
result2 += escapeSeq || encodeHex(char);
|
|
8581
8581
|
}
|
|
8582
8582
|
}
|
|
8583
|
-
return
|
|
8583
|
+
return result2;
|
|
8584
8584
|
}
|
|
8585
8585
|
function writeFlowSequence(state, level, object) {
|
|
8586
8586
|
var _result = "", _tag = state.tag, index, length, value;
|
|
@@ -8910,22 +8910,22 @@ function parseMarkdown(source) {
|
|
|
8910
8910
|
};
|
|
8911
8911
|
}
|
|
8912
8912
|
function extractSections(body) {
|
|
8913
|
-
const
|
|
8913
|
+
const result2 = {};
|
|
8914
8914
|
const lines = body.split(/\r?\n/);
|
|
8915
8915
|
let heading = null;
|
|
8916
8916
|
let buf = [];
|
|
8917
8917
|
for (const line of lines) {
|
|
8918
8918
|
const m = /^##\s+(.+?)\s*$/.exec(line);
|
|
8919
8919
|
if (m) {
|
|
8920
|
-
if (heading !== null)
|
|
8920
|
+
if (heading !== null) result2[heading] = buf.join("\n").trim();
|
|
8921
8921
|
heading = m[1].trim();
|
|
8922
8922
|
buf = [];
|
|
8923
8923
|
} else if (heading !== null) {
|
|
8924
8924
|
buf.push(line);
|
|
8925
8925
|
}
|
|
8926
8926
|
}
|
|
8927
|
-
if (heading !== null)
|
|
8928
|
-
return
|
|
8927
|
+
if (heading !== null) result2[heading] = buf.join("\n").trim();
|
|
8928
|
+
return result2;
|
|
8929
8929
|
}
|
|
8930
8930
|
function deriveRoleTexts(input) {
|
|
8931
8931
|
const tagLabels = [];
|
|
@@ -9027,7 +9027,7 @@ import { readFileSync as readFileSync2, readdirSync as readdirSync2, statSync, e
|
|
|
9027
9027
|
import { join as join2, relative } from "node:path";
|
|
9028
9028
|
function scanSource(opts) {
|
|
9029
9029
|
const { db, source, entriesRoot } = opts;
|
|
9030
|
-
const
|
|
9030
|
+
const now3 = opts.now ?? (() => (/* @__PURE__ */ new Date()).toISOString());
|
|
9031
9031
|
db.exec("DROP TABLE IF EXISTS temp.touched");
|
|
9032
9032
|
db.exec("CREATE TEMP TABLE touched(rowid INTEGER PRIMARY KEY)");
|
|
9033
9033
|
const insertTouched = db.prepare("INSERT INTO touched (rowid) VALUES (?)");
|
|
@@ -9045,7 +9045,7 @@ function scanSource(opts) {
|
|
|
9045
9045
|
path: rel,
|
|
9046
9046
|
content: src,
|
|
9047
9047
|
file_mtime: mtime,
|
|
9048
|
-
indexed_at:
|
|
9048
|
+
indexed_at: now3()
|
|
9049
9049
|
});
|
|
9050
9050
|
const existing = db.prepare("SELECT rowid, file_mtime, path FROM entries WHERE source = ? AND id = ?").get(source, row.id);
|
|
9051
9051
|
if (existing && existing.file_mtime === mtime && existing.path === rel) {
|
|
@@ -9415,7 +9415,7 @@ async function prewarmSealedKeys(opts) {
|
|
|
9415
9415
|
return failures;
|
|
9416
9416
|
}
|
|
9417
9417
|
function scanSealedSource(opts) {
|
|
9418
|
-
const
|
|
9418
|
+
const now3 = opts.now ?? (() => (/* @__PURE__ */ new Date()).toISOString());
|
|
9419
9419
|
const bundle = readFileSync3(opts.bundlePath);
|
|
9420
9420
|
const { header } = readSealedHeader(bundle);
|
|
9421
9421
|
const contentKey = opts.keyProvider.resolveContentKey(header.keyId, header.keyserverUrl);
|
|
@@ -9434,7 +9434,7 @@ function scanSealedSource(opts) {
|
|
|
9434
9434
|
path: file.relPath,
|
|
9435
9435
|
content: file.content.toString("utf-8"),
|
|
9436
9436
|
file_mtime: bundleMtime,
|
|
9437
|
-
indexed_at:
|
|
9437
|
+
indexed_at: now3()
|
|
9438
9438
|
});
|
|
9439
9439
|
const existing = opts.db.prepare("SELECT rowid FROM entries WHERE source = ? AND id = ?").get(opts.source, row.id);
|
|
9440
9440
|
const rowid = upsertEntry(opts.db, row);
|
|
@@ -9560,9 +9560,9 @@ function acquireFileLock(lockFilePath) {
|
|
|
9560
9560
|
}
|
|
9561
9561
|
return tryCreateLock(lockFilePath) ? { path: lockFilePath } : null;
|
|
9562
9562
|
}
|
|
9563
|
-
function releaseFileLock(
|
|
9563
|
+
function releaseFileLock(lock3) {
|
|
9564
9564
|
try {
|
|
9565
|
-
unlinkSync(
|
|
9565
|
+
unlinkSync(lock3.path);
|
|
9566
9566
|
} catch (err) {
|
|
9567
9567
|
if (err.code !== "ENOENT") throw err;
|
|
9568
9568
|
}
|
|
@@ -9570,8 +9570,8 @@ function releaseFileLock(lock2) {
|
|
|
9570
9570
|
function acquireReindexLock(caveatHome) {
|
|
9571
9571
|
return acquireFileLock(lockPath(caveatHome));
|
|
9572
9572
|
}
|
|
9573
|
-
function releaseReindexLock(
|
|
9574
|
-
releaseFileLock(
|
|
9573
|
+
function releaseReindexLock(lock3) {
|
|
9574
|
+
releaseFileLock(lock3);
|
|
9575
9575
|
}
|
|
9576
9576
|
function reindexAllSources(opts) {
|
|
9577
9577
|
const { db, paths, logger, keyProvider } = opts;
|
|
@@ -9635,9 +9635,9 @@ function errorMessage(err) {
|
|
|
9635
9635
|
function withSourceSavepoint(db, fn) {
|
|
9636
9636
|
db.exec("SAVEPOINT reindex_source");
|
|
9637
9637
|
try {
|
|
9638
|
-
const
|
|
9638
|
+
const result2 = fn();
|
|
9639
9639
|
db.exec("RELEASE SAVEPOINT reindex_source");
|
|
9640
|
-
return
|
|
9640
|
+
return result2;
|
|
9641
9641
|
} catch (err) {
|
|
9642
9642
|
try {
|
|
9643
9643
|
db.exec("ROLLBACK TO SAVEPOINT reindex_source");
|
|
@@ -10553,7 +10553,7 @@ var init_task_options = __esm({
|
|
|
10553
10553
|
function callTaskParser(parser4, streams) {
|
|
10554
10554
|
return parser4(streams.stdOut, streams.stdErr);
|
|
10555
10555
|
}
|
|
10556
|
-
function parseStringResponse(
|
|
10556
|
+
function parseStringResponse(result2, parsers12, texts, trim = true) {
|
|
10557
10557
|
asArray(texts).forEach((text) => {
|
|
10558
10558
|
for (let lines = toLinesWithContent(text, trim), i2 = 0, max = lines.length; i2 < max; i2++) {
|
|
10559
10559
|
const line = (offset = 0) => {
|
|
@@ -10562,10 +10562,10 @@ function parseStringResponse(result, parsers12, texts, trim = true) {
|
|
|
10562
10562
|
}
|
|
10563
10563
|
return lines[i2 + offset];
|
|
10564
10564
|
};
|
|
10565
|
-
parsers12.some(({ parse: parse2 }) => parse2(line,
|
|
10565
|
+
parsers12.some(({ parse: parse2 }) => parse2(line, result2));
|
|
10566
10566
|
}
|
|
10567
10567
|
});
|
|
10568
|
-
return
|
|
10568
|
+
return result2;
|
|
10569
10569
|
}
|
|
10570
10570
|
var init_task_parser = __esm({
|
|
10571
10571
|
"src/lib/utils/task-parser.ts"() {
|
|
@@ -11447,8 +11447,8 @@ var init_git_executor_chain = __esm({
|
|
|
11447
11447
|
logger(`empty task bypassing child process to call to task's parser`);
|
|
11448
11448
|
return task.parser(this);
|
|
11449
11449
|
}
|
|
11450
|
-
handleTaskData(task, args,
|
|
11451
|
-
const { exitCode, rejection, stdOut, stdErr } =
|
|
11450
|
+
handleTaskData(task, args, result2, logger) {
|
|
11451
|
+
const { exitCode, rejection, stdOut, stdErr } = result2;
|
|
11452
11452
|
return new Promise((done, fail) => {
|
|
11453
11453
|
logger(`Preparing to handle process response exitCode=%d stdOut=`, exitCode);
|
|
11454
11454
|
const { error } = this._plugins.exec(
|
|
@@ -11456,13 +11456,13 @@ var init_git_executor_chain = __esm({
|
|
|
11456
11456
|
{ error: rejection },
|
|
11457
11457
|
{
|
|
11458
11458
|
...pluginContext(task, args),
|
|
11459
|
-
...
|
|
11459
|
+
...result2
|
|
11460
11460
|
}
|
|
11461
11461
|
);
|
|
11462
11462
|
if (error && task.onError) {
|
|
11463
11463
|
logger.info(`exitCode=%s handling with custom error handler`);
|
|
11464
11464
|
return task.onError(
|
|
11465
|
-
|
|
11465
|
+
result2,
|
|
11466
11466
|
error,
|
|
11467
11467
|
(newStdOut) => {
|
|
11468
11468
|
logger.info(`custom error handler treated as success`);
|
|
@@ -11721,17 +11721,17 @@ var init_count_objects = __esm({
|
|
|
11721
11721
|
init_utils();
|
|
11722
11722
|
parser2 = new LineParser(
|
|
11723
11723
|
/([a-z-]+): (\d+)$/,
|
|
11724
|
-
(
|
|
11724
|
+
(result2, [key, value]) => {
|
|
11725
11725
|
const property = asCamelCase(key);
|
|
11726
|
-
if (Object.hasOwn(
|
|
11727
|
-
|
|
11726
|
+
if (Object.hasOwn(result2, property)) {
|
|
11727
|
+
result2[property] = asNumber(value);
|
|
11728
11728
|
}
|
|
11729
11729
|
}
|
|
11730
11730
|
);
|
|
11731
11731
|
}
|
|
11732
11732
|
});
|
|
11733
11733
|
function parseCommitResult(stdOut) {
|
|
11734
|
-
const
|
|
11734
|
+
const result2 = {
|
|
11735
11735
|
author: null,
|
|
11736
11736
|
branch: "",
|
|
11737
11737
|
commit: "",
|
|
@@ -11742,7 +11742,7 @@ function parseCommitResult(stdOut) {
|
|
|
11742
11742
|
deletions: 0
|
|
11743
11743
|
}
|
|
11744
11744
|
};
|
|
11745
|
-
return parseStringResponse(
|
|
11745
|
+
return parseStringResponse(result2, parsers, stdOut);
|
|
11746
11746
|
}
|
|
11747
11747
|
var parsers;
|
|
11748
11748
|
var init_parse_commit = __esm({
|
|
@@ -11750,39 +11750,39 @@ var init_parse_commit = __esm({
|
|
|
11750
11750
|
"use strict";
|
|
11751
11751
|
init_utils();
|
|
11752
11752
|
parsers = [
|
|
11753
|
-
new LineParser(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/, (
|
|
11754
|
-
|
|
11755
|
-
|
|
11756
|
-
|
|
11753
|
+
new LineParser(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/, (result2, [branch, root, commit]) => {
|
|
11754
|
+
result2.branch = branch;
|
|
11755
|
+
result2.commit = commit;
|
|
11756
|
+
result2.root = !!root;
|
|
11757
11757
|
}),
|
|
11758
|
-
new LineParser(/\s*Author:\s(.+)/i, (
|
|
11758
|
+
new LineParser(/\s*Author:\s(.+)/i, (result2, [author]) => {
|
|
11759
11759
|
const parts = author.split("<");
|
|
11760
11760
|
const email = parts.pop();
|
|
11761
11761
|
if (!email || !email.includes("@")) {
|
|
11762
11762
|
return;
|
|
11763
11763
|
}
|
|
11764
|
-
|
|
11764
|
+
result2.author = {
|
|
11765
11765
|
email: email.substr(0, email.length - 1),
|
|
11766
11766
|
name: parts.join("<").trim()
|
|
11767
11767
|
};
|
|
11768
11768
|
}),
|
|
11769
11769
|
new LineParser(
|
|
11770
11770
|
/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,
|
|
11771
|
-
(
|
|
11772
|
-
|
|
11773
|
-
|
|
11774
|
-
|
|
11771
|
+
(result2, [changes, insertions, deletions]) => {
|
|
11772
|
+
result2.summary.changes = parseInt(changes, 10) || 0;
|
|
11773
|
+
result2.summary.insertions = parseInt(insertions, 10) || 0;
|
|
11774
|
+
result2.summary.deletions = parseInt(deletions, 10) || 0;
|
|
11775
11775
|
}
|
|
11776
11776
|
),
|
|
11777
11777
|
new LineParser(
|
|
11778
11778
|
/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,
|
|
11779
|
-
(
|
|
11780
|
-
|
|
11779
|
+
(result2, [changes, lines, direction]) => {
|
|
11780
|
+
result2.summary.changes = parseInt(changes, 10) || 0;
|
|
11781
11781
|
const count = parseInt(lines, 10) || 0;
|
|
11782
11782
|
if (direction === "-") {
|
|
11783
|
-
|
|
11783
|
+
result2.summary.deletions = count;
|
|
11784
11784
|
} else if (direction === "+") {
|
|
11785
|
-
|
|
11785
|
+
result2.summary.insertions = count;
|
|
11786
11786
|
}
|
|
11787
11787
|
}
|
|
11788
11788
|
)
|
|
@@ -11865,12 +11865,12 @@ var init_hash_object = __esm({
|
|
|
11865
11865
|
});
|
|
11866
11866
|
function parseInit(bare, path, text) {
|
|
11867
11867
|
const response = String(text).trim();
|
|
11868
|
-
let
|
|
11869
|
-
if (
|
|
11870
|
-
return new InitSummary(bare, path, false,
|
|
11868
|
+
let result2;
|
|
11869
|
+
if (result2 = initResponseRegex.exec(response)) {
|
|
11870
|
+
return new InitSummary(bare, path, false, result2[1]);
|
|
11871
11871
|
}
|
|
11872
|
-
if (
|
|
11873
|
-
return new InitSummary(bare, path, true,
|
|
11872
|
+
if (result2 = reInitResponseRegex.exec(response)) {
|
|
11873
|
+
return new InitSummary(bare, path, true, result2[1]);
|
|
11874
11874
|
}
|
|
11875
11875
|
let gitDir = "";
|
|
11876
11876
|
const tokens = response.split(" ");
|
|
@@ -11977,8 +11977,8 @@ var init_parse_diff_summary = __esm({
|
|
|
11977
11977
|
statParser = [
|
|
11978
11978
|
new LineParser(
|
|
11979
11979
|
/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,
|
|
11980
|
-
(
|
|
11981
|
-
|
|
11980
|
+
(result2, [file, changes, alterations = ""]) => {
|
|
11981
|
+
result2.files.push({
|
|
11982
11982
|
file: file.trim(),
|
|
11983
11983
|
changes: asNumber(changes),
|
|
11984
11984
|
insertions: alterations.replace(/[^+]/g, "").length,
|
|
@@ -11989,8 +11989,8 @@ var init_parse_diff_summary = __esm({
|
|
|
11989
11989
|
),
|
|
11990
11990
|
new LineParser(
|
|
11991
11991
|
/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,
|
|
11992
|
-
(
|
|
11993
|
-
|
|
11992
|
+
(result2, [file, before, after]) => {
|
|
11993
|
+
result2.files.push({
|
|
11994
11994
|
file: file.trim(),
|
|
11995
11995
|
before: asNumber(before),
|
|
11996
11996
|
after: asNumber(after),
|
|
@@ -12000,25 +12000,25 @@ var init_parse_diff_summary = __esm({
|
|
|
12000
12000
|
),
|
|
12001
12001
|
new LineParser(
|
|
12002
12002
|
/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,
|
|
12003
|
-
(
|
|
12003
|
+
(result2, [changed, summary]) => {
|
|
12004
12004
|
const inserted = /(\d+) i/.exec(summary);
|
|
12005
12005
|
const deleted = /(\d+) d/.exec(summary);
|
|
12006
|
-
|
|
12007
|
-
|
|
12008
|
-
|
|
12006
|
+
result2.changed = asNumber(changed);
|
|
12007
|
+
result2.insertions = asNumber(inserted?.[1]);
|
|
12008
|
+
result2.deletions = asNumber(deleted?.[1]);
|
|
12009
12009
|
}
|
|
12010
12010
|
)
|
|
12011
12011
|
];
|
|
12012
12012
|
numStatParser = [
|
|
12013
12013
|
new LineParser(
|
|
12014
12014
|
/(\d+)\t(\d+)\t(.+)$/,
|
|
12015
|
-
(
|
|
12015
|
+
(result2, [changesInsert, changesDelete, file]) => {
|
|
12016
12016
|
const insertions = asNumber(changesInsert);
|
|
12017
12017
|
const deletions = asNumber(changesDelete);
|
|
12018
|
-
|
|
12019
|
-
|
|
12020
|
-
|
|
12021
|
-
|
|
12018
|
+
result2.changed++;
|
|
12019
|
+
result2.insertions += insertions;
|
|
12020
|
+
result2.deletions += deletions;
|
|
12021
|
+
result2.files.push({
|
|
12022
12022
|
file,
|
|
12023
12023
|
changes: insertions + deletions,
|
|
12024
12024
|
insertions,
|
|
@@ -12027,9 +12027,9 @@ var init_parse_diff_summary = __esm({
|
|
|
12027
12027
|
});
|
|
12028
12028
|
}
|
|
12029
12029
|
),
|
|
12030
|
-
new LineParser(/-\t-\t(.+)$/, (
|
|
12031
|
-
|
|
12032
|
-
|
|
12030
|
+
new LineParser(/-\t-\t(.+)$/, (result2, [file]) => {
|
|
12031
|
+
result2.changed++;
|
|
12032
|
+
result2.files.push({
|
|
12033
12033
|
file,
|
|
12034
12034
|
after: 0,
|
|
12035
12035
|
before: 0,
|
|
@@ -12038,9 +12038,9 @@ var init_parse_diff_summary = __esm({
|
|
|
12038
12038
|
})
|
|
12039
12039
|
];
|
|
12040
12040
|
nameOnlyParser = [
|
|
12041
|
-
new LineParser(/(.+)$/, (
|
|
12042
|
-
|
|
12043
|
-
|
|
12041
|
+
new LineParser(/(.+)$/, (result2, [file]) => {
|
|
12042
|
+
result2.changed++;
|
|
12043
|
+
result2.files.push({
|
|
12044
12044
|
file,
|
|
12045
12045
|
changes: 0,
|
|
12046
12046
|
insertions: 0,
|
|
@@ -12052,9 +12052,9 @@ var init_parse_diff_summary = __esm({
|
|
|
12052
12052
|
nameStatusParser = [
|
|
12053
12053
|
new LineParser(
|
|
12054
12054
|
/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,
|
|
12055
|
-
(
|
|
12056
|
-
|
|
12057
|
-
|
|
12055
|
+
(result2, [status, similarity, from, _to, to]) => {
|
|
12056
|
+
result2.changed++;
|
|
12057
|
+
result2.files.push({
|
|
12058
12058
|
file: to ?? from,
|
|
12059
12059
|
changes: 0,
|
|
12060
12060
|
insertions: 0,
|
|
@@ -12389,24 +12389,24 @@ var init_parse_remote_objects = __esm({
|
|
|
12389
12389
|
remoteMessagesObjectParsers = [
|
|
12390
12390
|
new RemoteLineParser(
|
|
12391
12391
|
/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,
|
|
12392
|
-
(
|
|
12392
|
+
(result2, [action, count]) => {
|
|
12393
12393
|
const key = action.toLowerCase();
|
|
12394
|
-
const enumeration = objectEnumerationResult(
|
|
12394
|
+
const enumeration = objectEnumerationResult(result2.remoteMessages);
|
|
12395
12395
|
Object.assign(enumeration, { [key]: asNumber(count) });
|
|
12396
12396
|
}
|
|
12397
12397
|
),
|
|
12398
12398
|
new RemoteLineParser(
|
|
12399
12399
|
/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,
|
|
12400
|
-
(
|
|
12400
|
+
(result2, [action, count]) => {
|
|
12401
12401
|
const key = action.toLowerCase();
|
|
12402
|
-
const enumeration = objectEnumerationResult(
|
|
12402
|
+
const enumeration = objectEnumerationResult(result2.remoteMessages);
|
|
12403
12403
|
Object.assign(enumeration, { [key]: asNumber(count) });
|
|
12404
12404
|
}
|
|
12405
12405
|
),
|
|
12406
12406
|
new RemoteLineParser(
|
|
12407
12407
|
/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,
|
|
12408
|
-
(
|
|
12409
|
-
const objects = objectEnumerationResult(
|
|
12408
|
+
(result2, [total, reused, packReused]) => {
|
|
12409
|
+
const objects = objectEnumerationResult(result2.remoteMessages);
|
|
12410
12410
|
objects.total = asObjectCount(total);
|
|
12411
12411
|
objects.reused = asObjectCount(reused);
|
|
12412
12412
|
objects.packReused = asNumber(packReused);
|
|
@@ -12426,21 +12426,21 @@ var init_parse_remote_messages = __esm({
|
|
|
12426
12426
|
init_utils();
|
|
12427
12427
|
init_parse_remote_objects();
|
|
12428
12428
|
parsers2 = [
|
|
12429
|
-
new RemoteLineParser(/^remote:\s*(.+)$/, (
|
|
12430
|
-
|
|
12429
|
+
new RemoteLineParser(/^remote:\s*(.+)$/, (result2, [text]) => {
|
|
12430
|
+
result2.remoteMessages.all.push(text.trim());
|
|
12431
12431
|
return false;
|
|
12432
12432
|
}),
|
|
12433
12433
|
...remoteMessagesObjectParsers,
|
|
12434
12434
|
new RemoteLineParser(
|
|
12435
12435
|
[/create a (?:pull|merge) request/i, /\s(https?:\/\/\S+)$/],
|
|
12436
|
-
(
|
|
12437
|
-
|
|
12436
|
+
(result2, [pullRequestUrl]) => {
|
|
12437
|
+
result2.remoteMessages.pullRequestUrl = pullRequestUrl;
|
|
12438
12438
|
}
|
|
12439
12439
|
),
|
|
12440
12440
|
new RemoteLineParser(
|
|
12441
12441
|
[/found (\d+) vulnerabilities.+\(([^)]+)\)/i, /\s(https?:\/\/\S+)$/],
|
|
12442
|
-
(
|
|
12443
|
-
|
|
12442
|
+
(result2, [count, summary, url]) => {
|
|
12443
|
+
result2.remoteMessages.vulnerabilities = {
|
|
12444
12444
|
count: asNumber(count),
|
|
12445
12445
|
summary,
|
|
12446
12446
|
url
|
|
@@ -12476,39 +12476,39 @@ var init_parse_pull = __esm({
|
|
|
12476
12476
|
SUMMARY_REGEX = /(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/;
|
|
12477
12477
|
ACTION_REGEX = /^(create|delete) mode \d+ (.+)/;
|
|
12478
12478
|
parsers3 = [
|
|
12479
|
-
new LineParser(FILE_UPDATE_REGEX, (
|
|
12480
|
-
|
|
12479
|
+
new LineParser(FILE_UPDATE_REGEX, (result2, [file, insertions, deletions]) => {
|
|
12480
|
+
result2.files.push(file);
|
|
12481
12481
|
if (insertions) {
|
|
12482
|
-
|
|
12482
|
+
result2.insertions[file] = insertions.length;
|
|
12483
12483
|
}
|
|
12484
12484
|
if (deletions) {
|
|
12485
|
-
|
|
12485
|
+
result2.deletions[file] = deletions.length;
|
|
12486
12486
|
}
|
|
12487
12487
|
}),
|
|
12488
|
-
new LineParser(SUMMARY_REGEX, (
|
|
12488
|
+
new LineParser(SUMMARY_REGEX, (result2, [changes, , insertions, , deletions]) => {
|
|
12489
12489
|
if (insertions !== void 0 || deletions !== void 0) {
|
|
12490
|
-
|
|
12491
|
-
|
|
12492
|
-
|
|
12490
|
+
result2.summary.changes = +changes || 0;
|
|
12491
|
+
result2.summary.insertions = +insertions || 0;
|
|
12492
|
+
result2.summary.deletions = +deletions || 0;
|
|
12493
12493
|
return true;
|
|
12494
12494
|
}
|
|
12495
12495
|
return false;
|
|
12496
12496
|
}),
|
|
12497
|
-
new LineParser(ACTION_REGEX, (
|
|
12498
|
-
append(
|
|
12499
|
-
append(action === "create" ?
|
|
12497
|
+
new LineParser(ACTION_REGEX, (result2, [action, file]) => {
|
|
12498
|
+
append(result2.files, file);
|
|
12499
|
+
append(action === "create" ? result2.created : result2.deleted, file);
|
|
12500
12500
|
})
|
|
12501
12501
|
];
|
|
12502
12502
|
errorParsers = [
|
|
12503
|
-
new LineParser(/^from\s(.+)$/i, (
|
|
12504
|
-
new LineParser(/^fatal:\s(.+)$/, (
|
|
12503
|
+
new LineParser(/^from\s(.+)$/i, (result2, [remote]) => void (result2.remote = remote)),
|
|
12504
|
+
new LineParser(/^fatal:\s(.+)$/, (result2, [message]) => void (result2.message = message)),
|
|
12505
12505
|
new LineParser(
|
|
12506
12506
|
/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,
|
|
12507
|
-
(
|
|
12508
|
-
|
|
12509
|
-
|
|
12510
|
-
|
|
12511
|
-
|
|
12507
|
+
(result2, [hashLocal, hashRemote, branchLocal, branchRemote]) => {
|
|
12508
|
+
result2.branch.local = branchLocal;
|
|
12509
|
+
result2.hash.local = hashLocal;
|
|
12510
|
+
result2.branch.remote = branchRemote;
|
|
12511
|
+
result2.hash.remote = hashRemote;
|
|
12512
12512
|
}
|
|
12513
12513
|
)
|
|
12514
12514
|
];
|
|
@@ -12549,8 +12549,8 @@ var init_parse_merge = __esm({
|
|
|
12549
12549
|
new LineParser(/^CONFLICT\s+\((.+)\):/, (summary, [reason]) => {
|
|
12550
12550
|
summary.conflicts.push(new MergeSummaryConflict(reason, null));
|
|
12551
12551
|
}),
|
|
12552
|
-
new LineParser(/^Automatic merge failed;\s+(.+)$/, (summary, [
|
|
12553
|
-
summary.result =
|
|
12552
|
+
new LineParser(/^Automatic merge failed;\s+(.+)$/, (summary, [result2]) => {
|
|
12553
|
+
summary.result = result2;
|
|
12554
12554
|
})
|
|
12555
12555
|
];
|
|
12556
12556
|
parseMergeResult = (stdOut, stdErr) => {
|
|
@@ -12608,23 +12608,23 @@ var init_parse_push = __esm({
|
|
|
12608
12608
|
init_utils();
|
|
12609
12609
|
init_parse_remote_messages();
|
|
12610
12610
|
parsers5 = [
|
|
12611
|
-
new LineParser(/^Pushing to (.+)$/, (
|
|
12612
|
-
|
|
12611
|
+
new LineParser(/^Pushing to (.+)$/, (result2, [repo]) => {
|
|
12612
|
+
result2.repo = repo;
|
|
12613
12613
|
}),
|
|
12614
|
-
new LineParser(/^updating local tracking ref '(.+)'/, (
|
|
12615
|
-
|
|
12616
|
-
...
|
|
12614
|
+
new LineParser(/^updating local tracking ref '(.+)'/, (result2, [local]) => {
|
|
12615
|
+
result2.ref = {
|
|
12616
|
+
...result2.ref || {},
|
|
12617
12617
|
local
|
|
12618
12618
|
};
|
|
12619
12619
|
}),
|
|
12620
|
-
new LineParser(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/, (
|
|
12621
|
-
|
|
12620
|
+
new LineParser(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/, (result2, [local, remote, type2]) => {
|
|
12621
|
+
result2.pushed.push(pushResultPushedItem(local, remote, type2));
|
|
12622
12622
|
}),
|
|
12623
12623
|
new LineParser(
|
|
12624
12624
|
/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,
|
|
12625
|
-
(
|
|
12626
|
-
|
|
12627
|
-
...
|
|
12625
|
+
(result2, [local, remote, remoteName]) => {
|
|
12626
|
+
result2.branch = {
|
|
12627
|
+
...result2.branch || {},
|
|
12628
12628
|
local,
|
|
12629
12629
|
remote,
|
|
12630
12630
|
remoteName
|
|
@@ -12633,8 +12633,8 @@ var init_parse_push = __esm({
|
|
|
12633
12633
|
),
|
|
12634
12634
|
new LineParser(
|
|
12635
12635
|
/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,
|
|
12636
|
-
(
|
|
12637
|
-
|
|
12636
|
+
(result2, [local, remote, from, to]) => {
|
|
12637
|
+
result2.update = {
|
|
12638
12638
|
head: {
|
|
12639
12639
|
local,
|
|
12640
12640
|
remote
|
|
@@ -12752,9 +12752,9 @@ function parser3(indexX, indexY, handler) {
|
|
|
12752
12752
|
return [`${indexX}${indexY}`, handler];
|
|
12753
12753
|
}
|
|
12754
12754
|
function conflicts(indexX, ...indexY) {
|
|
12755
|
-
return indexY.map((y2) => parser3(indexX, y2, (
|
|
12755
|
+
return indexY.map((y2) => parser3(indexX, y2, (result2, file) => result2.conflicted.push(file)));
|
|
12756
12756
|
}
|
|
12757
|
-
function splitLine(
|
|
12757
|
+
function splitLine(result2, lineStr) {
|
|
12758
12758
|
const trimmed2 = lineStr.trim();
|
|
12759
12759
|
switch (" ") {
|
|
12760
12760
|
case trimmed2.charAt(2):
|
|
@@ -12768,10 +12768,10 @@ function splitLine(result, lineStr) {
|
|
|
12768
12768
|
const raw = `${index}${workingDir}`;
|
|
12769
12769
|
const handler = parsers6.get(raw);
|
|
12770
12770
|
if (handler) {
|
|
12771
|
-
handler(
|
|
12771
|
+
handler(result2, path);
|
|
12772
12772
|
}
|
|
12773
12773
|
if (raw !== "##" && raw !== "!!") {
|
|
12774
|
-
|
|
12774
|
+
result2.files.push(new FileStatusSummary(path, index, workingDir));
|
|
12775
12775
|
}
|
|
12776
12776
|
}
|
|
12777
12777
|
}
|
|
@@ -12808,46 +12808,46 @@ var init_StatusSummary = __esm({
|
|
|
12808
12808
|
parser3(
|
|
12809
12809
|
" ",
|
|
12810
12810
|
"A",
|
|
12811
|
-
(
|
|
12811
|
+
(result2, file) => result2.created.push(file)
|
|
12812
12812
|
),
|
|
12813
12813
|
parser3(
|
|
12814
12814
|
" ",
|
|
12815
12815
|
"D",
|
|
12816
|
-
(
|
|
12816
|
+
(result2, file) => result2.deleted.push(file)
|
|
12817
12817
|
),
|
|
12818
12818
|
parser3(
|
|
12819
12819
|
" ",
|
|
12820
12820
|
"M",
|
|
12821
|
-
(
|
|
12821
|
+
(result2, file) => result2.modified.push(file)
|
|
12822
12822
|
),
|
|
12823
|
-
parser3("A", " ", (
|
|
12824
|
-
|
|
12825
|
-
|
|
12823
|
+
parser3("A", " ", (result2, file) => {
|
|
12824
|
+
result2.created.push(file);
|
|
12825
|
+
result2.staged.push(file);
|
|
12826
12826
|
}),
|
|
12827
|
-
parser3("A", "M", (
|
|
12828
|
-
|
|
12829
|
-
|
|
12830
|
-
|
|
12827
|
+
parser3("A", "M", (result2, file) => {
|
|
12828
|
+
result2.created.push(file);
|
|
12829
|
+
result2.staged.push(file);
|
|
12830
|
+
result2.modified.push(file);
|
|
12831
12831
|
}),
|
|
12832
|
-
parser3("D", " ", (
|
|
12833
|
-
|
|
12834
|
-
|
|
12832
|
+
parser3("D", " ", (result2, file) => {
|
|
12833
|
+
result2.deleted.push(file);
|
|
12834
|
+
result2.staged.push(file);
|
|
12835
12835
|
}),
|
|
12836
|
-
parser3("M", " ", (
|
|
12837
|
-
|
|
12838
|
-
|
|
12836
|
+
parser3("M", " ", (result2, file) => {
|
|
12837
|
+
result2.modified.push(file);
|
|
12838
|
+
result2.staged.push(file);
|
|
12839
12839
|
}),
|
|
12840
|
-
parser3("M", "M", (
|
|
12841
|
-
|
|
12842
|
-
|
|
12840
|
+
parser3("M", "M", (result2, file) => {
|
|
12841
|
+
result2.modified.push(file);
|
|
12842
|
+
result2.staged.push(file);
|
|
12843
12843
|
}),
|
|
12844
|
-
parser3("R", " ", (
|
|
12845
|
-
|
|
12844
|
+
parser3("R", " ", (result2, file) => {
|
|
12845
|
+
result2.renamed.push(renamedFile(file));
|
|
12846
12846
|
}),
|
|
12847
|
-
parser3("R", "M", (
|
|
12847
|
+
parser3("R", "M", (result2, file) => {
|
|
12848
12848
|
const renamed2 = renamedFile(file);
|
|
12849
|
-
|
|
12850
|
-
|
|
12849
|
+
result2.renamed.push(renamed2);
|
|
12850
|
+
result2.modified.push(renamed2.to);
|
|
12851
12851
|
}),
|
|
12852
12852
|
parser3("!", "!", (_result, _file) => {
|
|
12853
12853
|
(_result.ignored = _result.ignored || []).push(_file);
|
|
@@ -12855,7 +12855,7 @@ var init_StatusSummary = __esm({
|
|
|
12855
12855
|
parser3(
|
|
12856
12856
|
"?",
|
|
12857
12857
|
"?",
|
|
12858
|
-
(
|
|
12858
|
+
(result2, file) => result2.not_added.push(file)
|
|
12859
12859
|
),
|
|
12860
12860
|
...conflicts(
|
|
12861
12861
|
"A",
|
|
@@ -12878,25 +12878,25 @@ var init_StatusSummary = __esm({
|
|
|
12878
12878
|
),
|
|
12879
12879
|
[
|
|
12880
12880
|
"##",
|
|
12881
|
-
(
|
|
12881
|
+
(result2, line) => {
|
|
12882
12882
|
const aheadReg = /ahead (\d+)/;
|
|
12883
12883
|
const behindReg = /behind (\d+)/;
|
|
12884
12884
|
const currentReg = /^(.+?(?=(?:\.{3}|\s|$)))/;
|
|
12885
12885
|
const trackingReg = /\.{3}(\S*)/;
|
|
12886
12886
|
const onEmptyBranchReg = /\son\s(\S+?)(?=\.{3}|$)/;
|
|
12887
12887
|
let regexResult = aheadReg.exec(line);
|
|
12888
|
-
|
|
12888
|
+
result2.ahead = regexResult && +regexResult[1] || 0;
|
|
12889
12889
|
regexResult = behindReg.exec(line);
|
|
12890
|
-
|
|
12890
|
+
result2.behind = regexResult && +regexResult[1] || 0;
|
|
12891
12891
|
regexResult = currentReg.exec(line);
|
|
12892
|
-
|
|
12892
|
+
result2.current = filterType(regexResult?.[1], filterString, null);
|
|
12893
12893
|
regexResult = trackingReg.exec(line);
|
|
12894
|
-
|
|
12894
|
+
result2.tracking = filterType(regexResult?.[1], filterString, null);
|
|
12895
12895
|
regexResult = onEmptyBranchReg.exec(line);
|
|
12896
12896
|
if (regexResult) {
|
|
12897
|
-
|
|
12897
|
+
result2.current = filterType(regexResult?.[1], filterString, result2.current);
|
|
12898
12898
|
}
|
|
12899
|
-
|
|
12899
|
+
result2.detached = /\(no branch\)/.test(line);
|
|
12900
12900
|
}
|
|
12901
12901
|
]
|
|
12902
12902
|
]);
|
|
@@ -12971,8 +12971,8 @@ function version_default() {
|
|
|
12971
12971
|
commands: ["--version"],
|
|
12972
12972
|
format: "utf-8",
|
|
12973
12973
|
parser: versionParser,
|
|
12974
|
-
onError(
|
|
12975
|
-
if (
|
|
12974
|
+
onError(result2, error, done, fail) {
|
|
12975
|
+
if (result2.exitCode === -2) {
|
|
12976
12976
|
return done(Buffer.from(NOT_INSTALLED));
|
|
12977
12977
|
}
|
|
12978
12978
|
fail(error);
|
|
@@ -12997,17 +12997,17 @@ var init_version = __esm({
|
|
|
12997
12997
|
parsers7 = [
|
|
12998
12998
|
new LineParser(
|
|
12999
12999
|
/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,
|
|
13000
|
-
(
|
|
13000
|
+
(result2, [major, minor, patch, agent = ""]) => {
|
|
13001
13001
|
Object.assign(
|
|
13002
|
-
|
|
13002
|
+
result2,
|
|
13003
13003
|
versionResponse(asNumber(major), asNumber(minor), asNumber(patch), agent)
|
|
13004
13004
|
);
|
|
13005
13005
|
}
|
|
13006
13006
|
),
|
|
13007
13007
|
new LineParser(
|
|
13008
13008
|
/version (\d+)\.(\d+)\.(\D+)(.+)?$/,
|
|
13009
|
-
(
|
|
13010
|
-
Object.assign(
|
|
13009
|
+
(result2, [major, minor, patch, agent = ""]) => {
|
|
13010
|
+
Object.assign(result2, versionResponse(asNumber(major), asNumber(minor), patch, agent));
|
|
13011
13011
|
}
|
|
13012
13012
|
)
|
|
13013
13013
|
];
|
|
@@ -13311,16 +13311,16 @@ var init_parse_branch_delete = __esm({
|
|
|
13311
13311
|
deleteSuccessRegex = /(\S+)\s+\(\S+\s([^)]+)\)/;
|
|
13312
13312
|
deleteErrorRegex = /^error[^']+'([^']+)'/m;
|
|
13313
13313
|
parsers8 = [
|
|
13314
|
-
new LineParser(deleteSuccessRegex, (
|
|
13314
|
+
new LineParser(deleteSuccessRegex, (result2, [branch, hash]) => {
|
|
13315
13315
|
const deletion = branchDeletionSuccess(branch, hash);
|
|
13316
|
-
|
|
13317
|
-
|
|
13316
|
+
result2.all.push(deletion);
|
|
13317
|
+
result2.branches[branch] = deletion;
|
|
13318
13318
|
}),
|
|
13319
|
-
new LineParser(deleteErrorRegex, (
|
|
13319
|
+
new LineParser(deleteErrorRegex, (result2, [branch]) => {
|
|
13320
13320
|
const deletion = branchDeletionFailure(branch);
|
|
13321
|
-
|
|
13322
|
-
|
|
13323
|
-
|
|
13321
|
+
result2.errors.push(deletion);
|
|
13322
|
+
result2.all.push(deletion);
|
|
13323
|
+
result2.branches[branch] = deletion;
|
|
13324
13324
|
})
|
|
13325
13325
|
];
|
|
13326
13326
|
parseBranchDeletions = (stdOut, stdErr) => {
|
|
@@ -13376,19 +13376,19 @@ var init_parse_branch = __esm({
|
|
|
13376
13376
|
parsers9 = [
|
|
13377
13377
|
new LineParser(
|
|
13378
13378
|
/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,
|
|
13379
|
-
(
|
|
13380
|
-
|
|
13379
|
+
(result2, [current, name, commit, label]) => {
|
|
13380
|
+
result2.push(branchStatus(current), true, name, commit, label);
|
|
13381
13381
|
}
|
|
13382
13382
|
),
|
|
13383
13383
|
new LineParser(
|
|
13384
13384
|
/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,
|
|
13385
|
-
(
|
|
13386
|
-
|
|
13385
|
+
(result2, [current, name, commit, label]) => {
|
|
13386
|
+
result2.push(branchStatus(current), false, name, commit, label);
|
|
13387
13387
|
}
|
|
13388
13388
|
)
|
|
13389
13389
|
];
|
|
13390
|
-
currentBranchParser = new LineParser(/^(\S+)$/s, (
|
|
13391
|
-
|
|
13390
|
+
currentBranchParser = new LineParser(/^(\S+)$/s, (result2, [name]) => {
|
|
13391
|
+
result2.push("*", false, name, "", "");
|
|
13392
13392
|
});
|
|
13393
13393
|
}
|
|
13394
13394
|
});
|
|
@@ -13508,7 +13508,7 @@ var init_check_ignore = __esm({
|
|
|
13508
13508
|
}
|
|
13509
13509
|
});
|
|
13510
13510
|
function parseFetchResult(stdOut, stdErr) {
|
|
13511
|
-
const
|
|
13511
|
+
const result2 = {
|
|
13512
13512
|
raw: stdOut,
|
|
13513
13513
|
remote: null,
|
|
13514
13514
|
branches: [],
|
|
@@ -13516,7 +13516,7 @@ function parseFetchResult(stdOut, stdErr) {
|
|
|
13516
13516
|
updated: [],
|
|
13517
13517
|
deleted: []
|
|
13518
13518
|
};
|
|
13519
|
-
return parseStringResponse(
|
|
13519
|
+
return parseStringResponse(result2, parsers10, [stdOut, stdErr]);
|
|
13520
13520
|
}
|
|
13521
13521
|
var parsers10;
|
|
13522
13522
|
var init_parse_fetch = __esm({
|
|
@@ -13524,30 +13524,30 @@ var init_parse_fetch = __esm({
|
|
|
13524
13524
|
"use strict";
|
|
13525
13525
|
init_utils();
|
|
13526
13526
|
parsers10 = [
|
|
13527
|
-
new LineParser(/From (.+)$/, (
|
|
13528
|
-
|
|
13527
|
+
new LineParser(/From (.+)$/, (result2, [remote]) => {
|
|
13528
|
+
result2.remote = remote;
|
|
13529
13529
|
}),
|
|
13530
|
-
new LineParser(/\* \[new branch]\s+(\S+)\s*-> (.+)$/, (
|
|
13531
|
-
|
|
13530
|
+
new LineParser(/\* \[new branch]\s+(\S+)\s*-> (.+)$/, (result2, [name, tracking]) => {
|
|
13531
|
+
result2.branches.push({
|
|
13532
13532
|
name,
|
|
13533
13533
|
tracking
|
|
13534
13534
|
});
|
|
13535
13535
|
}),
|
|
13536
|
-
new LineParser(/\* \[new tag]\s+(\S+)\s*-> (.+)$/, (
|
|
13537
|
-
|
|
13536
|
+
new LineParser(/\* \[new tag]\s+(\S+)\s*-> (.+)$/, (result2, [name, tracking]) => {
|
|
13537
|
+
result2.tags.push({
|
|
13538
13538
|
name,
|
|
13539
13539
|
tracking
|
|
13540
13540
|
});
|
|
13541
13541
|
}),
|
|
13542
|
-
new LineParser(/- \[deleted]\s+\S+\s*-> (.+)$/, (
|
|
13543
|
-
|
|
13542
|
+
new LineParser(/- \[deleted]\s+\S+\s*-> (.+)$/, (result2, [tracking]) => {
|
|
13543
|
+
result2.deleted.push({
|
|
13544
13544
|
tracking
|
|
13545
13545
|
});
|
|
13546
13546
|
}),
|
|
13547
13547
|
new LineParser(
|
|
13548
13548
|
/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,
|
|
13549
|
-
(
|
|
13550
|
-
|
|
13549
|
+
(result2, [from, to, name, tracking]) => {
|
|
13550
|
+
result2.updated.push({
|
|
13551
13551
|
name,
|
|
13552
13552
|
tracking,
|
|
13553
13553
|
to,
|
|
@@ -13596,8 +13596,8 @@ var init_parse_move = __esm({
|
|
|
13596
13596
|
"use strict";
|
|
13597
13597
|
init_utils();
|
|
13598
13598
|
parsers11 = [
|
|
13599
|
-
new LineParser(/^Renaming (.+) to (.+)$/, (
|
|
13600
|
-
|
|
13599
|
+
new LineParser(/^Renaming (.+) to (.+)$/, (result2, [from, to]) => {
|
|
13600
|
+
result2.moves.push({ from, to });
|
|
13601
13601
|
})
|
|
13602
13602
|
];
|
|
13603
13603
|
}
|
|
@@ -13635,10 +13635,10 @@ function pullTask(remote, branch, customArgs) {
|
|
|
13635
13635
|
parser(stdOut, stdErr) {
|
|
13636
13636
|
return parsePullResult(stdOut, stdErr);
|
|
13637
13637
|
},
|
|
13638
|
-
onError(
|
|
13638
|
+
onError(result2, _error, _done, fail) {
|
|
13639
13639
|
const pullError = parsePullErrorResult(
|
|
13640
|
-
bufferToString(
|
|
13641
|
-
bufferToString(
|
|
13640
|
+
bufferToString(result2.stdOut),
|
|
13641
|
+
bufferToString(result2.stdErr)
|
|
13642
13642
|
);
|
|
13643
13643
|
if (pullError) {
|
|
13644
13644
|
return fail(new GitResponseError(pullError));
|
|
@@ -14334,7 +14334,7 @@ function completionDetectionPlugin({
|
|
|
14334
14334
|
exit: (0, import_promise_deferred2.deferred)(),
|
|
14335
14335
|
exitTimeout: (0, import_promise_deferred2.deferred)()
|
|
14336
14336
|
};
|
|
14337
|
-
const
|
|
14337
|
+
const result2 = Promise.race([
|
|
14338
14338
|
onClose === false ? never : events.closeTimeout.promise,
|
|
14339
14339
|
onExit === false ? never : events.exitTimeout.promise
|
|
14340
14340
|
]);
|
|
@@ -14352,7 +14352,7 @@ function completionDetectionPlugin({
|
|
|
14352
14352
|
get exitCode() {
|
|
14353
14353
|
return exitCode;
|
|
14354
14354
|
},
|
|
14355
|
-
result
|
|
14355
|
+
result: result2
|
|
14356
14356
|
};
|
|
14357
14357
|
}
|
|
14358
14358
|
function configureTimeout(flag, event, timeout) {
|
|
@@ -14421,18 +14421,18 @@ function customBinaryPlugin(plugins, input = ["git"], allowUnsafe = false) {
|
|
|
14421
14421
|
});
|
|
14422
14422
|
}
|
|
14423
14423
|
init_git_error();
|
|
14424
|
-
function isTaskError(
|
|
14425
|
-
return !!(
|
|
14424
|
+
function isTaskError(result2) {
|
|
14425
|
+
return !!(result2.exitCode && result2.stdErr.length);
|
|
14426
14426
|
}
|
|
14427
|
-
function getErrorMessage(
|
|
14428
|
-
return Buffer.concat([...
|
|
14427
|
+
function getErrorMessage(result2) {
|
|
14428
|
+
return Buffer.concat([...result2.stdOut, ...result2.stdErr]);
|
|
14429
14429
|
}
|
|
14430
14430
|
function errorDetectionHandler(overwrite = false, isError = isTaskError, errorMessage4 = getErrorMessage) {
|
|
14431
|
-
return (error,
|
|
14432
|
-
if (!overwrite && error || !isError(
|
|
14431
|
+
return (error, result2) => {
|
|
14432
|
+
if (!overwrite && error || !isError(result2)) {
|
|
14433
14433
|
return error;
|
|
14434
14434
|
}
|
|
14435
|
-
return errorMessage4(
|
|
14435
|
+
return errorMessage4(result2);
|
|
14436
14436
|
};
|
|
14437
14437
|
}
|
|
14438
14438
|
function errorDetectionPlugin(config) {
|
|
@@ -14815,10 +14815,10 @@ function withPendingQueueLock(caveatHome, operation) {
|
|
|
14815
14815
|
db.exec(`PRAGMA busy_timeout = ${PENDING_LOCK_BUSY_TIMEOUT_MS}`);
|
|
14816
14816
|
db.exec("BEGIN IMMEDIATE");
|
|
14817
14817
|
transactionOpen = true;
|
|
14818
|
-
const
|
|
14818
|
+
const result2 = operation();
|
|
14819
14819
|
db.exec("COMMIT");
|
|
14820
14820
|
transactionOpen = false;
|
|
14821
|
-
return
|
|
14821
|
+
return result2;
|
|
14822
14822
|
} catch (error) {
|
|
14823
14823
|
if (transactionOpen) {
|
|
14824
14824
|
try {
|
|
@@ -14886,14 +14886,14 @@ function acquirePendingClaim(caveatHome, sessionId, key, options2 = {}) {
|
|
|
14886
14886
|
const dir = join6(pendingDirFor(caveatHome, sessionId), ".claims");
|
|
14887
14887
|
mkdirSync3(dir, { recursive: true, mode: 448 });
|
|
14888
14888
|
const path = join6(dir, `${key}.claim`);
|
|
14889
|
-
const
|
|
14889
|
+
const now3 = options2.now ?? Date.now();
|
|
14890
14890
|
const ttlMs = options2.ttlMs ?? CLAIM_TTL_MS;
|
|
14891
14891
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
14892
14892
|
const ownerToken = randomBytes(16).toString("hex");
|
|
14893
14893
|
try {
|
|
14894
14894
|
const fd = openSync(path, "wx", 384);
|
|
14895
14895
|
try {
|
|
14896
|
-
writeFileSync2(fd, JSON.stringify({ ownerToken, createdAt:
|
|
14896
|
+
writeFileSync2(fd, JSON.stringify({ ownerToken, createdAt: now3 }), "utf-8");
|
|
14897
14897
|
} finally {
|
|
14898
14898
|
closeSync(fd);
|
|
14899
14899
|
}
|
|
@@ -14911,7 +14911,7 @@ function acquirePendingClaim(caveatHome, sessionId, key, options2 = {}) {
|
|
|
14911
14911
|
if (typeof parsed.createdAt === "number") createdAt = parsed.createdAt;
|
|
14912
14912
|
} catch {
|
|
14913
14913
|
}
|
|
14914
|
-
if (
|
|
14914
|
+
if (now3 - createdAt <= ttlMs) return null;
|
|
14915
14915
|
unlinkSync2(path);
|
|
14916
14916
|
} catch (retryError) {
|
|
14917
14917
|
if (retryError && typeof retryError === "object" && retryError.code === "ENOENT") continue;
|
|
@@ -14967,8 +14967,8 @@ function buildAndPublishPendingReminder(caveatHome, sessionId, semanticKey, buil
|
|
|
14967
14967
|
const claim = acquirePendingClaim(caveatHome, sessionId, semanticKey);
|
|
14968
14968
|
if (!claim) return { ran: false, published: false };
|
|
14969
14969
|
try {
|
|
14970
|
-
const
|
|
14971
|
-
return { ran: true, published:
|
|
14970
|
+
const result2 = publishPendingReminder(caveatHome, sessionId, claim.key, build());
|
|
14971
|
+
return { ran: true, published: result2.published };
|
|
14972
14972
|
} finally {
|
|
14973
14973
|
releasePendingClaim(claim);
|
|
14974
14974
|
}
|
|
@@ -14981,8 +14981,8 @@ function cleanupStalePendingDirs(caveatHome, options2 = {}) {
|
|
|
14981
14981
|
if (staleDays < 0) {
|
|
14982
14982
|
throw new Error(`cleanupStalePendingDirs: staleDays must be >= 0 (got ${staleDays})`);
|
|
14983
14983
|
}
|
|
14984
|
-
const
|
|
14985
|
-
const cutoffMs =
|
|
14984
|
+
const now3 = options2.now ?? /* @__PURE__ */ new Date();
|
|
14985
|
+
const cutoffMs = now3.getTime() - staleDays * 24 * 60 * 60 * 1e3;
|
|
14986
14986
|
const root = join6(caveatHome, "pending");
|
|
14987
14987
|
if (!existsSync6(root)) return { removed: [], kept: 0 };
|
|
14988
14988
|
return withPendingQueueLock(caveatHome, () => {
|
|
@@ -15003,7 +15003,7 @@ function cleanupStalePendingDirs(caveatHome, options2 = {}) {
|
|
|
15003
15003
|
continue;
|
|
15004
15004
|
}
|
|
15005
15005
|
if (!subStat.isDirectory()) continue;
|
|
15006
|
-
if (hasNonExpiredPendingClaim(sub,
|
|
15006
|
+
if (hasNonExpiredPendingClaim(sub, now3.getTime())) {
|
|
15007
15007
|
kept++;
|
|
15008
15008
|
continue;
|
|
15009
15009
|
}
|
|
@@ -15048,24 +15048,24 @@ function maybeSweepPendingDirs(caveatHome, options2 = {}) {
|
|
|
15048
15048
|
`maybeSweepPendingDirs: debounceDays must be >= 0 (got ${debounceDays})`
|
|
15049
15049
|
);
|
|
15050
15050
|
}
|
|
15051
|
-
const
|
|
15051
|
+
const now3 = options2.now ?? /* @__PURE__ */ new Date();
|
|
15052
15052
|
const pendingRoot = join6(caveatHome, "pending");
|
|
15053
15053
|
if (!existsSync6(pendingRoot)) return { skipped: "no_pending_dir" };
|
|
15054
15054
|
const marker = join6(pendingRoot, ".last-sweep");
|
|
15055
15055
|
try {
|
|
15056
15056
|
const m = statSync5(marker);
|
|
15057
|
-
const ageMs =
|
|
15057
|
+
const ageMs = now3.getTime() - m.mtimeMs;
|
|
15058
15058
|
if (ageMs < debounceDays * 24 * 60 * 60 * 1e3) {
|
|
15059
15059
|
return { skipped: "debounced" };
|
|
15060
15060
|
}
|
|
15061
15061
|
} catch {
|
|
15062
15062
|
}
|
|
15063
|
-
const
|
|
15063
|
+
const result2 = cleanupStalePendingDirs(caveatHome, { staleDays, now: now3 });
|
|
15064
15064
|
try {
|
|
15065
15065
|
writeFileSync2(marker, "", "utf-8");
|
|
15066
15066
|
} catch {
|
|
15067
15067
|
}
|
|
15068
|
-
return { swept:
|
|
15068
|
+
return { swept: result2 };
|
|
15069
15069
|
}
|
|
15070
15070
|
function peekPendingRemindersDetailed(caveatHome, sessionId) {
|
|
15071
15071
|
const dir = pendingDirFor(caveatHome, sessionId);
|
|
@@ -15327,18 +15327,18 @@ async function assertPrivateRemotes(remoteUrls, opts) {
|
|
|
15327
15327
|
const probe = opts.probeImpl ?? probeAnonymousRead;
|
|
15328
15328
|
let worst = { kind: "denied", status: 0 };
|
|
15329
15329
|
for (const remoteUrl of remoteUrls) {
|
|
15330
|
-
const
|
|
15331
|
-
if (
|
|
15330
|
+
const result2 = await probe(deriveAnonymousProbeUrl(remoteUrl));
|
|
15331
|
+
if (result2.kind === "anonymous-readable") {
|
|
15332
15332
|
throw new SyncError("REMOTE_PUBLIC", `remote is anonymously readable: ${remoteUrl}`);
|
|
15333
15333
|
}
|
|
15334
|
-
if (
|
|
15334
|
+
if (result2.kind === "indeterminate") {
|
|
15335
15335
|
if (!opts.trustRemotePrivate) {
|
|
15336
15336
|
throw new SyncError(
|
|
15337
15337
|
"REMOTE_VISIBILITY_INDETERMINATE",
|
|
15338
15338
|
`could not verify remote privacy: ${remoteUrl}; rerun with --trust-remote-private to accept this risk`
|
|
15339
15339
|
);
|
|
15340
15340
|
}
|
|
15341
|
-
worst =
|
|
15341
|
+
worst = result2;
|
|
15342
15342
|
}
|
|
15343
15343
|
}
|
|
15344
15344
|
return worst;
|
|
@@ -15614,7 +15614,7 @@ function autoSyncNotification(outcome) {
|
|
|
15614
15614
|
} else if (outcome.own.disposition === "fail") {
|
|
15615
15615
|
lines.push(`autosync: own sync failed (${outcome.own.code ?? "UNKNOWN"}). run \`caveat sync\` to resolve.`);
|
|
15616
15616
|
}
|
|
15617
|
-
const failedHandles = outcome.community.filter((
|
|
15617
|
+
const failedHandles = outcome.community.filter((result2) => result2.status === "failed").map((result2) => result2.handle).sort();
|
|
15618
15618
|
if (failedHandles.length > 0) {
|
|
15619
15619
|
lines.push(`autosync: community pull failed: ${failedHandles.join(", ")}`);
|
|
15620
15620
|
}
|
|
@@ -15624,8 +15624,8 @@ function autoSyncNotification(outcome) {
|
|
|
15624
15624
|
}
|
|
15625
15625
|
async function runAutoSync(opts) {
|
|
15626
15626
|
if (process.env[CAVEAT_AUTO_SYNC_ENV] === "off") return { ran: false };
|
|
15627
|
-
const
|
|
15628
|
-
if (!
|
|
15627
|
+
const lock3 = acquireFileLock(autoSyncLockPath(opts.caveatHome));
|
|
15628
|
+
if (!lock3) return { ran: false };
|
|
15629
15629
|
let reindexLock = null;
|
|
15630
15630
|
try {
|
|
15631
15631
|
reindexLock = acquireReindexLock(opts.caveatHome);
|
|
@@ -15652,7 +15652,7 @@ async function runAutoSync(opts) {
|
|
|
15652
15652
|
ownSyncState = { ...ownSyncState, lastAttemptAt: nowIso };
|
|
15653
15653
|
let lastProbe;
|
|
15654
15654
|
try {
|
|
15655
|
-
const
|
|
15655
|
+
const result2 = await syncOwn({
|
|
15656
15656
|
ownDir: opts.ownDir,
|
|
15657
15657
|
caveatHome: opts.caveatHome,
|
|
15658
15658
|
paths: opts.paths,
|
|
@@ -15667,8 +15667,8 @@ async function runAutoSync(opts) {
|
|
|
15667
15667
|
});
|
|
15668
15668
|
own = {
|
|
15669
15669
|
disposition: "success",
|
|
15670
|
-
pulled:
|
|
15671
|
-
changedFiles:
|
|
15670
|
+
pulled: result2.pulled,
|
|
15671
|
+
changedFiles: result2.changedFiles
|
|
15672
15672
|
};
|
|
15673
15673
|
ownSyncState = { consecutiveFailureSignature: null, consecutiveFailureCount: 0 };
|
|
15674
15674
|
} catch (err) {
|
|
@@ -15716,7 +15716,7 @@ async function runAutoSync(opts) {
|
|
|
15716
15716
|
}
|
|
15717
15717
|
}
|
|
15718
15718
|
try {
|
|
15719
|
-
releaseFileLock(
|
|
15719
|
+
releaseFileLock(lock3);
|
|
15720
15720
|
} catch (err) {
|
|
15721
15721
|
opts.logger.warn(`autosync lock release failed: ${errorMessage3(err)}`);
|
|
15722
15722
|
}
|
|
@@ -15902,6 +15902,7 @@ var DEFAULT_CONFIG = {
|
|
|
15902
15902
|
sealedKeyId: "v1",
|
|
15903
15903
|
sealedKeyserverUrl: null,
|
|
15904
15904
|
runtimeErrors: false,
|
|
15905
|
+
runtimeErrorReportCredentialFile: null,
|
|
15905
15906
|
jevEnabled: false
|
|
15906
15907
|
};
|
|
15907
15908
|
function loadConfig(userConfigPath) {
|
|
@@ -15923,11 +15924,11 @@ function deepMerge(base, overlay) {
|
|
|
15923
15924
|
if (Array.isArray(overlay)) return overlay;
|
|
15924
15925
|
if (typeof overlay !== "object") return overlay;
|
|
15925
15926
|
if (typeof base !== "object" || base === null || Array.isArray(base)) return overlay;
|
|
15926
|
-
const
|
|
15927
|
+
const result2 = { ...base };
|
|
15927
15928
|
for (const [k2, v] of Object.entries(overlay)) {
|
|
15928
|
-
|
|
15929
|
+
result2[k2] = deepMerge(result2[k2], v);
|
|
15929
15930
|
}
|
|
15930
|
-
return
|
|
15931
|
+
return result2;
|
|
15931
15932
|
}
|
|
15932
15933
|
|
|
15933
15934
|
// ../../packages/core/dist/claudeHooks.js
|
|
@@ -16525,8 +16526,8 @@ function readCodexSessionSignals(transcriptPath) {
|
|
|
16525
16526
|
function listStale(db, opts = {}) {
|
|
16526
16527
|
const days = opts.days ?? 90;
|
|
16527
16528
|
const limit = opts.limit ?? 50;
|
|
16528
|
-
const
|
|
16529
|
-
const cutoff = new Date(
|
|
16529
|
+
const now3 = (opts.now ?? (() => /* @__PURE__ */ new Date()))();
|
|
16530
|
+
const cutoff = new Date(now3.getTime() - days * 24 * 60 * 60 * 1e3).toISOString();
|
|
16530
16531
|
const conditions = ["(last_hit_at IS NULL OR last_hit_at < ?)"];
|
|
16531
16532
|
const params = [cutoff];
|
|
16532
16533
|
if (opts.visibility === "public" || opts.visibility === "private") {
|
|
@@ -17157,9 +17158,9 @@ var WINDOWS_ACL_VERIFY = String.raw`$ErrorActionPreference='Stop';$p=$env:CAVEAT
|
|
|
17157
17158
|
var WINDOWS_ACL_APPLY = String.raw`$ErrorActionPreference='Stop';$p=$env:CAVEAT_ACL_PATH;$isDir=$env:CAVEAT_ACL_DIRECTORY -eq '1';$sid=[System.Security.Principal.WindowsIdentity]::GetCurrent().User;$acl=if($isDir){New-Object System.Security.AccessControl.DirectorySecurity}else{New-Object System.Security.AccessControl.FileSecurity};$acl.SetAccessRuleProtection($true,$false);$flags=if($isDir){[System.Security.AccessControl.InheritanceFlags]'ContainerInherit, ObjectInherit'}else{[System.Security.AccessControl.InheritanceFlags]::None};$rule=New-Object System.Security.AccessControl.FileSystemAccessRule($sid,'FullControl',$flags,[System.Security.AccessControl.PropagationFlags]::None,[System.Security.AccessControl.AccessControlType]::Allow);$acl.SetOwner($sid);$acl.AddAccessRule($rule);Set-Acl -LiteralPath $p -AclObject $acl;` + WINDOWS_ACL_VERIFY;
|
|
17158
17159
|
var WINDOWS_ACL_TIMEOUT_MS = 3e4;
|
|
17159
17160
|
function runWindowsAcl(path, directory2, apply) {
|
|
17160
|
-
const
|
|
17161
|
-
if (
|
|
17162
|
-
if (
|
|
17161
|
+
const result2 = spawnSync("pwsh.exe", ["-NoLogo", "-NoProfile", "-NonInteractive", "-Command", apply ? WINDOWS_ACL_APPLY : WINDOWS_ACL_VERIFY], { env: { ...process.env, CAVEAT_ACL_PATH: path, CAVEAT_ACL_DIRECTORY: directory2 ? "1" : "0" }, encoding: "utf-8", timeout: WINDOWS_ACL_TIMEOUT_MS, windowsHide: true });
|
|
17162
|
+
if (result2.error !== void 0) throw Error(`store_unsafe: powershell spawn ${result2.error.code ?? result2.error.message}`);
|
|
17163
|
+
if (result2.status !== 0) throw Error(`store_unsafe: powershell exit=${result2.status} signal=${result2.signal ?? "none"} stderr=${(result2.stderr ?? "").replace(/\s+/g, " ").trim().slice(0, 400) || "(empty)"}`);
|
|
17163
17164
|
}
|
|
17164
17165
|
function secureWindowsAcl(path, runner, directory2 = false, apply = false) {
|
|
17165
17166
|
try {
|
|
@@ -17219,10 +17220,10 @@ function lock(path, isWin, fn, options2 = {}) {
|
|
|
17219
17220
|
ensureSafeFile(lockPath2, isWin, options2);
|
|
17220
17221
|
db.exec("PRAGMA busy_timeout=5000; PRAGMA synchronous=FULL; BEGIN IMMEDIATE");
|
|
17221
17222
|
begun = true;
|
|
17222
|
-
const
|
|
17223
|
+
const result2 = fn();
|
|
17223
17224
|
db.exec("COMMIT");
|
|
17224
17225
|
begun = false;
|
|
17225
|
-
return
|
|
17226
|
+
return result2;
|
|
17226
17227
|
} finally {
|
|
17227
17228
|
if (begun) try {
|
|
17228
17229
|
db.exec("ROLLBACK");
|
|
@@ -17376,19 +17377,293 @@ function compactRuntimeErrors(options2 = {}) {
|
|
|
17376
17377
|
}, normalized);
|
|
17377
17378
|
return snapshot(normalized);
|
|
17378
17379
|
}
|
|
17380
|
+
var runtimeErrorsInternal = { validate, definitions, collectionEnabled, optionsFor, lock, readStore, ensureSafeDir, ensureSafeFile, secureWindowsAcl, assertPosix, now, validVersion };
|
|
17381
|
+
|
|
17382
|
+
// ../../packages/core/dist/runtimeErrorReport.js
|
|
17383
|
+
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
17384
|
+
import { createHash as createHash8, createHmac as createHmac2, randomBytes as randomBytes4, randomUUID, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
|
|
17385
|
+
import { closeSync as closeSync2, constants, existsSync as existsSync17, fstatSync, lstatSync as lstatSync2, openSync as openSync2, readFileSync as readFileSync15, renameSync as renameSync5, rmSync as rmSync7, writeFileSync as writeFileSync10 } from "node:fs";
|
|
17386
|
+
import { dirname as dirname9, isAbsolute as isAbsolute2, join as join14 } from "node:path";
|
|
17387
|
+
var RUNTIME_ERROR_REPORT_SCHEMA_VERSION = "1.0";
|
|
17388
|
+
var REPORT_STATE_SCHEMA = "caveat.runtime_error_report_state.v1";
|
|
17389
|
+
var REPORT_STATUS_SCHEMA = "caveat.runtime_error_report_status.v1";
|
|
17390
|
+
var REPORT_RESULT_SCHEMA = "caveat.runtime_error_report.v1";
|
|
17391
|
+
var PRODUCT_ID = "caveat";
|
|
17392
|
+
var MAX_CREDENTIAL_BYTES = 4096;
|
|
17393
|
+
var MAX_RESPONSE_BYTES = 64 * 1024;
|
|
17394
|
+
var REQUEST_TIMEOUT_MS = 5e3;
|
|
17395
|
+
var WINDOWS_ACL_TIMEOUT_MS2 = 3e4;
|
|
17396
|
+
var MINUTE_MS = 6e4;
|
|
17397
|
+
var RETRY_AFTER_ACCEPTED_MS = 60 * MINUTE_MS;
|
|
17398
|
+
var RETRY_AFTER_TRANSIENT_MS = 10 * MINUTE_MS;
|
|
17399
|
+
var RETRY_AFTER_CLOCK_MS = 60 * MINUTE_MS;
|
|
17400
|
+
var RETRY_AFTER_OPERATOR_MS = 6 * 60 * MINUTE_MS;
|
|
17401
|
+
var OUTCOME_RETRY_MS = {
|
|
17402
|
+
accepted: RETRY_AFTER_ACCEPTED_MS,
|
|
17403
|
+
in_flight: RETRY_AFTER_TRANSIENT_MS,
|
|
17404
|
+
unreachable: RETRY_AFTER_TRANSIENT_MS,
|
|
17405
|
+
timeout: RETRY_AFTER_TRANSIENT_MS,
|
|
17406
|
+
server_error: RETRY_AFTER_TRANSIENT_MS,
|
|
17407
|
+
rate_limited: RETRY_AFTER_TRANSIENT_MS,
|
|
17408
|
+
report_id_conflict: RETRY_AFTER_TRANSIENT_MS,
|
|
17409
|
+
response_unverified: RETRY_AFTER_TRANSIENT_MS,
|
|
17410
|
+
timestamp_skew: RETRY_AFTER_CLOCK_MS,
|
|
17411
|
+
observed_at_skew: RETRY_AFTER_CLOCK_MS,
|
|
17412
|
+
unauthorized: RETRY_AFTER_OPERATOR_MS,
|
|
17413
|
+
forbidden: RETRY_AFTER_OPERATOR_MS,
|
|
17414
|
+
invalid_report: RETRY_AFTER_OPERATOR_MS,
|
|
17415
|
+
report_too_large: RETRY_AFTER_OPERATOR_MS,
|
|
17416
|
+
unexpected_status: RETRY_AFTER_OPERATOR_MS,
|
|
17417
|
+
credential_unavailable: RETRY_AFTER_OPERATOR_MS,
|
|
17418
|
+
credential_unsafe: RETRY_AFTER_OPERATOR_MS,
|
|
17419
|
+
credential_invalid: RETRY_AFTER_OPERATOR_MS,
|
|
17420
|
+
version_invalid: RETRY_AFTER_OPERATOR_MS,
|
|
17421
|
+
store_unavailable: RETRY_AFTER_OPERATOR_MS
|
|
17422
|
+
};
|
|
17423
|
+
var { collectionEnabled: collectionEnabled2, optionsFor: optionsFor2, lock: lock2, readStore: readStore2, ensureSafeDir: ensureSafeDir2, secureWindowsAcl: secureWindowsAcl2, assertPosix: assertPosix2, now: now2, validVersion: validVersion2 } = runtimeErrorsInternal;
|
|
17424
|
+
var plain2 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
17425
|
+
var validTime2 = (v) => typeof v === "string" && Number.isFinite(Date.parse(v)) && new Date(v).toISOString() === v;
|
|
17426
|
+
var emptyState = () => ({ schema: REPORT_STATE_SCHEMA, last_attempt_at: null, last_outcome: null, last_accepted_at: null, next_attempt_at: null });
|
|
17427
|
+
var result = (status, outcome = null, counts = {}) => ({ schema: REPORT_RESULT_SCHEMA, status, outcome, runtime_error_count: counts.errors ?? 0, resolution_count: counts.resolutions ?? 0, acknowledged_through: counts.acknowledged ?? null });
|
|
17428
|
+
function reportStatePath(storePath) {
|
|
17429
|
+
return join14(dirname9(storePath), "runtime-error-report.json");
|
|
17430
|
+
}
|
|
17431
|
+
function configuredCredentialPath(options2) {
|
|
17432
|
+
try {
|
|
17433
|
+
const value = loadConfig(options2.configPath ?? runtimeErrorsConfigPath(options2.env ?? process.env)).runtimeErrorReportCredentialFile;
|
|
17434
|
+
return typeof value === "string" && value.length > 0 && isAbsolute2(value) ? value : null;
|
|
17435
|
+
} catch {
|
|
17436
|
+
return null;
|
|
17437
|
+
}
|
|
17438
|
+
}
|
|
17439
|
+
var WINDOWS_CREDENTIAL_ACL_VERIFY = String.raw`$ErrorActionPreference='Stop';$p=$env:CAVEAT_ACL_PATH;$sid=[System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value;$acl=Get-Acl -LiteralPath $p;$owner=$acl.GetOwner([System.Security.Principal.SecurityIdentifier]).Value;$trusted=@($sid,'S-1-5-18','S-1-5-32-544');if($trusted -notcontains $owner){exit 41};foreach($r in @($acl.GetAccessRules($true,$true,[System.Security.Principal.SecurityIdentifier]))){if($r.AccessControlType -eq 'Allow' -and ($trusted -notcontains $r.IdentityReference.Value)){exit 44}}`;
|
|
17440
|
+
function runWindowsCredentialAcl(path) {
|
|
17441
|
+
const run = spawnSync2("pwsh.exe", ["-NoLogo", "-NoProfile", "-NonInteractive", "-Command", WINDOWS_CREDENTIAL_ACL_VERIFY], { env: { ...process.env, CAVEAT_ACL_PATH: path }, encoding: "utf-8", timeout: WINDOWS_ACL_TIMEOUT_MS2, windowsHide: true });
|
|
17442
|
+
if (run.error !== void 0) throw Error(`credential_unsafe: powershell spawn ${run.error.code ?? run.error.message}`);
|
|
17443
|
+
if (run.status !== 0) throw Error(`credential_unsafe: powershell exit=${run.status} signal=${run.signal ?? "none"}`);
|
|
17444
|
+
}
|
|
17445
|
+
var ReportFailure = class extends Error {
|
|
17446
|
+
constructor(outcome) {
|
|
17447
|
+
super(outcome);
|
|
17448
|
+
this.outcome = outcome;
|
|
17449
|
+
}
|
|
17450
|
+
outcome;
|
|
17451
|
+
};
|
|
17452
|
+
function loadCredential(path, isWin, options2) {
|
|
17453
|
+
let text;
|
|
17454
|
+
try {
|
|
17455
|
+
const before = lstatSync2(path);
|
|
17456
|
+
if (!before.isFile() || before.isSymbolicLink() || before.size > MAX_CREDENTIAL_BYTES) throw new ReportFailure("credential_unsafe");
|
|
17457
|
+
if (isWin) (options2.credentialAclRunner ?? runWindowsCredentialAcl)(path);
|
|
17458
|
+
else if ((before.mode & 63) !== 0 || typeof process.getuid === "function" && before.uid !== process.getuid()) throw new ReportFailure("credential_unsafe");
|
|
17459
|
+
const fd = openSync2(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
|
|
17460
|
+
try {
|
|
17461
|
+
const after = fstatSync(fd);
|
|
17462
|
+
if (before.dev !== after.dev || before.ino !== after.ino || after.size > MAX_CREDENTIAL_BYTES) throw new ReportFailure("credential_unsafe");
|
|
17463
|
+
text = readFileSync15(fd, "utf8");
|
|
17464
|
+
} finally {
|
|
17465
|
+
closeSync2(fd);
|
|
17466
|
+
}
|
|
17467
|
+
} catch (error) {
|
|
17468
|
+
if (error instanceof ReportFailure) throw error;
|
|
17469
|
+
throw new ReportFailure(plain2(error) && error.code === "ENOENT" ? "credential_unavailable" : "credential_unsafe");
|
|
17470
|
+
}
|
|
17471
|
+
let value;
|
|
17472
|
+
try {
|
|
17473
|
+
value = JSON.parse(text);
|
|
17474
|
+
} catch {
|
|
17475
|
+
throw new ReportFailure("credential_invalid");
|
|
17476
|
+
}
|
|
17477
|
+
if (!plain2(value) || typeof value.url !== "string" || typeof value.key_id !== "string" || typeof value.secret !== "string") throw new ReportFailure("credential_invalid");
|
|
17478
|
+
let url;
|
|
17479
|
+
try {
|
|
17480
|
+
url = new URL(value.url);
|
|
17481
|
+
} catch {
|
|
17482
|
+
throw new ReportFailure("credential_invalid");
|
|
17483
|
+
}
|
|
17484
|
+
if (!["http:", "https:"].includes(url.protocol) || url.username !== "" || url.password !== "" || !/^[A-Za-z0-9._:-]{1,128}$/.test(value.key_id) || value.secret.length < 16 || value.secret.length > 1024) throw new ReportFailure("credential_invalid");
|
|
17485
|
+
return { url: url.toString(), keyId: value.key_id, secret: value.secret };
|
|
17486
|
+
}
|
|
17487
|
+
function signRuntimeErrorReport(secret, ts, body) {
|
|
17488
|
+
const bodyHash = createHash8("sha256").update(body).digest("hex");
|
|
17489
|
+
return createHmac2("sha256", Buffer.from(secret, "utf8")).update(`${ts}
|
|
17490
|
+
${bodyHash}`).digest("hex");
|
|
17491
|
+
}
|
|
17492
|
+
function signRuntimeErrorReportReceipt(secret, reportId, receivedAt) {
|
|
17493
|
+
return createHmac2("sha256", Buffer.from(secret, "utf8")).update(`${reportId}
|
|
17494
|
+
${receivedAt}`).digest("hex");
|
|
17495
|
+
}
|
|
17496
|
+
function sameHex(expected, actual) {
|
|
17497
|
+
if (typeof actual !== "string" || !/^[0-9a-f]{64}$/.test(actual)) return false;
|
|
17498
|
+
return timingSafeEqual2(Buffer.from(expected, "hex"), Buffer.from(actual, "hex"));
|
|
17499
|
+
}
|
|
17500
|
+
function readReportState(path) {
|
|
17501
|
+
try {
|
|
17502
|
+
const value = JSON.parse(readFileSync15(path, "utf8"));
|
|
17503
|
+
if (!plain2(value) || value.schema !== REPORT_STATE_SCHEMA) return emptyState();
|
|
17504
|
+
const time = (v) => validTime2(v) ? v : null;
|
|
17505
|
+
const outcome = typeof value.last_outcome === "string" && Object.hasOwn(OUTCOME_RETRY_MS, value.last_outcome) ? value.last_outcome : null;
|
|
17506
|
+
return { schema: REPORT_STATE_SCHEMA, last_attempt_at: time(value.last_attempt_at), last_outcome: outcome, last_accepted_at: time(value.last_accepted_at), next_attempt_at: time(value.next_attempt_at) };
|
|
17507
|
+
} catch {
|
|
17508
|
+
return emptyState();
|
|
17509
|
+
}
|
|
17510
|
+
}
|
|
17511
|
+
function writeReportState(path, state, isWin, options2) {
|
|
17512
|
+
ensureSafeDir2(dirname9(path), isWin, options2);
|
|
17513
|
+
const temporary = join14(dirname9(path), `.runtime-error-report-${process.pid}-${randomBytes4(6).toString("hex")}`);
|
|
17514
|
+
try {
|
|
17515
|
+
writeFileSync10(temporary, `${JSON.stringify(state)}
|
|
17516
|
+
`, { mode: 384, flag: "wx" });
|
|
17517
|
+
if (isWin) secureWindowsAcl2(temporary, options2.aclRunner, false, true);
|
|
17518
|
+
else assertPosix2(lstatSync2(temporary), 384);
|
|
17519
|
+
renameSync5(temporary, path);
|
|
17520
|
+
} finally {
|
|
17521
|
+
rmSync7(temporary, { force: true });
|
|
17522
|
+
}
|
|
17523
|
+
}
|
|
17524
|
+
function nextState(previous, outcome, at) {
|
|
17525
|
+
return { schema: REPORT_STATE_SCHEMA, last_attempt_at: at, last_outcome: outcome, last_accepted_at: outcome === "accepted" ? at : previous.last_accepted_at, next_attempt_at: new Date(Date.parse(at) + OUTCOME_RETRY_MS[outcome]).toISOString() };
|
|
17526
|
+
}
|
|
17527
|
+
function claimPending(storePath, isWin, at, options2) {
|
|
17528
|
+
if (!existsSync17(storePath)) return "nothing_pending";
|
|
17529
|
+
return lock2(storePath, isWin, () => {
|
|
17530
|
+
const statePath = reportStatePath(storePath);
|
|
17531
|
+
const state = readReportState(statePath);
|
|
17532
|
+
if (options2.respectRetryWindow && state.next_attempt_at !== null && Date.parse(at) < Date.parse(state.next_attempt_at)) return "waiting";
|
|
17533
|
+
const store = readStore2(storePath, isWin, options2);
|
|
17534
|
+
const pending = store.records.filter((record) => record.sequence > store.acknowledged_through);
|
|
17535
|
+
if (pending.length === 0) return "nothing_pending";
|
|
17536
|
+
const claimed = nextState(state, "in_flight", at);
|
|
17537
|
+
writeReportState(statePath, claimed, isWin, options2);
|
|
17538
|
+
return {
|
|
17539
|
+
rows: pending.filter((r2) => r2.status === "open").map((r2) => ({ fingerprint: r2.fingerprint, error_code: r2.error_code, component: r2.component, message_template: r2.message_template, severity: r2.severity, status: "open", occurrence_count: r2.count, first_seen: r2.first_seen, last_seen: r2.last_seen, product_version: r2.product_version, state_schema_version: r2.state_schema_version })),
|
|
17540
|
+
resolutions: pending.filter((r2) => r2.status === "resolved").map((r2) => ({ fingerprint: r2.fingerprint, resolved_at: r2.resolved_at, reason_code: r2.reason_code })),
|
|
17541
|
+
cursor: pending.at(-1).sequence,
|
|
17542
|
+
state: claimed
|
|
17543
|
+
};
|
|
17544
|
+
}, options2);
|
|
17545
|
+
}
|
|
17546
|
+
function errorCodeOf(text) {
|
|
17547
|
+
try {
|
|
17548
|
+
const value = JSON.parse(text);
|
|
17549
|
+
if (!plain2(value)) return null;
|
|
17550
|
+
return typeof value.error === "string" ? value.error : typeof value.code === "string" ? value.code : null;
|
|
17551
|
+
} catch {
|
|
17552
|
+
return null;
|
|
17553
|
+
}
|
|
17554
|
+
}
|
|
17555
|
+
async function post(credential, reportId, ts, body, options2) {
|
|
17556
|
+
let status;
|
|
17557
|
+
let text;
|
|
17558
|
+
try {
|
|
17559
|
+
const response = await (options2.fetchImpl ?? fetch)(credential.url, {
|
|
17560
|
+
method: "POST",
|
|
17561
|
+
// A redirect would re-send the signed report to a host the credential never named.
|
|
17562
|
+
redirect: "error",
|
|
17563
|
+
headers: { "content-type": "application/json", authorization: `BugHub-HMAC-SHA256 key_id=${credential.keyId}, ts=${ts}, sig=${signRuntimeErrorReport(credential.secret, ts, body)}` },
|
|
17564
|
+
// Exactly the bytes that were hashed for the signature.
|
|
17565
|
+
body: new Uint8Array(body),
|
|
17566
|
+
signal: AbortSignal.timeout(options2.timeoutMs ?? REQUEST_TIMEOUT_MS)
|
|
17567
|
+
});
|
|
17568
|
+
status = response.status;
|
|
17569
|
+
const bytes = Buffer.from(await response.arrayBuffer());
|
|
17570
|
+
text = bytes.length > MAX_RESPONSE_BYTES ? "" : bytes.toString("utf8");
|
|
17571
|
+
} catch (error) {
|
|
17572
|
+
return plain2(error) && (error.name === "TimeoutError" || error.name === "AbortError") ? "timeout" : "unreachable";
|
|
17573
|
+
}
|
|
17574
|
+
if (status === 200) {
|
|
17575
|
+
let value;
|
|
17576
|
+
try {
|
|
17577
|
+
value = JSON.parse(text);
|
|
17578
|
+
} catch {
|
|
17579
|
+
return "response_unverified";
|
|
17580
|
+
}
|
|
17581
|
+
if (!plain2(value) || value.accepted !== true || value.report_id !== reportId || typeof value.received_at !== "string") return "response_unverified";
|
|
17582
|
+
return sameHex(signRuntimeErrorReportReceipt(credential.secret, reportId, value.received_at), value.sig) ? "accepted" : "response_unverified";
|
|
17583
|
+
}
|
|
17584
|
+
if (status === 401) return errorCodeOf(text) === "timestamp_skew" ? "timestamp_skew" : "unauthorized";
|
|
17585
|
+
if (status === 403) return "forbidden";
|
|
17586
|
+
if (status === 409) return "report_id_conflict";
|
|
17587
|
+
if (status === 413) return "report_too_large";
|
|
17588
|
+
if (status === 422) return errorCodeOf(text) === "observed_at_skew" ? "observed_at_skew" : "invalid_report";
|
|
17589
|
+
if (status === 429) return "rate_limited";
|
|
17590
|
+
return status >= 500 ? "server_error" : "unexpected_status";
|
|
17591
|
+
}
|
|
17592
|
+
async function sendRuntimeErrorReport(options2 = {}) {
|
|
17593
|
+
if (!collectionEnabled2(options2)) return result("disabled");
|
|
17594
|
+
const credentialPath = configuredCredentialPath(options2);
|
|
17595
|
+
if (credentialPath === null) return result("not_configured");
|
|
17596
|
+
try {
|
|
17597
|
+
return await sendPending(credentialPath, options2);
|
|
17598
|
+
} catch {
|
|
17599
|
+
return result("failed", "store_unavailable");
|
|
17600
|
+
}
|
|
17601
|
+
}
|
|
17602
|
+
async function sendPending(credentialPath, options2) {
|
|
17603
|
+
const { path: storePath, isWin } = optionsFor2(options2);
|
|
17604
|
+
const at = now2(options2);
|
|
17605
|
+
const claim = claimPending(storePath, isWin, at, options2);
|
|
17606
|
+
if (claim === "nothing_pending" || claim === "waiting") return result(claim);
|
|
17607
|
+
const counts = { errors: claim.rows.length, resolutions: claim.resolutions.length };
|
|
17608
|
+
const finish = (outcome2, acknowledged2 = null) => {
|
|
17609
|
+
lock2(storePath, isWin, () => writeReportState(reportStatePath(storePath), nextState(claim.state, outcome2, at), isWin, options2), options2);
|
|
17610
|
+
return result(outcome2 === "accepted" ? "sent" : "failed", outcome2, { ...counts, acknowledged: acknowledged2 });
|
|
17611
|
+
};
|
|
17612
|
+
const version = options2.version;
|
|
17613
|
+
if (!validVersion2(version)) return finish("version_invalid");
|
|
17614
|
+
let credential;
|
|
17615
|
+
try {
|
|
17616
|
+
credential = loadCredential(credentialPath, isWin, options2);
|
|
17617
|
+
} catch (error) {
|
|
17618
|
+
return finish(error instanceof ReportFailure ? error.outcome : "credential_unsafe");
|
|
17619
|
+
}
|
|
17620
|
+
const reportId = randomUUID();
|
|
17621
|
+
const ts = String(Math.floor(Date.parse(at) / 1e3));
|
|
17622
|
+
const body = Buffer.from(JSON.stringify({ schema_version: RUNTIME_ERROR_REPORT_SCHEMA_VERSION, report_id: reportId, product_id: PRODUCT_ID, installed_version: version, observed_at: at, runtime_errors: claim.rows, resolutions: claim.resolutions }), "utf8");
|
|
17623
|
+
const outcome = await post(credential, reportId, ts, body, options2);
|
|
17624
|
+
if (outcome !== "accepted") return finish(outcome);
|
|
17625
|
+
const acknowledged = acknowledgeRuntimeErrors(claim.cursor, options2).cursor.acknowledged_through;
|
|
17626
|
+
return finish("accepted", acknowledged);
|
|
17627
|
+
}
|
|
17628
|
+
function runtimeErrorReportDue(options2 = {}) {
|
|
17629
|
+
try {
|
|
17630
|
+
if (!collectionEnabled2(options2) || configuredCredentialPath(options2) === null) return false;
|
|
17631
|
+
const { path: storePath } = optionsFor2(options2);
|
|
17632
|
+
if (!existsSync17(storePath)) return false;
|
|
17633
|
+
const store = JSON.parse(readFileSync15(storePath, "utf8"));
|
|
17634
|
+
if (!plain2(store) || typeof store.next_sequence !== "number" || typeof store.acknowledged_through !== "number" || store.next_sequence - 1 <= store.acknowledged_through) return false;
|
|
17635
|
+
const next = readReportState(reportStatePath(storePath)).next_attempt_at;
|
|
17636
|
+
return next === null || Date.parse(now2(options2)) >= Date.parse(next);
|
|
17637
|
+
} catch {
|
|
17638
|
+
return false;
|
|
17639
|
+
}
|
|
17640
|
+
}
|
|
17641
|
+
function runtimeErrorReportStatus(options2 = {}) {
|
|
17642
|
+
const base = { schema: REPORT_STATUS_SCHEMA, pending_count: 0, last_attempt_at: null, last_outcome: null, last_accepted_at: null, next_attempt_at: null };
|
|
17643
|
+
if (!collectionEnabled2(options2)) return { ...base, reporting: "disabled", status: "not_applicable" };
|
|
17644
|
+
if (configuredCredentialPath(options2) === null) return { ...base, reporting: "not_configured", status: "not_applicable" };
|
|
17645
|
+
try {
|
|
17646
|
+
const { path: storePath, isWin } = optionsFor2(options2);
|
|
17647
|
+
const store = existsSync17(storePath) ? readStore2(storePath, isWin, options2) : null;
|
|
17648
|
+
const state = readReportState(reportStatePath(storePath));
|
|
17649
|
+
return { schema: REPORT_STATUS_SCHEMA, reporting: "enabled", status: "ready", pending_count: store ? store.records.filter((record) => record.sequence > store.acknowledged_through).length : 0, last_attempt_at: state.last_attempt_at, last_outcome: state.last_outcome, last_accepted_at: state.last_accepted_at, next_attempt_at: state.next_attempt_at };
|
|
17650
|
+
} catch {
|
|
17651
|
+
return { ...base, reporting: "enabled", status: "unavailable" };
|
|
17652
|
+
}
|
|
17653
|
+
}
|
|
17379
17654
|
|
|
17380
17655
|
// ../../packages/core/dist/jevObservations.js
|
|
17381
|
-
import { createHash as
|
|
17382
|
-
import { existsSync as
|
|
17383
|
-
import { join as
|
|
17656
|
+
import { createHash as createHash9, randomBytes as randomBytes5 } from "node:crypto";
|
|
17657
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync9, readFileSync as readFileSync16, readdirSync as readdirSync9, renameSync as renameSync6, rmSync as rmSync8, writeFileSync as writeFileSync11 } from "node:fs";
|
|
17658
|
+
import { join as join15 } from "node:path";
|
|
17384
17659
|
var JEV_OBSERVATION_SCHEMA = "caveat.jev_observation.v1";
|
|
17385
|
-
var directory = (home) =>
|
|
17660
|
+
var directory = (home) => join15(home, "jev-observations");
|
|
17386
17661
|
var pathFor = (home, id) => {
|
|
17387
17662
|
if (!/^[0-9a-f]{64}$/.test(id)) throw new Error("jev_observation_id_invalid");
|
|
17388
|
-
return
|
|
17663
|
+
return join15(directory(home), `${id}.json`);
|
|
17389
17664
|
};
|
|
17390
17665
|
function jevObservationId(host, sessionId, turnKey) {
|
|
17391
|
-
return
|
|
17666
|
+
return createHash9("sha256").update(`${host}\0${sessionId}\0${turnKey}`).digest("hex");
|
|
17392
17667
|
}
|
|
17393
17668
|
function validate2(value) {
|
|
17394
17669
|
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("jev_observation_invalid");
|
|
@@ -17396,14 +17671,14 @@ function validate2(value) {
|
|
|
17396
17671
|
if (item.schema !== JEV_OBSERVATION_SCHEMA || typeof item.id !== "string" || !/^[0-9a-f]{64}$/.test(item.id) || !["claude", "codex"].includes(item.host) || typeof item.observedAt !== "string" || typeof item.sessionId !== "string" || typeof item.projectRoot !== "string" || typeof item.transcriptPath !== "string" || !Array.isArray(item.turns) || item.turns.some((turn) => typeof turn.originSessionId !== "string" || !Number.isSafeInteger(turn.turnNumber) || typeof turn.truncated !== "boolean") || typeof item.thinkingAvailable !== "boolean" || typeof item.model !== "string" || ![item.repeatedProblem, item.clearlyStuck, item.struggleThreshold, item.matchThreshold].every((score) => typeof score === "number" && Number.isFinite(score) && score >= 0 && score <= 1) || typeof item.struggling !== "boolean" || !Array.isArray(item.termChoices) || item.termChoices.some((choice) => typeof choice.term !== "string" || typeof choice.probability !== "number") || item.noneProbability !== null && typeof item.noneProbability !== "number" || !Array.isArray(item.selectedTerms) || item.selectedTerms.some((term) => typeof term !== "string") || typeof item.query !== "string" || !Array.isArray(item.ftsHits) || item.ftsHits.some((ref) => typeof ref !== "string") || !Array.isArray(item.candidates) || item.candidates.some((candidate) => typeof candidate.ref !== "string" || typeof candidate.score !== "number" || !Number.isFinite(candidate.score)) || item.selectedRef !== null && typeof item.selectedRef !== "string" || item.noticeText !== null && typeof item.noticeText !== "string" || !["below_struggle_threshold", "no_terms", "no_candidates", "below_match_threshold", "matched"].includes(item.decision) || !["none", "pending", "delivered", "suppressed"].includes(item.delivery) || item.review !== null && (!item.review || typeof item.review !== "object" || !["correct", "incorrect", "missed", "none", "unclear"].includes(item.review.verdict) || typeof item.review.note !== "string" || typeof item.review.reviewedAt !== "string")) throw new Error("jev_observation_invalid");
|
|
17397
17672
|
}
|
|
17398
17673
|
function readJevObservation(home, id) {
|
|
17399
|
-
const value = JSON.parse(
|
|
17674
|
+
const value = JSON.parse(readFileSync16(pathFor(home, id), "utf8"));
|
|
17400
17675
|
validate2(value);
|
|
17401
17676
|
if (value.id !== id) throw new Error("jev_observation_id_mismatch");
|
|
17402
17677
|
return value;
|
|
17403
17678
|
}
|
|
17404
17679
|
function listJevObservations(home) {
|
|
17405
17680
|
const dir = directory(home);
|
|
17406
|
-
if (!
|
|
17681
|
+
if (!existsSync18(dir)) return [];
|
|
17407
17682
|
return readdirSync9(dir).filter((name) => /^[0-9a-f]{64}\.json$/.test(name)).map((name) => readJevObservation(home, name.slice(0, -5))).sort((a, b2) => b2.observedAt.localeCompare(a.observedAt) || b2.id.localeCompare(a.id));
|
|
17408
17683
|
}
|
|
17409
17684
|
function writeJevObservation(home, item) {
|
|
@@ -17411,13 +17686,13 @@ function writeJevObservation(home, item) {
|
|
|
17411
17686
|
const dir = directory(home);
|
|
17412
17687
|
mkdirSync9(dir, { recursive: true, mode: 448 });
|
|
17413
17688
|
const path = pathFor(home, item.id);
|
|
17414
|
-
const temporary = `${path}.${
|
|
17689
|
+
const temporary = `${path}.${randomBytes5(6).toString("hex")}.tmp`;
|
|
17415
17690
|
try {
|
|
17416
|
-
|
|
17691
|
+
writeFileSync11(temporary, `${JSON.stringify(item)}
|
|
17417
17692
|
`, { encoding: "utf8", mode: 384, flag: "wx" });
|
|
17418
|
-
|
|
17693
|
+
renameSync6(temporary, path);
|
|
17419
17694
|
} finally {
|
|
17420
|
-
|
|
17695
|
+
rmSync8(temporary, { force: true });
|
|
17421
17696
|
}
|
|
17422
17697
|
}
|
|
17423
17698
|
function updateJevDelivery(home, id) {
|
|
@@ -17467,16 +17742,16 @@ function environmentAppliesToTask(environment, taskText, hostPlatform2) {
|
|
|
17467
17742
|
}
|
|
17468
17743
|
|
|
17469
17744
|
// ../../packages/core/dist/id.js
|
|
17470
|
-
import { randomBytes as
|
|
17745
|
+
import { randomBytes as randomBytes6 } from "node:crypto";
|
|
17471
17746
|
function randomHex(hexChars) {
|
|
17472
17747
|
const bytes = Math.ceil(hexChars / 2);
|
|
17473
|
-
return
|
|
17748
|
+
return randomBytes6(bytes).toString("hex").slice(0, hexChars);
|
|
17474
17749
|
}
|
|
17475
|
-
function slugify(title,
|
|
17750
|
+
function slugify(title, now3 = () => /* @__PURE__ */ new Date()) {
|
|
17476
17751
|
const lowered = title.toLowerCase();
|
|
17477
17752
|
const sluggy = lowered.replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
17478
17753
|
if (!sluggy || !/^[a-z0-9]/.test(sluggy)) {
|
|
17479
|
-
const d =
|
|
17754
|
+
const d = now3();
|
|
17480
17755
|
const yyyy = d.getUTCFullYear().toString().padStart(4, "0");
|
|
17481
17756
|
const mm = (d.getUTCMonth() + 1).toString().padStart(2, "0");
|
|
17482
17757
|
const dd = d.getUTCDate().toString().padStart(2, "0");
|
|
@@ -17490,13 +17765,13 @@ function resolveCollision(baseId, exists2) {
|
|
|
17490
17765
|
while (exists2(`${baseId}-${n}`)) n++;
|
|
17491
17766
|
return `${baseId}-${n}`;
|
|
17492
17767
|
}
|
|
17493
|
-
function generateSourceSession(
|
|
17494
|
-
return `${
|
|
17768
|
+
function generateSourceSession(now3 = () => /* @__PURE__ */ new Date()) {
|
|
17769
|
+
return `${now3().toISOString()}/${randomHex(12)}`;
|
|
17495
17770
|
}
|
|
17496
17771
|
|
|
17497
17772
|
// ../../packages/core/dist/writer.js
|
|
17498
|
-
import { existsSync as
|
|
17499
|
-
import { dirname as
|
|
17773
|
+
import { existsSync as existsSync19, mkdirSync as mkdirSync10, writeFileSync as writeFileSync12 } from "node:fs";
|
|
17774
|
+
import { dirname as dirname10 } from "node:path";
|
|
17500
17775
|
function buildEntry(frontmatter, sections) {
|
|
17501
17776
|
const bodyParts = [];
|
|
17502
17777
|
for (const [heading, content2] of Object.entries(sections)) {
|
|
@@ -17514,21 +17789,21 @@ ${body}${body ? "\n" : ""}`;
|
|
|
17514
17789
|
return { content, body };
|
|
17515
17790
|
}
|
|
17516
17791
|
function writeEntryFile(filePath, content) {
|
|
17517
|
-
const dir =
|
|
17518
|
-
if (!
|
|
17519
|
-
|
|
17792
|
+
const dir = dirname10(filePath);
|
|
17793
|
+
if (!existsSync19(dir)) mkdirSync10(dir, { recursive: true });
|
|
17794
|
+
writeFileSync12(filePath, content, "utf-8");
|
|
17520
17795
|
}
|
|
17521
17796
|
|
|
17522
17797
|
// ../../packages/core/dist/record.js
|
|
17523
17798
|
import { statSync as statSync8 } from "node:fs";
|
|
17524
|
-
import { join as
|
|
17799
|
+
import { join as join16 } from "node:path";
|
|
17525
17800
|
var DEFAULT_CATEGORY = "misc";
|
|
17526
17801
|
function recordEntry(input, opts) {
|
|
17527
|
-
const
|
|
17802
|
+
const now3 = opts.now ?? (() => /* @__PURE__ */ new Date());
|
|
17528
17803
|
const source = opts.source ?? "own";
|
|
17529
|
-
const nowDate =
|
|
17804
|
+
const nowDate = now3();
|
|
17530
17805
|
const ymd = formatYmd(nowDate);
|
|
17531
|
-
const baseId = input.id ?? slugify(input.title,
|
|
17806
|
+
const baseId = input.id ?? slugify(input.title, now3);
|
|
17532
17807
|
const id = resolveCollision(baseId, (candidate) => entryExists(opts.db, source, candidate));
|
|
17533
17808
|
const mergedEnv = {
|
|
17534
17809
|
...fingerprint2(),
|
|
@@ -17543,7 +17818,7 @@ function recordEntry(input, opts) {
|
|
|
17543
17818
|
tags: input.tags ?? [],
|
|
17544
17819
|
environment: mergedEnv,
|
|
17545
17820
|
source_project: null,
|
|
17546
|
-
source_session: generateSourceSession(
|
|
17821
|
+
source_session: generateSourceSession(now3),
|
|
17547
17822
|
created_at: ymd,
|
|
17548
17823
|
updated_at: ymd,
|
|
17549
17824
|
last_verified: ymd
|
|
@@ -17557,7 +17832,7 @@ function recordEntry(input, opts) {
|
|
|
17557
17832
|
const built = buildEntry(frontmatter, sections);
|
|
17558
17833
|
const category = input.category ?? DEFAULT_CATEGORY;
|
|
17559
17834
|
const relPath = `${category}/${id}.md`;
|
|
17560
|
-
const filePath =
|
|
17835
|
+
const filePath = join16(opts.entriesRoot, relPath);
|
|
17561
17836
|
writeEntryFile(filePath, built.content);
|
|
17562
17837
|
const stat = statSync8(filePath);
|
|
17563
17838
|
upsertEntry(opts.db, {
|
|
@@ -17587,8 +17862,8 @@ function formatYmd(d) {
|
|
|
17587
17862
|
}
|
|
17588
17863
|
|
|
17589
17864
|
// ../../packages/core/dist/update.js
|
|
17590
|
-
import { readFileSync as
|
|
17591
|
-
import { join as
|
|
17865
|
+
import { readFileSync as readFileSync17, statSync as statSync9, writeFileSync as writeFileSync13 } from "node:fs";
|
|
17866
|
+
import { join as join17 } from "node:path";
|
|
17592
17867
|
var IMMUTABLE_KEYS = /* @__PURE__ */ new Set([
|
|
17593
17868
|
"id",
|
|
17594
17869
|
"created_at",
|
|
@@ -17600,15 +17875,15 @@ function updateEntry(id, patch, opts) {
|
|
|
17600
17875
|
if (source !== "own") {
|
|
17601
17876
|
throw new Error("community \u30A8\u30F3\u30C8\u30EA\u306F\u8CFC\u8AAD\u7269\u3067\u3059; \u7DE8\u96C6\u306F\u4E0A\u6D41\u3067\u884C\u3063\u3066\u304F\u3060\u3055\u3044");
|
|
17602
17877
|
}
|
|
17603
|
-
const
|
|
17604
|
-
const nowDate =
|
|
17878
|
+
const now3 = opts.now ?? (() => /* @__PURE__ */ new Date());
|
|
17879
|
+
const nowDate = now3();
|
|
17605
17880
|
const row = opts.db.prepare("SELECT path FROM entries WHERE source = ? AND id = ?").get(source, id);
|
|
17606
17881
|
if (!row) {
|
|
17607
17882
|
throw new Error(`caveat not found: id=${id} source=${source}`);
|
|
17608
17883
|
}
|
|
17609
17884
|
const relPath = row.path;
|
|
17610
|
-
const filePath =
|
|
17611
|
-
const raw =
|
|
17885
|
+
const filePath = join17(opts.entriesRoot, relPath);
|
|
17886
|
+
const raw = readFileSync17(filePath, "utf-8");
|
|
17612
17887
|
const parsed = parseMarkdown(raw);
|
|
17613
17888
|
if (patch.frontmatter) {
|
|
17614
17889
|
for (const key of Object.keys(patch.frontmatter)) {
|
|
@@ -17649,7 +17924,7 @@ function updateEntry(id, patch, opts) {
|
|
|
17649
17924
|
}
|
|
17650
17925
|
}
|
|
17651
17926
|
const built = buildEntry(mergedFrontmatter, mergedSections);
|
|
17652
|
-
|
|
17927
|
+
writeFileSync13(filePath, built.content, "utf-8");
|
|
17653
17928
|
const stat = statSync9(filePath);
|
|
17654
17929
|
upsertEntry(opts.db, {
|
|
17655
17930
|
id,
|
|
@@ -17674,9 +17949,9 @@ function formatYmd2(d) {
|
|
|
17674
17949
|
}
|
|
17675
17950
|
|
|
17676
17951
|
// ../../packages/core/dist/markHit.js
|
|
17677
|
-
function markHit(db, keys,
|
|
17952
|
+
function markHit(db, keys, now3 = () => (/* @__PURE__ */ new Date()).toISOString()) {
|
|
17678
17953
|
if (keys.length === 0) return;
|
|
17679
|
-
const ts =
|
|
17954
|
+
const ts = now3();
|
|
17680
17955
|
const stmt = db.prepare(
|
|
17681
17956
|
"UPDATE entries SET last_hit_at = ? WHERE source = ? AND id = ?"
|
|
17682
17957
|
);
|
|
@@ -17686,8 +17961,8 @@ function markHit(db, keys, now2 = () => (/* @__PURE__ */ new Date()).toISOString
|
|
|
17686
17961
|
}
|
|
17687
17962
|
|
|
17688
17963
|
// ../../packages/core/dist/hookQueryLog.js
|
|
17689
|
-
import { appendFileSync, chmodSync as chmodSync2, mkdirSync as mkdirSync11, renameSync as
|
|
17690
|
-
import { join as
|
|
17964
|
+
import { appendFileSync, chmodSync as chmodSync2, mkdirSync as mkdirSync11, renameSync as renameSync7, statSync as statSync10, unlinkSync as unlinkSync3 } from "node:fs";
|
|
17965
|
+
import { join as join18, resolve as resolve3 } from "node:path";
|
|
17691
17966
|
var CAVEAT_HOOK_QUERY_LOG_ENV = "CAVEAT_HOOK_QUERY_LOG";
|
|
17692
17967
|
var HOOK_QUERY_LOG_MAX_BYTES = 1024 * 1024;
|
|
17693
17968
|
var HOOK_QUERY_LOG_MAX_QUERY_CODE_UNITS = 1e3;
|
|
@@ -17695,7 +17970,7 @@ var fsDependencies = {
|
|
|
17695
17970
|
appendFileSync,
|
|
17696
17971
|
chmodSync: chmodSync2,
|
|
17697
17972
|
mkdirSync: mkdirSync11,
|
|
17698
|
-
renameSync:
|
|
17973
|
+
renameSync: renameSync7,
|
|
17699
17974
|
statSync: statSync10,
|
|
17700
17975
|
unlinkSync: unlinkSync3
|
|
17701
17976
|
};
|
|
@@ -17711,8 +17986,8 @@ function chmodExistingFile(path, dependencies) {
|
|
|
17711
17986
|
}
|
|
17712
17987
|
function logHookQueryMiss(miss, dependencies = fsDependencies) {
|
|
17713
17988
|
if (process.env[CAVEAT_HOOK_QUERY_LOG_ENV] !== "on") return;
|
|
17714
|
-
const metricsDir =
|
|
17715
|
-
const activePath =
|
|
17989
|
+
const metricsDir = join18(resolve3(miss.caveatHome), "metrics");
|
|
17990
|
+
const activePath = join18(metricsDir, "hook-search-misses.jsonl");
|
|
17716
17991
|
const backupPath = `${activePath}.1`;
|
|
17717
17992
|
const record = JSON.stringify({
|
|
17718
17993
|
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -17753,15 +18028,15 @@ function logHookQueryMiss(miss, dependencies = fsDependencies) {
|
|
|
17753
18028
|
}
|
|
17754
18029
|
|
|
17755
18030
|
// ../../packages/core/dist/proposalEval.js
|
|
17756
|
-
import { createHash as
|
|
17757
|
-
import { isAbsolute as
|
|
18031
|
+
import { createHash as createHash10 } from "node:crypto";
|
|
18032
|
+
import { isAbsolute as isAbsolute3, relative as relative4, resolve as resolve4, sep } from "node:path";
|
|
17758
18033
|
|
|
17759
18034
|
// ../../packages/core/dist/proposalExecution.js
|
|
17760
|
-
import { createHash as
|
|
17761
|
-
import { basename as basename3, isAbsolute as
|
|
18035
|
+
import { createHash as createHash11 } from "node:crypto";
|
|
18036
|
+
import { basename as basename3, isAbsolute as isAbsolute4 } from "node:path";
|
|
17762
18037
|
|
|
17763
18038
|
// ../../packages/core/dist/proposalExecutionCompiler.js
|
|
17764
|
-
import { createHash as
|
|
18039
|
+
import { createHash as createHash12 } from "node:crypto";
|
|
17765
18040
|
|
|
17766
18041
|
export {
|
|
17767
18042
|
__commonJS,
|
|
@@ -17836,6 +18111,9 @@ export {
|
|
|
17836
18111
|
acknowledgeRuntimeErrors,
|
|
17837
18112
|
setRuntimeErrorStatus,
|
|
17838
18113
|
compactRuntimeErrors,
|
|
18114
|
+
sendRuntimeErrorReport,
|
|
18115
|
+
runtimeErrorReportDue,
|
|
18116
|
+
runtimeErrorReportStatus,
|
|
17839
18117
|
jevObservationId,
|
|
17840
18118
|
listJevObservations,
|
|
17841
18119
|
writeJevObservation,
|
|
@@ -17863,4 +18141,4 @@ strip-bom-string/index.js:
|
|
|
17863
18141
|
js-yaml/dist/js-yaml.mjs:
|
|
17864
18142
|
(*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
|
|
17865
18143
|
*/
|
|
17866
|
-
//# sourceMappingURL=chunk-
|
|
18144
|
+
//# sourceMappingURL=chunk-G52CLPRY.js.map
|