@prisma-next/cli 0.15.0 → 0.16.0-dev.10

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.
Files changed (177) hide show
  1. package/README.md +3 -4
  2. package/dist/cli.d.mts +1 -1
  3. package/dist/cli.mjs +13 -13
  4. package/dist/{client-DigVI8zX.mjs → client-2kwLMBSf.mjs} +67 -36
  5. package/dist/client-2kwLMBSf.mjs.map +1 -0
  6. package/dist/{command-helpers-CUoKYTlG.mjs → command-helpers-CVn3U9Uz.mjs} +32 -8
  7. package/dist/command-helpers-CVn3U9Uz.mjs.map +1 -0
  8. package/dist/commands/contract-emit.d.mts +0 -1
  9. package/dist/commands/contract-emit.d.mts.map +1 -1
  10. package/dist/commands/contract-emit.mjs +1 -1
  11. package/dist/commands/contract-infer.d.mts +0 -1
  12. package/dist/commands/contract-infer.d.mts.map +1 -1
  13. package/dist/commands/contract-infer.mjs +1 -1
  14. package/dist/commands/db-init.d.mts +0 -1
  15. package/dist/commands/db-init.d.mts.map +1 -1
  16. package/dist/commands/db-init.mjs +8 -7
  17. package/dist/commands/db-init.mjs.map +1 -1
  18. package/dist/commands/db-schema.d.mts +0 -1
  19. package/dist/commands/db-schema.d.mts.map +1 -1
  20. package/dist/commands/db-schema.mjs +3 -3
  21. package/dist/commands/db-sign.d.mts +0 -1
  22. package/dist/commands/db-sign.d.mts.map +1 -1
  23. package/dist/commands/db-sign.mjs +8 -10
  24. package/dist/commands/db-sign.mjs.map +1 -1
  25. package/dist/commands/db-update.d.mts +0 -1
  26. package/dist/commands/db-update.d.mts.map +1 -1
  27. package/dist/commands/db-update.mjs +12 -14
  28. package/dist/commands/db-update.mjs.map +1 -1
  29. package/dist/commands/db-verify.d.mts +0 -1
  30. package/dist/commands/db-verify.d.mts.map +1 -1
  31. package/dist/commands/db-verify.mjs +1 -1
  32. package/dist/commands/migrate.d.mts +1 -2
  33. package/dist/commands/migrate.d.mts.map +1 -1
  34. package/dist/commands/migrate.mjs +7 -7
  35. package/dist/commands/migrate.mjs.map +1 -1
  36. package/dist/commands/migration-check.d.mts +4 -3
  37. package/dist/commands/migration-check.d.mts.map +1 -1
  38. package/dist/commands/migration-check.mjs +1 -1
  39. package/dist/commands/migration-graph.d.mts +2 -3
  40. package/dist/commands/migration-graph.d.mts.map +1 -1
  41. package/dist/commands/migration-graph.mjs +3 -3
  42. package/dist/commands/migration-list.d.mts +2 -3
  43. package/dist/commands/migration-list.d.mts.map +1 -1
  44. package/dist/commands/migration-list.mjs +1 -1
  45. package/dist/commands/migration-log.d.mts +2 -3
  46. package/dist/commands/migration-log.d.mts.map +1 -1
  47. package/dist/commands/migration-log.mjs +1 -1
  48. package/dist/commands/migration-new.d.mts +0 -1
  49. package/dist/commands/migration-new.d.mts.map +1 -1
  50. package/dist/commands/migration-new.mjs +14 -38
  51. package/dist/commands/migration-new.mjs.map +1 -1
  52. package/dist/commands/migration-plan.d.mts +0 -1
  53. package/dist/commands/migration-plan.d.mts.map +1 -1
  54. package/dist/commands/migration-plan.mjs +1 -1
  55. package/dist/commands/migration-show.d.mts +0 -1
  56. package/dist/commands/migration-show.d.mts.map +1 -1
  57. package/dist/commands/migration-show.mjs +3 -3
  58. package/dist/commands/migration-status.d.mts +2 -3
  59. package/dist/commands/migration-status.d.mts.map +1 -1
  60. package/dist/commands/migration-status.mjs +1 -1
  61. package/dist/commands/ref.d.mts +1 -2
  62. package/dist/commands/ref.d.mts.map +1 -1
  63. package/dist/commands/ref.mjs +13 -18
  64. package/dist/commands/ref.mjs.map +1 -1
  65. package/dist/commands/telemetry/index.d.mts +0 -1
  66. package/dist/commands/telemetry/index.d.mts.map +1 -1
  67. package/dist/commands/telemetry/index.mjs +1 -1
  68. package/dist/contract-at-errors-C-l4-JEY.mjs +36 -0
  69. package/dist/contract-at-errors-C-l4-JEY.mjs.map +1 -0
  70. package/dist/{contract-emit-wgqrOXUI.mjs → contract-emit-DzOkTs11.mjs} +3 -3
  71. package/dist/{contract-emit-wgqrOXUI.mjs.map → contract-emit-DzOkTs11.mjs.map} +1 -1
  72. package/dist/{contract-emit-sYrqzsdN.mjs → contract-emit-iSMJVs26.mjs} +3 -3
  73. package/dist/{contract-emit-sYrqzsdN.mjs.map → contract-emit-iSMJVs26.mjs.map} +1 -1
  74. package/dist/{contract-infer-6SQnnVj7.mjs → contract-infer-BVqworBB.mjs} +3 -3
  75. package/dist/{contract-infer-6SQnnVj7.mjs.map → contract-infer-BVqworBB.mjs.map} +1 -1
  76. package/dist/{contract-space-aggregate-loader-DpB4x97a.mjs → contract-space-aggregate-loader-hPVymNLw.mjs} +14 -15
  77. package/dist/contract-space-aggregate-loader-hPVymNLw.mjs.map +1 -0
  78. package/dist/{db-verify-CEsG5Gek.mjs → db-verify-BpwCMyWJ.mjs} +6 -7
  79. package/dist/db-verify-BpwCMyWJ.mjs.map +1 -0
  80. package/dist/exports/control-api.d.mts +1 -2
  81. package/dist/exports/control-api.d.mts.map +1 -1
  82. package/dist/exports/control-api.mjs +2 -2
  83. package/dist/exports/index.d.mts +0 -1
  84. package/dist/exports/index.d.mts.map +1 -1
  85. package/dist/exports/index.mjs +2 -2
  86. package/dist/exports/init-output.d.mts +1 -0
  87. package/dist/exports/init-output.d.mts.map +1 -1
  88. package/dist/exports/init-output.mjs +1 -1
  89. package/dist/{format-CjongNb1.mjs → format-CFLZv_zU.mjs} +6 -5
  90. package/dist/format-CFLZv_zU.mjs.map +1 -0
  91. package/dist/{framework-components-BbnM1RYm.mjs → framework-components-VMQJbAwl.mjs} +2 -2
  92. package/dist/{framework-components-BbnM1RYm.mjs.map → framework-components-VMQJbAwl.mjs.map} +1 -1
  93. package/dist/global-flags-BpoOYtNZ.d.mts.map +1 -1
  94. package/dist/{init-D8YFfaD6.mjs → init-BSgPxVXA.mjs} +85 -90
  95. package/dist/init-BSgPxVXA.mjs.map +1 -0
  96. package/dist/{inspect-live-schema-CEt_ztBJ.mjs → inspect-live-schema-DxsD_a4d.mjs} +3 -3
  97. package/dist/{inspect-live-schema-CEt_ztBJ.mjs.map → inspect-live-schema-DxsD_a4d.mjs.map} +1 -1
  98. package/dist/{migration-check-ByeQHOhK.mjs → migration-check-DMxPzbHl.mjs} +70 -44
  99. package/dist/migration-check-DMxPzbHl.mjs.map +1 -0
  100. package/dist/migration-cli.d.mts +0 -1
  101. package/dist/migration-cli.d.mts.map +1 -1
  102. package/dist/migration-cli.mjs +3 -3
  103. package/dist/migration-cli.mjs.map +1 -1
  104. package/dist/{migration-command-scaffold-CJO3tjiR.mjs → migration-command-scaffold-DB_i9nBC.mjs} +3 -3
  105. package/dist/{migration-command-scaffold-CJO3tjiR.mjs.map → migration-command-scaffold-DB_i9nBC.mjs.map} +1 -1
  106. package/dist/{migration-list-DTYM8xvm.mjs → migration-list-cnSKilYH.mjs} +5 -5
  107. package/dist/migration-list-cnSKilYH.mjs.map +1 -0
  108. package/dist/{migration-log-qZ8LpQIl.mjs → migration-log-CEqFiez9.mjs} +3 -3
  109. package/dist/{migration-log-qZ8LpQIl.mjs.map → migration-log-CEqFiez9.mjs.map} +1 -1
  110. package/dist/{migration-path-target-DmNwsDgs.mjs → migration-path-target-C0TQuV5n.mjs} +2 -2
  111. package/dist/{migration-path-target-DmNwsDgs.mjs.map → migration-path-target-C0TQuV5n.mjs.map} +1 -1
  112. package/dist/{migration-plan-CfPrB80t.mjs → migration-plan-BJHulFZC.mjs} +54 -62
  113. package/dist/migration-plan-BJHulFZC.mjs.map +1 -0
  114. package/dist/{migration-status-DRuS-rP5.mjs → migration-status-ugWwGk1V.mjs} +5 -5
  115. package/dist/{migration-status-DRuS-rP5.mjs.map → migration-status-ugWwGk1V.mjs.map} +1 -1
  116. package/dist/{output-mEQ74_nd.mjs → output-DWNYqZGc.mjs} +5 -6
  117. package/dist/output-DWNYqZGc.mjs.map +1 -0
  118. package/dist/{ref-advancement-BkXlikCA.mjs → ref-advancement-BCz7X7qJ.mjs} +13 -6
  119. package/dist/ref-advancement-BCz7X7qJ.mjs.map +1 -0
  120. package/dist/schemas-CeGMYFYX.d.mts.map +1 -1
  121. package/dist/{telemetry-DHBBq5wT.mjs → telemetry-BEyNMfco.mjs} +2 -2
  122. package/dist/{telemetry-DHBBq5wT.mjs.map → telemetry-BEyNMfco.mjs.map} +1 -1
  123. package/dist/{terminal-ui-DGRNFWna.d.mts → terminal-ui-BN4QOsm5.d.mts} +1 -2
  124. package/dist/terminal-ui-BN4QOsm5.d.mts.map +1 -0
  125. package/dist/{types-DFoqNIcQ.d.mts → types-D4r_HI9-.d.mts} +8 -4
  126. package/dist/types-D4r_HI9-.d.mts.map +1 -0
  127. package/dist/{verify-DDCb0R2r.mjs → verify-C4RazDE1.mjs} +9 -8
  128. package/dist/verify-C4RazDE1.mjs.map +1 -0
  129. package/package.json +25 -25
  130. package/src/commands/db-init.ts +4 -3
  131. package/src/commands/db-sign.ts +6 -4
  132. package/src/commands/db-update.ts +15 -7
  133. package/src/commands/db-verify.ts +2 -3
  134. package/src/commands/init/errors.ts +62 -58
  135. package/src/commands/init/hygiene-gitattributes.ts +37 -21
  136. package/src/commands/init/init.ts +35 -32
  137. package/src/commands/init/output.ts +4 -5
  138. package/src/commands/init/reinit-cleanup.ts +16 -17
  139. package/src/commands/migrate.ts +1 -0
  140. package/src/commands/migration-check.ts +75 -38
  141. package/src/commands/migration-list.ts +1 -5
  142. package/src/commands/migration-new.ts +15 -39
  143. package/src/commands/migration-plan.ts +56 -78
  144. package/src/commands/ref.ts +19 -14
  145. package/src/control-api/operations/db-run.ts +4 -4
  146. package/src/control-api/operations/db-verify.ts +12 -9
  147. package/src/control-api/operations/format.ts +4 -3
  148. package/src/control-api/operations/migrate.ts +70 -26
  149. package/src/control-api/types.ts +4 -1
  150. package/src/migration-cli.ts +5 -5
  151. package/src/utils/cli-errors.ts +28 -7
  152. package/src/utils/combine-verify-results.ts +1 -1
  153. package/src/utils/contract-at-errors.ts +13 -22
  154. package/src/utils/contract-space-aggregate-loader.ts +12 -13
  155. package/src/utils/contract-space-seed-phase.ts +8 -6
  156. package/src/utils/formatters/errors.ts +24 -3
  157. package/src/utils/formatters/verify.ts +7 -6
  158. package/src/utils/integrity-violation-to-check-failure.ts +14 -14
  159. package/src/utils/plan-resolution.ts +6 -9
  160. package/src/utils/ref-advancement.ts +22 -3
  161. package/src/utils/result-handler.ts +4 -2
  162. package/dist/client-DigVI8zX.mjs.map +0 -1
  163. package/dist/command-helpers-CUoKYTlG.mjs.map +0 -1
  164. package/dist/contract-at-errors-D8CNDD7g.mjs +0 -42
  165. package/dist/contract-at-errors-D8CNDD7g.mjs.map +0 -1
  166. package/dist/contract-space-aggregate-loader-DpB4x97a.mjs.map +0 -1
  167. package/dist/db-verify-CEsG5Gek.mjs.map +0 -1
  168. package/dist/format-CjongNb1.mjs.map +0 -1
  169. package/dist/init-D8YFfaD6.mjs.map +0 -1
  170. package/dist/migration-check-ByeQHOhK.mjs.map +0 -1
  171. package/dist/migration-list-DTYM8xvm.mjs.map +0 -1
  172. package/dist/migration-plan-CfPrB80t.mjs.map +0 -1
  173. package/dist/output-mEQ74_nd.mjs.map +0 -1
  174. package/dist/ref-advancement-BkXlikCA.mjs.map +0 -1
  175. package/dist/terminal-ui-DGRNFWna.d.mts.map +0 -1
  176. package/dist/types-DFoqNIcQ.d.mts.map +0 -1
  177. package/dist/verify-DDCb0R2r.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { n as executeContractEmit, r as disposeEmitQueue } from "../contract-emit-sYrqzsdN.mjs";
1
+ import { n as executeContractEmit, r as disposeEmitQueue } from "../contract-emit-iSMJVs26.mjs";
2
2
  import { t as enrichContract } from "../contract-enrichment-gn9sWbPw.mjs";
3
- import { a as executeDbInit, i as executeDbUpdate, r as executeDbVerify, t as createControlClient } from "../client-DigVI8zX.mjs";
3
+ import { a as executeDbInit, i as executeDbUpdate, r as executeDbVerify, t as createControlClient } from "../client-2kwLMBSf.mjs";
4
4
  export { createControlClient, disposeEmitQueue, enrichContract, executeContractEmit, executeDbInit, executeDbUpdate, executeDbVerify };
@@ -1,7 +1,6 @@
1
1
  import { createContractEmitCommand } from "../commands/contract-emit.mjs";
2
2
  import { Command } from "commander";
3
3
  import { Contract } from "@prisma-next/contract/types";
4
-
5
4
  //#region src/commands/format.d.ts
6
5
  declare function createFormatCommand(): Command;
7
6
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/commands/format.ts","../../src/load-ts-contract.ts"],"mappings":";;;;;iBAmBgB,mBAAA,IAAuB,OAAO;;;UCX7B,qBAAA;EAAA,SACN,SAAA,GAAY,aAAa;AAAA;;ADUpC;;;;AAA8C;;;;ACX9C;;;;AACoC;AA4HpC;iBAAsB,kBAAA,CACpB,SAAA,UACA,OAAA,GAAU,qBAAA,GACT,OAAA,CAAQ,QAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/commands/format.ts","../../src/load-ts-contract.ts"],"mappings":";;;;iBAmBgB,uBAAuB;;;UCXtB;WACN,YAAY;;;;;;;;;;;;;;;;;iBA4HD,mBACpB,mBACA,UAAU,wBACT,QAAQ"}
@@ -1,5 +1,5 @@
1
- import { t as createContractEmitCommand } from "../contract-emit-wgqrOXUI.mjs";
2
- import { t as createFormatCommand } from "../format-CjongNb1.mjs";
1
+ import { t as createContractEmitCommand } from "../contract-emit-DzOkTs11.mjs";
2
+ import { t as createFormatCommand } from "../format-CFLZv_zU.mjs";
3
3
  import { join, resolve } from "pathe";
4
4
  import { existsSync, unlinkSync, writeFileSync } from "node:fs";
5
5
  import { tmpdir } from "node:os";
@@ -1,3 +1,4 @@
1
+ import "../terminal-ui-BN4QOsm5.mjs";
1
2
  //#region src/commands/init/output.d.ts
2
3
  /**
3
4
  * arktype schema for the structured success document `init --json` writes
@@ -1 +1 @@
1
- {"version":3,"file":"init-output.d.mts","names":[],"sources":["../../src/commands/init/output.ts"],"mappings":";;AAkBA;;;;;;;;;;;;;cAAa,gBAAA,gDAAgB,UAAA;;;;;;;;;;;;;;;;KAwBjB,UAAA,UAAoB,gBAAA,CAAiB,KAAK"}
1
+ {"version":3,"file":"init-output.d.mts","names":[],"sources":["../../src/commands/init/output.ts"],"mappings":";;;;;;;;;;;;;;;;cAkBa,gEAAgB;;;;;;;;;;;;;;;;KAuBjB,oBAAoB,iBAAiB"}
@@ -1,2 +1,2 @@
1
- import { t as InitOutputSchema } from "../output-mEQ74_nd.mjs";
1
+ import { t as InitOutputSchema } from "../output-DWNYqZGc.mjs";
2
2
  export { InitOutputSchema };
@@ -1,4 +1,4 @@
1
- import { A as formatStyledHeader, F as CliStructuredError, _ as createTerminalUI, ct as errorUnexpected, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, rt as errorRuntime, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from "./command-helpers-CUoKYTlG.mjs";
1
+ import { A as formatStyledHeader, F as CliStructuredError, _ as createTerminalUI, ct as errorUnexpected, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, rt as errorRuntime, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from "./command-helpers-CVn3U9Uz.mjs";
2
2
  import { Command } from "commander";
3
3
  import { loadConfig } from "@prisma-next/config-loader";
4
4
  import { ifDefined } from "@prisma-next/utils/defined";
@@ -6,7 +6,8 @@ import { notOk, ok } from "@prisma-next/utils/result";
6
6
  import { relative, resolve } from "pathe";
7
7
  import { readFile, writeFile } from "node:fs/promises";
8
8
  import { EOL } from "node:os";
9
- import { PslFormatError, format } from "@prisma-next/psl-parser/format";
9
+ import { format } from "@prisma-next/psl-parser/format";
10
+ import { isStructuredError } from "@prisma-next/utils/structured-error";
10
11
  //#region src/control-api/operations/format.ts
11
12
  function resolveNewline(formatterNewline, eol) {
12
13
  if (formatterNewline !== void 0) return formatterNewline;
@@ -42,10 +43,10 @@ async function executeFormat(options) {
42
43
  try {
43
44
  formatted = format(contents, formatOptions);
44
45
  } catch (error) {
45
- if (error instanceof PslFormatError) return notOk(errorRuntime("Cannot format PSL with parse errors", {
46
+ if (isStructuredError(error) && error.code === "PSL.PARSE_FAILED") return notOk(errorRuntime("Cannot format PSL with parse errors", {
46
47
  why: error.message,
47
48
  fix: "Fix the parse errors in your schema and try again.",
48
- meta: { diagnostics: error.diagnostics }
49
+ meta: { diagnostics: error.meta?.["diagnostics"] }
49
50
  }));
50
51
  return notOk(errorUnexpected(error instanceof Error ? error.message : String(error)));
51
52
  }
@@ -99,4 +100,4 @@ function createFormatCommand() {
99
100
  //#endregion
100
101
  export { createFormatCommand as t };
101
102
 
102
- //# sourceMappingURL=format-CjongNb1.mjs.map
103
+ //# sourceMappingURL=format-CFLZv_zU.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-CFLZv_zU.mjs","names":[],"sources":["../src/control-api/operations/format.ts","../src/commands/format.ts"],"sourcesContent":["import { readFile, writeFile } from 'node:fs/promises';\nimport { EOL } from 'node:os';\nimport { loadConfig } from '@prisma-next/config-loader';\nimport { type FormatOptions, format } from '@prisma-next/psl-parser/format';\nimport { notOk, ok, type Result } from '@prisma-next/utils/result';\nimport { isStructuredError } from '@prisma-next/utils/structured-error';\nimport { CliStructuredError, errorRuntime, errorUnexpected } from '../../utils/cli-errors';\n\nexport interface FormatOperationOptions {\n readonly configPath?: string;\n readonly eol?: string;\n}\n\nexport interface FormatOperationResult {\n readonly formatted: boolean;\n readonly path?: string;\n}\n\nexport function resolveNewline(\n formatterNewline: 'LF' | 'CRLF' | undefined,\n eol: string,\n): 'LF' | 'CRLF' {\n if (formatterNewline !== undefined) {\n return formatterNewline;\n }\n return eol === '\\r\\n' ? 'CRLF' : 'LF';\n}\n\nexport async function executeFormat(\n options: FormatOperationOptions,\n): Promise<Result<FormatOperationResult, CliStructuredError>> {\n const eol = options.eol ?? EOL;\n\n let config: Awaited<ReturnType<typeof loadConfig>>;\n try {\n config = await loadConfig(options.configPath);\n } catch (error) {\n if (CliStructuredError.is(error)) {\n return notOk(error);\n }\n return notOk(errorUnexpected(error instanceof Error ? error.message : String(error)));\n }\n\n const source = config.contract?.source;\n if (source?.sourceFormat !== 'psl') {\n return ok({ formatted: false });\n }\n\n const inputPath = source.inputs?.[0];\n if (inputPath === undefined) {\n return ok({ formatted: false });\n }\n\n let contents: string;\n try {\n contents = await readFile(inputPath, 'utf-8');\n } catch (error) {\n return notOk(\n errorRuntime('Failed to read contract source file', {\n why: error instanceof Error ? error.message : String(error),\n fix: `Check that ${inputPath} exists and is readable.`,\n }),\n );\n }\n\n const formatOptions: FormatOptions = {\n indent: config.formatter?.indent ?? 2,\n newline: resolveNewline(config.formatter?.newline, eol),\n };\n\n let formatted: string;\n try {\n formatted = format(contents, formatOptions);\n } catch (error) {\n if (isStructuredError(error) && error.code === 'PSL.PARSE_FAILED') {\n return notOk(\n errorRuntime('Cannot format PSL with parse errors', {\n why: error.message,\n fix: 'Fix the parse errors in your schema and try again.',\n meta: { diagnostics: error.meta?.['diagnostics'] },\n }),\n );\n }\n return notOk(errorUnexpected(error instanceof Error ? error.message : String(error)));\n }\n\n try {\n await writeFile(inputPath, formatted, 'utf-8');\n } catch (error) {\n return notOk(\n errorRuntime('Failed to write formatted contract source file', {\n why: error instanceof Error ? error.message : String(error),\n fix: `Check that ${inputPath} is writable.`,\n }),\n );\n }\n\n return ok({ formatted: true, path: inputPath });\n}\n","import { ifDefined } from '@prisma-next/utils/defined';\nimport { Command } from 'commander';\nimport { relative, resolve } from 'pathe';\nimport { executeFormat } from '../control-api/operations/format';\nimport {\n addGlobalOptions,\n setCommandDescriptions,\n setCommandExamples,\n} from '../utils/command-helpers';\nimport { formatStyledHeader } from '../utils/formatters/styled';\nimport type { CommonCommandOptions } from '../utils/global-flags';\nimport { parseGlobalFlagsOrExit } from '../utils/global-flags';\nimport { handleResult } from '../utils/result-handler';\nimport { createTerminalUI } from '../utils/terminal-ui';\n\ninterface FormatCommandOptions extends CommonCommandOptions {\n readonly config?: string;\n}\n\nexport function createFormatCommand(): Command {\n const command = new Command('format');\n setCommandDescriptions(\n command,\n 'Format your PSL contract source',\n 'Formats the Prisma schema (PSL) contract source declared in your config\\n' +\n '(contract.source.inputs[0]) in place. Only runs when contract.source.sourceFormat\\n' +\n \"is 'psl'; a TypeScript or unset source is left untouched. Indent and newline are\\n\" +\n 'read from the optional formatter config section, defaulting to two spaces and the\\n' +\n 'system newline.',\n );\n setCommandExamples(command, [\n 'prisma-next format',\n 'prisma-next format --config ./custom-config.ts',\n ]);\n addGlobalOptions(command)\n .option('--config <path>', 'Path to prisma-next.config.ts')\n .action(async (options: FormatCommandOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n const ui = createTerminalUI(flags);\n\n if (!flags.json && !flags.quiet) {\n const displayConfigPath = options.config\n ? relative(process.cwd(), resolve(options.config))\n : 'prisma-next.config.ts';\n ui.stderr(\n formatStyledHeader({\n command: 'format',\n description: 'Format your PSL contract source',\n details: [{ label: 'config', value: displayConfigPath }],\n flags,\n }),\n );\n }\n\n const result = await executeFormat({ ...ifDefined('configPath', options.config) });\n\n const exitCode = handleResult(result, flags, ui, (value) => {\n if (flags.json) {\n ui.output(JSON.stringify(value));\n return;\n }\n if (flags.quiet) {\n return;\n }\n if (value.formatted) {\n ui.success(`Formatted ${relative(process.cwd(), value.path ?? '')}`);\n } else {\n ui.info('Nothing to format (contract source is not PSL).');\n }\n });\n process.exit(exitCode);\n });\n\n return command;\n}\n"],"mappings":";;;;;;;;;;;AAkBA,SAAgB,eACd,kBACA,KACe;CACf,IAAI,qBAAqB,KAAA,GACvB,OAAO;CAET,OAAO,QAAQ,SAAS,SAAS;AACnC;AAEA,eAAsB,cACpB,SAC4D;CAC5D,MAAM,MAAM,QAAQ,OAAO;CAE3B,IAAI;CACJ,IAAI;EACF,SAAS,MAAM,WAAW,QAAQ,UAAU;CAC9C,SAAS,OAAO;EACd,IAAI,mBAAmB,GAAG,KAAK,GAC7B,OAAO,MAAM,KAAK;EAEpB,OAAO,MAAM,gBAAgB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,CAAC;CACtF;CAEA,MAAM,SAAS,OAAO,UAAU;CAChC,IAAI,QAAQ,iBAAiB,OAC3B,OAAO,GAAG,EAAE,WAAW,MAAM,CAAC;CAGhC,MAAM,YAAY,OAAO,SAAS;CAClC,IAAI,cAAc,KAAA,GAChB,OAAO,GAAG,EAAE,WAAW,MAAM,CAAC;CAGhC,IAAI;CACJ,IAAI;EACF,WAAW,MAAM,SAAS,WAAW,OAAO;CAC9C,SAAS,OAAO;EACd,OAAO,MACL,aAAa,uCAAuC;GAClD,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GAC1D,KAAK,cAAc,UAAU;EAC/B,CAAC,CACH;CACF;CAEA,MAAM,gBAA+B;EACnC,QAAQ,OAAO,WAAW,UAAU;EACpC,SAAS,eAAe,OAAO,WAAW,SAAS,GAAG;CACxD;CAEA,IAAI;CACJ,IAAI;EACF,YAAY,OAAO,UAAU,aAAa;CAC5C,SAAS,OAAO;EACd,IAAI,kBAAkB,KAAK,KAAK,MAAM,SAAS,oBAC7C,OAAO,MACL,aAAa,uCAAuC;GAClD,KAAK,MAAM;GACX,KAAK;GACL,MAAM,EAAE,aAAa,MAAM,OAAO,eAAe;EACnD,CAAC,CACH;EAEF,OAAO,MAAM,gBAAgB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,CAAC;CACtF;CAEA,IAAI;EACF,MAAM,UAAU,WAAW,WAAW,OAAO;CAC/C,SAAS,OAAO;EACd,OAAO,MACL,aAAa,kDAAkD;GAC7D,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GAC1D,KAAK,cAAc,UAAU;EAC/B,CAAC,CACH;CACF;CAEA,OAAO,GAAG;EAAE,WAAW;EAAM,MAAM;CAAU,CAAC;AAChD;;;AC/EA,SAAgB,sBAA+B;CAC7C,MAAM,UAAU,IAAI,QAAQ,QAAQ;CACpC,uBACE,SACA,mCACA,kVAKF;CACA,mBAAmB,SAAS,CAC1B,sBACA,gDACF,CAAC;CACD,iBAAiB,OAAO,CAAC,CACtB,OAAO,mBAAmB,+BAA+B,CAAC,CAC1D,OAAO,OAAO,YAAkC;EAC/C,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EAEjC,IAAI,CAAC,MAAM,QAAQ,CAAC,MAAM,OAAO;GAC/B,MAAM,oBAAoB,QAAQ,SAC9B,SAAS,QAAQ,IAAI,GAAG,QAAQ,QAAQ,MAAM,CAAC,IAC/C;GACJ,GAAG,OACD,mBAAmB;IACjB,SAAS;IACT,aAAa;IACb,SAAS,CAAC;KAAE,OAAO;KAAU,OAAO;IAAkB,CAAC;IACvD;GACF,CAAC,CACH;EACF;EAIA,MAAM,WAAW,aAAa,MAFT,cAAc,EAAE,GAAG,UAAU,cAAc,QAAQ,MAAM,EAAE,CAAC,GAE3C,OAAO,KAAK,UAAU;GAC1D,IAAI,MAAM,MAAM;IACd,GAAG,OAAO,KAAK,UAAU,KAAK,CAAC;IAC/B;GACF;GACA,IAAI,MAAM,OACR;GAEF,IAAI,MAAM,WACR,GAAG,QAAQ,aAAa,SAAS,QAAQ,IAAI,GAAG,MAAM,QAAQ,EAAE,GAAG;QAEnE,GAAG,KAAK,iDAAiD;EAE7D,CAAC;EACD,QAAQ,KAAK,QAAQ;CACvB,CAAC;CAEH,OAAO;AACT"}
@@ -1,4 +1,4 @@
1
- import { R as errorConfigValidation } from "./command-helpers-CUoKYTlG.mjs";
1
+ import { R as errorConfigValidation } from "./command-helpers-CVn3U9Uz.mjs";
2
2
  import "@prisma-next/framework-components/components";
3
3
  //#region src/utils/framework-components.ts
4
4
  /**
@@ -55,4 +55,4 @@ function assertFrameworkComponentsCompatible(expectedFamilyId, expectedTargetId,
55
55
  //#endregion
56
56
  export { assertFrameworkComponentsCompatible as t };
57
57
 
58
- //# sourceMappingURL=framework-components-BbnM1RYm.mjs.map
58
+ //# sourceMappingURL=framework-components-VMQJbAwl.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"framework-components-BbnM1RYm.mjs","names":[],"sources":["../src/utils/framework-components.ts"],"sourcesContent":["import type { Contract } from '@prisma-next/contract/types';\nimport {\n checkContractComponentRequirements,\n type TargetBoundComponentDescriptor,\n} from '@prisma-next/framework-components/components';\nimport type { ControlStack } from '@prisma-next/framework-components/control';\nimport { errorConfigValidation, errorContractMissingExtensionPacks } from './cli-errors';\n\n/**\n * Asserts that all framework components are compatible with the expected family and target.\n *\n * This function validates that each component in the framework components array:\n * - Has kind 'target', 'adapter', 'extension', or 'driver'\n * - Has familyId matching expectedFamilyId\n * - Has targetId matching expectedTargetId\n *\n * This validation happens at the CLI composition boundary, before passing components\n * to typed planner/runner instances. It fills the gap between runtime validation\n * (via `validateConfig()`) and compile-time type enforcement.\n *\n * @param expectedFamilyId - The expected family ID (e.g., 'sql')\n * @param expectedTargetId - The expected target ID (e.g., 'postgres')\n * @param frameworkComponents - Array of framework components to validate\n * @returns The same array typed as TargetBoundComponentDescriptor\n * @throws CliStructuredError if any component is incompatible\n *\n * @example\n * ```ts\n * const config = await loadConfig();\n * const frameworkComponents = [config.target, config.adapter, ...(config.extensionPacks ?? [])];\n *\n * // Validate and type-narrow components before passing to planner\n * const typedComponents = assertFrameworkComponentsCompatible(\n * config.family.familyId,\n * config.target.targetId,\n * frameworkComponents\n * );\n *\n * const planner = target.migrations.createPlanner(familyInstance);\n * planner.plan({ contract, schema, policy, frameworkComponents: typedComponents });\n * ```\n */\nexport function assertFrameworkComponentsCompatible<\n TFamilyId extends string,\n TTargetId extends string,\n>(\n expectedFamilyId: TFamilyId,\n expectedTargetId: TTargetId,\n frameworkComponents: ReadonlyArray<unknown>,\n): ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, TTargetId>> {\n for (let i = 0; i < frameworkComponents.length; i++) {\n const component = frameworkComponents[i];\n\n // Check that component is an object\n if (typeof component !== 'object' || component === null) {\n throw errorConfigValidation('frameworkComponents[]', {\n why: `Framework component at index ${i} must be an object`,\n });\n }\n\n const record = component as Record<string, unknown>;\n\n // Check kind\n if (!Object.hasOwn(record, 'kind')) {\n throw errorConfigValidation('frameworkComponents[].kind', {\n why: `Framework component at index ${i} must have 'kind' property`,\n });\n }\n\n const kind = record['kind'];\n if (kind !== 'target' && kind !== 'adapter' && kind !== 'extension' && kind !== 'driver') {\n throw errorConfigValidation('frameworkComponents[].kind', {\n why: `Framework component at index ${i} has invalid kind '${String(kind)}' (must be 'target', 'adapter', 'extension', or 'driver')`,\n });\n }\n\n // Check familyId\n if (!Object.hasOwn(record, 'familyId')) {\n throw errorConfigValidation('frameworkComponents[].familyId', {\n why: `Framework component at index ${i} (kind: ${String(kind)}) must have 'familyId' property`,\n });\n }\n\n const familyId = record['familyId'];\n if (familyId !== expectedFamilyId) {\n throw errorConfigValidation('frameworkComponents[].familyId', {\n why: `Framework component at index ${i} (kind: ${String(kind)}) has familyId '${String(familyId)}' but expected '${expectedFamilyId}'`,\n });\n }\n\n // Check targetId\n if (!Object.hasOwn(record, 'targetId')) {\n throw errorConfigValidation('frameworkComponents[].targetId', {\n why: `Framework component at index ${i} (kind: ${String(kind)}) must have 'targetId' property`,\n });\n }\n\n const targetId = record['targetId'];\n if (targetId !== expectedTargetId) {\n throw errorConfigValidation('frameworkComponents[].targetId', {\n why: `Framework component at index ${i} (kind: ${String(kind)}) has targetId '${String(targetId)}' but expected '${expectedTargetId}'`,\n });\n }\n }\n\n // Type assertion is safe because we've validated all components above\n return frameworkComponents as ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, TTargetId>>;\n}\n\n/**\n * Validates that a contract is compatible with the configured target, adapter,\n * and extension packs. Throws on family/target mismatches or missing extension packs.\n *\n * This check ensures the emitted contract matches the CLI config before running\n * commands that depend on the contract (e.g., db verify, db sign).\n *\n * @param contract - The contract to validate (must include targetFamily, target, extensionPacks).\n * @param stack - The control plane stack (target, adapter, driver, extensionPacks).\n *\n * @throws {CliStructuredError} errorConfigValidation when contract.targetFamily or contract.target\n * doesn't match the configured family/target.\n * @throws {CliStructuredError} errorContractMissingExtensionPacks when the contract requires\n * extension packs that are not provided in the config (includes all missing packs in error.meta).\n *\n * @example\n * ```ts\n * import { assertContractRequirementsSatisfied } from './framework-components';\n *\n * const config = await loadConfig();\n * const contract = await loadContractJson(config.contract.output);\n * const stack = createControlStack({ family: config.family, target: config.target, adapter: config.adapter, ... });\n *\n * // Throws if contract is incompatible with config\n * assertContractRequirementsSatisfied({ contract, stack });\n * ```\n */\nexport function assertContractRequirementsSatisfied<\n TFamilyId extends string,\n TTargetId extends string,\n>({\n contract,\n stack,\n}: {\n readonly contract: Pick<Contract, 'targetFamily' | 'target' | 'extensionPacks'>;\n readonly stack: ControlStack<TFamilyId, TTargetId>;\n}): void {\n const providedComponentIds = new Set<string>([\n stack.target.id,\n ...(stack.adapter ? [stack.adapter.id] : []),\n ]);\n for (const extension of stack.extensionPacks) {\n providedComponentIds.add(extension.id);\n }\n\n const result = checkContractComponentRequirements({\n contract,\n expectedTargetFamily: stack.target.familyId,\n expectedTargetId: stack.target.targetId,\n providedComponentIds,\n });\n\n if (result.familyMismatch) {\n throw errorConfigValidation('contract.targetFamily', {\n why: `Contract was emitted for family '${result.familyMismatch.actual}' but CLI config is wired to '${result.familyMismatch.expected}'.`,\n });\n }\n\n if (result.targetMismatch) {\n throw errorConfigValidation('contract.target', {\n why: `Contract target '${result.targetMismatch.actual}' does not match CLI target '${result.targetMismatch.expected}'.`,\n });\n }\n\n if (result.missingExtensionPackIds.length > 0) {\n throw errorContractMissingExtensionPacks({\n missingExtensionPacks: result.missingExtensionPackIds,\n providedComponentIds: [...providedComponentIds],\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAgB,oCAId,kBACA,kBACA,qBACqE;CACrE,KAAK,IAAI,IAAI,GAAG,IAAI,oBAAoB,QAAQ,KAAK;EACnD,MAAM,YAAY,oBAAoB;EAGtC,IAAI,OAAO,cAAc,YAAY,cAAc,MACjD,MAAM,sBAAsB,yBAAyB,EACnD,KAAK,gCAAgC,EAAE,oBACzC,CAAC;EAGH,MAAM,SAAS;EAGf,IAAI,CAAC,OAAO,OAAO,QAAQ,MAAM,GAC/B,MAAM,sBAAsB,8BAA8B,EACxD,KAAK,gCAAgC,EAAE,4BACzC,CAAC;EAGH,MAAM,OAAO,OAAO;EACpB,IAAI,SAAS,YAAY,SAAS,aAAa,SAAS,eAAe,SAAS,UAC9E,MAAM,sBAAsB,8BAA8B,EACxD,KAAK,gCAAgC,EAAE,qBAAqB,OAAO,IAAI,EAAE,2DAC3E,CAAC;EAIH,IAAI,CAAC,OAAO,OAAO,QAAQ,UAAU,GACnC,MAAM,sBAAsB,kCAAkC,EAC5D,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,iCAChE,CAAC;EAGH,MAAM,WAAW,OAAO;EACxB,IAAI,aAAa,kBACf,MAAM,sBAAsB,kCAAkC,EAC5D,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,kBAAkB,OAAO,QAAQ,EAAE,kBAAkB,iBAAiB,GACtI,CAAC;EAIH,IAAI,CAAC,OAAO,OAAO,QAAQ,UAAU,GACnC,MAAM,sBAAsB,kCAAkC,EAC5D,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,iCAChE,CAAC;EAGH,MAAM,WAAW,OAAO;EACxB,IAAI,aAAa,kBACf,MAAM,sBAAsB,kCAAkC,EAC5D,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,kBAAkB,OAAO,QAAQ,EAAE,kBAAkB,iBAAiB,GACtI,CAAC;CAEL;CAGA,OAAO;AACT"}
1
+ {"version":3,"file":"framework-components-VMQJbAwl.mjs","names":[],"sources":["../src/utils/framework-components.ts"],"sourcesContent":["import type { Contract } from '@prisma-next/contract/types';\nimport {\n checkContractComponentRequirements,\n type TargetBoundComponentDescriptor,\n} from '@prisma-next/framework-components/components';\nimport type { ControlStack } from '@prisma-next/framework-components/control';\nimport { errorConfigValidation, errorContractMissingExtensionPacks } from './cli-errors';\n\n/**\n * Asserts that all framework components are compatible with the expected family and target.\n *\n * This function validates that each component in the framework components array:\n * - Has kind 'target', 'adapter', 'extension', or 'driver'\n * - Has familyId matching expectedFamilyId\n * - Has targetId matching expectedTargetId\n *\n * This validation happens at the CLI composition boundary, before passing components\n * to typed planner/runner instances. It fills the gap between runtime validation\n * (via `validateConfig()`) and compile-time type enforcement.\n *\n * @param expectedFamilyId - The expected family ID (e.g., 'sql')\n * @param expectedTargetId - The expected target ID (e.g., 'postgres')\n * @param frameworkComponents - Array of framework components to validate\n * @returns The same array typed as TargetBoundComponentDescriptor\n * @throws CliStructuredError if any component is incompatible\n *\n * @example\n * ```ts\n * const config = await loadConfig();\n * const frameworkComponents = [config.target, config.adapter, ...(config.extensionPacks ?? [])];\n *\n * // Validate and type-narrow components before passing to planner\n * const typedComponents = assertFrameworkComponentsCompatible(\n * config.family.familyId,\n * config.target.targetId,\n * frameworkComponents\n * );\n *\n * const planner = target.migrations.createPlanner(familyInstance);\n * planner.plan({ contract, schema, policy, frameworkComponents: typedComponents });\n * ```\n */\nexport function assertFrameworkComponentsCompatible<\n TFamilyId extends string,\n TTargetId extends string,\n>(\n expectedFamilyId: TFamilyId,\n expectedTargetId: TTargetId,\n frameworkComponents: ReadonlyArray<unknown>,\n): ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, TTargetId>> {\n for (let i = 0; i < frameworkComponents.length; i++) {\n const component = frameworkComponents[i];\n\n // Check that component is an object\n if (typeof component !== 'object' || component === null) {\n throw errorConfigValidation('frameworkComponents[]', {\n why: `Framework component at index ${i} must be an object`,\n });\n }\n\n const record = component as Record<string, unknown>;\n\n // Check kind\n if (!Object.hasOwn(record, 'kind')) {\n throw errorConfigValidation('frameworkComponents[].kind', {\n why: `Framework component at index ${i} must have 'kind' property`,\n });\n }\n\n const kind = record['kind'];\n if (kind !== 'target' && kind !== 'adapter' && kind !== 'extension' && kind !== 'driver') {\n throw errorConfigValidation('frameworkComponents[].kind', {\n why: `Framework component at index ${i} has invalid kind '${String(kind)}' (must be 'target', 'adapter', 'extension', or 'driver')`,\n });\n }\n\n // Check familyId\n if (!Object.hasOwn(record, 'familyId')) {\n throw errorConfigValidation('frameworkComponents[].familyId', {\n why: `Framework component at index ${i} (kind: ${String(kind)}) must have 'familyId' property`,\n });\n }\n\n const familyId = record['familyId'];\n if (familyId !== expectedFamilyId) {\n throw errorConfigValidation('frameworkComponents[].familyId', {\n why: `Framework component at index ${i} (kind: ${String(kind)}) has familyId '${String(familyId)}' but expected '${expectedFamilyId}'`,\n });\n }\n\n // Check targetId\n if (!Object.hasOwn(record, 'targetId')) {\n throw errorConfigValidation('frameworkComponents[].targetId', {\n why: `Framework component at index ${i} (kind: ${String(kind)}) must have 'targetId' property`,\n });\n }\n\n const targetId = record['targetId'];\n if (targetId !== expectedTargetId) {\n throw errorConfigValidation('frameworkComponents[].targetId', {\n why: `Framework component at index ${i} (kind: ${String(kind)}) has targetId '${String(targetId)}' but expected '${expectedTargetId}'`,\n });\n }\n }\n\n // Type assertion is safe because we've validated all components above\n return frameworkComponents as ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, TTargetId>>;\n}\n\n/**\n * Validates that a contract is compatible with the configured target, adapter,\n * and extension packs. Throws on family/target mismatches or missing extension packs.\n *\n * This check ensures the emitted contract matches the CLI config before running\n * commands that depend on the contract (e.g., db verify, db sign).\n *\n * @param contract - The contract to validate (must include targetFamily, target, extensionPacks).\n * @param stack - The control plane stack (target, adapter, driver, extensionPacks).\n *\n * @throws {CliStructuredError} errorConfigValidation when contract.targetFamily or contract.target\n * doesn't match the configured family/target.\n * @throws {CliStructuredError} errorContractMissingExtensionPacks when the contract requires\n * extension packs that are not provided in the config (includes all missing packs in error.meta).\n *\n * @example\n * ```ts\n * import { assertContractRequirementsSatisfied } from './framework-components';\n *\n * const config = await loadConfig();\n * const contract = await loadContractJson(config.contract.output);\n * const stack = createControlStack({ family: config.family, target: config.target, adapter: config.adapter, ... });\n *\n * // Throws if contract is incompatible with config\n * assertContractRequirementsSatisfied({ contract, stack });\n * ```\n */\nexport function assertContractRequirementsSatisfied<\n TFamilyId extends string,\n TTargetId extends string,\n>({\n contract,\n stack,\n}: {\n readonly contract: Pick<Contract, 'targetFamily' | 'target' | 'extensionPacks'>;\n readonly stack: ControlStack<TFamilyId, TTargetId>;\n}): void {\n const providedComponentIds = new Set<string>([\n stack.target.id,\n ...(stack.adapter ? [stack.adapter.id] : []),\n ]);\n for (const extension of stack.extensionPacks) {\n providedComponentIds.add(extension.id);\n }\n\n const result = checkContractComponentRequirements({\n contract,\n expectedTargetFamily: stack.target.familyId,\n expectedTargetId: stack.target.targetId,\n providedComponentIds,\n });\n\n if (result.familyMismatch) {\n throw errorConfigValidation('contract.targetFamily', {\n why: `Contract was emitted for family '${result.familyMismatch.actual}' but CLI config is wired to '${result.familyMismatch.expected}'.`,\n });\n }\n\n if (result.targetMismatch) {\n throw errorConfigValidation('contract.target', {\n why: `Contract target '${result.targetMismatch.actual}' does not match CLI target '${result.targetMismatch.expected}'.`,\n });\n }\n\n if (result.missingExtensionPackIds.length > 0) {\n throw errorContractMissingExtensionPacks({\n missingExtensionPacks: result.missingExtensionPackIds,\n providedComponentIds: [...providedComponentIds],\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAgB,oCAId,kBACA,kBACA,qBACqE;CACrE,KAAK,IAAI,IAAI,GAAG,IAAI,oBAAoB,QAAQ,KAAK;EACnD,MAAM,YAAY,oBAAoB;EAGtC,IAAI,OAAO,cAAc,YAAY,cAAc,MACjD,MAAM,sBAAsB,yBAAyB,EACnD,KAAK,gCAAgC,EAAE,oBACzC,CAAC;EAGH,MAAM,SAAS;EAGf,IAAI,CAAC,OAAO,OAAO,QAAQ,MAAM,GAC/B,MAAM,sBAAsB,8BAA8B,EACxD,KAAK,gCAAgC,EAAE,4BACzC,CAAC;EAGH,MAAM,OAAO,OAAO;EACpB,IAAI,SAAS,YAAY,SAAS,aAAa,SAAS,eAAe,SAAS,UAC9E,MAAM,sBAAsB,8BAA8B,EACxD,KAAK,gCAAgC,EAAE,qBAAqB,OAAO,IAAI,EAAE,2DAC3E,CAAC;EAIH,IAAI,CAAC,OAAO,OAAO,QAAQ,UAAU,GACnC,MAAM,sBAAsB,kCAAkC,EAC5D,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,iCAChE,CAAC;EAGH,MAAM,WAAW,OAAO;EACxB,IAAI,aAAa,kBACf,MAAM,sBAAsB,kCAAkC,EAC5D,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,kBAAkB,OAAO,QAAQ,EAAE,kBAAkB,iBAAiB,GACtI,CAAC;EAIH,IAAI,CAAC,OAAO,OAAO,QAAQ,UAAU,GACnC,MAAM,sBAAsB,kCAAkC,EAC5D,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,iCAChE,CAAC;EAGH,MAAM,WAAW,OAAO;EACxB,IAAI,aAAa,kBACf,MAAM,sBAAsB,kCAAkC,EAC5D,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,kBAAkB,OAAO,QAAQ,EAAE,kBAAkB,iBAAiB,GACtI,CAAC;CAEL;CAGA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"global-flags-BpoOYtNZ.d.mts","names":[],"sources":["../src/utils/global-flags.ts"],"mappings":";KAMY,YAAA;AAAA,UAEK,WAAA;EAAA,SACN,MAAA,EAAQ,YAAY;EAAA,SACpB,cAAA;EAAA,SACA,IAAA;EAAA,SACA,KAAA;EAAA,SACA,OAAA;EAAA,SACA,KAAA;EAAA,SACA,WAAA;EAAA,SACA,GAAA;AAAA;;;;;UAOM,oBAAA;EAAA,SACN,MAAA;EAAA,SACA,IAAA;EAAA,SACA,KAAA;EAAA,SACA,CAAA;EAAA,SACA,OAAA;EAAA,SACA,CAAA;EAAA,SACA,KAAA;EAAA,SACA,KAAA;EAAA,SACA,UAAA;EAAA,SACA,WAAA;EAAA,SACA,gBAAA;EAAA,SACA,GAAA;EAAA,SACA,CAAA;AAAA"}
1
+ {"version":3,"file":"global-flags-BpoOYtNZ.d.mts","names":[],"sources":["../src/utils/global-flags.ts"],"mappings":";KAMY;UAEK;WACN,QAAQ;WACR;WACA;WACA;WACA;WACA;WACA;WACA;;;;;;UAOM;WACN;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA"}
@@ -1,6 +1,6 @@
1
- import { F as CliStructuredError, _ as createTerminalUI, b as formatErrorJson, x as formatErrorOutput } from "./command-helpers-CUoKYTlG.mjs";
1
+ import { F as CliStructuredError, _ as createTerminalUI, b as formatErrorJson, x as formatErrorOutput } from "./command-helpers-CVn3U9Uz.mjs";
2
2
  import { a as starterSchema, c as version, i as schemaSample, n as dbFile, o as targetLabel, r as defaultSchemaPath, s as targetPackageName, t as configFile } from "./cli.mjs";
3
- import { i as renderInitOutro, n as buildNextSteps, r as formatInitJson, t as InitOutputSchema } from "./output-mEQ74_nd.mjs";
3
+ import { i as renderInitOutro, n as buildNextSteps, r as formatInitJson, t as InitOutputSchema } from "./output-DWNYqZGc.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import { basename, dirname, extname, isAbsolute, join, normalize } from "pathe";
6
6
  import { blindCast } from "@prisma-next/utils/casts";
@@ -182,8 +182,7 @@ function stripQuotes(value) {
182
182
  * the user was never given the choice — `--force` is the contract.
183
183
  */
184
184
  function errorInitReinitNeedsForce() {
185
- return new CliStructuredError("5002", "Project is already initialized", {
186
- domain: "CLI",
185
+ return new CliStructuredError("CLI.INIT_REINIT_NEEDS_FORCE", "Project is already initialized", {
187
186
  why: "A `prisma-next.config.ts` already exists in this directory. Re-running `init` would overwrite the scaffolded files; in non-interactive mode `init` will not do that without `--force`.",
188
187
  fix: "Pass `--force` to overwrite the existing scaffold, or run `init` interactively to confirm.",
189
188
  docsUrl: "https://prisma-next.dev/docs/cli/init"
@@ -208,8 +207,7 @@ function errorInitMissingFlags(options) {
208
207
  default: return `--${flag} <value>`;
209
208
  }
210
209
  }).join(" ");
211
- return new CliStructuredError("5003", "Missing required flags", {
212
- domain: "CLI",
210
+ return new CliStructuredError("CLI.INIT_MISSING_FLAGS", "Missing required flags", {
213
211
  why: `${options.why} Missing required flag(s): ${flagList}.`,
214
212
  fix: `Re-run with the missing flag(s) supplied, e.g. \`prisma-next init --yes ${fixList}\`. Use \`prisma-next init --help\` to see every flag.`,
215
213
  docsUrl: "https://prisma-next.dev/docs/cli/init",
@@ -221,8 +219,7 @@ function errorInitMissingFlags(options) {
221
219
  * allowed values in `meta` for machine-readable consumption.
222
220
  */
223
221
  function errorInitInvalidFlagValue(options) {
224
- return new CliStructuredError("5004", `Invalid value for --${options.flag}`, {
225
- domain: "CLI",
222
+ return new CliStructuredError("CLI.INIT_INVALID_FLAG_VALUE", `Invalid value for --${options.flag}`, {
226
223
  why: `\`--${options.flag} ${options.value}\` is not one of: ${options.allowed.join(", ")}.`,
227
224
  fix: `Use one of: ${options.allowed.map((v) => `--${options.flag} ${v}`).join(", ")}.`,
228
225
  docsUrl: "https://prisma-next.dev/docs/cli/init",
@@ -240,8 +237,7 @@ function errorInitInvalidFlagValue(options) {
240
237
  */
241
238
  function errorInitAuthoringSchemaPathMismatch(options) {
242
239
  const expectedAuthoring = options.expectedExtension === ".ts" ? "typescript" : "psl";
243
- return new CliStructuredError("5014", "Authoring and schema path do not match", {
244
- domain: "CLI",
240
+ return new CliStructuredError("CLI.INIT_AUTHORING_SCHEMA_PATH_MISMATCH", "Authoring and schema path do not match", {
245
241
  why: `\`--authoring ${options.authoring}\` requires a schema file ending in ${options.expectedExtension}, but \`--schema-path ${options.schemaPath}\` ends in ${options.actualExtension}.`,
246
242
  fix: `Use a matching pair, for example \`--authoring ${expectedAuthoring} --schema-path <path>${options.expectedExtension}\`, or change \`--authoring\` to match the path you supplied. You can also omit \`--schema-path\` to use the default for the chosen authoring.`,
247
243
  docsUrl: "https://prisma-next.dev/docs/cli/init",
@@ -261,8 +257,7 @@ function errorInitAuthoringSchemaPathMismatch(options) {
261
257
  * 3 (USER_ABORTED).
262
258
  */
263
259
  function errorInitUserAborted() {
264
- return new CliStructuredError("5006", "Init cancelled", {
265
- domain: "CLI",
260
+ return new CliStructuredError("CLI.INIT_USER_ABORTED", "Init cancelled", {
266
261
  why: "The interactive prompt was cancelled before all required inputs were supplied. No files were modified.",
267
262
  fix: "Re-run `prisma-next init` and complete the prompts, or pass the required inputs as flags (see `--help`) for a non-interactive run.",
268
263
  severity: "info"
@@ -277,8 +272,7 @@ function errorInitUserAborted() {
277
272
  * mode is supposed to prevent.
278
273
  */
279
274
  function errorInitStrictProbeWithoutProbe() {
280
- return new CliStructuredError("5005", "`--strict-probe` requires `--probe-db`", {
281
- domain: "CLI",
275
+ return new CliStructuredError("CLI.INIT_STRICT_PROBE_WITHOUT_PROBE", "`--strict-probe` requires `--probe-db`", {
282
276
  why: "`--strict-probe` only changes how a *failed* probe is reported; without `--probe-db` no probe is attempted in the first place. (`init` is offline-by-default — it never opens a connection to your database without explicit consent.)",
283
277
  fix: "Add `--probe-db` to opt in to the probe, or drop `--strict-probe` if you do not need the version check.",
284
278
  docsUrl: "https://prisma-next.dev/docs/cli/init"
@@ -293,8 +287,7 @@ function errorInitStrictProbeWithoutProbe() {
293
287
  */
294
288
  function errorInitInstallFailed(options) {
295
289
  const trimmed = options.stderrLines.map((s) => s.trim()).filter(Boolean);
296
- return new CliStructuredError("5007", "Failed to install dependencies", {
297
- domain: "CLI",
290
+ return new CliStructuredError("CLI.INIT_INSTALL_FAILED", "Failed to install dependencies", {
298
291
  why: trimmed.length === 0 ? "The package manager exited with an error and no recoverable fallback applied." : `The package manager exited with: ${trimmed[0]}`,
299
292
  fix: `Install manually:\n ${options.addCommand}\n ${options.addDevCommand}\nThen run \`${options.emitCommand}\` to emit the contract.`,
300
293
  docsUrl: "https://prisma-next.dev/docs/cli/init",
@@ -316,8 +309,7 @@ function errorInitInstallFailed(options) {
316
309
  * and re-run.
317
310
  */
318
311
  function errorInitInvalidManifest(options) {
319
- return new CliStructuredError("5010", `Failed to parse ${options.path}`, {
320
- domain: "CLI",
312
+ return new CliStructuredError("CLI.INIT_INVALID_MANIFEST", `Failed to parse ${options.path}`, {
321
313
  why: `\`${options.path}\` is not valid JSON: ${options.cause}`,
322
314
  fix: `Fix the JSON syntax in \`${options.path}\` (a missing comma or unbalanced brace is the most common cause), then re-run \`prisma-next init\`.`,
323
315
  docsUrl: "https://prisma-next.dev/docs/cli/init",
@@ -342,8 +334,7 @@ function errorInitInvalidManifest(options) {
342
334
  * re-run.
343
335
  */
344
336
  function errorInitInvalidTsconfig(options) {
345
- return new CliStructuredError("5011", `Failed to parse ${options.path}`, {
346
- domain: "CLI",
337
+ return new CliStructuredError("CLI.INIT_INVALID_TSCONFIG", `Failed to parse ${options.path}`, {
347
338
  why: `\`${options.path}\` is not valid JSON or JSONC: ${options.cause}`,
348
339
  fix: `Fix the syntax in \`${options.path}\` and re-run \`prisma-next init\`. \`init\` accepts JSONC (comments and trailing commas) but cannot recover from unbalanced braces or missing commas.`,
349
340
  docsUrl: "https://prisma-next.dev/docs/cli/init",
@@ -368,8 +359,7 @@ function errorInitInvalidTsconfig(options) {
368
359
  * carries `filesWritten` so a follow-up agent can resume manually.
369
360
  */
370
361
  function errorInitProbeFailed(options) {
371
- return new CliStructuredError("5012", "Database probe failed", {
372
- domain: "CLI",
362
+ return new CliStructuredError("CLI.INIT_PROBE_FAILED", "Database probe failed", {
373
363
  why: `\`--probe-db\` could not complete and \`--strict-probe\` was set: ${options.cause}`,
374
364
  fix: "Confirm `DATABASE_URL` points at a reachable server, or drop `--strict-probe` to treat probe failures as warnings.",
375
365
  docsUrl: "https://prisma-next.dev/docs/cli/init",
@@ -386,8 +376,7 @@ function errorInitProbeFailed(options) {
386
376
  * `5 = EMIT_FAILED`.
387
377
  */
388
378
  function errorInitEmitFailed(options) {
389
- return new CliStructuredError("5008", "Failed to emit contract", {
390
- domain: "CLI",
379
+ return new CliStructuredError("CLI.INIT_EMIT_FAILED", "Failed to emit contract", {
391
380
  why: `\`prisma-next contract emit\` failed: ${options.cause}`,
392
381
  fix: `Inspect your contract file, fix the underlying issue, then re-run \`${options.emitCommand}\`. Pass \`-v\` for the full error envelope.`,
393
382
  docsUrl: "https://prisma-next.dev/docs/cli/contract-emit",
@@ -409,8 +398,7 @@ function errorInitEmitFailed(options) {
409
398
  * semantics. Maps to exit code `6 = SKILL_INSTALL_FAILED`.
410
399
  */
411
400
  function errorInitSkillInstallFailed(options) {
412
- return new CliStructuredError("5013", "Failed to install Prisma Next skills", {
413
- domain: "CLI",
401
+ return new CliStructuredError("CLI.INIT_SKILL_INSTALL_FAILED", "Failed to install Prisma Next skills", {
414
402
  why: `\`${options.skillInstallCommand}\` exited with an error: ${options.cause}`,
415
403
  fix: `Either:
416
404
  - Re-run \`prisma-next init --no-skill${options.filesWritten.length > 0 ? " --force" : ""}\` to skip the skill install for this run, or\n - Fix the underlying issue (network, npm registry, \`npx skills\` on PATH) and install manually:\n ${options.skillInstallCommand}`,
@@ -425,50 +413,59 @@ function errorInitSkillInstallFailed(options) {
425
413
  //#endregion
426
414
  //#region src/commands/init/hygiene-gitattributes.ts
427
415
  /**
428
- * The schema-relative `.gitattributes` entries written for a freshly
429
- * initialised project (FR3.4). Mirrors the relevant subset of the
430
- * repo-root [`.gitattributes`](../../../../../../../../.gitattributes):
416
+ * The `.gitattributes` entries written for a freshly initialised project
417
+ * (FR3.4). Mirrors the relevant subset of the repo-root
418
+ * [`.gitattributes`](../../../../../../../../.gitattributes):
431
419
  *
432
420
  * - **Today**: `contract.json`, `contract.d.ts` are emitted on every
433
421
  * `prisma-next contract emit`. Marking them `linguist-generated`
434
422
  * keeps GitHub's diff stats honest and collapses the file in code
435
423
  * review by default.
436
- * - **Forward-looking**: `end-contract.*`, `start-contract.*`, `ops.json`,
437
- * `migration.json` are not yet emitted by `init` flows but will be
438
- * produced by adjacent commands (lower / migration tooling). Adding
439
- * them now matches Decision 5 (forward-looking subset) so the file
440
- * does not need to be amended every time a new artefact lands.
441
- *
442
- * Patterns are written relative to the schema directory so a user
443
- * who runs `init --schema-path db/contract.prisma` gets
444
- * `db/contract.json linguist-generated` — not the workspace-glob form
445
- * `<glob>/contract.json` (which would over-match any unrelated
424
+ * - **Forward-looking**: `ops.json`, `migration.json` are not yet emitted
425
+ * by `init` flows but will be produced by adjacent commands (lower /
426
+ * migration tooling). Adding them now matches Decision 5
427
+ * (forward-looking subset) so the file does not need to be amended
428
+ * every time a new artifact lands.
429
+ *
430
+ * `ARTIFACT_FILENAMES` entries are written relative to the schema
431
+ * directory so a user who runs `init --schema-path db/contract.prisma`
432
+ * gets `db/contract.json linguist-generated` — not the workspace-glob
433
+ * form `<glob>/contract.json` (which would over-match any unrelated
446
434
  * `contract.json` the user has elsewhere) and not the absolute
447
- * `DEFAULT_CONTRACT_SOURCE_DIR/contract.json` (which would silently break for a non-default
448
- * schema path).
435
+ * `DEFAULT_CONTRACT_SOURCE_DIR/contract.json` (which would silently
436
+ * break for a non-default schema path).
437
+ *
438
+ * The migration contract snapshot store (`migrations/snapshots/<hex>/`)
439
+ * is anchored to the migrations root instead, not the schema directory:
440
+ * migration package depth under `migrations/` varies (`app/<pkg>`,
441
+ * `<space>/<pkg>`, or a bare `<pkg>` in extension source repos), so no
442
+ * single schema-dir-relative pattern can reach every snapshot. See
443
+ * `STORE_GITATTRIBUTES_LINES` below.
449
444
  */
450
- const ARTEFACT_FILENAMES$1 = [
445
+ const ARTIFACT_FILENAMES$1 = [
451
446
  "contract.json",
452
447
  "contract.d.ts",
453
- "end-contract.json",
454
- "end-contract.d.ts",
455
- "start-contract.json",
456
- "start-contract.d.ts",
457
448
  "ops.json",
458
449
  "migration.json"
459
450
  ];
460
451
  const ATTRIBUTE = "linguist-generated";
461
452
  /**
453
+ * Full `.gitattributes` lines for the migration contract snapshot store,
454
+ * already anchored to the migrations root — unlike `ARTIFACT_FILENAMES`,
455
+ * these are not combined with the schema-relative prefix.
456
+ */
457
+ const STORE_GITATTRIBUTES_LINES = [`migrations/snapshots/**/contract.json ${ATTRIBUTE}`, `migrations/snapshots/**/contract.d.ts ${ATTRIBUTE}`];
458
+ /**
462
459
  * Computes the `.gitattributes` lines this scaffold expects to own. Each
463
460
  * line has the shape `<path> linguist-generated`. The `target` parameter
464
461
  * is currently unused but accepted for symmetry with the other hygiene
465
462
  * helpers and to leave room for target-specific entries (e.g. a future
466
- * Mongo-only artefact) without a signature break.
463
+ * family-specific artifact) without a signature break.
467
464
  */
468
465
  function requiredGitattributesLines(schemaDir, _target) {
469
466
  const dir = schemaDir === "." ? "" : schemaDir.replace(/\/+$/, "");
470
467
  const prefix = dir === "" ? "" : `${dir}/`;
471
- return ARTEFACT_FILENAMES$1.map((file) => `${prefix}${file} ${ATTRIBUTE}`);
468
+ return [...ARTIFACT_FILENAMES$1.map((file) => `${prefix}${file} ${ATTRIBUTE}`), ...STORE_GITATTRIBUTES_LINES];
472
469
  }
473
470
  /**
474
471
  * Idempotent `.gitattributes` merge (FR3.4 / FR9.3). Returns the new file
@@ -1049,40 +1046,39 @@ function requirePeer(moduleId, baseDir, overrides) {
1049
1046
  /**
1050
1047
  * Filenames the contract pipeline emits next to the user's schema source
1051
1048
  * (`<schemaDir>/contract.json`, `<schemaDir>/contract.d.ts`, …). Mirrors
1052
- * `ARTEFACT_FILENAMES` in `hygiene-gitattributes.ts`; kept as a separate
1053
- * constant here because the cleanup contract is target-agnostic and we
1054
- * deliberately do not want a stale `start-contract.json` from a previous
1055
- * target lingering after a re-init.
1056
- *
1057
- * If a future emit pipeline produces an additional artefact, add it here
1058
- * **and** to the gitattributes list — the two stay in lockstep so the
1059
- * file `init` advertises as `linguist-generated` is exactly the file
1060
- * `init` is willing to delete on re-init.
1061
- */
1062
- const ARTEFACT_FILENAMES = [
1049
+ * the schema-dir-relative `ARTIFACT_FILENAMES` in `hygiene-gitattributes.ts`
1050
+ * (not that file's migrations-root-anchored store lines, which are outside
1051
+ * this command's scope reinit only ever touches `schemaDir`); kept as a
1052
+ * separate constant here because the cleanup contract is target-agnostic
1053
+ * and we deliberately do not want a stale artifact from a previous target
1054
+ * lingering after a re-init.
1055
+ *
1056
+ * If a future emit pipeline produces an additional schema-dir artifact,
1057
+ * add it here **and** to `ARTIFACT_FILENAMES` in `hygiene-gitattributes.ts`
1058
+ * — the two stay in lockstep so the file `init` advertises as
1059
+ * `linguist-generated` is exactly the file `init` is willing to delete on
1060
+ * re-init.
1061
+ */
1062
+ const ARTIFACT_FILENAMES = [
1063
1063
  "contract.json",
1064
1064
  "contract.d.ts",
1065
- "end-contract.json",
1066
- "end-contract.d.ts",
1067
- "start-contract.json",
1068
- "start-contract.d.ts",
1069
1065
  "ops.json",
1070
1066
  "migration.json"
1071
1067
  ];
1072
1068
  /**
1073
- * Returns the schema-relative paths of stale contract artefacts the
1069
+ * Returns the schema-relative paths of stale contract artifacts the
1074
1070
  * previous `init` run (or a `contract emit`) left behind in `schemaDir`.
1075
1071
  * Paths are returned relative to `baseDir` so the caller can plumb them
1076
1072
  * into `filesWritten`-style logging without re-deriving the path.
1077
1073
  *
1078
1074
  * Pure function: no filesystem mutation. Used by `runInit`'s precondition
1079
1075
  * phase (FR6.2 / NFR3 atomicity) so a downstream parse failure leaves
1080
- * the artefacts on disk and the project byte-identical to its pre-init
1076
+ * the artifacts on disk and the project byte-identical to its pre-init
1081
1077
  * state.
1082
1078
  */
1083
- function findStaleArtefacts(baseDir, schemaDir) {
1079
+ function findStaleArtifacts(baseDir, schemaDir) {
1084
1080
  const result = [];
1085
- for (const filename of ARTEFACT_FILENAMES) {
1081
+ for (const filename of ARTIFACT_FILENAMES) {
1086
1082
  const rel = join(schemaDir, filename);
1087
1083
  if (existsSync(join(baseDir, rel))) result.push(rel);
1088
1084
  }
@@ -1681,7 +1677,7 @@ async function runInit(baseDir, runOptions) {
1681
1677
  content: envExampleContent(inputs.target)
1682
1678
  }
1683
1679
  ];
1684
- const filesToDelete = inputs.reinit ? [...findStaleArtefacts(baseDir, schemaDir)] : [];
1680
+ const filesToDelete = inputs.reinit ? [...findStaleArtifacts(baseDir, schemaDir)] : [];
1685
1681
  if (existsSync(join(baseDir, ".agents/skills/prisma-next/SKILL.md"))) filesToDelete.push(LEGACY_SKILL_FILE);
1686
1682
  if (inputs.writeEnv) if (!existsSync(join(baseDir, ".env"))) filesToWrite.push({
1687
1683
  path: ".env",
@@ -1880,8 +1876,7 @@ async function runInit(baseDir, runOptions) {
1880
1876
  warnings
1881
1877
  };
1882
1878
  const validated = InitOutputSchema(output);
1883
- if (validated instanceof Error || validated.problems !== void 0) return emitError(ui, flags, new CliStructuredError("5009", "Init produced an invalid output document", {
1884
- domain: "CLI",
1879
+ if (validated instanceof Error || validated.problems !== void 0) return emitError(ui, flags, new CliStructuredError("CLI.INIT_INVALID_OUTPUT_DOCUMENT", "Init produced an invalid output document", {
1885
1880
  why: `The success document failed schema validation: ${String(validated)}`,
1886
1881
  fix: "This is a bug in prisma-next. Please report it with the full `-v` output.",
1887
1882
  docsUrl: "https://prisma-next.dev/docs/cli/init"
@@ -1910,10 +1905,10 @@ function emitError(ui, flags, error) {
1910
1905
  * Maps a structured init error to its documented exit code. Centralised so
1911
1906
  * the error → exit-code contract lives next to the codes themselves.
1912
1907
  *
1913
- * `5009` (and the unknown-code default branch) routes to
1914
- * `INIT_EXIT_INTERNAL_ERROR` because those represent prisma-next bugs the
1915
- * user did not cause — surfacing them as `PRECONDITION` would mislead
1916
- * automation into thinking the caller mis-invoked the CLI.
1908
+ * `CLI.INIT_INVALID_OUTPUT_DOCUMENT` (and the unknown-code default branch)
1909
+ * routes to `INIT_EXIT_INTERNAL_ERROR` because those represent prisma-next
1910
+ * bugs the user did not cause — surfacing them as `PRECONDITION` would
1911
+ * mislead automation into thinking the caller mis-invoked the CLI.
1917
1912
  *
1918
1913
  * See [exit-codes.ts](./exit-codes.ts) for the canonical list and
1919
1914
  * [Style Guide § Exit Codes](../../../../../../../docs/CLI%20Style%20Guide.md#exit-codes)
@@ -1924,19 +1919,19 @@ function emitError(ui, flags, error) {
1924
1919
  */
1925
1920
  function exitCodeForError(error) {
1926
1921
  switch (error.code) {
1927
- case "5002":
1928
- case "5003":
1929
- case "5004":
1930
- case "5005":
1931
- case "5010":
1932
- case "5011":
1933
- case "5012":
1934
- case "5014": return 2;
1935
- case "5006": return 3;
1936
- case "5007": return 4;
1937
- case "5008": return 5;
1938
- case "5009": return 1;
1939
- case "5013": return 6;
1922
+ case "CLI.INIT_REINIT_NEEDS_FORCE":
1923
+ case "CLI.INIT_MISSING_FLAGS":
1924
+ case "CLI.INIT_INVALID_FLAG_VALUE":
1925
+ case "CLI.INIT_STRICT_PROBE_WITHOUT_PROBE":
1926
+ case "CLI.INIT_INVALID_MANIFEST":
1927
+ case "CLI.INIT_INVALID_TSCONFIG":
1928
+ case "CLI.INIT_PROBE_FAILED":
1929
+ case "CLI.INIT_AUTHORING_SCHEMA_PATH_MISMATCH": return 2;
1930
+ case "CLI.INIT_USER_ABORTED": return 3;
1931
+ case "CLI.INIT_INSTALL_FAILED": return 4;
1932
+ case "CLI.INIT_EMIT_FAILED": return 5;
1933
+ case "CLI.INIT_INVALID_OUTPUT_DOCUMENT": return 1;
1934
+ case "CLI.INIT_SKILL_INSTALL_FAILED": return 6;
1940
1935
  default: return 1;
1941
1936
  }
1942
1937
  }
@@ -2094,7 +2089,7 @@ function formatCatalogWarning(workspaceFile, entries) {
2094
2089
  /**
2095
2090
  * Recognised pnpm error signatures that justify a fallback to npm.
2096
2091
  *
2097
- * These patterns indicate the published artefact itself is at fault
2092
+ * These patterns indicate the published artifact itself is at fault
2098
2093
  * (a leaked `workspace:*` or `catalog:` specifier), not the user's
2099
2094
  * environment — pnpm is faithfully reporting "I cannot resolve this
2100
2095
  * registry version", and npm is willing to install it because npm
@@ -2153,7 +2148,7 @@ async function runEmit(ctx) {
2153
2148
  const spinner = ctx.ui.spinner();
2154
2149
  spinner.start("Emitting contract...");
2155
2150
  try {
2156
- const { executeContractEmit } = await import("./contract-emit-sYrqzsdN.mjs").then((n) => n.t);
2151
+ const { executeContractEmit } = await import("./contract-emit-iSMJVs26.mjs").then((n) => n.t);
2157
2152
  await executeContractEmit({ configPath: join(ctx.baseDir, "prisma-next.config.ts") });
2158
2153
  spinner.stop("Contract emitted");
2159
2154
  } catch (err) {
@@ -2206,4 +2201,4 @@ function sanitisePackageName(raw) {
2206
2201
  //#endregion
2207
2202
  export { runInit };
2208
2203
 
2209
- //# sourceMappingURL=init-D8YFfaD6.mjs.map
2204
+ //# sourceMappingURL=init-BSgPxVXA.mjs.map