@prisma-next/cli 0.3.0-pr.99.6 → 0.4.0-dev.1

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 (257) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +381 -128
  3. package/dist/agent-skill-mongo.md +106 -0
  4. package/dist/agent-skill-postgres.md +106 -0
  5. package/dist/cli-errors-BDCYR5ap.mjs +4 -0
  6. package/dist/cli-errors-DStABy9d.d.mts +3 -0
  7. package/dist/cli.d.mts +1 -0
  8. package/dist/cli.js +1 -2910
  9. package/dist/cli.mjs +254 -0
  10. package/dist/cli.mjs.map +1 -0
  11. package/dist/client-DiUkJAeN.mjs +987 -0
  12. package/dist/client-DiUkJAeN.mjs.map +1 -0
  13. package/dist/commands/contract-emit.d.mts +7 -0
  14. package/dist/commands/contract-emit.d.mts.map +1 -0
  15. package/dist/commands/contract-emit.mjs +4 -0
  16. package/dist/commands/contract-infer.d.mts +7 -0
  17. package/dist/commands/contract-infer.d.mts.map +1 -0
  18. package/dist/commands/contract-infer.mjs +4 -0
  19. package/dist/commands/db-init.d.mts +7 -0
  20. package/dist/commands/db-init.d.mts.map +1 -0
  21. package/dist/commands/db-init.mjs +125 -0
  22. package/dist/commands/db-init.mjs.map +1 -0
  23. package/dist/commands/db-schema.d.mts +7 -0
  24. package/dist/commands/db-schema.d.mts.map +1 -0
  25. package/dist/commands/db-schema.mjs +53 -0
  26. package/dist/commands/db-schema.mjs.map +1 -0
  27. package/dist/commands/db-sign.d.mts +7 -0
  28. package/dist/commands/db-sign.d.mts.map +1 -0
  29. package/dist/commands/db-sign.mjs +136 -0
  30. package/dist/commands/db-sign.mjs.map +1 -0
  31. package/dist/commands/db-update.d.mts +7 -0
  32. package/dist/commands/db-update.d.mts.map +1 -0
  33. package/dist/commands/db-update.mjs +122 -0
  34. package/dist/commands/db-update.mjs.map +1 -0
  35. package/dist/commands/db-verify.d.mts +7 -0
  36. package/dist/commands/db-verify.d.mts.map +1 -0
  37. package/dist/commands/db-verify.mjs +322 -0
  38. package/dist/commands/db-verify.mjs.map +1 -0
  39. package/dist/commands/migration-apply.d.mts +36 -0
  40. package/dist/commands/migration-apply.d.mts.map +1 -0
  41. package/dist/commands/migration-apply.mjs +244 -0
  42. package/dist/commands/migration-apply.mjs.map +1 -0
  43. package/dist/commands/migration-new.d.mts +8 -0
  44. package/dist/commands/migration-new.d.mts.map +1 -0
  45. package/dist/commands/migration-new.mjs +152 -0
  46. package/dist/commands/migration-new.mjs.map +1 -0
  47. package/dist/commands/migration-plan.d.mts +47 -0
  48. package/dist/commands/migration-plan.d.mts.map +1 -0
  49. package/dist/commands/migration-plan.mjs +313 -0
  50. package/dist/commands/migration-plan.mjs.map +1 -0
  51. package/dist/commands/migration-ref.d.mts +43 -0
  52. package/dist/commands/migration-ref.d.mts.map +1 -0
  53. package/dist/commands/migration-ref.mjs +195 -0
  54. package/dist/commands/migration-ref.mjs.map +1 -0
  55. package/dist/commands/migration-show.d.mts +28 -0
  56. package/dist/commands/migration-show.d.mts.map +1 -0
  57. package/dist/commands/migration-show.mjs +140 -0
  58. package/dist/commands/migration-show.mjs.map +1 -0
  59. package/dist/commands/migration-status.d.mts +86 -0
  60. package/dist/commands/migration-status.d.mts.map +1 -0
  61. package/dist/commands/migration-status.mjs +4 -0
  62. package/dist/commands/migration-verify.d.mts +16 -0
  63. package/dist/commands/migration-verify.d.mts.map +1 -0
  64. package/dist/commands/migration-verify.mjs +110 -0
  65. package/dist/commands/migration-verify.mjs.map +1 -0
  66. package/dist/config-loader-C4VXKl8f.mjs +43 -0
  67. package/dist/config-loader-C4VXKl8f.mjs.map +1 -0
  68. package/dist/{config-loader.d.ts → config-loader.d.mts} +8 -3
  69. package/dist/config-loader.d.mts.map +1 -0
  70. package/dist/config-loader.mjs +3 -0
  71. package/dist/contract-emit-D2wDXfyo.mjs +191 -0
  72. package/dist/contract-emit-D2wDXfyo.mjs.map +1 -0
  73. package/dist/contract-emit-D9WOShFz.mjs +4 -0
  74. package/dist/contract-emit-Zm_sd1wQ.mjs +112 -0
  75. package/dist/contract-emit-Zm_sd1wQ.mjs.map +1 -0
  76. package/dist/contract-enrichment-CGW6mm-E.mjs +79 -0
  77. package/dist/contract-enrichment-CGW6mm-E.mjs.map +1 -0
  78. package/dist/contract-infer-DozZT511.mjs +90 -0
  79. package/dist/contract-infer-DozZT511.mjs.map +1 -0
  80. package/dist/exports/config-types.d.mts +2 -0
  81. package/dist/exports/config-types.mjs +3 -0
  82. package/dist/exports/control-api.d.mts +624 -0
  83. package/dist/exports/control-api.d.mts.map +1 -0
  84. package/dist/exports/control-api.mjs +6 -0
  85. package/dist/{load-ts-contract.d.ts → exports/index.d.mts} +12 -7
  86. package/dist/exports/index.d.mts.map +1 -0
  87. package/dist/exports/index.mjs +137 -0
  88. package/dist/exports/index.mjs.map +1 -0
  89. package/dist/extract-operation-statements-DZUJNmL3.mjs +13 -0
  90. package/dist/extract-operation-statements-DZUJNmL3.mjs.map +1 -0
  91. package/dist/extract-sql-ddl-DDMX-9mz.mjs +26 -0
  92. package/dist/extract-sql-ddl-DDMX-9mz.mjs.map +1 -0
  93. package/dist/framework-components-BAsliT4V.mjs +59 -0
  94. package/dist/framework-components-BAsliT4V.mjs.map +1 -0
  95. package/dist/init-DQ8auNB4.mjs +430 -0
  96. package/dist/init-DQ8auNB4.mjs.map +1 -0
  97. package/dist/inspect-live-schema-BYnhztxZ.mjs +91 -0
  98. package/dist/inspect-live-schema-BYnhztxZ.mjs.map +1 -0
  99. package/dist/migration-command-scaffold-CntCcntR.mjs +105 -0
  100. package/dist/migration-command-scaffold-CntCcntR.mjs.map +1 -0
  101. package/dist/migration-status-CJANY4yr.mjs +1583 -0
  102. package/dist/migration-status-CJANY4yr.mjs.map +1 -0
  103. package/dist/migrations-DTZBYXm1.mjs +173 -0
  104. package/dist/migrations-DTZBYXm1.mjs.map +1 -0
  105. package/dist/progress-adapter-B-YvmcDu.mjs +43 -0
  106. package/dist/progress-adapter-B-YvmcDu.mjs.map +1 -0
  107. package/dist/quick-reference-mongo.md +93 -0
  108. package/dist/quick-reference-postgres.md +91 -0
  109. package/dist/result-handler-oK_vA-Fn.mjs +697 -0
  110. package/dist/result-handler-oK_vA-Fn.mjs.map +1 -0
  111. package/dist/terminal-ui-C5k88MmW.mjs +274 -0
  112. package/dist/terminal-ui-C5k88MmW.mjs.map +1 -0
  113. package/dist/validate-contract-deps-esa-VQ0h.mjs +37 -0
  114. package/dist/validate-contract-deps-esa-VQ0h.mjs.map +1 -0
  115. package/dist/verify-DlFQ2FOw.mjs +385 -0
  116. package/dist/verify-DlFQ2FOw.mjs.map +1 -0
  117. package/package.json +87 -40
  118. package/src/cli.ts +118 -58
  119. package/src/commands/contract-emit.ts +101 -78
  120. package/src/commands/contract-infer-paths.ts +32 -0
  121. package/src/commands/contract-infer.ts +143 -0
  122. package/src/commands/db-init.ts +97 -219
  123. package/src/commands/db-schema.ts +77 -0
  124. package/src/commands/db-sign.ts +46 -73
  125. package/src/commands/db-update.ts +236 -0
  126. package/src/commands/db-verify.ts +409 -119
  127. package/src/commands/init/detect-package-manager.ts +47 -0
  128. package/src/commands/init/index.ts +21 -0
  129. package/src/commands/init/init.ts +203 -0
  130. package/src/commands/init/templates/agent-skill-mongo.md +106 -0
  131. package/src/commands/init/templates/agent-skill-postgres.md +106 -0
  132. package/src/commands/init/templates/agent-skill.ts +19 -0
  133. package/src/commands/init/templates/code-templates.ts +168 -0
  134. package/src/commands/init/templates/quick-reference-mongo.md +93 -0
  135. package/src/commands/init/templates/quick-reference-postgres.md +91 -0
  136. package/src/commands/init/templates/quick-reference.ts +19 -0
  137. package/src/commands/init/templates/render.ts +20 -0
  138. package/src/commands/init/templates/tsconfig.ts +35 -0
  139. package/src/commands/inspect-live-schema.ts +170 -0
  140. package/src/commands/migration-apply.ts +427 -0
  141. package/src/commands/migration-new.ts +260 -0
  142. package/src/commands/migration-plan.ts +519 -0
  143. package/src/commands/migration-ref.ts +305 -0
  144. package/src/commands/migration-show.ts +246 -0
  145. package/src/commands/migration-status.ts +864 -0
  146. package/src/commands/migration-verify.ts +180 -0
  147. package/src/config-loader.ts +13 -3
  148. package/src/control-api/client.ts +205 -183
  149. package/src/control-api/contract-enrichment.ts +119 -0
  150. package/src/control-api/errors.ts +9 -0
  151. package/src/control-api/operations/contract-emit.ts +181 -0
  152. package/src/control-api/operations/db-init.ts +53 -49
  153. package/src/control-api/operations/db-update.ts +220 -0
  154. package/src/control-api/operations/extract-operation-statements.ts +14 -0
  155. package/src/control-api/operations/extract-sql-ddl.ts +47 -0
  156. package/src/control-api/operations/migration-apply.ts +191 -0
  157. package/src/control-api/operations/migration-helpers.ts +49 -0
  158. package/src/control-api/types.ts +274 -52
  159. package/src/exports/config-types.ts +4 -3
  160. package/src/exports/control-api.ts +15 -5
  161. package/src/load-ts-contract.ts +30 -19
  162. package/src/utils/cli-errors.ts +14 -8
  163. package/src/utils/command-helpers.ts +302 -3
  164. package/src/utils/formatters/emit.ts +67 -0
  165. package/src/utils/formatters/errors.ts +82 -0
  166. package/src/utils/formatters/graph-migration-mapper.ts +240 -0
  167. package/src/utils/formatters/graph-render.ts +1323 -0
  168. package/src/utils/formatters/graph-types.ts +120 -0
  169. package/src/utils/formatters/help.ts +380 -0
  170. package/src/utils/formatters/helpers.ts +28 -0
  171. package/src/utils/formatters/migrations.ts +346 -0
  172. package/src/utils/formatters/styled.ts +212 -0
  173. package/src/utils/formatters/verify.ts +621 -0
  174. package/src/utils/framework-components.ts +13 -10
  175. package/src/utils/global-flags.ts +41 -23
  176. package/src/utils/migration-command-scaffold.ts +184 -0
  177. package/src/utils/migration-types.ts +12 -0
  178. package/src/utils/progress-adapter.ts +18 -29
  179. package/src/utils/result-handler.ts +12 -13
  180. package/src/utils/shutdown.ts +92 -0
  181. package/src/utils/suggest-command.ts +31 -0
  182. package/src/utils/terminal-ui.ts +276 -0
  183. package/src/utils/validate-contract-deps.ts +49 -0
  184. package/dist/chunk-AGOTG4L3.js +0 -965
  185. package/dist/chunk-AGOTG4L3.js.map +0 -1
  186. package/dist/chunk-HLLI4YL7.js +0 -180
  187. package/dist/chunk-HLLI4YL7.js.map +0 -1
  188. package/dist/chunk-HWYQOCAJ.js +0 -47
  189. package/dist/chunk-HWYQOCAJ.js.map +0 -1
  190. package/dist/chunk-VG2R7DGF.js +0 -735
  191. package/dist/chunk-VG2R7DGF.js.map +0 -1
  192. package/dist/cli.d.ts +0 -2
  193. package/dist/cli.d.ts.map +0 -1
  194. package/dist/cli.js.map +0 -1
  195. package/dist/commands/contract-emit.d.ts +0 -3
  196. package/dist/commands/contract-emit.d.ts.map +0 -1
  197. package/dist/commands/contract-emit.js +0 -10
  198. package/dist/commands/contract-emit.js.map +0 -1
  199. package/dist/commands/db-init.d.ts +0 -3
  200. package/dist/commands/db-init.d.ts.map +0 -1
  201. package/dist/commands/db-init.js +0 -257
  202. package/dist/commands/db-init.js.map +0 -1
  203. package/dist/commands/db-introspect.d.ts +0 -3
  204. package/dist/commands/db-introspect.d.ts.map +0 -1
  205. package/dist/commands/db-introspect.js +0 -155
  206. package/dist/commands/db-introspect.js.map +0 -1
  207. package/dist/commands/db-schema-verify.d.ts +0 -3
  208. package/dist/commands/db-schema-verify.d.ts.map +0 -1
  209. package/dist/commands/db-schema-verify.js +0 -171
  210. package/dist/commands/db-schema-verify.js.map +0 -1
  211. package/dist/commands/db-sign.d.ts +0 -3
  212. package/dist/commands/db-sign.d.ts.map +0 -1
  213. package/dist/commands/db-sign.js +0 -195
  214. package/dist/commands/db-sign.js.map +0 -1
  215. package/dist/commands/db-verify.d.ts +0 -3
  216. package/dist/commands/db-verify.d.ts.map +0 -1
  217. package/dist/commands/db-verify.js +0 -193
  218. package/dist/commands/db-verify.js.map +0 -1
  219. package/dist/config-loader.d.ts.map +0 -1
  220. package/dist/config-loader.js +0 -7
  221. package/dist/config-loader.js.map +0 -1
  222. package/dist/control-api/client.d.ts +0 -13
  223. package/dist/control-api/client.d.ts.map +0 -1
  224. package/dist/control-api/operations/db-init.d.ts +0 -29
  225. package/dist/control-api/operations/db-init.d.ts.map +0 -1
  226. package/dist/control-api/types.d.ts +0 -387
  227. package/dist/control-api/types.d.ts.map +0 -1
  228. package/dist/exports/config-types.d.ts +0 -3
  229. package/dist/exports/config-types.d.ts.map +0 -1
  230. package/dist/exports/config-types.js +0 -6
  231. package/dist/exports/config-types.js.map +0 -1
  232. package/dist/exports/control-api.d.ts +0 -13
  233. package/dist/exports/control-api.d.ts.map +0 -1
  234. package/dist/exports/control-api.js +0 -7
  235. package/dist/exports/control-api.js.map +0 -1
  236. package/dist/exports/index.d.ts +0 -4
  237. package/dist/exports/index.d.ts.map +0 -1
  238. package/dist/exports/index.js +0 -176
  239. package/dist/exports/index.js.map +0 -1
  240. package/dist/load-ts-contract.d.ts.map +0 -1
  241. package/dist/utils/cli-errors.d.ts +0 -7
  242. package/dist/utils/cli-errors.d.ts.map +0 -1
  243. package/dist/utils/command-helpers.d.ts +0 -12
  244. package/dist/utils/command-helpers.d.ts.map +0 -1
  245. package/dist/utils/framework-components.d.ts +0 -70
  246. package/dist/utils/framework-components.d.ts.map +0 -1
  247. package/dist/utils/global-flags.d.ts +0 -25
  248. package/dist/utils/global-flags.d.ts.map +0 -1
  249. package/dist/utils/output.d.ts +0 -142
  250. package/dist/utils/output.d.ts.map +0 -1
  251. package/dist/utils/progress-adapter.d.ts +0 -26
  252. package/dist/utils/progress-adapter.d.ts.map +0 -1
  253. package/dist/utils/result-handler.d.ts +0 -15
  254. package/dist/utils/result-handler.d.ts.map +0 -1
  255. package/src/commands/db-introspect.ts +0 -227
  256. package/src/commands/db-schema-verify.ts +0 -238
  257. package/src/utils/output.ts +0 -1471
@@ -0,0 +1,28 @@
1
+ import { t as CliStructuredError } from "../cli-errors-DStABy9d.mjs";
2
+ import { Command } from "commander";
3
+ import { Result } from "@prisma-next/utils/result";
4
+ import { MigrationBundle } from "@prisma-next/migration-tools/types";
5
+
6
+ //#region src/commands/migration-show.d.ts
7
+ interface MigrationShowResult {
8
+ readonly ok: true;
9
+ readonly dirName: string;
10
+ readonly dirPath: string;
11
+ readonly from: string;
12
+ readonly to: string;
13
+ readonly migrationId: string | null;
14
+ readonly kind: string;
15
+ readonly createdAt: string;
16
+ readonly operations: readonly {
17
+ readonly id: string;
18
+ readonly label: string;
19
+ readonly operationClass: string;
20
+ }[];
21
+ readonly sql: readonly string[];
22
+ readonly summary: string;
23
+ }
24
+ declare function resolveByHashPrefix(packages: readonly MigrationBundle[], prefix: string): Result<MigrationBundle, CliStructuredError>;
25
+ declare function createMigrationShowCommand(): Command;
26
+ //#endregion
27
+ export { MigrationShowResult, createMigrationShowCommand, resolveByHashPrefix };
28
+ //# sourceMappingURL=migration-show.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-show.d.mts","names":[],"sources":["../../src/commands/migration-show.ts"],"sourcesContent":[],"mappings":";;;;;;UA2BiB,mBAAA;;EAAA,SAAA,OAAA,EAAA,MAAmB;EAsBpB,SAAA,OAAA,EAAA,MAAmB;EACd,SAAA,IAAA,EAAA,MAAA;EAEX,SAAA,EAAA,EAAA,MAAA;EAAiB,SAAA,WAAA,EAAA,MAAA,GAAA,IAAA;EAAxB,SAAA,IAAA,EAAA,MAAA;EAAM,SAAA,SAAA,EAAA,MAAA;EA2JO,SAAA,UAAA,EAAA,SAA0B;;;;;;;;iBA9J1B,mBAAA,oBACK,oCAElB,OAAO,iBAAiB;iBA2JX,0BAAA,CAAA,GAA8B"}
@@ -0,0 +1,140 @@
1
+ import { t as loadConfig } from "../config-loader-C4VXKl8f.mjs";
2
+ import { _ as errorUnexpected, m as errorRuntime } from "../cli-errors-BDCYR5ap.mjs";
3
+ import { t as extractOperationStatements } from "../extract-operation-statements-DZUJNmL3.mjs";
4
+ import { _ as formatStyledHeader, d as setCommandExamples, m as parseGlobalFlags, n as addGlobalOptions, t as handleResult, u as setCommandDescriptions } from "../result-handler-oK_vA-Fn.mjs";
5
+ import { t as TerminalUI } from "../terminal-ui-C5k88MmW.mjs";
6
+ import { a as formatMigrationShowOutput } from "../migrations-DTZBYXm1.mjs";
7
+ import { Command } from "commander";
8
+ import { notOk, ok } from "@prisma-next/utils/result";
9
+ import { relative, resolve } from "pathe";
10
+ import { findLatestMigration, reconstructGraph } from "@prisma-next/migration-tools/dag";
11
+ import { readMigrationPackage, readMigrationsDir } from "@prisma-next/migration-tools/io";
12
+ import { MigrationToolsError, isAttested } from "@prisma-next/migration-tools/types";
13
+
14
+ //#region src/commands/migration-show.ts
15
+ function looksLikePath(target) {
16
+ return target.includes("/") || target.includes("\\");
17
+ }
18
+ function resolveByHashPrefix(packages, prefix) {
19
+ const normalizedPrefix = prefix.startsWith("sha256:") ? prefix : `sha256:${prefix}`;
20
+ const matches = packages.filter((p) => typeof p.manifest.migrationId === "string").filter((p) => p.manifest.migrationId.startsWith(normalizedPrefix));
21
+ if (matches.length === 1) return ok(matches[0]);
22
+ if (matches.length === 0) return notOk(errorRuntime("No migration found matching prefix", {
23
+ why: `No attested migration has a migrationId starting with "${normalizedPrefix}"`,
24
+ fix: "Run `prisma-next migration show` (no argument) to see the latest migration, or check the migrations directory for available packages."
25
+ }));
26
+ return notOk(errorRuntime("Ambiguous hash prefix", {
27
+ why: `Multiple migrations match prefix "${normalizedPrefix}":\n${matches.map((p) => ` ${p.dirName} ${p.manifest.migrationId}`).join("\n")}`,
28
+ fix: "Provide a longer prefix to uniquely identify the migration."
29
+ }));
30
+ }
31
+ async function executeMigrationShowCommand(target, options, flags, ui) {
32
+ const config = await loadConfig(options.config);
33
+ const configPath = options.config ? relative(process.cwd(), resolve(options.config)) : "prisma-next.config.ts";
34
+ const migrationsDir = resolve(options.config ? resolve(options.config, "..") : process.cwd(), config.migrations?.dir ?? "migrations");
35
+ const migrationsRelative = relative(process.cwd(), migrationsDir);
36
+ if (!flags.json && !flags.quiet) {
37
+ const details = [{
38
+ label: "config",
39
+ value: configPath
40
+ }, {
41
+ label: "migrations",
42
+ value: migrationsRelative
43
+ }];
44
+ if (target) details.push({
45
+ label: "target",
46
+ value: target
47
+ });
48
+ const header = formatStyledHeader({
49
+ command: "migration show",
50
+ description: "Display migration package contents",
51
+ details,
52
+ flags
53
+ });
54
+ ui.stderr(header);
55
+ }
56
+ let pkg;
57
+ try {
58
+ if (target && looksLikePath(target)) pkg = await readMigrationPackage(resolve(target));
59
+ else {
60
+ const allPackages = await readMigrationsDir(migrationsDir);
61
+ if (allPackages.length === 0) return notOk(errorRuntime("No migrations found", {
62
+ why: `No migration packages found in ${migrationsRelative}`,
63
+ fix: "Run `prisma-next migration plan` to create a migration first."
64
+ }));
65
+ if (target) {
66
+ const resolved = resolveByHashPrefix(allPackages, target);
67
+ if (!resolved.ok) return resolved;
68
+ pkg = resolved.value;
69
+ } else {
70
+ const attested = allPackages.filter(isAttested);
71
+ if (attested.length === 0) return notOk(errorRuntime("No attested migrations found", {
72
+ why: `All migrations in ${migrationsRelative} are drafts (migrationId: null)`,
73
+ fix: "Run `prisma-next migration verify --dir <path>` to attest a draft migration."
74
+ }));
75
+ const latestMigration = findLatestMigration(reconstructGraph(attested));
76
+ if (!latestMigration) return notOk(errorRuntime("Could not resolve latest migration", {
77
+ why: "No latest migration found in the migration history",
78
+ fix: "The migrations directory may be corrupted. Inspect the migration.json files."
79
+ }));
80
+ const leafPkg = attested.find((p) => p.manifest.migrationId === latestMigration.migrationId);
81
+ if (!leafPkg) return notOk(errorRuntime("Could not resolve latest migration", {
82
+ why: `Latest migration ${latestMigration.dirName} does not match any package`,
83
+ fix: "The migrations directory may be corrupted. Inspect the migration.json files."
84
+ }));
85
+ pkg = leafPkg;
86
+ }
87
+ }
88
+ } catch (error) {
89
+ if (MigrationToolsError.is(error)) return notOk(errorRuntime(error.message, {
90
+ why: error.why,
91
+ fix: error.fix,
92
+ meta: {
93
+ code: error.code,
94
+ ...error.details ?? {}
95
+ }
96
+ }));
97
+ return notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read migration: ${error instanceof Error ? error.message : String(error)}` }));
98
+ }
99
+ const ops = pkg.ops;
100
+ const sql = extractOperationStatements(config.family.familyId, ops) ?? [];
101
+ return ok({
102
+ ok: true,
103
+ dirName: pkg.dirName,
104
+ dirPath: relative(process.cwd(), pkg.dirPath),
105
+ from: pkg.manifest.from,
106
+ to: pkg.manifest.to,
107
+ migrationId: pkg.manifest.migrationId,
108
+ kind: pkg.manifest.kind,
109
+ createdAt: pkg.manifest.createdAt,
110
+ operations: ops.map((op) => ({
111
+ id: op.id,
112
+ label: op.label,
113
+ operationClass: op.operationClass
114
+ })),
115
+ sql,
116
+ summary: `${ops.length} operation(s)`
117
+ });
118
+ }
119
+ function createMigrationShowCommand() {
120
+ const command = new Command("show");
121
+ setCommandDescriptions(command, "Display migration package contents", "Shows the operations, DDL preview, and metadata for a migration package.\nAccepts a directory path, a hash prefix (git-style), or defaults to the\nlatest migration.");
122
+ setCommandExamples(command, ["prisma-next migration show", "prisma-next migration show sha256:a1b2c3"]);
123
+ addGlobalOptions(command).argument("[target]", "Migration directory path or migrationId hash prefix (defaults to latest)").option("--config <path>", "Path to prisma-next.config.ts").action(async (target, options) => {
124
+ const flags = parseGlobalFlags(options);
125
+ const ui = new TerminalUI({
126
+ color: flags.color,
127
+ interactive: flags.interactive
128
+ });
129
+ const exitCode = handleResult(await executeMigrationShowCommand(target, options, flags, ui), flags, ui, (showResult) => {
130
+ if (flags.json) ui.output(JSON.stringify(showResult, null, 2));
131
+ else if (!flags.quiet) ui.log(formatMigrationShowOutput(showResult, flags));
132
+ });
133
+ process.exit(exitCode);
134
+ });
135
+ return command;
136
+ }
137
+
138
+ //#endregion
139
+ export { createMigrationShowCommand, resolveByHashPrefix };
140
+ //# sourceMappingURL=migration-show.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-show.mjs","names":["details: Array<{ label: string; value: string }>","pkg: MigrationBundle"],"sources":["../../src/commands/migration-show.ts"],"sourcesContent":["import type { MigrationPlanOperation } from '@prisma-next/framework-components/control';\nimport { findLatestMigration, reconstructGraph } from '@prisma-next/migration-tools/dag';\nimport { readMigrationPackage, readMigrationsDir } from '@prisma-next/migration-tools/io';\nimport type { MigrationBundle } from '@prisma-next/migration-tools/types';\nimport { isAttested, MigrationToolsError } from '@prisma-next/migration-tools/types';\nimport { notOk, ok, type Result } from '@prisma-next/utils/result';\nimport { Command } from 'commander';\nimport { relative, resolve } from 'pathe';\nimport { loadConfig } from '../config-loader';\nimport { extractOperationStatements } from '../control-api/operations/extract-operation-statements';\nimport { type CliStructuredError, errorRuntime, errorUnexpected } from '../utils/cli-errors';\nimport {\n addGlobalOptions,\n setCommandDescriptions,\n setCommandExamples,\n} from '../utils/command-helpers';\nimport { formatMigrationShowOutput } from '../utils/formatters/migrations';\nimport { formatStyledHeader } from '../utils/formatters/styled';\nimport type { CommonCommandOptions } from '../utils/global-flags';\nimport { type GlobalFlags, parseGlobalFlags } from '../utils/global-flags';\nimport { handleResult } from '../utils/result-handler';\nimport { TerminalUI } from '../utils/terminal-ui';\n\ninterface MigrationShowOptions extends CommonCommandOptions {\n readonly config?: string;\n}\n\nexport interface MigrationShowResult {\n readonly ok: true;\n readonly dirName: string;\n readonly dirPath: string;\n readonly from: string;\n readonly to: string;\n readonly migrationId: string | null;\n readonly kind: string;\n readonly createdAt: string;\n readonly operations: readonly {\n readonly id: string;\n readonly label: string;\n readonly operationClass: string;\n }[];\n readonly sql: readonly string[];\n readonly summary: string;\n}\n\nfunction looksLikePath(target: string): boolean {\n return target.includes('/') || target.includes('\\\\');\n}\n\nexport function resolveByHashPrefix(\n packages: readonly MigrationBundle[],\n prefix: string,\n): Result<MigrationBundle, CliStructuredError> {\n const normalizedPrefix = prefix.startsWith('sha256:') ? prefix : `sha256:${prefix}`;\n const attested = packages.filter((p) => typeof p.manifest.migrationId === 'string');\n const matches = attested.filter((p) => p.manifest.migrationId!.startsWith(normalizedPrefix));\n\n if (matches.length === 1) {\n return ok(matches[0]!);\n }\n\n if (matches.length === 0) {\n return notOk(\n errorRuntime('No migration found matching prefix', {\n why: `No attested migration has a migrationId starting with \"${normalizedPrefix}\"`,\n fix: 'Run `prisma-next migration show` (no argument) to see the latest migration, or check the migrations directory for available packages.',\n }),\n );\n }\n\n const candidates = matches.map((p) => ` ${p.dirName} ${p.manifest.migrationId}`).join('\\n');\n return notOk(\n errorRuntime('Ambiguous hash prefix', {\n why: `Multiple migrations match prefix \"${normalizedPrefix}\":\\n${candidates}`,\n fix: 'Provide a longer prefix to uniquely identify the migration.',\n }),\n );\n}\n\nasync function executeMigrationShowCommand(\n target: string | undefined,\n options: MigrationShowOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n): Promise<Result<MigrationShowResult, CliStructuredError>> {\n const config = await loadConfig(options.config);\n const configPath = options.config\n ? relative(process.cwd(), resolve(options.config))\n : 'prisma-next.config.ts';\n\n const migrationsDir = resolve(\n options.config ? resolve(options.config, '..') : process.cwd(),\n config.migrations?.dir ?? 'migrations',\n );\n const migrationsRelative = relative(process.cwd(), migrationsDir);\n\n if (!flags.json && !flags.quiet) {\n const details: Array<{ label: string; value: string }> = [\n { label: 'config', value: configPath },\n { label: 'migrations', value: migrationsRelative },\n ];\n if (target) {\n details.push({ label: 'target', value: target });\n }\n const header = formatStyledHeader({\n command: 'migration show',\n description: 'Display migration package contents',\n details,\n flags,\n });\n ui.stderr(header);\n }\n\n let pkg: MigrationBundle;\n\n try {\n if (target && looksLikePath(target)) {\n pkg = await readMigrationPackage(resolve(target));\n } else {\n const allPackages = await readMigrationsDir(migrationsDir);\n if (allPackages.length === 0) {\n return notOk(\n errorRuntime('No migrations found', {\n why: `No migration packages found in ${migrationsRelative}`,\n fix: 'Run `prisma-next migration plan` to create a migration first.',\n }),\n );\n }\n\n if (target) {\n const resolved = resolveByHashPrefix(allPackages, target);\n if (!resolved.ok) return resolved;\n pkg = resolved.value;\n } else {\n const attested = allPackages.filter(isAttested);\n if (attested.length === 0) {\n return notOk(\n errorRuntime('No attested migrations found', {\n why: `All migrations in ${migrationsRelative} are drafts (migrationId: null)`,\n fix: 'Run `prisma-next migration verify --dir <path>` to attest a draft migration.',\n }),\n );\n }\n const graph = reconstructGraph(attested);\n const latestMigration = findLatestMigration(graph);\n if (!latestMigration) {\n return notOk(\n errorRuntime('Could not resolve latest migration', {\n why: 'No latest migration found in the migration history',\n fix: 'The migrations directory may be corrupted. Inspect the migration.json files.',\n }),\n );\n }\n const leafPkg = attested.find(\n (p) => p.manifest.migrationId === latestMigration.migrationId,\n );\n if (!leafPkg) {\n return notOk(\n errorRuntime('Could not resolve latest migration', {\n why: `Latest migration ${latestMigration.dirName} does not match any package`,\n fix: 'The migrations directory may be corrupted. Inspect the migration.json files.',\n }),\n );\n }\n pkg = leafPkg;\n }\n }\n } catch (error) {\n if (MigrationToolsError.is(error)) {\n return notOk(\n errorRuntime(error.message, {\n why: error.why,\n fix: error.fix,\n meta: { code: error.code, ...(error.details ?? {}) },\n }),\n );\n }\n return notOk(\n errorUnexpected(error instanceof Error ? error.message : String(error), {\n why: `Failed to read migration: ${error instanceof Error ? error.message : String(error)}`,\n }),\n );\n }\n\n const ops = pkg.ops as readonly MigrationPlanOperation[];\n const sql = extractOperationStatements(config.family.familyId, ops) ?? [];\n\n const result: MigrationShowResult = {\n ok: true,\n dirName: pkg.dirName,\n dirPath: relative(process.cwd(), pkg.dirPath),\n from: pkg.manifest.from,\n to: pkg.manifest.to,\n migrationId: pkg.manifest.migrationId,\n kind: pkg.manifest.kind,\n createdAt: pkg.manifest.createdAt,\n operations: ops.map((op) => ({\n id: op.id,\n label: op.label,\n operationClass: op.operationClass,\n })),\n sql,\n summary: `${ops.length} operation(s)`,\n };\n return ok(result);\n}\n\nexport function createMigrationShowCommand(): Command {\n const command = new Command('show');\n setCommandDescriptions(\n command,\n 'Display migration package contents',\n 'Shows the operations, DDL preview, and metadata for a migration package.\\n' +\n 'Accepts a directory path, a hash prefix (git-style), or defaults to the\\n' +\n 'latest migration.',\n );\n setCommandExamples(command, [\n 'prisma-next migration show',\n 'prisma-next migration show sha256:a1b2c3',\n ]);\n addGlobalOptions(command)\n .argument(\n '[target]',\n 'Migration directory path or migrationId hash prefix (defaults to latest)',\n )\n .option('--config <path>', 'Path to prisma-next.config.ts')\n .action(async (target: string | undefined, options: MigrationShowOptions) => {\n const flags = parseGlobalFlags(options);\n\n const ui = new TerminalUI({ color: flags.color, interactive: flags.interactive });\n\n const result = await executeMigrationShowCommand(target, options, flags, ui);\n\n const exitCode = handleResult(result, flags, ui, (showResult) => {\n if (flags.json) {\n ui.output(JSON.stringify(showResult, null, 2));\n } else if (!flags.quiet) {\n ui.log(formatMigrationShowOutput(showResult, flags));\n }\n });\n\n process.exit(exitCode);\n });\n\n return command;\n}\n"],"mappings":"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"}
@@ -0,0 +1,86 @@
1
+ import { Command } from "commander";
2
+ import { AttestedMigrationBundle, DraftMigrationBundle, MigrationGraph } from "@prisma-next/migration-tools/types";
3
+
4
+ //#region src/utils/migration-types.d.ts
5
+ interface StatusRef {
6
+ readonly name: string;
7
+ readonly hash: string;
8
+ readonly active: boolean;
9
+ }
10
+ interface StatusDiagnostic {
11
+ readonly code: string;
12
+ readonly severity: 'warn' | 'info';
13
+ readonly message: string;
14
+ readonly hints: readonly string[];
15
+ }
16
+ //#endregion
17
+ //#region src/utils/formatters/graph-migration-mapper.d.ts
18
+ type EdgeStatusKind = 'applied' | 'pending' | 'unreachable';
19
+ /** Minimal per-edge status from the CLI's status result. */
20
+ interface EdgeStatus {
21
+ readonly dirName: string;
22
+ readonly status: EdgeStatusKind;
23
+ }
24
+ //#endregion
25
+ //#region src/commands/migration-status.d.ts
26
+ interface MigrationStatusEntry {
27
+ readonly dirName: string;
28
+ readonly from: string;
29
+ readonly to: string;
30
+ readonly migrationId: string | null;
31
+ readonly operationCount: number;
32
+ readonly operationSummary: string;
33
+ readonly hasDestructive: boolean;
34
+ readonly status: EdgeStatusKind | 'unknown';
35
+ }
36
+ interface MigrationStatusResult {
37
+ readonly ok: true;
38
+ readonly mode: 'online' | 'offline';
39
+ readonly migrations: readonly MigrationStatusEntry[];
40
+ readonly markerHash?: string;
41
+ readonly targetHash: string;
42
+ readonly contractHash: string;
43
+ readonly refs?: readonly StatusRef[];
44
+ readonly pathDecision?: {
45
+ readonly fromHash: string;
46
+ readonly toHash: string;
47
+ readonly alternativeCount: number;
48
+ readonly tieBreakReasons: readonly string[];
49
+ readonly refName?: string;
50
+ readonly selectedPath: readonly {
51
+ readonly dirName: string;
52
+ readonly migrationId: string | null;
53
+ readonly from: string;
54
+ readonly to: string;
55
+ }[];
56
+ };
57
+ readonly summary: string;
58
+ readonly diagnostics: readonly StatusDiagnostic[];
59
+ readonly graph?: MigrationGraph;
60
+ readonly bundles?: readonly AttestedMigrationBundle[];
61
+ readonly drafts?: readonly DraftMigrationBundle[];
62
+ readonly edgeStatuses?: readonly EdgeStatus[];
63
+ readonly activeRefHash?: string;
64
+ readonly activeRefName?: string;
65
+ readonly diverged?: boolean;
66
+ }
67
+ /**
68
+ * Derive per-edge status across the full graph using path analysis.
69
+ *
70
+ * - **applied**: edge is on the path from root to the DB marker
71
+ * - **pending**: edge is on the path from the DB marker to the target
72
+ * (and the marker is reachable from root, i.e. it's on the same branch)
73
+ * - **unreachable**: edge is on the path from root to the target but the DB
74
+ * marker is on a different branch — `apply` can't reach these edges
75
+ * without the DB first moving to this branch
76
+ *
77
+ * Returns statuses only for edges that have a known status (skips offline
78
+ * and edges not on any relevant path).
79
+ *
80
+ * @internal Exported for testing only.
81
+ */
82
+ declare function deriveEdgeStatuses(graph: MigrationGraph, targetHash: string, contractHash: string, markerHash: string | undefined, mode: 'online' | 'offline'): EdgeStatus[];
83
+ declare function createMigrationStatusCommand(): Command;
84
+ //#endregion
85
+ export { MigrationStatusEntry, MigrationStatusResult, type StatusDiagnostic, type StatusRef, createMigrationStatusCommand, deriveEdgeStatuses };
86
+ //# sourceMappingURL=migration-status.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-status.d.mts","names":[],"sources":["../../src/utils/migration-types.ts","../../src/utils/formatters/graph-migration-mapper.ts","../../src/commands/migration-status.ts"],"sourcesContent":[],"mappings":";;;;UAAiB,SAAA;;;;AAAjB;AAMiB,UAAA,gBAAA,CAAgB;;;;ECWrB,SAAA,KAAA,EAAA,SAAc,MAAA,EAAA;AAmB1B;;;KAnBY,cAAA;ADjBZ;AAMiB,UC8BA,UAAA,CD9BgB;;mBCgCd;;;;ADtCF,UE4DA,oBAAA,CF5DS;EAMT,SAAA,OAAA,EAAA,MAAgB;;;;ECWrB,SAAA,cAAc,EAAA,MAAA;EAmBT,SAAA,gBAEE,EAAA,MAAA;;mBC8BA;;AAKF,UAAA,qBAAA,CAAqB;EAGN,SAAA,EAAA,EAAA,IAAA;EAIL,SAAA,IAAA,EAAA,QAAA,GAAA,SAAA;EAeM,SAAA,UAAA,EAAA,SAnBD,oBAmBC,EAAA;EACd,SAAA,UAAA,CAAA,EAAA,MAAA;EACW,SAAA,UAAA,EAAA,MAAA;EACD,SAAA,YAAA,EAAA,MAAA;EACM,SAAA,IAAA,CAAA,EAAA,SAnBR,SAmBQ,EAAA;EAAU,SAAA,YAAA,CAAA,EAAA;IAkD7B,SAAA,QAAkB,EAAA,MAAA;IAwjBlB,SAAA,MAAA,EAAA,MAAA;;;;;;;;;;;;iCA9mBiB;mBACd;8BACW;6BACD;mCACM;;;;;;;;;;;;;;;;;;;;iBAkDnB,kBAAA,QACP,uHAKN;iBAkjBa,4BAAA,CAAA,GAAgC"}
@@ -0,0 +1,4 @@
1
+ import "../config-loader-C4VXKl8f.mjs";
2
+ import { n as deriveEdgeStatuses, t as createMigrationStatusCommand } from "../migration-status-CJANY4yr.mjs";
3
+
4
+ export { createMigrationStatusCommand, deriveEdgeStatuses };
@@ -0,0 +1,16 @@
1
+ import { Command } from "commander";
2
+
3
+ //#region src/commands/migration-verify.d.ts
4
+ interface MigrationVerifyResult {
5
+ readonly ok: boolean;
6
+ readonly status: 'verified' | 'attested';
7
+ readonly dir: string;
8
+ readonly migrationId?: string;
9
+ readonly storedMigrationId?: string;
10
+ readonly computedMigrationId?: string;
11
+ readonly summary: string;
12
+ }
13
+ declare function createMigrationVerifyCommand(): Command;
14
+ //#endregion
15
+ export { MigrationVerifyResult, createMigrationVerifyCommand };
16
+ //# sourceMappingURL=migration-verify.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-verify.d.mts","names":[],"sources":["../../src/commands/migration-verify.ts"],"sourcesContent":[],"mappings":";;;UAkCiB,qBAAA;;EAAA,SAAA,MAAA,EAAA,UAAqB,GAAA,UAAA;EAkHtB,SAAA,GAAA,EAAA,MAAA;;;;;;iBAAA,4BAAA,CAAA,GAAgC"}
@@ -0,0 +1,110 @@
1
+ import { t as loadConfig } from "../config-loader-C4VXKl8f.mjs";
2
+ import { _ as errorUnexpected, h as errorTargetMigrationNotSupported, m as errorRuntime, t as CliStructuredError } from "../cli-errors-BDCYR5ap.mjs";
3
+ import { t as assertFrameworkComponentsCompatible } from "../framework-components-BAsliT4V.mjs";
4
+ import { _ as formatStyledHeader, d as setCommandExamples, m as parseGlobalFlags, n as addGlobalOptions, r as getTargetMigrations, t as handleResult, u as setCommandDescriptions } from "../result-handler-oK_vA-Fn.mjs";
5
+ import { t as TerminalUI } from "../terminal-ui-C5k88MmW.mjs";
6
+ import { o as formatMigrationVerifyCommandOutput } from "../migrations-DTZBYXm1.mjs";
7
+ import { Command } from "commander";
8
+ import { notOk, ok } from "@prisma-next/utils/result";
9
+ import { ifDefined } from "@prisma-next/utils/defined";
10
+ import { readMigrationPackage, writeMigrationOps } from "@prisma-next/migration-tools/io";
11
+ import { MigrationToolsError } from "@prisma-next/migration-tools/types";
12
+ import { evaluateMigrationTs, hasMigrationTs } from "@prisma-next/migration-tools/migration-ts";
13
+ import { attestMigration, verifyMigration } from "@prisma-next/migration-tools/attestation";
14
+
15
+ //#region src/commands/migration-verify.ts
16
+ async function executeMigrationVerifyCommand(options, flags, ui) {
17
+ const dir = options.dir;
18
+ if (!flags.json && !flags.quiet) {
19
+ const header = formatStyledHeader({
20
+ command: "migration verify",
21
+ description: "Verify migration package integrity",
22
+ details: [{
23
+ label: "dir",
24
+ value: dir
25
+ }],
26
+ flags
27
+ });
28
+ ui.stderr(header);
29
+ }
30
+ try {
31
+ if (await hasMigrationTs(dir)) {
32
+ const pkg = await readMigrationPackage(dir);
33
+ const descriptors = await evaluateMigrationTs(dir);
34
+ const config = await loadConfig(options.config);
35
+ const migrations = getTargetMigrations(config.target);
36
+ if (!migrations?.resolveDescriptors) throw errorTargetMigrationNotSupported({ why: `Target "${config.target.targetId}" does not implement resolveDescriptors; cannot verify a migration package that uses migration.ts` });
37
+ const frameworkComponents = assertFrameworkComponentsCompatible(config.family.familyId, config.target.targetId, [
38
+ config.target,
39
+ config.adapter,
40
+ ...config.extensionPacks ?? []
41
+ ]);
42
+ await writeMigrationOps(dir, migrations.resolveDescriptors(descriptors, {
43
+ fromContract: pkg.manifest.fromContract,
44
+ toContract: pkg.manifest.toContract,
45
+ frameworkComponents
46
+ }));
47
+ }
48
+ const result = await verifyMigration(dir);
49
+ if (result.ok) return ok({
50
+ ok: true,
51
+ status: "verified",
52
+ dir,
53
+ ...ifDefined("migrationId", result.storedMigrationId),
54
+ ...ifDefined("storedMigrationId", result.storedMigrationId),
55
+ ...ifDefined("computedMigrationId", result.computedMigrationId),
56
+ summary: "Migration package verified — migrationId matches"
57
+ });
58
+ if (result.reason === "draft") {
59
+ const migrationId$1 = await attestMigration(dir);
60
+ return ok({
61
+ ok: true,
62
+ status: "attested",
63
+ dir,
64
+ migrationId: migrationId$1,
65
+ summary: `Draft migration attested with migrationId: ${migrationId$1}`
66
+ });
67
+ }
68
+ const migrationId = await attestMigration(dir);
69
+ return ok({
70
+ ok: true,
71
+ status: "attested",
72
+ dir,
73
+ migrationId,
74
+ summary: `Migration re-attested with migrationId: ${migrationId}`
75
+ });
76
+ } catch (error) {
77
+ if (CliStructuredError.is(error)) return notOk(error);
78
+ if (MigrationToolsError.is(error)) return notOk(errorRuntime(error.message, {
79
+ why: error.why,
80
+ fix: error.fix,
81
+ meta: {
82
+ code: error.code,
83
+ ...error.details ?? {}
84
+ }
85
+ }));
86
+ return notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to verify migration: ${error instanceof Error ? error.message : String(error)}` }));
87
+ }
88
+ }
89
+ function createMigrationVerifyCommand() {
90
+ const command = new Command("verify");
91
+ setCommandDescriptions(command, "Verify a migration package migrationId", "Recomputes the content-addressed migrationId for a migration package and compares\nit against the stored value. Draft migrations (migrationId: null) are automatically\nattested. If migration.ts exists, it is always re-evaluated and ops.json is refreshed.");
92
+ setCommandExamples(command, ["prisma-next migration verify --dir migrations/20250101-add-users"]);
93
+ addGlobalOptions(command).requiredOption("--dir <path>", "Path to the migration package directory").option("--config <path>", "Path to prisma-next.config.ts (required when migration.ts exists)").action(async (options) => {
94
+ const flags = parseGlobalFlags(options);
95
+ const ui = new TerminalUI({
96
+ color: flags.color,
97
+ interactive: flags.interactive
98
+ });
99
+ const exitCode = handleResult(await executeMigrationVerifyCommand(options, flags, ui), flags, ui, (verifyResult) => {
100
+ if (flags.json) ui.output(JSON.stringify(verifyResult, null, 2));
101
+ else if (!flags.quiet) ui.log(formatMigrationVerifyCommandOutput(verifyResult, flags));
102
+ });
103
+ process.exit(exitCode);
104
+ });
105
+ return command;
106
+ }
107
+
108
+ //#endregion
109
+ export { createMigrationVerifyCommand };
110
+ //# sourceMappingURL=migration-verify.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-verify.mjs","names":["migrationId"],"sources":["../../src/commands/migration-verify.ts"],"sourcesContent":["import type { OperationDescriptor } from '@prisma-next/framework-components/control';\nimport { attestMigration, verifyMigration } from '@prisma-next/migration-tools/attestation';\nimport { readMigrationPackage, writeMigrationOps } from '@prisma-next/migration-tools/io';\nimport { evaluateMigrationTs, hasMigrationTs } from '@prisma-next/migration-tools/migration-ts';\nimport { MigrationToolsError } from '@prisma-next/migration-tools/types';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { notOk, ok, type Result } from '@prisma-next/utils/result';\nimport { Command } from 'commander';\nimport { loadConfig } from '../config-loader';\nimport {\n CliStructuredError,\n errorRuntime,\n errorTargetMigrationNotSupported,\n errorUnexpected,\n} from '../utils/cli-errors';\nimport {\n addGlobalOptions,\n getTargetMigrations,\n setCommandDescriptions,\n setCommandExamples,\n} from '../utils/command-helpers';\nimport { formatMigrationVerifyCommandOutput } from '../utils/formatters/migrations';\nimport { formatStyledHeader } from '../utils/formatters/styled';\nimport { assertFrameworkComponentsCompatible } from '../utils/framework-components';\nimport type { CommonCommandOptions } from '../utils/global-flags';\nimport { type GlobalFlags, parseGlobalFlags } from '../utils/global-flags';\nimport { handleResult } from '../utils/result-handler';\nimport { TerminalUI } from '../utils/terminal-ui';\n\ninterface MigrationVerifyOptions extends CommonCommandOptions {\n readonly dir: string;\n readonly config?: string;\n}\n\nexport interface MigrationVerifyResult {\n readonly ok: boolean;\n readonly status: 'verified' | 'attested';\n readonly dir: string;\n readonly migrationId?: string;\n readonly storedMigrationId?: string;\n readonly computedMigrationId?: string;\n readonly summary: string;\n}\n\nasync function executeMigrationVerifyCommand(\n options: MigrationVerifyOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n): Promise<Result<MigrationVerifyResult, CliStructuredError>> {\n const dir = options.dir;\n\n if (!flags.json && !flags.quiet) {\n const header = formatStyledHeader({\n command: 'migration verify',\n description: 'Verify migration package integrity',\n details: [{ label: 'dir', value: dir }],\n flags,\n });\n ui.stderr(header);\n }\n\n try {\n // If migration.ts exists, always evaluate and resolve to ops.json.\n // This ensures ops.json is always fresh relative to migration.ts.\n if (await hasMigrationTs(dir)) {\n const pkg = await readMigrationPackage(dir);\n const descriptors = await evaluateMigrationTs(dir);\n\n const config = await loadConfig(options.config);\n const migrations = getTargetMigrations(config.target);\n if (!migrations?.resolveDescriptors) {\n throw errorTargetMigrationNotSupported({\n why: `Target \"${config.target.targetId}\" does not implement resolveDescriptors; cannot verify a migration package that uses migration.ts`,\n });\n }\n\n const frameworkComponents = assertFrameworkComponentsCompatible(\n config.family.familyId,\n config.target.targetId,\n [config.target, config.adapter, ...(config.extensionPacks ?? [])],\n );\n\n const resolvedOps = migrations.resolveDescriptors(descriptors as OperationDescriptor[], {\n fromContract: pkg.manifest.fromContract,\n toContract: pkg.manifest.toContract,\n frameworkComponents,\n });\n\n await writeMigrationOps(dir, resolvedOps);\n }\n\n // Now verify/attest with the (potentially updated) ops.json\n const result = await verifyMigration(dir);\n\n if (result.ok) {\n return ok({\n ok: true,\n status: 'verified',\n dir,\n ...ifDefined('migrationId', result.storedMigrationId),\n ...ifDefined('storedMigrationId', result.storedMigrationId),\n ...ifDefined('computedMigrationId', result.computedMigrationId),\n summary: 'Migration package verified — migrationId matches',\n });\n }\n\n if (result.reason === 'draft') {\n const migrationId = await attestMigration(dir);\n return ok({\n ok: true,\n status: 'attested',\n dir,\n migrationId,\n summary: `Draft migration attested with migrationId: ${migrationId}`,\n });\n }\n\n // Mismatch — ops.json was just rewritten by migration.ts evaluation above,\n // so this means the stored migrationId is stale. Re-attest.\n const migrationId = await attestMigration(dir);\n return ok({\n ok: true,\n status: 'attested',\n dir,\n migrationId,\n summary: `Migration re-attested with migrationId: ${migrationId}`,\n });\n } catch (error) {\n if (CliStructuredError.is(error)) {\n return notOk(error);\n }\n if (MigrationToolsError.is(error)) {\n return notOk(\n errorRuntime(error.message, {\n why: error.why,\n fix: error.fix,\n meta: { code: error.code, ...(error.details ?? {}) },\n }),\n );\n }\n return notOk(\n errorUnexpected(error instanceof Error ? error.message : String(error), {\n why: `Failed to verify migration: ${error instanceof Error ? error.message : String(error)}`,\n }),\n );\n }\n}\n\nexport function createMigrationVerifyCommand(): Command {\n const command = new Command('verify');\n setCommandDescriptions(\n command,\n 'Verify a migration package migrationId',\n 'Recomputes the content-addressed migrationId for a migration package and compares\\n' +\n 'it against the stored value. Draft migrations (migrationId: null) are automatically\\n' +\n 'attested. If migration.ts exists, it is always re-evaluated and ops.json is refreshed.',\n );\n setCommandExamples(command, ['prisma-next migration verify --dir migrations/20250101-add-users']);\n addGlobalOptions(command)\n .requiredOption('--dir <path>', 'Path to the migration package directory')\n .option('--config <path>', 'Path to prisma-next.config.ts (required when migration.ts exists)')\n .action(async (options: MigrationVerifyOptions) => {\n const flags = parseGlobalFlags(options);\n const ui = new TerminalUI({ color: flags.color, interactive: flags.interactive });\n\n const result = await executeMigrationVerifyCommand(options, flags, ui);\n\n const exitCode = handleResult(result, flags, ui, (verifyResult) => {\n if (flags.json) {\n ui.output(JSON.stringify(verifyResult, null, 2));\n } else if (!flags.quiet) {\n ui.log(formatMigrationVerifyCommandOutput(verifyResult, flags));\n }\n });\n\n process.exit(exitCode);\n });\n\n return command;\n}\n"],"mappings":"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"}
@@ -0,0 +1,43 @@
1
+ import { errorConfigFileNotFound, errorConfigValidation, errorUnexpected } from "@prisma-next/errors/control";
2
+ import { dirname, resolve } from "node:path";
3
+ import { ConfigValidationError, validateConfig } from "@prisma-next/config/config-validation";
4
+ import { loadConfig } from "c12";
5
+
6
+ //#region src/config-loader.ts
7
+ /**
8
+ * Loads the Prisma Next config from a TypeScript file.
9
+ * Supports both default export and named export.
10
+ * Uses c12 to automatically handle TypeScript compilation and config file discovery.
11
+ *
12
+ * @param configPath - Optional path to config file. Defaults to `./prisma-next.config.ts` in current directory.
13
+ * @returns The loaded config object.
14
+ * @throws Error if config file doesn't exist or is invalid.
15
+ */
16
+ async function loadConfig$1(configPath) {
17
+ try {
18
+ const cwd = process.cwd();
19
+ const resolvedConfigPath = configPath ? resolve(cwd, configPath) : void 0;
20
+ const configCwd = resolvedConfigPath ? dirname(resolvedConfigPath) : cwd;
21
+ const result = await loadConfig({
22
+ name: "prisma-next",
23
+ ...resolvedConfigPath ? { configFile: resolvedConfigPath } : {},
24
+ cwd: configCwd
25
+ });
26
+ if (resolvedConfigPath && result.configFile !== resolvedConfigPath) throw errorConfigFileNotFound(resolvedConfigPath);
27
+ if (!result.config || Object.keys(result.config).length === 0) throw errorConfigFileNotFound(result.configFile || resolvedConfigPath || configPath);
28
+ validateConfig(result.config);
29
+ return result.config;
30
+ } catch (error) {
31
+ if (error instanceof ConfigValidationError) throw errorConfigValidation(error.field, { why: error.why });
32
+ if (error instanceof Error && "code" in error && typeof error.code === "string") throw error;
33
+ if (error instanceof Error) {
34
+ if (error.message.includes("not found") || error.message.includes("Cannot find") || error.message.includes("ENOENT")) throw errorConfigFileNotFound(configPath ? resolve(process.cwd(), configPath) : void 0, { why: error.message });
35
+ throw errorUnexpected(error.message, { why: `Failed to load config: ${error.message}` });
36
+ }
37
+ throw errorUnexpected(String(error));
38
+ }
39
+ }
40
+
41
+ //#endregion
42
+ export { loadConfig$1 as t };
43
+ //# sourceMappingURL=config-loader-C4VXKl8f.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-loader-C4VXKl8f.mjs","names":["loadConfig","loadConfigC12"],"sources":["../src/config-loader.ts"],"sourcesContent":["import { dirname, resolve } from 'node:path';\nimport type { PrismaNextConfig } from '@prisma-next/config/config-types';\nimport { ConfigValidationError, validateConfig } from '@prisma-next/config/config-validation';\nimport {\n errorConfigFileNotFound,\n errorConfigValidation,\n errorUnexpected,\n} from '@prisma-next/errors/control';\nimport { loadConfig as loadConfigC12 } from 'c12';\n\n/**\n * Loads the Prisma Next config from a TypeScript file.\n * Supports both default export and named export.\n * Uses c12 to automatically handle TypeScript compilation and config file discovery.\n *\n * @param configPath - Optional path to config file. Defaults to `./prisma-next.config.ts` in current directory.\n * @returns The loaded config object.\n * @throws Error if config file doesn't exist or is invalid.\n */\nexport async function loadConfig(configPath?: string): Promise<PrismaNextConfig> {\n try {\n const cwd = process.cwd();\n // Resolve config path to absolute path and set cwd to config directory when path is provided\n const resolvedConfigPath = configPath ? resolve(cwd, configPath) : undefined;\n const configCwd = resolvedConfigPath ? dirname(resolvedConfigPath) : cwd;\n\n const result = await loadConfigC12<PrismaNextConfig>({\n name: 'prisma-next',\n ...(resolvedConfigPath ? { configFile: resolvedConfigPath } : {}),\n cwd: configCwd,\n });\n\n // When a specific config file was requested, verify it was actually loaded\n // (c12 falls back to searching by name if the specified file doesn't exist)\n if (resolvedConfigPath && result.configFile !== resolvedConfigPath) {\n throw errorConfigFileNotFound(resolvedConfigPath);\n }\n\n // Check if config is missing or empty (c12 may return empty object when file doesn't exist)\n if (!result.config || Object.keys(result.config).length === 0) {\n // Use c12's configFile if available, otherwise use explicit configPath, otherwise omit path\n const displayPath = result.configFile || resolvedConfigPath || configPath;\n throw errorConfigFileNotFound(displayPath);\n }\n\n // Validate config structure\n validateConfig(result.config);\n\n return result.config;\n } catch (error) {\n if (error instanceof ConfigValidationError) {\n throw errorConfigValidation(error.field, {\n why: error.why,\n });\n }\n\n // Re-throw structured errors as-is\n if (\n error instanceof Error &&\n 'code' in error &&\n typeof (error as { code: string }).code === 'string'\n ) {\n throw error;\n }\n\n if (error instanceof Error) {\n // Check for file not found errors\n if (\n error.message.includes('not found') ||\n error.message.includes('Cannot find') ||\n error.message.includes('ENOENT')\n ) {\n // Use resolved path if available, otherwise use original configPath\n const displayPath = configPath ? resolve(process.cwd(), configPath) : undefined;\n throw errorConfigFileNotFound(displayPath, {\n why: error.message,\n });\n }\n // For other errors, wrap in unexpected error\n throw errorUnexpected(error.message, {\n why: `Failed to load config: ${error.message}`,\n });\n }\n throw errorUnexpected(String(error));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAmBA,eAAsBA,aAAW,YAAgD;AAC/E,KAAI;EACF,MAAM,MAAM,QAAQ,KAAK;EAEzB,MAAM,qBAAqB,aAAa,QAAQ,KAAK,WAAW,GAAG;EACnE,MAAM,YAAY,qBAAqB,QAAQ,mBAAmB,GAAG;EAErE,MAAM,SAAS,MAAMC,WAAgC;GACnD,MAAM;GACN,GAAI,qBAAqB,EAAE,YAAY,oBAAoB,GAAG,EAAE;GAChE,KAAK;GACN,CAAC;AAIF,MAAI,sBAAsB,OAAO,eAAe,mBAC9C,OAAM,wBAAwB,mBAAmB;AAInD,MAAI,CAAC,OAAO,UAAU,OAAO,KAAK,OAAO,OAAO,CAAC,WAAW,EAG1D,OAAM,wBADc,OAAO,cAAc,sBAAsB,WACrB;AAI5C,iBAAe,OAAO,OAAO;AAE7B,SAAO,OAAO;UACP,OAAO;AACd,MAAI,iBAAiB,sBACnB,OAAM,sBAAsB,MAAM,OAAO,EACvC,KAAK,MAAM,KACZ,CAAC;AAIJ,MACE,iBAAiB,SACjB,UAAU,SACV,OAAQ,MAA2B,SAAS,SAE5C,OAAM;AAGR,MAAI,iBAAiB,OAAO;AAE1B,OACE,MAAM,QAAQ,SAAS,YAAY,IACnC,MAAM,QAAQ,SAAS,cAAc,IACrC,MAAM,QAAQ,SAAS,SAAS,CAIhC,OAAM,wBADc,aAAa,QAAQ,QAAQ,KAAK,EAAE,WAAW,GAAG,QAC3B,EACzC,KAAK,MAAM,SACZ,CAAC;AAGJ,SAAM,gBAAgB,MAAM,SAAS,EACnC,KAAK,0BAA0B,MAAM,WACtC,CAAC;;AAEJ,QAAM,gBAAgB,OAAO,MAAM,CAAC"}
@@ -1,4 +1,7 @@
1
- import type { PrismaNextConfig } from '@prisma-next/core-control-plane/config-types';
1
+ import { PrismaNextConfig } from "@prisma-next/config/config-types";
2
+
3
+ //#region src/config-loader.d.ts
4
+
2
5
  /**
3
6
  * Loads the Prisma Next config from a TypeScript file.
4
7
  * Supports both default export and named export.
@@ -8,5 +11,7 @@ import type { PrismaNextConfig } from '@prisma-next/core-control-plane/config-ty
8
11
  * @returns The loaded config object.
9
12
  * @throws Error if config file doesn't exist or is invalid.
10
13
  */
11
- export declare function loadConfig(configPath?: string): Promise<PrismaNextConfig>;
12
- //# sourceMappingURL=config-loader.d.ts.map
14
+ declare function loadConfig(configPath?: string): Promise<PrismaNextConfig>;
15
+ //#endregion
16
+ export { loadConfig };
17
+ //# sourceMappingURL=config-loader.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-loader.d.mts","names":[],"sources":["../src/config-loader.ts"],"sourcesContent":[],"mappings":";;;;;;AAmBA;;;;;;;iBAAsB,UAAA,uBAAiC,QAAQ"}
@@ -0,0 +1,3 @@
1
+ import { t as loadConfig } from "./config-loader-C4VXKl8f.mjs";
2
+
3
+ export { loadConfig };