dorkos 0.34.1 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin/cli.js CHANGED
@@ -290,10 +290,10 @@ function mergeDefs(...defs) {
290
290
  function cloneDef(schema) {
291
291
  return mergeDefs(schema._zod.def);
292
292
  }
293
- function getElementAtPath(obj, path14) {
294
- if (!path14)
293
+ function getElementAtPath(obj, path15) {
294
+ if (!path15)
295
295
  return obj;
296
- return path14.reduce((acc, key) => acc?.[key], obj);
296
+ return path15.reduce((acc, key) => acc?.[key], obj);
297
297
  }
298
298
  function promiseAllObject(promisesObj) {
299
299
  const keys = Object.keys(promisesObj);
@@ -605,11 +605,11 @@ function aborted(x2, startIndex = 0) {
605
605
  }
606
606
  return false;
607
607
  }
608
- function prefixIssues(path14, issues) {
608
+ function prefixIssues(path15, issues) {
609
609
  return issues.map((iss) => {
610
610
  var _a2;
611
611
  (_a2 = iss).path ?? (_a2.path = []);
612
- iss.path.unshift(path14);
612
+ iss.path.unshift(path15);
613
613
  return iss;
614
614
  });
615
615
  }
@@ -850,8 +850,8 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
850
850
  return fieldErrors;
851
851
  }
852
852
  function treeifyError(error48, mapper = (issue2) => issue2.message) {
853
- const result = { errors: [] };
854
- const processError = (error49, path14 = []) => {
853
+ const result2 = { errors: [] };
854
+ const processError = (error49, path15 = []) => {
855
855
  var _a2, _b;
856
856
  for (const issue2 of error49.issues) {
857
857
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -861,12 +861,12 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
861
861
  } else if (issue2.code === "invalid_element") {
862
862
  processError({ issues: issue2.issues }, issue2.path);
863
863
  } else {
864
- const fullpath = [...path14, ...issue2.path];
864
+ const fullpath = [...path15, ...issue2.path];
865
865
  if (fullpath.length === 0) {
866
- result.errors.push(mapper(issue2));
866
+ result2.errors.push(mapper(issue2));
867
867
  continue;
868
868
  }
869
- let curr = result;
869
+ let curr = result2;
870
870
  let i2 = 0;
871
871
  while (i2 < fullpath.length) {
872
872
  const el = fullpath[i2];
@@ -889,12 +889,12 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
889
889
  }
890
890
  };
891
891
  processError(error48);
892
- return result;
892
+ return result2;
893
893
  }
894
894
  function toDotPath(_path) {
895
895
  const segs = [];
896
- const path14 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
897
- for (const seg of path14) {
896
+ const path15 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
897
+ for (const seg of path15) {
898
898
  if (typeof seg === "number")
899
899
  segs.push(`[${seg}]`);
900
900
  else if (typeof seg === "symbol")
@@ -954,52 +954,52 @@ var init_parse = __esm({
954
954
  init_util();
955
955
  _parse = (_Err) => (schema, value, _ctx, _params) => {
956
956
  const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
957
- const result = schema._zod.run({ value, issues: [] }, ctx);
958
- if (result instanceof Promise) {
957
+ const result2 = schema._zod.run({ value, issues: [] }, ctx);
958
+ if (result2 instanceof Promise) {
959
959
  throw new $ZodAsyncError();
960
960
  }
961
- if (result.issues.length) {
962
- const e2 = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
961
+ if (result2.issues.length) {
962
+ const e2 = new (_params?.Err ?? _Err)(result2.issues.map((iss) => finalizeIssue(iss, ctx, config())));
963
963
  captureStackTrace(e2, _params?.callee);
964
964
  throw e2;
965
965
  }
966
- return result.value;
966
+ return result2.value;
967
967
  };
968
968
  parse = /* @__PURE__ */ _parse($ZodRealError);
969
969
  _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
970
970
  const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
971
- let result = schema._zod.run({ value, issues: [] }, ctx);
972
- if (result instanceof Promise)
973
- result = await result;
974
- if (result.issues.length) {
975
- const e2 = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
971
+ let result2 = schema._zod.run({ value, issues: [] }, ctx);
972
+ if (result2 instanceof Promise)
973
+ result2 = await result2;
974
+ if (result2.issues.length) {
975
+ const e2 = new (params?.Err ?? _Err)(result2.issues.map((iss) => finalizeIssue(iss, ctx, config())));
976
976
  captureStackTrace(e2, params?.callee);
977
977
  throw e2;
978
978
  }
979
- return result.value;
979
+ return result2.value;
980
980
  };
981
981
  parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
982
982
  _safeParse = (_Err) => (schema, value, _ctx) => {
983
983
  const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
984
- const result = schema._zod.run({ value, issues: [] }, ctx);
985
- if (result instanceof Promise) {
984
+ const result2 = schema._zod.run({ value, issues: [] }, ctx);
985
+ if (result2 instanceof Promise) {
986
986
  throw new $ZodAsyncError();
987
987
  }
988
- return result.issues.length ? {
988
+ return result2.issues.length ? {
989
989
  success: false,
990
- error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
991
- } : { success: true, data: result.value };
990
+ error: new (_Err ?? $ZodError)(result2.issues.map((iss) => finalizeIssue(iss, ctx, config())))
991
+ } : { success: true, data: result2.value };
992
992
  };
993
993
  safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
994
994
  _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
995
995
  const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
996
- let result = schema._zod.run({ value, issues: [] }, ctx);
997
- if (result instanceof Promise)
998
- result = await result;
999
- return result.issues.length ? {
996
+ let result2 = schema._zod.run({ value, issues: [] }, ctx);
997
+ if (result2 instanceof Promise)
998
+ result2 = await result2;
999
+ return result2.issues.length ? {
1000
1000
  success: false,
1001
- error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
1002
- } : { success: true, data: result.value };
1001
+ error: new _Err(result2.issues.map((iss) => finalizeIssue(iss, ctx, config())))
1002
+ } : { success: true, data: result2.value };
1003
1003
  };
1004
1004
  safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
1005
1005
  _encode = (_Err) => (schema, value, _ctx) => {
@@ -1205,9 +1205,9 @@ var init_regexes = __esm({
1205
1205
  });
1206
1206
 
1207
1207
  // ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.js
1208
- function handleCheckPropertyResult(result, payload, property) {
1209
- if (result.issues.length) {
1210
- payload.issues.push(...prefixIssues(property, result.issues));
1208
+ function handleCheckPropertyResult(result2, payload, property) {
1209
+ if (result2.issues.length) {
1210
+ payload.issues.push(...prefixIssues(property, result2.issues));
1211
1211
  }
1212
1212
  }
1213
1213
  var $ZodCheck, numericOriginMap, $ZodCheckLessThan, $ZodCheckGreaterThan, $ZodCheckMultipleOf, $ZodCheckNumberFormat, $ZodCheckBigIntFormat, $ZodCheckMaxSize, $ZodCheckMinSize, $ZodCheckSizeEquals, $ZodCheckMaxLength, $ZodCheckMinLength, $ZodCheckLengthEquals, $ZodCheckStringFormat, $ZodCheckRegex, $ZodCheckLowerCase, $ZodCheckUpperCase, $ZodCheckIncludes, $ZodCheckStartsWith, $ZodCheckEndsWith, $ZodCheckProperty, $ZodCheckMimeType, $ZodCheckOverwrite;
@@ -1722,14 +1722,14 @@ var init_checks = __esm({
1722
1722
  $ZodCheckProperty = /* @__PURE__ */ $constructor("$ZodCheckProperty", (inst, def) => {
1723
1723
  $ZodCheck.init(inst, def);
1724
1724
  inst._zod.check = (payload) => {
1725
- const result = def.schema._zod.run({
1725
+ const result2 = def.schema._zod.run({
1726
1726
  value: payload.value[def.property],
1727
1727
  issues: []
1728
1728
  }, {});
1729
- if (result instanceof Promise) {
1730
- return result.then((result2) => handleCheckPropertyResult(result2, payload, def.property));
1729
+ if (result2 instanceof Promise) {
1730
+ return result2.then((result3) => handleCheckPropertyResult(result3, payload, def.property));
1731
1731
  }
1732
- handleCheckPropertyResult(result, payload, def.property);
1732
+ handleCheckPropertyResult(result2, payload, def.property);
1733
1733
  return;
1734
1734
  };
1735
1735
  });
@@ -1853,25 +1853,25 @@ function isValidJWT(token, algorithm = null) {
1853
1853
  return false;
1854
1854
  }
1855
1855
  }
1856
- function handleArrayResult(result, final, index) {
1857
- if (result.issues.length) {
1858
- final.issues.push(...prefixIssues(index, result.issues));
1856
+ function handleArrayResult(result2, final, index) {
1857
+ if (result2.issues.length) {
1858
+ final.issues.push(...prefixIssues(index, result2.issues));
1859
1859
  }
1860
- final.value[index] = result.value;
1860
+ final.value[index] = result2.value;
1861
1861
  }
1862
- function handlePropertyResult(result, final, key, input2, isOptionalOut) {
1863
- if (result.issues.length) {
1862
+ function handlePropertyResult(result2, final, key, input2, isOptionalOut) {
1863
+ if (result2.issues.length) {
1864
1864
  if (isOptionalOut && !(key in input2)) {
1865
1865
  return;
1866
1866
  }
1867
- final.issues.push(...prefixIssues(key, result.issues));
1867
+ final.issues.push(...prefixIssues(key, result2.issues));
1868
1868
  }
1869
- if (result.value === void 0) {
1869
+ if (result2.value === void 0) {
1870
1870
  if (key in input2) {
1871
1871
  final.value[key] = void 0;
1872
1872
  }
1873
1873
  } else {
1874
- final.value[key] = result.value;
1874
+ final.value[key] = result2.value;
1875
1875
  }
1876
1876
  }
1877
1877
  function normalizeDef(def) {
@@ -1925,9 +1925,9 @@ function handleCatchall(proms, input2, payload, ctx, def, inst) {
1925
1925
  });
1926
1926
  }
1927
1927
  function handleUnionResults(results, final, inst, ctx) {
1928
- for (const result of results) {
1929
- if (result.issues.length === 0) {
1930
- final.value = result.value;
1928
+ for (const result2 of results) {
1929
+ if (result2.issues.length === 0) {
1930
+ final.value = result2.value;
1931
1931
  return final;
1932
1932
  }
1933
1933
  }
@@ -1940,7 +1940,7 @@ function handleUnionResults(results, final, inst, ctx) {
1940
1940
  code: "invalid_union",
1941
1941
  input: final.value,
1942
1942
  inst,
1943
- errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
1943
+ errors: results.map((result2) => result2.issues.map((iss) => finalizeIssue(iss, ctx, config())))
1944
1944
  });
1945
1945
  return final;
1946
1946
  }
@@ -1955,7 +1955,7 @@ function handleExclusiveUnionResults(results, final, inst, ctx) {
1955
1955
  code: "invalid_union",
1956
1956
  input: final.value,
1957
1957
  inst,
1958
- errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
1958
+ errors: results.map((result2) => result2.issues.map((iss) => finalizeIssue(iss, ctx, config())))
1959
1959
  });
1960
1960
  } else {
1961
1961
  final.issues.push({
@@ -2012,7 +2012,7 @@ function mergeValues(a2, b2) {
2012
2012
  }
2013
2013
  return { valid: false, mergeErrorPath: [] };
2014
2014
  }
2015
- function handleIntersectionResults(result, left, right) {
2015
+ function handleIntersectionResults(result2, left, right) {
2016
2016
  const unrecKeys = /* @__PURE__ */ new Map();
2017
2017
  let unrecIssue;
2018
2018
  for (const iss of left.issues) {
@@ -2024,7 +2024,7 @@ function handleIntersectionResults(result, left, right) {
2024
2024
  unrecKeys.get(k2).l = true;
2025
2025
  }
2026
2026
  } else {
2027
- result.issues.push(iss);
2027
+ result2.issues.push(iss);
2028
2028
  }
2029
2029
  }
2030
2030
  for (const iss of right.issues) {
@@ -2035,27 +2035,27 @@ function handleIntersectionResults(result, left, right) {
2035
2035
  unrecKeys.get(k2).r = true;
2036
2036
  }
2037
2037
  } else {
2038
- result.issues.push(iss);
2038
+ result2.issues.push(iss);
2039
2039
  }
2040
2040
  }
2041
2041
  const bothKeys = [...unrecKeys].filter(([, f3]) => f3.l && f3.r).map(([k2]) => k2);
2042
2042
  if (bothKeys.length && unrecIssue) {
2043
- result.issues.push({ ...unrecIssue, keys: bothKeys });
2043
+ result2.issues.push({ ...unrecIssue, keys: bothKeys });
2044
2044
  }
2045
- if (aborted(result))
2046
- return result;
2045
+ if (aborted(result2))
2046
+ return result2;
2047
2047
  const merged = mergeValues(left.value, right.value);
2048
2048
  if (!merged.valid) {
2049
2049
  throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
2050
2050
  }
2051
- result.value = merged.data;
2052
- return result;
2051
+ result2.value = merged.data;
2052
+ return result2;
2053
2053
  }
2054
- function handleTupleResult(result, final, index) {
2055
- if (result.issues.length) {
2056
- final.issues.push(...prefixIssues(index, result.issues));
2054
+ function handleTupleResult(result2, final, index) {
2055
+ if (result2.issues.length) {
2056
+ final.issues.push(...prefixIssues(index, result2.issues));
2057
2057
  }
2058
- final.value[index] = result.value;
2058
+ final.value[index] = result2.value;
2059
2059
  }
2060
2060
  function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx) {
2061
2061
  if (keyResult.issues.length) {
@@ -2087,17 +2087,17 @@ function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx)
2087
2087
  }
2088
2088
  final.value.set(keyResult.value, valueResult.value);
2089
2089
  }
2090
- function handleSetResult(result, final) {
2091
- if (result.issues.length) {
2092
- final.issues.push(...result.issues);
2090
+ function handleSetResult(result2, final) {
2091
+ if (result2.issues.length) {
2092
+ final.issues.push(...result2.issues);
2093
2093
  }
2094
- final.value.add(result.value);
2094
+ final.value.add(result2.value);
2095
2095
  }
2096
- function handleOptionalResult(result, input2) {
2097
- if (result.issues.length && input2 === void 0) {
2096
+ function handleOptionalResult(result2, input2) {
2097
+ if (result2.issues.length && input2 === void 0) {
2098
2098
  return { issues: [], value: void 0 };
2099
2099
  }
2100
- return result;
2100
+ return result2;
2101
2101
  }
2102
2102
  function handleDefaultResult(payload, def) {
2103
2103
  if (payload.value === void 0) {
@@ -2123,24 +2123,24 @@ function handlePipeResult(left, next, ctx) {
2123
2123
  }
2124
2124
  return next._zod.run({ value: left.value, issues: left.issues }, ctx);
2125
2125
  }
2126
- function handleCodecAResult(result, def, ctx) {
2127
- if (result.issues.length) {
2128
- result.aborted = true;
2129
- return result;
2126
+ function handleCodecAResult(result2, def, ctx) {
2127
+ if (result2.issues.length) {
2128
+ result2.aborted = true;
2129
+ return result2;
2130
2130
  }
2131
2131
  const direction = ctx.direction || "forward";
2132
2132
  if (direction === "forward") {
2133
- const transformed = def.transform(result.value, result);
2133
+ const transformed = def.transform(result2.value, result2);
2134
2134
  if (transformed instanceof Promise) {
2135
- return transformed.then((value) => handleCodecTxResult(result, value, def.out, ctx));
2135
+ return transformed.then((value) => handleCodecTxResult(result2, value, def.out, ctx));
2136
2136
  }
2137
- return handleCodecTxResult(result, transformed, def.out, ctx);
2137
+ return handleCodecTxResult(result2, transformed, def.out, ctx);
2138
2138
  } else {
2139
- const transformed = def.reverseTransform(result.value, result);
2139
+ const transformed = def.reverseTransform(result2.value, result2);
2140
2140
  if (transformed instanceof Promise) {
2141
- return transformed.then((value) => handleCodecTxResult(result, value, def.in, ctx));
2141
+ return transformed.then((value) => handleCodecTxResult(result2, value, def.in, ctx));
2142
2142
  }
2143
- return handleCodecTxResult(result, transformed, def.in, ctx);
2143
+ return handleCodecTxResult(result2, transformed, def.in, ctx);
2144
2144
  }
2145
2145
  }
2146
2146
  function handleCodecTxResult(left, value, nextSchema, ctx) {
@@ -2154,8 +2154,8 @@ function handleReadonlyResult(payload) {
2154
2154
  payload.value = Object.freeze(payload.value);
2155
2155
  return payload;
2156
2156
  }
2157
- function handleRefineResult(result, payload, input2, inst) {
2158
- if (!result) {
2157
+ function handleRefineResult(result2, payload, input2, inst) {
2158
+ if (!result2) {
2159
2159
  const _iss = {
2160
2160
  code: "custom",
2161
2161
  input: input2,
@@ -2269,13 +2269,13 @@ var init_schemas = __esm({
2269
2269
  }
2270
2270
  return handleCanaryResult(canary, payload, ctx);
2271
2271
  }
2272
- const result = inst._zod.parse(payload, ctx);
2273
- if (result instanceof Promise) {
2272
+ const result2 = inst._zod.parse(payload, ctx);
2273
+ if (result2 instanceof Promise) {
2274
2274
  if (ctx.async === false)
2275
2275
  throw new $ZodAsyncError();
2276
- return result.then((result2) => runChecks(result2, checks, ctx));
2276
+ return result2.then((result3) => runChecks(result3, checks, ctx));
2277
2277
  }
2278
- return runChecks(result, checks, ctx);
2278
+ return runChecks(result2, checks, ctx);
2279
2279
  };
2280
2280
  }
2281
2281
  defineLazy(inst, "~standard", () => ({
@@ -2762,14 +2762,14 @@ var init_schemas = __esm({
2762
2762
  const proms = [];
2763
2763
  for (let i2 = 0; i2 < input2.length; i2++) {
2764
2764
  const item = input2[i2];
2765
- const result = def.element._zod.run({
2765
+ const result2 = def.element._zod.run({
2766
2766
  value: item,
2767
2767
  issues: []
2768
2768
  }, ctx);
2769
- if (result instanceof Promise) {
2770
- proms.push(result.then((result2) => handleArrayResult(result2, payload, i2)));
2769
+ if (result2 instanceof Promise) {
2770
+ proms.push(result2.then((result3) => handleArrayResult(result3, payload, i2)));
2771
2771
  } else {
2772
- handleArrayResult(result, payload, i2);
2772
+ handleArrayResult(result2, payload, i2);
2773
2773
  }
2774
2774
  }
2775
2775
  if (proms.length) {
@@ -2966,17 +2966,17 @@ var init_schemas = __esm({
2966
2966
  let async = false;
2967
2967
  const results = [];
2968
2968
  for (const option of def.options) {
2969
- const result = option._zod.run({
2969
+ const result2 = option._zod.run({
2970
2970
  value: payload.value,
2971
2971
  issues: []
2972
2972
  }, ctx);
2973
- if (result instanceof Promise) {
2974
- results.push(result);
2973
+ if (result2 instanceof Promise) {
2974
+ results.push(result2);
2975
2975
  async = true;
2976
2976
  } else {
2977
- if (result.issues.length === 0)
2978
- return result;
2979
- results.push(result);
2977
+ if (result2.issues.length === 0)
2978
+ return result2;
2979
+ results.push(result2);
2980
2980
  }
2981
2981
  }
2982
2982
  if (!async)
@@ -2998,15 +2998,15 @@ var init_schemas = __esm({
2998
2998
  let async = false;
2999
2999
  const results = [];
3000
3000
  for (const option of def.options) {
3001
- const result = option._zod.run({
3001
+ const result2 = option._zod.run({
3002
3002
  value: payload.value,
3003
3003
  issues: []
3004
3004
  }, ctx);
3005
- if (result instanceof Promise) {
3006
- results.push(result);
3005
+ if (result2 instanceof Promise) {
3006
+ results.push(result2);
3007
3007
  async = true;
3008
3008
  } else {
3009
- results.push(result);
3009
+ results.push(result2);
3010
3010
  }
3011
3011
  }
3012
3012
  if (!async)
@@ -3135,28 +3135,28 @@ var init_schemas = __esm({
3135
3135
  if (i2 >= optStart)
3136
3136
  continue;
3137
3137
  }
3138
- const result = item._zod.run({
3138
+ const result2 = item._zod.run({
3139
3139
  value: input2[i2],
3140
3140
  issues: []
3141
3141
  }, ctx);
3142
- if (result instanceof Promise) {
3143
- proms.push(result.then((result2) => handleTupleResult(result2, payload, i2)));
3142
+ if (result2 instanceof Promise) {
3143
+ proms.push(result2.then((result3) => handleTupleResult(result3, payload, i2)));
3144
3144
  } else {
3145
- handleTupleResult(result, payload, i2);
3145
+ handleTupleResult(result2, payload, i2);
3146
3146
  }
3147
3147
  }
3148
3148
  if (def.rest) {
3149
3149
  const rest = input2.slice(items.length);
3150
3150
  for (const el of rest) {
3151
3151
  i2++;
3152
- const result = def.rest._zod.run({
3152
+ const result2 = def.rest._zod.run({
3153
3153
  value: el,
3154
3154
  issues: []
3155
3155
  }, ctx);
3156
- if (result instanceof Promise) {
3157
- proms.push(result.then((result2) => handleTupleResult(result2, payload, i2)));
3156
+ if (result2 instanceof Promise) {
3157
+ proms.push(result2.then((result3) => handleTupleResult(result3, payload, i2)));
3158
3158
  } else {
3159
- handleTupleResult(result, payload, i2);
3159
+ handleTupleResult(result2, payload, i2);
3160
3160
  }
3161
3161
  }
3162
3162
  }
@@ -3186,19 +3186,19 @@ var init_schemas = __esm({
3186
3186
  for (const key of values2) {
3187
3187
  if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
3188
3188
  recordKeys.add(typeof key === "number" ? key.toString() : key);
3189
- const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
3190
- if (result instanceof Promise) {
3191
- proms.push(result.then((result2) => {
3192
- if (result2.issues.length) {
3193
- payload.issues.push(...prefixIssues(key, result2.issues));
3189
+ const result2 = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
3190
+ if (result2 instanceof Promise) {
3191
+ proms.push(result2.then((result3) => {
3192
+ if (result3.issues.length) {
3193
+ payload.issues.push(...prefixIssues(key, result3.issues));
3194
3194
  }
3195
- payload.value[key] = result2.value;
3195
+ payload.value[key] = result3.value;
3196
3196
  }));
3197
3197
  } else {
3198
- if (result.issues.length) {
3199
- payload.issues.push(...prefixIssues(key, result.issues));
3198
+ if (result2.issues.length) {
3199
+ payload.issues.push(...prefixIssues(key, result2.issues));
3200
3200
  }
3201
- payload.value[key] = result.value;
3201
+ payload.value[key] = result2.value;
3202
3202
  }
3203
3203
  }
3204
3204
  }
@@ -3251,19 +3251,19 @@ var init_schemas = __esm({
3251
3251
  }
3252
3252
  continue;
3253
3253
  }
3254
- const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
3255
- if (result instanceof Promise) {
3256
- proms.push(result.then((result2) => {
3257
- if (result2.issues.length) {
3258
- payload.issues.push(...prefixIssues(key, result2.issues));
3254
+ const result2 = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
3255
+ if (result2 instanceof Promise) {
3256
+ proms.push(result2.then((result3) => {
3257
+ if (result3.issues.length) {
3258
+ payload.issues.push(...prefixIssues(key, result3.issues));
3259
3259
  }
3260
- payload.value[keyResult.value] = result2.value;
3260
+ payload.value[keyResult.value] = result3.value;
3261
3261
  }));
3262
3262
  } else {
3263
- if (result.issues.length) {
3264
- payload.issues.push(...prefixIssues(key, result.issues));
3263
+ if (result2.issues.length) {
3264
+ payload.issues.push(...prefixIssues(key, result2.issues));
3265
3265
  }
3266
- payload.value[keyResult.value] = result.value;
3266
+ payload.value[keyResult.value] = result2.value;
3267
3267
  }
3268
3268
  }
3269
3269
  }
@@ -3320,11 +3320,11 @@ var init_schemas = __esm({
3320
3320
  const proms = [];
3321
3321
  payload.value = /* @__PURE__ */ new Set();
3322
3322
  for (const item of input2) {
3323
- const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
3324
- if (result instanceof Promise) {
3325
- proms.push(result.then((result2) => handleSetResult(result2, payload)));
3323
+ const result2 = def.valueType._zod.run({ value: item, issues: [] }, ctx);
3324
+ if (result2 instanceof Promise) {
3325
+ proms.push(result2.then((result3) => handleSetResult(result3, payload)));
3326
3326
  } else
3327
- handleSetResult(result, payload);
3327
+ handleSetResult(result2, payload);
3328
3328
  }
3329
3329
  if (proms.length)
3330
3330
  return Promise.all(proms).then(() => payload);
@@ -3422,10 +3422,10 @@ var init_schemas = __esm({
3422
3422
  });
3423
3423
  inst._zod.parse = (payload, ctx) => {
3424
3424
  if (def.innerType._zod.optin === "optional") {
3425
- const result = def.innerType._zod.run(payload, ctx);
3426
- if (result instanceof Promise)
3427
- return result.then((r3) => handleOptionalResult(r3, payload.value));
3428
- return handleOptionalResult(result, payload.value);
3425
+ const result2 = def.innerType._zod.run(payload, ctx);
3426
+ if (result2 instanceof Promise)
3427
+ return result2.then((r3) => handleOptionalResult(r3, payload.value));
3428
+ return handleOptionalResult(result2, payload.value);
3429
3429
  }
3430
3430
  if (payload.value === void 0) {
3431
3431
  return payload;
@@ -3470,11 +3470,11 @@ var init_schemas = __esm({
3470
3470
  payload.value = def.defaultValue;
3471
3471
  return payload;
3472
3472
  }
3473
- const result = def.innerType._zod.run(payload, ctx);
3474
- if (result instanceof Promise) {
3475
- return result.then((result2) => handleDefaultResult(result2, def));
3473
+ const result2 = def.innerType._zod.run(payload, ctx);
3474
+ if (result2 instanceof Promise) {
3475
+ return result2.then((result3) => handleDefaultResult(result3, def));
3476
3476
  }
3477
- return handleDefaultResult(result, def);
3477
+ return handleDefaultResult(result2, def);
3478
3478
  };
3479
3479
  });
3480
3480
  $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
@@ -3498,11 +3498,11 @@ var init_schemas = __esm({
3498
3498
  return v2 ? new Set([...v2].filter((x2) => x2 !== void 0)) : void 0;
3499
3499
  });
3500
3500
  inst._zod.parse = (payload, ctx) => {
3501
- const result = def.innerType._zod.run(payload, ctx);
3502
- if (result instanceof Promise) {
3503
- return result.then((result2) => handleNonOptionalResult(result2, inst));
3501
+ const result2 = def.innerType._zod.run(payload, ctx);
3502
+ if (result2 instanceof Promise) {
3503
+ return result2.then((result3) => handleNonOptionalResult(result3, inst));
3504
3504
  }
3505
- return handleNonOptionalResult(result, inst);
3505
+ return handleNonOptionalResult(result2, inst);
3506
3506
  };
3507
3507
  });
3508
3508
  $ZodSuccess = /* @__PURE__ */ $constructor("$ZodSuccess", (inst, def) => {
@@ -3511,14 +3511,14 @@ var init_schemas = __esm({
3511
3511
  if (ctx.direction === "backward") {
3512
3512
  throw new $ZodEncodeError("ZodSuccess");
3513
3513
  }
3514
- const result = def.innerType._zod.run(payload, ctx);
3515
- if (result instanceof Promise) {
3516
- return result.then((result2) => {
3517
- payload.value = result2.issues.length === 0;
3514
+ const result2 = def.innerType._zod.run(payload, ctx);
3515
+ if (result2 instanceof Promise) {
3516
+ return result2.then((result3) => {
3517
+ payload.value = result3.issues.length === 0;
3518
3518
  return payload;
3519
3519
  });
3520
3520
  }
3521
- payload.value = result.issues.length === 0;
3521
+ payload.value = result2.issues.length === 0;
3522
3522
  return payload;
3523
3523
  };
3524
3524
  });
@@ -3531,15 +3531,15 @@ var init_schemas = __esm({
3531
3531
  if (ctx.direction === "backward") {
3532
3532
  return def.innerType._zod.run(payload, ctx);
3533
3533
  }
3534
- const result = def.innerType._zod.run(payload, ctx);
3535
- if (result instanceof Promise) {
3536
- return result.then((result2) => {
3537
- payload.value = result2.value;
3538
- if (result2.issues.length) {
3534
+ const result2 = def.innerType._zod.run(payload, ctx);
3535
+ if (result2 instanceof Promise) {
3536
+ return result2.then((result3) => {
3537
+ payload.value = result3.value;
3538
+ if (result3.issues.length) {
3539
3539
  payload.value = def.catchValue({
3540
3540
  ...payload,
3541
3541
  error: {
3542
- issues: result2.issues.map((iss) => finalizeIssue(iss, ctx, config()))
3542
+ issues: result3.issues.map((iss) => finalizeIssue(iss, ctx, config()))
3543
3543
  },
3544
3544
  input: payload.value
3545
3545
  });
@@ -3548,12 +3548,12 @@ var init_schemas = __esm({
3548
3548
  return payload;
3549
3549
  });
3550
3550
  }
3551
- payload.value = result.value;
3552
- if (result.issues.length) {
3551
+ payload.value = result2.value;
3552
+ if (result2.issues.length) {
3553
3553
  payload.value = def.catchValue({
3554
3554
  ...payload,
3555
3555
  error: {
3556
- issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))
3556
+ issues: result2.issues.map((iss) => finalizeIssue(iss, ctx, config()))
3557
3557
  },
3558
3558
  input: payload.value
3559
3559
  });
@@ -3631,11 +3631,11 @@ var init_schemas = __esm({
3631
3631
  if (ctx.direction === "backward") {
3632
3632
  return def.innerType._zod.run(payload, ctx);
3633
3633
  }
3634
- const result = def.innerType._zod.run(payload, ctx);
3635
- if (result instanceof Promise) {
3636
- return result.then(handleReadonlyResult);
3634
+ const result2 = def.innerType._zod.run(payload, ctx);
3635
+ if (result2 instanceof Promise) {
3636
+ return result2.then(handleReadonlyResult);
3637
3637
  }
3638
- return handleReadonlyResult(result);
3638
+ return handleReadonlyResult(result2);
3639
3639
  };
3640
3640
  });
3641
3641
  $ZodTemplateLiteral = /* @__PURE__ */ $constructor("$ZodTemplateLiteral", (inst, def) => {
@@ -3693,11 +3693,11 @@ var init_schemas = __esm({
3693
3693
  }
3694
3694
  return function(...args) {
3695
3695
  const parsedArgs = inst._def.input ? parse(inst._def.input, args) : args;
3696
- const result = Reflect.apply(func, this, parsedArgs);
3696
+ const result2 = Reflect.apply(func, this, parsedArgs);
3697
3697
  if (inst._def.output) {
3698
- return parse(inst._def.output, result);
3698
+ return parse(inst._def.output, result2);
3699
3699
  }
3700
- return result;
3700
+ return result2;
3701
3701
  };
3702
3702
  };
3703
3703
  inst.implementAsync = (func) => {
@@ -3706,11 +3706,11 @@ var init_schemas = __esm({
3706
3706
  }
3707
3707
  return async function(...args) {
3708
3708
  const parsedArgs = inst._def.input ? await parseAsync(inst._def.input, args) : args;
3709
- const result = await Reflect.apply(func, this, parsedArgs);
3709
+ const result2 = await Reflect.apply(func, this, parsedArgs);
3710
3710
  if (inst._def.output) {
3711
- return await parseAsync(inst._def.output, result);
3711
+ return await parseAsync(inst._def.output, result2);
3712
3712
  }
3713
- return result;
3713
+ return result2;
3714
3714
  };
3715
3715
  };
3716
3716
  inst._zod.parse = (payload, _ctx) => {
@@ -7008,12 +7008,12 @@ var init_lt = __esm({
7008
7008
  }
7009
7009
  };
7010
7010
  function getSizing(origin, unitType, inclusive, targetShouldBe) {
7011
- const result = Sizable[origin] ?? null;
7012
- if (result === null)
7013
- return result;
7011
+ const result2 = Sizable[origin] ?? null;
7012
+ if (result2 === null)
7013
+ return result2;
7014
7014
  return {
7015
- unit: result.unit[unitType],
7016
- verb: result.verb[targetShouldBe][inclusive ? "inclusive" : "notInclusive"]
7015
+ unit: result2.unit[unitType],
7016
+ verb: result2.verb[targetShouldBe][inclusive ? "inclusive" : "notInclusive"]
7017
7017
  };
7018
7018
  }
7019
7019
  const FormatDictionary = {
@@ -10855,11 +10855,11 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
10855
10855
  }
10856
10856
  return seen.schema;
10857
10857
  }
10858
- const result = { schema: {}, count: 1, cycle: void 0, path: _params.path };
10859
- ctx.seen.set(schema, result);
10858
+ const result2 = { schema: {}, count: 1, cycle: void 0, path: _params.path };
10859
+ ctx.seen.set(schema, result2);
10860
10860
  const overrideSchema = schema._zod.toJSONSchema?.();
10861
10861
  if (overrideSchema) {
10862
- result.schema = overrideSchema;
10862
+ result2.schema = overrideSchema;
10863
10863
  } else {
10864
10864
  const params = {
10865
10865
  ..._params,
@@ -10867,9 +10867,9 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
10867
10867
  path: _params.path
10868
10868
  };
10869
10869
  if (schema._zod.processJSONSchema) {
10870
- schema._zod.processJSONSchema(ctx, result.schema, params);
10870
+ schema._zod.processJSONSchema(ctx, result2.schema, params);
10871
10871
  } else {
10872
- const _json = result.schema;
10872
+ const _json = result2.schema;
10873
10873
  const processor = ctx.processors[def.type];
10874
10874
  if (!processor) {
10875
10875
  throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
@@ -10878,22 +10878,22 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
10878
10878
  }
10879
10879
  const parent = schema._zod.parent;
10880
10880
  if (parent) {
10881
- if (!result.ref)
10882
- result.ref = parent;
10881
+ if (!result2.ref)
10882
+ result2.ref = parent;
10883
10883
  process2(parent, ctx, params);
10884
10884
  ctx.seen.get(parent).isParent = true;
10885
10885
  }
10886
10886
  }
10887
10887
  const meta3 = ctx.metadataRegistry.get(schema);
10888
10888
  if (meta3)
10889
- Object.assign(result.schema, meta3);
10889
+ Object.assign(result2.schema, meta3);
10890
10890
  if (ctx.io === "input" && isTransforming(schema)) {
10891
- delete result.schema.examples;
10892
- delete result.schema.default;
10891
+ delete result2.schema.examples;
10892
+ delete result2.schema.default;
10893
10893
  }
10894
- if (ctx.io === "input" && result.schema._prefault)
10895
- (_a2 = result.schema).default ?? (_a2.default = result.schema._prefault);
10896
- delete result.schema._prefault;
10894
+ if (ctx.io === "input" && result2.schema._prefault)
10895
+ (_a2 = result2.schema).default ?? (_a2.default = result2.schema._prefault);
10896
+ delete result2.schema._prefault;
10897
10897
  const _result = ctx.seen.get(schema);
10898
10898
  return _result.schema;
10899
10899
  }
@@ -11056,13 +11056,13 @@ function finalize(ctx, schema) {
11056
11056
  for (const entry of [...ctx.seen.entries()].reverse()) {
11057
11057
  flattenRef(entry[0]);
11058
11058
  }
11059
- const result = {};
11059
+ const result2 = {};
11060
11060
  if (ctx.target === "draft-2020-12") {
11061
- result.$schema = "https://json-schema.org/draft/2020-12/schema";
11061
+ result2.$schema = "https://json-schema.org/draft/2020-12/schema";
11062
11062
  } else if (ctx.target === "draft-07") {
11063
- result.$schema = "http://json-schema.org/draft-07/schema#";
11063
+ result2.$schema = "http://json-schema.org/draft-07/schema#";
11064
11064
  } else if (ctx.target === "draft-04") {
11065
- result.$schema = "http://json-schema.org/draft-04/schema#";
11065
+ result2.$schema = "http://json-schema.org/draft-04/schema#";
11066
11066
  } else if (ctx.target === "openapi-3.0") {
11067
11067
  } else {
11068
11068
  }
@@ -11070,9 +11070,9 @@ function finalize(ctx, schema) {
11070
11070
  const id = ctx.external.registry.get(schema)?.id;
11071
11071
  if (!id)
11072
11072
  throw new Error("Schema is missing an `id` property");
11073
- result.$id = ctx.external.uri(id);
11073
+ result2.$id = ctx.external.uri(id);
11074
11074
  }
11075
- Object.assign(result, root.def ?? root.schema);
11075
+ Object.assign(result2, root.def ?? root.schema);
11076
11076
  const defs = ctx.external?.defs ?? {};
11077
11077
  for (const entry of ctx.seen.entries()) {
11078
11078
  const seen = entry[1];
@@ -11084,14 +11084,14 @@ function finalize(ctx, schema) {
11084
11084
  } else {
11085
11085
  if (Object.keys(defs).length > 0) {
11086
11086
  if (ctx.target === "draft-2020-12") {
11087
- result.$defs = defs;
11087
+ result2.$defs = defs;
11088
11088
  } else {
11089
- result.definitions = defs;
11089
+ result2.definitions = defs;
11090
11090
  }
11091
11091
  }
11092
11092
  }
11093
11093
  try {
11094
- const finalized = JSON.parse(JSON.stringify(result));
11094
+ const finalized = JSON.parse(JSON.stringify(result2));
11095
11095
  Object.defineProperty(finalized, "~standard", {
11096
11096
  value: {
11097
11097
  ...schema["~standard"],
@@ -11811,8 +11811,8 @@ var init_json_schema_generator = __esm({
11811
11811
  this.ctx.external = _params.external;
11812
11812
  }
11813
11813
  extractDefs(this.ctx, schema);
11814
- const result = finalize(this.ctx, schema);
11815
- const { "~standard": _3, ...plainResult } = result;
11814
+ const result2 = finalize(this.ctx, schema);
11815
+ const { "~standard": _3, ...plainResult } = result2;
11816
11816
  return plainResult;
11817
11817
  }
11818
11818
  };
@@ -13588,13 +13588,13 @@ function resolveRef(ref, ctx) {
13588
13588
  if (!ref.startsWith("#")) {
13589
13589
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
13590
13590
  }
13591
- const path14 = ref.slice(1).split("/").filter(Boolean);
13592
- if (path14.length === 0) {
13591
+ const path15 = ref.slice(1).split("/").filter(Boolean);
13592
+ if (path15.length === 0) {
13593
13593
  return ctx.rootSchema;
13594
13594
  }
13595
13595
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
13596
- if (path14[0] === defsKey) {
13597
- const key = path14[1];
13596
+ if (path15[0] === defsKey) {
13597
+ const key = path15[1];
13598
13598
  if (!key || !ctx.defs[key]) {
13599
13599
  throw new Error(`Reference not found: ${ref}`);
13600
13600
  }
@@ -13819,11 +13819,11 @@ function convertBaseSchema(schema, ctx) {
13819
13819
  } else if (schemasToIntersect.length === 1) {
13820
13820
  zodSchema = schemasToIntersect[0];
13821
13821
  } else {
13822
- let result = z.intersection(schemasToIntersect[0], schemasToIntersect[1]);
13822
+ let result2 = z.intersection(schemasToIntersect[0], schemasToIntersect[1]);
13823
13823
  for (let i2 = 2; i2 < schemasToIntersect.length; i2++) {
13824
- result = z.intersection(result, schemasToIntersect[i2]);
13824
+ result2 = z.intersection(result2, schemasToIntersect[i2]);
13825
13825
  }
13826
- zodSchema = result;
13826
+ zodSchema = result2;
13827
13827
  }
13828
13828
  break;
13829
13829
  }
@@ -13914,12 +13914,12 @@ function convertSchema(schema, ctx) {
13914
13914
  if (schema.allOf.length === 0) {
13915
13915
  baseSchema = hasExplicitType ? baseSchema : z.any();
13916
13916
  } else {
13917
- let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
13917
+ let result2 = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
13918
13918
  const startIdx = hasExplicitType ? 0 : 1;
13919
13919
  for (let i2 = startIdx; i2 < schema.allOf.length; i2++) {
13920
- result = z.intersection(result, convertSchema(schema.allOf[i2], ctx));
13920
+ result2 = z.intersection(result2, convertSchema(schema.allOf[i2], ctx));
13921
13921
  }
13922
- baseSchema = result;
13922
+ baseSchema = result2;
13923
13923
  }
13924
13924
  }
13925
13925
  if (schema.nullable === true && ctx.version === "openapi-3.0") {
@@ -14926,8 +14926,8 @@ var init_parseUtil = __esm({
14926
14926
  init_errors3();
14927
14927
  init_en2();
14928
14928
  makeIssue = (params) => {
14929
- const { data, path: path14, errorMaps, issueData } = params;
14930
- const fullPath = [...path14, ...issueData.path || []];
14929
+ const { data, path: path15, errorMaps, issueData } = params;
14930
+ const fullPath = [...path15, ...issueData.path || []];
14931
14931
  const fullIssue = {
14932
14932
  ...issueData,
14933
14933
  path: fullPath
@@ -15235,11 +15235,11 @@ var init_types = __esm({
15235
15235
  init_parseUtil();
15236
15236
  init_util2();
15237
15237
  ParseInputLazyPath = class {
15238
- constructor(parent, value, path14, key) {
15238
+ constructor(parent, value, path15, key) {
15239
15239
  this._cachedPath = [];
15240
15240
  this.parent = parent;
15241
15241
  this.data = value;
15242
- this._path = path14;
15242
+ this._path = path15;
15243
15243
  this._key = key;
15244
15244
  }
15245
15245
  get path() {
@@ -15253,9 +15253,9 @@ var init_types = __esm({
15253
15253
  return this._cachedPath;
15254
15254
  }
15255
15255
  };
15256
- handleResult = (ctx, result) => {
15257
- if (isValid(result)) {
15258
- return { success: true, data: result.value };
15256
+ handleResult = (ctx, result2) => {
15257
+ if (isValid(result2)) {
15258
+ return { success: true, data: result2.value };
15259
15259
  } else {
15260
15260
  if (!ctx.common.issues.length) {
15261
15261
  throw new Error("Validation failed but no issues detected.");
@@ -15303,21 +15303,21 @@ var init_types = __esm({
15303
15303
  };
15304
15304
  }
15305
15305
  _parseSync(input2) {
15306
- const result = this._parse(input2);
15307
- if (isAsync(result)) {
15306
+ const result2 = this._parse(input2);
15307
+ if (isAsync(result2)) {
15308
15308
  throw new Error("Synchronous parse encountered promise.");
15309
15309
  }
15310
- return result;
15310
+ return result2;
15311
15311
  }
15312
15312
  _parseAsync(input2) {
15313
- const result = this._parse(input2);
15314
- return Promise.resolve(result);
15313
+ const result2 = this._parse(input2);
15314
+ return Promise.resolve(result2);
15315
15315
  }
15316
15316
  parse(data, params) {
15317
- const result = this.safeParse(data, params);
15318
- if (result.success)
15319
- return result.data;
15320
- throw result.error;
15317
+ const result2 = this.safeParse(data, params);
15318
+ if (result2.success)
15319
+ return result2.data;
15320
+ throw result2.error;
15321
15321
  }
15322
15322
  safeParse(data, params) {
15323
15323
  const ctx = {
@@ -15332,8 +15332,8 @@ var init_types = __esm({
15332
15332
  data,
15333
15333
  parsedType: getParsedType2(data)
15334
15334
  };
15335
- const result = this._parseSync({ data, path: ctx.path, parent: ctx });
15336
- return handleResult(ctx, result);
15335
+ const result2 = this._parseSync({ data, path: ctx.path, parent: ctx });
15336
+ return handleResult(ctx, result2);
15337
15337
  }
15338
15338
  "~validate"(data) {
15339
15339
  const ctx = {
@@ -15349,9 +15349,9 @@ var init_types = __esm({
15349
15349
  };
15350
15350
  if (!this["~standard"].async) {
15351
15351
  try {
15352
- const result = this._parseSync({ data, path: [], parent: ctx });
15353
- return isValid(result) ? {
15354
- value: result.value
15352
+ const result2 = this._parseSync({ data, path: [], parent: ctx });
15353
+ return isValid(result2) ? {
15354
+ value: result2.value
15355
15355
  } : {
15356
15356
  issues: ctx.common.issues
15357
15357
  };
@@ -15365,17 +15365,17 @@ var init_types = __esm({
15365
15365
  };
15366
15366
  }
15367
15367
  }
15368
- return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
15369
- value: result.value
15368
+ return this._parseAsync({ data, path: [], parent: ctx }).then((result2) => isValid(result2) ? {
15369
+ value: result2.value
15370
15370
  } : {
15371
15371
  issues: ctx.common.issues
15372
15372
  });
15373
15373
  }
15374
15374
  async parseAsync(data, params) {
15375
- const result = await this.safeParseAsync(data, params);
15376
- if (result.success)
15377
- return result.data;
15378
- throw result.error;
15375
+ const result2 = await this.safeParseAsync(data, params);
15376
+ if (result2.success)
15377
+ return result2.data;
15378
+ throw result2.error;
15379
15379
  }
15380
15380
  async safeParseAsync(data, params) {
15381
15381
  const ctx = {
@@ -15391,8 +15391,8 @@ var init_types = __esm({
15391
15391
  parsedType: getParsedType2(data)
15392
15392
  };
15393
15393
  const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
15394
- const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
15395
- return handleResult(ctx, result);
15394
+ const result2 = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
15395
+ return handleResult(ctx, result2);
15396
15396
  }
15397
15397
  refine(check2, message) {
15398
15398
  const getIssueProperties = (val) => {
@@ -15405,13 +15405,13 @@ var init_types = __esm({
15405
15405
  }
15406
15406
  };
15407
15407
  return this._refinement((val, ctx) => {
15408
- const result = check2(val);
15408
+ const result2 = check2(val);
15409
15409
  const setError = () => ctx.addIssue({
15410
15410
  code: ZodIssueCode2.custom,
15411
15411
  ...getIssueProperties(val)
15412
15412
  });
15413
- if (typeof Promise !== "undefined" && result instanceof Promise) {
15414
- return result.then((data) => {
15413
+ if (typeof Promise !== "undefined" && result2 instanceof Promise) {
15414
+ return result2.then((data) => {
15415
15415
  if (!data) {
15416
15416
  setError();
15417
15417
  return false;
@@ -15420,7 +15420,7 @@ var init_types = __esm({
15420
15420
  }
15421
15421
  });
15422
15422
  }
15423
- if (!result) {
15423
+ if (!result2) {
15424
15424
  setError();
15425
15425
  return false;
15426
15426
  } else {
@@ -16844,14 +16844,14 @@ var init_types = __esm({
16844
16844
  if (ctx.common.async) {
16845
16845
  return Promise.all([...ctx.data].map((item, i2) => {
16846
16846
  return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i2));
16847
- })).then((result2) => {
16848
- return ParseStatus.mergeArray(status, result2);
16847
+ })).then((result3) => {
16848
+ return ParseStatus.mergeArray(status, result3);
16849
16849
  });
16850
16850
  }
16851
- const result = [...ctx.data].map((item, i2) => {
16851
+ const result2 = [...ctx.data].map((item, i2) => {
16852
16852
  return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i2));
16853
16853
  });
16854
- return ParseStatus.mergeArray(status, result);
16854
+ return ParseStatus.mergeArray(status, result2);
16855
16855
  }
16856
16856
  get element() {
16857
16857
  return this._def.type;
@@ -17231,18 +17231,18 @@ var init_types = __esm({
17231
17231
  const { ctx } = this._processInputParams(input2);
17232
17232
  const options = this._def.options;
17233
17233
  function handleResults(results) {
17234
- for (const result of results) {
17235
- if (result.result.status === "valid") {
17236
- return result.result;
17234
+ for (const result2 of results) {
17235
+ if (result2.result.status === "valid") {
17236
+ return result2.result;
17237
17237
  }
17238
17238
  }
17239
- for (const result of results) {
17240
- if (result.result.status === "dirty") {
17241
- ctx.common.issues.push(...result.ctx.common.issues);
17242
- return result.result;
17239
+ for (const result2 of results) {
17240
+ if (result2.result.status === "dirty") {
17241
+ ctx.common.issues.push(...result2.ctx.common.issues);
17242
+ return result2.result;
17243
17243
  }
17244
17244
  }
17245
- const unionErrors = results.map((result) => new ZodError2(result.ctx.common.issues));
17245
+ const unionErrors = results.map((result2) => new ZodError2(result2.ctx.common.issues));
17246
17246
  addIssueToContext(ctx, {
17247
17247
  code: ZodIssueCode2.invalid_union,
17248
17248
  unionErrors
@@ -17280,15 +17280,15 @@ var init_types = __esm({
17280
17280
  },
17281
17281
  parent: null
17282
17282
  };
17283
- const result = option._parseSync({
17283
+ const result2 = option._parseSync({
17284
17284
  data: ctx.data,
17285
17285
  path: ctx.path,
17286
17286
  parent: childCtx
17287
17287
  });
17288
- if (result.status === "valid") {
17289
- return result;
17290
- } else if (result.status === "dirty" && !dirty) {
17291
- dirty = { result, ctx: childCtx };
17288
+ if (result2.status === "valid") {
17289
+ return result2;
17290
+ } else if (result2.status === "dirty" && !dirty) {
17291
+ dirty = { result: result2, ctx: childCtx };
17292
17292
  }
17293
17293
  if (childCtx.common.issues.length) {
17294
17294
  issues.push(childCtx.common.issues);
@@ -17795,9 +17795,9 @@ var init_types = __esm({
17795
17795
  error48.addIssue(makeArgsIssue(args, e2));
17796
17796
  throw error48;
17797
17797
  });
17798
- const result = await Reflect.apply(fn, this, parsedArgs);
17799
- const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e2) => {
17800
- error48.addIssue(makeReturnsIssue(result, e2));
17798
+ const result2 = await Reflect.apply(fn, this, parsedArgs);
17799
+ const parsedReturns = await me._def.returns._def.type.parseAsync(result2, params).catch((e2) => {
17800
+ error48.addIssue(makeReturnsIssue(result2, e2));
17801
17801
  throw error48;
17802
17802
  });
17803
17803
  return parsedReturns;
@@ -17809,10 +17809,10 @@ var init_types = __esm({
17809
17809
  if (!parsedArgs.success) {
17810
17810
  throw new ZodError2([makeArgsIssue(args, parsedArgs.error)]);
17811
17811
  }
17812
- const result = Reflect.apply(fn, this, parsedArgs.data);
17813
- const parsedReturns = me._def.returns.safeParse(result, params);
17812
+ const result2 = Reflect.apply(fn, this, parsedArgs.data);
17813
+ const parsedReturns = me._def.returns.safeParse(result2, params);
17814
17814
  if (!parsedReturns.success) {
17815
- throw new ZodError2([makeReturnsIssue(result, parsedReturns.error)]);
17815
+ throw new ZodError2([makeReturnsIssue(result2, parsedReturns.error)]);
17816
17816
  }
17817
17817
  return parsedReturns.data;
17818
17818
  });
@@ -18057,43 +18057,43 @@ var init_types = __esm({
18057
18057
  return Promise.resolve(processed).then(async (processed2) => {
18058
18058
  if (status.value === "aborted")
18059
18059
  return INVALID;
18060
- const result = await this._def.schema._parseAsync({
18060
+ const result2 = await this._def.schema._parseAsync({
18061
18061
  data: processed2,
18062
18062
  path: ctx.path,
18063
18063
  parent: ctx
18064
18064
  });
18065
- if (result.status === "aborted")
18065
+ if (result2.status === "aborted")
18066
18066
  return INVALID;
18067
- if (result.status === "dirty")
18068
- return DIRTY(result.value);
18067
+ if (result2.status === "dirty")
18068
+ return DIRTY(result2.value);
18069
18069
  if (status.value === "dirty")
18070
- return DIRTY(result.value);
18071
- return result;
18070
+ return DIRTY(result2.value);
18071
+ return result2;
18072
18072
  });
18073
18073
  } else {
18074
18074
  if (status.value === "aborted")
18075
18075
  return INVALID;
18076
- const result = this._def.schema._parseSync({
18076
+ const result2 = this._def.schema._parseSync({
18077
18077
  data: processed,
18078
18078
  path: ctx.path,
18079
18079
  parent: ctx
18080
18080
  });
18081
- if (result.status === "aborted")
18081
+ if (result2.status === "aborted")
18082
18082
  return INVALID;
18083
- if (result.status === "dirty")
18084
- return DIRTY(result.value);
18083
+ if (result2.status === "dirty")
18084
+ return DIRTY(result2.value);
18085
18085
  if (status.value === "dirty")
18086
- return DIRTY(result.value);
18087
- return result;
18086
+ return DIRTY(result2.value);
18087
+ return result2;
18088
18088
  }
18089
18089
  }
18090
18090
  if (effect.type === "refinement") {
18091
18091
  const executeRefinement = (acc) => {
18092
- const result = effect.refinement(acc, checkCtx);
18092
+ const result2 = effect.refinement(acc, checkCtx);
18093
18093
  if (ctx.common.async) {
18094
- return Promise.resolve(result);
18094
+ return Promise.resolve(result2);
18095
18095
  }
18096
- if (result instanceof Promise) {
18096
+ if (result2 instanceof Promise) {
18097
18097
  throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
18098
18098
  }
18099
18099
  return acc;
@@ -18131,18 +18131,18 @@ var init_types = __esm({
18131
18131
  });
18132
18132
  if (!isValid(base))
18133
18133
  return INVALID;
18134
- const result = effect.transform(base.value, checkCtx);
18135
- if (result instanceof Promise) {
18134
+ const result2 = effect.transform(base.value, checkCtx);
18135
+ if (result2 instanceof Promise) {
18136
18136
  throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
18137
18137
  }
18138
- return { status: status.value, value: result };
18138
+ return { status: status.value, value: result2 };
18139
18139
  } else {
18140
18140
  return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
18141
18141
  if (!isValid(base))
18142
18142
  return INVALID;
18143
- return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
18143
+ return Promise.resolve(effect.transform(base.value, checkCtx)).then((result2) => ({
18144
18144
  status: status.value,
18145
- value: result
18145
+ value: result2
18146
18146
  }));
18147
18147
  });
18148
18148
  }
@@ -18239,18 +18239,18 @@ var init_types = __esm({
18239
18239
  issues: []
18240
18240
  }
18241
18241
  };
18242
- const result = this._def.innerType._parse({
18242
+ const result2 = this._def.innerType._parse({
18243
18243
  data: newCtx.data,
18244
18244
  path: newCtx.path,
18245
18245
  parent: {
18246
18246
  ...newCtx
18247
18247
  }
18248
18248
  });
18249
- if (isAsync(result)) {
18250
- return result.then((result2) => {
18249
+ if (isAsync(result2)) {
18250
+ return result2.then((result3) => {
18251
18251
  return {
18252
18252
  status: "valid",
18253
- value: result2.status === "valid" ? result2.value : this._def.catchValue({
18253
+ value: result3.status === "valid" ? result3.value : this._def.catchValue({
18254
18254
  get error() {
18255
18255
  return new ZodError2(newCtx.common.issues);
18256
18256
  },
@@ -18261,7 +18261,7 @@ var init_types = __esm({
18261
18261
  } else {
18262
18262
  return {
18263
18263
  status: "valid",
18264
- value: result.status === "valid" ? result.value : this._def.catchValue({
18264
+ value: result2.status === "valid" ? result2.value : this._def.catchValue({
18265
18265
  get error() {
18266
18266
  return new ZodError2(newCtx.common.issues);
18267
18267
  },
@@ -18375,14 +18375,14 @@ var init_types = __esm({
18375
18375
  };
18376
18376
  ZodReadonly2 = class extends ZodType2 {
18377
18377
  _parse(input2) {
18378
- const result = this._def.innerType._parse(input2);
18378
+ const result2 = this._def.innerType._parse(input2);
18379
18379
  const freeze = (data) => {
18380
18380
  if (isValid(data)) {
18381
18381
  data.value = Object.freeze(data.value);
18382
18382
  }
18383
18383
  return data;
18384
18384
  };
18385
- return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
18385
+ return isAsync(result2) ? result2.then((data) => freeze(data)) : freeze(result2);
18386
18386
  }
18387
18387
  unwrap() {
18388
18388
  return this._def.innerType;
@@ -18765,13 +18765,13 @@ ${USAGE_LINE}`);
18765
18765
  let type;
18766
18766
  const rawType = values2.type;
18767
18767
  if (typeof rawType === "string" && rawType.length > 0) {
18768
- const result = PackageTypeSchema.safeParse(rawType);
18769
- if (!result.success) {
18768
+ const result2 = PackageTypeSchema.safeParse(rawType);
18769
+ if (!result2.success) {
18770
18770
  throw new Error(
18771
18771
  `Invalid --type value: '${rawType}'. Allowed: ${ALLOWED_PACKAGE_TYPES.join(", ")}`
18772
18772
  );
18773
18773
  }
18774
- type = result.data;
18774
+ type = result2.data;
18775
18775
  }
18776
18776
  return {
18777
18777
  name,
@@ -18783,7 +18783,7 @@ ${USAGE_LINE}`);
18783
18783
  };
18784
18784
  }
18785
18785
  async function runPackageInit(args) {
18786
- const result = await createPackage({
18786
+ const result2 = await createPackage({
18787
18787
  parentDir: args.parentDir ?? process.cwd(),
18788
18788
  name: args.name,
18789
18789
  type: args.type ?? "plugin",
@@ -18791,9 +18791,9 @@ async function runPackageInit(args) {
18791
18791
  author: args.author,
18792
18792
  adapterType: args.adapterType
18793
18793
  });
18794
- console.log(`Created package at: ${result.packagePath}`);
18794
+ console.log(`Created package at: ${result2.packagePath}`);
18795
18795
  console.log("Files written:");
18796
- for (const file2 of result.filesWritten) {
18796
+ for (const file2 of result2.filesWritten) {
18797
18797
  console.log(` - ${file2}`);
18798
18798
  }
18799
18799
  }
@@ -18842,17 +18842,17 @@ function parseSkillFile(filePath, content, schema) {
18842
18842
  filePath
18843
18843
  };
18844
18844
  }
18845
- const result = schema.safeParse(data);
18846
- if (!result.success) {
18845
+ const result2 = schema.safeParse(data);
18846
+ if (!result2.success) {
18847
18847
  return {
18848
18848
  ok: false,
18849
- error: `Invalid frontmatter: ${result.error.message}`,
18849
+ error: `Invalid frontmatter: ${result2.error.message}`,
18850
18850
  filePath
18851
18851
  };
18852
18852
  }
18853
18853
  const dirPath = path2.dirname(filePath);
18854
18854
  const dirName = path2.basename(dirPath);
18855
- const meta3 = result.data;
18855
+ const meta3 = result2.data;
18856
18856
  if (typeof meta3.name === "string" && meta3.name !== dirName) {
18857
18857
  return {
18858
18858
  ok: false,
@@ -18864,7 +18864,7 @@ function parseSkillFile(filePath, content, schema) {
18864
18864
  ok: true,
18865
18865
  definition: {
18866
18866
  name: dirName,
18867
- meta: result.data,
18867
+ meta: result2.data,
18868
18868
  body,
18869
18869
  filePath,
18870
18870
  dirPath
@@ -19246,14 +19246,14 @@ function parseMarketplaceJson(content) {
19246
19246
  error: `Invalid JSON: ${err instanceof Error ? err.message : String(err)}`
19247
19247
  };
19248
19248
  }
19249
- const result = MarketplaceJsonSchema.safeParse(parsed);
19250
- if (!result.success) {
19249
+ const result2 = MarketplaceJsonSchema.safeParse(parsed);
19250
+ if (!result2.success) {
19251
19251
  return {
19252
19252
  ok: false,
19253
- error: `marketplace.json validation failed: ${formatZodIssues(result.error.issues)}`
19253
+ error: `marketplace.json validation failed: ${formatZodIssues(result2.error.issues)}`
19254
19254
  };
19255
19255
  }
19256
- return { ok: true, marketplace: result.data };
19256
+ return { ok: true, marketplace: result2.data };
19257
19257
  }
19258
19258
  function parseDorkosSidecar(content) {
19259
19259
  let parsed;
@@ -19265,34 +19265,45 @@ function parseDorkosSidecar(content) {
19265
19265
  error: `Invalid JSON: ${err instanceof Error ? err.message : String(err)}`
19266
19266
  };
19267
19267
  }
19268
- const result = DorkosSidecarSchema.safeParse(parsed);
19269
- if (!result.success) {
19268
+ const result2 = DorkosSidecarSchema.safeParse(parsed);
19269
+ if (!result2.success) {
19270
19270
  return {
19271
19271
  ok: false,
19272
- error: `dorkos.json validation failed: ${formatZodIssues(result.error.issues)}`
19272
+ error: `dorkos.json validation failed: ${formatZodIssues(result2.error.issues)}`
19273
19273
  };
19274
19274
  }
19275
- return { ok: true, sidecar: result.data };
19275
+ return { ok: true, sidecar: result2.data };
19276
19276
  }
19277
19277
  function formatZodIssues(issues) {
19278
19278
  return issues.map((i2) => `${i2.path.join(".") || "<root>"}: ${i2.message}`).join("; ");
19279
19279
  }
19280
+ var LenientMarketplaceEnvelopeSchema, LenientPluginEntrySchema;
19280
19281
  var init_marketplace_json_parser = __esm({
19281
19282
  "../marketplace/dist/marketplace-json-parser.js"() {
19282
19283
  "use strict";
19284
+ init_zod2();
19283
19285
  init_marketplace_json_schema();
19284
19286
  init_dorkos_sidecar_schema();
19285
19287
  init_merge_marketplace();
19288
+ LenientMarketplaceEnvelopeSchema = external_exports2.object({
19289
+ name: external_exports2.string().min(1).regex(/^[a-z0-9][a-z0-9.-]*$/, "Must be kebab-case (letters, digits, dots, hyphens)"),
19290
+ owner: OwnerSchema,
19291
+ metadata: MetadataSchema.optional(),
19292
+ plugins: external_exports2.array(external_exports2.unknown())
19293
+ }).passthrough();
19294
+ LenientPluginEntrySchema = MarketplaceJsonEntrySchema.extend({
19295
+ name: external_exports2.string().min(1).regex(/^[a-z0-9][a-z0-9.-]*$/, "Must be kebab-case (letters, digits, dots, hyphens)")
19296
+ });
19286
19297
  }
19287
19298
  });
19288
19299
 
19289
19300
  // ../marketplace/dist/cc-validator.js
19290
19301
  function validateAgainstCcSchema(raw) {
19291
- const result = CcMarketplaceJsonSchema.safeParse(raw);
19292
- if (result.success) {
19302
+ const result2 = CcMarketplaceJsonSchema.safeParse(raw);
19303
+ if (result2.success) {
19293
19304
  return { ok: true };
19294
19305
  }
19295
- return { ok: false, errors: result.error.issues };
19306
+ return { ok: false, errors: result2.error.issues };
19296
19307
  }
19297
19308
  var CcSourceSchema, CcAuthorSchema, CcOwnerSchema, CcMetadataSchema, CcMarketplaceJsonEntrySchema, CcMarketplaceJsonSchema;
19298
19309
  var init_cc_validator = __esm({
@@ -19347,30 +19358,40 @@ import { promises as fs3 } from "node:fs";
19347
19358
  import path5 from "node:path";
19348
19359
  async function validatePackage(packagePath) {
19349
19360
  const issues = [];
19350
- const manifestPath = path5.join(packagePath, PACKAGE_MANIFEST_PATH);
19351
- let manifestContent;
19361
+ let manifestRaw;
19362
+ let manifestSource;
19363
+ const dorkManifestPath = path5.join(packagePath, PACKAGE_MANIFEST_PATH);
19364
+ let dorkManifestContent = null;
19352
19365
  try {
19353
- manifestContent = await fs3.readFile(manifestPath, "utf-8");
19366
+ dorkManifestContent = await fs3.readFile(dorkManifestPath, "utf-8");
19354
19367
  } catch {
19355
- issues.push({
19356
- level: "error",
19357
- code: "MANIFEST_MISSING",
19358
- message: `Required file missing: ${PACKAGE_MANIFEST_PATH}`,
19359
- path: PACKAGE_MANIFEST_PATH
19360
- });
19361
- return { ok: false, issues };
19362
19368
  }
19363
- let manifestRaw;
19364
- try {
19365
- manifestRaw = JSON.parse(manifestContent);
19366
- } catch (err) {
19367
- issues.push({
19368
- level: "error",
19369
- code: "MANIFEST_INVALID_JSON",
19370
- message: `Invalid JSON in manifest: ${err instanceof Error ? err.message : String(err)}`,
19371
- path: PACKAGE_MANIFEST_PATH
19372
- });
19373
- return { ok: false, issues };
19369
+ if (dorkManifestContent !== null) {
19370
+ try {
19371
+ manifestRaw = JSON.parse(dorkManifestContent);
19372
+ } catch (err) {
19373
+ issues.push({
19374
+ level: "error",
19375
+ code: "MANIFEST_INVALID_JSON",
19376
+ message: `Invalid JSON in manifest: ${err instanceof Error ? err.message : String(err)}`,
19377
+ path: PACKAGE_MANIFEST_PATH
19378
+ });
19379
+ return { ok: false, issues };
19380
+ }
19381
+ manifestSource = PACKAGE_MANIFEST_PATH;
19382
+ } else {
19383
+ const synthesized = await synthesizeFromCcManifest(packagePath);
19384
+ if (!synthesized) {
19385
+ issues.push({
19386
+ level: "error",
19387
+ code: "MANIFEST_MISSING",
19388
+ message: `Required file missing: ${PACKAGE_MANIFEST_PATH} (no ${CLAUDE_PLUGIN_MANIFEST_PATH} fallback found either)`,
19389
+ path: PACKAGE_MANIFEST_PATH
19390
+ });
19391
+ return { ok: false, issues };
19392
+ }
19393
+ manifestRaw = synthesized;
19394
+ manifestSource = CLAUDE_PLUGIN_MANIFEST_PATH;
19374
19395
  }
19375
19396
  const parseResult = MarketplacePackageManifestSchema.safeParse(manifestRaw);
19376
19397
  if (!parseResult.success) {
@@ -19379,7 +19400,7 @@ async function validatePackage(packagePath) {
19379
19400
  level: "error",
19380
19401
  code: "MANIFEST_SCHEMA_INVALID",
19381
19402
  message: `${issue2.path.join(".") || "<root>"}: ${issue2.message}`,
19382
- path: PACKAGE_MANIFEST_PATH
19403
+ path: manifestSource
19383
19404
  });
19384
19405
  }
19385
19406
  return { ok: false, issues };
@@ -19422,17 +19443,17 @@ async function validateSkillsInDirectory(fullDir, packagePath, issues) {
19422
19443
  const scanResults = await scanSkillDirectory(fullDir, PermissiveSkillFrontmatterSchema, {
19423
19444
  includeMissing: false
19424
19445
  });
19425
- for (const result of scanResults) {
19426
- if (!result.ok) {
19446
+ for (const result2 of scanResults) {
19447
+ if (!result2.ok) {
19427
19448
  issues.push({
19428
19449
  level: "error",
19429
19450
  code: "SKILL_INVALID",
19430
- message: result.error,
19431
- path: path5.relative(packagePath, result.filePath)
19451
+ message: result2.error,
19452
+ path: path5.relative(packagePath, result2.filePath)
19432
19453
  });
19433
19454
  continue;
19434
19455
  }
19435
- const { dirPath, filePath } = result.definition;
19456
+ const { dirPath, filePath } = result2.definition;
19436
19457
  const structureResult = await validateSkillStructure(dirPath);
19437
19458
  if (!structureResult.valid) {
19438
19459
  for (const err of structureResult.errors) {
@@ -19446,6 +19467,32 @@ async function validateSkillsInDirectory(fullDir, packagePath, issues) {
19446
19467
  }
19447
19468
  }
19448
19469
  }
19470
+ async function synthesizeFromCcManifest(packagePath) {
19471
+ const ccPath = path5.join(packagePath, CLAUDE_PLUGIN_MANIFEST_PATH);
19472
+ let content;
19473
+ try {
19474
+ content = await fs3.readFile(ccPath, "utf-8");
19475
+ } catch {
19476
+ return null;
19477
+ }
19478
+ let cc;
19479
+ try {
19480
+ cc = JSON.parse(content);
19481
+ } catch {
19482
+ return null;
19483
+ }
19484
+ return {
19485
+ schemaVersion: 1,
19486
+ name: cc.name,
19487
+ version: cc.version ?? "0.0.0",
19488
+ type: "plugin",
19489
+ description: cc.description ?? String(cc.name ?? "CC plugin"),
19490
+ tags: [],
19491
+ layers: [],
19492
+ requires: [],
19493
+ extensions: []
19494
+ };
19495
+ }
19449
19496
  var SKILL_SOURCE_DIRS, PermissiveSkillFrontmatterSchema;
19450
19497
  var init_package_validator = __esm({
19451
19498
  "../marketplace/dist/package-validator.js"() {
@@ -19478,22 +19525,22 @@ __export(package_validate_command_exports, {
19478
19525
  import path6 from "node:path";
19479
19526
  async function runPackageValidate(args) {
19480
19527
  const packagePath = path6.resolve(args.packagePath ?? process.cwd());
19481
- const result = await validatePackage(packagePath);
19482
- if (result.manifest) {
19528
+ const result2 = await validatePackage(packagePath);
19529
+ if (result2.manifest) {
19483
19530
  console.log(
19484
- `Package: ${result.manifest.name}@${result.manifest.version} (${result.manifest.type})`
19531
+ `Package: ${result2.manifest.name}@${result2.manifest.version} (${result2.manifest.type})`
19485
19532
  );
19486
19533
  }
19487
- if (result.issues.length === 0) {
19534
+ if (result2.issues.length === 0) {
19488
19535
  console.log("\u2713 Package is valid");
19489
19536
  return 0;
19490
19537
  }
19491
- for (const issue2 of result.issues) {
19538
+ for (const issue2 of result2.issues) {
19492
19539
  const prefix = issue2.level === "error" ? "\u2717" : "\u26A0";
19493
19540
  const location = issue2.path ? ` (${issue2.path})` : "";
19494
19541
  console.log(`${prefix} [${issue2.code}] ${issue2.message}${location}`);
19495
19542
  }
19496
- if (result.ok) {
19543
+ if (result2.ok) {
19497
19544
  console.log("\u2713 Package is valid (with warnings)");
19498
19545
  return 0;
19499
19546
  }
@@ -19553,16 +19600,16 @@ function resolveRelativePath(source, context) {
19553
19600
  throw new ResolvePluginSourceError('Relative paths must not contain ".."');
19554
19601
  }
19555
19602
  const startsWithDotSlash = source.startsWith("./");
19556
- let path14;
19603
+ let path15;
19557
19604
  if (startsWithDotSlash) {
19558
- path14 = stripLeadingDotSlash(source);
19605
+ path15 = stripLeadingDotSlash(source);
19559
19606
  } else {
19560
19607
  const pluginRoot = normalizePluginRoot(context.pluginRoot);
19561
- path14 = pluginRoot ? `${pluginRoot}/${source}` : source;
19608
+ path15 = pluginRoot ? `${pluginRoot}/${source}` : source;
19562
19609
  }
19563
19610
  return {
19564
19611
  type: "relative-path",
19565
- path: path14,
19612
+ path: path15,
19566
19613
  marketplaceRoot: context.marketplaceRoot
19567
19614
  };
19568
19615
  }
@@ -20181,14 +20228,14 @@ async function runCacheList() {
20181
20228
  async function runCachePrune(args) {
20182
20229
  try {
20183
20230
  const body = args.keepLastN !== void 0 ? { keepLastN: args.keepLastN } : {};
20184
- const result = await apiCall("POST", "/api/marketplace/cache/prune", body);
20185
- const count = result.removed.length;
20231
+ const result2 = await apiCall("POST", "/api/marketplace/cache/prune", body);
20232
+ const count = result2.removed.length;
20186
20233
  if (count === 0) {
20187
20234
  console.log("Nothing to prune \u2014 cache is already minimal.");
20188
20235
  return 0;
20189
20236
  }
20190
20237
  const noun = count === 1 ? "package" : "packages";
20191
- console.log(`Pruned ${count} cached ${noun}, freed ${formatBytes(result.freedBytes)}.`);
20238
+ console.log(`Pruned ${count} cached ${noun}, freed ${formatBytes(result2.freedBytes)}.`);
20192
20239
  return 0;
20193
20240
  } catch (err) {
20194
20241
  if (err instanceof ApiError) {
@@ -20453,14 +20500,14 @@ async function runInstall(args) {
20453
20500
  return 0;
20454
20501
  }
20455
20502
  }
20456
- const result = await apiCall(
20503
+ const result2 = await apiCall(
20457
20504
  "POST",
20458
20505
  `/api/marketplace/packages/${encodeURIComponent(args.name)}/install`,
20459
20506
  buildRequestBody(args)
20460
20507
  );
20461
- console.log(`Installed ${result.packageName}@${result.version} to ${result.installPath}`);
20462
- if (result.warnings && result.warnings.length > 0) {
20463
- for (const warning of result.warnings) {
20508
+ console.log(`Installed ${result2.packageName}@${result2.version} to ${result2.installPath}`);
20509
+ if (result2.warnings && result2.warnings.length > 0) {
20510
+ for (const warning of result2.warnings) {
20464
20511
  console.log(` warning: ${warning}`);
20465
20512
  }
20466
20513
  }
@@ -20551,16 +20598,16 @@ async function runUninstall(args) {
20551
20598
  const body = {};
20552
20599
  if (args.purge) body.purge = true;
20553
20600
  if (args.projectPath) body.projectPath = args.projectPath;
20554
- const result = await apiCall(
20601
+ const result2 = await apiCall(
20555
20602
  "POST",
20556
20603
  `/api/marketplace/packages/${encodeURIComponent(args.name)}/uninstall`,
20557
20604
  body
20558
20605
  );
20559
- console.log(`Uninstalled ${result.packageName} (${result.removedFiles} entries removed)`);
20560
- if (!args.purge && result.preservedData.length > 0) {
20606
+ console.log(`Uninstalled ${result2.packageName} (${result2.removedFiles} entries removed)`);
20607
+ if (!args.purge && result2.preservedData.length > 0) {
20561
20608
  console.log("Preserved:");
20562
- for (const path14 of result.preservedData) {
20563
- console.log(` ${path14}`);
20609
+ for (const path15 of result2.preservedData) {
20610
+ console.log(` ${path15}`);
20564
20611
  }
20565
20612
  }
20566
20613
  return 0;
@@ -20629,13 +20676,13 @@ async function runUpdate(args) {
20629
20676
  for (const name of targets) {
20630
20677
  const body = { apply: Boolean(args.apply) };
20631
20678
  if (args.projectPath) body.projectPath = args.projectPath;
20632
- const result = await apiCall(
20679
+ const result2 = await apiCall(
20633
20680
  "POST",
20634
20681
  `/api/marketplace/packages/${encodeURIComponent(name)}/update`,
20635
20682
  body
20636
20683
  );
20637
- allChecks.push(...result.checks);
20638
- allApplied.push(...result.applied);
20684
+ allChecks.push(...result2.checks);
20685
+ allApplied.push(...result2.applied);
20639
20686
  }
20640
20687
  renderUpdateChecks(allChecks, Boolean(args.apply));
20641
20688
  if (args.apply && allApplied.length > 0) {
@@ -20945,11 +20992,11 @@ function countPackages(marketplace) {
20945
20992
  return 0;
20946
20993
  }
20947
20994
  async function refreshOne(name) {
20948
- const result = await apiCall(
20995
+ const result2 = await apiCall(
20949
20996
  "POST",
20950
20997
  `/api/marketplace/sources/${encodeURIComponent(name)}/refresh`
20951
20998
  );
20952
- return countPackages(result.marketplace);
20999
+ return countPackages(result2.marketplace);
20953
21000
  }
20954
21001
  function formatSuccess(name, count) {
20955
21002
  return `Refreshed ${name}: ${count} ${count === 1 ? "package" : "packages"}.`;
@@ -21174,20 +21221,20 @@ var require_file_uri_to_path = __commonJS({
21174
21221
  var rest = decodeURI(uri.substring(7));
21175
21222
  var firstSlash = rest.indexOf("/");
21176
21223
  var host = rest.substring(0, firstSlash);
21177
- var path14 = rest.substring(firstSlash + 1);
21224
+ var path15 = rest.substring(firstSlash + 1);
21178
21225
  if ("localhost" == host) host = "";
21179
21226
  if (host) {
21180
21227
  host = sep2 + sep2 + host;
21181
21228
  }
21182
- path14 = path14.replace(/^(.+)\|/, "$1:");
21229
+ path15 = path15.replace(/^(.+)\|/, "$1:");
21183
21230
  if (sep2 == "\\") {
21184
- path14 = path14.replace(/\//g, "\\");
21231
+ path15 = path15.replace(/\//g, "\\");
21185
21232
  }
21186
- if (/^.+\:/.test(path14)) {
21233
+ if (/^.+\:/.test(path15)) {
21187
21234
  } else {
21188
- path14 = sep2 + path14;
21235
+ path15 = sep2 + path15;
21189
21236
  }
21190
- return host + path14;
21237
+ return host + path15;
21191
21238
  }
21192
21239
  }
21193
21240
  });
@@ -21196,18 +21243,18 @@ var require_file_uri_to_path = __commonJS({
21196
21243
  var require_bindings = __commonJS({
21197
21244
  "../../node_modules/.pnpm/bindings@1.5.0/node_modules/bindings/bindings.js"(exports, module) {
21198
21245
  var fs10 = __require("fs");
21199
- var path14 = __require("path");
21200
- var fileURLToPath2 = require_file_uri_to_path();
21201
- var join2 = path14.join;
21202
- var dirname2 = path14.dirname;
21203
- var exists = fs10.accessSync && function(path15) {
21246
+ var path15 = __require("path");
21247
+ var fileURLToPath3 = require_file_uri_to_path();
21248
+ var join2 = path15.join;
21249
+ var dirname2 = path15.dirname;
21250
+ var exists = fs10.accessSync && function(path16) {
21204
21251
  try {
21205
- fs10.accessSync(path15);
21252
+ fs10.accessSync(path16);
21206
21253
  } catch (e2) {
21207
21254
  return false;
21208
21255
  }
21209
21256
  return true;
21210
- } || fs10.existsSync || path14.existsSync;
21257
+ } || fs10.existsSync || path15.existsSync;
21211
21258
  var defaults = {
21212
21259
  arrow: process.env.NODE_BINDINGS_ARROW || " \u2192 ",
21213
21260
  compiled: process.env.NODE_BINDINGS_COMPILED_DIR || "compiled",
@@ -21252,7 +21299,7 @@ var require_bindings = __commonJS({
21252
21299
  if (!opts.module_root) {
21253
21300
  opts.module_root = exports.getRoot(exports.getFileName());
21254
21301
  }
21255
- if (path14.extname(opts.bindings) != ".node") {
21302
+ if (path15.extname(opts.bindings) != ".node") {
21256
21303
  opts.bindings += ".node";
21257
21304
  }
21258
21305
  var requireFunc = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
@@ -21309,7 +21356,7 @@ var require_bindings = __commonJS({
21309
21356
  Error.stackTraceLimit = origSTL;
21310
21357
  var fileSchema = "file://";
21311
21358
  if (fileName.indexOf(fileSchema) === 0) {
21312
- fileName = fileURLToPath2(fileName);
21359
+ fileName = fileURLToPath3(fileName);
21313
21360
  }
21314
21361
  return fileName;
21315
21362
  };
@@ -21453,12 +21500,12 @@ var require_transaction = __commonJS({
21453
21500
  }
21454
21501
  before.run();
21455
21502
  try {
21456
- const result = apply.call(fn, this, arguments);
21457
- if (result && typeof result.then === "function") {
21503
+ const result2 = apply.call(fn, this, arguments);
21504
+ if (result2 && typeof result2.then === "function") {
21458
21505
  throw new TypeError("Transaction function cannot return a promise");
21459
21506
  }
21460
21507
  after.run();
21461
- return result;
21508
+ return result2;
21462
21509
  } catch (ex) {
21463
21510
  if (db.inTransaction) {
21464
21511
  undo.run();
@@ -21491,7 +21538,7 @@ var require_backup = __commonJS({
21491
21538
  "../../node_modules/.pnpm/better-sqlite3@12.8.0/node_modules/better-sqlite3/lib/methods/backup.js"(exports, module) {
21492
21539
  "use strict";
21493
21540
  var fs10 = __require("fs");
21494
- var path14 = __require("path");
21541
+ var path15 = __require("path");
21495
21542
  var { promisify } = __require("util");
21496
21543
  var { cppdb } = require_util();
21497
21544
  var fsAccess = promisify(fs10.access);
@@ -21507,7 +21554,7 @@ var require_backup = __commonJS({
21507
21554
  if (typeof attachedName !== "string") throw new TypeError('Expected the "attached" option to be a string');
21508
21555
  if (!attachedName) throw new TypeError('The "attached" option cannot be an empty string');
21509
21556
  if (handler != null && typeof handler !== "function") throw new TypeError('Expected the "progress" option to be a function');
21510
- await fsAccess(path14.dirname(filename)).catch(() => {
21557
+ await fsAccess(path15.dirname(filename)).catch(() => {
21511
21558
  throw new TypeError("Cannot save backup because the directory does not exist");
21512
21559
  });
21513
21560
  const isNewFile = await fsAccess(filename).then(() => false, () => true);
@@ -21606,7 +21653,7 @@ var require_aggregate = __commonJS({
21606
21653
  const start = "start" in options ? options.start : null;
21607
21654
  const step = getFunctionOption(options, "step", true);
21608
21655
  const inverse = getFunctionOption(options, "inverse", false);
21609
- const result = getFunctionOption(options, "result", false);
21656
+ const result2 = getFunctionOption(options, "result", false);
21610
21657
  const safeIntegers = "safeIntegers" in options ? +getBooleanOption(options, "safeIntegers") : 2;
21611
21658
  const deterministic = getBooleanOption(options, "deterministic");
21612
21659
  const directOnly = getBooleanOption(options, "directOnly");
@@ -21617,7 +21664,7 @@ var require_aggregate = __commonJS({
21617
21664
  if (argCount > 0) argCount -= 1;
21618
21665
  if (argCount > 100) throw new RangeError("User-defined functions cannot have more than 100 arguments");
21619
21666
  }
21620
- this[cppdb].aggregate(start, step, inverse, result, name, argCount, safeIntegers, deterministic, directOnly);
21667
+ this[cppdb].aggregate(start, step, inverse, result2, name, argCount, safeIntegers, deterministic, directOnly);
21621
21668
  return this;
21622
21669
  };
21623
21670
  var getFunctionOption = (options, key, required2) => {
@@ -21813,7 +21860,7 @@ var require_database = __commonJS({
21813
21860
  "../../node_modules/.pnpm/better-sqlite3@12.8.0/node_modules/better-sqlite3/lib/database.js"(exports, module) {
21814
21861
  "use strict";
21815
21862
  var fs10 = __require("fs");
21816
- var path14 = __require("path");
21863
+ var path15 = __require("path");
21817
21864
  var util2 = require_util();
21818
21865
  var SqliteError = require_sqlite_error();
21819
21866
  var DEFAULT_ADDON;
@@ -21849,7 +21896,7 @@ var require_database = __commonJS({
21849
21896
  addon = DEFAULT_ADDON || (DEFAULT_ADDON = require_bindings()("better_sqlite3.node"));
21850
21897
  } else if (typeof nativeBinding === "string") {
21851
21898
  const requireFunc = typeof __non_webpack_require__ === "function" ? __non_webpack_require__ : __require;
21852
- addon = requireFunc(path14.resolve(nativeBinding).replace(/(\.node)?$/, ".node"));
21899
+ addon = requireFunc(path15.resolve(nativeBinding).replace(/(\.node)?$/, ".node"));
21853
21900
  } else {
21854
21901
  addon = nativeBinding;
21855
21902
  }
@@ -21857,7 +21904,7 @@ var require_database = __commonJS({
21857
21904
  addon.setErrorConstructor(SqliteError);
21858
21905
  addon.isInitialized = true;
21859
21906
  }
21860
- if (!anonymous && !filename.startsWith("file:") && !fs10.existsSync(path14.dirname(filename))) {
21907
+ if (!anonymous && !filename.startsWith("file:") && !fs10.existsSync(path15.dirname(filename))) {
21861
21908
  throw new TypeError("Cannot open database because the directory does not exist");
21862
21909
  }
21863
21910
  Object.defineProperties(this, {
@@ -22917,20 +22964,20 @@ function requireSrc() {
22917
22964
  function requirePicocolors() {
22918
22965
  if (hasRequiredPicocolors) return picocolors.exports;
22919
22966
  hasRequiredPicocolors = 1;
22920
- let p = process || {}, argv2 = p.argv || [], env3 = p.env || {};
22921
- let isColorSupported2 = !(!!env3.NO_COLOR || argv2.includes("--no-color")) && (!!env3.FORCE_COLOR || argv2.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env3.TERM !== "dumb" || !!env3.CI);
22967
+ let p = process || {}, argv2 = p.argv || [], env4 = p.env || {};
22968
+ let isColorSupported2 = !(!!env4.NO_COLOR || argv2.includes("--no-color")) && (!!env4.FORCE_COLOR || argv2.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env4.TERM !== "dumb" || !!env4.CI);
22922
22969
  let formatter = (open, close, replace = open) => (input2) => {
22923
22970
  let string4 = "" + input2, index = string4.indexOf(close, open.length);
22924
22971
  return ~index ? open + replaceClose2(string4, close, replace, index) + close : open + string4 + close;
22925
22972
  };
22926
22973
  let replaceClose2 = (string4, close, replace, index) => {
22927
- let result = "", cursor = 0;
22974
+ let result2 = "", cursor = 0;
22928
22975
  do {
22929
- result += string4.substring(cursor, index) + replace;
22976
+ result2 += string4.substring(cursor, index) + replace;
22930
22977
  cursor = index + close.length;
22931
22978
  index = string4.indexOf(close, cursor);
22932
22979
  } while (~index);
22933
- return result + string4.substring(cursor);
22980
+ return result2 + string4.substring(cursor);
22934
22981
  };
22935
22982
  let createColors2 = (enabled = isColorSupported2) => {
22936
22983
  let f3 = enabled ? formatter : () => String;
@@ -23699,12 +23746,12 @@ function stringWidth$1(string4, options = {}) {
23699
23746
  return width;
23700
23747
  }
23701
23748
  function isUnicodeSupported() {
23702
- const { env: env3 } = g$1;
23703
- const { TERM, TERM_PROGRAM } = env3;
23749
+ const { env: env4 } = g$1;
23750
+ const { TERM, TERM_PROGRAM } = env4;
23704
23751
  if (g$1.platform !== "win32") {
23705
23752
  return TERM !== "linux";
23706
23753
  }
23707
- return Boolean(env3.WT_SESSION) || Boolean(env3.TERMINUS_SUBLIME) || env3.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env3.TERMINAL_EMULATOR === "JetBrains-JediTerm";
23754
+ return Boolean(env4.WT_SESSION) || Boolean(env4.TERMINUS_SUBLIME) || env4.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env4.TERMINAL_EMULATOR === "JetBrains-JediTerm";
23708
23755
  }
23709
23756
  function stringWidth(str) {
23710
23757
  const hasICU = typeof Intl === "object";
@@ -23909,6 +23956,84 @@ var init_logger = __esm({
23909
23956
  }
23910
23957
  });
23911
23958
 
23959
+ // ../../apps/server/src/env.ts
23960
+ var boolFlag, serverEnvSchema, result, env3;
23961
+ var init_env = __esm({
23962
+ "../../apps/server/src/env.ts"() {
23963
+ "use strict";
23964
+ init_zod();
23965
+ boolFlag = external_exports.enum(["true", "false"]).default("false").transform((v2) => v2 === "true");
23966
+ serverEnvSchema = external_exports.object({
23967
+ // System
23968
+ HOME: external_exports.string().optional(),
23969
+ GITHUB_TOKEN: external_exports.string().optional(),
23970
+ // Runtime
23971
+ NODE_ENV: external_exports.enum(["development", "production", "test"]).default("development"),
23972
+ DORKOS_PORT: external_exports.coerce.number().int().min(1).max(65535).default(4242),
23973
+ DORKOS_HOST: external_exports.string().default("localhost"),
23974
+ DORKOS_DEFAULT_CWD: external_exports.string().optional(),
23975
+ DORKOS_BOUNDARY: external_exports.string().optional(),
23976
+ DORKOS_LOG_LEVEL: external_exports.coerce.number().int().min(0).max(5).optional(),
23977
+ DORK_HOME: external_exports.string().optional(),
23978
+ DORKOS_VERSION_OVERRIDE: external_exports.string().optional(),
23979
+ CLIENT_DIST_PATH: external_exports.string().optional(),
23980
+ // MCP external server — optional API key for authenticated access
23981
+ MCP_API_KEY: external_exports.string().optional(),
23982
+ // Marketplace MCP — when '1', auto-approves every install/uninstall/create
23983
+ // confirmation request without prompting the user. Used by CI and tests.
23984
+ MARKETPLACE_AUTO_APPROVE: external_exports.string().optional(),
23985
+ // Feature flags (boolean after transform)
23986
+ DORKOS_A2A_ENABLED: boolFlag,
23987
+ DORKOS_TASKS_ENABLED: boolFlag,
23988
+ DORKOS_RELAY_ENABLED: boolFlag,
23989
+ // Activity feed — retention period for pruning (defaults to 30 days in service)
23990
+ DORKOS_ACTIVITY_RETENTION_DAYS: external_exports.coerce.number().int().min(1).optional(),
23991
+ // Test mode — TestModeRuntime is registered instead of ClaudeCodeRuntime
23992
+ DORKOS_TEST_RUNTIME: external_exports.string().optional().transform((v2) => v2 === "true"),
23993
+ // Tunnel (ngrok integration — all optional)
23994
+ TUNNEL_ENABLED: boolFlag,
23995
+ TUNNEL_PORT: external_exports.coerce.number().int().min(1).max(65535).optional(),
23996
+ TUNNEL_AUTH: external_exports.string().optional(),
23997
+ TUNNEL_DOMAIN: external_exports.string().optional(),
23998
+ NGROK_AUTHTOKEN: external_exports.string().optional()
23999
+ });
24000
+ result = serverEnvSchema.safeParse(process.env);
24001
+ if (!result.success) {
24002
+ console.error("\n Missing or invalid environment variables:\n");
24003
+ result.error.issues.forEach((i2) => console.error(` - ${i2.path.join(".")}: ${i2.message}`));
24004
+ console.error("\n Copy .env.example to .env\n");
24005
+ process.exit(1);
24006
+ }
24007
+ env3 = result.data;
24008
+ }
24009
+ });
24010
+
24011
+ // ../../apps/server/src/lib/version.ts
24012
+ import { readFileSync } from "fs";
24013
+ import path11 from "path";
24014
+ import { fileURLToPath } from "url";
24015
+ function resolveVersion() {
24016
+ if (env3.DORKOS_VERSION_OVERRIDE) return env3.DORKOS_VERSION_OVERRIDE;
24017
+ if (true) return "0.36.0";
24018
+ const pkgPath = path11.join(path11.dirname(fileURLToPath(import.meta.url)), "../../package.json");
24019
+ return JSON.parse(readFileSync(pkgPath, "utf-8")).version;
24020
+ }
24021
+ function checkDevBuild(version2) {
24022
+ if (env3.DORKOS_VERSION_OVERRIDE) return false;
24023
+ if (true) return false;
24024
+ return DEV_VERSION_PATTERN.test(version2);
24025
+ }
24026
+ var DEV_VERSION_PATTERN, SERVER_VERSION, IS_DEV_BUILD;
24027
+ var init_version = __esm({
24028
+ "../../apps/server/src/lib/version.ts"() {
24029
+ "use strict";
24030
+ init_env();
24031
+ DEV_VERSION_PATTERN = /^0\.0\.0/;
24032
+ SERVER_VERSION = resolveVersion();
24033
+ IS_DEV_BUILD = checkDevBuild(SERVER_VERSION);
24034
+ }
24035
+ });
24036
+
23912
24037
  // ../../apps/server/src/services/core/config-manager.ts
23913
24038
  var config_manager_exports = {};
23914
24039
  __export(config_manager_exports, {
@@ -23917,17 +24042,25 @@ __export(config_manager_exports, {
23917
24042
  });
23918
24043
  import Conf from "conf";
23919
24044
  import fs7 from "fs";
23920
- import path11 from "path";
24045
+ import path12 from "path";
23921
24046
  function initConfigManager(dorkHome) {
23922
24047
  configManager = new ConfigManager(dorkHome);
23923
24048
  return configManager;
23924
24049
  }
23925
- var jsonSchemaFull, jsonSchemaProperties, confSchema, ConfigManager, configManager;
24050
+ var CONFIG_MIGRATIONS, jsonSchemaFull, jsonSchemaProperties, confSchema, ConfigManager, configManager;
23926
24051
  var init_config_manager = __esm({
23927
24052
  "../../apps/server/src/services/core/config-manager.ts"() {
23928
24053
  init_zod();
23929
24054
  init_config_schema();
23930
24055
  init_logger();
24056
+ init_version();
24057
+ CONFIG_MIGRATIONS = {
24058
+ "1.0.0": (store) => {
24059
+ if (!store.has("version")) {
24060
+ store.set("version", 1);
24061
+ }
24062
+ }
24063
+ };
23931
24064
  jsonSchemaFull = external_exports.toJSONSchema(UserConfigSchema, {
23932
24065
  target: "jsonSchema2019-09"
23933
24066
  });
@@ -23938,24 +24071,24 @@ var init_config_manager = __esm({
23938
24071
  _isFirstRun = false;
23939
24072
  constructor(dorkHome) {
23940
24073
  const configDir = dorkHome;
23941
- const configPath = path11.join(configDir, "config.json");
24074
+ const configPath = path12.join(configDir, "config.json");
23942
24075
  this._isFirstRun = !fs7.existsSync(configPath);
24076
+ const confOptions = {
24077
+ configName: "config",
24078
+ cwd: configDir,
24079
+ schema: confSchema,
24080
+ defaults: USER_CONFIG_DEFAULTS,
24081
+ clearInvalidConfig: false,
24082
+ // `projectVersion` is the app version — sourced from the canonical
24083
+ // version resolver (`lib/version.ts`) which honors
24084
+ // `DORKOS_VERSION_OVERRIDE`, the esbuild-injected CLI version, and the
24085
+ // package.json dev fallback in that order. Migration keys in
24086
+ // CONFIG_MIGRATIONS must be semver strings matching real releases.
24087
+ projectVersion: SERVER_VERSION,
24088
+ migrations: CONFIG_MIGRATIONS
24089
+ };
23943
24090
  try {
23944
- this.store = new Conf({
23945
- configName: "config",
23946
- cwd: configDir,
23947
- schema: confSchema,
23948
- defaults: USER_CONFIG_DEFAULTS,
23949
- clearInvalidConfig: false,
23950
- projectVersion: "1.0.0",
23951
- migrations: {
23952
- "1.0.0": (store) => {
23953
- if (!store.has("version")) {
23954
- store.set("version", 1);
23955
- }
23956
- }
23957
- }
23958
- });
24091
+ this.store = new Conf(confOptions);
23959
24092
  logger.info(`[Config] Loaded from ${configPath} (first run: ${this._isFirstRun})`);
23960
24093
  } catch (_error) {
23961
24094
  if (fs7.existsSync(configPath)) {
@@ -23965,13 +24098,7 @@ var init_config_manager = __esm({
23965
24098
  logger.warn(`Corrupt config backed up to ${backupPath}`);
23966
24099
  logger.warn("Creating fresh config with defaults.");
23967
24100
  }
23968
- this.store = new Conf({
23969
- configName: "config",
23970
- cwd: configDir,
23971
- schema: confSchema,
23972
- defaults: USER_CONFIG_DEFAULTS,
23973
- clearInvalidConfig: false
23974
- });
24101
+ this.store = new Conf(confOptions);
23975
24102
  }
23976
24103
  }
23977
24104
  /** Whether this is the first time the config file has been created */
@@ -23992,12 +24119,12 @@ var init_config_manager = __esm({
23992
24119
  }
23993
24120
  /** Set a nested value via dot-path. Returns warning if key is sensitive. */
23994
24121
  setDot(key, value) {
23995
- const result = {};
24122
+ const result2 = {};
23996
24123
  if (SENSITIVE_CONFIG_KEYS.includes(key)) {
23997
- result.warning = `'${key}' contains sensitive data. Consider using environment variables instead.`;
24124
+ result2.warning = `'${key}' contains sensitive data. Consider using environment variables instead.`;
23998
24125
  }
23999
24126
  this.store.set(key, value);
24000
- return result;
24127
+ return result2;
24001
24128
  }
24002
24129
  /** Get the full config object */
24003
24130
  getAll() {
@@ -24104,9 +24231,9 @@ function handleConfigGet(store, key) {
24104
24231
  }
24105
24232
  function handleConfigSet(store, key, rawValue) {
24106
24233
  const value = parseConfigValue(rawValue);
24107
- const result = store.setDot(key, value);
24108
- if (result.warning) {
24109
- console.warn(`\u26A0 ${result.warning}`);
24234
+ const result2 = store.setDot(key, value);
24235
+ if (result2.warning) {
24236
+ console.warn(`\u26A0 ${result2.warning}`);
24110
24237
  }
24111
24238
  console.log(`Set ${key} = ${value === null ? "null" : String(value)}`);
24112
24239
  }
@@ -24137,13 +24264,13 @@ function handleConfigPath(store) {
24137
24264
  console.log(store.path);
24138
24265
  }
24139
24266
  function handleConfigValidate(store) {
24140
- const result = store.validate();
24141
- if (result.valid) {
24267
+ const result2 = store.validate();
24268
+ if (result2.valid) {
24142
24269
  console.log("Config is valid");
24143
24270
  process.exit(0);
24144
24271
  } else {
24145
24272
  console.error("Config validation failed:");
24146
- for (const err of result.errors ?? []) {
24273
+ for (const err of result2.errors ?? []) {
24147
24274
  console.error(` - ${err}`);
24148
24275
  }
24149
24276
  process.exit(1);
@@ -24204,10 +24331,10 @@ __export(init_wizard_exports, {
24204
24331
  });
24205
24332
  import { input, select, confirm as confirm3 } from "@inquirer/prompts";
24206
24333
  import fs8 from "fs";
24207
- import path12 from "path";
24334
+ import path13 from "path";
24208
24335
  async function runInitWizard(options) {
24209
24336
  const { yes, dorkHome, store } = options;
24210
- const configPath = path12.join(dorkHome, "config.json");
24337
+ const configPath = path13.join(dorkHome, "config.json");
24211
24338
  if (yes) {
24212
24339
  store.reset();
24213
24340
  console.log(`Config initialized with defaults at ${configPath}`);
@@ -24257,7 +24384,7 @@ async function runInitWizard(options) {
24257
24384
  store.setDot("ui.theme", theme);
24258
24385
  store.setDot("tunnel.enabled", tunnelEnabled);
24259
24386
  if (cwd && cwd.trim() !== "") {
24260
- store.setDot("server.cwd", path12.resolve(cwd));
24387
+ store.setDot("server.cwd", path13.resolve(cwd));
24261
24388
  }
24262
24389
  console.log(`
24263
24390
  Config saved to ${configPath}`);
@@ -25428,8 +25555,8 @@ var require_main = __commonJS({
25428
25555
  // src/cli.ts
25429
25556
  import { parseArgs as parseArgs10 } from "node:util";
25430
25557
  import os3, { networkInterfaces } from "os";
25431
- import path13 from "path";
25432
- import { fileURLToPath } from "url";
25558
+ import path14 from "path";
25559
+ import { fileURLToPath as fileURLToPath2 } from "url";
25433
25560
  import fs9 from "fs";
25434
25561
 
25435
25562
  // src/check-claude.ts
@@ -25686,7 +25813,7 @@ if (nodeVersionIssue) {
25686
25813
  console.error(formatDiagnostic(nodeVersionIssue));
25687
25814
  process.exit(1);
25688
25815
  }
25689
- var __dirname = path13.dirname(fileURLToPath(import.meta.url));
25816
+ var __dirname = path14.dirname(fileURLToPath2(import.meta.url));
25690
25817
  if (process.argv[2] === "package") {
25691
25818
  const packageSubcommand = process.argv[3];
25692
25819
  const subArgs = process.argv.slice(4);
@@ -25930,12 +26057,12 @@ Examples:
25930
26057
  process.exit(0);
25931
26058
  }
25932
26059
  if (values.version) {
25933
- console.log("0.34.1");
26060
+ console.log("0.36.0");
25934
26061
  process.exit(0);
25935
26062
  }
25936
26063
  if (values["post-install-check"]) {
25937
26064
  const claudeFound = checkClaude();
25938
- console.log(`dorkos ${"0.34.1"}`);
26065
+ console.log(`dorkos ${"0.36.0"}`);
25939
26066
  if (claudeFound) {
25940
26067
  console.log("Installation verified.");
25941
26068
  } else {
@@ -25944,7 +26071,7 @@ if (values["post-install-check"]) {
25944
26071
  }
25945
26072
  process.exit(0);
25946
26073
  }
25947
- var DORK_HOME = env.DORK_HOME || path13.join(os3.homedir(), ".dork");
26074
+ var DORK_HOME = env.DORK_HOME || path14.join(os3.homedir(), ".dork");
25948
26075
  var subcommand = positionals[0];
25949
26076
  if (subcommand === "cleanup") {
25950
26077
  const { runCleanup: runCleanup2 } = await Promise.resolve().then(() => (init_cleanup_command(), cleanup_command_exports));
@@ -25952,7 +26079,7 @@ if (subcommand === "cleanup") {
25952
26079
  process.exit(process.exitCode ?? 0);
25953
26080
  }
25954
26081
  fs9.mkdirSync(DORK_HOME, { recursive: true });
25955
- fs9.mkdirSync(path13.join(DORK_HOME, "logs"), { recursive: true });
26082
+ fs9.mkdirSync(path14.join(DORK_HOME, "logs"), { recursive: true });
25956
26083
  process.env.DORK_HOME = DORK_HOME;
25957
26084
  if (subcommand === "config") {
25958
26085
  const { initConfigManager: initConfigManager3 } = await Promise.resolve().then(() => (init_config_manager(), config_manager_exports));
@@ -25982,7 +26109,7 @@ if (cliPort) {
25982
26109
  process.env.DORKOS_PORT = configPort ? String(configPort) : String(DEFAULT_PORT);
25983
26110
  }
25984
26111
  process.env.NODE_ENV = "production";
25985
- process.env.CLIENT_DIST_PATH = path13.join(__dirname, "../client");
26112
+ process.env.CLIENT_DIST_PATH = path14.join(__dirname, "../client");
25986
26113
  if (values.tunnel) {
25987
26114
  process.env.TUNNEL_ENABLED = "true";
25988
26115
  } else if (!process.env.TUNNEL_ENABLED && cfgMgr.getDot("tunnel.enabled")) {
@@ -26021,30 +26148,30 @@ if (!process.env.DORKOS_RELAY_ENABLED && cfgMgr.getDot("relay.enabled")) {
26021
26148
  }
26022
26149
  var cliDir = values.dir;
26023
26150
  if (cliDir) {
26024
- process.env.DORKOS_DEFAULT_CWD = path13.resolve(cliDir);
26151
+ process.env.DORKOS_DEFAULT_CWD = path14.resolve(cliDir);
26025
26152
  } else if (!process.env.DORKOS_DEFAULT_CWD) {
26026
26153
  const configCwd = cfgMgr.getDot("server.cwd");
26027
- process.env.DORKOS_DEFAULT_CWD = configCwd ? path13.resolve(configCwd) : process.cwd();
26154
+ process.env.DORKOS_DEFAULT_CWD = configCwd ? path14.resolve(configCwd) : process.cwd();
26028
26155
  }
26029
26156
  var cliBoundary = values.boundary;
26030
26157
  if (cliBoundary) {
26031
- process.env.DORKOS_BOUNDARY = path13.resolve(cliBoundary);
26158
+ process.env.DORKOS_BOUNDARY = path14.resolve(cliBoundary);
26032
26159
  } else if (!process.env.DORKOS_BOUNDARY) {
26033
26160
  const configBoundary = cfgMgr.getDot("server.boundary");
26034
26161
  if (configBoundary) {
26035
- process.env.DORKOS_BOUNDARY = path13.resolve(configBoundary);
26162
+ process.env.DORKOS_BOUNDARY = path14.resolve(configBoundary);
26036
26163
  }
26037
26164
  }
26038
26165
  var boundaryVal = process.env.DORKOS_BOUNDARY;
26039
26166
  var home = os3.homedir();
26040
- if (boundaryVal && !boundaryVal.startsWith(home + path13.sep) && boundaryVal !== home) {
26167
+ if (boundaryVal && !boundaryVal.startsWith(home + path14.sep) && boundaryVal !== home) {
26041
26168
  console.warn(
26042
26169
  `[Warning] Directory boundary "${boundaryVal}" is above home directory "${home}". This grants access to system directories.`
26043
26170
  );
26044
26171
  }
26045
26172
  var effectiveBoundary = process.env.DORKOS_BOUNDARY || home;
26046
26173
  var resolvedDir = process.env.DORKOS_DEFAULT_CWD;
26047
- if (resolvedDir !== effectiveBoundary && !resolvedDir.startsWith(effectiveBoundary + path13.sep)) {
26174
+ if (resolvedDir !== effectiveBoundary && !resolvedDir.startsWith(effectiveBoundary + path14.sep)) {
26048
26175
  console.warn(
26049
26176
  `[Warning] Default CWD "${resolvedDir}" is outside boundary "${effectiveBoundary}". Falling back to boundary root.`
26050
26177
  );
@@ -26052,7 +26179,7 @@ if (resolvedDir !== effectiveBoundary && !resolvedDir.startsWith(effectiveBounda
26052
26179
  }
26053
26180
  var logLevelName = values["log-level"] || env.LOG_LEVEL || cfgMgr.getDot("logging.level") || (env.NODE_ENV === "production" ? "info" : "debug");
26054
26181
  process.env.DORKOS_LOG_LEVEL = String(LOG_LEVEL_MAP[logLevelName] ?? 3);
26055
- var envPath = path13.join(process.env.DORKOS_DEFAULT_CWD, ".env");
26182
+ var envPath = path14.join(process.env.DORKOS_DEFAULT_CWD, ".env");
26056
26183
  if (fs9.existsSync(envPath)) {
26057
26184
  const dotenv = await import("dotenv");
26058
26185
  dotenv.config({ path: envPath, override: false });
@@ -26079,7 +26206,7 @@ var ansiReset = "\x1B[0m";
26079
26206
  console.log("");
26080
26207
  console.log(`${purple}${logo}${ansiReset}`);
26081
26208
  console.log("");
26082
- console.log(` DorkOS v${"0.34.1"}`);
26209
+ console.log(` DorkOS v${"0.36.0"}`);
26083
26210
  console.log(` Local: ${link(localUrl, localUrl)}`);
26084
26211
  var nets = networkInterfaces();
26085
26212
  var networkUrl = null;
@@ -26140,9 +26267,9 @@ if (shouldOpenBrowser && process.stdin.isTTY) {
26140
26267
  }
26141
26268
  });
26142
26269
  }
26143
- checkForUpdate("0.34.1").then((latestVersion) => {
26270
+ checkForUpdate("0.36.0").then((latestVersion) => {
26144
26271
  if (latestVersion) {
26145
- const msg = `Update available: ${"0.34.1"} \u2192 ${latestVersion}`;
26272
+ const msg = `Update available: ${"0.36.0"} \u2192 ${latestVersion}`;
26146
26273
  const cmd = "Run npm install -g dorkos@latest to update";
26147
26274
  const width = Math.max(msg.length, cmd.length) + 6;
26148
26275
  const pad = (s2) => `\u2502 ${s2}${" ".repeat(width - s2.length - 6)} \u2502`;