@mod-computer/cli 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -837,41 +837,41 @@ var init_types = __esm({
837
837
  get description() {
838
838
  return this._def.description;
839
839
  }
840
- _getType(input) {
841
- return getParsedType(input.data);
840
+ _getType(input2) {
841
+ return getParsedType(input2.data);
842
842
  }
843
- _getOrReturnCtx(input, ctx) {
843
+ _getOrReturnCtx(input2, ctx) {
844
844
  return ctx || {
845
- common: input.parent.common,
846
- data: input.data,
847
- parsedType: getParsedType(input.data),
845
+ common: input2.parent.common,
846
+ data: input2.data,
847
+ parsedType: getParsedType(input2.data),
848
848
  schemaErrorMap: this._def.errorMap,
849
- path: input.path,
850
- parent: input.parent
849
+ path: input2.path,
850
+ parent: input2.parent
851
851
  };
852
852
  }
853
- _processInputParams(input) {
853
+ _processInputParams(input2) {
854
854
  return {
855
855
  status: new ParseStatus(),
856
856
  ctx: {
857
- common: input.parent.common,
858
- data: input.data,
859
- parsedType: getParsedType(input.data),
857
+ common: input2.parent.common,
858
+ data: input2.data,
859
+ parsedType: getParsedType(input2.data),
860
860
  schemaErrorMap: this._def.errorMap,
861
- path: input.path,
862
- parent: input.parent
861
+ path: input2.path,
862
+ parent: input2.parent
863
863
  }
864
864
  };
865
865
  }
866
- _parseSync(input) {
867
- const result = this._parse(input);
866
+ _parseSync(input2) {
867
+ const result = this._parse(input2);
868
868
  if (isAsync(result)) {
869
869
  throw new Error("Synchronous parse encountered promise.");
870
870
  }
871
871
  return result;
872
872
  }
873
- _parseAsync(input) {
874
- const result = this._parse(input);
873
+ _parseAsync(input2) {
874
+ const result = this._parse(input2);
875
875
  return Promise.resolve(result);
876
876
  }
877
877
  parse(data, params) {
@@ -1135,13 +1135,13 @@ var init_types = __esm({
1135
1135
  dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
1136
1136
  dateRegex = new RegExp(`^${dateRegexSource}$`);
1137
1137
  ZodString = class _ZodString extends ZodType {
1138
- _parse(input) {
1138
+ _parse(input2) {
1139
1139
  if (this._def.coerce) {
1140
- input.data = String(input.data);
1140
+ input2.data = String(input2.data);
1141
1141
  }
1142
- const parsedType = this._getType(input);
1142
+ const parsedType = this._getType(input2);
1143
1143
  if (parsedType !== ZodParsedType.string) {
1144
- const ctx2 = this._getOrReturnCtx(input);
1144
+ const ctx2 = this._getOrReturnCtx(input2);
1145
1145
  addIssueToContext(ctx2, {
1146
1146
  code: ZodIssueCode.invalid_type,
1147
1147
  expected: ZodParsedType.string,
@@ -1153,8 +1153,8 @@ var init_types = __esm({
1153
1153
  let ctx = void 0;
1154
1154
  for (const check of this._def.checks) {
1155
1155
  if (check.kind === "min") {
1156
- if (input.data.length < check.value) {
1157
- ctx = this._getOrReturnCtx(input, ctx);
1156
+ if (input2.data.length < check.value) {
1157
+ ctx = this._getOrReturnCtx(input2, ctx);
1158
1158
  addIssueToContext(ctx, {
1159
1159
  code: ZodIssueCode.too_small,
1160
1160
  minimum: check.value,
@@ -1166,8 +1166,8 @@ var init_types = __esm({
1166
1166
  status.dirty();
1167
1167
  }
1168
1168
  } else if (check.kind === "max") {
1169
- if (input.data.length > check.value) {
1170
- ctx = this._getOrReturnCtx(input, ctx);
1169
+ if (input2.data.length > check.value) {
1170
+ ctx = this._getOrReturnCtx(input2, ctx);
1171
1171
  addIssueToContext(ctx, {
1172
1172
  code: ZodIssueCode.too_big,
1173
1173
  maximum: check.value,
@@ -1179,10 +1179,10 @@ var init_types = __esm({
1179
1179
  status.dirty();
1180
1180
  }
1181
1181
  } else if (check.kind === "length") {
1182
- const tooBig = input.data.length > check.value;
1183
- const tooSmall = input.data.length < check.value;
1182
+ const tooBig = input2.data.length > check.value;
1183
+ const tooSmall = input2.data.length < check.value;
1184
1184
  if (tooBig || tooSmall) {
1185
- ctx = this._getOrReturnCtx(input, ctx);
1185
+ ctx = this._getOrReturnCtx(input2, ctx);
1186
1186
  if (tooBig) {
1187
1187
  addIssueToContext(ctx, {
1188
1188
  code: ZodIssueCode.too_big,
@@ -1205,8 +1205,8 @@ var init_types = __esm({
1205
1205
  status.dirty();
1206
1206
  }
1207
1207
  } else if (check.kind === "email") {
1208
- if (!emailRegex.test(input.data)) {
1209
- ctx = this._getOrReturnCtx(input, ctx);
1208
+ if (!emailRegex.test(input2.data)) {
1209
+ ctx = this._getOrReturnCtx(input2, ctx);
1210
1210
  addIssueToContext(ctx, {
1211
1211
  validation: "email",
1212
1212
  code: ZodIssueCode.invalid_string,
@@ -1218,8 +1218,8 @@ var init_types = __esm({
1218
1218
  if (!emojiRegex) {
1219
1219
  emojiRegex = new RegExp(_emojiRegex, "u");
1220
1220
  }
1221
- if (!emojiRegex.test(input.data)) {
1222
- ctx = this._getOrReturnCtx(input, ctx);
1221
+ if (!emojiRegex.test(input2.data)) {
1222
+ ctx = this._getOrReturnCtx(input2, ctx);
1223
1223
  addIssueToContext(ctx, {
1224
1224
  validation: "emoji",
1225
1225
  code: ZodIssueCode.invalid_string,
@@ -1228,8 +1228,8 @@ var init_types = __esm({
1228
1228
  status.dirty();
1229
1229
  }
1230
1230
  } else if (check.kind === "uuid") {
1231
- if (!uuidRegex.test(input.data)) {
1232
- ctx = this._getOrReturnCtx(input, ctx);
1231
+ if (!uuidRegex.test(input2.data)) {
1232
+ ctx = this._getOrReturnCtx(input2, ctx);
1233
1233
  addIssueToContext(ctx, {
1234
1234
  validation: "uuid",
1235
1235
  code: ZodIssueCode.invalid_string,
@@ -1238,8 +1238,8 @@ var init_types = __esm({
1238
1238
  status.dirty();
1239
1239
  }
1240
1240
  } else if (check.kind === "nanoid") {
1241
- if (!nanoidRegex.test(input.data)) {
1242
- ctx = this._getOrReturnCtx(input, ctx);
1241
+ if (!nanoidRegex.test(input2.data)) {
1242
+ ctx = this._getOrReturnCtx(input2, ctx);
1243
1243
  addIssueToContext(ctx, {
1244
1244
  validation: "nanoid",
1245
1245
  code: ZodIssueCode.invalid_string,
@@ -1248,8 +1248,8 @@ var init_types = __esm({
1248
1248
  status.dirty();
1249
1249
  }
1250
1250
  } else if (check.kind === "cuid") {
1251
- if (!cuidRegex.test(input.data)) {
1252
- ctx = this._getOrReturnCtx(input, ctx);
1251
+ if (!cuidRegex.test(input2.data)) {
1252
+ ctx = this._getOrReturnCtx(input2, ctx);
1253
1253
  addIssueToContext(ctx, {
1254
1254
  validation: "cuid",
1255
1255
  code: ZodIssueCode.invalid_string,
@@ -1258,8 +1258,8 @@ var init_types = __esm({
1258
1258
  status.dirty();
1259
1259
  }
1260
1260
  } else if (check.kind === "cuid2") {
1261
- if (!cuid2Regex.test(input.data)) {
1262
- ctx = this._getOrReturnCtx(input, ctx);
1261
+ if (!cuid2Regex.test(input2.data)) {
1262
+ ctx = this._getOrReturnCtx(input2, ctx);
1263
1263
  addIssueToContext(ctx, {
1264
1264
  validation: "cuid2",
1265
1265
  code: ZodIssueCode.invalid_string,
@@ -1268,8 +1268,8 @@ var init_types = __esm({
1268
1268
  status.dirty();
1269
1269
  }
1270
1270
  } else if (check.kind === "ulid") {
1271
- if (!ulidRegex.test(input.data)) {
1272
- ctx = this._getOrReturnCtx(input, ctx);
1271
+ if (!ulidRegex.test(input2.data)) {
1272
+ ctx = this._getOrReturnCtx(input2, ctx);
1273
1273
  addIssueToContext(ctx, {
1274
1274
  validation: "ulid",
1275
1275
  code: ZodIssueCode.invalid_string,
@@ -1279,9 +1279,9 @@ var init_types = __esm({
1279
1279
  }
1280
1280
  } else if (check.kind === "url") {
1281
1281
  try {
1282
- new URL(input.data);
1282
+ new URL(input2.data);
1283
1283
  } catch {
1284
- ctx = this._getOrReturnCtx(input, ctx);
1284
+ ctx = this._getOrReturnCtx(input2, ctx);
1285
1285
  addIssueToContext(ctx, {
1286
1286
  validation: "url",
1287
1287
  code: ZodIssueCode.invalid_string,
@@ -1291,9 +1291,9 @@ var init_types = __esm({
1291
1291
  }
1292
1292
  } else if (check.kind === "regex") {
1293
1293
  check.regex.lastIndex = 0;
1294
- const testResult = check.regex.test(input.data);
1294
+ const testResult = check.regex.test(input2.data);
1295
1295
  if (!testResult) {
1296
- ctx = this._getOrReturnCtx(input, ctx);
1296
+ ctx = this._getOrReturnCtx(input2, ctx);
1297
1297
  addIssueToContext(ctx, {
1298
1298
  validation: "regex",
1299
1299
  code: ZodIssueCode.invalid_string,
@@ -1302,10 +1302,10 @@ var init_types = __esm({
1302
1302
  status.dirty();
1303
1303
  }
1304
1304
  } else if (check.kind === "trim") {
1305
- input.data = input.data.trim();
1305
+ input2.data = input2.data.trim();
1306
1306
  } else if (check.kind === "includes") {
1307
- if (!input.data.includes(check.value, check.position)) {
1308
- ctx = this._getOrReturnCtx(input, ctx);
1307
+ if (!input2.data.includes(check.value, check.position)) {
1308
+ ctx = this._getOrReturnCtx(input2, ctx);
1309
1309
  addIssueToContext(ctx, {
1310
1310
  code: ZodIssueCode.invalid_string,
1311
1311
  validation: { includes: check.value, position: check.position },
@@ -1314,12 +1314,12 @@ var init_types = __esm({
1314
1314
  status.dirty();
1315
1315
  }
1316
1316
  } else if (check.kind === "toLowerCase") {
1317
- input.data = input.data.toLowerCase();
1317
+ input2.data = input2.data.toLowerCase();
1318
1318
  } else if (check.kind === "toUpperCase") {
1319
- input.data = input.data.toUpperCase();
1319
+ input2.data = input2.data.toUpperCase();
1320
1320
  } else if (check.kind === "startsWith") {
1321
- if (!input.data.startsWith(check.value)) {
1322
- ctx = this._getOrReturnCtx(input, ctx);
1321
+ if (!input2.data.startsWith(check.value)) {
1322
+ ctx = this._getOrReturnCtx(input2, ctx);
1323
1323
  addIssueToContext(ctx, {
1324
1324
  code: ZodIssueCode.invalid_string,
1325
1325
  validation: { startsWith: check.value },
@@ -1328,8 +1328,8 @@ var init_types = __esm({
1328
1328
  status.dirty();
1329
1329
  }
1330
1330
  } else if (check.kind === "endsWith") {
1331
- if (!input.data.endsWith(check.value)) {
1332
- ctx = this._getOrReturnCtx(input, ctx);
1331
+ if (!input2.data.endsWith(check.value)) {
1332
+ ctx = this._getOrReturnCtx(input2, ctx);
1333
1333
  addIssueToContext(ctx, {
1334
1334
  code: ZodIssueCode.invalid_string,
1335
1335
  validation: { endsWith: check.value },
@@ -1339,8 +1339,8 @@ var init_types = __esm({
1339
1339
  }
1340
1340
  } else if (check.kind === "datetime") {
1341
1341
  const regex = datetimeRegex(check);
1342
- if (!regex.test(input.data)) {
1343
- ctx = this._getOrReturnCtx(input, ctx);
1342
+ if (!regex.test(input2.data)) {
1343
+ ctx = this._getOrReturnCtx(input2, ctx);
1344
1344
  addIssueToContext(ctx, {
1345
1345
  code: ZodIssueCode.invalid_string,
1346
1346
  validation: "datetime",
@@ -1350,8 +1350,8 @@ var init_types = __esm({
1350
1350
  }
1351
1351
  } else if (check.kind === "date") {
1352
1352
  const regex = dateRegex;
1353
- if (!regex.test(input.data)) {
1354
- ctx = this._getOrReturnCtx(input, ctx);
1353
+ if (!regex.test(input2.data)) {
1354
+ ctx = this._getOrReturnCtx(input2, ctx);
1355
1355
  addIssueToContext(ctx, {
1356
1356
  code: ZodIssueCode.invalid_string,
1357
1357
  validation: "date",
@@ -1361,8 +1361,8 @@ var init_types = __esm({
1361
1361
  }
1362
1362
  } else if (check.kind === "time") {
1363
1363
  const regex = timeRegex(check);
1364
- if (!regex.test(input.data)) {
1365
- ctx = this._getOrReturnCtx(input, ctx);
1364
+ if (!regex.test(input2.data)) {
1365
+ ctx = this._getOrReturnCtx(input2, ctx);
1366
1366
  addIssueToContext(ctx, {
1367
1367
  code: ZodIssueCode.invalid_string,
1368
1368
  validation: "time",
@@ -1371,8 +1371,8 @@ var init_types = __esm({
1371
1371
  status.dirty();
1372
1372
  }
1373
1373
  } else if (check.kind === "duration") {
1374
- if (!durationRegex.test(input.data)) {
1375
- ctx = this._getOrReturnCtx(input, ctx);
1374
+ if (!durationRegex.test(input2.data)) {
1375
+ ctx = this._getOrReturnCtx(input2, ctx);
1376
1376
  addIssueToContext(ctx, {
1377
1377
  validation: "duration",
1378
1378
  code: ZodIssueCode.invalid_string,
@@ -1381,8 +1381,8 @@ var init_types = __esm({
1381
1381
  status.dirty();
1382
1382
  }
1383
1383
  } else if (check.kind === "ip") {
1384
- if (!isValidIP(input.data, check.version)) {
1385
- ctx = this._getOrReturnCtx(input, ctx);
1384
+ if (!isValidIP(input2.data, check.version)) {
1385
+ ctx = this._getOrReturnCtx(input2, ctx);
1386
1386
  addIssueToContext(ctx, {
1387
1387
  validation: "ip",
1388
1388
  code: ZodIssueCode.invalid_string,
@@ -1391,8 +1391,8 @@ var init_types = __esm({
1391
1391
  status.dirty();
1392
1392
  }
1393
1393
  } else if (check.kind === "jwt") {
1394
- if (!isValidJWT(input.data, check.alg)) {
1395
- ctx = this._getOrReturnCtx(input, ctx);
1394
+ if (!isValidJWT(input2.data, check.alg)) {
1395
+ ctx = this._getOrReturnCtx(input2, ctx);
1396
1396
  addIssueToContext(ctx, {
1397
1397
  validation: "jwt",
1398
1398
  code: ZodIssueCode.invalid_string,
@@ -1401,8 +1401,8 @@ var init_types = __esm({
1401
1401
  status.dirty();
1402
1402
  }
1403
1403
  } else if (check.kind === "cidr") {
1404
- if (!isValidCidr(input.data, check.version)) {
1405
- ctx = this._getOrReturnCtx(input, ctx);
1404
+ if (!isValidCidr(input2.data, check.version)) {
1405
+ ctx = this._getOrReturnCtx(input2, ctx);
1406
1406
  addIssueToContext(ctx, {
1407
1407
  validation: "cidr",
1408
1408
  code: ZodIssueCode.invalid_string,
@@ -1411,8 +1411,8 @@ var init_types = __esm({
1411
1411
  status.dirty();
1412
1412
  }
1413
1413
  } else if (check.kind === "base64") {
1414
- if (!base64Regex.test(input.data)) {
1415
- ctx = this._getOrReturnCtx(input, ctx);
1414
+ if (!base64Regex.test(input2.data)) {
1415
+ ctx = this._getOrReturnCtx(input2, ctx);
1416
1416
  addIssueToContext(ctx, {
1417
1417
  validation: "base64",
1418
1418
  code: ZodIssueCode.invalid_string,
@@ -1421,8 +1421,8 @@ var init_types = __esm({
1421
1421
  status.dirty();
1422
1422
  }
1423
1423
  } else if (check.kind === "base64url") {
1424
- if (!base64urlRegex.test(input.data)) {
1425
- ctx = this._getOrReturnCtx(input, ctx);
1424
+ if (!base64urlRegex.test(input2.data)) {
1425
+ ctx = this._getOrReturnCtx(input2, ctx);
1426
1426
  addIssueToContext(ctx, {
1427
1427
  validation: "base64url",
1428
1428
  code: ZodIssueCode.invalid_string,
@@ -1434,7 +1434,7 @@ var init_types = __esm({
1434
1434
  util.assertNever(check);
1435
1435
  }
1436
1436
  }
1437
- return { status: status.value, value: input.data };
1437
+ return { status: status.value, value: input2.data };
1438
1438
  }
1439
1439
  _regex(regex, validation, message) {
1440
1440
  return this.refinement((data) => regex.test(data), {
@@ -1687,13 +1687,13 @@ var init_types = __esm({
1687
1687
  this.max = this.lte;
1688
1688
  this.step = this.multipleOf;
1689
1689
  }
1690
- _parse(input) {
1690
+ _parse(input2) {
1691
1691
  if (this._def.coerce) {
1692
- input.data = Number(input.data);
1692
+ input2.data = Number(input2.data);
1693
1693
  }
1694
- const parsedType = this._getType(input);
1694
+ const parsedType = this._getType(input2);
1695
1695
  if (parsedType !== ZodParsedType.number) {
1696
- const ctx2 = this._getOrReturnCtx(input);
1696
+ const ctx2 = this._getOrReturnCtx(input2);
1697
1697
  addIssueToContext(ctx2, {
1698
1698
  code: ZodIssueCode.invalid_type,
1699
1699
  expected: ZodParsedType.number,
@@ -1705,8 +1705,8 @@ var init_types = __esm({
1705
1705
  const status = new ParseStatus();
1706
1706
  for (const check of this._def.checks) {
1707
1707
  if (check.kind === "int") {
1708
- if (!util.isInteger(input.data)) {
1709
- ctx = this._getOrReturnCtx(input, ctx);
1708
+ if (!util.isInteger(input2.data)) {
1709
+ ctx = this._getOrReturnCtx(input2, ctx);
1710
1710
  addIssueToContext(ctx, {
1711
1711
  code: ZodIssueCode.invalid_type,
1712
1712
  expected: "integer",
@@ -1716,9 +1716,9 @@ var init_types = __esm({
1716
1716
  status.dirty();
1717
1717
  }
1718
1718
  } else if (check.kind === "min") {
1719
- const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
1719
+ const tooSmall = check.inclusive ? input2.data < check.value : input2.data <= check.value;
1720
1720
  if (tooSmall) {
1721
- ctx = this._getOrReturnCtx(input, ctx);
1721
+ ctx = this._getOrReturnCtx(input2, ctx);
1722
1722
  addIssueToContext(ctx, {
1723
1723
  code: ZodIssueCode.too_small,
1724
1724
  minimum: check.value,
@@ -1730,9 +1730,9 @@ var init_types = __esm({
1730
1730
  status.dirty();
1731
1731
  }
1732
1732
  } else if (check.kind === "max") {
1733
- const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
1733
+ const tooBig = check.inclusive ? input2.data > check.value : input2.data >= check.value;
1734
1734
  if (tooBig) {
1735
- ctx = this._getOrReturnCtx(input, ctx);
1735
+ ctx = this._getOrReturnCtx(input2, ctx);
1736
1736
  addIssueToContext(ctx, {
1737
1737
  code: ZodIssueCode.too_big,
1738
1738
  maximum: check.value,
@@ -1744,8 +1744,8 @@ var init_types = __esm({
1744
1744
  status.dirty();
1745
1745
  }
1746
1746
  } else if (check.kind === "multipleOf") {
1747
- if (floatSafeRemainder(input.data, check.value) !== 0) {
1748
- ctx = this._getOrReturnCtx(input, ctx);
1747
+ if (floatSafeRemainder(input2.data, check.value) !== 0) {
1748
+ ctx = this._getOrReturnCtx(input2, ctx);
1749
1749
  addIssueToContext(ctx, {
1750
1750
  code: ZodIssueCode.not_multiple_of,
1751
1751
  multipleOf: check.value,
@@ -1754,8 +1754,8 @@ var init_types = __esm({
1754
1754
  status.dirty();
1755
1755
  }
1756
1756
  } else if (check.kind === "finite") {
1757
- if (!Number.isFinite(input.data)) {
1758
- ctx = this._getOrReturnCtx(input, ctx);
1757
+ if (!Number.isFinite(input2.data)) {
1758
+ ctx = this._getOrReturnCtx(input2, ctx);
1759
1759
  addIssueToContext(ctx, {
1760
1760
  code: ZodIssueCode.not_finite,
1761
1761
  message: check.message
@@ -1766,7 +1766,7 @@ var init_types = __esm({
1766
1766
  util.assertNever(check);
1767
1767
  }
1768
1768
  }
1769
- return { status: status.value, value: input.data };
1769
+ return { status: status.value, value: input2.data };
1770
1770
  }
1771
1771
  gte(value, message) {
1772
1772
  return this.setLimit("min", value, true, errorUtil.toString(message));
@@ -1918,25 +1918,25 @@ var init_types = __esm({
1918
1918
  this.min = this.gte;
1919
1919
  this.max = this.lte;
1920
1920
  }
1921
- _parse(input) {
1921
+ _parse(input2) {
1922
1922
  if (this._def.coerce) {
1923
1923
  try {
1924
- input.data = BigInt(input.data);
1924
+ input2.data = BigInt(input2.data);
1925
1925
  } catch {
1926
- return this._getInvalidInput(input);
1926
+ return this._getInvalidInput(input2);
1927
1927
  }
1928
1928
  }
1929
- const parsedType = this._getType(input);
1929
+ const parsedType = this._getType(input2);
1930
1930
  if (parsedType !== ZodParsedType.bigint) {
1931
- return this._getInvalidInput(input);
1931
+ return this._getInvalidInput(input2);
1932
1932
  }
1933
1933
  let ctx = void 0;
1934
1934
  const status = new ParseStatus();
1935
1935
  for (const check of this._def.checks) {
1936
1936
  if (check.kind === "min") {
1937
- const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
1937
+ const tooSmall = check.inclusive ? input2.data < check.value : input2.data <= check.value;
1938
1938
  if (tooSmall) {
1939
- ctx = this._getOrReturnCtx(input, ctx);
1939
+ ctx = this._getOrReturnCtx(input2, ctx);
1940
1940
  addIssueToContext(ctx, {
1941
1941
  code: ZodIssueCode.too_small,
1942
1942
  type: "bigint",
@@ -1947,9 +1947,9 @@ var init_types = __esm({
1947
1947
  status.dirty();
1948
1948
  }
1949
1949
  } else if (check.kind === "max") {
1950
- const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
1950
+ const tooBig = check.inclusive ? input2.data > check.value : input2.data >= check.value;
1951
1951
  if (tooBig) {
1952
- ctx = this._getOrReturnCtx(input, ctx);
1952
+ ctx = this._getOrReturnCtx(input2, ctx);
1953
1953
  addIssueToContext(ctx, {
1954
1954
  code: ZodIssueCode.too_big,
1955
1955
  type: "bigint",
@@ -1960,8 +1960,8 @@ var init_types = __esm({
1960
1960
  status.dirty();
1961
1961
  }
1962
1962
  } else if (check.kind === "multipleOf") {
1963
- if (input.data % check.value !== BigInt(0)) {
1964
- ctx = this._getOrReturnCtx(input, ctx);
1963
+ if (input2.data % check.value !== BigInt(0)) {
1964
+ ctx = this._getOrReturnCtx(input2, ctx);
1965
1965
  addIssueToContext(ctx, {
1966
1966
  code: ZodIssueCode.not_multiple_of,
1967
1967
  multipleOf: check.value,
@@ -1973,10 +1973,10 @@ var init_types = __esm({
1973
1973
  util.assertNever(check);
1974
1974
  }
1975
1975
  }
1976
- return { status: status.value, value: input.data };
1976
+ return { status: status.value, value: input2.data };
1977
1977
  }
1978
- _getInvalidInput(input) {
1979
- const ctx = this._getOrReturnCtx(input);
1978
+ _getInvalidInput(input2) {
1979
+ const ctx = this._getOrReturnCtx(input2);
1980
1980
  addIssueToContext(ctx, {
1981
1981
  code: ZodIssueCode.invalid_type,
1982
1982
  expected: ZodParsedType.bigint,
@@ -2085,13 +2085,13 @@ var init_types = __esm({
2085
2085
  });
2086
2086
  };
2087
2087
  ZodBoolean = class extends ZodType {
2088
- _parse(input) {
2088
+ _parse(input2) {
2089
2089
  if (this._def.coerce) {
2090
- input.data = Boolean(input.data);
2090
+ input2.data = Boolean(input2.data);
2091
2091
  }
2092
- const parsedType = this._getType(input);
2092
+ const parsedType = this._getType(input2);
2093
2093
  if (parsedType !== ZodParsedType.boolean) {
2094
- const ctx = this._getOrReturnCtx(input);
2094
+ const ctx = this._getOrReturnCtx(input2);
2095
2095
  addIssueToContext(ctx, {
2096
2096
  code: ZodIssueCode.invalid_type,
2097
2097
  expected: ZodParsedType.boolean,
@@ -2099,7 +2099,7 @@ var init_types = __esm({
2099
2099
  });
2100
2100
  return INVALID;
2101
2101
  }
2102
- return OK(input.data);
2102
+ return OK(input2.data);
2103
2103
  }
2104
2104
  };
2105
2105
  ZodBoolean.create = (params) => {
@@ -2110,13 +2110,13 @@ var init_types = __esm({
2110
2110
  });
2111
2111
  };
2112
2112
  ZodDate = class _ZodDate extends ZodType {
2113
- _parse(input) {
2113
+ _parse(input2) {
2114
2114
  if (this._def.coerce) {
2115
- input.data = new Date(input.data);
2115
+ input2.data = new Date(input2.data);
2116
2116
  }
2117
- const parsedType = this._getType(input);
2117
+ const parsedType = this._getType(input2);
2118
2118
  if (parsedType !== ZodParsedType.date) {
2119
- const ctx2 = this._getOrReturnCtx(input);
2119
+ const ctx2 = this._getOrReturnCtx(input2);
2120
2120
  addIssueToContext(ctx2, {
2121
2121
  code: ZodIssueCode.invalid_type,
2122
2122
  expected: ZodParsedType.date,
@@ -2124,8 +2124,8 @@ var init_types = __esm({
2124
2124
  });
2125
2125
  return INVALID;
2126
2126
  }
2127
- if (Number.isNaN(input.data.getTime())) {
2128
- const ctx2 = this._getOrReturnCtx(input);
2127
+ if (Number.isNaN(input2.data.getTime())) {
2128
+ const ctx2 = this._getOrReturnCtx(input2);
2129
2129
  addIssueToContext(ctx2, {
2130
2130
  code: ZodIssueCode.invalid_date
2131
2131
  });
@@ -2135,8 +2135,8 @@ var init_types = __esm({
2135
2135
  let ctx = void 0;
2136
2136
  for (const check of this._def.checks) {
2137
2137
  if (check.kind === "min") {
2138
- if (input.data.getTime() < check.value) {
2139
- ctx = this._getOrReturnCtx(input, ctx);
2138
+ if (input2.data.getTime() < check.value) {
2139
+ ctx = this._getOrReturnCtx(input2, ctx);
2140
2140
  addIssueToContext(ctx, {
2141
2141
  code: ZodIssueCode.too_small,
2142
2142
  message: check.message,
@@ -2148,8 +2148,8 @@ var init_types = __esm({
2148
2148
  status.dirty();
2149
2149
  }
2150
2150
  } else if (check.kind === "max") {
2151
- if (input.data.getTime() > check.value) {
2152
- ctx = this._getOrReturnCtx(input, ctx);
2151
+ if (input2.data.getTime() > check.value) {
2152
+ ctx = this._getOrReturnCtx(input2, ctx);
2153
2153
  addIssueToContext(ctx, {
2154
2154
  code: ZodIssueCode.too_big,
2155
2155
  message: check.message,
@@ -2166,7 +2166,7 @@ var init_types = __esm({
2166
2166
  }
2167
2167
  return {
2168
2168
  status: status.value,
2169
- value: new Date(input.data.getTime())
2169
+ value: new Date(input2.data.getTime())
2170
2170
  };
2171
2171
  }
2172
2172
  _addCheck(check) {
@@ -2219,10 +2219,10 @@ var init_types = __esm({
2219
2219
  });
2220
2220
  };
2221
2221
  ZodSymbol = class extends ZodType {
2222
- _parse(input) {
2223
- const parsedType = this._getType(input);
2222
+ _parse(input2) {
2223
+ const parsedType = this._getType(input2);
2224
2224
  if (parsedType !== ZodParsedType.symbol) {
2225
- const ctx = this._getOrReturnCtx(input);
2225
+ const ctx = this._getOrReturnCtx(input2);
2226
2226
  addIssueToContext(ctx, {
2227
2227
  code: ZodIssueCode.invalid_type,
2228
2228
  expected: ZodParsedType.symbol,
@@ -2230,7 +2230,7 @@ var init_types = __esm({
2230
2230
  });
2231
2231
  return INVALID;
2232
2232
  }
2233
- return OK(input.data);
2233
+ return OK(input2.data);
2234
2234
  }
2235
2235
  };
2236
2236
  ZodSymbol.create = (params) => {
@@ -2240,10 +2240,10 @@ var init_types = __esm({
2240
2240
  });
2241
2241
  };
2242
2242
  ZodUndefined = class extends ZodType {
2243
- _parse(input) {
2244
- const parsedType = this._getType(input);
2243
+ _parse(input2) {
2244
+ const parsedType = this._getType(input2);
2245
2245
  if (parsedType !== ZodParsedType.undefined) {
2246
- const ctx = this._getOrReturnCtx(input);
2246
+ const ctx = this._getOrReturnCtx(input2);
2247
2247
  addIssueToContext(ctx, {
2248
2248
  code: ZodIssueCode.invalid_type,
2249
2249
  expected: ZodParsedType.undefined,
@@ -2251,7 +2251,7 @@ var init_types = __esm({
2251
2251
  });
2252
2252
  return INVALID;
2253
2253
  }
2254
- return OK(input.data);
2254
+ return OK(input2.data);
2255
2255
  }
2256
2256
  };
2257
2257
  ZodUndefined.create = (params) => {
@@ -2261,10 +2261,10 @@ var init_types = __esm({
2261
2261
  });
2262
2262
  };
2263
2263
  ZodNull = class extends ZodType {
2264
- _parse(input) {
2265
- const parsedType = this._getType(input);
2264
+ _parse(input2) {
2265
+ const parsedType = this._getType(input2);
2266
2266
  if (parsedType !== ZodParsedType.null) {
2267
- const ctx = this._getOrReturnCtx(input);
2267
+ const ctx = this._getOrReturnCtx(input2);
2268
2268
  addIssueToContext(ctx, {
2269
2269
  code: ZodIssueCode.invalid_type,
2270
2270
  expected: ZodParsedType.null,
@@ -2272,7 +2272,7 @@ var init_types = __esm({
2272
2272
  });
2273
2273
  return INVALID;
2274
2274
  }
2275
- return OK(input.data);
2275
+ return OK(input2.data);
2276
2276
  }
2277
2277
  };
2278
2278
  ZodNull.create = (params) => {
@@ -2286,8 +2286,8 @@ var init_types = __esm({
2286
2286
  super(...arguments);
2287
2287
  this._any = true;
2288
2288
  }
2289
- _parse(input) {
2290
- return OK(input.data);
2289
+ _parse(input2) {
2290
+ return OK(input2.data);
2291
2291
  }
2292
2292
  };
2293
2293
  ZodAny.create = (params) => {
@@ -2301,8 +2301,8 @@ var init_types = __esm({
2301
2301
  super(...arguments);
2302
2302
  this._unknown = true;
2303
2303
  }
2304
- _parse(input) {
2305
- return OK(input.data);
2304
+ _parse(input2) {
2305
+ return OK(input2.data);
2306
2306
  }
2307
2307
  };
2308
2308
  ZodUnknown.create = (params) => {
@@ -2312,8 +2312,8 @@ var init_types = __esm({
2312
2312
  });
2313
2313
  };
2314
2314
  ZodNever = class extends ZodType {
2315
- _parse(input) {
2316
- const ctx = this._getOrReturnCtx(input);
2315
+ _parse(input2) {
2316
+ const ctx = this._getOrReturnCtx(input2);
2317
2317
  addIssueToContext(ctx, {
2318
2318
  code: ZodIssueCode.invalid_type,
2319
2319
  expected: ZodParsedType.never,
@@ -2329,10 +2329,10 @@ var init_types = __esm({
2329
2329
  });
2330
2330
  };
2331
2331
  ZodVoid = class extends ZodType {
2332
- _parse(input) {
2333
- const parsedType = this._getType(input);
2332
+ _parse(input2) {
2333
+ const parsedType = this._getType(input2);
2334
2334
  if (parsedType !== ZodParsedType.undefined) {
2335
- const ctx = this._getOrReturnCtx(input);
2335
+ const ctx = this._getOrReturnCtx(input2);
2336
2336
  addIssueToContext(ctx, {
2337
2337
  code: ZodIssueCode.invalid_type,
2338
2338
  expected: ZodParsedType.void,
@@ -2340,7 +2340,7 @@ var init_types = __esm({
2340
2340
  });
2341
2341
  return INVALID;
2342
2342
  }
2343
- return OK(input.data);
2343
+ return OK(input2.data);
2344
2344
  }
2345
2345
  };
2346
2346
  ZodVoid.create = (params) => {
@@ -2350,8 +2350,8 @@ var init_types = __esm({
2350
2350
  });
2351
2351
  };
2352
2352
  ZodArray = class _ZodArray extends ZodType {
2353
- _parse(input) {
2354
- const { ctx, status } = this._processInputParams(input);
2353
+ _parse(input2) {
2354
+ const { ctx, status } = this._processInputParams(input2);
2355
2355
  const def = this._def;
2356
2356
  if (ctx.parsedType !== ZodParsedType.array) {
2357
2357
  addIssueToContext(ctx, {
@@ -2465,10 +2465,10 @@ var init_types = __esm({
2465
2465
  this._cached = { shape, keys };
2466
2466
  return this._cached;
2467
2467
  }
2468
- _parse(input) {
2469
- const parsedType = this._getType(input);
2468
+ _parse(input2) {
2469
+ const parsedType = this._getType(input2);
2470
2470
  if (parsedType !== ZodParsedType.object) {
2471
- const ctx2 = this._getOrReturnCtx(input);
2471
+ const ctx2 = this._getOrReturnCtx(input2);
2472
2472
  addIssueToContext(ctx2, {
2473
2473
  code: ZodIssueCode.invalid_type,
2474
2474
  expected: ZodParsedType.object,
@@ -2476,7 +2476,7 @@ var init_types = __esm({
2476
2476
  });
2477
2477
  return INVALID;
2478
2478
  }
2479
- const { status, ctx } = this._processInputParams(input);
2479
+ const { status, ctx } = this._processInputParams(input2);
2480
2480
  const { shape, keys: shapeKeys } = this._getCached();
2481
2481
  const extraKeys = [];
2482
2482
  if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
@@ -2790,8 +2790,8 @@ var init_types = __esm({
2790
2790
  });
2791
2791
  };
2792
2792
  ZodUnion = class extends ZodType {
2793
- _parse(input) {
2794
- const { ctx } = this._processInputParams(input);
2793
+ _parse(input2) {
2794
+ const { ctx } = this._processInputParams(input2);
2795
2795
  const options = this._def.options;
2796
2796
  function handleResults(results) {
2797
2797
  for (const result of results) {
@@ -2912,8 +2912,8 @@ var init_types = __esm({
2912
2912
  }
2913
2913
  };
2914
2914
  ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
2915
- _parse(input) {
2916
- const { ctx } = this._processInputParams(input);
2915
+ _parse(input2) {
2916
+ const { ctx } = this._processInputParams(input2);
2917
2917
  if (ctx.parsedType !== ZodParsedType.object) {
2918
2918
  addIssueToContext(ctx, {
2919
2919
  code: ZodIssueCode.invalid_type,
@@ -2988,8 +2988,8 @@ var init_types = __esm({
2988
2988
  }
2989
2989
  };
2990
2990
  ZodIntersection = class extends ZodType {
2991
- _parse(input) {
2992
- const { status, ctx } = this._processInputParams(input);
2991
+ _parse(input2) {
2992
+ const { status, ctx } = this._processInputParams(input2);
2993
2993
  const handleParsed = (parsedLeft, parsedRight) => {
2994
2994
  if (isAborted(parsedLeft) || isAborted(parsedRight)) {
2995
2995
  return INVALID;
@@ -3041,8 +3041,8 @@ var init_types = __esm({
3041
3041
  });
3042
3042
  };
3043
3043
  ZodTuple = class _ZodTuple extends ZodType {
3044
- _parse(input) {
3045
- const { status, ctx } = this._processInputParams(input);
3044
+ _parse(input2) {
3045
+ const { status, ctx } = this._processInputParams(input2);
3046
3046
  if (ctx.parsedType !== ZodParsedType.array) {
3047
3047
  addIssueToContext(ctx, {
3048
3048
  code: ZodIssueCode.invalid_type,
@@ -3114,8 +3114,8 @@ var init_types = __esm({
3114
3114
  get valueSchema() {
3115
3115
  return this._def.valueType;
3116
3116
  }
3117
- _parse(input) {
3118
- const { status, ctx } = this._processInputParams(input);
3117
+ _parse(input2) {
3118
+ const { status, ctx } = this._processInputParams(input2);
3119
3119
  if (ctx.parsedType !== ZodParsedType.object) {
3120
3120
  addIssueToContext(ctx, {
3121
3121
  code: ZodIssueCode.invalid_type,
@@ -3167,8 +3167,8 @@ var init_types = __esm({
3167
3167
  get valueSchema() {
3168
3168
  return this._def.valueType;
3169
3169
  }
3170
- _parse(input) {
3171
- const { status, ctx } = this._processInputParams(input);
3170
+ _parse(input2) {
3171
+ const { status, ctx } = this._processInputParams(input2);
3172
3172
  if (ctx.parsedType !== ZodParsedType.map) {
3173
3173
  addIssueToContext(ctx, {
3174
3174
  code: ZodIssueCode.invalid_type,
@@ -3227,8 +3227,8 @@ var init_types = __esm({
3227
3227
  });
3228
3228
  };
3229
3229
  ZodSet = class _ZodSet extends ZodType {
3230
- _parse(input) {
3231
- const { status, ctx } = this._processInputParams(input);
3230
+ _parse(input2) {
3231
+ const { status, ctx } = this._processInputParams(input2);
3232
3232
  if (ctx.parsedType !== ZodParsedType.set) {
3233
3233
  addIssueToContext(ctx, {
3234
3234
  code: ZodIssueCode.invalid_type,
@@ -3316,8 +3316,8 @@ var init_types = __esm({
3316
3316
  super(...arguments);
3317
3317
  this.validate = this.implement;
3318
3318
  }
3319
- _parse(input) {
3320
- const { ctx } = this._processInputParams(input);
3319
+ _parse(input2) {
3320
+ const { ctx } = this._processInputParams(input2);
3321
3321
  if (ctx.parsedType !== ZodParsedType.function) {
3322
3322
  addIssueToContext(ctx, {
3323
3323
  code: ZodIssueCode.invalid_type,
@@ -3420,8 +3420,8 @@ var init_types = __esm({
3420
3420
  get schema() {
3421
3421
  return this._def.getter();
3422
3422
  }
3423
- _parse(input) {
3424
- const { ctx } = this._processInputParams(input);
3423
+ _parse(input2) {
3424
+ const { ctx } = this._processInputParams(input2);
3425
3425
  const lazySchema = this._def.getter();
3426
3426
  return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
3427
3427
  }
@@ -3434,9 +3434,9 @@ var init_types = __esm({
3434
3434
  });
3435
3435
  };
3436
3436
  ZodLiteral = class extends ZodType {
3437
- _parse(input) {
3438
- if (input.data !== this._def.value) {
3439
- const ctx = this._getOrReturnCtx(input);
3437
+ _parse(input2) {
3438
+ if (input2.data !== this._def.value) {
3439
+ const ctx = this._getOrReturnCtx(input2);
3440
3440
  addIssueToContext(ctx, {
3441
3441
  received: ctx.data,
3442
3442
  code: ZodIssueCode.invalid_literal,
@@ -3444,7 +3444,7 @@ var init_types = __esm({
3444
3444
  });
3445
3445
  return INVALID;
3446
3446
  }
3447
- return { status: "valid", value: input.data };
3447
+ return { status: "valid", value: input2.data };
3448
3448
  }
3449
3449
  get value() {
3450
3450
  return this._def.value;
@@ -3458,9 +3458,9 @@ var init_types = __esm({
3458
3458
  });
3459
3459
  };
3460
3460
  ZodEnum = class _ZodEnum extends ZodType {
3461
- _parse(input) {
3462
- if (typeof input.data !== "string") {
3463
- const ctx = this._getOrReturnCtx(input);
3461
+ _parse(input2) {
3462
+ if (typeof input2.data !== "string") {
3463
+ const ctx = this._getOrReturnCtx(input2);
3464
3464
  const expectedValues = this._def.values;
3465
3465
  addIssueToContext(ctx, {
3466
3466
  expected: util.joinValues(expectedValues),
@@ -3472,8 +3472,8 @@ var init_types = __esm({
3472
3472
  if (!this._cache) {
3473
3473
  this._cache = new Set(this._def.values);
3474
3474
  }
3475
- if (!this._cache.has(input.data)) {
3476
- const ctx = this._getOrReturnCtx(input);
3475
+ if (!this._cache.has(input2.data)) {
3476
+ const ctx = this._getOrReturnCtx(input2);
3477
3477
  const expectedValues = this._def.values;
3478
3478
  addIssueToContext(ctx, {
3479
3479
  received: ctx.data,
@@ -3482,7 +3482,7 @@ var init_types = __esm({
3482
3482
  });
3483
3483
  return INVALID;
3484
3484
  }
3485
- return OK(input.data);
3485
+ return OK(input2.data);
3486
3486
  }
3487
3487
  get options() {
3488
3488
  return this._def.values;
@@ -3523,9 +3523,9 @@ var init_types = __esm({
3523
3523
  };
3524
3524
  ZodEnum.create = createZodEnum;
3525
3525
  ZodNativeEnum = class extends ZodType {
3526
- _parse(input) {
3526
+ _parse(input2) {
3527
3527
  const nativeEnumValues = util.getValidEnumValues(this._def.values);
3528
- const ctx = this._getOrReturnCtx(input);
3528
+ const ctx = this._getOrReturnCtx(input2);
3529
3529
  if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
3530
3530
  const expectedValues = util.objectValues(nativeEnumValues);
3531
3531
  addIssueToContext(ctx, {
@@ -3538,7 +3538,7 @@ var init_types = __esm({
3538
3538
  if (!this._cache) {
3539
3539
  this._cache = new Set(util.getValidEnumValues(this._def.values));
3540
3540
  }
3541
- if (!this._cache.has(input.data)) {
3541
+ if (!this._cache.has(input2.data)) {
3542
3542
  const expectedValues = util.objectValues(nativeEnumValues);
3543
3543
  addIssueToContext(ctx, {
3544
3544
  received: ctx.data,
@@ -3547,7 +3547,7 @@ var init_types = __esm({
3547
3547
  });
3548
3548
  return INVALID;
3549
3549
  }
3550
- return OK(input.data);
3550
+ return OK(input2.data);
3551
3551
  }
3552
3552
  get enum() {
3553
3553
  return this._def.values;
@@ -3564,8 +3564,8 @@ var init_types = __esm({
3564
3564
  unwrap() {
3565
3565
  return this._def.type;
3566
3566
  }
3567
- _parse(input) {
3568
- const { ctx } = this._processInputParams(input);
3567
+ _parse(input2) {
3568
+ const { ctx } = this._processInputParams(input2);
3569
3569
  if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
3570
3570
  addIssueToContext(ctx, {
3571
3571
  code: ZodIssueCode.invalid_type,
@@ -3597,8 +3597,8 @@ var init_types = __esm({
3597
3597
  sourceType() {
3598
3598
  return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
3599
3599
  }
3600
- _parse(input) {
3601
- const { status, ctx } = this._processInputParams(input);
3600
+ _parse(input2) {
3601
+ const { status, ctx } = this._processInputParams(input2);
3602
3602
  const effect = this._def.effect || null;
3603
3603
  const checkCtx = {
3604
3604
  addIssue: (arg) => {
@@ -3730,12 +3730,12 @@ var init_types = __esm({
3730
3730
  });
3731
3731
  };
3732
3732
  ZodOptional = class extends ZodType {
3733
- _parse(input) {
3734
- const parsedType = this._getType(input);
3733
+ _parse(input2) {
3734
+ const parsedType = this._getType(input2);
3735
3735
  if (parsedType === ZodParsedType.undefined) {
3736
3736
  return OK(void 0);
3737
3737
  }
3738
- return this._def.innerType._parse(input);
3738
+ return this._def.innerType._parse(input2);
3739
3739
  }
3740
3740
  unwrap() {
3741
3741
  return this._def.innerType;
@@ -3749,12 +3749,12 @@ var init_types = __esm({
3749
3749
  });
3750
3750
  };
3751
3751
  ZodNullable = class extends ZodType {
3752
- _parse(input) {
3753
- const parsedType = this._getType(input);
3752
+ _parse(input2) {
3753
+ const parsedType = this._getType(input2);
3754
3754
  if (parsedType === ZodParsedType.null) {
3755
3755
  return OK(null);
3756
3756
  }
3757
- return this._def.innerType._parse(input);
3757
+ return this._def.innerType._parse(input2);
3758
3758
  }
3759
3759
  unwrap() {
3760
3760
  return this._def.innerType;
@@ -3768,8 +3768,8 @@ var init_types = __esm({
3768
3768
  });
3769
3769
  };
3770
3770
  ZodDefault = class extends ZodType {
3771
- _parse(input) {
3772
- const { ctx } = this._processInputParams(input);
3771
+ _parse(input2) {
3772
+ const { ctx } = this._processInputParams(input2);
3773
3773
  let data = ctx.data;
3774
3774
  if (ctx.parsedType === ZodParsedType.undefined) {
3775
3775
  data = this._def.defaultValue();
@@ -3793,8 +3793,8 @@ var init_types = __esm({
3793
3793
  });
3794
3794
  };
3795
3795
  ZodCatch = class extends ZodType {
3796
- _parse(input) {
3797
- const { ctx } = this._processInputParams(input);
3796
+ _parse(input2) {
3797
+ const { ctx } = this._processInputParams(input2);
3798
3798
  const newCtx = {
3799
3799
  ...ctx,
3800
3800
  common: {
@@ -3846,10 +3846,10 @@ var init_types = __esm({
3846
3846
  });
3847
3847
  };
3848
3848
  ZodNaN = class extends ZodType {
3849
- _parse(input) {
3850
- const parsedType = this._getType(input);
3849
+ _parse(input2) {
3850
+ const parsedType = this._getType(input2);
3851
3851
  if (parsedType !== ZodParsedType.nan) {
3852
- const ctx = this._getOrReturnCtx(input);
3852
+ const ctx = this._getOrReturnCtx(input2);
3853
3853
  addIssueToContext(ctx, {
3854
3854
  code: ZodIssueCode.invalid_type,
3855
3855
  expected: ZodParsedType.nan,
@@ -3857,7 +3857,7 @@ var init_types = __esm({
3857
3857
  });
3858
3858
  return INVALID;
3859
3859
  }
3860
- return { status: "valid", value: input.data };
3860
+ return { status: "valid", value: input2.data };
3861
3861
  }
3862
3862
  };
3863
3863
  ZodNaN.create = (params) => {
@@ -3868,8 +3868,8 @@ var init_types = __esm({
3868
3868
  };
3869
3869
  BRAND = Symbol("zod_brand");
3870
3870
  ZodBranded = class extends ZodType {
3871
- _parse(input) {
3872
- const { ctx } = this._processInputParams(input);
3871
+ _parse(input2) {
3872
+ const { ctx } = this._processInputParams(input2);
3873
3873
  const data = ctx.data;
3874
3874
  return this._def.type._parse({
3875
3875
  data,
@@ -3882,8 +3882,8 @@ var init_types = __esm({
3882
3882
  }
3883
3883
  };
3884
3884
  ZodPipeline = class _ZodPipeline extends ZodType {
3885
- _parse(input) {
3886
- const { status, ctx } = this._processInputParams(input);
3885
+ _parse(input2) {
3886
+ const { status, ctx } = this._processInputParams(input2);
3887
3887
  if (ctx.common.async) {
3888
3888
  const handleAsync = async () => {
3889
3889
  const inResult = await this._def.in._parseAsync({
@@ -3937,8 +3937,8 @@ var init_types = __esm({
3937
3937
  }
3938
3938
  };
3939
3939
  ZodReadonly = class extends ZodType {
3940
- _parse(input) {
3941
- const result = this._def.innerType._parse(input);
3940
+ _parse(input2) {
3941
+ const result = this._def.innerType._parse(input2);
3942
3942
  const freeze = (data) => {
3943
3943
  if (isValid(data)) {
3944
3944
  data.value = Object.freeze(data.value);
@@ -5876,32 +5876,32 @@ var init_branch_service = __esm({
5876
5876
  doc: branchDoc
5877
5877
  };
5878
5878
  }
5879
- buildSpecificationData(input, context) {
5880
- if (!input) {
5879
+ buildSpecificationData(input2, context) {
5880
+ if (!input2) {
5881
5881
  return void 0;
5882
5882
  }
5883
- const specDocId = input.specDocId ?? context.specDocId;
5883
+ const specDocId = input2.specDocId ?? context.specDocId;
5884
5884
  if (!specDocId) {
5885
5885
  console.warn("[BranchService] Unable to build specification metadata without specDocId");
5886
5886
  return void 0;
5887
5887
  }
5888
- const createdAt = input.createdAt ?? context.createdAt;
5888
+ const createdAt = input2.createdAt ?? context.createdAt;
5889
5889
  const data = {
5890
5890
  specDocId,
5891
- specFilePath: input.specFilePath,
5892
- title: input.title,
5893
- branchName: input.branchName ?? context.branchName,
5894
- branchDescription: input.branchDescription ?? context.branchDescription ?? void 0,
5891
+ specFilePath: input2.specFilePath,
5892
+ title: input2.title,
5893
+ branchName: input2.branchName ?? context.branchName,
5894
+ branchDescription: input2.branchDescription ?? context.branchDescription ?? void 0,
5895
5895
  createdAt,
5896
- updatedAt: input.updatedAt ?? createdAt,
5897
- workspaceId: input.workspaceId ?? context.workspaceId,
5898
- lifecycleStatus: input.lifecycleStatus ?? "active",
5899
- activeTrackingEnabled: input.activeTrackingEnabled ?? true,
5900
- baseline: input.baseline ?? this.buildBaselineSnapshot(createdAt, context.workspaceId, context.initialFileHeads),
5901
- changeSummary: input.changeSummary,
5902
- coverage: input.coverage,
5903
- git: input.git,
5904
- lastSetActiveAt: input.activeTrackingEnabled === false ? void 0 : createdAt
5896
+ updatedAt: input2.updatedAt ?? createdAt,
5897
+ workspaceId: input2.workspaceId ?? context.workspaceId,
5898
+ lifecycleStatus: input2.lifecycleStatus ?? "active",
5899
+ activeTrackingEnabled: input2.activeTrackingEnabled ?? true,
5900
+ baseline: input2.baseline ?? this.buildBaselineSnapshot(createdAt, context.workspaceId, context.initialFileHeads),
5901
+ changeSummary: input2.changeSummary,
5902
+ coverage: input2.coverage,
5903
+ git: input2.git,
5904
+ lastSetActiveAt: input2.activeTrackingEnabled === false ? void 0 : createdAt
5905
5905
  };
5906
5906
  if (!data.branchDescription) {
5907
5907
  delete data.branchDescription;
@@ -5915,8 +5915,8 @@ var init_branch_service = __esm({
5915
5915
  if (!data.git) {
5916
5916
  delete data.git;
5917
5917
  }
5918
- if (input.abstract) {
5919
- data.abstract = input.abstract;
5918
+ if (input2.abstract) {
5919
+ data.abstract = input2.abstract;
5920
5920
  }
5921
5921
  return data;
5922
5922
  }
@@ -5990,8 +5990,8 @@ var init_branch_service = __esm({
5990
5990
  const safeTimestamp = timestamp ? timestamp.replace(/[:\sT]/g, "-").split(".")[0] : (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
5991
5991
  return `spec-${slug}-${safeTimestamp}`;
5992
5992
  }
5993
- slugifyBranchName(input) {
5994
- const slug = input.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 48);
5993
+ slugifyBranchName(input2) {
5994
+ const slug = input2.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 48);
5995
5995
  return slug || "branch";
5996
5996
  }
5997
5997
  detectConflicts(sourceBranch, targetBranch) {
@@ -18340,7 +18340,7 @@ function DirectoryPageContainer({ repo: repo2, selectedWorkspace, selectedThread
18340
18340
  cancelled = true;
18341
18341
  };
18342
18342
  }, [repo2, selectedWorkspace, selectedThread, loadRootDirectory]);
18343
- useInput((input, key) => {
18343
+ useInput((input2, key) => {
18344
18344
  if (key.downArrow) {
18345
18345
  setSelectedIndex((i) => Math.min(i + 1, rootIds.length - 1));
18346
18346
  } else if (key.upArrow) {
@@ -18499,7 +18499,7 @@ function BranchesContainer({ repo: repo2, workspace, onSelect }) {
18499
18499
  ;
18500
18500
  };
18501
18501
  }, [repo2, workspace]);
18502
- useInput2((input, key) => {
18502
+ useInput2((input2, key) => {
18503
18503
  if (key.downArrow)
18504
18504
  setIdx((i) => Math.min(i + 1, Math.max(0, threads.length - 1)));
18505
18505
  else if (key.upArrow)
@@ -18718,7 +18718,7 @@ function App({ repo: repo2, featureFlags: providedFeatureFlags }) {
18718
18718
  const [inputValue, setInputValue] = useState4("");
18719
18719
  const [pendingChatInput, setPendingChatInput] = useState4("");
18720
18720
  const initialUploadDoneRef = useRef2(false);
18721
- useInput3((input, key) => {
18721
+ useInput3((input2, key) => {
18722
18722
  if (key.escape) {
18723
18723
  setRoute("workspaces");
18724
18724
  setSelectedWorkspace(null);
@@ -18857,7 +18857,7 @@ import { NodeFSStorageAdapter } from "@automerge/automerge-repo-storage-nodefs";
18857
18857
  import { WebSocketClientAdapter } from "@automerge/automerge-repo-network-websocket";
18858
18858
 
18859
18859
  // ../mod-core/dist/utils/resolveAutomergeWsUrl.js
18860
- var DEFAULT_AUTOMERGE_WS_URL = "ws://localhost:3031";
18860
+ var DEFAULT_AUTOMERGE_WS_URL = "wss://mod-monorepo.onrender.com";
18861
18861
  var LOCAL_AUTOMERGE_WS_URL = "ws://localhost:3031";
18862
18862
  var ENV_KEYS = [
18863
18863
  "AUTOMERGE_WS_URL",
@@ -19047,6 +19047,7 @@ async function agentsRunCommand(args, repo2) {
19047
19047
  // dist/lib/storage.js
19048
19048
  import fs6 from "fs";
19049
19049
  import path6 from "path";
19050
+ import crypto2 from "crypto";
19050
19051
  import os from "os";
19051
19052
 
19052
19053
  // dist/types/config.js
@@ -19107,6 +19108,29 @@ function writeConfig(config) {
19107
19108
  const configPath = getConfigPath2();
19108
19109
  atomicWrite(configPath, JSON.stringify(config, null, 2), 384);
19109
19110
  }
19111
+ function getWorkspaceConnectionPath(directoryPath) {
19112
+ const absolutePath = path6.resolve(directoryPath);
19113
+ const hash = crypto2.createHash("sha256").update(absolutePath).digest("hex").slice(0, 16);
19114
+ return path6.join(getModDir(), "workspaces", hash);
19115
+ }
19116
+ function readWorkspaceConnection(directoryPath) {
19117
+ const connectionPath = getWorkspaceConnectionPath(directoryPath);
19118
+ if (!fs6.existsSync(connectionPath)) {
19119
+ return null;
19120
+ }
19121
+ try {
19122
+ const content = fs6.readFileSync(connectionPath, "utf-8");
19123
+ return JSON.parse(content);
19124
+ } catch (error) {
19125
+ console.warn(`Warning: Could not read workspace connection for ${directoryPath}`);
19126
+ return null;
19127
+ }
19128
+ }
19129
+ function writeWorkspaceConnection(directoryPath, connection) {
19130
+ ensureModDir2();
19131
+ const connectionPath = getWorkspaceConnectionPath(directoryPath);
19132
+ atomicWrite(connectionPath, JSON.stringify(connection, null, 2), 384);
19133
+ }
19110
19134
  function atomicWrite(filePath, content, mode) {
19111
19135
  const tempPath = `${filePath}.tmp.${process.pid}`;
19112
19136
  fs6.writeFileSync(tempPath, content, { mode });
@@ -21752,8 +21776,8 @@ var SpecificationParserService = class {
21752
21776
  return `${filePath || "inline"}:${content.length}-${content.slice(0, 10)}`;
21753
21777
  }
21754
21778
  try {
21755
- const crypto4 = __require("crypto");
21756
- const key = `${filePath || "inline"}:${crypto4.createHash("md5").update(content).digest("hex")}`;
21779
+ const crypto5 = __require("crypto");
21780
+ const key = `${filePath || "inline"}:${crypto5.createHash("md5").update(content).digest("hex")}`;
21757
21781
  return key;
21758
21782
  } catch (error) {
21759
21783
  return `${filePath || "inline"}:${content.length}-${content.slice(0, 10)}`;
@@ -22133,7 +22157,7 @@ Thumbs.db
22133
22157
  };
22134
22158
 
22135
22159
  // dist/services/automatic-file-tracker.js
22136
- import crypto2 from "crypto";
22160
+ import crypto3 from "crypto";
22137
22161
  var AutomaticFileTracker = class {
22138
22162
  constructor(repo2) {
22139
22163
  this.debounceTimers = /* @__PURE__ */ new Map();
@@ -22375,7 +22399,7 @@ var AutomaticFileTracker = class {
22375
22399
  return detectMimeType(fileName);
22376
22400
  }
22377
22401
  getContentHash(content) {
22378
- return crypto2.createHash("sha256").update(content, "utf8").digest("hex");
22402
+ return crypto3.createHash("sha256").update(content, "utf8").digest("hex");
22379
22403
  }
22380
22404
  async disableAutoTracking() {
22381
22405
  if (!this.isTracking)
@@ -24714,7 +24738,7 @@ Examples:
24714
24738
  // dist/services/file-import-service.js
24715
24739
  import fs14 from "fs";
24716
24740
  import path16 from "path";
24717
- import crypto3 from "crypto";
24741
+ import crypto4 from "crypto";
24718
24742
  var FileImportService = class {
24719
24743
  constructor(repo2) {
24720
24744
  this.folderCache = /* @__PURE__ */ new Map();
@@ -24915,7 +24939,7 @@ var FileImportService = class {
24915
24939
  try {
24916
24940
  const content = await fs14.promises.readFile(filePath, "utf-8");
24917
24941
  const relativePath = path16.relative(workingDir, filePath);
24918
- const contentHash = crypto3.createHash("sha256").update(content).digest("hex");
24942
+ const contentHash = crypto4.createHash("sha256").update(content).digest("hex");
24919
24943
  const pathParts = relativePath.split(path16.sep);
24920
24944
  const fileName = pathParts.pop();
24921
24945
  const dirPath = pathParts.join("/");
@@ -25096,36 +25120,211 @@ async function syncCommand(args, repo2) {
25096
25120
  import fs15 from "fs";
25097
25121
  import path17 from "path";
25098
25122
  import { fileURLToPath as fileURLToPath3 } from "url";
25123
+
25124
+ // dist/lib/prompts.js
25125
+ import readline from "readline";
25126
+ async function select(question, options) {
25127
+ const rl = readline.createInterface({
25128
+ input: process.stdin,
25129
+ output: process.stdout
25130
+ });
25131
+ return new Promise((resolve5) => {
25132
+ console.log(`
25133
+ ${question}`);
25134
+ options.forEach((option, index) => {
25135
+ const number = `${index + 1}.`.padEnd(3);
25136
+ if (option.description) {
25137
+ console.log(` ${number} ${option.label}`);
25138
+ console.log(` ${option.description}`);
25139
+ } else {
25140
+ console.log(` ${number} ${option.label}`);
25141
+ }
25142
+ });
25143
+ console.log();
25144
+ const prompt = () => {
25145
+ rl.question("Select [1-" + options.length + "]: ", (answer) => {
25146
+ const num = parseInt(answer.trim(), 10);
25147
+ if (num >= 1 && num <= options.length) {
25148
+ rl.close();
25149
+ resolve5(options[num - 1].value);
25150
+ } else {
25151
+ console.log(`Please enter a number between 1 and ${options.length}`);
25152
+ prompt();
25153
+ }
25154
+ });
25155
+ };
25156
+ prompt();
25157
+ });
25158
+ }
25159
+ async function input(question, options) {
25160
+ const rl = readline.createInterface({
25161
+ input: process.stdin,
25162
+ output: process.stdout
25163
+ });
25164
+ return new Promise((resolve5) => {
25165
+ const defaultSuffix = (options == null ? void 0 : options.default) ? ` (${options.default})` : "";
25166
+ const promptText = `${question}${defaultSuffix}: `;
25167
+ const prompt = () => {
25168
+ rl.question(promptText, (answer) => {
25169
+ const value = answer.trim() || (options == null ? void 0 : options.default) || "";
25170
+ if (options == null ? void 0 : options.validate) {
25171
+ const error = options.validate(value);
25172
+ if (error) {
25173
+ console.log(` ${error}`);
25174
+ prompt();
25175
+ return;
25176
+ }
25177
+ }
25178
+ rl.close();
25179
+ resolve5(value);
25180
+ });
25181
+ };
25182
+ prompt();
25183
+ });
25184
+ }
25185
+ function validateWorkspaceName(name) {
25186
+ if (!name || name.trim().length === 0) {
25187
+ return "Workspace name cannot be empty";
25188
+ }
25189
+ if (name.length > 100) {
25190
+ return "Workspace name must be 100 characters or less";
25191
+ }
25192
+ if (!/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*[a-zA-Z0-9]$|^[a-zA-Z0-9]$/.test(name.trim())) {
25193
+ return "Workspace name must start and end with alphanumeric characters";
25194
+ }
25195
+ return null;
25196
+ }
25197
+
25198
+ // dist/commands/init.js
25099
25199
  var __filename3 = fileURLToPath3(import.meta.url);
25100
25200
  var __dirname3 = path17.dirname(__filename3);
25101
25201
  async function initCommand(args, repo2) {
25102
25202
  const subcommand = args[0];
25203
+ const isForce = args.includes("--force");
25103
25204
  if (subcommand === "list" || args.includes("--list")) {
25104
25205
  await listAvailableCommands();
25105
25206
  process.exit(0);
25106
25207
  }
25107
25208
  try {
25108
- const workspaceStatus = await checkWorkspaceStatus(repo2);
25209
+ ensureModDir2();
25210
+ const currentDir = process.cwd();
25211
+ const existingConnection = readWorkspaceConnection(currentDir);
25212
+ if (existingConnection && !isForce) {
25213
+ console.log("Already initialized");
25214
+ console.log(`Workspace: ${existingConnection.workspaceName}`);
25215
+ console.log("");
25216
+ console.log("Run `mod sync start` to begin syncing");
25217
+ console.log("");
25218
+ console.log("To connect to a different workspace, run `mod init --force`");
25219
+ process.exit(0);
25220
+ }
25109
25221
  await ensureClaudeCommandsDirectory();
25110
25222
  const availableCommands = await discoverAvailableCommands();
25111
25223
  const installedCommands = await getInstalledCommands();
25112
- const commandsToInstall = await determineCommandsToInstall(availableCommands, installedCommands, args.includes("--force"));
25224
+ const commandsToInstall = await determineCommandsToInstall(availableCommands, installedCommands, isForce);
25113
25225
  if (commandsToInstall.length > 0) {
25114
- displayInstallationPlan(commandsToInstall);
25115
- const shouldProceed = args.includes("--force") || await confirmInstallation(commandsToInstall);
25116
- if (!shouldProceed) {
25117
- console.log("Installation cancelled");
25118
- process.exit(0);
25119
- }
25120
25226
  await installCommands(commandsToInstall);
25121
25227
  }
25122
- const finalWorkspaceStatus = await handleWorkspaceInitialization(workspaceStatus, repo2);
25123
- displayInitializationSuccess(commandsToInstall, finalWorkspaceStatus);
25228
+ const config = readConfig();
25229
+ const isAuthenticated = !!config.auth;
25230
+ let workspaceConnection;
25231
+ if (isAuthenticated) {
25232
+ workspaceConnection = await handleAuthenticatedInit(repo2, config.auth.email);
25233
+ } else {
25234
+ workspaceConnection = await handleUnauthenticatedInit(repo2);
25235
+ }
25236
+ writeWorkspaceConnection(currentDir, workspaceConnection);
25237
+ displayInitializationSuccess(commandsToInstall, workspaceConnection, isAuthenticated);
25124
25238
  process.exit(0);
25125
25239
  } catch (error) {
25126
25240
  handleInstallationError(error);
25127
25241
  }
25128
25242
  }
25243
+ async function handleAuthenticatedInit(repo2, email) {
25244
+ console.log(`Signed in as ${email}`);
25245
+ const modWorkspace = createModWorkspace(repo2);
25246
+ let workspaces = [];
25247
+ try {
25248
+ const handles = await modWorkspace.listWorkspaces();
25249
+ workspaces = handles.map((h) => ({ id: h.id, name: h.name }));
25250
+ } catch (error) {
25251
+ console.warn("Could not load cloud workspaces. Creating local workspace.");
25252
+ }
25253
+ const options = [
25254
+ ...workspaces.map((w) => ({
25255
+ label: w.name,
25256
+ value: { type: "existing", id: w.id, name: w.name }
25257
+ })),
25258
+ {
25259
+ label: "+ Create new workspace",
25260
+ value: { type: "create", id: "", name: "" }
25261
+ }
25262
+ ];
25263
+ const choice = await select("Select workspace:", options);
25264
+ if (choice.type === "create") {
25265
+ return await createNewWorkspace(repo2);
25266
+ }
25267
+ return {
25268
+ path: process.cwd(),
25269
+ workspaceId: choice.id,
25270
+ workspaceName: choice.name,
25271
+ connectedAt: (/* @__PURE__ */ new Date()).toISOString(),
25272
+ lastSyncedAt: (/* @__PURE__ */ new Date()).toISOString()
25273
+ };
25274
+ }
25275
+ async function handleUnauthenticatedInit(repo2) {
25276
+ const choice = await select("Select option:", [
25277
+ {
25278
+ label: "Create local workspace",
25279
+ value: "create",
25280
+ description: "Work offline, sync later"
25281
+ },
25282
+ {
25283
+ label: "Sign in to sync with team",
25284
+ value: "signin",
25285
+ description: "Access cloud workspaces"
25286
+ }
25287
+ ]);
25288
+ if (choice === "signin") {
25289
+ console.log("");
25290
+ console.log("Please run `mod auth login` to sign in, then run `mod init` again.");
25291
+ process.exit(0);
25292
+ }
25293
+ return await createNewWorkspace(repo2);
25294
+ }
25295
+ async function createNewWorkspace(repo2) {
25296
+ const currentDirName = path17.basename(process.cwd());
25297
+ const defaultName = currentDirName.charAt(0).toUpperCase() + currentDirName.slice(1);
25298
+ const name = await input("Workspace name", {
25299
+ default: defaultName,
25300
+ validate: validateWorkspaceName
25301
+ });
25302
+ console.log("Creating workspace...");
25303
+ const modWorkspace = createModWorkspace(repo2);
25304
+ const workspace = await modWorkspace.createWorkspace({ name });
25305
+ return {
25306
+ path: process.cwd(),
25307
+ workspaceId: workspace.id,
25308
+ workspaceName: workspace.name,
25309
+ connectedAt: (/* @__PURE__ */ new Date()).toISOString(),
25310
+ lastSyncedAt: (/* @__PURE__ */ new Date()).toISOString()
25311
+ };
25312
+ }
25313
+ function displayInitializationSuccess(commands, connection, isAuthenticated) {
25314
+ console.log("");
25315
+ console.log("Initialized Mod in " + connection.path);
25316
+ console.log(`Workspace: ${connection.workspaceName}`);
25317
+ if (commands.length > 0) {
25318
+ console.log("");
25319
+ console.log(`Installed ${commands.length} Claude command(s)`);
25320
+ }
25321
+ console.log("");
25322
+ if (isAuthenticated) {
25323
+ console.log("Run `mod sync start` to begin syncing");
25324
+ } else {
25325
+ console.log("Run `mod auth login` to enable sync with collaborators");
25326
+ }
25327
+ }
25129
25328
  async function ensureClaudeCommandsDirectory() {
25130
25329
  const claudeDir = path17.join(process.cwd(), ".claude");
25131
25330
  const commandsDir = path17.join(claudeDir, "commands");
@@ -25144,7 +25343,6 @@ async function discoverAvailableCommands() {
25144
25343
  const packageRoot = path17.resolve(__dirname3, "../..");
25145
25344
  const commandsSourceDir = path17.join(packageRoot, "commands");
25146
25345
  if (!fs15.existsSync(commandsSourceDir)) {
25147
- console.warn("\u26A0\uFE0F No commands directory found in CLI package");
25148
25346
  return [];
25149
25347
  }
25150
25348
  const commands = [];
@@ -25176,7 +25374,7 @@ async function getInstalledCommands() {
25176
25374
  const metadata = parseFrontmatter(content);
25177
25375
  installed.set(filename, metadata);
25178
25376
  } catch (error) {
25179
- console.warn(`\u26A0\uFE0F Could not read metadata from ${filename}: ${error.message}`);
25377
+ console.warn(`Could not read metadata from ${filename}: ${error.message}`);
25180
25378
  }
25181
25379
  }
25182
25380
  return installed;
@@ -25186,7 +25384,6 @@ function parseFrontmatter(content) {
25186
25384
  if (!frontmatterMatch) {
25187
25385
  return {
25188
25386
  version: "0.0.0",
25189
- // Old version to trigger update
25190
25387
  updated: "1970-01-01",
25191
25388
  checksum: "",
25192
25389
  description: void 0
@@ -25236,45 +25433,12 @@ function compareVersions(v1, v2) {
25236
25433
  }
25237
25434
  return 0;
25238
25435
  }
25239
- async function listAvailableCommands() {
25240
- console.log("\u{1F4CB} Available Claude Commands:\n");
25241
- try {
25242
- const commands = await discoverAvailableCommands();
25243
- if (commands.length === 0) {
25244
- console.log(" No commands available");
25245
- return;
25246
- }
25247
- for (const command of commands) {
25248
- console.log(` ${command.filename.replace(".md", "")}`);
25249
- console.log(` \u251C\u2500\u2500 Version: ${command.metadata.version}`);
25250
- if (command.metadata.description) {
25251
- console.log(` \u2514\u2500\u2500 Description: ${command.metadata.description}`);
25252
- } else {
25253
- console.log(` \u2514\u2500\u2500 Updated: ${command.metadata.updated}`);
25254
- }
25255
- console.log();
25256
- }
25257
- } catch (error) {
25258
- console.error("\u274C Error listing commands:", error.message);
25259
- }
25260
- }
25261
- function displayInstallationPlan(commands) {
25262
- console.log("\u{1F4E6} Installing Claude Commands:\n");
25263
- for (const command of commands) {
25264
- console.log(` ${command.filename.replace(".md", "")} (v${command.metadata.version})`);
25265
- }
25266
- console.log();
25267
- }
25268
- async function confirmInstallation(commands) {
25269
- return true;
25270
- }
25271
25436
  async function installCommands(commands) {
25272
25437
  const commandsDir = path17.join(process.cwd(), ".claude", "commands");
25273
25438
  const tempFiles = [];
25274
25439
  try {
25275
25440
  for (const command of commands) {
25276
25441
  const tempPath = path17.join(commandsDir, `${command.filename}.tmp`);
25277
- const finalPath = path17.join(commandsDir, command.filename);
25278
25442
  const contentWithChecksum = await updateChecksumInContent(command.content);
25279
25443
  fs15.writeFileSync(tempPath, contentWithChecksum, "utf8");
25280
25444
  tempFiles.push(tempPath);
@@ -25290,8 +25454,8 @@ async function installCommands(commands) {
25290
25454
  }
25291
25455
  }
25292
25456
  async function updateChecksumInContent(content) {
25293
- const crypto4 = await import("crypto");
25294
- const contentHash = crypto4.createHash("sha256").update(content).digest("hex").substring(0, 16);
25457
+ const crypto5 = await import("crypto");
25458
+ const contentHash = crypto5.createHash("sha256").update(content).digest("hex").substring(0, 16);
25295
25459
  const withoutChecksum = content.replace(/^(\s*)checksum:\s*\S*$/gm, "");
25296
25460
  return withoutChecksum.replace(/^(---\n)([\s\S]*?)(---)/, `$1$2checksum: ${contentHash}
25297
25461
  $3`);
@@ -25303,130 +25467,43 @@ function cleanup(tempFiles) {
25303
25467
  fs15.unlinkSync(file);
25304
25468
  }
25305
25469
  } catch (error) {
25306
- console.warn(`\u26A0\uFE0F Could not clean up temporary file ${file}: ${error.message}`);
25470
+ console.warn(`Could not clean up temporary file ${file}: ${error.message}`);
25307
25471
  }
25308
25472
  }
25309
25473
  }
25310
- function displayInitializationSuccess(commands, workspaceStatus) {
25311
- console.log("\u2705 Initialization Complete!\n");
25312
- if (commands.length > 0) {
25313
- console.log(`\u{1F4E6} Installed ${commands.length} Claude command(s):
25314
- `);
25315
- for (const command of commands) {
25316
- const commandName = command.filename.replace(".md", "");
25317
- console.log(` /${commandName} - ${command.metadata.description || "Mod workflow command"}`);
25318
- }
25319
- console.log();
25320
- } else {
25321
- console.log("\u2705 All Claude commands are up to date\n");
25322
- }
25323
- if (workspaceStatus.created) {
25324
- console.log(`\u{1F680} Created new workspace: "${workspaceStatus.workspaceName}"`);
25325
- } else {
25326
- console.log(`\u{1F4C1} Using existing workspace: "${workspaceStatus.workspaceName}"`);
25327
- }
25328
- console.log("\n\u{1F4A1} Usage:");
25329
- console.log(' Open Claude Code and type "/" to see available commands');
25330
- console.log(' Use "mod workspace list" to see all workspaces');
25331
- console.log(" Commands are available in your .claude/commands directory\n");
25332
- }
25333
- async function checkWorkspaceStatus(repo2) {
25474
+ async function listAvailableCommands() {
25475
+ console.log("Available Claude Commands:\n");
25334
25476
  try {
25335
- const config = await readModConfig();
25336
- if (config && config.workspaceId) {
25337
- let workspaceName = "Existing Workspace";
25338
- if (repo2) {
25339
- try {
25340
- const modWorkspace = createModWorkspace(repo2);
25341
- const workspaces = await modWorkspace.listWorkspaces();
25342
- const currentWorkspace = workspaces.find((w) => w.id === config.workspaceId);
25343
- if (currentWorkspace) {
25344
- workspaceName = currentWorkspace.name;
25345
- }
25346
- } catch (error) {
25347
- console.warn("\u26A0\uFE0F Could not fetch workspace name, using generic name");
25348
- }
25477
+ const commands = await discoverAvailableCommands();
25478
+ if (commands.length === 0) {
25479
+ console.log(" No commands available");
25480
+ return;
25481
+ }
25482
+ for (const command of commands) {
25483
+ console.log(` ${command.filename.replace(".md", "")}`);
25484
+ console.log(` Version: ${command.metadata.version}`);
25485
+ if (command.metadata.description) {
25486
+ console.log(` Description: ${command.metadata.description}`);
25349
25487
  }
25350
- return {
25351
- exists: true,
25352
- created: false,
25353
- workspaceName,
25354
- workspaceId: config.workspaceId
25355
- };
25488
+ console.log();
25356
25489
  }
25357
- return {
25358
- exists: false,
25359
- created: false,
25360
- workspaceName: "New Workspace",
25361
- workspaceId: void 0
25362
- };
25363
- } catch (error) {
25364
- return {
25365
- exists: false,
25366
- created: false,
25367
- workspaceName: "New Workspace",
25368
- workspaceId: void 0
25369
- };
25370
- }
25371
- }
25372
- async function handleWorkspaceInitialization(workspaceStatus, repo2) {
25373
- if (workspaceStatus.exists) {
25374
- return workspaceStatus;
25375
- }
25376
- try {
25377
- const modWorkspace = createModWorkspace(repo2);
25378
- const workspaceName = generateWorkspaceName();
25379
- console.log(`\u{1F680} Creating new workspace: "${workspaceName}"...`);
25380
- const workspace = await modWorkspace.createWorkspace({
25381
- name: workspaceName
25382
- });
25383
- const config = {
25384
- workspaceId: workspace.id,
25385
- activeBranchId: void 0
25386
- };
25387
- await writeModConfig(config);
25388
- return {
25389
- exists: false,
25390
- created: true,
25391
- workspaceName: workspace.name,
25392
- workspaceId: workspace.id
25393
- };
25394
25490
  } catch (error) {
25395
- console.warn(`\u26A0\uFE0F Failed to create workspace: ${error.message}`);
25396
- console.log(" Continuing with command installation only.");
25397
- return {
25398
- exists: false,
25399
- created: false,
25400
- workspaceName: "Failed to create",
25401
- workspaceId: void 0
25402
- };
25403
- }
25404
- }
25405
- function generateWorkspaceName() {
25406
- const currentDir = path17.basename(process.cwd());
25407
- const timestamp = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
25408
- if (currentDir && currentDir !== "." && currentDir !== "/" && currentDir.length > 1) {
25409
- return currentDir.charAt(0).toUpperCase() + currentDir.slice(1);
25491
+ console.error("Error listing commands:", error.message);
25410
25492
  }
25411
- return `Workspace-${timestamp}`;
25412
25493
  }
25413
25494
  function handleInstallationError(error) {
25414
- console.error("\u274C Initialization failed:");
25495
+ console.error("Initialization failed:");
25415
25496
  if (error.code === "EACCES" || error.code === "EPERM") {
25416
- console.error(" Permission denied. Try running with appropriate permissions.");
25417
- console.error(" Make sure you have write access to the .claude/commands directory.");
25497
+ console.error(" Permission denied.");
25418
25498
  } else if (error.code === "ENOSPC") {
25419
25499
  console.error(" Insufficient disk space.");
25420
- } else if (error.code === "ENOTDIR") {
25421
- console.error(" Invalid directory structure. Ensure .claude is a directory, not a file.");
25422
25500
  } else {
25423
25501
  console.error(` ${error.message}`);
25424
25502
  }
25425
- console.error("\n\u{1F527} Troubleshooting:");
25426
- console.error(" - Ensure you have write permissions in the current directory");
25427
- console.error(' - Try running "mod init --force" to overwrite existing files');
25428
- console.error(" - Check that .claude is not a file (should be a directory)");
25429
- console.error(' - For workspace issues, try "mod workspace create <name>" separately');
25503
+ console.error("");
25504
+ console.error("Troubleshooting:");
25505
+ console.error(" - Ensure you have write permissions");
25506
+ console.error(' - Try running "mod init --force" to overwrite');
25430
25507
  process.exit(1);
25431
25508
  }
25432
25509