mrvn-cli 0.2.8 → 0.2.10

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.js CHANGED
@@ -213,6 +213,11 @@ var DocumentStore = class {
213
213
  const raw = fs3.readFileSync(filePath, "utf-8");
214
214
  const doc = parseDocument(raw, filePath);
215
215
  if (doc.frontmatter.id) {
216
+ if (this.index.has(doc.frontmatter.id)) {
217
+ console.warn(
218
+ `[marvin] Duplicate ID "${doc.frontmatter.id}" in ${file2} \u2014 conflicts with existing entry. Run ID repair to fix.`
219
+ );
220
+ }
216
221
  this.index.set(doc.frontmatter.id, doc.frontmatter);
217
222
  }
218
223
  }
@@ -336,14 +341,19 @@ var DocumentStore = class {
336
341
  const dirName = this.typeDirs[type];
337
342
  const dir = path3.join(this.docsDir, dirName);
338
343
  if (!fs3.existsSync(dir)) return `${prefix}-001`;
344
+ const idPattern = new RegExp(`^${prefix}-(\\d+)$`);
339
345
  const files = fs3.readdirSync(dir).filter((f) => f.endsWith(".md"));
340
346
  let maxNum = 0;
341
347
  for (const file2 of files) {
342
- const match = file2.match(new RegExp(`^${prefix}-(\\d+)\\.md$`));
348
+ const filePath = path3.join(dir, file2);
349
+ const raw = fs3.readFileSync(filePath, "utf-8");
350
+ const doc = parseDocument(raw, filePath);
351
+ const match = doc.frontmatter.id?.match(idPattern);
343
352
  if (match) {
344
353
  maxNum = Math.max(maxNum, parseInt(match[1], 10));
345
354
  }
346
355
  }
356
+ maxNum = Math.max(maxNum, files.length);
347
357
  return `${prefix}-${String(maxNum + 1).padStart(3, "0")}`;
348
358
  }
349
359
  counts() {
@@ -500,14 +510,14 @@ function getPersona(idOrShortName) {
500
510
  function listPersonas() {
501
511
  return [...BUILTIN_PERSONAS];
502
512
  }
503
- function resolvePersonaId(input3) {
504
- const persona = getPersona(input3);
513
+ function resolvePersonaId(input4) {
514
+ const persona = getPersona(input4);
505
515
  if (!persona) {
506
516
  const available = BUILTIN_PERSONAS.map(
507
517
  (p) => `${p.shortName} (${p.name})`
508
518
  ).join(", ");
509
519
  throw new Error(
510
- `Unknown persona "${input3}". Available: ${available}`
520
+ `Unknown persona "${input4}". Available: ${available}`
511
521
  );
512
522
  }
513
523
  return persona.id;
@@ -1266,8 +1276,8 @@ function cached(getter) {
1266
1276
  }
1267
1277
  };
1268
1278
  }
1269
- function nullish(input3) {
1270
- return input3 === null || input3 === void 0;
1279
+ function nullish(input4) {
1280
+ return input4 === null || input4 === void 0;
1271
1281
  }
1272
1282
  function cleanRegex(source) {
1273
1283
  const start = source.startsWith("^") ? 1 : 0;
@@ -1361,8 +1371,8 @@ function randomString(length = 10) {
1361
1371
  function esc(str) {
1362
1372
  return JSON.stringify(str);
1363
1373
  }
1364
- function slugify2(input3) {
1365
- return input3.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
1374
+ function slugify2(input4) {
1375
+ return input4.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
1366
1376
  }
1367
1377
  var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
1368
1378
  };
@@ -1744,19 +1754,19 @@ function finalizeIssue(iss, ctx, config2) {
1744
1754
  }
1745
1755
  return full;
1746
1756
  }
1747
- function getSizableOrigin(input3) {
1748
- if (input3 instanceof Set)
1757
+ function getSizableOrigin(input4) {
1758
+ if (input4 instanceof Set)
1749
1759
  return "set";
1750
- if (input3 instanceof Map)
1760
+ if (input4 instanceof Map)
1751
1761
  return "map";
1752
- if (input3 instanceof File)
1762
+ if (input4 instanceof File)
1753
1763
  return "file";
1754
1764
  return "unknown";
1755
1765
  }
1756
- function getLengthableOrigin(input3) {
1757
- if (Array.isArray(input3))
1766
+ function getLengthableOrigin(input4) {
1767
+ if (Array.isArray(input4))
1758
1768
  return "array";
1759
- if (typeof input3 === "string")
1769
+ if (typeof input4 === "string")
1760
1770
  return "string";
1761
1771
  return "unknown";
1762
1772
  }
@@ -1782,12 +1792,12 @@ function parsedType(data) {
1782
1792
  return t;
1783
1793
  }
1784
1794
  function issue(...args) {
1785
- const [iss, input3, inst] = args;
1795
+ const [iss, input4, inst] = args;
1786
1796
  if (typeof iss === "string") {
1787
1797
  return {
1788
1798
  message: iss,
1789
1799
  code: "custom",
1790
- input: input3,
1800
+ input: input4,
1791
1801
  inst
1792
1802
  };
1793
1803
  }
@@ -2326,23 +2336,23 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
2326
2336
  bag.pattern = integer;
2327
2337
  });
2328
2338
  inst._zod.check = (payload) => {
2329
- const input3 = payload.value;
2339
+ const input4 = payload.value;
2330
2340
  if (isInt) {
2331
- if (!Number.isInteger(input3)) {
2341
+ if (!Number.isInteger(input4)) {
2332
2342
  payload.issues.push({
2333
2343
  expected: origin,
2334
2344
  format: def.format,
2335
2345
  code: "invalid_type",
2336
2346
  continue: false,
2337
- input: input3,
2347
+ input: input4,
2338
2348
  inst
2339
2349
  });
2340
2350
  return;
2341
2351
  }
2342
- if (!Number.isSafeInteger(input3)) {
2343
- if (input3 > 0) {
2352
+ if (!Number.isSafeInteger(input4)) {
2353
+ if (input4 > 0) {
2344
2354
  payload.issues.push({
2345
- input: input3,
2355
+ input: input4,
2346
2356
  code: "too_big",
2347
2357
  maximum: Number.MAX_SAFE_INTEGER,
2348
2358
  note: "Integers must be within the safe integer range.",
@@ -2353,7 +2363,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
2353
2363
  });
2354
2364
  } else {
2355
2365
  payload.issues.push({
2356
- input: input3,
2366
+ input: input4,
2357
2367
  code: "too_small",
2358
2368
  minimum: Number.MIN_SAFE_INTEGER,
2359
2369
  note: "Integers must be within the safe integer range.",
@@ -2366,10 +2376,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
2366
2376
  return;
2367
2377
  }
2368
2378
  }
2369
- if (input3 < minimum) {
2379
+ if (input4 < minimum) {
2370
2380
  payload.issues.push({
2371
2381
  origin: "number",
2372
- input: input3,
2382
+ input: input4,
2373
2383
  code: "too_small",
2374
2384
  minimum,
2375
2385
  inclusive: true,
@@ -2377,10 +2387,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
2377
2387
  continue: !def.abort
2378
2388
  });
2379
2389
  }
2380
- if (input3 > maximum) {
2390
+ if (input4 > maximum) {
2381
2391
  payload.issues.push({
2382
2392
  origin: "number",
2383
- input: input3,
2393
+ input: input4,
2384
2394
  code: "too_big",
2385
2395
  maximum,
2386
2396
  inclusive: true,
@@ -2400,11 +2410,11 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
2400
2410
  bag.maximum = maximum;
2401
2411
  });
2402
2412
  inst._zod.check = (payload) => {
2403
- const input3 = payload.value;
2404
- if (input3 < minimum) {
2413
+ const input4 = payload.value;
2414
+ if (input4 < minimum) {
2405
2415
  payload.issues.push({
2406
2416
  origin: "bigint",
2407
- input: input3,
2417
+ input: input4,
2408
2418
  code: "too_small",
2409
2419
  minimum,
2410
2420
  inclusive: true,
@@ -2412,10 +2422,10 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
2412
2422
  continue: !def.abort
2413
2423
  });
2414
2424
  }
2415
- if (input3 > maximum) {
2425
+ if (input4 > maximum) {
2416
2426
  payload.issues.push({
2417
2427
  origin: "bigint",
2418
- input: input3,
2428
+ input: input4,
2419
2429
  code: "too_big",
2420
2430
  maximum,
2421
2431
  inclusive: true,
@@ -2438,16 +2448,16 @@ var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, d
2438
2448
  inst2._zod.bag.maximum = def.maximum;
2439
2449
  });
2440
2450
  inst._zod.check = (payload) => {
2441
- const input3 = payload.value;
2442
- const size = input3.size;
2451
+ const input4 = payload.value;
2452
+ const size = input4.size;
2443
2453
  if (size <= def.maximum)
2444
2454
  return;
2445
2455
  payload.issues.push({
2446
- origin: getSizableOrigin(input3),
2456
+ origin: getSizableOrigin(input4),
2447
2457
  code: "too_big",
2448
2458
  maximum: def.maximum,
2449
2459
  inclusive: true,
2450
- input: input3,
2460
+ input: input4,
2451
2461
  inst,
2452
2462
  continue: !def.abort
2453
2463
  });
@@ -2466,16 +2476,16 @@ var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, d
2466
2476
  inst2._zod.bag.minimum = def.minimum;
2467
2477
  });
2468
2478
  inst._zod.check = (payload) => {
2469
- const input3 = payload.value;
2470
- const size = input3.size;
2479
+ const input4 = payload.value;
2480
+ const size = input4.size;
2471
2481
  if (size >= def.minimum)
2472
2482
  return;
2473
2483
  payload.issues.push({
2474
- origin: getSizableOrigin(input3),
2484
+ origin: getSizableOrigin(input4),
2475
2485
  code: "too_small",
2476
2486
  minimum: def.minimum,
2477
2487
  inclusive: true,
2478
- input: input3,
2488
+ input: input4,
2479
2489
  inst,
2480
2490
  continue: !def.abort
2481
2491
  });
@@ -2495,13 +2505,13 @@ var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (i
2495
2505
  bag.size = def.size;
2496
2506
  });
2497
2507
  inst._zod.check = (payload) => {
2498
- const input3 = payload.value;
2499
- const size = input3.size;
2508
+ const input4 = payload.value;
2509
+ const size = input4.size;
2500
2510
  if (size === def.size)
2501
2511
  return;
2502
2512
  const tooBig = size > def.size;
2503
2513
  payload.issues.push({
2504
- origin: getSizableOrigin(input3),
2514
+ origin: getSizableOrigin(input4),
2505
2515
  ...tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size },
2506
2516
  inclusive: true,
2507
2517
  exact: true,
@@ -2524,17 +2534,17 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
2524
2534
  inst2._zod.bag.maximum = def.maximum;
2525
2535
  });
2526
2536
  inst._zod.check = (payload) => {
2527
- const input3 = payload.value;
2528
- const length = input3.length;
2537
+ const input4 = payload.value;
2538
+ const length = input4.length;
2529
2539
  if (length <= def.maximum)
2530
2540
  return;
2531
- const origin = getLengthableOrigin(input3);
2541
+ const origin = getLengthableOrigin(input4);
2532
2542
  payload.issues.push({
2533
2543
  origin,
2534
2544
  code: "too_big",
2535
2545
  maximum: def.maximum,
2536
2546
  inclusive: true,
2537
- input: input3,
2547
+ input: input4,
2538
2548
  inst,
2539
2549
  continue: !def.abort
2540
2550
  });
@@ -2553,17 +2563,17 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
2553
2563
  inst2._zod.bag.minimum = def.minimum;
2554
2564
  });
2555
2565
  inst._zod.check = (payload) => {
2556
- const input3 = payload.value;
2557
- const length = input3.length;
2566
+ const input4 = payload.value;
2567
+ const length = input4.length;
2558
2568
  if (length >= def.minimum)
2559
2569
  return;
2560
- const origin = getLengthableOrigin(input3);
2570
+ const origin = getLengthableOrigin(input4);
2561
2571
  payload.issues.push({
2562
2572
  origin,
2563
2573
  code: "too_small",
2564
2574
  minimum: def.minimum,
2565
2575
  inclusive: true,
2566
- input: input3,
2576
+ input: input4,
2567
2577
  inst,
2568
2578
  continue: !def.abort
2569
2579
  });
@@ -2583,11 +2593,11 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
2583
2593
  bag.length = def.length;
2584
2594
  });
2585
2595
  inst._zod.check = (payload) => {
2586
- const input3 = payload.value;
2587
- const length = input3.length;
2596
+ const input4 = payload.value;
2597
+ const length = input4.length;
2588
2598
  if (length === def.length)
2589
2599
  return;
2590
- const origin = getLengthableOrigin(input3);
2600
+ const origin = getLengthableOrigin(input4);
2591
2601
  const tooBig = length > def.length;
2592
2602
  payload.issues.push({
2593
2603
  origin,
@@ -3241,15 +3251,15 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
3241
3251
  payload.value = Number(payload.value);
3242
3252
  } catch (_) {
3243
3253
  }
3244
- const input3 = payload.value;
3245
- if (typeof input3 === "number" && !Number.isNaN(input3) && Number.isFinite(input3)) {
3254
+ const input4 = payload.value;
3255
+ if (typeof input4 === "number" && !Number.isNaN(input4) && Number.isFinite(input4)) {
3246
3256
  return payload;
3247
3257
  }
3248
- const received = typeof input3 === "number" ? Number.isNaN(input3) ? "NaN" : !Number.isFinite(input3) ? "Infinity" : void 0 : void 0;
3258
+ const received = typeof input4 === "number" ? Number.isNaN(input4) ? "NaN" : !Number.isFinite(input4) ? "Infinity" : void 0 : void 0;
3249
3259
  payload.issues.push({
3250
3260
  expected: "number",
3251
3261
  code: "invalid_type",
3252
- input: input3,
3262
+ input: input4,
3253
3263
  inst,
3254
3264
  ...received ? { received } : {}
3255
3265
  });
@@ -3269,13 +3279,13 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
3269
3279
  payload.value = Boolean(payload.value);
3270
3280
  } catch (_) {
3271
3281
  }
3272
- const input3 = payload.value;
3273
- if (typeof input3 === "boolean")
3282
+ const input4 = payload.value;
3283
+ if (typeof input4 === "boolean")
3274
3284
  return payload;
3275
3285
  payload.issues.push({
3276
3286
  expected: "boolean",
3277
3287
  code: "invalid_type",
3278
- input: input3,
3288
+ input: input4,
3279
3289
  inst
3280
3290
  });
3281
3291
  return payload;
@@ -3308,13 +3318,13 @@ var $ZodBigIntFormat = /* @__PURE__ */ $constructor("$ZodBigIntFormat", (inst, d
3308
3318
  var $ZodSymbol = /* @__PURE__ */ $constructor("$ZodSymbol", (inst, def) => {
3309
3319
  $ZodType.init(inst, def);
3310
3320
  inst._zod.parse = (payload, _ctx) => {
3311
- const input3 = payload.value;
3312
- if (typeof input3 === "symbol")
3321
+ const input4 = payload.value;
3322
+ if (typeof input4 === "symbol")
3313
3323
  return payload;
3314
3324
  payload.issues.push({
3315
3325
  expected: "symbol",
3316
3326
  code: "invalid_type",
3317
- input: input3,
3327
+ input: input4,
3318
3328
  inst
3319
3329
  });
3320
3330
  return payload;
@@ -3327,13 +3337,13 @@ var $ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) =>
3327
3337
  inst._zod.optin = "optional";
3328
3338
  inst._zod.optout = "optional";
3329
3339
  inst._zod.parse = (payload, _ctx) => {
3330
- const input3 = payload.value;
3331
- if (typeof input3 === "undefined")
3340
+ const input4 = payload.value;
3341
+ if (typeof input4 === "undefined")
3332
3342
  return payload;
3333
3343
  payload.issues.push({
3334
3344
  expected: "undefined",
3335
3345
  code: "invalid_type",
3336
- input: input3,
3346
+ input: input4,
3337
3347
  inst
3338
3348
  });
3339
3349
  return payload;
@@ -3344,13 +3354,13 @@ var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
3344
3354
  inst._zod.pattern = _null;
3345
3355
  inst._zod.values = /* @__PURE__ */ new Set([null]);
3346
3356
  inst._zod.parse = (payload, _ctx) => {
3347
- const input3 = payload.value;
3348
- if (input3 === null)
3357
+ const input4 = payload.value;
3358
+ if (input4 === null)
3349
3359
  return payload;
3350
3360
  payload.issues.push({
3351
3361
  expected: "null",
3352
3362
  code: "invalid_type",
3353
- input: input3,
3363
+ input: input4,
3354
3364
  inst
3355
3365
  });
3356
3366
  return payload;
@@ -3379,13 +3389,13 @@ var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
3379
3389
  var $ZodVoid = /* @__PURE__ */ $constructor("$ZodVoid", (inst, def) => {
3380
3390
  $ZodType.init(inst, def);
3381
3391
  inst._zod.parse = (payload, _ctx) => {
3382
- const input3 = payload.value;
3383
- if (typeof input3 === "undefined")
3392
+ const input4 = payload.value;
3393
+ if (typeof input4 === "undefined")
3384
3394
  return payload;
3385
3395
  payload.issues.push({
3386
3396
  expected: "void",
3387
3397
  code: "invalid_type",
3388
- input: input3,
3398
+ input: input4,
3389
3399
  inst
3390
3400
  });
3391
3401
  return payload;
@@ -3400,15 +3410,15 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
3400
3410
  } catch (_err) {
3401
3411
  }
3402
3412
  }
3403
- const input3 = payload.value;
3404
- const isDate = input3 instanceof Date;
3405
- const isValidDate = isDate && !Number.isNaN(input3.getTime());
3413
+ const input4 = payload.value;
3414
+ const isDate = input4 instanceof Date;
3415
+ const isValidDate = isDate && !Number.isNaN(input4.getTime());
3406
3416
  if (isValidDate)
3407
3417
  return payload;
3408
3418
  payload.issues.push({
3409
3419
  expected: "date",
3410
3420
  code: "invalid_type",
3411
- input: input3,
3421
+ input: input4,
3412
3422
  ...isDate ? { received: "Invalid Date" } : {},
3413
3423
  inst
3414
3424
  });
@@ -3424,20 +3434,20 @@ function handleArrayResult(result, final, index) {
3424
3434
  var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
3425
3435
  $ZodType.init(inst, def);
3426
3436
  inst._zod.parse = (payload, ctx) => {
3427
- const input3 = payload.value;
3428
- if (!Array.isArray(input3)) {
3437
+ const input4 = payload.value;
3438
+ if (!Array.isArray(input4)) {
3429
3439
  payload.issues.push({
3430
3440
  expected: "array",
3431
3441
  code: "invalid_type",
3432
- input: input3,
3442
+ input: input4,
3433
3443
  inst
3434
3444
  });
3435
3445
  return payload;
3436
3446
  }
3437
- payload.value = Array(input3.length);
3447
+ payload.value = Array(input4.length);
3438
3448
  const proms = [];
3439
- for (let i = 0; i < input3.length; i++) {
3440
- const item = input3[i];
3449
+ for (let i = 0; i < input4.length; i++) {
3450
+ const item = input4[i];
3441
3451
  const result = def.element._zod.run({
3442
3452
  value: item,
3443
3453
  issues: []
@@ -3454,15 +3464,15 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
3454
3464
  return payload;
3455
3465
  };
3456
3466
  });
3457
- function handlePropertyResult(result, final, key, input3, isOptionalOut) {
3467
+ function handlePropertyResult(result, final, key, input4, isOptionalOut) {
3458
3468
  if (result.issues.length) {
3459
- if (isOptionalOut && !(key in input3)) {
3469
+ if (isOptionalOut && !(key in input4)) {
3460
3470
  return;
3461
3471
  }
3462
3472
  final.issues.push(...prefixIssues(key, result.issues));
3463
3473
  }
3464
3474
  if (result.value === void 0) {
3465
- if (key in input3) {
3475
+ if (key in input4) {
3466
3476
  final.value[key] = void 0;
3467
3477
  }
3468
3478
  } else {
@@ -3485,31 +3495,31 @@ function normalizeDef(def) {
3485
3495
  optionalKeys: new Set(okeys)
3486
3496
  };
3487
3497
  }
3488
- function handleCatchall(proms, input3, payload, ctx, def, inst) {
3498
+ function handleCatchall(proms, input4, payload, ctx, def, inst) {
3489
3499
  const unrecognized = [];
3490
3500
  const keySet = def.keySet;
3491
3501
  const _catchall = def.catchall._zod;
3492
3502
  const t = _catchall.def.type;
3493
3503
  const isOptionalOut = _catchall.optout === "optional";
3494
- for (const key in input3) {
3504
+ for (const key in input4) {
3495
3505
  if (keySet.has(key))
3496
3506
  continue;
3497
3507
  if (t === "never") {
3498
3508
  unrecognized.push(key);
3499
3509
  continue;
3500
3510
  }
3501
- const r = _catchall.run({ value: input3[key], issues: [] }, ctx);
3511
+ const r = _catchall.run({ value: input4[key], issues: [] }, ctx);
3502
3512
  if (r instanceof Promise) {
3503
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input3, isOptionalOut)));
3513
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input4, isOptionalOut)));
3504
3514
  } else {
3505
- handlePropertyResult(r, payload, key, input3, isOptionalOut);
3515
+ handlePropertyResult(r, payload, key, input4, isOptionalOut);
3506
3516
  }
3507
3517
  }
3508
3518
  if (unrecognized.length) {
3509
3519
  payload.issues.push({
3510
3520
  code: "unrecognized_keys",
3511
3521
  keys: unrecognized,
3512
- input: input3,
3522
+ input: input4,
3513
3523
  inst
3514
3524
  });
3515
3525
  }
@@ -3553,12 +3563,12 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3553
3563
  let value;
3554
3564
  inst._zod.parse = (payload, ctx) => {
3555
3565
  value ?? (value = _normalized.value);
3556
- const input3 = payload.value;
3557
- if (!isObject2(input3)) {
3566
+ const input4 = payload.value;
3567
+ if (!isObject2(input4)) {
3558
3568
  payload.issues.push({
3559
3569
  expected: "object",
3560
3570
  code: "invalid_type",
3561
- input: input3,
3571
+ input: input4,
3562
3572
  inst
3563
3573
  });
3564
3574
  return payload;
@@ -3569,17 +3579,17 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3569
3579
  for (const key of value.keys) {
3570
3580
  const el = shape[key];
3571
3581
  const isOptionalOut = el._zod.optout === "optional";
3572
- const r = el._zod.run({ value: input3[key], issues: [] }, ctx);
3582
+ const r = el._zod.run({ value: input4[key], issues: [] }, ctx);
3573
3583
  if (r instanceof Promise) {
3574
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input3, isOptionalOut)));
3584
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input4, isOptionalOut)));
3575
3585
  } else {
3576
- handlePropertyResult(r, payload, key, input3, isOptionalOut);
3586
+ handlePropertyResult(r, payload, key, input4, isOptionalOut);
3577
3587
  }
3578
3588
  }
3579
3589
  if (!catchall) {
3580
3590
  return proms.length ? Promise.all(proms).then(() => payload) : payload;
3581
3591
  }
3582
- return handleCatchall(proms, input3, payload, ctx, _normalized.value, inst);
3592
+ return handleCatchall(proms, input4, payload, ctx, _normalized.value, inst);
3583
3593
  };
3584
3594
  });
3585
3595
  var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
@@ -3660,12 +3670,12 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3660
3670
  let value;
3661
3671
  inst._zod.parse = (payload, ctx) => {
3662
3672
  value ?? (value = _normalized.value);
3663
- const input3 = payload.value;
3664
- if (!isObject2(input3)) {
3673
+ const input4 = payload.value;
3674
+ if (!isObject2(input4)) {
3665
3675
  payload.issues.push({
3666
3676
  expected: "object",
3667
3677
  code: "invalid_type",
3668
- input: input3,
3678
+ input: input4,
3669
3679
  inst
3670
3680
  });
3671
3681
  return payload;
@@ -3676,7 +3686,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3676
3686
  payload = fastpass(payload, ctx);
3677
3687
  if (!catchall)
3678
3688
  return payload;
3679
- return handleCatchall([], input3, payload, ctx, value, inst);
3689
+ return handleCatchall([], input4, payload, ctx, value, inst);
3680
3690
  }
3681
3691
  return superParse(payload, ctx);
3682
3692
  };
@@ -3838,17 +3848,17 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3838
3848
  return map2;
3839
3849
  });
3840
3850
  inst._zod.parse = (payload, ctx) => {
3841
- const input3 = payload.value;
3842
- if (!isObject(input3)) {
3851
+ const input4 = payload.value;
3852
+ if (!isObject(input4)) {
3843
3853
  payload.issues.push({
3844
3854
  code: "invalid_type",
3845
3855
  expected: "object",
3846
- input: input3,
3856
+ input: input4,
3847
3857
  inst
3848
3858
  });
3849
3859
  return payload;
3850
3860
  }
3851
- const opt = disc.value.get(input3?.[def.discriminator]);
3861
+ const opt = disc.value.get(input4?.[def.discriminator]);
3852
3862
  if (opt) {
3853
3863
  return opt._zod.run(payload, ctx);
3854
3864
  }
@@ -3860,7 +3870,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3860
3870
  errors: [],
3861
3871
  note: "No matching discriminator",
3862
3872
  discriminator: def.discriminator,
3863
- input: input3,
3873
+ input: input4,
3864
3874
  path: [def.discriminator],
3865
3875
  inst
3866
3876
  });
@@ -3870,9 +3880,9 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3870
3880
  var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
3871
3881
  $ZodType.init(inst, def);
3872
3882
  inst._zod.parse = (payload, ctx) => {
3873
- const input3 = payload.value;
3874
- const left = def.left._zod.run({ value: input3, issues: [] }, ctx);
3875
- const right = def.right._zod.run({ value: input3, issues: [] }, ctx);
3883
+ const input4 = payload.value;
3884
+ const left = def.left._zod.run({ value: input4, issues: [] }, ctx);
3885
+ const right = def.right._zod.run({ value: input4, issues: [] }, ctx);
3876
3886
  const async = left instanceof Promise || right instanceof Promise;
3877
3887
  if (async) {
3878
3888
  return Promise.all([left, right]).then(([left2, right2]) => {
@@ -3969,10 +3979,10 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
3969
3979
  $ZodType.init(inst, def);
3970
3980
  const items = def.items;
3971
3981
  inst._zod.parse = (payload, ctx) => {
3972
- const input3 = payload.value;
3973
- if (!Array.isArray(input3)) {
3982
+ const input4 = payload.value;
3983
+ if (!Array.isArray(input4)) {
3974
3984
  payload.issues.push({
3975
- input: input3,
3985
+ input: input4,
3976
3986
  inst,
3977
3987
  expected: "tuple",
3978
3988
  code: "invalid_type"
@@ -3984,12 +3994,12 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
3984
3994
  const reversedIndex = [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
3985
3995
  const optStart = reversedIndex === -1 ? 0 : items.length - reversedIndex;
3986
3996
  if (!def.rest) {
3987
- const tooBig = input3.length > items.length;
3988
- const tooSmall = input3.length < optStart - 1;
3997
+ const tooBig = input4.length > items.length;
3998
+ const tooSmall = input4.length < optStart - 1;
3989
3999
  if (tooBig || tooSmall) {
3990
4000
  payload.issues.push({
3991
4001
  ...tooBig ? { code: "too_big", maximum: items.length, inclusive: true } : { code: "too_small", minimum: items.length },
3992
- input: input3,
4002
+ input: input4,
3993
4003
  inst,
3994
4004
  origin: "array"
3995
4005
  });
@@ -3999,12 +4009,12 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
3999
4009
  let i = -1;
4000
4010
  for (const item of items) {
4001
4011
  i++;
4002
- if (i >= input3.length) {
4012
+ if (i >= input4.length) {
4003
4013
  if (i >= optStart)
4004
4014
  continue;
4005
4015
  }
4006
4016
  const result = item._zod.run({
4007
- value: input3[i],
4017
+ value: input4[i],
4008
4018
  issues: []
4009
4019
  }, ctx);
4010
4020
  if (result instanceof Promise) {
@@ -4014,7 +4024,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
4014
4024
  }
4015
4025
  }
4016
4026
  if (def.rest) {
4017
- const rest = input3.slice(items.length);
4027
+ const rest = input4.slice(items.length);
4018
4028
  for (const el of rest) {
4019
4029
  i++;
4020
4030
  const result = def.rest._zod.run({
@@ -4042,12 +4052,12 @@ function handleTupleResult(result, final, index) {
4042
4052
  var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
4043
4053
  $ZodType.init(inst, def);
4044
4054
  inst._zod.parse = (payload, ctx) => {
4045
- const input3 = payload.value;
4046
- if (!isPlainObject(input3)) {
4055
+ const input4 = payload.value;
4056
+ if (!isPlainObject(input4)) {
4047
4057
  payload.issues.push({
4048
4058
  expected: "record",
4049
4059
  code: "invalid_type",
4050
- input: input3,
4060
+ input: input4,
4051
4061
  inst
4052
4062
  });
4053
4063
  return payload;
@@ -4060,7 +4070,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
4060
4070
  for (const key of values) {
4061
4071
  if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
4062
4072
  recordKeys.add(typeof key === "number" ? key.toString() : key);
4063
- const result = def.valueType._zod.run({ value: input3[key], issues: [] }, ctx);
4073
+ const result = def.valueType._zod.run({ value: input4[key], issues: [] }, ctx);
4064
4074
  if (result instanceof Promise) {
4065
4075
  proms.push(result.then((result2) => {
4066
4076
  if (result2.issues.length) {
@@ -4077,7 +4087,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
4077
4087
  }
4078
4088
  }
4079
4089
  let unrecognized;
4080
- for (const key in input3) {
4090
+ for (const key in input4) {
4081
4091
  if (!recordKeys.has(key)) {
4082
4092
  unrecognized = unrecognized ?? [];
4083
4093
  unrecognized.push(key);
@@ -4086,14 +4096,14 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
4086
4096
  if (unrecognized && unrecognized.length > 0) {
4087
4097
  payload.issues.push({
4088
4098
  code: "unrecognized_keys",
4089
- input: input3,
4099
+ input: input4,
4090
4100
  inst,
4091
4101
  keys: unrecognized
4092
4102
  });
4093
4103
  }
4094
4104
  } else {
4095
4105
  payload.value = {};
4096
- for (const key of Reflect.ownKeys(input3)) {
4106
+ for (const key of Reflect.ownKeys(input4)) {
4097
4107
  if (key === "__proto__")
4098
4108
  continue;
4099
4109
  let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
@@ -4112,7 +4122,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
4112
4122
  }
4113
4123
  if (keyResult.issues.length) {
4114
4124
  if (def.mode === "loose") {
4115
- payload.value[key] = input3[key];
4125
+ payload.value[key] = input4[key];
4116
4126
  } else {
4117
4127
  payload.issues.push({
4118
4128
  code: "invalid_key",
@@ -4125,7 +4135,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
4125
4135
  }
4126
4136
  continue;
4127
4137
  }
4128
- const result = def.valueType._zod.run({ value: input3[key], issues: [] }, ctx);
4138
+ const result = def.valueType._zod.run({ value: input4[key], issues: [] }, ctx);
4129
4139
  if (result instanceof Promise) {
4130
4140
  proms.push(result.then((result2) => {
4131
4141
  if (result2.issues.length) {
@@ -4150,27 +4160,27 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
4150
4160
  var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
4151
4161
  $ZodType.init(inst, def);
4152
4162
  inst._zod.parse = (payload, ctx) => {
4153
- const input3 = payload.value;
4154
- if (!(input3 instanceof Map)) {
4163
+ const input4 = payload.value;
4164
+ if (!(input4 instanceof Map)) {
4155
4165
  payload.issues.push({
4156
4166
  expected: "map",
4157
4167
  code: "invalid_type",
4158
- input: input3,
4168
+ input: input4,
4159
4169
  inst
4160
4170
  });
4161
4171
  return payload;
4162
4172
  }
4163
4173
  const proms = [];
4164
4174
  payload.value = /* @__PURE__ */ new Map();
4165
- for (const [key, value] of input3) {
4175
+ for (const [key, value] of input4) {
4166
4176
  const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
4167
4177
  const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx);
4168
4178
  if (keyResult instanceof Promise || valueResult instanceof Promise) {
4169
4179
  proms.push(Promise.all([keyResult, valueResult]).then(([keyResult2, valueResult2]) => {
4170
- handleMapResult(keyResult2, valueResult2, payload, key, input3, inst, ctx);
4180
+ handleMapResult(keyResult2, valueResult2, payload, key, input4, inst, ctx);
4171
4181
  }));
4172
4182
  } else {
4173
- handleMapResult(keyResult, valueResult, payload, key, input3, inst, ctx);
4183
+ handleMapResult(keyResult, valueResult, payload, key, input4, inst, ctx);
4174
4184
  }
4175
4185
  }
4176
4186
  if (proms.length)
@@ -4178,7 +4188,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
4178
4188
  return payload;
4179
4189
  };
4180
4190
  });
4181
- function handleMapResult(keyResult, valueResult, final, key, input3, inst, ctx) {
4191
+ function handleMapResult(keyResult, valueResult, final, key, input4, inst, ctx) {
4182
4192
  if (keyResult.issues.length) {
4183
4193
  if (propertyKeyTypes.has(typeof key)) {
4184
4194
  final.issues.push(...prefixIssues(key, keyResult.issues));
@@ -4186,7 +4196,7 @@ function handleMapResult(keyResult, valueResult, final, key, input3, inst, ctx)
4186
4196
  final.issues.push({
4187
4197
  code: "invalid_key",
4188
4198
  origin: "map",
4189
- input: input3,
4199
+ input: input4,
4190
4200
  inst,
4191
4201
  issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
4192
4202
  });
@@ -4199,7 +4209,7 @@ function handleMapResult(keyResult, valueResult, final, key, input3, inst, ctx)
4199
4209
  final.issues.push({
4200
4210
  origin: "map",
4201
4211
  code: "invalid_element",
4202
- input: input3,
4212
+ input: input4,
4203
4213
  inst,
4204
4214
  key,
4205
4215
  issues: valueResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
@@ -4211,10 +4221,10 @@ function handleMapResult(keyResult, valueResult, final, key, input3, inst, ctx)
4211
4221
  var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
4212
4222
  $ZodType.init(inst, def);
4213
4223
  inst._zod.parse = (payload, ctx) => {
4214
- const input3 = payload.value;
4215
- if (!(input3 instanceof Set)) {
4224
+ const input4 = payload.value;
4225
+ if (!(input4 instanceof Set)) {
4216
4226
  payload.issues.push({
4217
- input: input3,
4227
+ input: input4,
4218
4228
  inst,
4219
4229
  expected: "set",
4220
4230
  code: "invalid_type"
@@ -4223,7 +4233,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
4223
4233
  }
4224
4234
  const proms = [];
4225
4235
  payload.value = /* @__PURE__ */ new Set();
4226
- for (const item of input3) {
4236
+ for (const item of input4) {
4227
4237
  const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
4228
4238
  if (result instanceof Promise) {
4229
4239
  proms.push(result.then((result2) => handleSetResult(result2, payload)));
@@ -4248,14 +4258,14 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
4248
4258
  inst._zod.values = valuesSet;
4249
4259
  inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
4250
4260
  inst._zod.parse = (payload, _ctx) => {
4251
- const input3 = payload.value;
4252
- if (valuesSet.has(input3)) {
4261
+ const input4 = payload.value;
4262
+ if (valuesSet.has(input4)) {
4253
4263
  return payload;
4254
4264
  }
4255
4265
  payload.issues.push({
4256
4266
  code: "invalid_value",
4257
4267
  values,
4258
- input: input3,
4268
+ input: input4,
4259
4269
  inst
4260
4270
  });
4261
4271
  return payload;
@@ -4270,14 +4280,14 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
4270
4280
  inst._zod.values = values;
4271
4281
  inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
4272
4282
  inst._zod.parse = (payload, _ctx) => {
4273
- const input3 = payload.value;
4274
- if (values.has(input3)) {
4283
+ const input4 = payload.value;
4284
+ if (values.has(input4)) {
4275
4285
  return payload;
4276
4286
  }
4277
4287
  payload.issues.push({
4278
4288
  code: "invalid_value",
4279
4289
  values: def.values,
4280
- input: input3,
4290
+ input: input4,
4281
4291
  inst
4282
4292
  });
4283
4293
  return payload;
@@ -4286,13 +4296,13 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
4286
4296
  var $ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => {
4287
4297
  $ZodType.init(inst, def);
4288
4298
  inst._zod.parse = (payload, _ctx) => {
4289
- const input3 = payload.value;
4290
- if (input3 instanceof File)
4299
+ const input4 = payload.value;
4300
+ if (input4 instanceof File)
4291
4301
  return payload;
4292
4302
  payload.issues.push({
4293
4303
  expected: "file",
4294
4304
  code: "invalid_type",
4295
- input: input3,
4305
+ input: input4,
4296
4306
  inst
4297
4307
  });
4298
4308
  return payload;
@@ -4319,8 +4329,8 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) =>
4319
4329
  return payload;
4320
4330
  };
4321
4331
  });
4322
- function handleOptionalResult(result, input3) {
4323
- if (result.issues.length && input3 === void 0) {
4332
+ function handleOptionalResult(result, input4) {
4333
+ if (result.issues.length && input4 === void 0) {
4324
4334
  return { issues: [], value: void 0 };
4325
4335
  }
4326
4336
  return result;
@@ -4756,20 +4766,20 @@ var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
4756
4766
  return payload;
4757
4767
  };
4758
4768
  inst._zod.check = (payload) => {
4759
- const input3 = payload.value;
4760
- const r = def.fn(input3);
4769
+ const input4 = payload.value;
4770
+ const r = def.fn(input4);
4761
4771
  if (r instanceof Promise) {
4762
- return r.then((r2) => handleRefineResult(r2, payload, input3, inst));
4772
+ return r.then((r2) => handleRefineResult(r2, payload, input4, inst));
4763
4773
  }
4764
- handleRefineResult(r, payload, input3, inst);
4774
+ handleRefineResult(r, payload, input4, inst);
4765
4775
  return;
4766
4776
  };
4767
4777
  });
4768
- function handleRefineResult(result, payload, input3, inst) {
4778
+ function handleRefineResult(result, payload, input4, inst) {
4769
4779
  if (!result) {
4770
4780
  const _iss = {
4771
4781
  code: "custom",
4772
- input: input3,
4782
+ input: input4,
4773
4783
  inst,
4774
4784
  // incorporates params.error into issue reporting
4775
4785
  path: [...inst._zod.def.path ?? []],
@@ -11079,23 +11089,23 @@ function _overwrite(tx) {
11079
11089
  }
11080
11090
  // @__NO_SIDE_EFFECTS__
11081
11091
  function _normalize(form) {
11082
- return /* @__PURE__ */ _overwrite((input3) => input3.normalize(form));
11092
+ return /* @__PURE__ */ _overwrite((input4) => input4.normalize(form));
11083
11093
  }
11084
11094
  // @__NO_SIDE_EFFECTS__
11085
11095
  function _trim() {
11086
- return /* @__PURE__ */ _overwrite((input3) => input3.trim());
11096
+ return /* @__PURE__ */ _overwrite((input4) => input4.trim());
11087
11097
  }
11088
11098
  // @__NO_SIDE_EFFECTS__
11089
11099
  function _toLowerCase() {
11090
- return /* @__PURE__ */ _overwrite((input3) => input3.toLowerCase());
11100
+ return /* @__PURE__ */ _overwrite((input4) => input4.toLowerCase());
11091
11101
  }
11092
11102
  // @__NO_SIDE_EFFECTS__
11093
11103
  function _toUpperCase() {
11094
- return /* @__PURE__ */ _overwrite((input3) => input3.toUpperCase());
11104
+ return /* @__PURE__ */ _overwrite((input4) => input4.toUpperCase());
11095
11105
  }
11096
11106
  // @__NO_SIDE_EFFECTS__
11097
11107
  function _slugify() {
11098
- return /* @__PURE__ */ _overwrite((input3) => slugify2(input3));
11108
+ return /* @__PURE__ */ _overwrite((input4) => slugify2(input4));
11099
11109
  }
11100
11110
  // @__NO_SIDE_EFFECTS__
11101
11111
  function _array(Class2, element, params) {
@@ -11400,8 +11410,8 @@ function _stringbool(Classes, _params) {
11400
11410
  type: "pipe",
11401
11411
  in: stringSchema,
11402
11412
  out: booleanSchema,
11403
- transform: ((input3, payload) => {
11404
- let data = input3;
11413
+ transform: ((input4, payload) => {
11414
+ let data = input4;
11405
11415
  if (params.case !== "sensitive")
11406
11416
  data = data.toLowerCase();
11407
11417
  if (truthySet.has(data)) {
@@ -11420,8 +11430,8 @@ function _stringbool(Classes, _params) {
11420
11430
  return {};
11421
11431
  }
11422
11432
  }),
11423
- reverseTransform: ((input3, _payload) => {
11424
- if (input3 === true) {
11433
+ reverseTransform: ((input4, _payload) => {
11434
+ if (input4 === true) {
11425
11435
  return truthyArray[0] || "true";
11426
11436
  } else {
11427
11437
  return falsyArray[0] || "false";
@@ -12317,9 +12327,9 @@ var allProcessors = {
12317
12327
  optional: optionalProcessor,
12318
12328
  lazy: lazyProcessor
12319
12329
  };
12320
- function toJSONSchema(input3, params) {
12321
- if ("_idmap" in input3) {
12322
- const registry2 = input3;
12330
+ function toJSONSchema(input4, params) {
12331
+ if ("_idmap" in input4) {
12332
+ const registry2 = input4;
12323
12333
  const ctx2 = initializeContext({ ...params, processors: allProcessors });
12324
12334
  const defs = {};
12325
12335
  for (const entry of registry2._idmap.entries()) {
@@ -12347,9 +12357,9 @@ function toJSONSchema(input3, params) {
12347
12357
  return { schemas };
12348
12358
  }
12349
12359
  const ctx = initializeContext({ ...params, processors: allProcessors });
12350
- process2(input3, ctx);
12351
- extractDefs(ctx, input3);
12352
- return finalize(ctx, input3);
12360
+ process2(input4, ctx);
12361
+ extractDefs(ctx, input4);
12362
+ return finalize(ctx, input4);
12353
12363
  }
12354
12364
 
12355
12365
  // node_modules/zod/v4/core/json-schema-generator.js
@@ -17653,12 +17663,12 @@ var JiraClient = class {
17653
17663
  );
17654
17664
  }
17655
17665
  };
17656
- function createJiraClient() {
17657
- const host = process.env.JIRA_HOST;
17658
- const email3 = process.env.JIRA_EMAIL;
17659
- const apiToken = process.env.JIRA_API_TOKEN;
17666
+ function createJiraClient(jiraUserConfig) {
17667
+ const host = jiraUserConfig?.host ?? process.env.JIRA_HOST;
17668
+ const email3 = jiraUserConfig?.email ?? process.env.JIRA_EMAIL;
17669
+ const apiToken = jiraUserConfig?.apiToken ?? process.env.JIRA_API_TOKEN;
17660
17670
  if (!host || !email3 || !apiToken) return null;
17661
- return new JiraClient({ host, email: email3, apiToken });
17671
+ return { client: new JiraClient({ host, email: email3, apiToken }), host };
17662
17672
  }
17663
17673
 
17664
17674
  // src/skills/builtin/jira/tools.ts
@@ -17668,7 +17678,7 @@ function jiraNotConfiguredError() {
17668
17678
  content: [
17669
17679
  {
17670
17680
  type: "text",
17671
- text: "Jira is not configured. Set JIRA_HOST, JIRA_EMAIL, and JIRA_API_TOKEN environment variables."
17681
+ text: 'Jira is not configured. Run "marvin config jira" or set JIRA_HOST, JIRA_EMAIL, and JIRA_API_TOKEN environment variables.'
17672
17682
  }
17673
17683
  ],
17674
17684
  isError: true
@@ -17700,6 +17710,7 @@ function findByJiraKey(store, jiraKey) {
17700
17710
  return docs.find((d) => d.frontmatter.jiraKey === jiraKey);
17701
17711
  }
17702
17712
  function createJiraTools(store) {
17713
+ const jiraUserConfig = loadUserConfig().jira;
17703
17714
  return [
17704
17715
  // --- Local read tools ---
17705
17716
  tool19(
@@ -17770,15 +17781,14 @@ function createJiraTools(store) {
17770
17781
  key: external_exports.string().describe("Jira issue key (e.g. 'PROJ-123')")
17771
17782
  },
17772
17783
  async (args) => {
17773
- const client = createJiraClient();
17774
- if (!client) return jiraNotConfiguredError();
17775
- const issue2 = await client.getIssue(args.key);
17776
- const host = process.env.JIRA_HOST;
17784
+ const jira = createJiraClient(jiraUserConfig);
17785
+ if (!jira) return jiraNotConfiguredError();
17786
+ const issue2 = await jira.client.getIssue(args.key);
17777
17787
  const existing = findByJiraKey(store, args.key);
17778
17788
  if (existing) {
17779
17789
  const fm2 = jiraIssueToFrontmatter(
17780
17790
  issue2,
17781
- host,
17791
+ jira.host,
17782
17792
  existing.frontmatter.linkedArtifacts
17783
17793
  );
17784
17794
  const doc2 = store.update(
@@ -17795,7 +17805,7 @@ function createJiraTools(store) {
17795
17805
  ]
17796
17806
  };
17797
17807
  }
17798
- const fm = jiraIssueToFrontmatter(issue2, host);
17808
+ const fm = jiraIssueToFrontmatter(issue2, jira.host);
17799
17809
  const doc = store.create(
17800
17810
  JIRA_TYPE,
17801
17811
  fm,
@@ -17819,10 +17829,9 @@ function createJiraTools(store) {
17819
17829
  maxResults: external_exports.number().optional().describe("Max issues to fetch (default 50)")
17820
17830
  },
17821
17831
  async (args) => {
17822
- const client = createJiraClient();
17823
- if (!client) return jiraNotConfiguredError();
17824
- const result = await client.searchIssues(args.jql, args.maxResults);
17825
- const host = process.env.JIRA_HOST;
17832
+ const jira = createJiraClient(jiraUserConfig);
17833
+ if (!jira) return jiraNotConfiguredError();
17834
+ const result = await jira.client.searchIssues(args.jql, args.maxResults);
17826
17835
  const created = [];
17827
17836
  const updated = [];
17828
17837
  for (const issue2 of result.issues) {
@@ -17830,7 +17839,7 @@ function createJiraTools(store) {
17830
17839
  if (existing) {
17831
17840
  const fm = jiraIssueToFrontmatter(
17832
17841
  issue2,
17833
- host,
17842
+ jira.host,
17834
17843
  existing.frontmatter.linkedArtifacts
17835
17844
  );
17836
17845
  store.update(
@@ -17840,7 +17849,7 @@ function createJiraTools(store) {
17840
17849
  );
17841
17850
  updated.push(`${existing.frontmatter.id} (${issue2.key})`);
17842
17851
  } else {
17843
- const fm = jiraIssueToFrontmatter(issue2, host);
17852
+ const fm = jiraIssueToFrontmatter(issue2, jira.host);
17844
17853
  const doc = store.create(
17845
17854
  JIRA_TYPE,
17846
17855
  fm,
@@ -17869,8 +17878,8 @@ function createJiraTools(store) {
17869
17878
  issueType: external_exports.enum(["Story", "Task", "Bug", "Epic"]).optional().describe("Jira issue type (default: 'Task')")
17870
17879
  },
17871
17880
  async (args) => {
17872
- const client = createJiraClient();
17873
- if (!client) return jiraNotConfiguredError();
17881
+ const jira = createJiraClient(jiraUserConfig);
17882
+ if (!jira) return jiraNotConfiguredError();
17874
17883
  const artifact = store.get(args.artifactId);
17875
17884
  if (!artifact) {
17876
17885
  return {
@@ -17887,20 +17896,19 @@ function createJiraTools(store) {
17887
17896
  `Marvin artifact: ${artifact.frontmatter.id} (${artifact.frontmatter.type})`,
17888
17897
  `Status: ${artifact.frontmatter.status}`
17889
17898
  ].join("\n");
17890
- const jiraResult = await client.createIssue({
17899
+ const jiraResult = await jira.client.createIssue({
17891
17900
  project: { key: args.projectKey },
17892
17901
  summary: artifact.frontmatter.title,
17893
17902
  description,
17894
17903
  issuetype: { name: args.issueType ?? "Task" }
17895
17904
  });
17896
- const host = process.env.JIRA_HOST;
17897
17905
  const jiDoc = store.create(
17898
17906
  JIRA_TYPE,
17899
17907
  {
17900
17908
  title: artifact.frontmatter.title,
17901
17909
  status: "open",
17902
17910
  jiraKey: jiraResult.key,
17903
- jiraUrl: `https://${host}/browse/${jiraResult.key}`,
17911
+ jiraUrl: `https://${jira.host}/browse/${jiraResult.key}`,
17904
17912
  issueType: args.issueType ?? "Task",
17905
17913
  priority: "Medium",
17906
17914
  assignee: "",
@@ -17929,8 +17937,8 @@ function createJiraTools(store) {
17929
17937
  id: external_exports.string().describe("Local JI-xxx ID")
17930
17938
  },
17931
17939
  async (args) => {
17932
- const client = createJiraClient();
17933
- if (!client) return jiraNotConfiguredError();
17940
+ const jira = createJiraClient(jiraUserConfig);
17941
+ if (!jira) return jiraNotConfiguredError();
17934
17942
  const doc = store.get(args.id);
17935
17943
  if (!doc || doc.frontmatter.type !== JIRA_TYPE) {
17936
17944
  return {
@@ -17941,15 +17949,14 @@ function createJiraTools(store) {
17941
17949
  };
17942
17950
  }
17943
17951
  const jiraKey = doc.frontmatter.jiraKey;
17944
- await client.updateIssue(jiraKey, {
17952
+ await jira.client.updateIssue(jiraKey, {
17945
17953
  summary: doc.frontmatter.title,
17946
17954
  description: doc.content || void 0
17947
17955
  });
17948
- const issue2 = await client.getIssue(jiraKey);
17949
- const host = process.env.JIRA_HOST;
17956
+ const issue2 = await jira.client.getIssue(jiraKey);
17950
17957
  const fm = jiraIssueToFrontmatter(
17951
17958
  issue2,
17952
- host,
17959
+ jira.host,
17953
17960
  doc.frontmatter.linkedArtifacts
17954
17961
  );
17955
17962
  store.update(args.id, fm, issue2.fields.description ?? "");
@@ -18408,10 +18415,10 @@ Marvin \u2014 ${persona.name}
18408
18415
  });
18409
18416
  try {
18410
18417
  while (true) {
18411
- const input3 = await new Promise((resolve5) => {
18418
+ const input4 = await new Promise((resolve5) => {
18412
18419
  rl.question(chalk.green("\nYou: "), resolve5);
18413
18420
  });
18414
- const trimmed = input3.trim();
18421
+ const trimmed = input4.trim();
18415
18422
  if (trimmed === "exit" || trimmed === "quit") {
18416
18423
  break;
18417
18424
  }
@@ -19202,23 +19209,29 @@ Project: ${project.config.name}
19202
19209
 
19203
19210
  // src/cli/commands/config.ts
19204
19211
  import chalk6 from "chalk";
19205
- import { password } from "@inquirer/prompts";
19212
+ import { input as input2, password } from "@inquirer/prompts";
19206
19213
  async function configCommand(key, value) {
19207
19214
  if (key === "api-key") {
19208
19215
  return setApiKey();
19209
19216
  }
19217
+ if (key === "jira") {
19218
+ return setJira();
19219
+ }
19210
19220
  if (!key) {
19211
19221
  const config2 = loadUserConfig();
19212
19222
  console.log(chalk6.bold("\nUser Configuration:\n"));
19213
19223
  console.log(
19214
- ` API Key: ${config2.apiKey ? chalk6.green("configured") : chalk6.red("not set")}`
19224
+ ` API Key: ${config2.apiKey ? chalk6.green("configured") : chalk6.red("not set")}`
19215
19225
  );
19216
19226
  console.log(
19217
- ` Default Model: ${config2.defaultModel ?? chalk6.dim("(default: claude-sonnet-4-5-20250929)")}`
19227
+ ` Default Model: ${config2.defaultModel ?? chalk6.dim("(default: claude-sonnet-4-5-20250929)")}`
19218
19228
  );
19219
19229
  console.log(
19220
19230
  ` Default Persona: ${config2.defaultPersona ?? chalk6.dim("(default: product-owner)")}`
19221
19231
  );
19232
+ console.log(
19233
+ ` Jira: ${config2.jira?.host ? chalk6.green(`configured (${config2.jira.host})`) : chalk6.red("not set")}`
19234
+ );
19222
19235
  console.log();
19223
19236
  return;
19224
19237
  }
@@ -19251,6 +19264,37 @@ async function configCommand(key, value) {
19251
19264
  }
19252
19265
  }
19253
19266
  }
19267
+ async function setJira() {
19268
+ const host = await input2({
19269
+ message: "Jira host (e.g. mycompany.atlassian.net):"
19270
+ });
19271
+ if (!host.trim()) {
19272
+ console.log(chalk6.red("No host provided."));
19273
+ return;
19274
+ }
19275
+ const email3 = await input2({
19276
+ message: "Jira email:"
19277
+ });
19278
+ if (!email3.trim()) {
19279
+ console.log(chalk6.red("No email provided."));
19280
+ return;
19281
+ }
19282
+ const apiToken = await password({
19283
+ message: "Jira API token:"
19284
+ });
19285
+ if (!apiToken.trim()) {
19286
+ console.log(chalk6.red("No API token provided."));
19287
+ return;
19288
+ }
19289
+ const config2 = loadUserConfig();
19290
+ config2.jira = {
19291
+ host: host.trim(),
19292
+ email: email3.trim(),
19293
+ apiToken: apiToken.trim()
19294
+ };
19295
+ saveUserConfig(config2);
19296
+ console.log(chalk6.green("Jira credentials saved."));
19297
+ }
19254
19298
  async function setApiKey() {
19255
19299
  const apiKey = await password({
19256
19300
  message: "Enter your Anthropic API key:"
@@ -19564,7 +19608,7 @@ ${pending} file${pending === 1 ? "" : "s"} ready to process. Run "marvin ingest
19564
19608
  // src/cli/commands/sync.ts
19565
19609
  import chalk9 from "chalk";
19566
19610
  import ora3 from "ora";
19567
- import { input as input2 } from "@inquirer/prompts";
19611
+ import { input as input3 } from "@inquirer/prompts";
19568
19612
 
19569
19613
  // src/git/repository.ts
19570
19614
  import * as path13 from "path";
@@ -19771,7 +19815,7 @@ async function syncInitCommand(opts) {
19771
19815
  const git = new MarvinGit(project.marvinDir);
19772
19816
  let remote = opts.remote;
19773
19817
  if (!remote) {
19774
- remote = await input2({
19818
+ remote = await input3({
19775
19819
  message: "Remote repository URL (leave blank to skip):"
19776
19820
  }) || void 0;
19777
19821
  }
@@ -21372,7 +21416,7 @@ function createProgram() {
21372
21416
  const program = new Command();
21373
21417
  program.name("marvin").description(
21374
21418
  "AI-powered product development assistant with Product Owner, Delivery Manager, and Technical Lead personas"
21375
- ).version("0.2.8");
21419
+ ).version("0.2.10");
21376
21420
  program.command("init").description("Initialize a new Marvin project in the current directory").action(async () => {
21377
21421
  await initCommand();
21378
21422
  });