@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/cli.js CHANGED
@@ -19,12 +19,14 @@ import {
19
19
  loadConfig,
20
20
  matchesAny,
21
21
  matchesTable,
22
+ mcpOutDir,
22
23
  nearestKey,
23
24
  nestjsOutDir,
25
+ nextOutDir,
24
26
  tableAliases,
25
27
  tableFilterWarnings,
26
28
  trpcOutDir
27
- } from "./chunk-QNYJFUVS.js";
29
+ } from "./chunk-67XCOBVS.js";
28
30
 
29
31
  // src/cli.ts
30
32
  import { qualifiedTableName as qualifiedTableName2, SchemaAnalyzer as SchemaAnalyzer2 } from "@drzl/analyzer";
@@ -336,6 +338,50 @@ function jsonSchemaOptions(g, cfg, outDir) {
336
338
  };
337
339
  }
338
340
 
341
+ // src/mcp-options.ts
342
+ function mcpOptions(g, cfg) {
343
+ return {
344
+ outputDir: mcpOutDir(g, cfg),
345
+ sdk: g.sdk,
346
+ serverName: g.serverName,
347
+ serverVersion: g.serverVersion,
348
+ stdio: g.stdio,
349
+ naming: g.naming,
350
+ outputHeader: g.outputHeader,
351
+ format: g.format,
352
+ importExtension: g.importExtension,
353
+ validation: g.validation
354
+ };
355
+ }
356
+
357
+ // src/next-options.ts
358
+ var VALIDATOR_DEFAULT_DIRS = {
359
+ zod: "src/validators/zod",
360
+ valibot: "src/validators/valibot",
361
+ arktype: "src/validators/arktype"
362
+ };
363
+ function projectRelative(p) {
364
+ return p.startsWith("./") ? p.slice(2) : p;
365
+ }
366
+ function nextOptions(g, cfg) {
367
+ const library = g.validation?.library ?? "zod";
368
+ const siblings = cfg.generators.filter((s) => s.kind === library);
369
+ const derived = siblings.length === 1 ? projectRelative(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS[library]) : void 0;
370
+ return {
371
+ outputDir: nextOutDir(g, cfg),
372
+ naming: g.naming,
373
+ outputHeader: g.outputHeader,
374
+ format: g.format,
375
+ importExtension: g.importExtension,
376
+ validation: {
377
+ ...g.validation,
378
+ library,
379
+ useShared: true,
380
+ importPath: g.validation?.importPath ?? derived
381
+ }
382
+ };
383
+ }
384
+
339
385
  // src/nestjs-options.ts
340
386
  function nestjsOptions(g, cfg) {
341
387
  return {
@@ -404,7 +450,7 @@ function trpcOptions(g, cfg, servicesDir) {
404
450
  }
405
451
 
406
452
  // src/generator-registry.ts
407
- var VALIDATOR_DEFAULT_DIRS = {
453
+ var VALIDATOR_DEFAULT_DIRS2 = {
408
454
  zod: "src/validators/zod",
409
455
  valibot: "src/validators/valibot",
410
456
  arktype: "src/validators/arktype",
@@ -487,6 +533,29 @@ var GENERATORS = [
487
533
  outputDir: (g, cfg) => graphqlOutDir(g, cfg),
488
534
  options: (g, cfg) => graphqlOptions(g, cfg)
489
535
  },
536
+ {
537
+ kind: "mcp",
538
+ // The one `optionalDependency` in this package's manifest, and temporarily so. A package that
539
+ // has never existed cannot publish through npm's trusted-publisher OIDC flow, so naming it as
540
+ // a hard dependency in the release that introduces it breaks `npm i @drzl/cli` for everyone
541
+ // until the first publish lands. `scripts/verify/stages/33-registry-deps.sh` gates that rule.
542
+ // It moves into `dependencies` beside the other fourteen once it is on the registry; tsup
543
+ // externalises all three dependency fields, so nothing about what runs changes when it does.
544
+ specifier: "@drzl/generator-mcp",
545
+ load: () => import("@drzl/generator-mcp"),
546
+ construct: (m, analysis) => new m.MCPGenerator(analysis),
547
+ outputDir: (g, cfg) => mcpOutDir(g, cfg),
548
+ options: (g, cfg) => mcpOptions(g, cfg)
549
+ },
550
+ {
551
+ kind: "next",
552
+ // Optional for the same reason as `mcp` above, and for the same one release only.
553
+ specifier: "@drzl/generator-next",
554
+ load: () => import("@drzl/generator-next"),
555
+ construct: (m, analysis) => new m.NextGenerator(analysis),
556
+ outputDir: (g, cfg) => nextOutDir(g, cfg),
557
+ options: (g, cfg) => nextOptions(g, cfg)
558
+ },
490
559
  {
491
560
  kind: "service",
492
561
  specifier: "@drzl/generator-service",
@@ -500,7 +569,7 @@ var GENERATORS = [
500
569
  specifier: "@drzl/generator-zod",
501
570
  load: () => import("@drzl/generator-zod"),
502
571
  construct: (m, analysis) => new m.ZodGenerator(analysis),
503
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS.zod,
572
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2.zod,
504
573
  // `meta` is zod-only; see `GeneratorCapabilities.meta` for why it is not passed to the other
505
574
  // four rather than being passed and ignored.
506
575
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, {
@@ -514,7 +583,7 @@ var GENERATORS = [
514
583
  specifier: "@drzl/generator-valibot",
515
584
  load: () => import("@drzl/generator-valibot"),
516
585
  construct: (m, analysis) => new m.ValibotGenerator(analysis),
517
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS.valibot,
586
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2.valibot,
518
587
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true, constraints: true })
519
588
  },
520
589
  {
@@ -522,7 +591,7 @@ var GENERATORS = [
522
591
  specifier: "@drzl/generator-arktype",
523
592
  load: () => import("@drzl/generator-arktype"),
524
593
  construct: (m, analysis) => new m.ArkTypeGenerator(analysis),
525
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS.arktype,
594
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2.arktype,
526
595
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: false })
527
596
  },
528
597
  {
@@ -530,7 +599,7 @@ var GENERATORS = [
530
599
  specifier: "@drzl/generator-typebox",
531
600
  load: () => import("@drzl/generator-typebox"),
532
601
  construct: (m, analysis) => new m.TypeBoxGenerator(analysis),
533
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS.typebox,
602
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2.typebox,
534
603
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true, standardSchema: true })
535
604
  },
536
605
  {
@@ -538,7 +607,7 @@ var GENERATORS = [
538
607
  specifier: "@drzl/generator-effect",
539
608
  load: () => import("@drzl/generator-effect"),
540
609
  construct: (m, analysis) => new m.EffectGenerator(analysis),
541
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS.effect,
610
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2.effect,
542
611
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true })
543
612
  },
544
613
  {
@@ -546,7 +615,7 @@ var GENERATORS = [
546
615
  specifier: "@drzl/generator-json-schema",
547
616
  load: () => import("@drzl/generator-json-schema"),
548
617
  construct: (m, analysis) => new m.JsonSchemaGenerator(analysis),
549
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS["json-schema"],
618
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2["json-schema"],
550
619
  options: (g, cfg, ctx) => jsonSchemaOptions(g, cfg, ctx.outDir)
551
620
  }
552
621
  ];