@drzl/cli 4.24.4 → 4.26.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/config.cjs CHANGED
@@ -54,7 +54,9 @@ __export(config_exports, {
54
54
  honoOutDir: () => honoOutDir,
55
55
  importFreshConfigModule: () => importFreshConfigModule,
56
56
  loadConfig: () => loadConfig,
57
+ mcpOutDir: () => mcpOutDir,
57
58
  nestjsOutDir: () => nestjsOutDir,
59
+ nextOutDir: () => nextOutDir,
58
60
  resolveConfig: () => resolveConfig,
59
61
  resolveTemplateDirsSync: () => resolveTemplateDirsSync,
60
62
  tableFilterWarnings: () => tableFilterWarnings,
@@ -304,7 +306,16 @@ function ambiguousPatternWarnings(patterns, tables, option) {
304
306
  // src/config.ts
305
307
  var NamingSchema = import_zod.z.object({
306
308
  routerSuffix: import_zod.z.string().default("Router"),
307
- procedureCase: import_zod.z.enum(["camel", "kebab", "snake"]).default("camel")
309
+ procedureCase: import_zod.z.enum(["camel", "kebab", "snake"]).default("camel"),
310
+ /**
311
+ * Placed in front of every generated MCP tool name, so one server can carry two schemas
312
+ * without collision: `db.users_list` rather than `users_list`. `mcp` only.
313
+ *
314
+ * There is no equivalent for the other kinds because there is nothing to collide: a router's
315
+ * procedures are separated by the URL tree or the router key they are mounted under, and MCP
316
+ * tool names are one flat namespace per server.
317
+ */
318
+ toolPrefix: import_zod.z.string()
308
319
  }).partial();
309
320
  var affixValueSchema = (pattern) => import_zod.z.union(
310
321
  [
@@ -342,6 +353,8 @@ var GeneratorKindSchema = import_zod.z.enum([
342
353
  "fastify",
343
354
  "nestjs",
344
355
  "graphql",
356
+ "mcp",
357
+ "next",
345
358
  "service",
346
359
  "zod",
347
360
  "valibot",
@@ -362,6 +375,23 @@ var GeneratorSchema = import_zod.z.object({
362
375
  * `@hono/zod-validator`, which is zod-specific.
363
376
  */
364
377
  validator: import_zod.z.enum(["standard", "zod"]).optional(),
378
+ /**
379
+ * Which generation of the MCP TypeScript SDK the emitted server is written against. `mcp` only.
380
+ *
381
+ * `v2` is `@modelcontextprotocol/server`, which takes any Standard Schema and so works with
382
+ * every library `validation.library` can name. `v1` is `@modelcontextprotocol/sdk`, which is
383
+ * zod-only: handed an arktype or valibot schema it throws at registration, so the generator
384
+ * refuses that combination rather than emitting a server that dies on startup.
385
+ */
386
+ sdk: import_zod.z.enum(["v1", "v2"]).optional(),
387
+ /** The name and version the emitted MCP server reports at initialize. `mcp` only. */
388
+ serverName: import_zod.z.string().optional(),
389
+ serverVersion: import_zod.z.string().optional(),
390
+ /**
391
+ * Also emit `stdio.ts`, a runnable entry point an MCP client's `command` can point at.
392
+ * `mcp` only, on by default.
393
+ */
394
+ stdio: import_zod.z.boolean().optional(),
365
395
  /**
366
396
  * Overrides the top-level `importExtension` for this generator alone, for a project whose
367
397
  * generated directories are compiled by different tsconfigs.
@@ -743,7 +773,7 @@ function buildConfigJsonSchema() {
743
773
  properties
744
774
  };
745
775
  }
746
- var ROUTER_KINDS = /* @__PURE__ */ new Set(["orpc", "trpc", "hono", "express"]);
776
+ var ROUTER_KINDS = /* @__PURE__ */ new Set(["orpc", "trpc", "hono", "express", "mcp", "next"]);
747
777
  var INJECTION_KINDS = /* @__PURE__ */ new Set(["orpc", "trpc"]);
748
778
  function trpcOutDir(g, cfg) {
749
779
  return g.path ?? cfg.outDir;
@@ -763,6 +793,12 @@ function nestjsOutDir(g, cfg) {
763
793
  function graphqlOutDir(g, cfg) {
764
794
  return g.path ?? cfg.outDir;
765
795
  }
796
+ function mcpOutDir(g, cfg) {
797
+ return g.path ?? cfg.outDir;
798
+ }
799
+ function nextOutDir(g, cfg) {
800
+ return g.path ?? cfg.outDir;
801
+ }
766
802
  function sharedSchemaNames(opts) {
767
803
  const resolved = (0, import_validation_core.resolveAffix)(opts);
768
804
  return import_validation_core.NAME_MODES.map((mode) => (0, import_validation_core.schemaName)(mode, import_validation_core.AFFIX_PROBE_TABLE, resolved));
@@ -828,6 +864,24 @@ function resolveConfig(cfg) {
828
864
  }
829
865
  continue;
830
866
  }
867
+ if (g.kind === "mcp" && g.includeRelations) {
868
+ warnings.push(
869
+ `drzl config: the "mcp" generator sets includeRelations, which it does not read. Relation lookups are routes, and this generator emits MCP tools rather than routes. Remove the flag.`
870
+ );
871
+ }
872
+ if (g.kind === "next") {
873
+ if (g.includeRelations) {
874
+ warnings.push(
875
+ `drzl config: the "next" generator sets includeRelations, which it does not read. Relation lookups are routes, and this generator emits server actions that parse a posted form. Remove the flag.`
876
+ );
877
+ }
878
+ const library2 = g.validation?.library ?? "zod";
879
+ if (!g.validation?.importPath && !generators.some((s) => s.kind === library2)) {
880
+ warnings.push(
881
+ `drzl config: the "next" generator parses 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.`
882
+ );
883
+ }
884
+ }
831
885
  if (!ROUTER_KINDS.has(g.kind)) continue;
832
886
  if (g.databaseInjection?.enabled && !INJECTION_KINDS.has(g.kind)) {
833
887
  warnings.push(
@@ -979,6 +1033,8 @@ function computeGeneratorOutputDirs(cfg, cwd = process.cwd()) {
979
1033
  if (g.kind === "fastify") dirs.add(abs(fastifyOutDir(g, cfg)));
980
1034
  if (g.kind === "nestjs") dirs.add(abs(nestjsOutDir(g, cfg)));
981
1035
  if (g.kind === "graphql") dirs.add(abs(graphqlOutDir(g, cfg)));
1036
+ if (g.kind === "mcp") dirs.add(abs(mcpOutDir(g, cfg)));
1037
+ if (g.kind === "next") dirs.add(abs(nextOutDir(g, cfg)));
982
1038
  if (g.kind === "service") dirs.add(abs(g.path ?? "src/services"));
983
1039
  if (g.kind === "zod") dirs.add(abs(g.path ?? "src/validators/zod"));
984
1040
  if (g.kind === "valibot") dirs.add(abs(g.path ?? "src/validators/valibot"));
@@ -1063,7 +1119,9 @@ function computeWatchTargets(cfg, cwd = process.cwd(), source) {
1063
1119
  honoOutDir,
1064
1120
  importFreshConfigModule,
1065
1121
  loadConfig,
1122
+ mcpOutDir,
1066
1123
  nestjsOutDir,
1124
+ nextOutDir,
1067
1125
  resolveConfig,
1068
1126
  resolveTemplateDirsSync,
1069
1127
  tableFilterWarnings,