@zeroxsolutions/zaku 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +9 -1
  2. package/dist/zaku.mjs +1443 -842
  3. package/package.json +6 -6
package/dist/zaku.mjs CHANGED
@@ -12,11 +12,20 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
12
12
  if (typeof require !== "undefined") return require.apply(this, arguments);
13
13
  throw Error('Dynamic require of "' + x + '" is not supported');
14
14
  });
15
- var __esm = (fn, res) => function __init() {
16
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
15
+ var __esm = (fn, res, err) => function __init() {
16
+ if (err) throw err[0];
17
+ try {
18
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
19
+ } catch (e) {
20
+ throw err = [e], e;
21
+ }
17
22
  };
18
23
  var __commonJS = (cb, mod) => function __require2() {
19
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
24
+ try {
25
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
26
+ } catch (e) {
27
+ throw mod = 0, e;
28
+ }
20
29
  };
21
30
  var __export = (target, all) => {
22
31
  for (var name in all)
@@ -1187,11 +1196,11 @@ function __metadata(metadataKey, metadataValue) {
1187
1196
  }
1188
1197
  function __awaiter(thisArg, _arguments, P, generator) {
1189
1198
  function adopt(value) {
1190
- return value instanceof P ? value : new P(function(resolve3) {
1191
- resolve3(value);
1199
+ return value instanceof P ? value : new P(function(resolve4) {
1200
+ resolve4(value);
1192
1201
  });
1193
1202
  }
1194
- return new (P || (P = Promise))(function(resolve3, reject) {
1203
+ return new (P || (P = Promise))(function(resolve4, reject) {
1195
1204
  function fulfilled(value) {
1196
1205
  try {
1197
1206
  step(generator.next(value));
@@ -1207,7 +1216,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
1207
1216
  }
1208
1217
  }
1209
1218
  function step(result) {
1210
- result.done ? resolve3(result.value) : adopt(result.value).then(fulfilled, rejected);
1219
+ result.done ? resolve4(result.value) : adopt(result.value).then(fulfilled, rejected);
1211
1220
  }
1212
1221
  step((generator = generator.apply(thisArg, _arguments || [])).next());
1213
1222
  });
@@ -1385,14 +1394,14 @@ function __asyncValues(o) {
1385
1394
  }, i);
1386
1395
  function verb(n) {
1387
1396
  i[n] = o[n] && function(v) {
1388
- return new Promise(function(resolve3, reject) {
1389
- v = o[n](v), settle2(resolve3, reject, v.done, v.value);
1397
+ return new Promise(function(resolve4, reject) {
1398
+ v = o[n](v), settle2(resolve4, reject, v.done, v.value);
1390
1399
  });
1391
1400
  };
1392
1401
  }
1393
- function settle2(resolve3, reject, d, v) {
1402
+ function settle2(resolve4, reject, d, v) {
1394
1403
  Promise.resolve(v).then(function(v2) {
1395
- resolve3({ value: v2, done: d });
1404
+ resolve4({ value: v2, done: d });
1396
1405
  }, reject);
1397
1406
  }
1398
1407
  }
@@ -2217,7 +2226,7 @@ var require_injectable = __commonJS({
2217
2226
  var reflection_helpers_1 = require_reflection_helpers();
2218
2227
  var dependency_container_1 = require_dependency_container();
2219
2228
  var dependency_container_2 = require_dependency_container();
2220
- function injectable12(options) {
2229
+ function injectable11(options) {
2221
2230
  return function(target) {
2222
2231
  dependency_container_1.typeInfo.set(target, reflection_helpers_1.getParamInfo(target));
2223
2232
  if (options && options.token) {
@@ -2231,7 +2240,7 @@ var require_injectable = __commonJS({
2231
2240
  }
2232
2241
  };
2233
2242
  }
2234
- exports.default = injectable12;
2243
+ exports.default = injectable11;
2235
2244
  }
2236
2245
  });
2237
2246
 
@@ -9827,9 +9836,9 @@ var require_dist = __commonJS({
9827
9836
  }
9828
9837
  });
9829
9838
 
9830
- // node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/constants.js
9839
+ // node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/constants.js
9831
9840
  var require_constants = __commonJS({
9832
- "node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/constants.js"(exports, module) {
9841
+ "node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/constants.js"(exports, module) {
9833
9842
  "use strict";
9834
9843
  var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
9835
9844
  var hasBlob = typeof Blob !== "undefined";
@@ -9850,10 +9859,11 @@ var require_constants = __commonJS({
9850
9859
  }
9851
9860
  });
9852
9861
 
9853
- // node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/buffer-util.js
9862
+ // node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/buffer-util.js
9854
9863
  var require_buffer_util = __commonJS({
9855
- "node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/buffer-util.js"(exports, module) {
9864
+ "node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/buffer-util.js"(exports, module) {
9856
9865
  "use strict";
9866
+ var { websocketMask, websocketUnmask } = __require("http");
9857
9867
  var { EMPTY_BUFFER } = require_constants();
9858
9868
  var FastBuffer = Buffer[Symbol.species];
9859
9869
  function concat(list, totalLength) {
@@ -9908,7 +9918,16 @@ var require_buffer_util = __commonJS({
9908
9918
  toBuffer,
9909
9919
  unmask: _unmask
9910
9920
  };
9911
- if (!process.env.WS_NO_BUFFER_UTIL) {
9921
+ if (websocketMask) {
9922
+ module.exports.mask = function(source, mask, output2, offset, length) {
9923
+ if (length < 24) _mask(source, mask, output2, offset, length);
9924
+ else websocketMask(source, mask, output2, offset, length);
9925
+ };
9926
+ module.exports.unmask = function(buffer, mask) {
9927
+ if (buffer.length < 24) _unmask(buffer, mask);
9928
+ else websocketUnmask(buffer, mask);
9929
+ };
9930
+ } else if (!process.env.WS_NO_BUFFER_UTIL) {
9912
9931
  try {
9913
9932
  const bufferUtil = __require("bufferutil");
9914
9933
  module.exports.mask = function(source, mask, output2, offset, length) {
@@ -9925,9 +9944,9 @@ var require_buffer_util = __commonJS({
9925
9944
  }
9926
9945
  });
9927
9946
 
9928
- // node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/limiter.js
9947
+ // node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/limiter.js
9929
9948
  var require_limiter = __commonJS({
9930
- "node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/limiter.js"(exports, module) {
9949
+ "node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/limiter.js"(exports, module) {
9931
9950
  "use strict";
9932
9951
  var kDone = /* @__PURE__ */ Symbol("kDone");
9933
9952
  var kRun = /* @__PURE__ */ Symbol("kRun");
@@ -9975,9 +9994,9 @@ var require_limiter = __commonJS({
9975
9994
  }
9976
9995
  });
9977
9996
 
9978
- // node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/permessage-deflate.js
9997
+ // node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/permessage-deflate.js
9979
9998
  var require_permessage_deflate = __commonJS({
9980
- "node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/permessage-deflate.js"(exports, module) {
9999
+ "node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/permessage-deflate.js"(exports, module) {
9981
10000
  "use strict";
9982
10001
  var zlib = __require("zlib");
9983
10002
  var bufferUtil = require_buffer_util();
@@ -10358,9 +10377,9 @@ var require_permessage_deflate = __commonJS({
10358
10377
  }
10359
10378
  });
10360
10379
 
10361
- // node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/validation.js
10380
+ // node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/validation.js
10362
10381
  var require_validation = __commonJS({
10363
- "node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/validation.js"(exports, module) {
10382
+ "node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/validation.js"(exports, module) {
10364
10383
  "use strict";
10365
10384
  var { isUtf8 } = __require("buffer");
10366
10385
  var { hasBlob } = require_constants();
@@ -10559,9 +10578,9 @@ var require_validation = __commonJS({
10559
10578
  }
10560
10579
  });
10561
10580
 
10562
- // node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/receiver.js
10581
+ // node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/receiver.js
10563
10582
  var require_receiver = __commonJS({
10564
- "node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/receiver.js"(exports, module) {
10583
+ "node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/receiver.js"(exports, module) {
10565
10584
  "use strict";
10566
10585
  var { Writable } = __require("stream");
10567
10586
  var PerMessageDeflate2 = require_permessage_deflate();
@@ -11182,9 +11201,9 @@ var require_receiver = __commonJS({
11182
11201
  }
11183
11202
  });
11184
11203
 
11185
- // node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/sender.js
11204
+ // node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/sender.js
11186
11205
  var require_sender = __commonJS({
11187
- "node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/sender.js"(exports, module) {
11206
+ "node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/sender.js"(exports, module) {
11188
11207
  "use strict";
11189
11208
  var { Duplex } = __require("stream");
11190
11209
  var { randomFillSync } = __require("crypto");
@@ -11303,12 +11322,15 @@ var require_sender = __commonJS({
11303
11322
  target[2] = target[3] = 0;
11304
11323
  target.writeUIntBE(dataLength, 4, 6);
11305
11324
  }
11306
- if (!options.mask) return [target, data];
11325
+ if (!options.mask) {
11326
+ return dataLength ? [target, data] : [target];
11327
+ }
11307
11328
  target[1] |= 128;
11308
11329
  target[offset - 4] = mask[0];
11309
11330
  target[offset - 3] = mask[1];
11310
11331
  target[offset - 2] = mask[2];
11311
11332
  target[offset - 1] = mask[3];
11333
+ if (!dataLength) return [target];
11312
11334
  if (skipMasking) return [target, data];
11313
11335
  if (merge3) {
11314
11336
  applyMask(data, mask, target, offset, dataLength);
@@ -11675,9 +11697,9 @@ var require_sender = __commonJS({
11675
11697
  }
11676
11698
  });
11677
11699
 
11678
- // node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/event-target.js
11700
+ // node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/event-target.js
11679
11701
  var require_event_target = __commonJS({
11680
- "node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/event-target.js"(exports, module) {
11702
+ "node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/event-target.js"(exports, module) {
11681
11703
  "use strict";
11682
11704
  var { kForOnEventAttribute, kListener } = require_constants();
11683
11705
  var kCode = /* @__PURE__ */ Symbol("kCode");
@@ -11904,9 +11926,9 @@ var require_event_target = __commonJS({
11904
11926
  }
11905
11927
  });
11906
11928
 
11907
- // node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/extension.js
11929
+ // node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/extension.js
11908
11930
  var require_extension = __commonJS({
11909
- "node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/extension.js"(exports, module) {
11931
+ "node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/extension.js"(exports, module) {
11910
11932
  "use strict";
11911
11933
  var { tokenChars } = require_validation();
11912
11934
  function push(dest, name, elem) {
@@ -12057,9 +12079,9 @@ var require_extension = __commonJS({
12057
12079
  }
12058
12080
  });
12059
12081
 
12060
- // node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/websocket.js
12082
+ // node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/websocket.js
12061
12083
  var require_websocket = __commonJS({
12062
- "node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/websocket.js"(exports, module) {
12084
+ "node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/websocket.js"(exports, module) {
12063
12085
  "use strict";
12064
12086
  var EventEmitter2 = __require("events");
12065
12087
  var https = __require("https");
@@ -12666,9 +12688,14 @@ var require_websocket = __commonJS({
12666
12688
  opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;
12667
12689
  }
12668
12690
  if (isIpcUrl) {
12669
- const parts = opts.path.split(":");
12670
- opts.socketPath = parts[0];
12671
- opts.path = parts[1];
12691
+ const i = opts.path.indexOf(":");
12692
+ if (i === -1) {
12693
+ opts.socketPath = opts.path;
12694
+ opts.path = "";
12695
+ } else {
12696
+ opts.socketPath = opts.path.slice(0, i);
12697
+ opts.path = opts.path.slice(i + 1);
12698
+ }
12672
12699
  }
12673
12700
  let req;
12674
12701
  if (opts.followRedirects) {
@@ -12966,9 +12993,9 @@ var require_websocket = __commonJS({
12966
12993
  }
12967
12994
  });
12968
12995
 
12969
- // node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/stream.js
12996
+ // node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/stream.js
12970
12997
  var require_stream = __commonJS({
12971
- "node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/stream.js"(exports, module) {
12998
+ "node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/stream.js"(exports, module) {
12972
12999
  "use strict";
12973
13000
  var WebSocket2 = require_websocket();
12974
13001
  var { Duplex } = __require("stream");
@@ -13064,9 +13091,9 @@ var require_stream = __commonJS({
13064
13091
  }
13065
13092
  });
13066
13093
 
13067
- // node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/subprotocol.js
13094
+ // node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/subprotocol.js
13068
13095
  var require_subprotocol = __commonJS({
13069
- "node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/subprotocol.js"(exports, module) {
13096
+ "node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/subprotocol.js"(exports, module) {
13070
13097
  "use strict";
13071
13098
  var { tokenChars } = require_validation();
13072
13099
  function parse4(header) {
@@ -13109,9 +13136,9 @@ var require_subprotocol = __commonJS({
13109
13136
  }
13110
13137
  });
13111
13138
 
13112
- // node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/websocket-server.js
13139
+ // node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/websocket-server.js
13113
13140
  var require_websocket_server = __commonJS({
13114
- "node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/websocket-server.js"(exports, module) {
13141
+ "node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/websocket-server.js"(exports, module) {
13115
13142
  "use strict";
13116
13143
  var EventEmitter2 = __require("events");
13117
13144
  var http = __require("http");
@@ -16461,7 +16488,7 @@ var require_compile = __commonJS({
16461
16488
  const schOrFunc = root.refs[ref];
16462
16489
  if (schOrFunc)
16463
16490
  return schOrFunc;
16464
- let _sch = resolve3.call(this, root, ref);
16491
+ let _sch = resolve4.call(this, root, ref);
16465
16492
  if (_sch === void 0) {
16466
16493
  const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref];
16467
16494
  const { schemaId } = this.opts;
@@ -16488,7 +16515,7 @@ var require_compile = __commonJS({
16488
16515
  function sameSchemaEnv(s1, s2) {
16489
16516
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
16490
16517
  }
16491
- function resolve3(root, ref) {
16518
+ function resolve4(root, ref) {
16492
16519
  let sch;
16493
16520
  while (typeof (sch = this.refs[ref]) == "string")
16494
16521
  ref = sch;
@@ -17318,7 +17345,7 @@ var require_fast_uri = __commonJS({
17318
17345
  }
17319
17346
  return uri;
17320
17347
  }
17321
- function resolve3(baseURI, relativeURI, options) {
17348
+ function resolve4(baseURI, relativeURI, options) {
17322
17349
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
17323
17350
  const {
17324
17351
  parsed: baseParsed,
@@ -17351,49 +17378,49 @@ var require_fast_uri = __commonJS({
17351
17378
  schemelessOptions.skipEscape = true;
17352
17379
  return serialize(resolved, schemelessOptions);
17353
17380
  }
17354
- function resolveComponent(base, relative3, options, skipNormalization) {
17381
+ function resolveComponent(base, relative4, options, skipNormalization) {
17355
17382
  const target = {};
17356
17383
  if (!skipNormalization) {
17357
17384
  base = parse4(serialize(base, options), options);
17358
- relative3 = parse4(serialize(relative3, options), options);
17385
+ relative4 = parse4(serialize(relative4, options), options);
17359
17386
  }
17360
17387
  options = options || {};
17361
- if (!options.tolerant && relative3.scheme) {
17362
- target.scheme = relative3.scheme;
17363
- target.userinfo = relative3.userinfo;
17364
- target.host = relative3.host;
17365
- target.port = relative3.port;
17366
- target.path = removeDotSegments(relative3.path || "");
17367
- target.query = relative3.query;
17388
+ if (!options.tolerant && relative4.scheme) {
17389
+ target.scheme = relative4.scheme;
17390
+ target.userinfo = relative4.userinfo;
17391
+ target.host = relative4.host;
17392
+ target.port = relative4.port;
17393
+ target.path = removeDotSegments(relative4.path || "");
17394
+ target.query = relative4.query;
17368
17395
  } else {
17369
- if (relative3.userinfo !== void 0 || relative3.host !== void 0 || relative3.port !== void 0) {
17370
- target.userinfo = relative3.userinfo;
17371
- target.host = relative3.host;
17372
- target.port = relative3.port;
17373
- target.path = removeDotSegments(relative3.path || "");
17374
- target.query = relative3.query;
17396
+ if (relative4.userinfo !== void 0 || relative4.host !== void 0 || relative4.port !== void 0) {
17397
+ target.userinfo = relative4.userinfo;
17398
+ target.host = relative4.host;
17399
+ target.port = relative4.port;
17400
+ target.path = removeDotSegments(relative4.path || "");
17401
+ target.query = relative4.query;
17375
17402
  } else {
17376
- if (!relative3.path) {
17403
+ if (!relative4.path) {
17377
17404
  target.path = base.path;
17378
- if (relative3.query !== void 0) {
17379
- target.query = relative3.query;
17405
+ if (relative4.query !== void 0) {
17406
+ target.query = relative4.query;
17380
17407
  } else {
17381
17408
  target.query = base.query;
17382
17409
  }
17383
17410
  } else {
17384
- if (relative3.path[0] === "/") {
17385
- target.path = removeDotSegments(relative3.path);
17411
+ if (relative4.path[0] === "/") {
17412
+ target.path = removeDotSegments(relative4.path);
17386
17413
  } else {
17387
17414
  if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
17388
- target.path = "/" + relative3.path;
17415
+ target.path = "/" + relative4.path;
17389
17416
  } else if (!base.path) {
17390
- target.path = relative3.path;
17417
+ target.path = relative4.path;
17391
17418
  } else {
17392
- target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative3.path;
17419
+ target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative4.path;
17393
17420
  }
17394
17421
  target.path = removeDotSegments(target.path);
17395
17422
  }
17396
- target.query = relative3.query;
17423
+ target.query = relative4.query;
17397
17424
  }
17398
17425
  target.userinfo = base.userinfo;
17399
17426
  target.host = base.host;
@@ -17401,7 +17428,7 @@ var require_fast_uri = __commonJS({
17401
17428
  }
17402
17429
  target.scheme = base.scheme;
17403
17430
  }
17404
- target.fragment = relative3.fragment;
17431
+ target.fragment = relative4.fragment;
17405
17432
  return target;
17406
17433
  }
17407
17434
  function equal(uriA, uriB, options) {
@@ -17687,7 +17714,7 @@ var require_fast_uri = __commonJS({
17687
17714
  var fastUri = {
17688
17715
  SCHEMES,
17689
17716
  normalize,
17690
- resolve: resolve3,
17717
+ resolve: resolve4,
17691
17718
  resolveComponent,
17692
17719
  equal,
17693
17720
  serialize,
@@ -20678,13 +20705,13 @@ var require_dist2 = __commonJS({
20678
20705
 
20679
20706
  // apps/zaku-cli/src/cli.ts
20680
20707
  var import_reflect_metadata3 = __toESM(require_Reflect(), 1);
20681
- import { readFile as readFile6 } from "node:fs/promises";
20708
+ import { readFile as readFile7 } from "node:fs/promises";
20682
20709
  import { createRequire } from "node:module";
20683
20710
  import { homedir as homedir2 } from "node:os";
20684
- import { dirname as dirname4, join as join12, resolve as resolve2, sep } from "node:path";
20711
+ import { dirname as dirname5, join as join13, relative as relative3, resolve as resolve3, sep } from "node:path";
20685
20712
  import { fileURLToPath } from "node:url";
20686
20713
 
20687
- // node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
20714
+ // node_modules/.pnpm/commander@15.1.0/node_modules/commander/lib/error.js
20688
20715
  var CommanderError = class extends Error {
20689
20716
  /**
20690
20717
  * Constructs the CommanderError class
@@ -20713,7 +20740,7 @@ var InvalidArgumentError = class extends CommanderError {
20713
20740
  }
20714
20741
  };
20715
20742
 
20716
- // node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/argument.js
20743
+ // node_modules/.pnpm/commander@15.1.0/node_modules/commander/lib/argument.js
20717
20744
  var Argument = class {
20718
20745
  /**
20719
20746
  * Initialize a new command argument with the given name and description.
@@ -20834,7 +20861,7 @@ function humanReadableArgName(arg) {
20834
20861
  return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
20835
20862
  }
20836
20863
 
20837
- // node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/command.js
20864
+ // node_modules/.pnpm/commander@15.1.0/node_modules/commander/lib/command.js
20838
20865
  import { EventEmitter } from "node:events";
20839
20866
  import childProcess from "node:child_process";
20840
20867
  import path from "node:path";
@@ -20842,7 +20869,7 @@ import fs from "node:fs";
20842
20869
  import process2 from "node:process";
20843
20870
  import { stripVTControlCharacters as stripVTControlCharacters2 } from "node:util";
20844
20871
 
20845
- // node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/help.js
20872
+ // node_modules/.pnpm/commander@15.1.0/node_modules/commander/lib/help.js
20846
20873
  import { stripVTControlCharacters } from "node:util";
20847
20874
  var Help = class {
20848
20875
  constructor() {
@@ -20911,11 +20938,11 @@ var Help = class {
20911
20938
  visibleOptions.push(helpOption);
20912
20939
  } else if (helpOption.long && !removeLong) {
20913
20940
  visibleOptions.push(
20914
- cmd.createOption(helpOption.long, helpOption.description)
20941
+ cmd.createOption(helpOption.long, helpOption.description).helpGroup(helpOption.helpGroupHeading)
20915
20942
  );
20916
20943
  } else if (helpOption.short && !removeShort) {
20917
20944
  visibleOptions.push(
20918
- cmd.createOption(helpOption.short, helpOption.description)
20945
+ cmd.createOption(helpOption.short, helpOption.description).helpGroup(helpOption.helpGroupHeading)
20919
20946
  );
20920
20947
  }
20921
20948
  }
@@ -21434,7 +21461,7 @@ ${itemIndentStr}`);
21434
21461
  }
21435
21462
  };
21436
21463
 
21437
- // node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/option.js
21464
+ // node_modules/.pnpm/commander@15.1.0/node_modules/commander/lib/option.js
21438
21465
  var Option = class {
21439
21466
  /**
21440
21467
  * Initialize a new `Option` with the given `flags` and `description`.
@@ -21447,7 +21474,7 @@ var Option = class {
21447
21474
  this.description = description || "";
21448
21475
  this.required = flags.includes("<");
21449
21476
  this.optional = flags.includes("[");
21450
- this.variadic = /\w\.\.\.[>\]]$/.test(flags);
21477
+ this.variadic = new RegExp("\\p{ID_Continue}\\.\\.\\.[>\\]]$", "u").test(flags);
21451
21478
  this.mandatory = false;
21452
21479
  const optionFlags = splitOptionFlags(flags);
21453
21480
  this.short = optionFlags.shortFlag;
@@ -21740,7 +21767,7 @@ function splitOptionFlags(flags) {
21740
21767
  return { shortFlag, longFlag };
21741
21768
  }
21742
21769
 
21743
- // node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/suggestSimilar.js
21770
+ // node_modules/.pnpm/commander@15.1.0/node_modules/commander/lib/suggestSimilar.js
21744
21771
  var maxDistance = 3;
21745
21772
  function editDistance(a, b) {
21746
21773
  if (Math.abs(a.length - b.length) > maxDistance)
@@ -21815,7 +21842,7 @@ function suggestSimilar(word, candidates) {
21815
21842
  return "";
21816
21843
  }
21817
21844
 
21818
- // node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/command.js
21845
+ // node_modules/.pnpm/commander@15.1.0/node_modules/commander/lib/command.js
21819
21846
  var Command = class _Command extends EventEmitter {
21820
21847
  /**
21821
21848
  * Initialize a new `Command`.
@@ -22630,7 +22657,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
22630
22657
  getOptionValueSourceWithGlobals(key) {
22631
22658
  let source;
22632
22659
  this._getCommandAndAncestors().forEach((cmd) => {
22633
- if (cmd.getOptionValueSource(key) !== void 0) {
22660
+ if (Object.hasOwn(cmd._optionValueSources, key)) {
22634
22661
  source = cmd.getOptionValueSource(key);
22635
22662
  }
22636
22663
  });
@@ -23273,7 +23300,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
23273
23300
  return arg.length > 1 && arg[0] === "-";
23274
23301
  }
23275
23302
  const negativeNumberArg = (arg) => {
23276
- if (!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg)) return false;
23303
+ if (!/^-(\d+|\d*\.\d+)([eE][+-]?\d+)?$/.test(arg)) return false;
23277
23304
  return !this._getCommandAndAncestors().some(
23278
23305
  (cmd) => cmd.options.map((opt) => opt.short).some((short) => /^-\d$/.test(short))
23279
23306
  );
@@ -23721,7 +23748,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
23721
23748
  * (This does not override a group set directly on the subcommand using .helpGroup().)
23722
23749
  *
23723
23750
  * @example
23724
- * program.commandsGroup('Development Commands:);
23751
+ * program.commandsGroup('Development Commands:');
23725
23752
  * program.command('watch')...
23726
23753
  * program.command('lint')...
23727
23754
  * ...
@@ -23892,7 +23919,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
23892
23919
  * Pass in false to disable the built-in help option.
23893
23920
  *
23894
23921
  * @example
23895
- * program.helpOption('-?, --help' 'show help'); // customise
23922
+ * program.helpOption('-?, --help', 'show help'); // customise
23896
23923
  * program.helpOption(false); // disable
23897
23924
  *
23898
23925
  * @param {(string | boolean)} flags
@@ -24021,16 +24048,20 @@ function incrementNodeInspectorPort(args) {
24021
24048
  let debugHost = "127.0.0.1";
24022
24049
  let debugPort = "9229";
24023
24050
  let match;
24024
- if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
24051
+ if ((match = arg.match(/^(--inspect(-brk|-wait)?)$/)) !== null) {
24025
24052
  debugOption = match[1];
24026
- } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
24053
+ } else if ((match = arg.match(
24054
+ /^(--inspect(-brk|-port|-wait)?)=(\[[^\]]+\]|[^:]+)$/
24055
+ )) !== null) {
24027
24056
  debugOption = match[1];
24028
24057
  if (/^\d+$/.test(match[3])) {
24029
24058
  debugPort = match[3];
24030
24059
  } else {
24031
24060
  debugHost = match[3];
24032
24061
  }
24033
- } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
24062
+ } else if ((match = arg.match(
24063
+ /^(--inspect(-brk|-port|-wait)?)=(\[[^\]]+\]|[^:]+):(\d+)$/
24064
+ )) !== null) {
24034
24065
  debugOption = match[1];
24035
24066
  debugHost = match[3];
24036
24067
  debugPort = match[4];
@@ -24049,7 +24080,7 @@ function useColor() {
24049
24080
  return void 0;
24050
24081
  }
24051
24082
 
24052
- // node_modules/.pnpm/commander@15.0.0/node_modules/commander/index.js
24083
+ // node_modules/.pnpm/commander@15.1.0/node_modules/commander/index.js
24053
24084
  var program = new Command();
24054
24085
 
24055
24086
  // apps/zaku-cli/src/dependencies.ts
@@ -24111,13 +24142,13 @@ function bootstrap(scope, tokens) {
24111
24142
  }
24112
24143
 
24113
24144
  // apps/zaku-cli/src/dependencies.ts
24114
- var import_tsyringe12 = __toESM(require_cjs(), 1);
24145
+ var import_tsyringe11 = __toESM(require_cjs(), 1);
24115
24146
  import { homedir } from "node:os";
24116
24147
 
24117
24148
  // packages/zaku/dist/index.js
24118
24149
  var import_reflect_metadata = __toESM(require_Reflect(), 1);
24119
24150
 
24120
- // node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
24151
+ // node_modules/.pnpm/tslib@2.9.1/node_modules/tslib/tslib.es6.mjs
24121
24152
  function __decorate2(decorators, target, key, desc) {
24122
24153
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
24123
24154
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -24154,11 +24185,13 @@ async function decodePreset(code, run) {
24154
24185
  // packages/zaku/dist/lib/commands/write-tokens.js
24155
24186
  var WriteTokens = class extends DomainCommand {
24156
24187
  root;
24188
+ config;
24157
24189
  cwd;
24158
24190
  css;
24159
24191
  constructor(input2) {
24160
24192
  super();
24161
24193
  this.root = input2.root;
24194
+ this.config = input2.config;
24162
24195
  this.cwd = input2.cwd;
24163
24196
  this.css = input2.css;
24164
24197
  }
@@ -24167,10 +24200,12 @@ var WriteTokens = class extends DomainCommand {
24167
24200
  // packages/zaku/dist/lib/commands/write-recipe.js
24168
24201
  var WriteRecipe = class extends DomainCommand {
24169
24202
  root;
24203
+ config;
24170
24204
  url;
24171
24205
  constructor(input2) {
24172
24206
  super();
24173
24207
  this.root = input2.root;
24208
+ this.config = input2.config;
24174
24209
  this.url = input2.url;
24175
24210
  }
24176
24211
  };
@@ -24178,11 +24213,13 @@ var WriteRecipe = class extends DomainCommand {
24178
24213
  // packages/zaku/dist/lib/commands/save-library.js
24179
24214
  var SaveLibrary = class extends DomainCommand {
24180
24215
  root;
24216
+ config;
24181
24217
  key;
24182
24218
  part;
24183
24219
  constructor(input2) {
24184
24220
  super();
24185
24221
  this.root = input2.root;
24222
+ this.config = input2.config;
24186
24223
  if (input2.key !== void 0)
24187
24224
  this.key = input2.key;
24188
24225
  if (input2.part !== void 0)
@@ -24193,10 +24230,12 @@ var SaveLibrary = class extends DomainCommand {
24193
24230
  // packages/zaku/dist/lib/commands/write-outline.js
24194
24231
  var WriteOutline = class extends DomainCommand {
24195
24232
  root;
24233
+ config;
24196
24234
  frames;
24197
24235
  constructor(input2) {
24198
24236
  super();
24199
24237
  this.root = input2.root;
24238
+ this.config = input2.config;
24200
24239
  this.frames = input2.frames;
24201
24240
  }
24202
24241
  };
@@ -24236,7 +24275,6 @@ var TOKENS = {
24236
24275
  RUN_COMMAND: "zaku.runCommand",
24237
24276
  RECIPE_PAGE_READER: "zaku.recipePageReader",
24238
24277
  BUDGET_LEDGER: "zaku.budgetLedger",
24239
- DESIGN_CONFIG_REPOSITORY: "zaku.designConfigRepository",
24240
24278
  TOKEN_DOCUMENT_REPOSITORY: "zaku.tokenDocumentRepository",
24241
24279
  RECIPE_REPOSITORY: "zaku.recipeRepository",
24242
24280
  JSON_SCHEMA_FILES: "zaku.jsonSchemaFiles",
@@ -24359,7 +24397,7 @@ function contrastRatio(fg, bg) {
24359
24397
  return (Math.max(one, two) + 0.05) / (Math.min(one, two) + 0.05);
24360
24398
  }
24361
24399
 
24362
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/external.js
24400
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/external.js
24363
24401
  var external_exports = {};
24364
24402
  __export(external_exports, {
24365
24403
  $brand: () => $brand,
@@ -24622,7 +24660,7 @@ __export(external_exports, {
24622
24660
  xor: () => xor
24623
24661
  });
24624
24662
 
24625
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/index.js
24663
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/index.js
24626
24664
  var core_exports2 = {};
24627
24665
  __export(core_exports2, {
24628
24666
  $ZodAny: () => $ZodAny,
@@ -24939,7 +24977,7 @@ __export(core_exports2, {
24939
24977
  withParser: () => withParser
24940
24978
  });
24941
24979
 
24942
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/util.js
24980
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/util.js
24943
24981
  var util_exports = {};
24944
24982
  __export(util_exports, {
24945
24983
  BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES,
@@ -25010,6 +25048,7 @@ __export(util_exports, {
25010
25048
  required: () => required,
25011
25049
  safeExtend: () => safeExtend,
25012
25050
  shallowClone: () => shallowClone,
25051
+ sizeCaps: () => sizeCaps,
25013
25052
  slugify: () => slugify,
25014
25053
  stringifyPrimitive: () => stringifyPrimitive,
25015
25054
  toZod: () => toZod,
@@ -25529,6 +25568,18 @@ function prefixIssues(path2, issues) {
25529
25568
  function unwrapMessage(message) {
25530
25569
  return typeof message === "string" ? message : message?.message;
25531
25570
  }
25571
+ function sizeCaps(defChecks) {
25572
+ const caps = [];
25573
+ for (const ch of defChecks ?? []) {
25574
+ const d = ch._zod.def;
25575
+ if (!/_(length|size)$|_equals$/.test(d.check))
25576
+ break;
25577
+ const max = d.maximum ?? d.length ?? d.size;
25578
+ if (max >= 0)
25579
+ caps.push([max, ch]);
25580
+ }
25581
+ return caps;
25582
+ }
25532
25583
  function attachSchema(issues, start, inst) {
25533
25584
  var _a3;
25534
25585
  for (let i = start; i < issues.length; i++) {
@@ -25782,7 +25833,7 @@ function constantCatch(value) {
25782
25833
  return fn;
25783
25834
  }
25784
25835
 
25785
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/core.js
25836
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/core.js
25786
25837
  var _a;
25787
25838
  var NEVER = /* @__PURE__ */ Object.freeze({
25788
25839
  status: "aborted"
@@ -25904,7 +25955,7 @@ function config(newConfig) {
25904
25955
  return globalConfig;
25905
25956
  }
25906
25957
 
25907
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/errors.js
25958
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/errors.js
25908
25959
  function _getMessage() {
25909
25960
  const internals = this._zod;
25910
25961
  internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
@@ -26096,7 +26147,7 @@ function prettifyError(error62) {
26096
26147
  return lines.join("\n");
26097
26148
  }
26098
26149
 
26099
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/parse.js
26150
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/parse.js
26100
26151
  function finalizeParams(callee, params) {
26101
26152
  return { callee: params?.callee ?? callee, Err: params?.Err };
26102
26153
  }
@@ -26256,7 +26307,7 @@ var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
26256
26307
  };
26257
26308
  var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
26258
26309
 
26259
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/regexes.js
26310
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/regexes.js
26260
26311
  var regexes_exports = {};
26261
26312
  __export(regexes_exports, {
26262
26313
  anyString: () => anyString,
@@ -26428,7 +26479,7 @@ var sha512_hex = /^[0-9a-fA-F]{128}$/;
26428
26479
  var sha512_base64 = /* @__PURE__ */ fixedBase64(86, "==");
26429
26480
  var sha512_base64url = /* @__PURE__ */ fixedBase64url(86);
26430
26481
 
26431
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/checks.js
26482
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/checks.js
26432
26483
  var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
26433
26484
  var _a3;
26434
26485
  inst._zod ?? (inst._zod = {});
@@ -26904,7 +26955,7 @@ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (ins
26904
26955
  };
26905
26956
  });
26906
26957
 
26907
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/doc.js
26958
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/doc.js
26908
26959
  var Doc = class {
26909
26960
  constructor(args = [], closed = {}) {
26910
26961
  this.content = [];
@@ -26945,14 +26996,14 @@ ${content.join("\n")}
26945
26996
  }
26946
26997
  };
26947
26998
 
26948
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/versions.js
26999
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/versions.js
26949
27000
  var version = {
26950
27001
  major: 4,
26951
27002
  minor: 6,
26952
- patch: 5
27003
+ patch: 7
26953
27004
  };
26954
27005
 
26955
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/schemas.js
27006
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/schemas.js
26956
27007
  var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
26957
27008
  var _a3;
26958
27009
  inst ?? (inst = {});
@@ -27705,6 +27756,31 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
27705
27756
  return payload;
27706
27757
  };
27707
27758
  });
27759
+ function capSize(inst, size2) {
27760
+ const caps = sizeCaps(inst._zod.def.checks);
27761
+ if (!caps.length)
27762
+ return;
27763
+ const cap = Math.min(...caps.map((c) => c[0]));
27764
+ const parse4 = inst._zod.parse;
27765
+ inst._zod.parse = (payload, ctx) => {
27766
+ const n = size2(payload.value);
27767
+ if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
27768
+ for (const [max, ch] of sizeCaps(inst._zod.def.checks)) {
27769
+ if (n > max && ch._zod.def.when(payload)) {
27770
+ const start = payload.issues.length;
27771
+ ch._zod.check(payload);
27772
+ payload.issues[start].continue = false;
27773
+ attachSchema(payload.issues, start, inst);
27774
+ return payload;
27775
+ }
27776
+ }
27777
+ }
27778
+ return parse4(payload, ctx);
27779
+ };
27780
+ }
27781
+ var arraySize = (input2) => Array.isArray(input2) ? input2.length : -1;
27782
+ var mapSize = (input2) => input2 instanceof Map ? input2.size : -1;
27783
+ var setSize = (input2) => input2 instanceof Set ? input2.size : -1;
27708
27784
  function handleArrayResult(result, final, index) {
27709
27785
  if (result.issues.length) {
27710
27786
  final.issues.push(...prefixIssues(index, result.issues));
@@ -27748,6 +27824,7 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
27748
27824
  }
27749
27825
  return payload;
27750
27826
  };
27827
+ capSize(inst, arraySize);
27751
27828
  });
27752
27829
  function handlePropertyResult(result, final, key, input2, optin, optout) {
27753
27830
  const isPresent = key in input2;
@@ -28704,6 +28781,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
28704
28781
  return Promise.all(proms).then(() => payload);
28705
28782
  return payload;
28706
28783
  };
28784
+ capSize(inst, mapSize);
28707
28785
  });
28708
28786
  function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx) {
28709
28787
  if (keyResult.issues.length) {
@@ -28770,6 +28848,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
28770
28848
  return Promise.all(proms).then(() => payload);
28771
28849
  return payload;
28772
28850
  };
28851
+ capSize(inst, setSize);
28773
28852
  });
28774
28853
  function handleSetResult(result, final) {
28775
28854
  if (result.issues.length) {
@@ -29366,7 +29445,7 @@ function handleRefineResult(result, payload, input2, inst) {
29366
29445
  }
29367
29446
  }
29368
29447
 
29369
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/memoizer.js
29448
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/memoizer.js
29370
29449
  var $ZodCyclicError = class extends Error {
29371
29450
  constructor() {
29372
29451
  super(`Cannot parse a reference cycle that closes through a transform`);
@@ -29385,7 +29464,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
29385
29464
  var NONE = 0;
29386
29465
  var ASSUMED = 1;
29387
29466
  var PROVEN = 2;
29388
- function isRecursive(inst, stack, resolve3) {
29467
+ function isRecursive(inst, stack, resolve4) {
29389
29468
  const cached2 = recursive.get(inst);
29390
29469
  if (cached2 !== void 0)
29391
29470
  return cached2 ? PROVEN : NONE;
@@ -29395,7 +29474,7 @@ function isRecursive(inst, stack, resolve3) {
29395
29474
  let result = NONE;
29396
29475
  const check2 = (child) => {
29397
29476
  if (result !== PROVEN && child?._zod) {
29398
- const answer = isRecursive(child, stack, resolve3);
29477
+ const answer = isRecursive(child, stack, resolve4);
29399
29478
  if (answer > result)
29400
29479
  result = answer;
29401
29480
  }
@@ -29406,7 +29485,7 @@ function isRecursive(inst, stack, resolve3) {
29406
29485
  const desc = Object.getOwnPropertyDescriptor(sh, key);
29407
29486
  if (spread && !desc.enumerable)
29408
29487
  continue;
29409
- const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve3) : NONE;
29488
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve4) : NONE;
29410
29489
  if (child > answer)
29411
29490
  answer = child;
29412
29491
  }
@@ -29470,7 +29549,7 @@ function isRecursive(inst, stack, resolve3) {
29470
29549
  break;
29471
29550
  // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
29472
29551
  case "lazy": {
29473
- const inner = def._cachedInner ?? (resolve3 ? inst._zod.innerType : void 0);
29552
+ const inner = def._cachedInner ?? (resolve4 ? inst._zod.innerType : void 0);
29474
29553
  merge3(inner ? isRecursive(inner, stack, false) : ASSUMED);
29475
29554
  break;
29476
29555
  }
@@ -29643,7 +29722,7 @@ function isBackEdge(ctx, value) {
29643
29722
  return backEdges !== void 0 && isRef(value) && backEdges.has(value);
29644
29723
  }
29645
29724
 
29646
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/index.js
29725
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/index.js
29647
29726
  var locales_exports = {};
29648
29727
  __export(locales_exports, {
29649
29728
  ar: () => ar_default,
@@ -29711,7 +29790,7 @@ __export(locales_exports, {
29711
29790
  zhTW: () => zh_TW_default
29712
29791
  });
29713
29792
 
29714
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ar.js
29793
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ar.js
29715
29794
  var error = () => {
29716
29795
  const Sizable = {
29717
29796
  string: { unit: "\u062D\u0631\u0641", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" },
@@ -29823,7 +29902,7 @@ function ar_default() {
29823
29902
  };
29824
29903
  }
29825
29904
 
29826
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/az.js
29905
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/az.js
29827
29906
  var error2 = () => {
29828
29907
  const Sizable = {
29829
29908
  string: { unit: "simvol", verb: "olmal\u0131d\u0131r" },
@@ -29934,7 +30013,7 @@ function az_default() {
29934
30013
  };
29935
30014
  }
29936
30015
 
29937
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/be.js
30016
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/be.js
29938
30017
  function getBelarusianPlural(count, one, few, many) {
29939
30018
  const absCount = Math.abs(count);
29940
30019
  const lastDigit = absCount % 10;
@@ -30103,7 +30182,7 @@ function be_default() {
30103
30182
  };
30104
30183
  }
30105
30184
 
30106
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/bg.js
30185
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/bg.js
30107
30186
  var error4 = () => {
30108
30187
  const Sizable = {
30109
30188
  string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" },
@@ -30229,7 +30308,7 @@ function bg_default() {
30229
30308
  };
30230
30309
  }
30231
30310
 
30232
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/bn.js
30311
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/bn.js
30233
30312
  var error5 = () => {
30234
30313
  const Sizable = {
30235
30314
  string: { unit: "\u0985\u0995\u09CD\u09B7\u09B0", verb: "\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7" },
@@ -30343,7 +30422,7 @@ function bn_default() {
30343
30422
  };
30344
30423
  }
30345
30424
 
30346
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ca.js
30425
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ca.js
30347
30426
  var error6 = () => {
30348
30427
  const Sizable = {
30349
30428
  string: { unit: "car\xE0cters", verb: "contenir" },
@@ -30457,7 +30536,7 @@ function ca_default() {
30457
30536
  };
30458
30537
  }
30459
30538
 
30460
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ckb.js
30539
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ckb.js
30461
30540
  var error7 = () => {
30462
30541
  const Sizable = {
30463
30542
  string: { unit: "\u067E\u06CC\u062A", verb: "\u0628\u06CE\u062A" },
@@ -30590,7 +30669,7 @@ function ckb_default() {
30590
30669
  };
30591
30670
  }
30592
30671
 
30593
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/cs.js
30672
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/cs.js
30594
30673
  var error8 = () => {
30595
30674
  const Sizable = {
30596
30675
  string: { unit: "znak\u016F", verb: "m\xEDt" },
@@ -30707,7 +30786,7 @@ function cs_default() {
30707
30786
  };
30708
30787
  }
30709
30788
 
30710
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/da.js
30789
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/da.js
30711
30790
  var error9 = () => {
30712
30791
  const Sizable = {
30713
30792
  string: { unit: "tegn", verb: "havde" },
@@ -30828,7 +30907,7 @@ function da_default() {
30828
30907
  };
30829
30908
  }
30830
30909
 
30831
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/de.js
30910
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/de.js
30832
30911
  var error10 = () => {
30833
30912
  const Sizable = {
30834
30913
  string: { unit: "Zeichen", verb: "zu haben" },
@@ -30942,7 +31021,7 @@ function de_default() {
30942
31021
  };
30943
31022
  }
30944
31023
 
30945
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/el.js
31024
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/el.js
30946
31025
  var error11 = () => {
30947
31026
  const Sizable = {
30948
31027
  string: { unit: "\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2", verb: "\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9" },
@@ -31055,7 +31134,7 @@ function el_default() {
31055
31134
  };
31056
31135
  }
31057
31136
 
31058
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/en.js
31137
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/en.js
31059
31138
  var error12 = () => {
31060
31139
  const Sizable = {
31061
31140
  string: { unit: "characters", verb: "to have" },
@@ -31180,7 +31259,7 @@ function en_default() {
31180
31259
  };
31181
31260
  }
31182
31261
 
31183
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/eo.js
31262
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/eo.js
31184
31263
  var error13 = () => {
31185
31264
  const Sizable = {
31186
31265
  string: { unit: "karaktrojn", verb: "havi" },
@@ -31295,7 +31374,7 @@ function eo_default() {
31295
31374
  };
31296
31375
  }
31297
31376
 
31298
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/es.js
31377
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/es.js
31299
31378
  var error14 = () => {
31300
31379
  const Sizable = {
31301
31380
  string: { unit: "caracteres", verb: "tener" },
@@ -31432,7 +31511,7 @@ function es_default() {
31432
31511
  };
31433
31512
  }
31434
31513
 
31435
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/fa.js
31514
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/fa.js
31436
31515
  var error15 = () => {
31437
31516
  const Sizable = {
31438
31517
  string: { unit: "\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" },
@@ -31552,7 +31631,7 @@ function fa_default() {
31552
31631
  };
31553
31632
  }
31554
31633
 
31555
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/fi.js
31634
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/fi.js
31556
31635
  var error16 = () => {
31557
31636
  const Sizable = {
31558
31637
  string: { unit: "merkki\xE4", subject: "merkkijonon" },
@@ -31670,7 +31749,7 @@ function fi_default() {
31670
31749
  };
31671
31750
  }
31672
31751
 
31673
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/fr.js
31752
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/fr.js
31674
31753
  var error17 = () => {
31675
31754
  const Sizable = {
31676
31755
  string: { unit: "caract\xE8res", verb: "avoir" },
@@ -31800,7 +31879,7 @@ function fr_default() {
31800
31879
  };
31801
31880
  }
31802
31881
 
31803
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/fr-CA.js
31882
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/fr-CA.js
31804
31883
  var error18 = () => {
31805
31884
  const Sizable = {
31806
31885
  string: { unit: "caract\xE8res", verb: "avoir" },
@@ -31913,7 +31992,7 @@ function fr_CA_default() {
31913
31992
  };
31914
31993
  }
31915
31994
 
31916
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/gu.js
31995
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/gu.js
31917
31996
  var error19 = () => {
31918
31997
  const Sizable = {
31919
31998
  string: { unit: "\u0A85\u0A95\u0ACD\u0AB7\u0AB0", verb: "\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F" },
@@ -32027,7 +32106,7 @@ function gu_default() {
32027
32106
  };
32028
32107
  }
32029
32108
 
32030
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/he.js
32109
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/he.js
32031
32110
  var error20 = () => {
32032
32111
  const TypeNames = {
32033
32112
  string: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA", gender: "f" },
@@ -32229,7 +32308,7 @@ function he_default() {
32229
32308
  };
32230
32309
  }
32231
32310
 
32232
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/hi.js
32311
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/hi.js
32233
32312
  var error21 = () => {
32234
32313
  const Sizable = {
32235
32314
  string: { unit: "\u0905\u0915\u094D\u0937\u0930", verb: "\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F" },
@@ -32341,7 +32420,7 @@ function hi_default() {
32341
32420
  };
32342
32421
  }
32343
32422
 
32344
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/hr.js
32423
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/hr.js
32345
32424
  var error22 = () => {
32346
32425
  const Sizable = {
32347
32426
  string: { unit: "znakova", verb: "imati" },
@@ -32468,7 +32547,7 @@ function hr_default() {
32468
32547
  };
32469
32548
  }
32470
32549
 
32471
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/hu.js
32550
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/hu.js
32472
32551
  var error23 = () => {
32473
32552
  const Sizable = {
32474
32553
  string: { unit: "karakter", verb: "legyen" },
@@ -32582,7 +32661,7 @@ function hu_default() {
32582
32661
  };
32583
32662
  }
32584
32663
 
32585
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/hy.js
32664
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/hy.js
32586
32665
  function getArmenianPlural(count, one, many) {
32587
32666
  return Math.abs(count) === 1 ? one : many;
32588
32667
  }
@@ -32741,7 +32820,7 @@ function hy_default() {
32741
32820
  };
32742
32821
  }
32743
32822
 
32744
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/id.js
32823
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/id.js
32745
32824
  var error25 = () => {
32746
32825
  const Sizable = {
32747
32826
  string: { unit: "karakter", verb: "memiliki" },
@@ -32853,7 +32932,7 @@ function id_default() {
32853
32932
  };
32854
32933
  }
32855
32934
 
32856
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/is.js
32935
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/is.js
32857
32936
  var error26 = () => {
32858
32937
  const Sizable = {
32859
32938
  string: { unit: "stafi", verb: "a\xF0 hafa" },
@@ -32968,7 +33047,7 @@ function is_default() {
32968
33047
  };
32969
33048
  }
32970
33049
 
32971
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/it.js
33050
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/it.js
32972
33051
  var error27 = () => {
32973
33052
  const Sizable = {
32974
33053
  string: { unit: "caratteri", verb: "avere" },
@@ -33082,7 +33161,7 @@ function it_default() {
33082
33161
  };
33083
33162
  }
33084
33163
 
33085
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ja.js
33164
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ja.js
33086
33165
  var error28 = () => {
33087
33166
  const Sizable = {
33088
33167
  string: { unit: "\u6587\u5B57", verb: "\u3067\u3042\u308B" },
@@ -33195,7 +33274,7 @@ function ja_default() {
33195
33274
  };
33196
33275
  }
33197
33276
 
33198
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ka.js
33277
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ka.js
33199
33278
  var error29 = () => {
33200
33279
  const Sizable = {
33201
33280
  string: { unit: "\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" },
@@ -33313,7 +33392,7 @@ function ka_default() {
33313
33392
  };
33314
33393
  }
33315
33394
 
33316
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/km.js
33395
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/km.js
33317
33396
  var error30 = () => {
33318
33397
  const Sizable = {
33319
33398
  string: { unit: "\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" },
@@ -33429,12 +33508,12 @@ function km_default() {
33429
33508
  };
33430
33509
  }
33431
33510
 
33432
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/kh.js
33511
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/kh.js
33433
33512
  function kh_default() {
33434
33513
  return km_default();
33435
33514
  }
33436
33515
 
33437
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/kn.js
33516
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/kn.js
33438
33517
  var error31 = () => {
33439
33518
  const Sizable = {
33440
33519
  string: { unit: "\u0C85\u0C95\u0CCD\u0CB7\u0CB0\u0C97\u0CB3\u0CC1", verb: "\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1" },
@@ -33550,7 +33629,7 @@ function kn_default() {
33550
33629
  };
33551
33630
  }
33552
33631
 
33553
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ko.js
33632
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ko.js
33554
33633
  var error32 = () => {
33555
33634
  const Sizable = {
33556
33635
  string: { unit: "\uBB38\uC790", verb: "to have" },
@@ -33667,7 +33746,7 @@ function ko_default() {
33667
33746
  };
33668
33747
  }
33669
33748
 
33670
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/lt.js
33749
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/lt.js
33671
33750
  var capitalizeFirstCharacter = (text) => {
33672
33751
  return text.charAt(0).toUpperCase() + text.slice(1);
33673
33752
  };
@@ -33875,7 +33954,7 @@ function lt_default() {
33875
33954
  };
33876
33955
  }
33877
33956
 
33878
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/mk.js
33957
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/mk.js
33879
33958
  var error34 = () => {
33880
33959
  const Sizable = {
33881
33960
  string: { unit: "\u0437\u043D\u0430\u0446\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" },
@@ -33990,7 +34069,7 @@ function mk_default() {
33990
34069
  };
33991
34070
  }
33992
34071
 
33993
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ms.js
34072
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ms.js
33994
34073
  var error35 = () => {
33995
34074
  const Sizable = {
33996
34075
  string: { unit: "aksara", verb: "mempunyai" },
@@ -34103,7 +34182,7 @@ function ms_default() {
34103
34182
  };
34104
34183
  }
34105
34184
 
34106
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ne.js
34185
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ne.js
34107
34186
  var error36 = () => {
34108
34187
  const Sizable = {
34109
34188
  string: { unit: "\u0905\u0915\u094D\u0937\u0930", verb: "\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B" },
@@ -34215,7 +34294,7 @@ function ne_default() {
34215
34294
  };
34216
34295
  }
34217
34296
 
34218
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/nl.js
34297
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/nl.js
34219
34298
  var error37 = () => {
34220
34299
  const Sizable = {
34221
34300
  string: { unit: "tekens", verb: "heeft" },
@@ -34331,7 +34410,7 @@ function nl_default() {
34331
34410
  };
34332
34411
  }
34333
34412
 
34334
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/nn.js
34413
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/nn.js
34335
34414
  var error38 = () => {
34336
34415
  const Sizable = {
34337
34416
  string: { unit: "teikn", verb: "\xE5 ha" },
@@ -34445,7 +34524,7 @@ function nn_default() {
34445
34524
  };
34446
34525
  }
34447
34526
 
34448
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/no.js
34527
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/no.js
34449
34528
  var error39 = () => {
34450
34529
  const Sizable = {
34451
34530
  string: { unit: "tegn", verb: "\xE5 ha" },
@@ -34559,7 +34638,7 @@ function no_default() {
34559
34638
  };
34560
34639
  }
34561
34640
 
34562
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ota.js
34641
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ota.js
34563
34642
  var error40 = () => {
34564
34643
  const Sizable = {
34565
34644
  string: { unit: "harf", verb: "olmal\u0131d\u0131r" },
@@ -34674,7 +34753,7 @@ function ota_default() {
34674
34753
  };
34675
34754
  }
34676
34755
 
34677
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ps.js
34756
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ps.js
34678
34757
  var error41 = () => {
34679
34758
  const Sizable = {
34680
34759
  string: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" },
@@ -34794,7 +34873,7 @@ function ps_default() {
34794
34873
  };
34795
34874
  }
34796
34875
 
34797
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/pl.js
34876
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/pl.js
34798
34877
  var error42 = () => {
34799
34878
  const Sizable = {
34800
34879
  string: { unit: "znak\xF3w", verb: "mie\u0107" },
@@ -34909,7 +34988,7 @@ function pl_default() {
34909
34988
  };
34910
34989
  }
34911
34990
 
34912
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/pt.js
34991
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/pt.js
34913
34992
  var error43 = () => {
34914
34993
  const Sizable = {
34915
34994
  string: { unit: "caracteres" },
@@ -35053,7 +35132,7 @@ function pt_default() {
35053
35132
  };
35054
35133
  }
35055
35134
 
35056
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/pt-BR.js
35135
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/pt-BR.js
35057
35136
  var error44 = () => {
35058
35137
  const Sizable = {
35059
35138
  string: { unit: "caracteres" },
@@ -35198,7 +35277,7 @@ function pt_BR_default() {
35198
35277
  };
35199
35278
  }
35200
35279
 
35201
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ro.js
35280
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ro.js
35202
35281
  var error45 = () => {
35203
35282
  const Sizable = {
35204
35283
  string: { unit: "caractere", verb: "s\u0103 aib\u0103" },
@@ -35321,7 +35400,7 @@ function ro_default() {
35321
35400
  };
35322
35401
  }
35323
35402
 
35324
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ru.js
35403
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ru.js
35325
35404
  function getRussianPlural(count, one, few, many) {
35326
35405
  const absCount = Math.abs(count);
35327
35406
  const lastDigit = absCount % 10;
@@ -35490,7 +35569,7 @@ function ru_default() {
35490
35569
  };
35491
35570
  }
35492
35571
 
35493
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/sk.js
35572
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/sk.js
35494
35573
  var error47 = () => {
35495
35574
  const Sizable = {
35496
35575
  string: { unit: "znakov", verb: "ma\u0165" },
@@ -35607,7 +35686,7 @@ function sk_default() {
35607
35686
  };
35608
35687
  }
35609
35688
 
35610
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/sl.js
35689
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/sl.js
35611
35690
  var error48 = () => {
35612
35691
  const Sizable = {
35613
35692
  string: { unit: "znakov", verb: "imeti" },
@@ -35722,7 +35801,7 @@ function sl_default() {
35722
35801
  };
35723
35802
  }
35724
35803
 
35725
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/sv.js
35804
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/sv.js
35726
35805
  var error49 = () => {
35727
35806
  const Sizable = {
35728
35807
  string: { unit: "tecken", verb: "att ha" },
@@ -35838,7 +35917,7 @@ function sv_default() {
35838
35917
  };
35839
35918
  }
35840
35919
 
35841
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ta.js
35920
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ta.js
35842
35921
  var error50 = () => {
35843
35922
  const Sizable = {
35844
35923
  string: { unit: "\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" },
@@ -35954,7 +36033,7 @@ function ta_default() {
35954
36033
  };
35955
36034
  }
35956
36035
 
35957
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/tg.js
36036
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/tg.js
35958
36037
  var error51 = () => {
35959
36038
  const Sizable = {
35960
36039
  string: { unit: "\u0430\u043B\u043E\u043C\u0430\u0442", verb: "\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434" },
@@ -36071,7 +36150,7 @@ function tg_default() {
36071
36150
  };
36072
36151
  }
36073
36152
 
36074
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/th.js
36153
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/th.js
36075
36154
  var error52 = () => {
36076
36155
  const Sizable = {
36077
36156
  string: { unit: "\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
@@ -36187,7 +36266,7 @@ function th_default() {
36187
36266
  };
36188
36267
  }
36189
36268
 
36190
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/tk.js
36269
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/tk.js
36191
36270
  var error53 = () => {
36192
36271
  const Sizable = {
36193
36272
  string: { unit: "simwol", verb: "bolmaly" },
@@ -36295,7 +36374,7 @@ function tk_default() {
36295
36374
  };
36296
36375
  }
36297
36376
 
36298
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/tr.js
36377
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/tr.js
36299
36378
  var error54 = () => {
36300
36379
  const Sizable = {
36301
36380
  string: { unit: "karakter", verb: "olmal\u0131" },
@@ -36406,7 +36485,7 @@ function tr_default() {
36406
36485
  };
36407
36486
  }
36408
36487
 
36409
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/uk.js
36488
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/uk.js
36410
36489
  var error55 = () => {
36411
36490
  const Sizable = {
36412
36491
  string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" },
@@ -36520,12 +36599,12 @@ function uk_default() {
36520
36599
  };
36521
36600
  }
36522
36601
 
36523
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ua.js
36602
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ua.js
36524
36603
  function ua_default() {
36525
36604
  return uk_default();
36526
36605
  }
36527
36606
 
36528
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ur.js
36607
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ur.js
36529
36608
  var error56 = () => {
36530
36609
  const Sizable = {
36531
36610
  string: { unit: "\u062D\u0631\u0648\u0641", verb: "\u06C1\u0648\u0646\u0627" },
@@ -36641,7 +36720,7 @@ function ur_default() {
36641
36720
  };
36642
36721
  }
36643
36722
 
36644
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/uz.js
36723
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/uz.js
36645
36724
  var error57 = () => {
36646
36725
  const Sizable = {
36647
36726
  string: { unit: "belgi", verb: "bo\u2018lishi kerak" },
@@ -36755,7 +36834,7 @@ function uz_default() {
36755
36834
  };
36756
36835
  }
36757
36836
 
36758
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/vi.js
36837
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/vi.js
36759
36838
  var error58 = () => {
36760
36839
  const Sizable = {
36761
36840
  string: { unit: "k\xFD t\u1EF1", verb: "c\xF3" },
@@ -36869,7 +36948,7 @@ function vi_default() {
36869
36948
  };
36870
36949
  }
36871
36950
 
36872
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/zh-CN.js
36951
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/zh-CN.js
36873
36952
  var error59 = () => {
36874
36953
  const Sizable = {
36875
36954
  string: { unit: "\u5B57\u7B26", verb: "\u5305\u542B" },
@@ -36984,7 +37063,7 @@ function zh_CN_default() {
36984
37063
  };
36985
37064
  }
36986
37065
 
36987
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/zh-TW.js
37066
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/zh-TW.js
36988
37067
  var error60 = () => {
36989
37068
  const Sizable = {
36990
37069
  string: { unit: "\u5B57\u5143", verb: "\u64C1\u6709" },
@@ -37097,7 +37176,7 @@ function zh_TW_default() {
37097
37176
  };
37098
37177
  }
37099
37178
 
37100
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/yo.js
37179
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/yo.js
37101
37180
  var error61 = () => {
37102
37181
  const Sizable = {
37103
37182
  string: { unit: "\xE0mi", verb: "n\xED" },
@@ -37210,7 +37289,7 @@ function yo_default() {
37210
37289
  };
37211
37290
  }
37212
37291
 
37213
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/registries.js
37292
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/registries.js
37214
37293
  var _a2;
37215
37294
  var $output = /* @__PURE__ */ Symbol("ZodOutput");
37216
37295
  var $input = /* @__PURE__ */ Symbol("ZodInput");
@@ -37260,7 +37339,7 @@ function registry() {
37260
37339
  (_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry());
37261
37340
  var globalRegistry = globalThis.__zod_globalRegistry;
37262
37341
 
37263
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/compile.js
37342
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/compile.js
37264
37343
  var INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
37265
37344
  var FALLBACK_FLAG = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
37266
37345
  var ZodCompileAsyncError = class extends Error {
@@ -38300,9 +38379,15 @@ function generateNullableCheck(doc, ctx, schema, accessor, buildsValue = true) {
38300
38379
  doc.write(`}`);
38301
38380
  return outputVar;
38302
38381
  }
38382
+ function generateSizeGate(doc, schema, size2) {
38383
+ for (const [max, check2] of sizeCaps(schema._zod.def.checks)) {
38384
+ doc.write(`if (${size2} > ${numericOperand(max, check2._zod.def.check)}) return INVALID;`);
38385
+ }
38386
+ }
38303
38387
  function generateArrayCheck(doc, ctx, schema, accessor, buildsValue = true) {
38304
38388
  const def = schema._zod.def;
38305
38389
  doc.write(`if (!Array.isArray(${accessor})) return INVALID;`);
38390
+ generateSizeGate(doc, schema, `${accessor}.length`);
38306
38391
  const outputVar = buildsValue ? newVar(ctx) : null;
38307
38392
  const iVar = newVar(ctx);
38308
38393
  const elemVar = newVar(ctx);
@@ -38702,6 +38787,7 @@ function literalPropertyKey(ctx, key) {
38702
38787
  function generateMapCheck(doc, ctx, schema, accessor) {
38703
38788
  const def = schema._zod.def;
38704
38789
  doc.write(`if (!(${accessor} instanceof Map)) return INVALID;`);
38790
+ generateSizeGate(doc, schema, `${accessor}.size`);
38705
38791
  const outputVar = newVar(ctx);
38706
38792
  const kVar = newVar(ctx);
38707
38793
  const valVar = newVar(ctx);
@@ -38718,6 +38804,7 @@ function generateMapCheck(doc, ctx, schema, accessor) {
38718
38804
  function generateSetCheck(doc, ctx, schema, accessor) {
38719
38805
  const def = schema._zod.def;
38720
38806
  doc.write(`if (!(${accessor} instanceof Set)) return INVALID;`);
38807
+ generateSizeGate(doc, schema, `${accessor}.size`);
38721
38808
  const outputVar = newVar(ctx);
38722
38809
  const valVar = newVar(ctx);
38723
38810
  doc.write(`const ${outputVar} = new Set();`);
@@ -38862,7 +38949,7 @@ function generateTransformCheck(doc, ctx, schema, accessor) {
38862
38949
  return accessor;
38863
38950
  }
38864
38951
 
38865
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/api.js
38952
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/api.js
38866
38953
  function snapshotChecks(def) {
38867
38954
  if (def.checks)
38868
38955
  def.checks = [...def.checks];
@@ -39921,7 +40008,7 @@ function _stringFormat(Class2, format, fnOrRegex, _params = {}) {
39921
40008
  return inst;
39922
40009
  }
39923
40010
 
39924
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/to-json-schema.js
40011
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/to-json-schema.js
39925
40012
  function assignProps(target, ...sources) {
39926
40013
  for (const source of sources) {
39927
40014
  for (const key of Reflect.ownKeys(source)) {
@@ -40451,7 +40538,7 @@ var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) =
40451
40538
  return finalize(ctx, schema);
40452
40539
  };
40453
40540
 
40454
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/json-schema-processors.js
40541
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/json-schema-processors.js
40455
40542
  var narrowMin = (agg, key, value) => {
40456
40543
  if (agg[key] === void 0 || value > agg[key])
40457
40544
  agg[key] = value;
@@ -41199,7 +41286,7 @@ function toJSONSchema(input2, params) {
41199
41286
  return finalize(ctx, input2);
41200
41287
  }
41201
41288
 
41202
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/json-schema-generator.js
41289
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/json-schema-generator.js
41203
41290
  var JSONSchemaGenerator = class {
41204
41291
  /** @deprecated Access via ctx instead */
41205
41292
  get metadataRegistry() {
@@ -41277,10 +41364,10 @@ var JSONSchemaGenerator = class {
41277
41364
  }
41278
41365
  };
41279
41366
 
41280
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/json-schema.js
41367
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/json-schema.js
41281
41368
  var json_schema_exports = {};
41282
41369
 
41283
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/schemas.js
41370
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/schemas.js
41284
41371
  var schemas_exports2 = {};
41285
41372
  __export(schemas_exports2, {
41286
41373
  ZodAny: () => ZodAny,
@@ -41461,7 +41548,7 @@ __export(schemas_exports2, {
41461
41548
  xor: () => xor
41462
41549
  });
41463
41550
 
41464
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/checks.js
41551
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/checks.js
41465
41552
  var checks_exports2 = {};
41466
41553
  __export(checks_exports2, {
41467
41554
  endsWith: () => _endsWith,
@@ -41496,7 +41583,7 @@ __export(checks_exports2, {
41496
41583
  uppercase: () => _uppercase
41497
41584
  });
41498
41585
 
41499
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/errors.js
41586
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/errors.js
41500
41587
  var _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
41501
41588
  function _lazyMethod(proto, key, make) {
41502
41589
  Object.defineProperty(proto, key, {
@@ -41542,7 +41629,7 @@ var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, void 0
41542
41629
  Parent: Error
41543
41630
  });
41544
41631
 
41545
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/parse.js
41632
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/parse.js
41546
41633
  var parse2 = /* @__PURE__ */ _parse(ZodRealError);
41547
41634
  var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
41548
41635
  var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -41556,7 +41643,7 @@ var safeDecode2 = /* @__PURE__ */ _safeDecode(ZodRealError);
41556
41643
  var safeEncodeAsync2 = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
41557
41644
  var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
41558
41645
 
41559
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/schemas.js
41646
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/schemas.js
41560
41647
  function _ensureDefaultLocale() {
41561
41648
  if (!globalConfig.localeError)
41562
41649
  config(en_default());
@@ -43021,7 +43108,7 @@ function preprocess(fn, schema) {
43021
43108
  });
43022
43109
  }
43023
43110
 
43024
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/compat.js
43111
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/compat.js
43025
43112
  var ZodIssueCode = {
43026
43113
  invalid_type: "invalid_type",
43027
43114
  too_big: "too_big",
@@ -43047,7 +43134,7 @@ var ZodFirstPartyTypeKind;
43047
43134
  /* @__PURE__ */ (function(ZodFirstPartyTypeKind3) {
43048
43135
  })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
43049
43136
 
43050
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/iso.js
43137
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/iso.js
43051
43138
  var iso_exports = {};
43052
43139
  __export(iso_exports, {
43053
43140
  ZodISODate: () => ZodISODate,
@@ -43072,7 +43159,7 @@ function duration2(params) {
43072
43159
  return _isoDuration(ZodISODuration, params);
43073
43160
  }
43074
43161
 
43075
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/from-json-schema.js
43162
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/from-json-schema.js
43076
43163
  var z = {
43077
43164
  ...schemas_exports2,
43078
43165
  ...checks_exports2,
@@ -43805,7 +43892,7 @@ function fromJSONSchema(schema, params) {
43805
43892
  return convertSchema(normalized, ctx);
43806
43893
  }
43807
43894
 
43808
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/visit.js
43895
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/visit.js
43809
43896
  var RESOLVING = /* @__PURE__ */ Symbol("z.visit/resolving");
43810
43897
  function visit(schema, fnOrHandlers) {
43811
43898
  const fn = typeof fnOrHandlers === "function" ? fnOrHandlers : (node2, rewritten) => {
@@ -43960,7 +44047,7 @@ function visit(schema, fnOrHandlers) {
43960
44047
  return run(schema);
43961
44048
  }
43962
44049
 
43963
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/deep-partial.js
44050
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/deep-partial.js
43964
44051
  function deepPartial(schema) {
43965
44052
  return visit(schema, {
43966
44053
  object: (s) => s.partial(),
@@ -43972,7 +44059,7 @@ function deepPartial(schema) {
43972
44059
  });
43973
44060
  }
43974
44061
 
43975
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/in-out.js
44062
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/in-out.js
43976
44063
  function withChecks(side, checks) {
43977
44064
  if (!checks?.length)
43978
44065
  return side;
@@ -44002,7 +44089,7 @@ function output(schema) {
44002
44089
  });
44003
44090
  }
44004
44091
 
44005
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/coerce.js
44092
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/coerce.js
44006
44093
  var coerce_exports = {};
44007
44094
  __export(coerce_exports, {
44008
44095
  bigint: () => bigint3,
@@ -44362,7 +44449,7 @@ function dtcgTokenDocument(system, schemes, name) {
44362
44449
  // packages/zaku/dist/lib/domain/errors/css-required.js
44363
44450
  var CssRequired = class extends Error {
44364
44451
  constructor() {
44365
- super("zaku tokens needs --css, the stylesheet that declares :root and .dark");
44452
+ super("zaku tokens needs designSystem.shadcn.css, the stylesheet that declares :root and .dark, or --css when it runs on one product");
44366
44453
  this.name = "CssRequired";
44367
44454
  }
44368
44455
  };
@@ -44417,6 +44504,34 @@ var PlaywrightMissing = class extends Error {
44417
44504
  }
44418
44505
  };
44419
44506
 
44507
+ // packages/zaku/dist/lib/domain/errors/product-config-missing.js
44508
+ var ProductConfigMissing = class extends Error {
44509
+ path;
44510
+ product;
44511
+ constructor(path2, product) {
44512
+ super(`no ${path2}, the zaku.yaml of the product ${product} the workspace config lists`);
44513
+ this.path = path2;
44514
+ this.product = product;
44515
+ this.name = "ProductConfigMissing";
44516
+ }
44517
+ };
44518
+
44519
+ // packages/zaku/dist/lib/domain/errors/product-required.js
44520
+ var ProductRequired = class extends Error {
44521
+ constructor(command, listed) {
44522
+ super(`${command} acts on one product; name one with --product: ${listed.join(", ")}`);
44523
+ this.name = "ProductRequired";
44524
+ }
44525
+ };
44526
+
44527
+ // packages/zaku/dist/lib/domain/errors/product-unknown.js
44528
+ var ProductUnknown = class extends Error {
44529
+ constructor(name, listed) {
44530
+ super(`no product ${name}; the config lists ${listed.join(", ")}`);
44531
+ this.name = "ProductUnknown";
44532
+ }
44533
+ };
44534
+
44420
44535
  // packages/zaku/dist/lib/domain/errors/recipe-page-failed.js
44421
44536
  var RecipePageFailed = class extends Error {
44422
44537
  constructor(cause) {
@@ -44433,6 +44548,18 @@ var RecipeUrlRequired = class extends Error {
44433
44548
  }
44434
44549
  };
44435
44550
 
44551
+ // packages/zaku/dist/lib/domain/errors/workspace-config-missing.js
44552
+ var WorkspaceConfigMissing = class extends Error {
44553
+ path;
44554
+ legacy;
44555
+ constructor(path2, legacy) {
44556
+ super(legacy === null ? `no ${path2}` : `no ${path2}, and no ${legacy} to fall back on; run zaku where zaku.config.yaml is, or name it with --config`);
44557
+ this.path = path2;
44558
+ this.legacy = legacy;
44559
+ this.name = "WorkspaceConfigMissing";
44560
+ }
44561
+ };
44562
+
44436
44563
  // packages/zaku/dist/lib/domain/theme-css.js
44437
44564
  function declarations(css, selector) {
44438
44565
  const escaped = selector.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -44452,19 +44579,17 @@ function parseThemeCss(css) {
44452
44579
 
44453
44580
  // packages/zaku/dist/lib/handlers/write-tokens.js
44454
44581
  var WriteTokensHandler = class WriteTokensHandler2 {
44455
- configs;
44456
44582
  documents;
44457
44583
  files;
44458
44584
  run;
44459
44585
  command = WriteTokens;
44460
- constructor(configs, documents, files2, run) {
44461
- this.configs = configs;
44586
+ constructor(documents, files2, run) {
44462
44587
  this.documents = documents;
44463
44588
  this.files = files2;
44464
44589
  this.run = run;
44465
44590
  }
44466
44591
  async handle(command) {
44467
- const config2 = await this.configs.read(command.root);
44592
+ const { config: config2 } = command;
44468
44593
  const system = config2.designSystem;
44469
44594
  let doc;
44470
44595
  let from;
@@ -44489,10 +44614,9 @@ var WriteTokensHandler = class WriteTokensHandler2 {
44489
44614
  };
44490
44615
  WriteTokensHandler = __decorate2([
44491
44616
  (0, import_tsyringe.injectable)({ token: TOKENS.COMMAND_HANDLER }),
44492
- __param2(0, (0, import_tsyringe.inject)(TOKENS.DESIGN_CONFIG_REPOSITORY)),
44493
- __param2(1, (0, import_tsyringe.inject)(TOKENS.TOKEN_DOCUMENT_REPOSITORY)),
44494
- __param2(2, (0, import_tsyringe.inject)(TOKENS.SOURCE_FILES)),
44495
- __param2(3, (0, import_tsyringe.inject)(TOKENS.RUN_COMMAND))
44617
+ __param2(0, (0, import_tsyringe.inject)(TOKENS.TOKEN_DOCUMENT_REPOSITORY)),
44618
+ __param2(1, (0, import_tsyringe.inject)(TOKENS.SOURCE_FILES)),
44619
+ __param2(2, (0, import_tsyringe.inject)(TOKENS.RUN_COMMAND))
44496
44620
  ], WriteTokensHandler);
44497
44621
 
44498
44622
  // packages/zaku/dist/lib/handlers/write-recipe.js
@@ -44587,17 +44711,15 @@ ${JSON.stringify(Object.entries(props).sort(([a], [b]) => a.localeCompare(b)))}`
44587
44711
 
44588
44712
  // packages/zaku/dist/lib/handlers/write-recipe.js
44589
44713
  var WriteRecipeHandler = class WriteRecipeHandler2 {
44590
- configs;
44591
44714
  recipes;
44592
44715
  readPage;
44593
44716
  command = WriteRecipe;
44594
- constructor(configs, recipes, readPage) {
44595
- this.configs = configs;
44717
+ constructor(recipes, readPage) {
44596
44718
  this.recipes = recipes;
44597
44719
  this.readPage = readPage;
44598
44720
  }
44599
44721
  async handle(command) {
44600
- const config2 = await this.configs.read(command.root);
44722
+ const { config: config2 } = command;
44601
44723
  const url2 = command.url ?? config2.recipe?.url;
44602
44724
  if (!url2)
44603
44725
  throw new RecipeUrlRequired();
@@ -44620,17 +44742,41 @@ var WriteRecipeHandler = class WriteRecipeHandler2 {
44620
44742
  };
44621
44743
  WriteRecipeHandler = __decorate2([
44622
44744
  (0, import_tsyringe2.injectable)({ token: TOKENS.COMMAND_HANDLER }),
44623
- __param2(0, (0, import_tsyringe2.inject)(TOKENS.DESIGN_CONFIG_REPOSITORY)),
44624
- __param2(1, (0, import_tsyringe2.inject)(TOKENS.RECIPE_REPOSITORY)),
44625
- __param2(2, (0, import_tsyringe2.inject)(TOKENS.RECIPE_PAGE_READER))
44745
+ __param2(0, (0, import_tsyringe2.inject)(TOKENS.RECIPE_REPOSITORY)),
44746
+ __param2(1, (0, import_tsyringe2.inject)(TOKENS.RECIPE_PAGE_READER))
44626
44747
  ], WriteRecipeHandler);
44627
44748
 
44628
44749
  // packages/zaku/dist/lib/handlers/save-library.js
44629
44750
  var import_tsyringe3 = __toESM(require_cjs(), 1);
44630
44751
  import { relative as relative2 } from "node:path";
44631
44752
 
44632
- // packages/zaku/dist/lib/domain/copy-defaults.js
44633
- var DEFAULT_COPY = { locales: ["en"], currencies: [] };
44753
+ // packages/zaku/dist/lib/repositories/design-paths.js
44754
+ import { join as join2 } from "node:path";
44755
+ function librarySnapshotDir(paths, key) {
44756
+ if (key === null)
44757
+ return paths;
44758
+ const library = join2(paths.library, key);
44759
+ return { root: paths.root, library, libraryIndex: join2(library, "index.json"), legacyLibrary: null };
44760
+ }
44761
+ function designPaths(root) {
44762
+ return {
44763
+ root,
44764
+ config: join2(root, "zaku.yaml"),
44765
+ maps: join2(root, "map"),
44766
+ outline: join2(root, "outline"),
44767
+ unmapped: join2(root, "outline", "unmapped.yaml"),
44768
+ files: join2(root, "outline", "files.yaml"),
44769
+ library: join2(root, "library"),
44770
+ libraryIndex: join2(root, "library", "index.json"),
44771
+ legacyLibrary: join2(root, "library.json"),
44772
+ tokens: join2(root, "tokens.json"),
44773
+ recipe: join2(root, "recipe.json")
44774
+ };
44775
+ }
44776
+
44777
+ // packages/zaku/dist/lib/repositories/library-snapshot.js
44778
+ import { mkdir, readdir, readFile as readFile2, rename as rename2, rm, writeFile as writeFile2 } from "node:fs/promises";
44779
+ import { join as join3, relative } from "node:path";
44634
44780
 
44635
44781
  // packages/zaku/dist/lib/domain/design-graph.js
44636
44782
  var DESKTOP_FAMILIES = /* @__PURE__ */ new Set(["macos", "windows", "gnome", "kde"]);
@@ -44716,334 +44862,6 @@ function snapshotsFor(input2, target) {
44716
44862
  return { libraries, kits, missing };
44717
44863
  }
44718
44864
 
44719
- // packages/zaku/dist/lib/schema/zaku-config.js
44720
- var PLATFORM_FAMILIES = ["web", "ios", "android", "macos", "windows", "gnome", "kde"];
44721
- var LAYERS = ["foundations", "components"];
44722
- var BRANCHES = ["ui", "native"];
44723
- var DEFAULT_INTERACTIVE = [
44724
- "Button",
44725
- "Button Group",
44726
- "Checkbox",
44727
- "Combobox",
44728
- "Dropdown Menu",
44729
- "Input",
44730
- "Input Group",
44731
- "Input OTP",
44732
- "Native Select",
44733
- "Pagination",
44734
- "Radio Group",
44735
- "Select",
44736
- "Slider",
44737
- "Switch",
44738
- "Tabs",
44739
- "Textarea",
44740
- "Toggle",
44741
- "Toggle Group"
44742
- ];
44743
- var id = external_exports.string().regex(/^[a-z][a-z0-9-]*$/, "lowercase letters, digits and dashes, starting with a letter");
44744
- var targetSchema = external_exports.object({
44745
- id,
44746
- family: external_exports.enum(PLATFORM_FAMILIES),
44747
- name: external_exports.string().regex(/^\S(.*\S)?$/, "a name has no leading or trailing space").refine((name) => !name.includes("/"), "a name has no slash, which separates the parts of a frame name"),
44748
- /** The frame size every frame of this target is drawn at; the frame check compares it. */
44749
- size: external_exports.object({ width: external_exports.number().positive(), height: external_exports.number().positive() }).strict().optional(),
44750
- /** The renderer whose libraries its frames draw from; `defaultBranch` in the design graph gives it when left out. */
44751
- branch: external_exports.enum(BRANCHES).optional()
44752
- }).strict();
44753
- var DEFAULT_SYSTEM_BARS = {
44754
- web: [],
44755
- ios: [["Status Bar"], ["Home Indicator"]],
44756
- android: [["Status Bar"], ["Navigation Bar", "Gesture Handle"]],
44757
- macos: [["Window Controls"]],
44758
- windows: [["Title Bar"]],
44759
- gnome: [["Header Bar"]],
44760
- kde: [["Title Bar"]]
44761
- };
44762
- function systemBarNames(config2) {
44763
- const bars = { ...DEFAULT_SYSTEM_BARS, ...config2.systemBars };
44764
- return new Set(Object.values(bars).flat(2));
44765
- }
44766
- var budgetSchema = external_exports.object({
44767
- mcpPerDay: external_exports.number().int().positive().default(200),
44768
- mcpPerRun: external_exports.number().int().positive().default(30),
44769
- reserve: external_exports.number().min(0).max(1).default(0.2)
44770
- }).strict();
44771
- var fileKey = external_exports.string().min(1);
44772
- var kitSchema = external_exports.object({ key: fileKey, family: external_exports.enum(PLATFORM_FAMILIES) }).strict();
44773
- var librarySchema = external_exports.object({
44774
- key: fileKey,
44775
- layer: external_exports.enum(LAYERS),
44776
- branches: external_exports.array(external_exports.enum(BRANCHES)).min(1),
44777
- /** The libraries and kits this one is built on, by key. */
44778
- extends: external_exports.array(fileKey).default([])
44779
- }).strict();
44780
- var productSchema = external_exports.object({ key: fileKey, family: external_exports.enum(PLATFORM_FAMILIES) }).strict();
44781
- var prototypeSchema = external_exports.object({ key: fileKey, family: external_exports.enum(PLATFORM_FAMILIES) }).strict();
44782
- var files = external_exports.object({
44783
- library: fileKey.optional(),
44784
- product: fileKey.optional(),
44785
- kits: external_exports.array(kitSchema).optional(),
44786
- libraries: external_exports.array(librarySchema).optional(),
44787
- products: external_exports.array(productSchema).optional(),
44788
- prototypes: external_exports.array(prototypeSchema).optional()
44789
- }).strict();
44790
- function byRole(figma) {
44791
- return [figma.kits, figma.libraries, figma.products, figma.prototypes].some((list) => list !== void 0);
44792
- }
44793
- var shadcnSystem = external_exports.object({ preset: external_exports.string().min(1) }).strict();
44794
- var tokenFiles = external_exports.array(external_exports.string().min(1)).min(1);
44795
- var resolverInputs = external_exports.record(external_exports.string(), external_exports.string());
44796
- var dtcgSystem = external_exports.object({
44797
- resolver: external_exports.string().min(1).optional(),
44798
- light: external_exports.union([tokenFiles, resolverInputs]),
44799
- dark: external_exports.union([tokenFiles, resolverInputs]),
44800
- /** The group whose tokens are the colour roles, and the one whose tokens are the radius steps. */
44801
- colors: external_exports.string().min(1).default("color"),
44802
- radii: external_exports.string().min(1).default("radius"),
44803
- /** Foreground and background token pairs a text is read in, each needing 4.5:1. */
44804
- contrast: external_exports.array(external_exports.tuple([external_exports.string().min(1), external_exports.string().min(1)])).default([])
44805
- }).strict().superRefine((dtcg, ctx) => {
44806
- for (const scheme of ["light", "dark"]) {
44807
- const files2 = Array.isArray(dtcg[scheme]);
44808
- if (dtcg.resolver !== void 0 && files2) {
44809
- ctx.addIssue({
44810
- code: "custom",
44811
- path: [scheme],
44812
- message: "with a resolver, name the modifier contexts, not files"
44813
- });
44814
- }
44815
- if (dtcg.resolver === void 0 && !files2) {
44816
- ctx.addIssue({
44817
- code: "custom",
44818
- path: [scheme],
44819
- message: "without a resolver, list the token files"
44820
- });
44821
- }
44822
- }
44823
- });
44824
- var designSystemSchema = external_exports.union([
44825
- external_exports.object({ shadcn: shadcnSystem }).strict(),
44826
- external_exports.object({ dtcg: dtcgSystem }).strict()
44827
- ]);
44828
- var recipeSchema = external_exports.object({
44829
- url: external_exports.url().optional(),
44830
- dark: external_exports.enum(["class", "media"]).default("class"),
44831
- darkClass: external_exports.string().min(1).default("dark")
44832
- }).strict();
44833
- function writtenInAScript(tag) {
44834
- try {
44835
- return new Intl.Locale(tag).maximize().script !== void 0;
44836
- } catch {
44837
- return false;
44838
- }
44839
- }
44840
- var copySchema = external_exports.object({
44841
- locales: external_exports.array(external_exports.string().refine(writtenInAScript, "a BCP 47 language tag, such as en or vi")).min(1).default(["en"]),
44842
- currencies: external_exports.array(external_exports.string().refine((code) => Intl.supportedValuesOf("currency").includes(code), "an ISO 4217 code, such as VND or USD")).default([])
44843
- }).strict();
44844
- var configShape = external_exports.object({
44845
- product: external_exports.string().min(1),
44846
- designSystem: designSystemSchema,
44847
- figma: files.default({}),
44848
- targets: external_exports.array(targetSchema).min(1),
44849
- modes: external_exports.record(external_exports.string(), external_exports.string()).default({}),
44850
- interactive: external_exports.array(external_exports.string().min(1)).default([...DEFAULT_INTERACTIVE]),
44851
- /** The bars of the families whose kit names them its own way; every family left out keeps its default. */
44852
- systemBars: external_exports.partialRecord(external_exports.enum(PLATFORM_FAMILIES), external_exports.array(external_exports.array(external_exports.string().min(1)).min(1))).optional(),
44853
- budget: budgetSchema.default({ mcpPerDay: 200, mcpPerRun: 30, reserve: 0.2 }),
44854
- recipe: recipeSchema.optional(),
44855
- copy: copySchema.default(DEFAULT_COPY)
44856
- }).strict();
44857
- var zakuConfigSchema = configShape.superRefine((config2, ctx) => {
44858
- for (const key of ["id", "name"]) {
44859
- const seen = /* @__PURE__ */ new Set();
44860
- config2.targets.forEach((target, index) => {
44861
- if (seen.has(target[key])) {
44862
- ctx.addIssue({
44863
- code: "custom",
44864
- path: ["targets", index, key],
44865
- message: `a second target with ${key} ${target[key]}`
44866
- });
44867
- }
44868
- seen.add(target[key]);
44869
- });
44870
- }
44871
- if (byRole(config2.figma))
44872
- refineFilesByRole(config2, ctx);
44873
- });
44874
- function refineFilesByRole(config2, ctx) {
44875
- const { figma } = config2;
44876
- if (figma.library !== void 0 || figma.product !== void 0) {
44877
- ctx.addIssue({
44878
- code: "custom",
44879
- path: ["figma"],
44880
- message: "figma.library and figma.product describe one library and one product; list files by role instead"
44881
- });
44882
- }
44883
- const kits = figma.kits ?? [];
44884
- const libraries = figma.libraries ?? [];
44885
- const products = figma.products ?? [];
44886
- const seen = /* @__PURE__ */ new Set();
44887
- const lists = [
44888
- ["kits", kits],
44889
- ["libraries", libraries],
44890
- ["products", products],
44891
- ["prototypes", figma.prototypes ?? []]
44892
- ];
44893
- for (const [list, entries] of lists) {
44894
- entries.forEach((entry, index) => {
44895
- if (seen.has(entry.key))
44896
- ctx.addIssue({
44897
- code: "custom",
44898
- path: ["figma", list, index, "key"],
44899
- message: `a second file with key ${entry.key}`
44900
- });
44901
- seen.add(entry.key);
44902
- });
44903
- }
44904
- const byKey = new Map(libraries.map((library) => [library.key, library]));
44905
- const kitKeys = new Set(kits.map((kit) => kit.key));
44906
- libraries.forEach((library, index) => {
44907
- const path2 = ["figma", "libraries", index, "extends"];
44908
- for (const key of library.extends) {
44909
- const base = byKey.get(key);
44910
- if (!base && !kitKeys.has(key)) {
44911
- ctx.addIssue({
44912
- code: "custom",
44913
- path: path2,
44914
- message: `${library.key} extends ${key}, which is no library or kit listed`
44915
- });
44916
- } else if (base?.layer === "components" && library.layer === "foundations") {
44917
- ctx.addIssue({ code: "custom", path: path2, message: `foundations ${library.key} extends components ${key}` });
44918
- } else if (base && !base.branches.some((branch) => library.branches.includes(branch))) {
44919
- ctx.addIssue({
44920
- code: "custom",
44921
- path: path2,
44922
- message: `${library.key} extends ${key}, which holds none of its branches`
44923
- });
44924
- }
44925
- }
44926
- });
44927
- const cycle = findCycle(libraries);
44928
- if (cycle)
44929
- ctx.addIssue({ code: "custom", path: ["figma", "libraries"], message: `extends comes back: ${cycle}` });
44930
- for (const [list, entries] of [
44931
- ["products", products],
44932
- ["prototypes", figma.prototypes ?? []]
44933
- ]) {
44934
- const families2 = /* @__PURE__ */ new Set();
44935
- entries.forEach((entry, index) => {
44936
- if (families2.has(entry.family))
44937
- ctx.addIssue({
44938
- code: "custom",
44939
- path: ["figma", list, index, "family"],
44940
- message: `a second ${list === "products" ? "product" : "prototype"} file for ${entry.family}`
44941
- });
44942
- families2.add(entry.family);
44943
- });
44944
- }
44945
- (figma.prototypes ?? []).forEach((prototype2, index) => {
44946
- if (!products.some((product) => product.family === prototype2.family))
44947
- ctx.addIssue({
44948
- code: "custom",
44949
- path: ["figma", "prototypes", index, "family"],
44950
- message: `no product file for ${prototype2.family} to copy its frames from`
44951
- });
44952
- });
44953
- config2.targets.forEach((target, index) => {
44954
- const branch = target.branch ?? defaultBranch(target.family);
44955
- const path2 = ["targets", index, "branch"];
44956
- if (branch === void 0) {
44957
- ctx.addIssue({ code: "custom", path: path2, message: `a ${target.family} target names its branch, ui or native` });
44958
- } else if (libraries.length > 0 && !libraries.some((library) => library.branches.includes(branch))) {
44959
- ctx.addIssue({ code: "custom", path: path2, message: `no library holds the ${branch} branch` });
44960
- }
44961
- });
44962
- }
44963
- function findCycle(libraries) {
44964
- const byKey = new Map(libraries.map((library) => [library.key, library]));
44965
- const visit2 = (key, path2) => {
44966
- if (path2.includes(key))
44967
- return [...path2.slice(path2.indexOf(key)), key].join(" -> ");
44968
- for (const next of byKey.get(key)?.extends ?? []) {
44969
- const found = visit2(next, [...path2, key]);
44970
- if (found)
44971
- return found;
44972
- }
44973
- return void 0;
44974
- };
44975
- for (const library of libraries) {
44976
- const found = visit2(library.key, []);
44977
- if (found)
44978
- return found;
44979
- }
44980
- return void 0;
44981
- }
44982
-
44983
- // packages/zaku/dist/lib/repositories/design-file.js
44984
- var import_yaml = __toESM(require_dist(), 1);
44985
- import { readFile, rename, writeFile } from "node:fs/promises";
44986
- function parseDesignFile(path2, text, schema) {
44987
- let data;
44988
- try {
44989
- data = path2.endsWith(".json") ? JSON.parse(text) : (0, import_yaml.parse)(text);
44990
- } catch (error62) {
44991
- throw new DesignFileInvalid(path2, [error62.message]);
44992
- }
44993
- const result = schema.safeParse(data);
44994
- if (!result.success) {
44995
- throw new DesignFileInvalid(path2, result.error.issues.map((issue2) => `${issue2.path.map(String).join(".") || "(root)"}: ${issue2.message}`));
44996
- }
44997
- return result.data;
44998
- }
44999
- async function readDesignFile(path2, schema) {
45000
- return parseDesignFile(path2, await readFile(path2, "utf8"), schema);
45001
- }
45002
- async function readOptionalDesignFile(path2, schema) {
45003
- let text;
45004
- try {
45005
- text = await readFile(path2, "utf8");
45006
- } catch (error62) {
45007
- if (error62.code === "ENOENT")
45008
- return null;
45009
- throw error62;
45010
- }
45011
- return parseDesignFile(path2, text, schema);
45012
- }
45013
- async function writeDesignFile(path2, value) {
45014
- const temporary = `${path2}.${process.pid}.tmp`;
45015
- await writeFile(temporary, `${JSON.stringify(value, null, 2)}
45016
- `);
45017
- await rename(temporary, path2);
45018
- }
45019
-
45020
- // packages/zaku/dist/lib/repositories/design-paths.js
45021
- import { join as join2 } from "node:path";
45022
- function librarySnapshotDir(paths, key) {
45023
- if (key === null)
45024
- return paths;
45025
- const library = join2(paths.library, key);
45026
- return { root: paths.root, library, libraryIndex: join2(library, "index.json"), legacyLibrary: null };
45027
- }
45028
- function designPaths(root) {
45029
- return {
45030
- root,
45031
- config: join2(root, "zaku.yaml"),
45032
- maps: join2(root, "map"),
45033
- outline: join2(root, "outline"),
45034
- unmapped: join2(root, "outline", "unmapped.yaml"),
45035
- library: join2(root, "library"),
45036
- libraryIndex: join2(root, "library", "index.json"),
45037
- legacyLibrary: join2(root, "library.json"),
45038
- tokens: join2(root, "tokens.json"),
45039
- recipe: join2(root, "recipe.json")
45040
- };
45041
- }
45042
-
45043
- // packages/zaku/dist/lib/repositories/library-snapshot.js
45044
- import { mkdir, readdir, readFile as readFile2, rename as rename2, rm, writeFile as writeFile2 } from "node:fs/promises";
45045
- import { join as join3, relative } from "node:path";
45046
-
45047
44865
  // packages/zaku/dist/lib/domain/library.js
45048
44866
  var rgbaSchema = external_exports.object({ r: external_exports.number(), g: external_exports.number(), b: external_exports.number(), a: external_exports.number() }).strict();
45049
44867
  var libraryItemSchema = external_exports.object({
@@ -45332,6 +45150,43 @@ function formatLibraryFile(value) {
45332
45150
  `;
45333
45151
  }
45334
45152
 
45153
+ // packages/zaku/dist/lib/repositories/design-file.js
45154
+ var import_yaml = __toESM(require_dist(), 1);
45155
+ import { readFile, rename, writeFile } from "node:fs/promises";
45156
+ function parseDesignFile(path2, text, schema) {
45157
+ let data;
45158
+ try {
45159
+ data = path2.endsWith(".json") ? JSON.parse(text) : (0, import_yaml.parse)(text);
45160
+ } catch (error62) {
45161
+ throw new DesignFileInvalid(path2, [error62.message]);
45162
+ }
45163
+ const result = schema.safeParse(data);
45164
+ if (!result.success) {
45165
+ throw new DesignFileInvalid(path2, result.error.issues.map((issue2) => `${issue2.path.map(String).join(".") || "(root)"}: ${issue2.message}`));
45166
+ }
45167
+ return result.data;
45168
+ }
45169
+ async function readDesignFile(path2, schema) {
45170
+ return parseDesignFile(path2, await readFile(path2, "utf8"), schema);
45171
+ }
45172
+ async function readOptionalDesignFile(path2, schema) {
45173
+ let text;
45174
+ try {
45175
+ text = await readFile(path2, "utf8");
45176
+ } catch (error62) {
45177
+ if (error62.code === "ENOENT")
45178
+ return null;
45179
+ throw error62;
45180
+ }
45181
+ return parseDesignFile(path2, text, schema);
45182
+ }
45183
+ async function writeDesignFile(path2, value) {
45184
+ const temporary = `${path2}.${process.pid}.tmp`;
45185
+ await writeFile(temporary, `${JSON.stringify(value, null, 2)}
45186
+ `);
45187
+ await rename(temporary, path2);
45188
+ }
45189
+
45335
45190
  // packages/zaku/dist/lib/repositories/library-snapshot.js
45336
45191
  async function readText(path2) {
45337
45192
  try {
@@ -45724,8 +45579,7 @@ function librarySaveTarget(config2, key) {
45724
45579
  }
45725
45580
  async function saveLibrary(options) {
45726
45581
  const paths = designPaths(options.root);
45727
- const config2 = await readDesignFile(paths.config, zakuConfigSchema);
45728
- const target = librarySaveTarget(config2, options.key);
45582
+ const target = librarySaveTarget(options.config, options.key);
45729
45583
  if (target.kind === "kit") {
45730
45584
  const at2 = librarySnapshotDir(paths, target.kit.key);
45731
45585
  const kit = await readKit({ rest: options.rest, key: target.kit.key, family: target.kit.family });
@@ -45753,6 +45607,7 @@ var SaveLibraryHandler = class SaveLibraryHandler2 {
45753
45607
  handle(command) {
45754
45608
  return saveLibrary({
45755
45609
  root: command.root,
45610
+ config: command.config,
45756
45611
  rest: this.rest,
45757
45612
  ...command.key !== void 0 ? { key: command.key } : {},
45758
45613
  ...command.part !== void 0 ? { part: command.part } : {}
@@ -45771,6 +45626,85 @@ var import_yaml2 = __toESM(require_dist(), 1);
45771
45626
  import { mkdir as mkdir2, rm as rm2, writeFile as writeFile3 } from "node:fs/promises";
45772
45627
  import { dirname as dirname2, join as join6 } from "node:path";
45773
45628
 
45629
+ // packages/zaku/dist/lib/adapters/figma-rest.js
45630
+ var FigmaRateLimited = class extends Error {
45631
+ url;
45632
+ constructor(url2) {
45633
+ super(`Figma answered 429 twice for ${url2}; wait and run again`);
45634
+ this.url = url2;
45635
+ this.name = "FigmaRateLimited";
45636
+ }
45637
+ };
45638
+ var FigmaRequestFailed = class extends Error {
45639
+ url;
45640
+ status;
45641
+ constructor(url2, status, body) {
45642
+ super(`Figma answered ${status} for ${url2}: ${body.slice(0, 200)}`);
45643
+ this.url = url2;
45644
+ this.status = status;
45645
+ this.name = "FigmaRequestFailed";
45646
+ }
45647
+ };
45648
+ var BASE = "https://api.figma.com/v1";
45649
+ var BATCH = 50;
45650
+ var MAX_WAIT_MS = 12e4;
45651
+ function createFigmaRest(options) {
45652
+ const send = options.fetch ?? globalThis.fetch;
45653
+ const sleep = options.sleep ?? ((ms) => new Promise((done) => setTimeout(done, ms)));
45654
+ const onCall = options.onCall ?? (() => void 0);
45655
+ async function call(url2) {
45656
+ for (let attempt = 0; attempt < 2; attempt += 1) {
45657
+ const res = await send(url2, { headers: { "X-Figma-Token": options.token } });
45658
+ onCall();
45659
+ if (res.status === 429) {
45660
+ if (attempt === 1)
45661
+ break;
45662
+ const seconds = Number(res.headers.get("Retry-After") ?? "60");
45663
+ await sleep(Math.min(Number.isFinite(seconds) ? seconds * 1e3 : 6e4, MAX_WAIT_MS));
45664
+ continue;
45665
+ }
45666
+ if (!res.ok)
45667
+ throw new FigmaRequestFailed(url2, res.status, await res.text());
45668
+ return await res.json();
45669
+ }
45670
+ throw new FigmaRateLimited(url2);
45671
+ }
45672
+ const chunks = (ids) => Array.from({ length: Math.ceil(ids.length / BATCH) }, (_, index) => ids.slice(index * BATCH, (index + 1) * BATCH));
45673
+ async function components(fileKey3) {
45674
+ const listed = await call(`${BASE}/files/${fileKey3}/components`);
45675
+ return listed.meta.components;
45676
+ }
45677
+ return {
45678
+ file: (fileKey3, depth) => call(`${BASE}/files/${fileKey3}?depth=${depth}`),
45679
+ async fileName(fileKey3) {
45680
+ const meta3 = await call(`${BASE}/files/${fileKey3}/meta`);
45681
+ return meta3.file.name;
45682
+ },
45683
+ async nodes(fileKey3, ids) {
45684
+ const merged = { version: "", nodes: {} };
45685
+ for (const chunk of chunks(ids)) {
45686
+ const part = await call(`${BASE}/files/${fileKey3}/nodes?ids=${encodeURIComponent(chunk.join(","))}`);
45687
+ merged.version = part.version;
45688
+ Object.assign(merged.nodes, part.nodes);
45689
+ }
45690
+ return merged;
45691
+ },
45692
+ async published(fileKey3) {
45693
+ const sets = await call(`${BASE}/files/${fileKey3}/component_sets`);
45694
+ return { sets: sets.meta.component_sets, components: await components(fileKey3) };
45695
+ },
45696
+ components,
45697
+ async images(fileKey3, ids) {
45698
+ const merged = {};
45699
+ for (const chunk of chunks(ids)) {
45700
+ const part = await call(`${BASE}/images/${fileKey3}?ids=${encodeURIComponent(chunk.join(","))}&format=png&scale=1`);
45701
+ Object.assign(merged, part.images);
45702
+ }
45703
+ return merged;
45704
+ }
45705
+ };
45706
+ }
45707
+
45774
45708
  // packages/zaku/dist/lib/domain/documentation-measures.js
45775
45709
  var COVER = {
45776
45710
  page: "Thumbnail",
@@ -46171,6 +46105,7 @@ var screenSchema = external_exports.object({
46171
46105
  states: external_exports.array(state).min(1).refine((states) => states[0] === DEFAULT_STATE, `the first state is ${DEFAULT_STATE}`),
46172
46106
  targets: external_exports.union([external_exports.literal("all"), external_exports.array(slug).min(1)]).default("all"),
46173
46107
  omits: external_exports.record(external_exports.string(), external_exports.string().min(1)).default({}),
46108
+ "state-omits": external_exports.record(external_exports.string(), external_exports.record(external_exports.string(), external_exports.string().min(1))).default({}),
46174
46109
  "copy-varies": external_exports.string().min(1).optional(),
46175
46110
  entry: external_exports.array(external_exports.object({
46176
46111
  from: screenRef.optional(),
@@ -46189,7 +46124,16 @@ var screenSchema = external_exports.object({
46189
46124
  }).partial().strict().default({}),
46190
46125
  components: external_exports.array(external_exports.string().min(1)).default([]),
46191
46126
  a11y: external_exports.record(external_exports.string(), external_exports.unknown()).default({})
46192
- }).strict();
46127
+ }).strict().superRefine((screen, context) => {
46128
+ for (const omitted of Object.keys(screen["state-omits"])) {
46129
+ if (!screen.states.includes(omitted))
46130
+ context.addIssue({
46131
+ code: "custom",
46132
+ path: ["state-omits", omitted],
46133
+ message: `${omitted} is not one of the screen's states`
46134
+ });
46135
+ }
46136
+ });
46193
46137
  var featureMapSchema = external_exports.object({ feature: slug, screens: external_exports.record(slug, screenSchema) }).strict();
46194
46138
  function resolveTargets(screen, config2) {
46195
46139
  const known = new Map(config2.targets.map((target) => [target.id, target]));
@@ -46307,6 +46251,7 @@ var PICTURE_NAME = /\b(photo|image|picture|avatar|cover|thumbnail|hero|banner|il
46307
46251
  var visiblePaint = (paints) => (paints ?? []).some((paint) => paint.visible !== false && (paint.opacity ?? 1) > 0);
46308
46252
  var holdsImage = (node2) => (node2.fills ?? []).some((paint) => paint.type === "IMAGE" && paint.visible !== false);
46309
46253
  var shown = (node2) => (node2.children ?? []).filter((child) => child.visible !== false);
46254
+ var holdsImageBelow = (node2) => shown(node2).some((child) => holdsImage(child) || holdsImageBelow(child));
46310
46255
  function signatureOf(node2) {
46311
46256
  const children = shown(node2);
46312
46257
  return children.length === 0 ? node2.type : `${node2.type}(${children.map(signatureOf).join(",")})`;
@@ -46348,7 +46293,7 @@ function outlineFrame(frame, where, ctx) {
46348
46293
  const images2 = [];
46349
46294
  const defaultNames = [];
46350
46295
  const links = [];
46351
- const relative3 = (node2) => {
46296
+ const relative4 = (node2) => {
46352
46297
  const box = node2.absoluteBoundingBox;
46353
46298
  return box ? { x: box.x - origin.x, y: box.y - origin.y, width: box.width, height: box.height } : null;
46354
46299
  };
@@ -46361,10 +46306,32 @@ function outlineFrame(frame, where, ctx) {
46361
46306
  if (node2.type === "INSTANCE" || node2.type === "TEXT")
46362
46307
  return;
46363
46308
  const filled = holdsImage(node2);
46364
- if (filled || PICTURE_NAME.test(node2.name))
46309
+ if (filled || PICTURE_NAME.test(node2.name) && !holdsImageBelow(node2))
46365
46310
  images2.push({ nodeId: node2.id, name: node2.name, filled });
46366
46311
  };
46367
- const inside = (node2, path2, instance) => {
46312
+ const clipped = (clip, node2) => {
46313
+ const box = node2.absoluteBoundingBox;
46314
+ if (!node2.clipsContent || !box)
46315
+ return clip;
46316
+ if (!clip)
46317
+ return box;
46318
+ const x = Math.max(clip.x, box.x);
46319
+ const y = Math.max(clip.y, box.y);
46320
+ return {
46321
+ x,
46322
+ y,
46323
+ width: Math.max(0, Math.min(clip.x + clip.width, box.x + box.width) - x),
46324
+ height: Math.max(0, Math.min(clip.y + clip.height, box.y + box.height) - y)
46325
+ };
46326
+ };
46327
+ const seen = (clip, node2) => {
46328
+ const box = node2.absoluteBoundingBox;
46329
+ if (!clip || !box)
46330
+ return true;
46331
+ return Math.min(clip.x + clip.width, box.x + box.width) > Math.max(clip.x, box.x) && Math.min(clip.y + clip.height, box.y + box.height) > Math.max(clip.y, box.y);
46332
+ };
46333
+ const inside = (node2, path2, instance, outer) => {
46334
+ const clip = clipped(outer, node2);
46368
46335
  for (const child of shown(node2)) {
46369
46336
  const childPath = path2 ? `${path2}/${child.name}` : child.name;
46370
46337
  picture(child);
@@ -46377,7 +46344,7 @@ function outlineFrame(frame, where, ctx) {
46377
46344
  componentKey: ctx.components[child.componentId ?? ""]?.key ?? "",
46378
46345
  component: component2,
46379
46346
  interactive: ctx.interactive.has(component2),
46380
- bounds: relative3(child)
46347
+ bounds: seen(clip, child) ? relative4(child) : null
46381
46348
  });
46382
46349
  } else if (child.type === "TEXT") {
46383
46350
  instance.texts.push({
@@ -46386,7 +46353,7 @@ function outlineFrame(frame, where, ctx) {
46386
46353
  characters: child.characters ?? ""
46387
46354
  });
46388
46355
  }
46389
- inside(child, childPath, instance);
46356
+ inside(child, childPath, instance, clip);
46390
46357
  }
46391
46358
  };
46392
46359
  const instanceOf = (node2) => {
@@ -46418,7 +46385,7 @@ function outlineFrame(frame, where, ctx) {
46418
46385
  texts: [],
46419
46386
  interactive: ctx.interactive.has(component2),
46420
46387
  local: meta3?.remote === false,
46421
- bounds: relative3(node2),
46388
+ bounds: relative4(node2),
46422
46389
  sizing: {
46423
46390
  horizontal: node2.layoutSizingHorizontal ?? "FIXED",
46424
46391
  vertical: node2.layoutSizingVertical ?? "FIXED"
@@ -46610,6 +46577,7 @@ var unmappedSchema = external_exports.object({
46610
46577
  /** A component drawn on a product page, which belongs in a Components library. */
46611
46578
  components: external_exports.array(external_exports.object({ nodeId: external_exports.string(), name: external_exports.string(), page: external_exports.string(), source: external_exports.string() }).strict()).optional()
46612
46579
  }).strict();
46580
+ var outlineFilesSchema = external_exports.object({ files: external_exports.array(external_exports.object({ key: external_exports.string(), name: external_exports.string() }).strict()) }).strict();
46613
46581
 
46614
46582
  // packages/zaku/dist/lib/repositories/outlines.js
46615
46583
  var FLOWS_DIR = "flows";
@@ -46629,12 +46597,12 @@ async function loadOutlines(dir) {
46629
46597
  features = (await readdir3(dir, { withFileTypes: true })).filter((entry) => entry.isDirectory() && entry.name !== FLOWS_DIR).map((entry) => entry.name).sort();
46630
46598
  } catch (error62) {
46631
46599
  if (error62.code === "ENOENT")
46632
- return { outlines, flows, unmapped: null, errors };
46600
+ return { outlines, flows, unmapped: null, files: null, errors };
46633
46601
  throw error62;
46634
46602
  }
46635
46603
  for (const feature of features) {
46636
- const files2 = (await readdir3(join5(dir, feature))).filter((name) => name.endsWith(".yaml")).sort();
46637
- for (const file2 of files2) {
46604
+ const files3 = (await readdir3(join5(dir, feature))).filter((name) => name.endsWith(".yaml")).sort();
46605
+ for (const file2 of files3) {
46638
46606
  try {
46639
46607
  outlines.push(await readDesignFile(join5(dir, feature, file2), screenOutlineSchema));
46640
46608
  } catch (error62) {
@@ -46651,8 +46619,8 @@ async function loadOutlines(dir) {
46651
46619
  throw error62;
46652
46620
  });
46653
46621
  for (const source of sources.sort()) {
46654
- const files2 = (await readdir3(join5(dir, FLOWS_DIR, source))).filter((name) => name.endsWith(".yaml")).sort();
46655
- for (const file2 of files2) {
46622
+ const files3 = (await readdir3(join5(dir, FLOWS_DIR, source))).filter((name) => name.endsWith(".yaml")).sort();
46623
+ for (const file2 of files3) {
46656
46624
  try {
46657
46625
  flows.push(await readDesignFile(join5(dir, FLOWS_DIR, source, file2), flowOutlineSchema));
46658
46626
  } catch (error62) {
@@ -46672,7 +46640,16 @@ async function loadOutlines(dir) {
46672
46640
  else
46673
46641
  throw error62;
46674
46642
  }
46675
- return { outlines, flows, unmapped, errors };
46643
+ let files2 = null;
46644
+ try {
46645
+ files2 = await readOptionalDesignFile(join5(dir, "files.yaml"), outlineFilesSchema);
46646
+ } catch (error62) {
46647
+ if (error62 instanceof DesignFileInvalid)
46648
+ errors.push(error62);
46649
+ else
46650
+ throw error62;
46651
+ }
46652
+ return { outlines, flows, unmapped, files: files2, errors };
46676
46653
  }
46677
46654
 
46678
46655
  // packages/zaku/dist/lib/handlers/write-outline.js
@@ -46749,9 +46726,28 @@ function productFiles(config2) {
46749
46726
  targets: graph.targetsOf(product.family)
46750
46727
  }));
46751
46728
  }
46729
+ async function readFileNames(rest, config2, read) {
46730
+ const graph = designGraph(config2);
46731
+ const files2 = [];
46732
+ for (const file2 of [...graph.products, ...graph.prototypes]) {
46733
+ const name = read.get(file2.key);
46734
+ if (name !== void 0)
46735
+ files2.push({ key: file2.key, name });
46736
+ }
46737
+ for (const library of graph.libraries.filter((each) => each.layer === "components")) {
46738
+ try {
46739
+ files2.push({ key: library.key, name: await rest.fileName(library.key) });
46740
+ } catch (error62) {
46741
+ if (error62 instanceof FigmaRequestFailed && (error62.status === 403 || error62.status === 404))
46742
+ continue;
46743
+ throw error62;
46744
+ }
46745
+ }
46746
+ return { files: files2 };
46747
+ }
46752
46748
  async function runOutline(options) {
46753
46749
  const paths = designPaths(options.root);
46754
- const config2 = await readDesignFile(paths.config, zakuConfigSchema);
46750
+ const { config: config2 } = options;
46755
46751
  const { libraries: listed, kits, products: byFamily, prototypes: flows } = config2.figma;
46756
46752
  const legacy = [listed, kits, byFamily, flows].every((files2) => files2 === void 0);
46757
46753
  const products = productFiles(config2);
@@ -46766,6 +46762,7 @@ async function runOutline(options) {
46766
46762
  const existing = await loadOutlines(paths.outline);
46767
46763
  const prototypes = new Set(legacy ? config2.targets.map((target) => `${target.name} prototype`) : []);
46768
46764
  const versions = {};
46765
+ const names = /* @__PURE__ */ new Map();
46769
46766
  const flowPages = /* @__PURE__ */ new Map();
46770
46767
  const flowFrame = (source, frame, targets) => {
46771
46768
  const parsed = parseFrameName(frame.name, targets);
@@ -46783,6 +46780,7 @@ ${frame.page}`;
46783
46780
  for (const product of products) {
46784
46781
  const file2 = await options.rest.file(product.key, INDEX_DEPTH);
46785
46782
  versions[product.key] = file2.version;
46783
+ names.set(product.key, file2.name);
46786
46784
  const listed2 = listFrames(file2.document);
46787
46785
  for (const frame of listed2.filter((candidate) => prototypes.has(candidate.page)))
46788
46786
  flowFrame(product.key, frame, product.targets);
@@ -46795,7 +46793,7 @@ ${frame.page}`;
46795
46793
  }
46796
46794
  const ref = legacy ? resolveFrame(frame, parsed, maps) : resolveTitle(parsed, maps);
46797
46795
  if (ref)
46798
- resolved.set(frame.id, { frame, parsed, ref, source: product.key });
46796
+ resolved.set(frameKey(product.key, frame.id), { frame, parsed, ref, source: product.key });
46799
46797
  else
46800
46798
  unmapped.frames.push({ nodeId: frame.id, name: frame.name });
46801
46799
  }
@@ -46806,6 +46804,7 @@ ${frame.page}`;
46806
46804
  for (const file2 of legacy ? [] : graph.prototypes) {
46807
46805
  const read = await options.rest.file(file2.key, INDEX_DEPTH);
46808
46806
  versions[file2.key] = read.version;
46807
+ names.set(file2.key, read.name);
46809
46808
  const targets = graph.targetsOf(file2.family);
46810
46809
  for (const frame of listFrames(read.document).filter((candidate) => holdsScreens(candidate.page)))
46811
46810
  flowFrame(file2.key, frame, targets);
@@ -46813,13 +46812,18 @@ ${frame.page}`;
46813
46812
  unmapped.fileVersion = Object.values(versions).join(",");
46814
46813
  if (!legacy)
46815
46814
  unmapped.components = components;
46816
- const outlined = new Set(existing.outlines.flatMap((outline) => outline.frames.map((frame) => frame.nodeId)));
46815
+ if (!legacy) {
46816
+ await mkdir2(paths.outline, { recursive: true });
46817
+ await writeFile3(paths.files, (0, import_yaml2.stringify)(await readFileNames(options.rest, config2, names)));
46818
+ }
46819
+ const outlined = new Set(existing.outlines.flatMap((outline) => outline.frames.map((frame) => frameKey(frame.source ?? outline.source, frame.nodeId))));
46817
46820
  const drawnScreens = new Set([...resolved.values()].map(({ ref }) => `${ref.feature}/${ref.id}`));
46818
46821
  const current = existing.outlines.every((outline) => (legacy ? outline.fileVersion === versions[outline.source] : isDeepStrictEqual2(outline.fileVersions, versions)) && outline.mapDigest === digests.get(outline.feature) && isDeepStrictEqual2(outline.libraryVersions, libraryVersions)) && [...resolved.keys()].every((id2) => outlined.has(id2)) && existing.flows.length === flowPages.size && existing.flows.every((flow) => flow.fileVersion === versions[flow.source]) && existing.outlines.every((outline) => drawnScreens.has(`${outline.feature}/${outline.screen}`));
46819
46822
  if (options.frames === null && existing.outlines.length > 0 && current) {
46820
46823
  return { skipped: true, read: 0, written: [], unmapped: unmapped.frames.length };
46821
46824
  }
46822
- const ids = options.frames ?? [...resolved.keys()];
46825
+ const resolvedIds = new Set([...resolved.values()].map(({ frame }) => frame.id));
46826
+ const ids = options.frames ?? [...resolvedIds];
46823
46827
  const byScreen = /* @__PURE__ */ new Map();
46824
46828
  if (options.frames !== null) {
46825
46829
  for (const outline of existing.outlines)
@@ -46827,7 +46831,7 @@ ${frame.page}`;
46827
46831
  }
46828
46832
  const interactive = new Set(config2.interactive);
46829
46833
  for (const product of products) {
46830
- const own2 = ids.filter((id2) => resolved.has(id2) ? resolved.get(id2)?.source === product.key : product === products[0]);
46834
+ const own2 = ids.filter((id2) => resolvedIds.has(id2) ? resolved.has(frameKey(product.key, id2)) : product === products[0]);
46831
46835
  if (own2.length === 0)
46832
46836
  continue;
46833
46837
  const response = await options.rest.nodes(product.key, own2);
@@ -46842,7 +46846,7 @@ ${frame.page}`;
46842
46846
  }
46843
46847
  }
46844
46848
  for (const [id2, entry] of Object.entries(response.nodes)) {
46845
- const found = resolved.get(id2);
46849
+ const found = resolved.get(frameKey(product.key, id2));
46846
46850
  if (!entry || !found)
46847
46851
  continue;
46848
46852
  const { frame: place, parsed, ref } = found;
@@ -46864,7 +46868,8 @@ ${frame.page}`;
46864
46868
  }, { ...entry, interactive, sizes });
46865
46869
  if (!legacy)
46866
46870
  Object.assign(frame, { page: place.page, source: product.key });
46867
- outline.frames = [...outline.frames.filter((kept) => kept.nodeId !== id2), frame].sort((a, b) => a.name.localeCompare(b.name));
46871
+ const replaced = (kept) => kept.nodeId === id2 && (kept.source ?? outline.source) === product.key;
46872
+ outline.frames = [...outline.frames.filter((kept) => !replaced(kept)), frame].sort((a, b) => a.name.localeCompare(b.name));
46868
46873
  outline.mapDigest = digests.get(ref.feature) ?? "";
46869
46874
  outline.libraryVersions = libraryVersions;
46870
46875
  if (legacy)
@@ -46926,6 +46931,10 @@ ${frame.page}`;
46926
46931
  unmapped: unmapped.frames.length
46927
46932
  };
46928
46933
  }
46934
+ function frameKey(source, id2) {
46935
+ return `${source}
46936
+ ${id2}`;
46937
+ }
46929
46938
  var WriteOutlineHandler = class WriteOutlineHandler2 {
46930
46939
  rest;
46931
46940
  command = WriteOutline;
@@ -46933,7 +46942,7 @@ var WriteOutlineHandler = class WriteOutlineHandler2 {
46933
46942
  this.rest = rest;
46934
46943
  }
46935
46944
  handle(command) {
46936
- return runOutline({ root: command.root, rest: this.rest, frames: command.frames });
46945
+ return runOutline({ root: command.root, config: command.config, rest: this.rest, frames: command.frames });
46937
46946
  }
46938
46947
  };
46939
46948
  WriteOutlineHandler = __decorate2([
@@ -46944,10 +46953,389 @@ WriteOutlineHandler = __decorate2([
46944
46953
  // packages/zaku/dist/lib/handlers/write-schemas.js
46945
46954
  var import_tsyringe5 = __toESM(require_cjs(), 1);
46946
46955
 
46956
+ // packages/zaku/dist/lib/schema/zaku-config.js
46957
+ import { posix } from "node:path";
46958
+
46959
+ // packages/zaku/dist/lib/domain/copy-defaults.js
46960
+ var DEFAULT_COPY = { locales: ["en"], currencies: [] };
46961
+
46962
+ // packages/zaku/dist/lib/schema/zaku-config.js
46963
+ var PLATFORM_FAMILIES = ["web", "ios", "android", "macos", "windows", "gnome", "kde"];
46964
+ var LAYERS = ["foundations", "components"];
46965
+ var BRANCHES = ["ui", "native"];
46966
+ var DEFAULT_INTERACTIVE = [
46967
+ "Button",
46968
+ "Button Group",
46969
+ "Checkbox",
46970
+ "Combobox",
46971
+ "Dropdown Menu",
46972
+ "Input",
46973
+ "Input Group",
46974
+ "Input OTP",
46975
+ "Native Select",
46976
+ "Pagination",
46977
+ "Radio Group",
46978
+ "Select",
46979
+ "Slider",
46980
+ "Switch",
46981
+ "Tabs",
46982
+ "Textarea",
46983
+ "Toggle",
46984
+ "Toggle Group"
46985
+ ];
46986
+ var id = external_exports.string().regex(/^[a-z][a-z0-9-]*$/, "lowercase letters, digits and dashes, starting with a letter");
46987
+ var targetSchema = external_exports.object({
46988
+ id,
46989
+ family: external_exports.enum(PLATFORM_FAMILIES),
46990
+ name: external_exports.string().regex(/^\S(.*\S)?$/, "a name has no leading or trailing space").refine((name) => !name.includes("/"), "a name has no slash, which separates the parts of a frame name"),
46991
+ /** The frame size every frame of this target is drawn at; the frame check compares it. */
46992
+ size: external_exports.object({ width: external_exports.number().positive(), height: external_exports.number().positive() }).strict().optional(),
46993
+ /** The renderer whose libraries its frames draw from; `defaultBranch` in the design graph gives it when left out. */
46994
+ branch: external_exports.enum(BRANCHES).optional()
46995
+ }).strict();
46996
+ var DEFAULT_SYSTEM_BARS = {
46997
+ web: [],
46998
+ ios: [["Status Bar"], ["Home Indicator"]],
46999
+ android: [["Status Bar"], ["Navigation Bar", "Gesture Handle"]],
47000
+ macos: [["Window Controls"]],
47001
+ windows: [["Title Bar"]],
47002
+ gnome: [["Header Bar"]],
47003
+ kde: [["Title Bar"]]
47004
+ };
47005
+ function systemBarNames(config2) {
47006
+ const bars = { ...DEFAULT_SYSTEM_BARS, ...config2.systemBars };
47007
+ return new Set(Object.values(bars).flat(2));
47008
+ }
47009
+ var budgetSchema = external_exports.object({
47010
+ mcpPerDay: external_exports.number().int().positive().default(200),
47011
+ mcpPerRun: external_exports.number().int().positive().default(30),
47012
+ reserve: external_exports.number().min(0).max(1).default(0.2)
47013
+ }).strict();
47014
+ var fileKey = external_exports.string().min(1);
47015
+ var kitSchema = external_exports.object({ key: fileKey, family: external_exports.enum(PLATFORM_FAMILIES) }).strict();
47016
+ var librarySchema = external_exports.object({
47017
+ key: fileKey,
47018
+ layer: external_exports.enum(LAYERS),
47019
+ branches: external_exports.array(external_exports.enum(BRANCHES)).min(1),
47020
+ /** The libraries and kits this one is built on, by key. */
47021
+ extends: external_exports.array(fileKey).default([])
47022
+ }).strict();
47023
+ var productSchema = external_exports.object({ key: fileKey, family: external_exports.enum(PLATFORM_FAMILIES) }).strict();
47024
+ var prototypeSchema = external_exports.object({ key: fileKey, family: external_exports.enum(PLATFORM_FAMILIES) }).strict();
47025
+ var files = external_exports.object({
47026
+ library: fileKey.optional(),
47027
+ product: fileKey.optional(),
47028
+ kits: external_exports.array(kitSchema).optional(),
47029
+ libraries: external_exports.array(librarySchema).optional(),
47030
+ products: external_exports.array(productSchema).optional(),
47031
+ prototypes: external_exports.array(prototypeSchema).optional()
47032
+ }).strict();
47033
+ function byRole(figma) {
47034
+ return [figma.kits, figma.libraries, figma.products, figma.prototypes].some((list) => list !== void 0);
47035
+ }
47036
+ var shadcnSystem = external_exports.object({
47037
+ preset: external_exports.string().min(1),
47038
+ /** The stylesheet `zaku tokens` reads, relative to the directory of the workspace config. */
47039
+ css: external_exports.string().min(1).optional()
47040
+ }).strict();
47041
+ var tokenFiles = external_exports.array(external_exports.string().min(1)).min(1);
47042
+ var resolverInputs = external_exports.record(external_exports.string(), external_exports.string());
47043
+ var dtcgSystem = external_exports.object({
47044
+ resolver: external_exports.string().min(1).optional(),
47045
+ light: external_exports.union([tokenFiles, resolverInputs]),
47046
+ dark: external_exports.union([tokenFiles, resolverInputs]),
47047
+ /** The group whose tokens are the colour roles, and the one whose tokens are the radius steps. */
47048
+ colors: external_exports.string().min(1).default("color"),
47049
+ radii: external_exports.string().min(1).default("radius"),
47050
+ /** Foreground and background token pairs a text is read in, each needing 4.5:1. */
47051
+ contrast: external_exports.array(external_exports.tuple([external_exports.string().min(1), external_exports.string().min(1)])).default([])
47052
+ }).strict().superRefine((dtcg, ctx) => {
47053
+ for (const scheme of ["light", "dark"]) {
47054
+ const files2 = Array.isArray(dtcg[scheme]);
47055
+ if (dtcg.resolver !== void 0 && files2) {
47056
+ ctx.addIssue({
47057
+ code: "custom",
47058
+ path: [scheme],
47059
+ message: "with a resolver, name the modifier contexts, not files"
47060
+ });
47061
+ }
47062
+ if (dtcg.resolver === void 0 && !files2) {
47063
+ ctx.addIssue({
47064
+ code: "custom",
47065
+ path: [scheme],
47066
+ message: "without a resolver, list the token files"
47067
+ });
47068
+ }
47069
+ }
47070
+ });
47071
+ var designSystemSchema = external_exports.union([
47072
+ external_exports.object({ shadcn: shadcnSystem }).strict(),
47073
+ external_exports.object({ dtcg: dtcgSystem }).strict()
47074
+ ]);
47075
+ var recipeSchema = external_exports.object({
47076
+ url: external_exports.url().optional(),
47077
+ dark: external_exports.enum(["class", "media"]).default("class"),
47078
+ darkClass: external_exports.string().min(1).default("dark")
47079
+ }).strict();
47080
+ function writtenInAScript(tag) {
47081
+ try {
47082
+ return new Intl.Locale(tag).maximize().script !== void 0;
47083
+ } catch {
47084
+ return false;
47085
+ }
47086
+ }
47087
+ var copySchema = external_exports.object({
47088
+ locales: external_exports.array(external_exports.string().refine(writtenInAScript, "a BCP 47 language tag, such as en or vi")).min(1).default(["en"]),
47089
+ currencies: external_exports.array(external_exports.string().refine((code) => Intl.supportedValuesOf("currency").includes(code), "an ISO 4217 code, such as VND or USD")).default([])
47090
+ }).strict();
47091
+ var configShape = external_exports.object({
47092
+ product: external_exports.string().min(1),
47093
+ designSystem: designSystemSchema,
47094
+ figma: files.default({}),
47095
+ targets: external_exports.array(targetSchema).min(1),
47096
+ modes: external_exports.record(external_exports.string(), external_exports.string()).default({}),
47097
+ interactive: external_exports.array(external_exports.string().min(1)).default([...DEFAULT_INTERACTIVE]),
47098
+ /** The bars of the families whose kit names them its own way; every family left out keeps its default. */
47099
+ systemBars: external_exports.partialRecord(external_exports.enum(PLATFORM_FAMILIES), external_exports.array(external_exports.array(external_exports.string().min(1)).min(1))).optional(),
47100
+ budget: budgetSchema.default({ mcpPerDay: 200, mcpPerRun: 30, reserve: 0.2 }),
47101
+ recipe: recipeSchema.optional(),
47102
+ copy: copySchema.default(DEFAULT_COPY)
47103
+ }).strict();
47104
+ var zakuConfigSchema = configShape.superRefine((config2, ctx) => {
47105
+ for (const key of ["id", "name"]) {
47106
+ const seen = /* @__PURE__ */ new Set();
47107
+ config2.targets.forEach((target, index) => {
47108
+ if (seen.has(target[key])) {
47109
+ ctx.addIssue({
47110
+ code: "custom",
47111
+ path: ["targets", index, key],
47112
+ message: `a second target with ${key} ${target[key]}`
47113
+ });
47114
+ }
47115
+ seen.add(target[key]);
47116
+ });
47117
+ }
47118
+ if (byRole(config2.figma))
47119
+ refineFilesByRole(config2, ctx);
47120
+ });
47121
+ function refineFilesByRole(config2, ctx) {
47122
+ const { figma } = config2;
47123
+ if (figma.library !== void 0 || figma.product !== void 0) {
47124
+ ctx.addIssue({
47125
+ code: "custom",
47126
+ path: ["figma"],
47127
+ message: "figma.library and figma.product describe one library and one product; list files by role instead"
47128
+ });
47129
+ }
47130
+ const kits = figma.kits ?? [];
47131
+ const libraries = figma.libraries ?? [];
47132
+ const products = figma.products ?? [];
47133
+ const seen = /* @__PURE__ */ new Set();
47134
+ const lists = [
47135
+ ["kits", kits],
47136
+ ["libraries", libraries],
47137
+ ["products", products],
47138
+ ["prototypes", figma.prototypes ?? []]
47139
+ ];
47140
+ for (const [list, entries] of lists) {
47141
+ entries.forEach((entry, index) => {
47142
+ if (seen.has(entry.key))
47143
+ ctx.addIssue({
47144
+ code: "custom",
47145
+ path: ["figma", list, index, "key"],
47146
+ message: `a second file with key ${entry.key}`
47147
+ });
47148
+ seen.add(entry.key);
47149
+ });
47150
+ }
47151
+ const byKey = new Map(libraries.map((library) => [library.key, library]));
47152
+ const kitKeys = new Set(kits.map((kit) => kit.key));
47153
+ libraries.forEach((library, index) => {
47154
+ const path2 = ["figma", "libraries", index, "extends"];
47155
+ for (const key of library.extends) {
47156
+ const base = byKey.get(key);
47157
+ if (!base && !kitKeys.has(key)) {
47158
+ ctx.addIssue({
47159
+ code: "custom",
47160
+ path: path2,
47161
+ message: `${library.key} extends ${key}, which is no library or kit listed`
47162
+ });
47163
+ } else if (base?.layer === "components" && library.layer === "foundations") {
47164
+ ctx.addIssue({ code: "custom", path: path2, message: `foundations ${library.key} extends components ${key}` });
47165
+ } else if (base && !base.branches.some((branch) => library.branches.includes(branch))) {
47166
+ ctx.addIssue({
47167
+ code: "custom",
47168
+ path: path2,
47169
+ message: `${library.key} extends ${key}, which holds none of its branches`
47170
+ });
47171
+ }
47172
+ }
47173
+ });
47174
+ const cycle = findCycle(libraries);
47175
+ if (cycle)
47176
+ ctx.addIssue({ code: "custom", path: ["figma", "libraries"], message: `extends comes back: ${cycle}` });
47177
+ for (const [list, entries] of [
47178
+ ["products", products],
47179
+ ["prototypes", figma.prototypes ?? []]
47180
+ ]) {
47181
+ const families2 = /* @__PURE__ */ new Set();
47182
+ entries.forEach((entry, index) => {
47183
+ if (families2.has(entry.family))
47184
+ ctx.addIssue({
47185
+ code: "custom",
47186
+ path: ["figma", list, index, "family"],
47187
+ message: `a second ${list === "products" ? "product" : "prototype"} file for ${entry.family}`
47188
+ });
47189
+ families2.add(entry.family);
47190
+ });
47191
+ }
47192
+ (figma.prototypes ?? []).forEach((prototype2, index) => {
47193
+ if (!products.some((product) => product.family === prototype2.family))
47194
+ ctx.addIssue({
47195
+ code: "custom",
47196
+ path: ["figma", "prototypes", index, "family"],
47197
+ message: `no product file for ${prototype2.family} to copy its frames from`
47198
+ });
47199
+ });
47200
+ config2.targets.forEach((target, index) => {
47201
+ const branch = target.branch ?? defaultBranch(target.family);
47202
+ const path2 = ["targets", index, "branch"];
47203
+ if (branch === void 0) {
47204
+ ctx.addIssue({ code: "custom", path: path2, message: `a ${target.family} target names its branch, ui or native` });
47205
+ } else if (libraries.length > 0 && !libraries.some((library) => library.branches.includes(branch))) {
47206
+ ctx.addIssue({ code: "custom", path: path2, message: `no library holds the ${branch} branch` });
47207
+ }
47208
+ });
47209
+ }
47210
+ function findCycle(libraries) {
47211
+ const byKey = new Map(libraries.map((library) => [library.key, library]));
47212
+ const visit2 = (key, path2) => {
47213
+ if (path2.includes(key))
47214
+ return [...path2.slice(path2.indexOf(key)), key].join(" -> ");
47215
+ for (const next of byKey.get(key)?.extends ?? []) {
47216
+ const found = visit2(next, [...path2, key]);
47217
+ if (found)
47218
+ return found;
47219
+ }
47220
+ return void 0;
47221
+ };
47222
+ for (const library of libraries) {
47223
+ const found = visit2(library.key, []);
47224
+ if (found)
47225
+ return found;
47226
+ }
47227
+ return void 0;
47228
+ }
47229
+ var SHARED_KEYS = ["designSystem", "modes", "copy", "interactive", "systemBars", "budget"];
47230
+ var sharedShape = {
47231
+ designSystem: designSystemSchema.optional(),
47232
+ modes: configShape.shape.modes.unwrap().optional(),
47233
+ copy: copySchema.optional(),
47234
+ interactive: configShape.shape.interactive.unwrap().optional(),
47235
+ systemBars: configShape.shape.systemBars,
47236
+ budget: budgetSchema.optional()
47237
+ };
47238
+ var PRODUCT_NAME = /^[A-Z0-9][A-Za-z0-9]*( [A-Z0-9][A-Za-z0-9]*)*$/;
47239
+ var workspaceProduct = external_exports.object({
47240
+ /** Title-case ASCII words: what people call the product and what its Figma files are named for. */
47241
+ name: external_exports.string().regex(PRODUCT_NAME, "title-case words of ASCII letters and digits, such as Back Office"),
47242
+ /** The directory of the product's design, relative to the config and inside its directory. */
47243
+ root: external_exports.string().min(1)
47244
+ }).strict();
47245
+ function cleanRoot(root) {
47246
+ if (root.includes("\\"))
47247
+ return { problem: "use forward slashes" };
47248
+ if (root.startsWith("/"))
47249
+ return { problem: "a root is relative to the config, not absolute" };
47250
+ const path2 = posix.normalize(root).replace(/\/$/, "");
47251
+ if (path2 === ".." || path2.startsWith("../"))
47252
+ return { problem: "a root stays inside the config's directory" };
47253
+ return { path: path2 };
47254
+ }
47255
+ function overlaps(a, b) {
47256
+ return a === "." || b === "." || a === b || a.startsWith(`${b}/`) || b.startsWith(`${a}/`);
47257
+ }
47258
+ var workspaceConfigSchema = external_exports.object({
47259
+ ...sharedShape,
47260
+ products: external_exports.array(workspaceProduct).min(1).optional(),
47261
+ product: external_exports.string().min(1).optional(),
47262
+ figma: files.optional(),
47263
+ targets: external_exports.array(targetSchema).optional(),
47264
+ recipe: recipeSchema.optional()
47265
+ }).strict().superRefine((config2, ctx) => {
47266
+ const { products, ...single } = config2;
47267
+ if (products === void 0) {
47268
+ const result = zakuConfigSchema.safeParse(single);
47269
+ if (!result.success) {
47270
+ for (const issue2 of result.error.issues) {
47271
+ ctx.addIssue({ code: "custom", path: issue2.path, message: issue2.message });
47272
+ }
47273
+ }
47274
+ return;
47275
+ }
47276
+ for (const key of ["product", "figma", "targets", "recipe"]) {
47277
+ if (config2[key] !== void 0) {
47278
+ ctx.addIssue({
47279
+ code: "custom",
47280
+ path: [key],
47281
+ message: `a workspace that lists products keeps ${key} in each product`
47282
+ });
47283
+ }
47284
+ }
47285
+ const names = /* @__PURE__ */ new Set();
47286
+ const roots = [];
47287
+ products.forEach((product, index) => {
47288
+ if (names.has(product.name)) {
47289
+ ctx.addIssue({
47290
+ code: "custom",
47291
+ path: ["products", index, "name"],
47292
+ message: `a second product named ${product.name}`
47293
+ });
47294
+ }
47295
+ names.add(product.name);
47296
+ const root = cleanRoot(product.root);
47297
+ if ("problem" in root) {
47298
+ ctx.addIssue({ code: "custom", path: ["products", index, "root"], message: root.problem });
47299
+ return;
47300
+ }
47301
+ const clash = roots.find((other) => overlaps(other, root.path));
47302
+ if (clash !== void 0) {
47303
+ ctx.addIssue({
47304
+ code: "custom",
47305
+ path: ["products", index, "root"],
47306
+ message: `${product.root} overlaps ${clash}, which another product holds`
47307
+ });
47308
+ }
47309
+ roots.push(root.path);
47310
+ });
47311
+ });
47312
+ var productConfigSchema = external_exports.object({
47313
+ ...sharedShape,
47314
+ figma: files.default({}),
47315
+ targets: external_exports.array(targetSchema).min(1),
47316
+ recipe: recipeSchema.optional()
47317
+ }).strict();
47318
+ function mergeProductConfig(shared, name, product) {
47319
+ const own2 = productConfigSchema.safeParse(product);
47320
+ if (!own2.success)
47321
+ throw new DesignFileInvalid(`zaku.yaml of ${name}`, issueLines(own2.error));
47322
+ const merged = { ...own2.data, product: name };
47323
+ for (const key of SHARED_KEYS)
47324
+ merged[key] = own2.data[key] ?? shared[key];
47325
+ const result = zakuConfigSchema.safeParse(merged);
47326
+ if (!result.success)
47327
+ throw new DesignFileInvalid(`zaku.yaml of ${name}`, issueLines(result.error));
47328
+ return result.data;
47329
+ }
47330
+ function issueLines(error62) {
47331
+ return error62.issues.map((issue2) => `${issue2.path.map(String).join(".") || "(root)"}: ${issue2.message}`);
47332
+ }
47333
+
46947
47334
  // packages/zaku/dist/lib/schema/json-schemas.js
46948
47335
  function designJsonSchemas() {
46949
47336
  return {
46950
47337
  "zaku.schema.json": external_exports.toJSONSchema(zakuConfigSchema, { io: "input" }),
47338
+ "zaku-config.schema.json": external_exports.toJSONSchema(workspaceConfigSchema, { io: "input" }),
46951
47339
  "map.schema.json": external_exports.toJSONSchema(featureMapSchema, { io: "input" })
46952
47340
  };
46953
47341
  }
@@ -46991,22 +47379,8 @@ RecordBudgetCallsHandler = __decorate2([
46991
47379
  __param2(0, (0, import_tsyringe6.inject)(TOKENS.BUDGET_LEDGER))
46992
47380
  ], RecordBudgetCallsHandler);
46993
47381
 
46994
- // packages/zaku/dist/lib/repositories/design-config-repository.js
46995
- var import_tsyringe7 = __toESM(require_cjs(), 1);
46996
- var DesignConfigRepository = class DesignConfigRepository2 {
46997
- read(root) {
46998
- return readDesignFile(designPaths(root).config, zakuConfigSchema);
46999
- }
47000
- readOptional(root) {
47001
- return readOptionalDesignFile(designPaths(root).config, zakuConfigSchema);
47002
- }
47003
- };
47004
- DesignConfigRepository = __decorate2([
47005
- (0, import_tsyringe7.injectable)({ token: TOKENS.DESIGN_CONFIG_REPOSITORY })
47006
- ], DesignConfigRepository);
47007
-
47008
47382
  // packages/zaku/dist/lib/repositories/token-document-repository.js
47009
- var import_tsyringe8 = __toESM(require_cjs(), 1);
47383
+ var import_tsyringe7 = __toESM(require_cjs(), 1);
47010
47384
  var TokenDocumentRepository = class TokenDocumentRepository2 {
47011
47385
  async save(root, doc) {
47012
47386
  const path2 = designPaths(root).tokens;
@@ -47015,11 +47389,11 @@ var TokenDocumentRepository = class TokenDocumentRepository2 {
47015
47389
  }
47016
47390
  };
47017
47391
  TokenDocumentRepository = __decorate2([
47018
- (0, import_tsyringe8.injectable)({ token: TOKENS.TOKEN_DOCUMENT_REPOSITORY })
47392
+ (0, import_tsyringe7.injectable)({ token: TOKENS.TOKEN_DOCUMENT_REPOSITORY })
47019
47393
  ], TokenDocumentRepository);
47020
47394
 
47021
47395
  // packages/zaku/dist/lib/repositories/recipe-repository.js
47022
- var import_tsyringe9 = __toESM(require_cjs(), 1);
47396
+ var import_tsyringe8 = __toESM(require_cjs(), 1);
47023
47397
  var RecipeRepository = class RecipeRepository2 {
47024
47398
  async save(root, doc) {
47025
47399
  const path2 = designPaths(root).recipe;
@@ -47028,11 +47402,11 @@ var RecipeRepository = class RecipeRepository2 {
47028
47402
  }
47029
47403
  };
47030
47404
  RecipeRepository = __decorate2([
47031
- (0, import_tsyringe9.injectable)({ token: TOKENS.RECIPE_REPOSITORY })
47405
+ (0, import_tsyringe8.injectable)({ token: TOKENS.RECIPE_REPOSITORY })
47032
47406
  ], RecipeRepository);
47033
47407
 
47034
47408
  // packages/zaku/dist/lib/repositories/json-schema-files.js
47035
- var import_tsyringe10 = __toESM(require_cjs(), 1);
47409
+ var import_tsyringe9 = __toESM(require_cjs(), 1);
47036
47410
  import { mkdir as mkdir3 } from "node:fs/promises";
47037
47411
  import { join as join7 } from "node:path";
47038
47412
  var JsonSchemaFiles = class JsonSchemaFiles2 {
@@ -47048,11 +47422,11 @@ var JsonSchemaFiles = class JsonSchemaFiles2 {
47048
47422
  }
47049
47423
  };
47050
47424
  JsonSchemaFiles = __decorate2([
47051
- (0, import_tsyringe10.injectable)({ token: TOKENS.JSON_SCHEMA_FILES })
47425
+ (0, import_tsyringe9.injectable)({ token: TOKENS.JSON_SCHEMA_FILES })
47052
47426
  ], JsonSchemaFiles);
47053
47427
 
47054
47428
  // packages/zaku/dist/lib/repositories/source-files.js
47055
- var import_tsyringe11 = __toESM(require_cjs(), 1);
47429
+ var import_tsyringe10 = __toESM(require_cjs(), 1);
47056
47430
  import { readFile as readFile4 } from "node:fs/promises";
47057
47431
  var SourceFiles = class SourceFiles2 {
47058
47432
  readText(path2) {
@@ -47063,7 +47437,7 @@ var SourceFiles = class SourceFiles2 {
47063
47437
  }
47064
47438
  };
47065
47439
  SourceFiles = __decorate2([
47066
- (0, import_tsyringe11.injectable)({ token: TOKENS.SOURCE_FILES })
47440
+ (0, import_tsyringe10.injectable)({ token: TOKENS.SOURCE_FILES })
47067
47441
  ], SourceFiles);
47068
47442
 
47069
47443
  // packages/zaku/dist/lib/repositories/budget-ledger.js
@@ -47165,81 +47539,6 @@ function printGraph(config2, snapshots) {
47165
47539
  return lines;
47166
47540
  }
47167
47541
 
47168
- // packages/zaku/dist/lib/adapters/figma-rest.js
47169
- var FigmaRateLimited = class extends Error {
47170
- url;
47171
- constructor(url2) {
47172
- super(`Figma answered 429 twice for ${url2}; wait and run again`);
47173
- this.url = url2;
47174
- this.name = "FigmaRateLimited";
47175
- }
47176
- };
47177
- var FigmaRequestFailed = class extends Error {
47178
- url;
47179
- status;
47180
- constructor(url2, status, body) {
47181
- super(`Figma answered ${status} for ${url2}: ${body.slice(0, 200)}`);
47182
- this.url = url2;
47183
- this.status = status;
47184
- this.name = "FigmaRequestFailed";
47185
- }
47186
- };
47187
- var BASE = "https://api.figma.com/v1";
47188
- var BATCH = 50;
47189
- var MAX_WAIT_MS = 12e4;
47190
- function createFigmaRest(options) {
47191
- const send = options.fetch ?? globalThis.fetch;
47192
- const sleep = options.sleep ?? ((ms) => new Promise((done) => setTimeout(done, ms)));
47193
- const onCall = options.onCall ?? (() => void 0);
47194
- async function call(url2) {
47195
- for (let attempt = 0; attempt < 2; attempt += 1) {
47196
- const res = await send(url2, { headers: { "X-Figma-Token": options.token } });
47197
- onCall();
47198
- if (res.status === 429) {
47199
- if (attempt === 1)
47200
- break;
47201
- const seconds = Number(res.headers.get("Retry-After") ?? "60");
47202
- await sleep(Math.min(Number.isFinite(seconds) ? seconds * 1e3 : 6e4, MAX_WAIT_MS));
47203
- continue;
47204
- }
47205
- if (!res.ok)
47206
- throw new FigmaRequestFailed(url2, res.status, await res.text());
47207
- return await res.json();
47208
- }
47209
- throw new FigmaRateLimited(url2);
47210
- }
47211
- const chunks = (ids) => Array.from({ length: Math.ceil(ids.length / BATCH) }, (_, index) => ids.slice(index * BATCH, (index + 1) * BATCH));
47212
- async function components(fileKey3) {
47213
- const listed = await call(`${BASE}/files/${fileKey3}/components`);
47214
- return listed.meta.components;
47215
- }
47216
- return {
47217
- file: (fileKey3, depth) => call(`${BASE}/files/${fileKey3}?depth=${depth}`),
47218
- async nodes(fileKey3, ids) {
47219
- const merged = { version: "", nodes: {} };
47220
- for (const chunk of chunks(ids)) {
47221
- const part = await call(`${BASE}/files/${fileKey3}/nodes?ids=${encodeURIComponent(chunk.join(","))}`);
47222
- merged.version = part.version;
47223
- Object.assign(merged.nodes, part.nodes);
47224
- }
47225
- return merged;
47226
- },
47227
- async published(fileKey3) {
47228
- const sets = await call(`${BASE}/files/${fileKey3}/component_sets`);
47229
- return { sets: sets.meta.component_sets, components: await components(fileKey3) };
47230
- },
47231
- components,
47232
- async images(fileKey3, ids) {
47233
- const merged = {};
47234
- for (const chunk of chunks(ids)) {
47235
- const part = await call(`${BASE}/images/${fileKey3}?ids=${encodeURIComponent(chunk.join(","))}&format=png&scale=1`);
47236
- Object.assign(merged, part.images);
47237
- }
47238
- return merged;
47239
- }
47240
- };
47241
- }
47242
-
47243
47542
  // packages/zaku/dist/lib/adapters/figma-variables-script.js
47244
47543
  async function exportVariables(figma, options) {
47245
47544
  const collections = [...await figma.variables.getLocalVariableCollectionsAsync()];
@@ -47751,7 +48050,7 @@ async function readRecipePage(playwright, options) {
47751
48050
  // packages/zaku/dist/lib/adapters/plugin-bridge.js
47752
48051
  import { createServer } from "node:http";
47753
48052
 
47754
- // node_modules/.pnpm/ws@8.22.0/node_modules/ws/wrapper.mjs
48053
+ // node_modules/.pnpm/ws@8.22.1/node_modules/ws/wrapper.mjs
47755
48054
  var import_stream = __toESM(require_stream(), 1);
47756
48055
  var import_extension = __toESM(require_extension(), 1);
47757
48056
  var import_permessage_deflate = __toESM(require_permessage_deflate(), 1);
@@ -47944,9 +48243,9 @@ async function startPluginBridge(options = {}) {
47944
48243
  if (!socket)
47945
48244
  return Promise.resolve({ ok: false, error: `file ${fileKey3} is not open in Figma with the zaku plugin` });
47946
48245
  const id2 = `c${++next}`;
47947
- return new Promise((resolve3) => {
48246
+ return new Promise((resolve4) => {
47948
48247
  const timer = setTimeout(() => settle2(id2, { ok: false, error: `no answer from the zaku panel in ${timeoutMs / 1e3} s; ${PARTIAL}` }), timeoutMs);
47949
- pending.set(id2, { socket, resolve: resolve3, timer });
48248
+ pending.set(id2, { socket, resolve: resolve4, timer });
47950
48249
  send(socket, { ...message, id: id2 });
47951
48250
  });
47952
48251
  }
@@ -48265,8 +48564,73 @@ var copy = ({ config: config2, maps, outlines }) => {
48265
48564
  return { findings };
48266
48565
  };
48267
48566
 
48567
+ // packages/zaku/dist/lib/domain/file-labels.js
48568
+ var FAMILY_LABELS = {
48569
+ web: "Web",
48570
+ ios: "iOS",
48571
+ android: "Android",
48572
+ macos: "macOS",
48573
+ windows: "Windows",
48574
+ gnome: "Linux",
48575
+ kde: "Linux KDE"
48576
+ };
48577
+ var BRANCH_LABELS = { ui: "UI", native: "Native" };
48578
+ function branchLabel(branches) {
48579
+ const [only2] = branches;
48580
+ return branches.length === 1 && only2 ? BRANCH_LABELS[only2] : null;
48581
+ }
48582
+ function expectedFileName(product, role) {
48583
+ if (role.kind !== "library") {
48584
+ const family = `${product} - ${FAMILY_LABELS[role.family]}`;
48585
+ return role.kind === "prototype" ? `${family} Prototype` : family;
48586
+ }
48587
+ if (role.layer === "foundations")
48588
+ return null;
48589
+ const branch = branchLabel(role.branches);
48590
+ return branch ? `${product} - ${branch} Components` : `${product} - Components`;
48591
+ }
48592
+ function fileRoleLabel(role) {
48593
+ if (role.kind !== "library")
48594
+ return `${FAMILY_LABELS[role.family]} ${role.kind} file`;
48595
+ const branch = branchLabel(role.branches);
48596
+ return branch ? `${branch} ${role.layer} library` : `${role.layer} library`;
48597
+ }
48598
+
48599
+ // packages/zaku/dist/lib/domain/checks/file-names.js
48600
+ var fileNames = (input2) => {
48601
+ if (input2.fileNames === null)
48602
+ return { findings: [] };
48603
+ const graph = designGraph(input2.config);
48604
+ if (graph.legacy)
48605
+ return { findings: [] };
48606
+ const roles = [
48607
+ ...graph.products.map((file2) => [file2.key, { kind: "product", family: file2.family }]),
48608
+ ...graph.prototypes.map((file2) => [file2.key, { kind: "prototype", family: file2.family }]),
48609
+ ...graph.libraries.map((file2) => [
48610
+ file2.key,
48611
+ { kind: "library", layer: file2.layer, branches: file2.branches }
48612
+ ])
48613
+ ];
48614
+ const names = new Map(input2.fileNames.map((file2) => [file2.key, file2.name]));
48615
+ const { product } = input2.config;
48616
+ const findings = [];
48617
+ for (const [key, role] of roles) {
48618
+ const actual = names.get(key);
48619
+ const expected = expectedFileName(product, role);
48620
+ if (actual === void 0 || expected === null || actual === expected)
48621
+ continue;
48622
+ const label2 = fileRoleLabel(role);
48623
+ const article = /^(iOS|Android) /.test(label2) ? "an" : "a";
48624
+ findings.push({
48625
+ check: "file-names",
48626
+ message: `${key} is named ${actual}; ${article} ${label2} of ${product} is named ${expected}; rename it in Figma, then run zaku outline`
48627
+ });
48628
+ }
48629
+ return { findings };
48630
+ };
48631
+
48268
48632
  // packages/zaku/dist/lib/domain/checks/coverage.js
48269
- function frameKey(feature, name) {
48633
+ function frameKey2(feature, name) {
48270
48634
  return `${feature}
48271
48635
  ${name}`;
48272
48636
  }
@@ -48285,10 +48649,23 @@ var coverage = ({ config: config2, maps, outlines, unmapped }) => {
48285
48649
  message: `unknown target ${target}`
48286
48650
  });
48287
48651
  }
48652
+ const targetIds = new Set(targets.map((target) => target.id));
48653
+ for (const [state2, omitted] of Object.entries(screen["state-omits"])) {
48654
+ for (const target of Object.keys(omitted).filter((id3) => !targetIds.has(id3))) {
48655
+ findings.push({
48656
+ check: "schema",
48657
+ feature: map2.feature,
48658
+ screen: id2,
48659
+ field: "state-omits",
48660
+ message: `state ${state2} omits ${target}, a target the screen does not have`
48661
+ });
48662
+ }
48663
+ }
48288
48664
  for (const state2 of screen.states) {
48289
- for (const target of targets) {
48665
+ const omitted = screen["state-omits"][state2] ?? {};
48666
+ for (const target of targets.filter((candidate) => !(candidate.id in omitted))) {
48290
48667
  const name = frameName(target, screen, state2);
48291
- expected.set(frameKey(map2.feature, name), {
48668
+ expected.set(frameKey2(map2.feature, name), {
48292
48669
  feature: map2.feature,
48293
48670
  screen: id2,
48294
48671
  frame: name
@@ -48300,7 +48677,7 @@ var coverage = ({ config: config2, maps, outlines, unmapped }) => {
48300
48677
  const drawn = /* @__PURE__ */ new Map();
48301
48678
  for (const outline of outlines) {
48302
48679
  for (const frame of outline.frames) {
48303
- const key = frameKey(outline.feature, frame.name);
48680
+ const key = frameKey2(outline.feature, frame.name);
48304
48681
  const first = drawn.get(key);
48305
48682
  if (first !== void 0) {
48306
48683
  findings.push({
@@ -48611,9 +48988,9 @@ function frameFindings(input2) {
48611
48988
  const graph = designGraph(config2);
48612
48989
  const owners = /* @__PURE__ */ new Map();
48613
48990
  for (const [key, snapshot] of Object.entries(input2.libraries)) {
48614
- const holds = graph.libraries.find((candidate) => candidate.key === key)?.branches ?? [];
48991
+ const holds2 = graph.libraries.find((candidate) => candidate.key === key)?.branches ?? [];
48615
48992
  for (const component2 of snapshot.components) {
48616
- const branches = component2.branch ? [component2.branch] : holds;
48993
+ const branches = component2.branch ? [component2.branch] : holds2;
48617
48994
  for (const variant of component2.variants)
48618
48995
  owners.set(variant.key, `${key}, a ${branches.join(" and ")} library`);
48619
48996
  }
@@ -49240,7 +49617,18 @@ var MIN_TARGET = {
49240
49617
  kde: 24
49241
49618
  };
49242
49619
  function controlsOf(frame) {
49243
- return frame.instances.flatMap((instance) => [instance, ...instance.nested].flatMap((control) => control.interactive && control.bounds ? [{ nodeId: control.nodeId, componentKey: control.componentKey, bounds: control.bounds }] : []));
49620
+ return frame.instances.flatMap((instance) => [{ ...instance, path: "" }, ...instance.nested].flatMap((control) => control.interactive && control.bounds ? [
49621
+ {
49622
+ nodeId: control.nodeId,
49623
+ componentKey: control.componentKey,
49624
+ bounds: control.bounds,
49625
+ instance: instance.nodeId,
49626
+ path: control.path
49627
+ }
49628
+ ] : []));
49629
+ }
49630
+ function holds(outer, inner) {
49631
+ return outer.instance === inner.instance && (outer.path === "" || inner.path.startsWith(`${outer.path}/`));
49244
49632
  }
49245
49633
  var targetSize = (input2) => {
49246
49634
  const libraries = checkLibraries(input2);
@@ -49284,13 +49672,29 @@ var targetSize = (input2) => {
49284
49672
  }
49285
49673
  return { findings };
49286
49674
  };
49675
+ function layersOf(frame) {
49676
+ let layer = 0;
49677
+ const out = [];
49678
+ for (const instance of frame.instances) {
49679
+ const controls = [instance, ...instance.nested].filter((control) => control.interactive && control.bounds);
49680
+ const { bounds } = instance;
49681
+ if (controls.length === 0 && bounds && bounds.x <= 0 && bounds.y <= 0 && bounds.x + bounds.width >= frame.size.width && bounds.y + bounds.height >= frame.size.height)
49682
+ layer += 1;
49683
+ for (const control of controls)
49684
+ out.push({ nodeId: control.nodeId, layer });
49685
+ }
49686
+ return out;
49687
+ }
49287
49688
  var overlap = ({ outlines }) => {
49288
49689
  const findings = [];
49289
49690
  for (const outline of outlines) {
49290
49691
  for (const frame of outline.frames) {
49291
49692
  const boxes = controlsOf(frame);
49693
+ const layer = new Map(layersOf(frame).map((entry) => [entry.nodeId, entry.layer]));
49292
49694
  boxes.forEach((a, i) => {
49293
49695
  for (const b of boxes.slice(i + 1)) {
49696
+ if (layer.get(a.nodeId) !== layer.get(b.nodeId) || holds(a, b) || holds(b, a))
49697
+ continue;
49294
49698
  const width = Math.min(a.bounds.x + a.bounds.width, b.bounds.x + b.bounds.width) - Math.max(a.bounds.x, b.bounds.x);
49295
49699
  const height = Math.min(a.bounds.y + a.bounds.height, b.bounds.y + b.bounds.height) - Math.max(a.bounds.y, b.bounds.y);
49296
49700
  if (width > 0 && height > 0) {
@@ -49462,6 +49866,7 @@ var ALL_CHECKS = {
49462
49866
  "system-bars": systemBars,
49463
49867
  placement,
49464
49868
  naming,
49869
+ "file-names": fileNames,
49465
49870
  component,
49466
49871
  prototype
49467
49872
  };
@@ -49502,6 +49907,7 @@ var CHECK_IDS = [
49502
49907
  "empty",
49503
49908
  "documentation",
49504
49909
  "naming",
49910
+ "file-names",
49505
49911
  "component",
49506
49912
  "prototype"
49507
49913
  ];
@@ -49619,17 +50025,10 @@ async function optional3(read, findings) {
49619
50025
  throw error62;
49620
50026
  }
49621
50027
  }
49622
- async function loadDesign(root) {
49623
- const paths = designPaths(root);
50028
+ async function loadDesign(product) {
50029
+ const paths = designPaths(product.root);
49624
50030
  const findings = [];
49625
- let config2;
49626
- try {
49627
- config2 = await readDesignFile(paths.config, zakuConfigSchema);
49628
- } catch (error62) {
49629
- if (error62 instanceof DesignFileInvalid)
49630
- return { input: null, findings: [schemaFinding(error62)] };
49631
- throw error62;
49632
- }
50031
+ const { config: config2 } = product;
49633
50032
  const { maps, errors: mapErrors } = await loadMaps(paths.maps);
49634
50033
  findings.push(...mapErrors.map(schemaFinding));
49635
50034
  for (const key of indexTitles(maps).duplicates) {
@@ -49640,7 +50039,7 @@ async function loadDesign(root) {
49640
50039
  message: `two screens share the title ${title}; a frame name could not tell them apart`
49641
50040
  });
49642
50041
  }
49643
- const { outlines, flows, unmapped, errors: outlineErrors } = await loadOutlines(paths.outline);
50042
+ const { outlines, flows, unmapped, files: files2, errors: outlineErrors } = await loadOutlines(paths.outline);
49644
50043
  findings.push(...outlineErrors.map(schemaFinding));
49645
50044
  const { libraries, kits, errors: snapshotErrors } = await readDesignSnapshots(paths, config2);
49646
50045
  findings.push(...snapshotErrors.map(schemaFinding));
@@ -49657,15 +50056,80 @@ async function loadDesign(root) {
49657
50056
  libraries,
49658
50057
  kits,
49659
50058
  tokens,
49660
- recipe: recipe2
50059
+ recipe: recipe2,
50060
+ fileNames: files2?.files ?? null
49661
50061
  },
49662
50062
  findings
49663
50063
  };
49664
50064
  }
49665
50065
 
50066
+ // packages/zaku/dist/lib/repositories/workspace.js
50067
+ import { readFile as readFile6 } from "node:fs/promises";
50068
+ import { dirname as dirname4, join as join9, resolve as resolve2 } from "node:path";
50069
+ var WORKSPACE_CONFIG = "zaku.config.yaml";
50070
+ async function readOptionalText(path2) {
50071
+ try {
50072
+ return await readFile6(path2, "utf8");
50073
+ } catch (error62) {
50074
+ if (error62.code === "ENOENT")
50075
+ return null;
50076
+ throw error62;
50077
+ }
50078
+ }
50079
+ function only(products, name) {
50080
+ if (name === void 0)
50081
+ return products;
50082
+ const named = products.filter((product) => product.name === name);
50083
+ if (named.length === 0)
50084
+ throw new ProductUnknown(name, products.map((product) => product.name));
50085
+ return named;
50086
+ }
50087
+ async function readWorkspace(cwd, options) {
50088
+ const configPath = resolve2(cwd, options.config ?? WORKSPACE_CONFIG);
50089
+ const text = await readOptionalText(configPath);
50090
+ if (text === null) {
50091
+ if (options.config !== void 0)
50092
+ throw new WorkspaceConfigMissing(configPath, null);
50093
+ const root = resolve2(cwd, "docs", "design");
50094
+ const legacyPath = designPaths(root).config;
50095
+ const config2 = await readOptionalDesignFile(legacyPath, zakuConfigSchema);
50096
+ if (config2 === null)
50097
+ throw new WorkspaceConfigMissing(configPath, legacyPath);
50098
+ const products2 = only([{ name: config2.product, root, config: config2 }], options.product);
50099
+ return { configPath: null, dir: resolve2(cwd), products: products2, legacy: true, budget: config2.budget };
50100
+ }
50101
+ const dir = dirname4(configPath);
50102
+ const workspace = parseDesignFile(configPath, text, workspaceConfigSchema);
50103
+ if (workspace.products === void 0) {
50104
+ const config2 = parseDesignFile(configPath, text, zakuConfigSchema);
50105
+ const products2 = only([{ name: config2.product, root: join9(dir, "design"), config: config2 }], options.product);
50106
+ return { configPath, dir, products: products2, legacy: false, budget: config2.budget };
50107
+ }
50108
+ const listed = workspace.products.map((product) => ({ name: product.name, root: resolve2(dir, product.root) }));
50109
+ const products = [];
50110
+ for (const { name, root } of only(listed, options.product)) {
50111
+ const path2 = designPaths(root).config;
50112
+ try {
50113
+ const own2 = await readOptionalDesignFile(path2, external_exports.unknown());
50114
+ if (own2 === null)
50115
+ throw new ProductConfigMissing(path2, name);
50116
+ products.push({ name, root, config: mergeProductConfig(workspace, name, own2) });
50117
+ } catch (error62) {
50118
+ if (error62 instanceof ProductConfigMissing)
50119
+ products.push({ name, root, refusal: error62 });
50120
+ else if (error62 instanceof DesignFileInvalid) {
50121
+ const refusal = error62.path === path2 ? error62 : new DesignFileInvalid(path2, error62.issues);
50122
+ products.push({ name, root, refusal });
50123
+ } else
50124
+ throw error62;
50125
+ }
50126
+ }
50127
+ return { configPath, dir, products, legacy: false, budget: workspace.budget ?? budgetSchema.parse({}) };
50128
+ }
50129
+
49666
50130
  // apps/zaku-cli/src/dependencies.ts
49667
50131
  function compose(seams) {
49668
- const scope = import_tsyringe12.container.createChildContainer();
50132
+ const scope = import_tsyringe11.container.createChildContainer();
49669
50133
  scope.register(TOKENS.CLOCK, { useValue: { now: seams.now } });
49670
50134
  scope.register(TOKENS.RUN_COMMAND, { useValue: seams.run });
49671
50135
  scope.register(TOKENS.BUDGET_LEDGER, {
@@ -49694,11 +50158,14 @@ function refusalOf(error62) {
49694
50158
  if (error62 instanceof FigmaFileKeyMissing) return { code: 3, line: error62.message };
49695
50159
  if (error62 instanceof FigmaTokenMissing) return { code: 3, line: error62.message };
49696
50160
  if (error62 instanceof LibraryKeyMissing) return { code: 3, line: error62.message };
50161
+ if (error62 instanceof WorkspaceConfigMissing) return { code: 3, line: error62.message };
50162
+ if (error62 instanceof ProductConfigMissing) return { code: 3, line: error62.message };
50163
+ if (error62 instanceof ProductUnknown || error62 instanceof ProductRequired) return { code: 3, line: error62.message };
49697
50164
  if (error62 instanceof RecipePageFailed) return { code: 2, line: `zaku recipe: ${error62.message}` };
49698
50165
  return null;
49699
50166
  }
49700
50167
 
49701
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/helpers/util.js
50168
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v3/helpers/util.js
49702
50169
  var util;
49703
50170
  (function(util2) {
49704
50171
  util2.assertEqual = (_) => {
@@ -49832,7 +50299,7 @@ var getParsedType2 = (data) => {
49832
50299
  }
49833
50300
  };
49834
50301
 
49835
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/ZodError.js
50302
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v3/ZodError.js
49836
50303
  var ZodIssueCode2 = util.arrayToEnum([
49837
50304
  "invalid_type",
49838
50305
  "invalid_literal",
@@ -49961,7 +50428,7 @@ ZodError2.create = (issues) => {
49961
50428
  return error62;
49962
50429
  };
49963
50430
 
49964
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/locales/en.js
50431
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v3/locales/en.js
49965
50432
  var errorMap = (issue2, _ctx) => {
49966
50433
  let message;
49967
50434
  switch (issue2.code) {
@@ -50064,13 +50531,13 @@ var errorMap = (issue2, _ctx) => {
50064
50531
  };
50065
50532
  var en_default2 = errorMap;
50066
50533
 
50067
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/errors.js
50534
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v3/errors.js
50068
50535
  var overrideErrorMap = en_default2;
50069
50536
  function getErrorMap2() {
50070
50537
  return overrideErrorMap;
50071
50538
  }
50072
50539
 
50073
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/helpers/parseUtil.js
50540
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v3/helpers/parseUtil.js
50074
50541
  var makeIssue = (params) => {
50075
50542
  const { data, path: path2, errorMaps, issueData } = params;
50076
50543
  const fullPath = [...path2, ...issueData.path || []];
@@ -50179,14 +50646,14 @@ var isDirty = (x) => x.status === "dirty";
50179
50646
  var isValid = (x) => x.status === "valid";
50180
50647
  var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
50181
50648
 
50182
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/helpers/errorUtil.js
50649
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v3/helpers/errorUtil.js
50183
50650
  var errorUtil;
50184
50651
  (function(errorUtil2) {
50185
50652
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
50186
50653
  errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
50187
50654
  })(errorUtil || (errorUtil = {}));
50188
50655
 
50189
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/types.js
50656
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v3/types.js
50190
50657
  var ParseInputLazyPath = class {
50191
50658
  constructor(parent, value, path2, key) {
50192
50659
  this._cachedPath = [];
@@ -53593,7 +54060,7 @@ var nullableType = ZodNullable2.create;
53593
54060
  var preprocessType = ZodEffects.createWithPreprocess;
53594
54061
  var pipelineType = ZodPipeline.create;
53595
54062
 
53596
- // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/mini/schemas.js
54063
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/mini/schemas.js
53597
54064
  var ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
53598
54065
  if (!inst._zod)
53599
54066
  throw new Error("Uninitialized schema in ZodMiniType.");
@@ -53659,7 +54126,7 @@ function object2(shape, params) {
53659
54126
  return new ZodMiniObject(def);
53660
54127
  }
53661
54128
 
53662
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
54129
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_supports-color@8.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
53663
54130
  function isZ4Schema(s) {
53664
54131
  const schema = s;
53665
54132
  return !!schema._zod;
@@ -53819,7 +54286,7 @@ function getLiteralValue(schema) {
53819
54286
  return void 0;
53820
54287
  }
53821
54288
 
53822
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
54289
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_supports-color@8.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
53823
54290
  var LATEST_PROTOCOL_VERSION = "2025-11-25";
53824
54291
  var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
53825
54292
  var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
@@ -55350,12 +55817,12 @@ var UrlElicitationRequiredError = class extends McpError {
55350
55817
  }
55351
55818
  };
55352
55819
 
55353
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
55820
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_supports-color@8.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
55354
55821
  function isTerminal(status) {
55355
55822
  return status === "completed" || status === "failed" || status === "cancelled";
55356
55823
  }
55357
55824
 
55358
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/Options.js
55825
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/Options.js
55359
55826
  var ignoreOverride = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to use");
55360
55827
  var defaultOptions = {
55361
55828
  name: void 0,
@@ -55389,7 +55856,7 @@ var getDefaultOptions = (options) => typeof options === "string" ? {
55389
55856
  ...options
55390
55857
  };
55391
55858
 
55392
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/Refs.js
55859
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/Refs.js
55393
55860
  var getRefs = (options) => {
55394
55861
  const _options = getDefaultOptions(options);
55395
55862
  const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
@@ -55410,7 +55877,7 @@ var getRefs = (options) => {
55410
55877
  };
55411
55878
  };
55412
55879
 
55413
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
55880
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
55414
55881
  function addErrorMessage(res, key, errorMessage, refs) {
55415
55882
  if (!refs?.errorMessages)
55416
55883
  return;
@@ -55426,7 +55893,7 @@ function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
55426
55893
  addErrorMessage(res, key, errorMessage, refs);
55427
55894
  }
55428
55895
 
55429
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
55896
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
55430
55897
  var getRelativePath = (pathA, pathB) => {
55431
55898
  let i = 0;
55432
55899
  for (; i < pathA.length && i < pathB.length; i++) {
@@ -55436,7 +55903,7 @@ var getRelativePath = (pathA, pathB) => {
55436
55903
  return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
55437
55904
  };
55438
55905
 
55439
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
55906
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
55440
55907
  function parseAnyDef(refs) {
55441
55908
  if (refs.target !== "openAi") {
55442
55909
  return {};
@@ -55452,7 +55919,7 @@ function parseAnyDef(refs) {
55452
55919
  };
55453
55920
  }
55454
55921
 
55455
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/array.js
55922
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/array.js
55456
55923
  function parseArrayDef(def, refs) {
55457
55924
  const res = {
55458
55925
  type: "array"
@@ -55476,7 +55943,7 @@ function parseArrayDef(def, refs) {
55476
55943
  return res;
55477
55944
  }
55478
55945
 
55479
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
55946
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
55480
55947
  function parseBigintDef(def, refs) {
55481
55948
  const res = {
55482
55949
  type: "integer",
@@ -55522,24 +55989,24 @@ function parseBigintDef(def, refs) {
55522
55989
  return res;
55523
55990
  }
55524
55991
 
55525
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
55992
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
55526
55993
  function parseBooleanDef() {
55527
55994
  return {
55528
55995
  type: "boolean"
55529
55996
  };
55530
55997
  }
55531
55998
 
55532
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
55999
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
55533
56000
  function parseBrandedDef(_def, refs) {
55534
56001
  return parseDef(_def.type._def, refs);
55535
56002
  }
55536
56003
 
55537
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
56004
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
55538
56005
  var parseCatchDef = (def, refs) => {
55539
56006
  return parseDef(def.innerType._def, refs);
55540
56007
  };
55541
56008
 
55542
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
56009
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
55543
56010
  function parseDateDef(def, refs, overrideDateStrategy) {
55544
56011
  const strategy = overrideDateStrategy ?? refs.dateStrategy;
55545
56012
  if (Array.isArray(strategy)) {
@@ -55598,7 +56065,7 @@ var integerDateParser = (def, refs) => {
55598
56065
  return res;
55599
56066
  };
55600
56067
 
55601
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
56068
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
55602
56069
  function parseDefaultDef(_def, refs) {
55603
56070
  return {
55604
56071
  ...parseDef(_def.innerType._def, refs),
@@ -55606,12 +56073,12 @@ function parseDefaultDef(_def, refs) {
55606
56073
  };
55607
56074
  }
55608
56075
 
55609
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
56076
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
55610
56077
  function parseEffectsDef(_def, refs) {
55611
56078
  return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);
55612
56079
  }
55613
56080
 
55614
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
56081
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
55615
56082
  function parseEnumDef(def) {
55616
56083
  return {
55617
56084
  type: "string",
@@ -55619,7 +56086,7 @@ function parseEnumDef(def) {
55619
56086
  };
55620
56087
  }
55621
56088
 
55622
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
56089
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
55623
56090
  var isJsonSchema7AllOfType = (type) => {
55624
56091
  if ("type" in type && type.type === "string")
55625
56092
  return false;
@@ -55661,7 +56128,7 @@ function parseIntersectionDef(def, refs) {
55661
56128
  } : void 0;
55662
56129
  }
55663
56130
 
55664
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
56131
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
55665
56132
  function parseLiteralDef(def, refs) {
55666
56133
  const parsedType2 = typeof def.value;
55667
56134
  if (parsedType2 !== "bigint" && parsedType2 !== "number" && parsedType2 !== "boolean" && parsedType2 !== "string") {
@@ -55681,7 +56148,7 @@ function parseLiteralDef(def, refs) {
55681
56148
  };
55682
56149
  }
55683
56150
 
55684
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
56151
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
55685
56152
  var emojiRegex2 = void 0;
55686
56153
  var zodPatterns = {
55687
56154
  /**
@@ -56006,7 +56473,7 @@ function stringifyRegExpWithFlags(regex, refs) {
56006
56473
  return pattern;
56007
56474
  }
56008
56475
 
56009
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
56476
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
56010
56477
  function parseRecordDef(def, refs) {
56011
56478
  if (refs.target === "openAi") {
56012
56479
  console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
@@ -56058,7 +56525,7 @@ function parseRecordDef(def, refs) {
56058
56525
  return schema;
56059
56526
  }
56060
56527
 
56061
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
56528
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
56062
56529
  function parseMapDef(def, refs) {
56063
56530
  if (refs.mapStrategy === "record") {
56064
56531
  return parseRecordDef(def, refs);
@@ -56083,7 +56550,7 @@ function parseMapDef(def, refs) {
56083
56550
  };
56084
56551
  }
56085
56552
 
56086
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
56553
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
56087
56554
  function parseNativeEnumDef(def) {
56088
56555
  const object3 = def.values;
56089
56556
  const actualKeys = Object.keys(def.values).filter((key) => {
@@ -56097,7 +56564,7 @@ function parseNativeEnumDef(def) {
56097
56564
  };
56098
56565
  }
56099
56566
 
56100
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
56567
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
56101
56568
  function parseNeverDef(refs) {
56102
56569
  return refs.target === "openAi" ? void 0 : {
56103
56570
  not: parseAnyDef({
@@ -56107,7 +56574,7 @@ function parseNeverDef(refs) {
56107
56574
  };
56108
56575
  }
56109
56576
 
56110
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
56577
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
56111
56578
  function parseNullDef(refs) {
56112
56579
  return refs.target === "openApi3" ? {
56113
56580
  enum: ["null"],
@@ -56117,7 +56584,7 @@ function parseNullDef(refs) {
56117
56584
  };
56118
56585
  }
56119
56586
 
56120
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
56587
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
56121
56588
  var primitiveMappings = {
56122
56589
  ZodString: "string",
56123
56590
  ZodNumber: "number",
@@ -56185,7 +56652,7 @@ var asAnyOf = (def, refs) => {
56185
56652
  return anyOf.length ? { anyOf } : void 0;
56186
56653
  };
56187
56654
 
56188
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
56655
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
56189
56656
  function parseNullableDef(def, refs) {
56190
56657
  if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
56191
56658
  if (refs.target === "openApi3") {
@@ -56217,7 +56684,7 @@ function parseNullableDef(def, refs) {
56217
56684
  return base && { anyOf: [base, { type: "null" }] };
56218
56685
  }
56219
56686
 
56220
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
56687
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
56221
56688
  function parseNumberDef(def, refs) {
56222
56689
  const res = {
56223
56690
  type: "number"
@@ -56266,7 +56733,7 @@ function parseNumberDef(def, refs) {
56266
56733
  return res;
56267
56734
  }
56268
56735
 
56269
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
56736
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
56270
56737
  function parseObjectDef(def, refs) {
56271
56738
  const forceOptionalIntoNullable = refs.target === "openAi";
56272
56739
  const result = {
@@ -56336,7 +56803,7 @@ function safeIsOptional(schema) {
56336
56803
  }
56337
56804
  }
56338
56805
 
56339
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
56806
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
56340
56807
  var parseOptionalDef = (def, refs) => {
56341
56808
  if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
56342
56809
  return parseDef(def.innerType._def, refs);
@@ -56355,7 +56822,7 @@ var parseOptionalDef = (def, refs) => {
56355
56822
  } : parseAnyDef(refs);
56356
56823
  };
56357
56824
 
56358
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
56825
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
56359
56826
  var parsePipelineDef = (def, refs) => {
56360
56827
  if (refs.pipeStrategy === "input") {
56361
56828
  return parseDef(def.in._def, refs);
@@ -56375,12 +56842,12 @@ var parsePipelineDef = (def, refs) => {
56375
56842
  };
56376
56843
  };
56377
56844
 
56378
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
56845
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
56379
56846
  function parsePromiseDef(def, refs) {
56380
56847
  return parseDef(def.type._def, refs);
56381
56848
  }
56382
56849
 
56383
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
56850
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
56384
56851
  function parseSetDef(def, refs) {
56385
56852
  const items = parseDef(def.valueType._def, {
56386
56853
  ...refs,
@@ -56400,7 +56867,7 @@ function parseSetDef(def, refs) {
56400
56867
  return schema;
56401
56868
  }
56402
56869
 
56403
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
56870
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
56404
56871
  function parseTupleDef(def, refs) {
56405
56872
  if (def.rest) {
56406
56873
  return {
@@ -56428,24 +56895,24 @@ function parseTupleDef(def, refs) {
56428
56895
  }
56429
56896
  }
56430
56897
 
56431
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
56898
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
56432
56899
  function parseUndefinedDef(refs) {
56433
56900
  return {
56434
56901
  not: parseAnyDef(refs)
56435
56902
  };
56436
56903
  }
56437
56904
 
56438
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
56905
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
56439
56906
  function parseUnknownDef(refs) {
56440
56907
  return parseAnyDef(refs);
56441
56908
  }
56442
56909
 
56443
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
56910
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
56444
56911
  var parseReadonlyDef = (def, refs) => {
56445
56912
  return parseDef(def.innerType._def, refs);
56446
56913
  };
56447
56914
 
56448
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/selectParser.js
56915
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/selectParser.js
56449
56916
  var selectParser = (def, typeName, refs) => {
56450
56917
  switch (typeName) {
56451
56918
  case ZodFirstPartyTypeKind2.ZodString:
@@ -56521,7 +56988,7 @@ var selectParser = (def, typeName, refs) => {
56521
56988
  }
56522
56989
  };
56523
56990
 
56524
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/parseDef.js
56991
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parseDef.js
56525
56992
  function parseDef(def, refs, forceResolution = false) {
56526
56993
  const seenItem = refs.seen.get(def);
56527
56994
  if (refs.override) {
@@ -56577,7 +57044,7 @@ var addMeta = (def, refs, jsonSchema) => {
56577
57044
  return jsonSchema;
56578
57045
  };
56579
57046
 
56580
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.5/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
57047
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
56581
57048
  var zodToJsonSchema = (schema, options) => {
56582
57049
  const refs = getRefs(options);
56583
57050
  let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2, schema2]) => ({
@@ -56639,7 +57106,7 @@ var zodToJsonSchema = (schema, options) => {
56639
57106
  return combined;
56640
57107
  };
56641
57108
 
56642
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
57109
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_supports-color@8.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
56643
57110
  function mapMiniTarget(t) {
56644
57111
  if (!t)
56645
57112
  return "draft-7";
@@ -56681,7 +57148,7 @@ function parseWithCompat(schema, data) {
56681
57148
  return result.data;
56682
57149
  }
56683
57150
 
56684
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
57151
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_supports-color@8.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
56685
57152
  var DEFAULT_REQUEST_TIMEOUT_MSEC = 6e4;
56686
57153
  var Protocol = class {
56687
57154
  constructor(_options) {
@@ -57203,7 +57670,7 @@ var Protocol = class {
57203
57670
  return;
57204
57671
  }
57205
57672
  const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
57206
- await new Promise((resolve3) => setTimeout(resolve3, pollInterval));
57673
+ await new Promise((resolve4) => setTimeout(resolve4, pollInterval));
57207
57674
  options?.signal?.throwIfAborted();
57208
57675
  }
57209
57676
  } catch (error62) {
@@ -57220,7 +57687,7 @@ var Protocol = class {
57220
57687
  */
57221
57688
  request(request, resultSchema, options) {
57222
57689
  const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
57223
- return new Promise((resolve3, reject) => {
57690
+ return new Promise((resolve4, reject) => {
57224
57691
  const earlyReject = (error62) => {
57225
57692
  reject(error62);
57226
57693
  };
@@ -57298,7 +57765,7 @@ var Protocol = class {
57298
57765
  if (!parseResult.success) {
57299
57766
  reject(parseResult.error);
57300
57767
  } else {
57301
- resolve3(parseResult.data);
57768
+ resolve4(parseResult.data);
57302
57769
  }
57303
57770
  } catch (error62) {
57304
57771
  reject(error62);
@@ -57560,12 +58027,12 @@ var Protocol = class {
57560
58027
  }
57561
58028
  } catch {
57562
58029
  }
57563
- return new Promise((resolve3, reject) => {
58030
+ return new Promise((resolve4, reject) => {
57564
58031
  if (signal.aborted) {
57565
58032
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
57566
58033
  return;
57567
58034
  }
57568
- const timeoutId = setTimeout(resolve3, interval);
58035
+ const timeoutId = setTimeout(resolve4, interval);
57569
58036
  signal.addEventListener("abort", () => {
57570
58037
  clearTimeout(timeoutId);
57571
58038
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
@@ -57658,7 +58125,7 @@ function mergeCapabilities(base, additional) {
57658
58125
  return result;
57659
58126
  }
57660
58127
 
57661
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
58128
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_supports-color@8.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
57662
58129
  var import_ajv = __toESM(require_ajv(), 1);
57663
58130
  var import_ajv_formats = __toESM(require_dist2(), 1);
57664
58131
  function createDefaultAjvInstance() {
@@ -57726,7 +58193,7 @@ var AjvJsonSchemaValidator = class {
57726
58193
  }
57727
58194
  };
57728
58195
 
57729
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
58196
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_supports-color@8.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
57730
58197
  var ExperimentalServerTasks = class {
57731
58198
  constructor(_server) {
57732
58199
  this._server = _server;
@@ -57939,7 +58406,7 @@ var ExperimentalServerTasks = class {
57939
58406
  }
57940
58407
  };
57941
58408
 
57942
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
58409
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_supports-color@8.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
57943
58410
  function assertToolsCallTaskCapability(requests, method, entityName) {
57944
58411
  if (!requests) {
57945
58412
  throw new Error(`${entityName} does not support task creation (required for ${method})`);
@@ -57974,7 +58441,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
57974
58441
  }
57975
58442
  }
57976
58443
 
57977
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
58444
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_supports-color@8.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
57978
58445
  var Server = class extends Protocol {
57979
58446
  /**
57980
58447
  * Initializes this server with the given name and version information.
@@ -58345,7 +58812,7 @@ var Server = class extends Protocol {
58345
58812
  }
58346
58813
  };
58347
58814
 
58348
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
58815
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_supports-color@8.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
58349
58816
  var COMPLETABLE_SYMBOL = /* @__PURE__ */ Symbol.for("mcp.completable");
58350
58817
  function isCompletable(schema) {
58351
58818
  return !!schema && typeof schema === "object" && COMPLETABLE_SYMBOL in schema;
@@ -58359,7 +58826,7 @@ var McpZodTypeKind;
58359
58826
  McpZodTypeKind2["Completable"] = "McpCompletable";
58360
58827
  })(McpZodTypeKind || (McpZodTypeKind = {}));
58361
58828
 
58362
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
58829
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_supports-color@8.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
58363
58830
  var TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
58364
58831
  function validateToolName(name) {
58365
58832
  const warnings = [];
@@ -58417,7 +58884,7 @@ function validateAndWarnToolName(name) {
58417
58884
  return result.isValid;
58418
58885
  }
58419
58886
 
58420
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
58887
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_supports-color@8.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
58421
58888
  var ExperimentalMcpServerTasks = class {
58422
58889
  constructor(_mcpServer) {
58423
58890
  this._mcpServer = _mcpServer;
@@ -58432,7 +58899,7 @@ var ExperimentalMcpServerTasks = class {
58432
58899
  }
58433
58900
  };
58434
58901
 
58435
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
58902
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_supports-color@8.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
58436
58903
  function toolInputElementCount(value, max) {
58437
58904
  let count = 0;
58438
58905
  const stack = [value];
@@ -58705,7 +59172,7 @@ var McpServer = class {
58705
59172
  let task = createTaskResult.task;
58706
59173
  const pollInterval = task.pollInterval ?? 5e3;
58707
59174
  while (task.status !== "completed" && task.status !== "failed" && task.status !== "cancelled") {
58708
- await new Promise((resolve3) => setTimeout(resolve3, pollInterval));
59175
+ await new Promise((resolve4) => setTimeout(resolve4, pollInterval));
58709
59176
  const updatedTask = await extra.taskStore.getTask(taskId);
58710
59177
  if (!updatedTask) {
58711
59178
  throw new McpError(ErrorCode.InternalError, `Task ${taskId} not found during polling`);
@@ -59273,10 +59740,10 @@ var EMPTY_COMPLETION_RESULT = {
59273
59740
  }
59274
59741
  };
59275
59742
 
59276
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
59743
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_supports-color@8.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
59277
59744
  import process3 from "node:process";
59278
59745
 
59279
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
59746
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_supports-color@8.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
59280
59747
  var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
59281
59748
  var ReadBuffer = class {
59282
59749
  constructor(options) {
@@ -59313,7 +59780,7 @@ function serializeMessage(message) {
59313
59780
  return JSON.stringify(message) + "\n";
59314
59781
  }
59315
59782
 
59316
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
59783
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_supports-color@8.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
59317
59784
  var StdioServerTransport = class {
59318
59785
  constructor(_stdin = process3.stdin, _stdout = process3.stdout, options) {
59319
59786
  this._stdin = _stdin;
@@ -59369,12 +59836,12 @@ var StdioServerTransport = class {
59369
59836
  this.onclose?.();
59370
59837
  }
59371
59838
  send(message) {
59372
- return new Promise((resolve3) => {
59839
+ return new Promise((resolve4) => {
59373
59840
  const json2 = serializeMessage(message);
59374
59841
  if (this._stdout.write(json2)) {
59375
- resolve3();
59842
+ resolve4();
59376
59843
  } else {
59377
- this._stdout.once("drain", resolve3);
59844
+ this._stdout.once("drain", resolve4);
59378
59845
  }
59379
59846
  });
59380
59847
  }
@@ -59383,11 +59850,11 @@ var StdioServerTransport = class {
59383
59850
  // apps/zaku-cli/src/mcp/server.ts
59384
59851
  import { mkdir as mkdir5 } from "node:fs/promises";
59385
59852
  import { tmpdir } from "node:os";
59386
- import { join as join11 } from "node:path";
59853
+ import { join as join12 } from "node:path";
59387
59854
 
59388
59855
  // apps/zaku-cli/src/mcp/screenshots.ts
59389
59856
  import { readdir as readdir4, rm as rm3, stat } from "node:fs/promises";
59390
- import { join as join9 } from "node:path";
59857
+ import { join as join10 } from "node:path";
59391
59858
  var KEPT_MS = 24 * 60 * 60 * 1e3;
59392
59859
  async function pruneScreenshots(dir, now) {
59393
59860
  let names;
@@ -59397,7 +59864,7 @@ async function pruneScreenshots(dir, now) {
59397
59864
  return;
59398
59865
  }
59399
59866
  for (const name of names.filter((entry) => entry.endsWith(".png"))) {
59400
- const path2 = join9(dir, name);
59867
+ const path2 = join10(dir, name);
59401
59868
  const written = await stat(path2).then(
59402
59869
  (stats) => stats.mtimeMs,
59403
59870
  () => now
@@ -59408,7 +59875,7 @@ async function pruneScreenshots(dir, now) {
59408
59875
 
59409
59876
  // apps/zaku-cli/src/mcp/tools.ts
59410
59877
  import { writeFile as writeFile5 } from "node:fs/promises";
59411
- import { join as join10 } from "node:path";
59878
+ import { join as join11 } from "node:path";
59412
59879
  var fileKey2 = external_exports.string().min(1).regex(/^[0-9a-zA-Z]{22,128}$/).describe(
59413
59880
  "The key of the Figma file to use. If the URL is provided, extract the file key from the URL: https://figma.com/design/:fileKey/:fileName."
59414
59881
  );
@@ -59452,7 +59919,7 @@ function registerFigmaTools(server, bridge, options) {
59452
59919
  options.timeoutMs
59453
59920
  );
59454
59921
  if (!answer.ok) return { isError: true, content: [{ type: "text", text: answer.error }] };
59455
- const path2 = join10(options.imageDir, `${id2.replace(":", "-")}-${Date.now()}.png`);
59922
+ const path2 = join11(options.imageDir, `${id2.replace(":", "-")}-${Date.now()}.png`);
59456
59923
  await writeFile5(path2, Buffer.from(answer.png, "base64"));
59457
59924
  const text = JSON.stringify({
59458
59925
  path: path2,
@@ -59478,7 +59945,7 @@ async function serveMcp(log) {
59478
59945
  log(
59479
59946
  bridge.port === null ? "zaku mcp: no port from 7337 to 7346 was free; every call will say so" : `zaku mcp: listening for the zaku plugin on localhost:${bridge.port}`
59480
59947
  );
59481
- const imageDir = join11(tmpdir(), "zaku-screenshots");
59948
+ const imageDir = join12(tmpdir(), "zaku-screenshots");
59482
59949
  await mkdir5(imageDir, { recursive: true });
59483
59950
  await pruneScreenshots(imageDir, Date.now());
59484
59951
  const server = new McpServer({ name: "zaku", version: "1" });
@@ -59495,59 +59962,175 @@ async function serveMcp(log) {
59495
59962
 
59496
59963
  // apps/zaku-cli/src/cli.ts
59497
59964
  var USE_FIGMA_CODE_LIMIT = 5e4;
59498
- var USAGE = "usage: zaku <check|outline|tokens|recipe|library|libraries|rules|budget|schema|mcp> [--root docs/design]";
59499
- async function sendOrRefuse(cli, io, finish, command) {
59500
- try {
59501
- return await cli.bus.send(command);
59502
- } catch (error62) {
59503
- const refusal = refusalOf(error62);
59504
- if (!refusal) throw error62;
59505
- io.err(refusal.line);
59506
- finish(refusal.code);
59507
- return null;
59508
- }
59509
- }
59965
+ var USAGE = "usage: zaku <check|outline|tokens|recipe|library|libraries|products|rules|budget|schema|mcp> [--config zaku.config.yaml] [--product <name>]";
59966
+ var LEGACY_WARNING = "zaku: read docs/design/zaku.yaml; move it to zaku.config.yaml at the repository root and the design to design/";
59510
59967
  async function recordRestCalls(cli, io) {
59511
59968
  const count = cli.restCalls();
59512
59969
  if (count === 0) return;
59513
59970
  const { seat, run } = seatAndRun(io.env);
59514
59971
  await cli.bus.send(new RecordBudgetCalls({ day: today(clock.now()), seat, run, kind: "rest", count }));
59515
59972
  }
59973
+ var CONFIG_OPTION = ["--config <path>", "the workspace config, when it is not zaku.config.yaml here"];
59974
+ var PRODUCT_OPTION = ["--product <name>", "only this product, by the name the workspace config gives it"];
59975
+ function warnLegacy(io, workspace) {
59976
+ if (workspace.legacy) io.err(LEGACY_WARNING);
59977
+ }
59978
+ async function workspaceOf(io, options) {
59979
+ const workspace = await readWorkspace(io.cwd, options);
59980
+ warnLegacy(io, workspace);
59981
+ return workspace;
59982
+ }
59983
+ function oneProduct(workspace, command) {
59984
+ const [product, ...rest] = workspace.products;
59985
+ if (product === void 0 || rest.length > 0) {
59986
+ throw new ProductRequired(
59987
+ command,
59988
+ workspace.products.map((each) => each.name)
59989
+ );
59990
+ }
59991
+ if ("refusal" in product) throw product.refusal;
59992
+ return product;
59993
+ }
59994
+ function onlyWithOne(workspace, command, option, given) {
59995
+ if (given !== void 0 && workspace.products.length > 1) {
59996
+ throw new ProductRequired(
59997
+ `${command} ${option}`,
59998
+ workspace.products.map((product) => product.name)
59999
+ );
60000
+ }
60001
+ }
60002
+ function productFailure(error62) {
60003
+ const refusal = refusalOf(error62);
60004
+ if (refusal) return refusal;
60005
+ if (error62 instanceof DesignFileInvalid || error62 instanceof FigmaRequestFailed) {
60006
+ return { code: 1, line: `zaku: ${error62.message}` };
60007
+ }
60008
+ throw error62;
60009
+ }
60010
+ function reportRefusal(io, error62) {
60011
+ const failure2 = productFailure(error62);
60012
+ io.err(failure2.line);
60013
+ return failure2.code;
60014
+ }
60015
+ async function forEachProduct(io, workspace, run) {
60016
+ let code = 0;
60017
+ for (const product of workspace.products) {
60018
+ if (workspace.products.length > 1) io.out(`== ${product.name}`);
60019
+ let exit;
60020
+ try {
60021
+ if ("refusal" in product) throw product.refusal;
60022
+ exit = await run(product);
60023
+ } catch (error62) {
60024
+ exit = reportRefusal(io, error62);
60025
+ }
60026
+ code = Math.max(code, exit);
60027
+ }
60028
+ return code;
60029
+ }
59516
60030
  var librariesCommand = (program2, io, finish) => {
59517
- program2.command("libraries").description("print the design graph: what each target draws from, and what each file extends and is extended by").option("--root <dir>", "the design directory", "docs/design").action(async (options) => {
59518
- const paths = designPaths(resolve2(io.cwd, options.root));
59519
- const config2 = await readDesignFile(paths.config, zakuConfigSchema);
59520
- for (const line of printGraph(config2, await readDesignSnapshots(paths, config2))) io.out(line);
60031
+ program2.command("libraries").description("print the design graph: what each target draws from, and what each file extends and is extended by").option(...CONFIG_OPTION).option(...PRODUCT_OPTION).action(async (options) => {
60032
+ const workspace = await workspaceOf(io, options);
60033
+ finish(
60034
+ await forEachProduct(io, workspace, async ({ root, config: config2 }) => {
60035
+ for (const line of printGraph(config2, await readDesignSnapshots(designPaths(root), config2))) io.out(line);
60036
+ return 0;
60037
+ })
60038
+ );
60039
+ });
60040
+ };
60041
+ var productsCommand = (program2, io, finish) => {
60042
+ program2.command("products").description("print each product the workspace config lists, with its design directory").option(...CONFIG_OPTION).option("--json", "print them as JSON").action(async (options) => {
60043
+ const workspace = await workspaceOf(io, options.config === void 0 ? {} : { config: options.config });
60044
+ const rows = workspace.products.map((product) => ({
60045
+ name: product.name,
60046
+ root: relative3(io.cwd, product.root) || "."
60047
+ }));
60048
+ if (options.json) io.out(JSON.stringify(rows, null, 2));
60049
+ else for (const row of rows) io.out(`${row.name} ${row.root}`);
59521
60050
  finish(0);
59522
60051
  });
59523
60052
  };
59524
60053
  var schemaCommand = (program2, io, finish, cli) => {
59525
- program2.command("schema").description("write the JSON Schemas an editor reads for the design files").option("--out <dir>", "where to write them", "docs/design").action(async (options) => {
59526
- const written = await cli.bus.send(new WriteSchemas({ out: resolve2(io.cwd, options.out) }));
60054
+ program2.command("schema").description("write the JSON Schemas an editor reads for the design files").option("--out <dir>", "where to write them; the workspace config's directory when left out").option(...CONFIG_OPTION).action(async (options) => {
60055
+ const out = options.out !== void 0 ? resolve3(io.cwd, options.out) : options.config !== void 0 ? dirname5(resolve3(io.cwd, options.config)) : resolve3(io.cwd);
60056
+ const written = await cli.bus.send(new WriteSchemas({ out }));
59527
60057
  for (const path2 of written) io.out(`wrote ${path2}`);
59528
60058
  finish(0);
59529
60059
  });
59530
60060
  };
60061
+ function checkExit(codes) {
60062
+ const rank = (code) => code === 1 ? 2 : code === 2 ? 1 : code;
60063
+ return codes.reduce((worst, code) => rank(code) > rank(worst) ? code : worst, 0);
60064
+ }
60065
+ async function checkProduct(product, ran) {
60066
+ let loaded;
60067
+ if ("refusal" in product) {
60068
+ if (!(product.refusal instanceof DesignFileInvalid)) return { refusal: product.refusal };
60069
+ loaded = { input: null, findings: [{ check: "schema", message: product.refusal.message }] };
60070
+ } else {
60071
+ try {
60072
+ loaded = await loadDesign(product);
60073
+ } catch (error62) {
60074
+ if (!(error62 instanceof DesignFileInvalid)) throw error62;
60075
+ loaded = { input: null, findings: [{ check: "schema", message: error62.message }] };
60076
+ }
60077
+ }
60078
+ const report = loaded.input ? runChecks(loaded.input, ALL_CHECKS) : { findings: [], notRun: [], passed: [] };
60079
+ report.findings.unshift(...loaded.findings);
60080
+ if (ran) report.findings.push(...ran.findings);
60081
+ const left = ran ? leftOut(ran) : [];
60082
+ return {
60083
+ report: { ...report, ...left.length > 0 ? { leftOut: left } : {} },
60084
+ code: loaded.input ? exitCode(report) : 1
60085
+ };
60086
+ }
59531
60087
  var checkCommand = (program2, io, finish) => {
59532
- program2.command("check").description("run every check over the committed design files").option("--root <dir>", "the design directory", "docs/design").option("--json", "print the report as JSON").option("--input <rules.json>", "what use_figma returned for zaku rules script, with or without --after").action(async (options) => {
59533
- const loaded = await loadDesign(resolve2(io.cwd, options.root));
59534
- const report = loaded.input ? runChecks(loaded.input, ALL_CHECKS) : { findings: [], notRun: [], passed: [] };
59535
- report.findings.unshift(...loaded.findings);
59536
- const ran = options.input ? parseDesignFile(options.input, await readFile6(resolve2(io.cwd, options.input), "utf8"), rulesAnswerSchema) : null;
59537
- if (ran && "rulesError" in ran) {
59538
- io.err(`zaku check: the rules did not run after the write: ${ran.rulesError}`);
60088
+ program2.command("check").description("run every check over each product's committed design files").option(...CONFIG_OPTION).option(...PRODUCT_OPTION).option("--json", "print the report as JSON, keyed by product when there are several").option("--input <rules.json>", "what use_figma returned for zaku rules script, with or without --after").action(async (options) => {
60089
+ let workspace;
60090
+ try {
60091
+ workspace = await workspaceOf(io, options);
60092
+ } catch (error62) {
60093
+ if (!(error62 instanceof DesignFileInvalid)) throw error62;
60094
+ const report = { findings: [{ check: "schema", message: error62.message }], notRun: [], passed: [] };
60095
+ if (options.json) io.out(JSON.stringify(report, null, 2));
60096
+ else for (const line of formatReport(report)) io.out(line);
59539
60097
  finish(1);
59540
60098
  return;
59541
60099
  }
59542
- if (ran) report.findings.push(...ran.findings);
59543
- const left = ran ? leftOut(ran) : [];
59544
- if (options.json) io.out(JSON.stringify({ ...report, ...left.length > 0 ? { leftOut: left } : {} }, null, 2));
59545
- else for (const line of [...left, ...formatReport(report)]) io.out(line);
59546
- finish(loaded.input ? exitCode(report) : 1);
60100
+ onlyWithOne(workspace, "zaku check", "--input", options.input);
60101
+ const answer = options.input ? parseDesignFile(options.input, await readFile7(resolve3(io.cwd, options.input), "utf8"), rulesAnswerSchema) : null;
60102
+ if (answer && "rulesError" in answer) {
60103
+ io.err(`zaku check: the rules did not run after the write: ${answer.rulesError}`);
60104
+ finish(1);
60105
+ return;
60106
+ }
60107
+ const several = workspace.products.length > 1;
60108
+ const reports = {};
60109
+ const codes = [];
60110
+ for (const product of workspace.products) {
60111
+ if (several && !options.json) io.out(`== ${product.name}`);
60112
+ const checked = await checkProduct(product, answer);
60113
+ if ("refusal" in checked) {
60114
+ const failure2 = productFailure(checked.refusal);
60115
+ io.err(failure2.line);
60116
+ codes.push(failure2.code);
60117
+ if (options.json) reports[product.name] = { refusal: failure2.line };
60118
+ continue;
60119
+ }
60120
+ codes.push(checked.code);
60121
+ if (options.json) reports[product.name] = checked.report;
60122
+ else for (const line of [...checked.report.leftOut ?? [], ...formatReport(checked.report)]) io.out(line);
60123
+ }
60124
+ if (options.json) {
60125
+ const [only2] = Object.values(reports);
60126
+ if (several) io.out(JSON.stringify(reports, null, 2));
60127
+ else if (only2) io.out(JSON.stringify(only2, null, 2));
60128
+ }
60129
+ finish(checkExit(codes));
59547
60130
  });
59548
60131
  };
59549
60132
  async function productPlaywright(cwd) {
59550
- const require2 = createRequire(join12(cwd, "package.json"));
60133
+ const require2 = createRequire(join13(cwd, "package.json"));
59551
60134
  let resolved;
59552
60135
  try {
59553
60136
  resolved = require2.resolve("playwright");
@@ -59558,15 +60141,15 @@ async function productPlaywright(cwd) {
59558
60141
  return require2("playwright");
59559
60142
  }
59560
60143
  function fromProductTree(cwd, resolved) {
59561
- for (let dir = resolve2(cwd); ; dir = dirname4(dir)) {
59562
- if (resolved.startsWith(join12(dir, "node_modules") + sep)) return true;
59563
- if (dirname4(dir) === dir) return false;
60144
+ for (let dir = resolve3(cwd); ; dir = dirname5(dir)) {
60145
+ if (resolved.startsWith(join13(dir, "node_modules") + sep)) return true;
60146
+ if (dirname5(dir) === dir) return false;
59564
60147
  }
59565
60148
  }
59566
60149
  var runners = {
59567
60150
  run: execRun,
59568
60151
  loadPlaywright: productPlaywright,
59569
- rulesLibrary: () => readFile6(fileURLToPath(new URL("./rules.js", import.meta.url)), "utf8")
60152
+ rulesLibrary: () => readFile7(fileURLToPath(new URL("./rules.js", import.meta.url)), "utf8")
59570
60153
  };
59571
60154
  var mcpCommand = (program2, io, finish) => {
59572
60155
  program2.command("mcp").description(
@@ -59577,30 +60160,35 @@ var mcpCommand = (program2, io, finish) => {
59577
60160
  });
59578
60161
  };
59579
60162
  var tokensCommand = (program2, io, finish, cli) => {
59580
- program2.command("tokens").description("write the code's tokens to tokens.json, from the design system zaku.yaml names").option("--css <path>", "the stylesheet that declares :root and .dark (shadcn)").option("--root <dir>", "the design directory", "docs/design").action(async (options) => {
59581
- const command = new WriteTokens({
59582
- root: resolve2(io.cwd, options.root),
59583
- cwd: io.cwd,
59584
- css: options.css ? resolve2(io.cwd, options.css) : null
59585
- });
59586
- const written = await sendOrRefuse(cli, io, finish, command);
59587
- if (!written) return;
59588
- io.out(`wrote ${written.path}: ${written.colours} colours, ${written.from}`);
59589
- finish(0);
60163
+ program2.command("tokens").description("write the code's tokens to tokens.json, from the design system zaku.yaml names").option("--css <path>", "the stylesheet that declares :root and .dark (shadcn), over designSystem.shadcn.css").option(...CONFIG_OPTION).option(...PRODUCT_OPTION).action(async (options) => {
60164
+ const workspace = await workspaceOf(io, options);
60165
+ onlyWithOne(workspace, "zaku tokens", "--css", options.css);
60166
+ finish(
60167
+ await forEachProduct(io, workspace, async ({ root, config: config2 }) => {
60168
+ const named = "shadcn" in config2.designSystem ? config2.designSystem.shadcn.css : void 0;
60169
+ const css = options.css ? resolve3(io.cwd, options.css) : named !== void 0 ? resolve3(workspace.dir, named) : null;
60170
+ const command = new WriteTokens({ root, config: config2, cwd: workspace.dir, css });
60171
+ const written = await cli.bus.send(command);
60172
+ io.out(`wrote ${written.path}: ${written.colours} colours, ${written.from}`);
60173
+ return 0;
60174
+ })
60175
+ );
59590
60176
  });
59591
60177
  };
59592
60178
  var recipeCommand = (program2, io, finish, cli) => {
59593
- program2.command("recipe").description("write what the code computes for every variant to recipe.json, from the product's recipe page").option("--url <url>", "the recipe page, when it is not zaku.yaml's recipe.url").option("--root <dir>", "the design directory", "docs/design").action(async (options) => {
59594
- const command = new WriteRecipe({
59595
- root: resolve2(io.cwd, options.root),
59596
- url: options.url ?? null
59597
- });
59598
- const written = await sendOrRefuse(cli, io, finish, command);
59599
- if (!written) return;
59600
- io.out(
59601
- `wrote ${written.path}: ${written.components} components, ${written.variants} variants, in light and dark`
60179
+ program2.command("recipe").description("write what the code computes for every variant to recipe.json, from the product's recipe page").option("--url <url>", "the recipe page, when it is not zaku.yaml's recipe.url").option(...CONFIG_OPTION).option(...PRODUCT_OPTION).action(async (options) => {
60180
+ const workspace = await workspaceOf(io, options);
60181
+ onlyWithOne(workspace, "zaku recipe", "--url", options.url);
60182
+ finish(
60183
+ await forEachProduct(io, workspace, async ({ root, config: config2 }) => {
60184
+ const command = new WriteRecipe({ root, config: config2, url: options.url ?? null });
60185
+ const written = await cli.bus.send(command);
60186
+ io.out(
60187
+ `wrote ${written.path}: ${written.components} components, ${written.variants} variants, in light and dark`
60188
+ );
60189
+ return 0;
60190
+ })
59602
60191
  );
59603
- finish(0);
59604
60192
  });
59605
60193
  };
59606
60194
  var clock = { now: () => /* @__PURE__ */ new Date() };
@@ -59621,10 +60209,21 @@ var budgetCommand = (program2, io, finish, cli) => {
59621
60209
  await cli.bus.send(new RecordBudgetCalls({ day, seat, run, kind: options.kind, count: options.count }));
59622
60210
  finish(0);
59623
60211
  });
59624
- budget.command("status").description("exit 4 when the budget refuses another MCP call").option("--root <dir>", "the design directory", "docs/design").action(async (options) => {
60212
+ budget.command("status").description("exit 4 when the budget refuses another MCP call").option(...CONFIG_OPTION).action(async (options) => {
59625
60213
  const { path: path2, seat, run, day } = ledger();
59626
- const config2 = await readOptionalDesignFile(designPaths(resolve2(io.cwd, options.root)).config, zakuConfigSchema);
59627
- const allowance = mcpAllowance(await readLedger(path2, day), seat, run, config2?.budget ?? budgetSchema.parse({}));
60214
+ let budgets;
60215
+ try {
60216
+ const workspace = await workspaceOf(io, options.config === void 0 ? {} : { config: options.config });
60217
+ budgets = workspace.products.map(
60218
+ (product) => "refusal" in product ? workspace.budget : product.config.budget
60219
+ );
60220
+ } catch (error62) {
60221
+ if (!(error62 instanceof WorkspaceConfigMissing) || options.config !== void 0) throw error62;
60222
+ budgets = [budgetSchema.parse({})];
60223
+ }
60224
+ const read = await readLedger(path2, day);
60225
+ const allowances = budgets.map((budget2) => mcpAllowance(read, seat, run, budget2));
60226
+ const allowance = allowances.reduce((chosen, each) => chosen.ok && !each.ok ? each : chosen);
59628
60227
  io.out(
59629
60228
  `mcp ${allowance.usedToday} today, ${allowance.usedThisRun} this run${allowance.reason ? `: ${allowance.reason}` : ""}`
59630
60229
  );
@@ -59632,8 +60231,7 @@ var budgetCommand = (program2, io, finish, cli) => {
59632
60231
  });
59633
60232
  };
59634
60233
  var outlineCommand = (program2, io, finish, cli) => {
59635
- program2.command("outline").description("read the product file's frames into docs/design/outline").option("--root <dir>", "the design directory", "docs/design").option("--frames <ids>", "only these frame ids, comma separated").action(async (options) => {
59636
- const root = resolve2(io.cwd, options.root);
60234
+ program2.command("outline").description("read each product file's frames into its design's outline/").option(...CONFIG_OPTION).option(...PRODUCT_OPTION).option("--frames <ids>", "only these frame ids, comma separated").action(async (options) => {
59637
60235
  const report = (summary) => io.out(
59638
60236
  summary.skipped ? "outline is current; nothing read" : `read ${summary.read} frames, wrote ${summary.written.length} outlines, ${summary.unmapped} unmapped`
59639
60237
  );
@@ -59643,9 +60241,15 @@ var outlineCommand = (program2, io, finish, cli) => {
59643
60241
  return;
59644
60242
  }
59645
60243
  try {
60244
+ const workspace = await workspaceOf(io, options);
60245
+ onlyWithOne(workspace, "zaku outline", "--frames", options.frames);
59646
60246
  const frames = options.frames ? options.frames.split(",") : null;
59647
- report(await cli.bus.send(new WriteOutline({ root, frames })));
59648
- finish(0);
60247
+ finish(
60248
+ await forEachProduct(io, workspace, async ({ root, config: config2 }) => {
60249
+ report(await cli.bus.send(new WriteOutline({ root, config: config2, frames })));
60250
+ return 0;
60251
+ })
60252
+ );
59649
60253
  } finally {
59650
60254
  await recordRestCalls(cli, io);
59651
60255
  }
@@ -59653,8 +60257,8 @@ var outlineCommand = (program2, io, finish, cli) => {
59653
60257
  };
59654
60258
  var libraryCommand = (program2, io, finish, cli) => {
59655
60259
  const library = program2.command("library").description("snapshot the library's components and tokens");
59656
- library.command("script").description("print the Plugin API code that exports the library variables, for use_figma").option("--root <dir>", "the design directory", "docs/design").option("--local", "also list the file's own components, for a library in the product file").option("--page <name>", "with --local, list only this page; one use_figma call per page").action(async (options) => {
59657
- const config2 = await readDesignFile(designPaths(resolve2(io.cwd, options.root)).config, zakuConfigSchema);
60260
+ library.command("script").description("print the Plugin API code that exports the library variables, for use_figma").option(...CONFIG_OPTION).option(...PRODUCT_OPTION).option("--local", "also list the file's own components, for a library in the product file").option("--page <name>", "with --local, list only this page; one use_figma call per page").action(async (options) => {
60261
+ const { config: config2 } = oneProduct(await workspaceOf(io, options), "zaku library script");
59658
60262
  io.out(
59659
60263
  libraryExportScript({
59660
60264
  combos: [config2.modes],
@@ -59686,23 +60290,13 @@ var libraryCommand = (program2, io, finish, cli) => {
59686
60290
  );
59687
60291
  library.command("save").description(
59688
60292
  "write a library's snapshot from its components over Figma REST, joined to the variables export, or a kit's published components"
59689
- ).option("--root <dir>", "the design directory", "docs/design").option("--key <key>", "the library or kit to save, as zaku.yaml lists it; needed when it lists several").option(
60293
+ ).option(...CONFIG_OPTION).option(...PRODUCT_OPTION).option("--key <key>", "the library or kit to save, as zaku.yaml lists it; needed when it lists several").option(
59690
60294
  "--input <variables.json>",
59691
60295
  "what use_figma returned for zaku library script; once per page export for a library in the product file",
59692
60296
  (value, previous = []) => [...previous, value]
59693
60297
  ).action(async (options) => {
59694
- const root = resolve2(io.cwd, options.root);
59695
- const config2 = await readDesignFile(designPaths(root).config, zakuConfigSchema);
59696
- let target;
59697
- try {
59698
- target = librarySaveTarget(config2, options.key);
59699
- } catch (error62) {
59700
- const refusal = refusalOf(error62);
59701
- if (!refusal) throw error62;
59702
- io.err(refusal.line);
59703
- finish(refusal.code);
59704
- return;
59705
- }
60298
+ const { root, config: config2 } = oneProduct(await workspaceOf(io, options), "zaku library save");
60299
+ const target = librarySaveTarget(config2, options.key);
59706
60300
  if (target.kind === "library" && (!options.input || options.input.length === 0)) {
59707
60301
  io.err("zaku library save needs --input, the variables use_figma returned for zaku library script");
59708
60302
  finish(3);
@@ -59716,7 +60310,7 @@ var libraryCommand = (program2, io, finish, cli) => {
59716
60310
  const part = target.kind === "library" ? mergeParts(
59717
60311
  await Promise.all(
59718
60312
  (options.input ?? []).map(
59719
- async (input2) => parseDesignFile(input2, await readFile6(resolve2(io.cwd, input2), "utf8"), variablePartSchema)
60313
+ async (input2) => parseDesignFile(input2, await readFile7(resolve3(io.cwd, input2), "utf8"), variablePartSchema)
59720
60314
  )
59721
60315
  )
59722
60316
  ) : void 0;
@@ -59724,6 +60318,7 @@ var libraryCommand = (program2, io, finish, cli) => {
59724
60318
  const saved = await cli.bus.send(
59725
60319
  new SaveLibrary({
59726
60320
  root,
60321
+ config: config2,
59727
60322
  ...options.key !== void 0 ? { key: options.key } : {},
59728
60323
  ...part ? { part } : {}
59729
60324
  })
@@ -59752,13 +60347,13 @@ var libraryCommand = (program2, io, finish, cli) => {
59752
60347
  };
59753
60348
  var rulesCommand = (program2, io, finish) => {
59754
60349
  const rules = program2.command("rules").description("zaku's rule checks, for a run that reaches Figma through use_figma");
59755
- rules.command("script").description("print the Plugin API code that runs the rules over a page or a node, for use_figma").option("--root <dir>", "the design directory", "docs/design").option("--page <page>", "the page to check, by id or name").option("--node <id>", "the node to check, with everything inside it").option("--after <write.js>", "run this use_figma write first, then the rules, and answer both").option("--key <key>", "the library file the page is in, so its views are held to the branches it holds").action(async (options) => {
60350
+ rules.command("script").description("print the Plugin API code that runs the rules over a page or a node, for use_figma").option(...CONFIG_OPTION).option(...PRODUCT_OPTION).option("--page <page>", "the page to check, by id or name").option("--node <id>", "the node to check, with everything inside it").option("--after <write.js>", "run this use_figma write first, then the rules, and answer both").option("--key <key>", "the library file the page is in, so its views are held to the branches it holds").action(async (options) => {
59756
60351
  if (options.page === void 0 === (options.node === void 0)) {
59757
60352
  io.err("zaku rules script needs --page or --node, one of them");
59758
60353
  finish(3);
59759
60354
  return;
59760
60355
  }
59761
- const config2 = await readDesignFile(designPaths(resolve2(io.cwd, options.root)).config, zakuConfigSchema);
60356
+ const { config: config2 } = oneProduct(await workspaceOf(io, options), "zaku rules script");
59762
60357
  const scope = options.node !== void 0 ? { nodeId: options.node } : { page: options.page };
59763
60358
  const graph = designGraph(config2);
59764
60359
  const file2 = options.key === void 0 ? graph.libraries.length === 1 ? graph.libraries[0] : void 0 : graph.libraries.find((library2) => library2.key === options.key);
@@ -59778,7 +60373,7 @@ return ${check2};`);
59778
60373
  finish(0);
59779
60374
  return;
59780
60375
  }
59781
- const write2 = await readFile6(resolve2(io.cwd, options.after), "utf8");
60376
+ const write2 = await readFile7(resolve3(io.cwd, options.after), "utf8");
59782
60377
  const body = [
59783
60378
  library,
59784
60379
  `const zakuWrite = async () => {
@@ -59810,6 +60405,7 @@ var COMMANDS = [
59810
60405
  budgetCommand,
59811
60406
  schemaCommand,
59812
60407
  librariesCommand,
60408
+ productsCommand,
59813
60409
  mcpCommand
59814
60410
  ];
59815
60411
  async function main(argv, io) {
@@ -59846,6 +60442,11 @@ async function main(argv, io) {
59846
60442
  io.err(USAGE);
59847
60443
  return 3;
59848
60444
  }
60445
+ const refusal = refusalOf(error62);
60446
+ if (refusal) {
60447
+ io.err(refusal.line);
60448
+ return refusal.code;
60449
+ }
59849
60450
  io.err(`zaku: ${error62 instanceof Error ? error62.message : String(error62)}`);
59850
60451
  return 1;
59851
60452
  }