prisma-next 0.12.0-dev.24 → 0.12.0-dev.26

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 (83) hide show
  1. package/dist/cli.mjs +11 -11
  2. package/dist/{client-BHe8szOW.mjs → client-V7BkIQrQ.mjs} +4 -4
  3. package/dist/{client-BHe8szOW.mjs.map → client-V7BkIQrQ.mjs.map} +1 -1
  4. package/dist/{command-helpers-Cmdqyhz9.mjs → command-helpers-DlrUCI7s.mjs} +3 -24
  5. package/dist/{command-helpers-Cmdqyhz9.mjs.map → command-helpers-DlrUCI7s.mjs.map} +1 -1
  6. package/dist/commands/contract-emit.mjs +1 -1
  7. package/dist/commands/contract-infer.mjs +1 -1
  8. package/dist/commands/db-init.mjs +4 -4
  9. package/dist/commands/db-schema.mjs +3 -3
  10. package/dist/commands/db-sign.mjs +4 -4
  11. package/dist/commands/db-update.mjs +5 -5
  12. package/dist/commands/db-verify.mjs +1 -1
  13. package/dist/commands/migrate.d.mts +1 -1
  14. package/dist/commands/migrate.mjs +5 -5
  15. package/dist/commands/migration-check.mjs +1 -1
  16. package/dist/commands/migration-graph.d.mts +2 -11
  17. package/dist/commands/migration-graph.d.mts.map +1 -1
  18. package/dist/commands/migration-graph.mjs +8 -35
  19. package/dist/commands/migration-graph.mjs.map +1 -1
  20. package/dist/commands/migration-list.d.mts +13 -24
  21. package/dist/commands/migration-list.d.mts.map +1 -1
  22. package/dist/commands/migration-list.mjs +4 -4
  23. package/dist/commands/migration-list.mjs.map +1 -1
  24. package/dist/commands/migration-log.d.mts +1 -1
  25. package/dist/commands/migration-log.mjs +1 -1
  26. package/dist/commands/migration-new.mjs +3 -3
  27. package/dist/commands/migration-plan.mjs +1 -1
  28. package/dist/commands/migration-show.d.mts +1 -1
  29. package/dist/commands/migration-show.mjs +3 -3
  30. package/dist/commands/migration-status.d.mts +24 -142
  31. package/dist/commands/migration-status.d.mts.map +1 -1
  32. package/dist/commands/migration-status.mjs +3 -759
  33. package/dist/commands/ref.d.mts +1 -1
  34. package/dist/commands/ref.mjs +2 -2
  35. package/dist/commands/telemetry/index.mjs +1 -1
  36. package/dist/{contract-at-errors-Cz0z5PJi.mjs → contract-at-errors-DlZHXSkI.mjs} +2 -2
  37. package/dist/{contract-at-errors-Cz0z5PJi.mjs.map → contract-at-errors-DlZHXSkI.mjs.map} +1 -1
  38. package/dist/{contract-emit-DPMij44i.mjs → contract-emit-CaKp92-Q.mjs} +3 -3
  39. package/dist/{contract-emit-DPMij44i.mjs.map → contract-emit-CaKp92-Q.mjs.map} +1 -1
  40. package/dist/{contract-emit-CC9jDOmu.mjs → contract-emit-S53EyBRV.mjs} +3 -3
  41. package/dist/{contract-emit-CC9jDOmu.mjs.map → contract-emit-S53EyBRV.mjs.map} +1 -1
  42. package/dist/{contract-infer-OCn12Zvn.mjs → contract-infer-Cebb-_Qx.mjs} +3 -3
  43. package/dist/{contract-infer-OCn12Zvn.mjs.map → contract-infer-Cebb-_Qx.mjs.map} +1 -1
  44. package/dist/{contract-space-aggregate-loader-CirAEsM8.mjs → contract-space-aggregate-loader-Dvl1SJ4C.mjs} +3 -3
  45. package/dist/{contract-space-aggregate-loader-CirAEsM8.mjs.map → contract-space-aggregate-loader-Dvl1SJ4C.mjs.map} +1 -1
  46. package/dist/{db-verify-DJxengYP.mjs → db-verify-B1OoWEWn.mjs} +4 -4
  47. package/dist/{db-verify-DJxengYP.mjs.map → db-verify-B1OoWEWn.mjs.map} +1 -1
  48. package/dist/exports/control-api.d.mts +1 -1
  49. package/dist/exports/control-api.mjs +2 -2
  50. package/dist/exports/index.mjs +1 -1
  51. package/dist/{framework-components-DynSvww4.mjs → framework-components-DCAT1uUC.mjs} +2 -2
  52. package/dist/{framework-components-DynSvww4.mjs.map → framework-components-DCAT1uUC.mjs.map} +1 -1
  53. package/dist/{init-B6kKrmf7.mjs → init-Kf3T4A4W.mjs} +3 -3
  54. package/dist/{init-B6kKrmf7.mjs.map → init-Kf3T4A4W.mjs.map} +1 -1
  55. package/dist/{inspect-live-schema-DVZlDlnF.mjs → inspect-live-schema-DTqflZ8X.mjs} +3 -3
  56. package/dist/{inspect-live-schema-DVZlDlnF.mjs.map → inspect-live-schema-DTqflZ8X.mjs.map} +1 -1
  57. package/dist/{migration-check-DzH1u-O1.mjs → migration-check-Ccyd0QKb.mjs} +2 -2
  58. package/dist/{migration-check-DzH1u-O1.mjs.map → migration-check-Ccyd0QKb.mjs.map} +1 -1
  59. package/dist/{migration-command-scaffold-Cs7Ky-m5.mjs → migration-command-scaffold-DI7_SFL0.mjs} +3 -3
  60. package/dist/{migration-command-scaffold-Cs7Ky-m5.mjs.map → migration-command-scaffold-DI7_SFL0.mjs.map} +1 -1
  61. package/dist/{migration-graph-tree-render-BQdhKBO8.mjs → migration-graph-tree-render-DyDBuJEX.mjs} +25 -2
  62. package/dist/{migration-graph-tree-render-BQdhKBO8.mjs.map → migration-graph-tree-render-DyDBuJEX.mjs.map} +1 -1
  63. package/dist/migration-list-types-DV9PBc7Z.d.mts +23 -0
  64. package/dist/migration-list-types-DV9PBc7Z.d.mts.map +1 -0
  65. package/dist/{migration-log-BzPmks3c.mjs → migration-log-Des4seHP.mjs} +4 -4
  66. package/dist/{migration-log-BzPmks3c.mjs.map → migration-log-Des4seHP.mjs.map} +1 -1
  67. package/dist/{migration-plan-CaeKCKp4.mjs → migration-plan-DxDTBzGS.mjs} +5 -5
  68. package/dist/{migration-plan-CaeKCKp4.mjs.map → migration-plan-DxDTBzGS.mjs.map} +1 -1
  69. package/dist/migration-status-CCwqA-vi.mjs +416 -0
  70. package/dist/migration-status-CCwqA-vi.mjs.map +1 -0
  71. package/dist/{migrations-DQ1t3XFL.mjs → migrations-B3H6RTXb.mjs} +2 -2
  72. package/dist/{migrations-DQ1t3XFL.mjs.map → migrations-B3H6RTXb.mjs.map} +1 -1
  73. package/dist/{telemetry-Q88WHwlv.mjs → telemetry-LFFQmqHd.mjs} +2 -2
  74. package/dist/{telemetry-Q88WHwlv.mjs.map → telemetry-LFFQmqHd.mjs.map} +1 -1
  75. package/dist/{types-DiC683UW.d.mts → types-BdS8PoKM.d.mts} +2 -1
  76. package/dist/types-BdS8PoKM.d.mts.map +1 -0
  77. package/dist/{verify-CreSJ1Mz.mjs → verify-C0TARc6h.mjs} +2 -2
  78. package/dist/{verify-CreSJ1Mz.mjs.map → verify-C0TARc6h.mjs.map} +1 -1
  79. package/package.json +11 -12
  80. package/dist/commands/migration-status.mjs.map +0 -1
  81. package/dist/graph-render-rFAqZujX.mjs +0 -1081
  82. package/dist/graph-render-rFAqZujX.mjs.map +0 -1
  83. package/dist/types-DiC683UW.d.mts.map +0 -1
@@ -1,6 +1,6 @@
1
- import { _ as parseGlobalFlagsOrExit, b as handleResult, l as setCommandDescriptions, t as addGlobalOptions, u as setCommandExamples, v as createTerminalUI } from "../command-helpers-Cmdqyhz9.mjs";
2
- import { t as inspectLiveSchema } from "../inspect-live-schema-DVZlDlnF.mjs";
3
- import { n as formatIntrospectOutput, t as formatIntrospectJson } from "../verify-CreSJ1Mz.mjs";
1
+ import { _ as createTerminalUI, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from "../command-helpers-DlrUCI7s.mjs";
2
+ import { t as inspectLiveSchema } from "../inspect-live-schema-DTqflZ8X.mjs";
3
+ import { n as formatIntrospectOutput, t as formatIntrospectJson } from "../verify-C0TARc6h.mjs";
4
4
  import { Command } from "commander";
5
5
  //#region src/commands/db-schema.ts
6
6
  function toIntrospectSchemaResult(result) {
@@ -1,9 +1,9 @@
1
1
  import { t as loadConfig } from "../config-loader-B6sJjXTv.mjs";
2
- import { E as formatStyledHeader, F as errorContractValidationFailed, I as errorDatabaseConnectionRequired, R as errorDriverRequired, Z as errorRuntime, _ as parseGlobalFlagsOrExit, b as handleResult, i as maskConnectionUrl, it as mapRefResolutionError, j as CliStructuredError, l as setCommandDescriptions, nt as errorUnexpected, o as resolveContractPath, rt as mapMigrationToolsError, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, v as createTerminalUI, z as errorFileNotFound } from "../command-helpers-Cmdqyhz9.mjs";
2
+ import { A as CliStructuredError, F as errorDatabaseConnectionRequired, L as errorDriverRequired, P as errorContractValidationFailed, R as errorFileNotFound, T as formatStyledHeader, X as errorRuntime, _ as createTerminalUI, g as parseGlobalFlagsOrExit, i as maskConnectionUrl, l as setCommandDescriptions, nt as mapMigrationToolsError, o as resolveContractPath, rt as mapRefResolutionError, s as resolveMigrationPaths, t as addGlobalOptions, tt as errorUnexpected, u as setCommandExamples, y as handleResult } from "../command-helpers-DlrUCI7s.mjs";
3
3
  import { t as createProgressAdapter } from "../progress-adapter-C644QK8l.mjs";
4
- import { a as ContractValidationError, t as createControlClient } from "../client-BHe8szOW.mjs";
5
- import { r as buildReadAggregate } from "../contract-space-aggregate-loader-CirAEsM8.mjs";
6
- import { a as formatSignJson, i as formatSchemaVerifyOutput, o as formatSignOutput, r as formatSchemaVerifyJson } from "../verify-CreSJ1Mz.mjs";
4
+ import { a as ContractValidationError, t as createControlClient } from "../client-V7BkIQrQ.mjs";
5
+ import { n as buildReadAggregate } from "../contract-space-aggregate-loader-Dvl1SJ4C.mjs";
6
+ import { a as formatSignJson, i as formatSchemaVerifyOutput, o as formatSignOutput, r as formatSchemaVerifyJson } from "../verify-C0TARc6h.mjs";
7
7
  import { Command } from "commander";
8
8
  import { notOk, ok } from "@prisma-next/utils/result";
9
9
  import { join, relative, resolve } from "pathe";
@@ -1,8 +1,8 @@
1
- import { F as errorContractValidationFailed, L as errorDestructiveChanges, M as ERROR_CODE_DESTRUCTIVE_CHANGES, W as errorMigrationPlanningFailed, X as errorRunnerFailed, _ as parseGlobalFlagsOrExit, b as handleResult, c as sanitizeErrorMessage, it as mapRefResolutionError, j as CliStructuredError, l as setCommandDescriptions, nt as errorUnexpected, rt as mapMigrationToolsError, s as resolveMigrationPaths, u as setCommandExamples, v as createTerminalUI } from "../command-helpers-Cmdqyhz9.mjs";
2
- import { a as ContractValidationError } from "../client-BHe8szOW.mjs";
3
- import { r as buildReadAggregate } from "../contract-space-aggregate-loader-CirAEsM8.mjs";
4
- import { i as formatMigrationPlanOutput, n as formatMigrationApplyOutput, r as formatMigrationJson } from "../migrations-DQ1t3XFL.mjs";
5
- import { n as prepareMigrationContext, t as addMigrationCommandOptions } from "../migration-command-scaffold-Cs7Ky-m5.mjs";
1
+ import { A as CliStructuredError, I as errorDestructiveChanges, P as errorContractValidationFailed, U as errorMigrationPlanningFailed, Y as errorRunnerFailed, _ as createTerminalUI, c as sanitizeErrorMessage, g as parseGlobalFlagsOrExit, j as ERROR_CODE_DESTRUCTIVE_CHANGES, l as setCommandDescriptions, nt as mapMigrationToolsError, rt as mapRefResolutionError, s as resolveMigrationPaths, tt as errorUnexpected, u as setCommandExamples, y as handleResult } from "../command-helpers-DlrUCI7s.mjs";
2
+ import { a as ContractValidationError } from "../client-V7BkIQrQ.mjs";
3
+ import { n as buildReadAggregate } from "../contract-space-aggregate-loader-Dvl1SJ4C.mjs";
4
+ import { i as formatMigrationPlanOutput, n as formatMigrationApplyOutput, r as formatMigrationJson } from "../migrations-B3H6RTXb.mjs";
5
+ import { n as prepareMigrationContext, t as addMigrationCommandOptions } from "../migration-command-scaffold-DI7_SFL0.mjs";
6
6
  import { i as readContractIR, n as computeRefAdvancementName, t as buildRefAdvancementFields } from "../ref-advancement-DUZqsue6.mjs";
7
7
  import { Command } from "commander";
8
8
  import { ifDefined } from "@prisma-next/utils/defined";
@@ -1,2 +1,2 @@
1
- import { t as createDbVerifyCommand } from "../db-verify-DJxengYP.mjs";
1
+ import { t as createDbVerifyCommand } from "../db-verify-B1OoWEWn.mjs";
2
2
  export { createDbVerifyCommand };
@@ -1,4 +1,4 @@
1
- import { E as PerSpaceExecutionEntry, w as MigrationApplyPathDecision } from "../types-DiC683UW.mjs";
1
+ import { E as PerSpaceExecutionEntry, w as MigrationApplyPathDecision } from "../types-BdS8PoKM.mjs";
2
2
  import { Command } from "commander";
3
3
 
4
4
  //#region src/commands/migrate.d.ts
@@ -1,11 +1,11 @@
1
1
  import { t as loadConfig } from "../config-loader-B6sJjXTv.mjs";
2
- import { E as formatStyledHeader, F as errorContractValidationFailed, G as errorPathUnreachable, H as errorMarkerMismatch, I as errorDatabaseConnectionRequired, R as errorDriverRequired, Z as errorRuntime, _ as parseGlobalFlagsOrExit, b as handleResult, et as errorTargetMigrationNotSupported, f as targetSupportsMigrations, i as maskConnectionUrl, it as mapRefResolutionError, j as CliStructuredError, l as setCommandDescriptions, n as collectDeclaredInvariants, nt as errorUnexpected, o as resolveContractPath, rt as mapMigrationToolsError, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, v as createTerminalUI, z as errorFileNotFound } from "../command-helpers-Cmdqyhz9.mjs";
3
- import { t as createControlClient } from "../client-BHe8szOW.mjs";
2
+ import { $ as errorTargetMigrationNotSupported, A as CliStructuredError, F as errorDatabaseConnectionRequired, L as errorDriverRequired, P as errorContractValidationFailed, R as errorFileNotFound, T as formatStyledHeader, V as errorMarkerMismatch, W as errorPathUnreachable, X as errorRuntime, _ as createTerminalUI, f as targetSupportsMigrations, g as parseGlobalFlagsOrExit, i as maskConnectionUrl, l as setCommandDescriptions, n as collectDeclaredInvariants, nt as mapMigrationToolsError, o as resolveContractPath, rt as mapRefResolutionError, s as resolveMigrationPaths, t as addGlobalOptions, tt as errorUnexpected, u as setCommandExamples, y as handleResult } from "../command-helpers-DlrUCI7s.mjs";
3
+ import { t as createControlClient } from "../client-V7BkIQrQ.mjs";
4
4
  import { t as toDeclaredExtensionsFromRaw } from "../extension-pack-inputs-IDvjRCi3.mjs";
5
- import { a as loadContractSpaceAggregateForCli, o as refuseContractSpaceIntegrity } from "../contract-space-aggregate-loader-CirAEsM8.mjs";
6
- import { t as formatMigrationApplyCommandOutput } from "../migrations-DQ1t3XFL.mjs";
5
+ import { a as refuseContractSpaceIntegrity, i as loadContractSpaceAggregateForCli } from "../contract-space-aggregate-loader-Dvl1SJ4C.mjs";
6
+ import { t as formatMigrationApplyCommandOutput } from "../migrations-B3H6RTXb.mjs";
7
7
  import { i as readContractIR, r as executeRefAdvancement } from "../ref-advancement-DUZqsue6.mjs";
8
- import { t as mapContractAtError } from "../contract-at-errors-Cz0z5PJi.mjs";
8
+ import { t as mapContractAtError } from "../contract-at-errors-DlZHXSkI.mjs";
9
9
  import { Command } from "commander";
10
10
  import { ifDefined } from "@prisma-next/utils/defined";
11
11
  import { notOk, ok } from "@prisma-next/utils/result";
@@ -1,2 +1,2 @@
1
- import { t as createMigrationCheckCommand } from "../migration-check-DzH1u-O1.mjs";
1
+ import { t as createMigrationCheckCommand } from "../migration-check-Ccyd0QKb.mjs";
2
2
  export { createMigrationCheckCommand };
@@ -1,4 +1,4 @@
1
- import { N as CliStructuredError } from "../types-DiC683UW.mjs";
1
+ import { N as CliStructuredError } from "../types-BdS8PoKM.mjs";
2
2
  import { n as GlobalFlags, t as CommonCommandOptions } from "../global-flags-DG4uY5tV.mjs";
3
3
  import { n as StatusRef } from "../migration-types-CAQ-0TEE.mjs";
4
4
  import { t as TerminalUI } from "../terminal-ui-C3xGyxW-.mjs";
@@ -10,18 +10,9 @@ import { MigrationGraph } from "@prisma-next/migration-tools/graph";
10
10
  interface MigrationGraphOptions extends CommonCommandOptions {
11
11
  readonly config?: string;
12
12
  readonly dot?: boolean;
13
- readonly tree?: boolean;
14
13
  readonly ascii?: boolean;
15
14
  readonly legend?: boolean;
16
15
  }
17
- /**
18
- * `--legend` describes the `--tree` visual language, so passing it auto-enables
19
- * the tree path (it has nothing to say about the legacy dagre default).
20
- */
21
- declare function migrationGraphUsesTree(options: {
22
- readonly tree?: boolean;
23
- readonly legend?: boolean;
24
- }): boolean;
25
16
  /**
26
17
  * The legend is decoration printed alongside the command header on stderr, so
27
18
  * it is suppressed for the machine-readable / silent paths (`--json`, `--dot`,
@@ -41,5 +32,5 @@ interface MigrationGraphResult {
41
32
  declare function executeMigrationGraphCommand(options: MigrationGraphOptions, flags: GlobalFlags, ui: TerminalUI): Promise<Result<MigrationGraphResult, CliStructuredError>>;
42
33
  declare function createMigrationGraphCommand(): Command;
43
34
  //#endregion
44
- export { MigrationGraphResult, createMigrationGraphCommand, executeMigrationGraphCommand, migrationGraphShowsLegend, migrationGraphUsesTree };
35
+ export { MigrationGraphResult, createMigrationGraphCommand, executeMigrationGraphCommand, migrationGraphShowsLegend };
45
36
  //# sourceMappingURL=migration-graph.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration-graph.d.mts","names":[],"sources":["../../src/commands/migration-graph.ts"],"mappings":";;;;;;;;;UA6BU,qBAAA,SAA8B,oBAAoB;EAAA,SACjD,MAAA;EAAA,SACA,GAAA;EAAA,SACA,IAAA;EAAA,SACA,KAAA;EAAA,SACA,MAAA;AAAA;;;;;iBAOK,sBAAA,CAAuB,OAAA;EAAA,SAC5B,IAAA;EAAA,SACA,MAAA;AAAA;;;;;;iBAUK,yBAAA,CACd,OAAA;EAAA,SAAoB,MAAA;EAAA,SAA2B,GAAA;AAAA,GAC/C,KAAA,EAAO,WAAW;AAAA,UAOH,oBAAA;EAAA,SACN,EAAA;EAAA,SACA,KAAA,EAAO,cAAA;EAAA,SACP,YAAA;EAAA,SACA,IAAA,WAAe,SAAS;EAAA,SACxB,OAAA;AAAA;AAAA,iBAGW,4BAAA,CACpB,OAAA,EAAS,qBAAA,EACT,KAAA,EAAO,WAAA,EACP,EAAA,EAAI,UAAA,GACH,OAAA,CAAQ,MAAA,CAAO,oBAAA,EAAsB,kBAAA;AAAA,iBAoDxB,2BAAA,CAAA,GAA+B,OAAO"}
1
+ {"version":3,"file":"migration-graph.d.mts","names":[],"sources":["../../src/commands/migration-graph.ts"],"mappings":";;;;;;;;;UA0BU,qBAAA,SAA8B,oBAAoB;EAAA,SACjD,MAAA;EAAA,SACA,GAAA;EAAA,SACA,KAAA;EAAA,SACA,MAAA;AAAA;;;;;;iBAQK,yBAAA,CACd,OAAA;EAAA,SAAoB,MAAA;EAAA,SAA2B,GAAA;AAAA,GAC/C,KAAA,EAAO,WAAW;AAAA,UAOH,oBAAA;EAAA,SACN,EAAA;EAAA,SACA,KAAA,EAAO,cAAA;EAAA,SACP,YAAA;EAAA,SACA,IAAA,WAAe,SAAS;EAAA,SACxB,OAAA;AAAA;AAAA,iBAGW,4BAAA,CACpB,OAAA,EAAS,qBAAA,EACT,KAAA,EAAO,WAAA,EACP,EAAA,EAAI,UAAA,GACH,OAAA,CAAQ,MAAA,CAAO,oBAAA,EAAsB,kBAAA;AAAA,iBAmDxB,2BAAA,CAAA,GAA+B,OAAO"}
@@ -1,20 +1,11 @@
1
1
  import { t as loadConfig } from "../config-loader-B6sJjXTv.mjs";
2
- import { E as formatStyledHeader, _ as parseGlobalFlagsOrExit, b as handleResult, d as setCommandSeeAlso, l as setCommandDescriptions, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, v as createTerminalUI } from "../command-helpers-Cmdqyhz9.mjs";
3
- import { r as buildReadAggregate } from "../contract-space-aggregate-loader-CirAEsM8.mjs";
4
- import { i as migrationGraphToRenderInput, n as graphRenderer } from "../graph-render-rFAqZujX.mjs";
5
- import { c as buildMigrationGraphLayout, n as renderMigrationGraphTree, s as buildMigrationGraphRows, t as renderMigrationGraphLegend } from "../migration-graph-tree-render-BQdhKBO8.mjs";
2
+ import { T as formatStyledHeader, _ as createTerminalUI, d as setCommandSeeAlso, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from "../command-helpers-DlrUCI7s.mjs";
3
+ import { n as buildReadAggregate } from "../contract-space-aggregate-loader-Dvl1SJ4C.mjs";
4
+ import { c as buildMigrationGraphLayout, n as renderMigrationGraphTree, s as buildMigrationGraphRows, t as renderMigrationGraphLegend } from "../migration-graph-tree-render-DyDBuJEX.mjs";
6
5
  import { Command } from "commander";
7
6
  import { ok } from "@prisma-next/utils/result";
8
- import { EMPTY_CONTRACT_HASH } from "@prisma-next/migration-tools/constants";
9
7
  //#region src/commands/migration-graph.ts
10
8
  /**
11
- * `--legend` describes the `--tree` visual language, so passing it auto-enables
12
- * the tree path (it has nothing to say about the legacy dagre default).
13
- */
14
- function migrationGraphUsesTree(options) {
15
- return options.tree === true || options.legend === true;
16
- }
17
- /**
18
9
  * The legend is decoration printed alongside the command header on stderr, so
19
10
  * it is suppressed for the machine-readable / silent paths (`--json`, `--dot`,
20
11
  * `--quiet`) exactly as the header is.
@@ -65,13 +56,12 @@ async function executeMigrationGraphCommand(options, flags, ui) {
65
56
  }
66
57
  function createMigrationGraphCommand() {
67
58
  const command = new Command("graph");
68
- setCommandDescriptions(command, "Show the migration graph topology", "Renders the migration graph topology. Offline — does not consult\nthe database. Use --tree for the condensed annotated tree\n(--ascii swaps box-drawing for pipe-friendly ASCII glyphs),\n--json for machine-readable output, or --dot for Graphviz DOT\nformat.");
59
+ setCommandDescriptions(command, "Show the migration graph topology", "Renders the migration graph topology. Offline — does not consult\nthe database. --ascii swaps box-drawing for pipe-friendly ASCII glyphs.\nUse --json for machine-readable output, or --dot for Graphviz DOT\nformat.");
69
60
  setCommandExamples(command, [
70
61
  "prisma-next migration graph",
71
62
  "prisma-next migration graph --json",
72
63
  "prisma-next migration graph --dot",
73
- "prisma-next migration graph --tree",
74
- "prisma-next migration graph --tree --ascii",
64
+ "prisma-next migration graph --ascii",
75
65
  "prisma-next migration graph --legend"
76
66
  ]);
77
67
  setCommandSeeAlso(command, [
@@ -92,7 +82,7 @@ function createMigrationGraphCommand() {
92
82
  oneLiner: "Display migration package contents"
93
83
  }
94
84
  ]);
95
- addGlobalOptions(command).option("--config <path>", "Path to prisma-next.config.ts").option("--dot", "Output in Graphviz DOT format").option("--tree", "Experimental condensed annotated tree renderer").option("--ascii", "Use ASCII glyphs for --tree (pipe-friendly)").option("--legend", "Print a key for the --tree glyphs and lane colors (implies --tree)").action(async (options) => {
85
+ addGlobalOptions(command).option("--config <path>", "Path to prisma-next.config.ts").option("--dot", "Output in Graphviz DOT format").option("--ascii", "Use ASCII glyphs (pipe-friendly)").option("--legend", "Print a key for the tree glyphs and lane colors").action(async (options) => {
96
86
  const flags = parseGlobalFlagsOrExit(options);
97
87
  const ui = createTerminalUI(flags);
98
88
  const exitCode = handleResult(await executeMigrationGraphCommand(options, flags, ui), flags, ui, (graphResult) => {
@@ -119,7 +109,7 @@ function createMigrationGraphCommand() {
119
109
  edges,
120
110
  summary: graphResult.summary
121
111
  }, null, 2));
122
- } else if (!flags.quiet) if (migrationGraphUsesTree(options)) {
112
+ } else if (!flags.quiet) {
123
113
  const refsByHash = /* @__PURE__ */ new Map();
124
114
  for (const ref of graphResult.refs) {
125
115
  const existing = refsByHash.get(ref.hash);
@@ -136,23 +126,6 @@ function createMigrationGraphCommand() {
136
126
  });
137
127
  ui.output(treeOutput);
138
128
  ui.output(`\n${graphResult.summary}`);
139
- } else {
140
- const renderInput = migrationGraphToRenderInput({
141
- graph: graphResult.graph,
142
- mode: "offline",
143
- markerHash: void 0,
144
- contractHash: graphResult.contractHash ?? EMPTY_CONTRACT_HASH,
145
- refs: graphResult.refs,
146
- activeRefHash: void 0,
147
- activeRefName: void 0,
148
- edgeStatuses: []
149
- });
150
- const graphOutput = graphRenderer.render(renderInput.graph, {
151
- ...renderInput.options,
152
- colorize: flags.color !== false
153
- });
154
- ui.log(graphOutput);
155
- ui.log(`\n${graphResult.summary}`);
156
129
  }
157
130
  });
158
131
  process.exit(exitCode);
@@ -160,6 +133,6 @@ function createMigrationGraphCommand() {
160
133
  return command;
161
134
  }
162
135
  //#endregion
163
- export { createMigrationGraphCommand, executeMigrationGraphCommand, migrationGraphShowsLegend, migrationGraphUsesTree };
136
+ export { createMigrationGraphCommand, executeMigrationGraphCommand, migrationGraphShowsLegend };
164
137
 
165
138
  //# sourceMappingURL=migration-graph.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration-graph.mjs","names":[],"sources":["../../src/commands/migration-graph.ts"],"sourcesContent":["import { EMPTY_CONTRACT_HASH } from '@prisma-next/migration-tools/constants';\nimport type { MigrationGraph } from '@prisma-next/migration-tools/graph';\nimport { ok, type Result } from '@prisma-next/utils/result';\nimport { Command } from 'commander';\nimport { loadConfig } from '../config-loader';\nimport type { CliStructuredError } from '../utils/cli-errors';\nimport {\n addGlobalOptions,\n resolveMigrationPaths,\n setCommandDescriptions,\n setCommandExamples,\n setCommandSeeAlso,\n} from '../utils/command-helpers';\nimport { buildReadAggregate } from '../utils/contract-space-aggregate-loader';\nimport { migrationGraphToRenderInput } from '../utils/formatters/graph-migration-mapper';\nimport { graphRenderer } from '../utils/formatters/graph-render';\nimport { buildMigrationGraphLayout } from '../utils/formatters/migration-graph-layout';\nimport { buildMigrationGraphRows } from '../utils/formatters/migration-graph-rows';\nimport {\n renderMigrationGraphLegend,\n renderMigrationGraphTree,\n} from '../utils/formatters/migration-graph-tree-render';\nimport { formatStyledHeader } from '../utils/formatters/styled';\nimport type { CommonCommandOptions } from '../utils/global-flags';\nimport { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';\nimport type { StatusRef } from '../utils/migration-types';\nimport { handleResult } from '../utils/result-handler';\nimport { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';\n\ninterface MigrationGraphOptions extends CommonCommandOptions {\n readonly config?: string;\n readonly dot?: boolean;\n readonly tree?: boolean;\n readonly ascii?: boolean;\n readonly legend?: boolean;\n}\n\n/**\n * `--legend` describes the `--tree` visual language, so passing it auto-enables\n * the tree path (it has nothing to say about the legacy dagre default).\n */\nexport function migrationGraphUsesTree(options: {\n readonly tree?: boolean;\n readonly legend?: boolean;\n}): boolean {\n return options.tree === true || options.legend === true;\n}\n\n/**\n * The legend is decoration printed alongside the command header on stderr, so\n * it is suppressed for the machine-readable / silent paths (`--json`, `--dot`,\n * `--quiet`) exactly as the header is.\n */\nexport function migrationGraphShowsLegend(\n options: { readonly legend?: boolean; readonly dot?: boolean },\n flags: GlobalFlags,\n): boolean {\n return (\n options.legend === true && options.dot !== true && flags.json !== true && flags.quiet !== true\n );\n}\n\nexport interface MigrationGraphResult {\n readonly ok: true;\n readonly graph: MigrationGraph;\n readonly contractHash: string | null;\n readonly refs: readonly StatusRef[];\n readonly summary: string;\n}\n\nexport async function executeMigrationGraphCommand(\n options: MigrationGraphOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n): Promise<Result<MigrationGraphResult, CliStructuredError>> {\n const config = await loadConfig(options.config);\n const { configPath, appMigrationsRelative, migrationsDir } = resolveMigrationPaths(\n options.config,\n config,\n );\n\n if (!flags.json && !flags.quiet) {\n const header = formatStyledHeader({\n command: 'migration graph',\n description: 'Show the migration graph topology',\n details: [\n { label: 'config', value: configPath },\n { label: 'migrations', value: appMigrationsRelative },\n ],\n flags,\n });\n ui.stderr(header);\n if (migrationGraphShowsLegend(options, flags)) {\n ui.stderr(\n renderMigrationGraphLegend({\n colorize: flags.color !== false,\n glyphMode: ui.resolveGlyphMode(options.ascii === true),\n }),\n );\n // Blank line separating the stderr key from the graph that follows on stdout.\n ui.stderr('');\n }\n }\n\n const loaded = await buildReadAggregate(config, { migrationsDir });\n if (!loaded.ok) {\n return loaded;\n }\n\n const { aggregate, contractHash } = loaded.value;\n const graph = aggregate.app.graph();\n const refs: readonly StatusRef[] = Object.entries(aggregate.app.refs).map(([name, entry]) => ({\n name,\n hash: entry.hash,\n active: false,\n }));\n\n return ok({\n ok: true,\n graph,\n contractHash,\n refs,\n summary: `${graph.nodes.size} node(s), ${graph.migrationByHash.size} edge(s)`,\n });\n}\n\nexport function createMigrationGraphCommand(): Command {\n const command = new Command('graph');\n setCommandDescriptions(\n command,\n 'Show the migration graph topology',\n 'Renders the migration graph topology. Offline — does not consult\\n' +\n 'the database. Use --tree for the condensed annotated tree\\n' +\n '(--ascii swaps box-drawing for pipe-friendly ASCII glyphs),\\n' +\n '--json for machine-readable output, or --dot for Graphviz DOT\\n' +\n 'format.',\n );\n setCommandExamples(command, [\n 'prisma-next migration graph',\n 'prisma-next migration graph --json',\n 'prisma-next migration graph --dot',\n 'prisma-next migration graph --tree',\n 'prisma-next migration graph --tree --ascii',\n 'prisma-next migration graph --legend',\n ]);\n setCommandSeeAlso(command, [\n { verb: 'migration status', oneLiner: 'Show migration path and pending status' },\n { verb: 'migration log', oneLiner: 'Show executed migration history' },\n { verb: 'migration list', oneLiner: 'List on-disk migrations' },\n { verb: 'migration show', oneLiner: 'Display migration package contents' },\n ]);\n addGlobalOptions(command)\n .option('--config <path>', 'Path to prisma-next.config.ts')\n .option('--dot', 'Output in Graphviz DOT format')\n .option('--tree', 'Experimental condensed annotated tree renderer')\n .option('--ascii', 'Use ASCII glyphs for --tree (pipe-friendly)')\n .option('--legend', 'Print a key for the --tree glyphs and lane colors (implies --tree)')\n .action(async (options: MigrationGraphOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n const ui = createTerminalUI(flags);\n const result = await executeMigrationGraphCommand(options, flags, ui);\n const exitCode = handleResult(result, flags, ui, (graphResult) => {\n // Explicit format flags win over the auto-JSON default. `flags.json`\n // is auto-enabled when stdout is non-TTY (per CLI Style Guide §\n // JSON Semantics); without this ordering, `migration graph --dot |\n // dot -Tsvg` pipes JSON into the GraphViz binary, which then\n // errors. `--dot` is the more specific instruction; honour it.\n if (options.dot) {\n const lines = ['digraph migrations {'];\n for (const edge of graphResult.graph.migrationByHash.values()) {\n const from = edge.from.slice(0, 12);\n const to = edge.to.slice(0, 12);\n lines.push(` \"${from}\" -> \"${to}\" [label=\"${edge.dirName}\"];`);\n }\n lines.push('}');\n ui.output(lines.join('\\n'));\n } else if (flags.json) {\n const nodes = [...graphResult.graph.nodes];\n const edges = [...graphResult.graph.migrationByHash.values()].map((e) => ({\n dirName: e.dirName,\n from: e.from,\n to: e.to,\n migrationHash: e.migrationHash,\n }));\n ui.output(\n JSON.stringify({ ok: true, nodes, edges, summary: graphResult.summary }, null, 2),\n );\n } else if (!flags.quiet) {\n if (migrationGraphUsesTree(options)) {\n const refsByHash = new Map<string, string[]>();\n for (const ref of graphResult.refs) {\n const existing = refsByHash.get(ref.hash);\n refsByHash.set(ref.hash, existing ? [...existing, ref.name] : [ref.name]);\n }\n const rowModel = buildMigrationGraphRows(graphResult.graph, {\n ...(graphResult.contractHash !== null\n ? { contractHash: graphResult.contractHash }\n : {}),\n });\n const layout = buildMigrationGraphLayout(rowModel);\n const activeRef = graphResult.refs.find((ref) => ref.active);\n const treeOutput = renderMigrationGraphTree(layout, {\n refsByHash,\n ...(graphResult.contractHash !== null\n ? { contractHash: graphResult.contractHash }\n : {}),\n ...(activeRef !== undefined ? { activeRefName: activeRef.name } : {}),\n colorize: flags.color !== false,\n glyphMode: ui.resolveGlyphMode(options.ascii === true),\n });\n // Emit the rendered tree to stdout (same stream as flat `migration list`),\n // not through clack's `log.message` rail: the graph is the command's\n // result (and its own box-drawing is the only vertical structure it\n // should carry), not a status line that needs the prompt gutter.\n ui.output(treeOutput);\n ui.output(`\\n${graphResult.summary}`);\n } else {\n const renderInput = migrationGraphToRenderInput({\n graph: graphResult.graph,\n mode: 'offline',\n markerHash: undefined,\n contractHash: graphResult.contractHash ?? EMPTY_CONTRACT_HASH,\n refs: graphResult.refs,\n activeRefHash: undefined,\n activeRefName: undefined,\n edgeStatuses: [],\n });\n const graphOutput = graphRenderer.render(renderInput.graph, {\n ...renderInput.options,\n colorize: flags.color !== false,\n });\n ui.log(graphOutput);\n ui.log(`\\n${graphResult.summary}`);\n }\n }\n });\n process.exit(exitCode);\n });\n return command;\n}\n"],"mappings":";;;;;;;;;;;;;AAyCA,SAAgB,uBAAuB,SAG3B;CACV,OAAO,QAAQ,SAAS,QAAQ,QAAQ,WAAW;AACrD;;;;;;AAOA,SAAgB,0BACd,SACA,OACS;CACT,OACE,QAAQ,WAAW,QAAQ,QAAQ,QAAQ,QAAQ,MAAM,SAAS,QAAQ,MAAM,UAAU;AAE9F;AAUA,eAAsB,6BACpB,SACA,OACA,IAC2D;CAC3D,MAAM,SAAS,MAAM,WAAW,QAAQ,MAAM;CAC9C,MAAM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GAAG,UAAU,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC;IAC1E;IAMA,MAAM,SAAS,0BALE,wBAAwB,YAAY,OAAO,EAC1D,GAAI,YAAY,iBAAiB,OAC7B,EAAE,cAAc,YAAY,aAAa,IACzC,CAAC,EACP,CACgD,CAAC;IACjD,MAAM,YAAY,YAAY,KAAK,MAAM,QAAQ,IAAI,MAAM;IAC3D,MAAM,aAAa,yBAAyB,QAAQ;KAClD;KACA,GAAI,YAAY,iBAAiB,OAC7B,EAAE,cAAc,YAAY,aAAa,IACzC,CAAC;KACL,GAAI,cAAc,KAAA,IAAY,EAAE,eAAe,UAAU,KAAK,IAAI,CAAC;KACnE,UAAU,MAAM,UAAU;KAC1B,WAAW,GAAG,iBAAiB,QAAQ,UAAU,IAAI;IACvD,CAAC;IAKD,GAAG,OAAO,UAAU;IACpB,GAAG,OAAO,KAAK,YAAY,SAAS;GACtC,OAAO;IACL,MAAM,cAAc,4BAA4B;KAC9C,OAAO,YAAY;KACnB,MAAM;KACN,YAAY,KAAA;KACZ,cAAc,YAAY,gBAAgB;KAC1C,MAAM,YAAY;KAClB,eAAe,KAAA;KACf,eAAe,KAAA;KACf,cAAc,CAAC;IACjB,CAAC;IACD,MAAM,cAAc,cAAc,OAAO,YAAY,OAAO;KAC1D,GAAG,YAAY;KACf,UAAU,MAAM,UAAU;IAC5B,CAAC;IACD,GAAG,IAAI,WAAW;IAClB,GAAG,IAAI,KAAK,YAAY,SAAS;GACnC;EAEJ,CAAC;EACD,QAAQ,KAAK,QAAQ;CACvB,CAAC;CACH,OAAO;AACT"}
1
+ {"version":3,"file":"migration-graph.mjs","names":[],"sources":["../../src/commands/migration-graph.ts"],"sourcesContent":["import type { MigrationGraph } from '@prisma-next/migration-tools/graph';\nimport { ok, type Result } from '@prisma-next/utils/result';\nimport { Command } from 'commander';\nimport { loadConfig } from '../config-loader';\nimport type { CliStructuredError } from '../utils/cli-errors';\nimport {\n addGlobalOptions,\n resolveMigrationPaths,\n setCommandDescriptions,\n setCommandExamples,\n setCommandSeeAlso,\n} from '../utils/command-helpers';\nimport { buildReadAggregate } from '../utils/contract-space-aggregate-loader';\nimport { buildMigrationGraphLayout } from '../utils/formatters/migration-graph-layout';\nimport { buildMigrationGraphRows } from '../utils/formatters/migration-graph-rows';\nimport {\n renderMigrationGraphLegend,\n renderMigrationGraphTree,\n} from '../utils/formatters/migration-graph-tree-render';\nimport { formatStyledHeader } from '../utils/formatters/styled';\nimport type { CommonCommandOptions } from '../utils/global-flags';\nimport { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';\nimport type { StatusRef } from '../utils/migration-types';\nimport { handleResult } from '../utils/result-handler';\nimport { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';\n\ninterface MigrationGraphOptions extends CommonCommandOptions {\n readonly config?: string;\n readonly dot?: boolean;\n readonly ascii?: boolean;\n readonly legend?: boolean;\n}\n\n/**\n * The legend is decoration printed alongside the command header on stderr, so\n * it is suppressed for the machine-readable / silent paths (`--json`, `--dot`,\n * `--quiet`) exactly as the header is.\n */\nexport function migrationGraphShowsLegend(\n options: { readonly legend?: boolean; readonly dot?: boolean },\n flags: GlobalFlags,\n): boolean {\n return (\n options.legend === true && options.dot !== true && flags.json !== true && flags.quiet !== true\n );\n}\n\nexport interface MigrationGraphResult {\n readonly ok: true;\n readonly graph: MigrationGraph;\n readonly contractHash: string | null;\n readonly refs: readonly StatusRef[];\n readonly summary: string;\n}\n\nexport async function executeMigrationGraphCommand(\n options: MigrationGraphOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n): Promise<Result<MigrationGraphResult, CliStructuredError>> {\n const config = await loadConfig(options.config);\n const { configPath, appMigrationsRelative, migrationsDir } = resolveMigrationPaths(\n options.config,\n config,\n );\n\n if (!flags.json && !flags.quiet) {\n const header = formatStyledHeader({\n command: 'migration graph',\n description: 'Show the migration graph topology',\n details: [\n { label: 'config', value: configPath },\n { label: 'migrations', value: appMigrationsRelative },\n ],\n flags,\n });\n ui.stderr(header);\n if (migrationGraphShowsLegend(options, flags)) {\n ui.stderr(\n renderMigrationGraphLegend({\n colorize: flags.color !== false,\n glyphMode: ui.resolveGlyphMode(options.ascii === true),\n }),\n );\n ui.stderr('');\n }\n }\n\n const loaded = await buildReadAggregate(config, { migrationsDir });\n if (!loaded.ok) {\n return loaded;\n }\n\n const { aggregate, contractHash } = loaded.value;\n const graph = aggregate.app.graph();\n const refs: readonly StatusRef[] = Object.entries(aggregate.app.refs).map(([name, entry]) => ({\n name,\n hash: entry.hash,\n active: false,\n }));\n\n return ok({\n ok: true,\n graph,\n contractHash,\n refs,\n summary: `${graph.nodes.size} node(s), ${graph.migrationByHash.size} edge(s)`,\n });\n}\n\nexport function createMigrationGraphCommand(): Command {\n const command = new Command('graph');\n setCommandDescriptions(\n command,\n 'Show the migration graph topology',\n 'Renders the migration graph topology. Offline — does not consult\\n' +\n 'the database. --ascii swaps box-drawing for pipe-friendly ASCII glyphs.\\n' +\n 'Use --json for machine-readable output, or --dot for Graphviz DOT\\n' +\n 'format.',\n );\n setCommandExamples(command, [\n 'prisma-next migration graph',\n 'prisma-next migration graph --json',\n 'prisma-next migration graph --dot',\n 'prisma-next migration graph --ascii',\n 'prisma-next migration graph --legend',\n ]);\n setCommandSeeAlso(command, [\n { verb: 'migration status', oneLiner: 'Show migration path and pending status' },\n { verb: 'migration log', oneLiner: 'Show executed migration history' },\n { verb: 'migration list', oneLiner: 'List on-disk migrations' },\n { verb: 'migration show', oneLiner: 'Display migration package contents' },\n ]);\n addGlobalOptions(command)\n .option('--config <path>', 'Path to prisma-next.config.ts')\n .option('--dot', 'Output in Graphviz DOT format')\n .option('--ascii', 'Use ASCII glyphs (pipe-friendly)')\n .option('--legend', 'Print a key for the tree glyphs and lane colors')\n .action(async (options: MigrationGraphOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n const ui = createTerminalUI(flags);\n const result = await executeMigrationGraphCommand(options, flags, ui);\n const exitCode = handleResult(result, flags, ui, (graphResult) => {\n if (options.dot) {\n const lines = ['digraph migrations {'];\n for (const edge of graphResult.graph.migrationByHash.values()) {\n const from = edge.from.slice(0, 12);\n const to = edge.to.slice(0, 12);\n lines.push(` \"${from}\" -> \"${to}\" [label=\"${edge.dirName}\"];`);\n }\n lines.push('}');\n ui.output(lines.join('\\n'));\n } else if (flags.json) {\n const nodes = [...graphResult.graph.nodes];\n const edges = [...graphResult.graph.migrationByHash.values()].map((e) => ({\n dirName: e.dirName,\n from: e.from,\n to: e.to,\n migrationHash: e.migrationHash,\n }));\n ui.output(\n JSON.stringify({ ok: true, nodes, edges, summary: graphResult.summary }, null, 2),\n );\n } else if (!flags.quiet) {\n const refsByHash = new Map<string, string[]>();\n for (const ref of graphResult.refs) {\n const existing = refsByHash.get(ref.hash);\n refsByHash.set(ref.hash, existing ? [...existing, ref.name] : [ref.name]);\n }\n const rowModel = buildMigrationGraphRows(graphResult.graph, {\n ...(graphResult.contractHash !== null\n ? { contractHash: graphResult.contractHash }\n : {}),\n });\n const layout = buildMigrationGraphLayout(rowModel);\n const activeRef = graphResult.refs.find((ref) => ref.active);\n const treeOutput = renderMigrationGraphTree(layout, {\n refsByHash,\n ...(graphResult.contractHash !== null\n ? { contractHash: graphResult.contractHash }\n : {}),\n ...(activeRef !== undefined ? { activeRefName: activeRef.name } : {}),\n colorize: flags.color !== false,\n glyphMode: ui.resolveGlyphMode(options.ascii === true),\n });\n ui.output(treeOutput);\n ui.output(`\\n${graphResult.summary}`);\n }\n });\n process.exit(exitCode);\n });\n return command;\n}\n"],"mappings":";;;;;;;;;;;;AAsCA,SAAgB,0BACd,SACA,OACS;CACT,OACE,QAAQ,WAAW,QAAQ,QAAQ,QAAQ,QAAQ,MAAM,SAAS,QAAQ,MAAM,UAAU;AAE9F;AAUA,eAAsB,6BACpB,SACA,OACA,IAC2D;CAC3D,MAAM,SAAS,MAAM,WAAW,QAAQ,MAAM;CAC9C,MAAM,EAAE,YAAY,uBAAuB,kBAAkB,sBAC3D,QAAQ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EAC1D,GAAI,YAAY,iBAAiB,OAC7B,EAAE,cAAc,YAAY,aAAa,IACzC,CAAC,EACP,CACgD,CAAC;IACjD,MAAM,YAAY,YAAY,KAAK,MAAM,QAAQ,IAAI,MAAM;IAC3D,MAAM,aAAa,yBAAyB,QAAQ;KAClD;KACA,GAAI,YAAY,iBAAiB,OAC7B,EAAE,cAAc,YAAY,aAAa,IACzC,CAAC;KACL,GAAI,cAAc,KAAA,IAAY,EAAE,eAAe,UAAU,KAAK,IAAI,CAAC;KACnE,UAAU,MAAM,UAAU;KAC1B,WAAW,GAAG,iBAAiB,QAAQ,UAAU,IAAI;IACvD,CAAC;IACD,GAAG,OAAO,UAAU;IACpB,GAAG,OAAO,KAAK,YAAY,SAAS;GACtC;EACF,CAAC;EACD,QAAQ,KAAK,QAAQ;CACvB,CAAC;CACH,OAAO;AACT"}
@@ -1,32 +1,21 @@
1
- import { N as CliStructuredError } from "../types-DiC683UW.mjs";
1
+ import { N as CliStructuredError } from "../types-BdS8PoKM.mjs";
2
2
  import { n as GlobalFlags, t as CommonCommandOptions } from "../global-flags-DG4uY5tV.mjs";
3
3
  import { n as GlyphMode, t as TerminalUI } from "../terminal-ui-C3xGyxW-.mjs";
4
+ import { n as MigrationListResult, r as MigrationSpaceListEntry } from "../migration-list-types-DV9PBc7Z.mjs";
4
5
  import { Command } from "commander";
5
6
  import { Result } from "@prisma-next/utils/result";
6
- import { ContractSpaceAggregate } from "@prisma-next/migration-tools/aggregate";
7
+ import { ContractSpaceAggregate, ContractSpaceMember } from "@prisma-next/migration-tools/aggregate";
7
8
 
8
- //#region src/utils/formatters/migration-list-types.d.ts
9
- interface MigrationListEntry {
10
- readonly dirName: string;
11
- readonly from: string | null;
12
- readonly to: string;
13
- readonly migrationHash: string;
14
- readonly operationCount: number;
15
- readonly createdAt: string;
16
- readonly refs: readonly string[];
17
- readonly providedInvariants: readonly string[];
18
- }
19
- interface MigrationSpaceListEntry {
20
- readonly spaceId: string;
21
- readonly migrations: readonly MigrationListEntry[];
22
- }
23
- interface MigrationListResult {
24
- readonly ok: true;
25
- readonly spaces: readonly MigrationSpaceListEntry[];
26
- readonly summary: string;
27
- }
28
- //#endregion
29
9
  //#region src/commands/migration-list.d.ts
10
+ /**
11
+ * Ref names decorating a space's destination contract hashes. The
12
+ * tolerant `member.refs` deliberately omits the structural `head.json`;
13
+ * for extension spaces the old enumerator surfaced it as a `head`
14
+ * decoration on the tip migration, so fold `member.headRef` back in to
15
+ * keep that output. The app space synthesises its head, so it carries
16
+ * no on-disk `head` ref to restore.
17
+ */
18
+ declare function listRefsByContractHash(member: ContractSpaceMember): ReadonlyMap<string, readonly string[]>;
30
19
  /**
31
20
  * Project the loaded {@link ContractSpaceAggregate} into the render-ready
32
21
  * {@link MigrationSpaceListEntry} rows `migration list` displays.
@@ -76,5 +65,5 @@ declare function runMigrationList(inputs: RunMigrationListInputs): Result<Migrat
76
65
  declare function executeMigrationListCommand(options: MigrationListOptions, flags: GlobalFlags, ui: TerminalUI): Promise<Result<MigrationListResult, CliStructuredError>>;
77
66
  declare function createMigrationListCommand(): Command;
78
67
  //#endregion
79
- export { MigrationListHumanRenderOptions, RunMigrationListInputs, createMigrationListCommand, executeMigrationListCommand, migrationSpaceListEntriesFromAggregate, renderMigrationListHumanOutput, runMigrationList };
68
+ export { MigrationListHumanRenderOptions, RunMigrationListInputs, createMigrationListCommand, executeMigrationListCommand, listRefsByContractHash, migrationSpaceListEntriesFromAggregate, renderMigrationListHumanOutput, runMigrationList };
80
69
  //# sourceMappingURL=migration-list.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration-list.d.mts","names":[],"sources":["../../src/utils/formatters/migration-list-types.ts","../../src/commands/migration-list.ts"],"mappings":";;;;;;;;UAAiB,kBAAA;EAAA,SACN,OAAA;EAAA,SACA,IAAA;EAAA,SACA,EAAA;EAAA,SACA,aAAA;EAAA,SACA,cAAA;EAAA,SACA,SAAA;EAAA,SACA,IAAA;EAAA,SACA,kBAAA;AAAA;A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A;AAAA,UAGM,+BAAA;EAAA,SACN,SAAA,EAAW,SAAS;EAAA,SACpB,QAAA;AAAA;AAAA,iBAGK,8BAAA,CACd,MAAA,EAAQ,mBAAA,EACR,OAAA,EAAS,+BAA+B;;;;;;AAV1B;AAGhB;;UAuBiB,sBAAA;EAAA,SACN,MAAA,WAAiB,uBAAuB;EAAA,SACxC,WAAA;AAAA;;;AAvBQ;AAGnB;;;;;;iBAwCgB,gBAAA,CACd,MAAA,EAAQ,sBAAA,GACP,MAAA,CAAO,mBAAA,EAAqB,kBAAA;;;AAxCW;AAgB1C;;iBAqDsB,2BAAA,CACpB,OAAA,EAAS,oBAAA,EACT,KAAA,EAAO,WAAA,EACP,EAAA,EAAI,UAAA,GACH,OAAA,CAAQ,MAAA,CAAO,mBAAA,EAAqB,kBAAA;AAAA,iBAqCvB,0BAAA,CAAA,GAA8B,OAAO"}
@@ -1,7 +1,7 @@
1
1
  import { t as loadConfig } from "../config-loader-B6sJjXTv.mjs";
2
- import { $ as errorSpaceNotFound, E as formatStyledHeader, V as errorInvalidSpaceId, _ as parseGlobalFlagsOrExit, b as handleResult, d as setCommandSeeAlso, l as setCommandDescriptions, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, v as createTerminalUI } from "../command-helpers-Cmdqyhz9.mjs";
3
- import { r as buildReadAggregate } from "../contract-space-aggregate-loader-CirAEsM8.mjs";
4
- import { a as renderMigrationListWithStyle, r as createAnsiMigrationListStyler } from "../migration-graph-tree-render-BQdhKBO8.mjs";
2
+ import { B as errorInvalidSpaceId, Q as errorSpaceNotFound, T as formatStyledHeader, _ as createTerminalUI, d as setCommandSeeAlso, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from "../command-helpers-DlrUCI7s.mjs";
3
+ import { n as buildReadAggregate } from "../contract-space-aggregate-loader-Dvl1SJ4C.mjs";
4
+ import { a as renderMigrationListWithStyle, r as createAnsiMigrationListStyler } from "../migration-graph-tree-render-DyDBuJEX.mjs";
5
5
  import { Command } from "commander";
6
6
  import { ifDefined } from "@prisma-next/utils/defined";
7
7
  import { notOk, ok } from "@prisma-next/utils/result";
@@ -183,6 +183,6 @@ function createMigrationListCommand() {
183
183
  return command;
184
184
  }
185
185
  //#endregion
186
- export { createMigrationListCommand, executeMigrationListCommand, migrationSpaceListEntriesFromAggregate, renderMigrationListHumanOutput, runMigrationList };
186
+ export { createMigrationListCommand, executeMigrationListCommand, listRefsByContractHash, migrationSpaceListEntriesFromAggregate, renderMigrationListHumanOutput, runMigrationList };
187
187
 
188
188
  //# sourceMappingURL=migration-list.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration-list.mjs","names":[],"sources":["../../src/commands/migration-list.ts"],"sourcesContent":["import type {\n ContractSpaceAggregate,\n ContractSpaceMember,\n} from '@prisma-next/migration-tools/aggregate';\nimport { HEAD_REF_NAME, refsByContractHash } from '@prisma-next/migration-tools/refs';\nimport {\n APP_SPACE_ID,\n isValidSpaceId,\n listContractSpaceDirectories,\n RESERVED_SPACE_SUBDIR_NAMES,\n} from '@prisma-next/migration-tools/spaces';\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 type CliStructuredError,\n errorInvalidSpaceId,\n errorSpaceNotFound,\n} from '../utils/cli-errors';\nimport {\n addGlobalOptions,\n resolveMigrationPaths,\n setCommandDescriptions,\n setCommandExamples,\n setCommandSeeAlso,\n} from '../utils/command-helpers';\nimport { buildReadAggregate } from '../utils/contract-space-aggregate-loader';\nimport { renderMigrationListWithStyle } from '../utils/formatters/migration-list-render';\nimport { createAnsiMigrationListStyler } from '../utils/formatters/migration-list-styler';\nimport type {\n MigrationListEntry,\n MigrationListResult,\n MigrationSpaceListEntry,\n} from '../utils/formatters/migration-list-types';\nimport { formatStyledHeader } from '../utils/formatters/styled';\nimport type { CommonCommandOptions } from '../utils/global-flags';\nimport { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';\nimport type { GlyphMode } from '../utils/glyph-mode';\nimport { handleResult } from '../utils/result-handler';\nimport { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';\n\nfunction compareSpaceIds(a: string, b: string): number {\n if (a === APP_SPACE_ID) return b === APP_SPACE_ID ? 0 : -1;\n if (b === APP_SPACE_ID) return 1;\n if (a < b) return -1;\n if (a > b) return 1;\n return 0;\n}\n\nfunction compareDirNamesDescending(a: MigrationListEntry, b: MigrationListEntry): number {\n if (a.dirName < b.dirName) return 1;\n if (a.dirName > b.dirName) return -1;\n return 0;\n}\n\n/**\n * Ref names decorating a space's destination contract hashes. The\n * tolerant `member.refs` deliberately omits the structural `head.json`;\n * for extension spaces the old enumerator surfaced it as a `head`\n * decoration on the tip migration, so fold `member.headRef` back in to\n * keep that output. The app space synthesises its head, so it carries\n * no on-disk `head` ref to restore.\n */\nfunction listRefsByContractHash(\n member: ContractSpaceMember,\n): ReadonlyMap<string, readonly string[]> {\n const byHash = new Map(refsByContractHash(member.refs));\n if (member.spaceId !== APP_SPACE_ID && member.headRef !== null) {\n const hash = member.headRef.hash;\n const bucket = byHash.get(hash) ?? [];\n if (!bucket.includes(HEAD_REF_NAME)) {\n byHash.set(hash, [...bucket, HEAD_REF_NAME].sort());\n }\n }\n return byHash;\n}\n\nasync function orderedOnDiskSpaceIds(projectMigrationsDir: string): Promise<readonly string[]> {\n const candidateDirs = await listContractSpaceDirectories(projectMigrationsDir);\n return candidateDirs\n .filter((name) => !RESERVED_SPACE_SUBDIR_NAMES.has(name))\n .filter(isValidSpaceId)\n .sort(compareSpaceIds);\n}\n\n/**\n * Project the loaded {@link ContractSpaceAggregate} into the render-ready\n * {@link MigrationSpaceListEntry} rows `migration list` displays.\n *\n * Space membership matches the on-disk contract-space directories (not the\n * aggregate's always-present synthesized app member when `migrations/app/`\n * is absent); package and ref data come from `aggregate.space(id)`.\n */\nexport async function migrationSpaceListEntriesFromAggregate(\n aggregate: ContractSpaceAggregate,\n projectMigrationsDir: string,\n): Promise<readonly MigrationSpaceListEntry[]> {\n const spaceIds = await orderedOnDiskSpaceIds(projectMigrationsDir);\n const spaces: MigrationSpaceListEntry[] = [];\n\n for (const spaceId of spaceIds) {\n const member = aggregate.space(spaceId);\n if (member === undefined) {\n continue;\n }\n const refsByHash = listRefsByContractHash(member);\n const migrations: MigrationListEntry[] = member.packages\n .map((pkg) => ({\n dirName: pkg.dirName,\n from: pkg.metadata.from,\n to: pkg.metadata.to,\n migrationHash: pkg.metadata.migrationHash,\n operationCount: pkg.ops.length,\n createdAt: pkg.metadata.createdAt,\n refs: refsByHash.get(pkg.metadata.to) ?? [],\n providedInvariants: pkg.metadata.providedInvariants,\n }))\n .sort(compareDirNamesDescending);\n\n spaces.push({ spaceId, migrations });\n }\n\n return spaces;\n}\n\ninterface MigrationListOptions extends CommonCommandOptions {\n readonly config?: string;\n readonly space?: string;\n readonly ascii?: boolean;\n}\n\nexport interface MigrationListHumanRenderOptions {\n readonly glyphMode: GlyphMode;\n readonly useColor: boolean;\n}\n\nexport function renderMigrationListHumanOutput(\n result: MigrationListResult,\n options: MigrationListHumanRenderOptions,\n): string {\n const styler = createAnsiMigrationListStyler({ useColor: options.useColor });\n return renderMigrationListWithStyle(result, styler, options.glyphMode, {\n colorize: options.useColor,\n });\n}\n\n/**\n * Inputs for {@link runMigrationList} — the policy core of `migration list`\n * that tests exercise directly.\n *\n * The core does not call `loadConfig`, parse CLI flags, render a styled\n * header, or write to any stream. Enumeration is supplied by the caller\n * (the CLI shell builds it from {@link migrationSpaceListEntriesFromAggregate}).\n */\nexport interface RunMigrationListInputs {\n readonly spaces: readonly MigrationSpaceListEntry[];\n readonly spaceFilter?: string;\n}\n\nfunction computeSummary(spaces: readonly MigrationSpaceListEntry[]): string {\n const totalMigrations = spaces.reduce((count, space) => count + space.migrations.length, 0);\n if (spaces.length <= 1) {\n return `${totalMigrations} migration(s) on disk`;\n }\n return `${totalMigrations} migration(s) across ${spaces.length} contract space(s)`;\n}\n\n/**\n * Policy core of `migration list`: validates `--space`, narrows the\n * pre-enumerated spaces, and assembles a {@link MigrationListResult}.\n *\n * - `migrations/` missing or contains no valid space directories →\n * caller passes `spaces: []`; this synthesizes `[{ spaceId: APP_SPACE_ID, migrations: [] }]`.\n * - `--space <id>` on an existing-but-empty space → `{ spaceId, migrations: [] }` in the input.\n * - `--space <id>` on a non-existent (or reserved) space → `SPACE_NOT_FOUND`.\n */\nexport function runMigrationList(\n inputs: RunMigrationListInputs,\n): Result<MigrationListResult, CliStructuredError> {\n const { spaces, spaceFilter } = inputs;\n\n if (spaceFilter !== undefined && !isValidSpaceId(spaceFilter)) {\n return notOk(errorInvalidSpaceId(spaceFilter));\n }\n\n if (spaceFilter !== undefined && !spaces.some((s) => s.spaceId === spaceFilter)) {\n return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()));\n }\n\n const scopedSpaces =\n spaceFilter !== undefined ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;\n\n const resultSpaces: readonly MigrationSpaceListEntry[] =\n scopedSpaces.length === 0 ? [{ spaceId: APP_SPACE_ID, migrations: [] }] : scopedSpaces;\n\n return ok({\n ok: true,\n spaces: resultSpaces,\n summary: computeSummary(resultSpaces),\n });\n}\n\n/**\n * CLI shell: loads config, resolves paths, prints the styled header on\n * stderr (interactive mode only), and delegates to {@link runMigrationList}.\n * Kept intentionally thin so the unit-testable surface lives in the core.\n */\nexport async function executeMigrationListCommand(\n options: MigrationListOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n): Promise<Result<MigrationListResult, CliStructuredError>> {\n const config = await loadConfig(options.config);\n const { configPath, migrationsDir, migrationsRelative } = resolveMigrationPaths(\n options.config,\n config,\n );\n\n if (!flags.json && !flags.quiet) {\n const header = formatStyledHeader({\n command: 'migration list',\n description: 'List on-disk migrations per contract space',\n details: [\n { label: 'config', value: configPath },\n { label: 'migrations', value: migrationsRelative },\n ...(options.space !== undefined ? [{ label: 'space', value: options.space }] : []),\n ],\n flags,\n });\n ui.stderr(header);\n }\n\n const loaded = await buildReadAggregate(config, { migrationsDir });\n if (!loaded.ok) {\n return notOk(loaded.failure);\n }\n\n const spaces = await migrationSpaceListEntriesFromAggregate(\n loaded.value.aggregate,\n migrationsDir,\n );\n\n return runMigrationList({\n spaces,\n ...ifDefined('spaceFilter', options.space),\n });\n}\n\nexport function createMigrationListCommand(): Command {\n const command = new Command('list');\n setCommandDescriptions(\n command,\n 'List on-disk migrations per contract space',\n 'Enumerates every on-disk migration under migrations/<space>/ for every\\n' +\n 'contract space found on disk. Offline — does not consult the database.\\n' +\n 'Human output draws the shared migration graph tree with operation counts,\\n' +\n 'invariants on each migration row, and refs on destination contract nodes.\\n' +\n 'Pass --space <id> to narrow to one contract space. --ascii forces ASCII\\n' +\n 'tree glyphs (orthogonal to --no-color).',\n );\n setCommandExamples(command, [\n 'prisma-next migration list',\n 'prisma-next migration list --space app',\n 'prisma-next migration list --ascii',\n 'prisma-next migration list --json',\n ]);\n setCommandSeeAlso(command, [\n { verb: 'migration status', oneLiner: 'Show migration path and pending status' },\n { verb: 'migration log', oneLiner: 'Show executed migration history' },\n { verb: 'migration graph', oneLiner: 'Show the migration graph topology' },\n { verb: 'migration show', oneLiner: 'Display migration package contents' },\n ]);\n addGlobalOptions(command)\n .option('--config <path>', 'Path to prisma-next.config.ts')\n .option('--space <id>', 'Narrow output to a single contract space')\n .option('--ascii', 'Use ASCII kind glyphs (pipe-friendly)')\n .action(async (options: MigrationListOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n const ui = createTerminalUI(flags);\n const result = await executeMigrationListCommand(options, flags, ui);\n const exitCode = handleResult(result, flags, ui, (listResult) => {\n if (flags.json) {\n ui.output(JSON.stringify(listResult, null, 2));\n } else if (!flags.quiet) {\n ui.output(\n renderMigrationListHumanOutput(listResult, {\n glyphMode: ui.resolveGlyphMode(options.ascii === true),\n useColor: ui.useColor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EAEjC,MAAM,WAAW,aAAa,MADT,4BAA4B,SAAS,OAAO,EAAE,GAC7B,OAAO,KAAK,eAAe;GAC/D,IAAI,MAAM,MACR,GAAG,OAAO,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,OAChB,GAAG,OACD,+BAA+B,YAAY;IACzC,WAAW,GAAG,iBAAiB,QAAQ,UAAU,IAAI;IACrD,UAAU,GAAG;GACf,CAAC,CACH;EAEJ,CAAC;EACD,QAAQ,KAAK,QAAQ;CACvB,CAAC;CACH,OAAO;AACT"}
1
+ {"version":3,"file":"migration-list.mjs","names":[],"sources":["../../src/commands/migration-list.ts"],"sourcesContent":["import type {\n ContractSpaceAggregate,\n ContractSpaceMember,\n} from '@prisma-next/migration-tools/aggregate';\nimport { HEAD_REF_NAME, refsByContractHash } from '@prisma-next/migration-tools/refs';\nimport {\n APP_SPACE_ID,\n isValidSpaceId,\n listContractSpaceDirectories,\n RESERVED_SPACE_SUBDIR_NAMES,\n} from '@prisma-next/migration-tools/spaces';\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 type CliStructuredError,\n errorInvalidSpaceId,\n errorSpaceNotFound,\n} from '../utils/cli-errors';\nimport {\n addGlobalOptions,\n resolveMigrationPaths,\n setCommandDescriptions,\n setCommandExamples,\n setCommandSeeAlso,\n} from '../utils/command-helpers';\nimport { buildReadAggregate } from '../utils/contract-space-aggregate-loader';\nimport { renderMigrationListWithStyle } from '../utils/formatters/migration-list-render';\nimport { createAnsiMigrationListStyler } from '../utils/formatters/migration-list-styler';\nimport type {\n MigrationListEntry,\n MigrationListResult,\n MigrationSpaceListEntry,\n} from '../utils/formatters/migration-list-types';\nimport { formatStyledHeader } from '../utils/formatters/styled';\nimport type { CommonCommandOptions } from '../utils/global-flags';\nimport { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';\nimport type { GlyphMode } from '../utils/glyph-mode';\nimport { handleResult } from '../utils/result-handler';\nimport { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';\n\nfunction compareSpaceIds(a: string, b: string): number {\n if (a === APP_SPACE_ID) return b === APP_SPACE_ID ? 0 : -1;\n if (b === APP_SPACE_ID) return 1;\n if (a < b) return -1;\n if (a > b) return 1;\n return 0;\n}\n\nfunction compareDirNamesDescending(a: MigrationListEntry, b: MigrationListEntry): number {\n if (a.dirName < b.dirName) return 1;\n if (a.dirName > b.dirName) return -1;\n return 0;\n}\n\n/**\n * Ref names decorating a space's destination contract hashes. The\n * tolerant `member.refs` deliberately omits the structural `head.json`;\n * for extension spaces the old enumerator surfaced it as a `head`\n * decoration on the tip migration, so fold `member.headRef` back in to\n * keep that output. The app space synthesises its head, so it carries\n * no on-disk `head` ref to restore.\n */\nexport function listRefsByContractHash(\n member: ContractSpaceMember,\n): ReadonlyMap<string, readonly string[]> {\n const byHash = new Map(refsByContractHash(member.refs));\n if (member.spaceId !== APP_SPACE_ID && member.headRef !== null) {\n const hash = member.headRef.hash;\n const bucket = byHash.get(hash) ?? [];\n if (!bucket.includes(HEAD_REF_NAME)) {\n byHash.set(hash, [...bucket, HEAD_REF_NAME].sort());\n }\n }\n return byHash;\n}\n\nasync function orderedOnDiskSpaceIds(projectMigrationsDir: string): Promise<readonly string[]> {\n const candidateDirs = await listContractSpaceDirectories(projectMigrationsDir);\n return candidateDirs\n .filter((name) => !RESERVED_SPACE_SUBDIR_NAMES.has(name))\n .filter(isValidSpaceId)\n .sort(compareSpaceIds);\n}\n\n/**\n * Project the loaded {@link ContractSpaceAggregate} into the render-ready\n * {@link MigrationSpaceListEntry} rows `migration list` displays.\n *\n * Space membership matches the on-disk contract-space directories (not the\n * aggregate's always-present synthesized app member when `migrations/app/`\n * is absent); package and ref data come from `aggregate.space(id)`.\n */\nexport async function migrationSpaceListEntriesFromAggregate(\n aggregate: ContractSpaceAggregate,\n projectMigrationsDir: string,\n): Promise<readonly MigrationSpaceListEntry[]> {\n const spaceIds = await orderedOnDiskSpaceIds(projectMigrationsDir);\n const spaces: MigrationSpaceListEntry[] = [];\n\n for (const spaceId of spaceIds) {\n const member = aggregate.space(spaceId);\n if (member === undefined) {\n continue;\n }\n const refsByHash = listRefsByContractHash(member);\n const migrations: MigrationListEntry[] = member.packages\n .map((pkg) => ({\n dirName: pkg.dirName,\n from: pkg.metadata.from,\n to: pkg.metadata.to,\n migrationHash: pkg.metadata.migrationHash,\n operationCount: pkg.ops.length,\n createdAt: pkg.metadata.createdAt,\n refs: refsByHash.get(pkg.metadata.to) ?? [],\n providedInvariants: pkg.metadata.providedInvariants,\n }))\n .sort(compareDirNamesDescending);\n\n spaces.push({ spaceId, migrations });\n }\n\n return spaces;\n}\n\ninterface MigrationListOptions extends CommonCommandOptions {\n readonly config?: string;\n readonly space?: string;\n readonly ascii?: boolean;\n}\n\nexport interface MigrationListHumanRenderOptions {\n readonly glyphMode: GlyphMode;\n readonly useColor: boolean;\n}\n\nexport function renderMigrationListHumanOutput(\n result: MigrationListResult,\n options: MigrationListHumanRenderOptions,\n): string {\n const styler = createAnsiMigrationListStyler({ useColor: options.useColor });\n return renderMigrationListWithStyle(result, styler, options.glyphMode, {\n colorize: options.useColor,\n });\n}\n\n/**\n * Inputs for {@link runMigrationList} — the policy core of `migration list`\n * that tests exercise directly.\n *\n * The core does not call `loadConfig`, parse CLI flags, render a styled\n * header, or write to any stream. Enumeration is supplied by the caller\n * (the CLI shell builds it from {@link migrationSpaceListEntriesFromAggregate}).\n */\nexport interface RunMigrationListInputs {\n readonly spaces: readonly MigrationSpaceListEntry[];\n readonly spaceFilter?: string;\n}\n\nfunction computeSummary(spaces: readonly MigrationSpaceListEntry[]): string {\n const totalMigrations = spaces.reduce((count, space) => count + space.migrations.length, 0);\n if (spaces.length <= 1) {\n return `${totalMigrations} migration(s) on disk`;\n }\n return `${totalMigrations} migration(s) across ${spaces.length} contract space(s)`;\n}\n\n/**\n * Policy core of `migration list`: validates `--space`, narrows the\n * pre-enumerated spaces, and assembles a {@link MigrationListResult}.\n *\n * - `migrations/` missing or contains no valid space directories →\n * caller passes `spaces: []`; this synthesizes `[{ spaceId: APP_SPACE_ID, migrations: [] }]`.\n * - `--space <id>` on an existing-but-empty space → `{ spaceId, migrations: [] }` in the input.\n * - `--space <id>` on a non-existent (or reserved) space → `SPACE_NOT_FOUND`.\n */\nexport function runMigrationList(\n inputs: RunMigrationListInputs,\n): Result<MigrationListResult, CliStructuredError> {\n const { spaces, spaceFilter } = inputs;\n\n if (spaceFilter !== undefined && !isValidSpaceId(spaceFilter)) {\n return notOk(errorInvalidSpaceId(spaceFilter));\n }\n\n if (spaceFilter !== undefined && !spaces.some((s) => s.spaceId === spaceFilter)) {\n return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()));\n }\n\n const scopedSpaces =\n spaceFilter !== undefined ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;\n\n const resultSpaces: readonly MigrationSpaceListEntry[] =\n scopedSpaces.length === 0 ? [{ spaceId: APP_SPACE_ID, migrations: [] }] : scopedSpaces;\n\n return ok({\n ok: true,\n spaces: resultSpaces,\n summary: computeSummary(resultSpaces),\n });\n}\n\n/**\n * CLI shell: loads config, resolves paths, prints the styled header on\n * stderr (interactive mode only), and delegates to {@link runMigrationList}.\n * Kept intentionally thin so the unit-testable surface lives in the core.\n */\nexport async function executeMigrationListCommand(\n options: MigrationListOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n): Promise<Result<MigrationListResult, CliStructuredError>> {\n const config = await loadConfig(options.config);\n const { configPath, migrationsDir, migrationsRelative } = resolveMigrationPaths(\n options.config,\n config,\n );\n\n if (!flags.json && !flags.quiet) {\n const header = formatStyledHeader({\n command: 'migration list',\n description: 'List on-disk migrations per contract space',\n details: [\n { label: 'config', value: configPath },\n { label: 'migrations', value: migrationsRelative },\n ...(options.space !== undefined ? [{ label: 'space', value: options.space }] : []),\n ],\n flags,\n });\n ui.stderr(header);\n }\n\n const loaded = await buildReadAggregate(config, { migrationsDir });\n if (!loaded.ok) {\n return notOk(loaded.failure);\n }\n\n const spaces = await migrationSpaceListEntriesFromAggregate(\n loaded.value.aggregate,\n migrationsDir,\n );\n\n return runMigrationList({\n spaces,\n ...ifDefined('spaceFilter', options.space),\n });\n}\n\nexport function createMigrationListCommand(): Command {\n const command = new Command('list');\n setCommandDescriptions(\n command,\n 'List on-disk migrations per contract space',\n 'Enumerates every on-disk migration under migrations/<space>/ for every\\n' +\n 'contract space found on disk. Offline — does not consult the database.\\n' +\n 'Human output draws the shared migration graph tree with operation counts,\\n' +\n 'invariants on each migration row, and refs on destination contract nodes.\\n' +\n 'Pass --space <id> to narrow to one contract space. --ascii forces ASCII\\n' +\n 'tree glyphs (orthogonal to --no-color).',\n );\n setCommandExamples(command, [\n 'prisma-next migration list',\n 'prisma-next migration list --space app',\n 'prisma-next migration list --ascii',\n 'prisma-next migration list --json',\n ]);\n setCommandSeeAlso(command, [\n { verb: 'migration status', oneLiner: 'Show migration path and pending status' },\n { verb: 'migration log', oneLiner: 'Show executed migration history' },\n { verb: 'migration graph', oneLiner: 'Show the migration graph topology' },\n { verb: 'migration show', oneLiner: 'Display migration package contents' },\n ]);\n addGlobalOptions(command)\n .option('--config <path>', 'Path to prisma-next.config.ts')\n .option('--space <id>', 'Narrow output to a single contract space')\n .option('--ascii', 'Use ASCII kind glyphs (pipe-friendly)')\n .action(async (options: MigrationListOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n const ui = createTerminalUI(flags);\n const result = await executeMigrationListCommand(options, flags, ui);\n const exitCode = handleResult(result, flags, ui, (listResult) => {\n if (flags.json) {\n ui.output(JSON.stringify(listResult, null, 2));\n } else if (!flags.quiet) {\n ui.output(\n renderMigrationListHumanOutput(listResult, {\n glyphMode: ui.resolveGlyphMode(options.ascii === true),\n useColor: ui.useColor,\n }),\n );\n }\n });\n process.exit(exitCode);\n });\n return command;\n}\n"],"mappings":";;;;;;;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,OAAO,KAAK,eAAe;GAC/D,IAAI,MAAM,MACR,GAAG,OAAO,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,OAChB,GAAG,OACD,+BAA+B,YAAY;IACzC,WAAW,GAAG,iBAAiB,QAAQ,UAAU,IAAI;IACrD,UAAU,GAAG;GACf,CAAC,CACH;EAEJ,CAAC;EACD,QAAQ,KAAK,QAAQ;CACvB,CAAC;CACH,OAAO;AACT"}
@@ -1,4 +1,4 @@
1
- import { N as CliStructuredError } from "../types-DiC683UW.mjs";
1
+ import { N as CliStructuredError } from "../types-BdS8PoKM.mjs";
2
2
  import { n as GlobalFlags, t as CommonCommandOptions } from "../global-flags-DG4uY5tV.mjs";
3
3
  import { t as TerminalUI } from "../terminal-ui-C3xGyxW-.mjs";
4
4
  import { Command } from "commander";
@@ -1,2 +1,2 @@
1
- import { n as executeMigrationLogCommand, t as createMigrationLogCommand } from "../migration-log-BzPmks3c.mjs";
1
+ import { n as executeMigrationLogCommand, t as createMigrationLogCommand } from "../migration-log-Des4seHP.mjs";
2
2
  export { createMigrationLogCommand, executeMigrationLogCommand };
@@ -1,7 +1,7 @@
1
1
  import { t as loadConfig } from "../config-loader-B6sJjXTv.mjs";
2
- import { E as formatStyledHeader, Z as errorRuntime, _ as parseGlobalFlagsOrExit, b as handleResult, et as errorTargetMigrationNotSupported, j as CliStructuredError, l as setCommandDescriptions, nt as errorUnexpected, o as resolveContractPath, r as getTargetMigrations, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, v as createTerminalUI, z as errorFileNotFound } from "../command-helpers-Cmdqyhz9.mjs";
3
- import { t as assertFrameworkComponentsCompatible } from "../framework-components-DynSvww4.mjs";
4
- import { s as refusePackageCorruptionOnAggregate } from "../contract-space-aggregate-loader-CirAEsM8.mjs";
2
+ import { $ as errorTargetMigrationNotSupported, A as CliStructuredError, R as errorFileNotFound, T as formatStyledHeader, X as errorRuntime, _ as createTerminalUI, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, o as resolveContractPath, r as getTargetMigrations, s as resolveMigrationPaths, t as addGlobalOptions, tt as errorUnexpected, u as setCommandExamples, y as handleResult } from "../command-helpers-DlrUCI7s.mjs";
3
+ import { t as assertFrameworkComponentsCompatible } from "../framework-components-DCAT1uUC.mjs";
4
+ import { o as refusePackageCorruptionOnAggregate } from "../contract-space-aggregate-loader-Dvl1SJ4C.mjs";
5
5
  import { Command } from "commander";
6
6
  import { getEmittedArtifactPaths } from "@prisma-next/emitter";
7
7
  import { notOk, ok } from "@prisma-next/utils/result";
@@ -1,2 +1,2 @@
1
- import { n as formatMigrationPlanOutput, r as resolveBundleByPrefix, t as createMigrationPlanCommand } from "../migration-plan-CaeKCKp4.mjs";
1
+ import { n as formatMigrationPlanOutput, r as resolveBundleByPrefix, t as createMigrationPlanCommand } from "../migration-plan-DxDTBzGS.mjs";
2
2
  export { createMigrationPlanCommand, formatMigrationPlanOutput, resolveBundleByPrefix };
@@ -1,4 +1,4 @@
1
- import { N as CliStructuredError } from "../types-DiC683UW.mjs";
1
+ import { N as CliStructuredError } from "../types-BdS8PoKM.mjs";
2
2
  import { Command } from "commander";
3
3
  import { Result } from "@prisma-next/utils/result";
4
4
  import { OperationPreview } from "@prisma-next/framework-components/control";
@@ -1,7 +1,7 @@
1
1
  import { t as loadConfig } from "../config-loader-B6sJjXTv.mjs";
2
- import { E as formatStyledHeader, F as errorContractValidationFailed, Z as errorRuntime, _ as parseGlobalFlagsOrExit, b as handleResult, d as setCommandSeeAlso, it as mapRefResolutionError, l as setCommandDescriptions, nt as errorUnexpected, o as resolveContractPath, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, v as createTerminalUI, z as errorFileNotFound } from "../command-helpers-Cmdqyhz9.mjs";
3
- import { t as createControlClient } from "../client-BHe8szOW.mjs";
4
- import { a as formatMigrationShowOutput } from "../migrations-DQ1t3XFL.mjs";
2
+ import { P as errorContractValidationFailed, R as errorFileNotFound, T as formatStyledHeader, X as errorRuntime, _ as createTerminalUI, d as setCommandSeeAlso, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, o as resolveContractPath, rt as mapRefResolutionError, s as resolveMigrationPaths, t as addGlobalOptions, tt as errorUnexpected, u as setCommandExamples, y as handleResult } from "../command-helpers-DlrUCI7s.mjs";
3
+ import { t as createControlClient } from "../client-V7BkIQrQ.mjs";
4
+ import { a as formatMigrationShowOutput } from "../migrations-B3H6RTXb.mjs";
5
5
  import { Command } from "commander";
6
6
  import { ifDefined } from "@prisma-next/utils/defined";
7
7
  import { notOk, ok } from "@prisma-next/utils/result";