@prisma-next/cli 0.11.0-dev.69 → 0.11.0-dev.70

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 (45) hide show
  1. package/dist/cli.mjs +5 -5
  2. package/dist/commands/migrate.d.mts +1 -1
  3. package/dist/commands/migration-graph.d.mts +6 -4
  4. package/dist/commands/migration-graph.d.mts.map +1 -1
  5. package/dist/commands/migration-graph.mjs +1 -121
  6. package/dist/commands/migration-list.d.mts +4 -3
  7. package/dist/commands/migration-list.d.mts.map +1 -1
  8. package/dist/commands/migration-list.mjs +1 -1
  9. package/dist/commands/migration-log.d.mts +3 -3
  10. package/dist/commands/migration-plan.d.mts +1 -1
  11. package/dist/commands/migration-plan.mjs +1 -1
  12. package/dist/commands/migration-show.d.mts +1 -1
  13. package/dist/commands/migration-status.d.mts +1 -1
  14. package/dist/commands/ref.d.mts +1 -1
  15. package/dist/exports/control-api.d.mts +1 -1
  16. package/dist/exports/init-output.mjs +1 -1
  17. package/dist/{global-flags-2SPgqWma.d.mts → global-flags-DG4uY5tV.d.mts} +1 -1
  18. package/dist/{global-flags-2SPgqWma.d.mts.map → global-flags-DG4uY5tV.d.mts.map} +1 -1
  19. package/dist/{init-BQNpPozW.mjs → init-DE-phHWK.mjs} +2 -2
  20. package/dist/{init-BQNpPozW.mjs.map → init-DE-phHWK.mjs.map} +1 -1
  21. package/dist/migration-graph-kPluRdF2.mjs +1232 -0
  22. package/dist/migration-graph-kPluRdF2.mjs.map +1 -0
  23. package/dist/{migration-list-A3bJ4j5e.mjs → migration-list-CE35R5Ag.mjs} +2 -277
  24. package/dist/migration-list-CE35R5Ag.mjs.map +1 -0
  25. package/dist/migration-list-styler-DeAwACt3.mjs +402 -0
  26. package/dist/migration-list-styler-DeAwACt3.mjs.map +1 -0
  27. package/dist/{migration-plan-ZZm8C0s-.mjs → migration-plan-DHLa2Khm.mjs} +1 -1
  28. package/dist/{migration-plan-ZZm8C0s-.mjs.map → migration-plan-DHLa2Khm.mjs.map} +1 -1
  29. package/dist/{migration-types-q64xAI_J.d.mts → migration-types-CAQ-0TEE.d.mts} +1 -1
  30. package/dist/{migration-types-q64xAI_J.d.mts.map → migration-types-CAQ-0TEE.d.mts.map} +1 -1
  31. package/dist/{output-DEg3SSnJ.mjs → output-CF_hqzI-.mjs} +1 -1
  32. package/dist/{output-DEg3SSnJ.mjs.map → output-CF_hqzI-.mjs.map} +1 -1
  33. package/dist/{terminal-ui-sLZt2cxc.d.mts → terminal-ui-BbtqsQYY.d.mts} +1 -1
  34. package/dist/{terminal-ui-sLZt2cxc.d.mts.map → terminal-ui-BbtqsQYY.d.mts.map} +1 -1
  35. package/dist/{types-BNqTw3ek.d.mts → types-Ci7TndCS.d.mts} +1 -1
  36. package/dist/{types-BNqTw3ek.d.mts.map → types-Ci7TndCS.d.mts.map} +1 -1
  37. package/package.json +18 -18
  38. package/src/commands/migration-graph.ts +60 -19
  39. package/src/utils/formatters/migration-graph-layout.ts +1119 -0
  40. package/src/utils/formatters/migration-graph-rows.ts +336 -0
  41. package/src/utils/formatters/migration-graph-tree-render.ts +459 -0
  42. package/src/utils/formatters/migration-list-graph-topology.ts +245 -35
  43. package/src/utils/formatters/migration-list-styler.ts +9 -7
  44. package/dist/commands/migration-graph.mjs.map +0 -1
  45. package/dist/migration-list-A3bJ4j5e.mjs.map +0 -1
@@ -14,6 +14,9 @@ import {
14
14
  import { buildReadAggregate } from '../utils/contract-space-aggregate-loader';
15
15
  import { migrationGraphToRenderInput } from '../utils/formatters/graph-migration-mapper';
16
16
  import { graphRenderer } from '../utils/formatters/graph-render';
17
+ import { buildMigrationGraphLayout } from '../utils/formatters/migration-graph-layout';
18
+ import { buildMigrationGraphRows } from '../utils/formatters/migration-graph-rows';
19
+ import { renderMigrationGraphTree } from '../utils/formatters/migration-graph-tree-render';
17
20
  import { formatStyledHeader } from '../utils/formatters/styled';
18
21
  import type { CommonCommandOptions } from '../utils/global-flags';
19
22
  import { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';
@@ -24,6 +27,8 @@ import { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';
24
27
  interface MigrationGraphOptions extends CommonCommandOptions {
25
28
  readonly config?: string;
26
29
  readonly dot?: boolean;
30
+ readonly tree?: boolean;
31
+ readonly ascii?: boolean;
27
32
  }
28
33
 
29
34
  export interface MigrationGraphResult {
@@ -85,14 +90,18 @@ export function createMigrationGraphCommand(): Command {
85
90
  setCommandDescriptions(
86
91
  command,
87
92
  'Show the migration graph topology',
88
- 'Renders the migration graph as an ASCII tree. Offline — does not\n' +
89
- 'consult the database. Use --json for machine-readable output or\n' +
90
- '--dot for Graphviz DOT format.',
93
+ 'Renders the migration graph topology. Offline — does not consult\n' +
94
+ 'the database. Use --tree for the condensed annotated tree\n' +
95
+ '(--ascii swaps box-drawing for pipe-friendly ASCII glyphs),\n' +
96
+ '--json for machine-readable output, or --dot for Graphviz DOT\n' +
97
+ 'format.',
91
98
  );
92
99
  setCommandExamples(command, [
93
100
  'prisma-next migration graph',
94
101
  'prisma-next migration graph --json',
95
102
  'prisma-next migration graph --dot',
103
+ 'prisma-next migration graph --tree',
104
+ 'prisma-next migration graph --tree --ascii',
96
105
  ]);
97
106
  setCommandSeeAlso(command, [
98
107
  { verb: 'migration status', oneLiner: 'Show migration path and pending status' },
@@ -103,6 +112,8 @@ export function createMigrationGraphCommand(): Command {
103
112
  addGlobalOptions(command)
104
113
  .option('--config <path>', 'Path to prisma-next.config.ts')
105
114
  .option('--dot', 'Output in Graphviz DOT format')
115
+ .option('--tree', 'Experimental condensed annotated tree renderer')
116
+ .option('--ascii', 'Use ASCII glyphs for --tree (pipe-friendly)')
106
117
  .action(async (options: MigrationGraphOptions) => {
107
118
  const flags = parseGlobalFlagsOrExit(options);
108
119
  const ui = createTerminalUI(flags);
@@ -134,22 +145,52 @@ export function createMigrationGraphCommand(): Command {
134
145
  JSON.stringify({ ok: true, nodes, edges, summary: graphResult.summary }, null, 2),
135
146
  );
136
147
  } else if (!flags.quiet) {
137
- const renderInput = migrationGraphToRenderInput({
138
- graph: graphResult.graph,
139
- mode: 'offline',
140
- markerHash: undefined,
141
- contractHash: graphResult.contractHash ?? EMPTY_CONTRACT_HASH,
142
- refs: graphResult.refs,
143
- activeRefHash: undefined,
144
- activeRefName: undefined,
145
- edgeStatuses: [],
146
- });
147
- const graphOutput = graphRenderer.render(renderInput.graph, {
148
- ...renderInput.options,
149
- colorize: flags.color !== false,
150
- });
151
- ui.log(graphOutput);
152
- ui.log(`\n${graphResult.summary}`);
148
+ if (options.tree) {
149
+ const refsByHash = new Map<string, string[]>();
150
+ for (const ref of graphResult.refs) {
151
+ const existing = refsByHash.get(ref.hash);
152
+ refsByHash.set(ref.hash, existing ? [...existing, ref.name] : [ref.name]);
153
+ }
154
+ const rowModel = buildMigrationGraphRows(graphResult.graph, {
155
+ ...(graphResult.contractHash !== null
156
+ ? { contractHash: graphResult.contractHash }
157
+ : {}),
158
+ });
159
+ const layout = buildMigrationGraphLayout(rowModel);
160
+ const activeRef = graphResult.refs.find((ref) => ref.active);
161
+ const treeOutput = renderMigrationGraphTree(layout, {
162
+ refsByHash,
163
+ ...(graphResult.contractHash !== null
164
+ ? { contractHash: graphResult.contractHash }
165
+ : {}),
166
+ ...(activeRef !== undefined ? { activeRefName: activeRef.name } : {}),
167
+ colorize: flags.color !== false,
168
+ glyphMode: ui.resolveGlyphMode(options.ascii === true),
169
+ });
170
+ // Emit the rendered tree to stdout like `migration list --graph`,
171
+ // not through clack's `log.message` rail: the graph is the command's
172
+ // result (and its own box-drawing is the only vertical structure it
173
+ // should carry), not a status line that needs the prompt gutter.
174
+ ui.output(treeOutput);
175
+ ui.output(`\n${graphResult.summary}`);
176
+ } else {
177
+ const renderInput = migrationGraphToRenderInput({
178
+ graph: graphResult.graph,
179
+ mode: 'offline',
180
+ markerHash: undefined,
181
+ contractHash: graphResult.contractHash ?? EMPTY_CONTRACT_HASH,
182
+ refs: graphResult.refs,
183
+ activeRefHash: undefined,
184
+ activeRefName: undefined,
185
+ edgeStatuses: [],
186
+ });
187
+ const graphOutput = graphRenderer.render(renderInput.graph, {
188
+ ...renderInput.options,
189
+ colorize: flags.color !== false,
190
+ });
191
+ ui.log(graphOutput);
192
+ ui.log(`\n${graphResult.summary}`);
193
+ }
153
194
  }
154
195
  });
155
196
  process.exit(exitCode);