@drzl/cli 4.24.3 → 4.25.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,13 @@ import {
19
19
  loadConfig,
20
20
  matchesAny,
21
21
  matchesTable,
22
+ mcpOutDir,
22
23
  nearestKey,
23
24
  nestjsOutDir,
24
25
  tableAliases,
25
26
  tableFilterWarnings,
26
27
  trpcOutDir
27
- } from "./chunk-QNYJFUVS.js";
28
+ } from "./chunk-J7NGXOAQ.js";
28
29
 
29
30
  // src/cli.ts
30
31
  import { qualifiedTableName as qualifiedTableName2, SchemaAnalyzer as SchemaAnalyzer2 } from "@drzl/analyzer";
@@ -336,6 +337,22 @@ function jsonSchemaOptions(g, cfg, outDir) {
336
337
  };
337
338
  }
338
339
 
340
+ // src/mcp-options.ts
341
+ function mcpOptions(g, cfg) {
342
+ return {
343
+ outputDir: mcpOutDir(g, cfg),
344
+ sdk: g.sdk,
345
+ serverName: g.serverName,
346
+ serverVersion: g.serverVersion,
347
+ stdio: g.stdio,
348
+ naming: g.naming,
349
+ outputHeader: g.outputHeader,
350
+ format: g.format,
351
+ importExtension: g.importExtension,
352
+ validation: g.validation
353
+ };
354
+ }
355
+
339
356
  // src/nestjs-options.ts
340
357
  function nestjsOptions(g, cfg) {
341
358
  return {
@@ -487,6 +504,20 @@ var GENERATORS = [
487
504
  outputDir: (g, cfg) => graphqlOutDir(g, cfg),
488
505
  options: (g, cfg) => graphqlOptions(g, cfg)
489
506
  },
507
+ {
508
+ kind: "mcp",
509
+ // The one `optionalDependency` in this package's manifest, and temporarily so. A package that
510
+ // has never existed cannot publish through npm's trusted-publisher OIDC flow, so naming it as
511
+ // a hard dependency in the release that introduces it breaks `npm i @drzl/cli` for everyone
512
+ // until the first publish lands. `scripts/verify/stages/33-registry-deps.sh` gates that rule.
513
+ // It moves into `dependencies` beside the other fourteen once it is on the registry; tsup
514
+ // externalises all three dependency fields, so nothing about what runs changes when it does.
515
+ specifier: "@drzl/generator-mcp",
516
+ load: () => import("@drzl/generator-mcp"),
517
+ construct: (m, analysis) => new m.MCPGenerator(analysis),
518
+ outputDir: (g, cfg) => mcpOutDir(g, cfg),
519
+ options: (g, cfg) => mcpOptions(g, cfg)
520
+ },
490
521
  {
491
522
  kind: "service",
492
523
  specifier: "@drzl/generator-service",
@@ -1886,6 +1917,8 @@ var EmitPlan = class {
1886
1917
  constructor(options) {
1887
1918
  this.byFile = /* @__PURE__ */ new Map();
1888
1919
  this.dirs = /* @__PURE__ */ new Set();
1920
+ /** Paths this run has actually put bytes on disk for, which is not every path it recorded. */
1921
+ this.wrote = /* @__PURE__ */ new Set();
1889
1922
  this.writes = options.write;
1890
1923
  this.existing = options.existing;
1891
1924
  }
@@ -1902,7 +1935,11 @@ var EmitPlan = class {
1902
1935
  after: contents,
1903
1936
  verdict: before === null ? "created" : before === contents ? "unchanged" : "changed"
1904
1937
  });
1905
- if (this.writes) await fs3.writeFile(file, contents, "utf8");
1938
+ if (!this.writes) return;
1939
+ const onDisk = prior ? this.wrote.has(file) ? prior.after : prior.before : before;
1940
+ if (onDisk === contents) return;
1941
+ await fs3.writeFile(file, contents, "utf8");
1942
+ this.wrote.add(file);
1906
1943
  }
1907
1944
  async read(file) {
1908
1945
  if (this.existing) return this.existing.get(file) ?? null;