@drzl/cli 4.28.0 → 4.30.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/cli.cjs CHANGED
@@ -508,6 +508,8 @@ var GeneratorKindSchema = import_zod.z.enum([
508
508
  "nestjs",
509
509
  "graphql",
510
510
  "ai",
511
+ "effect-http",
512
+ "h3",
511
513
  "mcp",
512
514
  "next",
513
515
  "tanstack-start",
@@ -540,6 +542,17 @@ var GeneratorSchema = import_zod.z.object({
540
542
  * refuses that combination rather than emitting a server that dies on startup.
541
543
  */
542
544
  sdk: import_zod.z.enum(["v1", "v2"]).optional(),
545
+ /**
546
+ * Which h3 major the emitted route handlers are written against. `h3` only.
547
+ *
548
+ * `v1` is the default and is what released Nitro depends on: nitropack 2.13.4 names
549
+ * `h3: ^1.15.11`, while h3's own `latest` tag is a 2.x release candidate. v1 has no Standard
550
+ * Schema overload on its validation helpers, so the emitted modules carry an adapter; v2 takes a
551
+ * schema directly and carries none.
552
+ */
553
+ h3: import_zod.z.enum(["v1", "v2"]).optional(),
554
+ /** The identifier the assembled `HttpApi` carries. `effect-http` only, defaults to `'api'`. */
555
+ apiName: import_zod.z.string().optional(),
543
556
  /** The name and version the emitted MCP server reports at initialize. `mcp` only. */
544
557
  serverName: import_zod.z.string().optional(),
545
558
  serverVersion: import_zod.z.string().optional(),
@@ -934,7 +947,9 @@ var ROUTER_KINDS = /* @__PURE__ */ new Set([
934
947
  "mcp",
935
948
  "next",
936
949
  "ai",
937
- "tanstack-start"
950
+ "tanstack-start",
951
+ "h3",
952
+ "effect-http"
938
953
  ]);
939
954
  var INJECTION_KINDS = /* @__PURE__ */ new Set(["orpc", "trpc"]);
940
955
  function trpcOutDir(g, cfg) {
@@ -967,6 +982,12 @@ function aiOutDir(g, cfg) {
967
982
  function tanstackStartOutDir(g, cfg) {
968
983
  return g.path ?? cfg.outDir;
969
984
  }
985
+ function h3OutDir(g, cfg) {
986
+ return g.path ?? cfg.outDir;
987
+ }
988
+ function effectHttpOutDir(g, cfg) {
989
+ return g.path ?? cfg.outDir;
990
+ }
970
991
  function sharedSchemaNames(opts) {
971
992
  const resolved = (0, import_validation_core.resolveAffix)(opts);
972
993
  return import_validation_core.NAME_MODES.map((mode) => (0, import_validation_core.schemaName)(mode, import_validation_core.AFFIX_PROBE_TABLE, resolved));
@@ -1032,6 +1053,31 @@ function resolveConfig(cfg) {
1032
1053
  }
1033
1054
  continue;
1034
1055
  }
1056
+ if (g.kind === "effect-http") {
1057
+ if (g.validation?.library) {
1058
+ warnings.push(
1059
+ `drzl config: the "effect-http" generator sets validation.library, which it does not read. HttpApi declares its payloads as Effect Schema and takes nothing else, so there is no library to choose. Remove the key.`
1060
+ );
1061
+ }
1062
+ if (!g.validation?.importPath && !generators.some((s) => s.kind === "effect")) {
1063
+ warnings.push(
1064
+ `drzl config: the "effect-http" generator declares the Effect Schema modules a validation generator writes, and this config has no "effect" generator for it to import from. Add { kind: "effect" }, or set validation.importPath to wherever those schemas live.`
1065
+ );
1066
+ }
1067
+ }
1068
+ if (g.kind === "h3") {
1069
+ if (g.includeRelations) {
1070
+ warnings.push(
1071
+ `drzl config: the "h3" generator sets includeRelations, which it does not read yet. Relation lookups are a route this generator does not emit. Remove the flag.`
1072
+ );
1073
+ }
1074
+ const library2 = g.validation?.library ?? "zod";
1075
+ if (!g.validation?.importPath && !generators.some((s) => s.kind === library2)) {
1076
+ warnings.push(
1077
+ `drzl config: the "h3" generator validates with the schemas a validation generator writes, and this config has no "${library2}" generator for it to import from. Add { kind: "${library2}" }, or set validation.importPath to wherever those schemas live.`
1078
+ );
1079
+ }
1080
+ }
1035
1081
  if (g.kind === "tanstack-start") {
1036
1082
  if (g.includeRelations) {
1037
1083
  warnings.push(
@@ -1223,6 +1269,8 @@ function computeGeneratorOutputDirs(cfg, cwd = process.cwd()) {
1223
1269
  if (g.kind === "next") dirs.add(abs(nextOutDir(g, cfg)));
1224
1270
  if (g.kind === "ai") dirs.add(abs(aiOutDir(g, cfg)));
1225
1271
  if (g.kind === "tanstack-start") dirs.add(abs(tanstackStartOutDir(g, cfg)));
1272
+ if (g.kind === "h3") dirs.add(abs(h3OutDir(g, cfg)));
1273
+ if (g.kind === "effect-http") dirs.add(abs(effectHttpOutDir(g, cfg)));
1226
1274
  if (g.kind === "service") dirs.add(abs(g.path ?? "src/services"));
1227
1275
  if (g.kind === "zod") dirs.add(abs(g.path ?? "src/validators/zod"));
1228
1276
  if (g.kind === "valibot") dirs.add(abs(g.path ?? "src/validators/valibot"));
@@ -1419,6 +1467,60 @@ function aiOptions(g, cfg) {
1419
1467
  };
1420
1468
  }
1421
1469
 
1470
+ // src/effect-http-options.ts
1471
+ var VALIDATOR_DEFAULT_DIRS = { effect: "src/validators/effect" };
1472
+ function projectRelative(p) {
1473
+ return p.startsWith("./") ? p.slice(2) : p;
1474
+ }
1475
+ function effectHttpOptions(g, cfg) {
1476
+ const library = "effect";
1477
+ const siblings = cfg.generators.filter((s) => s.kind === library);
1478
+ const derived = siblings.length === 1 ? projectRelative(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS[library]) : void 0;
1479
+ return {
1480
+ outputDir: effectHttpOutDir(g, cfg),
1481
+ apiName: g.apiName,
1482
+ naming: g.naming,
1483
+ outputHeader: g.outputHeader,
1484
+ format: g.format,
1485
+ importExtension: g.importExtension,
1486
+ validation: {
1487
+ ...g.validation,
1488
+ library,
1489
+ useShared: true,
1490
+ importPath: g.validation?.importPath ?? derived
1491
+ }
1492
+ };
1493
+ }
1494
+
1495
+ // src/h3-options.ts
1496
+ var VALIDATOR_DEFAULT_DIRS2 = {
1497
+ zod: "src/validators/zod",
1498
+ valibot: "src/validators/valibot",
1499
+ arktype: "src/validators/arktype"
1500
+ };
1501
+ function projectRelative2(p) {
1502
+ return p.startsWith("./") ? p.slice(2) : p;
1503
+ }
1504
+ function h3Options(g, cfg) {
1505
+ const library = g.validation?.library ?? "zod";
1506
+ const siblings = cfg.generators.filter((s) => s.kind === library);
1507
+ const derived = siblings.length === 1 ? projectRelative2(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS2[library]) : void 0;
1508
+ return {
1509
+ outputDir: h3OutDir(g, cfg),
1510
+ h3: g.h3,
1511
+ naming: g.naming,
1512
+ outputHeader: g.outputHeader,
1513
+ format: g.format,
1514
+ importExtension: g.importExtension,
1515
+ validation: {
1516
+ ...g.validation,
1517
+ library,
1518
+ useShared: true,
1519
+ importPath: g.validation?.importPath ?? derived
1520
+ }
1521
+ };
1522
+ }
1523
+
1422
1524
  // src/mcp-options.ts
1423
1525
  function mcpOptions(g, cfg) {
1424
1526
  return {
@@ -1436,18 +1538,18 @@ function mcpOptions(g, cfg) {
1436
1538
  }
1437
1539
 
1438
1540
  // src/next-options.ts
1439
- var VALIDATOR_DEFAULT_DIRS = {
1541
+ var VALIDATOR_DEFAULT_DIRS3 = {
1440
1542
  zod: "src/validators/zod",
1441
1543
  valibot: "src/validators/valibot",
1442
1544
  arktype: "src/validators/arktype"
1443
1545
  };
1444
- function projectRelative(p) {
1546
+ function projectRelative3(p) {
1445
1547
  return p.startsWith("./") ? p.slice(2) : p;
1446
1548
  }
1447
1549
  function nextOptions(g, cfg) {
1448
1550
  const library = g.validation?.library ?? "zod";
1449
1551
  const siblings = cfg.generators.filter((s) => s.kind === library);
1450
- const derived = siblings.length === 1 ? projectRelative(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS[library]) : void 0;
1552
+ const derived = siblings.length === 1 ? projectRelative3(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS3[library]) : void 0;
1451
1553
  return {
1452
1554
  outputDir: nextOutDir(g, cfg),
1453
1555
  naming: g.naming,
@@ -1464,18 +1566,18 @@ function nextOptions(g, cfg) {
1464
1566
  }
1465
1567
 
1466
1568
  // src/tanstack-start-options.ts
1467
- var VALIDATOR_DEFAULT_DIRS2 = {
1569
+ var VALIDATOR_DEFAULT_DIRS4 = {
1468
1570
  zod: "src/validators/zod",
1469
1571
  valibot: "src/validators/valibot",
1470
1572
  arktype: "src/validators/arktype"
1471
1573
  };
1472
- function projectRelative2(p) {
1574
+ function projectRelative4(p) {
1473
1575
  return p.startsWith("./") ? p.slice(2) : p;
1474
1576
  }
1475
1577
  function tanstackStartOptions(g, cfg) {
1476
1578
  const library = g.validation?.library ?? "zod";
1477
1579
  const siblings = cfg.generators.filter((s) => s.kind === library);
1478
- const derived = siblings.length === 1 ? projectRelative2(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS2[library]) : void 0;
1580
+ const derived = siblings.length === 1 ? projectRelative4(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS4[library]) : void 0;
1479
1581
  return {
1480
1582
  outputDir: tanstackStartOutDir(g, cfg),
1481
1583
  naming: g.naming,
@@ -1559,7 +1661,7 @@ function trpcOptions(g, cfg, servicesDir) {
1559
1661
  }
1560
1662
 
1561
1663
  // src/generator-registry.ts
1562
- var VALIDATOR_DEFAULT_DIRS3 = {
1664
+ var VALIDATOR_DEFAULT_DIRS5 = {
1563
1665
  zod: "src/validators/zod",
1564
1666
  valibot: "src/validators/valibot",
1565
1667
  arktype: "src/validators/arktype",
@@ -1644,12 +1746,12 @@ var GENERATORS = [
1644
1746
  },
1645
1747
  {
1646
1748
  kind: "mcp",
1647
- // The one `optionalDependency` in this package's manifest, and temporarily so. A package that
1648
- // has never existed cannot publish through npm's trusted-publisher OIDC flow, so naming it as
1649
- // a hard dependency in the release that introduces it breaks `npm i @drzl/cli` for everyone
1650
- // until the first publish lands. `scripts/verify/stages/33-registry-deps.sh` gates that rule.
1651
- // It moves into `dependencies` beside the other fourteen once it is on the registry; tsup
1652
- // externalises all three dependency fields, so nothing about what runs changes when it does.
1749
+ // This one and the three below spent one release each in `optionalDependencies`, because a
1750
+ // package that has never existed cannot publish through npm's trusted-publisher OIDC flow and
1751
+ // naming it as a hard dependency in the release that introduces it breaks `npm i @drzl/cli`
1752
+ // for everyone until the first publish lands. All four are on the registry now, so all four
1753
+ // are ordinary dependencies. `scripts/verify/stages/33-registry-deps.sh` gates both halves of
1754
+ // that rule and is what reported the promotion was due.
1653
1755
  specifier: "@drzl/generator-mcp",
1654
1756
  load: () => import("@drzl/generator-mcp"),
1655
1757
  construct: (m, analysis) => new m.MCPGenerator(analysis),
@@ -1658,7 +1760,6 @@ var GENERATORS = [
1658
1760
  },
1659
1761
  {
1660
1762
  kind: "next",
1661
- // Optional for the same reason as `mcp` above, and for the same one release only.
1662
1763
  specifier: "@drzl/generator-next",
1663
1764
  load: () => import("@drzl/generator-next"),
1664
1765
  construct: (m, analysis) => new m.NextGenerator(analysis),
@@ -1667,7 +1768,6 @@ var GENERATORS = [
1667
1768
  },
1668
1769
  {
1669
1770
  kind: "ai",
1670
- // Optional for the same reason as `mcp` and `next` above, and for the same one release only.
1671
1771
  specifier: "@drzl/generator-ai",
1672
1772
  load: () => import("@drzl/generator-ai"),
1673
1773
  construct: (m, analysis) => new m.AIGenerator(analysis),
@@ -1676,13 +1776,28 @@ var GENERATORS = [
1676
1776
  },
1677
1777
  {
1678
1778
  kind: "tanstack-start",
1679
- // Optional for the same reason as the three above, and for the same one release only.
1680
1779
  specifier: "@drzl/generator-tanstack-start",
1681
1780
  load: () => import("@drzl/generator-tanstack-start"),
1682
1781
  construct: (m, analysis) => new m.TanStackStartGenerator(analysis),
1683
1782
  outputDir: (g, cfg) => tanstackStartOutDir(g, cfg),
1684
1783
  options: (g, cfg) => tanstackStartOptions(g, cfg)
1685
1784
  },
1785
+ {
1786
+ kind: "h3",
1787
+ specifier: "@drzl/generator-h3",
1788
+ load: () => import("@drzl/generator-h3"),
1789
+ construct: (m, analysis) => new m.H3Generator(analysis),
1790
+ outputDir: (g, cfg) => h3OutDir(g, cfg),
1791
+ options: (g, cfg) => h3Options(g, cfg)
1792
+ },
1793
+ {
1794
+ kind: "effect-http",
1795
+ specifier: "@drzl/generator-effect-http",
1796
+ load: () => import("@drzl/generator-effect-http"),
1797
+ construct: (m, analysis) => new m.EffectHttpGenerator(analysis),
1798
+ outputDir: (g, cfg) => effectHttpOutDir(g, cfg),
1799
+ options: (g, cfg) => effectHttpOptions(g, cfg)
1800
+ },
1686
1801
  {
1687
1802
  kind: "service",
1688
1803
  specifier: "@drzl/generator-service",
@@ -1696,7 +1811,7 @@ var GENERATORS = [
1696
1811
  specifier: "@drzl/generator-zod",
1697
1812
  load: () => import("@drzl/generator-zod"),
1698
1813
  construct: (m, analysis) => new m.ZodGenerator(analysis),
1699
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS3.zod,
1814
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS5.zod,
1700
1815
  // `meta` is zod-only; see `GeneratorCapabilities.meta` for why it is not passed to the other
1701
1816
  // four rather than being passed and ignored.
1702
1817
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, {
@@ -1710,7 +1825,7 @@ var GENERATORS = [
1710
1825
  specifier: "@drzl/generator-valibot",
1711
1826
  load: () => import("@drzl/generator-valibot"),
1712
1827
  construct: (m, analysis) => new m.ValibotGenerator(analysis),
1713
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS3.valibot,
1828
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS5.valibot,
1714
1829
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true, constraints: true })
1715
1830
  },
1716
1831
  {
@@ -1718,7 +1833,7 @@ var GENERATORS = [
1718
1833
  specifier: "@drzl/generator-arktype",
1719
1834
  load: () => import("@drzl/generator-arktype"),
1720
1835
  construct: (m, analysis) => new m.ArkTypeGenerator(analysis),
1721
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS3.arktype,
1836
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS5.arktype,
1722
1837
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: false })
1723
1838
  },
1724
1839
  {
@@ -1726,7 +1841,7 @@ var GENERATORS = [
1726
1841
  specifier: "@drzl/generator-typebox",
1727
1842
  load: () => import("@drzl/generator-typebox"),
1728
1843
  construct: (m, analysis) => new m.TypeBoxGenerator(analysis),
1729
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS3.typebox,
1844
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS5.typebox,
1730
1845
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true, standardSchema: true })
1731
1846
  },
1732
1847
  {
@@ -1734,7 +1849,7 @@ var GENERATORS = [
1734
1849
  specifier: "@drzl/generator-effect",
1735
1850
  load: () => import("@drzl/generator-effect"),
1736
1851
  construct: (m, analysis) => new m.EffectGenerator(analysis),
1737
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS3.effect,
1852
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS5.effect,
1738
1853
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true })
1739
1854
  },
1740
1855
  {
@@ -1742,7 +1857,7 @@ var GENERATORS = [
1742
1857
  specifier: "@drzl/generator-json-schema",
1743
1858
  load: () => import("@drzl/generator-json-schema"),
1744
1859
  construct: (m, analysis) => new m.JsonSchemaGenerator(analysis),
1745
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS3["json-schema"],
1860
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS5["json-schema"],
1746
1861
  options: (g, cfg, ctx) => jsonSchemaOptions(g, cfg, ctx.outDir)
1747
1862
  }
1748
1863
  ];