prisma-next 0.12.0-dev.17 → 0.12.0-dev.3

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 (87) hide show
  1. package/dist/cli.mjs +160 -177
  2. package/dist/cli.mjs.map +1 -1
  3. package/dist/{client-Cdxcme1x.mjs → client-KgJorIvG.mjs} +8 -21
  4. package/dist/client-KgJorIvG.mjs.map +1 -0
  5. package/dist/{command-helpers-Cmdqyhz9.mjs → command-helpers-Bbw1GbwL.mjs} +2 -32
  6. package/dist/{command-helpers-Cmdqyhz9.mjs.map → command-helpers-Bbw1GbwL.mjs.map} +1 -1
  7. package/dist/commands/contract-emit.mjs +1 -1
  8. package/dist/commands/contract-infer.mjs +1 -1
  9. package/dist/commands/db-init.mjs +4 -4
  10. package/dist/commands/db-schema.mjs +3 -3
  11. package/dist/commands/db-sign.mjs +4 -4
  12. package/dist/commands/db-update.mjs +5 -5
  13. package/dist/commands/db-verify.mjs +1 -1
  14. package/dist/commands/migrate.d.mts +1 -1
  15. package/dist/commands/migrate.mjs +5 -5
  16. package/dist/commands/migration-check.mjs +1 -1
  17. package/dist/commands/migration-graph.d.mts +5 -23
  18. package/dist/commands/migration-graph.d.mts.map +1 -1
  19. package/dist/commands/migration-graph.mjs +2 -2
  20. package/dist/commands/migration-list.d.mts +3 -3
  21. package/dist/commands/migration-list.mjs +2 -2
  22. package/dist/commands/migration-log.d.mts +3 -3
  23. package/dist/commands/migration-log.mjs +3 -3
  24. package/dist/commands/migration-new.mjs +3 -3
  25. package/dist/commands/migration-plan.d.mts +1 -1
  26. package/dist/commands/migration-plan.mjs +1 -1
  27. package/dist/commands/migration-show.d.mts +1 -1
  28. package/dist/commands/migration-show.mjs +3 -3
  29. package/dist/commands/migration-status.d.mts +1 -1
  30. package/dist/commands/migration-status.mjs +4 -4
  31. package/dist/commands/migration-status.mjs.map +1 -1
  32. package/dist/commands/ref.d.mts +1 -1
  33. package/dist/commands/ref.mjs +2 -2
  34. package/dist/{contract-at-errors-Cz0z5PJi.mjs → contract-at-errors-BxP-TOMl.mjs} +2 -2
  35. package/dist/{contract-at-errors-Cz0z5PJi.mjs.map → contract-at-errors-BxP-TOMl.mjs.map} +1 -1
  36. package/dist/{contract-emit-CC9jDOmu.mjs → contract-emit-D-4jrNve.mjs} +3 -3
  37. package/dist/{contract-emit-CC9jDOmu.mjs.map → contract-emit-D-4jrNve.mjs.map} +1 -1
  38. package/dist/{contract-emit-DPMij44i.mjs → contract-emit-DxcGl4Uq.mjs} +3 -3
  39. package/dist/{contract-emit-DPMij44i.mjs.map → contract-emit-DxcGl4Uq.mjs.map} +1 -1
  40. package/dist/{contract-infer-DaFPNrZH.mjs → contract-infer-D8uEbJuu.mjs} +3 -3
  41. package/dist/{contract-infer-DaFPNrZH.mjs.map → contract-infer-D8uEbJuu.mjs.map} +1 -1
  42. package/dist/{contract-space-aggregate-loader-CirAEsM8.mjs → contract-space-aggregate-loader-DvZwdkrr.mjs} +2 -2
  43. package/dist/{contract-space-aggregate-loader-CirAEsM8.mjs.map → contract-space-aggregate-loader-DvZwdkrr.mjs.map} +1 -1
  44. package/dist/{db-verify-BSA1a_W_.mjs → db-verify-v_vUKXTU.mjs} +4 -4
  45. package/dist/{db-verify-BSA1a_W_.mjs.map → db-verify-v_vUKXTU.mjs.map} +1 -1
  46. package/dist/exports/control-api.d.mts +1 -1
  47. package/dist/exports/control-api.d.mts.map +1 -1
  48. package/dist/exports/control-api.mjs +2 -2
  49. package/dist/exports/index.mjs +1 -1
  50. package/dist/exports/init-output.mjs +1 -1
  51. package/dist/{framework-components-DynSvww4.mjs → framework-components-fYXjz_in.mjs} +2 -2
  52. package/dist/{framework-components-DynSvww4.mjs.map → framework-components-fYXjz_in.mjs.map} +1 -1
  53. package/dist/{global-flags-DG4uY5tV.d.mts → global-flags-DEHjV8_s.d.mts} +1 -1
  54. package/dist/{global-flags-DG4uY5tV.d.mts.map → global-flags-DEHjV8_s.d.mts.map} +1 -1
  55. package/dist/{init-B6kKrmf7.mjs → init-Cv9UzWL5.mjs} +58 -5
  56. package/dist/init-Cv9UzWL5.mjs.map +1 -0
  57. package/dist/{inspect-live-schema-Dn56wDhG.mjs → inspect-live-schema-C6ohV_oQ.mjs} +3 -3
  58. package/dist/{inspect-live-schema-Dn56wDhG.mjs.map → inspect-live-schema-C6ohV_oQ.mjs.map} +1 -1
  59. package/dist/{migration-check-DzH1u-O1.mjs → migration-check-BiBJoYYW.mjs} +2 -2
  60. package/dist/{migration-check-DzH1u-O1.mjs.map → migration-check-BiBJoYYW.mjs.map} +1 -1
  61. package/dist/{migration-command-scaffold-V52dV2Tv.mjs → migration-command-scaffold-CjvwO6at.mjs} +3 -3
  62. package/dist/{migration-command-scaffold-V52dV2Tv.mjs.map → migration-command-scaffold-CjvwO6at.mjs.map} +1 -1
  63. package/dist/{migration-graph-Cm3oee8C.mjs → migration-graph-D7DVUElV.mjs} +80 -326
  64. package/dist/migration-graph-D7DVUElV.mjs.map +1 -0
  65. package/dist/{migration-plan-CaeKCKp4.mjs → migration-plan-9DJ7q7_z.mjs} +5 -5
  66. package/dist/{migration-plan-CaeKCKp4.mjs.map → migration-plan-9DJ7q7_z.mjs.map} +1 -1
  67. package/dist/{migration-types-CAQ-0TEE.d.mts → migration-types-D2FW63pr.d.mts} +1 -1
  68. package/dist/{migration-types-CAQ-0TEE.d.mts.map → migration-types-D2FW63pr.d.mts.map} +1 -1
  69. package/dist/{migrations-DQ1t3XFL.mjs → migrations-Cv2jxNNK.mjs} +2 -2
  70. package/dist/{migrations-DQ1t3XFL.mjs.map → migrations-Cv2jxNNK.mjs.map} +1 -1
  71. package/dist/{output-CF_hqzI-.mjs → output-B60Gw5fu.mjs} +1 -1
  72. package/dist/{output-CF_hqzI-.mjs.map → output-B60Gw5fu.mjs.map} +1 -1
  73. package/dist/{terminal-ui-C3xGyxW-.d.mts → terminal-ui-5Y6mrg93.d.mts} +1 -1
  74. package/dist/{terminal-ui-C3xGyxW-.d.mts.map → terminal-ui-5Y6mrg93.d.mts.map} +1 -1
  75. package/dist/{types-DiC683UW.d.mts → types-Dt_SfqFm.d.mts} +2 -8
  76. package/dist/{types-DiC683UW.d.mts.map → types-Dt_SfqFm.d.mts.map} +1 -1
  77. package/dist/{verify-CreSJ1Mz.mjs → verify-DCA9Sldu.mjs} +2 -2
  78. package/dist/{verify-CreSJ1Mz.mjs.map → verify-DCA9Sldu.mjs.map} +1 -1
  79. package/package.json +11 -11
  80. package/dist/client-Cdxcme1x.mjs.map +0 -1
  81. package/dist/commands/telemetry/index.d.mts +0 -7
  82. package/dist/commands/telemetry/index.d.mts.map +0 -1
  83. package/dist/commands/telemetry/index.mjs +0 -2
  84. package/dist/init-B6kKrmf7.mjs.map +0 -1
  85. package/dist/migration-graph-Cm3oee8C.mjs.map +0 -1
  86. package/dist/telemetry-Q88WHwlv.mjs +0 -122
  87. package/dist/telemetry-Q88WHwlv.mjs.map +0 -1
@@ -1,11 +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";
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-Bbw1GbwL.mjs";
3
+ import { r as buildReadAggregate } from "./contract-space-aggregate-loader-DvZwdkrr.mjs";
4
4
  import { i as migrationGraphToRenderInput, n as graphRenderer } from "./graph-render-rFAqZujX.mjs";
5
5
  import { a as migrationListEmptySource, n as createAnsiMigrationListStyler, o as migrationListForwardArrow, s as classifyMigrationGraphTopology, t as CONTRACT_MARKER_NAME } from "./migration-list-styler-BRwF4-gy.mjs";
6
6
  import { Command } from "commander";
7
7
  import { ok } from "@prisma-next/utils/result";
8
- import { bold, createColors } from "colorette";
8
+ import { bold } from "colorette";
9
9
  import stringWidth from "string-width";
10
10
  import { EMPTY_CONTRACT_HASH } from "@prisma-next/migration-tools/constants";
11
11
  //#region src/utils/formatters/migration-graph-layout.ts
@@ -171,7 +171,7 @@ function classifyEdgeAdjacency(edge, position) {
171
171
  function emptyCells(width) {
172
172
  return Array.from({ length: width }, () => ({ kind: "empty" }));
173
173
  }
174
- function buildBranchConnectorCells(startLane, endLane, fanTargetLanes, activeLanes, gridWidth) {
174
+ function buildBranchConnectorCells(startLane, endLane, activeLanes, gridWidth) {
175
175
  const cells = emptyCells(gridWidth);
176
176
  for (let lane = 0; lane < gridWidth; lane++) {
177
177
  if (activeLanes.has(lane) && (lane < startLane || lane > endLane)) {
@@ -180,13 +180,11 @@ function buildBranchConnectorCells(startLane, endLane, fanTargetLanes, activeLan
180
180
  }
181
181
  if (lane === startLane) cells[lane] = { kind: "branch-tee" };
182
182
  else if (lane === endLane) cells[lane] = { kind: "branch-corner" };
183
- else if (lane > startLane && lane < endLane) if (fanTargetLanes.has(lane)) cells[lane] = { kind: "branch-tee" };
184
- else if (activeLanes.has(lane)) cells[lane] = { kind: "arc-crossing" };
185
- else cells[lane] = { kind: "branch-tee" };
183
+ else if (lane > startLane && lane < endLane) cells[lane] = { kind: "branch-tee" };
186
184
  }
187
185
  return cells;
188
186
  }
189
- function buildMergeConnectorCells(startLane, endLane, fanTargetLanes, activeLanes, gridWidth) {
187
+ function buildMergeConnectorCells(startLane, endLane, activeLanes, gridWidth) {
190
188
  const cells = emptyCells(gridWidth);
191
189
  for (let lane = 0; lane < gridWidth; lane++) {
192
190
  if (activeLanes.has(lane) && (lane < startLane || lane > endLane)) {
@@ -195,9 +193,7 @@ function buildMergeConnectorCells(startLane, endLane, fanTargetLanes, activeLane
195
193
  }
196
194
  if (lane === startLane) cells[lane] = { kind: "merge-tee" };
197
195
  else if (lane === endLane) cells[lane] = { kind: "merge-corner" };
198
- else if (lane > startLane && lane < endLane) if (fanTargetLanes.has(lane)) cells[lane] = { kind: "merge-tee" };
199
- else if (activeLanes.has(lane)) cells[lane] = { kind: "arc-crossing" };
200
- else cells[lane] = { kind: "horizontal-pass" };
196
+ else if (lane > startLane && lane < endLane) cells[lane] = activeLanes.has(lane) ? { kind: "merge-tee" } : { kind: "horizontal-pass" };
201
197
  }
202
198
  return cells;
203
199
  }
@@ -508,19 +504,18 @@ function layoutComponent(componentNodes, allEdges) {
508
504
  const endLane = Math.max(...laneIndices);
509
505
  ensureGridWidth(endLane + 1);
510
506
  const activeLanes = new Set(activeLaneIndices());
511
- const fanTargetLanes = new Set(laneIndices);
512
507
  rows.push({
513
508
  kind: "merge-connector",
514
509
  contractHash,
515
510
  startLane,
516
511
  endLane,
517
512
  branchCount: laneIndices.length,
518
- cells: buildMergeConnectorCells(startLane, endLane, fanTargetLanes, activeLanes, gridWidth)
513
+ cells: buildMergeConnectorCells(startLane, endLane, activeLanes, gridWidth)
519
514
  });
520
515
  for (const index of laneIndices) if (index !== startLane) setLane(index, null);
521
516
  return startLane;
522
517
  }
523
- function emitBranchConnector(contractHash, startLane, endLane, branchCount, fanTargetLanes) {
518
+ function emitBranchConnector(contractHash, startLane, endLane, branchCount) {
524
519
  ensureGridWidth(endLane + 1);
525
520
  const activeLanes = new Set(activeLaneIndices());
526
521
  rows.push({
@@ -529,7 +524,7 @@ function layoutComponent(componentNodes, allEdges) {
529
524
  startLane,
530
525
  endLane,
531
526
  branchCount,
532
- cells: buildBranchConnectorCells(startLane, endLane, new Set(fanTargetLanes), activeLanes, gridWidth)
527
+ cells: buildBranchConnectorCells(startLane, endLane, activeLanes, gridWidth)
533
528
  });
534
529
  }
535
530
  function emitEdgeRow(edge, lane, convergenceProducer) {
@@ -602,7 +597,7 @@ function layoutComponent(componentNodes, allEdges) {
602
597
  }
603
598
  if (groups.length >= 2) {
604
599
  const endLane = Math.max(...laneForGroup);
605
- emitBranchConnector(node, column, endLane, groups.length, laneForGroup);
600
+ emitBranchConnector(node, column, endLane, groups.length);
606
601
  }
607
602
  for (let groupIndex = 0; groupIndex < groups.length; groupIndex++) {
608
603
  const group = groups[groupIndex];
@@ -840,30 +835,6 @@ function buildMigrationGraphRows(graph, options = {}) {
840
835
  };
841
836
  }
842
837
  //#endregion
843
- //#region src/utils/formatters/migration-graph-lane-colors.ts
844
- const { magenta: magenta$1, cyan: cyan$1, green: green$1, yellow: yellow$1, blueBright, red: red$1 } = createColors({ useColor: true });
845
- const LANE_COLOR_CYCLE = [
846
- magenta$1,
847
- cyan$1,
848
- green$1,
849
- yellow$1,
850
- blueBright,
851
- red$1
852
- ];
853
- /**
854
- * The hue for a gutter column. The leftmost lane (column 0) is **neutral** — it
855
- * has nothing to be told apart from in the common single-lane linear case, so
856
- * the renderer dims it rather than tinting it; the rotating palette is reserved
857
- * for columns ≥ 1 (where a second lane exists to distinguish). Callers must dim
858
- * column 0 themselves; this returns identity for it as a guard. A lane freed and
859
- * reused by a later branch keeps its column's hue — coloring is by position, not
860
- * branch identity, exactly like `git log --graph`.
861
- */
862
- function laneColorForColumn(column) {
863
- if (column <= 0) return (text) => text;
864
- return LANE_COLOR_CYCLE[(column - 1) % LANE_COLOR_CYCLE.length] ?? ((text) => text);
865
- }
866
- //#endregion
867
838
  //#region src/utils/formatters/migration-graph-tree-render.ts
868
839
  const LABEL_GAP = 2;
869
840
  /**
@@ -931,233 +902,74 @@ function arrowForEdgeKind(kind, palette) {
931
902
  return palette.edgeArrow[kind];
932
903
  }
933
904
  /**
934
- * The leftmost lane (column 0) renders with the neutral dim lane style rather
935
- * than a palette hue — in the common single-lane case it has nothing to be told
936
- * apart from. Used as the "no owning arc" sentinel during colour resolution.
937
- */
938
- const NEUTRAL_LANE = 0;
939
- /**
940
- * Forced bold for branch-coloured names. A branched name pairs its lane hue
941
- * (also forced, via {@link laneColorForColumn}) with bold; both must emit even
942
- * when colorette's ambient TTY detection is off, so the colorized branch name
943
- * is deterministically bold + hue rather than hue-only.
944
- */
945
- const { bold: forcedBold } = createColors({ useColor: true });
946
- /**
947
- * Resolve per-cell colour columns for a row. Scanning right-to-left lets each
948
- * arc bridge inherit the corner column that closes it (the arc's back-lane), so
949
- * the whole arc — vertical run (already its own column), horizontal bridges,
950
- * corners, crossings, and the `◂`/`─` connector — reads as a single continuous
951
- * hue. A crossing can only be one colour, so rather than leave it dim (wrong for
952
- * both crossing lines) it takes the arc owning the horizontal run at this row
953
- * (the nearest corner to its right); the crossed vertical lane is simply
954
- * occluded at that one cell and reappears on the next row.
955
- */
956
- function resolveRowLaneColors(cells) {
957
- const lane = new Array(cells.length);
958
- const connector = new Array(cells.length);
959
- let arcCorner = NEUTRAL_LANE;
960
- for (let column = cells.length - 1; column >= 0; column--) {
961
- const cell = cells[column];
962
- connector[column] = arcCorner;
963
- switch (cell?.kind) {
964
- case "arc-branch-corner":
965
- case "arc-land-corner":
966
- arcCorner = column;
967
- lane[column] = column;
968
- break;
969
- case "arc-branch-tee":
970
- lane[column] = column;
971
- break;
972
- case "arc-crossing":
973
- case "arc-land-bridge":
974
- lane[column] = arcCorner;
975
- break;
976
- case "horizontal-pass":
977
- lane[column] = arcCorner === NEUTRAL_LANE ? column : arcCorner;
978
- break;
979
- case "node":
980
- lane[column] = column;
981
- arcCorner = NEUTRAL_LANE;
982
- break;
983
- default:
984
- lane[column] = column;
985
- arcCorner = NEUTRAL_LANE;
986
- }
987
- }
988
- return {
989
- lane,
990
- connector
991
- };
992
- }
993
- /**
994
- * Resolve per-cell connector colours. Scanning right-to-left, a corner or an
995
- * intermediate tee anchors its own lane (its junction glyph takes that column),
996
- * but a tee's **trailing dash leads into the branch on its right** (the next
997
- * branch point), so `┬─` reads as "this lane, then on toward the next" rather
998
- * than tinting the dash with the left lane. The leading tee at `startLane` (the
999
- * fork/merge origin) and pure horizontal segments inherit the nearest branch
1000
- * point to their right whole-cell, so the run into a branch — or collapsing
1001
- * into a merge corner — stays continuous. Pass-through verticals outside the
1002
- * run keep their own column (column 0 stays neutral).
1003
- */
1004
- function resolveConnectorLaneColors(cells, startLane) {
1005
- const glyph = new Array(cells.length);
1006
- const dash = new Array(cells.length);
1007
- let owner = NEUTRAL_LANE;
1008
- for (let column = cells.length - 1; column >= 0; column--) switch (cells[column]?.kind) {
1009
- case "branch-corner":
1010
- case "merge-corner":
1011
- owner = column;
1012
- glyph[column] = column;
1013
- dash[column] = column;
1014
- break;
1015
- case "branch-tee":
1016
- case "merge-tee":
1017
- if (column === startLane) {
1018
- const served = owner === NEUTRAL_LANE ? column : owner;
1019
- glyph[column] = column;
1020
- dash[column] = served;
1021
- } else {
1022
- dash[column] = owner === NEUTRAL_LANE ? column : owner;
1023
- glyph[column] = column;
1024
- owner = column;
1025
- }
1026
- break;
1027
- case "arc-crossing":
1028
- glyph[column] = column;
1029
- dash[column] = column;
1030
- break;
1031
- case "horizontal-pass": {
1032
- const served = owner === NEUTRAL_LANE ? column : owner;
1033
- glyph[column] = served;
1034
- dash[column] = served;
1035
- break;
1036
- }
1037
- default:
1038
- glyph[column] = column;
1039
- dash[column] = column;
1040
- }
1041
- return {
1042
- glyph,
1043
- dash
1044
- };
1045
- }
1046
- /**
1047
- * Style a structural glyph by its resolved colour column. Column 0 and the
1048
- * neutral sentinel render dim (`style.lane`); columns ≥ 1 take a palette hue.
1049
- */
1050
- function laneStylerForColumn(colorColumn, colorize, style) {
1051
- if (!colorize || colorColumn <= NEUTRAL_LANE) return (text) => style.lane(text);
1052
- return laneColorForColumn(colorColumn);
1053
- }
1054
- /**
1055
- * Tint a branch-owned token (direction arrow, migration name) by its edge's
1056
- * lane so the whole branch row reads in one colour. Column 0 has nothing to be
1057
- * told apart from in the common linear chain, so it keeps the token's existing
1058
- * default styling (`fallback`) rather than a palette hue; only lanes ≥ 1 take a
1059
- * colour. With colour off, the fallback (also colourless) is used unchanged.
1060
- */
1061
- function branchStylerOrDefault(column, colorize, fallback) {
1062
- if (!colorize || column <= NEUTRAL_LANE) return fallback;
1063
- return laneColorForColumn(column);
1064
- }
1065
- /**
1066
- * Render a connector tee (`├─` / `┬─` / `┴─`) with its junction glyph and its
1067
- * trailing dash coloured independently: the junction anchors its own lane while
1068
- * the dash leads into the branch on its right.
1069
- */
1070
- function renderConnectorTee(pair, glyphColumn, dashColumn, colorize, style) {
1071
- const glyph = laneStylerForColumn(glyphColumn, colorize, style);
1072
- if (glyphColumn === dashColumn) return glyph(pair);
1073
- return glyph(pair.slice(0, 1)) + laneStylerForColumn(dashColumn, colorize, style)(pair.slice(1));
1074
- }
1075
- /**
1076
905
  * A node-marker glyph pair (`○◂`, `○─`, `*<`, `*-`) is the contract node
1077
- * marker (`○` / `*`) followed by an arc connector (`◂` / `─` / `<` / `-`). The
1078
- * marker takes its own lane's hue (so each node visibly belongs to its branch);
1079
- * the connector follows the arc it belongs to (its owning back-lane hue).
1080
- * Direction arrows are handled elsewhere — they take their edge's lane hue too.
906
+ * marker (`○` / `*`) followed by an arc connector (`◂` / `─` / `<` / `-`).
907
+ * The marker is the signal and stays bright (`style.kind`); the connector is
908
+ * gutter and stays dim (`style.lane`) consistent with the plain node marker,
909
+ * which is never dimmed.
1081
910
  */
1082
- function renderNodeMarkerPair(pair, nodeColumn, arcColumn, colorize, style) {
1083
- const marker = laneStylerForColumn(nodeColumn, colorize, style);
1084
- const connector = laneStylerForColumn(arcColumn, colorize, style);
1085
- return marker(pair.slice(0, 1)) + connector(pair.slice(1));
911
+ function renderNodeMarkerPair(pair, style) {
912
+ return style.kind(pair.slice(0, 1)) + style.lane(pair.slice(1));
1086
913
  }
1087
- function renderCellPair(cell, column, colors, colorize, style, palette) {
1088
- const lane = laneStylerForColumn(colors.lane[column] ?? column, colorize, style);
914
+ function renderCellPair(cell, style, palette) {
1089
915
  switch (cell.kind) {
1090
- case "node": {
1091
- const arcColumn = colors.connector[column] ?? NEUTRAL_LANE;
1092
- if (cell.arcLand === true) return renderNodeMarkerPair(palette.arcLand, column, arcColumn, colorize, style);
1093
- if (cell.arcTee === true) return renderNodeMarkerPair(palette.arcTee, column, arcColumn, colorize, style);
1094
- return lane(palette.node);
1095
- }
1096
- case "vertical-pass": return lane(palette.verticalPass);
1097
- case "edge-lane": return cell.ownsLabel ? lane(palette.verticalPass.trimEnd()) + branchStylerOrDefault(column, colorize, style.kind)(arrowForEdgeKind(cell.edgeKind, palette)) : lane(palette.verticalPass);
1098
- case "branch-tee": return lane(palette.branchTee);
1099
- case "merge-tee": return lane(palette.mergeTee);
1100
- case "branch-corner": return lane(palette.branchCorner);
1101
- case "merge-corner": return lane(palette.mergeCorner);
1102
- case "arc-branch-corner": return lane(palette.arcBranchCorner);
1103
- case "arc-branch-tee": return lane(palette.arcBranchTee);
1104
- case "arc-land-corner": return lane(palette.arcLandCorner);
1105
- case "arc-crossing": return lane(palette.arcLandBridge);
1106
- case "arc-land-bridge": return lane(palette.arcLandBridge);
1107
- case "horizontal-pass": return lane(palette.horizontalPass);
916
+ case "node":
917
+ if (cell.arcLand === true) return renderNodeMarkerPair(palette.arcLand, style);
918
+ if (cell.arcTee === true) return renderNodeMarkerPair(palette.arcTee, style);
919
+ return style.kind(palette.node);
920
+ case "vertical-pass": return style.lane(palette.verticalPass);
921
+ case "edge-lane": return cell.ownsLabel ? style.lane(palette.verticalPass.trimEnd()) + style.kind(arrowForEdgeKind(cell.edgeKind, palette)) : style.lane(palette.verticalPass);
922
+ case "branch-tee": return style.lane(palette.branchTee);
923
+ case "merge-tee": return style.lane(palette.mergeTee);
924
+ case "branch-corner": return style.lane(palette.branchCorner);
925
+ case "merge-corner": return style.lane(palette.mergeCorner);
926
+ case "arc-branch-corner": return style.lane(palette.arcBranchCorner);
927
+ case "arc-branch-tee": return style.lane(palette.arcBranchTee);
928
+ case "arc-land-corner": return style.lane(palette.arcLandCorner);
929
+ case "arc-crossing": return style.lane(palette.arcCrossing);
930
+ case "arc-land-bridge": return style.lane(palette.arcLandBridge);
931
+ case "horizontal-pass": return style.lane(palette.horizontalPass);
1108
932
  case "empty": return " ";
1109
933
  }
1110
934
  }
1111
- function renderConnectorRow(row, gridWidth, colorize, style, palette) {
935
+ function renderConnectorRow(row, gridWidth, style, palette) {
1112
936
  const isMerge = row.kind === "merge-connector";
1113
937
  if (row.cells.length > 0) {
1114
- const colors = resolveConnectorLaneColors(row.cells, row.startLane ?? 0);
1115
938
  let seenTee = false;
1116
939
  let out = "";
1117
- for (let column = 0; column < row.cells.length; column++) {
1118
- const cell = row.cells[column];
1119
- if (cell === void 0) continue;
1120
- const glyphColumn = colors.glyph[column] ?? column;
1121
- const dashColumn = colors.dash[column] ?? glyphColumn;
1122
- const lane = laneStylerForColumn(glyphColumn, colorize, style);
1123
- switch (cell.kind) {
1124
- case "branch-tee":
1125
- out += renderConnectorTee(seenTee ? palette.connectorBranchTeeCo : palette.connectorBranchTee, glyphColumn, dashColumn, colorize, style);
1126
- seenTee = true;
1127
- break;
1128
- case "merge-tee":
1129
- out += renderConnectorTee(seenTee ? palette.connectorMergeTeeCo : palette.connectorBranchTee, glyphColumn, dashColumn, colorize, style);
1130
- seenTee = true;
1131
- break;
1132
- case "branch-corner":
1133
- out += lane(palette.branchCorner);
1134
- break;
1135
- case "merge-corner":
1136
- out += lane(palette.mergeCorner);
1137
- break;
1138
- case "vertical-pass":
1139
- out += lane(palette.verticalPass);
1140
- break;
1141
- case "horizontal-pass":
1142
- out += lane(palette.horizontalPass);
1143
- break;
1144
- case "arc-crossing":
1145
- out += renderConnectorTee(palette.arcCrossing, glyphColumn, dashColumn, colorize, style);
1146
- break;
1147
- default: out += " ";
1148
- }
940
+ for (const cell of row.cells) switch (cell.kind) {
941
+ case "branch-tee":
942
+ out += style.lane(seenTee ? palette.connectorBranchTeeCo : palette.connectorBranchTee);
943
+ seenTee = true;
944
+ break;
945
+ case "merge-tee":
946
+ out += style.lane(seenTee ? palette.connectorMergeTeeCo : palette.connectorBranchTee);
947
+ seenTee = true;
948
+ break;
949
+ case "branch-corner":
950
+ out += style.lane(palette.branchCorner);
951
+ break;
952
+ case "merge-corner":
953
+ out += style.lane(palette.mergeCorner);
954
+ break;
955
+ case "vertical-pass":
956
+ out += style.lane(palette.verticalPass);
957
+ break;
958
+ case "horizontal-pass":
959
+ out += style.lane(palette.horizontalPass);
960
+ break;
961
+ default: out += " ";
1149
962
  }
1150
963
  for (let column = row.cells.length; column < gridWidth; column++) out += " ";
1151
964
  return out;
1152
965
  }
1153
966
  const start = row.startLane ?? 0;
1154
967
  const end = row.endLane ?? start;
1155
- const runLane = laneStylerForColumn(end, colorize, style);
1156
968
  let out = "";
1157
969
  for (let column = 0; column < gridWidth; column++) if (column < start || column > end) out += " ";
1158
- else if (column === start) out += runLane(palette.connectorBranchTee);
1159
- else if (column === end) out += runLane(isMerge ? palette.mergeCorner : palette.branchCorner);
1160
- else out += runLane(isMerge ? palette.connectorMergeTeeCo : palette.connectorBranchTeeCo);
970
+ else if (column === start) out += style.lane(palette.connectorBranchTee);
971
+ else if (column === end) out += style.lane(isMerge ? palette.mergeCorner : palette.branchCorner);
972
+ else out += style.lane(isMerge ? palette.connectorMergeTeeCo : palette.connectorBranchTeeCo);
1161
973
  return out;
1162
974
  }
1163
975
  function abbreviateHash(hash, hashLength, emptySource) {
@@ -1196,11 +1008,6 @@ function padVisible(text, targetWidth) {
1196
1008
  const padding = Math.max(0, targetWidth - stringWidth(text));
1197
1009
  return text + " ".repeat(padding);
1198
1010
  }
1199
- const ANSI_ESCAPE = "\x1B";
1200
- function trimTrailingWhitespace(line) {
1201
- const trailingSpaceBeforeReset = new RegExp(`[\\t ]+((?:${ANSI_ESCAPE}\\[[0-9;]*m)+)$`);
1202
- return line.replace(trailingSpaceBeforeReset, "$1").replace(/\s+$/, "");
1203
- }
1204
1011
  function gridWidthForModel(rows) {
1205
1012
  return rows.reduce((max, row) => row.kind === "node" || row.kind === "edge" ? Math.max(max, row.cells.length) : max, 1);
1206
1013
  }
@@ -1240,24 +1047,20 @@ function renderMigrationGraphTree(model, opts) {
1240
1047
  continue;
1241
1048
  }
1242
1049
  if (row.kind === "branch-connector" || row.kind === "merge-connector") {
1243
- lines.push(trimTrailingWhitespace(renderConnectorRow(row, gridWidth, opts.colorize, style, palette)));
1050
+ lines.push(renderConnectorRow(row, gridWidth, style, palette).replace(/\s+$/, ""));
1244
1051
  continue;
1245
1052
  }
1246
- const cellColors = resolveRowLaneColors(row.cells);
1247
- let gutter = row.cells.map((cell, column) => renderCellPair(cell, column, cellColors, opts.colorize, style, palette)).join("");
1053
+ let gutter = row.cells.map((cell) => renderCellPair(cell, style, palette)).join("");
1054
+ const prevRow = model.rows[rowIndex - 1];
1248
1055
  let laneSpan = row.cells.length;
1249
- if (row.kind === "node") if ((row.contractHash ?? EMPTY_CONTRACT_HASH) === EMPTY_CONTRACT_HASH) laneSpan = 1;
1250
- else {
1251
- let lastActiveColumn = -1;
1252
- for (let column = row.cells.length - 1; column >= 0; column--) if (row.cells[column]?.kind !== "empty") {
1253
- lastActiveColumn = column;
1254
- break;
1255
- }
1256
- laneSpan = lastActiveColumn >= 0 ? lastActiveColumn + 1 : 1;
1056
+ if (row.kind === "node") {
1057
+ const contractHash = row.contractHash ?? EMPTY_CONTRACT_HASH;
1058
+ if (prevRow?.kind === "merge-connector" || contractHash === EMPTY_CONTRACT_HASH) laneSpan = 1;
1059
+ else laneSpan = row.cells.length;
1257
1060
  }
1258
1061
  const labelColumn = row.kind === "edge" ? edgeLabelColumn(row, wideLabelColumn) : wideLabelColumn !== void 0 && (nodeHasArcDecoration(row) || row.contractHash !== void 0) ? wideLabelColumn : laneSpan * 2 + LABEL_GAP;
1259
- if (row.kind === "edge" && row.edge?.from === EMPTY_CONTRACT_HASH && (row.laneIndex ?? 0) === 0) gutter = row.cells.slice(0, 1).map((cell, column) => renderCellPair(cell, column, cellColors, opts.colorize, style, palette)).join("");
1260
- else if (row.kind === "node" && laneSpan < row.cells.length && !nodeHasArcDecoration(row)) gutter = row.cells.slice(0, laneSpan).map((cell, column) => renderCellPair(cell, column, cellColors, opts.colorize, style, palette)).join("");
1062
+ if (row.kind === "edge" && row.edge?.from === EMPTY_CONTRACT_HASH && (row.laneIndex ?? 0) === 0) gutter = row.cells.slice(0, 1).map((cell) => renderCellPair(cell, style, palette)).join("");
1063
+ else if (row.kind === "node" && laneSpan < row.cells.length && !nodeHasArcDecoration(row)) gutter = row.cells.slice(0, laneSpan).map((cell) => renderCellPair(cell, style, palette)).join("");
1261
1064
  else if (gutter.length < laneSpan * 2) gutter = gutter.padEnd(laneSpan * 2, " ");
1262
1065
  const dirNameWidth = rowDirNameWidth(labelColumn, maxDirNameLen, dirNameGap);
1263
1066
  const dataColumn = labelColumn + dirNameWidth;
@@ -1265,76 +1068,35 @@ function renderMigrationGraphTree(model, opts) {
1265
1068
  if (row.kind === "node") {
1266
1069
  const contractHash = row.contractHash ?? EMPTY_CONTRACT_HASH;
1267
1070
  if (contractHash === EMPTY_CONTRACT_HASH) {
1268
- const trailingLanes = row.cells.slice(1).map((cell, offset) => renderCellPair(cell, offset + 1, cellColors, opts.colorize, style, palette)).join("");
1071
+ const trailingLanes = row.cells.slice(1).map((cell) => renderCellPair(cell, style, palette)).join("");
1269
1072
  const emptyGutter = palette.emptySource.padEnd(2, " ") + trailingLanes;
1270
1073
  const overlayNames = overlayNamesForContract(contractHash, opts);
1271
1074
  if (overlayNames.length === 0) {
1272
- lines.push(trimTrailingWhitespace(emptyGutter));
1075
+ lines.push(emptyGutter.replace(/\s+$/, ""));
1273
1076
  continue;
1274
1077
  }
1275
1078
  const overlay = style.refs(overlayNames);
1276
- lines.push(trimTrailingWhitespace(`${padVisible(emptyGutter, dataColumn)}${overlay}`));
1079
+ lines.push(`${padVisible(emptyGutter, dataColumn)}${overlay}`.replace(/\s+$/, ""));
1277
1080
  continue;
1278
1081
  }
1279
1082
  const hashText = style.sourceHash(abbreviateHash(contractHash, hashLength, palette.emptySource));
1280
1083
  const overlayNames = overlayNamesForContract(contractHash, opts);
1281
1084
  const overlayPad = overlayNames.length > 0 ? " ".repeat(Math.max(0, dataColumn - labelColumn - stringWidth(hashText))) : "";
1282
1085
  const overlay = overlayNames.length > 0 ? style.refs(overlayNames) : "";
1283
- lines.push(trimTrailingWhitespace(`${gutterPad}${hashText}${overlayPad}${overlay}`));
1086
+ lines.push(`${gutterPad}${hashText}${overlayPad}${overlay}`.replace(/\s+$/, ""));
1284
1087
  continue;
1285
1088
  }
1286
1089
  const edge = row.edge;
1287
1090
  if (edge === void 0) continue;
1288
1091
  const dirNamePadding = " ".repeat(Math.max(0, dirNameWidth - edge.dirName.length));
1289
- const laneIndex = row.laneIndex ?? 0;
1290
- const dirName = `${(opts.colorize && laneIndex > NEUTRAL_LANE ? (text) => forcedBold(laneColorForColumn(laneIndex)(text)) : style.dirName)(edge.dirName)}${dirNamePadding}`;
1092
+ const dirName = `${style.dirName(edge.dirName)}${dirNamePadding}`;
1291
1093
  const hashColumn = formatEdgeHashColumn(edge, style, hashLength, palette);
1292
- lines.push(trimTrailingWhitespace(`${gutterPad}${dirName}${hashColumn}`));
1094
+ lines.push(`${gutterPad}${dirName}${hashColumn}`.replace(/\s+$/, ""));
1293
1095
  }
1294
1096
  return lines.join("\n");
1295
1097
  }
1296
- /**
1297
- * A compact key for the `--tree` visual language: the contract marker, the
1298
- * in-lane direction arrows, the empty baseline, the `(refs)` overlay (including
1299
- * the reserved `db` live-database and `contract` working-schema markers), and a
1300
- * worked sample of the data-column `from → to` migration hash arrow.
1301
- *
1302
- * Honors the same glyph palette (unicode vs ASCII) and `colorize` gate as the
1303
- * tree renderer, so the key matches whatever the graph itself drew and stays
1304
- * pipe-safe (zero ANSI when color is off). The caller adds the trailing blank
1305
- * line that separates this stderr key from the graph on stdout.
1306
- */
1307
- function renderMigrationGraphLegend(opts) {
1308
- const palette = paletteFor(opts.glyphMode ?? "unicode");
1309
- const style = createAnsiMigrationListStyler({ useColor: opts.colorize });
1310
- const node = palette.node.trimEnd();
1311
- const sampleArrow = `${style.sourceHash("aaaaaa")} ${style.glyph(palette.forwardArrow)} ${style.destHash("bbbbbb")}`;
1312
- return [
1313
- "Legend:",
1314
- ` ${style.kind(node)} contract ${style.kind(palette.edgeArrow.forward)} forward ${style.kind(palette.edgeArrow.rollback)} rollback`,
1315
- ` ${style.kind(palette.edgeArrow.self)} migration without schema change`,
1316
- ` ${style.glyph(palette.emptySource)} empty database (baseline)`,
1317
- ` ${style.refs(["refs"])} ${DB_MARKER_NAME} / ${CONTRACT_MARKER_NAME} markers`,
1318
- ` ${sampleArrow} migration from contract aaaaaa to bbbbbb`
1319
- ].join("\n");
1320
- }
1321
1098
  //#endregion
1322
1099
  //#region src/commands/migration-graph.ts
1323
- /**
1324
- * `--legend` describes the `--tree` visual language, so passing it auto-enables
1325
- * the tree path (it has nothing to say about the legacy dagre default).
1326
- */
1327
- function migrationGraphUsesTree(options) {
1328
- return options.tree === true || options.legend === true;
1329
- }
1330
- /**
1331
- * The legend is decoration printed alongside the command header on stderr, so
1332
- * it is suppressed for the machine-readable / silent paths (`--json`, `--dot`,
1333
- * `--quiet`) exactly as the header is.
1334
- */
1335
- function migrationGraphShowsLegend(options, flags) {
1336
- return options.legend === true && options.dot !== true && flags.json !== true && flags.quiet !== true;
1337
- }
1338
1100
  async function executeMigrationGraphCommand(options, flags, ui) {
1339
1101
  const config = await loadConfig(options.config);
1340
1102
  const { configPath, appMigrationsRelative, migrationsDir } = resolveMigrationPaths(options.config, config);
@@ -1352,13 +1114,6 @@ async function executeMigrationGraphCommand(options, flags, ui) {
1352
1114
  flags
1353
1115
  });
1354
1116
  ui.stderr(header);
1355
- if (migrationGraphShowsLegend(options, flags)) {
1356
- ui.stderr(renderMigrationGraphLegend({
1357
- colorize: flags.color !== false,
1358
- glyphMode: ui.resolveGlyphMode(options.ascii === true)
1359
- }));
1360
- ui.stderr("");
1361
- }
1362
1117
  }
1363
1118
  const loaded = await buildReadAggregate(config, { migrationsDir });
1364
1119
  if (!loaded.ok) return loaded;
@@ -1384,8 +1139,7 @@ function createMigrationGraphCommand() {
1384
1139
  "prisma-next migration graph --json",
1385
1140
  "prisma-next migration graph --dot",
1386
1141
  "prisma-next migration graph --tree",
1387
- "prisma-next migration graph --tree --ascii",
1388
- "prisma-next migration graph --legend"
1142
+ "prisma-next migration graph --tree --ascii"
1389
1143
  ]);
1390
1144
  setCommandSeeAlso(command, [
1391
1145
  {
@@ -1405,7 +1159,7 @@ function createMigrationGraphCommand() {
1405
1159
  oneLiner: "Display migration package contents"
1406
1160
  }
1407
1161
  ]);
1408
- 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) => {
1162
+ 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)").action(async (options) => {
1409
1163
  const flags = parseGlobalFlagsOrExit(options);
1410
1164
  const ui = createTerminalUI(flags);
1411
1165
  const exitCode = handleResult(await executeMigrationGraphCommand(options, flags, ui), flags, ui, (graphResult) => {
@@ -1432,7 +1186,7 @@ function createMigrationGraphCommand() {
1432
1186
  edges,
1433
1187
  summary: graphResult.summary
1434
1188
  }, null, 2));
1435
- } else if (!flags.quiet) if (migrationGraphUsesTree(options)) {
1189
+ } else if (!flags.quiet) if (options.tree) {
1436
1190
  const refsByHash = /* @__PURE__ */ new Map();
1437
1191
  for (const ref of graphResult.refs) {
1438
1192
  const existing = refsByHash.get(ref.hash);
@@ -1473,6 +1227,6 @@ function createMigrationGraphCommand() {
1473
1227
  return command;
1474
1228
  }
1475
1229
  //#endregion
1476
- export { migrationGraphUsesTree as i, executeMigrationGraphCommand as n, migrationGraphShowsLegend as r, createMigrationGraphCommand as t };
1230
+ export { executeMigrationGraphCommand as n, createMigrationGraphCommand as t };
1477
1231
 
1478
- //# sourceMappingURL=migration-graph-Cm3oee8C.mjs.map
1232
+ //# sourceMappingURL=migration-graph-D7DVUElV.mjs.map