@majeanson/lac 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +5641 -2808
- package/dist/index.mjs.map +1 -1
- package/dist/lsp.mjs +571 -635
- package/dist/mcp.mjs +1017 -513
- package/package.json +1 -1
package/dist/mcp.mjs
CHANGED
|
@@ -6,11 +6,8 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
6
6
|
import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
7
7
|
import { execSync } from "node:child_process";
|
|
8
8
|
import "@anthropic-ai/sdk";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/** A special constant with type `never` */
|
|
12
|
-
const NEVER = Object.freeze({ status: "aborted" });
|
|
13
|
-
function $constructor$1(name, initializer$4, params) {
|
|
9
|
+
Object.freeze({ status: "aborted" });
|
|
10
|
+
function $constructor$1(name, initializer, params) {
|
|
14
11
|
function init(inst, def) {
|
|
15
12
|
if (!inst._zod) Object.defineProperty(inst, "_zod", {
|
|
16
13
|
value: {
|
|
@@ -22,7 +19,7 @@ function $constructor$1(name, initializer$4, params) {
|
|
|
22
19
|
});
|
|
23
20
|
if (inst._zod.traits.has(name)) return;
|
|
24
21
|
inst._zod.traits.add(name);
|
|
25
|
-
initializer
|
|
22
|
+
initializer(inst, def);
|
|
26
23
|
const proto = _.prototype;
|
|
27
24
|
const keys = Object.keys(proto);
|
|
28
25
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -34,10 +31,10 @@ function $constructor$1(name, initializer$4, params) {
|
|
|
34
31
|
class Definition extends Parent {}
|
|
35
32
|
Object.defineProperty(Definition, "name", { value: name });
|
|
36
33
|
function _(def) {
|
|
37
|
-
var _a
|
|
34
|
+
var _a;
|
|
38
35
|
const inst = params?.Parent ? new Definition() : this;
|
|
39
36
|
init(inst, def);
|
|
40
|
-
(_a
|
|
37
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
41
38
|
for (const fn of inst._zod.deferred) fn();
|
|
42
39
|
return inst;
|
|
43
40
|
}
|
|
@@ -65,7 +62,6 @@ function config$1(newConfig) {
|
|
|
65
62
|
if (newConfig) Object.assign(globalConfig$1, newConfig);
|
|
66
63
|
return globalConfig$1;
|
|
67
64
|
}
|
|
68
|
-
|
|
69
65
|
//#endregion
|
|
70
66
|
//#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/util.js
|
|
71
67
|
function getEnumValues$1(entries) {
|
|
@@ -106,9 +102,9 @@ function floatSafeRemainder$1(val, step) {
|
|
|
106
102
|
return Number.parseInt(val.toFixed(decCount).replace(".", "")) % Number.parseInt(step.toFixed(decCount).replace(".", "")) / 10 ** decCount;
|
|
107
103
|
}
|
|
108
104
|
const EVALUATING$1 = Symbol("evaluating");
|
|
109
|
-
function defineLazy$1(object
|
|
105
|
+
function defineLazy$1(object, key, getter) {
|
|
110
106
|
let value = void 0;
|
|
111
|
-
Object.defineProperty(object
|
|
107
|
+
Object.defineProperty(object, key, {
|
|
112
108
|
get() {
|
|
113
109
|
if (value === EVALUATING$1) return;
|
|
114
110
|
if (value === void 0) {
|
|
@@ -118,7 +114,7 @@ function defineLazy$1(object$2, key, getter) {
|
|
|
118
114
|
return value;
|
|
119
115
|
},
|
|
120
116
|
set(v) {
|
|
121
|
-
Object.defineProperty(object
|
|
117
|
+
Object.defineProperty(object, key, { value: v });
|
|
122
118
|
},
|
|
123
119
|
configurable: true
|
|
124
120
|
});
|
|
@@ -133,10 +129,7 @@ function assignProp$1(target, prop, value) {
|
|
|
133
129
|
}
|
|
134
130
|
function mergeDefs$1(...defs) {
|
|
135
131
|
const mergedDescriptors = {};
|
|
136
|
-
for (const def of defs)
|
|
137
|
-
const descriptors = Object.getOwnPropertyDescriptors(def);
|
|
138
|
-
Object.assign(mergedDescriptors, descriptors);
|
|
139
|
-
}
|
|
132
|
+
for (const def of defs) Object.assign(mergedDescriptors, Object.getOwnPropertyDescriptors(def));
|
|
140
133
|
return Object.defineProperties({}, mergedDescriptors);
|
|
141
134
|
}
|
|
142
135
|
function esc$1(str) {
|
|
@@ -342,23 +335,23 @@ function aborted$1(x, startIndex = 0) {
|
|
|
342
335
|
for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
|
|
343
336
|
return false;
|
|
344
337
|
}
|
|
345
|
-
function prefixIssues$1(path
|
|
338
|
+
function prefixIssues$1(path, issues) {
|
|
346
339
|
return issues.map((iss) => {
|
|
347
|
-
var _a
|
|
348
|
-
(_a
|
|
349
|
-
iss.path.unshift(path
|
|
340
|
+
var _a;
|
|
341
|
+
(_a = iss).path ?? (_a.path = []);
|
|
342
|
+
iss.path.unshift(path);
|
|
350
343
|
return iss;
|
|
351
344
|
});
|
|
352
345
|
}
|
|
353
346
|
function unwrapMessage$1(message) {
|
|
354
347
|
return typeof message === "string" ? message : message?.message;
|
|
355
348
|
}
|
|
356
|
-
function finalizeIssue$1(iss, ctx, config
|
|
349
|
+
function finalizeIssue$1(iss, ctx, config) {
|
|
357
350
|
const full = {
|
|
358
351
|
...iss,
|
|
359
352
|
path: iss.path ?? []
|
|
360
353
|
};
|
|
361
|
-
if (!iss.message) full.message = unwrapMessage$1(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage$1(ctx?.error?.(iss)) ?? unwrapMessage$1(config
|
|
354
|
+
if (!iss.message) full.message = unwrapMessage$1(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage$1(ctx?.error?.(iss)) ?? unwrapMessage$1(config.customError?.(iss)) ?? unwrapMessage$1(config.localeError?.(iss)) ?? "Invalid input";
|
|
362
355
|
delete full.inst;
|
|
363
356
|
delete full.continue;
|
|
364
357
|
if (!ctx?.reportInput) delete full.input;
|
|
@@ -379,7 +372,6 @@ function issue$1(...args) {
|
|
|
379
372
|
};
|
|
380
373
|
return { ...iss };
|
|
381
374
|
}
|
|
382
|
-
|
|
383
375
|
//#endregion
|
|
384
376
|
//#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/errors.js
|
|
385
377
|
const initializer$3 = (inst, def) => {
|
|
@@ -400,7 +392,7 @@ const initializer$3 = (inst, def) => {
|
|
|
400
392
|
};
|
|
401
393
|
const $ZodError$1 = $constructor$1("$ZodError", initializer$3);
|
|
402
394
|
const $ZodRealError$1 = $constructor$1("$ZodError", initializer$3, { Parent: Error });
|
|
403
|
-
function flattenError$1(error, mapper = (issue
|
|
395
|
+
function flattenError$1(error, mapper = (issue) => issue.message) {
|
|
404
396
|
const fieldErrors = {};
|
|
405
397
|
const formErrors = [];
|
|
406
398
|
for (const sub of error.issues) if (sub.path.length > 0) {
|
|
@@ -412,22 +404,22 @@ function flattenError$1(error, mapper = (issue$2) => issue$2.message) {
|
|
|
412
404
|
fieldErrors
|
|
413
405
|
};
|
|
414
406
|
}
|
|
415
|
-
function formatError$1(error, mapper = (issue
|
|
407
|
+
function formatError$1(error, mapper = (issue) => issue.message) {
|
|
416
408
|
const fieldErrors = { _errors: [] };
|
|
417
|
-
const processError = (error
|
|
418
|
-
for (const issue
|
|
419
|
-
else if (issue
|
|
420
|
-
else if (issue
|
|
421
|
-
else if (issue
|
|
409
|
+
const processError = (error) => {
|
|
410
|
+
for (const issue of error.issues) if (issue.code === "invalid_union" && issue.errors.length) issue.errors.map((issues) => processError({ issues }));
|
|
411
|
+
else if (issue.code === "invalid_key") processError({ issues: issue.issues });
|
|
412
|
+
else if (issue.code === "invalid_element") processError({ issues: issue.issues });
|
|
413
|
+
else if (issue.path.length === 0) fieldErrors._errors.push(mapper(issue));
|
|
422
414
|
else {
|
|
423
415
|
let curr = fieldErrors;
|
|
424
416
|
let i = 0;
|
|
425
|
-
while (i < issue
|
|
426
|
-
const el = issue
|
|
427
|
-
if (!(i === issue
|
|
417
|
+
while (i < issue.path.length) {
|
|
418
|
+
const el = issue.path[i];
|
|
419
|
+
if (!(i === issue.path.length - 1)) curr[el] = curr[el] || { _errors: [] };
|
|
428
420
|
else {
|
|
429
421
|
curr[el] = curr[el] || { _errors: [] };
|
|
430
|
-
curr[el]._errors.push(mapper(issue
|
|
422
|
+
curr[el]._errors.push(mapper(issue));
|
|
431
423
|
}
|
|
432
424
|
curr = curr[el];
|
|
433
425
|
i++;
|
|
@@ -437,7 +429,6 @@ function formatError$1(error, mapper = (issue$2) => issue$2.message) {
|
|
|
437
429
|
processError(error);
|
|
438
430
|
return fieldErrors;
|
|
439
431
|
}
|
|
440
|
-
|
|
441
432
|
//#endregion
|
|
442
433
|
//#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/parse.js
|
|
443
434
|
const _parse$1 = (_Err) => (schema, value, _ctx, _params) => {
|
|
@@ -454,7 +445,6 @@ const _parse$1 = (_Err) => (schema, value, _ctx, _params) => {
|
|
|
454
445
|
}
|
|
455
446
|
return result.value;
|
|
456
447
|
};
|
|
457
|
-
const parse$2 = /* @__PURE__ */ _parse$1($ZodRealError$1);
|
|
458
448
|
const _parseAsync$1 = (_Err) => async (schema, value, _ctx, params) => {
|
|
459
449
|
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
460
450
|
let result = schema._zod.run({
|
|
@@ -469,7 +459,6 @@ const _parseAsync$1 = (_Err) => async (schema, value, _ctx, params) => {
|
|
|
469
459
|
}
|
|
470
460
|
return result.value;
|
|
471
461
|
};
|
|
472
|
-
const parseAsync$2 = /* @__PURE__ */ _parseAsync$1($ZodRealError$1);
|
|
473
462
|
const _safeParse$1 = (_Err) => (schema, value, _ctx) => {
|
|
474
463
|
const ctx = _ctx ? {
|
|
475
464
|
..._ctx,
|
|
@@ -509,39 +498,30 @@ const _encode$1 = (_Err) => (schema, value, _ctx) => {
|
|
|
509
498
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
510
499
|
return _parse$1(_Err)(schema, value, ctx);
|
|
511
500
|
};
|
|
512
|
-
const encode$2 = /* @__PURE__ */ _encode$1($ZodRealError$1);
|
|
513
501
|
const _decode$1 = (_Err) => (schema, value, _ctx) => {
|
|
514
502
|
return _parse$1(_Err)(schema, value, _ctx);
|
|
515
503
|
};
|
|
516
|
-
const decode$2 = /* @__PURE__ */ _decode$1($ZodRealError$1);
|
|
517
504
|
const _encodeAsync$1 = (_Err) => async (schema, value, _ctx) => {
|
|
518
505
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
519
506
|
return _parseAsync$1(_Err)(schema, value, ctx);
|
|
520
507
|
};
|
|
521
|
-
const encodeAsync$2 = /* @__PURE__ */ _encodeAsync$1($ZodRealError$1);
|
|
522
508
|
const _decodeAsync$1 = (_Err) => async (schema, value, _ctx) => {
|
|
523
509
|
return _parseAsync$1(_Err)(schema, value, _ctx);
|
|
524
510
|
};
|
|
525
|
-
const decodeAsync$2 = /* @__PURE__ */ _decodeAsync$1($ZodRealError$1);
|
|
526
511
|
const _safeEncode$1 = (_Err) => (schema, value, _ctx) => {
|
|
527
512
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
528
513
|
return _safeParse$1(_Err)(schema, value, ctx);
|
|
529
514
|
};
|
|
530
|
-
const safeEncode$2 = /* @__PURE__ */ _safeEncode$1($ZodRealError$1);
|
|
531
515
|
const _safeDecode$1 = (_Err) => (schema, value, _ctx) => {
|
|
532
516
|
return _safeParse$1(_Err)(schema, value, _ctx);
|
|
533
517
|
};
|
|
534
|
-
const safeDecode$2 = /* @__PURE__ */ _safeDecode$1($ZodRealError$1);
|
|
535
518
|
const _safeEncodeAsync$1 = (_Err) => async (schema, value, _ctx) => {
|
|
536
519
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
537
520
|
return _safeParseAsync$1(_Err)(schema, value, ctx);
|
|
538
521
|
};
|
|
539
|
-
const safeEncodeAsync$2 = /* @__PURE__ */ _safeEncodeAsync$1($ZodRealError$1);
|
|
540
522
|
const _safeDecodeAsync$1 = (_Err) => async (schema, value, _ctx) => {
|
|
541
523
|
return _safeParseAsync$1(_Err)(schema, value, _ctx);
|
|
542
524
|
};
|
|
543
|
-
const safeDecodeAsync$2 = /* @__PURE__ */ _safeDecodeAsync$1($ZodRealError$1);
|
|
544
|
-
|
|
545
525
|
//#endregion
|
|
546
526
|
//#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/regexes.js
|
|
547
527
|
const cuid$1 = /^[cC][^\s-]{8,}$/;
|
|
@@ -557,9 +537,9 @@ const guid$1 = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0
|
|
|
557
537
|
/** Returns a regex for validating an RFC 9562/4122 UUID.
|
|
558
538
|
*
|
|
559
539
|
* @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
|
|
560
|
-
const uuid$1 = (version
|
|
561
|
-
if (!version
|
|
562
|
-
return
|
|
540
|
+
const uuid$1 = (version) => {
|
|
541
|
+
if (!version) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
|
|
542
|
+
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
|
563
543
|
};
|
|
564
544
|
/** Practical email validation */
|
|
565
545
|
const email$1 = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
@@ -581,32 +561,32 @@ function timeSource$1(args) {
|
|
|
581
561
|
return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
582
562
|
}
|
|
583
563
|
function time$3(args) {
|
|
584
|
-
return
|
|
564
|
+
return new RegExp(`^${timeSource$1(args)}$`);
|
|
585
565
|
}
|
|
586
566
|
function datetime$3(args) {
|
|
587
|
-
const time
|
|
567
|
+
const time = timeSource$1({ precision: args.precision });
|
|
588
568
|
const opts = ["Z"];
|
|
589
569
|
if (args.local) opts.push("");
|
|
590
570
|
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
591
|
-
const timeRegex = `${time
|
|
592
|
-
return
|
|
571
|
+
const timeRegex = `${time}(?:${opts.join("|")})`;
|
|
572
|
+
return new RegExp(`^${dateSource$1}T(?:${timeRegex})$`);
|
|
593
573
|
}
|
|
594
574
|
const string$3 = (params) => {
|
|
595
575
|
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
596
|
-
return
|
|
576
|
+
return new RegExp(`^${regex}$`);
|
|
597
577
|
};
|
|
598
578
|
const integer$1 = /^-?\d+$/;
|
|
599
579
|
const number$3 = /^-?\d+(?:\.\d+)?$/;
|
|
580
|
+
const boolean$3 = /^(?:true|false)$/i;
|
|
600
581
|
const lowercase$1 = /^[^A-Z]*$/;
|
|
601
582
|
const uppercase$1 = /^[^a-z]*$/;
|
|
602
|
-
|
|
603
583
|
//#endregion
|
|
604
584
|
//#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/checks.js
|
|
605
585
|
const $ZodCheck$1 = /* @__PURE__ */ $constructor$1("$ZodCheck", (inst, def) => {
|
|
606
|
-
var _a
|
|
586
|
+
var _a;
|
|
607
587
|
inst._zod ?? (inst._zod = {});
|
|
608
588
|
inst._zod.def = def;
|
|
609
|
-
(_a
|
|
589
|
+
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
|
610
590
|
});
|
|
611
591
|
const numericOriginMap$1 = {
|
|
612
592
|
number: "number",
|
|
@@ -616,8 +596,8 @@ const numericOriginMap$1 = {
|
|
|
616
596
|
const $ZodCheckLessThan$1 = /* @__PURE__ */ $constructor$1("$ZodCheckLessThan", (inst, def) => {
|
|
617
597
|
$ZodCheck$1.init(inst, def);
|
|
618
598
|
const origin = numericOriginMap$1[typeof def.value];
|
|
619
|
-
inst._zod.onattach.push((inst
|
|
620
|
-
const bag = inst
|
|
599
|
+
inst._zod.onattach.push((inst) => {
|
|
600
|
+
const bag = inst._zod.bag;
|
|
621
601
|
const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
622
602
|
if (def.value < curr) if (def.inclusive) bag.maximum = def.value;
|
|
623
603
|
else bag.exclusiveMaximum = def.value;
|
|
@@ -638,8 +618,8 @@ const $ZodCheckLessThan$1 = /* @__PURE__ */ $constructor$1("$ZodCheckLessThan",
|
|
|
638
618
|
const $ZodCheckGreaterThan$1 = /* @__PURE__ */ $constructor$1("$ZodCheckGreaterThan", (inst, def) => {
|
|
639
619
|
$ZodCheck$1.init(inst, def);
|
|
640
620
|
const origin = numericOriginMap$1[typeof def.value];
|
|
641
|
-
inst._zod.onattach.push((inst
|
|
642
|
-
const bag = inst
|
|
621
|
+
inst._zod.onattach.push((inst) => {
|
|
622
|
+
const bag = inst._zod.bag;
|
|
643
623
|
const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
644
624
|
if (def.value > curr) if (def.inclusive) bag.minimum = def.value;
|
|
645
625
|
else bag.exclusiveMinimum = def.value;
|
|
@@ -659,9 +639,9 @@ const $ZodCheckGreaterThan$1 = /* @__PURE__ */ $constructor$1("$ZodCheckGreaterT
|
|
|
659
639
|
});
|
|
660
640
|
const $ZodCheckMultipleOf$1 = /* @__PURE__ */ $constructor$1("$ZodCheckMultipleOf", (inst, def) => {
|
|
661
641
|
$ZodCheck$1.init(inst, def);
|
|
662
|
-
inst._zod.onattach.push((inst
|
|
663
|
-
var _a
|
|
664
|
-
(_a
|
|
642
|
+
inst._zod.onattach.push((inst) => {
|
|
643
|
+
var _a;
|
|
644
|
+
(_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
|
|
665
645
|
});
|
|
666
646
|
inst._zod.check = (payload) => {
|
|
667
647
|
if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
@@ -682,8 +662,8 @@ const $ZodCheckNumberFormat$1 = /* @__PURE__ */ $constructor$1("$ZodCheckNumberF
|
|
|
682
662
|
const isInt = def.format?.includes("int");
|
|
683
663
|
const origin = isInt ? "int" : "number";
|
|
684
664
|
const [minimum, maximum] = NUMBER_FORMAT_RANGES$1[def.format];
|
|
685
|
-
inst._zod.onattach.push((inst
|
|
686
|
-
const bag = inst
|
|
665
|
+
inst._zod.onattach.push((inst) => {
|
|
666
|
+
const bag = inst._zod.bag;
|
|
687
667
|
bag.format = def.format;
|
|
688
668
|
bag.minimum = minimum;
|
|
689
669
|
bag.maximum = maximum;
|
|
@@ -748,15 +728,15 @@ const $ZodCheckNumberFormat$1 = /* @__PURE__ */ $constructor$1("$ZodCheckNumberF
|
|
|
748
728
|
};
|
|
749
729
|
});
|
|
750
730
|
const $ZodCheckMaxLength$1 = /* @__PURE__ */ $constructor$1("$ZodCheckMaxLength", (inst, def) => {
|
|
751
|
-
var _a
|
|
731
|
+
var _a;
|
|
752
732
|
$ZodCheck$1.init(inst, def);
|
|
753
|
-
(_a
|
|
733
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
754
734
|
const val = payload.value;
|
|
755
735
|
return !nullish$1(val) && val.length !== void 0;
|
|
756
736
|
});
|
|
757
|
-
inst._zod.onattach.push((inst
|
|
758
|
-
const curr = inst
|
|
759
|
-
if (def.maximum < curr) inst
|
|
737
|
+
inst._zod.onattach.push((inst) => {
|
|
738
|
+
const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
739
|
+
if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
|
|
760
740
|
});
|
|
761
741
|
inst._zod.check = (payload) => {
|
|
762
742
|
const input = payload.value;
|
|
@@ -774,15 +754,15 @@ const $ZodCheckMaxLength$1 = /* @__PURE__ */ $constructor$1("$ZodCheckMaxLength"
|
|
|
774
754
|
};
|
|
775
755
|
});
|
|
776
756
|
const $ZodCheckMinLength$1 = /* @__PURE__ */ $constructor$1("$ZodCheckMinLength", (inst, def) => {
|
|
777
|
-
var _a
|
|
757
|
+
var _a;
|
|
778
758
|
$ZodCheck$1.init(inst, def);
|
|
779
|
-
(_a
|
|
759
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
780
760
|
const val = payload.value;
|
|
781
761
|
return !nullish$1(val) && val.length !== void 0;
|
|
782
762
|
});
|
|
783
|
-
inst._zod.onattach.push((inst
|
|
784
|
-
const curr = inst
|
|
785
|
-
if (def.minimum > curr) inst
|
|
763
|
+
inst._zod.onattach.push((inst) => {
|
|
764
|
+
const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
765
|
+
if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
|
|
786
766
|
});
|
|
787
767
|
inst._zod.check = (payload) => {
|
|
788
768
|
const input = payload.value;
|
|
@@ -800,14 +780,14 @@ const $ZodCheckMinLength$1 = /* @__PURE__ */ $constructor$1("$ZodCheckMinLength"
|
|
|
800
780
|
};
|
|
801
781
|
});
|
|
802
782
|
const $ZodCheckLengthEquals$1 = /* @__PURE__ */ $constructor$1("$ZodCheckLengthEquals", (inst, def) => {
|
|
803
|
-
var _a
|
|
783
|
+
var _a;
|
|
804
784
|
$ZodCheck$1.init(inst, def);
|
|
805
|
-
(_a
|
|
785
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
806
786
|
const val = payload.value;
|
|
807
787
|
return !nullish$1(val) && val.length !== void 0;
|
|
808
788
|
});
|
|
809
|
-
inst._zod.onattach.push((inst
|
|
810
|
-
const bag = inst
|
|
789
|
+
inst._zod.onattach.push((inst) => {
|
|
790
|
+
const bag = inst._zod.bag;
|
|
811
791
|
bag.minimum = def.length;
|
|
812
792
|
bag.maximum = def.length;
|
|
813
793
|
bag.length = def.length;
|
|
@@ -836,17 +816,17 @@ const $ZodCheckLengthEquals$1 = /* @__PURE__ */ $constructor$1("$ZodCheckLengthE
|
|
|
836
816
|
};
|
|
837
817
|
});
|
|
838
818
|
const $ZodCheckStringFormat$1 = /* @__PURE__ */ $constructor$1("$ZodCheckStringFormat", (inst, def) => {
|
|
839
|
-
var _a
|
|
819
|
+
var _a, _b;
|
|
840
820
|
$ZodCheck$1.init(inst, def);
|
|
841
|
-
inst._zod.onattach.push((inst
|
|
842
|
-
const bag = inst
|
|
821
|
+
inst._zod.onattach.push((inst) => {
|
|
822
|
+
const bag = inst._zod.bag;
|
|
843
823
|
bag.format = def.format;
|
|
844
824
|
if (def.pattern) {
|
|
845
825
|
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
846
826
|
bag.patterns.add(def.pattern);
|
|
847
827
|
}
|
|
848
828
|
});
|
|
849
|
-
if (def.pattern) (_a
|
|
829
|
+
if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => {
|
|
850
830
|
def.pattern.lastIndex = 0;
|
|
851
831
|
if (def.pattern.test(payload.value)) return;
|
|
852
832
|
payload.issues.push({
|
|
@@ -890,8 +870,8 @@ const $ZodCheckIncludes$1 = /* @__PURE__ */ $constructor$1("$ZodCheckIncludes",
|
|
|
890
870
|
const escapedRegex = escapeRegex$1(def.includes);
|
|
891
871
|
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
892
872
|
def.pattern = pattern;
|
|
893
|
-
inst._zod.onattach.push((inst
|
|
894
|
-
const bag = inst
|
|
873
|
+
inst._zod.onattach.push((inst) => {
|
|
874
|
+
const bag = inst._zod.bag;
|
|
895
875
|
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
896
876
|
bag.patterns.add(pattern);
|
|
897
877
|
});
|
|
@@ -910,10 +890,10 @@ const $ZodCheckIncludes$1 = /* @__PURE__ */ $constructor$1("$ZodCheckIncludes",
|
|
|
910
890
|
});
|
|
911
891
|
const $ZodCheckStartsWith$1 = /* @__PURE__ */ $constructor$1("$ZodCheckStartsWith", (inst, def) => {
|
|
912
892
|
$ZodCheck$1.init(inst, def);
|
|
913
|
-
const pattern =
|
|
893
|
+
const pattern = new RegExp(`^${escapeRegex$1(def.prefix)}.*`);
|
|
914
894
|
def.pattern ?? (def.pattern = pattern);
|
|
915
|
-
inst._zod.onattach.push((inst
|
|
916
|
-
const bag = inst
|
|
895
|
+
inst._zod.onattach.push((inst) => {
|
|
896
|
+
const bag = inst._zod.bag;
|
|
917
897
|
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
918
898
|
bag.patterns.add(pattern);
|
|
919
899
|
});
|
|
@@ -932,10 +912,10 @@ const $ZodCheckStartsWith$1 = /* @__PURE__ */ $constructor$1("$ZodCheckStartsWit
|
|
|
932
912
|
});
|
|
933
913
|
const $ZodCheckEndsWith$1 = /* @__PURE__ */ $constructor$1("$ZodCheckEndsWith", (inst, def) => {
|
|
934
914
|
$ZodCheck$1.init(inst, def);
|
|
935
|
-
const pattern =
|
|
915
|
+
const pattern = new RegExp(`.*${escapeRegex$1(def.suffix)}$`);
|
|
936
916
|
def.pattern ?? (def.pattern = pattern);
|
|
937
|
-
inst._zod.onattach.push((inst
|
|
938
|
-
const bag = inst
|
|
917
|
+
inst._zod.onattach.push((inst) => {
|
|
918
|
+
const bag = inst._zod.bag;
|
|
939
919
|
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
940
920
|
bag.patterns.add(pattern);
|
|
941
921
|
});
|
|
@@ -958,7 +938,6 @@ const $ZodCheckOverwrite$1 = /* @__PURE__ */ $constructor$1("$ZodCheckOverwrite"
|
|
|
958
938
|
payload.value = def.tx(payload.value);
|
|
959
939
|
};
|
|
960
940
|
});
|
|
961
|
-
|
|
962
941
|
//#endregion
|
|
963
942
|
//#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/doc.js
|
|
964
943
|
var Doc$1 = class {
|
|
@@ -990,7 +969,6 @@ var Doc$1 = class {
|
|
|
990
969
|
return new F(...args, lines.join("\n"));
|
|
991
970
|
}
|
|
992
971
|
};
|
|
993
|
-
|
|
994
972
|
//#endregion
|
|
995
973
|
//#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/versions.js
|
|
996
974
|
const version$1 = {
|
|
@@ -998,11 +976,10 @@ const version$1 = {
|
|
|
998
976
|
minor: 3,
|
|
999
977
|
patch: 6
|
|
1000
978
|
};
|
|
1001
|
-
|
|
1002
979
|
//#endregion
|
|
1003
980
|
//#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/schemas.js
|
|
1004
981
|
const $ZodType$1 = /* @__PURE__ */ $constructor$1("$ZodType", (inst, def) => {
|
|
1005
|
-
var _a
|
|
982
|
+
var _a;
|
|
1006
983
|
inst ?? (inst = {});
|
|
1007
984
|
inst._zod.def = def;
|
|
1008
985
|
inst._zod.bag = inst._zod.bag || {};
|
|
@@ -1011,15 +988,15 @@ const $ZodType$1 = /* @__PURE__ */ $constructor$1("$ZodType", (inst, def) => {
|
|
|
1011
988
|
if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
|
|
1012
989
|
for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
|
|
1013
990
|
if (checks.length === 0) {
|
|
1014
|
-
(_a
|
|
991
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
1015
992
|
inst._zod.deferred?.push(() => {
|
|
1016
993
|
inst._zod.run = inst._zod.parse;
|
|
1017
994
|
});
|
|
1018
995
|
} else {
|
|
1019
|
-
const runChecks = (payload, checks
|
|
996
|
+
const runChecks = (payload, checks, ctx) => {
|
|
1020
997
|
let isAborted = aborted$1(payload);
|
|
1021
998
|
let asyncResult;
|
|
1022
|
-
for (const ch of checks
|
|
999
|
+
for (const ch of checks) {
|
|
1023
1000
|
if (ch._zod.def.when) {
|
|
1024
1001
|
if (!ch._zod.def.when(payload)) continue;
|
|
1025
1002
|
} else if (isAborted) continue;
|
|
@@ -1049,7 +1026,7 @@ const $ZodType$1 = /* @__PURE__ */ $constructor$1("$ZodType", (inst, def) => {
|
|
|
1049
1026
|
const checkResult = runChecks(payload, checks, ctx);
|
|
1050
1027
|
if (checkResult instanceof Promise) {
|
|
1051
1028
|
if (ctx.async === false) throw new $ZodAsyncError$1();
|
|
1052
|
-
return checkResult.then((checkResult
|
|
1029
|
+
return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
|
|
1053
1030
|
}
|
|
1054
1031
|
return inst._zod.parse(checkResult, ctx);
|
|
1055
1032
|
};
|
|
@@ -1063,15 +1040,15 @@ const $ZodType$1 = /* @__PURE__ */ $constructor$1("$ZodType", (inst, def) => {
|
|
|
1063
1040
|
...ctx,
|
|
1064
1041
|
skipChecks: true
|
|
1065
1042
|
});
|
|
1066
|
-
if (canary instanceof Promise) return canary.then((canary
|
|
1067
|
-
return handleCanaryResult(canary
|
|
1043
|
+
if (canary instanceof Promise) return canary.then((canary) => {
|
|
1044
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
1068
1045
|
});
|
|
1069
1046
|
return handleCanaryResult(canary, payload, ctx);
|
|
1070
1047
|
}
|
|
1071
1048
|
const result = inst._zod.parse(payload, ctx);
|
|
1072
1049
|
if (result instanceof Promise) {
|
|
1073
1050
|
if (ctx.async === false) throw new $ZodAsyncError$1();
|
|
1074
|
-
return result.then((result
|
|
1051
|
+
return result.then((result) => runChecks(result, checks, ctx));
|
|
1075
1052
|
}
|
|
1076
1053
|
return runChecks(result, checks, ctx);
|
|
1077
1054
|
};
|
|
@@ -1095,7 +1072,7 @@ const $ZodString$1 = /* @__PURE__ */ $constructor$1("$ZodString", (inst, def) =>
|
|
|
1095
1072
|
inst._zod.parse = (payload, _) => {
|
|
1096
1073
|
if (def.coerce) try {
|
|
1097
1074
|
payload.value = String(payload.value);
|
|
1098
|
-
} catch (_
|
|
1075
|
+
} catch (_) {}
|
|
1099
1076
|
if (typeof payload.value === "string") return payload;
|
|
1100
1077
|
payload.issues.push({
|
|
1101
1078
|
expected: "string",
|
|
@@ -1301,8 +1278,8 @@ const $ZodBase64$1 = /* @__PURE__ */ $constructor$1("$ZodBase64", (inst, def) =>
|
|
|
1301
1278
|
});
|
|
1302
1279
|
function isValidBase64URL$1(data) {
|
|
1303
1280
|
if (!base64url$1.test(data)) return false;
|
|
1304
|
-
const base64
|
|
1305
|
-
return isValidBase64$1(base64
|
|
1281
|
+
const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
1282
|
+
return isValidBase64$1(base64.padEnd(Math.ceil(base64.length / 4) * 4, "="));
|
|
1306
1283
|
}
|
|
1307
1284
|
const $ZodBase64URL$1 = /* @__PURE__ */ $constructor$1("$ZodBase64URL", (inst, def) => {
|
|
1308
1285
|
def.pattern ?? (def.pattern = base64url$1);
|
|
@@ -1375,6 +1352,24 @@ const $ZodNumberFormat$1 = /* @__PURE__ */ $constructor$1("$ZodNumberFormat", (i
|
|
|
1375
1352
|
$ZodCheckNumberFormat$1.init(inst, def);
|
|
1376
1353
|
$ZodNumber$1.init(inst, def);
|
|
1377
1354
|
});
|
|
1355
|
+
const $ZodBoolean$1 = /* @__PURE__ */ $constructor$1("$ZodBoolean", (inst, def) => {
|
|
1356
|
+
$ZodType$1.init(inst, def);
|
|
1357
|
+
inst._zod.pattern = boolean$3;
|
|
1358
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1359
|
+
if (def.coerce) try {
|
|
1360
|
+
payload.value = Boolean(payload.value);
|
|
1361
|
+
} catch (_) {}
|
|
1362
|
+
const input = payload.value;
|
|
1363
|
+
if (typeof input === "boolean") return payload;
|
|
1364
|
+
payload.issues.push({
|
|
1365
|
+
expected: "boolean",
|
|
1366
|
+
code: "invalid_type",
|
|
1367
|
+
input,
|
|
1368
|
+
inst
|
|
1369
|
+
});
|
|
1370
|
+
return payload;
|
|
1371
|
+
};
|
|
1372
|
+
});
|
|
1378
1373
|
const $ZodUnknown$1 = /* @__PURE__ */ $constructor$1("$ZodUnknown", (inst, def) => {
|
|
1379
1374
|
$ZodType$1.init(inst, def);
|
|
1380
1375
|
inst._zod.parse = (payload) => payload;
|
|
@@ -1416,7 +1411,7 @@ const $ZodArray$1 = /* @__PURE__ */ $constructor$1("$ZodArray", (inst, def) => {
|
|
|
1416
1411
|
value: item,
|
|
1417
1412
|
issues: []
|
|
1418
1413
|
}, ctx);
|
|
1419
|
-
if (result instanceof Promise) proms.push(result.then((result
|
|
1414
|
+
if (result instanceof Promise) proms.push(result.then((result) => handleArrayResult$1(result, payload, i)));
|
|
1420
1415
|
else handleArrayResult$1(result, payload, i);
|
|
1421
1416
|
}
|
|
1422
1417
|
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
@@ -1460,7 +1455,7 @@ function handleCatchall$1(proms, input, payload, ctx, def, inst) {
|
|
|
1460
1455
|
value: input[key],
|
|
1461
1456
|
issues: []
|
|
1462
1457
|
}, ctx);
|
|
1463
|
-
if (r instanceof Promise) proms.push(r.then((r
|
|
1458
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult$1(r, payload, key, input, isOptionalOut)));
|
|
1464
1459
|
else handlePropertyResult$1(r, payload, key, input, isOptionalOut);
|
|
1465
1460
|
}
|
|
1466
1461
|
if (unrecognized.length) payload.issues.push({
|
|
@@ -1497,13 +1492,13 @@ const $ZodObject$1 = /* @__PURE__ */ $constructor$1("$ZodObject", (inst, def) =>
|
|
|
1497
1492
|
}
|
|
1498
1493
|
return propValues;
|
|
1499
1494
|
});
|
|
1500
|
-
const isObject
|
|
1495
|
+
const isObject = isObject$1;
|
|
1501
1496
|
const catchall = def.catchall;
|
|
1502
1497
|
let value;
|
|
1503
1498
|
inst._zod.parse = (payload, ctx) => {
|
|
1504
1499
|
value ?? (value = _normalized.value);
|
|
1505
1500
|
const input = payload.value;
|
|
1506
|
-
if (!isObject
|
|
1501
|
+
if (!isObject(input)) {
|
|
1507
1502
|
payload.issues.push({
|
|
1508
1503
|
expected: "object",
|
|
1509
1504
|
code: "invalid_type",
|
|
@@ -1522,7 +1517,7 @@ const $ZodObject$1 = /* @__PURE__ */ $constructor$1("$ZodObject", (inst, def) =>
|
|
|
1522
1517
|
value: input[key],
|
|
1523
1518
|
issues: []
|
|
1524
1519
|
}, ctx);
|
|
1525
|
-
if (r instanceof Promise) proms.push(r.then((r
|
|
1520
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult$1(r, payload, key, input, isOptionalOut)));
|
|
1526
1521
|
else handlePropertyResult$1(r, payload, key, input, isOptionalOut);
|
|
1527
1522
|
}
|
|
1528
1523
|
if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
@@ -1597,16 +1592,15 @@ const $ZodObjectJIT$1 = /* @__PURE__ */ $constructor$1("$ZodObjectJIT", (inst, d
|
|
|
1597
1592
|
return (payload, ctx) => fn(shape, payload, ctx);
|
|
1598
1593
|
};
|
|
1599
1594
|
let fastpass;
|
|
1600
|
-
const isObject
|
|
1595
|
+
const isObject = isObject$1;
|
|
1601
1596
|
const jit = !globalConfig$1.jitless;
|
|
1602
|
-
const
|
|
1603
|
-
const fastEnabled = jit && allowsEval$2.value;
|
|
1597
|
+
const fastEnabled = jit && allowsEval$1.value;
|
|
1604
1598
|
const catchall = def.catchall;
|
|
1605
1599
|
let value;
|
|
1606
1600
|
inst._zod.parse = (payload, ctx) => {
|
|
1607
1601
|
value ?? (value = _normalized.value);
|
|
1608
1602
|
const input = payload.value;
|
|
1609
|
-
if (!isObject
|
|
1603
|
+
if (!isObject(input)) {
|
|
1610
1604
|
payload.issues.push({
|
|
1611
1605
|
expected: "object",
|
|
1612
1606
|
code: "invalid_type",
|
|
@@ -1652,7 +1646,7 @@ const $ZodUnion$1 = /* @__PURE__ */ $constructor$1("$ZodUnion", (inst, def) => {
|
|
|
1652
1646
|
defineLazy$1(inst._zod, "pattern", () => {
|
|
1653
1647
|
if (def.options.every((o) => o._zod.pattern)) {
|
|
1654
1648
|
const patterns = def.options.map((o) => o._zod.pattern);
|
|
1655
|
-
return
|
|
1649
|
+
return new RegExp(`^(${patterns.map((p) => cleanRegex$1(p.source)).join("|")})$`);
|
|
1656
1650
|
}
|
|
1657
1651
|
});
|
|
1658
1652
|
const single = def.options.length === 1;
|
|
@@ -1675,8 +1669,8 @@ const $ZodUnion$1 = /* @__PURE__ */ $constructor$1("$ZodUnion", (inst, def) => {
|
|
|
1675
1669
|
}
|
|
1676
1670
|
}
|
|
1677
1671
|
if (!async) return handleUnionResults$1(results, payload, inst, ctx);
|
|
1678
|
-
return Promise.all(results).then((results
|
|
1679
|
-
return handleUnionResults$1(results
|
|
1672
|
+
return Promise.all(results).then((results) => {
|
|
1673
|
+
return handleUnionResults$1(results, payload, inst, ctx);
|
|
1680
1674
|
});
|
|
1681
1675
|
};
|
|
1682
1676
|
});
|
|
@@ -1692,8 +1686,8 @@ const $ZodIntersection$1 = /* @__PURE__ */ $constructor$1("$ZodIntersection", (i
|
|
|
1692
1686
|
value: input,
|
|
1693
1687
|
issues: []
|
|
1694
1688
|
}, ctx);
|
|
1695
|
-
if (left instanceof Promise || right instanceof Promise) return Promise.all([left, right]).then(([left
|
|
1696
|
-
return handleIntersectionResults$1(payload, left
|
|
1689
|
+
if (left instanceof Promise || right instanceof Promise) return Promise.all([left, right]).then(([left, right]) => {
|
|
1690
|
+
return handleIntersectionResults$1(payload, left, right);
|
|
1697
1691
|
});
|
|
1698
1692
|
return handleIntersectionResults$1(payload, left, right);
|
|
1699
1693
|
};
|
|
@@ -1784,7 +1778,7 @@ const $ZodEnum$1 = /* @__PURE__ */ $constructor$1("$ZodEnum", (inst, def) => {
|
|
|
1784
1778
|
const values = getEnumValues$1(def.entries);
|
|
1785
1779
|
const valuesSet = new Set(values);
|
|
1786
1780
|
inst._zod.values = valuesSet;
|
|
1787
|
-
inst._zod.pattern =
|
|
1781
|
+
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes$1.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex$1(o) : o.toString()).join("|")})$`);
|
|
1788
1782
|
inst._zod.parse = (payload, _ctx) => {
|
|
1789
1783
|
const input = payload.value;
|
|
1790
1784
|
if (valuesSet.has(input)) return payload;
|
|
@@ -1827,7 +1821,7 @@ const $ZodOptional$1 = /* @__PURE__ */ $constructor$1("$ZodOptional", (inst, def
|
|
|
1827
1821
|
});
|
|
1828
1822
|
defineLazy$1(inst._zod, "pattern", () => {
|
|
1829
1823
|
const pattern = def.innerType._zod.pattern;
|
|
1830
|
-
return pattern ?
|
|
1824
|
+
return pattern ? new RegExp(`^(${cleanRegex$1(pattern.source)})?$`) : void 0;
|
|
1831
1825
|
});
|
|
1832
1826
|
inst._zod.parse = (payload, ctx) => {
|
|
1833
1827
|
if (def.innerType._zod.optin === "optional") {
|
|
@@ -1853,7 +1847,7 @@ const $ZodNullable$1 = /* @__PURE__ */ $constructor$1("$ZodNullable", (inst, def
|
|
|
1853
1847
|
defineLazy$1(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
1854
1848
|
defineLazy$1(inst._zod, "pattern", () => {
|
|
1855
1849
|
const pattern = def.innerType._zod.pattern;
|
|
1856
|
-
return pattern ?
|
|
1850
|
+
return pattern ? new RegExp(`^(${cleanRegex$1(pattern.source)}|null)$`) : void 0;
|
|
1857
1851
|
});
|
|
1858
1852
|
defineLazy$1(inst._zod, "values", () => {
|
|
1859
1853
|
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : void 0;
|
|
@@ -1877,7 +1871,7 @@ const $ZodDefault$1 = /* @__PURE__ */ $constructor$1("$ZodDefault", (inst, def)
|
|
|
1877
1871
|
return payload;
|
|
1878
1872
|
}
|
|
1879
1873
|
const result = def.innerType._zod.run(payload, ctx);
|
|
1880
|
-
if (result instanceof Promise) return result.then((result
|
|
1874
|
+
if (result instanceof Promise) return result.then((result) => handleDefaultResult$1(result, def));
|
|
1881
1875
|
return handleDefaultResult$1(result, def);
|
|
1882
1876
|
};
|
|
1883
1877
|
});
|
|
@@ -1903,7 +1897,7 @@ const $ZodNonOptional$1 = /* @__PURE__ */ $constructor$1("$ZodNonOptional", (ins
|
|
|
1903
1897
|
});
|
|
1904
1898
|
inst._zod.parse = (payload, ctx) => {
|
|
1905
1899
|
const result = def.innerType._zod.run(payload, ctx);
|
|
1906
|
-
if (result instanceof Promise) return result.then((result
|
|
1900
|
+
if (result instanceof Promise) return result.then((result) => handleNonOptionalResult$1(result, inst));
|
|
1907
1901
|
return handleNonOptionalResult$1(result, inst);
|
|
1908
1902
|
};
|
|
1909
1903
|
});
|
|
@@ -1924,12 +1918,12 @@ const $ZodCatch$1 = /* @__PURE__ */ $constructor$1("$ZodCatch", (inst, def) => {
|
|
|
1924
1918
|
inst._zod.parse = (payload, ctx) => {
|
|
1925
1919
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
1926
1920
|
const result = def.innerType._zod.run(payload, ctx);
|
|
1927
|
-
if (result instanceof Promise) return result.then((result
|
|
1928
|
-
payload.value = result
|
|
1929
|
-
if (result
|
|
1921
|
+
if (result instanceof Promise) return result.then((result) => {
|
|
1922
|
+
payload.value = result.value;
|
|
1923
|
+
if (result.issues.length) {
|
|
1930
1924
|
payload.value = def.catchValue({
|
|
1931
1925
|
...payload,
|
|
1932
|
-
error: { issues: result
|
|
1926
|
+
error: { issues: result.issues.map((iss) => finalizeIssue$1(iss, ctx, config$1())) },
|
|
1933
1927
|
input: payload.value
|
|
1934
1928
|
});
|
|
1935
1929
|
payload.issues = [];
|
|
@@ -1957,11 +1951,11 @@ const $ZodPipe$1 = /* @__PURE__ */ $constructor$1("$ZodPipe", (inst, def) => {
|
|
|
1957
1951
|
inst._zod.parse = (payload, ctx) => {
|
|
1958
1952
|
if (ctx.direction === "backward") {
|
|
1959
1953
|
const right = def.out._zod.run(payload, ctx);
|
|
1960
|
-
if (right instanceof Promise) return right.then((right
|
|
1954
|
+
if (right instanceof Promise) return right.then((right) => handlePipeResult$1(right, def.in, ctx));
|
|
1961
1955
|
return handlePipeResult$1(right, def.in, ctx);
|
|
1962
1956
|
}
|
|
1963
1957
|
const left = def.in._zod.run(payload, ctx);
|
|
1964
|
-
if (left instanceof Promise) return left.then((left
|
|
1958
|
+
if (left instanceof Promise) return left.then((left) => handlePipeResult$1(left, def.out, ctx));
|
|
1965
1959
|
return handlePipeResult$1(left, def.out, ctx);
|
|
1966
1960
|
};
|
|
1967
1961
|
});
|
|
@@ -2001,7 +1995,7 @@ const $ZodCustom$1 = /* @__PURE__ */ $constructor$1("$ZodCustom", (inst, def) =>
|
|
|
2001
1995
|
inst._zod.check = (payload) => {
|
|
2002
1996
|
const input = payload.value;
|
|
2003
1997
|
const r = def.fn(input);
|
|
2004
|
-
if (r instanceof Promise) return r.then((r
|
|
1998
|
+
if (r instanceof Promise) return r.then((r) => handleRefineResult$1(r, payload, input, inst));
|
|
2005
1999
|
handleRefineResult$1(r, payload, input, inst);
|
|
2006
2000
|
};
|
|
2007
2001
|
});
|
|
@@ -2018,7 +2012,6 @@ function handleRefineResult$1(result, payload, input, inst) {
|
|
|
2018
2012
|
payload.issues.push(issue$1(_iss));
|
|
2019
2013
|
}
|
|
2020
2014
|
}
|
|
2021
|
-
|
|
2022
2015
|
//#endregion
|
|
2023
2016
|
//#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/registries.js
|
|
2024
2017
|
var _a$1;
|
|
@@ -2028,9 +2021,9 @@ var $ZodRegistry$1 = class {
|
|
|
2028
2021
|
this._idmap = /* @__PURE__ */ new Map();
|
|
2029
2022
|
}
|
|
2030
2023
|
add(schema, ..._meta) {
|
|
2031
|
-
const meta
|
|
2032
|
-
this._map.set(schema, meta
|
|
2033
|
-
if (meta
|
|
2024
|
+
const meta = _meta[0];
|
|
2025
|
+
this._map.set(schema, meta);
|
|
2026
|
+
if (meta && typeof meta === "object" && "id" in meta) this._idmap.set(meta.id, schema);
|
|
2034
2027
|
return this;
|
|
2035
2028
|
}
|
|
2036
2029
|
clear() {
|
|
@@ -2039,8 +2032,8 @@ var $ZodRegistry$1 = class {
|
|
|
2039
2032
|
return this;
|
|
2040
2033
|
}
|
|
2041
2034
|
remove(schema) {
|
|
2042
|
-
const meta
|
|
2043
|
-
if (meta
|
|
2035
|
+
const meta = this._map.get(schema);
|
|
2036
|
+
if (meta && typeof meta === "object" && "id" in meta) this._idmap.delete(meta.id);
|
|
2044
2037
|
this._map.delete(schema);
|
|
2045
2038
|
return this;
|
|
2046
2039
|
}
|
|
@@ -2066,7 +2059,6 @@ function registry$1() {
|
|
|
2066
2059
|
}
|
|
2067
2060
|
(_a$1 = globalThis).__zod_globalRegistry ?? (_a$1.__zod_globalRegistry = registry$1());
|
|
2068
2061
|
const globalRegistry$1 = globalThis.__zod_globalRegistry;
|
|
2069
|
-
|
|
2070
2062
|
//#endregion
|
|
2071
2063
|
//#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/api.js
|
|
2072
2064
|
/* @__NO_SIDE_EFFECTS__ */
|
|
@@ -2358,6 +2350,13 @@ function _int$1(Class, params) {
|
|
|
2358
2350
|
});
|
|
2359
2351
|
}
|
|
2360
2352
|
/* @__NO_SIDE_EFFECTS__ */
|
|
2353
|
+
function _boolean$1(Class, params) {
|
|
2354
|
+
return new Class({
|
|
2355
|
+
type: "boolean",
|
|
2356
|
+
...normalizeParams$1(params)
|
|
2357
|
+
});
|
|
2358
|
+
}
|
|
2359
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2361
2360
|
function _unknown$1(Class) {
|
|
2362
2361
|
return new Class({ type: "unknown" });
|
|
2363
2362
|
}
|
|
@@ -2535,10 +2534,10 @@ function _refine$1(Class, fn, _params) {
|
|
|
2535
2534
|
/* @__NO_SIDE_EFFECTS__ */
|
|
2536
2535
|
function _superRefine$1(fn) {
|
|
2537
2536
|
const ch = /* @__PURE__ */ _check$1((payload) => {
|
|
2538
|
-
payload.addIssue = (issue
|
|
2539
|
-
if (typeof issue
|
|
2537
|
+
payload.addIssue = (issue) => {
|
|
2538
|
+
if (typeof issue === "string") payload.issues.push(issue$1(issue, payload.value, ch._zod.def));
|
|
2540
2539
|
else {
|
|
2541
|
-
const _issue = issue
|
|
2540
|
+
const _issue = issue;
|
|
2542
2541
|
if (_issue.fatal) _issue.continue = false;
|
|
2543
2542
|
_issue.code ?? (_issue.code = "custom");
|
|
2544
2543
|
_issue.input ?? (_issue.input = payload.value);
|
|
@@ -2560,33 +2559,6 @@ function _check$1(fn, params) {
|
|
|
2560
2559
|
ch._zod.check = fn;
|
|
2561
2560
|
return ch;
|
|
2562
2561
|
}
|
|
2563
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2564
|
-
function describe$1(description) {
|
|
2565
|
-
const ch = new $ZodCheck$1({ check: "describe" });
|
|
2566
|
-
ch._zod.onattach = [(inst) => {
|
|
2567
|
-
const existing = globalRegistry$1.get(inst) ?? {};
|
|
2568
|
-
globalRegistry$1.add(inst, {
|
|
2569
|
-
...existing,
|
|
2570
|
-
description
|
|
2571
|
-
});
|
|
2572
|
-
}];
|
|
2573
|
-
ch._zod.check = () => {};
|
|
2574
|
-
return ch;
|
|
2575
|
-
}
|
|
2576
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2577
|
-
function meta$1(metadata) {
|
|
2578
|
-
const ch = new $ZodCheck$1({ check: "meta" });
|
|
2579
|
-
ch._zod.onattach = [(inst) => {
|
|
2580
|
-
const existing = globalRegistry$1.get(inst) ?? {};
|
|
2581
|
-
globalRegistry$1.add(inst, {
|
|
2582
|
-
...existing,
|
|
2583
|
-
...metadata
|
|
2584
|
-
});
|
|
2585
|
-
}];
|
|
2586
|
-
ch._zod.check = () => {};
|
|
2587
|
-
return ch;
|
|
2588
|
-
}
|
|
2589
|
-
|
|
2590
2562
|
//#endregion
|
|
2591
2563
|
//#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.js
|
|
2592
2564
|
function initializeContext$1(params) {
|
|
@@ -2611,7 +2583,7 @@ function process$3(schema, ctx, _params = {
|
|
|
2611
2583
|
path: [],
|
|
2612
2584
|
schemaPath: []
|
|
2613
2585
|
}) {
|
|
2614
|
-
var _a
|
|
2586
|
+
var _a;
|
|
2615
2587
|
const def = schema._zod.def;
|
|
2616
2588
|
const seen = ctx.seen.get(schema);
|
|
2617
2589
|
if (seen) {
|
|
@@ -2648,13 +2620,13 @@ function process$3(schema, ctx, _params = {
|
|
|
2648
2620
|
ctx.seen.get(parent).isParent = true;
|
|
2649
2621
|
}
|
|
2650
2622
|
}
|
|
2651
|
-
const meta
|
|
2652
|
-
if (meta
|
|
2623
|
+
const meta = ctx.metadataRegistry.get(schema);
|
|
2624
|
+
if (meta) Object.assign(result.schema, meta);
|
|
2653
2625
|
if (ctx.io === "input" && isTransforming$1(schema)) {
|
|
2654
2626
|
delete result.schema.examples;
|
|
2655
2627
|
delete result.schema.default;
|
|
2656
2628
|
}
|
|
2657
|
-
if (ctx.io === "input" && result.schema._prefault) (_a
|
|
2629
|
+
if (ctx.io === "input" && result.schema._prefault) (_a = result.schema).default ?? (_a.default = result.schema._prefault);
|
|
2658
2630
|
delete result.schema._prefault;
|
|
2659
2631
|
return ctx.seen.get(schema).schema;
|
|
2660
2632
|
}
|
|
@@ -2674,7 +2646,7 @@ function extractDefs$1(ctx, schema) {
|
|
|
2674
2646
|
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
2675
2647
|
if (ctx.external) {
|
|
2676
2648
|
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
2677
|
-
const uriGenerator = ctx.external.uri ?? ((id
|
|
2649
|
+
const uriGenerator = ctx.external.uri ?? ((id) => id);
|
|
2678
2650
|
if (externalId) return { ref: uriGenerator(externalId) };
|
|
2679
2651
|
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
2680
2652
|
entry[1].defId = id;
|
|
@@ -2697,9 +2669,9 @@ function extractDefs$1(ctx, schema) {
|
|
|
2697
2669
|
const { ref, defId } = makeURI(entry);
|
|
2698
2670
|
seen.def = { ...seen.schema };
|
|
2699
2671
|
if (defId) seen.defId = defId;
|
|
2700
|
-
const schema
|
|
2701
|
-
for (const key in schema
|
|
2702
|
-
schema
|
|
2672
|
+
const schema = seen.schema;
|
|
2673
|
+
for (const key in schema) delete schema[key];
|
|
2674
|
+
schema.$ref = ref;
|
|
2703
2675
|
};
|
|
2704
2676
|
if (ctx.cycles === "throw") for (const entry of ctx.seen.entries()) {
|
|
2705
2677
|
const seen = entry[1];
|
|
@@ -2742,8 +2714,8 @@ function finalize$1(ctx, schema) {
|
|
|
2742
2714
|
const flattenRef = (zodSchema) => {
|
|
2743
2715
|
const seen = ctx.seen.get(zodSchema);
|
|
2744
2716
|
if (seen.ref === null) return;
|
|
2745
|
-
const schema
|
|
2746
|
-
const _cached = { ...schema
|
|
2717
|
+
const schema = seen.def ?? seen.schema;
|
|
2718
|
+
const _cached = { ...schema };
|
|
2747
2719
|
const ref = seen.ref;
|
|
2748
2720
|
seen.ref = null;
|
|
2749
2721
|
if (ref) {
|
|
@@ -2751,17 +2723,17 @@ function finalize$1(ctx, schema) {
|
|
|
2751
2723
|
const refSeen = ctx.seen.get(ref);
|
|
2752
2724
|
const refSchema = refSeen.schema;
|
|
2753
2725
|
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
2754
|
-
schema
|
|
2755
|
-
schema
|
|
2756
|
-
} else Object.assign(schema
|
|
2757
|
-
Object.assign(schema
|
|
2758
|
-
if (zodSchema._zod.parent === ref) for (const key in schema
|
|
2726
|
+
schema.allOf = schema.allOf ?? [];
|
|
2727
|
+
schema.allOf.push(refSchema);
|
|
2728
|
+
} else Object.assign(schema, refSchema);
|
|
2729
|
+
Object.assign(schema, _cached);
|
|
2730
|
+
if (zodSchema._zod.parent === ref) for (const key in schema) {
|
|
2759
2731
|
if (key === "$ref" || key === "allOf") continue;
|
|
2760
|
-
if (!(key in _cached)) delete schema
|
|
2732
|
+
if (!(key in _cached)) delete schema[key];
|
|
2761
2733
|
}
|
|
2762
|
-
if (refSchema.$ref && refSeen.def) for (const key in schema
|
|
2734
|
+
if (refSchema.$ref && refSeen.def) for (const key in schema) {
|
|
2763
2735
|
if (key === "$ref" || key === "allOf") continue;
|
|
2764
|
-
if (key in refSeen.def && JSON.stringify(schema
|
|
2736
|
+
if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) delete schema[key];
|
|
2765
2737
|
}
|
|
2766
2738
|
}
|
|
2767
2739
|
const parent = zodSchema._zod.parent;
|
|
@@ -2769,16 +2741,16 @@ function finalize$1(ctx, schema) {
|
|
|
2769
2741
|
flattenRef(parent);
|
|
2770
2742
|
const parentSeen = ctx.seen.get(parent);
|
|
2771
2743
|
if (parentSeen?.schema.$ref) {
|
|
2772
|
-
schema
|
|
2773
|
-
if (parentSeen.def) for (const key in schema
|
|
2744
|
+
schema.$ref = parentSeen.schema.$ref;
|
|
2745
|
+
if (parentSeen.def) for (const key in schema) {
|
|
2774
2746
|
if (key === "$ref" || key === "allOf") continue;
|
|
2775
|
-
if (key in parentSeen.def && JSON.stringify(schema
|
|
2747
|
+
if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) delete schema[key];
|
|
2776
2748
|
}
|
|
2777
2749
|
}
|
|
2778
2750
|
}
|
|
2779
2751
|
ctx.override({
|
|
2780
2752
|
zodSchema,
|
|
2781
|
-
jsonSchema: schema
|
|
2753
|
+
jsonSchema: schema,
|
|
2782
2754
|
path: seen.path ?? []
|
|
2783
2755
|
});
|
|
2784
2756
|
};
|
|
@@ -2872,7 +2844,6 @@ const createStandardJSONSchemaMethod$1 = (schema, io, processors = {}) => (param
|
|
|
2872
2844
|
extractDefs$1(ctx, schema);
|
|
2873
2845
|
return finalize$1(ctx, schema);
|
|
2874
2846
|
};
|
|
2875
|
-
|
|
2876
2847
|
//#endregion
|
|
2877
2848
|
//#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/json-schema-processors.js
|
|
2878
2849
|
const formatMap$1 = {
|
|
@@ -2928,6 +2899,9 @@ const numberProcessor$1 = (schema, ctx, _json, _params) => {
|
|
|
2928
2899
|
}
|
|
2929
2900
|
if (typeof multipleOf === "number") json.multipleOf = multipleOf;
|
|
2930
2901
|
};
|
|
2902
|
+
const booleanProcessor$1 = (_schema, _ctx, json, _params) => {
|
|
2903
|
+
json.type = "boolean";
|
|
2904
|
+
};
|
|
2931
2905
|
const neverProcessor$1 = (_schema, _ctx, json, _params) => {
|
|
2932
2906
|
json.not = {};
|
|
2933
2907
|
};
|
|
@@ -3083,7 +3057,6 @@ const optionalProcessor$1 = (schema, ctx, _json, params) => {
|
|
|
3083
3057
|
const seen = ctx.seen.get(schema);
|
|
3084
3058
|
seen.ref = def.innerType;
|
|
3085
3059
|
};
|
|
3086
|
-
|
|
3087
3060
|
//#endregion
|
|
3088
3061
|
//#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/iso.js
|
|
3089
3062
|
const ZodISODateTime$1 = /* @__PURE__ */ $constructor$1("ZodISODateTime", (inst, def) => {
|
|
@@ -3091,30 +3064,29 @@ const ZodISODateTime$1 = /* @__PURE__ */ $constructor$1("ZodISODateTime", (inst,
|
|
|
3091
3064
|
ZodStringFormat$1.init(inst, def);
|
|
3092
3065
|
});
|
|
3093
3066
|
function datetime$2(params) {
|
|
3094
|
-
return _isoDateTime$1(ZodISODateTime$1, params);
|
|
3067
|
+
return /* @__PURE__ */ _isoDateTime$1(ZodISODateTime$1, params);
|
|
3095
3068
|
}
|
|
3096
3069
|
const ZodISODate$1 = /* @__PURE__ */ $constructor$1("ZodISODate", (inst, def) => {
|
|
3097
3070
|
$ZodISODate$1.init(inst, def);
|
|
3098
3071
|
ZodStringFormat$1.init(inst, def);
|
|
3099
3072
|
});
|
|
3100
3073
|
function date$2(params) {
|
|
3101
|
-
return _isoDate$1(ZodISODate$1, params);
|
|
3074
|
+
return /* @__PURE__ */ _isoDate$1(ZodISODate$1, params);
|
|
3102
3075
|
}
|
|
3103
3076
|
const ZodISOTime$1 = /* @__PURE__ */ $constructor$1("ZodISOTime", (inst, def) => {
|
|
3104
3077
|
$ZodISOTime$1.init(inst, def);
|
|
3105
3078
|
ZodStringFormat$1.init(inst, def);
|
|
3106
3079
|
});
|
|
3107
3080
|
function time$2(params) {
|
|
3108
|
-
return _isoTime$1(ZodISOTime$1, params);
|
|
3081
|
+
return /* @__PURE__ */ _isoTime$1(ZodISOTime$1, params);
|
|
3109
3082
|
}
|
|
3110
3083
|
const ZodISODuration$1 = /* @__PURE__ */ $constructor$1("ZodISODuration", (inst, def) => {
|
|
3111
3084
|
$ZodISODuration$1.init(inst, def);
|
|
3112
3085
|
ZodStringFormat$1.init(inst, def);
|
|
3113
3086
|
});
|
|
3114
3087
|
function duration$2(params) {
|
|
3115
|
-
return _isoDuration$1(ZodISODuration$1, params);
|
|
3088
|
+
return /* @__PURE__ */ _isoDuration$1(ZodISODuration$1, params);
|
|
3116
3089
|
}
|
|
3117
|
-
|
|
3118
3090
|
//#endregion
|
|
3119
3091
|
//#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/errors.js
|
|
3120
3092
|
const initializer$2 = (inst, issues) => {
|
|
@@ -3123,12 +3095,12 @@ const initializer$2 = (inst, issues) => {
|
|
|
3123
3095
|
Object.defineProperties(inst, {
|
|
3124
3096
|
format: { value: (mapper) => formatError$1(inst, mapper) },
|
|
3125
3097
|
flatten: { value: (mapper) => flattenError$1(inst, mapper) },
|
|
3126
|
-
addIssue: { value: (issue
|
|
3127
|
-
inst.issues.push(issue
|
|
3098
|
+
addIssue: { value: (issue) => {
|
|
3099
|
+
inst.issues.push(issue);
|
|
3128
3100
|
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer$1, 2);
|
|
3129
3101
|
} },
|
|
3130
|
-
addIssues: { value: (issues
|
|
3131
|
-
inst.issues.push(...issues
|
|
3102
|
+
addIssues: { value: (issues) => {
|
|
3103
|
+
inst.issues.push(...issues);
|
|
3132
3104
|
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer$1, 2);
|
|
3133
3105
|
} },
|
|
3134
3106
|
isEmpty: { get() {
|
|
@@ -3136,9 +3108,8 @@ const initializer$2 = (inst, issues) => {
|
|
|
3136
3108
|
} }
|
|
3137
3109
|
});
|
|
3138
3110
|
};
|
|
3139
|
-
|
|
3111
|
+
$constructor$1("ZodError", initializer$2);
|
|
3140
3112
|
const ZodRealError$1 = $constructor$1("ZodError", initializer$2, { Parent: Error });
|
|
3141
|
-
|
|
3142
3113
|
//#endregion
|
|
3143
3114
|
//#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/parse.js
|
|
3144
3115
|
const parse$1 = /* @__PURE__ */ _parse$1(ZodRealError$1);
|
|
@@ -3153,7 +3124,6 @@ const safeEncode$1 = /* @__PURE__ */ _safeEncode$1(ZodRealError$1);
|
|
|
3153
3124
|
const safeDecode$1 = /* @__PURE__ */ _safeDecode$1(ZodRealError$1);
|
|
3154
3125
|
const safeEncodeAsync$1 = /* @__PURE__ */ _safeEncodeAsync$1(ZodRealError$1);
|
|
3155
3126
|
const safeDecodeAsync$1 = /* @__PURE__ */ _safeDecodeAsync$1(ZodRealError$1);
|
|
3156
|
-
|
|
3157
3127
|
//#endregion
|
|
3158
3128
|
//#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/schemas.js
|
|
3159
3129
|
const ZodType$1 = /* @__PURE__ */ $constructor$1("ZodType", (inst, def) => {
|
|
@@ -3174,10 +3144,10 @@ const ZodType$1 = /* @__PURE__ */ $constructor$1("ZodType", (inst, def) => {
|
|
|
3174
3144
|
} } : ch)] }), { parent: true });
|
|
3175
3145
|
};
|
|
3176
3146
|
inst.with = inst.check;
|
|
3177
|
-
inst.clone = (def
|
|
3147
|
+
inst.clone = (def, params) => clone$1(inst, def, params);
|
|
3178
3148
|
inst.brand = () => inst;
|
|
3179
|
-
inst.register = ((reg, meta
|
|
3180
|
-
reg.add(inst, meta
|
|
3149
|
+
inst.register = ((reg, meta) => {
|
|
3150
|
+
reg.add(inst, meta);
|
|
3181
3151
|
return inst;
|
|
3182
3152
|
});
|
|
3183
3153
|
inst.parse = (data, params) => parse$1(inst, data, params, { callee: inst.parse });
|
|
@@ -3195,7 +3165,7 @@ const ZodType$1 = /* @__PURE__ */ $constructor$1("ZodType", (inst, def) => {
|
|
|
3195
3165
|
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync$1(inst, data, params);
|
|
3196
3166
|
inst.refine = (check, params) => inst.check(refine$1(check, params));
|
|
3197
3167
|
inst.superRefine = (refinement) => inst.check(superRefine$1(refinement));
|
|
3198
|
-
inst.overwrite = (fn) => inst.check(_overwrite$1(fn));
|
|
3168
|
+
inst.overwrite = (fn) => inst.check(/* @__PURE__ */ _overwrite$1(fn));
|
|
3199
3169
|
inst.optional = () => optional$1(inst);
|
|
3200
3170
|
inst.exactOptional = () => exactOptional$1(inst);
|
|
3201
3171
|
inst.nullable = () => nullable$1(inst);
|
|
@@ -3205,8 +3175,8 @@ const ZodType$1 = /* @__PURE__ */ $constructor$1("ZodType", (inst, def) => {
|
|
|
3205
3175
|
inst.or = (arg) => union$1([inst, arg]);
|
|
3206
3176
|
inst.and = (arg) => intersection$1(inst, arg);
|
|
3207
3177
|
inst.transform = (tx) => pipe$1(inst, transform$1(tx));
|
|
3208
|
-
inst.default = (def
|
|
3209
|
-
inst.prefault = (def
|
|
3178
|
+
inst.default = (def) => _default$1(inst, def);
|
|
3179
|
+
inst.prefault = (def) => prefault$1(inst, def);
|
|
3210
3180
|
inst.catch = (params) => _catch$1(inst, params);
|
|
3211
3181
|
inst.pipe = (target) => pipe$1(inst, target);
|
|
3212
3182
|
inst.readonly = () => readonly$1(inst);
|
|
@@ -3241,55 +3211,55 @@ const _ZodString$1 = /* @__PURE__ */ $constructor$1("_ZodString", (inst, def) =>
|
|
|
3241
3211
|
inst.format = bag.format ?? null;
|
|
3242
3212
|
inst.minLength = bag.minimum ?? null;
|
|
3243
3213
|
inst.maxLength = bag.maximum ?? null;
|
|
3244
|
-
inst.regex = (...args) => inst.check(_regex$1(...args));
|
|
3245
|
-
inst.includes = (...args) => inst.check(_includes$1(...args));
|
|
3246
|
-
inst.startsWith = (...args) => inst.check(_startsWith$1(...args));
|
|
3247
|
-
inst.endsWith = (...args) => inst.check(_endsWith$1(...args));
|
|
3248
|
-
inst.min = (...args) => inst.check(_minLength$1(...args));
|
|
3249
|
-
inst.max = (...args) => inst.check(_maxLength$1(...args));
|
|
3250
|
-
inst.length = (...args) => inst.check(_length$1(...args));
|
|
3251
|
-
inst.nonempty = (...args) => inst.check(_minLength$1(1, ...args));
|
|
3252
|
-
inst.lowercase = (params) => inst.check(_lowercase$1(params));
|
|
3253
|
-
inst.uppercase = (params) => inst.check(_uppercase$1(params));
|
|
3254
|
-
inst.trim = () => inst.check(_trim$1());
|
|
3255
|
-
inst.normalize = (...args) => inst.check(_normalize$1(...args));
|
|
3256
|
-
inst.toLowerCase = () => inst.check(_toLowerCase$1());
|
|
3257
|
-
inst.toUpperCase = () => inst.check(_toUpperCase$1());
|
|
3258
|
-
inst.slugify = () => inst.check(_slugify$1());
|
|
3214
|
+
inst.regex = (...args) => inst.check(/* @__PURE__ */ _regex$1(...args));
|
|
3215
|
+
inst.includes = (...args) => inst.check(/* @__PURE__ */ _includes$1(...args));
|
|
3216
|
+
inst.startsWith = (...args) => inst.check(/* @__PURE__ */ _startsWith$1(...args));
|
|
3217
|
+
inst.endsWith = (...args) => inst.check(/* @__PURE__ */ _endsWith$1(...args));
|
|
3218
|
+
inst.min = (...args) => inst.check(/* @__PURE__ */ _minLength$1(...args));
|
|
3219
|
+
inst.max = (...args) => inst.check(/* @__PURE__ */ _maxLength$1(...args));
|
|
3220
|
+
inst.length = (...args) => inst.check(/* @__PURE__ */ _length$1(...args));
|
|
3221
|
+
inst.nonempty = (...args) => inst.check(/* @__PURE__ */ _minLength$1(1, ...args));
|
|
3222
|
+
inst.lowercase = (params) => inst.check(/* @__PURE__ */ _lowercase$1(params));
|
|
3223
|
+
inst.uppercase = (params) => inst.check(/* @__PURE__ */ _uppercase$1(params));
|
|
3224
|
+
inst.trim = () => inst.check(/* @__PURE__ */ _trim$1());
|
|
3225
|
+
inst.normalize = (...args) => inst.check(/* @__PURE__ */ _normalize$1(...args));
|
|
3226
|
+
inst.toLowerCase = () => inst.check(/* @__PURE__ */ _toLowerCase$1());
|
|
3227
|
+
inst.toUpperCase = () => inst.check(/* @__PURE__ */ _toUpperCase$1());
|
|
3228
|
+
inst.slugify = () => inst.check(/* @__PURE__ */ _slugify$1());
|
|
3259
3229
|
});
|
|
3260
3230
|
const ZodString$1 = /* @__PURE__ */ $constructor$1("ZodString", (inst, def) => {
|
|
3261
3231
|
$ZodString$1.init(inst, def);
|
|
3262
3232
|
_ZodString$1.init(inst, def);
|
|
3263
|
-
inst.email = (params) => inst.check(_email$1(ZodEmail$1, params));
|
|
3264
|
-
inst.url = (params) => inst.check(_url$1(ZodURL$1, params));
|
|
3265
|
-
inst.jwt = (params) => inst.check(_jwt$1(ZodJWT$1, params));
|
|
3266
|
-
inst.emoji = (params) => inst.check(_emoji$2(ZodEmoji$1, params));
|
|
3267
|
-
inst.guid = (params) => inst.check(_guid$1(ZodGUID$1, params));
|
|
3268
|
-
inst.uuid = (params) => inst.check(_uuid$1(ZodUUID$1, params));
|
|
3269
|
-
inst.uuidv4 = (params) => inst.check(_uuidv4$1(ZodUUID$1, params));
|
|
3270
|
-
inst.uuidv6 = (params) => inst.check(_uuidv6$1(ZodUUID$1, params));
|
|
3271
|
-
inst.uuidv7 = (params) => inst.check(_uuidv7$1(ZodUUID$1, params));
|
|
3272
|
-
inst.nanoid = (params) => inst.check(_nanoid$1(ZodNanoID$1, params));
|
|
3273
|
-
inst.guid = (params) => inst.check(_guid$1(ZodGUID$1, params));
|
|
3274
|
-
inst.cuid = (params) => inst.check(_cuid$1(ZodCUID$1, params));
|
|
3275
|
-
inst.cuid2 = (params) => inst.check(_cuid2$1(ZodCUID2$1, params));
|
|
3276
|
-
inst.ulid = (params) => inst.check(_ulid$1(ZodULID$1, params));
|
|
3277
|
-
inst.base64 = (params) => inst.check(_base64$1(ZodBase64$1, params));
|
|
3278
|
-
inst.base64url = (params) => inst.check(_base64url$1(ZodBase64URL$1, params));
|
|
3279
|
-
inst.xid = (params) => inst.check(_xid$1(ZodXID$1, params));
|
|
3280
|
-
inst.ksuid = (params) => inst.check(_ksuid$1(ZodKSUID$1, params));
|
|
3281
|
-
inst.ipv4 = (params) => inst.check(_ipv4$1(ZodIPv4$1, params));
|
|
3282
|
-
inst.ipv6 = (params) => inst.check(_ipv6$1(ZodIPv6$1, params));
|
|
3283
|
-
inst.cidrv4 = (params) => inst.check(_cidrv4$1(ZodCIDRv4$1, params));
|
|
3284
|
-
inst.cidrv6 = (params) => inst.check(_cidrv6$1(ZodCIDRv6$1, params));
|
|
3285
|
-
inst.e164 = (params) => inst.check(_e164$1(ZodE164$1, params));
|
|
3233
|
+
inst.email = (params) => inst.check(/* @__PURE__ */ _email$1(ZodEmail$1, params));
|
|
3234
|
+
inst.url = (params) => inst.check(/* @__PURE__ */ _url$1(ZodURL$1, params));
|
|
3235
|
+
inst.jwt = (params) => inst.check(/* @__PURE__ */ _jwt$1(ZodJWT$1, params));
|
|
3236
|
+
inst.emoji = (params) => inst.check(/* @__PURE__ */ _emoji$2(ZodEmoji$1, params));
|
|
3237
|
+
inst.guid = (params) => inst.check(/* @__PURE__ */ _guid$1(ZodGUID$1, params));
|
|
3238
|
+
inst.uuid = (params) => inst.check(/* @__PURE__ */ _uuid$1(ZodUUID$1, params));
|
|
3239
|
+
inst.uuidv4 = (params) => inst.check(/* @__PURE__ */ _uuidv4$1(ZodUUID$1, params));
|
|
3240
|
+
inst.uuidv6 = (params) => inst.check(/* @__PURE__ */ _uuidv6$1(ZodUUID$1, params));
|
|
3241
|
+
inst.uuidv7 = (params) => inst.check(/* @__PURE__ */ _uuidv7$1(ZodUUID$1, params));
|
|
3242
|
+
inst.nanoid = (params) => inst.check(/* @__PURE__ */ _nanoid$1(ZodNanoID$1, params));
|
|
3243
|
+
inst.guid = (params) => inst.check(/* @__PURE__ */ _guid$1(ZodGUID$1, params));
|
|
3244
|
+
inst.cuid = (params) => inst.check(/* @__PURE__ */ _cuid$1(ZodCUID$1, params));
|
|
3245
|
+
inst.cuid2 = (params) => inst.check(/* @__PURE__ */ _cuid2$1(ZodCUID2$1, params));
|
|
3246
|
+
inst.ulid = (params) => inst.check(/* @__PURE__ */ _ulid$1(ZodULID$1, params));
|
|
3247
|
+
inst.base64 = (params) => inst.check(/* @__PURE__ */ _base64$1(ZodBase64$1, params));
|
|
3248
|
+
inst.base64url = (params) => inst.check(/* @__PURE__ */ _base64url$1(ZodBase64URL$1, params));
|
|
3249
|
+
inst.xid = (params) => inst.check(/* @__PURE__ */ _xid$1(ZodXID$1, params));
|
|
3250
|
+
inst.ksuid = (params) => inst.check(/* @__PURE__ */ _ksuid$1(ZodKSUID$1, params));
|
|
3251
|
+
inst.ipv4 = (params) => inst.check(/* @__PURE__ */ _ipv4$1(ZodIPv4$1, params));
|
|
3252
|
+
inst.ipv6 = (params) => inst.check(/* @__PURE__ */ _ipv6$1(ZodIPv6$1, params));
|
|
3253
|
+
inst.cidrv4 = (params) => inst.check(/* @__PURE__ */ _cidrv4$1(ZodCIDRv4$1, params));
|
|
3254
|
+
inst.cidrv6 = (params) => inst.check(/* @__PURE__ */ _cidrv6$1(ZodCIDRv6$1, params));
|
|
3255
|
+
inst.e164 = (params) => inst.check(/* @__PURE__ */ _e164$1(ZodE164$1, params));
|
|
3286
3256
|
inst.datetime = (params) => inst.check(datetime$2(params));
|
|
3287
3257
|
inst.date = (params) => inst.check(date$2(params));
|
|
3288
3258
|
inst.time = (params) => inst.check(time$2(params));
|
|
3289
3259
|
inst.duration = (params) => inst.check(duration$2(params));
|
|
3290
3260
|
});
|
|
3291
3261
|
function string$2(params) {
|
|
3292
|
-
return _string$1(ZodString$1, params);
|
|
3262
|
+
return /* @__PURE__ */ _string$1(ZodString$1, params);
|
|
3293
3263
|
}
|
|
3294
3264
|
const ZodStringFormat$1 = /* @__PURE__ */ $constructor$1("ZodStringFormat", (inst, def) => {
|
|
3295
3265
|
$ZodStringFormat$1.init(inst, def);
|
|
@@ -3375,20 +3345,20 @@ const ZodNumber$1 = /* @__PURE__ */ $constructor$1("ZodNumber", (inst, def) => {
|
|
|
3375
3345
|
$ZodNumber$1.init(inst, def);
|
|
3376
3346
|
ZodType$1.init(inst, def);
|
|
3377
3347
|
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor$1(inst, ctx, json, params);
|
|
3378
|
-
inst.gt = (value, params) => inst.check(_gt$1(value, params));
|
|
3379
|
-
inst.gte = (value, params) => inst.check(_gte$1(value, params));
|
|
3380
|
-
inst.min = (value, params) => inst.check(_gte$1(value, params));
|
|
3381
|
-
inst.lt = (value, params) => inst.check(_lt$1(value, params));
|
|
3382
|
-
inst.lte = (value, params) => inst.check(_lte$1(value, params));
|
|
3383
|
-
inst.max = (value, params) => inst.check(_lte$1(value, params));
|
|
3348
|
+
inst.gt = (value, params) => inst.check(/* @__PURE__ */ _gt$1(value, params));
|
|
3349
|
+
inst.gte = (value, params) => inst.check(/* @__PURE__ */ _gte$1(value, params));
|
|
3350
|
+
inst.min = (value, params) => inst.check(/* @__PURE__ */ _gte$1(value, params));
|
|
3351
|
+
inst.lt = (value, params) => inst.check(/* @__PURE__ */ _lt$1(value, params));
|
|
3352
|
+
inst.lte = (value, params) => inst.check(/* @__PURE__ */ _lte$1(value, params));
|
|
3353
|
+
inst.max = (value, params) => inst.check(/* @__PURE__ */ _lte$1(value, params));
|
|
3384
3354
|
inst.int = (params) => inst.check(int$1(params));
|
|
3385
3355
|
inst.safe = (params) => inst.check(int$1(params));
|
|
3386
|
-
inst.positive = (params) => inst.check(_gt$1(0, params));
|
|
3387
|
-
inst.nonnegative = (params) => inst.check(_gte$1(0, params));
|
|
3388
|
-
inst.negative = (params) => inst.check(_lt$1(0, params));
|
|
3389
|
-
inst.nonpositive = (params) => inst.check(_lte$1(0, params));
|
|
3390
|
-
inst.multipleOf = (value, params) => inst.check(_multipleOf$1(value, params));
|
|
3391
|
-
inst.step = (value, params) => inst.check(_multipleOf$1(value, params));
|
|
3356
|
+
inst.positive = (params) => inst.check(/* @__PURE__ */ _gt$1(0, params));
|
|
3357
|
+
inst.nonnegative = (params) => inst.check(/* @__PURE__ */ _gte$1(0, params));
|
|
3358
|
+
inst.negative = (params) => inst.check(/* @__PURE__ */ _lt$1(0, params));
|
|
3359
|
+
inst.nonpositive = (params) => inst.check(/* @__PURE__ */ _lte$1(0, params));
|
|
3360
|
+
inst.multipleOf = (value, params) => inst.check(/* @__PURE__ */ _multipleOf$1(value, params));
|
|
3361
|
+
inst.step = (value, params) => inst.check(/* @__PURE__ */ _multipleOf$1(value, params));
|
|
3392
3362
|
inst.finite = () => inst;
|
|
3393
3363
|
const bag = inst._zod.bag;
|
|
3394
3364
|
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
@@ -3398,14 +3368,22 @@ const ZodNumber$1 = /* @__PURE__ */ $constructor$1("ZodNumber", (inst, def) => {
|
|
|
3398
3368
|
inst.format = bag.format ?? null;
|
|
3399
3369
|
});
|
|
3400
3370
|
function number$2(params) {
|
|
3401
|
-
return _number$1(ZodNumber$1, params);
|
|
3371
|
+
return /* @__PURE__ */ _number$1(ZodNumber$1, params);
|
|
3402
3372
|
}
|
|
3403
3373
|
const ZodNumberFormat$1 = /* @__PURE__ */ $constructor$1("ZodNumberFormat", (inst, def) => {
|
|
3404
3374
|
$ZodNumberFormat$1.init(inst, def);
|
|
3405
3375
|
ZodNumber$1.init(inst, def);
|
|
3406
3376
|
});
|
|
3407
3377
|
function int$1(params) {
|
|
3408
|
-
return _int$1(ZodNumberFormat$1, params);
|
|
3378
|
+
return /* @__PURE__ */ _int$1(ZodNumberFormat$1, params);
|
|
3379
|
+
}
|
|
3380
|
+
const ZodBoolean$1 = /* @__PURE__ */ $constructor$1("ZodBoolean", (inst, def) => {
|
|
3381
|
+
$ZodBoolean$1.init(inst, def);
|
|
3382
|
+
ZodType$1.init(inst, def);
|
|
3383
|
+
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor$1(inst, ctx, json, params);
|
|
3384
|
+
});
|
|
3385
|
+
function boolean$2(params) {
|
|
3386
|
+
return /* @__PURE__ */ _boolean$1(ZodBoolean$1, params);
|
|
3409
3387
|
}
|
|
3410
3388
|
const ZodUnknown$1 = /* @__PURE__ */ $constructor$1("ZodUnknown", (inst, def) => {
|
|
3411
3389
|
$ZodUnknown$1.init(inst, def);
|
|
@@ -3413,7 +3391,7 @@ const ZodUnknown$1 = /* @__PURE__ */ $constructor$1("ZodUnknown", (inst, def) =>
|
|
|
3413
3391
|
inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor$1(inst, ctx, json, params);
|
|
3414
3392
|
});
|
|
3415
3393
|
function unknown$1() {
|
|
3416
|
-
return _unknown$1(ZodUnknown$1);
|
|
3394
|
+
return /* @__PURE__ */ _unknown$1(ZodUnknown$1);
|
|
3417
3395
|
}
|
|
3418
3396
|
const ZodNever$1 = /* @__PURE__ */ $constructor$1("ZodNever", (inst, def) => {
|
|
3419
3397
|
$ZodNever$1.init(inst, def);
|
|
@@ -3421,21 +3399,21 @@ const ZodNever$1 = /* @__PURE__ */ $constructor$1("ZodNever", (inst, def) => {
|
|
|
3421
3399
|
inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor$1(inst, ctx, json, params);
|
|
3422
3400
|
});
|
|
3423
3401
|
function never$1(params) {
|
|
3424
|
-
return _never$1(ZodNever$1, params);
|
|
3402
|
+
return /* @__PURE__ */ _never$1(ZodNever$1, params);
|
|
3425
3403
|
}
|
|
3426
3404
|
const ZodArray$1 = /* @__PURE__ */ $constructor$1("ZodArray", (inst, def) => {
|
|
3427
3405
|
$ZodArray$1.init(inst, def);
|
|
3428
3406
|
ZodType$1.init(inst, def);
|
|
3429
3407
|
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor$1(inst, ctx, json, params);
|
|
3430
3408
|
inst.element = def.element;
|
|
3431
|
-
inst.min = (minLength, params) => inst.check(_minLength$1(minLength, params));
|
|
3432
|
-
inst.nonempty = (params) => inst.check(_minLength$1(1, params));
|
|
3433
|
-
inst.max = (maxLength, params) => inst.check(_maxLength$1(maxLength, params));
|
|
3434
|
-
inst.length = (len, params) => inst.check(_length$1(len, params));
|
|
3409
|
+
inst.min = (minLength, params) => inst.check(/* @__PURE__ */ _minLength$1(minLength, params));
|
|
3410
|
+
inst.nonempty = (params) => inst.check(/* @__PURE__ */ _minLength$1(1, params));
|
|
3411
|
+
inst.max = (maxLength, params) => inst.check(/* @__PURE__ */ _maxLength$1(maxLength, params));
|
|
3412
|
+
inst.length = (len, params) => inst.check(/* @__PURE__ */ _length$1(len, params));
|
|
3435
3413
|
inst.unwrap = () => inst.element;
|
|
3436
3414
|
});
|
|
3437
3415
|
function array$1(element, params) {
|
|
3438
|
-
return _array$1(ZodArray$1, element, params);
|
|
3416
|
+
return /* @__PURE__ */ _array$1(ZodArray$1, element, params);
|
|
3439
3417
|
}
|
|
3440
3418
|
const ZodObject$1 = /* @__PURE__ */ $constructor$1("ZodObject", (inst, def) => {
|
|
3441
3419
|
$ZodObjectJIT$1.init(inst, def);
|
|
@@ -3552,10 +3530,10 @@ const ZodTransform$1 = /* @__PURE__ */ $constructor$1("ZodTransform", (inst, def
|
|
|
3552
3530
|
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor$1(inst, ctx, json, params);
|
|
3553
3531
|
inst._zod.parse = (payload, _ctx) => {
|
|
3554
3532
|
if (_ctx.direction === "backward") throw new $ZodEncodeError$1(inst.constructor.name);
|
|
3555
|
-
payload.addIssue = (issue
|
|
3556
|
-
if (typeof issue
|
|
3533
|
+
payload.addIssue = (issue) => {
|
|
3534
|
+
if (typeof issue === "string") payload.issues.push(issue$1(issue, payload.value, def));
|
|
3557
3535
|
else {
|
|
3558
|
-
const _issue = issue
|
|
3536
|
+
const _issue = issue;
|
|
3559
3537
|
if (_issue.fatal) _issue.continue = false;
|
|
3560
3538
|
_issue.code ?? (_issue.code = "custom");
|
|
3561
3539
|
_issue.input ?? (_issue.input = payload.value);
|
|
@@ -3564,8 +3542,8 @@ const ZodTransform$1 = /* @__PURE__ */ $constructor$1("ZodTransform", (inst, def
|
|
|
3564
3542
|
}
|
|
3565
3543
|
};
|
|
3566
3544
|
const output = def.transform(payload.value, payload);
|
|
3567
|
-
if (output instanceof Promise) return output.then((output
|
|
3568
|
-
payload.value = output
|
|
3545
|
+
if (output instanceof Promise) return output.then((output) => {
|
|
3546
|
+
payload.value = output;
|
|
3569
3547
|
return payload;
|
|
3570
3548
|
});
|
|
3571
3549
|
payload.value = output;
|
|
@@ -3704,14 +3682,11 @@ const ZodCustom$1 = /* @__PURE__ */ $constructor$1("ZodCustom", (inst, def) => {
|
|
|
3704
3682
|
inst._zod.processJSONSchema = (ctx, json, params) => customProcessor$1(inst, ctx, json, params);
|
|
3705
3683
|
});
|
|
3706
3684
|
function refine$1(fn, _params = {}) {
|
|
3707
|
-
return _refine$1(ZodCustom$1, fn, _params);
|
|
3685
|
+
return /* @__PURE__ */ _refine$1(ZodCustom$1, fn, _params);
|
|
3708
3686
|
}
|
|
3709
3687
|
function superRefine$1(fn) {
|
|
3710
|
-
return _superRefine$1(fn);
|
|
3688
|
+
return /* @__PURE__ */ _superRefine$1(fn);
|
|
3711
3689
|
}
|
|
3712
|
-
const describe = describe$1;
|
|
3713
|
-
const meta = meta$1;
|
|
3714
|
-
|
|
3715
3690
|
//#endregion
|
|
3716
3691
|
//#region ../feature-schema/dist/schema.mjs
|
|
3717
3692
|
/** Matches any domain prefix: feat-2026-001, proc-2026-001, goal-2026-001, etc. */
|
|
@@ -3761,6 +3736,17 @@ const CodeSnippetSchema$1 = object$1({
|
|
|
3761
3736
|
label: string$2().min(1),
|
|
3762
3737
|
snippet: string$2().min(1)
|
|
3763
3738
|
});
|
|
3739
|
+
/**
|
|
3740
|
+
* Per-field lock entry — written into a feature.json to explicitly protect a specific field
|
|
3741
|
+
* from AI overwrite in this feature, even if not in the workspace-level restrictedFields config.
|
|
3742
|
+
* Use this when a field was hard-won and should never be touched without a human review.
|
|
3743
|
+
*/
|
|
3744
|
+
const FieldLockSchema$1 = object$1({
|
|
3745
|
+
field: string$2().min(1),
|
|
3746
|
+
lockedAt: string$2().min(1),
|
|
3747
|
+
lockedBy: string$2().min(1),
|
|
3748
|
+
reason: string$2().optional()
|
|
3749
|
+
});
|
|
3764
3750
|
const FeatureSchema$1 = object$1({
|
|
3765
3751
|
featureKey: string$2().regex(FEATURE_KEY_PATTERN$1, "featureKey must match pattern <domain>-YYYY-NNN (e.g. feat-2026-001, proc-2026-001)"),
|
|
3766
3752
|
title: string$2().min(1),
|
|
@@ -3790,9 +3776,11 @@ const FeatureSchema$1 = object$1({
|
|
|
3790
3776
|
publicInterface: array$1(PublicInterfaceEntrySchema$1).optional(),
|
|
3791
3777
|
externalDependencies: array$1(string$2()).optional(),
|
|
3792
3778
|
lastVerifiedDate: string$2().regex(/^\d{4}-\d{2}-\d{2}$/, "lastVerifiedDate must be YYYY-MM-DD").optional(),
|
|
3793
|
-
codeSnippets: array$1(CodeSnippetSchema$1).optional()
|
|
3779
|
+
codeSnippets: array$1(CodeSnippetSchema$1).optional(),
|
|
3780
|
+
implementationNotes: array$1(string$2()).optional(),
|
|
3781
|
+
fieldLocks: array$1(FieldLockSchema$1).optional(),
|
|
3782
|
+
featureLocked: boolean$2().optional()
|
|
3794
3783
|
});
|
|
3795
|
-
|
|
3796
3784
|
//#endregion
|
|
3797
3785
|
//#region ../feature-schema/dist/validate.mjs
|
|
3798
3786
|
function validateFeature(data) {
|
|
@@ -3803,12 +3791,13 @@ function validateFeature(data) {
|
|
|
3803
3791
|
};
|
|
3804
3792
|
return {
|
|
3805
3793
|
success: false,
|
|
3806
|
-
errors: result.error.issues.map((issue
|
|
3807
|
-
|
|
3794
|
+
errors: result.error.issues.map((issue) => {
|
|
3795
|
+
const path = issue.path.length > 0 ? `${issue.path.join(".")}: ` : "";
|
|
3796
|
+
if (issue.code === "invalid_type") return `${path}expected ${issue.expected}, got ${issue.received}`;
|
|
3797
|
+
return `${path}${issue.message}`;
|
|
3808
3798
|
})
|
|
3809
3799
|
};
|
|
3810
3800
|
}
|
|
3811
|
-
|
|
3812
3801
|
//#endregion
|
|
3813
3802
|
//#region ../feature-schema/dist/keygen.mjs
|
|
3814
3803
|
const LAC_DIR = ".lac";
|
|
@@ -3937,7 +3926,6 @@ function registerFeatureKey(fromDir, key) {
|
|
|
3937
3926
|
fs.renameSync(counterTmp, counterPath);
|
|
3938
3927
|
fs.renameSync(keysTmp, keysPath);
|
|
3939
3928
|
}
|
|
3940
|
-
|
|
3941
3929
|
//#endregion
|
|
3942
3930
|
//#region ../lac-mcp/src/tools/analysis.ts
|
|
3943
3931
|
function scanFeatures$1(dir) {
|
|
@@ -3979,8 +3967,8 @@ const RISK_KEYWORDS = [
|
|
|
3979
3967
|
"short-term",
|
|
3980
3968
|
"quick fix"
|
|
3981
3969
|
];
|
|
3982
|
-
function handleAuditDecisions(a, workspaceRoot
|
|
3983
|
-
const features = scanFeatures$1(a.path ? resolve(String(a.path), workspaceRoot
|
|
3970
|
+
function handleAuditDecisions(a, workspaceRoot) {
|
|
3971
|
+
const features = scanFeatures$1(a.path ? resolve(String(a.path), workspaceRoot) : workspaceRoot);
|
|
3984
3972
|
const missingDecisions = [];
|
|
3985
3973
|
const flaggedDecisions = [];
|
|
3986
3974
|
const unaddressedReopens = [];
|
|
@@ -4004,7 +3992,7 @@ function handleAuditDecisions(a, workspaceRoot$1) {
|
|
|
4004
3992
|
hasIssue = true;
|
|
4005
3993
|
}
|
|
4006
3994
|
}
|
|
4007
|
-
const staleAnnotation = feature.annotations?.find((a
|
|
3995
|
+
const staleAnnotation = feature.annotations?.find((a) => a.type === "stale-review");
|
|
4008
3996
|
if (staleAnnotation) {
|
|
4009
3997
|
unaddressedReopens.push(` ${feature.featureKey.padEnd(20)} ${feature.status.padEnd(10)} — ${staleAnnotation.body}`);
|
|
4010
3998
|
hasIssue = true;
|
|
@@ -4039,7 +4027,7 @@ function handleAuditDecisions(a, workspaceRoot$1) {
|
|
|
4039
4027
|
text: sections.join("\n\n")
|
|
4040
4028
|
}] };
|
|
4041
4029
|
}
|
|
4042
|
-
function handleFeatureSimilarity(a, workspaceRoot
|
|
4030
|
+
function handleFeatureSimilarity(a, workspaceRoot) {
|
|
4043
4031
|
if (!a.path) return {
|
|
4044
4032
|
content: [{
|
|
4045
4033
|
type: "text",
|
|
@@ -4047,7 +4035,7 @@ function handleFeatureSimilarity(a, workspaceRoot$1) {
|
|
|
4047
4035
|
}],
|
|
4048
4036
|
isError: true
|
|
4049
4037
|
};
|
|
4050
|
-
const featureDir = resolve(String(a.path), workspaceRoot
|
|
4038
|
+
const featureDir = resolve(String(a.path), workspaceRoot);
|
|
4051
4039
|
const featurePath = path.join(featureDir, "feature.json");
|
|
4052
4040
|
let raw;
|
|
4053
4041
|
try {
|
|
@@ -4072,7 +4060,7 @@ function handleFeatureSimilarity(a, workspaceRoot$1) {
|
|
|
4072
4060
|
const target = result.data;
|
|
4073
4061
|
const targetTags = new Set(target.tags ?? []);
|
|
4074
4062
|
const targetWords = new Set((target.title + " " + target.problem).toLowerCase().split(/\W+/).filter((w) => w.length > 4));
|
|
4075
|
-
const allFeatures = scanFeatures$1(workspaceRoot
|
|
4063
|
+
const allFeatures = scanFeatures$1(workspaceRoot);
|
|
4076
4064
|
const matches = [];
|
|
4077
4065
|
for (const { feature } of allFeatures) {
|
|
4078
4066
|
if (feature.featureKey === target.featureKey) continue;
|
|
@@ -4100,7 +4088,7 @@ function handleFeatureSimilarity(a, workspaceRoot$1) {
|
|
|
4100
4088
|
reasons
|
|
4101
4089
|
});
|
|
4102
4090
|
}
|
|
4103
|
-
matches.sort((a
|
|
4091
|
+
matches.sort((a, b) => b.score - a.score);
|
|
4104
4092
|
if (matches.length === 0) return { content: [{
|
|
4105
4093
|
type: "text",
|
|
4106
4094
|
text: `No similar features found for "${target.featureKey} — ${target.title}".`
|
|
@@ -4111,10 +4099,9 @@ function handleFeatureSimilarity(a, workspaceRoot$1) {
|
|
|
4111
4099
|
text: [`Similar features to "${target.featureKey} — ${target.title}":\n`, ...matches.slice(0, 10).map((m) => `${stars(m.score)} ${m.feature.featureKey.padEnd(20)} "${m.feature.title}"\n ${m.reasons.join(" · ")}`)].join("\n")
|
|
4112
4100
|
}] };
|
|
4113
4101
|
}
|
|
4114
|
-
|
|
4115
4102
|
//#endregion
|
|
4116
4103
|
//#region ../lac-mcp/src/tools/git-tools.ts
|
|
4117
|
-
function handleTimeTravel(a, workspaceRoot
|
|
4104
|
+
function handleTimeTravel(a, workspaceRoot) {
|
|
4118
4105
|
if (!a.path) return {
|
|
4119
4106
|
content: [{
|
|
4120
4107
|
type: "text",
|
|
@@ -4122,7 +4109,7 @@ function handleTimeTravel(a, workspaceRoot$1) {
|
|
|
4122
4109
|
}],
|
|
4123
4110
|
isError: true
|
|
4124
4111
|
};
|
|
4125
|
-
const featureDir = path.isAbsolute(String(a.path)) ? String(a.path) : path.resolve(workspaceRoot
|
|
4112
|
+
const featureDir = path.isAbsolute(String(a.path)) ? String(a.path) : path.resolve(workspaceRoot, String(a.path));
|
|
4126
4113
|
const featurePath = path.join(featureDir, "feature.json");
|
|
4127
4114
|
let gitRoot;
|
|
4128
4115
|
try {
|
|
@@ -4224,7 +4211,6 @@ function handleTimeTravel(a, workspaceRoot$1) {
|
|
|
4224
4211
|
text: `feature.json at: ${commitInfo}${newerCommits.length > 0 ? `\n\n[${newerCommits.length} commit(s) made after this snapshot]` : ""}\n\n${displayContent}`
|
|
4225
4212
|
}] };
|
|
4226
4213
|
}
|
|
4227
|
-
|
|
4228
4214
|
//#endregion
|
|
4229
4215
|
//#region ../lac-mcp/src/tools/impact.ts
|
|
4230
4216
|
const SOURCE_EXTENSIONS$1 = new Set([
|
|
@@ -4294,7 +4280,7 @@ function findOwningFeatureKey(filePath) {
|
|
|
4294
4280
|
current = parent;
|
|
4295
4281
|
}
|
|
4296
4282
|
}
|
|
4297
|
-
function handleCrossFeatureImpact(a, workspaceRoot
|
|
4283
|
+
function handleCrossFeatureImpact(a, workspaceRoot) {
|
|
4298
4284
|
if (!a.file) return {
|
|
4299
4285
|
content: [{
|
|
4300
4286
|
type: "text",
|
|
@@ -4302,7 +4288,7 @@ function handleCrossFeatureImpact(a, workspaceRoot$1) {
|
|
|
4302
4288
|
}],
|
|
4303
4289
|
isError: true
|
|
4304
4290
|
};
|
|
4305
|
-
const targetFile = path.isAbsolute(String(a.file)) ? String(a.file) : path.resolve(workspaceRoot
|
|
4291
|
+
const targetFile = path.isAbsolute(String(a.file)) ? String(a.file) : path.resolve(workspaceRoot, String(a.file));
|
|
4306
4292
|
if (!fs.existsSync(targetFile)) return {
|
|
4307
4293
|
content: [{
|
|
4308
4294
|
type: "text",
|
|
@@ -4312,14 +4298,14 @@ function handleCrossFeatureImpact(a, workspaceRoot$1) {
|
|
|
4312
4298
|
};
|
|
4313
4299
|
const targetBasename = path.basename(targetFile);
|
|
4314
4300
|
const targetNoExt = path.basename(targetFile, path.extname(targetFile));
|
|
4315
|
-
const targetRelFromRoot = path.relative(workspaceRoot
|
|
4301
|
+
const targetRelFromRoot = path.relative(workspaceRoot, targetFile).replace(/\\/g, "/");
|
|
4316
4302
|
const patterns = [...new Set([
|
|
4317
4303
|
targetBasename,
|
|
4318
4304
|
targetNoExt,
|
|
4319
4305
|
targetRelFromRoot
|
|
4320
4306
|
])];
|
|
4321
4307
|
const owningKey = findOwningFeatureKey(targetFile);
|
|
4322
|
-
const features = scanFeatures(workspaceRoot
|
|
4308
|
+
const features = scanFeatures(workspaceRoot);
|
|
4323
4309
|
const impacts = [];
|
|
4324
4310
|
for (const { feature, filePath: featureJsonPath } of features) {
|
|
4325
4311
|
if (feature.featureKey === owningKey) continue;
|
|
@@ -4345,7 +4331,7 @@ function handleCrossFeatureImpact(a, workspaceRoot$1) {
|
|
|
4345
4331
|
});
|
|
4346
4332
|
}
|
|
4347
4333
|
const lines = [
|
|
4348
|
-
`Impact analysis: ${path.relative(workspaceRoot
|
|
4334
|
+
`Impact analysis: ${path.relative(workspaceRoot, targetFile)}`,
|
|
4349
4335
|
"─".repeat(50),
|
|
4350
4336
|
owningKey ? `Owned by : ${owningKey}` : "No owning feature found (untracked file)"
|
|
4351
4337
|
];
|
|
@@ -4365,11 +4351,10 @@ function handleCrossFeatureImpact(a, workspaceRoot$1) {
|
|
|
4365
4351
|
text: lines.join("\n")
|
|
4366
4352
|
}] };
|
|
4367
4353
|
}
|
|
4368
|
-
|
|
4369
4354
|
//#endregion
|
|
4370
4355
|
//#region ../lac-claude/dist/index.mjs
|
|
4371
4356
|
Object.freeze({ status: "aborted" });
|
|
4372
|
-
function $constructor(name, initializer
|
|
4357
|
+
function $constructor(name, initializer, params) {
|
|
4373
4358
|
function init(inst, def) {
|
|
4374
4359
|
if (!inst._zod) Object.defineProperty(inst, "_zod", {
|
|
4375
4360
|
value: {
|
|
@@ -4381,7 +4366,7 @@ function $constructor(name, initializer$2$1, params) {
|
|
|
4381
4366
|
});
|
|
4382
4367
|
if (inst._zod.traits.has(name)) return;
|
|
4383
4368
|
inst._zod.traits.add(name);
|
|
4384
|
-
initializer
|
|
4369
|
+
initializer(inst, def);
|
|
4385
4370
|
const proto = _.prototype;
|
|
4386
4371
|
const keys = Object.keys(proto);
|
|
4387
4372
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -4393,10 +4378,10 @@ function $constructor(name, initializer$2$1, params) {
|
|
|
4393
4378
|
class Definition extends Parent {}
|
|
4394
4379
|
Object.defineProperty(Definition, "name", { value: name });
|
|
4395
4380
|
function _(def) {
|
|
4396
|
-
var _a
|
|
4381
|
+
var _a;
|
|
4397
4382
|
const inst = params?.Parent ? new Definition() : this;
|
|
4398
4383
|
init(inst, def);
|
|
4399
|
-
(_a
|
|
4384
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
4400
4385
|
for (const fn of inst._zod.deferred) fn();
|
|
4401
4386
|
return inst;
|
|
4402
4387
|
}
|
|
@@ -4462,9 +4447,9 @@ function floatSafeRemainder(val, step) {
|
|
|
4462
4447
|
return Number.parseInt(val.toFixed(decCount).replace(".", "")) % Number.parseInt(step.toFixed(decCount).replace(".", "")) / 10 ** decCount;
|
|
4463
4448
|
}
|
|
4464
4449
|
const EVALUATING = Symbol("evaluating");
|
|
4465
|
-
function defineLazy(object
|
|
4450
|
+
function defineLazy(object, key, getter) {
|
|
4466
4451
|
let value = void 0;
|
|
4467
|
-
Object.defineProperty(object
|
|
4452
|
+
Object.defineProperty(object, key, {
|
|
4468
4453
|
get() {
|
|
4469
4454
|
if (value === EVALUATING) return;
|
|
4470
4455
|
if (value === void 0) {
|
|
@@ -4474,7 +4459,7 @@ function defineLazy(object$1$1, key, getter) {
|
|
|
4474
4459
|
return value;
|
|
4475
4460
|
},
|
|
4476
4461
|
set(v) {
|
|
4477
|
-
Object.defineProperty(object
|
|
4462
|
+
Object.defineProperty(object, key, { value: v });
|
|
4478
4463
|
},
|
|
4479
4464
|
configurable: true
|
|
4480
4465
|
});
|
|
@@ -4489,10 +4474,7 @@ function assignProp(target, prop, value) {
|
|
|
4489
4474
|
}
|
|
4490
4475
|
function mergeDefs(...defs) {
|
|
4491
4476
|
const mergedDescriptors = {};
|
|
4492
|
-
for (const def of defs)
|
|
4493
|
-
const descriptors = Object.getOwnPropertyDescriptors(def);
|
|
4494
|
-
Object.assign(mergedDescriptors, descriptors);
|
|
4495
|
-
}
|
|
4477
|
+
for (const def of defs) Object.assign(mergedDescriptors, Object.getOwnPropertyDescriptors(def));
|
|
4496
4478
|
return Object.defineProperties({}, mergedDescriptors);
|
|
4497
4479
|
}
|
|
4498
4480
|
function esc(str) {
|
|
@@ -4698,23 +4680,23 @@ function aborted(x, startIndex = 0) {
|
|
|
4698
4680
|
for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
|
|
4699
4681
|
return false;
|
|
4700
4682
|
}
|
|
4701
|
-
function prefixIssues(path
|
|
4683
|
+
function prefixIssues(path, issues) {
|
|
4702
4684
|
return issues.map((iss) => {
|
|
4703
|
-
var _a
|
|
4704
|
-
(_a
|
|
4705
|
-
iss.path.unshift(path
|
|
4685
|
+
var _a;
|
|
4686
|
+
(_a = iss).path ?? (_a.path = []);
|
|
4687
|
+
iss.path.unshift(path);
|
|
4706
4688
|
return iss;
|
|
4707
4689
|
});
|
|
4708
4690
|
}
|
|
4709
4691
|
function unwrapMessage(message) {
|
|
4710
4692
|
return typeof message === "string" ? message : message?.message;
|
|
4711
4693
|
}
|
|
4712
|
-
function finalizeIssue(iss, ctx, config
|
|
4694
|
+
function finalizeIssue(iss, ctx, config) {
|
|
4713
4695
|
const full = {
|
|
4714
4696
|
...iss,
|
|
4715
4697
|
path: iss.path ?? []
|
|
4716
4698
|
};
|
|
4717
|
-
if (!iss.message) full.message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config
|
|
4699
|
+
if (!iss.message) full.message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
|
|
4718
4700
|
delete full.inst;
|
|
4719
4701
|
delete full.continue;
|
|
4720
4702
|
if (!ctx?.reportInput) delete full.input;
|
|
@@ -4753,7 +4735,7 @@ const initializer$1 = (inst, def) => {
|
|
|
4753
4735
|
};
|
|
4754
4736
|
const $ZodError = $constructor("$ZodError", initializer$1);
|
|
4755
4737
|
const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
|
|
4756
|
-
function flattenError(error, mapper = (issue
|
|
4738
|
+
function flattenError(error, mapper = (issue) => issue.message) {
|
|
4757
4739
|
const fieldErrors = {};
|
|
4758
4740
|
const formErrors = [];
|
|
4759
4741
|
for (const sub of error.issues) if (sub.path.length > 0) {
|
|
@@ -4765,22 +4747,22 @@ function flattenError(error, mapper = (issue$1$1) => issue$1$1.message) {
|
|
|
4765
4747
|
fieldErrors
|
|
4766
4748
|
};
|
|
4767
4749
|
}
|
|
4768
|
-
function formatError(error, mapper = (issue
|
|
4750
|
+
function formatError(error, mapper = (issue) => issue.message) {
|
|
4769
4751
|
const fieldErrors = { _errors: [] };
|
|
4770
|
-
const processError = (error
|
|
4771
|
-
for (const issue
|
|
4772
|
-
else if (issue
|
|
4773
|
-
else if (issue
|
|
4774
|
-
else if (issue
|
|
4752
|
+
const processError = (error) => {
|
|
4753
|
+
for (const issue of error.issues) if (issue.code === "invalid_union" && issue.errors.length) issue.errors.map((issues) => processError({ issues }));
|
|
4754
|
+
else if (issue.code === "invalid_key") processError({ issues: issue.issues });
|
|
4755
|
+
else if (issue.code === "invalid_element") processError({ issues: issue.issues });
|
|
4756
|
+
else if (issue.path.length === 0) fieldErrors._errors.push(mapper(issue));
|
|
4775
4757
|
else {
|
|
4776
4758
|
let curr = fieldErrors;
|
|
4777
4759
|
let i = 0;
|
|
4778
|
-
while (i < issue
|
|
4779
|
-
const el = issue
|
|
4780
|
-
if (!(i === issue
|
|
4760
|
+
while (i < issue.path.length) {
|
|
4761
|
+
const el = issue.path[i];
|
|
4762
|
+
if (!(i === issue.path.length - 1)) curr[el] = curr[el] || { _errors: [] };
|
|
4781
4763
|
else {
|
|
4782
4764
|
curr[el] = curr[el] || { _errors: [] };
|
|
4783
|
-
curr[el]._errors.push(mapper(issue
|
|
4765
|
+
curr[el]._errors.push(mapper(issue));
|
|
4784
4766
|
}
|
|
4785
4767
|
curr = curr[el];
|
|
4786
4768
|
i++;
|
|
@@ -4894,9 +4876,9 @@ const guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9
|
|
|
4894
4876
|
/** Returns a regex for validating an RFC 9562/4122 UUID.
|
|
4895
4877
|
*
|
|
4896
4878
|
* @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
|
|
4897
|
-
const uuid = (version
|
|
4898
|
-
if (!version
|
|
4899
|
-
return
|
|
4879
|
+
const uuid = (version) => {
|
|
4880
|
+
if (!version) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
|
|
4881
|
+
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
|
4900
4882
|
};
|
|
4901
4883
|
/** Practical email validation */
|
|
4902
4884
|
const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
@@ -4918,29 +4900,30 @@ function timeSource(args) {
|
|
|
4918
4900
|
return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
4919
4901
|
}
|
|
4920
4902
|
function time$1(args) {
|
|
4921
|
-
return
|
|
4903
|
+
return new RegExp(`^${timeSource(args)}$`);
|
|
4922
4904
|
}
|
|
4923
4905
|
function datetime$1(args) {
|
|
4924
|
-
const time
|
|
4906
|
+
const time = timeSource({ precision: args.precision });
|
|
4925
4907
|
const opts = ["Z"];
|
|
4926
4908
|
if (args.local) opts.push("");
|
|
4927
4909
|
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
4928
|
-
const timeRegex = `${time
|
|
4929
|
-
return
|
|
4910
|
+
const timeRegex = `${time}(?:${opts.join("|")})`;
|
|
4911
|
+
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
4930
4912
|
}
|
|
4931
4913
|
const string$1 = (params) => {
|
|
4932
4914
|
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
4933
|
-
return
|
|
4915
|
+
return new RegExp(`^${regex}$`);
|
|
4934
4916
|
};
|
|
4935
4917
|
const integer = /^-?\d+$/;
|
|
4936
4918
|
const number$1 = /^-?\d+(?:\.\d+)?$/;
|
|
4919
|
+
const boolean$1 = /^(?:true|false)$/i;
|
|
4937
4920
|
const lowercase = /^[^A-Z]*$/;
|
|
4938
4921
|
const uppercase = /^[^a-z]*$/;
|
|
4939
4922
|
const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
4940
|
-
var _a
|
|
4923
|
+
var _a;
|
|
4941
4924
|
inst._zod ?? (inst._zod = {});
|
|
4942
4925
|
inst._zod.def = def;
|
|
4943
|
-
(_a
|
|
4926
|
+
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
|
4944
4927
|
});
|
|
4945
4928
|
const numericOriginMap = {
|
|
4946
4929
|
number: "number",
|
|
@@ -4950,8 +4933,8 @@ const numericOriginMap = {
|
|
|
4950
4933
|
const $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {
|
|
4951
4934
|
$ZodCheck.init(inst, def);
|
|
4952
4935
|
const origin = numericOriginMap[typeof def.value];
|
|
4953
|
-
inst._zod.onattach.push((inst
|
|
4954
|
-
const bag = inst
|
|
4936
|
+
inst._zod.onattach.push((inst) => {
|
|
4937
|
+
const bag = inst._zod.bag;
|
|
4955
4938
|
const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
4956
4939
|
if (def.value < curr) if (def.inclusive) bag.maximum = def.value;
|
|
4957
4940
|
else bag.exclusiveMaximum = def.value;
|
|
@@ -4972,8 +4955,8 @@ const $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (ins
|
|
|
4972
4955
|
const $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
|
|
4973
4956
|
$ZodCheck.init(inst, def);
|
|
4974
4957
|
const origin = numericOriginMap[typeof def.value];
|
|
4975
|
-
inst._zod.onattach.push((inst
|
|
4976
|
-
const bag = inst
|
|
4958
|
+
inst._zod.onattach.push((inst) => {
|
|
4959
|
+
const bag = inst._zod.bag;
|
|
4977
4960
|
const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
4978
4961
|
if (def.value > curr) if (def.inclusive) bag.minimum = def.value;
|
|
4979
4962
|
else bag.exclusiveMinimum = def.value;
|
|
@@ -4993,9 +4976,9 @@ const $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan"
|
|
|
4993
4976
|
});
|
|
4994
4977
|
const $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
4995
4978
|
$ZodCheck.init(inst, def);
|
|
4996
|
-
inst._zod.onattach.push((inst
|
|
4997
|
-
var _a
|
|
4998
|
-
(_a
|
|
4979
|
+
inst._zod.onattach.push((inst) => {
|
|
4980
|
+
var _a;
|
|
4981
|
+
(_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
|
|
4999
4982
|
});
|
|
5000
4983
|
inst._zod.check = (payload) => {
|
|
5001
4984
|
if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
@@ -5016,8 +4999,8 @@ const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberForma
|
|
|
5016
4999
|
const isInt = def.format?.includes("int");
|
|
5017
5000
|
const origin = isInt ? "int" : "number";
|
|
5018
5001
|
const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
|
|
5019
|
-
inst._zod.onattach.push((inst
|
|
5020
|
-
const bag = inst
|
|
5002
|
+
inst._zod.onattach.push((inst) => {
|
|
5003
|
+
const bag = inst._zod.bag;
|
|
5021
5004
|
bag.format = def.format;
|
|
5022
5005
|
bag.minimum = minimum;
|
|
5023
5006
|
bag.maximum = maximum;
|
|
@@ -5082,15 +5065,15 @@ const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberForma
|
|
|
5082
5065
|
};
|
|
5083
5066
|
});
|
|
5084
5067
|
const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
5085
|
-
var _a
|
|
5068
|
+
var _a;
|
|
5086
5069
|
$ZodCheck.init(inst, def);
|
|
5087
|
-
(_a
|
|
5070
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
5088
5071
|
const val = payload.value;
|
|
5089
5072
|
return !nullish(val) && val.length !== void 0;
|
|
5090
5073
|
});
|
|
5091
|
-
inst._zod.onattach.push((inst
|
|
5092
|
-
const curr = inst
|
|
5093
|
-
if (def.maximum < curr) inst
|
|
5074
|
+
inst._zod.onattach.push((inst) => {
|
|
5075
|
+
const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
5076
|
+
if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
|
|
5094
5077
|
});
|
|
5095
5078
|
inst._zod.check = (payload) => {
|
|
5096
5079
|
const input = payload.value;
|
|
@@ -5108,15 +5091,15 @@ const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (i
|
|
|
5108
5091
|
};
|
|
5109
5092
|
});
|
|
5110
5093
|
const $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
5111
|
-
var _a
|
|
5094
|
+
var _a;
|
|
5112
5095
|
$ZodCheck.init(inst, def);
|
|
5113
|
-
(_a
|
|
5096
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
5114
5097
|
const val = payload.value;
|
|
5115
5098
|
return !nullish(val) && val.length !== void 0;
|
|
5116
5099
|
});
|
|
5117
|
-
inst._zod.onattach.push((inst
|
|
5118
|
-
const curr = inst
|
|
5119
|
-
if (def.minimum > curr) inst
|
|
5100
|
+
inst._zod.onattach.push((inst) => {
|
|
5101
|
+
const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
5102
|
+
if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
|
|
5120
5103
|
});
|
|
5121
5104
|
inst._zod.check = (payload) => {
|
|
5122
5105
|
const input = payload.value;
|
|
@@ -5134,14 +5117,14 @@ const $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (i
|
|
|
5134
5117
|
};
|
|
5135
5118
|
});
|
|
5136
5119
|
const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
5137
|
-
var _a
|
|
5120
|
+
var _a;
|
|
5138
5121
|
$ZodCheck.init(inst, def);
|
|
5139
|
-
(_a
|
|
5122
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
5140
5123
|
const val = payload.value;
|
|
5141
5124
|
return !nullish(val) && val.length !== void 0;
|
|
5142
5125
|
});
|
|
5143
|
-
inst._zod.onattach.push((inst
|
|
5144
|
-
const bag = inst
|
|
5126
|
+
inst._zod.onattach.push((inst) => {
|
|
5127
|
+
const bag = inst._zod.bag;
|
|
5145
5128
|
bag.minimum = def.length;
|
|
5146
5129
|
bag.maximum = def.length;
|
|
5147
5130
|
bag.length = def.length;
|
|
@@ -5170,17 +5153,17 @@ const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEqual
|
|
|
5170
5153
|
};
|
|
5171
5154
|
});
|
|
5172
5155
|
const $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
5173
|
-
var _a
|
|
5156
|
+
var _a, _b;
|
|
5174
5157
|
$ZodCheck.init(inst, def);
|
|
5175
|
-
inst._zod.onattach.push((inst
|
|
5176
|
-
const bag = inst
|
|
5158
|
+
inst._zod.onattach.push((inst) => {
|
|
5159
|
+
const bag = inst._zod.bag;
|
|
5177
5160
|
bag.format = def.format;
|
|
5178
5161
|
if (def.pattern) {
|
|
5179
5162
|
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
5180
5163
|
bag.patterns.add(def.pattern);
|
|
5181
5164
|
}
|
|
5182
5165
|
});
|
|
5183
|
-
if (def.pattern) (_a
|
|
5166
|
+
if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => {
|
|
5184
5167
|
def.pattern.lastIndex = 0;
|
|
5185
5168
|
if (def.pattern.test(payload.value)) return;
|
|
5186
5169
|
payload.issues.push({
|
|
@@ -5224,8 +5207,8 @@ const $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (ins
|
|
|
5224
5207
|
const escapedRegex = escapeRegex(def.includes);
|
|
5225
5208
|
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
5226
5209
|
def.pattern = pattern;
|
|
5227
|
-
inst._zod.onattach.push((inst
|
|
5228
|
-
const bag = inst
|
|
5210
|
+
inst._zod.onattach.push((inst) => {
|
|
5211
|
+
const bag = inst._zod.bag;
|
|
5229
5212
|
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
5230
5213
|
bag.patterns.add(pattern);
|
|
5231
5214
|
});
|
|
@@ -5244,10 +5227,10 @@ const $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (ins
|
|
|
5244
5227
|
});
|
|
5245
5228
|
const $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {
|
|
5246
5229
|
$ZodCheck.init(inst, def);
|
|
5247
|
-
const pattern =
|
|
5230
|
+
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
5248
5231
|
def.pattern ?? (def.pattern = pattern);
|
|
5249
|
-
inst._zod.onattach.push((inst
|
|
5250
|
-
const bag = inst
|
|
5232
|
+
inst._zod.onattach.push((inst) => {
|
|
5233
|
+
const bag = inst._zod.bag;
|
|
5251
5234
|
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
5252
5235
|
bag.patterns.add(pattern);
|
|
5253
5236
|
});
|
|
@@ -5266,10 +5249,10 @@ const $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith",
|
|
|
5266
5249
|
});
|
|
5267
5250
|
const $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => {
|
|
5268
5251
|
$ZodCheck.init(inst, def);
|
|
5269
|
-
const pattern =
|
|
5252
|
+
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
|
|
5270
5253
|
def.pattern ?? (def.pattern = pattern);
|
|
5271
|
-
inst._zod.onattach.push((inst
|
|
5272
|
-
const bag = inst
|
|
5254
|
+
inst._zod.onattach.push((inst) => {
|
|
5255
|
+
const bag = inst._zod.bag;
|
|
5273
5256
|
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
5274
5257
|
bag.patterns.add(pattern);
|
|
5275
5258
|
});
|
|
@@ -5327,7 +5310,7 @@ const version = {
|
|
|
5327
5310
|
patch: 6
|
|
5328
5311
|
};
|
|
5329
5312
|
const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
5330
|
-
var _a
|
|
5313
|
+
var _a;
|
|
5331
5314
|
inst ?? (inst = {});
|
|
5332
5315
|
inst._zod.def = def;
|
|
5333
5316
|
inst._zod.bag = inst._zod.bag || {};
|
|
@@ -5336,15 +5319,15 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
5336
5319
|
if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
|
|
5337
5320
|
for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
|
|
5338
5321
|
if (checks.length === 0) {
|
|
5339
|
-
(_a
|
|
5322
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
5340
5323
|
inst._zod.deferred?.push(() => {
|
|
5341
5324
|
inst._zod.run = inst._zod.parse;
|
|
5342
5325
|
});
|
|
5343
5326
|
} else {
|
|
5344
|
-
const runChecks = (payload, checks
|
|
5327
|
+
const runChecks = (payload, checks, ctx) => {
|
|
5345
5328
|
let isAborted = aborted(payload);
|
|
5346
5329
|
let asyncResult;
|
|
5347
|
-
for (const ch of checks
|
|
5330
|
+
for (const ch of checks) {
|
|
5348
5331
|
if (ch._zod.def.when) {
|
|
5349
5332
|
if (!ch._zod.def.when(payload)) continue;
|
|
5350
5333
|
} else if (isAborted) continue;
|
|
@@ -5374,7 +5357,7 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
5374
5357
|
const checkResult = runChecks(payload, checks, ctx);
|
|
5375
5358
|
if (checkResult instanceof Promise) {
|
|
5376
5359
|
if (ctx.async === false) throw new $ZodAsyncError();
|
|
5377
|
-
return checkResult.then((checkResult
|
|
5360
|
+
return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
|
|
5378
5361
|
}
|
|
5379
5362
|
return inst._zod.parse(checkResult, ctx);
|
|
5380
5363
|
};
|
|
@@ -5388,15 +5371,15 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
5388
5371
|
...ctx,
|
|
5389
5372
|
skipChecks: true
|
|
5390
5373
|
});
|
|
5391
|
-
if (canary instanceof Promise) return canary.then((canary
|
|
5392
|
-
return handleCanaryResult(canary
|
|
5374
|
+
if (canary instanceof Promise) return canary.then((canary) => {
|
|
5375
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
5393
5376
|
});
|
|
5394
5377
|
return handleCanaryResult(canary, payload, ctx);
|
|
5395
5378
|
}
|
|
5396
5379
|
const result = inst._zod.parse(payload, ctx);
|
|
5397
5380
|
if (result instanceof Promise) {
|
|
5398
5381
|
if (ctx.async === false) throw new $ZodAsyncError();
|
|
5399
|
-
return result.then((result
|
|
5382
|
+
return result.then((result) => runChecks(result, checks, ctx));
|
|
5400
5383
|
}
|
|
5401
5384
|
return runChecks(result, checks, ctx);
|
|
5402
5385
|
};
|
|
@@ -5420,7 +5403,7 @@ const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
|
5420
5403
|
inst._zod.parse = (payload, _) => {
|
|
5421
5404
|
if (def.coerce) try {
|
|
5422
5405
|
payload.value = String(payload.value);
|
|
5423
|
-
} catch (_
|
|
5406
|
+
} catch (_) {}
|
|
5424
5407
|
if (typeof payload.value === "string") return payload;
|
|
5425
5408
|
payload.issues.push({
|
|
5426
5409
|
expected: "string",
|
|
@@ -5626,8 +5609,8 @@ const $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
|
5626
5609
|
});
|
|
5627
5610
|
function isValidBase64URL(data) {
|
|
5628
5611
|
if (!base64url.test(data)) return false;
|
|
5629
|
-
const base64
|
|
5630
|
-
return isValidBase64(base64
|
|
5612
|
+
const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
5613
|
+
return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "="));
|
|
5631
5614
|
}
|
|
5632
5615
|
const $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
5633
5616
|
def.pattern ?? (def.pattern = base64url);
|
|
@@ -5700,6 +5683,24 @@ const $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst,
|
|
|
5700
5683
|
$ZodCheckNumberFormat.init(inst, def);
|
|
5701
5684
|
$ZodNumber.init(inst, def);
|
|
5702
5685
|
});
|
|
5686
|
+
const $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
5687
|
+
$ZodType.init(inst, def);
|
|
5688
|
+
inst._zod.pattern = boolean$1;
|
|
5689
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
5690
|
+
if (def.coerce) try {
|
|
5691
|
+
payload.value = Boolean(payload.value);
|
|
5692
|
+
} catch (_) {}
|
|
5693
|
+
const input = payload.value;
|
|
5694
|
+
if (typeof input === "boolean") return payload;
|
|
5695
|
+
payload.issues.push({
|
|
5696
|
+
expected: "boolean",
|
|
5697
|
+
code: "invalid_type",
|
|
5698
|
+
input,
|
|
5699
|
+
inst
|
|
5700
|
+
});
|
|
5701
|
+
return payload;
|
|
5702
|
+
};
|
|
5703
|
+
});
|
|
5703
5704
|
const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
|
|
5704
5705
|
$ZodType.init(inst, def);
|
|
5705
5706
|
inst._zod.parse = (payload) => payload;
|
|
@@ -5741,7 +5742,7 @@ const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
5741
5742
|
value: item,
|
|
5742
5743
|
issues: []
|
|
5743
5744
|
}, ctx);
|
|
5744
|
-
if (result instanceof Promise) proms.push(result.then((result
|
|
5745
|
+
if (result instanceof Promise) proms.push(result.then((result) => handleArrayResult(result, payload, i)));
|
|
5745
5746
|
else handleArrayResult(result, payload, i);
|
|
5746
5747
|
}
|
|
5747
5748
|
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
@@ -5785,7 +5786,7 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
5785
5786
|
value: input[key],
|
|
5786
5787
|
issues: []
|
|
5787
5788
|
}, ctx);
|
|
5788
|
-
if (r instanceof Promise) proms.push(r.then((r
|
|
5789
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
|
|
5789
5790
|
else handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
5790
5791
|
}
|
|
5791
5792
|
if (unrecognized.length) payload.issues.push({
|
|
@@ -5822,13 +5823,13 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
5822
5823
|
}
|
|
5823
5824
|
return propValues;
|
|
5824
5825
|
});
|
|
5825
|
-
const isObject$
|
|
5826
|
+
const isObject$2 = isObject;
|
|
5826
5827
|
const catchall = def.catchall;
|
|
5827
5828
|
let value;
|
|
5828
5829
|
inst._zod.parse = (payload, ctx) => {
|
|
5829
5830
|
value ?? (value = _normalized.value);
|
|
5830
5831
|
const input = payload.value;
|
|
5831
|
-
if (!isObject$
|
|
5832
|
+
if (!isObject$2(input)) {
|
|
5832
5833
|
payload.issues.push({
|
|
5833
5834
|
expected: "object",
|
|
5834
5835
|
code: "invalid_type",
|
|
@@ -5847,7 +5848,7 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
5847
5848
|
value: input[key],
|
|
5848
5849
|
issues: []
|
|
5849
5850
|
}, ctx);
|
|
5850
|
-
if (r instanceof Promise) proms.push(r.then((r
|
|
5851
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
|
|
5851
5852
|
else handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
5852
5853
|
}
|
|
5853
5854
|
if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
@@ -5922,7 +5923,7 @@ const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def)
|
|
|
5922
5923
|
return (payload, ctx) => fn(shape, payload, ctx);
|
|
5923
5924
|
};
|
|
5924
5925
|
let fastpass;
|
|
5925
|
-
const isObject$1
|
|
5926
|
+
const isObject$1 = isObject;
|
|
5926
5927
|
const jit = !globalConfig.jitless;
|
|
5927
5928
|
const fastEnabled = jit && allowsEval.value;
|
|
5928
5929
|
const catchall = def.catchall;
|
|
@@ -5930,7 +5931,7 @@ const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def)
|
|
|
5930
5931
|
inst._zod.parse = (payload, ctx) => {
|
|
5931
5932
|
value ?? (value = _normalized.value);
|
|
5932
5933
|
const input = payload.value;
|
|
5933
|
-
if (!isObject$1
|
|
5934
|
+
if (!isObject$1(input)) {
|
|
5934
5935
|
payload.issues.push({
|
|
5935
5936
|
expected: "object",
|
|
5936
5937
|
code: "invalid_type",
|
|
@@ -5976,7 +5977,7 @@ const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
5976
5977
|
defineLazy(inst._zod, "pattern", () => {
|
|
5977
5978
|
if (def.options.every((o) => o._zod.pattern)) {
|
|
5978
5979
|
const patterns = def.options.map((o) => o._zod.pattern);
|
|
5979
|
-
return
|
|
5980
|
+
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
5980
5981
|
}
|
|
5981
5982
|
});
|
|
5982
5983
|
const single = def.options.length === 1;
|
|
@@ -5999,8 +6000,8 @@ const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
5999
6000
|
}
|
|
6000
6001
|
}
|
|
6001
6002
|
if (!async) return handleUnionResults(results, payload, inst, ctx);
|
|
6002
|
-
return Promise.all(results).then((results
|
|
6003
|
-
return handleUnionResults(results
|
|
6003
|
+
return Promise.all(results).then((results) => {
|
|
6004
|
+
return handleUnionResults(results, payload, inst, ctx);
|
|
6004
6005
|
});
|
|
6005
6006
|
};
|
|
6006
6007
|
});
|
|
@@ -6016,8 +6017,8 @@ const $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst,
|
|
|
6016
6017
|
value: input,
|
|
6017
6018
|
issues: []
|
|
6018
6019
|
}, ctx);
|
|
6019
|
-
if (left instanceof Promise || right instanceof Promise) return Promise.all([left, right]).then(([left
|
|
6020
|
-
return handleIntersectionResults(payload, left
|
|
6020
|
+
if (left instanceof Promise || right instanceof Promise) return Promise.all([left, right]).then(([left, right]) => {
|
|
6021
|
+
return handleIntersectionResults(payload, left, right);
|
|
6021
6022
|
});
|
|
6022
6023
|
return handleIntersectionResults(payload, left, right);
|
|
6023
6024
|
};
|
|
@@ -6108,7 +6109,7 @@ const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
6108
6109
|
const values = getEnumValues(def.entries);
|
|
6109
6110
|
const valuesSet = new Set(values);
|
|
6110
6111
|
inst._zod.values = valuesSet;
|
|
6111
|
-
inst._zod.pattern =
|
|
6112
|
+
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
6112
6113
|
inst._zod.parse = (payload, _ctx) => {
|
|
6113
6114
|
const input = payload.value;
|
|
6114
6115
|
if (valuesSet.has(input)) return payload;
|
|
@@ -6151,7 +6152,7 @@ const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) =>
|
|
|
6151
6152
|
});
|
|
6152
6153
|
defineLazy(inst._zod, "pattern", () => {
|
|
6153
6154
|
const pattern = def.innerType._zod.pattern;
|
|
6154
|
-
return pattern ?
|
|
6155
|
+
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
6155
6156
|
});
|
|
6156
6157
|
inst._zod.parse = (payload, ctx) => {
|
|
6157
6158
|
if (def.innerType._zod.optin === "optional") {
|
|
@@ -6177,7 +6178,7 @@ const $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) =>
|
|
|
6177
6178
|
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
6178
6179
|
defineLazy(inst._zod, "pattern", () => {
|
|
6179
6180
|
const pattern = def.innerType._zod.pattern;
|
|
6180
|
-
return pattern ?
|
|
6181
|
+
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
6181
6182
|
});
|
|
6182
6183
|
defineLazy(inst._zod, "values", () => {
|
|
6183
6184
|
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : void 0;
|
|
@@ -6201,7 +6202,7 @@ const $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
|
|
|
6201
6202
|
return payload;
|
|
6202
6203
|
}
|
|
6203
6204
|
const result = def.innerType._zod.run(payload, ctx);
|
|
6204
|
-
if (result instanceof Promise) return result.then((result
|
|
6205
|
+
if (result instanceof Promise) return result.then((result) => handleDefaultResult(result, def));
|
|
6205
6206
|
return handleDefaultResult(result, def);
|
|
6206
6207
|
};
|
|
6207
6208
|
});
|
|
@@ -6227,7 +6228,7 @@ const $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, d
|
|
|
6227
6228
|
});
|
|
6228
6229
|
inst._zod.parse = (payload, ctx) => {
|
|
6229
6230
|
const result = def.innerType._zod.run(payload, ctx);
|
|
6230
|
-
if (result instanceof Promise) return result.then((result
|
|
6231
|
+
if (result instanceof Promise) return result.then((result) => handleNonOptionalResult(result, inst));
|
|
6231
6232
|
return handleNonOptionalResult(result, inst);
|
|
6232
6233
|
};
|
|
6233
6234
|
});
|
|
@@ -6248,12 +6249,12 @@ const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
|
6248
6249
|
inst._zod.parse = (payload, ctx) => {
|
|
6249
6250
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
6250
6251
|
const result = def.innerType._zod.run(payload, ctx);
|
|
6251
|
-
if (result instanceof Promise) return result.then((result
|
|
6252
|
-
payload.value = result
|
|
6253
|
-
if (result
|
|
6252
|
+
if (result instanceof Promise) return result.then((result) => {
|
|
6253
|
+
payload.value = result.value;
|
|
6254
|
+
if (result.issues.length) {
|
|
6254
6255
|
payload.value = def.catchValue({
|
|
6255
6256
|
...payload,
|
|
6256
|
-
error: { issues: result
|
|
6257
|
+
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
6257
6258
|
input: payload.value
|
|
6258
6259
|
});
|
|
6259
6260
|
payload.issues = [];
|
|
@@ -6281,11 +6282,11 @@ const $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
|
|
|
6281
6282
|
inst._zod.parse = (payload, ctx) => {
|
|
6282
6283
|
if (ctx.direction === "backward") {
|
|
6283
6284
|
const right = def.out._zod.run(payload, ctx);
|
|
6284
|
-
if (right instanceof Promise) return right.then((right
|
|
6285
|
+
if (right instanceof Promise) return right.then((right) => handlePipeResult(right, def.in, ctx));
|
|
6285
6286
|
return handlePipeResult(right, def.in, ctx);
|
|
6286
6287
|
}
|
|
6287
6288
|
const left = def.in._zod.run(payload, ctx);
|
|
6288
|
-
if (left instanceof Promise) return left.then((left
|
|
6289
|
+
if (left instanceof Promise) return left.then((left) => handlePipeResult(left, def.out, ctx));
|
|
6289
6290
|
return handlePipeResult(left, def.out, ctx);
|
|
6290
6291
|
};
|
|
6291
6292
|
});
|
|
@@ -6325,7 +6326,7 @@ const $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
|
6325
6326
|
inst._zod.check = (payload) => {
|
|
6326
6327
|
const input = payload.value;
|
|
6327
6328
|
const r = def.fn(input);
|
|
6328
|
-
if (r instanceof Promise) return r.then((r
|
|
6329
|
+
if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
|
|
6329
6330
|
handleRefineResult(r, payload, input, inst);
|
|
6330
6331
|
};
|
|
6331
6332
|
});
|
|
@@ -6349,9 +6350,9 @@ var $ZodRegistry = class {
|
|
|
6349
6350
|
this._idmap = /* @__PURE__ */ new Map();
|
|
6350
6351
|
}
|
|
6351
6352
|
add(schema, ..._meta) {
|
|
6352
|
-
const meta
|
|
6353
|
-
this._map.set(schema, meta
|
|
6354
|
-
if (meta
|
|
6353
|
+
const meta = _meta[0];
|
|
6354
|
+
this._map.set(schema, meta);
|
|
6355
|
+
if (meta && typeof meta === "object" && "id" in meta) this._idmap.set(meta.id, schema);
|
|
6355
6356
|
return this;
|
|
6356
6357
|
}
|
|
6357
6358
|
clear() {
|
|
@@ -6360,8 +6361,8 @@ var $ZodRegistry = class {
|
|
|
6360
6361
|
return this;
|
|
6361
6362
|
}
|
|
6362
6363
|
remove(schema) {
|
|
6363
|
-
const meta
|
|
6364
|
-
if (meta
|
|
6364
|
+
const meta = this._map.get(schema);
|
|
6365
|
+
if (meta && typeof meta === "object" && "id" in meta) this._idmap.delete(meta.id);
|
|
6365
6366
|
this._map.delete(schema);
|
|
6366
6367
|
return this;
|
|
6367
6368
|
}
|
|
@@ -6676,6 +6677,13 @@ function _int(Class, params) {
|
|
|
6676
6677
|
});
|
|
6677
6678
|
}
|
|
6678
6679
|
/* @__NO_SIDE_EFFECTS__ */
|
|
6680
|
+
function _boolean(Class, params) {
|
|
6681
|
+
return new Class({
|
|
6682
|
+
type: "boolean",
|
|
6683
|
+
...normalizeParams(params)
|
|
6684
|
+
});
|
|
6685
|
+
}
|
|
6686
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
6679
6687
|
function _unknown(Class) {
|
|
6680
6688
|
return new Class({ type: "unknown" });
|
|
6681
6689
|
}
|
|
@@ -6853,10 +6861,10 @@ function _refine(Class, fn, _params) {
|
|
|
6853
6861
|
/* @__NO_SIDE_EFFECTS__ */
|
|
6854
6862
|
function _superRefine(fn) {
|
|
6855
6863
|
const ch = /* @__PURE__ */ _check((payload) => {
|
|
6856
|
-
payload.addIssue = (issue$
|
|
6857
|
-
if (typeof issue$
|
|
6864
|
+
payload.addIssue = (issue$2) => {
|
|
6865
|
+
if (typeof issue$2 === "string") payload.issues.push(issue(issue$2, payload.value, ch._zod.def));
|
|
6858
6866
|
else {
|
|
6859
|
-
const _issue = issue$
|
|
6867
|
+
const _issue = issue$2;
|
|
6860
6868
|
if (_issue.fatal) _issue.continue = false;
|
|
6861
6869
|
_issue.code ?? (_issue.code = "custom");
|
|
6862
6870
|
_issue.input ?? (_issue.input = payload.value);
|
|
@@ -6900,7 +6908,7 @@ function process$2(schema, ctx, _params = {
|
|
|
6900
6908
|
path: [],
|
|
6901
6909
|
schemaPath: []
|
|
6902
6910
|
}) {
|
|
6903
|
-
var _a
|
|
6911
|
+
var _a;
|
|
6904
6912
|
const def = schema._zod.def;
|
|
6905
6913
|
const seen = ctx.seen.get(schema);
|
|
6906
6914
|
if (seen) {
|
|
@@ -6937,13 +6945,13 @@ function process$2(schema, ctx, _params = {
|
|
|
6937
6945
|
ctx.seen.get(parent).isParent = true;
|
|
6938
6946
|
}
|
|
6939
6947
|
}
|
|
6940
|
-
const meta
|
|
6941
|
-
if (meta
|
|
6948
|
+
const meta = ctx.metadataRegistry.get(schema);
|
|
6949
|
+
if (meta) Object.assign(result.schema, meta);
|
|
6942
6950
|
if (ctx.io === "input" && isTransforming(schema)) {
|
|
6943
6951
|
delete result.schema.examples;
|
|
6944
6952
|
delete result.schema.default;
|
|
6945
6953
|
}
|
|
6946
|
-
if (ctx.io === "input" && result.schema._prefault) (_a
|
|
6954
|
+
if (ctx.io === "input" && result.schema._prefault) (_a = result.schema).default ?? (_a.default = result.schema._prefault);
|
|
6947
6955
|
delete result.schema._prefault;
|
|
6948
6956
|
return ctx.seen.get(schema).schema;
|
|
6949
6957
|
}
|
|
@@ -6963,7 +6971,7 @@ function extractDefs(ctx, schema) {
|
|
|
6963
6971
|
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
6964
6972
|
if (ctx.external) {
|
|
6965
6973
|
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
6966
|
-
const uriGenerator = ctx.external.uri ?? ((id
|
|
6974
|
+
const uriGenerator = ctx.external.uri ?? ((id) => id);
|
|
6967
6975
|
if (externalId) return { ref: uriGenerator(externalId) };
|
|
6968
6976
|
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
6969
6977
|
entry[1].defId = id;
|
|
@@ -6986,9 +6994,9 @@ function extractDefs(ctx, schema) {
|
|
|
6986
6994
|
const { ref, defId } = makeURI(entry);
|
|
6987
6995
|
seen.def = { ...seen.schema };
|
|
6988
6996
|
if (defId) seen.defId = defId;
|
|
6989
|
-
const schema
|
|
6990
|
-
for (const key in schema
|
|
6991
|
-
schema
|
|
6997
|
+
const schema = seen.schema;
|
|
6998
|
+
for (const key in schema) delete schema[key];
|
|
6999
|
+
schema.$ref = ref;
|
|
6992
7000
|
};
|
|
6993
7001
|
if (ctx.cycles === "throw") for (const entry of ctx.seen.entries()) {
|
|
6994
7002
|
const seen = entry[1];
|
|
@@ -7031,8 +7039,8 @@ function finalize(ctx, schema) {
|
|
|
7031
7039
|
const flattenRef = (zodSchema) => {
|
|
7032
7040
|
const seen = ctx.seen.get(zodSchema);
|
|
7033
7041
|
if (seen.ref === null) return;
|
|
7034
|
-
const schema
|
|
7035
|
-
const _cached = { ...schema
|
|
7042
|
+
const schema = seen.def ?? seen.schema;
|
|
7043
|
+
const _cached = { ...schema };
|
|
7036
7044
|
const ref = seen.ref;
|
|
7037
7045
|
seen.ref = null;
|
|
7038
7046
|
if (ref) {
|
|
@@ -7040,17 +7048,17 @@ function finalize(ctx, schema) {
|
|
|
7040
7048
|
const refSeen = ctx.seen.get(ref);
|
|
7041
7049
|
const refSchema = refSeen.schema;
|
|
7042
7050
|
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
7043
|
-
schema
|
|
7044
|
-
schema
|
|
7045
|
-
} else Object.assign(schema
|
|
7046
|
-
Object.assign(schema
|
|
7047
|
-
if (zodSchema._zod.parent === ref) for (const key in schema
|
|
7051
|
+
schema.allOf = schema.allOf ?? [];
|
|
7052
|
+
schema.allOf.push(refSchema);
|
|
7053
|
+
} else Object.assign(schema, refSchema);
|
|
7054
|
+
Object.assign(schema, _cached);
|
|
7055
|
+
if (zodSchema._zod.parent === ref) for (const key in schema) {
|
|
7048
7056
|
if (key === "$ref" || key === "allOf") continue;
|
|
7049
|
-
if (!(key in _cached)) delete schema
|
|
7057
|
+
if (!(key in _cached)) delete schema[key];
|
|
7050
7058
|
}
|
|
7051
|
-
if (refSchema.$ref && refSeen.def) for (const key in schema
|
|
7059
|
+
if (refSchema.$ref && refSeen.def) for (const key in schema) {
|
|
7052
7060
|
if (key === "$ref" || key === "allOf") continue;
|
|
7053
|
-
if (key in refSeen.def && JSON.stringify(schema
|
|
7061
|
+
if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) delete schema[key];
|
|
7054
7062
|
}
|
|
7055
7063
|
}
|
|
7056
7064
|
const parent = zodSchema._zod.parent;
|
|
@@ -7058,16 +7066,16 @@ function finalize(ctx, schema) {
|
|
|
7058
7066
|
flattenRef(parent);
|
|
7059
7067
|
const parentSeen = ctx.seen.get(parent);
|
|
7060
7068
|
if (parentSeen?.schema.$ref) {
|
|
7061
|
-
schema
|
|
7062
|
-
if (parentSeen.def) for (const key in schema
|
|
7069
|
+
schema.$ref = parentSeen.schema.$ref;
|
|
7070
|
+
if (parentSeen.def) for (const key in schema) {
|
|
7063
7071
|
if (key === "$ref" || key === "allOf") continue;
|
|
7064
|
-
if (key in parentSeen.def && JSON.stringify(schema
|
|
7072
|
+
if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) delete schema[key];
|
|
7065
7073
|
}
|
|
7066
7074
|
}
|
|
7067
7075
|
}
|
|
7068
7076
|
ctx.override({
|
|
7069
7077
|
zodSchema,
|
|
7070
|
-
jsonSchema: schema
|
|
7078
|
+
jsonSchema: schema,
|
|
7071
7079
|
path: seen.path ?? []
|
|
7072
7080
|
});
|
|
7073
7081
|
};
|
|
@@ -7214,6 +7222,9 @@ const numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
7214
7222
|
}
|
|
7215
7223
|
if (typeof multipleOf === "number") json.multipleOf = multipleOf;
|
|
7216
7224
|
};
|
|
7225
|
+
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
7226
|
+
json.type = "boolean";
|
|
7227
|
+
};
|
|
7217
7228
|
const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
7218
7229
|
json.not = {};
|
|
7219
7230
|
};
|
|
@@ -7403,12 +7414,12 @@ const initializer = (inst, issues) => {
|
|
|
7403
7414
|
Object.defineProperties(inst, {
|
|
7404
7415
|
format: { value: (mapper) => formatError(inst, mapper) },
|
|
7405
7416
|
flatten: { value: (mapper) => flattenError(inst, mapper) },
|
|
7406
|
-
addIssue: { value: (issue
|
|
7407
|
-
inst.issues.push(issue
|
|
7417
|
+
addIssue: { value: (issue) => {
|
|
7418
|
+
inst.issues.push(issue);
|
|
7408
7419
|
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
7409
7420
|
} },
|
|
7410
|
-
addIssues: { value: (issues
|
|
7411
|
-
inst.issues.push(...issues
|
|
7421
|
+
addIssues: { value: (issues) => {
|
|
7422
|
+
inst.issues.push(...issues);
|
|
7412
7423
|
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
7413
7424
|
} },
|
|
7414
7425
|
isEmpty: { get() {
|
|
@@ -7448,10 +7459,10 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
7448
7459
|
} } : ch)] }), { parent: true });
|
|
7449
7460
|
};
|
|
7450
7461
|
inst.with = inst.check;
|
|
7451
|
-
inst.clone = (def
|
|
7462
|
+
inst.clone = (def, params) => clone(inst, def, params);
|
|
7452
7463
|
inst.brand = () => inst;
|
|
7453
|
-
inst.register = ((reg, meta
|
|
7454
|
-
reg.add(inst, meta
|
|
7464
|
+
inst.register = ((reg, meta) => {
|
|
7465
|
+
reg.add(inst, meta);
|
|
7455
7466
|
return inst;
|
|
7456
7467
|
});
|
|
7457
7468
|
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
@@ -7479,8 +7490,8 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
7479
7490
|
inst.or = (arg) => union([inst, arg]);
|
|
7480
7491
|
inst.and = (arg) => intersection(inst, arg);
|
|
7481
7492
|
inst.transform = (tx) => pipe(inst, transform(tx));
|
|
7482
|
-
inst.default = (def
|
|
7483
|
-
inst.prefault = (def
|
|
7493
|
+
inst.default = (def) => _default(inst, def);
|
|
7494
|
+
inst.prefault = (def) => prefault(inst, def);
|
|
7484
7495
|
inst.catch = (params) => _catch(inst, params);
|
|
7485
7496
|
inst.pipe = (target) => pipe(inst, target);
|
|
7486
7497
|
inst.readonly = () => readonly(inst);
|
|
@@ -7681,6 +7692,14 @@ const ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, d
|
|
|
7681
7692
|
function int(params) {
|
|
7682
7693
|
return /* @__PURE__ */ _int(ZodNumberFormat, params);
|
|
7683
7694
|
}
|
|
7695
|
+
const ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
7696
|
+
$ZodBoolean.init(inst, def);
|
|
7697
|
+
ZodType.init(inst, def);
|
|
7698
|
+
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
|
|
7699
|
+
});
|
|
7700
|
+
function boolean(params) {
|
|
7701
|
+
return /* @__PURE__ */ _boolean(ZodBoolean, params);
|
|
7702
|
+
}
|
|
7684
7703
|
const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
7685
7704
|
$ZodUnknown.init(inst, def);
|
|
7686
7705
|
ZodType.init(inst, def);
|
|
@@ -7826,10 +7845,10 @@ const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) =>
|
|
|
7826
7845
|
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
7827
7846
|
inst._zod.parse = (payload, _ctx) => {
|
|
7828
7847
|
if (_ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
7829
|
-
payload.addIssue = (issue$1
|
|
7830
|
-
if (typeof issue$1
|
|
7848
|
+
payload.addIssue = (issue$1) => {
|
|
7849
|
+
if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, def));
|
|
7831
7850
|
else {
|
|
7832
|
-
const _issue = issue$1
|
|
7851
|
+
const _issue = issue$1;
|
|
7833
7852
|
if (_issue.fatal) _issue.continue = false;
|
|
7834
7853
|
_issue.code ?? (_issue.code = "custom");
|
|
7835
7854
|
_issue.input ?? (_issue.input = payload.value);
|
|
@@ -7838,8 +7857,8 @@ const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) =>
|
|
|
7838
7857
|
}
|
|
7839
7858
|
};
|
|
7840
7859
|
const output = def.transform(payload.value, payload);
|
|
7841
|
-
if (output instanceof Promise) return output.then((output
|
|
7842
|
-
payload.value = output
|
|
7860
|
+
if (output instanceof Promise) return output.then((output) => {
|
|
7861
|
+
payload.value = output;
|
|
7843
7862
|
return payload;
|
|
7844
7863
|
});
|
|
7845
7864
|
payload.value = output;
|
|
@@ -8030,7 +8049,18 @@ const CodeSnippetSchema = object({
|
|
|
8030
8049
|
label: string().min(1),
|
|
8031
8050
|
snippet: string().min(1)
|
|
8032
8051
|
});
|
|
8033
|
-
|
|
8052
|
+
/**
|
|
8053
|
+
* Per-field lock entry — written into a feature.json to explicitly protect a specific field
|
|
8054
|
+
* from AI overwrite in this feature, even if not in the workspace-level restrictedFields config.
|
|
8055
|
+
* Use this when a field was hard-won and should never be touched without a human review.
|
|
8056
|
+
*/
|
|
8057
|
+
const FieldLockSchema = object({
|
|
8058
|
+
field: string().min(1),
|
|
8059
|
+
lockedAt: string().min(1),
|
|
8060
|
+
lockedBy: string().min(1),
|
|
8061
|
+
reason: string().optional()
|
|
8062
|
+
});
|
|
8063
|
+
object({
|
|
8034
8064
|
featureKey: string().regex(FEATURE_KEY_PATTERN, "featureKey must match pattern <domain>-YYYY-NNN (e.g. feat-2026-001, proc-2026-001)"),
|
|
8035
8065
|
title: string().min(1),
|
|
8036
8066
|
status: FeatureStatusSchema,
|
|
@@ -8059,7 +8089,10 @@ const FeatureSchema = object({
|
|
|
8059
8089
|
publicInterface: array(PublicInterfaceEntrySchema).optional(),
|
|
8060
8090
|
externalDependencies: array(string()).optional(),
|
|
8061
8091
|
lastVerifiedDate: string().regex(/^\d{4}-\d{2}-\d{2}$/, "lastVerifiedDate must be YYYY-MM-DD").optional(),
|
|
8062
|
-
codeSnippets: array(CodeSnippetSchema).optional()
|
|
8092
|
+
codeSnippets: array(CodeSnippetSchema).optional(),
|
|
8093
|
+
implementationNotes: array(string()).optional(),
|
|
8094
|
+
fieldLocks: array(FieldLockSchema).optional(),
|
|
8095
|
+
featureLocked: boolean().optional()
|
|
8063
8096
|
});
|
|
8064
8097
|
const SOURCE_EXTENSIONS = new Set([
|
|
8065
8098
|
".ts",
|
|
@@ -8189,6 +8222,110 @@ function contextToString(ctx) {
|
|
|
8189
8222
|
}
|
|
8190
8223
|
return parts.join("\n");
|
|
8191
8224
|
}
|
|
8225
|
+
/**
|
|
8226
|
+
* Guardlock — configurable field protection for lac workspaces.
|
|
8227
|
+
*
|
|
8228
|
+
* Two layers of protection:
|
|
8229
|
+
* 1. Workspace-level: `lac.config.json` → `guardlock.restrictedFields` — applies to all features
|
|
8230
|
+
* 2. Per-feature: `feature.json` → `fieldLocks[]` — locks specific fields in a single feature,
|
|
8231
|
+
* useful when a field was hard-won and should never be touched without human review.
|
|
8232
|
+
*
|
|
8233
|
+
* "While working on this feature, lock these fields too" → add entries to fieldLocks.
|
|
8234
|
+
*/
|
|
8235
|
+
const GUARDLOCK_DEFAULTS = {
|
|
8236
|
+
mode: "warn",
|
|
8237
|
+
restrictedFields: [],
|
|
8238
|
+
requireAlternatives: false,
|
|
8239
|
+
freezeRequiresHumanRevision: false
|
|
8240
|
+
};
|
|
8241
|
+
/** Walk up from startDir to find the nearest lac.config.json */
|
|
8242
|
+
function findLacConfig(startDir) {
|
|
8243
|
+
let dir = startDir;
|
|
8244
|
+
const root = path.parse(dir).root;
|
|
8245
|
+
while (dir !== root) {
|
|
8246
|
+
const candidate = path.join(dir, "lac.config.json");
|
|
8247
|
+
if (fs.existsSync(candidate)) return candidate;
|
|
8248
|
+
const parent = path.dirname(dir);
|
|
8249
|
+
if (parent === dir) break;
|
|
8250
|
+
dir = parent;
|
|
8251
|
+
}
|
|
8252
|
+
return null;
|
|
8253
|
+
}
|
|
8254
|
+
/** Load guardlock config from the nearest lac.config.json, walking up from fromDir. */
|
|
8255
|
+
function loadGuardlockConfig(fromDir) {
|
|
8256
|
+
const configPath = findLacConfig(fromDir);
|
|
8257
|
+
if (!configPath) return { ...GUARDLOCK_DEFAULTS };
|
|
8258
|
+
try {
|
|
8259
|
+
const raw = fs.readFileSync(configPath, "utf-8");
|
|
8260
|
+
const g = JSON.parse(raw).guardlock ?? {};
|
|
8261
|
+
return {
|
|
8262
|
+
mode: g.mode ?? GUARDLOCK_DEFAULTS.mode,
|
|
8263
|
+
restrictedFields: g.restrictedFields ?? GUARDLOCK_DEFAULTS.restrictedFields,
|
|
8264
|
+
requireAlternatives: g.requireAlternatives ?? GUARDLOCK_DEFAULTS.requireAlternatives,
|
|
8265
|
+
freezeRequiresHumanRevision: g.freezeRequiresHumanRevision ?? GUARDLOCK_DEFAULTS.freezeRequiresHumanRevision
|
|
8266
|
+
};
|
|
8267
|
+
} catch {
|
|
8268
|
+
return { ...GUARDLOCK_DEFAULTS };
|
|
8269
|
+
}
|
|
8270
|
+
}
|
|
8271
|
+
/**
|
|
8272
|
+
* Resolve which fields are locked for a given feature.
|
|
8273
|
+
*
|
|
8274
|
+
* Combines two sources:
|
|
8275
|
+
* - workspace config: `guardlock.restrictedFields`
|
|
8276
|
+
* - per-feature: `feature.fieldLocks[]` — "lock these fields while working on this feature"
|
|
8277
|
+
*
|
|
8278
|
+
* Returns a Set of locked field names and a map of field → reason (for error messages).
|
|
8279
|
+
*/
|
|
8280
|
+
function resolveLockedFields(config, featureFieldLocks = []) {
|
|
8281
|
+
const lockedFields = /* @__PURE__ */ new Set();
|
|
8282
|
+
const lockReasons = /* @__PURE__ */ new Map();
|
|
8283
|
+
for (const field of config.restrictedFields) {
|
|
8284
|
+
lockedFields.add(field);
|
|
8285
|
+
lockReasons.set(field, "workspace config (guardlock.restrictedFields)");
|
|
8286
|
+
}
|
|
8287
|
+
for (const lock of featureFieldLocks) {
|
|
8288
|
+
lockedFields.add(lock.field);
|
|
8289
|
+
if (!lockReasons.get(lock.field)) {
|
|
8290
|
+
const reason = lock.reason ? `per-feature lock by ${lock.lockedBy}: ${lock.reason}` : `per-feature lock by ${lock.lockedBy} (${lock.lockedAt})`;
|
|
8291
|
+
lockReasons.set(lock.field, reason);
|
|
8292
|
+
}
|
|
8293
|
+
}
|
|
8294
|
+
return {
|
|
8295
|
+
lockedFields,
|
|
8296
|
+
lockReasons
|
|
8297
|
+
};
|
|
8298
|
+
}
|
|
8299
|
+
/**
|
|
8300
|
+
* Check if writing `fieldsToWrite` would violate any locks.
|
|
8301
|
+
*
|
|
8302
|
+
* @param featureLocked - when true, ALL fields in this feature are locked (equivalent to
|
|
8303
|
+
* listing every attempted field in fieldLocks). Use `feature.featureLocked` to pass this.
|
|
8304
|
+
*
|
|
8305
|
+
* Returns a list of violations (field + reason) or empty if clean.
|
|
8306
|
+
*/
|
|
8307
|
+
function checkGuardlock(config, featureFieldLocks, fieldsToWrite, featureLocked = false) {
|
|
8308
|
+
if (config.mode === "off") return [];
|
|
8309
|
+
if (featureLocked) return fieldsToWrite.map((field) => ({
|
|
8310
|
+
field,
|
|
8311
|
+
reason: "feature is AI-locked (featureLocked: true)"
|
|
8312
|
+
}));
|
|
8313
|
+
const { lockedFields, lockReasons } = resolveLockedFields(config, featureFieldLocks);
|
|
8314
|
+
const violations = [];
|
|
8315
|
+
for (const field of fieldsToWrite) if (lockedFields.has(field)) violations.push({
|
|
8316
|
+
field,
|
|
8317
|
+
reason: lockReasons.get(field) ?? "locked"
|
|
8318
|
+
});
|
|
8319
|
+
return violations;
|
|
8320
|
+
}
|
|
8321
|
+
/** Format guardlock violations into a human-readable message. */
|
|
8322
|
+
function formatGuardlockMessage(violations, mode, canOverride) {
|
|
8323
|
+
const prefix = mode === "block" ? "🔒 Guardlock blocked" : "⚠ Guardlock warning";
|
|
8324
|
+
const lines = violations.map((v) => ` - ${v.field}: ${v.reason}`);
|
|
8325
|
+
const overrideHint = canOverride ? mode === "block" ? "\nPass override: true to force-write these fields." : "" : "";
|
|
8326
|
+
return `${prefix} — ${violations.length} protected field(s) would be overwritten:\n${lines.join("\n")}${overrideHint}`;
|
|
8327
|
+
}
|
|
8328
|
+
const _dtNow = /* @__PURE__ */ new Date();
|
|
8192
8329
|
const FILL_PROMPTS = {
|
|
8193
8330
|
analysis: {
|
|
8194
8331
|
system: `You are a software engineering analyst. Given a feature.json and the feature's source code, write a clear analysis section. Cover: what the code does architecturally, key patterns used, and why they were likely chosen. Be specific — name actual functions, modules, and techniques visible in the code. Write in first-person technical prose, 150-300 words. Return only the analysis text, no JSON wrapper, no markdown heading.`,
|
|
@@ -8234,7 +8371,7 @@ Return ONLY a valid JSON array — no other text:
|
|
|
8234
8371
|
{
|
|
8235
8372
|
"id": "auto-1",
|
|
8236
8373
|
"author": "lac fill",
|
|
8237
|
-
"date": "${(
|
|
8374
|
+
"date": "${`${_dtNow.getFullYear()}-${String(_dtNow.getMonth() + 1).padStart(2, "0")}-${String(_dtNow.getDate()).padStart(2, "0")}`}",
|
|
8238
8375
|
"type": "tech-debt",
|
|
8239
8376
|
"body": "string"
|
|
8240
8377
|
}
|
|
@@ -8299,6 +8436,15 @@ Return ONLY a valid JSON array — no other text:
|
|
|
8299
8436
|
}
|
|
8300
8437
|
]`,
|
|
8301
8438
|
userSuffix: "Extract the critical code snippets for this feature."
|
|
8439
|
+
},
|
|
8440
|
+
implementationNotes: {
|
|
8441
|
+
system: `You are a software engineering analyst. Given a feature.json and its source code, write 2-5 short implementation notes — free-form sentences capturing context that does not fit neatly into decisions[], analysis, or userGuide. Good candidates: architectural choices made for non-obvious reasons, constraints the code works around, "why not X" rationale, threading/ordering requirements, or performance trade-offs visible in the implementation.
|
|
8442
|
+
|
|
8443
|
+
Return ONLY a valid JSON array of plain strings — no other text, no markdown fences:
|
|
8444
|
+
["Note about why X was done this way.", "Note about a constraint that affects Y."]
|
|
8445
|
+
|
|
8446
|
+
If there are no notable implementation notes, return an empty array: []`,
|
|
8447
|
+
userSuffix: "Extract free-form implementation notes for this feature."
|
|
8302
8448
|
}
|
|
8303
8449
|
};
|
|
8304
8450
|
const JSON_FIELDS = new Set([
|
|
@@ -8325,7 +8471,8 @@ const ALL_FILLABLE_FIELDS = [
|
|
|
8325
8471
|
"publicInterface",
|
|
8326
8472
|
"externalDependencies",
|
|
8327
8473
|
"lastVerifiedDate",
|
|
8328
|
-
"codeSnippets"
|
|
8474
|
+
"codeSnippets",
|
|
8475
|
+
"implementationNotes"
|
|
8329
8476
|
];
|
|
8330
8477
|
function getMissingFields(feature) {
|
|
8331
8478
|
return ALL_FILLABLE_FIELDS.filter((field) => {
|
|
@@ -8344,7 +8491,6 @@ function appendPromptLog(featureDir, entries) {
|
|
|
8344
8491
|
const lines = entries.map((e) => JSON.stringify(e)).join("\n") + "\n";
|
|
8345
8492
|
fs.appendFileSync(logPath, lines, "utf-8");
|
|
8346
8493
|
}
|
|
8347
|
-
|
|
8348
8494
|
//#endregion
|
|
8349
8495
|
//#region ../lac-mcp/src/index.ts
|
|
8350
8496
|
const workspaceRoot = process$1.argv[2] ?? process$1.env.LAC_WORKSPACE ?? process$1.cwd();
|
|
@@ -8486,7 +8632,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [
|
|
|
8486
8632
|
},
|
|
8487
8633
|
{
|
|
8488
8634
|
name: "write_feature_fields",
|
|
8489
|
-
description: "Patch a feature.json with new field values. Use this after read_feature_context — write the fields you generated back to disk. If you are changing intent-critical fields (problem, analysis, implementation, decisions, successCriteria), pass a revision object with author and reason. After writing, call advance_feature to check if the feature is ready to transition.",
|
|
8635
|
+
description: "Patch a feature.json with new field values. Use this after read_feature_context — write the fields you generated back to disk. If you are changing intent-critical fields (problem, analysis, implementation, decisions, successCriteria), pass a revision object with author and reason. Guardlock: if the feature has restricted fields (via lac.config.json guardlock.restrictedFields, feature.fieldLocks, or feature.featureLocked), those fields are blocked or warned by default — pass override: true to force-write them. After writing, call advance_feature to check if the feature is ready to transition.",
|
|
8490
8636
|
inputSchema: {
|
|
8491
8637
|
type: "object",
|
|
8492
8638
|
properties: {
|
|
@@ -8512,6 +8658,10 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [
|
|
|
8512
8658
|
}
|
|
8513
8659
|
},
|
|
8514
8660
|
required: ["author", "reason"]
|
|
8661
|
+
},
|
|
8662
|
+
override: {
|
|
8663
|
+
type: "boolean",
|
|
8664
|
+
description: "Set to true to bypass guardlock and write restricted fields anyway. Only use when the user explicitly requests it — guardlocks exist to protect human decisions from AI drift."
|
|
8515
8665
|
}
|
|
8516
8666
|
},
|
|
8517
8667
|
required: ["path", "fields"]
|
|
@@ -8605,6 +8755,15 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [
|
|
|
8605
8755
|
maxFileSize: {
|
|
8606
8756
|
type: "number",
|
|
8607
8757
|
description: "Maximum characters to read per file before truncating (default: 8000). Increase for large files."
|
|
8758
|
+
},
|
|
8759
|
+
extractionDepth: {
|
|
8760
|
+
type: "number",
|
|
8761
|
+
enum: [
|
|
8762
|
+
1,
|
|
8763
|
+
2,
|
|
8764
|
+
3
|
|
8765
|
+
],
|
|
8766
|
+
description: "How much implementation detail to capture. 1=Why (intent only: analysis, decisions, successCriteria, knownLimitations, userGuide — no code or signatures). 2=What (intent + API surface: adds implementation notes, publicInterface with TypeScript types, componentFile, npmPackages — no literal code). 3=How (full spec: adds codeSnippets and toolingAnnotations). Default: 2."
|
|
8608
8767
|
}
|
|
8609
8768
|
},
|
|
8610
8769
|
required: ["path"]
|
|
@@ -8733,6 +8892,44 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [
|
|
|
8733
8892
|
required: []
|
|
8734
8893
|
}
|
|
8735
8894
|
},
|
|
8895
|
+
{
|
|
8896
|
+
name: "lock_feature_fields",
|
|
8897
|
+
description: "Lock or unlock specific fields in a feature.json, or toggle featureLocked for the whole feature. Use this when the user says \"lock these fields while working on this feature\" or \"don't let AI touch X\". Locked fields are skipped by write_feature_fields and read_feature_context will tell Claude not to generate them.",
|
|
8898
|
+
inputSchema: {
|
|
8899
|
+
type: "object",
|
|
8900
|
+
properties: {
|
|
8901
|
+
path: {
|
|
8902
|
+
type: "string",
|
|
8903
|
+
description: "Absolute or relative path to the feature folder"
|
|
8904
|
+
},
|
|
8905
|
+
action: {
|
|
8906
|
+
type: "string",
|
|
8907
|
+
enum: [
|
|
8908
|
+
"lock",
|
|
8909
|
+
"unlock",
|
|
8910
|
+
"freeze",
|
|
8911
|
+
"thaw",
|
|
8912
|
+
"status"
|
|
8913
|
+
],
|
|
8914
|
+
description: "\"lock\" — add fields to fieldLocks. \"unlock\" — remove from fieldLocks. \"freeze\" — set featureLocked: true (lock all fields). \"thaw\" — remove featureLocked. \"status\" — show current locks."
|
|
8915
|
+
},
|
|
8916
|
+
fields: {
|
|
8917
|
+
type: "array",
|
|
8918
|
+
items: { type: "string" },
|
|
8919
|
+
description: "Field names to lock or unlock (required for lock/unlock actions)"
|
|
8920
|
+
},
|
|
8921
|
+
reason: {
|
|
8922
|
+
type: "string",
|
|
8923
|
+
description: "Why these fields are being locked (shown in guardlock notices)"
|
|
8924
|
+
},
|
|
8925
|
+
author: {
|
|
8926
|
+
type: "string",
|
|
8927
|
+
description: "Who is setting the lock (defaults to \"Claude\" for MCP-initiated locks)"
|
|
8928
|
+
}
|
|
8929
|
+
},
|
|
8930
|
+
required: ["path", "action"]
|
|
8931
|
+
}
|
|
8932
|
+
},
|
|
8736
8933
|
{
|
|
8737
8934
|
name: "extract_all_features",
|
|
8738
8935
|
description: "Scan a repository and return a manifest of all directories that should have feature.json files but do not yet. Useful for onboarding a legacy or external repo into LAC. After calling this tool, iterate over the returned candidates and call extract_feature_from_code on each one.",
|
|
@@ -8979,14 +9176,52 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
8979
9176
|
});
|
|
8980
9177
|
if (notFound.length > 0) componentFileWarning = `\n## ⚠ componentFile drift\nThese paths do not exist on disk — update componentFile to match actual source files:\n${notFound.map((p) => ` - ${p}`).join("\n")}\n`;
|
|
8981
9178
|
}
|
|
8982
|
-
const
|
|
9179
|
+
const guardConfig = loadGuardlockConfig(featureDir);
|
|
9180
|
+
const featureFieldLocks = feature.fieldLocks ?? [];
|
|
9181
|
+
const featureLocked = !!feature.featureLocked;
|
|
9182
|
+
let lockedFieldNames = /* @__PURE__ */ new Set();
|
|
9183
|
+
let guardlockNotice = "";
|
|
9184
|
+
if (guardConfig.mode !== "off") {
|
|
9185
|
+
const { lockedFields, lockReasons } = (() => {
|
|
9186
|
+
if (featureLocked) {
|
|
9187
|
+
const allFields = new Set(missingFields.map(String));
|
|
9188
|
+
const reasons = /* @__PURE__ */ new Map();
|
|
9189
|
+
for (const f of allFields) reasons.set(f, "feature is AI-locked (featureLocked: true)");
|
|
9190
|
+
return {
|
|
9191
|
+
lockedFields: allFields,
|
|
9192
|
+
lockReasons: reasons
|
|
9193
|
+
};
|
|
9194
|
+
}
|
|
9195
|
+
const locked = /* @__PURE__ */ new Set();
|
|
9196
|
+
const reasons = /* @__PURE__ */ new Map();
|
|
9197
|
+
for (const f of guardConfig.restrictedFields) {
|
|
9198
|
+
locked.add(f);
|
|
9199
|
+
reasons.set(f, "workspace guardlock.restrictedFields");
|
|
9200
|
+
}
|
|
9201
|
+
for (const lock of featureFieldLocks) {
|
|
9202
|
+
locked.add(lock.field);
|
|
9203
|
+
if (!reasons.has(lock.field)) reasons.set(lock.field, lock.reason ? `per-feature lock: ${lock.reason}` : `locked by ${lock.lockedBy}`);
|
|
9204
|
+
}
|
|
9205
|
+
return {
|
|
9206
|
+
lockedFields: locked,
|
|
9207
|
+
lockReasons: reasons
|
|
9208
|
+
};
|
|
9209
|
+
})();
|
|
9210
|
+
lockedFieldNames = lockedFields;
|
|
9211
|
+
if (lockedFields.size > 0) {
|
|
9212
|
+
const lockedLines = [...lockedFields].filter((f) => missingFields.includes(f)).map((f) => ` - ${f}: ${lockReasons.get(f)}`);
|
|
9213
|
+
if (lockedLines.length > 0) guardlockNotice = `## 🔒 Guardlock — DO NOT generate these fields\nThese fields are human-locked. Do not write values for them. The human will fill them.\n${lockedLines.join("\n")}\n\n`;
|
|
9214
|
+
}
|
|
9215
|
+
}
|
|
9216
|
+
const fieldInstructions = missingFields.filter((f) => !lockedFieldNames.has(f)).map((field) => {
|
|
8983
9217
|
const prompt = FILL_PROMPTS[field];
|
|
8984
9218
|
const isJson = JSON_FIELDS.has(field);
|
|
8985
9219
|
return `### ${field}\n${prompt.system}\n${prompt.userSuffix}\n${isJson ? "(Return valid JSON for this field)" : "(Return plain text for this field)"}`;
|
|
8986
9220
|
}).join("\n\n");
|
|
9221
|
+
const fillableFields = missingFields.filter((f) => !lockedFieldNames.has(f));
|
|
8987
9222
|
const staleAnnotation = feature.annotations?.find((ann) => ann.type === "stale-review");
|
|
8988
9223
|
const staleWarning = staleAnnotation ? `## ⚠ Stale fields (feature was reopened)\n${staleAnnotation.body}\nReview and rewrite these fields against the current code, then call write_feature_fields.\n\n` : "";
|
|
8989
|
-
const instructions = missingFields.length === 0 ? staleWarning || "All fillable fields are already populated. No generation needed." : `${staleWarning}## Missing fields to fill (${
|
|
9224
|
+
const instructions = fillableFields.length === 0 && missingFields.length === 0 ? staleWarning || "All fillable fields are already populated. No generation needed." : fillableFields.length === 0 && missingFields.length > 0 ? `${guardlockNotice}${staleWarning}All missing fields are human-locked. No AI generation needed — the human will fill them.` : `${guardlockNotice}${staleWarning}## Missing fields to fill (${fillableFields.join(", ")})\n\nGenerate each field described below, then call write_feature_fields with all values at once. Fill ALL missing fields before calling advance_feature.\n\n${fieldInstructions}`;
|
|
8990
9225
|
return { content: [{
|
|
8991
9226
|
type: "text",
|
|
8992
9227
|
text: `${componentFileWarning}${instructions}\n\n## Context\n\n${contextStr}`
|
|
@@ -9016,6 +9251,24 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
9016
9251
|
}],
|
|
9017
9252
|
isError: true
|
|
9018
9253
|
};
|
|
9254
|
+
if (!(a.override === true)) {
|
|
9255
|
+
const guardConfig = loadGuardlockConfig(featureDir);
|
|
9256
|
+
const featureFieldLocks = existing.fieldLocks ?? [];
|
|
9257
|
+
const featureLocked = existing.featureLocked === true;
|
|
9258
|
+
const violations = checkGuardlock(guardConfig, featureFieldLocks, Object.keys(fields), featureLocked);
|
|
9259
|
+
if (violations.length > 0) {
|
|
9260
|
+
const msg = formatGuardlockMessage(violations, guardConfig.mode === "block" ? "block" : "warn", true);
|
|
9261
|
+
if (guardConfig.mode === "block") return {
|
|
9262
|
+
content: [{
|
|
9263
|
+
type: "text",
|
|
9264
|
+
text: msg
|
|
9265
|
+
}],
|
|
9266
|
+
isError: true
|
|
9267
|
+
};
|
|
9268
|
+
a.__guardlockWarning = msg;
|
|
9269
|
+
}
|
|
9270
|
+
}
|
|
9271
|
+
const guardlockWarning = a.__guardlockWarning;
|
|
9019
9272
|
const INTENT_CRITICAL = new Set([
|
|
9020
9273
|
"problem",
|
|
9021
9274
|
"analysis",
|
|
@@ -9028,11 +9281,21 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
9028
9281
|
...existing,
|
|
9029
9282
|
...fields
|
|
9030
9283
|
};
|
|
9031
|
-
|
|
9284
|
+
const preWriteResult = validateFeature(updated);
|
|
9285
|
+
if (!preWriteResult.success) return {
|
|
9286
|
+
content: [{
|
|
9287
|
+
type: "text",
|
|
9288
|
+
text: `Shape validation failed — fields not written:\n${preWriteResult.errors.map((e) => ` • ${e}`).join("\n")}\n\nFix the field values and try again.`
|
|
9289
|
+
}],
|
|
9290
|
+
isError: true
|
|
9291
|
+
};
|
|
9292
|
+
const _d0 = /* @__PURE__ */ new Date();
|
|
9293
|
+
updated.lastVerifiedDate = `${_d0.getFullYear()}-${String(_d0.getMonth() + 1).padStart(2, "0")}-${String(_d0.getDate()).padStart(2, "0")}`;
|
|
9032
9294
|
const revisionInput = a.revision;
|
|
9033
9295
|
let revisionWarning = "";
|
|
9034
9296
|
if (changingCritical.length > 0) if (revisionInput?.author && revisionInput?.reason) {
|
|
9035
|
-
const
|
|
9297
|
+
const _d1 = /* @__PURE__ */ new Date();
|
|
9298
|
+
const today = `${_d1.getFullYear()}-${String(_d1.getMonth() + 1).padStart(2, "0")}-${String(_d1.getDate()).padStart(2, "0")}`;
|
|
9036
9299
|
updated.revisions = [...existing.revisions ?? [], {
|
|
9037
9300
|
date: today,
|
|
9038
9301
|
author: revisionInput.author,
|
|
@@ -9058,7 +9321,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
9058
9321
|
const nextHint = stillMissing.length > 0 ? `${stillMissing.length} field(s) still missing: ${stillMissing.join(", ")}. Fill all remaining fields with write_feature_fields before calling advance_feature.` : `All AI fields filled. Call advance_feature to transition status when ready.`;
|
|
9059
9322
|
return { content: [{
|
|
9060
9323
|
type: "text",
|
|
9061
|
-
text:
|
|
9324
|
+
text: `${guardlockWarning ? guardlockWarning + "\n\n" : ""}✓ Wrote ${writtenKeys.length} field(s) to ${featurePath}: ${writtenKeys.join(", ")}\n\n${nextHint}${revisionWarning}`
|
|
9062
9325
|
}] };
|
|
9063
9326
|
}
|
|
9064
9327
|
case "advance_feature": {
|
|
@@ -9103,13 +9366,48 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
9103
9366
|
type: "text",
|
|
9104
9367
|
text: `Cannot advance "${feature.featureKey}" to "${to}" — ${missing.length} required field(s) missing: ${missing.join(", ")}.\n\nCall read_feature_context on this path, fill the missing fields with write_feature_fields, then try advance_feature again.`
|
|
9105
9368
|
}] };
|
|
9369
|
+
if (to === "frozen") {
|
|
9370
|
+
const guardConfig = loadGuardlockConfig(featureDir);
|
|
9371
|
+
if (guardConfig.requireAlternatives) {
|
|
9372
|
+
const decisionsWithoutAlternatives = (feature.decisions ?? []).filter((d) => !d.alternativesConsidered || d.alternativesConsidered.length === 0);
|
|
9373
|
+
if (decisionsWithoutAlternatives.length > 0) {
|
|
9374
|
+
const names = decisionsWithoutAlternatives.map((d) => `"${d.decision.slice(0, 50)}"`);
|
|
9375
|
+
return { content: [{
|
|
9376
|
+
type: "text",
|
|
9377
|
+
text: `🔒 Guardlock blocked freeze — ${decisionsWithoutAlternatives.length} decision(s) missing alternativesConsidered:\n${names.map((n) => ` - ${n}`).join("\n")}\n\nAdd alternativesConsidered to each decision explaining what was rejected and why, then try again.\nThis is what makes a feature.json a real guardlock — not just what you chose, but what you didn't.`
|
|
9378
|
+
}] };
|
|
9379
|
+
}
|
|
9380
|
+
}
|
|
9381
|
+
if (guardConfig.freezeRequiresHumanRevision) {
|
|
9382
|
+
const INTENT_CRITICAL_FREEZE = [
|
|
9383
|
+
"problem",
|
|
9384
|
+
"analysis",
|
|
9385
|
+
"implementation",
|
|
9386
|
+
"decisions",
|
|
9387
|
+
"successCriteria"
|
|
9388
|
+
];
|
|
9389
|
+
const hasRevisions = Array.isArray(parsed.revisions) && parsed.revisions.length > 0;
|
|
9390
|
+
const filledCritical = INTENT_CRITICAL_FREEZE.filter((f) => {
|
|
9391
|
+
const val = feature[f];
|
|
9392
|
+
if (val === void 0 || val === null) return false;
|
|
9393
|
+
if (typeof val === "string") return val.trim().length > 0;
|
|
9394
|
+
if (Array.isArray(val)) return val.length > 0;
|
|
9395
|
+
return false;
|
|
9396
|
+
});
|
|
9397
|
+
if (filledCritical.length > 0 && !hasRevisions) return { content: [{
|
|
9398
|
+
type: "text",
|
|
9399
|
+
text: `🔒 Guardlock blocked freeze — no revision entries recorded for intent-critical fields (${filledCritical.join(", ")}).\n\nA human must review and sign off before freezing. Call write_feature_fields with a revision object (author + reason) on any of these fields, then try advance_feature again.\nThis enforces that a human reviewed the decisions before they become a frozen contract.`
|
|
9400
|
+
}] };
|
|
9401
|
+
}
|
|
9402
|
+
}
|
|
9106
9403
|
let deprecationHint = "";
|
|
9107
9404
|
if (to === "deprecated") {
|
|
9108
9405
|
const hasSuperseeded = !!parsed.superseded_by;
|
|
9109
9406
|
const hasMerged = !!parsed.merged_into;
|
|
9110
9407
|
if (!hasSuperseeded && !hasMerged) deprecationHint = "\n\n⚠ No lifecycle pointer set. Consider running `lac supersede` or `lac merge`, or call write_feature_fields with superseded_by or merged_into before deprecating so future readers know where this feature went.";
|
|
9111
9408
|
}
|
|
9112
|
-
const
|
|
9409
|
+
const _da = /* @__PURE__ */ new Date();
|
|
9410
|
+
const today = `${_da.getFullYear()}-${String(_da.getMonth() + 1).padStart(2, "0")}-${String(_da.getDate()).padStart(2, "0")}`;
|
|
9113
9411
|
const updated = {
|
|
9114
9412
|
...parsed,
|
|
9115
9413
|
status: to
|
|
@@ -9252,21 +9550,25 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
9252
9550
|
if (feature.status === "draft") validTransitions.push("active");
|
|
9253
9551
|
if (feature.status === "active") validTransitions.push("frozen");
|
|
9254
9552
|
if (feature.status === "frozen") validTransitions.push("active (requires reason)");
|
|
9553
|
+
const nextTransitionTo = feature.status === "draft" ? "active" : feature.status === "active" ? "frozen" : null;
|
|
9554
|
+
const missingForNext = nextTransitionTo ? getMissingForTransition(feature, nextTransitionTo) : [];
|
|
9555
|
+
const readyToAdvance = nextTransitionTo !== null && missingForNext.length === 0;
|
|
9255
9556
|
const nextAction = missingFields.length > 0 ? `call read_feature_context to fill: ${missingFields.join(", ")}` : staleAnnotation ? `call read_feature_context to review stale fields (reopened feature)` : feature.status === "draft" ? `call advance_feature with to: "active"` : feature.status === "active" ? `call advance_feature with to: "frozen" when complete` : feature.status === "frozen" ? `frozen — call spawn_child_feature for bugs, or advance_feature to reopen` : "deprecated — no action needed";
|
|
9256
9557
|
const sinceDate = (feature.statusHistory ? [...feature.statusHistory].reverse().find((h) => h.to === feature.status) : void 0)?.date ?? null;
|
|
9257
9558
|
return { content: [{
|
|
9258
9559
|
type: "text",
|
|
9259
9560
|
text: [
|
|
9260
|
-
`Key
|
|
9261
|
-
`Title
|
|
9262
|
-
`Status
|
|
9263
|
-
`Missing
|
|
9264
|
-
`Stale
|
|
9265
|
-
`
|
|
9266
|
-
`
|
|
9267
|
-
`
|
|
9561
|
+
`Key : ${feature.featureKey}`,
|
|
9562
|
+
`Title : ${feature.title}`,
|
|
9563
|
+
`Status : ${statusIcon(feature.status)} ${feature.status}${sinceDate ? ` (since ${sinceDate})` : ""}`,
|
|
9564
|
+
`Missing : ${missingFields.length === 0 ? "none" : missingFields.join(", ")}`,
|
|
9565
|
+
`Stale : ${staleAnnotation ? staleAnnotation.body : "none"}`,
|
|
9566
|
+
`ReadyToAdv : ${readyToAdvance ? "yes" : nextTransitionTo ? `no — missing for ${nextTransitionTo}: ${missingForNext.join(", ")}` : "n/a (frozen or deprecated)"}`,
|
|
9567
|
+
`Transitions : ${validTransitions.join(", ")}`,
|
|
9568
|
+
`Parent : ${feature.lineage?.parent ?? "none"}`,
|
|
9569
|
+
`Children : ${feature.lineage?.children?.length ?? 0}`,
|
|
9268
9570
|
``,
|
|
9269
|
-
`Next action: ${nextAction}`
|
|
9571
|
+
`Next action : ${nextAction}`
|
|
9270
9572
|
].join("\n")
|
|
9271
9573
|
}] };
|
|
9272
9574
|
}
|
|
@@ -9305,27 +9607,129 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
9305
9607
|
parts.push(file.content);
|
|
9306
9608
|
}
|
|
9307
9609
|
const rawContext = parts.join("\n");
|
|
9610
|
+
const VERB_PREFIXES = [
|
|
9611
|
+
"parse",
|
|
9612
|
+
"format",
|
|
9613
|
+
"generate",
|
|
9614
|
+
"create",
|
|
9615
|
+
"validate",
|
|
9616
|
+
"handle",
|
|
9617
|
+
"build",
|
|
9618
|
+
"fetch",
|
|
9619
|
+
"render",
|
|
9620
|
+
"transform",
|
|
9621
|
+
"convert",
|
|
9622
|
+
"check",
|
|
9623
|
+
"find",
|
|
9624
|
+
"load",
|
|
9625
|
+
"save",
|
|
9626
|
+
"update",
|
|
9627
|
+
"delete",
|
|
9628
|
+
"send",
|
|
9629
|
+
"read",
|
|
9630
|
+
"write",
|
|
9631
|
+
"init",
|
|
9632
|
+
"reset",
|
|
9633
|
+
"apply",
|
|
9634
|
+
"run",
|
|
9635
|
+
"execute",
|
|
9636
|
+
"process",
|
|
9637
|
+
"compile",
|
|
9638
|
+
"resolve",
|
|
9639
|
+
"scan",
|
|
9640
|
+
"extract",
|
|
9641
|
+
"import",
|
|
9642
|
+
"export"
|
|
9643
|
+
];
|
|
9644
|
+
const verbGroups = /* @__PURE__ */ new Map();
|
|
9645
|
+
const unclassified = [];
|
|
9646
|
+
const sourceOnly = ctx.sourceFiles.filter((f) => !f.relativePath.includes(".test.") && !f.relativePath.includes(".spec."));
|
|
9647
|
+
for (const file of sourceOnly) {
|
|
9648
|
+
const exportMatches = file.content.matchAll(/^export\s+(?:async\s+)?(?:function|class|const|let)\s+(\w+)/gm);
|
|
9649
|
+
for (const m of exportMatches) {
|
|
9650
|
+
const name = m[1] ?? "";
|
|
9651
|
+
const lower = name.toLowerCase();
|
|
9652
|
+
const verb = VERB_PREFIXES.find((v) => lower.startsWith(v));
|
|
9653
|
+
if (verb) {
|
|
9654
|
+
const group = verbGroups.get(verb) ?? [];
|
|
9655
|
+
group.push(name);
|
|
9656
|
+
verbGroups.set(verb, group);
|
|
9657
|
+
} else unclassified.push(name);
|
|
9658
|
+
}
|
|
9659
|
+
}
|
|
9660
|
+
const meaningfulGroups = [...verbGroups.entries()].filter(([, fns]) => fns.length > 0).sort((a, b) => b[1].length - a[1].length);
|
|
9661
|
+
const totalExports = [...verbGroups.values()].flat().length + unclassified.length;
|
|
9662
|
+
const suggestedCount = Math.max(meaningfulGroups.length >= 2 ? meaningfulGroups.length : 1, sourceOnly.length > 1 ? sourceOnly.length : 1);
|
|
9663
|
+
const cappedSuggestion = Math.min(suggestedCount, 8);
|
|
9664
|
+
const granularityLines = ["### Granularity analysis"];
|
|
9665
|
+
granularityLines.push(`Scanned ${sourceOnly.length} non-test source file(s), found ${totalExports} exported symbol(s).`);
|
|
9666
|
+
if (meaningfulGroups.length > 0) {
|
|
9667
|
+
granularityLines.push("Detected subsystem groups by verb prefix:");
|
|
9668
|
+
for (const [verb, fns] of meaningfulGroups.slice(0, 6)) granularityLines.push(` • \`${verb}*\` — ${fns.slice(0, 4).join(", ")}${fns.length > 4 ? ` (+${fns.length - 4} more)` : ""}`);
|
|
9669
|
+
}
|
|
9670
|
+
if (unclassified.length > 0) granularityLines.push(` • (unclassified) — ${unclassified.slice(0, 4).join(", ")}${unclassified.length > 4 ? ` (+${unclassified.length - 4})` : ""}`);
|
|
9671
|
+
if (cappedSuggestion === 1) granularityLines.push(`**Suggestion: 1 feature** — exports appear to form a single cohesive concern.`);
|
|
9672
|
+
else granularityLines.push(`**Suggestion: ~${cappedSuggestion} feature(s)** — distinct subsystems detected. Consider creating a separate feature.json for each group rather than one monolithic feature.`);
|
|
9673
|
+
const granularityHint = granularityLines.join("\n");
|
|
9674
|
+
const depth = a.extractionDepth === 1 || a.extractionDepth === 2 || a.extractionDepth === 3 ? a.extractionDepth : 2;
|
|
9675
|
+
const depthLabel = depth === 1 ? "Why (intent only)" : depth === 2 ? "What (intent + API surface)" : "How (full spec)";
|
|
9676
|
+
const depthNote = depth === 1 ? `\n⚠ Extraction depth: 1 — WHY only. Do NOT extract implementation details, code snippets, TypeScript signatures, file paths, or package names. Focus entirely on the problem, intent, decisions, and success criteria. A developer with no access to the source code should be able to understand what this feature does and why it exists — but NOT how to reimplement it.` : depth === 2 ? `\n⚠ Extraction depth: 2 — WHAT. Extract intent + API surface. Include publicInterface with full TypeScript signatures, componentFile, npmPackages, and implementation notes. Do NOT include literal code snippets (codeSnippets field) or tooling suppression directives (toolingAnnotations field).` : `\n⚠ Extraction depth: 3 — HOW (full spec). Extract everything including literal code snippets and tooling annotations. This is the maximum fidelity mode.`;
|
|
9677
|
+
const fieldsSection = depth === 1 ? `### Fields to generate (depth 1 — intent only)
|
|
9678
|
+
**title** — Short descriptive name (5-10 words)
|
|
9679
|
+
**problem** — What problem does this code solve? 1-2 sentences.
|
|
9680
|
+
**domain** — Single lowercase word or hyphenated phrase (e.g. "auth", "data-pipeline")
|
|
9681
|
+
**tags** — 3-6 lowercase tags as JSON array: ["tag1", "tag2"]
|
|
9682
|
+
**analysis** — Architectural overview, key patterns, why they were chosen. 150-300 words.
|
|
9683
|
+
**decisions** — 2-4 key technical decisions as JSON array: [{"decision":"...","rationale":"...","alternativesConsidered":["..."]}]
|
|
9684
|
+
**knownLimitations** — 2-4 limitations/trade-offs as JSON array: ["..."]
|
|
9685
|
+
**successCriteria** — How do we know this works? 1-3 testable sentences.
|
|
9686
|
+
**userGuide** — Plain-language description for an end user (not a developer). What does this do and why does it help? 2-4 sentences.` : depth === 2 ? `### Fields to generate (depth 2 — intent + API surface)
|
|
9687
|
+
**title** — Short descriptive name (5-10 words)
|
|
9688
|
+
**problem** — What problem does this code solve? 1-2 sentences.
|
|
9689
|
+
**domain** — Single lowercase word or hyphenated phrase (e.g. "auth", "data-pipeline")
|
|
9690
|
+
**tags** — 3-6 lowercase tags as JSON array: ["tag1", "tag2"]
|
|
9691
|
+
**analysis** — Architectural overview, key patterns, why they were chosen. 150-300 words.
|
|
9692
|
+
**decisions** — 2-4 key technical decisions as JSON array: [{"decision":"...","rationale":"...","alternativesConsidered":["..."]}]
|
|
9693
|
+
**implementation** — Main components, data flow, non-obvious patterns. 100-200 words.
|
|
9694
|
+
**knownLimitations** — 2-4 limitations/trade-offs as JSON array: ["..."]
|
|
9695
|
+
**successCriteria** — How do we know this works? 1-3 testable sentences.
|
|
9696
|
+
**userGuide** — Plain-language description for an end user. 2-4 sentences.
|
|
9697
|
+
**componentFile** — Relative path to the primary source file (e.g. "src/index.ts")
|
|
9698
|
+
**npmPackages** — Runtime npm packages this feature depends on as JSON array: ["pkg"]. Use [] if none.
|
|
9699
|
+
**publicInterface** — Exported functions/types/props as JSON array with FULL TypeScript signatures: [{"name":"...","type":"(arg: Type) => ReturnType","description":"..."}]
|
|
9700
|
+
**externalDependencies** — Cross-feature runtime deps not in lineage as JSON array: ["feat-key-or-path"]. Use [] if none.` : `### Fields to generate (depth 3 — full spec)
|
|
9701
|
+
**title** — Short descriptive name (5-10 words)
|
|
9702
|
+
**problem** — What problem does this code solve? 1-2 sentences.
|
|
9703
|
+
**domain** — Single lowercase word or hyphenated phrase (e.g. "auth", "data-pipeline")
|
|
9704
|
+
**tags** — 3-6 lowercase tags as JSON array: ["tag1", "tag2"]
|
|
9705
|
+
**analysis** — Architectural overview, key patterns, why they were chosen. 150-300 words.
|
|
9706
|
+
**decisions** — 2-4 key technical decisions as JSON array: [{"decision":"...","rationale":"...","alternativesConsidered":["..."]}]
|
|
9707
|
+
**implementation** — Main components, data flow, non-obvious patterns. 100-200 words.
|
|
9708
|
+
**knownLimitations** — 2-4 limitations/TODOs as JSON array: ["..."]
|
|
9709
|
+
**successCriteria** — How do we know this works? 1-3 testable sentences.
|
|
9710
|
+
**userGuide** — Plain-language description for an end user. 2-4 sentences.
|
|
9711
|
+
**componentFile** — Relative path to the primary source file (e.g. "src/index.ts")
|
|
9712
|
+
**npmPackages** — Runtime npm packages as JSON array. Use [] if none.
|
|
9713
|
+
**publicInterface** — Exported functions/types/props with FULL TypeScript signatures: [{"name":"...","type":"(arg: Type) => ReturnType","description":"..."}]
|
|
9714
|
+
**externalDependencies** — Cross-feature runtime deps as JSON array. Use [] if none.
|
|
9715
|
+
**codeSnippets** — Critical one-liners worth preserving verbatim as JSON array: [{"label":"...","snippet":"..."}]
|
|
9716
|
+
**toolingAnnotations** — Coverage/lint/type suppression directives needed for CI as JSON array: [{"tool":"...","directive":"...","location":"...","reason":"..."}]. Use [] if none.`;
|
|
9308
9717
|
return { content: [{
|
|
9309
9718
|
type: "text",
|
|
9310
9719
|
text: `${`## Extract feature.json from existing code
|
|
9311
9720
|
|
|
9312
9721
|
No feature.json exists at "${dir}". Analyze the ${ctx.sourceFiles.length} source file(s) below and generate a complete feature.json proposal.
|
|
9313
9722
|
|
|
9723
|
+
Extraction mode: **${depthLabel}**${depthNote}
|
|
9724
|
+
|
|
9725
|
+
${granularityHint}
|
|
9726
|
+
|
|
9314
9727
|
When done, execute in order:
|
|
9315
9728
|
1. Call create_feature with: dir="${dir}", plus your generated title and problem
|
|
9316
|
-
2. Call write_feature_fields with: path="${dir}",
|
|
9729
|
+
2. Call write_feature_fields with: path="${dir}", and the fields listed below
|
|
9317
9730
|
3. Call advance_feature to transition when ready
|
|
9318
9731
|
|
|
9319
|
-
|
|
9320
|
-
**title** — Short descriptive name (5-10 words)
|
|
9321
|
-
**problem** — What problem does this code solve? 1-2 sentences.
|
|
9322
|
-
**domain** — Single lowercase word or hyphenated phrase (e.g. "auth", "data-pipeline")
|
|
9323
|
-
**tags** — 3-6 lowercase tags as JSON array: ["tag1", "tag2"]
|
|
9324
|
-
**analysis** — Architectural overview, key patterns, why they were chosen. 150-300 words.
|
|
9325
|
-
**decisions** — 2-4 key technical decisions as JSON array: [{"decision":"...","rationale":"...","alternativesConsidered":["..."]}]
|
|
9326
|
-
**implementation** — Main components, data flow, non-obvious patterns. 100-200 words.
|
|
9327
|
-
**knownLimitations** — 2-4 limitations/TODOs as JSON array: ["..."]
|
|
9328
|
-
**successCriteria** — How do we know this works? 1-3 testable sentences.`}\n\n## Source files\n\n${rawContext}`
|
|
9732
|
+
${fieldsSection}`}\n\n## Source files\n\n${rawContext}`
|
|
9329
9733
|
}] };
|
|
9330
9734
|
}
|
|
9331
9735
|
case "feature_changelog": {
|
|
@@ -9381,12 +9785,12 @@ When done, execute in order:
|
|
|
9381
9785
|
date: ann.date,
|
|
9382
9786
|
label: `[${ann.type}] ${ann.body} (by ${ann.author})`
|
|
9383
9787
|
});
|
|
9384
|
-
const annotatedChildren = new Set((feature.annotations ?? []).filter((a
|
|
9788
|
+
const annotatedChildren = new Set((feature.annotations ?? []).filter((a) => a.type === "spawn").map((a) => a.body));
|
|
9385
9789
|
for (const child of feature.lineage?.children ?? []) if (!annotatedChildren.has(child)) events.push({
|
|
9386
9790
|
date: "(unknown)",
|
|
9387
9791
|
label: `↳ spawned child: ${child}`
|
|
9388
9792
|
});
|
|
9389
|
-
events.sort((a
|
|
9793
|
+
events.sort((a, b) => a.date.localeCompare(b.date));
|
|
9390
9794
|
const decisionsLine = feature.decisions?.length ? `\nDecisions: ${feature.decisions.map((d) => `"${d.decision}"`).join(" · ")}` : "";
|
|
9391
9795
|
return { content: [{
|
|
9392
9796
|
type: "text",
|
|
@@ -9405,10 +9809,10 @@ When done, execute in order:
|
|
|
9405
9809
|
const group = byStatus[f.feature.status];
|
|
9406
9810
|
if (group) group.push(f);
|
|
9407
9811
|
}
|
|
9408
|
-
for (const group of Object.values(byStatus)) group.sort((a
|
|
9409
|
-
const pa = a
|
|
9812
|
+
for (const group of Object.values(byStatus)) group.sort((a, b) => {
|
|
9813
|
+
const pa = a.feature.priority ?? 9999;
|
|
9410
9814
|
const pb = b.feature.priority ?? 9999;
|
|
9411
|
-
return pa !== pb ? pa - pb : a
|
|
9815
|
+
return pa !== pb ? pa - pb : a.feature.featureKey.localeCompare(b.feature.featureKey);
|
|
9412
9816
|
});
|
|
9413
9817
|
const formatGroup = (status, items) => {
|
|
9414
9818
|
if (items.length === 0) return "";
|
|
@@ -9543,18 +9947,18 @@ Analyze the source files and determine whether this feature should be broken int
|
|
|
9543
9947
|
const scanDir = a.path ? resolvePath(String(a.path)) : workspaceRoot;
|
|
9544
9948
|
const format = a.format === "json" ? "json" : "markdown";
|
|
9545
9949
|
function readReadmeSummary(dir) {
|
|
9546
|
-
for (const name
|
|
9950
|
+
for (const name of [
|
|
9547
9951
|
"README.md",
|
|
9548
9952
|
"readme.md",
|
|
9549
9953
|
"Readme.md"
|
|
9550
9954
|
]) {
|
|
9551
|
-
const p = path.join(dir, name
|
|
9955
|
+
const p = path.join(dir, name);
|
|
9552
9956
|
if (!fs.existsSync(p)) continue;
|
|
9553
9957
|
try {
|
|
9554
|
-
const lines
|
|
9958
|
+
const lines = fs.readFileSync(p, "utf-8").split("\n");
|
|
9555
9959
|
const parts = [];
|
|
9556
9960
|
let started = false;
|
|
9557
|
-
for (const line of lines
|
|
9961
|
+
for (const line of lines) {
|
|
9558
9962
|
if (!started && line.trim()) started = true;
|
|
9559
9963
|
if (!started) continue;
|
|
9560
9964
|
parts.push(line);
|
|
@@ -9588,7 +9992,7 @@ Analyze the source files and determine whether this feature should be broken int
|
|
|
9588
9992
|
for (const { feature } of allFeatures) {
|
|
9589
9993
|
const s = feature.status;
|
|
9590
9994
|
if (s in statusCounts) statusCounts[s] = (statusCounts[s] ?? 0) + 1;
|
|
9591
|
-
if (feature.annotations?.some((a
|
|
9995
|
+
if (feature.annotations?.some((a) => a.type === "stale-review")) staleCount++;
|
|
9592
9996
|
}
|
|
9593
9997
|
const byDomain = /* @__PURE__ */ new Map();
|
|
9594
9998
|
const noDomain = [];
|
|
@@ -9645,7 +10049,7 @@ Analyze the source files and determine whether this feature should be broken int
|
|
|
9645
10049
|
const readmeLine = readme ? `\n ${(readme.split("\n")[0] ?? "").replace(/^#+\s*/, "").slice(0, 80)}` : "";
|
|
9646
10050
|
return ` ${statusIcon(feature.status)} ${feature.featureKey.padEnd(18)} ${feature.title}${tags}${dec}\n ${problem}${readmeLine}`;
|
|
9647
10051
|
};
|
|
9648
|
-
for (const [domain, features] of [...byDomain.entries()].sort(([a
|
|
10052
|
+
for (const [domain, features] of [...byDomain.entries()].sort(([a], [b]) => a.localeCompare(b))) {
|
|
9649
10053
|
lines.push(`### ${domain}`);
|
|
9650
10054
|
for (const { feature, filePath } of features) lines.push(formatRow(feature, filePath));
|
|
9651
10055
|
lines.push("");
|
|
@@ -9664,6 +10068,111 @@ Analyze the source files and determine whether this feature should be broken int
|
|
|
9664
10068
|
case "feature_similarity": return { ...handleFeatureSimilarity(a, workspaceRoot) };
|
|
9665
10069
|
case "time_travel": return { ...handleTimeTravel(a, workspaceRoot) };
|
|
9666
10070
|
case "cross_feature_impact": return { ...handleCrossFeatureImpact(a, workspaceRoot) };
|
|
10071
|
+
case "lock_feature_fields": {
|
|
10072
|
+
const featureDir = resolvePath(String(a.path));
|
|
10073
|
+
const featurePath = path.join(featureDir, "feature.json");
|
|
10074
|
+
let rawStr;
|
|
10075
|
+
try {
|
|
10076
|
+
rawStr = fs.readFileSync(featurePath, "utf-8");
|
|
10077
|
+
} catch {
|
|
10078
|
+
return {
|
|
10079
|
+
content: [{
|
|
10080
|
+
type: "text",
|
|
10081
|
+
text: `No feature.json found at "${featurePath}"`
|
|
10082
|
+
}],
|
|
10083
|
+
isError: true
|
|
10084
|
+
};
|
|
10085
|
+
}
|
|
10086
|
+
const raw = JSON.parse(rawStr);
|
|
10087
|
+
const action = String(a.action);
|
|
10088
|
+
const author = a.author ? String(a.author) : "Claude (MCP)";
|
|
10089
|
+
const reason = a.reason ? String(a.reason) : void 0;
|
|
10090
|
+
const _dl = /* @__PURE__ */ new Date();
|
|
10091
|
+
const lockedAt = `${_dl.getFullYear()}-${String(_dl.getMonth() + 1).padStart(2, "0")}-${String(_dl.getDate()).padStart(2, "0")}`;
|
|
10092
|
+
const existingLocks = raw.fieldLocks ?? [];
|
|
10093
|
+
if (action === "status") {
|
|
10094
|
+
const featureLocked = raw.featureLocked === true;
|
|
10095
|
+
const lines = [`🔒 Lock status for ${String(raw.featureKey)}`];
|
|
10096
|
+
if (featureLocked) lines.push(" ⚡ featureLocked: true — ALL fields are AI-locked");
|
|
10097
|
+
if (existingLocks.length > 0) {
|
|
10098
|
+
lines.push(" Per-field locks:");
|
|
10099
|
+
for (const l of existingLocks) lines.push(` 🔒 ${l.field.padEnd(24)} by ${l.lockedBy} on ${l.lockedAt}${l.reason ? ` — ${l.reason}` : ""}`);
|
|
10100
|
+
} else if (!featureLocked) lines.push(" No per-field locks set.");
|
|
10101
|
+
return { content: [{
|
|
10102
|
+
type: "text",
|
|
10103
|
+
text: lines.join("\n")
|
|
10104
|
+
}] };
|
|
10105
|
+
}
|
|
10106
|
+
if (action === "freeze") {
|
|
10107
|
+
if (raw.featureLocked === true) return { content: [{
|
|
10108
|
+
type: "text",
|
|
10109
|
+
text: `${String(raw.featureKey)} is already fully locked.`
|
|
10110
|
+
}] };
|
|
10111
|
+
raw.featureLocked = true;
|
|
10112
|
+
fs.writeFileSync(featurePath, JSON.stringify(raw, null, 2) + "\n", "utf-8");
|
|
10113
|
+
return { content: [{
|
|
10114
|
+
type: "text",
|
|
10115
|
+
text: `⚡ ${String(raw.featureKey)} is now fully AI-locked (featureLocked: true).\nAI tools will refuse to write any field without override: true.`
|
|
10116
|
+
}] };
|
|
10117
|
+
}
|
|
10118
|
+
if (action === "thaw") {
|
|
10119
|
+
if (!raw.featureLocked) return { content: [{
|
|
10120
|
+
type: "text",
|
|
10121
|
+
text: `${String(raw.featureKey)} is not fully locked — nothing to thaw.`
|
|
10122
|
+
}] };
|
|
10123
|
+
delete raw.featureLocked;
|
|
10124
|
+
fs.writeFileSync(featurePath, JSON.stringify(raw, null, 2) + "\n", "utf-8");
|
|
10125
|
+
return { content: [{
|
|
10126
|
+
type: "text",
|
|
10127
|
+
text: `🔓 ${String(raw.featureKey)}: featureLocked removed. Per-field locks (if any) remain.`
|
|
10128
|
+
}] };
|
|
10129
|
+
}
|
|
10130
|
+
const fields = a.fields ?? [];
|
|
10131
|
+
if (fields.length === 0) return {
|
|
10132
|
+
content: [{
|
|
10133
|
+
type: "text",
|
|
10134
|
+
text: `"fields" array is required for action "${action}"`
|
|
10135
|
+
}],
|
|
10136
|
+
isError: true
|
|
10137
|
+
};
|
|
10138
|
+
if (action === "lock") {
|
|
10139
|
+
const existingSet = new Set(existingLocks.map((l) => l.field));
|
|
10140
|
+
const newLocks = fields.filter((f) => !existingSet.has(f)).map((field) => ({
|
|
10141
|
+
field,
|
|
10142
|
+
lockedBy: author,
|
|
10143
|
+
lockedAt,
|
|
10144
|
+
...reason ? { reason } : {}
|
|
10145
|
+
}));
|
|
10146
|
+
const alreadyLocked = fields.filter((f) => existingSet.has(f));
|
|
10147
|
+
raw.fieldLocks = [...existingLocks, ...newLocks];
|
|
10148
|
+
fs.writeFileSync(featurePath, JSON.stringify(raw, null, 2) + "\n", "utf-8");
|
|
10149
|
+
const lines = newLocks.map((l) => ` 🔒 ${l.field}${l.reason ? ` — ${l.reason}` : ""}`);
|
|
10150
|
+
if (alreadyLocked.length > 0) lines.push(` Already locked: ${alreadyLocked.join(", ")}`);
|
|
10151
|
+
return { content: [{
|
|
10152
|
+
type: "text",
|
|
10153
|
+
text: `Locked ${newLocks.length} field(s) in ${String(raw.featureKey)}:\n${lines.join("\n")}\n\nread_feature_context will now skip these fields. write_feature_fields will warn (or block) if these fields are in a write request.`
|
|
10154
|
+
}] };
|
|
10155
|
+
}
|
|
10156
|
+
if (action === "unlock") {
|
|
10157
|
+
const toRemove = new Set(fields);
|
|
10158
|
+
const after = existingLocks.filter((l) => !toRemove.has(l.field));
|
|
10159
|
+
const removed = existingLocks.filter((l) => toRemove.has(l.field)).map((l) => l.field);
|
|
10160
|
+
raw.fieldLocks = after.length > 0 ? after : void 0;
|
|
10161
|
+
if (raw.fieldLocks === void 0) delete raw.fieldLocks;
|
|
10162
|
+
fs.writeFileSync(featurePath, JSON.stringify(raw, null, 2) + "\n", "utf-8");
|
|
10163
|
+
return { content: [{
|
|
10164
|
+
type: "text",
|
|
10165
|
+
text: `🔓 Unlocked ${removed.length} field(s): ${removed.join(", ")}`
|
|
10166
|
+
}] };
|
|
10167
|
+
}
|
|
10168
|
+
return {
|
|
10169
|
+
content: [{
|
|
10170
|
+
type: "text",
|
|
10171
|
+
text: `Unknown action: "${action}"`
|
|
10172
|
+
}],
|
|
10173
|
+
isError: true
|
|
10174
|
+
};
|
|
10175
|
+
}
|
|
9667
10176
|
case "extract_all_features": {
|
|
9668
10177
|
const toUnix = (p) => p.replace(/\\/g, "/");
|
|
9669
10178
|
const scanRoot = a.path ? resolvePath(String(a.path)) : workspaceRoot;
|
|
@@ -9752,9 +10261,9 @@ Analyze the source files and determine whether this feature should be broken int
|
|
|
9752
10261
|
else if (depth > 0) {
|
|
9753
10262
|
const signals = [];
|
|
9754
10263
|
let sourceFileCount = 0;
|
|
9755
|
-
for (const name
|
|
9756
|
-
if (MODULE_SIGNALS.has(name
|
|
9757
|
-
if (SOURCE_EXTS.has(path.extname(name
|
|
10264
|
+
for (const name of names) {
|
|
10265
|
+
if (MODULE_SIGNALS.has(name) || name.endsWith(".csproj")) signals.push(name);
|
|
10266
|
+
if (SOURCE_EXTS.has(path.extname(name))) sourceFileCount++;
|
|
9758
10267
|
}
|
|
9759
10268
|
if (strategy === "module" ? signals.length > 0 : sourceFileCount > 0) candidates.push({
|
|
9760
10269
|
dir,
|
|
@@ -9771,7 +10280,7 @@ Analyze the source files and determine whether this feature should be broken int
|
|
|
9771
10280
|
}
|
|
9772
10281
|
}
|
|
9773
10282
|
mcpWalk(scanRoot, 0);
|
|
9774
|
-
candidates.sort((a
|
|
10283
|
+
candidates.sort((a, b) => a.dir.split(path.sep).length - b.dir.split(path.sep).length);
|
|
9775
10284
|
const candidateDirs = new Set(candidates.map((c) => c.dir));
|
|
9776
10285
|
for (const c of candidates) {
|
|
9777
10286
|
let parent = path.dirname(c.dir);
|
|
@@ -9903,11 +10412,7 @@ function statusIcon(status) {
|
|
|
9903
10412
|
deprecated: "⊘"
|
|
9904
10413
|
}[status] ?? "?";
|
|
9905
10414
|
}
|
|
9906
|
-
const REQUIRED_FOR_ACTIVE = [
|
|
9907
|
-
"analysis",
|
|
9908
|
-
"implementation",
|
|
9909
|
-
"successCriteria"
|
|
9910
|
-
];
|
|
10415
|
+
const REQUIRED_FOR_ACTIVE = ["analysis"];
|
|
9911
10416
|
const REQUIRED_FOR_FROZEN = [
|
|
9912
10417
|
"analysis",
|
|
9913
10418
|
"implementation",
|
|
@@ -9918,9 +10423,9 @@ const REQUIRED_FOR_FROZEN = [
|
|
|
9918
10423
|
"componentFile"
|
|
9919
10424
|
];
|
|
9920
10425
|
function getMissingForTransition(feature, to) {
|
|
9921
|
-
const required
|
|
10426
|
+
const required = to === "active" ? REQUIRED_FOR_ACTIVE : to === "frozen" ? REQUIRED_FOR_FROZEN : [];
|
|
9922
10427
|
const missing = [];
|
|
9923
|
-
for (const field of required
|
|
10428
|
+
for (const field of required) {
|
|
9924
10429
|
const val = feature[field];
|
|
9925
10430
|
if (val === void 0 || val === null) {
|
|
9926
10431
|
missing.push(field);
|
|
@@ -9935,7 +10440,7 @@ function getMissingForTransition(feature, to) {
|
|
|
9935
10440
|
continue;
|
|
9936
10441
|
}
|
|
9937
10442
|
}
|
|
9938
|
-
if (
|
|
10443
|
+
if (to === "frozen" && (!feature.decisions || feature.decisions.length === 0)) missing.push("decisions");
|
|
9939
10444
|
return [...new Set(missing)];
|
|
9940
10445
|
}
|
|
9941
10446
|
function checkIllegalTransition(from, to) {
|
|
@@ -9953,6 +10458,5 @@ main().catch((err) => {
|
|
|
9953
10458
|
process$1.stderr.write(`Fatal: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
9954
10459
|
process$1.exit(1);
|
|
9955
10460
|
});
|
|
9956
|
-
|
|
9957
10461
|
//#endregion
|
|
9958
|
-
export {
|
|
10462
|
+
export {};
|