prisma-next 0.11.0-dev.5 → 0.11.0-dev.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/dist/cli-errors-DFF1LlfU.mjs +215 -0
  2. package/dist/cli-errors-DFF1LlfU.mjs.map +1 -0
  3. package/dist/cli.mjs +9 -10
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/{client-oXO2WCPD.mjs → client-5uvDppD8.mjs} +23 -21
  6. package/dist/client-5uvDppD8.mjs.map +1 -0
  7. package/dist/{command-helpers-DtavI0wJ.mjs → command-helpers-4UNsRRc4.mjs} +427 -9
  8. package/dist/command-helpers-4UNsRRc4.mjs.map +1 -0
  9. package/dist/commands/contract-emit.d.mts.map +1 -1
  10. package/dist/commands/contract-emit.mjs +1 -1
  11. package/dist/commands/contract-infer.d.mts.map +1 -1
  12. package/dist/commands/contract-infer.mjs +1 -1
  13. package/dist/commands/db-init.d.mts.map +1 -1
  14. package/dist/commands/db-init.mjs +33 -7
  15. package/dist/commands/db-init.mjs.map +1 -1
  16. package/dist/commands/db-schema.d.mts.map +1 -1
  17. package/dist/commands/db-schema.mjs +3 -4
  18. package/dist/commands/db-schema.mjs.map +1 -1
  19. package/dist/commands/db-sign.d.mts.map +1 -1
  20. package/dist/commands/db-sign.mjs +6 -7
  21. package/dist/commands/db-sign.mjs.map +1 -1
  22. package/dist/commands/db-update.d.mts.map +1 -1
  23. package/dist/commands/db-update.mjs +36 -8
  24. package/dist/commands/db-update.mjs.map +1 -1
  25. package/dist/commands/db-verify.d.mts.map +1 -1
  26. package/dist/commands/db-verify.mjs +1 -1
  27. package/dist/commands/migrate.d.mts +5 -1
  28. package/dist/commands/migrate.d.mts.map +1 -1
  29. package/dist/commands/migrate.mjs +79 -39
  30. package/dist/commands/migrate.mjs.map +1 -1
  31. package/dist/commands/migration-check.d.mts +4 -3
  32. package/dist/commands/migration-check.d.mts.map +1 -1
  33. package/dist/commands/migration-check.mjs +1 -280
  34. package/dist/commands/migration-graph.d.mts +1 -1
  35. package/dist/commands/migration-graph.d.mts.map +1 -1
  36. package/dist/commands/migration-graph.mjs +3 -4
  37. package/dist/commands/migration-graph.mjs.map +1 -1
  38. package/dist/commands/migration-list.d.mts +63 -12
  39. package/dist/commands/migration-list.d.mts.map +1 -1
  40. package/dist/commands/migration-list.mjs +2 -103
  41. package/dist/commands/migration-log.d.mts.map +1 -1
  42. package/dist/commands/migration-log.mjs +3 -4
  43. package/dist/commands/migration-log.mjs.map +1 -1
  44. package/dist/commands/migration-new.d.mts.map +1 -1
  45. package/dist/commands/migration-new.mjs +33 -38
  46. package/dist/commands/migration-new.mjs.map +1 -1
  47. package/dist/commands/migration-plan.d.mts +2 -1
  48. package/dist/commands/migration-plan.d.mts.map +1 -1
  49. package/dist/commands/migration-plan.mjs +1 -1
  50. package/dist/commands/migration-show.d.mts +4 -55
  51. package/dist/commands/migration-show.d.mts.map +1 -1
  52. package/dist/commands/migration-show.mjs +62 -153
  53. package/dist/commands/migration-show.mjs.map +1 -1
  54. package/dist/commands/migration-status.d.mts +5 -40
  55. package/dist/commands/migration-status.d.mts.map +1 -1
  56. package/dist/commands/migration-status.mjs +93 -67
  57. package/dist/commands/migration-status.mjs.map +1 -1
  58. package/dist/commands/ref.d.mts +1 -1
  59. package/dist/commands/ref.d.mts.map +1 -1
  60. package/dist/commands/ref.mjs +34 -9
  61. package/dist/commands/ref.mjs.map +1 -1
  62. package/dist/config-loader-B6sJjXTv.mjs.map +1 -1
  63. package/dist/config-loader.d.mts.map +1 -1
  64. package/dist/{contract-emit-o-8VmdQX.mjs → contract-emit-C-CFGZsI.mjs} +9 -6
  65. package/dist/{contract-emit-o-8VmdQX.mjs.map → contract-emit-C-CFGZsI.mjs.map} +1 -1
  66. package/dist/{contract-emit-CmsklifJ.mjs → contract-emit-CuUzzM46.mjs} +5 -6
  67. package/dist/{contract-emit-CmsklifJ.mjs.map → contract-emit-CuUzzM46.mjs.map} +1 -1
  68. package/dist/{contract-enrichment-Dani0mMW.mjs → contract-enrichment-XmUPhmsS.mjs} +4 -25
  69. package/dist/contract-enrichment-XmUPhmsS.mjs.map +1 -0
  70. package/dist/{contract-infer-pKkiCt7C.mjs → contract-infer-C98ZaRhp.mjs} +3 -4
  71. package/dist/{contract-infer-pKkiCt7C.mjs.map → contract-infer-C98ZaRhp.mjs.map} +1 -1
  72. package/dist/contract-space-aggregate-loader-CVHGuA35.mjs +170 -0
  73. package/dist/contract-space-aggregate-loader-CVHGuA35.mjs.map +1 -0
  74. package/dist/{db-verify-AoIUriL4.mjs → db-verify-BWl1Yxi-.mjs} +6 -7
  75. package/dist/{db-verify-AoIUriL4.mjs.map → db-verify-BWl1Yxi-.mjs.map} +1 -1
  76. package/dist/exports/control-api.d.mts +1 -1
  77. package/dist/exports/control-api.d.mts.map +1 -1
  78. package/dist/exports/control-api.mjs +3 -3
  79. package/dist/exports/index.d.mts.map +1 -1
  80. package/dist/exports/index.mjs +1 -1
  81. package/dist/exports/index.mjs.map +1 -1
  82. package/dist/exports/init-output.d.mts.map +1 -1
  83. package/dist/exports/init-output.mjs +1 -1
  84. package/dist/extension-pack-inputs-BiY86HbQ.mjs +62 -0
  85. package/dist/extension-pack-inputs-BiY86HbQ.mjs.map +1 -0
  86. package/dist/{framework-components-65gOHkHB.mjs → framework-components-DTcjouhS.mjs} +2 -2
  87. package/dist/{framework-components-65gOHkHB.mjs.map → framework-components-DTcjouhS.mjs.map} +1 -1
  88. package/dist/{global-flags-CdE7M0d9.d.mts → global-flags-DWsQ6SSI.d.mts} +1 -1
  89. package/dist/global-flags-DWsQ6SSI.d.mts.map +1 -0
  90. package/dist/glyph-mode-CBB4emzO.d.mts +5 -0
  91. package/dist/glyph-mode-CBB4emzO.d.mts.map +1 -0
  92. package/dist/{graph-render-DJVv0_uf.mjs → graph-render-D2FnLpuK.mjs} +1 -1
  93. package/dist/{graph-render-DJVv0_uf.mjs.map → graph-render-D2FnLpuK.mjs.map} +1 -1
  94. package/dist/{init-Db5Itt5r.mjs → init-C7PvN163.mjs} +5 -5
  95. package/dist/{init-Db5Itt5r.mjs.map → init-C7PvN163.mjs.map} +1 -1
  96. package/dist/{inspect-live-schema-LeWvkZVz.mjs → inspect-live-schema-BRCWQ-Sr.mjs} +5 -5
  97. package/dist/{inspect-live-schema-LeWvkZVz.mjs.map → inspect-live-schema-BRCWQ-Sr.mjs.map} +1 -1
  98. package/dist/migration-check-DoskM1nB.mjs +341 -0
  99. package/dist/migration-check-DoskM1nB.mjs.map +1 -0
  100. package/dist/migration-cli.d.mts.map +1 -1
  101. package/dist/migration-cli.mjs +4 -4
  102. package/dist/migration-cli.mjs.map +1 -1
  103. package/dist/{migration-command-scaffold-BtkunvFQ.mjs → migration-command-scaffold-CXLkoIJx.mjs} +5 -5
  104. package/dist/{migration-command-scaffold-BtkunvFQ.mjs.map → migration-command-scaffold-CXLkoIJx.mjs.map} +1 -1
  105. package/dist/migration-list-B2-iQ5Jd.mjs +646 -0
  106. package/dist/migration-list-B2-iQ5Jd.mjs.map +1 -0
  107. package/dist/{migration-plan-C2jeH1J5.mjs → migration-plan-BqmIKQpZ.mjs} +341 -88
  108. package/dist/migration-plan-BqmIKQpZ.mjs.map +1 -0
  109. package/dist/{migration-types-BXWvz12q.d.mts → migration-types-q64xAI_J.d.mts} +1 -1
  110. package/dist/{migration-types-BXWvz12q.d.mts.map → migration-types-q64xAI_J.d.mts.map} +1 -1
  111. package/dist/{migrations-CwZMa1Ck.mjs → migrations-BcVTutso.mjs} +12 -13
  112. package/dist/migrations-BcVTutso.mjs.map +1 -0
  113. package/dist/{output-BlsrGMEF.mjs → output-B60Gw5fu.mjs} +1 -1
  114. package/dist/{output-BlsrGMEF.mjs.map → output-B60Gw5fu.mjs.map} +1 -1
  115. package/dist/{progress-adapter-DFfvZcYL.mjs → progress-adapter-xASh41wr.mjs} +1 -1
  116. package/dist/{progress-adapter-DFfvZcYL.mjs.map → progress-adapter-xASh41wr.mjs.map} +1 -1
  117. package/dist/ref-advancement-DRh5Nquq.mjs +50 -0
  118. package/dist/ref-advancement-DRh5Nquq.mjs.map +1 -0
  119. package/dist/{types-C9FfXb1l.d.mts → types-CEtm6v6a.d.mts} +5 -11
  120. package/dist/types-CEtm6v6a.d.mts.map +1 -0
  121. package/dist/{verify-Bom75OYI.mjs → verify-DOHbbrub.mjs} +2 -2
  122. package/dist/{verify-Bom75OYI.mjs.map → verify-DOHbbrub.mjs.map} +1 -1
  123. package/package.json +12 -12
  124. package/dist/cli-errors-Czmx92Zy.d.mts +0 -3
  125. package/dist/cli-errors-Djtz98Vm.mjs +0 -71
  126. package/dist/cli-errors-Djtz98Vm.mjs.map +0 -1
  127. package/dist/client-oXO2WCPD.mjs.map +0 -1
  128. package/dist/command-helpers-DtavI0wJ.mjs.map +0 -1
  129. package/dist/commands/migration-check.mjs.map +0 -1
  130. package/dist/commands/migration-list.mjs.map +0 -1
  131. package/dist/contract-enrichment-Dani0mMW.mjs.map +0 -1
  132. package/dist/contract-space-aggregate-loader-BmNQwlws.mjs +0 -160
  133. package/dist/contract-space-aggregate-loader-BmNQwlws.mjs.map +0 -1
  134. package/dist/global-flags-CdE7M0d9.d.mts.map +0 -1
  135. package/dist/migration-plan-C2jeH1J5.mjs.map +0 -1
  136. package/dist/migrations-CwZMa1Ck.mjs.map +0 -1
  137. package/dist/terminal-ui-BiB_8KNo.mjs +0 -379
  138. package/dist/terminal-ui-BiB_8KNo.mjs.map +0 -1
  139. package/dist/types-C9FfXb1l.d.mts.map +0 -1
@@ -1,6 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-twds-ZHy.mjs";
2
- import { d as errorInvalidOutputFormat, g as errorRuntime, m as errorOutputFormatMutex, t as CliStructuredError } from "./cli-errors-Djtz98Vm.mjs";
3
- import { a as isCI, i as formatErrorOutput, o as createColorFormatter, r as formatErrorJson, s as formatDim, t as createTerminalUI } from "./terminal-ui-BiB_8KNo.mjs";
2
+ import { C as errorRuntime, d as errorInvalidOutputFormat, g as errorOutputFormatMutex, t as CliStructuredError } from "./cli-errors-DFF1LlfU.mjs";
4
3
  import { ifDefined } from "@prisma-next/utils/defined";
5
4
  import { notOk } from "@prisma-next/utils/result";
6
5
  import { relative, resolve } from "pathe";
@@ -9,10 +8,33 @@ import { hasMigrations } from "@prisma-next/framework-components/control";
9
8
  import { readMigrationsDir } from "@prisma-next/migration-tools/io";
10
9
  import { reconstructGraph } from "@prisma-next/migration-tools/migration-graph";
11
10
  import { APP_SPACE_ID as APP_SPACE_ID$1, spaceMigrationDirectory } from "@prisma-next/migration-tools/spaces";
12
- import { blue, bold, cyan, dim, green, magenta } from "colorette";
11
+ import { blue, bold, cyan, dim, green, magenta, red, yellow } from "colorette";
13
12
  import wrapAnsi from "wrap-ansi";
14
13
  import stringWidth from "string-width";
15
14
  import stripAnsi from "strip-ansi";
15
+ import { isCI } from "ci-info";
16
+ import * as clack from "@clack/prompts";
17
+ //#region src/utils/formatters/helpers.ts
18
+ /**
19
+ * Checks if verbose output is enabled at the specified level.
20
+ */
21
+ function isVerbose(flags, level) {
22
+ return (flags.verbose ?? 0) >= level;
23
+ }
24
+ /**
25
+ * Creates a color-aware formatter function.
26
+ * Returns a function that applies the color only if colors are enabled.
27
+ */
28
+ function createColorFormatter(useColor, colorFn) {
29
+ return useColor ? colorFn : (text) => text;
30
+ }
31
+ /**
32
+ * Formats text with dim styling if colors are enabled.
33
+ */
34
+ function formatDim(useColor, text) {
35
+ return useColor ? dim(text) : text;
36
+ }
37
+ //#endregion
16
38
  //#region src/utils/formatters/styled.ts
17
39
  /**
18
40
  * Fixed width for left column in help output.
@@ -417,6 +439,75 @@ function formatRootHelp(options) {
417
439
  return `${lines.join("\n")}\n`;
418
440
  }
419
441
  //#endregion
442
+ //#region src/utils/is-ci.ts
443
+ /**
444
+ * Returns true when the process is running in any CI environment recognised
445
+ * by the `ci-info` package. The single source of truth for CI detection
446
+ * across this CLI — colour-output suppression and telemetry-skip both call
447
+ * this helper, so neither path drifts from the other when a new CI provider
448
+ * is added upstream.
449
+ *
450
+ * `ci-info` checks the standard `CI=true` marker plus dozens of
451
+ * provider-specific environment variables (Buildkite, Jenkins, Drone,
452
+ * Bitbucket Pipelines, Azure Pipelines, AWS CodeBuild, …) that the raw
453
+ * `process.env.CI` read misses.
454
+ *
455
+ */
456
+ function isCI$1() {
457
+ return isCI;
458
+ }
459
+ //#endregion
460
+ //#region src/utils/formatters/errors.ts
461
+ /**
462
+ * Formats error output for human-readable display.
463
+ */
464
+ function formatErrorOutput(error, flags) {
465
+ const lines = [];
466
+ const useColor = flags.color !== false;
467
+ const formatRed = createColorFormatter(useColor, red);
468
+ const formatDimText = (text) => formatDim(useColor, text);
469
+ lines.push(`${formatRed("✖")} ${error.summary} (${error.code})`);
470
+ if (error.why) lines.push(`${formatDimText(` Why: ${error.why}`)}`);
471
+ if (error.fix) lines.push(`${formatDimText(` Fix: ${error.fix}`)}`);
472
+ if (error.where?.path) {
473
+ const whereLine = error.where.line ? `${error.where.path}:${error.where.line}` : error.where.path;
474
+ lines.push(`${formatDimText(` Where: ${whereLine}`)}`);
475
+ }
476
+ if (error.meta?.["conflicts"]) {
477
+ const conflicts = error.meta["conflicts"];
478
+ if (conflicts.length > 0) {
479
+ const maxToShow = isVerbose(flags, 1) ? conflicts.length : Math.min(3, conflicts.length);
480
+ const header = isVerbose(flags, 1) ? " Conflicts:" : ` Conflicts (showing ${maxToShow} of ${conflicts.length}):`;
481
+ lines.push(`${formatDimText(header)}`);
482
+ for (const conflict of conflicts.slice(0, maxToShow)) lines.push(`${formatDimText(` - [${conflict.kind}] ${conflict.summary}`)}`);
483
+ if (!isVerbose(flags, 1) && conflicts.length > maxToShow) lines.push(`${formatDimText(" Re-run with -v/--verbose to see all conflicts")}`);
484
+ }
485
+ }
486
+ if (error.meta?.["issues"]) {
487
+ const issues = error.meta["issues"];
488
+ if (issues.length > 0) {
489
+ const maxToShow = isVerbose(flags, 1) ? issues.length : Math.min(3, issues.length);
490
+ const header = isVerbose(flags, 1) ? " Issues:" : ` Issues (showing ${maxToShow} of ${issues.length}):`;
491
+ lines.push(`${formatDimText(header)}`);
492
+ for (const issue of issues.slice(0, maxToShow)) {
493
+ const kind = issue.kind ?? "issue";
494
+ const message = issue.message ?? "";
495
+ lines.push(`${formatDimText(` - [${kind}] ${message}`)}`);
496
+ }
497
+ if (!isVerbose(flags, 1) && issues.length > maxToShow) lines.push(`${formatDimText(" Re-run with -v/--verbose to see all issues")}`);
498
+ }
499
+ }
500
+ if (error.docsUrl && isVerbose(flags, 1)) lines.push(formatDimText(error.docsUrl));
501
+ if (isVerbose(flags, 2) && error.meta) lines.push(`${formatDimText(` Meta: ${JSON.stringify(error.meta, null, 2)}`)}`);
502
+ return lines.join("\n");
503
+ }
504
+ /**
505
+ * Formats error output as JSON.
506
+ */
507
+ function formatErrorJson(error) {
508
+ return JSON.stringify(error, null, 2);
509
+ }
510
+ //#endregion
420
511
  //#region src/utils/result-handler.ts
421
512
  /**
422
513
  * Processes a CLI command result, handling both success and error cases.
@@ -438,6 +529,333 @@ function handleResult(result, flags, ui, onSuccess) {
438
529
  return result.failure.domain === "CLI" ? 2 : 1;
439
530
  }
440
531
  //#endregion
532
+ //#region src/utils/glyph-mode.ts
533
+ function localeString(env) {
534
+ return env["LC_ALL"] ?? env["LC_CTYPE"] ?? env["LANG"] ?? "";
535
+ }
536
+ function isUtf8Locale(env) {
537
+ const locale = localeString(env);
538
+ if (locale.length === 0) return false;
539
+ return /UTF-8|utf8/i.test(locale);
540
+ }
541
+ function detectGlyphMode(input) {
542
+ if (!input.isTTY) return "ascii";
543
+ if (!isUtf8Locale(input.env)) return "ascii";
544
+ return "unicode";
545
+ }
546
+ //#endregion
547
+ //#region src/utils/shutdown.ts
548
+ function createShutdownHandler(options) {
549
+ const exit = options?.exit ?? ((code) => process.exit(code));
550
+ const gracePeriodMs = options?.gracePeriodMs ?? 3e3;
551
+ const controller = new AbortController();
552
+ let shuttingDown = false;
553
+ let graceTimer;
554
+ const onSignal = () => {
555
+ if (shuttingDown) {
556
+ exit(130);
557
+ return;
558
+ }
559
+ shuttingDown = true;
560
+ controller.abort();
561
+ graceTimer = setTimeout(() => exit(130), gracePeriodMs);
562
+ graceTimer.unref();
563
+ };
564
+ return {
565
+ signal: controller.signal,
566
+ isShuttingDown: () => shuttingDown,
567
+ onSignal,
568
+ clearGraceTimer: () => {
569
+ if (graceTimer !== void 0) {
570
+ clearTimeout(graceTimer);
571
+ graceTimer = void 0;
572
+ }
573
+ }
574
+ };
575
+ }
576
+ const globalHandler = createShutdownHandler();
577
+ /**
578
+ * The global AbortSignal. Pass this to any async operation that should
579
+ * be cancellable on Ctrl+C (e.g., DB queries, long-running emit).
580
+ */
581
+ const shutdownSignal = globalHandler.signal;
582
+ /**
583
+ * Installs SIGINT and SIGTERM handlers. Call once at CLI startup.
584
+ *
585
+ * - First signal: aborts the controller, starts a 3s grace timer.
586
+ * - Second signal: force-exits immediately.
587
+ */
588
+ let installed = false;
589
+ function installShutdownHandlers() {
590
+ if (installed) return;
591
+ installed = true;
592
+ process.on("SIGINT", globalHandler.onSignal);
593
+ process.on("SIGTERM", globalHandler.onSignal);
594
+ }
595
+ //#endregion
596
+ //#region src/utils/terminal-ui.ts
597
+ /**
598
+ * Composable CLI output abstraction.
599
+ *
600
+ * Follows the Unix convention of separating data from decoration:
601
+ * - **stdout** — data output only (`ui.output()`). This is what scripts and pipes capture.
602
+ * - **stderr** — all decoration (spinners, logs, notes, intro/outro). Visible in terminal, invisible in pipes.
603
+ *
604
+ * Rules:
605
+ * 1. All methods except `output()` and `error()` write to stderr only in interactive mode.
606
+ * 2. `output(data)` always writes to stdout — if a command calls it, there is data to emit.
607
+ * 3. `error()` always writes to stderr — errors matter even when piped.
608
+ * 4. Decoration is suppressed when piped unless `--format pretty` was explicit (`forcePretty`).
609
+ * 5. Never write data to stderr — decoration methods are for human context only.
610
+ * 6. Never write decoration to stdout — it breaks pipes, `$(...)` captures, and `> file` redirects.
611
+ */
612
+ var TerminalUI = class TerminalUI {
613
+ /**
614
+ * True when stdout is a TTY (interactive terminal).
615
+ * False when piped (e.g., `prisma-next db verify | jq`).
616
+ */
617
+ isInteractive;
618
+ /**
619
+ * Whether color output is enabled.
620
+ */
621
+ useColor;
622
+ /**
623
+ * When true, decoration methods write even on non-TTY stdout
624
+ * (explicit `--format pretty`).
625
+ */
626
+ forcePretty;
627
+ /**
628
+ * Whether stdout is a TTY — used for migration-list graph glyph detection.
629
+ */
630
+ stdoutIsTTY;
631
+ /**
632
+ * Process environment snapshot for locale-aware glyph detection.
633
+ */
634
+ env;
635
+ static stderrOpts = { output: process.stderr };
636
+ constructor(options) {
637
+ this.isInteractive = options?.interactive ?? !!process.stdout.isTTY;
638
+ this.forcePretty = options?.forcePretty ?? false;
639
+ this.useColor = options?.color ?? (this.isInteractive || this.forcePretty);
640
+ this.stdoutIsTTY = options?.stdoutIsTTY ?? !!process.stdout.isTTY;
641
+ this.env = options?.env ?? process.env;
642
+ }
643
+ get isTTY() {
644
+ return this.stdoutIsTTY;
645
+ }
646
+ /**
647
+ * Resolve graph glyph mode for `migration list --graph`. `--ascii` forces
648
+ * ASCII; otherwise delegates to the pure {@link detectGlyphMode} helper.
649
+ */
650
+ resolveGlyphMode(forceAscii) {
651
+ if (forceAscii) return "ascii";
652
+ return detectGlyphMode(this.glyphModeInput());
653
+ }
654
+ glyphModeInput() {
655
+ return {
656
+ isTTY: this.stdoutIsTTY,
657
+ env: this.env
658
+ };
659
+ }
660
+ get shouldDecorate() {
661
+ return this.isInteractive || this.forcePretty;
662
+ }
663
+ /**
664
+ * Log a message line to stderr. No-op when piped unless forcePretty.
665
+ */
666
+ log(message) {
667
+ if (!this.shouldDecorate) return;
668
+ clack.log.message(message, TerminalUI.stderrOpts);
669
+ }
670
+ /**
671
+ * Log a success message to stderr. No-op when piped unless forcePretty.
672
+ */
673
+ success(message) {
674
+ if (!this.shouldDecorate) return;
675
+ clack.log.success(message, TerminalUI.stderrOpts);
676
+ }
677
+ /**
678
+ * Log a warning message to stderr. No-op when piped unless forcePretty.
679
+ */
680
+ warn(message) {
681
+ if (!this.shouldDecorate) return;
682
+ clack.log.warn(message, TerminalUI.stderrOpts);
683
+ }
684
+ /**
685
+ * Log an error message to stderr. Always writes (errors matter even in pipes).
686
+ */
687
+ error(message) {
688
+ clack.log.error(message, TerminalUI.stderrOpts);
689
+ }
690
+ /**
691
+ * Log an info message to stderr. No-op when piped unless forcePretty.
692
+ */
693
+ info(message) {
694
+ if (!this.shouldDecorate) return;
695
+ clack.log.info(message, TerminalUI.stderrOpts);
696
+ }
697
+ /**
698
+ * Log a step message to stderr. No-op when piped unless forcePretty.
699
+ */
700
+ step(message) {
701
+ if (!this.shouldDecorate) return;
702
+ clack.log.step(message, TerminalUI.stderrOpts);
703
+ }
704
+ /**
705
+ * Display a note box on stderr. No-op when piped unless forcePretty.
706
+ */
707
+ note(message, title) {
708
+ if (!this.shouldDecorate) return;
709
+ clack.note(message, title, TerminalUI.stderrOpts);
710
+ }
711
+ /**
712
+ * Display intro banner on stderr. No-op when piped unless forcePretty.
713
+ */
714
+ intro(title) {
715
+ if (!this.shouldDecorate) return;
716
+ clack.intro(title, TerminalUI.stderrOpts);
717
+ }
718
+ /**
719
+ * Display outro banner on stderr. No-op when piped unless forcePretty.
720
+ */
721
+ outro(message) {
722
+ if (!this.shouldDecorate) return;
723
+ clack.outro(message, TerminalUI.stderrOpts);
724
+ }
725
+ /**
726
+ * Create a Clack spinner on stderr with a 100ms delay threshold.
727
+ * The spinner only appears if the operation takes longer than the threshold,
728
+ * avoiding flicker for fast operations. Returns a no-op spinner when not decorating.
729
+ */
730
+ spinner(delayMs = 100) {
731
+ const noop = {
732
+ start: () => {},
733
+ stop: () => {},
734
+ cancel: () => {},
735
+ error: () => {},
736
+ message: () => {},
737
+ clear: () => {},
738
+ get isCancelled() {
739
+ return false;
740
+ }
741
+ };
742
+ if (!this.shouldDecorate) return noop;
743
+ let inner;
744
+ let timer;
745
+ let pendingMsg;
746
+ let settled = false;
747
+ const ensureCleared = () => {
748
+ if (timer !== void 0) {
749
+ clearTimeout(timer);
750
+ timer = void 0;
751
+ }
752
+ };
753
+ const onAbort = () => {
754
+ if (!settled) {
755
+ settled = true;
756
+ ensureCleared();
757
+ if (inner) inner.cancel("Interrupted");
758
+ }
759
+ };
760
+ if (!shutdownSignal.aborted) shutdownSignal.addEventListener("abort", onAbort, { once: true });
761
+ return {
762
+ start(msg) {
763
+ pendingMsg = msg;
764
+ timer = setTimeout(() => {
765
+ if (!settled) {
766
+ inner = clack.spinner(TerminalUI.stderrOpts);
767
+ inner.start(pendingMsg);
768
+ }
769
+ }, delayMs);
770
+ },
771
+ stop(msg) {
772
+ settled = true;
773
+ ensureCleared();
774
+ if (inner) inner.stop(msg);
775
+ },
776
+ cancel(msg) {
777
+ settled = true;
778
+ ensureCleared();
779
+ if (inner) inner.cancel(msg);
780
+ },
781
+ error(msg) {
782
+ settled = true;
783
+ ensureCleared();
784
+ if (inner) inner.error(msg);
785
+ },
786
+ message(msg) {
787
+ pendingMsg = msg;
788
+ if (inner) inner.message(msg);
789
+ },
790
+ clear() {
791
+ settled = true;
792
+ ensureCleared();
793
+ if (inner) inner.clear();
794
+ },
795
+ get isCancelled() {
796
+ return inner?.isCancelled ?? false;
797
+ }
798
+ };
799
+ }
800
+ /**
801
+ * Prompt for yes/no confirmation on stderr. Returns true if confirmed.
802
+ * In non-interactive mode or when cancelled (Ctrl-C), returns false.
803
+ */
804
+ async confirm(message) {
805
+ if (!this.isInteractive) return false;
806
+ const result = await clack.confirm({
807
+ message,
808
+ ...TerminalUI.stderrOpts
809
+ });
810
+ if (clack.isCancel(result)) return false;
811
+ return result;
812
+ }
813
+ /**
814
+ * Write a raw line to stderr. No-op when piped unless forcePretty.
815
+ * Use for decoration that doesn't fit Clack's log format (e.g. styled headers).
816
+ */
817
+ stderr(message) {
818
+ if (!this.shouldDecorate) return;
819
+ process.stderr.write(`${message}\n`);
820
+ }
821
+ /**
822
+ * Write machine-readable data to stdout.
823
+ * Always writes — if a command calls output(), there is data to emit.
824
+ *
825
+ * This is what scripts and pipes capture: `prisma-next db verify --json | jq .ok`
826
+ */
827
+ output(data) {
828
+ process.stdout.write(`${data}\n`);
829
+ }
830
+ green(text) {
831
+ return this.useColor ? green(text) : text;
832
+ }
833
+ red(text) {
834
+ return this.useColor ? red(text) : text;
835
+ }
836
+ cyan(text) {
837
+ return this.useColor ? cyan(text) : text;
838
+ }
839
+ dim(text) {
840
+ return this.useColor ? dim(text) : text;
841
+ }
842
+ bold(text) {
843
+ return this.useColor ? bold(text) : text;
844
+ }
845
+ yellow(text) {
846
+ return this.useColor ? yellow(text) : text;
847
+ }
848
+ };
849
+ function createTerminalUI(flags, runtime) {
850
+ return new TerminalUI({
851
+ color: flags.color,
852
+ interactive: flags.interactive,
853
+ forcePretty: flags.format === "pretty" && flags.explicitFormat,
854
+ stdoutIsTTY: runtime?.isTTY,
855
+ env: runtime?.env
856
+ });
857
+ }
858
+ //#endregion
441
859
  //#region src/utils/global-flags.ts
442
860
  function isJsonFlagSet(json) {
443
861
  return json === true;
@@ -525,7 +943,7 @@ function parseGlobalFlags(options) {
525
943
  if (process.env["NO_COLOR"] || flags.json) flags.color = false;
526
944
  else if (options["no-color"]) flags.color = false;
527
945
  else if (options.color !== void 0) flags.color = options.color;
528
- else flags.color = process.stdout.isTTY && !isCI();
946
+ else flags.color = process.stdout.isTTY && !isCI$1();
529
947
  if (options["no-interactive"]) flags.interactive = false;
530
948
  else if (options.interactive !== void 0) flags.interactive = options.interactive;
531
949
  else flags.interactive = !!process.stdout.isTTY;
@@ -693,10 +1111,10 @@ function getTargetMigrations(target) {
693
1111
  * string); there is no draft state to filter out.
694
1112
  */
695
1113
  async function loadMigrationPackages(migrationsDir) {
696
- const bundles = await readMigrationsDir(migrationsDir);
1114
+ const { packages } = await readMigrationsDir(migrationsDir);
697
1115
  return {
698
- bundles,
699
- graph: reconstructGraph(bundles)
1116
+ bundles: packages,
1117
+ graph: reconstructGraph(packages)
700
1118
  };
701
1119
  }
702
1120
  /**
@@ -773,6 +1191,6 @@ function addGlobalOptions(command) {
773
1191
  } }).option("--format <pretty|json>", "Output format (default: pretty, or json when stdout is not a TTY)").option("--json", "Output as JSON (alias for --format json)").option("-q, --quiet", "Quiet mode: errors only").option("-v, --verbose", "Verbose output: debug info, timings").option("--trace", "Trace output: deep internals, stack traces").option("--color", "Force color output").option("--no-color", "Disable color output").option("--interactive", "Force interactive mode").option("--no-interactive", "Disable interactive prompts").option("-y, --yes", "Auto-accept prompts");
774
1192
  }
775
1193
  //#endregion
776
- export { formatSuccessMessage as C, formatStyledHeader as S, parseGlobalFlags as _, loadMigrationPackages as a, formatCommandHelp as b, resolveContractPath as c, setCommandDescriptions as d, setCommandExamples as f, toStructuralEdge as g, toPathDecisionResult as h, getTargetMigrations as i, resolveMigrationPaths as l, targetSupportsMigrations as m, collectDeclaredInvariants as n, maskConnectionUrl as o, setCommandSeeAlso as p, command_helpers_exports as r, readContractEnvelope as s, addGlobalOptions as t, sanitizeErrorMessage as u, parseGlobalFlagsOrExit as v, formatRootHelp as x, handleResult as y };
1194
+ export { formatDim as A, formatErrorOutput as C, formatStyledHeader as D, formatRootHelp as E, formatSuccessMessage as O, formatErrorJson as S, formatCommandHelp as T, parseGlobalFlags as _, loadMigrationPackages as a, installShutdownHandlers as b, resolveContractPath as c, setCommandDescriptions as d, setCommandExamples as f, toStructuralEdge as g, toPathDecisionResult as h, getTargetMigrations as i, isVerbose as j, createColorFormatter as k, resolveMigrationPaths as l, targetSupportsMigrations as m, collectDeclaredInvariants as n, maskConnectionUrl as o, setCommandSeeAlso as p, command_helpers_exports as r, readContractEnvelope as s, addGlobalOptions as t, sanitizeErrorMessage as u, parseGlobalFlagsOrExit as v, isCI$1 as w, handleResult as x, createTerminalUI as y };
777
1195
 
778
- //# sourceMappingURL=command-helpers-DtavI0wJ.mjs.map
1196
+ //# sourceMappingURL=command-helpers-4UNsRRc4.mjs.map