@locusai/cli 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/agent/worker.js +18064 -17837
- package/bin/locus.js +2053 -1517
- package/package.json +2 -2
package/bin/locus.js
CHANGED
|
@@ -56,8 +56,8 @@ var require_array = __commonJS((exports) => {
|
|
|
56
56
|
var require_errno = __commonJS((exports) => {
|
|
57
57
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
58
|
exports.isEnoentCodeError = undefined;
|
|
59
|
-
function isEnoentCodeError(
|
|
60
|
-
return
|
|
59
|
+
function isEnoentCodeError(error48) {
|
|
60
|
+
return error48.code === "ENOENT";
|
|
61
61
|
}
|
|
62
62
|
exports.isEnoentCodeError = isEnoentCodeError;
|
|
63
63
|
});
|
|
@@ -284,11 +284,11 @@ var require_is_glob = __commonJS((exports, module) => {
|
|
|
284
284
|
if (isExtglob(str)) {
|
|
285
285
|
return true;
|
|
286
286
|
}
|
|
287
|
-
var
|
|
287
|
+
var check2 = strictCheck;
|
|
288
288
|
if (options && options.strict === false) {
|
|
289
|
-
|
|
289
|
+
check2 = relaxedCheck;
|
|
290
290
|
}
|
|
291
|
-
return
|
|
291
|
+
return check2(str);
|
|
292
292
|
};
|
|
293
293
|
});
|
|
294
294
|
|
|
@@ -600,15 +600,15 @@ var require_to_regex_range = __commonJS((exports, module) => {
|
|
|
600
600
|
}
|
|
601
601
|
return tokens;
|
|
602
602
|
}
|
|
603
|
-
function filterPatterns(arr, comparison, prefix,
|
|
603
|
+
function filterPatterns(arr, comparison, prefix, intersection2, options) {
|
|
604
604
|
let result = [];
|
|
605
605
|
for (let ele of arr) {
|
|
606
|
-
let { string } = ele;
|
|
607
|
-
if (!
|
|
608
|
-
result.push(prefix +
|
|
606
|
+
let { string: string4 } = ele;
|
|
607
|
+
if (!intersection2 && !contains(comparison, "string", string4)) {
|
|
608
|
+
result.push(prefix + string4);
|
|
609
609
|
}
|
|
610
|
-
if (
|
|
611
|
-
result.push(prefix +
|
|
610
|
+
if (intersection2 && contains(comparison, "string", string4)) {
|
|
611
|
+
result.push(prefix + string4);
|
|
612
612
|
}
|
|
613
613
|
}
|
|
614
614
|
return result;
|
|
@@ -628,8 +628,8 @@ var require_to_regex_range = __commonJS((exports, module) => {
|
|
|
628
628
|
function countNines(min, len) {
|
|
629
629
|
return Number(String(min).slice(0, -len) + "9".repeat(len));
|
|
630
630
|
}
|
|
631
|
-
function countZeros(
|
|
632
|
-
return
|
|
631
|
+
function countZeros(integer2, zeros) {
|
|
632
|
+
return integer2 - integer2 % Math.pow(10, zeros);
|
|
633
633
|
}
|
|
634
634
|
function toQuantifier(digits) {
|
|
635
635
|
let [start = 0, stop = ""] = digits;
|
|
@@ -677,8 +677,8 @@ var require_fill_range = __commonJS((exports, module) => {
|
|
|
677
677
|
*/
|
|
678
678
|
var util = __require("util");
|
|
679
679
|
var toRegexRange = require_to_regex_range();
|
|
680
|
-
var
|
|
681
|
-
var
|
|
680
|
+
var isObject2 = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
681
|
+
var transform2 = (toNumber) => {
|
|
682
682
|
return (value) => toNumber === true ? Number(value) : String(value);
|
|
683
683
|
};
|
|
684
684
|
var isValidValue = (value) => {
|
|
@@ -799,7 +799,7 @@ var require_fill_range = __commonJS((exports, module) => {
|
|
|
799
799
|
let padded = zeros(startString) || zeros(endString) || zeros(stepString);
|
|
800
800
|
let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
|
|
801
801
|
let toNumber = padded === false && stringify(start, end, options) === false;
|
|
802
|
-
let format = options.transform ||
|
|
802
|
+
let format = options.transform || transform2(toNumber);
|
|
803
803
|
if (options.toRegex && step === 1) {
|
|
804
804
|
return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
|
|
805
805
|
}
|
|
@@ -856,7 +856,7 @@ var require_fill_range = __commonJS((exports, module) => {
|
|
|
856
856
|
if (typeof step === "function") {
|
|
857
857
|
return fill(start, end, 1, { transform: step });
|
|
858
858
|
}
|
|
859
|
-
if (
|
|
859
|
+
if (isObject2(step)) {
|
|
860
860
|
return fill(start, end, 0, step);
|
|
861
861
|
}
|
|
862
862
|
let opts = { ...options };
|
|
@@ -864,7 +864,7 @@ var require_fill_range = __commonJS((exports, module) => {
|
|
|
864
864
|
opts.wrap = true;
|
|
865
865
|
step = step || opts.step || 1;
|
|
866
866
|
if (!isNumber(step)) {
|
|
867
|
-
if (step != null && !
|
|
867
|
+
if (step != null && !isObject2(step))
|
|
868
868
|
return invalidStep(step, opts);
|
|
869
869
|
return fill(start, end, 1, step);
|
|
870
870
|
}
|
|
@@ -1091,7 +1091,7 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
1091
1091
|
CHAR_NO_BREAK_SPACE,
|
|
1092
1092
|
CHAR_ZERO_WIDTH_NOBREAK_SPACE
|
|
1093
1093
|
} = require_constants();
|
|
1094
|
-
var
|
|
1094
|
+
var parse5 = (input, options = {}) => {
|
|
1095
1095
|
if (typeof input !== "string") {
|
|
1096
1096
|
throw new TypeError("Expected a string");
|
|
1097
1097
|
}
|
|
@@ -1295,7 +1295,7 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
1295
1295
|
push({ type: "eos" });
|
|
1296
1296
|
return ast;
|
|
1297
1297
|
};
|
|
1298
|
-
module.exports =
|
|
1298
|
+
module.exports = parse5;
|
|
1299
1299
|
});
|
|
1300
1300
|
|
|
1301
1301
|
// ../../node_modules/braces/index.js
|
|
@@ -1303,7 +1303,7 @@ var require_braces = __commonJS((exports, module) => {
|
|
|
1303
1303
|
var stringify = require_stringify();
|
|
1304
1304
|
var compile = require_compile();
|
|
1305
1305
|
var expand = require_expand();
|
|
1306
|
-
var
|
|
1306
|
+
var parse5 = require_parse();
|
|
1307
1307
|
var braces = (input, options = {}) => {
|
|
1308
1308
|
let output = [];
|
|
1309
1309
|
if (Array.isArray(input)) {
|
|
@@ -1323,7 +1323,7 @@ var require_braces = __commonJS((exports, module) => {
|
|
|
1323
1323
|
}
|
|
1324
1324
|
return output;
|
|
1325
1325
|
};
|
|
1326
|
-
braces.parse = (input, options = {}) =>
|
|
1326
|
+
braces.parse = (input, options = {}) => parse5(input, options);
|
|
1327
1327
|
braces.stringify = (input, options = {}) => {
|
|
1328
1328
|
if (typeof input === "string") {
|
|
1329
1329
|
return stringify(braces.parse(input, options), options);
|
|
@@ -1900,7 +1900,7 @@ var require_parse2 = __commonJS((exports, module) => {
|
|
|
1900
1900
|
var syntaxError = (type, char) => {
|
|
1901
1901
|
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
1902
1902
|
};
|
|
1903
|
-
var
|
|
1903
|
+
var parse5 = (input, options) => {
|
|
1904
1904
|
if (typeof input !== "string") {
|
|
1905
1905
|
throw new TypeError("Expected a string");
|
|
1906
1906
|
}
|
|
@@ -2050,7 +2050,7 @@ var require_parse2 = __commonJS((exports, module) => {
|
|
|
2050
2050
|
output = token.close = `)$))${extglobStar}`;
|
|
2051
2051
|
}
|
|
2052
2052
|
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
2053
|
-
const expression =
|
|
2053
|
+
const expression = parse5(rest, { ...options, fastpaths: false }).output;
|
|
2054
2054
|
output = token.close = `)${expression})${extglobStar})`;
|
|
2055
2055
|
}
|
|
2056
2056
|
if (token.prev.type === "bos") {
|
|
@@ -2062,14 +2062,14 @@ var require_parse2 = __commonJS((exports, module) => {
|
|
|
2062
2062
|
};
|
|
2063
2063
|
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
2064
2064
|
let backslashes = false;
|
|
2065
|
-
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m,
|
|
2065
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc2, chars, first, rest, index) => {
|
|
2066
2066
|
if (first === "\\") {
|
|
2067
2067
|
backslashes = true;
|
|
2068
2068
|
return m;
|
|
2069
2069
|
}
|
|
2070
2070
|
if (first === "?") {
|
|
2071
|
-
if (
|
|
2072
|
-
return
|
|
2071
|
+
if (esc2) {
|
|
2072
|
+
return esc2 + first + (rest ? QMARK.repeat(rest.length) : "");
|
|
2073
2073
|
}
|
|
2074
2074
|
if (index === 0) {
|
|
2075
2075
|
return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
|
|
@@ -2080,12 +2080,12 @@ var require_parse2 = __commonJS((exports, module) => {
|
|
|
2080
2080
|
return DOT_LITERAL.repeat(chars.length);
|
|
2081
2081
|
}
|
|
2082
2082
|
if (first === "*") {
|
|
2083
|
-
if (
|
|
2084
|
-
return
|
|
2083
|
+
if (esc2) {
|
|
2084
|
+
return esc2 + first + (rest ? star : "");
|
|
2085
2085
|
}
|
|
2086
2086
|
return star;
|
|
2087
2087
|
}
|
|
2088
|
-
return
|
|
2088
|
+
return esc2 ? m : `\\${m}`;
|
|
2089
2089
|
});
|
|
2090
2090
|
if (backslashes === true) {
|
|
2091
2091
|
if (opts.unescape === true) {
|
|
@@ -2579,7 +2579,7 @@ var require_parse2 = __commonJS((exports, module) => {
|
|
|
2579
2579
|
}
|
|
2580
2580
|
return state;
|
|
2581
2581
|
};
|
|
2582
|
-
|
|
2582
|
+
parse5.fastpaths = (input, options) => {
|
|
2583
2583
|
const opts = { ...options };
|
|
2584
2584
|
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
2585
2585
|
const len = input.length;
|
|
@@ -2648,17 +2648,17 @@ var require_parse2 = __commonJS((exports, module) => {
|
|
|
2648
2648
|
}
|
|
2649
2649
|
return source;
|
|
2650
2650
|
};
|
|
2651
|
-
module.exports =
|
|
2651
|
+
module.exports = parse5;
|
|
2652
2652
|
});
|
|
2653
2653
|
|
|
2654
2654
|
// ../../node_modules/picomatch/lib/picomatch.js
|
|
2655
2655
|
var require_picomatch = __commonJS((exports, module) => {
|
|
2656
2656
|
var path = __require("path");
|
|
2657
2657
|
var scan = require_scan();
|
|
2658
|
-
var
|
|
2658
|
+
var parse5 = require_parse2();
|
|
2659
2659
|
var utils = require_utils2();
|
|
2660
2660
|
var constants = require_constants2();
|
|
2661
|
-
var
|
|
2661
|
+
var isObject2 = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
2662
2662
|
var picomatch = (glob, options, returnState = false) => {
|
|
2663
2663
|
if (Array.isArray(glob)) {
|
|
2664
2664
|
const fns = glob.map((input) => picomatch(input, options, returnState));
|
|
@@ -2672,7 +2672,7 @@ var require_picomatch = __commonJS((exports, module) => {
|
|
|
2672
2672
|
};
|
|
2673
2673
|
return arrayMatcher;
|
|
2674
2674
|
}
|
|
2675
|
-
const isState =
|
|
2675
|
+
const isState = isObject2(glob) && glob.tokens && glob.input;
|
|
2676
2676
|
if (glob === "" || typeof glob !== "string" && !isState) {
|
|
2677
2677
|
throw new TypeError("Expected pattern to be a non-empty string");
|
|
2678
2678
|
}
|
|
@@ -2745,7 +2745,7 @@ var require_picomatch = __commonJS((exports, module) => {
|
|
|
2745
2745
|
picomatch.parse = (pattern, options) => {
|
|
2746
2746
|
if (Array.isArray(pattern))
|
|
2747
2747
|
return pattern.map((p) => picomatch.parse(p, options));
|
|
2748
|
-
return
|
|
2748
|
+
return parse5(pattern, { ...options, fastpaths: false });
|
|
2749
2749
|
};
|
|
2750
2750
|
picomatch.scan = (input, options) => scan(input, options);
|
|
2751
2751
|
picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
@@ -2771,10 +2771,10 @@ var require_picomatch = __commonJS((exports, module) => {
|
|
|
2771
2771
|
}
|
|
2772
2772
|
let parsed = { negated: false, fastpaths: true };
|
|
2773
2773
|
if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
|
|
2774
|
-
parsed.output =
|
|
2774
|
+
parsed.output = parse5.fastpaths(input, options);
|
|
2775
2775
|
}
|
|
2776
2776
|
if (!parsed.output) {
|
|
2777
|
-
parsed =
|
|
2777
|
+
parsed = parse5(input, options);
|
|
2778
2778
|
}
|
|
2779
2779
|
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
2780
2780
|
};
|
|
@@ -2806,7 +2806,7 @@ var require_micromatch = __commonJS((exports, module) => {
|
|
|
2806
2806
|
var micromatch = (list, patterns, options) => {
|
|
2807
2807
|
patterns = [].concat(patterns);
|
|
2808
2808
|
list = [].concat(list);
|
|
2809
|
-
let
|
|
2809
|
+
let omit2 = new Set;
|
|
2810
2810
|
let keep = new Set;
|
|
2811
2811
|
let items = new Set;
|
|
2812
2812
|
let negatives = 0;
|
|
@@ -2827,15 +2827,15 @@ var require_micromatch = __commonJS((exports, module) => {
|
|
|
2827
2827
|
if (!match)
|
|
2828
2828
|
continue;
|
|
2829
2829
|
if (negated) {
|
|
2830
|
-
|
|
2830
|
+
omit2.add(matched.output);
|
|
2831
2831
|
} else {
|
|
2832
|
-
|
|
2832
|
+
omit2.delete(matched.output);
|
|
2833
2833
|
keep.add(matched.output);
|
|
2834
2834
|
}
|
|
2835
2835
|
}
|
|
2836
2836
|
}
|
|
2837
2837
|
let result = negatives === patterns.length ? [...items] : [...keep];
|
|
2838
|
-
let matches = result.filter((item) => !
|
|
2838
|
+
let matches = result.filter((item) => !omit2.has(item));
|
|
2839
2839
|
if (options && matches.length === 0) {
|
|
2840
2840
|
if (options.failglob === true) {
|
|
2841
2841
|
throw new Error(`No matches found for "${patterns.join(", ")}"`);
|
|
@@ -3171,7 +3171,7 @@ var require_merge2 = __commonJS((exports, module) => {
|
|
|
3171
3171
|
merging = false;
|
|
3172
3172
|
mergeStream();
|
|
3173
3173
|
}
|
|
3174
|
-
function
|
|
3174
|
+
function pipe2(stream) {
|
|
3175
3175
|
function onend() {
|
|
3176
3176
|
stream.removeListener("merge2UnpipeEnd", onend);
|
|
3177
3177
|
stream.removeListener("end", onend);
|
|
@@ -3195,7 +3195,7 @@ var require_merge2 = __commonJS((exports, module) => {
|
|
|
3195
3195
|
stream.resume();
|
|
3196
3196
|
}
|
|
3197
3197
|
for (let i = 0;i < streams.length; i++) {
|
|
3198
|
-
|
|
3198
|
+
pipe2(streams[i]);
|
|
3199
3199
|
}
|
|
3200
3200
|
next();
|
|
3201
3201
|
}
|
|
@@ -3239,16 +3239,16 @@ var require_stream = __commonJS((exports) => {
|
|
|
3239
3239
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3240
3240
|
exports.merge = undefined;
|
|
3241
3241
|
var merge2 = require_merge2();
|
|
3242
|
-
function
|
|
3242
|
+
function merge3(streams) {
|
|
3243
3243
|
const mergedStream = merge2(streams);
|
|
3244
3244
|
streams.forEach((stream) => {
|
|
3245
|
-
stream.once("error", (
|
|
3245
|
+
stream.once("error", (error48) => mergedStream.emit("error", error48));
|
|
3246
3246
|
});
|
|
3247
3247
|
mergedStream.once("close", () => propagateCloseEventToSources(streams));
|
|
3248
3248
|
mergedStream.once("end", () => propagateCloseEventToSources(streams));
|
|
3249
3249
|
return mergedStream;
|
|
3250
3250
|
}
|
|
3251
|
-
exports.merge =
|
|
3251
|
+
exports.merge = merge3;
|
|
3252
3252
|
function propagateCloseEventToSources(streams) {
|
|
3253
3253
|
streams.forEach((stream) => stream.emit("close"));
|
|
3254
3254
|
}
|
|
@@ -3272,8 +3272,8 @@ var require_string = __commonJS((exports) => {
|
|
|
3272
3272
|
var require_utils3 = __commonJS((exports) => {
|
|
3273
3273
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3274
3274
|
exports.string = exports.stream = exports.pattern = exports.path = exports.fs = exports.errno = exports.array = undefined;
|
|
3275
|
-
var
|
|
3276
|
-
exports.array =
|
|
3275
|
+
var array2 = require_array();
|
|
3276
|
+
exports.array = array2;
|
|
3277
3277
|
var errno = require_errno();
|
|
3278
3278
|
exports.errno = errno;
|
|
3279
3279
|
var fs = require_fs();
|
|
@@ -3284,8 +3284,8 @@ var require_utils3 = __commonJS((exports) => {
|
|
|
3284
3284
|
exports.pattern = pattern;
|
|
3285
3285
|
var stream = require_stream();
|
|
3286
3286
|
exports.stream = stream;
|
|
3287
|
-
var
|
|
3288
|
-
exports.string =
|
|
3287
|
+
var string4 = require_string();
|
|
3288
|
+
exports.string = string4;
|
|
3289
3289
|
});
|
|
3290
3290
|
|
|
3291
3291
|
// ../../node_modules/fast-glob/out/managers/tasks.js
|
|
@@ -3402,8 +3402,8 @@ var require_async = __commonJS((exports) => {
|
|
|
3402
3402
|
});
|
|
3403
3403
|
}
|
|
3404
3404
|
exports.read = read;
|
|
3405
|
-
function callFailureCallback(callback,
|
|
3406
|
-
callback(
|
|
3405
|
+
function callFailureCallback(callback, error48) {
|
|
3406
|
+
callback(error48);
|
|
3407
3407
|
}
|
|
3408
3408
|
function callSuccessCallback(callback, result) {
|
|
3409
3409
|
callback(null, result);
|
|
@@ -3425,11 +3425,11 @@ var require_sync = __commonJS((exports) => {
|
|
|
3425
3425
|
stat.isSymbolicLink = () => true;
|
|
3426
3426
|
}
|
|
3427
3427
|
return stat;
|
|
3428
|
-
} catch (
|
|
3428
|
+
} catch (error48) {
|
|
3429
3429
|
if (!settings.throwErrorOnBrokenSymbolicLink) {
|
|
3430
3430
|
return lstat;
|
|
3431
3431
|
}
|
|
3432
|
-
throw
|
|
3432
|
+
throw error48;
|
|
3433
3433
|
}
|
|
3434
3434
|
}
|
|
3435
3435
|
exports.read = read;
|
|
@@ -3507,8 +3507,8 @@ var require_out = __commonJS((exports) => {
|
|
|
3507
3507
|
// ../../node_modules/queue-microtask/index.js
|
|
3508
3508
|
var require_queue_microtask = __commonJS((exports, module) => {
|
|
3509
3509
|
/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
3510
|
-
var
|
|
3511
|
-
module.exports = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : global) : (cb) => (
|
|
3510
|
+
var promise2;
|
|
3511
|
+
module.exports = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : global) : (cb) => (promise2 || (promise2 = Promise.resolve())).then(cb).catch((err) => setTimeout(() => {
|
|
3512
3512
|
throw err;
|
|
3513
3513
|
}, 0));
|
|
3514
3514
|
});
|
|
@@ -3555,8 +3555,8 @@ var require_run_parallel = __commonJS((exports, module) => {
|
|
|
3555
3555
|
});
|
|
3556
3556
|
});
|
|
3557
3557
|
} else {
|
|
3558
|
-
tasks.forEach(function(
|
|
3559
|
-
|
|
3558
|
+
tasks.forEach(function(task2, i) {
|
|
3559
|
+
task2(function(err, result) {
|
|
3560
3560
|
each(i, err, result);
|
|
3561
3561
|
});
|
|
3562
3562
|
});
|
|
@@ -3634,7 +3634,7 @@ var require_async2 = __commonJS((exports) => {
|
|
|
3634
3634
|
var rpl = require_run_parallel();
|
|
3635
3635
|
var constants_1 = require_constants3();
|
|
3636
3636
|
var utils = require_utils4();
|
|
3637
|
-
var
|
|
3637
|
+
var common2 = require_common();
|
|
3638
3638
|
function read(directory, settings, callback) {
|
|
3639
3639
|
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
3640
3640
|
readdirWithFileTypes(directory, settings, callback);
|
|
@@ -3652,7 +3652,7 @@ var require_async2 = __commonJS((exports) => {
|
|
|
3652
3652
|
const entries = dirents.map((dirent) => ({
|
|
3653
3653
|
dirent,
|
|
3654
3654
|
name: dirent.name,
|
|
3655
|
-
path:
|
|
3655
|
+
path: common2.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
|
|
3656
3656
|
}));
|
|
3657
3657
|
if (!settings.followSymbolicLinks) {
|
|
3658
3658
|
callSuccessCallback(callback, entries);
|
|
@@ -3696,11 +3696,11 @@ var require_async2 = __commonJS((exports) => {
|
|
|
3696
3696
|
return;
|
|
3697
3697
|
}
|
|
3698
3698
|
const tasks = names.map((name) => {
|
|
3699
|
-
const path =
|
|
3699
|
+
const path = common2.joinPathSegments(directory, name, settings.pathSegmentSeparator);
|
|
3700
3700
|
return (done) => {
|
|
3701
|
-
fsStat.stat(path, settings.fsStatSettings, (
|
|
3702
|
-
if (
|
|
3703
|
-
done(
|
|
3701
|
+
fsStat.stat(path, settings.fsStatSettings, (error48, stats) => {
|
|
3702
|
+
if (error48 !== null) {
|
|
3703
|
+
done(error48);
|
|
3704
3704
|
return;
|
|
3705
3705
|
}
|
|
3706
3706
|
const entry = {
|
|
@@ -3725,8 +3725,8 @@ var require_async2 = __commonJS((exports) => {
|
|
|
3725
3725
|
});
|
|
3726
3726
|
}
|
|
3727
3727
|
exports.readdir = readdir;
|
|
3728
|
-
function callFailureCallback(callback,
|
|
3729
|
-
callback(
|
|
3728
|
+
function callFailureCallback(callback, error48) {
|
|
3729
|
+
callback(error48);
|
|
3730
3730
|
}
|
|
3731
3731
|
function callSuccessCallback(callback, result) {
|
|
3732
3732
|
callback(null, result);
|
|
@@ -3740,7 +3740,7 @@ var require_sync2 = __commonJS((exports) => {
|
|
|
3740
3740
|
var fsStat = require_out();
|
|
3741
3741
|
var constants_1 = require_constants3();
|
|
3742
3742
|
var utils = require_utils4();
|
|
3743
|
-
var
|
|
3743
|
+
var common2 = require_common();
|
|
3744
3744
|
function read(directory, settings) {
|
|
3745
3745
|
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
3746
3746
|
return readdirWithFileTypes(directory, settings);
|
|
@@ -3754,15 +3754,15 @@ var require_sync2 = __commonJS((exports) => {
|
|
|
3754
3754
|
const entry = {
|
|
3755
3755
|
dirent,
|
|
3756
3756
|
name: dirent.name,
|
|
3757
|
-
path:
|
|
3757
|
+
path: common2.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
|
|
3758
3758
|
};
|
|
3759
3759
|
if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) {
|
|
3760
3760
|
try {
|
|
3761
3761
|
const stats = settings.fs.statSync(entry.path);
|
|
3762
3762
|
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
|
|
3763
|
-
} catch (
|
|
3763
|
+
} catch (error48) {
|
|
3764
3764
|
if (settings.throwErrorOnBrokenSymbolicLink) {
|
|
3765
|
-
throw
|
|
3765
|
+
throw error48;
|
|
3766
3766
|
}
|
|
3767
3767
|
}
|
|
3768
3768
|
}
|
|
@@ -3773,7 +3773,7 @@ var require_sync2 = __commonJS((exports) => {
|
|
|
3773
3773
|
function readdir(directory, settings) {
|
|
3774
3774
|
const names = settings.fs.readdirSync(directory);
|
|
3775
3775
|
return names.map((name) => {
|
|
3776
|
-
const entryPath =
|
|
3776
|
+
const entryPath = common2.joinPathSegments(directory, name, settings.pathSegmentSeparator);
|
|
3777
3777
|
const stats = fsStat.statSync(entryPath, settings.fsStatSettings);
|
|
3778
3778
|
const entry = {
|
|
3779
3779
|
name,
|
|
@@ -3943,7 +3943,7 @@ var require_queue = __commonJS((exports, module) => {
|
|
|
3943
3943
|
empty: noop2,
|
|
3944
3944
|
kill,
|
|
3945
3945
|
killAndDrain,
|
|
3946
|
-
error,
|
|
3946
|
+
error: error48,
|
|
3947
3947
|
abort
|
|
3948
3948
|
};
|
|
3949
3949
|
return self2;
|
|
@@ -4086,7 +4086,7 @@ var require_queue = __commonJS((exports, module) => {
|
|
|
4086
4086
|
}
|
|
4087
4087
|
self2.drain = noop2;
|
|
4088
4088
|
}
|
|
4089
|
-
function
|
|
4089
|
+
function error48(handler) {
|
|
4090
4090
|
errorHandler = handler;
|
|
4091
4091
|
}
|
|
4092
4092
|
}
|
|
@@ -4183,11 +4183,11 @@ var require_queue = __commonJS((exports, module) => {
|
|
|
4183
4183
|
var require_common2 = __commonJS((exports) => {
|
|
4184
4184
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4185
4185
|
exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = undefined;
|
|
4186
|
-
function isFatalError(settings,
|
|
4186
|
+
function isFatalError(settings, error48) {
|
|
4187
4187
|
if (settings.errorFilter === null) {
|
|
4188
4188
|
return true;
|
|
4189
4189
|
}
|
|
4190
|
-
return !settings.errorFilter(
|
|
4190
|
+
return !settings.errorFilter(error48);
|
|
4191
4191
|
}
|
|
4192
4192
|
exports.isFatalError = isFatalError;
|
|
4193
4193
|
function isAppliedFilter(filter, value) {
|
|
@@ -4213,13 +4213,13 @@ var require_common2 = __commonJS((exports) => {
|
|
|
4213
4213
|
// ../../node_modules/@nodelib/fs.walk/out/readers/reader.js
|
|
4214
4214
|
var require_reader = __commonJS((exports) => {
|
|
4215
4215
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4216
|
-
var
|
|
4216
|
+
var common2 = require_common2();
|
|
4217
4217
|
|
|
4218
4218
|
class Reader {
|
|
4219
4219
|
constructor(_root, _settings) {
|
|
4220
4220
|
this._root = _root;
|
|
4221
4221
|
this._settings = _settings;
|
|
4222
|
-
this._root =
|
|
4222
|
+
this._root = common2.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
|
|
4223
4223
|
}
|
|
4224
4224
|
}
|
|
4225
4225
|
exports.default = Reader;
|
|
@@ -4231,7 +4231,7 @@ var require_async3 = __commonJS((exports) => {
|
|
|
4231
4231
|
var events_1 = __require("events");
|
|
4232
4232
|
var fsScandir = require_out2();
|
|
4233
4233
|
var fastq = require_queue();
|
|
4234
|
-
var
|
|
4234
|
+
var common2 = require_common2();
|
|
4235
4235
|
var reader_1 = require_reader();
|
|
4236
4236
|
|
|
4237
4237
|
class AsyncReader extends reader_1.default {
|
|
@@ -4278,16 +4278,16 @@ var require_async3 = __commonJS((exports) => {
|
|
|
4278
4278
|
}
|
|
4279
4279
|
_pushToQueue(directory, base) {
|
|
4280
4280
|
const queueItem = { directory, base };
|
|
4281
|
-
this._queue.push(queueItem, (
|
|
4282
|
-
if (
|
|
4283
|
-
this._handleError(
|
|
4281
|
+
this._queue.push(queueItem, (error48) => {
|
|
4282
|
+
if (error48 !== null) {
|
|
4283
|
+
this._handleError(error48);
|
|
4284
4284
|
}
|
|
4285
4285
|
});
|
|
4286
4286
|
}
|
|
4287
4287
|
_worker(item, done) {
|
|
4288
|
-
this._scandir(item.directory, this._settings.fsScandirSettings, (
|
|
4289
|
-
if (
|
|
4290
|
-
done(
|
|
4288
|
+
this._scandir(item.directory, this._settings.fsScandirSettings, (error48, entries) => {
|
|
4289
|
+
if (error48 !== null) {
|
|
4290
|
+
done(error48, undefined);
|
|
4291
4291
|
return;
|
|
4292
4292
|
}
|
|
4293
4293
|
for (const entry of entries) {
|
|
@@ -4296,13 +4296,13 @@ var require_async3 = __commonJS((exports) => {
|
|
|
4296
4296
|
done(null, undefined);
|
|
4297
4297
|
});
|
|
4298
4298
|
}
|
|
4299
|
-
_handleError(
|
|
4300
|
-
if (this._isDestroyed || !
|
|
4299
|
+
_handleError(error48) {
|
|
4300
|
+
if (this._isDestroyed || !common2.isFatalError(this._settings, error48)) {
|
|
4301
4301
|
return;
|
|
4302
4302
|
}
|
|
4303
4303
|
this._isFatalError = true;
|
|
4304
4304
|
this._isDestroyed = true;
|
|
4305
|
-
this._emitter.emit("error",
|
|
4305
|
+
this._emitter.emit("error", error48);
|
|
4306
4306
|
}
|
|
4307
4307
|
_handleEntry(entry, base) {
|
|
4308
4308
|
if (this._isDestroyed || this._isFatalError) {
|
|
@@ -4310,12 +4310,12 @@ var require_async3 = __commonJS((exports) => {
|
|
|
4310
4310
|
}
|
|
4311
4311
|
const fullpath = entry.path;
|
|
4312
4312
|
if (base !== undefined) {
|
|
4313
|
-
entry.path =
|
|
4313
|
+
entry.path = common2.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
|
|
4314
4314
|
}
|
|
4315
|
-
if (
|
|
4315
|
+
if (common2.isAppliedFilter(this._settings.entryFilter, entry)) {
|
|
4316
4316
|
this._emitEntry(entry);
|
|
4317
4317
|
}
|
|
4318
|
-
if (entry.dirent.isDirectory() &&
|
|
4318
|
+
if (entry.dirent.isDirectory() && common2.isAppliedFilter(this._settings.deepFilter, entry)) {
|
|
4319
4319
|
this._pushToQueue(fullpath, base === undefined ? undefined : entry.path);
|
|
4320
4320
|
}
|
|
4321
4321
|
}
|
|
@@ -4339,8 +4339,8 @@ var require_async4 = __commonJS((exports) => {
|
|
|
4339
4339
|
this._storage = [];
|
|
4340
4340
|
}
|
|
4341
4341
|
read(callback) {
|
|
4342
|
-
this._reader.onError((
|
|
4343
|
-
callFailureCallback(callback,
|
|
4342
|
+
this._reader.onError((error48) => {
|
|
4343
|
+
callFailureCallback(callback, error48);
|
|
4344
4344
|
});
|
|
4345
4345
|
this._reader.onEntry((entry) => {
|
|
4346
4346
|
this._storage.push(entry);
|
|
@@ -4352,8 +4352,8 @@ var require_async4 = __commonJS((exports) => {
|
|
|
4352
4352
|
}
|
|
4353
4353
|
}
|
|
4354
4354
|
exports.default = AsyncProvider;
|
|
4355
|
-
function callFailureCallback(callback,
|
|
4356
|
-
callback(
|
|
4355
|
+
function callFailureCallback(callback, error48) {
|
|
4356
|
+
callback(error48);
|
|
4357
4357
|
}
|
|
4358
4358
|
function callSuccessCallback(callback, entries) {
|
|
4359
4359
|
callback(null, entries);
|
|
@@ -4382,8 +4382,8 @@ var require_stream2 = __commonJS((exports) => {
|
|
|
4382
4382
|
});
|
|
4383
4383
|
}
|
|
4384
4384
|
read() {
|
|
4385
|
-
this._reader.onError((
|
|
4386
|
-
this._stream.emit("error",
|
|
4385
|
+
this._reader.onError((error48) => {
|
|
4386
|
+
this._stream.emit("error", error48);
|
|
4387
4387
|
});
|
|
4388
4388
|
this._reader.onEntry((entry) => {
|
|
4389
4389
|
this._stream.push(entry);
|
|
@@ -4402,7 +4402,7 @@ var require_stream2 = __commonJS((exports) => {
|
|
|
4402
4402
|
var require_sync3 = __commonJS((exports) => {
|
|
4403
4403
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4404
4404
|
var fsScandir = require_out2();
|
|
4405
|
-
var
|
|
4405
|
+
var common2 = require_common2();
|
|
4406
4406
|
var reader_1 = require_reader();
|
|
4407
4407
|
|
|
4408
4408
|
class SyncReader extends reader_1.default {
|
|
@@ -4431,25 +4431,25 @@ var require_sync3 = __commonJS((exports) => {
|
|
|
4431
4431
|
for (const entry of entries) {
|
|
4432
4432
|
this._handleEntry(entry, base);
|
|
4433
4433
|
}
|
|
4434
|
-
} catch (
|
|
4435
|
-
this._handleError(
|
|
4434
|
+
} catch (error48) {
|
|
4435
|
+
this._handleError(error48);
|
|
4436
4436
|
}
|
|
4437
4437
|
}
|
|
4438
|
-
_handleError(
|
|
4439
|
-
if (!
|
|
4438
|
+
_handleError(error48) {
|
|
4439
|
+
if (!common2.isFatalError(this._settings, error48)) {
|
|
4440
4440
|
return;
|
|
4441
4441
|
}
|
|
4442
|
-
throw
|
|
4442
|
+
throw error48;
|
|
4443
4443
|
}
|
|
4444
4444
|
_handleEntry(entry, base) {
|
|
4445
4445
|
const fullpath = entry.path;
|
|
4446
4446
|
if (base !== undefined) {
|
|
4447
|
-
entry.path =
|
|
4447
|
+
entry.path = common2.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
|
|
4448
4448
|
}
|
|
4449
|
-
if (
|
|
4449
|
+
if (common2.isAppliedFilter(this._settings.entryFilter, entry)) {
|
|
4450
4450
|
this._pushToStorage(entry);
|
|
4451
4451
|
}
|
|
4452
|
-
if (entry.dirent.isDirectory() &&
|
|
4452
|
+
if (entry.dirent.isDirectory() && common2.isAppliedFilter(this._settings.deepFilter, entry)) {
|
|
4453
4453
|
this._pushToQueue(fullpath, base === undefined ? undefined : entry.path);
|
|
4454
4454
|
}
|
|
4455
4455
|
}
|
|
@@ -4575,8 +4575,8 @@ var require_reader2 = __commonJS((exports) => {
|
|
|
4575
4575
|
}
|
|
4576
4576
|
return entry;
|
|
4577
4577
|
}
|
|
4578
|
-
_isFatalError(
|
|
4579
|
-
return !utils.errno.isEnoentCodeError(
|
|
4578
|
+
_isFatalError(error48) {
|
|
4579
|
+
return !utils.errno.isEnoentCodeError(error48) && !this._settings.suppressErrors;
|
|
4580
4580
|
}
|
|
4581
4581
|
}
|
|
4582
4582
|
exports.default = Reader;
|
|
@@ -4619,17 +4619,17 @@ var require_stream3 = __commonJS((exports) => {
|
|
|
4619
4619
|
return stream;
|
|
4620
4620
|
}
|
|
4621
4621
|
_getEntry(filepath, pattern, options) {
|
|
4622
|
-
return this._getStat(filepath).then((stats) => this._makeEntry(stats, pattern)).catch((
|
|
4623
|
-
if (options.errorFilter(
|
|
4622
|
+
return this._getStat(filepath).then((stats) => this._makeEntry(stats, pattern)).catch((error48) => {
|
|
4623
|
+
if (options.errorFilter(error48)) {
|
|
4624
4624
|
return null;
|
|
4625
4625
|
}
|
|
4626
|
-
throw
|
|
4626
|
+
throw error48;
|
|
4627
4627
|
});
|
|
4628
4628
|
}
|
|
4629
4629
|
_getStat(filepath) {
|
|
4630
4630
|
return new Promise((resolve, reject) => {
|
|
4631
|
-
this._stat(filepath, this._fsStatSettings, (
|
|
4632
|
-
return
|
|
4631
|
+
this._stat(filepath, this._fsStatSettings, (error48, stats) => {
|
|
4632
|
+
return error48 === null ? resolve(stats) : reject(error48);
|
|
4633
4633
|
});
|
|
4634
4634
|
});
|
|
4635
4635
|
}
|
|
@@ -4652,11 +4652,11 @@ var require_async5 = __commonJS((exports) => {
|
|
|
4652
4652
|
}
|
|
4653
4653
|
dynamic(root, options) {
|
|
4654
4654
|
return new Promise((resolve, reject) => {
|
|
4655
|
-
this._walkAsync(root, options, (
|
|
4656
|
-
if (
|
|
4655
|
+
this._walkAsync(root, options, (error48, entries) => {
|
|
4656
|
+
if (error48 === null) {
|
|
4657
4657
|
resolve(entries);
|
|
4658
4658
|
} else {
|
|
4659
|
-
reject(
|
|
4659
|
+
reject(error48);
|
|
4660
4660
|
}
|
|
4661
4661
|
});
|
|
4662
4662
|
});
|
|
@@ -4917,10 +4917,10 @@ var require_error = __commonJS((exports) => {
|
|
|
4917
4917
|
this._settings = _settings;
|
|
4918
4918
|
}
|
|
4919
4919
|
getFilter() {
|
|
4920
|
-
return (
|
|
4920
|
+
return (error48) => this._isNonFatalError(error48);
|
|
4921
4921
|
}
|
|
4922
|
-
_isNonFatalError(
|
|
4923
|
-
return utils.errno.isEnoentCodeError(
|
|
4922
|
+
_isNonFatalError(error48) {
|
|
4923
|
+
return utils.errno.isEnoentCodeError(error48) || this._settings.suppressErrors;
|
|
4924
4924
|
}
|
|
4925
4925
|
}
|
|
4926
4926
|
exports.default = ErrorFilter;
|
|
@@ -4973,17 +4973,17 @@ var require_provider = __commonJS((exports) => {
|
|
|
4973
4973
|
this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions());
|
|
4974
4974
|
this.entryTransformer = new entry_2.default(this._settings);
|
|
4975
4975
|
}
|
|
4976
|
-
_getRootDirectory(
|
|
4977
|
-
return path.resolve(this._settings.cwd,
|
|
4976
|
+
_getRootDirectory(task2) {
|
|
4977
|
+
return path.resolve(this._settings.cwd, task2.base);
|
|
4978
4978
|
}
|
|
4979
|
-
_getReaderOptions(
|
|
4980
|
-
const basePath =
|
|
4979
|
+
_getReaderOptions(task2) {
|
|
4980
|
+
const basePath = task2.base === "." ? "" : task2.base;
|
|
4981
4981
|
return {
|
|
4982
4982
|
basePath,
|
|
4983
4983
|
pathSegmentSeparator: "/",
|
|
4984
4984
|
concurrency: this._settings.concurrency,
|
|
4985
|
-
deepFilter: this.deepFilter.getFilter(basePath,
|
|
4986
|
-
entryFilter: this.entryFilter.getFilter(
|
|
4985
|
+
deepFilter: this.deepFilter.getFilter(basePath, task2.positive, task2.negative),
|
|
4986
|
+
entryFilter: this.entryFilter.getFilter(task2.positive, task2.negative),
|
|
4987
4987
|
errorFilter: this.errorFilter.getFilter(),
|
|
4988
4988
|
followSymbolicLinks: this._settings.followSymbolicLinks,
|
|
4989
4989
|
fs: this._settings.fs,
|
|
@@ -5019,17 +5019,17 @@ var require_async6 = __commonJS((exports) => {
|
|
|
5019
5019
|
super(...arguments);
|
|
5020
5020
|
this._reader = new async_1.default(this._settings);
|
|
5021
5021
|
}
|
|
5022
|
-
async read(
|
|
5023
|
-
const root = this._getRootDirectory(
|
|
5024
|
-
const options = this._getReaderOptions(
|
|
5025
|
-
const entries = await this.api(root,
|
|
5022
|
+
async read(task2) {
|
|
5023
|
+
const root = this._getRootDirectory(task2);
|
|
5024
|
+
const options = this._getReaderOptions(task2);
|
|
5025
|
+
const entries = await this.api(root, task2, options);
|
|
5026
5026
|
return entries.map((entry) => options.transform(entry));
|
|
5027
5027
|
}
|
|
5028
|
-
api(root,
|
|
5029
|
-
if (
|
|
5028
|
+
api(root, task2, options) {
|
|
5029
|
+
if (task2.dynamic) {
|
|
5030
5030
|
return this._reader.dynamic(root, options);
|
|
5031
5031
|
}
|
|
5032
|
-
return this._reader.static(
|
|
5032
|
+
return this._reader.static(task2.patterns, options);
|
|
5033
5033
|
}
|
|
5034
5034
|
}
|
|
5035
5035
|
exports.default = ProviderAsync;
|
|
@@ -5047,20 +5047,20 @@ var require_stream4 = __commonJS((exports) => {
|
|
|
5047
5047
|
super(...arguments);
|
|
5048
5048
|
this._reader = new stream_2.default(this._settings);
|
|
5049
5049
|
}
|
|
5050
|
-
read(
|
|
5051
|
-
const root = this._getRootDirectory(
|
|
5052
|
-
const options = this._getReaderOptions(
|
|
5053
|
-
const source = this.api(root,
|
|
5050
|
+
read(task2) {
|
|
5051
|
+
const root = this._getRootDirectory(task2);
|
|
5052
|
+
const options = this._getReaderOptions(task2);
|
|
5053
|
+
const source = this.api(root, task2, options);
|
|
5054
5054
|
const destination = new stream_1.Readable({ objectMode: true, read: () => {} });
|
|
5055
|
-
source.once("error", (
|
|
5055
|
+
source.once("error", (error48) => destination.emit("error", error48)).on("data", (entry) => destination.emit("data", options.transform(entry))).once("end", () => destination.emit("end"));
|
|
5056
5056
|
destination.once("close", () => source.destroy());
|
|
5057
5057
|
return destination;
|
|
5058
5058
|
}
|
|
5059
|
-
api(root,
|
|
5060
|
-
if (
|
|
5059
|
+
api(root, task2, options) {
|
|
5060
|
+
if (task2.dynamic) {
|
|
5061
5061
|
return this._reader.dynamic(root, options);
|
|
5062
5062
|
}
|
|
5063
|
-
return this._reader.static(
|
|
5063
|
+
return this._reader.static(task2.patterns, options);
|
|
5064
5064
|
}
|
|
5065
5065
|
}
|
|
5066
5066
|
exports.default = ProviderStream;
|
|
@@ -5098,11 +5098,11 @@ var require_sync5 = __commonJS((exports) => {
|
|
|
5098
5098
|
try {
|
|
5099
5099
|
const stats = this._getStat(filepath);
|
|
5100
5100
|
return this._makeEntry(stats, pattern);
|
|
5101
|
-
} catch (
|
|
5102
|
-
if (options.errorFilter(
|
|
5101
|
+
} catch (error48) {
|
|
5102
|
+
if (options.errorFilter(error48)) {
|
|
5103
5103
|
return null;
|
|
5104
5104
|
}
|
|
5105
|
-
throw
|
|
5105
|
+
throw error48;
|
|
5106
5106
|
}
|
|
5107
5107
|
}
|
|
5108
5108
|
_getStat(filepath) {
|
|
@@ -5123,17 +5123,17 @@ var require_sync6 = __commonJS((exports) => {
|
|
|
5123
5123
|
super(...arguments);
|
|
5124
5124
|
this._reader = new sync_1.default(this._settings);
|
|
5125
5125
|
}
|
|
5126
|
-
read(
|
|
5127
|
-
const root = this._getRootDirectory(
|
|
5128
|
-
const options = this._getReaderOptions(
|
|
5129
|
-
const entries = this.api(root,
|
|
5126
|
+
read(task2) {
|
|
5127
|
+
const root = this._getRootDirectory(task2);
|
|
5128
|
+
const options = this._getReaderOptions(task2);
|
|
5129
|
+
const entries = this.api(root, task2, options);
|
|
5130
5130
|
return entries.map(options.transform);
|
|
5131
5131
|
}
|
|
5132
|
-
api(root,
|
|
5133
|
-
if (
|
|
5132
|
+
api(root, task2, options) {
|
|
5133
|
+
if (task2.dynamic) {
|
|
5134
5134
|
return this._reader.dynamic(root, options);
|
|
5135
5135
|
}
|
|
5136
|
-
return this._reader.static(
|
|
5136
|
+
return this._reader.static(task2.patterns, options);
|
|
5137
5137
|
}
|
|
5138
5138
|
}
|
|
5139
5139
|
exports.default = ProviderSync;
|
|
@@ -5317,8 +5317,8 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
5317
5317
|
TMP_KEY_IGNORE = Symbol.for("node-ignore");
|
|
5318
5318
|
}
|
|
5319
5319
|
var KEY_IGNORE = TMP_KEY_IGNORE;
|
|
5320
|
-
var define = (
|
|
5321
|
-
Object.defineProperty(
|
|
5320
|
+
var define = (object2, key, value) => {
|
|
5321
|
+
Object.defineProperty(object2, key, { value });
|
|
5322
5322
|
return value;
|
|
5323
5323
|
};
|
|
5324
5324
|
var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
|
|
@@ -14402,17 +14402,6 @@ var require_db = __commonJS((exports, module) => {
|
|
|
14402
14402
|
};
|
|
14403
14403
|
});
|
|
14404
14404
|
|
|
14405
|
-
// ../../node_modules/form-data/node_modules/mime-types/node_modules/mime-db/index.js
|
|
14406
|
-
var require_mime_db = __commonJS((exports, module) => {
|
|
14407
|
-
/*!
|
|
14408
|
-
* mime-db
|
|
14409
|
-
* Copyright(c) 2014 Jonathan Ong
|
|
14410
|
-
* Copyright(c) 2015-2022 Douglas Christopher Wilson
|
|
14411
|
-
* MIT Licensed
|
|
14412
|
-
*/
|
|
14413
|
-
module.exports = require_db();
|
|
14414
|
-
});
|
|
14415
|
-
|
|
14416
14405
|
// ../../node_modules/form-data/node_modules/mime-types/index.js
|
|
14417
14406
|
var require_mime_types = __commonJS((exports) => {
|
|
14418
14407
|
/*!
|
|
@@ -14421,7 +14410,7 @@ var require_mime_types = __commonJS((exports) => {
|
|
|
14421
14410
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
14422
14411
|
* MIT Licensed
|
|
14423
14412
|
*/
|
|
14424
|
-
var db =
|
|
14413
|
+
var db = require_db();
|
|
14425
14414
|
var extname = __require("path").extname;
|
|
14426
14415
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
14427
14416
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
@@ -14768,7 +14757,7 @@ var require_round = __commonJS((exports, module) => {
|
|
|
14768
14757
|
|
|
14769
14758
|
// ../../node_modules/math-intrinsics/isNaN.js
|
|
14770
14759
|
var require_isNaN = __commonJS((exports, module) => {
|
|
14771
|
-
module.exports = Number.isNaN || function
|
|
14760
|
+
module.exports = Number.isNaN || function isNaN2(a) {
|
|
14772
14761
|
return a !== a;
|
|
14773
14762
|
};
|
|
14774
14763
|
});
|
|
@@ -14902,7 +14891,7 @@ var require_implementation = __commonJS((exports, module) => {
|
|
|
14902
14891
|
var toStr = Object.prototype.toString;
|
|
14903
14892
|
var max = Math.max;
|
|
14904
14893
|
var funcType = "[object Function]";
|
|
14905
|
-
var concatty = function
|
|
14894
|
+
var concatty = function concatty2(a, b) {
|
|
14906
14895
|
var arr = [];
|
|
14907
14896
|
for (var i = 0;i < a.length; i += 1) {
|
|
14908
14897
|
arr[i] = a[i];
|
|
@@ -14912,7 +14901,7 @@ var require_implementation = __commonJS((exports, module) => {
|
|
|
14912
14901
|
}
|
|
14913
14902
|
return arr;
|
|
14914
14903
|
};
|
|
14915
|
-
var slicy = function
|
|
14904
|
+
var slicy = function slicy2(arrLike, offset) {
|
|
14916
14905
|
var arr = [];
|
|
14917
14906
|
for (var i = offset || 0, j = 0;i < arrLike.length; i += 1, j += 1) {
|
|
14918
14907
|
arr[j] = arrLike[i];
|
|
@@ -14929,7 +14918,7 @@ var require_implementation = __commonJS((exports, module) => {
|
|
|
14929
14918
|
}
|
|
14930
14919
|
return str;
|
|
14931
14920
|
};
|
|
14932
|
-
module.exports = function
|
|
14921
|
+
module.exports = function bind2(that) {
|
|
14933
14922
|
var target = this;
|
|
14934
14923
|
if (typeof target !== "function" || toStr.apply(target) !== funcType) {
|
|
14935
14924
|
throw new TypeError(ERROR_MESSAGE + target);
|
|
@@ -14953,7 +14942,7 @@ var require_implementation = __commonJS((exports, module) => {
|
|
|
14953
14942
|
}
|
|
14954
14943
|
bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
|
|
14955
14944
|
if (target.prototype) {
|
|
14956
|
-
var Empty = function
|
|
14945
|
+
var Empty = function Empty2() {};
|
|
14957
14946
|
Empty.prototype = target.prototype;
|
|
14958
14947
|
bound.prototype = new Empty;
|
|
14959
14948
|
Empty.prototype = null;
|
|
@@ -15192,7 +15181,7 @@ var require_get_intrinsic = __commonJS((exports, module) => {
|
|
|
15192
15181
|
}
|
|
15193
15182
|
}
|
|
15194
15183
|
var errorProto;
|
|
15195
|
-
var doEval = function
|
|
15184
|
+
var doEval = function doEval2(name) {
|
|
15196
15185
|
var value;
|
|
15197
15186
|
if (name === "%AsyncFunction%") {
|
|
15198
15187
|
value = getEvalledConstructor("async function () {}");
|
|
@@ -15201,12 +15190,12 @@ var require_get_intrinsic = __commonJS((exports, module) => {
|
|
|
15201
15190
|
} else if (name === "%AsyncGeneratorFunction%") {
|
|
15202
15191
|
value = getEvalledConstructor("async function* () {}");
|
|
15203
15192
|
} else if (name === "%AsyncGenerator%") {
|
|
15204
|
-
var fn =
|
|
15193
|
+
var fn = doEval2("%AsyncGeneratorFunction%");
|
|
15205
15194
|
if (fn) {
|
|
15206
15195
|
value = fn.prototype;
|
|
15207
15196
|
}
|
|
15208
15197
|
} else if (name === "%AsyncIteratorPrototype%") {
|
|
15209
|
-
var gen =
|
|
15198
|
+
var gen = doEval2("%AsyncGenerator%");
|
|
15210
15199
|
if (gen && getProto) {
|
|
15211
15200
|
value = getProto(gen.prototype);
|
|
15212
15201
|
}
|
|
@@ -15277,7 +15266,7 @@ var require_get_intrinsic = __commonJS((exports, module) => {
|
|
|
15277
15266
|
var $exec = bind2.call($call, RegExp.prototype.exec);
|
|
15278
15267
|
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
|
15279
15268
|
var reEscapeChar = /\\(\\)?/g;
|
|
15280
|
-
var stringToPath = function
|
|
15269
|
+
var stringToPath = function stringToPath2(string4) {
|
|
15281
15270
|
var first = $strSlice(string4, 0, 1);
|
|
15282
15271
|
var last = $strSlice(string4, -1);
|
|
15283
15272
|
if (first === "%" && last !== "%") {
|
|
@@ -15291,7 +15280,7 @@ var require_get_intrinsic = __commonJS((exports, module) => {
|
|
|
15291
15280
|
});
|
|
15292
15281
|
return result;
|
|
15293
15282
|
};
|
|
15294
|
-
var getBaseIntrinsic = function
|
|
15283
|
+
var getBaseIntrinsic = function getBaseIntrinsic2(name, allowMissing) {
|
|
15295
15284
|
var intrinsicName = name;
|
|
15296
15285
|
var alias;
|
|
15297
15286
|
if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
|
|
@@ -17025,7 +17014,7 @@ var require_follow_redirects = __commonJS((exports, module) => {
|
|
|
17025
17014
|
|
|
17026
17015
|
// src/cli.ts
|
|
17027
17016
|
import { existsSync as existsSync7, readFileSync as readFileSync6 } from "node:fs";
|
|
17028
|
-
import { dirname as dirname3, join as
|
|
17017
|
+
import { dirname as dirname3, join as join8 } from "node:path";
|
|
17029
17018
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
17030
17019
|
import { parseArgs } from "node:util";
|
|
17031
17020
|
|
|
@@ -17035,1143 +17024,251 @@ import {
|
|
|
17035
17024
|
mkdirSync,
|
|
17036
17025
|
readdirSync,
|
|
17037
17026
|
readFileSync,
|
|
17038
|
-
statSync
|
|
17027
|
+
statSync,
|
|
17028
|
+
writeFileSync
|
|
17039
17029
|
} from "node:fs";
|
|
17040
17030
|
import { join as join2 } from "node:path";
|
|
17041
17031
|
|
|
17042
|
-
//
|
|
17043
|
-
|
|
17044
|
-
|
|
17045
|
-
|
|
17046
|
-
|
|
17047
|
-
|
|
17048
|
-
|
|
17049
|
-
|
|
17050
|
-
|
|
17051
|
-
|
|
17052
|
-
|
|
17053
|
-
|
|
17054
|
-
|
|
17055
|
-
|
|
17056
|
-
|
|
17057
|
-
|
|
17058
|
-
|
|
17059
|
-
|
|
17060
|
-
|
|
17061
|
-
|
|
17062
|
-
|
|
17063
|
-
|
|
17064
|
-
|
|
17065
|
-
|
|
17066
|
-
|
|
17067
|
-
|
|
17068
|
-
|
|
17069
|
-
|
|
17070
|
-
|
|
17071
|
-
|
|
17072
|
-
|
|
17073
|
-
|
|
17074
|
-
|
|
17075
|
-
|
|
17076
|
-
|
|
17077
|
-
|
|
17078
|
-
|
|
17079
|
-
|
|
17080
|
-
|
|
17081
|
-
|
|
17082
|
-
|
|
17083
|
-
|
|
17084
|
-
|
|
17085
|
-
|
|
17086
|
-
|
|
17087
|
-
|
|
17088
|
-
|
|
17089
|
-
|
|
17090
|
-
|
|
17091
|
-
|
|
17092
|
-
|
|
17093
|
-
|
|
17094
|
-
|
|
17095
|
-
|
|
17096
|
-
|
|
17097
|
-
|
|
17098
|
-
|
|
17099
|
-
|
|
17100
|
-
|
|
17101
|
-
|
|
17102
|
-
|
|
17103
|
-
|
|
17104
|
-
|
|
17105
|
-
|
|
17106
|
-
|
|
17107
|
-
|
|
17108
|
-
|
|
17109
|
-
|
|
17110
|
-
|
|
17111
|
-
|
|
17112
|
-
|
|
17113
|
-
|
|
17114
|
-
|
|
17115
|
-
|
|
17116
|
-
|
|
17117
|
-
|
|
17118
|
-
|
|
17119
|
-
|
|
17120
|
-
|
|
17121
|
-
|
|
17122
|
-
|
|
17123
|
-
|
|
17124
|
-
|
|
17125
|
-
|
|
17126
|
-
|
|
17127
|
-
|
|
17128
|
-
|
|
17129
|
-
|
|
17130
|
-
|
|
17131
|
-
|
|
17132
|
-
|
|
17133
|
-
|
|
17134
|
-
|
|
17135
|
-
|
|
17136
|
-
|
|
17137
|
-
|
|
17138
|
-
|
|
17139
|
-
|
|
17140
|
-
|
|
17141
|
-
|
|
17142
|
-
|
|
17143
|
-
|
|
17144
|
-
|
|
17145
|
-
|
|
17146
|
-
|
|
17147
|
-
|
|
17148
|
-
|
|
17149
|
-
|
|
17150
|
-
|
|
17151
|
-
|
|
17152
|
-
|
|
17153
|
-
|
|
17154
|
-
|
|
17155
|
-
|
|
17156
|
-
|
|
17157
|
-
|
|
17158
|
-
|
|
17159
|
-
|
|
17160
|
-
|
|
17161
|
-
|
|
17162
|
-
|
|
17163
|
-
|
|
17164
|
-
|
|
17165
|
-
|
|
17166
|
-
|
|
17167
|
-
|
|
17168
|
-
|
|
17169
|
-
|
|
17170
|
-
|
|
17171
|
-
|
|
17172
|
-
|
|
17173
|
-
|
|
17174
|
-
|
|
17175
|
-
|
|
17176
|
-
|
|
17177
|
-
|
|
17178
|
-
|
|
17179
|
-
|
|
17180
|
-
|
|
17181
|
-
|
|
17182
|
-
|
|
17183
|
-
|
|
17184
|
-
|
|
17185
|
-
|
|
17186
|
-
|
|
17187
|
-
|
|
17188
|
-
|
|
17189
|
-
|
|
17190
|
-
|
|
17191
|
-
|
|
17192
|
-
|
|
17193
|
-
|
|
17194
|
-
|
|
17195
|
-
|
|
17196
|
-
|
|
17197
|
-
|
|
17198
|
-
|
|
17199
|
-
|
|
17200
|
-
|
|
17201
|
-
|
|
17202
|
-
|
|
17203
|
-
|
|
17204
|
-
|
|
17205
|
-
|
|
17206
|
-
|
|
17207
|
-
|
|
17208
|
-
|
|
17209
|
-
|
|
17210
|
-
|
|
17211
|
-
|
|
17212
|
-
|
|
17213
|
-
|
|
17214
|
-
|
|
17215
|
-
|
|
17216
|
-
|
|
17217
|
-
|
|
17218
|
-
|
|
17219
|
-
|
|
17220
|
-
|
|
17221
|
-
|
|
17222
|
-
|
|
17223
|
-
|
|
17224
|
-
|
|
17225
|
-
|
|
17226
|
-
|
|
17227
|
-
|
|
17228
|
-
|
|
17229
|
-
|
|
17230
|
-
|
|
17231
|
-
|
|
17232
|
-
|
|
17233
|
-
|
|
17234
|
-
|
|
17235
|
-
|
|
17236
|
-
|
|
17237
|
-
|
|
17238
|
-
|
|
17239
|
-
|
|
17240
|
-
|
|
17241
|
-
|
|
17242
|
-
|
|
17243
|
-
|
|
17244
|
-
|
|
17245
|
-
|
|
17246
|
-
|
|
17247
|
-
|
|
17248
|
-
|
|
17249
|
-
|
|
17250
|
-
|
|
17251
|
-
|
|
17252
|
-
|
|
17253
|
-
|
|
17254
|
-
|
|
17255
|
-
|
|
17256
|
-
|
|
17257
|
-
|
|
17258
|
-
|
|
17259
|
-
|
|
17260
|
-
|
|
17261
|
-
|
|
17262
|
-
|
|
17263
|
-
|
|
17264
|
-
|
|
17265
|
-
|
|
17266
|
-
|
|
17267
|
-
|
|
17268
|
-
|
|
17269
|
-
|
|
17270
|
-
|
|
17271
|
-
|
|
17272
|
-
|
|
17273
|
-
|
|
17274
|
-
|
|
17275
|
-
|
|
17276
|
-
|
|
17277
|
-
|
|
17278
|
-
|
|
17279
|
-
|
|
17280
|
-
|
|
17281
|
-
|
|
17282
|
-
}
|
|
17283
|
-
}
|
|
17284
|
-
};
|
|
17285
|
-
var onInputStreamUnpipe = async ({ stream, streams, ended, aborted, controller: { signal } }) => {
|
|
17286
|
-
await once(stream, unpipeEvent, { signal });
|
|
17287
|
-
streams.delete(stream);
|
|
17288
|
-
ended.delete(stream);
|
|
17289
|
-
aborted.delete(stream);
|
|
17290
|
-
};
|
|
17291
|
-
var unpipeEvent = Symbol("unpipe");
|
|
17292
|
-
var endStream = (stream) => {
|
|
17293
|
-
if (stream.writable) {
|
|
17294
|
-
stream.end();
|
|
17295
|
-
}
|
|
17296
|
-
};
|
|
17297
|
-
var abortStream = (stream) => {
|
|
17298
|
-
if (stream.readable || stream.writable) {
|
|
17299
|
-
stream.destroy();
|
|
17300
|
-
}
|
|
17301
|
-
};
|
|
17302
|
-
var errorStream = (stream, error) => {
|
|
17303
|
-
if (!stream.destroyed) {
|
|
17304
|
-
stream.once("error", noop);
|
|
17305
|
-
stream.destroy(error);
|
|
17306
|
-
}
|
|
17307
|
-
};
|
|
17308
|
-
var noop = () => {};
|
|
17309
|
-
var updateMaxListeners = (passThroughStream, increment) => {
|
|
17310
|
-
const maxListeners = passThroughStream.getMaxListeners();
|
|
17311
|
-
if (maxListeners !== 0 && maxListeners !== Number.POSITIVE_INFINITY) {
|
|
17312
|
-
passThroughStream.setMaxListeners(maxListeners + increment);
|
|
17313
|
-
}
|
|
17314
|
-
};
|
|
17315
|
-
var PASSTHROUGH_LISTENERS_COUNT = 2;
|
|
17316
|
-
var PASSTHROUGH_LISTENERS_PER_STREAM = 1;
|
|
17317
|
-
|
|
17318
|
-
// ../../node_modules/globby/index.js
|
|
17319
|
-
var import_fast_glob2 = __toESM(require_out4(), 1);
|
|
17320
|
-
|
|
17321
|
-
// ../../node_modules/path-type/index.js
|
|
17322
|
-
import fs from "node:fs";
|
|
17323
|
-
import fsPromises from "node:fs/promises";
|
|
17324
|
-
async function isType(fsStatType, statsMethodName, filePath) {
|
|
17325
|
-
if (typeof filePath !== "string") {
|
|
17326
|
-
throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
|
17327
|
-
}
|
|
17328
|
-
try {
|
|
17329
|
-
const stats = await fsPromises[fsStatType](filePath);
|
|
17330
|
-
return stats[statsMethodName]();
|
|
17331
|
-
} catch (error) {
|
|
17332
|
-
if (error.code === "ENOENT") {
|
|
17333
|
-
return false;
|
|
17334
|
-
}
|
|
17335
|
-
throw error;
|
|
17336
|
-
}
|
|
17337
|
-
}
|
|
17338
|
-
function isTypeSync(fsStatType, statsMethodName, filePath) {
|
|
17339
|
-
if (typeof filePath !== "string") {
|
|
17340
|
-
throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
|
17341
|
-
}
|
|
17342
|
-
try {
|
|
17343
|
-
return fs[fsStatType](filePath)[statsMethodName]();
|
|
17344
|
-
} catch (error) {
|
|
17345
|
-
if (error.code === "ENOENT") {
|
|
17346
|
-
return false;
|
|
17347
|
-
}
|
|
17348
|
-
throw error;
|
|
17349
|
-
}
|
|
17350
|
-
}
|
|
17351
|
-
var isFile = isType.bind(undefined, "stat", "isFile");
|
|
17352
|
-
var isDirectory = isType.bind(undefined, "stat", "isDirectory");
|
|
17353
|
-
var isSymlink = isType.bind(undefined, "lstat", "isSymbolicLink");
|
|
17354
|
-
var isFileSync = isTypeSync.bind(undefined, "statSync", "isFile");
|
|
17355
|
-
var isDirectorySync = isTypeSync.bind(undefined, "statSync", "isDirectory");
|
|
17356
|
-
var isSymlinkSync = isTypeSync.bind(undefined, "lstatSync", "isSymbolicLink");
|
|
17357
|
-
|
|
17358
|
-
// ../../node_modules/unicorn-magic/node.js
|
|
17359
|
-
import { promisify } from "node:util";
|
|
17360
|
-
import { execFile as execFileCallback, execFileSync as execFileSyncOriginal } from "node:child_process";
|
|
17361
|
-
import { fileURLToPath } from "node:url";
|
|
17362
|
-
var execFileOriginal = promisify(execFileCallback);
|
|
17363
|
-
function toPath(urlOrPath) {
|
|
17364
|
-
return urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
17365
|
-
}
|
|
17366
|
-
var TEN_MEGABYTES_IN_BYTES = 10 * 1024 * 1024;
|
|
17367
|
-
|
|
17368
|
-
// ../../node_modules/globby/ignore.js
|
|
17369
|
-
var import_fast_glob = __toESM(require_out4(), 1);
|
|
17370
|
-
var import_ignore = __toESM(require_ignore(), 1);
|
|
17371
|
-
import process2 from "node:process";
|
|
17372
|
-
import fs2 from "node:fs";
|
|
17373
|
-
import fsPromises2 from "node:fs/promises";
|
|
17374
|
-
import path from "node:path";
|
|
17375
|
-
|
|
17376
|
-
// ../../node_modules/globby/node_modules/slash/index.js
|
|
17377
|
-
function slash(path) {
|
|
17378
|
-
const isExtendedLengthPath = path.startsWith("\\\\?\\");
|
|
17379
|
-
if (isExtendedLengthPath) {
|
|
17380
|
-
return path;
|
|
17381
|
-
}
|
|
17382
|
-
return path.replace(/\\/g, "/");
|
|
17383
|
-
}
|
|
17384
|
-
|
|
17385
|
-
// ../../node_modules/globby/utilities.js
|
|
17386
|
-
var isNegativePattern = (pattern) => pattern[0] === "!";
|
|
17387
|
-
|
|
17388
|
-
// ../../node_modules/globby/ignore.js
|
|
17389
|
-
var defaultIgnoredDirectories = [
|
|
17390
|
-
"**/node_modules",
|
|
17391
|
-
"**/flow-typed",
|
|
17392
|
-
"**/coverage",
|
|
17393
|
-
"**/.git"
|
|
17394
|
-
];
|
|
17395
|
-
var ignoreFilesGlobOptions = {
|
|
17396
|
-
absolute: true,
|
|
17397
|
-
dot: true
|
|
17398
|
-
};
|
|
17399
|
-
var GITIGNORE_FILES_PATTERN = "**/.gitignore";
|
|
17400
|
-
var applyBaseToPattern = (pattern, base) => isNegativePattern(pattern) ? "!" + path.posix.join(base, pattern.slice(1)) : path.posix.join(base, pattern);
|
|
17401
|
-
var parseIgnoreFile = (file, cwd) => {
|
|
17402
|
-
const base = slash(path.relative(cwd, path.dirname(file.filePath)));
|
|
17403
|
-
return file.content.split(/\r?\n/).filter((line) => line && !line.startsWith("#")).map((pattern) => applyBaseToPattern(pattern, base));
|
|
17404
|
-
};
|
|
17405
|
-
var toRelativePath = (fileOrDirectory, cwd) => {
|
|
17406
|
-
cwd = slash(cwd);
|
|
17407
|
-
if (path.isAbsolute(fileOrDirectory)) {
|
|
17408
|
-
if (slash(fileOrDirectory).startsWith(cwd)) {
|
|
17409
|
-
return path.relative(cwd, fileOrDirectory);
|
|
17410
|
-
}
|
|
17411
|
-
throw new Error(`Path ${fileOrDirectory} is not in cwd ${cwd}`);
|
|
17412
|
-
}
|
|
17413
|
-
return fileOrDirectory;
|
|
17414
|
-
};
|
|
17415
|
-
var getIsIgnoredPredicate = (files, cwd) => {
|
|
17416
|
-
const patterns = files.flatMap((file) => parseIgnoreFile(file, cwd));
|
|
17417
|
-
const ignores = import_ignore.default().add(patterns);
|
|
17418
|
-
return (fileOrDirectory) => {
|
|
17419
|
-
fileOrDirectory = toPath(fileOrDirectory);
|
|
17420
|
-
fileOrDirectory = toRelativePath(fileOrDirectory, cwd);
|
|
17421
|
-
return fileOrDirectory ? ignores.ignores(slash(fileOrDirectory)) : false;
|
|
17422
|
-
};
|
|
17423
|
-
};
|
|
17424
|
-
var normalizeOptions = (options = {}) => ({
|
|
17425
|
-
cwd: toPath(options.cwd) ?? process2.cwd(),
|
|
17426
|
-
suppressErrors: Boolean(options.suppressErrors),
|
|
17427
|
-
deep: typeof options.deep === "number" ? options.deep : Number.POSITIVE_INFINITY,
|
|
17428
|
-
ignore: [...options.ignore ?? [], ...defaultIgnoredDirectories]
|
|
17429
|
-
});
|
|
17430
|
-
var isIgnoredByIgnoreFiles = async (patterns, options) => {
|
|
17431
|
-
const { cwd, suppressErrors, deep, ignore } = normalizeOptions(options);
|
|
17432
|
-
const paths = await import_fast_glob.default(patterns, {
|
|
17433
|
-
cwd,
|
|
17434
|
-
suppressErrors,
|
|
17435
|
-
deep,
|
|
17436
|
-
ignore,
|
|
17437
|
-
...ignoreFilesGlobOptions
|
|
17438
|
-
});
|
|
17439
|
-
const files = await Promise.all(paths.map(async (filePath) => ({
|
|
17440
|
-
filePath,
|
|
17441
|
-
content: await fsPromises2.readFile(filePath, "utf8")
|
|
17442
|
-
})));
|
|
17443
|
-
return getIsIgnoredPredicate(files, cwd);
|
|
17444
|
-
};
|
|
17445
|
-
var isIgnoredByIgnoreFilesSync = (patterns, options) => {
|
|
17446
|
-
const { cwd, suppressErrors, deep, ignore } = normalizeOptions(options);
|
|
17447
|
-
const paths = import_fast_glob.default.sync(patterns, {
|
|
17448
|
-
cwd,
|
|
17449
|
-
suppressErrors,
|
|
17450
|
-
deep,
|
|
17451
|
-
ignore,
|
|
17452
|
-
...ignoreFilesGlobOptions
|
|
17453
|
-
});
|
|
17454
|
-
const files = paths.map((filePath) => ({
|
|
17455
|
-
filePath,
|
|
17456
|
-
content: fs2.readFileSync(filePath, "utf8")
|
|
17457
|
-
}));
|
|
17458
|
-
return getIsIgnoredPredicate(files, cwd);
|
|
17459
|
-
};
|
|
17460
|
-
|
|
17461
|
-
// ../../node_modules/globby/index.js
|
|
17462
|
-
var assertPatternsInput = (patterns) => {
|
|
17463
|
-
if (patterns.some((pattern) => typeof pattern !== "string")) {
|
|
17464
|
-
throw new TypeError("Patterns must be a string or an array of strings");
|
|
17465
|
-
}
|
|
17466
|
-
};
|
|
17467
|
-
var normalizePathForDirectoryGlob = (filePath, cwd) => {
|
|
17468
|
-
const path2 = isNegativePattern(filePath) ? filePath.slice(1) : filePath;
|
|
17469
|
-
return nodePath.isAbsolute(path2) ? path2 : nodePath.join(cwd, path2);
|
|
17470
|
-
};
|
|
17471
|
-
var getDirectoryGlob = ({ directoryPath, files, extensions }) => {
|
|
17472
|
-
const extensionGlob = extensions?.length > 0 ? `.${extensions.length > 1 ? `{${extensions.join(",")}}` : extensions[0]}` : "";
|
|
17473
|
-
return files ? files.map((file) => nodePath.posix.join(directoryPath, `**/${nodePath.extname(file) ? file : `${file}${extensionGlob}`}`)) : [nodePath.posix.join(directoryPath, `**${extensionGlob ? `/*${extensionGlob}` : ""}`)];
|
|
17474
|
-
};
|
|
17475
|
-
var directoryToGlob = async (directoryPaths, {
|
|
17476
|
-
cwd = process3.cwd(),
|
|
17477
|
-
files,
|
|
17478
|
-
extensions
|
|
17479
|
-
} = {}) => {
|
|
17480
|
-
const globs = await Promise.all(directoryPaths.map(async (directoryPath) => await isDirectory(normalizePathForDirectoryGlob(directoryPath, cwd)) ? getDirectoryGlob({ directoryPath, files, extensions }) : directoryPath));
|
|
17481
|
-
return globs.flat();
|
|
17482
|
-
};
|
|
17483
|
-
var directoryToGlobSync = (directoryPaths, {
|
|
17484
|
-
cwd = process3.cwd(),
|
|
17485
|
-
files,
|
|
17486
|
-
extensions
|
|
17487
|
-
} = {}) => directoryPaths.flatMap((directoryPath) => isDirectorySync(normalizePathForDirectoryGlob(directoryPath, cwd)) ? getDirectoryGlob({ directoryPath, files, extensions }) : directoryPath);
|
|
17488
|
-
var toPatternsArray = (patterns) => {
|
|
17489
|
-
patterns = [...new Set([patterns].flat())];
|
|
17490
|
-
assertPatternsInput(patterns);
|
|
17491
|
-
return patterns;
|
|
17492
|
-
};
|
|
17493
|
-
var checkCwdOption = (cwd) => {
|
|
17494
|
-
if (!cwd) {
|
|
17495
|
-
return;
|
|
17496
|
-
}
|
|
17497
|
-
let stat;
|
|
17498
|
-
try {
|
|
17499
|
-
stat = fs3.statSync(cwd);
|
|
17500
|
-
} catch {
|
|
17501
|
-
return;
|
|
17502
|
-
}
|
|
17503
|
-
if (!stat.isDirectory()) {
|
|
17504
|
-
throw new Error("The `cwd` option must be a path to a directory");
|
|
17505
|
-
}
|
|
17506
|
-
};
|
|
17507
|
-
var normalizeOptions2 = (options = {}) => {
|
|
17508
|
-
options = {
|
|
17509
|
-
...options,
|
|
17510
|
-
ignore: options.ignore ?? [],
|
|
17511
|
-
expandDirectories: options.expandDirectories ?? true,
|
|
17512
|
-
cwd: toPath(options.cwd)
|
|
17513
|
-
};
|
|
17514
|
-
checkCwdOption(options.cwd);
|
|
17515
|
-
return options;
|
|
17516
|
-
};
|
|
17517
|
-
var normalizeArguments = (function_) => async (patterns, options) => function_(toPatternsArray(patterns), normalizeOptions2(options));
|
|
17518
|
-
var normalizeArgumentsSync = (function_) => (patterns, options) => function_(toPatternsArray(patterns), normalizeOptions2(options));
|
|
17519
|
-
var getIgnoreFilesPatterns = (options) => {
|
|
17520
|
-
const { ignoreFiles, gitignore } = options;
|
|
17521
|
-
const patterns = ignoreFiles ? toPatternsArray(ignoreFiles) : [];
|
|
17522
|
-
if (gitignore) {
|
|
17523
|
-
patterns.push(GITIGNORE_FILES_PATTERN);
|
|
17524
|
-
}
|
|
17525
|
-
return patterns;
|
|
17526
|
-
};
|
|
17527
|
-
var getFilter = async (options) => {
|
|
17528
|
-
const ignoreFilesPatterns = getIgnoreFilesPatterns(options);
|
|
17529
|
-
return createFilterFunction(ignoreFilesPatterns.length > 0 && await isIgnoredByIgnoreFiles(ignoreFilesPatterns, options));
|
|
17530
|
-
};
|
|
17531
|
-
var getFilterSync = (options) => {
|
|
17532
|
-
const ignoreFilesPatterns = getIgnoreFilesPatterns(options);
|
|
17533
|
-
return createFilterFunction(ignoreFilesPatterns.length > 0 && isIgnoredByIgnoreFilesSync(ignoreFilesPatterns, options));
|
|
17534
|
-
};
|
|
17535
|
-
var createFilterFunction = (isIgnored) => {
|
|
17536
|
-
const seen = new Set;
|
|
17537
|
-
return (fastGlobResult) => {
|
|
17538
|
-
const pathKey = nodePath.normalize(fastGlobResult.path ?? fastGlobResult);
|
|
17539
|
-
if (seen.has(pathKey) || isIgnored && isIgnored(pathKey)) {
|
|
17540
|
-
return false;
|
|
17541
|
-
}
|
|
17542
|
-
seen.add(pathKey);
|
|
17543
|
-
return true;
|
|
17544
|
-
};
|
|
17545
|
-
};
|
|
17546
|
-
var unionFastGlobResults = (results, filter) => results.flat().filter((fastGlobResult) => filter(fastGlobResult));
|
|
17547
|
-
var convertNegativePatterns = (patterns, options) => {
|
|
17548
|
-
const tasks = [];
|
|
17549
|
-
while (patterns.length > 0) {
|
|
17550
|
-
const index = patterns.findIndex((pattern) => isNegativePattern(pattern));
|
|
17551
|
-
if (index === -1) {
|
|
17552
|
-
tasks.push({ patterns, options });
|
|
17553
|
-
break;
|
|
17554
|
-
}
|
|
17555
|
-
const ignorePattern = patterns[index].slice(1);
|
|
17556
|
-
for (const task of tasks) {
|
|
17557
|
-
task.options.ignore.push(ignorePattern);
|
|
17558
|
-
}
|
|
17559
|
-
if (index !== 0) {
|
|
17560
|
-
tasks.push({
|
|
17561
|
-
patterns: patterns.slice(0, index),
|
|
17562
|
-
options: {
|
|
17563
|
-
...options,
|
|
17564
|
-
ignore: [
|
|
17565
|
-
...options.ignore,
|
|
17566
|
-
ignorePattern
|
|
17567
|
-
]
|
|
17568
|
-
}
|
|
17569
|
-
});
|
|
17570
|
-
}
|
|
17571
|
-
patterns = patterns.slice(index + 1);
|
|
17572
|
-
}
|
|
17573
|
-
return tasks;
|
|
17574
|
-
};
|
|
17575
|
-
var normalizeExpandDirectoriesOption = (options, cwd) => ({
|
|
17576
|
-
...cwd ? { cwd } : {},
|
|
17577
|
-
...Array.isArray(options) ? { files: options } : options
|
|
17578
|
-
});
|
|
17579
|
-
var generateTasks = async (patterns, options) => {
|
|
17580
|
-
const globTasks = convertNegativePatterns(patterns, options);
|
|
17581
|
-
const { cwd, expandDirectories } = options;
|
|
17582
|
-
if (!expandDirectories) {
|
|
17583
|
-
return globTasks;
|
|
17584
|
-
}
|
|
17585
|
-
const directoryToGlobOptions = normalizeExpandDirectoriesOption(expandDirectories, cwd);
|
|
17586
|
-
return Promise.all(globTasks.map(async (task) => {
|
|
17587
|
-
let { patterns: patterns2, options: options2 } = task;
|
|
17588
|
-
[
|
|
17589
|
-
patterns2,
|
|
17590
|
-
options2.ignore
|
|
17591
|
-
] = await Promise.all([
|
|
17592
|
-
directoryToGlob(patterns2, directoryToGlobOptions),
|
|
17593
|
-
directoryToGlob(options2.ignore, { cwd })
|
|
17594
|
-
]);
|
|
17595
|
-
return { patterns: patterns2, options: options2 };
|
|
17596
|
-
}));
|
|
17597
|
-
};
|
|
17598
|
-
var generateTasksSync = (patterns, options) => {
|
|
17599
|
-
const globTasks = convertNegativePatterns(patterns, options);
|
|
17600
|
-
const { cwd, expandDirectories } = options;
|
|
17601
|
-
if (!expandDirectories) {
|
|
17602
|
-
return globTasks;
|
|
17603
|
-
}
|
|
17604
|
-
const directoryToGlobSyncOptions = normalizeExpandDirectoriesOption(expandDirectories, cwd);
|
|
17605
|
-
return globTasks.map((task) => {
|
|
17606
|
-
let { patterns: patterns2, options: options2 } = task;
|
|
17607
|
-
patterns2 = directoryToGlobSync(patterns2, directoryToGlobSyncOptions);
|
|
17608
|
-
options2.ignore = directoryToGlobSync(options2.ignore, { cwd });
|
|
17609
|
-
return { patterns: patterns2, options: options2 };
|
|
17610
|
-
});
|
|
17611
|
-
};
|
|
17612
|
-
var globby = normalizeArguments(async (patterns, options) => {
|
|
17613
|
-
const [
|
|
17614
|
-
tasks,
|
|
17615
|
-
filter
|
|
17616
|
-
] = await Promise.all([
|
|
17617
|
-
generateTasks(patterns, options),
|
|
17618
|
-
getFilter(options)
|
|
17619
|
-
]);
|
|
17620
|
-
const results = await Promise.all(tasks.map((task) => import_fast_glob2.default(task.patterns, task.options)));
|
|
17621
|
-
return unionFastGlobResults(results, filter);
|
|
17622
|
-
});
|
|
17623
|
-
var globbySync = normalizeArgumentsSync((patterns, options) => {
|
|
17624
|
-
const tasks = generateTasksSync(patterns, options);
|
|
17625
|
-
const filter = getFilterSync(options);
|
|
17626
|
-
const results = tasks.map((task) => import_fast_glob2.default.sync(task.patterns, task.options));
|
|
17627
|
-
return unionFastGlobResults(results, filter);
|
|
17628
|
-
});
|
|
17629
|
-
var globbyStream = normalizeArgumentsSync((patterns, options) => {
|
|
17630
|
-
const tasks = generateTasksSync(patterns, options);
|
|
17631
|
-
const filter = getFilterSync(options);
|
|
17632
|
-
const streams = tasks.map((task) => import_fast_glob2.default.stream(task.patterns, task.options));
|
|
17633
|
-
const stream = mergeStreams(streams).filter((fastGlobResult) => filter(fastGlobResult));
|
|
17634
|
-
return stream;
|
|
17635
|
-
});
|
|
17636
|
-
var isDynamicPattern = normalizeArgumentsSync((patterns, options) => patterns.some((pattern) => import_fast_glob2.default.isDynamicPattern(pattern, options)));
|
|
17637
|
-
var generateGlobTasks = normalizeArguments(generateTasks);
|
|
17638
|
-
var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
|
|
17639
|
-
|
|
17640
|
-
// ../sdk/src/core/indexer.ts
|
|
17641
|
-
class CodebaseIndexer {
|
|
17642
|
-
projectPath;
|
|
17643
|
-
indexPath;
|
|
17644
|
-
fullReindexRatioThreshold = 0.2;
|
|
17645
|
-
constructor(projectPath) {
|
|
17646
|
-
this.projectPath = projectPath;
|
|
17647
|
-
this.indexPath = join3(projectPath, ".locus", "codebase-index.json");
|
|
17648
|
-
}
|
|
17649
|
-
async index(onProgress, treeSummarizer, force = false) {
|
|
17650
|
-
if (!treeSummarizer) {
|
|
17651
|
-
throw new Error("A treeSummarizer is required for this indexing method.");
|
|
17652
|
-
}
|
|
17653
|
-
onProgress?.("Generating file tree...");
|
|
17654
|
-
const currentFiles = await this.getFileTree();
|
|
17655
|
-
const treeString = currentFiles.join(`
|
|
17656
|
-
`);
|
|
17657
|
-
const newTreeHash = this.hashTree(treeString);
|
|
17658
|
-
const existingIndex = this.loadIndex();
|
|
17659
|
-
if (!force && existingIndex?.treeHash === newTreeHash) {
|
|
17660
|
-
onProgress?.("No file changes detected, skipping reindex");
|
|
17661
|
-
return null;
|
|
17662
|
-
}
|
|
17663
|
-
const currentHashes = this.computeFileHashes(currentFiles);
|
|
17664
|
-
const existingHashes = existingIndex?.fileHashes;
|
|
17665
|
-
const canIncremental = !force && existingIndex && existingHashes;
|
|
17666
|
-
if (canIncremental) {
|
|
17667
|
-
onProgress?.("Performing incremental update");
|
|
17668
|
-
const { added, deleted, modified } = this.diffFiles(currentHashes, existingHashes);
|
|
17669
|
-
const changedFiles = [...added, ...modified];
|
|
17670
|
-
const totalChanges = changedFiles.length + deleted.length;
|
|
17671
|
-
const existingFileCount = Object.keys(existingHashes).length;
|
|
17672
|
-
onProgress?.(`File changes detected: ${changedFiles.length} changed, ${added.length} added, ${deleted.length} deleted`);
|
|
17673
|
-
if (existingFileCount > 0) {
|
|
17674
|
-
const changeRatio = totalChanges / existingFileCount;
|
|
17675
|
-
if (changeRatio <= this.fullReindexRatioThreshold && changedFiles.length > 0) {
|
|
17676
|
-
onProgress?.(`Reindexing ${changedFiles.length} changed files and merging with existing index`);
|
|
17677
|
-
const incrementalIndex = await treeSummarizer(changedFiles.join(`
|
|
17678
|
-
`));
|
|
17679
|
-
const updatedIndex = this.cloneIndex(existingIndex);
|
|
17680
|
-
this.removeFilesFromIndex(updatedIndex, [...deleted, ...modified]);
|
|
17681
|
-
return this.mergeIndex(updatedIndex, incrementalIndex, currentHashes, newTreeHash);
|
|
17682
|
-
}
|
|
17683
|
-
if (changedFiles.length === 0 && deleted.length > 0) {
|
|
17684
|
-
onProgress?.(`Removing ${deleted.length} deleted files from index`);
|
|
17685
|
-
const updatedIndex = this.cloneIndex(existingIndex);
|
|
17686
|
-
this.removeFilesFromIndex(updatedIndex, deleted);
|
|
17687
|
-
return this.applyIndexMetadata(updatedIndex, currentHashes, newTreeHash);
|
|
17688
|
-
}
|
|
17689
|
-
if (changedFiles.length === 0 && deleted.length === 0) {
|
|
17690
|
-
onProgress?.("No actual file changes, updating hashes only");
|
|
17691
|
-
const updatedIndex = this.cloneIndex(existingIndex);
|
|
17692
|
-
return this.applyIndexMetadata(updatedIndex, currentHashes, newTreeHash);
|
|
17693
|
-
}
|
|
17694
|
-
onProgress?.(`Too many changes (${(changeRatio * 100).toFixed(1)}%), performing full reindex`);
|
|
17695
|
-
}
|
|
17696
|
-
}
|
|
17697
|
-
onProgress?.("AI is analyzing codebase structure...");
|
|
17698
|
-
const index = await treeSummarizer(treeString);
|
|
17699
|
-
return this.applyIndexMetadata(index, currentHashes, newTreeHash);
|
|
17700
|
-
}
|
|
17701
|
-
async getFileTree() {
|
|
17702
|
-
const gitmodulesPath = join3(this.projectPath, ".gitmodules");
|
|
17703
|
-
const submoduleIgnores = [];
|
|
17704
|
-
if (existsSync2(gitmodulesPath)) {
|
|
17705
|
-
try {
|
|
17706
|
-
const content = readFileSync2(gitmodulesPath, "utf-8");
|
|
17707
|
-
const lines = content.split(`
|
|
17708
|
-
`);
|
|
17709
|
-
for (const line of lines) {
|
|
17710
|
-
const match = line.match(/^\s*path\s*=\s*(.*)$/);
|
|
17711
|
-
const path2 = match?.[1]?.trim();
|
|
17712
|
-
if (path2) {
|
|
17713
|
-
submoduleIgnores.push(`${path2}/**`);
|
|
17714
|
-
submoduleIgnores.push(`**/${path2}/**`);
|
|
17715
|
-
}
|
|
17716
|
-
}
|
|
17717
|
-
} catch {}
|
|
17718
|
-
}
|
|
17719
|
-
return globby(["**/*"], {
|
|
17720
|
-
cwd: this.projectPath,
|
|
17721
|
-
gitignore: true,
|
|
17722
|
-
ignore: [
|
|
17723
|
-
...submoduleIgnores,
|
|
17724
|
-
"**/node_modules/**",
|
|
17725
|
-
"**/dist/**",
|
|
17726
|
-
"**/build/**",
|
|
17727
|
-
"**/target/**",
|
|
17728
|
-
"**/bin/**",
|
|
17729
|
-
"**/obj/**",
|
|
17730
|
-
"**/.next/**",
|
|
17731
|
-
"**/.svelte-kit/**",
|
|
17732
|
-
"**/.nuxt/**",
|
|
17733
|
-
"**/.cache/**",
|
|
17734
|
-
"**/out/**",
|
|
17735
|
-
"**/__tests__/**",
|
|
17736
|
-
"**/coverage/**",
|
|
17737
|
-
"**/*.test.*",
|
|
17738
|
-
"**/*.spec.*",
|
|
17739
|
-
"**/*.d.ts",
|
|
17740
|
-
"**/tsconfig.tsbuildinfo",
|
|
17741
|
-
"**/.locus/*.json",
|
|
17742
|
-
"**/.locus/*.md",
|
|
17743
|
-
"**/.locus/!(artifacts)/**",
|
|
17744
|
-
"**/.git/**",
|
|
17745
|
-
"**/.svn/**",
|
|
17746
|
-
"**/.hg/**",
|
|
17747
|
-
"**/.vscode/**",
|
|
17748
|
-
"**/.idea/**",
|
|
17749
|
-
"**/.DS_Store",
|
|
17750
|
-
"**/bun.lock",
|
|
17751
|
-
"**/package-lock.json",
|
|
17752
|
-
"**/yarn.lock",
|
|
17753
|
-
"**/pnpm-lock.yaml",
|
|
17754
|
-
"**/Cargo.lock",
|
|
17755
|
-
"**/go.sum",
|
|
17756
|
-
"**/poetry.lock",
|
|
17757
|
-
"**/*.{png,jpg,jpeg,gif,svg,ico,mp4,webm,wav,mp3,woff,woff2,eot,ttf,otf,pdf,zip,tar.gz,rar}"
|
|
17758
|
-
]
|
|
17759
|
-
});
|
|
17760
|
-
}
|
|
17761
|
-
loadIndex() {
|
|
17762
|
-
if (existsSync2(this.indexPath)) {
|
|
17763
|
-
try {
|
|
17764
|
-
return JSON.parse(readFileSync2(this.indexPath, "utf-8"));
|
|
17765
|
-
} catch {
|
|
17766
|
-
return null;
|
|
17767
|
-
}
|
|
17768
|
-
}
|
|
17769
|
-
return null;
|
|
17770
|
-
}
|
|
17771
|
-
saveIndex(index) {
|
|
17772
|
-
const dir = dirname(this.indexPath);
|
|
17773
|
-
if (!existsSync2(dir)) {
|
|
17774
|
-
mkdirSync2(dir, { recursive: true });
|
|
17775
|
-
}
|
|
17776
|
-
writeFileSync(this.indexPath, JSON.stringify(index, null, 2));
|
|
17777
|
-
}
|
|
17778
|
-
cloneIndex(index) {
|
|
17779
|
-
return JSON.parse(JSON.stringify(index));
|
|
17780
|
-
}
|
|
17781
|
-
applyIndexMetadata(index, fileHashes, treeHash) {
|
|
17782
|
-
index.lastIndexed = new Date().toISOString();
|
|
17783
|
-
index.treeHash = treeHash;
|
|
17784
|
-
index.fileHashes = fileHashes;
|
|
17785
|
-
return index;
|
|
17786
|
-
}
|
|
17787
|
-
hashTree(tree) {
|
|
17788
|
-
return createHash("sha256").update(tree).digest("hex");
|
|
17789
|
-
}
|
|
17790
|
-
hashFile(filePath) {
|
|
17791
|
-
try {
|
|
17792
|
-
const content = readFileSync2(join3(this.projectPath, filePath), "utf-8");
|
|
17793
|
-
return createHash("sha256").update(content).digest("hex").slice(0, 16);
|
|
17794
|
-
} catch {
|
|
17795
|
-
return null;
|
|
17796
|
-
}
|
|
17797
|
-
}
|
|
17798
|
-
computeFileHashes(files) {
|
|
17799
|
-
const hashes = {};
|
|
17800
|
-
for (const file of files) {
|
|
17801
|
-
const hash = this.hashFile(file);
|
|
17802
|
-
if (hash !== null) {
|
|
17803
|
-
hashes[file] = hash;
|
|
17804
|
-
}
|
|
17805
|
-
}
|
|
17806
|
-
return hashes;
|
|
17807
|
-
}
|
|
17808
|
-
diffFiles(currentHashes, existingHashes) {
|
|
17809
|
-
const currentFiles = Object.keys(currentHashes);
|
|
17810
|
-
const existingFiles = Object.keys(existingHashes);
|
|
17811
|
-
const existingSet = new Set(existingFiles);
|
|
17812
|
-
const currentSet = new Set(currentFiles);
|
|
17813
|
-
const added = currentFiles.filter((f) => !existingSet.has(f));
|
|
17814
|
-
const deleted = existingFiles.filter((f) => !currentSet.has(f));
|
|
17815
|
-
const modified = currentFiles.filter((f) => existingSet.has(f) && currentHashes[f] !== existingHashes[f]);
|
|
17816
|
-
return { added, deleted, modified };
|
|
17817
|
-
}
|
|
17818
|
-
removeFilesFromIndex(index, files) {
|
|
17819
|
-
const fileSet = new Set(files);
|
|
17820
|
-
for (const file of files) {
|
|
17821
|
-
delete index.responsibilities[file];
|
|
17822
|
-
}
|
|
17823
|
-
for (const [symbol, paths] of Object.entries(index.symbols)) {
|
|
17824
|
-
index.symbols[symbol] = paths.filter((p) => !fileSet.has(p));
|
|
17825
|
-
if (index.symbols[symbol].length === 0) {
|
|
17826
|
-
delete index.symbols[symbol];
|
|
17827
|
-
}
|
|
17828
|
-
}
|
|
17829
|
-
}
|
|
17830
|
-
mergeIndex(existing, incremental, newHashes, newTreeHash) {
|
|
17831
|
-
const mergedSymbols = { ...existing.symbols };
|
|
17832
|
-
for (const [symbol, paths] of Object.entries(incremental.symbols)) {
|
|
17833
|
-
if (mergedSymbols[symbol]) {
|
|
17834
|
-
mergedSymbols[symbol] = [
|
|
17835
|
-
...new Set([...mergedSymbols[symbol], ...paths])
|
|
17836
|
-
];
|
|
17837
|
-
} else {
|
|
17838
|
-
mergedSymbols[symbol] = paths;
|
|
17839
|
-
}
|
|
17840
|
-
}
|
|
17841
|
-
const merged = {
|
|
17842
|
-
symbols: mergedSymbols,
|
|
17843
|
-
responsibilities: {
|
|
17844
|
-
...existing.responsibilities,
|
|
17845
|
-
...incremental.responsibilities
|
|
17846
|
-
},
|
|
17847
|
-
lastIndexed: ""
|
|
17848
|
-
};
|
|
17849
|
-
return this.applyIndexMetadata(merged, newHashes, newTreeHash);
|
|
17850
|
-
}
|
|
17851
|
-
}
|
|
17852
|
-
|
|
17853
|
-
// ../sdk/src/agent/codebase-indexer-service.ts
|
|
17854
|
-
class CodebaseIndexerService {
|
|
17855
|
-
deps;
|
|
17856
|
-
indexer;
|
|
17857
|
-
constructor(deps) {
|
|
17858
|
-
this.deps = deps;
|
|
17859
|
-
this.indexer = new CodebaseIndexer(deps.projectPath);
|
|
17860
|
-
}
|
|
17861
|
-
async reindex(force = false) {
|
|
17862
|
-
try {
|
|
17863
|
-
const index = await this.indexer.index((msg) => this.deps.log(msg, "info"), async (tree) => {
|
|
17864
|
-
const prompt = `You are a codebase analysis expert. Analyze the file tree and extract:
|
|
17865
|
-
1. Key symbols (classes, functions, types) and their locations
|
|
17866
|
-
2. Responsibilities of each directory/file
|
|
17867
|
-
3. Overall project structure
|
|
17868
|
-
|
|
17869
|
-
Analyze this file tree and provide a JSON response with:
|
|
17870
|
-
- "symbols": object mapping symbol names to file paths (array)
|
|
17871
|
-
- "responsibilities": object mapping paths to brief descriptions
|
|
17872
|
-
|
|
17873
|
-
File tree:
|
|
17874
|
-
${tree}
|
|
17875
|
-
|
|
17876
|
-
Return ONLY valid JSON, no markdown formatting.`;
|
|
17877
|
-
const response = await this.deps.aiRunner.run(prompt, true);
|
|
17878
|
-
const jsonMatch = response.match(/\{[\s\S]*\}/);
|
|
17879
|
-
if (jsonMatch) {
|
|
17880
|
-
return JSON.parse(jsonMatch[0]);
|
|
17881
|
-
}
|
|
17882
|
-
return { symbols: {}, responsibilities: {}, lastIndexed: "" };
|
|
17883
|
-
}, force);
|
|
17884
|
-
if (index === null) {
|
|
17885
|
-
this.deps.log("No changes detected, skipping reindex", "info");
|
|
17886
|
-
return;
|
|
17887
|
-
}
|
|
17888
|
-
this.indexer.saveIndex(index);
|
|
17889
|
-
this.deps.log("Codebase reindexed successfully", "success");
|
|
17890
|
-
} catch (error) {
|
|
17891
|
-
this.deps.log(`Failed to reindex codebase: ${error}`, "error");
|
|
17892
|
-
}
|
|
17893
|
-
}
|
|
17894
|
-
}
|
|
17895
|
-
// ../sdk/src/agent/sprint-planner.ts
|
|
17896
|
-
class SprintPlanner {
|
|
17897
|
-
deps;
|
|
17898
|
-
constructor(deps) {
|
|
17899
|
-
this.deps = deps;
|
|
17900
|
-
}
|
|
17901
|
-
async planSprint(sprint, tasks) {
|
|
17902
|
-
this.deps.log(`Planning sprint: ${sprint.name}`, "info");
|
|
17903
|
-
try {
|
|
17904
|
-
const taskList = tasks.map((t) => `- [${t.id}] ${t.title}: ${t.description || "No description"}`).join(`
|
|
17905
|
-
`);
|
|
17906
|
-
const planningPrompt = `# Sprint Planning: ${sprint.name}
|
|
17907
|
-
|
|
17908
|
-
You are an expert project manager and lead engineer. You need to create a mindmap and execution plan for the following tasks in this sprint.
|
|
17909
|
-
|
|
17910
|
-
## Tasks
|
|
17911
|
-
${taskList}
|
|
17912
|
-
|
|
17913
|
-
## Instructions
|
|
17914
|
-
1. Analyze dependencies between these tasks.
|
|
17915
|
-
2. Prioritize them for the most efficient execution.
|
|
17916
|
-
3. Create a mindmap (in Markdown or Mermaid format) that visualizes the sprint structure.
|
|
17917
|
-
4. Output your final plan. The plan should clearly state the order of execution.
|
|
17918
|
-
|
|
17919
|
-
**IMPORTANT**:
|
|
17920
|
-
- Do NOT create any files on the filesystem during this planning phase.
|
|
17921
|
-
- Avoid using absolute local paths (e.g., /Users/...) in your output. Use relative paths starting from the project root if necessary.
|
|
17922
|
-
- Your output will be saved as the official sprint mindmap on the server.`;
|
|
17923
|
-
const plan = await this.deps.aiRunner.run(planningPrompt, true);
|
|
17924
|
-
this.deps.log("Sprint mindmap generated and posted to server.", "success");
|
|
17925
|
-
return plan;
|
|
17926
|
-
} catch (error) {
|
|
17927
|
-
this.deps.log(`Sprint planning failed: ${error}`, "error");
|
|
17928
|
-
return sprint.mindmap || "";
|
|
17929
|
-
}
|
|
17930
|
-
}
|
|
17931
|
-
}
|
|
17932
|
-
// ../sdk/src/core/prompt-builder.ts
|
|
17933
|
-
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "node:fs";
|
|
17934
|
-
|
|
17935
|
-
// ../../node_modules/zod/v4/classic/external.js
|
|
17936
|
-
var exports_external = {};
|
|
17937
|
-
__export(exports_external, {
|
|
17938
|
-
xor: () => xor,
|
|
17939
|
-
xid: () => xid2,
|
|
17940
|
-
void: () => _void2,
|
|
17941
|
-
uuidv7: () => uuidv7,
|
|
17942
|
-
uuidv6: () => uuidv6,
|
|
17943
|
-
uuidv4: () => uuidv4,
|
|
17944
|
-
uuid: () => uuid2,
|
|
17945
|
-
util: () => exports_util,
|
|
17946
|
-
url: () => url,
|
|
17947
|
-
uppercase: () => _uppercase,
|
|
17948
|
-
unknown: () => unknown,
|
|
17949
|
-
union: () => union,
|
|
17950
|
-
undefined: () => _undefined3,
|
|
17951
|
-
ulid: () => ulid2,
|
|
17952
|
-
uint64: () => uint64,
|
|
17953
|
-
uint32: () => uint32,
|
|
17954
|
-
tuple: () => tuple,
|
|
17955
|
-
trim: () => _trim,
|
|
17956
|
-
treeifyError: () => treeifyError,
|
|
17957
|
-
transform: () => transform,
|
|
17958
|
-
toUpperCase: () => _toUpperCase,
|
|
17959
|
-
toLowerCase: () => _toLowerCase,
|
|
17960
|
-
toJSONSchema: () => toJSONSchema,
|
|
17961
|
-
templateLiteral: () => templateLiteral,
|
|
17962
|
-
symbol: () => symbol,
|
|
17963
|
-
superRefine: () => superRefine,
|
|
17964
|
-
success: () => success,
|
|
17965
|
-
stringbool: () => stringbool,
|
|
17966
|
-
stringFormat: () => stringFormat,
|
|
17967
|
-
string: () => string2,
|
|
17968
|
-
strictObject: () => strictObject,
|
|
17969
|
-
startsWith: () => _startsWith,
|
|
17970
|
-
slugify: () => _slugify,
|
|
17971
|
-
size: () => _size,
|
|
17972
|
-
setErrorMap: () => setErrorMap,
|
|
17973
|
-
set: () => set,
|
|
17974
|
-
safeParseAsync: () => safeParseAsync2,
|
|
17975
|
-
safeParse: () => safeParse2,
|
|
17976
|
-
safeEncodeAsync: () => safeEncodeAsync2,
|
|
17977
|
-
safeEncode: () => safeEncode2,
|
|
17978
|
-
safeDecodeAsync: () => safeDecodeAsync2,
|
|
17979
|
-
safeDecode: () => safeDecode2,
|
|
17980
|
-
registry: () => registry,
|
|
17981
|
-
regexes: () => exports_regexes,
|
|
17982
|
-
regex: () => _regex,
|
|
17983
|
-
refine: () => refine,
|
|
17984
|
-
record: () => record,
|
|
17985
|
-
readonly: () => readonly,
|
|
17986
|
-
property: () => _property,
|
|
17987
|
-
promise: () => promise,
|
|
17988
|
-
prettifyError: () => prettifyError,
|
|
17989
|
-
preprocess: () => preprocess,
|
|
17990
|
-
prefault: () => prefault,
|
|
17991
|
-
positive: () => _positive,
|
|
17992
|
-
pipe: () => pipe,
|
|
17993
|
-
partialRecord: () => partialRecord,
|
|
17994
|
-
parseAsync: () => parseAsync2,
|
|
17995
|
-
parse: () => parse3,
|
|
17996
|
-
overwrite: () => _overwrite,
|
|
17997
|
-
optional: () => optional,
|
|
17998
|
-
object: () => object,
|
|
17999
|
-
number: () => number2,
|
|
18000
|
-
nullish: () => nullish2,
|
|
18001
|
-
nullable: () => nullable,
|
|
18002
|
-
null: () => _null3,
|
|
18003
|
-
normalize: () => _normalize,
|
|
18004
|
-
nonpositive: () => _nonpositive,
|
|
18005
|
-
nonoptional: () => nonoptional,
|
|
18006
|
-
nonnegative: () => _nonnegative,
|
|
18007
|
-
never: () => never,
|
|
18008
|
-
negative: () => _negative,
|
|
18009
|
-
nativeEnum: () => nativeEnum,
|
|
18010
|
-
nanoid: () => nanoid2,
|
|
18011
|
-
nan: () => nan,
|
|
18012
|
-
multipleOf: () => _multipleOf,
|
|
18013
|
-
minSize: () => _minSize,
|
|
18014
|
-
minLength: () => _minLength,
|
|
18015
|
-
mime: () => _mime,
|
|
18016
|
-
meta: () => meta2,
|
|
18017
|
-
maxSize: () => _maxSize,
|
|
18018
|
-
maxLength: () => _maxLength,
|
|
18019
|
-
map: () => map,
|
|
18020
|
-
mac: () => mac2,
|
|
18021
|
-
lte: () => _lte,
|
|
18022
|
-
lt: () => _lt,
|
|
18023
|
-
lowercase: () => _lowercase,
|
|
18024
|
-
looseRecord: () => looseRecord,
|
|
18025
|
-
looseObject: () => looseObject,
|
|
18026
|
-
locales: () => exports_locales,
|
|
18027
|
-
literal: () => literal,
|
|
18028
|
-
length: () => _length,
|
|
18029
|
-
lazy: () => lazy,
|
|
18030
|
-
ksuid: () => ksuid2,
|
|
18031
|
-
keyof: () => keyof,
|
|
18032
|
-
jwt: () => jwt,
|
|
18033
|
-
json: () => json,
|
|
18034
|
-
iso: () => exports_iso,
|
|
18035
|
-
ipv6: () => ipv62,
|
|
18036
|
-
ipv4: () => ipv42,
|
|
18037
|
-
intersection: () => intersection,
|
|
18038
|
-
int64: () => int64,
|
|
18039
|
-
int32: () => int32,
|
|
18040
|
-
int: () => int,
|
|
18041
|
-
instanceof: () => _instanceof,
|
|
18042
|
-
includes: () => _includes,
|
|
18043
|
-
httpUrl: () => httpUrl,
|
|
18044
|
-
hostname: () => hostname2,
|
|
18045
|
-
hex: () => hex2,
|
|
18046
|
-
hash: () => hash,
|
|
18047
|
-
guid: () => guid2,
|
|
18048
|
-
gte: () => _gte,
|
|
18049
|
-
gt: () => _gt,
|
|
18050
|
-
globalRegistry: () => globalRegistry,
|
|
18051
|
-
getErrorMap: () => getErrorMap,
|
|
18052
|
-
function: () => _function,
|
|
18053
|
-
fromJSONSchema: () => fromJSONSchema,
|
|
18054
|
-
formatError: () => formatError,
|
|
18055
|
-
float64: () => float64,
|
|
18056
|
-
float32: () => float32,
|
|
18057
|
-
flattenError: () => flattenError,
|
|
18058
|
-
file: () => file,
|
|
18059
|
-
exactOptional: () => exactOptional,
|
|
18060
|
-
enum: () => _enum2,
|
|
18061
|
-
endsWith: () => _endsWith,
|
|
18062
|
-
encodeAsync: () => encodeAsync2,
|
|
18063
|
-
encode: () => encode2,
|
|
18064
|
-
emoji: () => emoji2,
|
|
18065
|
-
email: () => email2,
|
|
18066
|
-
e164: () => e1642,
|
|
18067
|
-
discriminatedUnion: () => discriminatedUnion,
|
|
18068
|
-
describe: () => describe2,
|
|
18069
|
-
decodeAsync: () => decodeAsync2,
|
|
18070
|
-
decode: () => decode2,
|
|
18071
|
-
date: () => date3,
|
|
18072
|
-
custom: () => custom,
|
|
18073
|
-
cuid2: () => cuid22,
|
|
18074
|
-
cuid: () => cuid3,
|
|
18075
|
-
core: () => exports_core2,
|
|
18076
|
-
config: () => config,
|
|
18077
|
-
coerce: () => exports_coerce,
|
|
18078
|
-
codec: () => codec,
|
|
18079
|
-
clone: () => clone,
|
|
18080
|
-
cidrv6: () => cidrv62,
|
|
18081
|
-
cidrv4: () => cidrv42,
|
|
18082
|
-
check: () => check,
|
|
18083
|
-
catch: () => _catch2,
|
|
18084
|
-
boolean: () => boolean2,
|
|
18085
|
-
bigint: () => bigint2,
|
|
18086
|
-
base64url: () => base64url2,
|
|
18087
|
-
base64: () => base642,
|
|
18088
|
-
array: () => array,
|
|
18089
|
-
any: () => any,
|
|
18090
|
-
_function: () => _function,
|
|
18091
|
-
_default: () => _default2,
|
|
18092
|
-
_ZodString: () => _ZodString,
|
|
18093
|
-
ZodXor: () => ZodXor,
|
|
18094
|
-
ZodXID: () => ZodXID,
|
|
18095
|
-
ZodVoid: () => ZodVoid,
|
|
18096
|
-
ZodUnknown: () => ZodUnknown,
|
|
18097
|
-
ZodUnion: () => ZodUnion,
|
|
18098
|
-
ZodUndefined: () => ZodUndefined,
|
|
18099
|
-
ZodUUID: () => ZodUUID,
|
|
18100
|
-
ZodURL: () => ZodURL,
|
|
18101
|
-
ZodULID: () => ZodULID,
|
|
18102
|
-
ZodType: () => ZodType,
|
|
18103
|
-
ZodTuple: () => ZodTuple,
|
|
18104
|
-
ZodTransform: () => ZodTransform,
|
|
18105
|
-
ZodTemplateLiteral: () => ZodTemplateLiteral,
|
|
18106
|
-
ZodSymbol: () => ZodSymbol,
|
|
18107
|
-
ZodSuccess: () => ZodSuccess,
|
|
18108
|
-
ZodStringFormat: () => ZodStringFormat,
|
|
18109
|
-
ZodString: () => ZodString,
|
|
18110
|
-
ZodSet: () => ZodSet,
|
|
18111
|
-
ZodRecord: () => ZodRecord,
|
|
18112
|
-
ZodRealError: () => ZodRealError,
|
|
18113
|
-
ZodReadonly: () => ZodReadonly,
|
|
18114
|
-
ZodPromise: () => ZodPromise,
|
|
18115
|
-
ZodPrefault: () => ZodPrefault,
|
|
18116
|
-
ZodPipe: () => ZodPipe,
|
|
18117
|
-
ZodOptional: () => ZodOptional,
|
|
18118
|
-
ZodObject: () => ZodObject,
|
|
18119
|
-
ZodNumberFormat: () => ZodNumberFormat,
|
|
18120
|
-
ZodNumber: () => ZodNumber,
|
|
18121
|
-
ZodNullable: () => ZodNullable,
|
|
18122
|
-
ZodNull: () => ZodNull,
|
|
18123
|
-
ZodNonOptional: () => ZodNonOptional,
|
|
18124
|
-
ZodNever: () => ZodNever,
|
|
18125
|
-
ZodNanoID: () => ZodNanoID,
|
|
18126
|
-
ZodNaN: () => ZodNaN,
|
|
18127
|
-
ZodMap: () => ZodMap,
|
|
18128
|
-
ZodMAC: () => ZodMAC,
|
|
18129
|
-
ZodLiteral: () => ZodLiteral,
|
|
18130
|
-
ZodLazy: () => ZodLazy,
|
|
18131
|
-
ZodKSUID: () => ZodKSUID,
|
|
18132
|
-
ZodJWT: () => ZodJWT,
|
|
18133
|
-
ZodIssueCode: () => ZodIssueCode,
|
|
18134
|
-
ZodIntersection: () => ZodIntersection,
|
|
18135
|
-
ZodISOTime: () => ZodISOTime,
|
|
18136
|
-
ZodISODuration: () => ZodISODuration,
|
|
18137
|
-
ZodISODateTime: () => ZodISODateTime,
|
|
18138
|
-
ZodISODate: () => ZodISODate,
|
|
18139
|
-
ZodIPv6: () => ZodIPv6,
|
|
18140
|
-
ZodIPv4: () => ZodIPv4,
|
|
18141
|
-
ZodGUID: () => ZodGUID,
|
|
18142
|
-
ZodFunction: () => ZodFunction,
|
|
18143
|
-
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
18144
|
-
ZodFile: () => ZodFile,
|
|
18145
|
-
ZodExactOptional: () => ZodExactOptional,
|
|
18146
|
-
ZodError: () => ZodError,
|
|
18147
|
-
ZodEnum: () => ZodEnum,
|
|
18148
|
-
ZodEmoji: () => ZodEmoji,
|
|
18149
|
-
ZodEmail: () => ZodEmail,
|
|
18150
|
-
ZodE164: () => ZodE164,
|
|
18151
|
-
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
18152
|
-
ZodDefault: () => ZodDefault,
|
|
18153
|
-
ZodDate: () => ZodDate,
|
|
18154
|
-
ZodCustomStringFormat: () => ZodCustomStringFormat,
|
|
18155
|
-
ZodCustom: () => ZodCustom,
|
|
18156
|
-
ZodCodec: () => ZodCodec,
|
|
18157
|
-
ZodCatch: () => ZodCatch,
|
|
18158
|
-
ZodCUID2: () => ZodCUID2,
|
|
18159
|
-
ZodCUID: () => ZodCUID,
|
|
18160
|
-
ZodCIDRv6: () => ZodCIDRv6,
|
|
18161
|
-
ZodCIDRv4: () => ZodCIDRv4,
|
|
18162
|
-
ZodBoolean: () => ZodBoolean,
|
|
18163
|
-
ZodBigIntFormat: () => ZodBigIntFormat,
|
|
18164
|
-
ZodBigInt: () => ZodBigInt,
|
|
18165
|
-
ZodBase64URL: () => ZodBase64URL,
|
|
18166
|
-
ZodBase64: () => ZodBase64,
|
|
18167
|
-
ZodArray: () => ZodArray,
|
|
18168
|
-
ZodAny: () => ZodAny,
|
|
18169
|
-
TimePrecision: () => TimePrecision,
|
|
18170
|
-
NEVER: () => NEVER,
|
|
18171
|
-
$output: () => $output,
|
|
18172
|
-
$input: () => $input,
|
|
18173
|
-
$brand: () => $brand
|
|
18174
|
-
});
|
|
17032
|
+
// ../../node_modules/zod/v4/classic/external.js
|
|
17033
|
+
var exports_external = {};
|
|
17034
|
+
__export(exports_external, {
|
|
17035
|
+
xor: () => xor,
|
|
17036
|
+
xid: () => xid2,
|
|
17037
|
+
void: () => _void2,
|
|
17038
|
+
uuidv7: () => uuidv7,
|
|
17039
|
+
uuidv6: () => uuidv6,
|
|
17040
|
+
uuidv4: () => uuidv4,
|
|
17041
|
+
uuid: () => uuid2,
|
|
17042
|
+
util: () => exports_util,
|
|
17043
|
+
url: () => url,
|
|
17044
|
+
uppercase: () => _uppercase,
|
|
17045
|
+
unknown: () => unknown,
|
|
17046
|
+
union: () => union,
|
|
17047
|
+
undefined: () => _undefined3,
|
|
17048
|
+
ulid: () => ulid2,
|
|
17049
|
+
uint64: () => uint64,
|
|
17050
|
+
uint32: () => uint32,
|
|
17051
|
+
tuple: () => tuple,
|
|
17052
|
+
trim: () => _trim,
|
|
17053
|
+
treeifyError: () => treeifyError,
|
|
17054
|
+
transform: () => transform,
|
|
17055
|
+
toUpperCase: () => _toUpperCase,
|
|
17056
|
+
toLowerCase: () => _toLowerCase,
|
|
17057
|
+
toJSONSchema: () => toJSONSchema,
|
|
17058
|
+
templateLiteral: () => templateLiteral,
|
|
17059
|
+
symbol: () => symbol,
|
|
17060
|
+
superRefine: () => superRefine,
|
|
17061
|
+
success: () => success,
|
|
17062
|
+
stringbool: () => stringbool,
|
|
17063
|
+
stringFormat: () => stringFormat,
|
|
17064
|
+
string: () => string2,
|
|
17065
|
+
strictObject: () => strictObject,
|
|
17066
|
+
startsWith: () => _startsWith,
|
|
17067
|
+
slugify: () => _slugify,
|
|
17068
|
+
size: () => _size,
|
|
17069
|
+
setErrorMap: () => setErrorMap,
|
|
17070
|
+
set: () => set,
|
|
17071
|
+
safeParseAsync: () => safeParseAsync2,
|
|
17072
|
+
safeParse: () => safeParse2,
|
|
17073
|
+
safeEncodeAsync: () => safeEncodeAsync2,
|
|
17074
|
+
safeEncode: () => safeEncode2,
|
|
17075
|
+
safeDecodeAsync: () => safeDecodeAsync2,
|
|
17076
|
+
safeDecode: () => safeDecode2,
|
|
17077
|
+
registry: () => registry,
|
|
17078
|
+
regexes: () => exports_regexes,
|
|
17079
|
+
regex: () => _regex,
|
|
17080
|
+
refine: () => refine,
|
|
17081
|
+
record: () => record,
|
|
17082
|
+
readonly: () => readonly,
|
|
17083
|
+
property: () => _property,
|
|
17084
|
+
promise: () => promise,
|
|
17085
|
+
prettifyError: () => prettifyError,
|
|
17086
|
+
preprocess: () => preprocess,
|
|
17087
|
+
prefault: () => prefault,
|
|
17088
|
+
positive: () => _positive,
|
|
17089
|
+
pipe: () => pipe,
|
|
17090
|
+
partialRecord: () => partialRecord,
|
|
17091
|
+
parseAsync: () => parseAsync2,
|
|
17092
|
+
parse: () => parse3,
|
|
17093
|
+
overwrite: () => _overwrite,
|
|
17094
|
+
optional: () => optional,
|
|
17095
|
+
object: () => object,
|
|
17096
|
+
number: () => number2,
|
|
17097
|
+
nullish: () => nullish2,
|
|
17098
|
+
nullable: () => nullable,
|
|
17099
|
+
null: () => _null3,
|
|
17100
|
+
normalize: () => _normalize,
|
|
17101
|
+
nonpositive: () => _nonpositive,
|
|
17102
|
+
nonoptional: () => nonoptional,
|
|
17103
|
+
nonnegative: () => _nonnegative,
|
|
17104
|
+
never: () => never,
|
|
17105
|
+
negative: () => _negative,
|
|
17106
|
+
nativeEnum: () => nativeEnum,
|
|
17107
|
+
nanoid: () => nanoid2,
|
|
17108
|
+
nan: () => nan,
|
|
17109
|
+
multipleOf: () => _multipleOf,
|
|
17110
|
+
minSize: () => _minSize,
|
|
17111
|
+
minLength: () => _minLength,
|
|
17112
|
+
mime: () => _mime,
|
|
17113
|
+
meta: () => meta2,
|
|
17114
|
+
maxSize: () => _maxSize,
|
|
17115
|
+
maxLength: () => _maxLength,
|
|
17116
|
+
map: () => map,
|
|
17117
|
+
mac: () => mac2,
|
|
17118
|
+
lte: () => _lte,
|
|
17119
|
+
lt: () => _lt,
|
|
17120
|
+
lowercase: () => _lowercase,
|
|
17121
|
+
looseRecord: () => looseRecord,
|
|
17122
|
+
looseObject: () => looseObject,
|
|
17123
|
+
locales: () => exports_locales,
|
|
17124
|
+
literal: () => literal,
|
|
17125
|
+
length: () => _length,
|
|
17126
|
+
lazy: () => lazy,
|
|
17127
|
+
ksuid: () => ksuid2,
|
|
17128
|
+
keyof: () => keyof,
|
|
17129
|
+
jwt: () => jwt,
|
|
17130
|
+
json: () => json,
|
|
17131
|
+
iso: () => exports_iso,
|
|
17132
|
+
ipv6: () => ipv62,
|
|
17133
|
+
ipv4: () => ipv42,
|
|
17134
|
+
intersection: () => intersection,
|
|
17135
|
+
int64: () => int64,
|
|
17136
|
+
int32: () => int32,
|
|
17137
|
+
int: () => int,
|
|
17138
|
+
instanceof: () => _instanceof,
|
|
17139
|
+
includes: () => _includes,
|
|
17140
|
+
httpUrl: () => httpUrl,
|
|
17141
|
+
hostname: () => hostname2,
|
|
17142
|
+
hex: () => hex2,
|
|
17143
|
+
hash: () => hash,
|
|
17144
|
+
guid: () => guid2,
|
|
17145
|
+
gte: () => _gte,
|
|
17146
|
+
gt: () => _gt,
|
|
17147
|
+
globalRegistry: () => globalRegistry,
|
|
17148
|
+
getErrorMap: () => getErrorMap,
|
|
17149
|
+
function: () => _function,
|
|
17150
|
+
fromJSONSchema: () => fromJSONSchema,
|
|
17151
|
+
formatError: () => formatError,
|
|
17152
|
+
float64: () => float64,
|
|
17153
|
+
float32: () => float32,
|
|
17154
|
+
flattenError: () => flattenError,
|
|
17155
|
+
file: () => file,
|
|
17156
|
+
exactOptional: () => exactOptional,
|
|
17157
|
+
enum: () => _enum2,
|
|
17158
|
+
endsWith: () => _endsWith,
|
|
17159
|
+
encodeAsync: () => encodeAsync2,
|
|
17160
|
+
encode: () => encode2,
|
|
17161
|
+
emoji: () => emoji2,
|
|
17162
|
+
email: () => email2,
|
|
17163
|
+
e164: () => e1642,
|
|
17164
|
+
discriminatedUnion: () => discriminatedUnion,
|
|
17165
|
+
describe: () => describe2,
|
|
17166
|
+
decodeAsync: () => decodeAsync2,
|
|
17167
|
+
decode: () => decode2,
|
|
17168
|
+
date: () => date3,
|
|
17169
|
+
custom: () => custom,
|
|
17170
|
+
cuid2: () => cuid22,
|
|
17171
|
+
cuid: () => cuid3,
|
|
17172
|
+
core: () => exports_core2,
|
|
17173
|
+
config: () => config,
|
|
17174
|
+
coerce: () => exports_coerce,
|
|
17175
|
+
codec: () => codec,
|
|
17176
|
+
clone: () => clone,
|
|
17177
|
+
cidrv6: () => cidrv62,
|
|
17178
|
+
cidrv4: () => cidrv42,
|
|
17179
|
+
check: () => check,
|
|
17180
|
+
catch: () => _catch2,
|
|
17181
|
+
boolean: () => boolean2,
|
|
17182
|
+
bigint: () => bigint2,
|
|
17183
|
+
base64url: () => base64url2,
|
|
17184
|
+
base64: () => base642,
|
|
17185
|
+
array: () => array,
|
|
17186
|
+
any: () => any,
|
|
17187
|
+
_function: () => _function,
|
|
17188
|
+
_default: () => _default2,
|
|
17189
|
+
_ZodString: () => _ZodString,
|
|
17190
|
+
ZodXor: () => ZodXor,
|
|
17191
|
+
ZodXID: () => ZodXID,
|
|
17192
|
+
ZodVoid: () => ZodVoid,
|
|
17193
|
+
ZodUnknown: () => ZodUnknown,
|
|
17194
|
+
ZodUnion: () => ZodUnion,
|
|
17195
|
+
ZodUndefined: () => ZodUndefined,
|
|
17196
|
+
ZodUUID: () => ZodUUID,
|
|
17197
|
+
ZodURL: () => ZodURL,
|
|
17198
|
+
ZodULID: () => ZodULID,
|
|
17199
|
+
ZodType: () => ZodType,
|
|
17200
|
+
ZodTuple: () => ZodTuple,
|
|
17201
|
+
ZodTransform: () => ZodTransform,
|
|
17202
|
+
ZodTemplateLiteral: () => ZodTemplateLiteral,
|
|
17203
|
+
ZodSymbol: () => ZodSymbol,
|
|
17204
|
+
ZodSuccess: () => ZodSuccess,
|
|
17205
|
+
ZodStringFormat: () => ZodStringFormat,
|
|
17206
|
+
ZodString: () => ZodString,
|
|
17207
|
+
ZodSet: () => ZodSet,
|
|
17208
|
+
ZodRecord: () => ZodRecord,
|
|
17209
|
+
ZodRealError: () => ZodRealError,
|
|
17210
|
+
ZodReadonly: () => ZodReadonly,
|
|
17211
|
+
ZodPromise: () => ZodPromise,
|
|
17212
|
+
ZodPrefault: () => ZodPrefault,
|
|
17213
|
+
ZodPipe: () => ZodPipe,
|
|
17214
|
+
ZodOptional: () => ZodOptional,
|
|
17215
|
+
ZodObject: () => ZodObject,
|
|
17216
|
+
ZodNumberFormat: () => ZodNumberFormat,
|
|
17217
|
+
ZodNumber: () => ZodNumber,
|
|
17218
|
+
ZodNullable: () => ZodNullable,
|
|
17219
|
+
ZodNull: () => ZodNull,
|
|
17220
|
+
ZodNonOptional: () => ZodNonOptional,
|
|
17221
|
+
ZodNever: () => ZodNever,
|
|
17222
|
+
ZodNanoID: () => ZodNanoID,
|
|
17223
|
+
ZodNaN: () => ZodNaN,
|
|
17224
|
+
ZodMap: () => ZodMap,
|
|
17225
|
+
ZodMAC: () => ZodMAC,
|
|
17226
|
+
ZodLiteral: () => ZodLiteral,
|
|
17227
|
+
ZodLazy: () => ZodLazy,
|
|
17228
|
+
ZodKSUID: () => ZodKSUID,
|
|
17229
|
+
ZodJWT: () => ZodJWT,
|
|
17230
|
+
ZodIssueCode: () => ZodIssueCode,
|
|
17231
|
+
ZodIntersection: () => ZodIntersection,
|
|
17232
|
+
ZodISOTime: () => ZodISOTime,
|
|
17233
|
+
ZodISODuration: () => ZodISODuration,
|
|
17234
|
+
ZodISODateTime: () => ZodISODateTime,
|
|
17235
|
+
ZodISODate: () => ZodISODate,
|
|
17236
|
+
ZodIPv6: () => ZodIPv6,
|
|
17237
|
+
ZodIPv4: () => ZodIPv4,
|
|
17238
|
+
ZodGUID: () => ZodGUID,
|
|
17239
|
+
ZodFunction: () => ZodFunction,
|
|
17240
|
+
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
17241
|
+
ZodFile: () => ZodFile,
|
|
17242
|
+
ZodExactOptional: () => ZodExactOptional,
|
|
17243
|
+
ZodError: () => ZodError,
|
|
17244
|
+
ZodEnum: () => ZodEnum,
|
|
17245
|
+
ZodEmoji: () => ZodEmoji,
|
|
17246
|
+
ZodEmail: () => ZodEmail,
|
|
17247
|
+
ZodE164: () => ZodE164,
|
|
17248
|
+
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
17249
|
+
ZodDefault: () => ZodDefault,
|
|
17250
|
+
ZodDate: () => ZodDate,
|
|
17251
|
+
ZodCustomStringFormat: () => ZodCustomStringFormat,
|
|
17252
|
+
ZodCustom: () => ZodCustom,
|
|
17253
|
+
ZodCodec: () => ZodCodec,
|
|
17254
|
+
ZodCatch: () => ZodCatch,
|
|
17255
|
+
ZodCUID2: () => ZodCUID2,
|
|
17256
|
+
ZodCUID: () => ZodCUID,
|
|
17257
|
+
ZodCIDRv6: () => ZodCIDRv6,
|
|
17258
|
+
ZodCIDRv4: () => ZodCIDRv4,
|
|
17259
|
+
ZodBoolean: () => ZodBoolean,
|
|
17260
|
+
ZodBigIntFormat: () => ZodBigIntFormat,
|
|
17261
|
+
ZodBigInt: () => ZodBigInt,
|
|
17262
|
+
ZodBase64URL: () => ZodBase64URL,
|
|
17263
|
+
ZodBase64: () => ZodBase64,
|
|
17264
|
+
ZodArray: () => ZodArray,
|
|
17265
|
+
ZodAny: () => ZodAny,
|
|
17266
|
+
TimePrecision: () => TimePrecision,
|
|
17267
|
+
NEVER: () => NEVER,
|
|
17268
|
+
$output: () => $output,
|
|
17269
|
+
$input: () => $input,
|
|
17270
|
+
$brand: () => $brand
|
|
17271
|
+
});
|
|
18175
17272
|
|
|
18176
17273
|
// ../../node_modules/zod/v4/core/index.js
|
|
18177
17274
|
var exports_core2 = {};
|
|
@@ -18189,7 +17286,7 @@ __export(exports_core2, {
|
|
|
18189
17286
|
safeDecode: () => safeDecode,
|
|
18190
17287
|
registry: () => registry,
|
|
18191
17288
|
regexes: () => exports_regexes,
|
|
18192
|
-
process: () =>
|
|
17289
|
+
process: () => process2,
|
|
18193
17290
|
prettifyError: () => prettifyError,
|
|
18194
17291
|
parseAsync: () => parseAsync,
|
|
18195
17292
|
parse: () => parse,
|
|
@@ -18697,10 +17794,10 @@ function mergeDefs(...defs) {
|
|
|
18697
17794
|
function cloneDef(schema) {
|
|
18698
17795
|
return mergeDefs(schema._zod.def);
|
|
18699
17796
|
}
|
|
18700
|
-
function getElementAtPath(obj,
|
|
18701
|
-
if (!
|
|
17797
|
+
function getElementAtPath(obj, path) {
|
|
17798
|
+
if (!path)
|
|
18702
17799
|
return obj;
|
|
18703
|
-
return
|
|
17800
|
+
return path.reduce((acc, key) => acc?.[key], obj);
|
|
18704
17801
|
}
|
|
18705
17802
|
function promiseAllObject(promisesObj) {
|
|
18706
17803
|
const keys = Object.keys(promisesObj);
|
|
@@ -19081,11 +18178,11 @@ function aborted(x, startIndex = 0) {
|
|
|
19081
18178
|
}
|
|
19082
18179
|
return false;
|
|
19083
18180
|
}
|
|
19084
|
-
function prefixIssues(
|
|
18181
|
+
function prefixIssues(path, issues) {
|
|
19085
18182
|
return issues.map((iss) => {
|
|
19086
18183
|
var _a;
|
|
19087
18184
|
(_a = iss).path ?? (_a.path = []);
|
|
19088
|
-
iss.path.unshift(
|
|
18185
|
+
iss.path.unshift(path);
|
|
19089
18186
|
return iss;
|
|
19090
18187
|
});
|
|
19091
18188
|
}
|
|
@@ -19268,7 +18365,7 @@ function formatError(error, mapper = (issue2) => issue2.message) {
|
|
|
19268
18365
|
}
|
|
19269
18366
|
function treeifyError(error, mapper = (issue2) => issue2.message) {
|
|
19270
18367
|
const result = { errors: [] };
|
|
19271
|
-
const processError = (error2,
|
|
18368
|
+
const processError = (error2, path = []) => {
|
|
19272
18369
|
var _a, _b;
|
|
19273
18370
|
for (const issue2 of error2.issues) {
|
|
19274
18371
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
@@ -19278,7 +18375,7 @@ function treeifyError(error, mapper = (issue2) => issue2.message) {
|
|
|
19278
18375
|
} else if (issue2.code === "invalid_element") {
|
|
19279
18376
|
processError({ issues: issue2.issues }, issue2.path);
|
|
19280
18377
|
} else {
|
|
19281
|
-
const fullpath = [...
|
|
18378
|
+
const fullpath = [...path, ...issue2.path];
|
|
19282
18379
|
if (fullpath.length === 0) {
|
|
19283
18380
|
result.errors.push(mapper(issue2));
|
|
19284
18381
|
continue;
|
|
@@ -19310,8 +18407,8 @@ function treeifyError(error, mapper = (issue2) => issue2.message) {
|
|
|
19310
18407
|
}
|
|
19311
18408
|
function toDotPath(_path) {
|
|
19312
18409
|
const segs = [];
|
|
19313
|
-
const
|
|
19314
|
-
for (const seg of
|
|
18410
|
+
const path = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
18411
|
+
for (const seg of path) {
|
|
19315
18412
|
if (typeof seg === "number")
|
|
19316
18413
|
segs.push(`[${seg}]`);
|
|
19317
18414
|
else if (typeof seg === "symbol")
|
|
@@ -28653,7 +27750,7 @@ function initializeContext(params) {
|
|
|
28653
27750
|
external: params?.external ?? undefined
|
|
28654
27751
|
};
|
|
28655
27752
|
}
|
|
28656
|
-
function
|
|
27753
|
+
function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
28657
27754
|
var _a2;
|
|
28658
27755
|
const def = schema._zod.def;
|
|
28659
27756
|
const seen = ctx.seen.get(schema);
|
|
@@ -28690,7 +27787,7 @@ function process4(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
28690
27787
|
if (parent) {
|
|
28691
27788
|
if (!result.ref)
|
|
28692
27789
|
result.ref = parent;
|
|
28693
|
-
|
|
27790
|
+
process2(parent, ctx, params);
|
|
28694
27791
|
ctx.seen.get(parent).isParent = true;
|
|
28695
27792
|
}
|
|
28696
27793
|
}
|
|
@@ -28966,14 +28063,14 @@ function isTransforming(_schema, _ctx) {
|
|
|
28966
28063
|
}
|
|
28967
28064
|
var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
28968
28065
|
const ctx = initializeContext({ ...params, processors });
|
|
28969
|
-
|
|
28066
|
+
process2(schema, ctx);
|
|
28970
28067
|
extractDefs(ctx, schema);
|
|
28971
28068
|
return finalize(ctx, schema);
|
|
28972
28069
|
};
|
|
28973
28070
|
var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
28974
28071
|
const { libraryOptions, target } = params ?? {};
|
|
28975
28072
|
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
|
|
28976
|
-
|
|
28073
|
+
process2(schema, ctx);
|
|
28977
28074
|
extractDefs(ctx, schema);
|
|
28978
28075
|
return finalize(ctx, schema);
|
|
28979
28076
|
};
|
|
@@ -29224,7 +28321,7 @@ var arrayProcessor = (schema, ctx, _json, params) => {
|
|
|
29224
28321
|
if (typeof maximum === "number")
|
|
29225
28322
|
json.maxItems = maximum;
|
|
29226
28323
|
json.type = "array";
|
|
29227
|
-
json.items =
|
|
28324
|
+
json.items = process2(def.element, ctx, { ...params, path: [...params.path, "items"] });
|
|
29228
28325
|
};
|
|
29229
28326
|
var objectProcessor = (schema, ctx, _json, params) => {
|
|
29230
28327
|
const json = _json;
|
|
@@ -29233,7 +28330,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
29233
28330
|
json.properties = {};
|
|
29234
28331
|
const shape = def.shape;
|
|
29235
28332
|
for (const key in shape) {
|
|
29236
|
-
json.properties[key] =
|
|
28333
|
+
json.properties[key] = process2(shape[key], ctx, {
|
|
29237
28334
|
...params,
|
|
29238
28335
|
path: [...params.path, "properties", key]
|
|
29239
28336
|
});
|
|
@@ -29256,7 +28353,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
29256
28353
|
if (ctx.io === "output")
|
|
29257
28354
|
json.additionalProperties = false;
|
|
29258
28355
|
} else if (def.catchall) {
|
|
29259
|
-
json.additionalProperties =
|
|
28356
|
+
json.additionalProperties = process2(def.catchall, ctx, {
|
|
29260
28357
|
...params,
|
|
29261
28358
|
path: [...params.path, "additionalProperties"]
|
|
29262
28359
|
});
|
|
@@ -29265,7 +28362,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
29265
28362
|
var unionProcessor = (schema, ctx, json, params) => {
|
|
29266
28363
|
const def = schema._zod.def;
|
|
29267
28364
|
const isExclusive = def.inclusive === false;
|
|
29268
|
-
const options = def.options.map((x, i) =>
|
|
28365
|
+
const options = def.options.map((x, i) => process2(x, ctx, {
|
|
29269
28366
|
...params,
|
|
29270
28367
|
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
|
|
29271
28368
|
}));
|
|
@@ -29277,11 +28374,11 @@ var unionProcessor = (schema, ctx, json, params) => {
|
|
|
29277
28374
|
};
|
|
29278
28375
|
var intersectionProcessor = (schema, ctx, json, params) => {
|
|
29279
28376
|
const def = schema._zod.def;
|
|
29280
|
-
const a =
|
|
28377
|
+
const a = process2(def.left, ctx, {
|
|
29281
28378
|
...params,
|
|
29282
28379
|
path: [...params.path, "allOf", 0]
|
|
29283
28380
|
});
|
|
29284
|
-
const b =
|
|
28381
|
+
const b = process2(def.right, ctx, {
|
|
29285
28382
|
...params,
|
|
29286
28383
|
path: [...params.path, "allOf", 1]
|
|
29287
28384
|
});
|
|
@@ -29298,11 +28395,11 @@ var tupleProcessor = (schema, ctx, _json, params) => {
|
|
|
29298
28395
|
json.type = "array";
|
|
29299
28396
|
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
29300
28397
|
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
29301
|
-
const prefixItems = def.items.map((x, i) =>
|
|
28398
|
+
const prefixItems = def.items.map((x, i) => process2(x, ctx, {
|
|
29302
28399
|
...params,
|
|
29303
28400
|
path: [...params.path, prefixPath, i]
|
|
29304
28401
|
}));
|
|
29305
|
-
const rest = def.rest ?
|
|
28402
|
+
const rest = def.rest ? process2(def.rest, ctx, {
|
|
29306
28403
|
...params,
|
|
29307
28404
|
path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
|
|
29308
28405
|
}) : null;
|
|
@@ -29342,7 +28439,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
29342
28439
|
const keyBag = keyType._zod.bag;
|
|
29343
28440
|
const patterns = keyBag?.patterns;
|
|
29344
28441
|
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
29345
|
-
const valueSchema =
|
|
28442
|
+
const valueSchema = process2(def.valueType, ctx, {
|
|
29346
28443
|
...params,
|
|
29347
28444
|
path: [...params.path, "patternProperties", "*"]
|
|
29348
28445
|
});
|
|
@@ -29352,12 +28449,12 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
29352
28449
|
}
|
|
29353
28450
|
} else {
|
|
29354
28451
|
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
29355
|
-
json.propertyNames =
|
|
28452
|
+
json.propertyNames = process2(def.keyType, ctx, {
|
|
29356
28453
|
...params,
|
|
29357
28454
|
path: [...params.path, "propertyNames"]
|
|
29358
28455
|
});
|
|
29359
28456
|
}
|
|
29360
|
-
json.additionalProperties =
|
|
28457
|
+
json.additionalProperties = process2(def.valueType, ctx, {
|
|
29361
28458
|
...params,
|
|
29362
28459
|
path: [...params.path, "additionalProperties"]
|
|
29363
28460
|
});
|
|
@@ -29372,7 +28469,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
29372
28469
|
};
|
|
29373
28470
|
var nullableProcessor = (schema, ctx, json, params) => {
|
|
29374
28471
|
const def = schema._zod.def;
|
|
29375
|
-
const inner =
|
|
28472
|
+
const inner = process2(def.innerType, ctx, params);
|
|
29376
28473
|
const seen = ctx.seen.get(schema);
|
|
29377
28474
|
if (ctx.target === "openapi-3.0") {
|
|
29378
28475
|
seen.ref = def.innerType;
|
|
@@ -29383,20 +28480,20 @@ var nullableProcessor = (schema, ctx, json, params) => {
|
|
|
29383
28480
|
};
|
|
29384
28481
|
var nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
29385
28482
|
const def = schema._zod.def;
|
|
29386
|
-
|
|
28483
|
+
process2(def.innerType, ctx, params);
|
|
29387
28484
|
const seen = ctx.seen.get(schema);
|
|
29388
28485
|
seen.ref = def.innerType;
|
|
29389
28486
|
};
|
|
29390
28487
|
var defaultProcessor = (schema, ctx, json, params) => {
|
|
29391
28488
|
const def = schema._zod.def;
|
|
29392
|
-
|
|
28489
|
+
process2(def.innerType, ctx, params);
|
|
29393
28490
|
const seen = ctx.seen.get(schema);
|
|
29394
28491
|
seen.ref = def.innerType;
|
|
29395
28492
|
json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
29396
28493
|
};
|
|
29397
28494
|
var prefaultProcessor = (schema, ctx, json, params) => {
|
|
29398
28495
|
const def = schema._zod.def;
|
|
29399
|
-
|
|
28496
|
+
process2(def.innerType, ctx, params);
|
|
29400
28497
|
const seen = ctx.seen.get(schema);
|
|
29401
28498
|
seen.ref = def.innerType;
|
|
29402
28499
|
if (ctx.io === "input")
|
|
@@ -29404,7 +28501,7 @@ var prefaultProcessor = (schema, ctx, json, params) => {
|
|
|
29404
28501
|
};
|
|
29405
28502
|
var catchProcessor = (schema, ctx, json, params) => {
|
|
29406
28503
|
const def = schema._zod.def;
|
|
29407
|
-
|
|
28504
|
+
process2(def.innerType, ctx, params);
|
|
29408
28505
|
const seen = ctx.seen.get(schema);
|
|
29409
28506
|
seen.ref = def.innerType;
|
|
29410
28507
|
let catchValue;
|
|
@@ -29418,32 +28515,32 @@ var catchProcessor = (schema, ctx, json, params) => {
|
|
|
29418
28515
|
var pipeProcessor = (schema, ctx, _json, params) => {
|
|
29419
28516
|
const def = schema._zod.def;
|
|
29420
28517
|
const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
|
|
29421
|
-
|
|
28518
|
+
process2(innerType, ctx, params);
|
|
29422
28519
|
const seen = ctx.seen.get(schema);
|
|
29423
28520
|
seen.ref = innerType;
|
|
29424
28521
|
};
|
|
29425
28522
|
var readonlyProcessor = (schema, ctx, json, params) => {
|
|
29426
28523
|
const def = schema._zod.def;
|
|
29427
|
-
|
|
28524
|
+
process2(def.innerType, ctx, params);
|
|
29428
28525
|
const seen = ctx.seen.get(schema);
|
|
29429
28526
|
seen.ref = def.innerType;
|
|
29430
28527
|
json.readOnly = true;
|
|
29431
28528
|
};
|
|
29432
28529
|
var promiseProcessor = (schema, ctx, _json, params) => {
|
|
29433
28530
|
const def = schema._zod.def;
|
|
29434
|
-
|
|
28531
|
+
process2(def.innerType, ctx, params);
|
|
29435
28532
|
const seen = ctx.seen.get(schema);
|
|
29436
28533
|
seen.ref = def.innerType;
|
|
29437
28534
|
};
|
|
29438
28535
|
var optionalProcessor = (schema, ctx, _json, params) => {
|
|
29439
28536
|
const def = schema._zod.def;
|
|
29440
|
-
|
|
28537
|
+
process2(def.innerType, ctx, params);
|
|
29441
28538
|
const seen = ctx.seen.get(schema);
|
|
29442
28539
|
seen.ref = def.innerType;
|
|
29443
28540
|
};
|
|
29444
28541
|
var lazyProcessor = (schema, ctx, _json, params) => {
|
|
29445
28542
|
const innerType = schema._zod.innerType;
|
|
29446
|
-
|
|
28543
|
+
process2(innerType, ctx, params);
|
|
29447
28544
|
const seen = ctx.seen.get(schema);
|
|
29448
28545
|
seen.ref = innerType;
|
|
29449
28546
|
};
|
|
@@ -29495,7 +28592,7 @@ function toJSONSchema(input, params) {
|
|
|
29495
28592
|
const defs = {};
|
|
29496
28593
|
for (const entry of registry2._idmap.entries()) {
|
|
29497
28594
|
const [_, schema] = entry;
|
|
29498
|
-
|
|
28595
|
+
process2(schema, ctx2);
|
|
29499
28596
|
}
|
|
29500
28597
|
const schemas = {};
|
|
29501
28598
|
const external = {
|
|
@@ -29518,7 +28615,7 @@ function toJSONSchema(input, params) {
|
|
|
29518
28615
|
return { schemas };
|
|
29519
28616
|
}
|
|
29520
28617
|
const ctx = initializeContext({ ...params, processors: allProcessors });
|
|
29521
|
-
|
|
28618
|
+
process2(input, ctx);
|
|
29522
28619
|
extractDefs(ctx, input);
|
|
29523
28620
|
return finalize(ctx, input);
|
|
29524
28621
|
}
|
|
@@ -29564,7 +28661,7 @@ class JSONSchemaGenerator {
|
|
|
29564
28661
|
});
|
|
29565
28662
|
}
|
|
29566
28663
|
process(schema, _params = { path: [], schemaPath: [] }) {
|
|
29567
|
-
return
|
|
28664
|
+
return process2(schema, this.ctx, _params);
|
|
29568
28665
|
}
|
|
29569
28666
|
emit(schema, _params) {
|
|
29570
28667
|
if (_params) {
|
|
@@ -31058,13 +30155,13 @@ function resolveRef(ref, ctx) {
|
|
|
31058
30155
|
if (!ref.startsWith("#")) {
|
|
31059
30156
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
31060
30157
|
}
|
|
31061
|
-
const
|
|
31062
|
-
if (
|
|
30158
|
+
const path = ref.slice(1).split("/").filter(Boolean);
|
|
30159
|
+
if (path.length === 0) {
|
|
31063
30160
|
return ctx.rootSchema;
|
|
31064
30161
|
}
|
|
31065
30162
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
31066
|
-
if (
|
|
31067
|
-
const key =
|
|
30163
|
+
if (path[0] === defsKey) {
|
|
30164
|
+
const key = path[1];
|
|
31068
30165
|
if (!key || !ctx.defs[key]) {
|
|
31069
30166
|
throw new Error(`Reference not found: ${ref}`);
|
|
31070
30167
|
}
|
|
@@ -31466,7 +30563,7 @@ function date4(params) {
|
|
|
31466
30563
|
config(en_default());
|
|
31467
30564
|
// ../shared/src/common.ts
|
|
31468
30565
|
var BaseEntitySchema = exports_external.object({
|
|
31469
|
-
id: exports_external.
|
|
30566
|
+
id: exports_external.uuid(),
|
|
31470
30567
|
createdAt: exports_external.union([exports_external.date(), exports_external.number()]),
|
|
31471
30568
|
updatedAt: exports_external.union([exports_external.date(), exports_external.number()])
|
|
31472
30569
|
});
|
|
@@ -31562,16 +30659,17 @@ var EventType;
|
|
|
31562
30659
|
EventType2["MEMBER_INVITED"] = "MEMBER_INVITED";
|
|
31563
30660
|
EventType2["SPRINT_CREATED"] = "SPRINT_CREATED";
|
|
31564
30661
|
EventType2["SPRINT_STATUS_CHANGED"] = "SPRINT_STATUS_CHANGED";
|
|
30662
|
+
EventType2["SPRINT_DELETED"] = "SPRINT_DELETED";
|
|
31565
30663
|
EventType2["CHECKLIST_INITIALIZED"] = "CHECKLIST_INITIALIZED";
|
|
31566
30664
|
})(EventType ||= {});
|
|
31567
30665
|
// ../shared/src/models/activity.ts
|
|
31568
30666
|
var CommentSchema = BaseEntitySchema.extend({
|
|
31569
|
-
taskId: exports_external.
|
|
30667
|
+
taskId: exports_external.uuid(),
|
|
31570
30668
|
author: exports_external.string().min(1),
|
|
31571
30669
|
text: exports_external.string().min(1)
|
|
31572
30670
|
});
|
|
31573
30671
|
var ArtifactSchema = BaseEntitySchema.extend({
|
|
31574
|
-
taskId: exports_external.
|
|
30672
|
+
taskId: exports_external.uuid(),
|
|
31575
30673
|
type: exports_external.string().min(1),
|
|
31576
30674
|
title: exports_external.string().min(1),
|
|
31577
30675
|
contentText: exports_external.string().optional(),
|
|
@@ -31588,8 +30686,8 @@ var TaskDeletedPayloadSchema = exports_external.object({
|
|
|
31588
30686
|
});
|
|
31589
30687
|
var StatusChangedPayloadSchema = exports_external.object({
|
|
31590
30688
|
title: exports_external.string(),
|
|
31591
|
-
oldStatus: exports_external.
|
|
31592
|
-
newStatus: exports_external.
|
|
30689
|
+
oldStatus: exports_external.enum(TaskStatus),
|
|
30690
|
+
newStatus: exports_external.enum(TaskStatus)
|
|
31593
30691
|
});
|
|
31594
30692
|
var CommentAddedPayloadSchema = exports_external.object({
|
|
31595
30693
|
title: exports_external.string(),
|
|
@@ -31608,13 +30706,13 @@ var MemberInvitedPayloadSchema = exports_external.object({
|
|
|
31608
30706
|
});
|
|
31609
30707
|
var SprintCreatedPayloadSchema = exports_external.object({
|
|
31610
30708
|
name: exports_external.string(),
|
|
31611
|
-
sprintId: exports_external.
|
|
30709
|
+
sprintId: exports_external.uuid()
|
|
31612
30710
|
});
|
|
31613
30711
|
var SprintStatusChangedPayloadSchema = exports_external.object({
|
|
31614
30712
|
name: exports_external.string(),
|
|
31615
|
-
sprintId: exports_external.
|
|
31616
|
-
oldStatus: exports_external.
|
|
31617
|
-
newStatus: exports_external.
|
|
30713
|
+
sprintId: exports_external.uuid(),
|
|
30714
|
+
oldStatus: exports_external.enum(SprintStatus),
|
|
30715
|
+
newStatus: exports_external.enum(SprintStatus)
|
|
31618
30716
|
});
|
|
31619
30717
|
var ChecklistInitializedPayloadSchema = exports_external.object({
|
|
31620
30718
|
itemCount: exports_external.number()
|
|
@@ -31677,9 +30775,9 @@ var EventPayloadSchema = exports_external.discriminatedUnion("type", [
|
|
|
31677
30775
|
var EventSchema = exports_external.object({
|
|
31678
30776
|
id: exports_external.string(),
|
|
31679
30777
|
workspaceId: exports_external.string(),
|
|
31680
|
-
taskId: exports_external.
|
|
30778
|
+
taskId: exports_external.uuid().optional().nullable(),
|
|
31681
30779
|
userId: exports_external.string().optional().nullable(),
|
|
31682
|
-
type: exports_external.
|
|
30780
|
+
type: exports_external.enum(EventType),
|
|
31683
30781
|
payload: exports_external.record(exports_external.string(), exports_external.unknown()),
|
|
31684
30782
|
createdAt: exports_external.union([exports_external.date(), exports_external.number()])
|
|
31685
30783
|
});
|
|
@@ -31713,14 +30811,14 @@ var ArtifactsResponseSchema = exports_external.object({
|
|
|
31713
30811
|
artifacts: exports_external.array(ArtifactSchema)
|
|
31714
30812
|
});
|
|
31715
30813
|
var CreateArtifactSchema = exports_external.object({
|
|
31716
|
-
taskId: exports_external.
|
|
30814
|
+
taskId: exports_external.uuid(),
|
|
31717
30815
|
type: exports_external.string().min(1),
|
|
31718
30816
|
title: exports_external.string().min(1),
|
|
31719
30817
|
contentText: exports_external.string().optional()
|
|
31720
30818
|
});
|
|
31721
30819
|
var ReportCiResultSchema = exports_external.object({
|
|
31722
|
-
workspaceId: exports_external.
|
|
31723
|
-
taskId: exports_external.
|
|
30820
|
+
workspaceId: exports_external.uuid(),
|
|
30821
|
+
taskId: exports_external.uuid().optional(),
|
|
31724
30822
|
preset: exports_external.string(),
|
|
31725
30823
|
ok: exports_external.boolean(),
|
|
31726
30824
|
summary: exports_external.string(),
|
|
@@ -31737,14 +30835,53 @@ var LockSchema = exports_external.object({
|
|
|
31737
30835
|
var UnlockSchema = exports_external.object({
|
|
31738
30836
|
agentId: exports_external.string().min(1)
|
|
31739
30837
|
});
|
|
30838
|
+
// ../shared/src/models/ai.ts
|
|
30839
|
+
var AIRoleSchema = exports_external.enum(["user", "assistant", "system"]);
|
|
30840
|
+
var AIArtifactSchema = exports_external.object({
|
|
30841
|
+
id: exports_external.string(),
|
|
30842
|
+
type: exports_external.enum(["code", "document", "sprint", "task_list", "task"]),
|
|
30843
|
+
title: exports_external.string(),
|
|
30844
|
+
content: exports_external.string(),
|
|
30845
|
+
language: exports_external.string().optional(),
|
|
30846
|
+
metadata: exports_external.record(exports_external.string(), exports_external.any()).optional()
|
|
30847
|
+
});
|
|
30848
|
+
var SuggestedActionSchema = exports_external.object({
|
|
30849
|
+
label: exports_external.string(),
|
|
30850
|
+
type: exports_external.enum([
|
|
30851
|
+
"create_task",
|
|
30852
|
+
"create_doc",
|
|
30853
|
+
"chat_suggestion",
|
|
30854
|
+
"start_sprint",
|
|
30855
|
+
"plan_sprint"
|
|
30856
|
+
]),
|
|
30857
|
+
payload: exports_external.any()
|
|
30858
|
+
});
|
|
30859
|
+
var AIMessageSchema = exports_external.object({
|
|
30860
|
+
id: exports_external.string(),
|
|
30861
|
+
role: AIRoleSchema,
|
|
30862
|
+
content: exports_external.string(),
|
|
30863
|
+
timestamp: exports_external.union([exports_external.string(), exports_external.number()]).or(exports_external.date()).or(exports_external.any()).optional().transform((val) => val ? new Date(val) : new Date),
|
|
30864
|
+
thoughtProcess: exports_external.string().optional(),
|
|
30865
|
+
artifacts: exports_external.array(AIArtifactSchema).optional(),
|
|
30866
|
+
suggestedActions: exports_external.array(SuggestedActionSchema).optional()
|
|
30867
|
+
});
|
|
30868
|
+
var ChatRequestSchema = exports_external.object({
|
|
30869
|
+
message: exports_external.string().min(1, "Message is required"),
|
|
30870
|
+
sessionId: exports_external.string().optional()
|
|
30871
|
+
});
|
|
30872
|
+
var ChatResponseSchema = exports_external.object({
|
|
30873
|
+
message: AIMessageSchema,
|
|
30874
|
+
sessionId: exports_external.string(),
|
|
30875
|
+
history: exports_external.array(AIMessageSchema).optional()
|
|
30876
|
+
});
|
|
31740
30877
|
// ../shared/src/models/user.ts
|
|
31741
30878
|
var UserSchema = BaseEntitySchema.extend({
|
|
31742
30879
|
email: exports_external.string().email(),
|
|
31743
30880
|
name: exports_external.string().min(1),
|
|
31744
30881
|
avatarUrl: exports_external.string().url().nullable().optional(),
|
|
31745
|
-
role: exports_external.
|
|
31746
|
-
orgId: exports_external.
|
|
31747
|
-
workspaceId: exports_external.
|
|
30882
|
+
role: exports_external.enum(UserRole),
|
|
30883
|
+
orgId: exports_external.uuid().optional().nullable(),
|
|
30884
|
+
workspaceId: exports_external.uuid().optional().nullable(),
|
|
31748
30885
|
companyName: exports_external.string().optional(),
|
|
31749
30886
|
userRole: exports_external.string().optional(),
|
|
31750
30887
|
teamSize: exports_external.string().optional(),
|
|
@@ -31765,18 +30902,18 @@ var UpdateUserSchema = UserSchema.partial().omit({
|
|
|
31765
30902
|
// ../shared/src/models/auth.ts
|
|
31766
30903
|
var JwtAuthUserSchema = exports_external.object({
|
|
31767
30904
|
authType: exports_external.literal("jwt"),
|
|
31768
|
-
id: exports_external.
|
|
30905
|
+
id: exports_external.uuid(),
|
|
31769
30906
|
email: exports_external.string().email(),
|
|
31770
30907
|
name: exports_external.string(),
|
|
31771
|
-
role: exports_external.
|
|
31772
|
-
orgId: exports_external.
|
|
31773
|
-
workspaceId: exports_external.
|
|
30908
|
+
role: exports_external.enum(UserRole),
|
|
30909
|
+
orgId: exports_external.uuid().nullable().optional(),
|
|
30910
|
+
workspaceId: exports_external.uuid().nullable().optional()
|
|
31774
30911
|
});
|
|
31775
30912
|
var ApiKeyAuthUserSchema = exports_external.object({
|
|
31776
30913
|
authType: exports_external.literal("api_key"),
|
|
31777
|
-
apiKeyId: exports_external.
|
|
30914
|
+
apiKeyId: exports_external.uuid(),
|
|
31778
30915
|
apiKeyName: exports_external.string(),
|
|
31779
|
-
orgId: exports_external.
|
|
30916
|
+
orgId: exports_external.uuid()
|
|
31780
30917
|
});
|
|
31781
30918
|
var AuthenticatedUserSchema = exports_external.discriminatedUnion("authType", [
|
|
31782
30919
|
JwtAuthUserSchema,
|
|
@@ -31808,7 +30945,7 @@ var JWTPayloadSchema = exports_external.object({
|
|
|
31808
30945
|
email: exports_external.string().email(),
|
|
31809
30946
|
name: exports_external.string(),
|
|
31810
30947
|
role: exports_external.string(),
|
|
31811
|
-
orgId: exports_external.
|
|
30948
|
+
orgId: exports_external.uuid().optional(),
|
|
31812
30949
|
iat: exports_external.number(),
|
|
31813
30950
|
exp: exports_external.number()
|
|
31814
30951
|
});
|
|
@@ -31817,8 +30954,8 @@ var AuthContextSchema = exports_external.object({
|
|
|
31817
30954
|
email: exports_external.string().email(),
|
|
31818
30955
|
name: exports_external.string(),
|
|
31819
30956
|
role: exports_external.string(),
|
|
31820
|
-
orgId: exports_external.
|
|
31821
|
-
workspaceId: exports_external.
|
|
30957
|
+
orgId: exports_external.uuid().optional(),
|
|
30958
|
+
workspaceId: exports_external.uuid().optional(),
|
|
31822
30959
|
authType: exports_external.enum(["jwt", "api_key", "local"])
|
|
31823
30960
|
});
|
|
31824
30961
|
var APIKeySchema = exports_external.object({
|
|
@@ -31849,8 +30986,8 @@ var CreateApiKeySchema = exports_external.object({
|
|
|
31849
30986
|
});
|
|
31850
30987
|
// ../shared/src/models/ci.ts
|
|
31851
30988
|
var RecordCiSchema = exports_external.object({
|
|
31852
|
-
taskId: exports_external.
|
|
31853
|
-
workspaceId: exports_external.
|
|
30989
|
+
taskId: exports_external.uuid(),
|
|
30990
|
+
workspaceId: exports_external.uuid(),
|
|
31854
30991
|
result: exports_external.object({
|
|
31855
30992
|
ok: exports_external.boolean(),
|
|
31856
30993
|
summary: exports_external.string(),
|
|
@@ -31865,25 +31002,36 @@ var RecordCiSchema = exports_external.object({
|
|
|
31865
31002
|
});
|
|
31866
31003
|
// ../shared/src/models/doc.ts
|
|
31867
31004
|
var DocGroupSchemaForDoc = exports_external.object({
|
|
31868
|
-
id: exports_external.
|
|
31005
|
+
id: exports_external.uuid(),
|
|
31869
31006
|
name: exports_external.string()
|
|
31870
31007
|
});
|
|
31008
|
+
var DocType;
|
|
31009
|
+
((DocType2) => {
|
|
31010
|
+
DocType2["GENERAL"] = "GENERAL";
|
|
31011
|
+
DocType2["PRD"] = "PRD";
|
|
31012
|
+
DocType2["TECH_SPEC"] = "TECH_SPEC";
|
|
31013
|
+
DocType2["ADR"] = "ADR";
|
|
31014
|
+
DocType2["API_DESIGN"] = "API_DESIGN";
|
|
31015
|
+
})(DocType ||= {});
|
|
31871
31016
|
var DocSchema = BaseEntitySchema.extend({
|
|
31872
|
-
workspaceId: exports_external.
|
|
31873
|
-
groupId: exports_external.
|
|
31017
|
+
workspaceId: exports_external.uuid(),
|
|
31018
|
+
groupId: exports_external.uuid().nullable().optional(),
|
|
31874
31019
|
title: exports_external.string().min(1, "Title is required"),
|
|
31875
31020
|
content: exports_external.string().default(""),
|
|
31021
|
+
type: exports_external.enum(DocType).default("GENERAL" /* GENERAL */),
|
|
31876
31022
|
group: DocGroupSchemaForDoc.nullable().optional()
|
|
31877
31023
|
});
|
|
31878
31024
|
var CreateDocSchema = exports_external.object({
|
|
31879
31025
|
title: exports_external.string().min(1, "Title is required"),
|
|
31880
31026
|
content: exports_external.string().optional(),
|
|
31881
|
-
|
|
31027
|
+
type: exports_external.enum(DocType).optional().default("GENERAL" /* GENERAL */),
|
|
31028
|
+
groupId: exports_external.string().optional()
|
|
31882
31029
|
});
|
|
31883
31030
|
var UpdateDocSchema = exports_external.object({
|
|
31884
31031
|
title: exports_external.string().min(1).optional(),
|
|
31885
31032
|
content: exports_external.string().optional(),
|
|
31886
|
-
|
|
31033
|
+
type: exports_external.enum(DocType).optional(),
|
|
31034
|
+
groupId: exports_external.string().nullable().optional()
|
|
31887
31035
|
});
|
|
31888
31036
|
var DocResponseSchema = exports_external.object({
|
|
31889
31037
|
doc: DocSchema
|
|
@@ -31899,7 +31047,7 @@ var DocQuerySchema = exports_external.object({
|
|
|
31899
31047
|
});
|
|
31900
31048
|
// ../shared/src/models/doc-group.ts
|
|
31901
31049
|
var DocGroupSchema = BaseEntitySchema.extend({
|
|
31902
|
-
workspaceId: exports_external.
|
|
31050
|
+
workspaceId: exports_external.uuid(),
|
|
31903
31051
|
name: exports_external.string().min(1, "Name is required"),
|
|
31904
31052
|
order: exports_external.number().default(0)
|
|
31905
31053
|
});
|
|
@@ -31924,16 +31072,16 @@ var DocGroupIdParamSchema = exports_external.object({
|
|
|
31924
31072
|
var InvitationSchema = BaseEntitySchema.extend({
|
|
31925
31073
|
orgId: exports_external.string().uuid("Invalid Organization ID"),
|
|
31926
31074
|
email: exports_external.string().email("Invalid email address"),
|
|
31927
|
-
role: exports_external.
|
|
31075
|
+
role: exports_external.enum(MembershipRole),
|
|
31928
31076
|
token: exports_external.string(),
|
|
31929
31077
|
expiresAt: exports_external.number(),
|
|
31930
31078
|
acceptedAt: exports_external.number().nullable().optional(),
|
|
31931
|
-
invitedBy: exports_external.
|
|
31079
|
+
invitedBy: exports_external.uuid()
|
|
31932
31080
|
});
|
|
31933
31081
|
var CreateInvitationSchema = exports_external.object({
|
|
31934
31082
|
orgId: exports_external.string().uuid("Invalid Organization ID"),
|
|
31935
31083
|
email: exports_external.string().email("Invalid email address"),
|
|
31936
|
-
role: exports_external.
|
|
31084
|
+
role: exports_external.enum(MembershipRole).default("MEMBER" /* MEMBER */)
|
|
31937
31085
|
});
|
|
31938
31086
|
var AcceptInvitationSchema = exports_external.object({
|
|
31939
31087
|
token: exports_external.string().min(1, "Invitation token is required"),
|
|
@@ -31957,10 +31105,10 @@ var InvitationsResponseSchema = exports_external.object({
|
|
|
31957
31105
|
});
|
|
31958
31106
|
var AcceptInvitationResponseSchema = exports_external.object({
|
|
31959
31107
|
membership: exports_external.object({
|
|
31960
|
-
id: exports_external.
|
|
31961
|
-
userId: exports_external.
|
|
31962
|
-
orgId: exports_external.
|
|
31963
|
-
role: exports_external.
|
|
31108
|
+
id: exports_external.uuid(),
|
|
31109
|
+
userId: exports_external.uuid(),
|
|
31110
|
+
orgId: exports_external.uuid(),
|
|
31111
|
+
role: exports_external.enum(MembershipRole),
|
|
31964
31112
|
createdAt: exports_external.number()
|
|
31965
31113
|
})
|
|
31966
31114
|
});
|
|
@@ -31983,13 +31131,13 @@ var AddMemberSchema = exports_external.object({
|
|
|
31983
31131
|
role: exports_external.enum(["ADMIN", "MEMBER"]).default("MEMBER")
|
|
31984
31132
|
});
|
|
31985
31133
|
var MembershipWithUserSchema = exports_external.object({
|
|
31986
|
-
id: exports_external.
|
|
31987
|
-
userId: exports_external.
|
|
31988
|
-
orgId: exports_external.
|
|
31134
|
+
id: exports_external.uuid(),
|
|
31135
|
+
userId: exports_external.uuid(),
|
|
31136
|
+
orgId: exports_external.uuid(),
|
|
31989
31137
|
role: exports_external.string(),
|
|
31990
31138
|
createdAt: exports_external.number(),
|
|
31991
31139
|
user: exports_external.object({
|
|
31992
|
-
id: exports_external.
|
|
31140
|
+
id: exports_external.uuid(),
|
|
31993
31141
|
email: exports_external.string().email(),
|
|
31994
31142
|
name: exports_external.string(),
|
|
31995
31143
|
avatarUrl: exports_external.string().url().nullable().optional()
|
|
@@ -32015,9 +31163,9 @@ var MembershipResponseSchema = exports_external.object({
|
|
|
32015
31163
|
});
|
|
32016
31164
|
// ../shared/src/models/sprint.ts
|
|
32017
31165
|
var SprintSchema = BaseEntitySchema.extend({
|
|
32018
|
-
workspaceId: exports_external.
|
|
31166
|
+
workspaceId: exports_external.uuid().nullable().optional(),
|
|
32019
31167
|
name: exports_external.string().min(1, "Name is required").max(100),
|
|
32020
|
-
status: exports_external.
|
|
31168
|
+
status: exports_external.enum(SprintStatus),
|
|
32021
31169
|
startDate: exports_external.union([exports_external.date(), exports_external.number()]).nullable().optional(),
|
|
32022
31170
|
endDate: exports_external.union([exports_external.date(), exports_external.number()]).nullable().optional(),
|
|
32023
31171
|
mindmap: exports_external.string().nullable().optional(),
|
|
@@ -32025,18 +31173,22 @@ var SprintSchema = BaseEntitySchema.extend({
|
|
|
32025
31173
|
});
|
|
32026
31174
|
var CreateSprintSchema = exports_external.object({
|
|
32027
31175
|
name: exports_external.string().min(1, "Name is required").max(100),
|
|
32028
|
-
startDate: exports_external.union([exports_external.
|
|
32029
|
-
endDate: exports_external.union([exports_external.
|
|
31176
|
+
startDate: exports_external.union([exports_external.string(), exports_external.number()]).optional(),
|
|
31177
|
+
endDate: exports_external.union([exports_external.string(), exports_external.number()]).optional(),
|
|
31178
|
+
taskIds: exports_external.array(exports_external.string()).optional()
|
|
32030
31179
|
});
|
|
32031
31180
|
var UpdateSprintSchema = SprintSchema.partial().omit({
|
|
32032
31181
|
id: true,
|
|
32033
31182
|
createdAt: true,
|
|
32034
|
-
updatedAt: true
|
|
31183
|
+
updatedAt: true,
|
|
31184
|
+
startDate: true,
|
|
31185
|
+
endDate: true,
|
|
31186
|
+
mindmapUpdatedAt: true
|
|
32035
31187
|
}).extend({
|
|
32036
31188
|
name: exports_external.string().min(1).max(100).optional(),
|
|
32037
|
-
startDate: exports_external.union([exports_external.
|
|
32038
|
-
endDate: exports_external.union([exports_external.
|
|
32039
|
-
mindmapUpdatedAt: exports_external.union([exports_external.
|
|
31189
|
+
startDate: exports_external.union([exports_external.string(), exports_external.number()]).optional().nullable(),
|
|
31190
|
+
endDate: exports_external.union([exports_external.string(), exports_external.number()]).optional().nullable(),
|
|
31191
|
+
mindmapUpdatedAt: exports_external.union([exports_external.string(), exports_external.number()]).optional().nullable()
|
|
32040
31192
|
});
|
|
32041
31193
|
var SprintIdParamSchema = exports_external.object({
|
|
32042
31194
|
id: exports_external.string().uuid("Invalid Sprint ID")
|
|
@@ -32055,45 +31207,50 @@ var AcceptanceItemSchema = exports_external.object({
|
|
|
32055
31207
|
done: exports_external.boolean()
|
|
32056
31208
|
});
|
|
32057
31209
|
var TaskSchema = BaseEntitySchema.extend({
|
|
32058
|
-
workspaceId: exports_external.
|
|
31210
|
+
workspaceId: exports_external.uuid().nullable().optional(),
|
|
32059
31211
|
title: exports_external.string().min(1, "Title is required").max(200),
|
|
32060
|
-
description: exports_external.string()
|
|
32061
|
-
status: exports_external.
|
|
32062
|
-
priority: exports_external.
|
|
32063
|
-
labels: exports_external.array(exports_external.string())
|
|
32064
|
-
assigneeRole: exports_external.
|
|
31212
|
+
description: exports_external.string(),
|
|
31213
|
+
status: exports_external.enum(TaskStatus),
|
|
31214
|
+
priority: exports_external.enum(TaskPriority),
|
|
31215
|
+
labels: exports_external.array(exports_external.string()),
|
|
31216
|
+
assigneeRole: exports_external.enum(AssigneeRole).nullable().optional(),
|
|
32065
31217
|
assignedTo: exports_external.string().nullable().optional(),
|
|
32066
|
-
sprintId: exports_external.
|
|
32067
|
-
parentId: exports_external.
|
|
32068
|
-
dueDate: exports_external.union([exports_external.
|
|
32069
|
-
acceptanceChecklist: exports_external.array(AcceptanceItemSchema)
|
|
31218
|
+
sprintId: exports_external.uuid().nullable().optional(),
|
|
31219
|
+
parentId: exports_external.uuid().nullable().optional(),
|
|
31220
|
+
dueDate: exports_external.union([exports_external.string(), exports_external.number()]).nullable().optional(),
|
|
31221
|
+
acceptanceChecklist: exports_external.array(AcceptanceItemSchema),
|
|
32070
31222
|
comments: exports_external.array(CommentSchema).optional(),
|
|
32071
31223
|
activityLog: exports_external.array(EventSchema).optional(),
|
|
32072
|
-
docs: exports_external.array(DocSchema)
|
|
31224
|
+
docs: exports_external.array(DocSchema)
|
|
32073
31225
|
});
|
|
32074
31226
|
var CreateTaskSchema = exports_external.object({
|
|
32075
31227
|
title: exports_external.string().min(1, "Title is required").max(200),
|
|
32076
31228
|
description: exports_external.string().optional().default(""),
|
|
32077
|
-
status: exports_external.
|
|
32078
|
-
priority: exports_external.
|
|
31229
|
+
status: exports_external.enum(TaskStatus).optional().default("BACKLOG" /* BACKLOG */),
|
|
31230
|
+
priority: exports_external.enum(TaskPriority).optional().default("MEDIUM" /* MEDIUM */),
|
|
32079
31231
|
labels: exports_external.array(exports_external.string()).optional().default([]),
|
|
32080
|
-
assigneeRole: exports_external.
|
|
31232
|
+
assigneeRole: exports_external.enum(AssigneeRole).optional(),
|
|
32081
31233
|
assignedTo: exports_external.string().nullable().optional(),
|
|
32082
|
-
dueDate: exports_external.union([exports_external.
|
|
32083
|
-
parentId: exports_external.string().
|
|
32084
|
-
sprintId: exports_external.string().
|
|
31234
|
+
dueDate: exports_external.union([exports_external.string(), exports_external.number()]).nullable().optional(),
|
|
31235
|
+
parentId: exports_external.string().nullable().optional(),
|
|
31236
|
+
sprintId: exports_external.string().nullable().optional(),
|
|
32085
31237
|
acceptanceChecklist: exports_external.array(AcceptanceItemSchema).optional(),
|
|
32086
|
-
docIds: exports_external.array(exports_external.string()
|
|
31238
|
+
docIds: exports_external.array(exports_external.string()).optional()
|
|
32087
31239
|
});
|
|
32088
31240
|
var UpdateTaskSchema = TaskSchema.partial().omit({
|
|
32089
31241
|
id: true,
|
|
32090
31242
|
workspaceId: true,
|
|
32091
31243
|
createdAt: true,
|
|
32092
|
-
updatedAt: true
|
|
31244
|
+
updatedAt: true,
|
|
31245
|
+
dueDate: true,
|
|
31246
|
+
comments: true,
|
|
31247
|
+
activityLog: true,
|
|
31248
|
+
docs: true
|
|
32093
31249
|
}).extend({
|
|
32094
31250
|
title: exports_external.string().min(1).max(200).optional(),
|
|
31251
|
+
dueDate: exports_external.union([exports_external.string(), exports_external.number()]).optional().nullable(),
|
|
32095
31252
|
acceptanceChecklist: exports_external.array(AcceptanceItemSchema).optional(),
|
|
32096
|
-
docIds: exports_external.array(exports_external.string()
|
|
31253
|
+
docIds: exports_external.array(exports_external.string()).optional()
|
|
32097
31254
|
});
|
|
32098
31255
|
var AddCommentSchema = exports_external.object({
|
|
32099
31256
|
author: exports_external.string().min(1, "Author is required"),
|
|
@@ -32101,7 +31258,7 @@ var AddCommentSchema = exports_external.object({
|
|
|
32101
31258
|
});
|
|
32102
31259
|
var DispatchTaskSchema = exports_external.object({
|
|
32103
31260
|
workerId: exports_external.string().optional(),
|
|
32104
|
-
sprintId: exports_external.
|
|
31261
|
+
sprintId: exports_external.uuid().optional().nullable()
|
|
32105
31262
|
});
|
|
32106
31263
|
var TaskIdParamSchema = exports_external.object({
|
|
32107
31264
|
id: exports_external.string().uuid("Invalid Task ID")
|
|
@@ -32120,7 +31277,7 @@ var ChecklistItemSchema = exports_external.object({
|
|
|
32120
31277
|
done: exports_external.boolean()
|
|
32121
31278
|
});
|
|
32122
31279
|
var WorkspaceSchema = BaseEntitySchema.extend({
|
|
32123
|
-
orgId: exports_external.
|
|
31280
|
+
orgId: exports_external.uuid(),
|
|
32124
31281
|
name: exports_external.string().min(1, "Name is required").max(100),
|
|
32125
31282
|
defaultChecklist: exports_external.array(ChecklistItemSchema).nullable().optional()
|
|
32126
31283
|
});
|
|
@@ -32147,24 +31304,908 @@ var WorkspaceAndUserParamSchema = exports_external.object({
|
|
|
32147
31304
|
var WorkspaceResponseSchema = exports_external.object({
|
|
32148
31305
|
workspace: WorkspaceSchema
|
|
32149
31306
|
});
|
|
32150
|
-
var WorkspacesResponseSchema = exports_external.object({
|
|
32151
|
-
workspaces: exports_external.array(WorkspaceSchema)
|
|
31307
|
+
var WorkspacesResponseSchema = exports_external.object({
|
|
31308
|
+
workspaces: exports_external.array(WorkspaceSchema)
|
|
31309
|
+
});
|
|
31310
|
+
var WorkspaceStatsSchema = exports_external.object({
|
|
31311
|
+
workspaceName: exports_external.string(),
|
|
31312
|
+
taskCounts: exports_external.record(exports_external.string(), exports_external.number()),
|
|
31313
|
+
memberCount: exports_external.number()
|
|
31314
|
+
});
|
|
31315
|
+
var WorkspaceStatsResponseSchema = exports_external.object({
|
|
31316
|
+
stats: WorkspaceStatsSchema
|
|
31317
|
+
});
|
|
31318
|
+
// ../sdk/src/core/config.ts
|
|
31319
|
+
import { join } from "node:path";
|
|
31320
|
+
var PROVIDER = {
|
|
31321
|
+
CLAUDE: "claude",
|
|
31322
|
+
CODEX: "codex"
|
|
31323
|
+
};
|
|
31324
|
+
var DEFAULT_MODEL = {
|
|
31325
|
+
[PROVIDER.CLAUDE]: "sonnet",
|
|
31326
|
+
[PROVIDER.CODEX]: "gpt-5.1-codex-mini"
|
|
31327
|
+
};
|
|
31328
|
+
var LOCUS_CONFIG = {
|
|
31329
|
+
dir: ".locus",
|
|
31330
|
+
configFile: "config.json",
|
|
31331
|
+
indexFile: "codebase-index.json",
|
|
31332
|
+
contextFile: "CLAUDE.md",
|
|
31333
|
+
artifactsDir: "artifacts",
|
|
31334
|
+
documentsDir: "documents",
|
|
31335
|
+
agentSkillsDir: ".agent/skills"
|
|
31336
|
+
};
|
|
31337
|
+
function getLocusPath(projectPath, fileName) {
|
|
31338
|
+
if (fileName === "contextFile") {
|
|
31339
|
+
return join(projectPath, LOCUS_CONFIG.contextFile);
|
|
31340
|
+
}
|
|
31341
|
+
return join(projectPath, LOCUS_CONFIG.dir, LOCUS_CONFIG[fileName]);
|
|
31342
|
+
}
|
|
31343
|
+
|
|
31344
|
+
// ../sdk/src/agent/artifact-syncer.ts
|
|
31345
|
+
class ArtifactSyncer {
|
|
31346
|
+
deps;
|
|
31347
|
+
constructor(deps) {
|
|
31348
|
+
this.deps = deps;
|
|
31349
|
+
}
|
|
31350
|
+
async getOrCreateArtifactsGroup() {
|
|
31351
|
+
try {
|
|
31352
|
+
const groups = await this.deps.client.docs.listGroups(this.deps.workspaceId);
|
|
31353
|
+
const artifactsGroup = groups.find((g) => g.name === "Artifacts");
|
|
31354
|
+
if (artifactsGroup) {
|
|
31355
|
+
return artifactsGroup.id;
|
|
31356
|
+
}
|
|
31357
|
+
const newGroup = await this.deps.client.docs.createGroup(this.deps.workspaceId, {
|
|
31358
|
+
name: "Artifacts",
|
|
31359
|
+
order: 999
|
|
31360
|
+
});
|
|
31361
|
+
this.deps.log("Created 'Artifacts' group for agent-generated docs", "info");
|
|
31362
|
+
return newGroup.id;
|
|
31363
|
+
} catch (error48) {
|
|
31364
|
+
this.deps.log(`Failed to get/create Artifacts group: ${error48}`, "error");
|
|
31365
|
+
throw error48;
|
|
31366
|
+
}
|
|
31367
|
+
}
|
|
31368
|
+
async sync() {
|
|
31369
|
+
const artifactsDir = getLocusPath(this.deps.projectPath, "artifactsDir");
|
|
31370
|
+
if (!existsSync(artifactsDir)) {
|
|
31371
|
+
mkdirSync(artifactsDir, { recursive: true });
|
|
31372
|
+
return;
|
|
31373
|
+
}
|
|
31374
|
+
try {
|
|
31375
|
+
const files = readdirSync(artifactsDir);
|
|
31376
|
+
this.deps.log(`Syncing ${files.length} artifacts to server...`, "info");
|
|
31377
|
+
const groups = await this.deps.client.docs.listGroups(this.deps.workspaceId);
|
|
31378
|
+
const groupMap = new Map(groups.map((g) => [g.id, g.name]));
|
|
31379
|
+
let artifactsGroupId = groups.find((g) => g.name === "Artifacts")?.id;
|
|
31380
|
+
if (!artifactsGroupId) {
|
|
31381
|
+
artifactsGroupId = await this.getOrCreateArtifactsGroup();
|
|
31382
|
+
}
|
|
31383
|
+
const existingDocs = await this.deps.client.docs.list(this.deps.workspaceId);
|
|
31384
|
+
for (const file2 of files) {
|
|
31385
|
+
const filePath = join2(artifactsDir, file2);
|
|
31386
|
+
if (statSync(filePath).isFile()) {
|
|
31387
|
+
const content = readFileSync(filePath, "utf-8");
|
|
31388
|
+
const title = file2.replace(/\.md$/, "").trim();
|
|
31389
|
+
if (!title)
|
|
31390
|
+
continue;
|
|
31391
|
+
const existing = existingDocs.find((d) => d.title === title);
|
|
31392
|
+
if (existing) {
|
|
31393
|
+
if (existing.content !== content || existing.groupId !== artifactsGroupId) {
|
|
31394
|
+
await this.deps.client.docs.update(existing.id, this.deps.workspaceId, { content, groupId: artifactsGroupId });
|
|
31395
|
+
this.deps.log(`Updated artifact: ${file2}`, "success");
|
|
31396
|
+
}
|
|
31397
|
+
} else {
|
|
31398
|
+
await this.deps.client.docs.create(this.deps.workspaceId, {
|
|
31399
|
+
title,
|
|
31400
|
+
content,
|
|
31401
|
+
groupId: artifactsGroupId,
|
|
31402
|
+
type: "GENERAL" /* GENERAL */
|
|
31403
|
+
});
|
|
31404
|
+
this.deps.log(`Created artifact: ${file2}`, "success");
|
|
31405
|
+
}
|
|
31406
|
+
}
|
|
31407
|
+
}
|
|
31408
|
+
for (const doc3 of existingDocs) {
|
|
31409
|
+
if (doc3.groupId === artifactsGroupId) {
|
|
31410
|
+
const fileName = `${doc3.title}.md`;
|
|
31411
|
+
const filePath = join2(artifactsDir, fileName);
|
|
31412
|
+
if (!existsSync(filePath)) {
|
|
31413
|
+
writeFileSync(filePath, doc3.content || "");
|
|
31414
|
+
this.deps.log(`Fetched artifact: ${fileName}`, "success");
|
|
31415
|
+
}
|
|
31416
|
+
} else {
|
|
31417
|
+
const documentsDir = getLocusPath(this.deps.projectPath, "documentsDir");
|
|
31418
|
+
const groupName = groupMap.get(doc3.groupId || "") || "General";
|
|
31419
|
+
const groupDir = join2(documentsDir, groupName);
|
|
31420
|
+
if (!existsSync(groupDir)) {
|
|
31421
|
+
mkdirSync(groupDir, { recursive: true });
|
|
31422
|
+
}
|
|
31423
|
+
const fileName = `${doc3.title}.md`;
|
|
31424
|
+
const filePath = join2(groupDir, fileName);
|
|
31425
|
+
if (!existsSync(filePath) || readFileSync(filePath, "utf-8") !== doc3.content) {
|
|
31426
|
+
writeFileSync(filePath, doc3.content || "");
|
|
31427
|
+
}
|
|
31428
|
+
}
|
|
31429
|
+
}
|
|
31430
|
+
} catch (error48) {
|
|
31431
|
+
this.deps.log(`Failed to sync artifacts: ${error48}`, "error");
|
|
31432
|
+
}
|
|
31433
|
+
}
|
|
31434
|
+
}
|
|
31435
|
+
// ../sdk/src/core/indexer.ts
|
|
31436
|
+
import { createHash } from "node:crypto";
|
|
31437
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
31438
|
+
import { dirname, join as join3 } from "node:path";
|
|
31439
|
+
|
|
31440
|
+
// ../../node_modules/globby/index.js
|
|
31441
|
+
import process4 from "node:process";
|
|
31442
|
+
import fs3 from "node:fs";
|
|
31443
|
+
import nodePath from "node:path";
|
|
31444
|
+
|
|
31445
|
+
// ../../node_modules/@sindresorhus/merge-streams/index.js
|
|
31446
|
+
import { on, once } from "node:events";
|
|
31447
|
+
import { PassThrough as PassThroughStream } from "node:stream";
|
|
31448
|
+
import { finished } from "node:stream/promises";
|
|
31449
|
+
function mergeStreams(streams) {
|
|
31450
|
+
if (!Array.isArray(streams)) {
|
|
31451
|
+
throw new TypeError(`Expected an array, got \`${typeof streams}\`.`);
|
|
31452
|
+
}
|
|
31453
|
+
for (const stream of streams) {
|
|
31454
|
+
validateStream(stream);
|
|
31455
|
+
}
|
|
31456
|
+
const objectMode = streams.some(({ readableObjectMode }) => readableObjectMode);
|
|
31457
|
+
const highWaterMark = getHighWaterMark(streams, objectMode);
|
|
31458
|
+
const passThroughStream = new MergedStream({
|
|
31459
|
+
objectMode,
|
|
31460
|
+
writableHighWaterMark: highWaterMark,
|
|
31461
|
+
readableHighWaterMark: highWaterMark
|
|
31462
|
+
});
|
|
31463
|
+
for (const stream of streams) {
|
|
31464
|
+
passThroughStream.add(stream);
|
|
31465
|
+
}
|
|
31466
|
+
if (streams.length === 0) {
|
|
31467
|
+
endStream(passThroughStream);
|
|
31468
|
+
}
|
|
31469
|
+
return passThroughStream;
|
|
31470
|
+
}
|
|
31471
|
+
var getHighWaterMark = (streams, objectMode) => {
|
|
31472
|
+
if (streams.length === 0) {
|
|
31473
|
+
return 16384;
|
|
31474
|
+
}
|
|
31475
|
+
const highWaterMarks = streams.filter(({ readableObjectMode }) => readableObjectMode === objectMode).map(({ readableHighWaterMark }) => readableHighWaterMark);
|
|
31476
|
+
return Math.max(...highWaterMarks);
|
|
31477
|
+
};
|
|
31478
|
+
|
|
31479
|
+
class MergedStream extends PassThroughStream {
|
|
31480
|
+
#streams = new Set([]);
|
|
31481
|
+
#ended = new Set([]);
|
|
31482
|
+
#aborted = new Set([]);
|
|
31483
|
+
#onFinished;
|
|
31484
|
+
add(stream) {
|
|
31485
|
+
validateStream(stream);
|
|
31486
|
+
if (this.#streams.has(stream)) {
|
|
31487
|
+
return;
|
|
31488
|
+
}
|
|
31489
|
+
this.#streams.add(stream);
|
|
31490
|
+
this.#onFinished ??= onMergedStreamFinished(this, this.#streams);
|
|
31491
|
+
endWhenStreamsDone({
|
|
31492
|
+
passThroughStream: this,
|
|
31493
|
+
stream,
|
|
31494
|
+
streams: this.#streams,
|
|
31495
|
+
ended: this.#ended,
|
|
31496
|
+
aborted: this.#aborted,
|
|
31497
|
+
onFinished: this.#onFinished
|
|
31498
|
+
});
|
|
31499
|
+
stream.pipe(this, { end: false });
|
|
31500
|
+
}
|
|
31501
|
+
remove(stream) {
|
|
31502
|
+
validateStream(stream);
|
|
31503
|
+
if (!this.#streams.has(stream)) {
|
|
31504
|
+
return false;
|
|
31505
|
+
}
|
|
31506
|
+
stream.unpipe(this);
|
|
31507
|
+
return true;
|
|
31508
|
+
}
|
|
31509
|
+
}
|
|
31510
|
+
var onMergedStreamFinished = async (passThroughStream, streams) => {
|
|
31511
|
+
updateMaxListeners(passThroughStream, PASSTHROUGH_LISTENERS_COUNT);
|
|
31512
|
+
const controller = new AbortController;
|
|
31513
|
+
try {
|
|
31514
|
+
await Promise.race([
|
|
31515
|
+
onMergedStreamEnd(passThroughStream, controller),
|
|
31516
|
+
onInputStreamsUnpipe(passThroughStream, streams, controller)
|
|
31517
|
+
]);
|
|
31518
|
+
} finally {
|
|
31519
|
+
controller.abort();
|
|
31520
|
+
updateMaxListeners(passThroughStream, -PASSTHROUGH_LISTENERS_COUNT);
|
|
31521
|
+
}
|
|
31522
|
+
};
|
|
31523
|
+
var onMergedStreamEnd = async (passThroughStream, { signal }) => {
|
|
31524
|
+
await finished(passThroughStream, { signal, cleanup: true });
|
|
31525
|
+
};
|
|
31526
|
+
var onInputStreamsUnpipe = async (passThroughStream, streams, { signal }) => {
|
|
31527
|
+
for await (const [unpipedStream] of on(passThroughStream, "unpipe", { signal })) {
|
|
31528
|
+
if (streams.has(unpipedStream)) {
|
|
31529
|
+
unpipedStream.emit(unpipeEvent);
|
|
31530
|
+
}
|
|
31531
|
+
}
|
|
31532
|
+
};
|
|
31533
|
+
var validateStream = (stream) => {
|
|
31534
|
+
if (typeof stream?.pipe !== "function") {
|
|
31535
|
+
throw new TypeError(`Expected a readable stream, got: \`${typeof stream}\`.`);
|
|
31536
|
+
}
|
|
31537
|
+
};
|
|
31538
|
+
var endWhenStreamsDone = async ({ passThroughStream, stream, streams, ended, aborted: aborted2, onFinished }) => {
|
|
31539
|
+
updateMaxListeners(passThroughStream, PASSTHROUGH_LISTENERS_PER_STREAM);
|
|
31540
|
+
const controller = new AbortController;
|
|
31541
|
+
try {
|
|
31542
|
+
await Promise.race([
|
|
31543
|
+
afterMergedStreamFinished(onFinished, stream),
|
|
31544
|
+
onInputStreamEnd({ passThroughStream, stream, streams, ended, aborted: aborted2, controller }),
|
|
31545
|
+
onInputStreamUnpipe({ stream, streams, ended, aborted: aborted2, controller })
|
|
31546
|
+
]);
|
|
31547
|
+
} finally {
|
|
31548
|
+
controller.abort();
|
|
31549
|
+
updateMaxListeners(passThroughStream, -PASSTHROUGH_LISTENERS_PER_STREAM);
|
|
31550
|
+
}
|
|
31551
|
+
if (streams.size === ended.size + aborted2.size) {
|
|
31552
|
+
if (ended.size === 0 && aborted2.size > 0) {
|
|
31553
|
+
abortStream(passThroughStream);
|
|
31554
|
+
} else {
|
|
31555
|
+
endStream(passThroughStream);
|
|
31556
|
+
}
|
|
31557
|
+
}
|
|
31558
|
+
};
|
|
31559
|
+
var isAbortError = (error48) => error48?.code === "ERR_STREAM_PREMATURE_CLOSE";
|
|
31560
|
+
var afterMergedStreamFinished = async (onFinished, stream) => {
|
|
31561
|
+
try {
|
|
31562
|
+
await onFinished;
|
|
31563
|
+
abortStream(stream);
|
|
31564
|
+
} catch (error48) {
|
|
31565
|
+
if (isAbortError(error48)) {
|
|
31566
|
+
abortStream(stream);
|
|
31567
|
+
} else {
|
|
31568
|
+
errorStream(stream, error48);
|
|
31569
|
+
}
|
|
31570
|
+
}
|
|
31571
|
+
};
|
|
31572
|
+
var onInputStreamEnd = async ({ passThroughStream, stream, streams, ended, aborted: aborted2, controller: { signal } }) => {
|
|
31573
|
+
try {
|
|
31574
|
+
await finished(stream, { signal, cleanup: true, readable: true, writable: false });
|
|
31575
|
+
if (streams.has(stream)) {
|
|
31576
|
+
ended.add(stream);
|
|
31577
|
+
}
|
|
31578
|
+
} catch (error48) {
|
|
31579
|
+
if (signal.aborted || !streams.has(stream)) {
|
|
31580
|
+
return;
|
|
31581
|
+
}
|
|
31582
|
+
if (isAbortError(error48)) {
|
|
31583
|
+
aborted2.add(stream);
|
|
31584
|
+
} else {
|
|
31585
|
+
errorStream(passThroughStream, error48);
|
|
31586
|
+
}
|
|
31587
|
+
}
|
|
31588
|
+
};
|
|
31589
|
+
var onInputStreamUnpipe = async ({ stream, streams, ended, aborted: aborted2, controller: { signal } }) => {
|
|
31590
|
+
await once(stream, unpipeEvent, { signal });
|
|
31591
|
+
streams.delete(stream);
|
|
31592
|
+
ended.delete(stream);
|
|
31593
|
+
aborted2.delete(stream);
|
|
31594
|
+
};
|
|
31595
|
+
var unpipeEvent = Symbol("unpipe");
|
|
31596
|
+
var endStream = (stream) => {
|
|
31597
|
+
if (stream.writable) {
|
|
31598
|
+
stream.end();
|
|
31599
|
+
}
|
|
31600
|
+
};
|
|
31601
|
+
var abortStream = (stream) => {
|
|
31602
|
+
if (stream.readable || stream.writable) {
|
|
31603
|
+
stream.destroy();
|
|
31604
|
+
}
|
|
31605
|
+
};
|
|
31606
|
+
var errorStream = (stream, error48) => {
|
|
31607
|
+
if (!stream.destroyed) {
|
|
31608
|
+
stream.once("error", noop);
|
|
31609
|
+
stream.destroy(error48);
|
|
31610
|
+
}
|
|
31611
|
+
};
|
|
31612
|
+
var noop = () => {};
|
|
31613
|
+
var updateMaxListeners = (passThroughStream, increment) => {
|
|
31614
|
+
const maxListeners = passThroughStream.getMaxListeners();
|
|
31615
|
+
if (maxListeners !== 0 && maxListeners !== Number.POSITIVE_INFINITY) {
|
|
31616
|
+
passThroughStream.setMaxListeners(maxListeners + increment);
|
|
31617
|
+
}
|
|
31618
|
+
};
|
|
31619
|
+
var PASSTHROUGH_LISTENERS_COUNT = 2;
|
|
31620
|
+
var PASSTHROUGH_LISTENERS_PER_STREAM = 1;
|
|
31621
|
+
|
|
31622
|
+
// ../../node_modules/globby/index.js
|
|
31623
|
+
var import_fast_glob2 = __toESM(require_out4(), 1);
|
|
31624
|
+
|
|
31625
|
+
// ../../node_modules/path-type/index.js
|
|
31626
|
+
import fs from "node:fs";
|
|
31627
|
+
import fsPromises from "node:fs/promises";
|
|
31628
|
+
async function isType(fsStatType, statsMethodName, filePath) {
|
|
31629
|
+
if (typeof filePath !== "string") {
|
|
31630
|
+
throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
|
31631
|
+
}
|
|
31632
|
+
try {
|
|
31633
|
+
const stats = await fsPromises[fsStatType](filePath);
|
|
31634
|
+
return stats[statsMethodName]();
|
|
31635
|
+
} catch (error48) {
|
|
31636
|
+
if (error48.code === "ENOENT") {
|
|
31637
|
+
return false;
|
|
31638
|
+
}
|
|
31639
|
+
throw error48;
|
|
31640
|
+
}
|
|
31641
|
+
}
|
|
31642
|
+
function isTypeSync(fsStatType, statsMethodName, filePath) {
|
|
31643
|
+
if (typeof filePath !== "string") {
|
|
31644
|
+
throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
|
31645
|
+
}
|
|
31646
|
+
try {
|
|
31647
|
+
return fs[fsStatType](filePath)[statsMethodName]();
|
|
31648
|
+
} catch (error48) {
|
|
31649
|
+
if (error48.code === "ENOENT") {
|
|
31650
|
+
return false;
|
|
31651
|
+
}
|
|
31652
|
+
throw error48;
|
|
31653
|
+
}
|
|
31654
|
+
}
|
|
31655
|
+
var isFile = isType.bind(undefined, "stat", "isFile");
|
|
31656
|
+
var isDirectory = isType.bind(undefined, "stat", "isDirectory");
|
|
31657
|
+
var isSymlink = isType.bind(undefined, "lstat", "isSymbolicLink");
|
|
31658
|
+
var isFileSync = isTypeSync.bind(undefined, "statSync", "isFile");
|
|
31659
|
+
var isDirectorySync = isTypeSync.bind(undefined, "statSync", "isDirectory");
|
|
31660
|
+
var isSymlinkSync = isTypeSync.bind(undefined, "lstatSync", "isSymbolicLink");
|
|
31661
|
+
|
|
31662
|
+
// ../../node_modules/unicorn-magic/node.js
|
|
31663
|
+
import { promisify } from "node:util";
|
|
31664
|
+
import { execFile as execFileCallback, execFileSync as execFileSyncOriginal } from "node:child_process";
|
|
31665
|
+
import { fileURLToPath } from "node:url";
|
|
31666
|
+
var execFileOriginal = promisify(execFileCallback);
|
|
31667
|
+
function toPath(urlOrPath) {
|
|
31668
|
+
return urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
31669
|
+
}
|
|
31670
|
+
var TEN_MEGABYTES_IN_BYTES = 10 * 1024 * 1024;
|
|
31671
|
+
|
|
31672
|
+
// ../../node_modules/globby/ignore.js
|
|
31673
|
+
var import_fast_glob = __toESM(require_out4(), 1);
|
|
31674
|
+
var import_ignore = __toESM(require_ignore(), 1);
|
|
31675
|
+
import process3 from "node:process";
|
|
31676
|
+
import fs2 from "node:fs";
|
|
31677
|
+
import fsPromises2 from "node:fs/promises";
|
|
31678
|
+
import path from "node:path";
|
|
31679
|
+
|
|
31680
|
+
// ../../node_modules/globby/node_modules/slash/index.js
|
|
31681
|
+
function slash(path) {
|
|
31682
|
+
const isExtendedLengthPath = path.startsWith("\\\\?\\");
|
|
31683
|
+
if (isExtendedLengthPath) {
|
|
31684
|
+
return path;
|
|
31685
|
+
}
|
|
31686
|
+
return path.replace(/\\/g, "/");
|
|
31687
|
+
}
|
|
31688
|
+
|
|
31689
|
+
// ../../node_modules/globby/utilities.js
|
|
31690
|
+
var isNegativePattern = (pattern) => pattern[0] === "!";
|
|
31691
|
+
|
|
31692
|
+
// ../../node_modules/globby/ignore.js
|
|
31693
|
+
var defaultIgnoredDirectories = [
|
|
31694
|
+
"**/node_modules",
|
|
31695
|
+
"**/flow-typed",
|
|
31696
|
+
"**/coverage",
|
|
31697
|
+
"**/.git"
|
|
31698
|
+
];
|
|
31699
|
+
var ignoreFilesGlobOptions = {
|
|
31700
|
+
absolute: true,
|
|
31701
|
+
dot: true
|
|
31702
|
+
};
|
|
31703
|
+
var GITIGNORE_FILES_PATTERN = "**/.gitignore";
|
|
31704
|
+
var applyBaseToPattern = (pattern, base) => isNegativePattern(pattern) ? "!" + path.posix.join(base, pattern.slice(1)) : path.posix.join(base, pattern);
|
|
31705
|
+
var parseIgnoreFile = (file2, cwd) => {
|
|
31706
|
+
const base = slash(path.relative(cwd, path.dirname(file2.filePath)));
|
|
31707
|
+
return file2.content.split(/\r?\n/).filter((line) => line && !line.startsWith("#")).map((pattern) => applyBaseToPattern(pattern, base));
|
|
31708
|
+
};
|
|
31709
|
+
var toRelativePath = (fileOrDirectory, cwd) => {
|
|
31710
|
+
cwd = slash(cwd);
|
|
31711
|
+
if (path.isAbsolute(fileOrDirectory)) {
|
|
31712
|
+
if (slash(fileOrDirectory).startsWith(cwd)) {
|
|
31713
|
+
return path.relative(cwd, fileOrDirectory);
|
|
31714
|
+
}
|
|
31715
|
+
throw new Error(`Path ${fileOrDirectory} is not in cwd ${cwd}`);
|
|
31716
|
+
}
|
|
31717
|
+
return fileOrDirectory;
|
|
31718
|
+
};
|
|
31719
|
+
var getIsIgnoredPredicate = (files, cwd) => {
|
|
31720
|
+
const patterns = files.flatMap((file2) => parseIgnoreFile(file2, cwd));
|
|
31721
|
+
const ignores = import_ignore.default().add(patterns);
|
|
31722
|
+
return (fileOrDirectory) => {
|
|
31723
|
+
fileOrDirectory = toPath(fileOrDirectory);
|
|
31724
|
+
fileOrDirectory = toRelativePath(fileOrDirectory, cwd);
|
|
31725
|
+
return fileOrDirectory ? ignores.ignores(slash(fileOrDirectory)) : false;
|
|
31726
|
+
};
|
|
31727
|
+
};
|
|
31728
|
+
var normalizeOptions = (options = {}) => ({
|
|
31729
|
+
cwd: toPath(options.cwd) ?? process3.cwd(),
|
|
31730
|
+
suppressErrors: Boolean(options.suppressErrors),
|
|
31731
|
+
deep: typeof options.deep === "number" ? options.deep : Number.POSITIVE_INFINITY,
|
|
31732
|
+
ignore: [...options.ignore ?? [], ...defaultIgnoredDirectories]
|
|
31733
|
+
});
|
|
31734
|
+
var isIgnoredByIgnoreFiles = async (patterns, options) => {
|
|
31735
|
+
const { cwd, suppressErrors, deep, ignore } = normalizeOptions(options);
|
|
31736
|
+
const paths = await import_fast_glob.default(patterns, {
|
|
31737
|
+
cwd,
|
|
31738
|
+
suppressErrors,
|
|
31739
|
+
deep,
|
|
31740
|
+
ignore,
|
|
31741
|
+
...ignoreFilesGlobOptions
|
|
31742
|
+
});
|
|
31743
|
+
const files = await Promise.all(paths.map(async (filePath) => ({
|
|
31744
|
+
filePath,
|
|
31745
|
+
content: await fsPromises2.readFile(filePath, "utf8")
|
|
31746
|
+
})));
|
|
31747
|
+
return getIsIgnoredPredicate(files, cwd);
|
|
31748
|
+
};
|
|
31749
|
+
var isIgnoredByIgnoreFilesSync = (patterns, options) => {
|
|
31750
|
+
const { cwd, suppressErrors, deep, ignore } = normalizeOptions(options);
|
|
31751
|
+
const paths = import_fast_glob.default.sync(patterns, {
|
|
31752
|
+
cwd,
|
|
31753
|
+
suppressErrors,
|
|
31754
|
+
deep,
|
|
31755
|
+
ignore,
|
|
31756
|
+
...ignoreFilesGlobOptions
|
|
31757
|
+
});
|
|
31758
|
+
const files = paths.map((filePath) => ({
|
|
31759
|
+
filePath,
|
|
31760
|
+
content: fs2.readFileSync(filePath, "utf8")
|
|
31761
|
+
}));
|
|
31762
|
+
return getIsIgnoredPredicate(files, cwd);
|
|
31763
|
+
};
|
|
31764
|
+
|
|
31765
|
+
// ../../node_modules/globby/index.js
|
|
31766
|
+
var assertPatternsInput = (patterns) => {
|
|
31767
|
+
if (patterns.some((pattern) => typeof pattern !== "string")) {
|
|
31768
|
+
throw new TypeError("Patterns must be a string or an array of strings");
|
|
31769
|
+
}
|
|
31770
|
+
};
|
|
31771
|
+
var normalizePathForDirectoryGlob = (filePath, cwd) => {
|
|
31772
|
+
const path2 = isNegativePattern(filePath) ? filePath.slice(1) : filePath;
|
|
31773
|
+
return nodePath.isAbsolute(path2) ? path2 : nodePath.join(cwd, path2);
|
|
31774
|
+
};
|
|
31775
|
+
var getDirectoryGlob = ({ directoryPath, files, extensions }) => {
|
|
31776
|
+
const extensionGlob = extensions?.length > 0 ? `.${extensions.length > 1 ? `{${extensions.join(",")}}` : extensions[0]}` : "";
|
|
31777
|
+
return files ? files.map((file2) => nodePath.posix.join(directoryPath, `**/${nodePath.extname(file2) ? file2 : `${file2}${extensionGlob}`}`)) : [nodePath.posix.join(directoryPath, `**${extensionGlob ? `/*${extensionGlob}` : ""}`)];
|
|
31778
|
+
};
|
|
31779
|
+
var directoryToGlob = async (directoryPaths, {
|
|
31780
|
+
cwd = process4.cwd(),
|
|
31781
|
+
files,
|
|
31782
|
+
extensions
|
|
31783
|
+
} = {}) => {
|
|
31784
|
+
const globs = await Promise.all(directoryPaths.map(async (directoryPath) => await isDirectory(normalizePathForDirectoryGlob(directoryPath, cwd)) ? getDirectoryGlob({ directoryPath, files, extensions }) : directoryPath));
|
|
31785
|
+
return globs.flat();
|
|
31786
|
+
};
|
|
31787
|
+
var directoryToGlobSync = (directoryPaths, {
|
|
31788
|
+
cwd = process4.cwd(),
|
|
31789
|
+
files,
|
|
31790
|
+
extensions
|
|
31791
|
+
} = {}) => directoryPaths.flatMap((directoryPath) => isDirectorySync(normalizePathForDirectoryGlob(directoryPath, cwd)) ? getDirectoryGlob({ directoryPath, files, extensions }) : directoryPath);
|
|
31792
|
+
var toPatternsArray = (patterns) => {
|
|
31793
|
+
patterns = [...new Set([patterns].flat())];
|
|
31794
|
+
assertPatternsInput(patterns);
|
|
31795
|
+
return patterns;
|
|
31796
|
+
};
|
|
31797
|
+
var checkCwdOption = (cwd) => {
|
|
31798
|
+
if (!cwd) {
|
|
31799
|
+
return;
|
|
31800
|
+
}
|
|
31801
|
+
let stat;
|
|
31802
|
+
try {
|
|
31803
|
+
stat = fs3.statSync(cwd);
|
|
31804
|
+
} catch {
|
|
31805
|
+
return;
|
|
31806
|
+
}
|
|
31807
|
+
if (!stat.isDirectory()) {
|
|
31808
|
+
throw new Error("The `cwd` option must be a path to a directory");
|
|
31809
|
+
}
|
|
31810
|
+
};
|
|
31811
|
+
var normalizeOptions2 = (options = {}) => {
|
|
31812
|
+
options = {
|
|
31813
|
+
...options,
|
|
31814
|
+
ignore: options.ignore ?? [],
|
|
31815
|
+
expandDirectories: options.expandDirectories ?? true,
|
|
31816
|
+
cwd: toPath(options.cwd)
|
|
31817
|
+
};
|
|
31818
|
+
checkCwdOption(options.cwd);
|
|
31819
|
+
return options;
|
|
31820
|
+
};
|
|
31821
|
+
var normalizeArguments = (function_) => async (patterns, options) => function_(toPatternsArray(patterns), normalizeOptions2(options));
|
|
31822
|
+
var normalizeArgumentsSync = (function_) => (patterns, options) => function_(toPatternsArray(patterns), normalizeOptions2(options));
|
|
31823
|
+
var getIgnoreFilesPatterns = (options) => {
|
|
31824
|
+
const { ignoreFiles, gitignore } = options;
|
|
31825
|
+
const patterns = ignoreFiles ? toPatternsArray(ignoreFiles) : [];
|
|
31826
|
+
if (gitignore) {
|
|
31827
|
+
patterns.push(GITIGNORE_FILES_PATTERN);
|
|
31828
|
+
}
|
|
31829
|
+
return patterns;
|
|
31830
|
+
};
|
|
31831
|
+
var getFilter = async (options) => {
|
|
31832
|
+
const ignoreFilesPatterns = getIgnoreFilesPatterns(options);
|
|
31833
|
+
return createFilterFunction(ignoreFilesPatterns.length > 0 && await isIgnoredByIgnoreFiles(ignoreFilesPatterns, options));
|
|
31834
|
+
};
|
|
31835
|
+
var getFilterSync = (options) => {
|
|
31836
|
+
const ignoreFilesPatterns = getIgnoreFilesPatterns(options);
|
|
31837
|
+
return createFilterFunction(ignoreFilesPatterns.length > 0 && isIgnoredByIgnoreFilesSync(ignoreFilesPatterns, options));
|
|
31838
|
+
};
|
|
31839
|
+
var createFilterFunction = (isIgnored) => {
|
|
31840
|
+
const seen = new Set;
|
|
31841
|
+
return (fastGlobResult) => {
|
|
31842
|
+
const pathKey = nodePath.normalize(fastGlobResult.path ?? fastGlobResult);
|
|
31843
|
+
if (seen.has(pathKey) || isIgnored && isIgnored(pathKey)) {
|
|
31844
|
+
return false;
|
|
31845
|
+
}
|
|
31846
|
+
seen.add(pathKey);
|
|
31847
|
+
return true;
|
|
31848
|
+
};
|
|
31849
|
+
};
|
|
31850
|
+
var unionFastGlobResults = (results, filter) => results.flat().filter((fastGlobResult) => filter(fastGlobResult));
|
|
31851
|
+
var convertNegativePatterns = (patterns, options) => {
|
|
31852
|
+
const tasks = [];
|
|
31853
|
+
while (patterns.length > 0) {
|
|
31854
|
+
const index = patterns.findIndex((pattern) => isNegativePattern(pattern));
|
|
31855
|
+
if (index === -1) {
|
|
31856
|
+
tasks.push({ patterns, options });
|
|
31857
|
+
break;
|
|
31858
|
+
}
|
|
31859
|
+
const ignorePattern = patterns[index].slice(1);
|
|
31860
|
+
for (const task2 of tasks) {
|
|
31861
|
+
task2.options.ignore.push(ignorePattern);
|
|
31862
|
+
}
|
|
31863
|
+
if (index !== 0) {
|
|
31864
|
+
tasks.push({
|
|
31865
|
+
patterns: patterns.slice(0, index),
|
|
31866
|
+
options: {
|
|
31867
|
+
...options,
|
|
31868
|
+
ignore: [
|
|
31869
|
+
...options.ignore,
|
|
31870
|
+
ignorePattern
|
|
31871
|
+
]
|
|
31872
|
+
}
|
|
31873
|
+
});
|
|
31874
|
+
}
|
|
31875
|
+
patterns = patterns.slice(index + 1);
|
|
31876
|
+
}
|
|
31877
|
+
return tasks;
|
|
31878
|
+
};
|
|
31879
|
+
var normalizeExpandDirectoriesOption = (options, cwd) => ({
|
|
31880
|
+
...cwd ? { cwd } : {},
|
|
31881
|
+
...Array.isArray(options) ? { files: options } : options
|
|
31882
|
+
});
|
|
31883
|
+
var generateTasks = async (patterns, options) => {
|
|
31884
|
+
const globTasks = convertNegativePatterns(patterns, options);
|
|
31885
|
+
const { cwd, expandDirectories } = options;
|
|
31886
|
+
if (!expandDirectories) {
|
|
31887
|
+
return globTasks;
|
|
31888
|
+
}
|
|
31889
|
+
const directoryToGlobOptions = normalizeExpandDirectoriesOption(expandDirectories, cwd);
|
|
31890
|
+
return Promise.all(globTasks.map(async (task2) => {
|
|
31891
|
+
let { patterns: patterns2, options: options2 } = task2;
|
|
31892
|
+
[
|
|
31893
|
+
patterns2,
|
|
31894
|
+
options2.ignore
|
|
31895
|
+
] = await Promise.all([
|
|
31896
|
+
directoryToGlob(patterns2, directoryToGlobOptions),
|
|
31897
|
+
directoryToGlob(options2.ignore, { cwd })
|
|
31898
|
+
]);
|
|
31899
|
+
return { patterns: patterns2, options: options2 };
|
|
31900
|
+
}));
|
|
31901
|
+
};
|
|
31902
|
+
var generateTasksSync = (patterns, options) => {
|
|
31903
|
+
const globTasks = convertNegativePatterns(patterns, options);
|
|
31904
|
+
const { cwd, expandDirectories } = options;
|
|
31905
|
+
if (!expandDirectories) {
|
|
31906
|
+
return globTasks;
|
|
31907
|
+
}
|
|
31908
|
+
const directoryToGlobSyncOptions = normalizeExpandDirectoriesOption(expandDirectories, cwd);
|
|
31909
|
+
return globTasks.map((task2) => {
|
|
31910
|
+
let { patterns: patterns2, options: options2 } = task2;
|
|
31911
|
+
patterns2 = directoryToGlobSync(patterns2, directoryToGlobSyncOptions);
|
|
31912
|
+
options2.ignore = directoryToGlobSync(options2.ignore, { cwd });
|
|
31913
|
+
return { patterns: patterns2, options: options2 };
|
|
31914
|
+
});
|
|
31915
|
+
};
|
|
31916
|
+
var globby = normalizeArguments(async (patterns, options) => {
|
|
31917
|
+
const [
|
|
31918
|
+
tasks,
|
|
31919
|
+
filter
|
|
31920
|
+
] = await Promise.all([
|
|
31921
|
+
generateTasks(patterns, options),
|
|
31922
|
+
getFilter(options)
|
|
31923
|
+
]);
|
|
31924
|
+
const results = await Promise.all(tasks.map((task2) => import_fast_glob2.default(task2.patterns, task2.options)));
|
|
31925
|
+
return unionFastGlobResults(results, filter);
|
|
32152
31926
|
});
|
|
32153
|
-
var
|
|
32154
|
-
|
|
32155
|
-
|
|
32156
|
-
|
|
31927
|
+
var globbySync = normalizeArgumentsSync((patterns, options) => {
|
|
31928
|
+
const tasks = generateTasksSync(patterns, options);
|
|
31929
|
+
const filter = getFilterSync(options);
|
|
31930
|
+
const results = tasks.map((task2) => import_fast_glob2.default.sync(task2.patterns, task2.options));
|
|
31931
|
+
return unionFastGlobResults(results, filter);
|
|
32157
31932
|
});
|
|
32158
|
-
var
|
|
32159
|
-
|
|
31933
|
+
var globbyStream = normalizeArgumentsSync((patterns, options) => {
|
|
31934
|
+
const tasks = generateTasksSync(patterns, options);
|
|
31935
|
+
const filter = getFilterSync(options);
|
|
31936
|
+
const streams = tasks.map((task2) => import_fast_glob2.default.stream(task2.patterns, task2.options));
|
|
31937
|
+
const stream = mergeStreams(streams).filter((fastGlobResult) => filter(fastGlobResult));
|
|
31938
|
+
return stream;
|
|
32160
31939
|
});
|
|
31940
|
+
var isDynamicPattern = normalizeArgumentsSync((patterns, options) => patterns.some((pattern) => import_fast_glob2.default.isDynamicPattern(pattern, options)));
|
|
31941
|
+
var generateGlobTasks = normalizeArguments(generateTasks);
|
|
31942
|
+
var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
|
|
31943
|
+
|
|
31944
|
+
// ../sdk/src/core/indexer.ts
|
|
31945
|
+
class CodebaseIndexer {
|
|
31946
|
+
projectPath;
|
|
31947
|
+
indexPath;
|
|
31948
|
+
fullReindexRatioThreshold = 0.2;
|
|
31949
|
+
constructor(projectPath) {
|
|
31950
|
+
this.projectPath = projectPath;
|
|
31951
|
+
this.indexPath = join3(projectPath, ".locus", "codebase-index.json");
|
|
31952
|
+
}
|
|
31953
|
+
async index(onProgress, treeSummarizer, force = false) {
|
|
31954
|
+
if (!treeSummarizer) {
|
|
31955
|
+
throw new Error("A treeSummarizer is required for this indexing method.");
|
|
31956
|
+
}
|
|
31957
|
+
onProgress?.("Generating file tree...");
|
|
31958
|
+
const currentFiles = await this.getFileTree();
|
|
31959
|
+
const treeString = currentFiles.join(`
|
|
31960
|
+
`);
|
|
31961
|
+
const newTreeHash = this.hashTree(treeString);
|
|
31962
|
+
const existingIndex = this.loadIndex();
|
|
31963
|
+
if (!force && existingIndex?.treeHash === newTreeHash) {
|
|
31964
|
+
onProgress?.("No file changes detected, skipping reindex");
|
|
31965
|
+
return null;
|
|
31966
|
+
}
|
|
31967
|
+
const currentHashes = this.computeFileHashes(currentFiles);
|
|
31968
|
+
const existingHashes = existingIndex?.fileHashes;
|
|
31969
|
+
const canIncremental = !force && existingIndex && existingHashes;
|
|
31970
|
+
if (canIncremental) {
|
|
31971
|
+
onProgress?.("Performing incremental update");
|
|
31972
|
+
const { added, deleted, modified } = this.diffFiles(currentHashes, existingHashes);
|
|
31973
|
+
const changedFiles = [...added, ...modified];
|
|
31974
|
+
const totalChanges = changedFiles.length + deleted.length;
|
|
31975
|
+
const existingFileCount = Object.keys(existingHashes).length;
|
|
31976
|
+
onProgress?.(`File changes detected: ${changedFiles.length} changed, ${added.length} added, ${deleted.length} deleted`);
|
|
31977
|
+
if (existingFileCount > 0) {
|
|
31978
|
+
const changeRatio = totalChanges / existingFileCount;
|
|
31979
|
+
if (changeRatio <= this.fullReindexRatioThreshold && changedFiles.length > 0) {
|
|
31980
|
+
onProgress?.(`Reindexing ${changedFiles.length} changed files and merging with existing index`);
|
|
31981
|
+
const incrementalIndex = await treeSummarizer(changedFiles.join(`
|
|
31982
|
+
`));
|
|
31983
|
+
const updatedIndex = this.cloneIndex(existingIndex);
|
|
31984
|
+
this.removeFilesFromIndex(updatedIndex, [...deleted, ...modified]);
|
|
31985
|
+
return this.mergeIndex(updatedIndex, incrementalIndex, currentHashes, newTreeHash);
|
|
31986
|
+
}
|
|
31987
|
+
if (changedFiles.length === 0 && deleted.length > 0) {
|
|
31988
|
+
onProgress?.(`Removing ${deleted.length} deleted files from index`);
|
|
31989
|
+
const updatedIndex = this.cloneIndex(existingIndex);
|
|
31990
|
+
this.removeFilesFromIndex(updatedIndex, deleted);
|
|
31991
|
+
return this.applyIndexMetadata(updatedIndex, currentHashes, newTreeHash);
|
|
31992
|
+
}
|
|
31993
|
+
if (changedFiles.length === 0 && deleted.length === 0) {
|
|
31994
|
+
onProgress?.("No actual file changes, updating hashes only");
|
|
31995
|
+
const updatedIndex = this.cloneIndex(existingIndex);
|
|
31996
|
+
return this.applyIndexMetadata(updatedIndex, currentHashes, newTreeHash);
|
|
31997
|
+
}
|
|
31998
|
+
onProgress?.(`Too many changes (${(changeRatio * 100).toFixed(1)}%), performing full reindex`);
|
|
31999
|
+
}
|
|
32000
|
+
}
|
|
32001
|
+
onProgress?.("AI is analyzing codebase structure...");
|
|
32002
|
+
const index = await treeSummarizer(treeString);
|
|
32003
|
+
return this.applyIndexMetadata(index, currentHashes, newTreeHash);
|
|
32004
|
+
}
|
|
32005
|
+
async getFileTree() {
|
|
32006
|
+
const gitmodulesPath = join3(this.projectPath, ".gitmodules");
|
|
32007
|
+
const submoduleIgnores = [];
|
|
32008
|
+
if (existsSync2(gitmodulesPath)) {
|
|
32009
|
+
try {
|
|
32010
|
+
const content = readFileSync2(gitmodulesPath, "utf-8");
|
|
32011
|
+
const lines = content.split(`
|
|
32012
|
+
`);
|
|
32013
|
+
for (const line of lines) {
|
|
32014
|
+
const match = line.match(/^\s*path\s*=\s*(.*)$/);
|
|
32015
|
+
const path2 = match?.[1]?.trim();
|
|
32016
|
+
if (path2) {
|
|
32017
|
+
submoduleIgnores.push(`${path2}/**`);
|
|
32018
|
+
submoduleIgnores.push(`**/${path2}/**`);
|
|
32019
|
+
}
|
|
32020
|
+
}
|
|
32021
|
+
} catch {}
|
|
32022
|
+
}
|
|
32023
|
+
return globby(["**/*"], {
|
|
32024
|
+
cwd: this.projectPath,
|
|
32025
|
+
gitignore: true,
|
|
32026
|
+
ignore: [
|
|
32027
|
+
...submoduleIgnores,
|
|
32028
|
+
"**/node_modules/**",
|
|
32029
|
+
"**/dist/**",
|
|
32030
|
+
"**/build/**",
|
|
32031
|
+
"**/target/**",
|
|
32032
|
+
"**/bin/**",
|
|
32033
|
+
"**/obj/**",
|
|
32034
|
+
"**/.next/**",
|
|
32035
|
+
"**/.svelte-kit/**",
|
|
32036
|
+
"**/.nuxt/**",
|
|
32037
|
+
"**/.cache/**",
|
|
32038
|
+
"**/out/**",
|
|
32039
|
+
"**/__tests__/**",
|
|
32040
|
+
"**/coverage/**",
|
|
32041
|
+
"**/*.test.*",
|
|
32042
|
+
"**/*.spec.*",
|
|
32043
|
+
"**/*.d.ts",
|
|
32044
|
+
"**/tsconfig.tsbuildinfo",
|
|
32045
|
+
"**/.locus/*.json",
|
|
32046
|
+
"**/.locus/*.md",
|
|
32047
|
+
"**/.locus/!(artifacts)/**",
|
|
32048
|
+
"**/.git/**",
|
|
32049
|
+
"**/.svn/**",
|
|
32050
|
+
"**/.hg/**",
|
|
32051
|
+
"**/.vscode/**",
|
|
32052
|
+
"**/.idea/**",
|
|
32053
|
+
"**/.DS_Store",
|
|
32054
|
+
"**/bun.lock",
|
|
32055
|
+
"**/package-lock.json",
|
|
32056
|
+
"**/yarn.lock",
|
|
32057
|
+
"**/pnpm-lock.yaml",
|
|
32058
|
+
"**/Cargo.lock",
|
|
32059
|
+
"**/go.sum",
|
|
32060
|
+
"**/poetry.lock",
|
|
32061
|
+
"**/*.{png,jpg,jpeg,gif,svg,ico,mp4,webm,wav,mp3,woff,woff2,eot,ttf,otf,pdf,zip,tar.gz,rar}"
|
|
32062
|
+
]
|
|
32063
|
+
});
|
|
32064
|
+
}
|
|
32065
|
+
loadIndex() {
|
|
32066
|
+
if (existsSync2(this.indexPath)) {
|
|
32067
|
+
try {
|
|
32068
|
+
return JSON.parse(readFileSync2(this.indexPath, "utf-8"));
|
|
32069
|
+
} catch {
|
|
32070
|
+
return null;
|
|
32071
|
+
}
|
|
32072
|
+
}
|
|
32073
|
+
return null;
|
|
32074
|
+
}
|
|
32075
|
+
saveIndex(index) {
|
|
32076
|
+
const dir = dirname(this.indexPath);
|
|
32077
|
+
if (!existsSync2(dir)) {
|
|
32078
|
+
mkdirSync2(dir, { recursive: true });
|
|
32079
|
+
}
|
|
32080
|
+
writeFileSync2(this.indexPath, JSON.stringify(index, null, 2));
|
|
32081
|
+
}
|
|
32082
|
+
cloneIndex(index) {
|
|
32083
|
+
return JSON.parse(JSON.stringify(index));
|
|
32084
|
+
}
|
|
32085
|
+
applyIndexMetadata(index, fileHashes, treeHash) {
|
|
32086
|
+
index.lastIndexed = new Date().toISOString();
|
|
32087
|
+
index.treeHash = treeHash;
|
|
32088
|
+
index.fileHashes = fileHashes;
|
|
32089
|
+
return index;
|
|
32090
|
+
}
|
|
32091
|
+
hashTree(tree) {
|
|
32092
|
+
return createHash("sha256").update(tree).digest("hex");
|
|
32093
|
+
}
|
|
32094
|
+
hashFile(filePath) {
|
|
32095
|
+
try {
|
|
32096
|
+
const content = readFileSync2(join3(this.projectPath, filePath), "utf-8");
|
|
32097
|
+
return createHash("sha256").update(content).digest("hex").slice(0, 16);
|
|
32098
|
+
} catch {
|
|
32099
|
+
return null;
|
|
32100
|
+
}
|
|
32101
|
+
}
|
|
32102
|
+
computeFileHashes(files) {
|
|
32103
|
+
const hashes = {};
|
|
32104
|
+
for (const file2 of files) {
|
|
32105
|
+
const hash2 = this.hashFile(file2);
|
|
32106
|
+
if (hash2 !== null) {
|
|
32107
|
+
hashes[file2] = hash2;
|
|
32108
|
+
}
|
|
32109
|
+
}
|
|
32110
|
+
return hashes;
|
|
32111
|
+
}
|
|
32112
|
+
diffFiles(currentHashes, existingHashes) {
|
|
32113
|
+
const currentFiles = Object.keys(currentHashes);
|
|
32114
|
+
const existingFiles = Object.keys(existingHashes);
|
|
32115
|
+
const existingSet = new Set(existingFiles);
|
|
32116
|
+
const currentSet = new Set(currentFiles);
|
|
32117
|
+
const added = currentFiles.filter((f) => !existingSet.has(f));
|
|
32118
|
+
const deleted = existingFiles.filter((f) => !currentSet.has(f));
|
|
32119
|
+
const modified = currentFiles.filter((f) => existingSet.has(f) && currentHashes[f] !== existingHashes[f]);
|
|
32120
|
+
return { added, deleted, modified };
|
|
32121
|
+
}
|
|
32122
|
+
removeFilesFromIndex(index, files) {
|
|
32123
|
+
const fileSet = new Set(files);
|
|
32124
|
+
for (const file2 of files) {
|
|
32125
|
+
delete index.responsibilities[file2];
|
|
32126
|
+
}
|
|
32127
|
+
for (const [symbol2, paths] of Object.entries(index.symbols)) {
|
|
32128
|
+
index.symbols[symbol2] = paths.filter((p) => !fileSet.has(p));
|
|
32129
|
+
if (index.symbols[symbol2].length === 0) {
|
|
32130
|
+
delete index.symbols[symbol2];
|
|
32131
|
+
}
|
|
32132
|
+
}
|
|
32133
|
+
}
|
|
32134
|
+
mergeIndex(existing, incremental, newHashes, newTreeHash) {
|
|
32135
|
+
const mergedSymbols = { ...existing.symbols };
|
|
32136
|
+
for (const [symbol2, paths] of Object.entries(incremental.symbols)) {
|
|
32137
|
+
if (mergedSymbols[symbol2]) {
|
|
32138
|
+
mergedSymbols[symbol2] = [
|
|
32139
|
+
...new Set([...mergedSymbols[symbol2], ...paths])
|
|
32140
|
+
];
|
|
32141
|
+
} else {
|
|
32142
|
+
mergedSymbols[symbol2] = paths;
|
|
32143
|
+
}
|
|
32144
|
+
}
|
|
32145
|
+
const merged = {
|
|
32146
|
+
symbols: mergedSymbols,
|
|
32147
|
+
responsibilities: {
|
|
32148
|
+
...existing.responsibilities,
|
|
32149
|
+
...incremental.responsibilities
|
|
32150
|
+
},
|
|
32151
|
+
lastIndexed: ""
|
|
32152
|
+
};
|
|
32153
|
+
return this.applyIndexMetadata(merged, newHashes, newTreeHash);
|
|
32154
|
+
}
|
|
32155
|
+
}
|
|
32156
|
+
|
|
32157
|
+
// ../sdk/src/agent/codebase-indexer-service.ts
|
|
32158
|
+
class CodebaseIndexerService {
|
|
32159
|
+
deps;
|
|
32160
|
+
indexer;
|
|
32161
|
+
constructor(deps) {
|
|
32162
|
+
this.deps = deps;
|
|
32163
|
+
this.indexer = new CodebaseIndexer(deps.projectPath);
|
|
32164
|
+
}
|
|
32165
|
+
async reindex(force = false) {
|
|
32166
|
+
try {
|
|
32167
|
+
const index = await this.indexer.index((msg) => this.deps.log(msg, "info"), async (tree) => {
|
|
32168
|
+
const prompt = `You are a codebase analysis expert. Analyze the file tree and extract:
|
|
32169
|
+
1. Key symbols (classes, functions, types) and their locations
|
|
32170
|
+
2. Responsibilities of each directory/file
|
|
32171
|
+
3. Overall project structure
|
|
32172
|
+
|
|
32173
|
+
Analyze this file tree and provide a JSON response with:
|
|
32174
|
+
- "symbols": object mapping symbol names to file paths (array)
|
|
32175
|
+
- "responsibilities": object mapping paths to brief descriptions
|
|
32176
|
+
|
|
32177
|
+
File tree:
|
|
32178
|
+
${tree}
|
|
32179
|
+
|
|
32180
|
+
Return ONLY valid JSON, no markdown formatting.`;
|
|
32181
|
+
const response = await this.deps.aiRunner.run(prompt, true);
|
|
32182
|
+
const jsonMatch = response.match(/\{[\s\S]*\}/);
|
|
32183
|
+
if (jsonMatch) {
|
|
32184
|
+
return JSON.parse(jsonMatch[0]);
|
|
32185
|
+
}
|
|
32186
|
+
return { symbols: {}, responsibilities: {}, lastIndexed: "" };
|
|
32187
|
+
}, force);
|
|
32188
|
+
if (index === null) {
|
|
32189
|
+
this.deps.log("No changes detected, skipping reindex", "info");
|
|
32190
|
+
return;
|
|
32191
|
+
}
|
|
32192
|
+
this.indexer.saveIndex(index);
|
|
32193
|
+
this.deps.log("Codebase reindexed successfully", "success");
|
|
32194
|
+
} catch (error48) {
|
|
32195
|
+
this.deps.log(`Failed to reindex codebase: ${error48}`, "error");
|
|
32196
|
+
}
|
|
32197
|
+
}
|
|
32198
|
+
}
|
|
32161
32199
|
// ../sdk/src/core/prompt-builder.ts
|
|
32200
|
+
import { existsSync as existsSync3, readdirSync as readdirSync2, readFileSync as readFileSync3, statSync as statSync2 } from "node:fs";
|
|
32201
|
+
import { homedir } from "node:os";
|
|
32202
|
+
import { join as join4 } from "node:path";
|
|
32162
32203
|
class PromptBuilder {
|
|
32163
32204
|
projectPath;
|
|
32164
32205
|
constructor(projectPath) {
|
|
32165
32206
|
this.projectPath = projectPath;
|
|
32166
32207
|
}
|
|
32167
|
-
async build(task2) {
|
|
32208
|
+
async build(task2, options = {}) {
|
|
32168
32209
|
let prompt = `# Task: ${task2.title}
|
|
32169
32210
|
|
|
32170
32211
|
`;
|
|
@@ -32179,18 +32220,81 @@ You are acting as a ${roleText}.
|
|
|
32179
32220
|
${task2.description || "No description provided."}
|
|
32180
32221
|
|
|
32181
32222
|
`;
|
|
32223
|
+
const projectConfig = this.getProjectConfig();
|
|
32224
|
+
if (projectConfig) {
|
|
32225
|
+
prompt += `## Project Metadata
|
|
32226
|
+
`;
|
|
32227
|
+
prompt += `- Version: ${projectConfig.version || "Unknown"}
|
|
32228
|
+
`;
|
|
32229
|
+
prompt += `- Created At: ${projectConfig.createdAt || "Unknown"}
|
|
32230
|
+
|
|
32231
|
+
`;
|
|
32232
|
+
}
|
|
32233
|
+
let serverContext = null;
|
|
32234
|
+
if (options.taskContext) {
|
|
32235
|
+
try {
|
|
32236
|
+
serverContext = JSON.parse(options.taskContext);
|
|
32237
|
+
} catch {
|
|
32238
|
+
serverContext = { context: options.taskContext };
|
|
32239
|
+
}
|
|
32240
|
+
}
|
|
32182
32241
|
const contextPath = getLocusPath(this.projectPath, "contextFile");
|
|
32242
|
+
let hasLocalContext = false;
|
|
32183
32243
|
if (existsSync3(contextPath)) {
|
|
32184
32244
|
try {
|
|
32185
32245
|
const context = readFileSync3(contextPath, "utf-8");
|
|
32186
|
-
|
|
32246
|
+
if (context.trim().length > 20) {
|
|
32247
|
+
prompt += `## Project Context (Local)
|
|
32187
32248
|
${context}
|
|
32188
32249
|
|
|
32189
32250
|
`;
|
|
32251
|
+
hasLocalContext = true;
|
|
32252
|
+
}
|
|
32190
32253
|
} catch (err) {
|
|
32191
32254
|
console.warn(`Warning: Could not read context file: ${err}`);
|
|
32192
32255
|
}
|
|
32193
32256
|
}
|
|
32257
|
+
if (!hasLocalContext) {
|
|
32258
|
+
const fallback = this.getFallbackContext();
|
|
32259
|
+
if (fallback) {
|
|
32260
|
+
prompt += `## Project Context (README Fallback)
|
|
32261
|
+
${fallback}
|
|
32262
|
+
|
|
32263
|
+
`;
|
|
32264
|
+
}
|
|
32265
|
+
}
|
|
32266
|
+
if (serverContext) {
|
|
32267
|
+
prompt += `## Project Context (Server)
|
|
32268
|
+
`;
|
|
32269
|
+
if (serverContext.project) {
|
|
32270
|
+
prompt += `- Project: ${serverContext.project.name || "Unknown"}
|
|
32271
|
+
`;
|
|
32272
|
+
if (!hasLocalContext && serverContext.project.techStack?.length) {
|
|
32273
|
+
prompt += `- Tech Stack: ${serverContext.project.techStack.join(", ")}
|
|
32274
|
+
`;
|
|
32275
|
+
}
|
|
32276
|
+
}
|
|
32277
|
+
if (serverContext.context) {
|
|
32278
|
+
prompt += `
|
|
32279
|
+
${serverContext.context}
|
|
32280
|
+
`;
|
|
32281
|
+
}
|
|
32282
|
+
prompt += `
|
|
32283
|
+
`;
|
|
32284
|
+
}
|
|
32285
|
+
prompt += this.getProjectStructure();
|
|
32286
|
+
prompt += this.getSkillsInfo();
|
|
32287
|
+
prompt += `## Project Knowledge Base
|
|
32288
|
+
`;
|
|
32289
|
+
prompt += `You have access to the following documentation directories for context:
|
|
32290
|
+
`;
|
|
32291
|
+
prompt += `- Artifacts: \`.locus/artifacts\`
|
|
32292
|
+
`;
|
|
32293
|
+
prompt += `- Documents: \`.locus/documents\`
|
|
32294
|
+
`;
|
|
32295
|
+
prompt += `If you need more information about the project strategies, plans, or architecture, please read files in these directories.
|
|
32296
|
+
|
|
32297
|
+
`;
|
|
32194
32298
|
const indexPath = getLocusPath(this.projectPath, "indexFile");
|
|
32195
32299
|
if (existsSync3(indexPath)) {
|
|
32196
32300
|
prompt += `## Codebase Overview
|
|
@@ -32199,11 +32303,19 @@ There is an index file in the .locus/codebase-index.json and if you need you can
|
|
|
32199
32303
|
`;
|
|
32200
32304
|
}
|
|
32201
32305
|
if (task2.docs && task2.docs.length > 0) {
|
|
32202
|
-
prompt += `## Attached Documents
|
|
32306
|
+
prompt += `## Attached Documents (Summarized)
|
|
32307
|
+
`;
|
|
32308
|
+
prompt += `> Full content available on server. Rely on Task Description for specific requirements.
|
|
32309
|
+
|
|
32203
32310
|
`;
|
|
32204
32311
|
for (const doc3 of task2.docs) {
|
|
32205
|
-
|
|
32206
|
-
|
|
32312
|
+
const content = doc3.content || "";
|
|
32313
|
+
const limit = 800;
|
|
32314
|
+
const preview = content.slice(0, limit);
|
|
32315
|
+
const isTruncated = content.length > limit;
|
|
32316
|
+
prompt += `### Doc: ${doc3.title}
|
|
32317
|
+
${preview}${isTruncated ? `
|
|
32318
|
+
...(truncated)...` : ""}
|
|
32207
32319
|
|
|
32208
32320
|
`;
|
|
32209
32321
|
}
|
|
@@ -32219,7 +32331,7 @@ ${doc3.content || "(No content)"}
|
|
|
32219
32331
|
`;
|
|
32220
32332
|
}
|
|
32221
32333
|
if (task2.comments && task2.comments.length > 0) {
|
|
32222
|
-
const comments = task2.comments.slice(0,
|
|
32334
|
+
const comments = task2.comments.slice(0, 3);
|
|
32223
32335
|
prompt += `## Task History & Feedback
|
|
32224
32336
|
`;
|
|
32225
32337
|
prompt += `Review the following comments for context or rejection feedback:
|
|
@@ -32241,6 +32353,108 @@ ${comment.text}
|
|
|
32241
32353
|
`;
|
|
32242
32354
|
return prompt;
|
|
32243
32355
|
}
|
|
32356
|
+
getProjectConfig() {
|
|
32357
|
+
const configPath = getLocusPath(this.projectPath, "configFile");
|
|
32358
|
+
if (existsSync3(configPath)) {
|
|
32359
|
+
try {
|
|
32360
|
+
return JSON.parse(readFileSync3(configPath, "utf-8"));
|
|
32361
|
+
} catch {
|
|
32362
|
+
return null;
|
|
32363
|
+
}
|
|
32364
|
+
}
|
|
32365
|
+
return null;
|
|
32366
|
+
}
|
|
32367
|
+
getFallbackContext() {
|
|
32368
|
+
const readmePath = join4(this.projectPath, "README.md");
|
|
32369
|
+
if (existsSync3(readmePath)) {
|
|
32370
|
+
try {
|
|
32371
|
+
const content = readFileSync3(readmePath, "utf-8");
|
|
32372
|
+
const limit = 1000;
|
|
32373
|
+
return content.slice(0, limit) + (content.length > limit ? `
|
|
32374
|
+
...(truncated)...` : "");
|
|
32375
|
+
} catch {
|
|
32376
|
+
return "";
|
|
32377
|
+
}
|
|
32378
|
+
}
|
|
32379
|
+
return "";
|
|
32380
|
+
}
|
|
32381
|
+
getProjectStructure() {
|
|
32382
|
+
try {
|
|
32383
|
+
const entries = readdirSync2(this.projectPath);
|
|
32384
|
+
const folders = entries.filter((e) => {
|
|
32385
|
+
if (e.startsWith(".") || e === "node_modules")
|
|
32386
|
+
return false;
|
|
32387
|
+
try {
|
|
32388
|
+
return statSync2(join4(this.projectPath, e)).isDirectory();
|
|
32389
|
+
} catch {
|
|
32390
|
+
return false;
|
|
32391
|
+
}
|
|
32392
|
+
});
|
|
32393
|
+
if (folders.length === 0)
|
|
32394
|
+
return "";
|
|
32395
|
+
let structure = `## Project Structure
|
|
32396
|
+
`;
|
|
32397
|
+
structure += `Key directories in this project:
|
|
32398
|
+
`;
|
|
32399
|
+
for (const folder of folders) {
|
|
32400
|
+
structure += `- \`${folder}/\`
|
|
32401
|
+
`;
|
|
32402
|
+
}
|
|
32403
|
+
return `${structure}
|
|
32404
|
+
`;
|
|
32405
|
+
} catch {
|
|
32406
|
+
return "";
|
|
32407
|
+
}
|
|
32408
|
+
}
|
|
32409
|
+
getSkillsInfo() {
|
|
32410
|
+
const projectSkillsDirs = [
|
|
32411
|
+
LOCUS_CONFIG.agentSkillsDir,
|
|
32412
|
+
".cursor/skills",
|
|
32413
|
+
".claude/skills",
|
|
32414
|
+
".codex/skills",
|
|
32415
|
+
".gemini/skills"
|
|
32416
|
+
];
|
|
32417
|
+
const globalHome = homedir();
|
|
32418
|
+
const globalSkillsDirs = [
|
|
32419
|
+
join4(globalHome, ".cursor/skills"),
|
|
32420
|
+
join4(globalHome, ".claude/skills"),
|
|
32421
|
+
join4(globalHome, ".codex/skills"),
|
|
32422
|
+
join4(globalHome, ".gemini/skills")
|
|
32423
|
+
];
|
|
32424
|
+
const allSkillNames = new Set;
|
|
32425
|
+
for (const relativePath of projectSkillsDirs) {
|
|
32426
|
+
const fullPath = join4(this.projectPath, relativePath);
|
|
32427
|
+
this.scanSkillsInDirectory(fullPath, allSkillNames);
|
|
32428
|
+
}
|
|
32429
|
+
for (const fullPath of globalSkillsDirs) {
|
|
32430
|
+
this.scanSkillsInDirectory(fullPath, allSkillNames);
|
|
32431
|
+
}
|
|
32432
|
+
const uniqueSkills = Array.from(allSkillNames).sort();
|
|
32433
|
+
if (uniqueSkills.length === 0)
|
|
32434
|
+
return "";
|
|
32435
|
+
return `## Available Agent Skills
|
|
32436
|
+
` + `The project has the following specialized skills available (from project or global locations):
|
|
32437
|
+
` + uniqueSkills.map((s) => `- ${s}`).join(`
|
|
32438
|
+
`) + `
|
|
32439
|
+
|
|
32440
|
+
`;
|
|
32441
|
+
}
|
|
32442
|
+
scanSkillsInDirectory(dirPath, skillSet) {
|
|
32443
|
+
if (!existsSync3(dirPath))
|
|
32444
|
+
return;
|
|
32445
|
+
try {
|
|
32446
|
+
const entries = readdirSync2(dirPath).filter((name) => {
|
|
32447
|
+
try {
|
|
32448
|
+
return statSync2(join4(dirPath, name)).isDirectory();
|
|
32449
|
+
} catch {
|
|
32450
|
+
return false;
|
|
32451
|
+
}
|
|
32452
|
+
});
|
|
32453
|
+
for (const entry of entries) {
|
|
32454
|
+
skillSet.add(entry);
|
|
32455
|
+
}
|
|
32456
|
+
} catch {}
|
|
32457
|
+
}
|
|
32244
32458
|
roleToText(role) {
|
|
32245
32459
|
if (!role) {
|
|
32246
32460
|
return null;
|
|
@@ -32270,18 +32484,11 @@ class TaskExecutor {
|
|
|
32270
32484
|
this.deps = deps;
|
|
32271
32485
|
this.promptBuilder = new PromptBuilder(deps.projectPath);
|
|
32272
32486
|
}
|
|
32273
|
-
|
|
32274
|
-
this.deps.sprintPlan = sprintPlan;
|
|
32275
|
-
}
|
|
32276
|
-
async execute(task2) {
|
|
32487
|
+
async execute(task2, context) {
|
|
32277
32488
|
this.deps.log(`Executing: ${task2.title}`, "info");
|
|
32278
|
-
|
|
32279
|
-
|
|
32280
|
-
|
|
32281
|
-
${this.deps.sprintPlan}
|
|
32282
|
-
|
|
32283
|
-
${basePrompt}`;
|
|
32284
|
-
}
|
|
32489
|
+
const basePrompt = await this.promptBuilder.build(task2, {
|
|
32490
|
+
taskContext: context
|
|
32491
|
+
});
|
|
32285
32492
|
try {
|
|
32286
32493
|
let plan = null;
|
|
32287
32494
|
if (this.deps.skipPlanning) {
|
|
@@ -32481,12 +32688,8 @@ class ClaudeRunner {
|
|
|
32481
32688
|
return null;
|
|
32482
32689
|
}
|
|
32483
32690
|
handleEvent(event) {
|
|
32484
|
-
const { type,
|
|
32485
|
-
if (type === "
|
|
32486
|
-
if (delta.type === "text_delta" && delta.text) {
|
|
32487
|
-
this.log?.(delta.text, "info");
|
|
32488
|
-
}
|
|
32489
|
-
} else if (type === "content_block_start" && content_block) {
|
|
32691
|
+
const { type, content_block } = event;
|
|
32692
|
+
if (type === "content_block_start" && content_block) {
|
|
32490
32693
|
if (content_block.type === "tool_use" && content_block.name) {
|
|
32491
32694
|
this.log?.(`
|
|
32492
32695
|
|
|
@@ -32507,7 +32710,7 @@ import { spawn as spawn2 } from "node:child_process";
|
|
|
32507
32710
|
import { randomUUID } from "node:crypto";
|
|
32508
32711
|
import { existsSync as existsSync4, readFileSync as readFileSync4, unlinkSync } from "node:fs";
|
|
32509
32712
|
import { tmpdir } from "node:os";
|
|
32510
|
-
import { join as
|
|
32713
|
+
import { join as join5 } from "node:path";
|
|
32511
32714
|
class CodexRunner {
|
|
32512
32715
|
projectPath;
|
|
32513
32716
|
model;
|
|
@@ -32536,7 +32739,7 @@ class CodexRunner {
|
|
|
32536
32739
|
}
|
|
32537
32740
|
executeRun(prompt) {
|
|
32538
32741
|
return new Promise((resolve2, reject) => {
|
|
32539
|
-
const outputPath =
|
|
32742
|
+
const outputPath = join5(tmpdir(), `locus-codex-${randomUUID()}.txt`);
|
|
32540
32743
|
const args = this.buildArgs(outputPath);
|
|
32541
32744
|
const codex = spawn2("codex", args, {
|
|
32542
32745
|
cwd: this.projectPath,
|
|
@@ -32573,7 +32776,13 @@ class CodexRunner {
|
|
|
32573
32776
|
});
|
|
32574
32777
|
}
|
|
32575
32778
|
buildArgs(outputPath) {
|
|
32576
|
-
const args = [
|
|
32779
|
+
const args = [
|
|
32780
|
+
"exec",
|
|
32781
|
+
"--full-auto",
|
|
32782
|
+
"--skip-git-repo-check",
|
|
32783
|
+
"--output-last-message",
|
|
32784
|
+
outputPath
|
|
32785
|
+
];
|
|
32577
32786
|
if (this.model) {
|
|
32578
32787
|
args.push("--model", this.model);
|
|
32579
32788
|
}
|
|
@@ -33819,7 +34028,7 @@ function transformData(fns, response) {
|
|
|
33819
34028
|
const context = response || config2;
|
|
33820
34029
|
const headers = AxiosHeaders_default.from(context.headers);
|
|
33821
34030
|
let data = context.data;
|
|
33822
|
-
utils_default.forEach(fns, function
|
|
34031
|
+
utils_default.forEach(fns, function transform2(fn) {
|
|
33823
34032
|
data = fn.call(config2, data, headers.normalize(), response ? response.status : undefined);
|
|
33824
34033
|
});
|
|
33825
34034
|
headers.normalize();
|
|
@@ -36052,6 +36261,28 @@ class BaseModule {
|
|
|
36052
36261
|
}
|
|
36053
36262
|
}
|
|
36054
36263
|
|
|
36264
|
+
// ../sdk/src/modules/ai.ts
|
|
36265
|
+
class AIModule extends BaseModule {
|
|
36266
|
+
async chat(workspaceId, body) {
|
|
36267
|
+
const { data } = await this.api.post(`/ai/${workspaceId}/chat`, body);
|
|
36268
|
+
return data;
|
|
36269
|
+
}
|
|
36270
|
+
async listSessions(workspaceId) {
|
|
36271
|
+
const { data } = await this.api.get(`/ai/${workspaceId}/sessions`);
|
|
36272
|
+
return data;
|
|
36273
|
+
}
|
|
36274
|
+
async getSession(workspaceId, sessionId) {
|
|
36275
|
+
const { data } = await this.api.get(`/ai/${workspaceId}/session/${sessionId}`);
|
|
36276
|
+
return data;
|
|
36277
|
+
}
|
|
36278
|
+
getChatStreamUrl(workspaceId, sessionId) {
|
|
36279
|
+
return `${this.api.defaults.baseURL}/ai/${workspaceId}/chat/stream?sessionId=${sessionId}`;
|
|
36280
|
+
}
|
|
36281
|
+
async deleteSession(workspaceId, sessionId) {
|
|
36282
|
+
await this.api.delete(`/ai/${workspaceId}/session/${sessionId}`);
|
|
36283
|
+
}
|
|
36284
|
+
}
|
|
36285
|
+
|
|
36055
36286
|
// ../sdk/src/modules/auth.ts
|
|
36056
36287
|
class AuthModule extends BaseModule {
|
|
36057
36288
|
async getMe() {
|
|
@@ -36215,6 +36446,10 @@ class SprintsModule extends BaseModule {
|
|
|
36215
36446
|
const { data } = await this.api.post(`/workspaces/${workspaceId}/sprints/${id}/complete`);
|
|
36216
36447
|
return data.sprint;
|
|
36217
36448
|
}
|
|
36449
|
+
async triggerAIPlanning(id, workspaceId) {
|
|
36450
|
+
const { data } = await this.api.post(`/workspaces/${workspaceId}/sprints/${id}/trigger-ai-planning`);
|
|
36451
|
+
return data.sprint;
|
|
36452
|
+
}
|
|
36218
36453
|
}
|
|
36219
36454
|
|
|
36220
36455
|
// ../sdk/src/modules/tasks.ts
|
|
@@ -36260,6 +36495,16 @@ class TasksModule extends BaseModule {
|
|
|
36260
36495
|
const { data } = await this.api.post(`/workspaces/${workspaceId}/tasks/${id}/comment`, body);
|
|
36261
36496
|
return data.comment;
|
|
36262
36497
|
}
|
|
36498
|
+
async batchUpdate(ids, workspaceId, updates) {
|
|
36499
|
+
await this.api.patch(`/workspaces/${workspaceId}/tasks/batch`, {
|
|
36500
|
+
ids,
|
|
36501
|
+
updates
|
|
36502
|
+
});
|
|
36503
|
+
}
|
|
36504
|
+
async getContext(id, workspaceId) {
|
|
36505
|
+
const { data } = await this.api.get(`/workspaces/${workspaceId}/tasks/${id}/context`);
|
|
36506
|
+
return data;
|
|
36507
|
+
}
|
|
36263
36508
|
}
|
|
36264
36509
|
|
|
36265
36510
|
// ../sdk/src/modules/workspaces.ts
|
|
@@ -36313,6 +36558,7 @@ class LocusClient {
|
|
|
36313
36558
|
api;
|
|
36314
36559
|
emitter;
|
|
36315
36560
|
auth;
|
|
36561
|
+
ai;
|
|
36316
36562
|
tasks;
|
|
36317
36563
|
sprints;
|
|
36318
36564
|
workspaces;
|
|
@@ -36324,7 +36570,7 @@ class LocusClient {
|
|
|
36324
36570
|
this.emitter = new LocusEmitter;
|
|
36325
36571
|
this.api = axios_default.create({
|
|
36326
36572
|
baseURL: config2.baseUrl,
|
|
36327
|
-
timeout: config2.timeout ||
|
|
36573
|
+
timeout: config2.timeout || 60000,
|
|
36328
36574
|
headers: {
|
|
36329
36575
|
"Content-Type": "application/json",
|
|
36330
36576
|
...config2.token ? { Authorization: `Bearer ${config2.token}` } : {}
|
|
@@ -36332,6 +36578,7 @@ class LocusClient {
|
|
|
36332
36578
|
});
|
|
36333
36579
|
this.setupInterceptors();
|
|
36334
36580
|
this.auth = new AuthModule(this.api, this.emitter);
|
|
36581
|
+
this.ai = new AIModule(this.api, this.emitter);
|
|
36335
36582
|
this.tasks = new TasksModule(this.api, this.emitter);
|
|
36336
36583
|
this.sprints = new SprintsModule(this.api, this.emitter);
|
|
36337
36584
|
this.workspaces = new WorkspacesModule(this.api, this.emitter);
|
|
@@ -36415,16 +36662,14 @@ class AgentWorker {
|
|
|
36415
36662
|
config;
|
|
36416
36663
|
client;
|
|
36417
36664
|
aiRunner;
|
|
36418
|
-
sprintPlanner;
|
|
36419
36665
|
indexerService;
|
|
36420
36666
|
artifactSyncer;
|
|
36421
36667
|
taskExecutor;
|
|
36422
36668
|
consecutiveEmpty = 0;
|
|
36423
|
-
maxEmpty =
|
|
36669
|
+
maxEmpty = 60;
|
|
36424
36670
|
maxTasks = 50;
|
|
36425
36671
|
tasksCompleted = 0;
|
|
36426
36672
|
pollInterval = 1e4;
|
|
36427
|
-
sprintPlan = null;
|
|
36428
36673
|
constructor(config2) {
|
|
36429
36674
|
this.config = config2;
|
|
36430
36675
|
const projectPath = config2.projectPath || process.cwd();
|
|
@@ -36445,10 +36690,6 @@ class AgentWorker {
|
|
|
36445
36690
|
model: config2.model,
|
|
36446
36691
|
log
|
|
36447
36692
|
});
|
|
36448
|
-
this.sprintPlanner = new SprintPlanner({
|
|
36449
|
-
aiRunner: this.aiRunner,
|
|
36450
|
-
log
|
|
36451
|
-
});
|
|
36452
36693
|
this.indexerService = new CodebaseIndexerService({
|
|
36453
36694
|
aiRunner: this.aiRunner,
|
|
36454
36695
|
projectPath,
|
|
@@ -36463,7 +36704,6 @@ class AgentWorker {
|
|
|
36463
36704
|
this.taskExecutor = new TaskExecutor({
|
|
36464
36705
|
aiRunner: this.aiRunner,
|
|
36465
36706
|
projectPath,
|
|
36466
|
-
sprintPlan: null,
|
|
36467
36707
|
skipPlanning: config2.skipPlanning,
|
|
36468
36708
|
log
|
|
36469
36709
|
});
|
|
@@ -36502,8 +36742,13 @@ class AgentWorker {
|
|
|
36502
36742
|
}
|
|
36503
36743
|
async executeTask(task2) {
|
|
36504
36744
|
const fullTask = await this.client.tasks.getById(task2.id, this.config.workspaceId);
|
|
36505
|
-
|
|
36506
|
-
|
|
36745
|
+
let context = "";
|
|
36746
|
+
try {
|
|
36747
|
+
context = await this.client.tasks.getContext(task2.id, this.config.workspaceId);
|
|
36748
|
+
} catch (err) {
|
|
36749
|
+
this.log(`Failed to fetch task context: ${err}`, "warn");
|
|
36750
|
+
}
|
|
36751
|
+
const result = await this.taskExecutor.execute(fullTask, context);
|
|
36507
36752
|
await this.indexerService.reindex();
|
|
36508
36753
|
return result;
|
|
36509
36754
|
}
|
|
@@ -36511,35 +36756,12 @@ class AgentWorker {
|
|
|
36511
36756
|
this.log(`Agent started in ${this.config.projectPath || process.cwd()}`, "success");
|
|
36512
36757
|
const sprint2 = await this.getActiveSprint();
|
|
36513
36758
|
if (sprint2) {
|
|
36514
|
-
this.log(`
|
|
36515
|
-
|
|
36516
|
-
|
|
36517
|
-
|
|
36518
|
-
|
|
36519
|
-
|
|
36520
|
-
if (activeTasks.length <= 1) {
|
|
36521
|
-
this.log("Skipping mindmap generation (only one task in sprint).", "info");
|
|
36522
|
-
this.sprintPlan = null;
|
|
36523
|
-
} else {
|
|
36524
|
-
const latestTaskCreation = activeTasks.reduce((latest, task2) => {
|
|
36525
|
-
const taskDate = new Date(task2.createdAt);
|
|
36526
|
-
return taskDate > latest ? taskDate : latest;
|
|
36527
|
-
}, new Date(0));
|
|
36528
|
-
const mindmapDate = sprint2.mindmapUpdatedAt ? new Date(sprint2.mindmapUpdatedAt) : new Date(0);
|
|
36529
|
-
const needsPlanning = !sprint2.mindmap || sprint2.mindmap.trim() === "" || latestTaskCreation > mindmapDate;
|
|
36530
|
-
if (needsPlanning) {
|
|
36531
|
-
if (sprint2.mindmap && latestTaskCreation > mindmapDate) {
|
|
36532
|
-
this.log("New tasks have been added to the sprint since last mindmap. Regenerating...", "warn");
|
|
36533
|
-
}
|
|
36534
|
-
this.sprintPlan = await this.sprintPlanner.planSprint(sprint2, tasks2);
|
|
36535
|
-
await this.client.sprints.update(sprint2.id, this.config.workspaceId, {
|
|
36536
|
-
mindmap: this.sprintPlan,
|
|
36537
|
-
mindmapUpdatedAt: new Date
|
|
36538
|
-
});
|
|
36539
|
-
} else {
|
|
36540
|
-
this.log("Using existing sprint mindmap.", "info");
|
|
36541
|
-
this.sprintPlan = sprint2.mindmap ?? null;
|
|
36542
|
-
}
|
|
36759
|
+
this.log(`Active sprint found: ${sprint2.name}. Ensuring plan is up to date...`, "info");
|
|
36760
|
+
try {
|
|
36761
|
+
await this.client.sprints.triggerAIPlanning(sprint2.id, this.config.workspaceId);
|
|
36762
|
+
this.log(`Sprint plan sync checked on server.`, "success");
|
|
36763
|
+
} catch (err) {
|
|
36764
|
+
this.log(`Sprint planning sync failed (non-critical): ${err instanceof Error ? err.message : String(err)}`, "warn");
|
|
36543
36765
|
}
|
|
36544
36766
|
} else {
|
|
36545
36767
|
this.log("No active sprint found for planning.", "warn");
|
|
@@ -36559,7 +36781,11 @@ class AgentWorker {
|
|
|
36559
36781
|
this.consecutiveEmpty = 0;
|
|
36560
36782
|
this.log(`Claimed: ${task2.title}`, "success");
|
|
36561
36783
|
const result = await this.executeTask(task2);
|
|
36562
|
-
|
|
36784
|
+
try {
|
|
36785
|
+
await this.artifactSyncer.sync();
|
|
36786
|
+
} catch (err) {
|
|
36787
|
+
this.log(`Artifact sync failed: ${err}`, "error");
|
|
36788
|
+
}
|
|
36563
36789
|
if (result.success) {
|
|
36564
36790
|
this.log(`Completed: ${task2.title}`, "success");
|
|
36565
36791
|
await this.client.tasks.update(task2.id, this.config.workspaceId, {
|
|
@@ -36596,7 +36822,7 @@ if (process.argv[1]?.includes("agent-worker") || process.argv[1]?.includes("work
|
|
|
36596
36822
|
config2.workspaceId = args[++i];
|
|
36597
36823
|
else if (arg === "--sprint-id")
|
|
36598
36824
|
config2.sprintId = args[++i];
|
|
36599
|
-
else if (arg === "--api-
|
|
36825
|
+
else if (arg === "--api-url")
|
|
36600
36826
|
config2.apiBase = args[++i];
|
|
36601
36827
|
else if (arg === "--api-key")
|
|
36602
36828
|
config2.apiKey = args[++i];
|
|
@@ -36625,7 +36851,7 @@ if (process.argv[1]?.includes("agent-worker") || process.argv[1]?.includes("work
|
|
|
36625
36851
|
// ../sdk/src/orchestrator.ts
|
|
36626
36852
|
import { spawn as spawn3 } from "node:child_process";
|
|
36627
36853
|
import { existsSync as existsSync5 } from "node:fs";
|
|
36628
|
-
import { dirname as dirname2, join as
|
|
36854
|
+
import { dirname as dirname2, join as join6 } from "node:path";
|
|
36629
36855
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
36630
36856
|
import { EventEmitter as EventEmitter3 } from "events";
|
|
36631
36857
|
class AgentOrchestrator extends EventEmitter3 {
|
|
@@ -36721,7 +36947,7 @@ ${c.success("✅ Orchestrator finished")}`);
|
|
|
36721
36947
|
const potentialPaths = [];
|
|
36722
36948
|
const currentModulePath = fileURLToPath2(import.meta.url);
|
|
36723
36949
|
const currentModuleDir = dirname2(currentModulePath);
|
|
36724
|
-
potentialPaths.push(
|
|
36950
|
+
potentialPaths.push(join6(currentModuleDir, "agent", "worker.js"), join6(currentModuleDir, "worker.js"), join6(currentModuleDir, "agent", "worker.ts"));
|
|
36725
36951
|
const workerPath = potentialPaths.find((p) => existsSync5(p));
|
|
36726
36952
|
if (!workerPath) {
|
|
36727
36953
|
throw new Error(`Worker file not found. Checked: ${potentialPaths.join(", ")}. ` + `Make sure the SDK is properly built and installed.`);
|
|
@@ -36731,7 +36957,7 @@ ${c.success("✅ Orchestrator finished")}`);
|
|
|
36731
36957
|
agentId,
|
|
36732
36958
|
"--workspace-id",
|
|
36733
36959
|
this.config.workspaceId,
|
|
36734
|
-
"--api-
|
|
36960
|
+
"--api-url",
|
|
36735
36961
|
this.config.apiBase,
|
|
36736
36962
|
"--api-key",
|
|
36737
36963
|
this.config.apiKey,
|
|
@@ -36902,22 +37128,311 @@ ${summary}`
|
|
|
36902
37128
|
}
|
|
36903
37129
|
}
|
|
36904
37130
|
// src/config-manager.ts
|
|
36905
|
-
import { existsSync as existsSync6, mkdirSync as mkdirSync3, readFileSync as readFileSync5, writeFileSync as
|
|
36906
|
-
import { join as
|
|
37131
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync3, readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "node:fs";
|
|
37132
|
+
import { join as join7 } from "node:path";
|
|
37133
|
+
|
|
37134
|
+
// src/templates/skills.ts
|
|
37135
|
+
var DEFAULT_SKILLS = [
|
|
37136
|
+
{
|
|
37137
|
+
name: "locus-expert",
|
|
37138
|
+
content: `---
|
|
37139
|
+
name: locus-expert
|
|
37140
|
+
description: Expertise in Locus-specific configuration, commands, and workflows.
|
|
37141
|
+
---
|
|
37142
|
+
# Locus Expert Skill
|
|
37143
|
+
|
|
37144
|
+
Use this skill to help manage Locus in this project.
|
|
37145
|
+
|
|
37146
|
+
## Locus Commands
|
|
37147
|
+
- \`locus init\`: Initialize Locus.
|
|
37148
|
+
- \`locus index\`: Index the codebase for AI context.
|
|
37149
|
+
- \`locus run\`: Start an agent to work on tasks.
|
|
37150
|
+
|
|
37151
|
+
## Configuration
|
|
37152
|
+
- \`.locus/config.json\`: Main project configuration.
|
|
37153
|
+
- \`CLAUDE.md\`: AI context and preferences.
|
|
37154
|
+
`
|
|
37155
|
+
},
|
|
37156
|
+
{
|
|
37157
|
+
name: "project-navigator",
|
|
37158
|
+
content: `---
|
|
37159
|
+
name: project-navigator
|
|
37160
|
+
description: General guidelines for efficient codebase exploration and navigation.
|
|
37161
|
+
---
|
|
37162
|
+
# Project Navigator Skill
|
|
37163
|
+
|
|
37164
|
+
Use this skill to explore and understand the codebase efficiently.
|
|
37165
|
+
|
|
37166
|
+
## Navigation Tips
|
|
37167
|
+
- Start by exploring the root directory to understand the project structure.
|
|
37168
|
+
- Look for \`README.md\` and documentation files.
|
|
37169
|
+
- Identify the main entry points of the application.
|
|
37170
|
+
- Use \`grep\` or search tools to find relevant code sections.
|
|
37171
|
+
`
|
|
37172
|
+
},
|
|
37173
|
+
{
|
|
37174
|
+
name: "frontend-expert",
|
|
37175
|
+
content: `---
|
|
37176
|
+
name: frontend-expert
|
|
37177
|
+
description: Specialized instructions for modern frontend development (React, Next.js, CSS).
|
|
37178
|
+
---
|
|
37179
|
+
# Frontend Expert Skill
|
|
37180
|
+
|
|
37181
|
+
Guidance for building premium, high-performance web interfaces.
|
|
37182
|
+
|
|
37183
|
+
## Core Best Practices
|
|
37184
|
+
- Use semantic HTML and accessible ARIA attributes.
|
|
37185
|
+
- Prioritize responsive design and mobile-first approach.
|
|
37186
|
+
- Use Vanilla CSS or TailwindCSS as per project guidelines.
|
|
37187
|
+
- Focus on micro-animations and smooth transitions.
|
|
37188
|
+
|
|
37189
|
+
## Testing
|
|
37190
|
+
- Use Playwright or Cypress for E2E tests.
|
|
37191
|
+
- Use React Testing Library for component testing.
|
|
37192
|
+
`
|
|
37193
|
+
},
|
|
37194
|
+
{
|
|
37195
|
+
name: "backend-expert",
|
|
37196
|
+
content: `---
|
|
37197
|
+
name: backend-expert
|
|
37198
|
+
description: Expertise in API design, database modeling, and server-side logic.
|
|
37199
|
+
---
|
|
37200
|
+
# Backend Expert Skill
|
|
37201
|
+
|
|
37202
|
+
Guidance for building scalable, secure, and robust backend systems.
|
|
37203
|
+
|
|
37204
|
+
## API Standards
|
|
37205
|
+
- Follow RESTful principles or GraphQL best practices.
|
|
37206
|
+
- Use clear versioning and consistent error handling.
|
|
37207
|
+
- Document APIs with Swagger/OpenAPI.
|
|
37208
|
+
|
|
37209
|
+
## Database
|
|
37210
|
+
- Design efficient schemas and indexes.
|
|
37211
|
+
- Use migrations for all schema changes.
|
|
37212
|
+
- Handle transactions and concurrency correctly.
|
|
37213
|
+
`
|
|
37214
|
+
},
|
|
37215
|
+
{
|
|
37216
|
+
name: "testing-champion",
|
|
37217
|
+
content: `---
|
|
37218
|
+
name: testing-champion
|
|
37219
|
+
description: Driving project quality through comprehensive testing strategies.
|
|
37220
|
+
---
|
|
37221
|
+
# Testing Champion Skill
|
|
37222
|
+
|
|
37223
|
+
Guidelines for ensuring project reliability and preventing regressions.
|
|
37224
|
+
|
|
37225
|
+
## Test Pyramid
|
|
37226
|
+
- **Unit Tests**: Test individual functions and logic in isolation.
|
|
37227
|
+
- **Integration Tests**: Test interactions between different modules.
|
|
37228
|
+
- **E2E Tests**: Test critical user flows from end to end.
|
|
37229
|
+
|
|
37230
|
+
## Requirements
|
|
37231
|
+
- Maintain high test coverage for critical paths.
|
|
37232
|
+
- Write descriptive test cases.
|
|
37233
|
+
- Run tests in CI before merging.
|
|
37234
|
+
`
|
|
37235
|
+
},
|
|
37236
|
+
{
|
|
37237
|
+
name: "devops-wizard",
|
|
37238
|
+
content: `---
|
|
37239
|
+
name: devops-wizard
|
|
37240
|
+
description: Expertise in CI/CD, deployment, and infrastructure management.
|
|
37241
|
+
---
|
|
37242
|
+
# DevOps Wizard Skill
|
|
37243
|
+
|
|
37244
|
+
Guidance for maintaining high availability and smooth delivery pipelines.
|
|
37245
|
+
|
|
37246
|
+
## CI/CD
|
|
37247
|
+
- Automate builds, tests, and deployments via GitHub Actions/GitLab CI.
|
|
37248
|
+
- Use staging environments for verification before production.
|
|
37249
|
+
|
|
37250
|
+
## Infrastructure
|
|
37251
|
+
- Use Infrastructure as Code (Terraform, Pulumi).
|
|
37252
|
+
- Monitor system health and performance (Prometheus, Grafana).
|
|
37253
|
+
- Handle secrets securely via vault/secrets manager.
|
|
37254
|
+
`
|
|
37255
|
+
},
|
|
37256
|
+
{
|
|
37257
|
+
name: "security-sentinel",
|
|
37258
|
+
content: `---
|
|
37259
|
+
name: security-sentinel
|
|
37260
|
+
description: Specialized knowledge in web security, vulnerability assessment, and safe coding.
|
|
37261
|
+
---
|
|
37262
|
+
# Security Sentinel Skill
|
|
37263
|
+
|
|
37264
|
+
Guidance for protecting the application and user data.
|
|
37265
|
+
|
|
37266
|
+
## Safe Practices
|
|
37267
|
+
- Sanitize all user inputs to prevent XSS and SQL injection.
|
|
37268
|
+
- Implement proper Authentication and Authorization (RBAC).
|
|
37269
|
+
- Use HTTPS and security headers.
|
|
37270
|
+
- Regularly audit dependencies for vulnerabilities.
|
|
37271
|
+
`
|
|
37272
|
+
},
|
|
37273
|
+
{
|
|
37274
|
+
name: "performance-master",
|
|
37275
|
+
content: `---
|
|
37276
|
+
name: performance-master
|
|
37277
|
+
description: Deep focus on optimization, profiling, and efficient resource usage.
|
|
37278
|
+
---
|
|
37279
|
+
# Performance Master Skill
|
|
37280
|
+
|
|
37281
|
+
Tactics for ensuring the application is fast and responsive.
|
|
37282
|
+
|
|
37283
|
+
## Optimization Areas
|
|
37284
|
+
- **Frontend**: Reduce bundle size, optimize images, use lazy loading.
|
|
37285
|
+
- **Backend**: Implement caching strategies, optimize queries, profile CPU/Memory usage.
|
|
37286
|
+
- **Network**: Reduce latency and minimize round trips.
|
|
37287
|
+
`
|
|
37288
|
+
},
|
|
37289
|
+
{
|
|
37290
|
+
name: "docs-wordsmith",
|
|
37291
|
+
content: `---
|
|
37292
|
+
name: docs-wordsmith
|
|
37293
|
+
description: Expertise in technical writing and maintaining clear project documentation.
|
|
37294
|
+
---
|
|
37295
|
+
# Docs Wordsmith Skill
|
|
37296
|
+
|
|
37297
|
+
Guidelines for keeping documentation clear, concise, and up to date.
|
|
37298
|
+
|
|
37299
|
+
## Principles
|
|
37300
|
+
- Always update documentation when changing core logic.
|
|
37301
|
+
- Use clear headings and consistent terminology.
|
|
37302
|
+
- Provide examples for complex features.
|
|
37303
|
+
- Keep README.md helpful for new contributors.
|
|
37304
|
+
`
|
|
37305
|
+
},
|
|
37306
|
+
{
|
|
37307
|
+
name: "nextjs-optimizer",
|
|
37308
|
+
content: `---
|
|
37309
|
+
name: nextjs-optimizer
|
|
37310
|
+
description: Specialized guidance for Next.js performance and architecture.
|
|
37311
|
+
---
|
|
37312
|
+
# Next.js Optimizer Skill
|
|
37313
|
+
|
|
37314
|
+
Expert instructions for high-performance Next.js applications.
|
|
37315
|
+
|
|
37316
|
+
## Performance
|
|
37317
|
+
- Use Server Components by default.
|
|
37318
|
+
- Optimize images with next/image.
|
|
37319
|
+
- Implement Partial Prerendering (PPR) where applicable.
|
|
37320
|
+
- Monitor Core Web Vitals.
|
|
37321
|
+
|
|
37322
|
+
## Architecture
|
|
37323
|
+
- Use App Router patterns.
|
|
37324
|
+
- Implement server actions for mutations.
|
|
37325
|
+
- Manage cache keys and revalidation carefully.
|
|
37326
|
+
`
|
|
37327
|
+
},
|
|
37328
|
+
{
|
|
37329
|
+
name: "zustand-specialist",
|
|
37330
|
+
content: `---
|
|
37331
|
+
name: zustand-specialist
|
|
37332
|
+
description: State management patterns and best practices using Zustand.
|
|
37333
|
+
---
|
|
37334
|
+
# Zustand Specialist Skill
|
|
37335
|
+
|
|
37336
|
+
Guidance for efficient state management with Zustand.
|
|
37337
|
+
|
|
37338
|
+
## Patterns
|
|
37339
|
+
- Slice pattern for organizing large stores.
|
|
37340
|
+
- Use selectors for atomic updates.
|
|
37341
|
+
- Keep stores focused and decoupled.
|
|
37342
|
+
- Handle persistence and hydration correctly.
|
|
37343
|
+
`
|
|
37344
|
+
},
|
|
37345
|
+
{
|
|
37346
|
+
name: "drizzle-guide",
|
|
37347
|
+
content: `---
|
|
37348
|
+
name: drizzle-guide
|
|
37349
|
+
description: Database schema design and query optimization with Drizzle ORM.
|
|
37350
|
+
---
|
|
37351
|
+
# Drizzle Guide Skill
|
|
37352
|
+
|
|
37353
|
+
Best practices for Drizzle ORM and database management.
|
|
37354
|
+
|
|
37355
|
+
## Schema Design
|
|
37356
|
+
- Define clear types and relationships.
|
|
37357
|
+
- Use migrations for all changes.
|
|
37358
|
+
- Implement indexes for frequently queried columns.
|
|
37359
|
+
|
|
37360
|
+
## Querying
|
|
37361
|
+
- Optimize for performance (batching, joins).
|
|
37362
|
+
- Use transaction API for atomic operations.
|
|
37363
|
+
- Ensure type safety across the application.
|
|
37364
|
+
`
|
|
37365
|
+
},
|
|
37366
|
+
{
|
|
37367
|
+
name: "playwright-automation",
|
|
37368
|
+
content: `---
|
|
37369
|
+
name: playwright-automation
|
|
37370
|
+
description: Automation and E2E testing best practices using Playwright.
|
|
37371
|
+
---
|
|
37372
|
+
# Playwright Automation Skill
|
|
37373
|
+
|
|
37374
|
+
Guidance for building reliable browser-based tests.
|
|
37375
|
+
|
|
37376
|
+
## Best Practices
|
|
37377
|
+
- Use locators instead of selectors.
|
|
37378
|
+
- Implement page object models for cleaner tests.
|
|
37379
|
+
- Run tests in parallel to save time.
|
|
37380
|
+
- Capture trace files and videos for debugging.
|
|
37381
|
+
`
|
|
37382
|
+
},
|
|
37383
|
+
{
|
|
37384
|
+
name: "i18n-coordinator",
|
|
37385
|
+
content: `---
|
|
37386
|
+
name: i18n-coordinator
|
|
37387
|
+
description: Managing internationalization and localization workflows.
|
|
37388
|
+
---
|
|
37389
|
+
# i18n Coordinator Skill
|
|
37390
|
+
|
|
37391
|
+
Guidance for globalizing your application.
|
|
37392
|
+
|
|
37393
|
+
## Workflow
|
|
37394
|
+
- Use a central translation service (e.g., react-i18next).
|
|
37395
|
+
- Never hardcode user-facing strings.
|
|
37396
|
+
- Support RTL (Right-to-Left) layouts if needed.
|
|
37397
|
+
- Ensure dynamic content is properly translated.
|
|
37398
|
+
`
|
|
37399
|
+
},
|
|
37400
|
+
{
|
|
37401
|
+
name: "project-overview",
|
|
37402
|
+
content: `---
|
|
37403
|
+
name: project-overview
|
|
37404
|
+
description: High-level architectural map and project organization guidance.
|
|
37405
|
+
---
|
|
37406
|
+
# Project Overview Skill
|
|
37407
|
+
|
|
37408
|
+
Guidance for understanding and maintaining the overall project architecture.
|
|
37409
|
+
|
|
37410
|
+
## Structure
|
|
37411
|
+
- Maintain a clear dependency graph.
|
|
37412
|
+
- Document the responsibility of each folder/package.
|
|
37413
|
+
- Keep boundaries between components clean.
|
|
37414
|
+
- Ensure the codebase follows established patterns consistently.
|
|
37415
|
+
`
|
|
37416
|
+
}
|
|
37417
|
+
];
|
|
37418
|
+
|
|
37419
|
+
// src/config-manager.ts
|
|
36907
37420
|
class ConfigManager {
|
|
36908
37421
|
projectPath;
|
|
36909
37422
|
constructor(projectPath) {
|
|
36910
37423
|
this.projectPath = projectPath;
|
|
36911
37424
|
}
|
|
36912
37425
|
async init(version2) {
|
|
36913
|
-
const locusConfigDir =
|
|
37426
|
+
const locusConfigDir = join7(this.projectPath, LOCUS_CONFIG.dir);
|
|
36914
37427
|
const locusConfigPath = getLocusPath(this.projectPath, "configFile");
|
|
36915
37428
|
const claudeMdPath = getLocusPath(this.projectPath, "contextFile");
|
|
36916
37429
|
if (!existsSync6(claudeMdPath)) {
|
|
36917
37430
|
const template = `# Locus Project Context
|
|
36918
37431
|
|
|
37432
|
+
# Workflow
|
|
37433
|
+
- Run lint and typecheck before completion
|
|
36919
37434
|
`;
|
|
36920
|
-
|
|
37435
|
+
writeFileSync3(claudeMdPath, template);
|
|
36921
37436
|
}
|
|
36922
37437
|
if (!existsSync6(locusConfigDir)) {
|
|
36923
37438
|
mkdirSync3(locusConfigDir, { recursive: true });
|
|
@@ -36928,7 +37443,27 @@ class ConfigManager {
|
|
|
36928
37443
|
createdAt: new Date().toISOString(),
|
|
36929
37444
|
projectPath: "."
|
|
36930
37445
|
};
|
|
36931
|
-
|
|
37446
|
+
writeFileSync3(locusConfigPath, JSON.stringify(config2, null, 2));
|
|
37447
|
+
}
|
|
37448
|
+
const skillLocations = [
|
|
37449
|
+
LOCUS_CONFIG.agentSkillsDir,
|
|
37450
|
+
".cursor/skills",
|
|
37451
|
+
".claude/skills",
|
|
37452
|
+
".codex/skills",
|
|
37453
|
+
".gemini/skills"
|
|
37454
|
+
];
|
|
37455
|
+
for (const location of skillLocations) {
|
|
37456
|
+
const skillsDir = join7(this.projectPath, location);
|
|
37457
|
+
if (!existsSync6(skillsDir)) {
|
|
37458
|
+
mkdirSync3(skillsDir, { recursive: true });
|
|
37459
|
+
}
|
|
37460
|
+
for (const skill of DEFAULT_SKILLS) {
|
|
37461
|
+
const skillPath = join7(skillsDir, skill.name);
|
|
37462
|
+
if (!existsSync6(skillPath)) {
|
|
37463
|
+
mkdirSync3(skillPath, { recursive: true });
|
|
37464
|
+
writeFileSync3(join7(skillPath, "SKILL.md"), skill.content);
|
|
37465
|
+
}
|
|
37466
|
+
}
|
|
36932
37467
|
}
|
|
36933
37468
|
}
|
|
36934
37469
|
loadConfig() {
|
|
@@ -36943,7 +37478,7 @@ class ConfigManager {
|
|
|
36943
37478
|
if (config2 && config2.version !== version2) {
|
|
36944
37479
|
config2.version = version2;
|
|
36945
37480
|
const path2 = getLocusPath(this.projectPath, "configFile");
|
|
36946
|
-
|
|
37481
|
+
writeFileSync3(path2, JSON.stringify(config2, null, 2));
|
|
36947
37482
|
}
|
|
36948
37483
|
}
|
|
36949
37484
|
}
|
|
@@ -36977,7 +37512,7 @@ function getVersion() {
|
|
|
36977
37512
|
try {
|
|
36978
37513
|
const __filename2 = fileURLToPath3(import.meta.url);
|
|
36979
37514
|
const __dirname2 = dirname3(__filename2);
|
|
36980
|
-
const packagePath =
|
|
37515
|
+
const packagePath = join8(__dirname2, "..", "package.json");
|
|
36981
37516
|
if (existsSync7(packagePath)) {
|
|
36982
37517
|
const pkg = JSON.parse(readFileSync6(packagePath, "utf-8"));
|
|
36983
37518
|
return pkg.version || "0.0.0";
|
|
@@ -36996,8 +37531,8 @@ function printBanner() {
|
|
|
36996
37531
|
`));
|
|
36997
37532
|
}
|
|
36998
37533
|
function isProjectInitialized(projectPath) {
|
|
36999
|
-
const locusDir =
|
|
37000
|
-
const configPath =
|
|
37534
|
+
const locusDir = join8(projectPath, LOCUS_CONFIG.dir);
|
|
37535
|
+
const configPath = join8(locusDir, LOCUS_CONFIG.configFile);
|
|
37001
37536
|
return existsSync7(locusDir) && existsSync7(configPath);
|
|
37002
37537
|
}
|
|
37003
37538
|
function requireInitialization(projectPath, command) {
|
|
@@ -37087,7 +37622,7 @@ async function indexCommand(args) {
|
|
|
37087
37622
|
const projectPath = values.dir || process.cwd();
|
|
37088
37623
|
requireInitialization(projectPath, "index");
|
|
37089
37624
|
new ConfigManager(projectPath).updateVersion(VERSION2);
|
|
37090
|
-
const provider = resolveProvider2(values.provider
|
|
37625
|
+
const provider = resolveProvider2(values.provider);
|
|
37091
37626
|
const model = values.model || DEFAULT_MODEL[provider];
|
|
37092
37627
|
const aiRunner = createAiRunner(provider, {
|
|
37093
37628
|
projectPath,
|
|
@@ -37108,7 +37643,7 @@ async function initCommand() {
|
|
|
37108
37643
|
console.log(`
|
|
37109
37644
|
${c.info("ℹ️ Locus is already initialized in this directory.")}
|
|
37110
37645
|
|
|
37111
|
-
Configuration found at: ${c.bold(
|
|
37646
|
+
Configuration found at: ${c.bold(join8(projectPath, LOCUS_CONFIG.dir))}
|
|
37112
37647
|
|
|
37113
37648
|
If you want to reinitialize, please remove the .locus directory first.
|
|
37114
37649
|
`);
|
|
@@ -37122,6 +37657,7 @@ Created:
|
|
|
37122
37657
|
\uD83D\uDCC1 ${c.dim(".locus/")} - Locus configuration directory
|
|
37123
37658
|
\uD83D\uDCC4 ${c.dim(".locus/config.json")} - Project configuration
|
|
37124
37659
|
\uD83D\uDCDD ${c.dim("CLAUDE.md")} - AI context file
|
|
37660
|
+
\uD83D\uDCC1 ${c.dim(".agent/skills/")} - Agent skills (Frontend, Backend, DevOps, etc.)
|
|
37125
37661
|
|
|
37126
37662
|
Next steps:
|
|
37127
37663
|
1. Run '${c.primary("locus index")}' to index your codebase
|