@prisma-next/cli 0.12.0-dev.5 → 0.12.0-dev.51

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 (174) hide show
  1. package/README.md +2 -2
  2. package/dist/cli.mjs +180 -163
  3. package/dist/cli.mjs.map +1 -1
  4. package/dist/{client-KgJorIvG.mjs → client-DC-UlBLy.mjs} +83 -58
  5. package/dist/client-DC-UlBLy.mjs.map +1 -0
  6. package/dist/{command-helpers-Bbw1GbwL.mjs → command-helpers-esJGBD4W.mjs} +317 -23
  7. package/dist/command-helpers-esJGBD4W.mjs.map +1 -0
  8. package/dist/commands/contract-emit.mjs +1 -1
  9. package/dist/commands/contract-infer.mjs +1 -1
  10. package/dist/commands/db-init.mjs +4 -5
  11. package/dist/commands/db-init.mjs.map +1 -1
  12. package/dist/commands/db-schema.mjs +3 -3
  13. package/dist/commands/db-sign.mjs +4 -4
  14. package/dist/commands/db-update.d.mts.map +1 -1
  15. package/dist/commands/db-update.mjs +10 -7
  16. package/dist/commands/db-update.mjs.map +1 -1
  17. package/dist/commands/db-verify.mjs +1 -1
  18. package/dist/commands/migrate.d.mts +2 -2
  19. package/dist/commands/migrate.d.mts.map +1 -1
  20. package/dist/commands/migrate.mjs +6 -8
  21. package/dist/commands/migrate.mjs.map +1 -1
  22. package/dist/commands/migration-check.d.mts +55 -13
  23. package/dist/commands/migration-check.d.mts.map +1 -1
  24. package/dist/commands/migration-check.mjs +3 -2
  25. package/dist/commands/migration-graph.d.mts +17 -8
  26. package/dist/commands/migration-graph.d.mts.map +1 -1
  27. package/dist/commands/migration-graph.mjs +183 -2
  28. package/dist/commands/migration-graph.mjs.map +1 -0
  29. package/dist/commands/migration-list.d.mts +25 -27
  30. package/dist/commands/migration-list.d.mts.map +1 -1
  31. package/dist/commands/migration-list.mjs +2 -190
  32. package/dist/commands/migration-log.d.mts +9 -19
  33. package/dist/commands/migration-log.d.mts.map +1 -1
  34. package/dist/commands/migration-log.mjs +1 -137
  35. package/dist/commands/migration-new.mjs +3 -3
  36. package/dist/commands/migration-plan.d.mts +1 -1
  37. package/dist/commands/migration-plan.mjs +1 -1
  38. package/dist/commands/migration-show.d.mts +17 -21
  39. package/dist/commands/migration-show.d.mts.map +1 -1
  40. package/dist/commands/migration-show.mjs +23 -35
  41. package/dist/commands/migration-show.mjs.map +1 -1
  42. package/dist/commands/migration-status.d.mts +42 -144
  43. package/dist/commands/migration-status.d.mts.map +1 -1
  44. package/dist/commands/migration-status.mjs +3 -759
  45. package/dist/commands/ref.d.mts +1 -1
  46. package/dist/commands/ref.mjs +3 -3
  47. package/dist/commands/telemetry/index.d.mts +7 -0
  48. package/dist/commands/telemetry/index.d.mts.map +1 -0
  49. package/dist/commands/telemetry/index.mjs +2 -0
  50. package/dist/{contract-at-errors-BxP-TOMl.mjs → contract-at-errors-COZAemUl.mjs} +2 -2
  51. package/dist/{contract-at-errors-BxP-TOMl.mjs.map → contract-at-errors-COZAemUl.mjs.map} +1 -1
  52. package/dist/{contract-emit-DxcGl4Uq.mjs → contract-emit-Bv46RAIO.mjs} +3 -3
  53. package/dist/{contract-emit-DxcGl4Uq.mjs.map → contract-emit-Bv46RAIO.mjs.map} +1 -1
  54. package/dist/{contract-emit-D-4jrNve.mjs → contract-emit-DIWImLqS.mjs} +5 -5
  55. package/dist/{contract-emit-D-4jrNve.mjs.map → contract-emit-DIWImLqS.mjs.map} +1 -1
  56. package/dist/{contract-infer-D8uEbJuu.mjs → contract-infer-DpGN9SAj.mjs} +3 -3
  57. package/dist/{contract-infer-D8uEbJuu.mjs.map → contract-infer-DpGN9SAj.mjs.map} +1 -1
  58. package/dist/{contract-space-aggregate-loader-DvZwdkrr.mjs → contract-space-aggregate-loader-CpNVrBqW.mjs} +63 -5
  59. package/dist/{contract-space-aggregate-loader-DvZwdkrr.mjs.map → contract-space-aggregate-loader-CpNVrBqW.mjs.map} +1 -1
  60. package/dist/{db-verify-v_vUKXTU.mjs → db-verify-Cq16Obsw.mjs} +4 -4
  61. package/dist/{db-verify-v_vUKXTU.mjs.map → db-verify-Cq16Obsw.mjs.map} +1 -1
  62. package/dist/exports/control-api.d.mts +2 -2
  63. package/dist/exports/control-api.d.mts.map +1 -1
  64. package/dist/exports/control-api.mjs +2 -2
  65. package/dist/exports/index.mjs +1 -1
  66. package/dist/exports/init-output.mjs +1 -1
  67. package/dist/{framework-components-fYXjz_in.mjs → framework-components-BO9VO43s.mjs} +2 -2
  68. package/dist/{framework-components-fYXjz_in.mjs.map → framework-components-BO9VO43s.mjs.map} +1 -1
  69. package/dist/{global-flags-DEHjV8_s.d.mts → global-flags-CV5LhrFg.d.mts} +1 -1
  70. package/dist/{global-flags-DEHjV8_s.d.mts.map → global-flags-CV5LhrFg.d.mts.map} +1 -1
  71. package/dist/{init-Cv9UzWL5.mjs → init-C0rjiQ9I.mjs} +5 -58
  72. package/dist/init-C0rjiQ9I.mjs.map +1 -0
  73. package/dist/{inspect-live-schema-C6ohV_oQ.mjs → inspect-live-schema-CRDKTNcf.mjs} +3 -3
  74. package/dist/{inspect-live-schema-C6ohV_oQ.mjs.map → inspect-live-schema-CRDKTNcf.mjs.map} +1 -1
  75. package/dist/migration-check-BxWlQBOs.mjs +573 -0
  76. package/dist/migration-check-BxWlQBOs.mjs.map +1 -0
  77. package/dist/{migration-command-scaffold-CjvwO6at.mjs → migration-command-scaffold-BDd9abqW.mjs} +3 -3
  78. package/dist/{migration-command-scaffold-CjvwO6at.mjs.map → migration-command-scaffold-BDd9abqW.mjs.map} +1 -1
  79. package/dist/migration-graph-space-render-CeNXh_Wy.mjs +1966 -0
  80. package/dist/migration-graph-space-render-CeNXh_Wy.mjs.map +1 -0
  81. package/dist/migration-list-vJWFuXca.mjs +228 -0
  82. package/dist/migration-list-vJWFuXca.mjs.map +1 -0
  83. package/dist/migration-log-6rcHQSI4.mjs +222 -0
  84. package/dist/migration-log-6rcHQSI4.mjs.map +1 -0
  85. package/dist/migration-path-target-UkxkgXnv.mjs +38 -0
  86. package/dist/migration-path-target-UkxkgXnv.mjs.map +1 -0
  87. package/dist/{migration-plan-9DJ7q7_z.mjs → migration-plan-CHu_erQ5.mjs} +5 -6
  88. package/dist/{migration-plan-9DJ7q7_z.mjs.map → migration-plan-CHu_erQ5.mjs.map} +1 -1
  89. package/dist/migration-status-Bjv91dE7.mjs +444 -0
  90. package/dist/migration-status-Bjv91dE7.mjs.map +1 -0
  91. package/dist/{output-B60Gw5fu.mjs → output-BD61elic.mjs} +1 -1
  92. package/dist/{output-B60Gw5fu.mjs.map → output-BD61elic.mjs.map} +1 -1
  93. package/dist/{ref-advancement-DUZqsue6.mjs → ref-advancement-CJY9zOv7.mjs} +1 -1
  94. package/dist/{ref-advancement-DUZqsue6.mjs.map → ref-advancement-CJY9zOv7.mjs.map} +1 -1
  95. package/dist/schemas-BL33A3i-.d.mts +193 -0
  96. package/dist/schemas-BL33A3i-.d.mts.map +1 -0
  97. package/dist/schemas-DJY2O09F.mjs +112 -0
  98. package/dist/schemas-DJY2O09F.mjs.map +1 -0
  99. package/dist/telemetry-CZkgkR_O.mjs +122 -0
  100. package/dist/telemetry-CZkgkR_O.mjs.map +1 -0
  101. package/dist/{terminal-ui-5Y6mrg93.d.mts → terminal-ui-BgLiAOYi.d.mts} +1 -1
  102. package/dist/{terminal-ui-5Y6mrg93.d.mts.map → terminal-ui-BgLiAOYi.d.mts.map} +1 -1
  103. package/dist/{types-Dt_SfqFm.d.mts → types-qV41eEXH.d.mts} +44 -31
  104. package/dist/types-qV41eEXH.d.mts.map +1 -0
  105. package/dist/{verify-DCA9Sldu.mjs → verify-IilvIk_E.mjs} +2 -2
  106. package/dist/{verify-DCA9Sldu.mjs.map → verify-IilvIk_E.mjs.map} +1 -1
  107. package/package.json +22 -19
  108. package/src/cli.ts +5 -0
  109. package/src/commands/db-update.ts +7 -1
  110. package/src/commands/init/index.ts +6 -35
  111. package/src/commands/init/init.ts +1 -14
  112. package/src/commands/init/inputs.ts +0 -75
  113. package/src/commands/json/schemas.ts +195 -0
  114. package/src/commands/migrate.ts +6 -6
  115. package/src/commands/migration-check.ts +469 -134
  116. package/src/commands/migration-graph.ts +162 -91
  117. package/src/commands/migration-list.ts +69 -39
  118. package/src/commands/migration-log.ts +52 -102
  119. package/src/commands/migration-show.ts +31 -66
  120. package/src/commands/migration-status-overlay.ts +61 -0
  121. package/src/commands/migration-status.ts +453 -1067
  122. package/src/commands/telemetry/index.ts +107 -0
  123. package/src/commands/telemetry/status.ts +67 -0
  124. package/src/control-api/client.ts +20 -9
  125. package/src/control-api/operations/contract-emit.ts +2 -2
  126. package/src/control-api/operations/db-init.ts +3 -3
  127. package/src/control-api/operations/{db-apply.ts → db-run.ts} +37 -10
  128. package/src/control-api/operations/db-update.ts +4 -4
  129. package/src/control-api/operations/{migration-apply.ts → migrate.ts} +32 -24
  130. package/src/control-api/operations/{apply.ts → run-migration.ts} +33 -27
  131. package/src/control-api/types.ts +46 -29
  132. package/src/utils/cli-errors.ts +70 -2
  133. package/src/utils/formatters/errors.ts +11 -0
  134. package/src/utils/formatters/migration-graph-lane-colors.ts +194 -0
  135. package/src/utils/formatters/migration-graph-layout.ts +51 -7
  136. package/src/utils/formatters/migration-graph-rows.ts +128 -15
  137. package/src/utils/formatters/migration-graph-space-render.ts +138 -0
  138. package/src/utils/formatters/migration-graph-tree-render.ts +405 -77
  139. package/src/utils/formatters/migration-list-data-column.ts +4 -91
  140. package/src/utils/formatters/migration-list-graph-topology.ts +72 -94
  141. package/src/utils/formatters/migration-list-render.ts +123 -71
  142. package/src/utils/formatters/migration-list-styler.ts +48 -5
  143. package/src/utils/formatters/migration-list-types.ts +5 -21
  144. package/src/utils/formatters/migration-log-table.ts +205 -0
  145. package/src/utils/formatters/migrations.ts +33 -11
  146. package/src/utils/global-flags.ts +35 -0
  147. package/src/utils/integrity-violation-to-check-failure.ts +28 -19
  148. package/src/utils/legend.ts +38 -0
  149. package/src/utils/migration-path-target.ts +60 -0
  150. package/src/utils/telemetry.ts +68 -32
  151. package/dist/client-KgJorIvG.mjs.map +0 -1
  152. package/dist/command-helpers-Bbw1GbwL.mjs.map +0 -1
  153. package/dist/commands/migration-list.mjs.map +0 -1
  154. package/dist/commands/migration-log.mjs.map +0 -1
  155. package/dist/commands/migration-status.mjs.map +0 -1
  156. package/dist/extension-pack-inputs-IDvjRCi3.mjs +0 -62
  157. package/dist/extension-pack-inputs-IDvjRCi3.mjs.map +0 -1
  158. package/dist/graph-render-rFAqZujX.mjs +0 -1081
  159. package/dist/graph-render-rFAqZujX.mjs.map +0 -1
  160. package/dist/init-Cv9UzWL5.mjs.map +0 -1
  161. package/dist/migration-check-BiBJoYYW.mjs +0 -341
  162. package/dist/migration-check-BiBJoYYW.mjs.map +0 -1
  163. package/dist/migration-graph-D7DVUElV.mjs +0 -1232
  164. package/dist/migration-graph-D7DVUElV.mjs.map +0 -1
  165. package/dist/migration-list-styler-BRwF4-gy.mjs +0 -399
  166. package/dist/migration-list-styler-BRwF4-gy.mjs.map +0 -1
  167. package/dist/migration-types-D2FW63pr.d.mts +0 -15
  168. package/dist/migration-types-D2FW63pr.d.mts.map +0 -1
  169. package/dist/migrations-Cv2jxNNK.mjs +0 -228
  170. package/dist/migrations-Cv2jxNNK.mjs.map +0 -1
  171. package/dist/types-Dt_SfqFm.d.mts.map +0 -1
  172. package/src/utils/formatters/graph-migration-mapper.ts +0 -235
  173. package/src/utils/formatters/graph-render.ts +0 -1323
  174. package/src/utils/formatters/graph-types.ts +0 -120
@@ -1,9 +1,7 @@
1
1
  import { existsSync, readFileSync } from 'node:fs';
2
2
  import * as clack from '@clack/prompts';
3
- import { readUserConfig, resolveGating, writeUserConfig } from '@prisma-next/cli-telemetry';
4
3
  import { extname, join, normalize } from 'pathe';
5
4
  import type { GlobalFlags } from '../../utils/global-flags';
6
- import { isCI } from '../../utils/is-ci';
7
5
  import {
8
6
  errorInitAuthoringSchemaPathMismatch,
9
7
  errorInitInvalidFlagValue,
@@ -71,18 +69,6 @@ export interface ResolvedInitInputs {
71
69
  * is added separately via the install step.
72
70
  */
73
71
  readonly removePreviousFacade: string | null;
74
- /**
75
- * Telemetry consent answer recorded during this `init` run, or `null`
76
- * when no prompt was shown. The prompt fires only on the
77
- * canPrompt + !autoAcceptPrompts + no env/CI opt-out +
78
- * `enableTelemetry === undefined` intersection; outside that window
79
- * the field is `null` and the stored preference (if any) stays
80
- * unchanged. The answer has already been persisted to
81
- * `$XDG_CONFIG_HOME/prisma-next/config.json` by
82
- * the time `runInit` sees this value — it's surfaced here purely so
83
- * the post-init summary can mention what the user chose.
84
- */
85
- readonly enableTelemetry: boolean | null;
86
72
  /**
87
73
  * Whether to run `npx skills add prisma/prisma-next#v<version>` at the
88
74
  * project level after install + emit. True by default; `--no-skill`
@@ -106,12 +92,6 @@ const AUTHORING_VALUES: ReadonlyMap<string, AuthoringId> = new Map([
106
92
  ['ts', 'typescript'],
107
93
  ]);
108
94
 
109
- export const TELEMETRY_CONSENT_MESSAGE = [
110
- 'Help us prioritize features by sharing anonymous CLI usage data?',
111
- 'The telemetry implementation is open source and fully transparent.',
112
- '(packages/1-framework/3-tooling/cli-telemetry and apps/telemetry-backend).',
113
- ].join(' ');
114
-
115
95
  /**
116
96
  * Resolves every required input for `runInit`. In interactive mode, missing
117
97
  * inputs are prompted via clack; in non-interactive mode, missing required
@@ -197,11 +177,6 @@ export async function resolveInitInputs(ctx: {
197
177
  autoAcceptPrompts,
198
178
  });
199
179
 
200
- const enableTelemetry = await resolveTelemetryConsent({
201
- canPrompt,
202
- autoAcceptPrompts,
203
- });
204
-
205
180
  // Skill-install gating. `--no-skill` (commander parses
206
181
  // `options.skill === false`) is the only escape hatch; otherwise
207
182
  // project-level install is unconditional. The skill is always
@@ -219,60 +194,10 @@ export async function resolveInitInputs(ctx: {
219
194
  strictProbe: Boolean(options.strictProbe),
220
195
  reinit,
221
196
  removePreviousFacade,
222
- enableTelemetry,
223
197
  installProjectSkill,
224
198
  };
225
199
  }
226
200
 
227
- /**
228
- * The interactive telemetry consent prompt. Shown as the last
229
- * question of the `init` sequence iff:
230
- * 1. `canPrompt === true` (interactive stdin / stdout combo),
231
- * 2. `autoAcceptPrompts === false` (the user did not pass `--yes`),
232
- * 3. neither telemetry env opt-out is active,
233
- * 4. the process is not running in CI,
234
- * 5. the stored `enableTelemetry` value is `undefined` (the user
235
- * has never been asked, or skipped the prompt previously).
236
- *
237
- * Outside that intersection the function returns `null` and leaves the
238
- * stored preference untouched. Inside it, the user's answer is
239
- * persisted via `writeUserConfig({ enableTelemetry })` before this
240
- * function returns; on an affirmative answer `writeUserConfig`
241
- * generates and stores the v4 `installationId` in the same write.
242
- *
243
- * The wording names CLI usage data and points to the open-source
244
- * client/backend paths. Default value is `true` to match precedent
245
- * and to make the consent answer a single keystroke once it's been
246
- * disclosed.
247
- */
248
- async function resolveTelemetryConsent(opts: {
249
- readonly canPrompt: boolean;
250
- readonly autoAcceptPrompts: boolean;
251
- }): Promise<boolean | null> {
252
- if (!opts.canPrompt || opts.autoAcceptPrompts || isCI()) {
253
- return null;
254
- }
255
- const config = readUserConfig();
256
- const gating = resolveGating({ env: process.env, config });
257
- if (!gating.enabled && gating.reason === 'env-override') {
258
- return null;
259
- }
260
- const stored = config.enableTelemetry;
261
- if (stored !== undefined) {
262
- return null;
263
- }
264
- const result = await clack.confirm({
265
- message: TELEMETRY_CONSENT_MESSAGE,
266
- initialValue: true,
267
- output: process.stderr,
268
- });
269
- if (clack.isCancel(result)) {
270
- throw errorInitUserAborted();
271
- }
272
- writeUserConfig({ enableTelemetry: Boolean(result) });
273
- return Boolean(result);
274
- }
275
-
276
201
  async function resolveWriteEnv(opts: {
277
202
  readonly flag: boolean | undefined;
278
203
  readonly canPrompt: boolean;
@@ -0,0 +1,195 @@
1
+ import { type } from 'arktype';
2
+
3
+ export const migrationEntrySchema = type({
4
+ name: 'string',
5
+ hash: 'string',
6
+ fromContract: 'string | null',
7
+ toContract: 'string',
8
+ operationCount: 'number',
9
+ createdAt: 'string',
10
+ refs: 'string[]',
11
+ providedInvariants: 'string[]',
12
+ });
13
+
14
+ export type MigrationEntry = typeof migrationEntrySchema.infer;
15
+
16
+ export const contractRefSchema = type({
17
+ hash: 'string',
18
+ refs: 'string[]',
19
+ });
20
+
21
+ export type ContractRef = typeof contractRefSchema.infer;
22
+
23
+ export const successEnvelopeBaseSchema = type({
24
+ ok: 'true',
25
+ summary: 'string',
26
+ });
27
+
28
+ export type SuccessEnvelopeBase = typeof successEnvelopeBaseSchema.infer;
29
+
30
+ export const migrationSpaceListEntrySchema = type({
31
+ space: 'string',
32
+ migrations: migrationEntrySchema.array(),
33
+ });
34
+
35
+ export type MigrationSpaceListEntry = typeof migrationSpaceListEntrySchema.infer;
36
+
37
+ export const migrationListResultSchema = successEnvelopeBaseSchema.and(
38
+ type({
39
+ spaces: migrationSpaceListEntrySchema.array(),
40
+ }),
41
+ );
42
+
43
+ export type MigrationListResult = typeof migrationListResultSchema.infer;
44
+
45
+ export const graphMigrationSchema = type({
46
+ name: 'string',
47
+ hash: 'string',
48
+ fromContract: 'string | null',
49
+ toContract: 'string',
50
+ });
51
+
52
+ export type GraphMigration = typeof graphMigrationSchema.infer;
53
+
54
+ export const migrationSpaceGraphEntrySchema = type({
55
+ space: 'string',
56
+ contracts: contractRefSchema.array(),
57
+ migrations: graphMigrationSchema.array(),
58
+ });
59
+
60
+ export type MigrationSpaceGraphEntry = typeof migrationSpaceGraphEntrySchema.infer;
61
+
62
+ export const migrationGraphJsonResultSchema = successEnvelopeBaseSchema.and(
63
+ type({
64
+ spaces: migrationSpaceGraphEntrySchema.array(),
65
+ }),
66
+ );
67
+
68
+ export type MigrationGraphJsonResult = typeof migrationGraphJsonResultSchema.infer;
69
+
70
+ export const migrationStatusEntrySchema = migrationEntrySchema.and(
71
+ type({
72
+ status: '"applied" | "pending" | null',
73
+ }),
74
+ );
75
+
76
+ export type MigrationStatusEntry = typeof migrationStatusEntrySchema.infer;
77
+
78
+ const contractUnreadableDiagnosticSchema = type({
79
+ code: '"CONTRACT.UNREADABLE"',
80
+ severity: '"warn" | "info"',
81
+ message: 'string',
82
+ hints: 'string[]',
83
+ });
84
+
85
+ const markerNotInHistoryDiagnosticSchema = type({
86
+ code: '"MIGRATION.MARKER_NOT_IN_HISTORY"',
87
+ severity: '"warn" | "info"',
88
+ message: 'string',
89
+ hints: 'string[]',
90
+ });
91
+
92
+ const missingInvariantsDiagnosticSchema = type({
93
+ code: '"MIGRATION.MISSING_INVARIANTS"',
94
+ 'ref?': 'string',
95
+ invariants: 'string[]',
96
+ message: 'string',
97
+ });
98
+
99
+ export const statusDiagnosticSchema = contractUnreadableDiagnosticSchema
100
+ .or(markerNotInHistoryDiagnosticSchema)
101
+ .or(missingInvariantsDiagnosticSchema);
102
+
103
+ export type StatusDiagnosticJson = typeof statusDiagnosticSchema.infer;
104
+
105
+ export const migrationStatusSpaceSchema = type({
106
+ space: 'string',
107
+ currentContract: 'string | null',
108
+ targetContract: 'string',
109
+ migrations: migrationStatusEntrySchema.array(),
110
+ });
111
+
112
+ export type MigrationStatusSpace = typeof migrationStatusSpaceSchema.infer;
113
+
114
+ export const migrationStatusJsonResultSchema = successEnvelopeBaseSchema.and(
115
+ type({
116
+ spaces: migrationStatusSpaceSchema.array(),
117
+ diagnostics: statusDiagnosticSchema.array(),
118
+ }),
119
+ );
120
+
121
+ export type MigrationStatusResult = typeof migrationStatusJsonResultSchema.infer;
122
+
123
+ export const ledgerRecordSchema = type({
124
+ space: 'string',
125
+ name: 'string',
126
+ hash: 'string',
127
+ fromContract: 'string | null',
128
+ toContract: 'string',
129
+ appliedAt: 'string',
130
+ operationCount: 'number',
131
+ });
132
+
133
+ export type LedgerRecord = typeof ledgerRecordSchema.infer;
134
+
135
+ export const migrationLogResultSchema = successEnvelopeBaseSchema.and(
136
+ type({
137
+ records: ledgerRecordSchema.array(),
138
+ }),
139
+ );
140
+
141
+ export type MigrationLogResult = typeof migrationLogResultSchema.infer;
142
+
143
+ export const showOperationSchema = type({
144
+ id: 'string',
145
+ label: 'string',
146
+ operationClass: 'string',
147
+ });
148
+
149
+ export type ShowOperation = typeof showOperationSchema.infer;
150
+
151
+ export const showPreviewStatementSchema = type({
152
+ text: 'string',
153
+ language: 'string',
154
+ });
155
+
156
+ export const showMigrationSchema = type({
157
+ space: 'string',
158
+ name: 'string',
159
+ hash: 'string',
160
+ fromContract: 'string | null',
161
+ toContract: 'string',
162
+ createdAt: 'string',
163
+ operations: showOperationSchema.array(),
164
+ preview: type({
165
+ statements: showPreviewStatementSchema.array(),
166
+ }),
167
+ });
168
+
169
+ export type ShowMigration = typeof showMigrationSchema.infer;
170
+
171
+ export const migrationShowResultSchema = successEnvelopeBaseSchema.and(
172
+ type({
173
+ migration: showMigrationSchema,
174
+ }),
175
+ );
176
+
177
+ export type MigrationShowResult = typeof migrationShowResultSchema.infer;
178
+
179
+ export const checkFailureSchema = type({
180
+ space: 'string',
181
+ code: 'string',
182
+ where: 'string',
183
+ why: 'string',
184
+ fix: 'string',
185
+ });
186
+
187
+ export type CheckFailure = typeof checkFailureSchema.infer;
188
+
189
+ export const migrationCheckResultSchema = type({
190
+ ok: 'boolean',
191
+ failures: checkFailureSchema.array(),
192
+ summary: 'string',
193
+ });
194
+
195
+ export type MigrationCheckResult = typeof migrationCheckResultSchema.infer;
@@ -11,8 +11,8 @@ import { Command } from 'commander';
11
11
  import { loadConfig } from '../config-loader';
12
12
  import { createControlClient } from '../control-api/client';
13
13
  import type {
14
- MigrationApplyFailure,
15
- MigrationApplyPathDecision,
14
+ MigrateFailure,
15
+ MigratePathDecision,
16
16
  PerSpaceExecutionEntry,
17
17
  } from '../control-api/types';
18
18
  import {
@@ -76,14 +76,14 @@ export interface MigrateResult {
76
76
  }[];
77
77
  readonly summary: string;
78
78
  readonly perSpace: readonly PerSpaceExecutionEntry[];
79
- readonly pathDecision?: MigrationApplyPathDecision;
79
+ readonly pathDecision?: MigratePathDecision;
80
80
  readonly timings: {
81
81
  readonly total: number;
82
82
  };
83
83
  readonly advancedRef?: { readonly name: string; readonly hash: string } | null;
84
84
  }
85
85
 
86
- function mapApplyFailure(failure: MigrationApplyFailure): CliStructuredErrorType {
86
+ function mapApplyFailure(failure: MigrateFailure): CliStructuredErrorType {
87
87
  if (failure.code === 'MIGRATION_PATH_NOT_FOUND') {
88
88
  return errorPathUnreachable(failure);
89
89
  }
@@ -136,7 +136,7 @@ async function executeMigrateCommand(
136
136
 
137
137
  // Construct the family instance up-front so the on-disk contract read
138
138
  // crosses the serializer seam (`familyInstance.deserializeContract`) at
139
- // the read site. The downstream `client.migrationApply({ contract })`
139
+ // the read site. The downstream `client.migrate({ contract })`
140
140
  // re-validates internally (no harm — validation is idempotent), but
141
141
  // closing the gap at the read site is what makes the cast-pattern
142
142
  // lint enforceable and matches the other CLI commands. See TML-2536.
@@ -312,7 +312,7 @@ async function executeMigrateCommand(
312
312
  }
313
313
  }
314
314
 
315
- const applyResult = await client.migrationApply({
315
+ const applyResult = await client.migrate({
316
316
  contract: applyContract,
317
317
  migrationsDir,
318
318
  ...ifDefined('refHash', refEntry?.hash),