@majeanson/lac 3.2.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 +14383 -1040
- package/dist/index.mjs.map +1 -1
- package/dist/lsp.mjs +572 -635
- package/dist/mcp.mjs +1044 -516
- 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),
|
|
@@ -3784,14 +3770,17 @@ const FeatureSchema$1 = object$1({
|
|
|
3784
3770
|
superseded_from: array$1(string$2().regex(FEATURE_KEY_PATTERN$1, "each superseded_from entry must be a valid featureKey")).optional(),
|
|
3785
3771
|
merged_into: string$2().regex(FEATURE_KEY_PATTERN$1, "merged_into must be a valid featureKey").optional(),
|
|
3786
3772
|
merged_from: array$1(string$2().regex(FEATURE_KEY_PATTERN$1, "each merged_from entry must be a valid featureKey")).optional(),
|
|
3773
|
+
userGuide: string$2().optional(),
|
|
3787
3774
|
componentFile: string$2().optional(),
|
|
3788
3775
|
npmPackages: array$1(string$2()).optional(),
|
|
3789
3776
|
publicInterface: array$1(PublicInterfaceEntrySchema$1).optional(),
|
|
3790
3777
|
externalDependencies: array$1(string$2()).optional(),
|
|
3791
3778
|
lastVerifiedDate: string$2().regex(/^\d{4}-\d{2}-\d{2}$/, "lastVerifiedDate must be YYYY-MM-DD").optional(),
|
|
3792
|
-
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()
|
|
3793
3783
|
});
|
|
3794
|
-
|
|
3795
3784
|
//#endregion
|
|
3796
3785
|
//#region ../feature-schema/dist/validate.mjs
|
|
3797
3786
|
function validateFeature(data) {
|
|
@@ -3802,12 +3791,13 @@ function validateFeature(data) {
|
|
|
3802
3791
|
};
|
|
3803
3792
|
return {
|
|
3804
3793
|
success: false,
|
|
3805
|
-
errors: result.error.issues.map((issue
|
|
3806
|
-
|
|
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}`;
|
|
3807
3798
|
})
|
|
3808
3799
|
};
|
|
3809
3800
|
}
|
|
3810
|
-
|
|
3811
3801
|
//#endregion
|
|
3812
3802
|
//#region ../feature-schema/dist/keygen.mjs
|
|
3813
3803
|
const LAC_DIR = ".lac";
|
|
@@ -3936,7 +3926,6 @@ function registerFeatureKey(fromDir, key) {
|
|
|
3936
3926
|
fs.renameSync(counterTmp, counterPath);
|
|
3937
3927
|
fs.renameSync(keysTmp, keysPath);
|
|
3938
3928
|
}
|
|
3939
|
-
|
|
3940
3929
|
//#endregion
|
|
3941
3930
|
//#region ../lac-mcp/src/tools/analysis.ts
|
|
3942
3931
|
function scanFeatures$1(dir) {
|
|
@@ -3978,8 +3967,8 @@ const RISK_KEYWORDS = [
|
|
|
3978
3967
|
"short-term",
|
|
3979
3968
|
"quick fix"
|
|
3980
3969
|
];
|
|
3981
|
-
function handleAuditDecisions(a, workspaceRoot
|
|
3982
|
-
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);
|
|
3983
3972
|
const missingDecisions = [];
|
|
3984
3973
|
const flaggedDecisions = [];
|
|
3985
3974
|
const unaddressedReopens = [];
|
|
@@ -4003,7 +3992,7 @@ function handleAuditDecisions(a, workspaceRoot$1) {
|
|
|
4003
3992
|
hasIssue = true;
|
|
4004
3993
|
}
|
|
4005
3994
|
}
|
|
4006
|
-
const staleAnnotation = feature.annotations?.find((a
|
|
3995
|
+
const staleAnnotation = feature.annotations?.find((a) => a.type === "stale-review");
|
|
4007
3996
|
if (staleAnnotation) {
|
|
4008
3997
|
unaddressedReopens.push(` ${feature.featureKey.padEnd(20)} ${feature.status.padEnd(10)} — ${staleAnnotation.body}`);
|
|
4009
3998
|
hasIssue = true;
|
|
@@ -4038,7 +4027,7 @@ function handleAuditDecisions(a, workspaceRoot$1) {
|
|
|
4038
4027
|
text: sections.join("\n\n")
|
|
4039
4028
|
}] };
|
|
4040
4029
|
}
|
|
4041
|
-
function handleFeatureSimilarity(a, workspaceRoot
|
|
4030
|
+
function handleFeatureSimilarity(a, workspaceRoot) {
|
|
4042
4031
|
if (!a.path) return {
|
|
4043
4032
|
content: [{
|
|
4044
4033
|
type: "text",
|
|
@@ -4046,7 +4035,7 @@ function handleFeatureSimilarity(a, workspaceRoot$1) {
|
|
|
4046
4035
|
}],
|
|
4047
4036
|
isError: true
|
|
4048
4037
|
};
|
|
4049
|
-
const featureDir = resolve(String(a.path), workspaceRoot
|
|
4038
|
+
const featureDir = resolve(String(a.path), workspaceRoot);
|
|
4050
4039
|
const featurePath = path.join(featureDir, "feature.json");
|
|
4051
4040
|
let raw;
|
|
4052
4041
|
try {
|
|
@@ -4071,7 +4060,7 @@ function handleFeatureSimilarity(a, workspaceRoot$1) {
|
|
|
4071
4060
|
const target = result.data;
|
|
4072
4061
|
const targetTags = new Set(target.tags ?? []);
|
|
4073
4062
|
const targetWords = new Set((target.title + " " + target.problem).toLowerCase().split(/\W+/).filter((w) => w.length > 4));
|
|
4074
|
-
const allFeatures = scanFeatures$1(workspaceRoot
|
|
4063
|
+
const allFeatures = scanFeatures$1(workspaceRoot);
|
|
4075
4064
|
const matches = [];
|
|
4076
4065
|
for (const { feature } of allFeatures) {
|
|
4077
4066
|
if (feature.featureKey === target.featureKey) continue;
|
|
@@ -4099,7 +4088,7 @@ function handleFeatureSimilarity(a, workspaceRoot$1) {
|
|
|
4099
4088
|
reasons
|
|
4100
4089
|
});
|
|
4101
4090
|
}
|
|
4102
|
-
matches.sort((a
|
|
4091
|
+
matches.sort((a, b) => b.score - a.score);
|
|
4103
4092
|
if (matches.length === 0) return { content: [{
|
|
4104
4093
|
type: "text",
|
|
4105
4094
|
text: `No similar features found for "${target.featureKey} — ${target.title}".`
|
|
@@ -4110,10 +4099,9 @@ function handleFeatureSimilarity(a, workspaceRoot$1) {
|
|
|
4110
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")
|
|
4111
4100
|
}] };
|
|
4112
4101
|
}
|
|
4113
|
-
|
|
4114
4102
|
//#endregion
|
|
4115
4103
|
//#region ../lac-mcp/src/tools/git-tools.ts
|
|
4116
|
-
function handleTimeTravel(a, workspaceRoot
|
|
4104
|
+
function handleTimeTravel(a, workspaceRoot) {
|
|
4117
4105
|
if (!a.path) return {
|
|
4118
4106
|
content: [{
|
|
4119
4107
|
type: "text",
|
|
@@ -4121,7 +4109,7 @@ function handleTimeTravel(a, workspaceRoot$1) {
|
|
|
4121
4109
|
}],
|
|
4122
4110
|
isError: true
|
|
4123
4111
|
};
|
|
4124
|
-
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));
|
|
4125
4113
|
const featurePath = path.join(featureDir, "feature.json");
|
|
4126
4114
|
let gitRoot;
|
|
4127
4115
|
try {
|
|
@@ -4223,7 +4211,6 @@ function handleTimeTravel(a, workspaceRoot$1) {
|
|
|
4223
4211
|
text: `feature.json at: ${commitInfo}${newerCommits.length > 0 ? `\n\n[${newerCommits.length} commit(s) made after this snapshot]` : ""}\n\n${displayContent}`
|
|
4224
4212
|
}] };
|
|
4225
4213
|
}
|
|
4226
|
-
|
|
4227
4214
|
//#endregion
|
|
4228
4215
|
//#region ../lac-mcp/src/tools/impact.ts
|
|
4229
4216
|
const SOURCE_EXTENSIONS$1 = new Set([
|
|
@@ -4293,7 +4280,7 @@ function findOwningFeatureKey(filePath) {
|
|
|
4293
4280
|
current = parent;
|
|
4294
4281
|
}
|
|
4295
4282
|
}
|
|
4296
|
-
function handleCrossFeatureImpact(a, workspaceRoot
|
|
4283
|
+
function handleCrossFeatureImpact(a, workspaceRoot) {
|
|
4297
4284
|
if (!a.file) return {
|
|
4298
4285
|
content: [{
|
|
4299
4286
|
type: "text",
|
|
@@ -4301,7 +4288,7 @@ function handleCrossFeatureImpact(a, workspaceRoot$1) {
|
|
|
4301
4288
|
}],
|
|
4302
4289
|
isError: true
|
|
4303
4290
|
};
|
|
4304
|
-
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));
|
|
4305
4292
|
if (!fs.existsSync(targetFile)) return {
|
|
4306
4293
|
content: [{
|
|
4307
4294
|
type: "text",
|
|
@@ -4311,14 +4298,14 @@ function handleCrossFeatureImpact(a, workspaceRoot$1) {
|
|
|
4311
4298
|
};
|
|
4312
4299
|
const targetBasename = path.basename(targetFile);
|
|
4313
4300
|
const targetNoExt = path.basename(targetFile, path.extname(targetFile));
|
|
4314
|
-
const targetRelFromRoot = path.relative(workspaceRoot
|
|
4301
|
+
const targetRelFromRoot = path.relative(workspaceRoot, targetFile).replace(/\\/g, "/");
|
|
4315
4302
|
const patterns = [...new Set([
|
|
4316
4303
|
targetBasename,
|
|
4317
4304
|
targetNoExt,
|
|
4318
4305
|
targetRelFromRoot
|
|
4319
4306
|
])];
|
|
4320
4307
|
const owningKey = findOwningFeatureKey(targetFile);
|
|
4321
|
-
const features = scanFeatures(workspaceRoot
|
|
4308
|
+
const features = scanFeatures(workspaceRoot);
|
|
4322
4309
|
const impacts = [];
|
|
4323
4310
|
for (const { feature, filePath: featureJsonPath } of features) {
|
|
4324
4311
|
if (feature.featureKey === owningKey) continue;
|
|
@@ -4344,7 +4331,7 @@ function handleCrossFeatureImpact(a, workspaceRoot$1) {
|
|
|
4344
4331
|
});
|
|
4345
4332
|
}
|
|
4346
4333
|
const lines = [
|
|
4347
|
-
`Impact analysis: ${path.relative(workspaceRoot
|
|
4334
|
+
`Impact analysis: ${path.relative(workspaceRoot, targetFile)}`,
|
|
4348
4335
|
"─".repeat(50),
|
|
4349
4336
|
owningKey ? `Owned by : ${owningKey}` : "No owning feature found (untracked file)"
|
|
4350
4337
|
];
|
|
@@ -4364,11 +4351,10 @@ function handleCrossFeatureImpact(a, workspaceRoot$1) {
|
|
|
4364
4351
|
text: lines.join("\n")
|
|
4365
4352
|
}] };
|
|
4366
4353
|
}
|
|
4367
|
-
|
|
4368
4354
|
//#endregion
|
|
4369
4355
|
//#region ../lac-claude/dist/index.mjs
|
|
4370
4356
|
Object.freeze({ status: "aborted" });
|
|
4371
|
-
function $constructor(name, initializer
|
|
4357
|
+
function $constructor(name, initializer, params) {
|
|
4372
4358
|
function init(inst, def) {
|
|
4373
4359
|
if (!inst._zod) Object.defineProperty(inst, "_zod", {
|
|
4374
4360
|
value: {
|
|
@@ -4380,7 +4366,7 @@ function $constructor(name, initializer$2$1, params) {
|
|
|
4380
4366
|
});
|
|
4381
4367
|
if (inst._zod.traits.has(name)) return;
|
|
4382
4368
|
inst._zod.traits.add(name);
|
|
4383
|
-
initializer
|
|
4369
|
+
initializer(inst, def);
|
|
4384
4370
|
const proto = _.prototype;
|
|
4385
4371
|
const keys = Object.keys(proto);
|
|
4386
4372
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -4392,10 +4378,10 @@ function $constructor(name, initializer$2$1, params) {
|
|
|
4392
4378
|
class Definition extends Parent {}
|
|
4393
4379
|
Object.defineProperty(Definition, "name", { value: name });
|
|
4394
4380
|
function _(def) {
|
|
4395
|
-
var _a
|
|
4381
|
+
var _a;
|
|
4396
4382
|
const inst = params?.Parent ? new Definition() : this;
|
|
4397
4383
|
init(inst, def);
|
|
4398
|
-
(_a
|
|
4384
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
4399
4385
|
for (const fn of inst._zod.deferred) fn();
|
|
4400
4386
|
return inst;
|
|
4401
4387
|
}
|
|
@@ -4461,9 +4447,9 @@ function floatSafeRemainder(val, step) {
|
|
|
4461
4447
|
return Number.parseInt(val.toFixed(decCount).replace(".", "")) % Number.parseInt(step.toFixed(decCount).replace(".", "")) / 10 ** decCount;
|
|
4462
4448
|
}
|
|
4463
4449
|
const EVALUATING = Symbol("evaluating");
|
|
4464
|
-
function defineLazy(object
|
|
4450
|
+
function defineLazy(object, key, getter) {
|
|
4465
4451
|
let value = void 0;
|
|
4466
|
-
Object.defineProperty(object
|
|
4452
|
+
Object.defineProperty(object, key, {
|
|
4467
4453
|
get() {
|
|
4468
4454
|
if (value === EVALUATING) return;
|
|
4469
4455
|
if (value === void 0) {
|
|
@@ -4473,7 +4459,7 @@ function defineLazy(object$1$1, key, getter) {
|
|
|
4473
4459
|
return value;
|
|
4474
4460
|
},
|
|
4475
4461
|
set(v) {
|
|
4476
|
-
Object.defineProperty(object
|
|
4462
|
+
Object.defineProperty(object, key, { value: v });
|
|
4477
4463
|
},
|
|
4478
4464
|
configurable: true
|
|
4479
4465
|
});
|
|
@@ -4488,10 +4474,7 @@ function assignProp(target, prop, value) {
|
|
|
4488
4474
|
}
|
|
4489
4475
|
function mergeDefs(...defs) {
|
|
4490
4476
|
const mergedDescriptors = {};
|
|
4491
|
-
for (const def of defs)
|
|
4492
|
-
const descriptors = Object.getOwnPropertyDescriptors(def);
|
|
4493
|
-
Object.assign(mergedDescriptors, descriptors);
|
|
4494
|
-
}
|
|
4477
|
+
for (const def of defs) Object.assign(mergedDescriptors, Object.getOwnPropertyDescriptors(def));
|
|
4495
4478
|
return Object.defineProperties({}, mergedDescriptors);
|
|
4496
4479
|
}
|
|
4497
4480
|
function esc(str) {
|
|
@@ -4697,23 +4680,23 @@ function aborted(x, startIndex = 0) {
|
|
|
4697
4680
|
for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
|
|
4698
4681
|
return false;
|
|
4699
4682
|
}
|
|
4700
|
-
function prefixIssues(path
|
|
4683
|
+
function prefixIssues(path, issues) {
|
|
4701
4684
|
return issues.map((iss) => {
|
|
4702
|
-
var _a
|
|
4703
|
-
(_a
|
|
4704
|
-
iss.path.unshift(path
|
|
4685
|
+
var _a;
|
|
4686
|
+
(_a = iss).path ?? (_a.path = []);
|
|
4687
|
+
iss.path.unshift(path);
|
|
4705
4688
|
return iss;
|
|
4706
4689
|
});
|
|
4707
4690
|
}
|
|
4708
4691
|
function unwrapMessage(message) {
|
|
4709
4692
|
return typeof message === "string" ? message : message?.message;
|
|
4710
4693
|
}
|
|
4711
|
-
function finalizeIssue(iss, ctx, config
|
|
4694
|
+
function finalizeIssue(iss, ctx, config) {
|
|
4712
4695
|
const full = {
|
|
4713
4696
|
...iss,
|
|
4714
4697
|
path: iss.path ?? []
|
|
4715
4698
|
};
|
|
4716
|
-
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";
|
|
4717
4700
|
delete full.inst;
|
|
4718
4701
|
delete full.continue;
|
|
4719
4702
|
if (!ctx?.reportInput) delete full.input;
|
|
@@ -4752,7 +4735,7 @@ const initializer$1 = (inst, def) => {
|
|
|
4752
4735
|
};
|
|
4753
4736
|
const $ZodError = $constructor("$ZodError", initializer$1);
|
|
4754
4737
|
const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
|
|
4755
|
-
function flattenError(error, mapper = (issue
|
|
4738
|
+
function flattenError(error, mapper = (issue) => issue.message) {
|
|
4756
4739
|
const fieldErrors = {};
|
|
4757
4740
|
const formErrors = [];
|
|
4758
4741
|
for (const sub of error.issues) if (sub.path.length > 0) {
|
|
@@ -4764,22 +4747,22 @@ function flattenError(error, mapper = (issue$1$1) => issue$1$1.message) {
|
|
|
4764
4747
|
fieldErrors
|
|
4765
4748
|
};
|
|
4766
4749
|
}
|
|
4767
|
-
function formatError(error, mapper = (issue
|
|
4750
|
+
function formatError(error, mapper = (issue) => issue.message) {
|
|
4768
4751
|
const fieldErrors = { _errors: [] };
|
|
4769
|
-
const processError = (error
|
|
4770
|
-
for (const issue
|
|
4771
|
-
else if (issue
|
|
4772
|
-
else if (issue
|
|
4773
|
-
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));
|
|
4774
4757
|
else {
|
|
4775
4758
|
let curr = fieldErrors;
|
|
4776
4759
|
let i = 0;
|
|
4777
|
-
while (i < issue
|
|
4778
|
-
const el = issue
|
|
4779
|
-
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: [] };
|
|
4780
4763
|
else {
|
|
4781
4764
|
curr[el] = curr[el] || { _errors: [] };
|
|
4782
|
-
curr[el]._errors.push(mapper(issue
|
|
4765
|
+
curr[el]._errors.push(mapper(issue));
|
|
4783
4766
|
}
|
|
4784
4767
|
curr = curr[el];
|
|
4785
4768
|
i++;
|
|
@@ -4893,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
|
|
|
4893
4876
|
/** Returns a regex for validating an RFC 9562/4122 UUID.
|
|
4894
4877
|
*
|
|
4895
4878
|
* @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
|
|
4896
|
-
const uuid = (version
|
|
4897
|
-
if (!version
|
|
4898
|
-
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})$`);
|
|
4899
4882
|
};
|
|
4900
4883
|
/** Practical email validation */
|
|
4901
4884
|
const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
@@ -4917,29 +4900,30 @@ function timeSource(args) {
|
|
|
4917
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+)?)?`;
|
|
4918
4901
|
}
|
|
4919
4902
|
function time$1(args) {
|
|
4920
|
-
return
|
|
4903
|
+
return new RegExp(`^${timeSource(args)}$`);
|
|
4921
4904
|
}
|
|
4922
4905
|
function datetime$1(args) {
|
|
4923
|
-
const time
|
|
4906
|
+
const time = timeSource({ precision: args.precision });
|
|
4924
4907
|
const opts = ["Z"];
|
|
4925
4908
|
if (args.local) opts.push("");
|
|
4926
4909
|
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
4927
|
-
const timeRegex = `${time
|
|
4928
|
-
return
|
|
4910
|
+
const timeRegex = `${time}(?:${opts.join("|")})`;
|
|
4911
|
+
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
4929
4912
|
}
|
|
4930
4913
|
const string$1 = (params) => {
|
|
4931
4914
|
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
4932
|
-
return
|
|
4915
|
+
return new RegExp(`^${regex}$`);
|
|
4933
4916
|
};
|
|
4934
4917
|
const integer = /^-?\d+$/;
|
|
4935
4918
|
const number$1 = /^-?\d+(?:\.\d+)?$/;
|
|
4919
|
+
const boolean$1 = /^(?:true|false)$/i;
|
|
4936
4920
|
const lowercase = /^[^A-Z]*$/;
|
|
4937
4921
|
const uppercase = /^[^a-z]*$/;
|
|
4938
4922
|
const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
4939
|
-
var _a
|
|
4923
|
+
var _a;
|
|
4940
4924
|
inst._zod ?? (inst._zod = {});
|
|
4941
4925
|
inst._zod.def = def;
|
|
4942
|
-
(_a
|
|
4926
|
+
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
|
4943
4927
|
});
|
|
4944
4928
|
const numericOriginMap = {
|
|
4945
4929
|
number: "number",
|
|
@@ -4949,8 +4933,8 @@ const numericOriginMap = {
|
|
|
4949
4933
|
const $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {
|
|
4950
4934
|
$ZodCheck.init(inst, def);
|
|
4951
4935
|
const origin = numericOriginMap[typeof def.value];
|
|
4952
|
-
inst._zod.onattach.push((inst
|
|
4953
|
-
const bag = inst
|
|
4936
|
+
inst._zod.onattach.push((inst) => {
|
|
4937
|
+
const bag = inst._zod.bag;
|
|
4954
4938
|
const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
4955
4939
|
if (def.value < curr) if (def.inclusive) bag.maximum = def.value;
|
|
4956
4940
|
else bag.exclusiveMaximum = def.value;
|
|
@@ -4971,8 +4955,8 @@ const $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (ins
|
|
|
4971
4955
|
const $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
|
|
4972
4956
|
$ZodCheck.init(inst, def);
|
|
4973
4957
|
const origin = numericOriginMap[typeof def.value];
|
|
4974
|
-
inst._zod.onattach.push((inst
|
|
4975
|
-
const bag = inst
|
|
4958
|
+
inst._zod.onattach.push((inst) => {
|
|
4959
|
+
const bag = inst._zod.bag;
|
|
4976
4960
|
const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
4977
4961
|
if (def.value > curr) if (def.inclusive) bag.minimum = def.value;
|
|
4978
4962
|
else bag.exclusiveMinimum = def.value;
|
|
@@ -4992,9 +4976,9 @@ const $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan"
|
|
|
4992
4976
|
});
|
|
4993
4977
|
const $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
4994
4978
|
$ZodCheck.init(inst, def);
|
|
4995
|
-
inst._zod.onattach.push((inst
|
|
4996
|
-
var _a
|
|
4997
|
-
(_a
|
|
4979
|
+
inst._zod.onattach.push((inst) => {
|
|
4980
|
+
var _a;
|
|
4981
|
+
(_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
|
|
4998
4982
|
});
|
|
4999
4983
|
inst._zod.check = (payload) => {
|
|
5000
4984
|
if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
@@ -5015,8 +4999,8 @@ const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberForma
|
|
|
5015
4999
|
const isInt = def.format?.includes("int");
|
|
5016
5000
|
const origin = isInt ? "int" : "number";
|
|
5017
5001
|
const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
|
|
5018
|
-
inst._zod.onattach.push((inst
|
|
5019
|
-
const bag = inst
|
|
5002
|
+
inst._zod.onattach.push((inst) => {
|
|
5003
|
+
const bag = inst._zod.bag;
|
|
5020
5004
|
bag.format = def.format;
|
|
5021
5005
|
bag.minimum = minimum;
|
|
5022
5006
|
bag.maximum = maximum;
|
|
@@ -5081,15 +5065,15 @@ const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberForma
|
|
|
5081
5065
|
};
|
|
5082
5066
|
});
|
|
5083
5067
|
const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
5084
|
-
var _a
|
|
5068
|
+
var _a;
|
|
5085
5069
|
$ZodCheck.init(inst, def);
|
|
5086
|
-
(_a
|
|
5070
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
5087
5071
|
const val = payload.value;
|
|
5088
5072
|
return !nullish(val) && val.length !== void 0;
|
|
5089
5073
|
});
|
|
5090
|
-
inst._zod.onattach.push((inst
|
|
5091
|
-
const curr = inst
|
|
5092
|
-
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;
|
|
5093
5077
|
});
|
|
5094
5078
|
inst._zod.check = (payload) => {
|
|
5095
5079
|
const input = payload.value;
|
|
@@ -5107,15 +5091,15 @@ const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (i
|
|
|
5107
5091
|
};
|
|
5108
5092
|
});
|
|
5109
5093
|
const $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
5110
|
-
var _a
|
|
5094
|
+
var _a;
|
|
5111
5095
|
$ZodCheck.init(inst, def);
|
|
5112
|
-
(_a
|
|
5096
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
5113
5097
|
const val = payload.value;
|
|
5114
5098
|
return !nullish(val) && val.length !== void 0;
|
|
5115
5099
|
});
|
|
5116
|
-
inst._zod.onattach.push((inst
|
|
5117
|
-
const curr = inst
|
|
5118
|
-
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;
|
|
5119
5103
|
});
|
|
5120
5104
|
inst._zod.check = (payload) => {
|
|
5121
5105
|
const input = payload.value;
|
|
@@ -5133,14 +5117,14 @@ const $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (i
|
|
|
5133
5117
|
};
|
|
5134
5118
|
});
|
|
5135
5119
|
const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
5136
|
-
var _a
|
|
5120
|
+
var _a;
|
|
5137
5121
|
$ZodCheck.init(inst, def);
|
|
5138
|
-
(_a
|
|
5122
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
5139
5123
|
const val = payload.value;
|
|
5140
5124
|
return !nullish(val) && val.length !== void 0;
|
|
5141
5125
|
});
|
|
5142
|
-
inst._zod.onattach.push((inst
|
|
5143
|
-
const bag = inst
|
|
5126
|
+
inst._zod.onattach.push((inst) => {
|
|
5127
|
+
const bag = inst._zod.bag;
|
|
5144
5128
|
bag.minimum = def.length;
|
|
5145
5129
|
bag.maximum = def.length;
|
|
5146
5130
|
bag.length = def.length;
|
|
@@ -5169,17 +5153,17 @@ const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEqual
|
|
|
5169
5153
|
};
|
|
5170
5154
|
});
|
|
5171
5155
|
const $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
5172
|
-
var _a
|
|
5156
|
+
var _a, _b;
|
|
5173
5157
|
$ZodCheck.init(inst, def);
|
|
5174
|
-
inst._zod.onattach.push((inst
|
|
5175
|
-
const bag = inst
|
|
5158
|
+
inst._zod.onattach.push((inst) => {
|
|
5159
|
+
const bag = inst._zod.bag;
|
|
5176
5160
|
bag.format = def.format;
|
|
5177
5161
|
if (def.pattern) {
|
|
5178
5162
|
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
5179
5163
|
bag.patterns.add(def.pattern);
|
|
5180
5164
|
}
|
|
5181
5165
|
});
|
|
5182
|
-
if (def.pattern) (_a
|
|
5166
|
+
if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => {
|
|
5183
5167
|
def.pattern.lastIndex = 0;
|
|
5184
5168
|
if (def.pattern.test(payload.value)) return;
|
|
5185
5169
|
payload.issues.push({
|
|
@@ -5223,8 +5207,8 @@ const $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (ins
|
|
|
5223
5207
|
const escapedRegex = escapeRegex(def.includes);
|
|
5224
5208
|
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
5225
5209
|
def.pattern = pattern;
|
|
5226
|
-
inst._zod.onattach.push((inst
|
|
5227
|
-
const bag = inst
|
|
5210
|
+
inst._zod.onattach.push((inst) => {
|
|
5211
|
+
const bag = inst._zod.bag;
|
|
5228
5212
|
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
5229
5213
|
bag.patterns.add(pattern);
|
|
5230
5214
|
});
|
|
@@ -5243,10 +5227,10 @@ const $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (ins
|
|
|
5243
5227
|
});
|
|
5244
5228
|
const $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {
|
|
5245
5229
|
$ZodCheck.init(inst, def);
|
|
5246
|
-
const pattern =
|
|
5230
|
+
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
5247
5231
|
def.pattern ?? (def.pattern = pattern);
|
|
5248
|
-
inst._zod.onattach.push((inst
|
|
5249
|
-
const bag = inst
|
|
5232
|
+
inst._zod.onattach.push((inst) => {
|
|
5233
|
+
const bag = inst._zod.bag;
|
|
5250
5234
|
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
5251
5235
|
bag.patterns.add(pattern);
|
|
5252
5236
|
});
|
|
@@ -5265,10 +5249,10 @@ const $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith",
|
|
|
5265
5249
|
});
|
|
5266
5250
|
const $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => {
|
|
5267
5251
|
$ZodCheck.init(inst, def);
|
|
5268
|
-
const pattern =
|
|
5252
|
+
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
|
|
5269
5253
|
def.pattern ?? (def.pattern = pattern);
|
|
5270
|
-
inst._zod.onattach.push((inst
|
|
5271
|
-
const bag = inst
|
|
5254
|
+
inst._zod.onattach.push((inst) => {
|
|
5255
|
+
const bag = inst._zod.bag;
|
|
5272
5256
|
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
5273
5257
|
bag.patterns.add(pattern);
|
|
5274
5258
|
});
|
|
@@ -5326,7 +5310,7 @@ const version = {
|
|
|
5326
5310
|
patch: 6
|
|
5327
5311
|
};
|
|
5328
5312
|
const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
5329
|
-
var _a
|
|
5313
|
+
var _a;
|
|
5330
5314
|
inst ?? (inst = {});
|
|
5331
5315
|
inst._zod.def = def;
|
|
5332
5316
|
inst._zod.bag = inst._zod.bag || {};
|
|
@@ -5335,15 +5319,15 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
5335
5319
|
if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
|
|
5336
5320
|
for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
|
|
5337
5321
|
if (checks.length === 0) {
|
|
5338
|
-
(_a
|
|
5322
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
5339
5323
|
inst._zod.deferred?.push(() => {
|
|
5340
5324
|
inst._zod.run = inst._zod.parse;
|
|
5341
5325
|
});
|
|
5342
5326
|
} else {
|
|
5343
|
-
const runChecks = (payload, checks
|
|
5327
|
+
const runChecks = (payload, checks, ctx) => {
|
|
5344
5328
|
let isAborted = aborted(payload);
|
|
5345
5329
|
let asyncResult;
|
|
5346
|
-
for (const ch of checks
|
|
5330
|
+
for (const ch of checks) {
|
|
5347
5331
|
if (ch._zod.def.when) {
|
|
5348
5332
|
if (!ch._zod.def.when(payload)) continue;
|
|
5349
5333
|
} else if (isAborted) continue;
|
|
@@ -5373,7 +5357,7 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
5373
5357
|
const checkResult = runChecks(payload, checks, ctx);
|
|
5374
5358
|
if (checkResult instanceof Promise) {
|
|
5375
5359
|
if (ctx.async === false) throw new $ZodAsyncError();
|
|
5376
|
-
return checkResult.then((checkResult
|
|
5360
|
+
return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
|
|
5377
5361
|
}
|
|
5378
5362
|
return inst._zod.parse(checkResult, ctx);
|
|
5379
5363
|
};
|
|
@@ -5387,15 +5371,15 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
5387
5371
|
...ctx,
|
|
5388
5372
|
skipChecks: true
|
|
5389
5373
|
});
|
|
5390
|
-
if (canary instanceof Promise) return canary.then((canary
|
|
5391
|
-
return handleCanaryResult(canary
|
|
5374
|
+
if (canary instanceof Promise) return canary.then((canary) => {
|
|
5375
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
5392
5376
|
});
|
|
5393
5377
|
return handleCanaryResult(canary, payload, ctx);
|
|
5394
5378
|
}
|
|
5395
5379
|
const result = inst._zod.parse(payload, ctx);
|
|
5396
5380
|
if (result instanceof Promise) {
|
|
5397
5381
|
if (ctx.async === false) throw new $ZodAsyncError();
|
|
5398
|
-
return result.then((result
|
|
5382
|
+
return result.then((result) => runChecks(result, checks, ctx));
|
|
5399
5383
|
}
|
|
5400
5384
|
return runChecks(result, checks, ctx);
|
|
5401
5385
|
};
|
|
@@ -5419,7 +5403,7 @@ const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
|
5419
5403
|
inst._zod.parse = (payload, _) => {
|
|
5420
5404
|
if (def.coerce) try {
|
|
5421
5405
|
payload.value = String(payload.value);
|
|
5422
|
-
} catch (_
|
|
5406
|
+
} catch (_) {}
|
|
5423
5407
|
if (typeof payload.value === "string") return payload;
|
|
5424
5408
|
payload.issues.push({
|
|
5425
5409
|
expected: "string",
|
|
@@ -5625,8 +5609,8 @@ const $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
|
5625
5609
|
});
|
|
5626
5610
|
function isValidBase64URL(data) {
|
|
5627
5611
|
if (!base64url.test(data)) return false;
|
|
5628
|
-
const base64
|
|
5629
|
-
return isValidBase64(base64
|
|
5612
|
+
const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
5613
|
+
return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "="));
|
|
5630
5614
|
}
|
|
5631
5615
|
const $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
5632
5616
|
def.pattern ?? (def.pattern = base64url);
|
|
@@ -5699,6 +5683,24 @@ const $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst,
|
|
|
5699
5683
|
$ZodCheckNumberFormat.init(inst, def);
|
|
5700
5684
|
$ZodNumber.init(inst, def);
|
|
5701
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
|
+
});
|
|
5702
5704
|
const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
|
|
5703
5705
|
$ZodType.init(inst, def);
|
|
5704
5706
|
inst._zod.parse = (payload) => payload;
|
|
@@ -5740,7 +5742,7 @@ const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
5740
5742
|
value: item,
|
|
5741
5743
|
issues: []
|
|
5742
5744
|
}, ctx);
|
|
5743
|
-
if (result instanceof Promise) proms.push(result.then((result
|
|
5745
|
+
if (result instanceof Promise) proms.push(result.then((result) => handleArrayResult(result, payload, i)));
|
|
5744
5746
|
else handleArrayResult(result, payload, i);
|
|
5745
5747
|
}
|
|
5746
5748
|
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
@@ -5784,7 +5786,7 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
5784
5786
|
value: input[key],
|
|
5785
5787
|
issues: []
|
|
5786
5788
|
}, ctx);
|
|
5787
|
-
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)));
|
|
5788
5790
|
else handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
5789
5791
|
}
|
|
5790
5792
|
if (unrecognized.length) payload.issues.push({
|
|
@@ -5821,13 +5823,13 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
5821
5823
|
}
|
|
5822
5824
|
return propValues;
|
|
5823
5825
|
});
|
|
5824
|
-
const isObject$
|
|
5826
|
+
const isObject$2 = isObject;
|
|
5825
5827
|
const catchall = def.catchall;
|
|
5826
5828
|
let value;
|
|
5827
5829
|
inst._zod.parse = (payload, ctx) => {
|
|
5828
5830
|
value ?? (value = _normalized.value);
|
|
5829
5831
|
const input = payload.value;
|
|
5830
|
-
if (!isObject$
|
|
5832
|
+
if (!isObject$2(input)) {
|
|
5831
5833
|
payload.issues.push({
|
|
5832
5834
|
expected: "object",
|
|
5833
5835
|
code: "invalid_type",
|
|
@@ -5846,7 +5848,7 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
5846
5848
|
value: input[key],
|
|
5847
5849
|
issues: []
|
|
5848
5850
|
}, ctx);
|
|
5849
|
-
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)));
|
|
5850
5852
|
else handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
5851
5853
|
}
|
|
5852
5854
|
if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
@@ -5921,7 +5923,7 @@ const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def)
|
|
|
5921
5923
|
return (payload, ctx) => fn(shape, payload, ctx);
|
|
5922
5924
|
};
|
|
5923
5925
|
let fastpass;
|
|
5924
|
-
const isObject$1
|
|
5926
|
+
const isObject$1 = isObject;
|
|
5925
5927
|
const jit = !globalConfig.jitless;
|
|
5926
5928
|
const fastEnabled = jit && allowsEval.value;
|
|
5927
5929
|
const catchall = def.catchall;
|
|
@@ -5929,7 +5931,7 @@ const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def)
|
|
|
5929
5931
|
inst._zod.parse = (payload, ctx) => {
|
|
5930
5932
|
value ?? (value = _normalized.value);
|
|
5931
5933
|
const input = payload.value;
|
|
5932
|
-
if (!isObject$1
|
|
5934
|
+
if (!isObject$1(input)) {
|
|
5933
5935
|
payload.issues.push({
|
|
5934
5936
|
expected: "object",
|
|
5935
5937
|
code: "invalid_type",
|
|
@@ -5975,7 +5977,7 @@ const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
5975
5977
|
defineLazy(inst._zod, "pattern", () => {
|
|
5976
5978
|
if (def.options.every((o) => o._zod.pattern)) {
|
|
5977
5979
|
const patterns = def.options.map((o) => o._zod.pattern);
|
|
5978
|
-
return
|
|
5980
|
+
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
5979
5981
|
}
|
|
5980
5982
|
});
|
|
5981
5983
|
const single = def.options.length === 1;
|
|
@@ -5998,8 +6000,8 @@ const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
5998
6000
|
}
|
|
5999
6001
|
}
|
|
6000
6002
|
if (!async) return handleUnionResults(results, payload, inst, ctx);
|
|
6001
|
-
return Promise.all(results).then((results
|
|
6002
|
-
return handleUnionResults(results
|
|
6003
|
+
return Promise.all(results).then((results) => {
|
|
6004
|
+
return handleUnionResults(results, payload, inst, ctx);
|
|
6003
6005
|
});
|
|
6004
6006
|
};
|
|
6005
6007
|
});
|
|
@@ -6015,8 +6017,8 @@ const $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst,
|
|
|
6015
6017
|
value: input,
|
|
6016
6018
|
issues: []
|
|
6017
6019
|
}, ctx);
|
|
6018
|
-
if (left instanceof Promise || right instanceof Promise) return Promise.all([left, right]).then(([left
|
|
6019
|
-
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);
|
|
6020
6022
|
});
|
|
6021
6023
|
return handleIntersectionResults(payload, left, right);
|
|
6022
6024
|
};
|
|
@@ -6107,7 +6109,7 @@ const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
6107
6109
|
const values = getEnumValues(def.entries);
|
|
6108
6110
|
const valuesSet = new Set(values);
|
|
6109
6111
|
inst._zod.values = valuesSet;
|
|
6110
|
-
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("|")})$`);
|
|
6111
6113
|
inst._zod.parse = (payload, _ctx) => {
|
|
6112
6114
|
const input = payload.value;
|
|
6113
6115
|
if (valuesSet.has(input)) return payload;
|
|
@@ -6150,7 +6152,7 @@ const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) =>
|
|
|
6150
6152
|
});
|
|
6151
6153
|
defineLazy(inst._zod, "pattern", () => {
|
|
6152
6154
|
const pattern = def.innerType._zod.pattern;
|
|
6153
|
-
return pattern ?
|
|
6155
|
+
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
6154
6156
|
});
|
|
6155
6157
|
inst._zod.parse = (payload, ctx) => {
|
|
6156
6158
|
if (def.innerType._zod.optin === "optional") {
|
|
@@ -6176,7 +6178,7 @@ const $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) =>
|
|
|
6176
6178
|
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
6177
6179
|
defineLazy(inst._zod, "pattern", () => {
|
|
6178
6180
|
const pattern = def.innerType._zod.pattern;
|
|
6179
|
-
return pattern ?
|
|
6181
|
+
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
6180
6182
|
});
|
|
6181
6183
|
defineLazy(inst._zod, "values", () => {
|
|
6182
6184
|
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : void 0;
|
|
@@ -6200,7 +6202,7 @@ const $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
|
|
|
6200
6202
|
return payload;
|
|
6201
6203
|
}
|
|
6202
6204
|
const result = def.innerType._zod.run(payload, ctx);
|
|
6203
|
-
if (result instanceof Promise) return result.then((result
|
|
6205
|
+
if (result instanceof Promise) return result.then((result) => handleDefaultResult(result, def));
|
|
6204
6206
|
return handleDefaultResult(result, def);
|
|
6205
6207
|
};
|
|
6206
6208
|
});
|
|
@@ -6226,7 +6228,7 @@ const $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, d
|
|
|
6226
6228
|
});
|
|
6227
6229
|
inst._zod.parse = (payload, ctx) => {
|
|
6228
6230
|
const result = def.innerType._zod.run(payload, ctx);
|
|
6229
|
-
if (result instanceof Promise) return result.then((result
|
|
6231
|
+
if (result instanceof Promise) return result.then((result) => handleNonOptionalResult(result, inst));
|
|
6230
6232
|
return handleNonOptionalResult(result, inst);
|
|
6231
6233
|
};
|
|
6232
6234
|
});
|
|
@@ -6247,12 +6249,12 @@ const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
|
6247
6249
|
inst._zod.parse = (payload, ctx) => {
|
|
6248
6250
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
6249
6251
|
const result = def.innerType._zod.run(payload, ctx);
|
|
6250
|
-
if (result instanceof Promise) return result.then((result
|
|
6251
|
-
payload.value = result
|
|
6252
|
-
if (result
|
|
6252
|
+
if (result instanceof Promise) return result.then((result) => {
|
|
6253
|
+
payload.value = result.value;
|
|
6254
|
+
if (result.issues.length) {
|
|
6253
6255
|
payload.value = def.catchValue({
|
|
6254
6256
|
...payload,
|
|
6255
|
-
error: { issues: result
|
|
6257
|
+
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
6256
6258
|
input: payload.value
|
|
6257
6259
|
});
|
|
6258
6260
|
payload.issues = [];
|
|
@@ -6280,11 +6282,11 @@ const $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
|
|
|
6280
6282
|
inst._zod.parse = (payload, ctx) => {
|
|
6281
6283
|
if (ctx.direction === "backward") {
|
|
6282
6284
|
const right = def.out._zod.run(payload, ctx);
|
|
6283
|
-
if (right instanceof Promise) return right.then((right
|
|
6285
|
+
if (right instanceof Promise) return right.then((right) => handlePipeResult(right, def.in, ctx));
|
|
6284
6286
|
return handlePipeResult(right, def.in, ctx);
|
|
6285
6287
|
}
|
|
6286
6288
|
const left = def.in._zod.run(payload, ctx);
|
|
6287
|
-
if (left instanceof Promise) return left.then((left
|
|
6289
|
+
if (left instanceof Promise) return left.then((left) => handlePipeResult(left, def.out, ctx));
|
|
6288
6290
|
return handlePipeResult(left, def.out, ctx);
|
|
6289
6291
|
};
|
|
6290
6292
|
});
|
|
@@ -6324,7 +6326,7 @@ const $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
|
6324
6326
|
inst._zod.check = (payload) => {
|
|
6325
6327
|
const input = payload.value;
|
|
6326
6328
|
const r = def.fn(input);
|
|
6327
|
-
if (r instanceof Promise) return r.then((r
|
|
6329
|
+
if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
|
|
6328
6330
|
handleRefineResult(r, payload, input, inst);
|
|
6329
6331
|
};
|
|
6330
6332
|
});
|
|
@@ -6348,9 +6350,9 @@ var $ZodRegistry = class {
|
|
|
6348
6350
|
this._idmap = /* @__PURE__ */ new Map();
|
|
6349
6351
|
}
|
|
6350
6352
|
add(schema, ..._meta) {
|
|
6351
|
-
const meta
|
|
6352
|
-
this._map.set(schema, meta
|
|
6353
|
-
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);
|
|
6354
6356
|
return this;
|
|
6355
6357
|
}
|
|
6356
6358
|
clear() {
|
|
@@ -6359,8 +6361,8 @@ var $ZodRegistry = class {
|
|
|
6359
6361
|
return this;
|
|
6360
6362
|
}
|
|
6361
6363
|
remove(schema) {
|
|
6362
|
-
const meta
|
|
6363
|
-
if (meta
|
|
6364
|
+
const meta = this._map.get(schema);
|
|
6365
|
+
if (meta && typeof meta === "object" && "id" in meta) this._idmap.delete(meta.id);
|
|
6364
6366
|
this._map.delete(schema);
|
|
6365
6367
|
return this;
|
|
6366
6368
|
}
|
|
@@ -6675,6 +6677,13 @@ function _int(Class, params) {
|
|
|
6675
6677
|
});
|
|
6676
6678
|
}
|
|
6677
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__ */
|
|
6678
6687
|
function _unknown(Class) {
|
|
6679
6688
|
return new Class({ type: "unknown" });
|
|
6680
6689
|
}
|
|
@@ -6852,10 +6861,10 @@ function _refine(Class, fn, _params) {
|
|
|
6852
6861
|
/* @__NO_SIDE_EFFECTS__ */
|
|
6853
6862
|
function _superRefine(fn) {
|
|
6854
6863
|
const ch = /* @__PURE__ */ _check((payload) => {
|
|
6855
|
-
payload.addIssue = (issue$
|
|
6856
|
-
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));
|
|
6857
6866
|
else {
|
|
6858
|
-
const _issue = issue$
|
|
6867
|
+
const _issue = issue$2;
|
|
6859
6868
|
if (_issue.fatal) _issue.continue = false;
|
|
6860
6869
|
_issue.code ?? (_issue.code = "custom");
|
|
6861
6870
|
_issue.input ?? (_issue.input = payload.value);
|
|
@@ -6899,7 +6908,7 @@ function process$2(schema, ctx, _params = {
|
|
|
6899
6908
|
path: [],
|
|
6900
6909
|
schemaPath: []
|
|
6901
6910
|
}) {
|
|
6902
|
-
var _a
|
|
6911
|
+
var _a;
|
|
6903
6912
|
const def = schema._zod.def;
|
|
6904
6913
|
const seen = ctx.seen.get(schema);
|
|
6905
6914
|
if (seen) {
|
|
@@ -6936,13 +6945,13 @@ function process$2(schema, ctx, _params = {
|
|
|
6936
6945
|
ctx.seen.get(parent).isParent = true;
|
|
6937
6946
|
}
|
|
6938
6947
|
}
|
|
6939
|
-
const meta
|
|
6940
|
-
if (meta
|
|
6948
|
+
const meta = ctx.metadataRegistry.get(schema);
|
|
6949
|
+
if (meta) Object.assign(result.schema, meta);
|
|
6941
6950
|
if (ctx.io === "input" && isTransforming(schema)) {
|
|
6942
6951
|
delete result.schema.examples;
|
|
6943
6952
|
delete result.schema.default;
|
|
6944
6953
|
}
|
|
6945
|
-
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);
|
|
6946
6955
|
delete result.schema._prefault;
|
|
6947
6956
|
return ctx.seen.get(schema).schema;
|
|
6948
6957
|
}
|
|
@@ -6962,7 +6971,7 @@ function extractDefs(ctx, schema) {
|
|
|
6962
6971
|
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
6963
6972
|
if (ctx.external) {
|
|
6964
6973
|
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
6965
|
-
const uriGenerator = ctx.external.uri ?? ((id
|
|
6974
|
+
const uriGenerator = ctx.external.uri ?? ((id) => id);
|
|
6966
6975
|
if (externalId) return { ref: uriGenerator(externalId) };
|
|
6967
6976
|
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
6968
6977
|
entry[1].defId = id;
|
|
@@ -6985,9 +6994,9 @@ function extractDefs(ctx, schema) {
|
|
|
6985
6994
|
const { ref, defId } = makeURI(entry);
|
|
6986
6995
|
seen.def = { ...seen.schema };
|
|
6987
6996
|
if (defId) seen.defId = defId;
|
|
6988
|
-
const schema
|
|
6989
|
-
for (const key in schema
|
|
6990
|
-
schema
|
|
6997
|
+
const schema = seen.schema;
|
|
6998
|
+
for (const key in schema) delete schema[key];
|
|
6999
|
+
schema.$ref = ref;
|
|
6991
7000
|
};
|
|
6992
7001
|
if (ctx.cycles === "throw") for (const entry of ctx.seen.entries()) {
|
|
6993
7002
|
const seen = entry[1];
|
|
@@ -7030,8 +7039,8 @@ function finalize(ctx, schema) {
|
|
|
7030
7039
|
const flattenRef = (zodSchema) => {
|
|
7031
7040
|
const seen = ctx.seen.get(zodSchema);
|
|
7032
7041
|
if (seen.ref === null) return;
|
|
7033
|
-
const schema
|
|
7034
|
-
const _cached = { ...schema
|
|
7042
|
+
const schema = seen.def ?? seen.schema;
|
|
7043
|
+
const _cached = { ...schema };
|
|
7035
7044
|
const ref = seen.ref;
|
|
7036
7045
|
seen.ref = null;
|
|
7037
7046
|
if (ref) {
|
|
@@ -7039,17 +7048,17 @@ function finalize(ctx, schema) {
|
|
|
7039
7048
|
const refSeen = ctx.seen.get(ref);
|
|
7040
7049
|
const refSchema = refSeen.schema;
|
|
7041
7050
|
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
7042
|
-
schema
|
|
7043
|
-
schema
|
|
7044
|
-
} else Object.assign(schema
|
|
7045
|
-
Object.assign(schema
|
|
7046
|
-
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) {
|
|
7047
7056
|
if (key === "$ref" || key === "allOf") continue;
|
|
7048
|
-
if (!(key in _cached)) delete schema
|
|
7057
|
+
if (!(key in _cached)) delete schema[key];
|
|
7049
7058
|
}
|
|
7050
|
-
if (refSchema.$ref && refSeen.def) for (const key in schema
|
|
7059
|
+
if (refSchema.$ref && refSeen.def) for (const key in schema) {
|
|
7051
7060
|
if (key === "$ref" || key === "allOf") continue;
|
|
7052
|
-
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];
|
|
7053
7062
|
}
|
|
7054
7063
|
}
|
|
7055
7064
|
const parent = zodSchema._zod.parent;
|
|
@@ -7057,16 +7066,16 @@ function finalize(ctx, schema) {
|
|
|
7057
7066
|
flattenRef(parent);
|
|
7058
7067
|
const parentSeen = ctx.seen.get(parent);
|
|
7059
7068
|
if (parentSeen?.schema.$ref) {
|
|
7060
|
-
schema
|
|
7061
|
-
if (parentSeen.def) for (const key in schema
|
|
7069
|
+
schema.$ref = parentSeen.schema.$ref;
|
|
7070
|
+
if (parentSeen.def) for (const key in schema) {
|
|
7062
7071
|
if (key === "$ref" || key === "allOf") continue;
|
|
7063
|
-
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];
|
|
7064
7073
|
}
|
|
7065
7074
|
}
|
|
7066
7075
|
}
|
|
7067
7076
|
ctx.override({
|
|
7068
7077
|
zodSchema,
|
|
7069
|
-
jsonSchema: schema
|
|
7078
|
+
jsonSchema: schema,
|
|
7070
7079
|
path: seen.path ?? []
|
|
7071
7080
|
});
|
|
7072
7081
|
};
|
|
@@ -7213,6 +7222,9 @@ const numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
7213
7222
|
}
|
|
7214
7223
|
if (typeof multipleOf === "number") json.multipleOf = multipleOf;
|
|
7215
7224
|
};
|
|
7225
|
+
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
7226
|
+
json.type = "boolean";
|
|
7227
|
+
};
|
|
7216
7228
|
const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
7217
7229
|
json.not = {};
|
|
7218
7230
|
};
|
|
@@ -7402,12 +7414,12 @@ const initializer = (inst, issues) => {
|
|
|
7402
7414
|
Object.defineProperties(inst, {
|
|
7403
7415
|
format: { value: (mapper) => formatError(inst, mapper) },
|
|
7404
7416
|
flatten: { value: (mapper) => flattenError(inst, mapper) },
|
|
7405
|
-
addIssue: { value: (issue
|
|
7406
|
-
inst.issues.push(issue
|
|
7417
|
+
addIssue: { value: (issue) => {
|
|
7418
|
+
inst.issues.push(issue);
|
|
7407
7419
|
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
7408
7420
|
} },
|
|
7409
|
-
addIssues: { value: (issues
|
|
7410
|
-
inst.issues.push(...issues
|
|
7421
|
+
addIssues: { value: (issues) => {
|
|
7422
|
+
inst.issues.push(...issues);
|
|
7411
7423
|
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
7412
7424
|
} },
|
|
7413
7425
|
isEmpty: { get() {
|
|
@@ -7447,10 +7459,10 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
7447
7459
|
} } : ch)] }), { parent: true });
|
|
7448
7460
|
};
|
|
7449
7461
|
inst.with = inst.check;
|
|
7450
|
-
inst.clone = (def
|
|
7462
|
+
inst.clone = (def, params) => clone(inst, def, params);
|
|
7451
7463
|
inst.brand = () => inst;
|
|
7452
|
-
inst.register = ((reg, meta
|
|
7453
|
-
reg.add(inst, meta
|
|
7464
|
+
inst.register = ((reg, meta) => {
|
|
7465
|
+
reg.add(inst, meta);
|
|
7454
7466
|
return inst;
|
|
7455
7467
|
});
|
|
7456
7468
|
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
@@ -7478,8 +7490,8 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
7478
7490
|
inst.or = (arg) => union([inst, arg]);
|
|
7479
7491
|
inst.and = (arg) => intersection(inst, arg);
|
|
7480
7492
|
inst.transform = (tx) => pipe(inst, transform(tx));
|
|
7481
|
-
inst.default = (def
|
|
7482
|
-
inst.prefault = (def
|
|
7493
|
+
inst.default = (def) => _default(inst, def);
|
|
7494
|
+
inst.prefault = (def) => prefault(inst, def);
|
|
7483
7495
|
inst.catch = (params) => _catch(inst, params);
|
|
7484
7496
|
inst.pipe = (target) => pipe(inst, target);
|
|
7485
7497
|
inst.readonly = () => readonly(inst);
|
|
@@ -7680,6 +7692,14 @@ const ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, d
|
|
|
7680
7692
|
function int(params) {
|
|
7681
7693
|
return /* @__PURE__ */ _int(ZodNumberFormat, params);
|
|
7682
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
|
+
}
|
|
7683
7703
|
const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
7684
7704
|
$ZodUnknown.init(inst, def);
|
|
7685
7705
|
ZodType.init(inst, def);
|
|
@@ -7825,10 +7845,10 @@ const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) =>
|
|
|
7825
7845
|
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
7826
7846
|
inst._zod.parse = (payload, _ctx) => {
|
|
7827
7847
|
if (_ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
7828
|
-
payload.addIssue = (issue$1
|
|
7829
|
-
if (typeof issue$1
|
|
7848
|
+
payload.addIssue = (issue$1) => {
|
|
7849
|
+
if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, def));
|
|
7830
7850
|
else {
|
|
7831
|
-
const _issue = issue$1
|
|
7851
|
+
const _issue = issue$1;
|
|
7832
7852
|
if (_issue.fatal) _issue.continue = false;
|
|
7833
7853
|
_issue.code ?? (_issue.code = "custom");
|
|
7834
7854
|
_issue.input ?? (_issue.input = payload.value);
|
|
@@ -7837,8 +7857,8 @@ const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) =>
|
|
|
7837
7857
|
}
|
|
7838
7858
|
};
|
|
7839
7859
|
const output = def.transform(payload.value, payload);
|
|
7840
|
-
if (output instanceof Promise) return output.then((output
|
|
7841
|
-
payload.value = output
|
|
7860
|
+
if (output instanceof Promise) return output.then((output) => {
|
|
7861
|
+
payload.value = output;
|
|
7842
7862
|
return payload;
|
|
7843
7863
|
});
|
|
7844
7864
|
payload.value = output;
|
|
@@ -8029,7 +8049,18 @@ const CodeSnippetSchema = object({
|
|
|
8029
8049
|
label: string().min(1),
|
|
8030
8050
|
snippet: string().min(1)
|
|
8031
8051
|
});
|
|
8032
|
-
|
|
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({
|
|
8033
8064
|
featureKey: string().regex(FEATURE_KEY_PATTERN, "featureKey must match pattern <domain>-YYYY-NNN (e.g. feat-2026-001, proc-2026-001)"),
|
|
8034
8065
|
title: string().min(1),
|
|
8035
8066
|
status: FeatureStatusSchema,
|
|
@@ -8052,12 +8083,16 @@ const FeatureSchema = object({
|
|
|
8052
8083
|
superseded_from: array(string().regex(FEATURE_KEY_PATTERN, "each superseded_from entry must be a valid featureKey")).optional(),
|
|
8053
8084
|
merged_into: string().regex(FEATURE_KEY_PATTERN, "merged_into must be a valid featureKey").optional(),
|
|
8054
8085
|
merged_from: array(string().regex(FEATURE_KEY_PATTERN, "each merged_from entry must be a valid featureKey")).optional(),
|
|
8086
|
+
userGuide: string().optional(),
|
|
8055
8087
|
componentFile: string().optional(),
|
|
8056
8088
|
npmPackages: array(string()).optional(),
|
|
8057
8089
|
publicInterface: array(PublicInterfaceEntrySchema).optional(),
|
|
8058
8090
|
externalDependencies: array(string()).optional(),
|
|
8059
8091
|
lastVerifiedDate: string().regex(/^\d{4}-\d{2}-\d{2}$/, "lastVerifiedDate must be YYYY-MM-DD").optional(),
|
|
8060
|
-
codeSnippets: array(CodeSnippetSchema).optional()
|
|
8092
|
+
codeSnippets: array(CodeSnippetSchema).optional(),
|
|
8093
|
+
implementationNotes: array(string()).optional(),
|
|
8094
|
+
fieldLocks: array(FieldLockSchema).optional(),
|
|
8095
|
+
featureLocked: boolean().optional()
|
|
8061
8096
|
});
|
|
8062
8097
|
const SOURCE_EXTENSIONS = new Set([
|
|
8063
8098
|
".ts",
|
|
@@ -8187,6 +8222,110 @@ function contextToString(ctx) {
|
|
|
8187
8222
|
}
|
|
8188
8223
|
return parts.join("\n");
|
|
8189
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();
|
|
8190
8329
|
const FILL_PROMPTS = {
|
|
8191
8330
|
analysis: {
|
|
8192
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.`,
|
|
@@ -8232,7 +8371,7 @@ Return ONLY a valid JSON array — no other text:
|
|
|
8232
8371
|
{
|
|
8233
8372
|
"id": "auto-1",
|
|
8234
8373
|
"author": "lac fill",
|
|
8235
|
-
"date": "${(
|
|
8374
|
+
"date": "${`${_dtNow.getFullYear()}-${String(_dtNow.getMonth() + 1).padStart(2, "0")}-${String(_dtNow.getDate()).padStart(2, "0")}`}",
|
|
8236
8375
|
"type": "tech-debt",
|
|
8237
8376
|
"body": "string"
|
|
8238
8377
|
}
|
|
@@ -8243,6 +8382,10 @@ Return ONLY a valid JSON array — no other text:
|
|
|
8243
8382
|
system: `You are a software engineering analyst. Write a plain-language success criteria statement for this feature — "how do we know it's done and working?" Be specific and testable. 1-3 sentences. Return only the text, no JSON wrapper, no heading.`,
|
|
8244
8383
|
userSuffix: "Write the success criteria for this feature."
|
|
8245
8384
|
},
|
|
8385
|
+
userGuide: {
|
|
8386
|
+
system: `You are a technical writer writing for end users — not developers. Given a feature.json, write a plain-language user guide for this feature. Explain what it does and how to use it in everyday language. Avoid technical terms, implementation details, and acceptance-criteria framing. Write from the user's perspective: what they will see, what they can do, and why it helps them. 2-5 sentences or a short bullet list. Return only the guide text, no JSON wrapper, no heading.`,
|
|
8387
|
+
userSuffix: "Write a plain-language user guide for this feature."
|
|
8388
|
+
},
|
|
8246
8389
|
domain: {
|
|
8247
8390
|
system: `You are a software engineering analyst. Identify the primary technical domain for this feature from its code and problem statement. Return a single lowercase word or short hyphenated phrase (e.g. "auth", "payments", "notifications", "data-pipeline"). Return only the domain value — nothing else.`,
|
|
8248
8391
|
userSuffix: "Identify the domain for this feature."
|
|
@@ -8293,6 +8436,15 @@ Return ONLY a valid JSON array — no other text:
|
|
|
8293
8436
|
}
|
|
8294
8437
|
]`,
|
|
8295
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."
|
|
8296
8448
|
}
|
|
8297
8449
|
};
|
|
8298
8450
|
const JSON_FIELDS = new Set([
|
|
@@ -8312,20 +8464,22 @@ const ALL_FILLABLE_FIELDS = [
|
|
|
8312
8464
|
"knownLimitations",
|
|
8313
8465
|
"tags",
|
|
8314
8466
|
"successCriteria",
|
|
8467
|
+
"userGuide",
|
|
8315
8468
|
"domain",
|
|
8316
8469
|
"componentFile",
|
|
8317
8470
|
"npmPackages",
|
|
8318
8471
|
"publicInterface",
|
|
8319
8472
|
"externalDependencies",
|
|
8320
8473
|
"lastVerifiedDate",
|
|
8321
|
-
"codeSnippets"
|
|
8474
|
+
"codeSnippets",
|
|
8475
|
+
"implementationNotes"
|
|
8322
8476
|
];
|
|
8323
8477
|
function getMissingFields(feature) {
|
|
8324
8478
|
return ALL_FILLABLE_FIELDS.filter((field) => {
|
|
8325
8479
|
const val = feature[field];
|
|
8326
8480
|
if (val === void 0 || val === null) return true;
|
|
8327
8481
|
if (typeof val === "string") return val.trim().length === 0;
|
|
8328
|
-
if (Array.isArray(val)) return
|
|
8482
|
+
if (Array.isArray(val)) return false;
|
|
8329
8483
|
return false;
|
|
8330
8484
|
});
|
|
8331
8485
|
}
|
|
@@ -8337,7 +8491,6 @@ function appendPromptLog(featureDir, entries) {
|
|
|
8337
8491
|
const lines = entries.map((e) => JSON.stringify(e)).join("\n") + "\n";
|
|
8338
8492
|
fs.appendFileSync(logPath, lines, "utf-8");
|
|
8339
8493
|
}
|
|
8340
|
-
|
|
8341
8494
|
//#endregion
|
|
8342
8495
|
//#region ../lac-mcp/src/index.ts
|
|
8343
8496
|
const workspaceRoot = process$1.argv[2] ?? process$1.env.LAC_WORKSPACE ?? process$1.cwd();
|
|
@@ -8392,7 +8545,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [
|
|
|
8392
8545
|
},
|
|
8393
8546
|
{
|
|
8394
8547
|
name: "create_feature",
|
|
8395
|
-
description: "Create a new feature.json in the specified directory.",
|
|
8548
|
+
description: "Create a new feature.json in the specified directory. After creating, immediately call read_feature_context on the same path to analyze surrounding code and fill all required fields before calling advance_feature.",
|
|
8396
8549
|
inputSchema: {
|
|
8397
8550
|
type: "object",
|
|
8398
8551
|
properties: {
|
|
@@ -8479,7 +8632,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [
|
|
|
8479
8632
|
},
|
|
8480
8633
|
{
|
|
8481
8634
|
name: "write_feature_fields",
|
|
8482
|
-
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.",
|
|
8483
8636
|
inputSchema: {
|
|
8484
8637
|
type: "object",
|
|
8485
8638
|
properties: {
|
|
@@ -8505,6 +8658,10 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [
|
|
|
8505
8658
|
}
|
|
8506
8659
|
},
|
|
8507
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."
|
|
8508
8665
|
}
|
|
8509
8666
|
},
|
|
8510
8667
|
required: ["path", "fields"]
|
|
@@ -8598,6 +8755,15 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [
|
|
|
8598
8755
|
maxFileSize: {
|
|
8599
8756
|
type: "number",
|
|
8600
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."
|
|
8601
8767
|
}
|
|
8602
8768
|
},
|
|
8603
8769
|
required: ["path"]
|
|
@@ -8726,6 +8892,44 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [
|
|
|
8726
8892
|
required: []
|
|
8727
8893
|
}
|
|
8728
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
|
+
},
|
|
8729
8933
|
{
|
|
8730
8934
|
name: "extract_all_features",
|
|
8731
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.",
|
|
@@ -8870,6 +9074,10 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
8870
9074
|
if (raw.superseded_by && !featureKeys.has(String(raw.superseded_by))) issues.push(`broken superseded_by ref: "${raw.superseded_by}" not found`);
|
|
8871
9075
|
if (raw.merged_into && !featureKeys.has(String(raw.merged_into))) issues.push(`broken merged_into ref: "${raw.merged_into}" not found`);
|
|
8872
9076
|
for (const key of raw.merged_from ?? []) if (!featureKeys.has(key)) issues.push(`broken merged_from ref: "${key}" not found`);
|
|
9077
|
+
if (feature.status === "active" || feature.status === "draft") {
|
|
9078
|
+
const preFreeze = getMissingForTransition(feature, "frozen");
|
|
9079
|
+
if (preFreeze.length > 0) warnings.push(`will block freeze — missing: ${preFreeze.join(", ")}`);
|
|
9080
|
+
}
|
|
8873
9081
|
if (raw.superseded_by && feature.status !== "deprecated") warnings.push(`superseded_by set but status is "${feature.status}" — consider deprecating`);
|
|
8874
9082
|
if (raw.merged_into && feature.status !== "deprecated") warnings.push(`merged_into set but status is "${feature.status}" — consider deprecating`);
|
|
8875
9083
|
const hasRevisions = Array.isArray(raw.revisions) && raw.revisions.length > 0;
|
|
@@ -8961,16 +9169,62 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
8961
9169
|
const feature = result.data;
|
|
8962
9170
|
const contextStr = contextToString(buildContext(featureDir, feature));
|
|
8963
9171
|
const missingFields = getMissingFields(feature);
|
|
8964
|
-
|
|
9172
|
+
let componentFileWarning = "";
|
|
9173
|
+
if (feature.componentFile) {
|
|
9174
|
+
const notFound = feature.componentFile.split(",").map((s) => s.trim()).filter(Boolean).filter((p) => {
|
|
9175
|
+
return [path.resolve(featureDir, p), path.resolve(workspaceRoot, p)].every((c) => !fs.existsSync(c));
|
|
9176
|
+
});
|
|
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`;
|
|
9178
|
+
}
|
|
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) => {
|
|
8965
9217
|
const prompt = FILL_PROMPTS[field];
|
|
8966
9218
|
const isJson = JSON_FIELDS.has(field);
|
|
8967
9219
|
return `### ${field}\n${prompt.system}\n${prompt.userSuffix}\n${isJson ? "(Return valid JSON for this field)" : "(Return plain text for this field)"}`;
|
|
8968
9220
|
}).join("\n\n");
|
|
9221
|
+
const fillableFields = missingFields.filter((f) => !lockedFieldNames.has(f));
|
|
8969
9222
|
const staleAnnotation = feature.annotations?.find((ann) => ann.type === "stale-review");
|
|
8970
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` : "";
|
|
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}`;
|
|
8971
9225
|
return { content: [{
|
|
8972
9226
|
type: "text",
|
|
8973
|
-
text: `${
|
|
9227
|
+
text: `${componentFileWarning}${instructions}\n\n## Context\n\n${contextStr}`
|
|
8974
9228
|
}] };
|
|
8975
9229
|
}
|
|
8976
9230
|
case "write_feature_fields": {
|
|
@@ -8997,6 +9251,24 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
8997
9251
|
}],
|
|
8998
9252
|
isError: true
|
|
8999
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;
|
|
9000
9272
|
const INTENT_CRITICAL = new Set([
|
|
9001
9273
|
"problem",
|
|
9002
9274
|
"analysis",
|
|
@@ -9009,16 +9281,28 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
9009
9281
|
...existing,
|
|
9010
9282
|
...fields
|
|
9011
9283
|
};
|
|
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")}`;
|
|
9012
9294
|
const revisionInput = a.revision;
|
|
9013
9295
|
let revisionWarning = "";
|
|
9014
9296
|
if (changingCritical.length > 0) if (revisionInput?.author && revisionInput?.reason) {
|
|
9015
|
-
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")}`;
|
|
9016
9299
|
updated.revisions = [...existing.revisions ?? [], {
|
|
9017
9300
|
date: today,
|
|
9018
9301
|
author: revisionInput.author,
|
|
9019
9302
|
fields_changed: changingCritical,
|
|
9020
9303
|
reason: revisionInput.reason
|
|
9021
9304
|
}];
|
|
9305
|
+
updated.annotations = (existing.annotations ?? []).filter((ann) => ann.type !== "stale-review");
|
|
9022
9306
|
} else revisionWarning = `\n\n⚠ Intent-critical fields changed (${changingCritical.join(", ")}) without a revision entry. Pass a "revision" object with author and reason to attribute this change.`;
|
|
9023
9307
|
fs.writeFileSync(featurePath, JSON.stringify(updated, null, 2) + "\n", "utf-8");
|
|
9024
9308
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -9034,10 +9318,10 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
9034
9318
|
const writtenKeys = Object.keys(fields);
|
|
9035
9319
|
const afterResult = validateFeature(JSON.parse(fs.readFileSync(featurePath, "utf-8")));
|
|
9036
9320
|
const stillMissing = afterResult.success ? getMissingFields(afterResult.data) : [];
|
|
9037
|
-
const nextHint = stillMissing.length > 0 ? `${stillMissing.length} field(s) still missing: ${stillMissing.join(", ")}.
|
|
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.`;
|
|
9038
9322
|
return { content: [{
|
|
9039
9323
|
type: "text",
|
|
9040
|
-
text:
|
|
9324
|
+
text: `${guardlockWarning ? guardlockWarning + "\n\n" : ""}✓ Wrote ${writtenKeys.length} field(s) to ${featurePath}: ${writtenKeys.join(", ")}\n\n${nextHint}${revisionWarning}`
|
|
9041
9325
|
}] };
|
|
9042
9326
|
}
|
|
9043
9327
|
case "advance_feature": {
|
|
@@ -9082,17 +9366,53 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
9082
9366
|
type: "text",
|
|
9083
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.`
|
|
9084
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
|
+
}
|
|
9085
9403
|
let deprecationHint = "";
|
|
9086
9404
|
if (to === "deprecated") {
|
|
9087
9405
|
const hasSuperseeded = !!parsed.superseded_by;
|
|
9088
9406
|
const hasMerged = !!parsed.merged_into;
|
|
9089
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.";
|
|
9090
9408
|
}
|
|
9091
|
-
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")}`;
|
|
9092
9411
|
const updated = {
|
|
9093
9412
|
...parsed,
|
|
9094
9413
|
status: to
|
|
9095
9414
|
};
|
|
9415
|
+
if (to === "frozen") updated.lastVerifiedDate = today;
|
|
9096
9416
|
updated.statusHistory = [...updated.statusHistory ?? [], {
|
|
9097
9417
|
from,
|
|
9098
9418
|
to,
|
|
@@ -9230,21 +9550,25 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
9230
9550
|
if (feature.status === "draft") validTransitions.push("active");
|
|
9231
9551
|
if (feature.status === "active") validTransitions.push("frozen");
|
|
9232
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;
|
|
9233
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";
|
|
9234
9557
|
const sinceDate = (feature.statusHistory ? [...feature.statusHistory].reverse().find((h) => h.to === feature.status) : void 0)?.date ?? null;
|
|
9235
9558
|
return { content: [{
|
|
9236
9559
|
type: "text",
|
|
9237
9560
|
text: [
|
|
9238
|
-
`Key
|
|
9239
|
-
`Title
|
|
9240
|
-
`Status
|
|
9241
|
-
`Missing
|
|
9242
|
-
`Stale
|
|
9243
|
-
`
|
|
9244
|
-
`
|
|
9245
|
-
`
|
|
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}`,
|
|
9246
9570
|
``,
|
|
9247
|
-
`Next action: ${nextAction}`
|
|
9571
|
+
`Next action : ${nextAction}`
|
|
9248
9572
|
].join("\n")
|
|
9249
9573
|
}] };
|
|
9250
9574
|
}
|
|
@@ -9283,27 +9607,129 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
9283
9607
|
parts.push(file.content);
|
|
9284
9608
|
}
|
|
9285
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.`;
|
|
9286
9717
|
return { content: [{
|
|
9287
9718
|
type: "text",
|
|
9288
9719
|
text: `${`## Extract feature.json from existing code
|
|
9289
9720
|
|
|
9290
9721
|
No feature.json exists at "${dir}". Analyze the ${ctx.sourceFiles.length} source file(s) below and generate a complete feature.json proposal.
|
|
9291
9722
|
|
|
9723
|
+
Extraction mode: **${depthLabel}**${depthNote}
|
|
9724
|
+
|
|
9725
|
+
${granularityHint}
|
|
9726
|
+
|
|
9292
9727
|
When done, execute in order:
|
|
9293
9728
|
1. Call create_feature with: dir="${dir}", plus your generated title and problem
|
|
9294
|
-
2. Call write_feature_fields with: path="${dir}",
|
|
9729
|
+
2. Call write_feature_fields with: path="${dir}", and the fields listed below
|
|
9295
9730
|
3. Call advance_feature to transition when ready
|
|
9296
9731
|
|
|
9297
|
-
|
|
9298
|
-
**title** — Short descriptive name (5-10 words)
|
|
9299
|
-
**problem** — What problem does this code solve? 1-2 sentences.
|
|
9300
|
-
**domain** — Single lowercase word or hyphenated phrase (e.g. "auth", "data-pipeline")
|
|
9301
|
-
**tags** — 3-6 lowercase tags as JSON array: ["tag1", "tag2"]
|
|
9302
|
-
**analysis** — Architectural overview, key patterns, why they were chosen. 150-300 words.
|
|
9303
|
-
**decisions** — 2-4 key technical decisions as JSON array: [{"decision":"...","rationale":"...","alternativesConsidered":["..."]}]
|
|
9304
|
-
**implementation** — Main components, data flow, non-obvious patterns. 100-200 words.
|
|
9305
|
-
**knownLimitations** — 2-4 limitations/TODOs as JSON array: ["..."]
|
|
9306
|
-
**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}`
|
|
9307
9733
|
}] };
|
|
9308
9734
|
}
|
|
9309
9735
|
case "feature_changelog": {
|
|
@@ -9359,12 +9785,12 @@ When done, execute in order:
|
|
|
9359
9785
|
date: ann.date,
|
|
9360
9786
|
label: `[${ann.type}] ${ann.body} (by ${ann.author})`
|
|
9361
9787
|
});
|
|
9362
|
-
const annotatedChildren = new Set((feature.annotations ?? []).filter((a
|
|
9788
|
+
const annotatedChildren = new Set((feature.annotations ?? []).filter((a) => a.type === "spawn").map((a) => a.body));
|
|
9363
9789
|
for (const child of feature.lineage?.children ?? []) if (!annotatedChildren.has(child)) events.push({
|
|
9364
9790
|
date: "(unknown)",
|
|
9365
9791
|
label: `↳ spawned child: ${child}`
|
|
9366
9792
|
});
|
|
9367
|
-
events.sort((a
|
|
9793
|
+
events.sort((a, b) => a.date.localeCompare(b.date));
|
|
9368
9794
|
const decisionsLine = feature.decisions?.length ? `\nDecisions: ${feature.decisions.map((d) => `"${d.decision}"`).join(" · ")}` : "";
|
|
9369
9795
|
return { content: [{
|
|
9370
9796
|
type: "text",
|
|
@@ -9383,10 +9809,10 @@ When done, execute in order:
|
|
|
9383
9809
|
const group = byStatus[f.feature.status];
|
|
9384
9810
|
if (group) group.push(f);
|
|
9385
9811
|
}
|
|
9386
|
-
for (const group of Object.values(byStatus)) group.sort((a
|
|
9387
|
-
const pa = a
|
|
9812
|
+
for (const group of Object.values(byStatus)) group.sort((a, b) => {
|
|
9813
|
+
const pa = a.feature.priority ?? 9999;
|
|
9388
9814
|
const pb = b.feature.priority ?? 9999;
|
|
9389
|
-
return pa !== pb ? pa - pb : a
|
|
9815
|
+
return pa !== pb ? pa - pb : a.feature.featureKey.localeCompare(b.feature.featureKey);
|
|
9390
9816
|
});
|
|
9391
9817
|
const formatGroup = (status, items) => {
|
|
9392
9818
|
if (items.length === 0) return "";
|
|
@@ -9521,18 +9947,18 @@ Analyze the source files and determine whether this feature should be broken int
|
|
|
9521
9947
|
const scanDir = a.path ? resolvePath(String(a.path)) : workspaceRoot;
|
|
9522
9948
|
const format = a.format === "json" ? "json" : "markdown";
|
|
9523
9949
|
function readReadmeSummary(dir) {
|
|
9524
|
-
for (const name
|
|
9950
|
+
for (const name of [
|
|
9525
9951
|
"README.md",
|
|
9526
9952
|
"readme.md",
|
|
9527
9953
|
"Readme.md"
|
|
9528
9954
|
]) {
|
|
9529
|
-
const p = path.join(dir, name
|
|
9955
|
+
const p = path.join(dir, name);
|
|
9530
9956
|
if (!fs.existsSync(p)) continue;
|
|
9531
9957
|
try {
|
|
9532
|
-
const lines
|
|
9958
|
+
const lines = fs.readFileSync(p, "utf-8").split("\n");
|
|
9533
9959
|
const parts = [];
|
|
9534
9960
|
let started = false;
|
|
9535
|
-
for (const line of lines
|
|
9961
|
+
for (const line of lines) {
|
|
9536
9962
|
if (!started && line.trim()) started = true;
|
|
9537
9963
|
if (!started) continue;
|
|
9538
9964
|
parts.push(line);
|
|
@@ -9566,7 +9992,7 @@ Analyze the source files and determine whether this feature should be broken int
|
|
|
9566
9992
|
for (const { feature } of allFeatures) {
|
|
9567
9993
|
const s = feature.status;
|
|
9568
9994
|
if (s in statusCounts) statusCounts[s] = (statusCounts[s] ?? 0) + 1;
|
|
9569
|
-
if (feature.annotations?.some((a
|
|
9995
|
+
if (feature.annotations?.some((a) => a.type === "stale-review")) staleCount++;
|
|
9570
9996
|
}
|
|
9571
9997
|
const byDomain = /* @__PURE__ */ new Map();
|
|
9572
9998
|
const noDomain = [];
|
|
@@ -9623,7 +10049,7 @@ Analyze the source files and determine whether this feature should be broken int
|
|
|
9623
10049
|
const readmeLine = readme ? `\n ${(readme.split("\n")[0] ?? "").replace(/^#+\s*/, "").slice(0, 80)}` : "";
|
|
9624
10050
|
return ` ${statusIcon(feature.status)} ${feature.featureKey.padEnd(18)} ${feature.title}${tags}${dec}\n ${problem}${readmeLine}`;
|
|
9625
10051
|
};
|
|
9626
|
-
for (const [domain, features] of [...byDomain.entries()].sort(([a
|
|
10052
|
+
for (const [domain, features] of [...byDomain.entries()].sort(([a], [b]) => a.localeCompare(b))) {
|
|
9627
10053
|
lines.push(`### ${domain}`);
|
|
9628
10054
|
for (const { feature, filePath } of features) lines.push(formatRow(feature, filePath));
|
|
9629
10055
|
lines.push("");
|
|
@@ -9642,6 +10068,111 @@ Analyze the source files and determine whether this feature should be broken int
|
|
|
9642
10068
|
case "feature_similarity": return { ...handleFeatureSimilarity(a, workspaceRoot) };
|
|
9643
10069
|
case "time_travel": return { ...handleTimeTravel(a, workspaceRoot) };
|
|
9644
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
|
+
}
|
|
9645
10176
|
case "extract_all_features": {
|
|
9646
10177
|
const toUnix = (p) => p.replace(/\\/g, "/");
|
|
9647
10178
|
const scanRoot = a.path ? resolvePath(String(a.path)) : workspaceRoot;
|
|
@@ -9730,9 +10261,9 @@ Analyze the source files and determine whether this feature should be broken int
|
|
|
9730
10261
|
else if (depth > 0) {
|
|
9731
10262
|
const signals = [];
|
|
9732
10263
|
let sourceFileCount = 0;
|
|
9733
|
-
for (const name
|
|
9734
|
-
if (MODULE_SIGNALS.has(name
|
|
9735
|
-
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++;
|
|
9736
10267
|
}
|
|
9737
10268
|
if (strategy === "module" ? signals.length > 0 : sourceFileCount > 0) candidates.push({
|
|
9738
10269
|
dir,
|
|
@@ -9749,7 +10280,7 @@ Analyze the source files and determine whether this feature should be broken int
|
|
|
9749
10280
|
}
|
|
9750
10281
|
}
|
|
9751
10282
|
mcpWalk(scanRoot, 0);
|
|
9752
|
-
candidates.sort((a
|
|
10283
|
+
candidates.sort((a, b) => a.dir.split(path.sep).length - b.dir.split(path.sep).length);
|
|
9753
10284
|
const candidateDirs = new Set(candidates.map((c) => c.dir));
|
|
9754
10285
|
for (const c of candidates) {
|
|
9755
10286
|
let parent = path.dirname(c.dir);
|
|
@@ -9881,22 +10412,20 @@ function statusIcon(status) {
|
|
|
9881
10412
|
deprecated: "⊘"
|
|
9882
10413
|
}[status] ?? "?";
|
|
9883
10414
|
}
|
|
9884
|
-
const REQUIRED_FOR_ACTIVE = [
|
|
9885
|
-
"analysis",
|
|
9886
|
-
"implementation",
|
|
9887
|
-
"successCriteria"
|
|
9888
|
-
];
|
|
10415
|
+
const REQUIRED_FOR_ACTIVE = ["analysis"];
|
|
9889
10416
|
const REQUIRED_FOR_FROZEN = [
|
|
9890
10417
|
"analysis",
|
|
9891
10418
|
"implementation",
|
|
9892
10419
|
"successCriteria",
|
|
9893
10420
|
"knownLimitations",
|
|
9894
|
-
"tags"
|
|
10421
|
+
"tags",
|
|
10422
|
+
"userGuide",
|
|
10423
|
+
"componentFile"
|
|
9895
10424
|
];
|
|
9896
10425
|
function getMissingForTransition(feature, to) {
|
|
9897
|
-
const required
|
|
10426
|
+
const required = to === "active" ? REQUIRED_FOR_ACTIVE : to === "frozen" ? REQUIRED_FOR_FROZEN : [];
|
|
9898
10427
|
const missing = [];
|
|
9899
|
-
for (const field of required
|
|
10428
|
+
for (const field of required) {
|
|
9900
10429
|
const val = feature[field];
|
|
9901
10430
|
if (val === void 0 || val === null) {
|
|
9902
10431
|
missing.push(field);
|
|
@@ -9911,7 +10440,7 @@ function getMissingForTransition(feature, to) {
|
|
|
9911
10440
|
continue;
|
|
9912
10441
|
}
|
|
9913
10442
|
}
|
|
9914
|
-
if (
|
|
10443
|
+
if (to === "frozen" && (!feature.decisions || feature.decisions.length === 0)) missing.push("decisions");
|
|
9915
10444
|
return [...new Set(missing)];
|
|
9916
10445
|
}
|
|
9917
10446
|
function checkIllegalTransition(from, to) {
|
|
@@ -9929,6 +10458,5 @@ main().catch((err) => {
|
|
|
9929
10458
|
process$1.stderr.write(`Fatal: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
9930
10459
|
process$1.exit(1);
|
|
9931
10460
|
});
|
|
9932
|
-
|
|
9933
10461
|
//#endregion
|
|
9934
|
-
export {
|
|
10462
|
+
export {};
|