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

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 (43) hide show
  1. package/dist/cli.mjs +6 -6
  2. package/dist/commands/migrate.d.mts +1 -1
  3. package/dist/commands/migration-graph.d.mts +4 -4
  4. package/dist/commands/migration-graph.mjs +164 -1
  5. package/dist/commands/migration-graph.mjs.map +1 -0
  6. package/dist/commands/migration-list.d.mts +3 -3
  7. package/dist/commands/migration-list.d.mts.map +1 -1
  8. package/dist/commands/migration-list.mjs +4 -6
  9. package/dist/commands/migration-list.mjs.map +1 -1
  10. package/dist/commands/migration-log.d.mts +3 -3
  11. package/dist/commands/migration-log.mjs +1 -1
  12. package/dist/commands/migration-plan.d.mts +1 -1
  13. package/dist/commands/migration-plan.mjs +1 -1
  14. package/dist/commands/migration-show.d.mts +1 -1
  15. package/dist/commands/migration-status.d.mts +1 -1
  16. package/dist/commands/ref.d.mts +1 -1
  17. package/dist/commands/telemetry/index.mjs +1 -1
  18. package/dist/exports/control-api.d.mts +1 -1
  19. package/dist/exports/init-output.mjs +1 -1
  20. package/dist/{global-flags-DSkV6iYT.d.mts → global-flags-DG4uY5tV.d.mts} +1 -1
  21. package/dist/{global-flags-DSkV6iYT.d.mts.map → global-flags-DG4uY5tV.d.mts.map} +1 -1
  22. package/dist/{init-S2vxszo_.mjs → init-B6kKrmf7.mjs} +2 -2
  23. package/dist/{init-S2vxszo_.mjs.map → init-B6kKrmf7.mjs.map} +1 -1
  24. package/dist/{migration-graph-CeBB07Cc.mjs → migration-graph-tree-render-BQdhKBO8.mjs} +405 -165
  25. package/dist/migration-graph-tree-render-BQdhKBO8.mjs.map +1 -0
  26. package/dist/{migration-log-Cj-T-r0o.mjs → migration-log-BzPmks3c.mjs} +2 -2
  27. package/dist/{migration-log-Cj-T-r0o.mjs.map → migration-log-BzPmks3c.mjs.map} +1 -1
  28. package/dist/{migration-plan-BQAbZkj_.mjs → migration-plan-CaeKCKp4.mjs} +1 -1
  29. package/dist/{migration-plan-BQAbZkj_.mjs.map → migration-plan-CaeKCKp4.mjs.map} +1 -1
  30. package/dist/{migration-types-Bhmj0RSa.d.mts → migration-types-CAQ-0TEE.d.mts} +1 -1
  31. package/dist/{migration-types-Bhmj0RSa.d.mts.map → migration-types-CAQ-0TEE.d.mts.map} +1 -1
  32. package/dist/{output-BD61elic.mjs → output-CF_hqzI-.mjs} +1 -1
  33. package/dist/{output-BD61elic.mjs.map → output-CF_hqzI-.mjs.map} +1 -1
  34. package/dist/{telemetry-Bu85x2Gy.mjs → telemetry-Q88WHwlv.mjs} +1 -1
  35. package/dist/{telemetry-Bu85x2Gy.mjs.map → telemetry-Q88WHwlv.mjs.map} +1 -1
  36. package/dist/{terminal-ui-BgLiAOYi.d.mts → terminal-ui-C3xGyxW-.d.mts} +1 -1
  37. package/dist/{terminal-ui-BgLiAOYi.d.mts.map → terminal-ui-C3xGyxW-.d.mts.map} +1 -1
  38. package/dist/{types-C8OcDFBe.d.mts → types-DiC683UW.d.mts} +1 -1
  39. package/dist/{types-C8OcDFBe.d.mts.map → types-DiC683UW.d.mts.map} +1 -1
  40. package/package.json +11 -11
  41. package/dist/migration-graph-CeBB07Cc.mjs.map +0 -1
  42. package/dist/migration-list-styler-CsMECsY4.mjs +0 -414
  43. package/dist/migration-list-styler-CsMECsY4.mjs.map +0 -1
package/dist/cli.mjs CHANGED
@@ -9,22 +9,22 @@ import { createDbUpdateCommand } from "./commands/db-update.mjs";
9
9
  import { t as createDbVerifyCommand } from "./db-verify-DJxengYP.mjs";
10
10
  import { createMigrateCommand } from "./commands/migrate.mjs";
11
11
  import { t as createMigrationCheckCommand } from "./migration-check-DzH1u-O1.mjs";
12
- import { t as createMigrationGraphCommand } from "./migration-graph-CeBB07Cc.mjs";
12
+ import { createMigrationGraphCommand } from "./commands/migration-graph.mjs";
13
13
  import { createMigrationListCommand } from "./commands/migration-list.mjs";
14
- import { t as createMigrationLogCommand } from "./migration-log-Cj-T-r0o.mjs";
14
+ import { t as createMigrationLogCommand } from "./migration-log-BzPmks3c.mjs";
15
15
  import { createMigrationNewCommand } from "./commands/migration-new.mjs";
16
- import { t as createMigrationPlanCommand } from "./migration-plan-BQAbZkj_.mjs";
16
+ import { t as createMigrationPlanCommand } from "./migration-plan-CaeKCKp4.mjs";
17
17
  import { createMigrationShowCommand } from "./commands/migration-show.mjs";
18
18
  import { createMigrationStatusCommand } from "./commands/migration-status.mjs";
19
19
  import { createRefCommand } from "./commands/ref.mjs";
20
- import { t as createTelemetryCommand } from "./telemetry-Bu85x2Gy.mjs";
20
+ import { t as createTelemetryCommand } from "./telemetry-Q88WHwlv.mjs";
21
21
  import { Command } from "commander";
22
22
  import { DEFAULT_CONTRACT_SOURCE_DIR } from "@prisma-next/config/config-types";
23
23
  import { ensureInstallationId, readUserConfig, resolveGating, runTelemetry, userConfigPath } from "@prisma-next/cli-telemetry";
24
24
  import { distance } from "closest-match";
25
25
  import { fileURLToPath } from "node:url";
26
26
  //#region package.json
27
- var version = "0.12.0-dev.22";
27
+ var version = "0.12.0-dev.24";
28
28
  //#endregion
29
29
  //#region src/commands/init/templates/code-templates.ts
30
30
  function targetPackageName(target) {
@@ -293,7 +293,7 @@ Exit codes (see CLI Style Guide § Exit Codes):
293
293
  "prisma-next init --no-skill # skip the skills install (air-gapped / restricted env)"
294
294
  ]);
295
295
  return addGlobalOptions(command).option("--target <db>", "Database target: postgres or mongodb").option("--authoring <style>", "Schema authoring style: psl or typescript").option("--schema-path <path>", `Where to write the starter schema (default: ${defaultSchemaPath("psl")})`).option("--force", "Overwrite an existing scaffold without prompting").option("--write-env", "Write a .env file from .env.example (gitignored; default: only .env.example)").option("--probe-db", "Connect to DATABASE_URL once and check the server version against the target minimum (opt-in; off by default)").option("--strict-probe", "Treat a failed --probe-db as fatal (no-op without --probe-db; init is offline-by-default)").option("--no-install", "Skip dependency installation and contract emission").option("--no-skill", "Skip Prisma Next skills install (air-gapped CI, restricted registries, etc.)").action(async (options) => {
296
- const { runInit } = await import("./init-S2vxszo_.mjs");
296
+ const { runInit } = await import("./init-B6kKrmf7.mjs");
297
297
  const flags = parseGlobalFlagsOrExit(options);
298
298
  const canPrompt = deriveCanPrompt({
299
299
  flagsInteractive: flags.interactive,
@@ -1,4 +1,4 @@
1
- import { E as PerSpaceExecutionEntry, w as MigrationApplyPathDecision } from "../types-C8OcDFBe.mjs";
1
+ import { E as PerSpaceExecutionEntry, w as MigrationApplyPathDecision } from "../types-DiC683UW.mjs";
2
2
  import { Command } from "commander";
3
3
 
4
4
  //#region src/commands/migrate.d.ts
@@ -1,7 +1,7 @@
1
- import { N as CliStructuredError } from "../types-C8OcDFBe.mjs";
2
- import { n as GlobalFlags, t as CommonCommandOptions } from "../global-flags-DSkV6iYT.mjs";
3
- import { n as StatusRef } from "../migration-types-Bhmj0RSa.mjs";
4
- import { t as TerminalUI } from "../terminal-ui-BgLiAOYi.mjs";
1
+ import { N as CliStructuredError } from "../types-DiC683UW.mjs";
2
+ import { n as GlobalFlags, t as CommonCommandOptions } from "../global-flags-DG4uY5tV.mjs";
3
+ import { n as StatusRef } from "../migration-types-CAQ-0TEE.mjs";
4
+ import { t as TerminalUI } from "../terminal-ui-C3xGyxW-.mjs";
5
5
  import { Command } from "commander";
6
6
  import { Result } from "@prisma-next/utils/result";
7
7
  import { MigrationGraph } from "@prisma-next/migration-tools/graph";
@@ -1,2 +1,165 @@
1
- import { i as migrationGraphUsesTree, n as executeMigrationGraphCommand, r as migrationGraphShowsLegend, t as createMigrationGraphCommand } from "../migration-graph-CeBB07Cc.mjs";
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";
6
+ import { Command } from "commander";
7
+ import { ok } from "@prisma-next/utils/result";
8
+ import { EMPTY_CONTRACT_HASH } from "@prisma-next/migration-tools/constants";
9
+ //#region src/commands/migration-graph.ts
10
+ /**
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
+ * The legend is decoration printed alongside the command header on stderr, so
19
+ * it is suppressed for the machine-readable / silent paths (`--json`, `--dot`,
20
+ * `--quiet`) exactly as the header is.
21
+ */
22
+ function migrationGraphShowsLegend(options, flags) {
23
+ return options.legend === true && options.dot !== true && flags.json !== true && flags.quiet !== true;
24
+ }
25
+ async function executeMigrationGraphCommand(options, flags, ui) {
26
+ const config = await loadConfig(options.config);
27
+ const { configPath, appMigrationsRelative, migrationsDir } = resolveMigrationPaths(options.config, config);
28
+ if (!flags.json && !flags.quiet) {
29
+ const header = formatStyledHeader({
30
+ command: "migration graph",
31
+ description: "Show the migration graph topology",
32
+ details: [{
33
+ label: "config",
34
+ value: configPath
35
+ }, {
36
+ label: "migrations",
37
+ value: appMigrationsRelative
38
+ }],
39
+ flags
40
+ });
41
+ ui.stderr(header);
42
+ if (migrationGraphShowsLegend(options, flags)) {
43
+ ui.stderr(renderMigrationGraphLegend({
44
+ colorize: flags.color !== false,
45
+ glyphMode: ui.resolveGlyphMode(options.ascii === true)
46
+ }));
47
+ ui.stderr("");
48
+ }
49
+ }
50
+ const loaded = await buildReadAggregate(config, { migrationsDir });
51
+ if (!loaded.ok) return loaded;
52
+ const { aggregate, contractHash } = loaded.value;
53
+ const graph = aggregate.app.graph();
54
+ return ok({
55
+ ok: true,
56
+ graph,
57
+ contractHash,
58
+ refs: Object.entries(aggregate.app.refs).map(([name, entry]) => ({
59
+ name,
60
+ hash: entry.hash,
61
+ active: false
62
+ })),
63
+ summary: `${graph.nodes.size} node(s), ${graph.migrationByHash.size} edge(s)`
64
+ });
65
+ }
66
+ function createMigrationGraphCommand() {
67
+ 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.");
69
+ setCommandExamples(command, [
70
+ "prisma-next migration graph",
71
+ "prisma-next migration graph --json",
72
+ "prisma-next migration graph --dot",
73
+ "prisma-next migration graph --tree",
74
+ "prisma-next migration graph --tree --ascii",
75
+ "prisma-next migration graph --legend"
76
+ ]);
77
+ setCommandSeeAlso(command, [
78
+ {
79
+ verb: "migration status",
80
+ oneLiner: "Show migration path and pending status"
81
+ },
82
+ {
83
+ verb: "migration log",
84
+ oneLiner: "Show executed migration history"
85
+ },
86
+ {
87
+ verb: "migration list",
88
+ oneLiner: "List on-disk migrations"
89
+ },
90
+ {
91
+ verb: "migration show",
92
+ oneLiner: "Display migration package contents"
93
+ }
94
+ ]);
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) => {
96
+ const flags = parseGlobalFlagsOrExit(options);
97
+ const ui = createTerminalUI(flags);
98
+ const exitCode = handleResult(await executeMigrationGraphCommand(options, flags, ui), flags, ui, (graphResult) => {
99
+ if (options.dot) {
100
+ const lines = ["digraph migrations {"];
101
+ for (const edge of graphResult.graph.migrationByHash.values()) {
102
+ const from = edge.from.slice(0, 12);
103
+ const to = edge.to.slice(0, 12);
104
+ lines.push(` "${from}" -> "${to}" [label="${edge.dirName}"];`);
105
+ }
106
+ lines.push("}");
107
+ ui.output(lines.join("\n"));
108
+ } else if (flags.json) {
109
+ const nodes = [...graphResult.graph.nodes];
110
+ const edges = [...graphResult.graph.migrationByHash.values()].map((e) => ({
111
+ dirName: e.dirName,
112
+ from: e.from,
113
+ to: e.to,
114
+ migrationHash: e.migrationHash
115
+ }));
116
+ ui.output(JSON.stringify({
117
+ ok: true,
118
+ nodes,
119
+ edges,
120
+ summary: graphResult.summary
121
+ }, null, 2));
122
+ } else if (!flags.quiet) if (migrationGraphUsesTree(options)) {
123
+ const refsByHash = /* @__PURE__ */ new Map();
124
+ for (const ref of graphResult.refs) {
125
+ const existing = refsByHash.get(ref.hash);
126
+ refsByHash.set(ref.hash, existing ? [...existing, ref.name] : [ref.name]);
127
+ }
128
+ const layout = buildMigrationGraphLayout(buildMigrationGraphRows(graphResult.graph, { ...graphResult.contractHash !== null ? { contractHash: graphResult.contractHash } : {} }));
129
+ const activeRef = graphResult.refs.find((ref) => ref.active);
130
+ const treeOutput = renderMigrationGraphTree(layout, {
131
+ refsByHash,
132
+ ...graphResult.contractHash !== null ? { contractHash: graphResult.contractHash } : {},
133
+ ...activeRef !== void 0 ? { activeRefName: activeRef.name } : {},
134
+ colorize: flags.color !== false,
135
+ glyphMode: ui.resolveGlyphMode(options.ascii === true)
136
+ });
137
+ ui.output(treeOutput);
138
+ 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
+ }
157
+ });
158
+ process.exit(exitCode);
159
+ });
160
+ return command;
161
+ }
162
+ //#endregion
2
163
  export { createMigrationGraphCommand, executeMigrationGraphCommand, migrationGraphShowsLegend, migrationGraphUsesTree };
164
+
165
+ //# sourceMappingURL=migration-graph.mjs.map
@@ -0,0 +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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AI,KAAK,YAAY,SAAS;GACnC;EAEJ,CAAC;EACD,QAAQ,KAAK,QAAQ;CACvB,CAAC;CACH,OAAO;AACT"}
@@ -1,6 +1,6 @@
1
- import { N as CliStructuredError } from "../types-C8OcDFBe.mjs";
2
- import { n as GlobalFlags, t as CommonCommandOptions } from "../global-flags-DSkV6iYT.mjs";
3
- import { n as GlyphMode, t as TerminalUI } from "../terminal-ui-BgLiAOYi.mjs";
1
+ import { N as CliStructuredError } from "../types-DiC683UW.mjs";
2
+ import { n as GlobalFlags, t as CommonCommandOptions } from "../global-flags-DG4uY5tV.mjs";
3
+ import { n as GlyphMode, t as TerminalUI } from "../terminal-ui-C3xGyxW-.mjs";
4
4
  import { Command } from "commander";
5
5
  import { Result } from "@prisma-next/utils/result";
6
6
  import { ContractSpaceAggregate } from "@prisma-next/migration-tools/aggregate";
@@ -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;AAAA,UAGM,uBAAA;EAAA,SACN,OAAA;EAAA,SACA,UAAA,WAAqB,kBAAkB;AAAA;AAAA,UAGjC,mBAAA;EAAA,SACN,EAAA;EAAA,SACA,MAAA,WAAiB,uBAAuB;EAAA,SACxC,OAAA;AAAA;;;;;;;;;;;iBC8EW,sCAAA,CACpB,SAAA,EAAW,sBAAA,EACX,oBAAA,WACC,OAAA,UAAiB,uBAAA;AAAA,UA6BV,oBAAA,SAA6B,oBAAoB;EAAA,SAChD,MAAA;EAAA,SACA,KAAA;EAAA,SACA,KAAA;AAAA;AAAA,UAGM,+BAAA;EAAA,SACN,SAAA,EAAW,SAAS;EAAA,SACpB,QAAA;AAAA;AAAA,iBAGK,8BAAA,CACd,MAAA,EAAQ,mBAAA,EACR,OAAA,EAAS,+BAA+B;;;ADjIQ;AAGlD;;;;;UC6IiB,sBAAA;EAAA,SACN,MAAA,WAAiB,uBAAuB;EAAA,SACxC,WAAA;AAAA;AD5IO;;;;AC8ElB;;;;;AD9EkB,iBCgKF,gBAAA,CACd,MAAA,EAAQ,sBAAA,GACP,MAAA,CAAO,mBAAA,EAAqB,kBAAA;;;;;;iBA6BT,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
+ {"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;AAAA,UAGM,uBAAA;EAAA,SACN,OAAA;EAAA,SACA,UAAA,WAAqB,kBAAkB;AAAA;AAAA,UAGjC,mBAAA;EAAA,SACN,EAAA;EAAA,SACA,MAAA,WAAiB,uBAAuB;EAAA,SACxC,OAAA;AAAA;;;;;;;;;;;iBC2EW,sCAAA,CACpB,SAAA,EAAW,sBAAA,EACX,oBAAA,WACC,OAAA,UAAiB,uBAAA;AAAA,UA6BV,oBAAA,SAA6B,oBAAoB;EAAA,SAChD,MAAA;EAAA,SACA,KAAA;EAAA,SACA,KAAA;AAAA;AAAA,UAGM,+BAAA;EAAA,SACN,SAAA,EAAW,SAAS;EAAA,SACpB,QAAA;AAAA;AAAA,iBAGK,8BAAA,CACd,MAAA,EAAQ,mBAAA,EACR,OAAA,EAAS,+BAA+B;;;AD9HQ;AAGlD;;;;;UC2IiB,sBAAA;EAAA,SACN,MAAA,WAAiB,uBAAuB;EAAA,SACxC,WAAA;AAAA;AD1IO;;;;AC2ElB;;;;;AD3EkB,iBC8JF,gBAAA,CACd,MAAA,EAAQ,sBAAA,GACP,MAAA,CAAO,mBAAA,EAAqB,kBAAA;;;;;;iBA6BT,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
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
3
  import { r as buildReadAggregate } from "../contract-space-aggregate-loader-CirAEsM8.mjs";
4
- import { a as renderMigrationListWithStyle, i as buildMigrationListTopologyBySpace, n as createAnsiMigrationListStyler } from "../migration-list-styler-CsMECsY4.mjs";
4
+ import { a as renderMigrationListWithStyle, r as createAnsiMigrationListStyler } from "../migration-graph-tree-render-BQdhKBO8.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";
@@ -73,9 +73,7 @@ async function migrationSpaceListEntriesFromAggregate(aggregate, projectMigratio
73
73
  return spaces;
74
74
  }
75
75
  function renderMigrationListHumanOutput(result, options) {
76
- const styler = createAnsiMigrationListStyler({ useColor: options.useColor });
77
- const topologyBySpaceId = buildMigrationListTopologyBySpace(result);
78
- return renderMigrationListWithStyle(result, styler, options.glyphMode, topologyBySpaceId);
76
+ return renderMigrationListWithStyle(result, createAnsiMigrationListStyler({ useColor: options.useColor }), options.glyphMode, { colorize: options.useColor });
79
77
  }
80
78
  function computeSummary(spaces) {
81
79
  const totalMigrations = spaces.reduce((count, space) => count + space.migrations.length, 0);
@@ -117,7 +115,7 @@ async function executeMigrationListCommand(options, flags, ui) {
117
115
  if (!flags.json && !flags.quiet) {
118
116
  const header = formatStyledHeader({
119
117
  command: "migration list",
120
- description: "List on-disk migrations, latest first, per contract space",
118
+ description: "List on-disk migrations per contract space",
121
119
  details: [
122
120
  {
123
121
  label: "config",
@@ -145,7 +143,7 @@ async function executeMigrationListCommand(options, flags, ui) {
145
143
  }
146
144
  function createMigrationListCommand() {
147
145
  const command = new Command("list");
148
- setCommandDescriptions(command, "List on-disk migrations, latest first, per contract space", "Enumerates every on-disk migration under migrations/<space>/ for every\ncontract space found on disk, latest first. Offline — does not consult\nthe database. Each row leads with a kind glyph (* forward, ↩ rollback,\n⟲ self), then dirName, then source → destination contract hashes\n(7-char git-style). Self-edges show a single hash. Invariants render as\n{...}; refs on the destination as (production, db). Pass --space <id>\nto narrow to one contract space. --ascii forces ASCII kind glyphs\n(orthogonal to --no-color).");
146
+ setCommandDescriptions(command, "List on-disk migrations per contract space", "Enumerates every on-disk migration under migrations/<space>/ for every\ncontract space found on disk. Offline — does not consult the database.\nHuman output draws the shared migration graph tree with operation counts,\ninvariants on each migration row, and refs on destination contract nodes.\nPass --space <id> to narrow to one contract space. --ascii forces ASCII\ntree glyphs (orthogonal to --no-color).");
149
147
  setCommandExamples(command, [
150
148
  "prisma-next migration list",
151
149
  "prisma-next migration list --space app",
@@ -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 {\n buildMigrationListTopologyBySpace,\n renderMigrationListWithStyle,\n} 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 const topologyBySpaceId = buildMigrationListTopologyBySpace(result);\n return renderMigrationListWithStyle(result, styler, options.glyphMode, topologyBySpaceId);\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, latest first, 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, latest first, per contract space',\n 'Enumerates every on-disk migration under migrations/<space>/ for every\\n' +\n 'contract space found on disk, latest first. Offline — does not consult\\n' +\n 'the database. Each row leads with a kind glyph (* forward, ↩ rollback,\\n' +\n '⟲ self), then dirName, then source → destination contract hashes\\n' +\n '(7-char git-style). Self-edges show a single hash. Invariants render as\\n' +\n '{...}; refs on the destination as (production, db). Pass --space <id>\\n' +\n 'to narrow to one contract space. --ascii forces ASCII kind glyphs\\n' +\n '(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":";;;;;;;;;;AA6CA,SAAS,gBAAgB,GAAW,GAAmB;CACrD,IAAI,MAAM,cAAc,OAAO,MAAM,eAAe,IAAI;CACxD,IAAI,MAAM,cAAc,OAAO;CAC/B,IAAI,IAAI,GAAG,OAAO;CAClB,IAAI,IAAI,GAAG,OAAO;CAClB,OAAO;AACT;AAEA,SAAS,0BAA0B,GAAuB,GAA+B;CACvF,IAAI,EAAE,UAAU,EAAE,SAAS,OAAO;CAClC,IAAI,EAAE,UAAU,EAAE,SAAS,OAAO;CAClC,OAAO;AACT;;;;;;;;;AAUA,SAAS,uBACP,QACwC;CACxC,MAAM,SAAS,IAAI,IAAI,mBAAmB,OAAO,IAAI,CAAC;CACtD,IAAI,OAAO,YAAY,gBAAgB,OAAO,YAAY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M,mBAAmB,QAAQ,EAAE,cAAc,CAAC;CACjE,IAAI,CAAC,OAAO,IACV,OAAO,MAAM,OAAO,OAAO;CAQ7B,OAAO,iBAAiB;EACtB,QAAA,MANmB,uCACnB,OAAO,MAAM,WACb,aACF;EAIE,GAAG,UAAU,eAAe,QAAQ,KAAK;CAC3C,CAAC;AACH;AAEA,SAAgB,6BAAsC;CACpD,MAAM,UAAU,IAAI,QAAQ,MAAM;CAClC,uBACE,SACA,6DACA,0gBAQF;CACA,mBAAmB,SAAS;EAC1B;EACA;EACA;EACA;CACF,CAAC;CACD,kBAAkB,SAAS;EACzB;GAAE,MAAM;GAAoB,UAAU;EAAyC;EAC/E;GAAE,MAAM;GAAiB,UAAU;EAAkC;EACrE;GAAE,MAAM;GAAmB,UAAU;EAAoC;EACzE;GAAE,MAAM;GAAkB,UAAU;EAAqC;CAC3E,CAAC;CACD,iBAAiB,OAAO,EACrB,OAAO,mBAAmB,+BAA+B,EACzD,OAAO,gBAAgB,0CAA0C,EACjE,OAAO,WAAW,uCAAuC,EACzD,OAAO,OAAO,YAAkC;EAC/C,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;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 */\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,\n }),\n );\n }\n });\n process.exit(exitCode);\n });\n return command;\n}\n"],"mappings":";;;;;;;;;;AA0CA,SAAS,gBAAgB,GAAW,GAAmB;CACrD,IAAI,MAAM,cAAc,OAAO,MAAM,eAAe,IAAI;CACxD,IAAI,MAAM,cAAc,OAAO;CAC/B,IAAI,IAAI,GAAG,OAAO;CAClB,IAAI,IAAI,GAAG,OAAO;CAClB,OAAO;AACT;AAEA,SAAS,0BAA0B,GAAuB,GAA+B;CACvF,IAAI,EAAE,UAAU,EAAE,SAAS,OAAO;CAClC,IAAI,EAAE,UAAU,EAAE,SAAS,OAAO;CAClC,OAAO;AACT;;;;;;;;;AAUA,SAAS,uBACP,QACwC;CACxC,MAAM,SAAS,IAAI,IAAI,mBAAmB,OAAO,IAAI,CAAC;CACtD,IAAI,OAAO,YAAY,gBAAgB,OAAO,YAAY,MAAM;EAC9D,MAAM,OAAO,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V,OAAO,MAAM,OAAO,OAAO;CAQ7B,OAAO,iBAAiB;EACtB,QAAA,MANmB,uCACnB,OAAO,MAAM,WACb,aACF;EAIE,GAAG,UAAU,eAAe,QAAQ,KAAK;CAC3C,CAAC;AACH;AAEA,SAAgB,6BAAsC;CACpD,MAAM,UAAU,IAAI,QAAQ,MAAM;CAClC,uBACE,SACA,8CACA,wZAMF;CACA,mBAAmB,SAAS;EAC1B;EACA;EACA;EACA;CACF,CAAC;CACD,kBAAkB,SAAS;EACzB;GAAE,MAAM;GAAoB,UAAU;EAAyC;EAC/E;GAAE,MAAM;GAAiB,UAAU;EAAkC;EACrE;GAAE,MAAM;GAAmB,UAAU;EAAoC;EACzE;GAAE,MAAM;GAAkB,UAAU;EAAqC;CAC3E,CAAC;CACD,iBAAiB,OAAO,EACrB,OAAO,mBAAmB,+BAA+B,EACzD,OAAO,gBAAgB,0CAA0C,EACjE,OAAO,WAAW,uCAAuC,EACzD,OAAO,OAAO,YAAkC;EAC/C,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;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,6 +1,6 @@
1
- import { N as CliStructuredError } from "../types-C8OcDFBe.mjs";
2
- import { n as GlobalFlags, t as CommonCommandOptions } from "../global-flags-DSkV6iYT.mjs";
3
- import { t as TerminalUI } from "../terminal-ui-BgLiAOYi.mjs";
1
+ import { N as CliStructuredError } from "../types-DiC683UW.mjs";
2
+ import { n as GlobalFlags, t as CommonCommandOptions } from "../global-flags-DG4uY5tV.mjs";
3
+ import { t as TerminalUI } from "../terminal-ui-C3xGyxW-.mjs";
4
4
  import { Command } from "commander";
5
5
  import { Result } from "@prisma-next/utils/result";
6
6
  import { LedgerEntryRecord } from "@prisma-next/contract/types";
@@ -1,2 +1,2 @@
1
- import { n as executeMigrationLogCommand, t as createMigrationLogCommand } from "../migration-log-Cj-T-r0o.mjs";
1
+ import { n as executeMigrationLogCommand, t as createMigrationLogCommand } from "../migration-log-BzPmks3c.mjs";
2
2
  export { createMigrationLogCommand, executeMigrationLogCommand };
@@ -1,4 +1,4 @@
1
- import { n as GlobalFlags } from "../global-flags-DSkV6iYT.mjs";
1
+ import { n as GlobalFlags } from "../global-flags-DG4uY5tV.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,2 +1,2 @@
1
- import { n as formatMigrationPlanOutput, r as resolveBundleByPrefix, t as createMigrationPlanCommand } from "../migration-plan-BQAbZkj_.mjs";
1
+ import { n as formatMigrationPlanOutput, r as resolveBundleByPrefix, t as createMigrationPlanCommand } from "../migration-plan-CaeKCKp4.mjs";
2
2
  export { createMigrationPlanCommand, formatMigrationPlanOutput, resolveBundleByPrefix };
@@ -1,4 +1,4 @@
1
- import { N as CliStructuredError } from "../types-C8OcDFBe.mjs";
1
+ import { N as CliStructuredError } from "../types-DiC683UW.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,4 +1,4 @@
1
- import { n as StatusRef, t as StatusDiagnostic } from "../migration-types-Bhmj0RSa.mjs";
1
+ import { n as StatusRef, t as StatusDiagnostic } from "../migration-types-CAQ-0TEE.mjs";
2
2
  import { Command } from "commander";
3
3
  import { ContractMarkerRecordLike, ContractSpaceAggregate } from "@prisma-next/migration-tools/aggregate";
4
4
  import { MigrationGraph } from "@prisma-next/migration-tools/graph";
@@ -1,4 +1,4 @@
1
- import { N as CliStructuredError } from "../types-C8OcDFBe.mjs";
1
+ import { N as CliStructuredError } from "../types-DiC683UW.mjs";
2
2
  import { Command } from "commander";
3
3
  import { Result } from "@prisma-next/utils/result";
4
4
  import { RefEntry } from "@prisma-next/migration-tools/refs";
@@ -1,2 +1,2 @@
1
- import { t as createTelemetryCommand } from "../../telemetry-Bu85x2Gy.mjs";
1
+ import { t as createTelemetryCommand } from "../../telemetry-Q88WHwlv.mjs";
2
2
  export { createTelemetryCommand };
@@ -1,4 +1,4 @@
1
- import { A as ExecuteDbVerifyOptions, C as IntrospectOptions, D as SchemaVerifyOptions, M as executeDbVerify, O as SignOptions, S as EmitSuccess, T as OnControlProgress, _ as EmitContractConfig, a as ControlClientOptions, b as EmitOptions, c as DbInitFailureCode, d as DbInitSuccess, f as DbUpdateFailure, g as DbUpdateSuccess, h as DbUpdateResult, i as ControlClient, j as ExecuteDbVerifyResult, k as VerifyOptions, l as DbInitOptions, m as DbUpdateOptions, n as ContractEmitResult, o as ControlProgressEvent, p as DbUpdateFailureCode, r as ControlActionName, s as DbInitFailure, t as ContractEmitOptions, u as DbInitResult, v as EmitFailure, x as EmitResult, y as EmitFailureCode } from "../types-C8OcDFBe.mjs";
1
+ import { A as ExecuteDbVerifyOptions, C as IntrospectOptions, D as SchemaVerifyOptions, M as executeDbVerify, O as SignOptions, S as EmitSuccess, T as OnControlProgress, _ as EmitContractConfig, a as ControlClientOptions, b as EmitOptions, c as DbInitFailureCode, d as DbInitSuccess, f as DbUpdateFailure, g as DbUpdateSuccess, h as DbUpdateResult, i as ControlClient, j as ExecuteDbVerifyResult, k as VerifyOptions, l as DbInitOptions, m as DbUpdateOptions, n as ContractEmitResult, o as ControlProgressEvent, p as DbUpdateFailureCode, r as ControlActionName, s as DbInitFailure, t as ContractEmitOptions, u as DbInitResult, v as EmitFailure, x as EmitResult, y as EmitFailureCode } from "../types-DiC683UW.mjs";
2
2
  import { ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyInstance, ControlStack, SignDatabaseResult, TargetMigrationsCapability, VerifyDatabaseResult, VerifyDatabaseSchemaResult } from "@prisma-next/framework-components/control";
3
3
  import { TargetBoundComponentDescriptor } from "@prisma-next/framework-components/components";
4
4
  import { Contract } from "@prisma-next/contract/types";
@@ -1,2 +1,2 @@
1
- import { t as InitOutputSchema } from "../output-BD61elic.mjs";
1
+ import { t as InitOutputSchema } from "../output-CF_hqzI-.mjs";
2
2
  export { InitOutputSchema };
@@ -31,4 +31,4 @@ interface CommonCommandOptions {
31
31
  }
32
32
  //#endregion
33
33
  export { GlobalFlags as n, CommonCommandOptions as t };
34
- //# sourceMappingURL=global-flags-DSkV6iYT.d.mts.map
34
+ //# sourceMappingURL=global-flags-DG4uY5tV.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"global-flags-DSkV6iYT.d.mts","names":[],"sources":["../src/utils/global-flags.ts"],"mappings":";KAMY,YAAA;AAAA,UAEK,WAAA;EAAA,SACN,MAAA,EAAQ,YAAY;EAAA,SACpB,cAAA;EAAA,SACA,IAAA;EAAA,SACA,KAAA;EAAA,SACA,OAAA;EAAA,SACA,KAAA;EAAA,SACA,WAAA;EAAA,SACA,GAAA;AAAA;;;;;UAOM,oBAAA;EAAA,SACN,MAAA;EAAA,SACA,IAAA;EAAA,SACA,KAAA;EAAA,SACA,CAAA;EAAA,SACA,OAAA;EAAA,SACA,CAAA;EAAA,SACA,KAAA;EAAA,SACA,KAAA;EAAA,SACA,UAAA;EAAA,SACA,WAAA;EAAA,SACA,gBAAA;EAAA,SACA,GAAA;EAAA,SACA,CAAA;AAAA"}
1
+ {"version":3,"file":"global-flags-DG4uY5tV.d.mts","names":[],"sources":["../src/utils/global-flags.ts"],"mappings":";KAMY,YAAA;AAAA,UAEK,WAAA;EAAA,SACN,MAAA,EAAQ,YAAY;EAAA,SACpB,cAAA;EAAA,SACA,IAAA;EAAA,SACA,KAAA;EAAA,SACA,OAAA;EAAA,SACA,KAAA;EAAA,SACA,WAAA;EAAA,SACA,GAAA;AAAA;;;;;UAOM,oBAAA;EAAA,SACN,MAAA;EAAA,SACA,IAAA;EAAA,SACA,KAAA;EAAA,SACA,CAAA;EAAA,SACA,OAAA;EAAA,SACA,CAAA;EAAA,SACA,KAAA;EAAA,SACA,KAAA;EAAA,SACA,UAAA;EAAA,SACA,WAAA;EAAA,SACA,gBAAA;EAAA,SACA,GAAA;EAAA,SACA,CAAA;AAAA"}
@@ -1,6 +1,6 @@
1
1
  import { S as formatErrorOutput, j as CliStructuredError, v as createTerminalUI, x as formatErrorJson } from "./command-helpers-Cmdqyhz9.mjs";
2
2
  import { a as starterSchema, c as version, i as schemaSample, n as dbFile, o as targetLabel, r as defaultSchemaPath, s as targetPackageName, t as configFile } from "./cli.mjs";
3
- import { i as renderInitOutro, n as buildNextSteps, r as formatInitJson, t as InitOutputSchema } from "./output-BD61elic.mjs";
3
+ import { i as renderInitOutro, n as buildNextSteps, r as formatInitJson, t as InitOutputSchema } from "./output-CF_hqzI-.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import { basename, dirname, extname, isAbsolute, join, normalize } from "pathe";
6
6
  import * as clack from "@clack/prompts";
@@ -2198,4 +2198,4 @@ function sanitisePackageName(raw) {
2198
2198
  //#endregion
2199
2199
  export { runInit };
2200
2200
 
2201
- //# sourceMappingURL=init-S2vxszo_.mjs.map
2201
+ //# sourceMappingURL=init-B6kKrmf7.mjs.map