@prisma/orm-toolchain 0.16.0-dev.36 → 0.16.0-dev.38

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.
@@ -13,10 +13,10 @@ import { t as createMigrationNewCommand } from "./migration-new-BurCjyaQ.mjs";
13
13
  import { t as createMigrationPlanCommand } from "./migration-plan-q_L84PN1-BWE0LTH6.mjs";
14
14
  import { t as createMigrationShowCommand } from "./migration-show-Bx5I5aW9.mjs";
15
15
  import { t as createMigrationListCommand } from "./migration-list-BFBeo1_X-c0kqYokL.mjs";
16
- import { r as createMigrationStatusCommand } from "./migration-status-CFlzlRmu-DewBN8Ys.mjs";
16
+ import { r as createMigrationStatusCommand } from "./migration-status-CE7cQLDq-B1jDVmqG.mjs";
17
17
  import { t as createMigrationLogCommand } from "./migration-log-CS5IWcNq-BQ-32Low.mjs";
18
18
  import { t as createMigrationGraphCommand } from "./migration-graph-DkoCC0Qy.mjs";
19
- import { t as createMigrationCheckCommand } from "./migration-check-CcG-fB8r-CDs5C9vt.mjs";
19
+ import { t as createMigrationCheckCommand } from "./migration-check-DcwUnadt-B6Qoh0ot.mjs";
20
20
  import { t as createMigrateCommand } from "./migrate-Cb_iv264.mjs";
21
21
  import { t as createRefCommand } from "./ref-B6cTthTi.mjs";
22
22
  import { a as resolveGating, i as readUserConfig, r as ensureInstallationId, s as runTelemetry, u as userConfigPath } from "./exports-BN0vFTxG.mjs";
@@ -27,7 +27,7 @@ import { Command } from "commander";
27
27
  import { fileURLToPath } from "node:url";
28
28
  import { distance } from "closest-match";
29
29
  //#region ../../../1-framework/3-tooling/cli/dist/cli.mjs
30
- var version = "0.16.0-dev.36";
30
+ var version = "0.16.0-dev.38";
31
31
  /**
32
32
  * The resolver a scaffold for `target` is written against.
33
33
  *
@@ -1 +1 @@
1
- {"version":3,"file":"bin__prisma-next.mjs","names":["isCI"],"sources":["../../../../1-framework/3-tooling/cli/dist/cli.mjs"],"sourcesContent":["#!/usr/bin/env node\nimport { D as isCI, O as formatCommandHelp, g as parseGlobalFlagsOrExit, h as parseGlobalFlags, k as formatRootHelp, l as setCommandDescriptions, m as deriveCanPrompt, t as addGlobalOptions, u as setCommandExamples, v as installShutdownHandlers } from \"./command-helpers-CAoXqAY9.mjs\";\nimport { t as createContractEmitCommand } from \"./contract-emit-0hSjbuxp.mjs\";\nimport { t as createContractInferCommand } from \"./contract-infer-BnkqpftN.mjs\";\nimport { createDbInitCommand } from \"./commands/db-init.mjs\";\nimport { createDbSchemaCommand } from \"./commands/db-schema.mjs\";\nimport { createDbSignCommand } from \"./commands/db-sign.mjs\";\nimport { createDbUpdateCommand } from \"./commands/db-update.mjs\";\nimport { t as createDbVerifyCommand } from \"./db-verify-CKPsRFrj.mjs\";\nimport { t as createFormatCommand } from \"./format-ByDm2goZ.mjs\";\nimport { t as createMigrationListCommand } from \"./migration-list-BFBeo1_X.mjs\";\nimport { createMigrateCommand } from \"./commands/migrate.mjs\";\nimport { t as createMigrationCheckCommand } from \"./migration-check-CcG-fB8r.mjs\";\nimport { createMigrationGraphCommand } from \"./commands/migration-graph.mjs\";\nimport { t as createMigrationLogCommand } from \"./migration-log-CS5IWcNq.mjs\";\nimport { createMigrationNewCommand } from \"./commands/migration-new.mjs\";\nimport { t as createMigrationPlanCommand } from \"./migration-plan-q_L84PN1.mjs\";\nimport { createMigrationShowCommand } from \"./commands/migration-show.mjs\";\nimport { r as createMigrationStatusCommand } from \"./migration-status-CFlzlRmu.mjs\";\nimport { createRefCommand } from \"./commands/ref.mjs\";\nimport { t as createTelemetryCommand } from \"./telemetry-CmbCa3Ld.mjs\";\nimport { Command } from \"commander\";\nimport { createScaffoldSpecifierResolver } from \"@internal/publish-surface/import-roots\";\nimport { DEFAULT_CONTRACT_SOURCE_DIR } from \"@internal/config/config-types\";\nimport { keepInternalSpecifiers } from \"@internal/framework-components/emission\";\nimport { ensureInstallationId, readUserConfig, resolveGating, runTelemetry, userConfigPath } from \"@internal/cli-telemetry\";\nimport { distance } from \"closest-match\";\nimport { fileURLToPath } from \"node:url\";\n//#region package.json\nvar version = \"0.16.0-dev.36\";\n//#endregion\n//#region src/commands/init/templates/code-templates.ts\n/**\n* The resolver a scaffold for `target` is written against.\n*\n* A scaffold is always on the facade root: `init` writes an application around\n* one database package, and the workspace names are not published, so a project\n* scaffolded against them could not install (ADR 242). Both the files `init`\n* writes and the dependency it adds go through this, so they cannot disagree.\n*/\nfunction scaffoldSpecifierResolverFor(target) {\n\treturn createScaffoldSpecifierResolver({\n\t\tmode: \"facade\",\n\t\tfacade: target === \"postgres\" ? \"@prisma/orm-postgres\" : \"@prisma/orm-mongo\"\n\t});\n}\n/**\n* The package name a scaffolded project depends on and imports from, for the\n* import root it is being scaffolded against.\n*\n* Every specifier the scaffold writes derives from this one, and `init` builds\n* a single resolver and hands it to both the file templates and the dependency\n* it installs — so the two cannot disagree. The one caller that deliberately\n* does not thread a resolver is the re-init cleanup in `inputs.ts`, which\n* inspects a manifest an earlier run wrote rather than writing one.\n*\n* Resolvers for scaffolding should come from `createScaffoldSpecifierResolver`\n* in the publish-surface package, which rejects the roots a facade-shaped\n* scaffold cannot express. (Named without its scope on purpose: JSDoc survives\n* into the published bundle, where an internal package name would trip the\n* shell tarball checks.)\n*/\nfunction targetPackageName(target, resolveImportSpecifier = keepInternalSpecifiers) {\n\treturn resolveImportSpecifier(target === \"postgres\" ? \"@internal/postgres\" : \"@internal/mongo\");\n}\n/** One entrypoint of the scaffolded project's target package. */\nfunction targetEntrypoint(target, subpath, resolveImportSpecifier = keepInternalSpecifiers) {\n\treturn resolveImportSpecifier(`${target === \"postgres\" ? \"@internal/postgres\" : \"@internal/mongo\"}/${subpath}`);\n}\nfunction targetLabel(target) {\n\treturn target === \"postgres\" ? \"PostgreSQL\" : \"MongoDB\";\n}\nfunction defaultSchemaPath(authoring) {\n\tif (authoring === \"typescript\") return `${DEFAULT_CONTRACT_SOURCE_DIR}/contract.ts`;\n\treturn `${DEFAULT_CONTRACT_SOURCE_DIR}/contract.prisma`;\n}\nfunction starterSchema(target, authoring, resolveImportSpecifier = keepInternalSpecifiers) {\n\tif (authoring === \"typescript\") {\n\t\tconst builder = targetEntrypoint(target, \"contract-builder\", resolveImportSpecifier);\n\t\treturn target === \"mongo\" ? starterSchemaTsMongo(builder) : starterSchemaTsPostgres(builder);\n\t}\n\treturn target === \"mongo\" ? starterSchemaPslMongo() : starterSchemaPslPostgres();\n}\n/**\n* Renders a short authoring-appropriate schema sample (FR5.1) for embedding\n* in `prisma-next.md`. Returns a complete fenced markdown code block.\n*\n* The sample intentionally shows just one model: it's illustrative, not\n* a substitute for the full scaffolded contract file. The TS samples use\n* the same outer shape as `starterSchemaTs*` (FR5.3) so a user reading\n* the doc and the file side-by-side sees the same structure.\n*/\nfunction schemaSample(target, authoring, resolveImportSpecifier = keepInternalSpecifiers) {\n\tif (authoring === \"typescript\") {\n\t\tconst builder = targetEntrypoint(target, \"contract-builder\", resolveImportSpecifier);\n\t\treturn target === \"mongo\" ? schemaSampleTsMongo(builder) : schemaSampleTsPostgres(builder);\n\t}\n\treturn target === \"mongo\" ? schemaSamplePslMongo() : schemaSamplePslPostgres();\n}\nfunction schemaSamplePslPostgres() {\n\treturn `\\`\\`\\`prisma\nmodel User {\n id Int @id @default(autoincrement())\n email String @unique\n username String?\n name String?\n}\n\\`\\`\\``;\n}\nfunction schemaSamplePslMongo() {\n\treturn `\\`\\`\\`prisma\nmodel User {\n id ObjectId @id @map(\"_id\")\n email String @unique\n username String?\n name String?\n @@map(\"users\")\n}\n\\`\\`\\``;\n}\nfunction schemaSampleTsPostgres(builder) {\n\treturn `\\`\\`\\`typescript\nimport { defineContract } from '${builder}';\n\nexport const contract = defineContract(\n {},\n ({ field, model }) => ({\n models: {\n User: model('User', {\n fields: {\n id: field.id.uuidv7String(),\n email: field.text().unique(),\n username: field.text().optional(),\n name: field.text().optional(),\n },\n }),\n },\n }),\n);\n\\`\\`\\``;\n}\nfunction schemaSampleTsMongo(builder) {\n\treturn `\\`\\`\\`typescript\nimport { defineContract } from '${builder}';\n\nexport const contract = defineContract(\n {},\n ({ field, model }) => ({\n models: {\n User: model('User', {\n collection: 'users',\n fields: {\n _id: field.objectId(),\n email: field.string(),\n username: field.string().optional(),\n name: field.string().optional(),\n },\n }),\n },\n }),\n);\n\\`\\`\\``;\n}\nfunction starterSchemaPslPostgres() {\n\treturn `// use prisma-next\n\nmodel User {\n id Int @id @default(autoincrement())\n email String @unique\n username String?\n name String?\n posts Post[]\n createdAt DateTime @default(now())\n updatedAt temporal.updatedAt()\n}\n\nmodel Post {\n id Int @id @default(autoincrement())\n title String\n content String?\n author User @relation(fields: [authorId], references: [id])\n authorId Int\n createdAt DateTime @default(now())\n updatedAt temporal.updatedAt()\n}\n`;\n}\nfunction starterSchemaPslMongo() {\n\treturn `// use prisma-next\n\nmodel User {\n id ObjectId @id @map(\"_id\")\n email String @unique\n username String?\n name String?\n posts Post[]\n @@map(\"users\")\n}\n\nmodel Post {\n id ObjectId @id @map(\"_id\")\n title String\n content String?\n author User @relation(fields: [authorId], references: [id])\n authorId ObjectId\n @@map(\"posts\")\n}\n`;\n}\nfunction starterSchemaTsPostgres(builder) {\n\treturn `import { defineContract } from '${builder}';\n\nexport const contract = defineContract(\n {},\n ({ field, model, rel }) => ({\n models: {\n User: model('User', {\n fields: {\n id: field.id.uuidv7String(),\n email: field.text().unique(),\n username: field.text().optional(),\n name: field.text().optional(),\n createdAt: field.temporal.createdAt(),\n updatedAt: field.temporal.updatedAt(),\n },\n relations: {\n posts: rel.hasMany('Post', { by: 'authorId' }),\n },\n }),\n\n Post: model('Post', {\n fields: {\n id: field.id.uuidv7String(),\n title: field.text(),\n content: field.text().optional(),\n authorId: field.uuidString(),\n createdAt: field.temporal.createdAt(),\n updatedAt: field.temporal.updatedAt(),\n },\n relations: {\n author: rel.belongsTo('User', { from: 'authorId', to: 'id' }),\n },\n }),\n },\n }),\n);\n`;\n}\nfunction starterSchemaTsMongo(builder) {\n\treturn `import { defineContract } from '${builder}';\n\nexport const contract = defineContract(\n {},\n ({ field, model, rel }) => ({\n models: {\n User: model('User', {\n collection: 'users',\n fields: {\n _id: field.objectId(),\n email: field.string(),\n username: field.string().optional(),\n name: field.string().optional(),\n },\n relations: {\n posts: rel.hasMany('Post', { from: '_id', to: 'authorId' }),\n },\n }),\n\n Post: model('Post', {\n collection: 'posts',\n fields: {\n _id: field.objectId(),\n title: field.string(),\n content: field.string().optional(),\n authorId: field.objectId(),\n },\n relations: {\n author: rel.belongsTo('User', { from: 'authorId', to: '_id' }),\n },\n }),\n },\n }),\n);\n`;\n}\nfunction configFile(target, contractPath, resolveImportSpecifier = keepInternalSpecifiers) {\n\treturn `import 'dotenv/config';\nimport { defineConfig } from '${targetEntrypoint(target, \"config\", resolveImportSpecifier)}';\n\nexport default defineConfig({\n contract: ${JSON.stringify(contractPath)},\n db: {\n connection: process.env['DATABASE_URL']!,\n },\n});\n`;\n}\nfunction dbFile(target, resolveImportSpecifier = keepInternalSpecifiers) {\n\tconst runtime = targetEntrypoint(target, \"runtime\", resolveImportSpecifier);\n\tif (target === \"postgres\") return `import postgres from '${runtime}';\nimport type { Contract } from './contract.d';\nimport contractJson from './contract.json' with { type: 'json' };\n\nexport const db = postgres<Contract>({\n contractJson,\n url: process.env['DATABASE_URL']!,\n});\n`;\n\treturn `import mongo from '${runtime}';\nimport type { Contract } from './contract.d';\nimport contractJson from './contract.json' with { type: 'json' };\n\nexport const db = mongo<Contract>({\n contractJson,\n url: process.env['DATABASE_URL']!,\n});\n`;\n}\n//#endregion\n//#region src/commands/init/index.ts\nfunction createInitCommand() {\n\tconst command = new Command(\"init\");\n\tsetCommandDescriptions(command, \"Initialize a new Prisma Next project\", `Scaffolds config, schema, and runtime files, installs dependencies,\nand emits the contract. Gets you from zero to typed queries in one step.\n\nRun interactively for a guided experience, or supply --target / --authoring\nand --yes for a fully scriptable run (CI, AI coding agents, automation).\n\nExit codes (see CLI Style Guide § Exit Codes):\n 0 OK Init succeeded.\\n 1 INTERNAL_ERROR Unexpected bug in prisma-next (please report).\\n 2 PRECONDITION Bad flags / missing prerequisite (e.g. no package.json).\\n 3 USER_ABORTED User cancelled an interactive prompt.\\n 4 INSTALL_FAILED Dependency installation failed (init-specific).\\n 5 EMIT_FAILED \\`contract emit\\` failed after install (init-specific).\\n 6 SKILL_INSTALL_FAILED Agent-skill install failed (re-run with --no-skill to skip).`);\n\tsetCommandExamples(command, [\n\t\t\"prisma-next init\",\n\t\t\"prisma-next init --yes --target postgres --authoring psl\",\n\t\t\"prisma-next init --yes --target mongodb --authoring typescript --json\",\n\t\t\"prisma-next init --yes --force --target postgres --authoring psl # overwrite an existing scaffold\",\n\t\t\"prisma-next init --no-install # skip pnpm/npm install + emit\",\n\t\t\"prisma-next init --no-skill # skip the skills install (air-gapped / restricted env)\"\n\t]);\n\treturn 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) => {\n\t\tconst { runInit } = await import(\"./init-DHctXAI9.mjs\");\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst canPrompt = deriveCanPrompt({\n\t\t\tflagsInteractive: flags.interactive,\n\t\t\toptionInteractive: options.interactive,\n\t\t\tstdinIsTTY: Boolean(process.stdin.isTTY)\n\t\t});\n\t\tconst exitCode = await runInit(process.cwd(), {\n\t\t\toptions,\n\t\t\tflags,\n\t\t\tcanPrompt\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n}\n//#endregion\n//#region src/commands/lsp.ts\nfunction createLspCommand() {\n\tconst command = new Command(\"lsp\");\n\tsetCommandDescriptions(command, \"Start the Prisma Next language server\", \"Launches a Language Server Protocol server that publishes PSL parse diagnostics\\nand handles whole-document PSL formatting for the schema inputs declared in\\nyour config (contract.source.inputs). Formatting uses the Prisma Next PSL\\nformatter and the formatter block from the project config.\\nCommunicates over stdio; intended to be spawned by an\\neditor, not run interactively. The server keeps running until the editor client\\ndisconnects.\");\n\tsetCommandExamples(command, [\"prisma-next lsp --stdio\"]);\n\taddGlobalOptions(command).option(\"--stdio\", \"Communicate with the editor over stdio (the default and only transport)\").action(async () => {\n\t\tconst { startServer } = await import(\"@internal/language-server\");\n\t\tstartServer();\n\t});\n\treturn command;\n}\n//#endregion\n//#region src/utils/suggest-command.ts\n/**\n* Suggests similar command names for a mistyped input.\n*\n* Uses Levenshtein distance to find close matches. Only suggests commands\n* within a reasonable distance threshold (40% of the input length, minimum 2).\n* Returns up to 3 suggestions in case of ties.\n*\n* @returns Array of suggested command names (empty if nothing is close enough).\n*/\nfunction suggestCommands(input, candidates) {\n\tif (candidates.length === 0) return [];\n\tconst maxDistance = Math.max(2, Math.ceil(input.length * .4));\n\tconst scored = candidates.map((name) => ({\n\t\tname,\n\t\tdist: distance(input, name)\n\t})).filter((entry) => entry.dist <= maxDistance).sort((a, b) => a.dist - b.dist);\n\tif (scored.length === 0) return [];\n\tconst bestDist = scored[0].dist;\n\treturn scored.filter((entry) => entry.dist === bestDist).slice(0, 3).map((entry) => entry.name);\n}\n//#endregion\n//#region src/utils/telemetry.ts\n/**\n* Resolve the commander command path from a leaf `Command`, walking up\n* the parent chain. Result is rooted at the program name and ends at\n* the leaf — `['prisma-next', 'migration', 'new']` for\n* `prisma-next migration new …`.\n*/\nfunction commandPathFor(actionCommand) {\n\tconst path = [];\n\tlet cursor = actionCommand;\n\twhile (cursor !== null) {\n\t\tpath.unshift(cursor.name());\n\t\tcursor = cursor.parent;\n\t}\n\treturn path;\n}\nfunction commanderOptionSnapshots(actionCommand) {\n\treturn actionCommand.options.map((option) => {\n\t\tconst attributeName = option.attributeName();\n\t\treturn {\n\t\t\tattributeName,\n\t\t\tlongName: option.long ?? null,\n\t\t\tsource: actionCommand.getOptionValueSource(attributeName) ?? null\n\t\t};\n\t});\n}\n/**\n* Project commander's leaf `Command` into the wire-shape snapshot the\n* telemetry sanitiser consumes. Pure projection — no env, no I/O.\n*/\nfunction commanderSnapshotForTelemetry(actionCommand) {\n\treturn {\n\t\tcommandPath: commandPathFor(actionCommand),\n\t\tpositionalArgs: actionCommand.args,\n\t\toptions: commanderOptionSnapshots(actionCommand)\n\t};\n}\nfunction resolveTelemetryGate() {\n\tif (isCI()) return {\n\t\tenabled: false,\n\t\toutcome: {\n\t\t\tspawned: false,\n\t\t\treason: \"ci\"\n\t\t}\n\t};\n\tconst userConfig = readUserConfig();\n\tif (!resolveGating({\n\t\tenv: process.env,\n\t\tconfig: userConfig\n\t}).enabled) return {\n\t\tenabled: false,\n\t\toutcome: {\n\t\t\tspawned: false,\n\t\t\treason: \"gated-off\"\n\t\t}\n\t};\n\treturn {\n\t\tenabled: true,\n\t\tuserConfig\n\t};\n}\n/**\n* Path to the compiled sender script inside `@internal/cli-telemetry`'s\n* `dist/`. Resolved off this module's `import.meta.url` via the package\n* specifier `@internal/cli-telemetry/sender`, so the consumer pays\n* no attention to internal package layout.\n*/\nfunction senderPath() {\n\treturn fileURLToPath(new URL(import.meta.resolve(\"@internal/cli-telemetry/sender\")));\n}\nfunction fireTelemetry(actionCommand, userConfig) {\n\treturn runTelemetry({\n\t\tcommand: commanderSnapshotForTelemetry(actionCommand),\n\t\tversion,\n\t\tprojectRoot: process.cwd(),\n\t\tsenderPath: senderPath(),\n\t\tisCI: isCI(),\n\t\tenv: process.env,\n\t\tuserConfig\n\t});\n}\n/**\n* preAction-stage entry point. Synchronous by construction: resolve\n* env/CI/user-consent gates (cheap, all in-memory and a single tiny\n* user-config read), then — only when enabled — `fork()` the detached\n* sender script. The forked child loads `prisma-next.config.*` via\n* c12 on its own (see `loadProjectConfig` in cli-telemetry); the\n* parent does no project-config I/O on the command's hot path.\n*\n* Privacy invariant: gate resolution always happens before any project\n* config touches disk. The child loading user TS code is acceptable\n* only because it's gated behind the same resolved-enabled signal.\n*/\n/**\n* Builds the one-time first-run disclosure. The resolved absolute path to\n* the user-level config file is substituted in so the user can see exactly\n* which file to edit (it must not be confused with `prisma-next.config.ts`).\n* `prisma-next telemetry disable` is named as the primary, friendliest\n* opt-out, alongside the env vars and the config edit.\n*/\nfunction firstRunNotice(configPath) {\n\treturn [\n\t\t\"Prisma Next collects anonymous CLI usage data, enabled by default.\",\n\t\t\"What's collected and why: https://prisma-next.dev/docs/cli/telemetry.\",\n\t\t\"Opt out: run \\\"prisma-next telemetry disable\\\", set DO_NOT_TRACK=1 or\",\n\t\t`PRISMA_NEXT_DISABLE_TELEMETRY=1, or set \"enableTelemetry\": false in ${configPath}.`\n\t].join(\" \");\n}\n/**\n* Best-effort first-run disclosure + installationId mint. Runs only on the\n* gating-enabled path. Prints the notice to stderr (never stdout) and mints\n* a persistent id without touching `enableTelemetry`, so the opt-out default\n* stays intact and no unasked-for consent is recorded.\n*\n* Every step is wrapped so an un-writable config dir (or any other failure)\n* never throws and never blocks the command. Returns the minted (or\n* pre-existing) id so the caller can forward it to `runTelemetry` without a\n* redundant disk read. On mint failure it returns `undefined`: the notice may\n* reprint next run, and `runTelemetry` no-ops on the missing id.\n*/\nfunction discloseAndMintOnFirstRun() {\n\ttry {\n\t\tprocess.stderr.write(`${firstRunNotice(userConfigPath())}\\n`);\n\t} catch {}\n\ttry {\n\t\treturn ensureInstallationId();\n\t} catch {}\n}\n/**\n* True when the run is the `telemetry` command (or one of its\n* subcommands). The usage-telemetry preAction fire is exempted for it:\n* it would be absurd for `telemetry disable` to send a usage event before\n* disabling, or for `telemetry status` to mint an id + send while merely\n* reporting state. This is the only command-specific exemption.\n*\n* The check is rooted at the program: the path must be\n* `['prisma-next', 'telemetry', …]`, so it matches the top-level\n* `telemetry` command and its subcommands without matching a hypothetical\n* nested `… telemetry` elsewhere.\n*/\nfunction isTelemetryCommand(actionCommand) {\n\treturn commandPathFor(actionCommand)[1] === \"telemetry\";\n}\nfunction fireTelemetryFromPreAction(actionCommand) {\n\tif (isTelemetryCommand(actionCommand)) return {\n\t\tspawned: false,\n\t\treason: \"gated-off\"\n\t};\n\tconst gate = resolveTelemetryGate();\n\tif (!gate.enabled) return gate.outcome;\n\tconst storedId = gate.userConfig.installationId;\n\tif (typeof storedId !== \"string\" || storedId.length === 0) {\n\t\tconst installationId = discloseAndMintOnFirstRun();\n\t\treturn fireTelemetry(actionCommand, installationId === void 0 ? gate.userConfig : {\n\t\t\t...gate.userConfig,\n\t\t\tinstallationId\n\t\t});\n\t}\n\treturn fireTelemetry(actionCommand, gate.userConfig);\n}\n//#endregion\n//#region src/cli.ts\ninstallShutdownHandlers();\n/**\n* Lookup table mapping removed subcommands to their replacement verbs.\n* Keyed by `<parent>:<subcommand>` (e.g. `migration:apply`).\n* The handler consults this before falling back to the fuzzy suggest engine.\n*/\nconst removedVerbRedirects = {\n\t\"migration:apply\": \"Use `prisma-next migrate --to <contract>` instead.\",\n\t\"migration:ref\": \"Use `prisma-next ref set|list|delete` instead.\"\n};\n/**\n* Removed flags on specific subcommands. Keyed by `<parent>:<sub>:<flag>`.\n* Checked during the pre-parse argv scan before commander sees the flags.\n*/\nconst removedFlagRedirects = {\n\t\"migration:status:graph\": \"Use `prisma-next migration graph` to view the migration graph.\",\n\t\"migration:status:all\": \"Use `prisma-next migration log --db <url>` to view the full execution history.\",\n\t\"migration:status:limit\": \"Use `prisma-next migration log --db <url>` to view the full execution history.\",\n\t\"migration:status:ref\": \"Use `--to <contract>` instead of `--ref`.\"\n};\n/**\n* Formats the \"Did you mean ...?\" hint for an unknown command.\n*/\nfunction formatSuggestion(input, candidates) {\n\tconst suggestions = suggestCommands(input, candidates.map((c) => c));\n\tif (suggestions.length === 0) return \"\";\n\tif (suggestions.length === 1) return `\\nDid you mean ${suggestions[0]}?\\n`;\n\treturn `\\nDid you mean one of these?\\n${suggestions.map((s) => ` ${s}`).join(\"\\n\")}\\n`;\n}\nconst program = new Command();\nprogram.name(\"prisma-next\").description(\"Prisma Next CLI\").version(version);\nprogram.hook(\"preAction\", (_thisCommand, actionCommand) => {\n\ttry {\n\t\tfireTelemetryFromPreAction(actionCommand);\n\t} catch {}\n});\nconst versionOption = program.options.find((opt) => opt.flags.includes(\"--version\"));\nif (versionOption) versionOption.description = \"Output the version number\";\nprogram.configureOutput({\n\twriteErr: () => {},\n\twriteOut: (str) => {\n\t\tprocess.stdout.write(str);\n\t}\n});\nconst rootHelpFormatter = (cmd) => {\n\treturn formatRootHelp({\n\t\tprogram: cmd,\n\t\tflags: parseGlobalFlags({})\n\t});\n};\nprogram.configureHelp({\n\tformatHelp: rootHelpFormatter,\n\tsubcommandDescription: () => \"\"\n});\nprogram.exitOverride((err) => {\n\tif (err) {\n\t\tconst errorCode = err.code;\n\t\tconst errorMessage = String(err.message ?? \"\");\n\t\tconst errorName = err.name ?? \"\";\n\t\tif (errorCode === \"commander.unknownCommand\" || errorCode === \"commander.unknownArgument\" || errorName === \"CommanderError\" && (errorMessage.includes(\"unknown command\") || errorMessage.includes(\"unknown argument\"))) {\n\t\t\tconst flags = parseGlobalFlags({});\n\t\t\tconst match = errorMessage.match(/unknown command ['\"]([^'\"]+)['\"]/);\n\t\t\tconst commandName = match ? match[1] : process.argv[3] || process.argv[2] || \"unknown\";\n\t\t\tconst firstArg = process.argv[2];\n\t\t\tconst parentCommand = firstArg ? program.commands.find((cmd) => cmd.name() === firstArg) : void 0;\n\t\t\tif (parentCommand && commandName !== firstArg) {\n\t\t\t\tconst subNames = parentCommand.commands.map((c) => c.name());\n\t\t\t\tprocess.stderr.write(`Unknown command: ${commandName}${formatSuggestion(commandName, subNames)}\\n`);\n\t\t\t\tconst helpText = formatCommandHelp({\n\t\t\t\t\tcommand: parentCommand,\n\t\t\t\t\tflags\n\t\t\t\t});\n\t\t\t\tprocess.stderr.write(`${helpText}\\n`);\n\t\t\t} else {\n\t\t\t\tconst topNames = program.commands.map((c) => c.name());\n\t\t\t\tprocess.stderr.write(`Unknown command: ${commandName}${formatSuggestion(commandName, topNames)}\\n`);\n\t\t\t\tconst helpText = formatRootHelp({\n\t\t\t\t\tprogram,\n\t\t\t\t\tflags\n\t\t\t\t});\n\t\t\t\tprocess.stderr.write(`${helpText}\\n`);\n\t\t\t}\n\t\t\tprocess.exit(2);\n\t\t\treturn;\n\t\t}\n\t\tif (errorCode === \"commander.help\" || errorCode === \"commander.helpDisplayed\" || errorCode === \"outputHelp\" || errorMessage === \"(outputHelp)\" || errorMessage.includes(\"outputHelp\") || errorName === \"CommanderError\" && errorMessage.includes(\"outputHelp\")) {\n\t\t\tprocess.exit(0);\n\t\t\treturn;\n\t\t}\n\t\tif (errorCode === \"commander.missingArgument\" || errorCode === \"commander.missingMandatoryOptionValue\" || errorName === \"CommanderError\" && (errorMessage.includes(\"missing\") || errorMessage.includes(\"required\"))) {\n\t\t\tprocess.exit(2);\n\t\t\treturn;\n\t\t}\n\t\tprocess.stderr.write(`Unhandled error: ${err.message}\\n`);\n\t\tif (err.stack) process.stderr.write(`${err.stack}\\n`);\n\t\tprocess.exit(1);\n\t}\n\tprocess.exit(0);\n});\nconst contractCommand = new Command(\"contract\");\nsetCommandDescriptions(contractCommand, \"Contract management commands\", \"Define and emit your application data contract. The contract describes your schema as a\\ndeclarative data structure that can be signed and verified against your database.\");\ncontractCommand.configureHelp({\n\tformatHelp: (cmd) => {\n\t\treturn formatCommandHelp({\n\t\t\tcommand: cmd,\n\t\t\tflags: parseGlobalFlags({})\n\t\t});\n\t},\n\tsubcommandDescription: () => \"\"\n});\nconst contractEmitCommand = createContractEmitCommand();\ncontractCommand.addCommand(contractEmitCommand);\nconst contractInferCommand = createContractInferCommand();\ncontractCommand.addCommand(contractInferCommand);\nconst dbCommand = new Command(\"db\");\nsetCommandDescriptions(dbCommand, \"Database management commands\", \"Verify and sign your database with your contract. Ensure your database schema matches\\nyour contract, and sign it to record the contract hash for future verification.\");\ndbCommand.configureHelp({\n\tformatHelp: (cmd) => {\n\t\treturn formatCommandHelp({\n\t\t\tcommand: cmd,\n\t\t\tflags: parseGlobalFlags({})\n\t\t});\n\t},\n\tsubcommandDescription: () => \"\"\n});\nconst dbVerifyCommand = createDbVerifyCommand();\ndbCommand.addCommand(dbVerifyCommand);\nconst dbInitCommand = createDbInitCommand();\ndbCommand.addCommand(dbInitCommand);\nconst dbUpdateCommand = createDbUpdateCommand();\ndbCommand.addCommand(dbUpdateCommand);\nconst dbSchemaCommand = createDbSchemaCommand();\ndbCommand.addCommand(dbSchemaCommand);\nconst dbSignCommand = createDbSignCommand();\ndbCommand.addCommand(dbSignCommand);\nconst migrationCommand = new Command(\"migration\");\nsetCommandDescriptions(migrationCommand, \"On-disk migration management commands\", \"Plan, apply, and scaffold on-disk migration packages. Migrations are\\ncontract-to-contract edges stored as versioned directories under migrations/.\");\nmigrationCommand.configureHelp({\n\tformatHelp: (cmd) => {\n\t\treturn formatCommandHelp({\n\t\t\tcommand: cmd,\n\t\t\tflags: parseGlobalFlags({})\n\t\t});\n\t},\n\tsubcommandDescription: () => \"\"\n});\nconst migrationPlanCommand = createMigrationPlanCommand();\nmigrationCommand.addCommand(migrationPlanCommand);\nconst migrationNewCommand = createMigrationNewCommand();\nmigrationCommand.addCommand(migrationNewCommand);\nconst migrationShowCommand = createMigrationShowCommand();\nmigrationCommand.addCommand(migrationShowCommand);\nconst migrationStatusCommand = createMigrationStatusCommand();\nmigrationCommand.addCommand(migrationStatusCommand);\nconst migrationLogCommand = createMigrationLogCommand();\nmigrationCommand.addCommand(migrationLogCommand);\nconst migrationListCommand = createMigrationListCommand();\nmigrationCommand.addCommand(migrationListCommand);\nconst migrationGraphCommand = createMigrationGraphCommand();\nmigrationCommand.addCommand(migrationGraphCommand);\nconst migrationCheckCommand = createMigrationCheckCommand();\nmigrationCommand.addCommand(migrationCheckCommand);\nconst migrateCommand = createMigrateCommand();\nconst refCommand = createRefCommand();\nconst telemetryCommand = createTelemetryCommand();\nconst initCommand = createInitCommand();\nconst formatCommand = createFormatCommand();\nconst lspCommand = createLspCommand();\nprogram.addCommand(initCommand);\nprogram.addCommand(migrateCommand);\nprogram.addCommand(formatCommand);\nprogram.addCommand(lspCommand);\nprogram.addCommand(contractCommand);\nprogram.addCommand(dbCommand);\nprogram.addCommand(migrationCommand);\nprogram.addCommand(refCommand);\nprogram.addCommand(telemetryCommand);\nconst TELEMETRY_CRASH_TEST_SLEEP_MS = 200;\nif (process.env[\"PRISMA_NEXT_ENABLE_TEST_COMMANDS\"] === \"1\") {\n\tconst telemetryCrashTestCommand = new Command(\"__telemetry-crash-test\").description(\"Internal: deliberately throw for the telemetry e2e suite.\").action(async () => {\n\t\tawait new Promise((settle) => setTimeout(settle, TELEMETRY_CRASH_TEST_SLEEP_MS));\n\t\tthrow new Error(\"__telemetry-crash-test: intentional crash for e2e coverage\");\n\t});\n\ttelemetryCrashTestCommand.configureHelp({ visibleCommands: () => [] });\n\tprogram.addCommand(telemetryCrashTestCommand, { hidden: true });\n}\nconst helpCommand = new Command(\"help\").description(\"Show usage instructions\").configureHelp({ formatHelp: (cmd) => {\n\treturn formatCommandHelp({\n\t\tcommand: cmd,\n\t\tflags: parseGlobalFlags({})\n\t});\n} }).action(() => {\n\tconst flags = parseGlobalFlags({});\n\tconst helpText = formatRootHelp({\n\t\tprogram,\n\t\tflags\n\t});\n\tprocess.stdout.write(`${helpText}\\n`);\n\tprocess.exit(0);\n});\nprogram.addCommand(helpCommand);\nprogram.action(() => {\n\tconst flags = parseGlobalFlags({});\n\tconst helpText = formatRootHelp({\n\t\tprogram,\n\t\tflags\n\t});\n\tprocess.stderr.write(`${helpText}\\n`);\n\tprocess.exit(0);\n});\nconst args = process.argv.slice(2);\nif (args.length > 0) {\n\tconst commandName = args[0];\n\tif (commandName === \"--version\" || commandName === \"-V\") {\n\t\tprocess.stdout.write(`${program.version()}\\n`);\n\t\tprocess.exit(0);\n\t}\n\tif (!(commandName === \"--help\" || commandName === \"-h\")) {\n\t\tconst command = program.commands.find((cmd) => cmd.name() === commandName);\n\t\tif (!command) {\n\t\t\tconst flags = parseGlobalFlags({});\n\t\t\tconst topNames = program.commands.map((c) => c.name());\n\t\t\tprocess.stderr.write(`Unknown command: ${commandName}${formatSuggestion(commandName, topNames)}\\n`);\n\t\t\tconst helpText = formatRootHelp({\n\t\t\t\tprogram,\n\t\t\t\tflags\n\t\t\t});\n\t\t\tprocess.stderr.write(`${helpText}\\n`);\n\t\t\tprocess.exit(2);\n\t\t} else if (command.commands.length > 0 && args.length >= 2) {\n\t\t\tconst subcommandName = args[1];\n\t\t\tconst redirect = removedVerbRedirects[`${commandName}:${subcommandName}`];\n\t\t\tif (redirect) {\n\t\t\t\tprocess.stderr.write(`Unknown command: ${subcommandName}\\n${redirect}\\n`);\n\t\t\t\tprocess.exit(2);\n\t\t\t}\n\t\t\tfor (let i = 2; i < args.length; i++) {\n\t\t\t\tconst arg = args[i];\n\t\t\t\tif (!arg.startsWith(\"--\")) continue;\n\t\t\t\tconst flagRedirect = removedFlagRedirects[`${commandName}:${subcommandName}:${arg.slice(2)}`];\n\t\t\t\tif (flagRedirect) {\n\t\t\t\t\tprocess.stderr.write(`Unknown option: ${arg}\\n${flagRedirect}\\n`);\n\t\t\t\t\tprocess.exit(2);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (command.commands.length > 0 && args.length === 1) {\n\t\t\tconst helpText = formatCommandHelp({\n\t\t\t\tcommand,\n\t\t\t\tflags: parseGlobalFlags({})\n\t\t\t});\n\t\t\tprocess.stderr.write(`${helpText}\\n`);\n\t\t\tprocess.exit(0);\n\t\t}\n\t}\n}\nprogram.parse();\n//#endregion\nexport { schemaSample as a, targetLabel as c, scaffoldSpecifierResolverFor as i, targetPackageName as l, d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ACjB,QAAQ,OAAO,MAAM,mBAAmB,IAAI,IAAI,aAAa,GAAG;KAChE,QAAQ,KAAK,CAAC;IACf;GACD;EACD;EACA,IAAI,QAAQ,SAAS,SAAS,KAAK,KAAK,WAAW,GAAG;GACrD,MAAM,WAAW,kBAAkB;IAClC;IACA,OAAO,iBAAiB,CAAC,CAAC;GAC3B,CAAC;GACD,QAAQ,OAAO,MAAM,GAAG,SAAS,GAAG;GACpC,QAAQ,KAAK,CAAC;EACf;CACD;AACD;AACA,QAAQ,MAAM"}
1
+ {"version":3,"file":"bin__prisma-next.mjs","names":["isCI"],"sources":["../../../../1-framework/3-tooling/cli/dist/cli.mjs"],"sourcesContent":["#!/usr/bin/env node\nimport { D as isCI, O as formatCommandHelp, g as parseGlobalFlagsOrExit, h as parseGlobalFlags, k as formatRootHelp, l as setCommandDescriptions, m as deriveCanPrompt, t as addGlobalOptions, u as setCommandExamples, v as installShutdownHandlers } from \"./command-helpers-CAoXqAY9.mjs\";\nimport { t as createContractEmitCommand } from \"./contract-emit-0hSjbuxp.mjs\";\nimport { t as createContractInferCommand } from \"./contract-infer-BnkqpftN.mjs\";\nimport { createDbInitCommand } from \"./commands/db-init.mjs\";\nimport { createDbSchemaCommand } from \"./commands/db-schema.mjs\";\nimport { createDbSignCommand } from \"./commands/db-sign.mjs\";\nimport { createDbUpdateCommand } from \"./commands/db-update.mjs\";\nimport { t as createDbVerifyCommand } from \"./db-verify-CKPsRFrj.mjs\";\nimport { t as createFormatCommand } from \"./format-ByDm2goZ.mjs\";\nimport { t as createMigrationListCommand } from \"./migration-list-BFBeo1_X.mjs\";\nimport { createMigrateCommand } from \"./commands/migrate.mjs\";\nimport { t as createMigrationCheckCommand } from \"./migration-check-DcwUnadt.mjs\";\nimport { createMigrationGraphCommand } from \"./commands/migration-graph.mjs\";\nimport { t as createMigrationLogCommand } from \"./migration-log-CS5IWcNq.mjs\";\nimport { createMigrationNewCommand } from \"./commands/migration-new.mjs\";\nimport { t as createMigrationPlanCommand } from \"./migration-plan-q_L84PN1.mjs\";\nimport { createMigrationShowCommand } from \"./commands/migration-show.mjs\";\nimport { r as createMigrationStatusCommand } from \"./migration-status-CE7cQLDq.mjs\";\nimport { createRefCommand } from \"./commands/ref.mjs\";\nimport { t as createTelemetryCommand } from \"./telemetry-CmbCa3Ld.mjs\";\nimport { Command } from \"commander\";\nimport { createScaffoldSpecifierResolver } from \"@internal/publish-surface/import-roots\";\nimport { DEFAULT_CONTRACT_SOURCE_DIR } from \"@internal/config/config-types\";\nimport { keepInternalSpecifiers } from \"@internal/framework-components/emission\";\nimport { ensureInstallationId, readUserConfig, resolveGating, runTelemetry, userConfigPath } from \"@internal/cli-telemetry\";\nimport { distance } from \"closest-match\";\nimport { fileURLToPath } from \"node:url\";\n//#region package.json\nvar version = \"0.16.0-dev.38\";\n//#endregion\n//#region src/commands/init/templates/code-templates.ts\n/**\n* The resolver a scaffold for `target` is written against.\n*\n* A scaffold is always on the facade root: `init` writes an application around\n* one database package, and the workspace names are not published, so a project\n* scaffolded against them could not install (ADR 242). Both the files `init`\n* writes and the dependency it adds go through this, so they cannot disagree.\n*/\nfunction scaffoldSpecifierResolverFor(target) {\n\treturn createScaffoldSpecifierResolver({\n\t\tmode: \"facade\",\n\t\tfacade: target === \"postgres\" ? \"@prisma/orm-postgres\" : \"@prisma/orm-mongo\"\n\t});\n}\n/**\n* The package name a scaffolded project depends on and imports from, for the\n* import root it is being scaffolded against.\n*\n* Every specifier the scaffold writes derives from this one, and `init` builds\n* a single resolver and hands it to both the file templates and the dependency\n* it installs — so the two cannot disagree. The one caller that deliberately\n* does not thread a resolver is the re-init cleanup in `inputs.ts`, which\n* inspects a manifest an earlier run wrote rather than writing one.\n*\n* Resolvers for scaffolding should come from `createScaffoldSpecifierResolver`\n* in the publish-surface package, which rejects the roots a facade-shaped\n* scaffold cannot express. (Named without its scope on purpose: JSDoc survives\n* into the published bundle, where an internal package name would trip the\n* shell tarball checks.)\n*/\nfunction targetPackageName(target, resolveImportSpecifier = keepInternalSpecifiers) {\n\treturn resolveImportSpecifier(target === \"postgres\" ? \"@internal/postgres\" : \"@internal/mongo\");\n}\n/** One entrypoint of the scaffolded project's target package. */\nfunction targetEntrypoint(target, subpath, resolveImportSpecifier = keepInternalSpecifiers) {\n\treturn resolveImportSpecifier(`${target === \"postgres\" ? \"@internal/postgres\" : \"@internal/mongo\"}/${subpath}`);\n}\nfunction targetLabel(target) {\n\treturn target === \"postgres\" ? \"PostgreSQL\" : \"MongoDB\";\n}\nfunction defaultSchemaPath(authoring) {\n\tif (authoring === \"typescript\") return `${DEFAULT_CONTRACT_SOURCE_DIR}/contract.ts`;\n\treturn `${DEFAULT_CONTRACT_SOURCE_DIR}/contract.prisma`;\n}\nfunction starterSchema(target, authoring, resolveImportSpecifier = keepInternalSpecifiers) {\n\tif (authoring === \"typescript\") {\n\t\tconst builder = targetEntrypoint(target, \"contract-builder\", resolveImportSpecifier);\n\t\treturn target === \"mongo\" ? starterSchemaTsMongo(builder) : starterSchemaTsPostgres(builder);\n\t}\n\treturn target === \"mongo\" ? starterSchemaPslMongo() : starterSchemaPslPostgres();\n}\n/**\n* Renders a short authoring-appropriate schema sample (FR5.1) for embedding\n* in `prisma-next.md`. Returns a complete fenced markdown code block.\n*\n* The sample intentionally shows just one model: it's illustrative, not\n* a substitute for the full scaffolded contract file. The TS samples use\n* the same outer shape as `starterSchemaTs*` (FR5.3) so a user reading\n* the doc and the file side-by-side sees the same structure.\n*/\nfunction schemaSample(target, authoring, resolveImportSpecifier = keepInternalSpecifiers) {\n\tif (authoring === \"typescript\") {\n\t\tconst builder = targetEntrypoint(target, \"contract-builder\", resolveImportSpecifier);\n\t\treturn target === \"mongo\" ? schemaSampleTsMongo(builder) : schemaSampleTsPostgres(builder);\n\t}\n\treturn target === \"mongo\" ? schemaSamplePslMongo() : schemaSamplePslPostgres();\n}\nfunction schemaSamplePslPostgres() {\n\treturn `\\`\\`\\`prisma\nmodel User {\n id Int @id @default(autoincrement())\n email String @unique\n username String?\n name String?\n}\n\\`\\`\\``;\n}\nfunction schemaSamplePslMongo() {\n\treturn `\\`\\`\\`prisma\nmodel User {\n id ObjectId @id @map(\"_id\")\n email String @unique\n username String?\n name String?\n @@map(\"users\")\n}\n\\`\\`\\``;\n}\nfunction schemaSampleTsPostgres(builder) {\n\treturn `\\`\\`\\`typescript\nimport { defineContract } from '${builder}';\n\nexport const contract = defineContract(\n {},\n ({ field, model }) => ({\n models: {\n User: model('User', {\n fields: {\n id: field.id.uuidv7String(),\n email: field.text().unique(),\n username: field.text().optional(),\n name: field.text().optional(),\n },\n }),\n },\n }),\n);\n\\`\\`\\``;\n}\nfunction schemaSampleTsMongo(builder) {\n\treturn `\\`\\`\\`typescript\nimport { defineContract } from '${builder}';\n\nexport const contract = defineContract(\n {},\n ({ field, model }) => ({\n models: {\n User: model('User', {\n collection: 'users',\n fields: {\n _id: field.objectId(),\n email: field.string(),\n username: field.string().optional(),\n name: field.string().optional(),\n },\n }),\n },\n }),\n);\n\\`\\`\\``;\n}\nfunction starterSchemaPslPostgres() {\n\treturn `// use prisma-next\n\nmodel User {\n id Int @id @default(autoincrement())\n email String @unique\n username String?\n name String?\n posts Post[]\n createdAt DateTime @default(now())\n updatedAt temporal.updatedAt()\n}\n\nmodel Post {\n id Int @id @default(autoincrement())\n title String\n content String?\n author User @relation(fields: [authorId], references: [id])\n authorId Int\n createdAt DateTime @default(now())\n updatedAt temporal.updatedAt()\n}\n`;\n}\nfunction starterSchemaPslMongo() {\n\treturn `// use prisma-next\n\nmodel User {\n id ObjectId @id @map(\"_id\")\n email String @unique\n username String?\n name String?\n posts Post[]\n @@map(\"users\")\n}\n\nmodel Post {\n id ObjectId @id @map(\"_id\")\n title String\n content String?\n author User @relation(fields: [authorId], references: [id])\n authorId ObjectId\n @@map(\"posts\")\n}\n`;\n}\nfunction starterSchemaTsPostgres(builder) {\n\treturn `import { defineContract } from '${builder}';\n\nexport const contract = defineContract(\n {},\n ({ field, model, rel }) => ({\n models: {\n User: model('User', {\n fields: {\n id: field.id.uuidv7String(),\n email: field.text().unique(),\n username: field.text().optional(),\n name: field.text().optional(),\n createdAt: field.temporal.createdAt(),\n updatedAt: field.temporal.updatedAt(),\n },\n relations: {\n posts: rel.hasMany('Post', { by: 'authorId' }),\n },\n }),\n\n Post: model('Post', {\n fields: {\n id: field.id.uuidv7String(),\n title: field.text(),\n content: field.text().optional(),\n authorId: field.uuidString(),\n createdAt: field.temporal.createdAt(),\n updatedAt: field.temporal.updatedAt(),\n },\n relations: {\n author: rel.belongsTo('User', { from: 'authorId', to: 'id' }),\n },\n }),\n },\n }),\n);\n`;\n}\nfunction starterSchemaTsMongo(builder) {\n\treturn `import { defineContract } from '${builder}';\n\nexport const contract = defineContract(\n {},\n ({ field, model, rel }) => ({\n models: {\n User: model('User', {\n collection: 'users',\n fields: {\n _id: field.objectId(),\n email: field.string(),\n username: field.string().optional(),\n name: field.string().optional(),\n },\n relations: {\n posts: rel.hasMany('Post', { from: '_id', to: 'authorId' }),\n },\n }),\n\n Post: model('Post', {\n collection: 'posts',\n fields: {\n _id: field.objectId(),\n title: field.string(),\n content: field.string().optional(),\n authorId: field.objectId(),\n },\n relations: {\n author: rel.belongsTo('User', { from: 'authorId', to: '_id' }),\n },\n }),\n },\n }),\n);\n`;\n}\nfunction configFile(target, contractPath, resolveImportSpecifier = keepInternalSpecifiers) {\n\treturn `import 'dotenv/config';\nimport { defineConfig } from '${targetEntrypoint(target, \"config\", resolveImportSpecifier)}';\n\nexport default defineConfig({\n contract: ${JSON.stringify(contractPath)},\n db: {\n connection: process.env['DATABASE_URL']!,\n },\n});\n`;\n}\nfunction dbFile(target, resolveImportSpecifier = keepInternalSpecifiers) {\n\tconst runtime = targetEntrypoint(target, \"runtime\", resolveImportSpecifier);\n\tif (target === \"postgres\") return `import postgres from '${runtime}';\nimport type { Contract } from './contract.d';\nimport contractJson from './contract.json' with { type: 'json' };\n\nexport const db = postgres<Contract>({\n contractJson,\n url: process.env['DATABASE_URL']!,\n});\n`;\n\treturn `import mongo from '${runtime}';\nimport type { Contract } from './contract.d';\nimport contractJson from './contract.json' with { type: 'json' };\n\nexport const db = mongo<Contract>({\n contractJson,\n url: process.env['DATABASE_URL']!,\n});\n`;\n}\n//#endregion\n//#region src/commands/init/index.ts\nfunction createInitCommand() {\n\tconst command = new Command(\"init\");\n\tsetCommandDescriptions(command, \"Initialize a new Prisma Next project\", `Scaffolds config, schema, and runtime files, installs dependencies,\nand emits the contract. Gets you from zero to typed queries in one step.\n\nRun interactively for a guided experience, or supply --target / --authoring\nand --yes for a fully scriptable run (CI, AI coding agents, automation).\n\nExit codes (see CLI Style Guide § Exit Codes):\n 0 OK Init succeeded.\\n 1 INTERNAL_ERROR Unexpected bug in prisma-next (please report).\\n 2 PRECONDITION Bad flags / missing prerequisite (e.g. no package.json).\\n 3 USER_ABORTED User cancelled an interactive prompt.\\n 4 INSTALL_FAILED Dependency installation failed (init-specific).\\n 5 EMIT_FAILED \\`contract emit\\` failed after install (init-specific).\\n 6 SKILL_INSTALL_FAILED Agent-skill install failed (re-run with --no-skill to skip).`);\n\tsetCommandExamples(command, [\n\t\t\"prisma-next init\",\n\t\t\"prisma-next init --yes --target postgres --authoring psl\",\n\t\t\"prisma-next init --yes --target mongodb --authoring typescript --json\",\n\t\t\"prisma-next init --yes --force --target postgres --authoring psl # overwrite an existing scaffold\",\n\t\t\"prisma-next init --no-install # skip pnpm/npm install + emit\",\n\t\t\"prisma-next init --no-skill # skip the skills install (air-gapped / restricted env)\"\n\t]);\n\treturn 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) => {\n\t\tconst { runInit } = await import(\"./init-DHctXAI9.mjs\");\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst canPrompt = deriveCanPrompt({\n\t\t\tflagsInteractive: flags.interactive,\n\t\t\toptionInteractive: options.interactive,\n\t\t\tstdinIsTTY: Boolean(process.stdin.isTTY)\n\t\t});\n\t\tconst exitCode = await runInit(process.cwd(), {\n\t\t\toptions,\n\t\t\tflags,\n\t\t\tcanPrompt\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n}\n//#endregion\n//#region src/commands/lsp.ts\nfunction createLspCommand() {\n\tconst command = new Command(\"lsp\");\n\tsetCommandDescriptions(command, \"Start the Prisma Next language server\", \"Launches a Language Server Protocol server that publishes PSL parse diagnostics\\nand handles whole-document PSL formatting for the schema inputs declared in\\nyour config (contract.source.inputs). Formatting uses the Prisma Next PSL\\nformatter and the formatter block from the project config.\\nCommunicates over stdio; intended to be spawned by an\\neditor, not run interactively. The server keeps running until the editor client\\ndisconnects.\");\n\tsetCommandExamples(command, [\"prisma-next lsp --stdio\"]);\n\taddGlobalOptions(command).option(\"--stdio\", \"Communicate with the editor over stdio (the default and only transport)\").action(async () => {\n\t\tconst { startServer } = await import(\"@internal/language-server\");\n\t\tstartServer();\n\t});\n\treturn command;\n}\n//#endregion\n//#region src/utils/suggest-command.ts\n/**\n* Suggests similar command names for a mistyped input.\n*\n* Uses Levenshtein distance to find close matches. Only suggests commands\n* within a reasonable distance threshold (40% of the input length, minimum 2).\n* Returns up to 3 suggestions in case of ties.\n*\n* @returns Array of suggested command names (empty if nothing is close enough).\n*/\nfunction suggestCommands(input, candidates) {\n\tif (candidates.length === 0) return [];\n\tconst maxDistance = Math.max(2, Math.ceil(input.length * .4));\n\tconst scored = candidates.map((name) => ({\n\t\tname,\n\t\tdist: distance(input, name)\n\t})).filter((entry) => entry.dist <= maxDistance).sort((a, b) => a.dist - b.dist);\n\tif (scored.length === 0) return [];\n\tconst bestDist = scored[0].dist;\n\treturn scored.filter((entry) => entry.dist === bestDist).slice(0, 3).map((entry) => entry.name);\n}\n//#endregion\n//#region src/utils/telemetry.ts\n/**\n* Resolve the commander command path from a leaf `Command`, walking up\n* the parent chain. Result is rooted at the program name and ends at\n* the leaf — `['prisma-next', 'migration', 'new']` for\n* `prisma-next migration new …`.\n*/\nfunction commandPathFor(actionCommand) {\n\tconst path = [];\n\tlet cursor = actionCommand;\n\twhile (cursor !== null) {\n\t\tpath.unshift(cursor.name());\n\t\tcursor = cursor.parent;\n\t}\n\treturn path;\n}\nfunction commanderOptionSnapshots(actionCommand) {\n\treturn actionCommand.options.map((option) => {\n\t\tconst attributeName = option.attributeName();\n\t\treturn {\n\t\t\tattributeName,\n\t\t\tlongName: option.long ?? null,\n\t\t\tsource: actionCommand.getOptionValueSource(attributeName) ?? null\n\t\t};\n\t});\n}\n/**\n* Project commander's leaf `Command` into the wire-shape snapshot the\n* telemetry sanitiser consumes. Pure projection — no env, no I/O.\n*/\nfunction commanderSnapshotForTelemetry(actionCommand) {\n\treturn {\n\t\tcommandPath: commandPathFor(actionCommand),\n\t\tpositionalArgs: actionCommand.args,\n\t\toptions: commanderOptionSnapshots(actionCommand)\n\t};\n}\nfunction resolveTelemetryGate() {\n\tif (isCI()) return {\n\t\tenabled: false,\n\t\toutcome: {\n\t\t\tspawned: false,\n\t\t\treason: \"ci\"\n\t\t}\n\t};\n\tconst userConfig = readUserConfig();\n\tif (!resolveGating({\n\t\tenv: process.env,\n\t\tconfig: userConfig\n\t}).enabled) return {\n\t\tenabled: false,\n\t\toutcome: {\n\t\t\tspawned: false,\n\t\t\treason: \"gated-off\"\n\t\t}\n\t};\n\treturn {\n\t\tenabled: true,\n\t\tuserConfig\n\t};\n}\n/**\n* Path to the compiled sender script inside `@internal/cli-telemetry`'s\n* `dist/`. Resolved off this module's `import.meta.url` via the package\n* specifier `@internal/cli-telemetry/sender`, so the consumer pays\n* no attention to internal package layout.\n*/\nfunction senderPath() {\n\treturn fileURLToPath(new URL(import.meta.resolve(\"@internal/cli-telemetry/sender\")));\n}\nfunction fireTelemetry(actionCommand, userConfig) {\n\treturn runTelemetry({\n\t\tcommand: commanderSnapshotForTelemetry(actionCommand),\n\t\tversion,\n\t\tprojectRoot: process.cwd(),\n\t\tsenderPath: senderPath(),\n\t\tisCI: isCI(),\n\t\tenv: process.env,\n\t\tuserConfig\n\t});\n}\n/**\n* preAction-stage entry point. Synchronous by construction: resolve\n* env/CI/user-consent gates (cheap, all in-memory and a single tiny\n* user-config read), then — only when enabled — `fork()` the detached\n* sender script. The forked child loads `prisma-next.config.*` via\n* c12 on its own (see `loadProjectConfig` in cli-telemetry); the\n* parent does no project-config I/O on the command's hot path.\n*\n* Privacy invariant: gate resolution always happens before any project\n* config touches disk. The child loading user TS code is acceptable\n* only because it's gated behind the same resolved-enabled signal.\n*/\n/**\n* Builds the one-time first-run disclosure. The resolved absolute path to\n* the user-level config file is substituted in so the user can see exactly\n* which file to edit (it must not be confused with `prisma-next.config.ts`).\n* `prisma-next telemetry disable` is named as the primary, friendliest\n* opt-out, alongside the env vars and the config edit.\n*/\nfunction firstRunNotice(configPath) {\n\treturn [\n\t\t\"Prisma Next collects anonymous CLI usage data, enabled by default.\",\n\t\t\"What's collected and why: https://prisma-next.dev/docs/cli/telemetry.\",\n\t\t\"Opt out: run \\\"prisma-next telemetry disable\\\", set DO_NOT_TRACK=1 or\",\n\t\t`PRISMA_NEXT_DISABLE_TELEMETRY=1, or set \"enableTelemetry\": false in ${configPath}.`\n\t].join(\" \");\n}\n/**\n* Best-effort first-run disclosure + installationId mint. Runs only on the\n* gating-enabled path. Prints the notice to stderr (never stdout) and mints\n* a persistent id without touching `enableTelemetry`, so the opt-out default\n* stays intact and no unasked-for consent is recorded.\n*\n* Every step is wrapped so an un-writable config dir (or any other failure)\n* never throws and never blocks the command. Returns the minted (or\n* pre-existing) id so the caller can forward it to `runTelemetry` without a\n* redundant disk read. On mint failure it returns `undefined`: the notice may\n* reprint next run, and `runTelemetry` no-ops on the missing id.\n*/\nfunction discloseAndMintOnFirstRun() {\n\ttry {\n\t\tprocess.stderr.write(`${firstRunNotice(userConfigPath())}\\n`);\n\t} catch {}\n\ttry {\n\t\treturn ensureInstallationId();\n\t} catch {}\n}\n/**\n* True when the run is the `telemetry` command (or one of its\n* subcommands). The usage-telemetry preAction fire is exempted for it:\n* it would be absurd for `telemetry disable` to send a usage event before\n* disabling, or for `telemetry status` to mint an id + send while merely\n* reporting state. This is the only command-specific exemption.\n*\n* The check is rooted at the program: the path must be\n* `['prisma-next', 'telemetry', …]`, so it matches the top-level\n* `telemetry` command and its subcommands without matching a hypothetical\n* nested `… telemetry` elsewhere.\n*/\nfunction isTelemetryCommand(actionCommand) {\n\treturn commandPathFor(actionCommand)[1] === \"telemetry\";\n}\nfunction fireTelemetryFromPreAction(actionCommand) {\n\tif (isTelemetryCommand(actionCommand)) return {\n\t\tspawned: false,\n\t\treason: \"gated-off\"\n\t};\n\tconst gate = resolveTelemetryGate();\n\tif (!gate.enabled) return gate.outcome;\n\tconst storedId = gate.userConfig.installationId;\n\tif (typeof storedId !== \"string\" || storedId.length === 0) {\n\t\tconst installationId = discloseAndMintOnFirstRun();\n\t\treturn fireTelemetry(actionCommand, installationId === void 0 ? gate.userConfig : {\n\t\t\t...gate.userConfig,\n\t\t\tinstallationId\n\t\t});\n\t}\n\treturn fireTelemetry(actionCommand, gate.userConfig);\n}\n//#endregion\n//#region src/cli.ts\ninstallShutdownHandlers();\n/**\n* Lookup table mapping removed subcommands to their replacement verbs.\n* Keyed by `<parent>:<subcommand>` (e.g. `migration:apply`).\n* The handler consults this before falling back to the fuzzy suggest engine.\n*/\nconst removedVerbRedirects = {\n\t\"migration:apply\": \"Use `prisma-next migrate --to <contract>` instead.\",\n\t\"migration:ref\": \"Use `prisma-next ref set|list|delete` instead.\"\n};\n/**\n* Removed flags on specific subcommands. Keyed by `<parent>:<sub>:<flag>`.\n* Checked during the pre-parse argv scan before commander sees the flags.\n*/\nconst removedFlagRedirects = {\n\t\"migration:status:graph\": \"Use `prisma-next migration graph` to view the migration graph.\",\n\t\"migration:status:all\": \"Use `prisma-next migration log --db <url>` to view the full execution history.\",\n\t\"migration:status:limit\": \"Use `prisma-next migration log --db <url>` to view the full execution history.\",\n\t\"migration:status:ref\": \"Use `--to <contract>` instead of `--ref`.\"\n};\n/**\n* Formats the \"Did you mean ...?\" hint for an unknown command.\n*/\nfunction formatSuggestion(input, candidates) {\n\tconst suggestions = suggestCommands(input, candidates.map((c) => c));\n\tif (suggestions.length === 0) return \"\";\n\tif (suggestions.length === 1) return `\\nDid you mean ${suggestions[0]}?\\n`;\n\treturn `\\nDid you mean one of these?\\n${suggestions.map((s) => ` ${s}`).join(\"\\n\")}\\n`;\n}\nconst program = new Command();\nprogram.name(\"prisma-next\").description(\"Prisma Next CLI\").version(version);\nprogram.hook(\"preAction\", (_thisCommand, actionCommand) => {\n\ttry {\n\t\tfireTelemetryFromPreAction(actionCommand);\n\t} catch {}\n});\nconst versionOption = program.options.find((opt) => opt.flags.includes(\"--version\"));\nif (versionOption) versionOption.description = \"Output the version number\";\nprogram.configureOutput({\n\twriteErr: () => {},\n\twriteOut: (str) => {\n\t\tprocess.stdout.write(str);\n\t}\n});\nconst rootHelpFormatter = (cmd) => {\n\treturn formatRootHelp({\n\t\tprogram: cmd,\n\t\tflags: parseGlobalFlags({})\n\t});\n};\nprogram.configureHelp({\n\tformatHelp: rootHelpFormatter,\n\tsubcommandDescription: () => \"\"\n});\nprogram.exitOverride((err) => {\n\tif (err) {\n\t\tconst errorCode = err.code;\n\t\tconst errorMessage = String(err.message ?? \"\");\n\t\tconst errorName = err.name ?? \"\";\n\t\tif (errorCode === \"commander.unknownCommand\" || errorCode === \"commander.unknownArgument\" || errorName === \"CommanderError\" && (errorMessage.includes(\"unknown command\") || errorMessage.includes(\"unknown argument\"))) {\n\t\t\tconst flags = parseGlobalFlags({});\n\t\t\tconst match = errorMessage.match(/unknown command ['\"]([^'\"]+)['\"]/);\n\t\t\tconst commandName = match ? match[1] : process.argv[3] || process.argv[2] || \"unknown\";\n\t\t\tconst firstArg = process.argv[2];\n\t\t\tconst parentCommand = firstArg ? program.commands.find((cmd) => cmd.name() === firstArg) : void 0;\n\t\t\tif (parentCommand && commandName !== firstArg) {\n\t\t\t\tconst subNames = parentCommand.commands.map((c) => c.name());\n\t\t\t\tprocess.stderr.write(`Unknown command: ${commandName}${formatSuggestion(commandName, subNames)}\\n`);\n\t\t\t\tconst helpText = formatCommandHelp({\n\t\t\t\t\tcommand: parentCommand,\n\t\t\t\t\tflags\n\t\t\t\t});\n\t\t\t\tprocess.stderr.write(`${helpText}\\n`);\n\t\t\t} else {\n\t\t\t\tconst topNames = program.commands.map((c) => c.name());\n\t\t\t\tprocess.stderr.write(`Unknown command: ${commandName}${formatSuggestion(commandName, topNames)}\\n`);\n\t\t\t\tconst helpText = formatRootHelp({\n\t\t\t\t\tprogram,\n\t\t\t\t\tflags\n\t\t\t\t});\n\t\t\t\tprocess.stderr.write(`${helpText}\\n`);\n\t\t\t}\n\t\t\tprocess.exit(2);\n\t\t\treturn;\n\t\t}\n\t\tif (errorCode === \"commander.help\" || errorCode === \"commander.helpDisplayed\" || errorCode === \"outputHelp\" || errorMessage === \"(outputHelp)\" || errorMessage.includes(\"outputHelp\") || errorName === \"CommanderError\" && errorMessage.includes(\"outputHelp\")) {\n\t\t\tprocess.exit(0);\n\t\t\treturn;\n\t\t}\n\t\tif (errorCode === \"commander.missingArgument\" || errorCode === \"commander.missingMandatoryOptionValue\" || errorName === \"CommanderError\" && (errorMessage.includes(\"missing\") || errorMessage.includes(\"required\"))) {\n\t\t\tprocess.exit(2);\n\t\t\treturn;\n\t\t}\n\t\tprocess.stderr.write(`Unhandled error: ${err.message}\\n`);\n\t\tif (err.stack) process.stderr.write(`${err.stack}\\n`);\n\t\tprocess.exit(1);\n\t}\n\tprocess.exit(0);\n});\nconst contractCommand = new Command(\"contract\");\nsetCommandDescriptions(contractCommand, \"Contract management commands\", \"Define and emit your application data contract. The contract describes your schema as a\\ndeclarative data structure that can be signed and verified against your database.\");\ncontractCommand.configureHelp({\n\tformatHelp: (cmd) => {\n\t\treturn formatCommandHelp({\n\t\t\tcommand: cmd,\n\t\t\tflags: parseGlobalFlags({})\n\t\t});\n\t},\n\tsubcommandDescription: () => \"\"\n});\nconst contractEmitCommand = createContractEmitCommand();\ncontractCommand.addCommand(contractEmitCommand);\nconst contractInferCommand = createContractInferCommand();\ncontractCommand.addCommand(contractInferCommand);\nconst dbCommand = new Command(\"db\");\nsetCommandDescriptions(dbCommand, \"Database management commands\", \"Verify and sign your database with your contract. Ensure your database schema matches\\nyour contract, and sign it to record the contract hash for future verification.\");\ndbCommand.configureHelp({\n\tformatHelp: (cmd) => {\n\t\treturn formatCommandHelp({\n\t\t\tcommand: cmd,\n\t\t\tflags: parseGlobalFlags({})\n\t\t});\n\t},\n\tsubcommandDescription: () => \"\"\n});\nconst dbVerifyCommand = createDbVerifyCommand();\ndbCommand.addCommand(dbVerifyCommand);\nconst dbInitCommand = createDbInitCommand();\ndbCommand.addCommand(dbInitCommand);\nconst dbUpdateCommand = createDbUpdateCommand();\ndbCommand.addCommand(dbUpdateCommand);\nconst dbSchemaCommand = createDbSchemaCommand();\ndbCommand.addCommand(dbSchemaCommand);\nconst dbSignCommand = createDbSignCommand();\ndbCommand.addCommand(dbSignCommand);\nconst migrationCommand = new Command(\"migration\");\nsetCommandDescriptions(migrationCommand, \"On-disk migration management commands\", \"Plan, apply, and scaffold on-disk migration packages. Migrations are\\ncontract-to-contract edges stored as versioned directories under migrations/.\");\nmigrationCommand.configureHelp({\n\tformatHelp: (cmd) => {\n\t\treturn formatCommandHelp({\n\t\t\tcommand: cmd,\n\t\t\tflags: parseGlobalFlags({})\n\t\t});\n\t},\n\tsubcommandDescription: () => \"\"\n});\nconst migrationPlanCommand = createMigrationPlanCommand();\nmigrationCommand.addCommand(migrationPlanCommand);\nconst migrationNewCommand = createMigrationNewCommand();\nmigrationCommand.addCommand(migrationNewCommand);\nconst migrationShowCommand = createMigrationShowCommand();\nmigrationCommand.addCommand(migrationShowCommand);\nconst migrationStatusCommand = createMigrationStatusCommand();\nmigrationCommand.addCommand(migrationStatusCommand);\nconst migrationLogCommand = createMigrationLogCommand();\nmigrationCommand.addCommand(migrationLogCommand);\nconst migrationListCommand = createMigrationListCommand();\nmigrationCommand.addCommand(migrationListCommand);\nconst migrationGraphCommand = createMigrationGraphCommand();\nmigrationCommand.addCommand(migrationGraphCommand);\nconst migrationCheckCommand = createMigrationCheckCommand();\nmigrationCommand.addCommand(migrationCheckCommand);\nconst migrateCommand = createMigrateCommand();\nconst refCommand = createRefCommand();\nconst telemetryCommand = createTelemetryCommand();\nconst initCommand = createInitCommand();\nconst formatCommand = createFormatCommand();\nconst lspCommand = createLspCommand();\nprogram.addCommand(initCommand);\nprogram.addCommand(migrateCommand);\nprogram.addCommand(formatCommand);\nprogram.addCommand(lspCommand);\nprogram.addCommand(contractCommand);\nprogram.addCommand(dbCommand);\nprogram.addCommand(migrationCommand);\nprogram.addCommand(refCommand);\nprogram.addCommand(telemetryCommand);\nconst TELEMETRY_CRASH_TEST_SLEEP_MS = 200;\nif (process.env[\"PRISMA_NEXT_ENABLE_TEST_COMMANDS\"] === \"1\") {\n\tconst telemetryCrashTestCommand = new Command(\"__telemetry-crash-test\").description(\"Internal: deliberately throw for the telemetry e2e suite.\").action(async () => {\n\t\tawait new Promise((settle) => setTimeout(settle, TELEMETRY_CRASH_TEST_SLEEP_MS));\n\t\tthrow new Error(\"__telemetry-crash-test: intentional crash for e2e coverage\");\n\t});\n\ttelemetryCrashTestCommand.configureHelp({ visibleCommands: () => [] });\n\tprogram.addCommand(telemetryCrashTestCommand, { hidden: true });\n}\nconst helpCommand = new Command(\"help\").description(\"Show usage instructions\").configureHelp({ formatHelp: (cmd) => {\n\treturn formatCommandHelp({\n\t\tcommand: cmd,\n\t\tflags: parseGlobalFlags({})\n\t});\n} }).action(() => {\n\tconst flags = parseGlobalFlags({});\n\tconst helpText = formatRootHelp({\n\t\tprogram,\n\t\tflags\n\t});\n\tprocess.stdout.write(`${helpText}\\n`);\n\tprocess.exit(0);\n});\nprogram.addCommand(helpCommand);\nprogram.action(() => {\n\tconst flags = parseGlobalFlags({});\n\tconst helpText = formatRootHelp({\n\t\tprogram,\n\t\tflags\n\t});\n\tprocess.stderr.write(`${helpText}\\n`);\n\tprocess.exit(0);\n});\nconst args = process.argv.slice(2);\nif (args.length > 0) {\n\tconst commandName = args[0];\n\tif (commandName === \"--version\" || commandName === \"-V\") {\n\t\tprocess.stdout.write(`${program.version()}\\n`);\n\t\tprocess.exit(0);\n\t}\n\tif (!(commandName === \"--help\" || commandName === \"-h\")) {\n\t\tconst command = program.commands.find((cmd) => cmd.name() === commandName);\n\t\tif (!command) {\n\t\t\tconst flags = parseGlobalFlags({});\n\t\t\tconst topNames = program.commands.map((c) => c.name());\n\t\t\tprocess.stderr.write(`Unknown command: ${commandName}${formatSuggestion(commandName, topNames)}\\n`);\n\t\t\tconst helpText = formatRootHelp({\n\t\t\t\tprogram,\n\t\t\t\tflags\n\t\t\t});\n\t\t\tprocess.stderr.write(`${helpText}\\n`);\n\t\t\tprocess.exit(2);\n\t\t} else if (command.commands.length > 0 && args.length >= 2) {\n\t\t\tconst subcommandName = args[1];\n\t\t\tconst redirect = removedVerbRedirects[`${commandName}:${subcommandName}`];\n\t\t\tif (redirect) {\n\t\t\t\tprocess.stderr.write(`Unknown command: ${subcommandName}\\n${redirect}\\n`);\n\t\t\t\tprocess.exit(2);\n\t\t\t}\n\t\t\tfor (let i = 2; i < args.length; i++) {\n\t\t\t\tconst arg = args[i];\n\t\t\t\tif (!arg.startsWith(\"--\")) continue;\n\t\t\t\tconst flagRedirect = removedFlagRedirects[`${commandName}:${subcommandName}:${arg.slice(2)}`];\n\t\t\t\tif (flagRedirect) {\n\t\t\t\t\tprocess.stderr.write(`Unknown option: ${arg}\\n${flagRedirect}\\n`);\n\t\t\t\t\tprocess.exit(2);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (command.commands.length > 0 && args.length === 1) {\n\t\t\tconst helpText = formatCommandHelp({\n\t\t\t\tcommand,\n\t\t\t\tflags: parseGlobalFlags({})\n\t\t\t});\n\t\t\tprocess.stderr.write(`${helpText}\\n`);\n\t\t\tprocess.exit(0);\n\t\t}\n\t}\n}\nprogram.parse();\n//#endregion\nexport { schemaSample as a, targetLabel as c, scaffoldSpecifierResolverFor as i, targetPackageName as l, dbFile as n, starterSchema as o, defaultSchemaPath as r, targetEntrypoint as s, configFile as t, version as u };\n\n//# sourceMappingURL=cli.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,IAAI,UAAU;;;;;;;;;AAWd,SAAS,6BAA6B,QAAQ;CAC7C,OAAO,gCAAgC;EACtC,MAAM;EACN,QAAQ,WAAW,aAAa,yBAAyB;CAC1D,CAAC;AACF;;;;;;;;;;;;;;;;;AAiBA,SAAS,kBAAkB,QAAQ,yBAAyB,wBAAwB;CACnF,OAAO,uBAAuB,WAAW,aAAa,uBAAuB,iBAAiB;AAC/F;;AAEA,SAAS,iBAAiB,QAAQ,SAAS,yBAAyB,wBAAwB;CAC3F,OAAO,uBAAuB,GAAG,WAAW,aAAa,uBAAuB,kBAAkB,GAAG,SAAS;AAC/G;AACA,SAAS,YAAY,QAAQ;CAC5B,OAAO,WAAW,aAAa,eAAe;AAC/C;AACA,SAAS,kBAAkB,WAAW;CACrC,IAAI,cAAc,cAAc,OAAO,GAAG,4BAA4B;CACtE,OAAO,GAAG,4BAA4B;AACvC;AACA,SAAS,cAAc,QAAQ,WAAW,yBAAyB,wBAAwB;CAC1F,IAAI,cAAc,cAAc;EAC/B,MAAM,UAAU,iBAAiB,QAAQ,oBAAoB,sB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,SAAS,SAAS,KAAK,KAAK,UAAU,GAAG;GAC3D,MAAM,iBAAiB,KAAK;GAC5B,MAAM,WAAW,qBAAqB,GAAG,YAAY,GAAG;GACxD,IAAI,UAAU;IACb,QAAQ,OAAO,MAAM,oBAAoB,eAAe,IAAI,SAAS,GAAG;IACxE,QAAQ,KAAK,CAAC;GACf;GACA,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;IACrC,MAAM,MAAM,KAAK;IACjB,IAAI,CAAC,IAAI,WAAW,IAAI,GAAG;IAC3B,MAAM,eAAe,qBAAqB,GAAG,YAAY,GAAG,eAAe,GAAG,IAAI,MAAM,CAAC;IACzF,IAAI,cAAc;KACjB,QAAQ,OAAO,MAAM,mBAAmB,IAAI,IAAI,aAAa,GAAG;KAChE,QAAQ,KAAK,CAAC;IACf;GACD;EACD;EACA,IAAI,QAAQ,SAAS,SAAS,KAAK,KAAK,WAAW,GAAG;GACrD,MAAM,WAAW,kBAAkB;IAClC;IACA,OAAO,iBAAiB,CAAC,CAAC;GAC3B,CAAC;GACD,QAAQ,OAAO,MAAM,GAAG,SAAS,GAAG;GACpC,QAAQ,KAAK,CAAC;EACf;CACD;AACD;AACA,QAAQ,MAAM"}
@@ -1,3 +1,3 @@
1
1
  import { t as migrationCheckResultSchema } from "./schemas-KhXMzNA_-CzZ7GFX_.mjs";
2
- import { n as enumerateCheckSpaces, r as runMigrationCheck, t as createMigrationCheckCommand } from "./migration-check-CcG-fB8r-CDs5C9vt.mjs";
2
+ import { n as enumerateCheckSpaces, r as runMigrationCheck, t as createMigrationCheckCommand } from "./migration-check-DcwUnadt-B6Qoh0ot.mjs";
3
3
  export { createMigrationCheckCommand, enumerateCheckSpaces, migrationCheckResultSchema, runMigrationCheck };
@@ -1,3 +1,3 @@
1
1
  import { n as migrationStatusJsonResultSchema } from "./schemas-KhXMzNA_-CzZ7GFX_.mjs";
2
- import { a as formatStatusHumanOutput, i as executeMigrationStatusCommand, n as buildStatusHeadline, o as formatStatusSummary, r as createMigrationStatusCommand, t as buildNoPathSummary } from "./migration-status-CFlzlRmu-DewBN8Ys.mjs";
2
+ import { a as formatStatusHumanOutput, i as executeMigrationStatusCommand, n as buildStatusHeadline, o as formatStatusSummary, r as createMigrationStatusCommand, t as buildNoPathSummary } from "./migration-status-CE7cQLDq-B1jDVmqG.mjs";
3
3
  export { buildNoPathSummary, buildStatusHeadline, createMigrationStatusCommand, executeMigrationStatusCommand, formatStatusHumanOutput, formatStatusSummary, migrationStatusJsonResultSchema };
@@ -16,7 +16,7 @@ import { readFile } from "node:fs/promises";
16
16
  import { createControlStack } from "@prisma/orm-framework/components/control";
17
17
  import { existsSync, readdirSync, statSync } from "node:fs";
18
18
  import { Command } from "commander";
19
- //#region ../../../1-framework/3-tooling/cli/dist/migration-check-CcG-fB8r.mjs
19
+ //#region ../../../1-framework/3-tooling/cli/dist/migration-check-DcwUnadt.mjs
20
20
  function migrationPathRelative$1(dirPath) {
21
21
  return relative(process.cwd(), dirPath);
22
22
  }
@@ -594,4 +594,4 @@ function createMigrationCheckCommand() {
594
594
  //#endregion
595
595
  export { enumerateCheckSpaces as n, runMigrationCheck as r, createMigrationCheckCommand as t };
596
596
 
597
- //# sourceMappingURL=migration-check-CcG-fB8r-CDs5C9vt.mjs.map
597
+ //# sourceMappingURL=migration-check-DcwUnadt-B6Qoh0ot.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-check-DcwUnadt-B6Qoh0ot.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-check-DcwUnadt.mjs"],"sourcesContent":["import { A as formatStyledHeader, K as errorInvalidSpaceId, L as errorAmbiguousMigrationRef, _ as createTerminalUI, at as errorSpaceNotFound, b as formatErrorJson, d as setCommandSeeAlso, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, o as resolveContractPath, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, ut as mapRefResolutionError, x as formatErrorOutput } from \"./command-helpers-CAoXqAY9.mjs\";\nimport { n as buildReadAggregate, s as toDeclaredExtensionsFromRaw } from \"./contract-space-aggregate-loader-CFH-336b.mjs\";\nimport { i as resolveTargetPathAcrossSpaces, n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from \"./migration-path-target-D3Sj55PI.mjs\";\nimport \"./schemas-KhXMzNA_.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { join, relative } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { existsSync, readdirSync, statSync } from \"node:fs\";\nimport { isValidSpaceId, listContractSpaceDirectories, spaceMigrationDirectory, spaceRefsDirectory } from \"@internal/migration-tools/spaces\";\nimport { loadContractSpaceAggregate } from \"@internal/migration-tools/aggregate\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { MigrationToolsError } from \"@internal/migration-tools/errors\";\nimport { contractSnapshotDir, readContractSnapshotJson } from \"@internal/migration-tools/contract-snapshot-store\";\nimport { parseMigrationRef } from \"@internal/migration-tools/ref-resolution\";\nimport { verifyMigrationHash } from \"@internal/migration-tools/hash\";\n//#region src/utils/integrity-violation-to-check-failure.ts\nfunction migrationPathRelative$1(dirPath) {\n\treturn relative(process.cwd(), dirPath);\n}\nfunction migrationFileRelative$1(dirPath, fileName) {\n\treturn join(migrationPathRelative$1(dirPath), fileName);\n}\n/**\n* Map one {@link IntegrityViolation} onto a `migration check` failure row.\n* Sole catalogue mapping from integrity violations to `MIGRATION.CHECK_*` codes.\n*/\nfunction integrityViolationToCheckFailure(violation, migrationsDir) {\n\tconst spaceRelative = (spaceId) => migrationPathRelative$1(join(migrationsDir, spaceId));\n\tconst packageRelative = (spaceId, dirName) => migrationPathRelative$1(join(migrationsDir, spaceId, dirName));\n\tconst refRelative = (spaceId, refName) => migrationPathRelative$1(join(migrationsDir, spaceId, \"refs\", `${refName}.json`));\n\tswitch (violation.kind) {\n\t\tcase \"hashMismatch\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_HASH_MISMATCH\",\n\t\t\twhere: migrationFileRelative$1(join(migrationsDir, violation.spaceId, violation.dirName), \"migration.json\"),\n\t\t\twhy: `Stored hash ${violation.stored} does not match recomputed hash ${violation.computed}`,\n\t\t\tfix: \"Re-emit the migration package or restore from version control.\"\n\t\t};\n\t\tcase \"providedInvariantsMismatch\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_PROVIDED_INVARIANTS_MISMATCH\",\n\t\t\twhere: packageRelative(violation.spaceId, violation.dirName),\n\t\t\twhy: `Migration \"${violation.dirName}\" providedInvariants in migration.json disagrees with ops.json.`,\n\t\t\tfix: \"Re-emit the migration package so migration.json and ops.json agree.\"\n\t\t};\n\t\tcase \"packageUnloadable\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_PACKAGE_UNLOADABLE\",\n\t\t\twhere: packageRelative(violation.spaceId, violation.dirName),\n\t\t\twhy: `Migration \"${violation.dirName}\" could not be loaded: ${violation.detail}`,\n\t\t\tfix: \"Re-emit the migration package or restore from version control.\"\n\t\t};\n\t\tcase \"sameSourceAndTarget\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_NOOP_SELF_EDGE\",\n\t\t\twhere: packageRelative(violation.spaceId, violation.dirName),\n\t\t\twhy: `Migration \"${violation.dirName}\" in space \"${violation.spaceId}\" has source equal to target (${violation.hash}) with no data invariant — a true no-op self-edge.`,\n\t\t\tfix: \"Add a data operation if this self-edge was meant to carry a data invariant, or delete the migration if it is a true no-op.\"\n\t\t};\n\t\tcase \"orphanSpaceDir\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_ORPHAN_SPACE_DIR\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Contract-space directory \"${violation.spaceId}\" exists on disk but no extension declares it.`,\n\t\t\tfix: \"Remove the orphan directory, or declare the extension in `extensions`.\"\n\t\t};\n\t\tcase \"declaredButUnmigrated\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_DECLARED_BUT_UNMIGRATED\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Extension \"${violation.spaceId}\" is declared in \\`extensions\\` but has no on-disk migrations directory.`,\n\t\t\tfix: \"Re-emit the extension contract-space artefacts with `prisma-next contract emit` and migration planning, or remove the extension from `extensions` if it is unused.\"\n\t\t};\n\t\tcase \"headRefMissing\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_HEAD_REF_MISSING\",\n\t\t\twhere: refRelative(violation.spaceId, \"head\"),\n\t\t\twhy: `Head ref \\`refs/head.json\\` is missing for contract space \"${violation.spaceId}\".`,\n\t\t\tfix: \"Re-emit the contract-space migrations and head ref artefacts, or restore `refs/head.json` from version control.\"\n\t\t};\n\t\tcase \"headRefNotInGraph\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_HEAD_REF_NOT_IN_GRAPH\",\n\t\t\twhere: refRelative(violation.spaceId, \"head\"),\n\t\t\twhy: `Head ref ${violation.hash} for contract space \"${violation.spaceId}\" is not present in its migration graph.`,\n\t\t\tfix: \"Re-emit the contract space migrations, or restore the missing migration package.\"\n\t\t};\n\t\tcase \"refUnreadable\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_REF_UNREADABLE\",\n\t\t\twhere: refRelative(violation.spaceId, violation.refName),\n\t\t\twhy: `Ref \"${violation.refName}\" for contract space \"${violation.spaceId}\" is unreadable: ${violation.detail}`,\n\t\t\tfix: \"Repair or remove the corrupt ref file.\"\n\t\t};\n\t\tcase \"targetMismatch\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_TARGET_MISMATCH\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Contract space \"${violation.spaceId}\" targets \"${violation.actual}\" but the project targets \"${violation.expected}\".`,\n\t\t\tfix: \"Update the extension to target the configured database, or change the project target.\"\n\t\t};\n\t\tcase \"disjointness\": return {\n\t\t\tspace: \"app\",\n\t\t\tcode: \"MIGRATION.CHECK_SPACE_DISJOINTNESS_VIOLATION\",\n\t\t\twhere: migrationPathRelative$1(migrationsDir),\n\t\t\twhy: `Storage element \"${violation.element}\" is claimed by multiple contract spaces: ${violation.claimedBy.join(\", \")}.`,\n\t\t\tfix: \"Update the contracts so each storage element is owned by exactly one contract space.\"\n\t\t};\n\t\tcase \"contractUnreadable\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_CONTRACT_UNREADABLE\",\n\t\t\twhere: migrationFileRelative$1(join(migrationsDir, violation.spaceId), \"contract.json\"),\n\t\t\twhy: `Contract for space \"${violation.spaceId}\" is unreadable: ${violation.detail}`,\n\t\t\tfix: \"Re-emit the extension contract artefacts, or fix the descriptor producing the invalid contract.\"\n\t\t};\n\t\tcase \"duplicateMigrationHash\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_DUPLICATE_MIGRATION_HASH\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Multiple migrations in space \"${violation.spaceId}\" share migrationHash \"${violation.migrationHash}\" (${violation.dirNames.join(\", \")}).`,\n\t\t\tfix: \"Re-emit one of the conflicting packages so each migrationHash is unique.\"\n\t\t};\n\t}\n}\n//#endregion\n//#region src/commands/migration-check.ts\nfunction migrationPathRelative(dirPath) {\n\treturn relative(process.cwd(), dirPath);\n}\nfunction migrationFileRelative(dirPath, fileName) {\n\treturn join(migrationPathRelative(dirPath), fileName);\n}\nfunction checkFileExists(spaceId, dirPath, dirName, fileName) {\n\tif (!existsSync(join(dirPath, fileName))) return {\n\t\tspace: spaceId,\n\t\tcode: \"MIGRATION.CHECK_FILE_MISSING\",\n\t\twhere: migrationFileRelative(dirPath, fileName),\n\t\twhy: `${fileName} is missing from ${dirName}`,\n\t\tfix: \"Re-emit the migration package or restore from version control.\"\n\t};\n\treturn null;\n}\n/**\n* Snapshot-store consistency check for one migration package (D6.5):\n* absent store entry is not an issue (runner independence, ADR 199 — a\n* package dir with only `migration.json` + `ops.json` is legitimate); a\n* present entry whose inner `storage.storageHash` disagrees with\n* `pkg.metadata.to` is `MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH`; an unparseable store\n* entry (or a malformed `to`) is `MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE`.\n*/\nasync function checkSnapshotConsistency(spaceId, pkg, migrationsDir) {\n\tlet snapshotDir;\n\ttry {\n\t\tsnapshotDir = contractSnapshotDir(migrationsDir, pkg.metadata.to);\n\t} catch {\n\t\treturn {\n\t\t\tspace: spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE\",\n\t\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\t\twhy: `Migration \"${pkg.dirName}\" declares to=\"${pkg.metadata.to}\", which is not a well-formed contract snapshot hash.`,\n\t\t\tfix: \"Re-emit the migration package so migration.json declares a valid 64-hex to-hash.\"\n\t\t};\n\t}\n\tlet raw;\n\ttry {\n\t\traw = await readContractSnapshotJson(migrationsDir, pkg.metadata.to);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error) && error.code === \"MIGRATION.CONTRACT_SNAPSHOT_MISSING\") return null;\n\t\treturn {\n\t\t\tspace: spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE\",\n\t\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\t\twhy: `Migration \"${pkg.dirName}\" has an unparseable contract snapshot at ${snapshotDir}/contract.json.`,\n\t\t\tfix: \"Restore migrations/snapshots/ from version control, or re-run the command that produced this migration to regenerate its snapshot.\"\n\t\t};\n\t}\n\tconst snapshotHash = (raw !== null && typeof raw === \"object\" ? raw : {})[\"storage\"]?.[\"storageHash\"];\n\tif (typeof snapshotHash === \"string\" && snapshotHash !== pkg.metadata.to) return {\n\t\tspace: spaceId,\n\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH\",\n\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\twhy: `Migration \"${pkg.dirName}\" declares to=${pkg.metadata.to} but its contract snapshot has storageHash=${snapshotHash}`,\n\t\tfix: \"Re-emit the migration package so migration.json and its contract snapshot agree.\"\n\t};\n\treturn null;\n}\n/**\n* Project the loaded {@link ContractSpaceAggregate} into the\n* {@link CheckSpace} rows the multi-space check iterates — one per on-disk\n* contract-space directory, in the aggregate's `app`-first ordering. Mirrors\n* `migration list`'s `migrationSpaceListEntriesFromAggregate`: space\n* membership matches the on-disk directories, package / ref / graph data come\n* from `aggregate.space(id)`.\n*/\nasync function enumerateCheckSpaces(aggregate, projectMigrationsDir) {\n\tconst candidateDirs = await listContractSpaceDirectories(projectMigrationsDir);\n\tconst onDiskSpaceIds = new Set(candidateDirs.filter(isValidSpaceId));\n\tconst spaces = [];\n\tfor (const space of aggregate.spaces()) {\n\t\tconst spaceId = space.spaceId;\n\t\tif (!isValidSpaceId(spaceId)) continue;\n\t\tif (!onDiskSpaceIds.has(spaceId)) continue;\n\t\tconst migrationsDir = spaceMigrationDirectory(projectMigrationsDir, spaceId);\n\t\tspaces.push({\n\t\t\tspaceId,\n\t\t\tpackages: space.packages,\n\t\t\trefs: space.refs,\n\t\t\tgraph: space.graph(),\n\t\t\tmigrationsDir,\n\t\t\trefsDir: spaceRefsDirectory(migrationsDir),\n\t\t\tprojectMigrationsDir\n\t\t});\n\t}\n\treturn spaces;\n}\nfunction checkManifestFilesPresent(space) {\n\tif (!existsSync(space.migrationsDir)) return [];\n\tconst loadedDirNames = new Set(space.packages.map((p) => p.dirName));\n\tconst failures = [];\n\tlet entries;\n\ttry {\n\t\tentries = readdirSync(space.migrationsDir);\n\t} catch {\n\t\treturn failures;\n\t}\n\tfor (const entry of entries) {\n\t\tif (entry.startsWith(\".\") || entry.startsWith(\"_\") || entry === \"refs\") continue;\n\t\tconst entryPath = join(space.migrationsDir, entry);\n\t\ttry {\n\t\t\tif (!statSync(entryPath).isDirectory()) continue;\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tif (!loadedDirNames.has(entry)) for (const f of [\"migration.json\", \"ops.json\"]) {\n\t\t\tconst fail = checkFileExists(space.spaceId, entryPath, entry, f);\n\t\t\tif (fail) failures.push(fail);\n\t\t}\n\t}\n\treturn failures;\n}\nfunction checkReachability(space) {\n\tconst allToHashes = new Set(space.packages.map((p) => p.metadata.to));\n\tconst failures = [];\n\tfor (const pkg of space.packages) if (!(pkg.metadata.from === null || allToHashes.has(pkg.metadata.from) || pkg.metadata.from === EMPTY_CONTRACT_HASH)) failures.push({\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_UNREACHABLE_MIGRATION\",\n\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\twhy: `Migration \"${pkg.dirName}\" starts from ${pkg.metadata.from} which no other migration produces`,\n\t\tfix: \"This migration is unreachable in the graph. Delete it or re-emit a connecting migration.\"\n\t});\n\treturn failures;\n}\nfunction checkDanglingRefs(space) {\n\tconst failures = [];\n\tfor (const [name, entry] of Object.entries(space.refs)) if (!space.graph.nodes.has(entry.hash)) failures.push({\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_DANGLING_REF\",\n\t\twhere: relative(process.cwd(), join(space.refsDir, `${name}.json`)),\n\t\twhy: `Ref \"${name}\" points at ${entry.hash} which does not exist in the migration graph`,\n\t\tfix: `Update the ref with \\`prisma-next ref set ${name} <valid-hash>\\` or delete it.`\n\t});\n\treturn failures;\n}\nasync function checkSpace(space) {\n\tconst snapshotFailures = await Promise.all(space.packages.map((pkg) => checkSnapshotConsistency(space.spaceId, pkg, space.projectMigrationsDir)));\n\treturn [\n\t\t...checkManifestFilesPresent(space),\n\t\t...snapshotFailures.filter((f) => f !== null),\n\t\t...checkReachability(space),\n\t\t...checkDanglingRefs(space)\n\t];\n}\n/**\n* Policy core of the holistic `migration check`: validates `--space`,\n* narrows the pre-enumerated spaces, and runs the per-space explicit graph\n* checks (file-existence, snapshot consistency, reachability, dangling\n* refs), aggregating every failure into one {@link MigrationCheckResult}.\n*\n* `--space` validation mirrors `migration list`: an invalid id →\n* {@link errorInvalidSpaceId}; an id with no on-disk space →\n* {@link errorSpaceNotFound}. Both map to exit `PRECONDITION` at the shell.\n* Aggregate-integrity violations (which already span every space) are folded\n* in by the caller, not here.\n*/\nasync function runMigrationCheck(inputs) {\n\tconst { spaces, spaceFilter } = inputs;\n\tif (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return notOk(errorInvalidSpaceId(spaceFilter));\n\tif (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()));\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;\n\tconst failures = (await Promise.all(scopedSpaces.map(checkSpace))).flat();\n\tif (failures.length === 0) return ok({\n\t\tok: true,\n\t\tfailures: [],\n\t\tsummary: \"All checks passed\"\n\t});\n\treturn ok({\n\t\tok: false,\n\t\tfailures,\n\t\tsummary: `${failures.length} integrity failure(s)`\n\t});\n}\nasync function loadAggregateIntegrityViolations(config, migrationsDir) {\n\ttry {\n\t\tconst contractJsonContent = await readFile(resolveContractPath(config), \"utf-8\");\n\t\tconst familyInstance = config.family.create(createControlStack(config));\n\t\tconst declaredExtensions = toDeclaredExtensionsFromRaw(config.extensions ?? []);\n\t\tconst parsedAppContract = JSON.parse(contractJsonContent);\n\t\treturn (await loadContractSpaceAggregate({\n\t\t\tmigrationsDir,\n\t\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json),\n\t\t\tappContract: familyInstance.deserializeContract(parsedAppContract)\n\t\t})).checkIntegrity({\n\t\t\tdeclaredExtensions,\n\t\t\tcheckContracts: true\n\t\t});\n\t} catch {\n\t\treturn [];\n\t}\n}\nasync function executeMigrationCheckCommand(target, options, flags, ui) {\n\tconst config = await loadConfig(options.config);\n\tconst { configPath, migrationsDir, appMigrationsDir, appMigrationsRelative } = resolveMigrationPaths(options.config, config);\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: configPath\n\t\t}, {\n\t\t\tlabel: \"migrations\",\n\t\t\tvalue: appMigrationsRelative\n\t\t}];\n\t\tif (target) details.push({\n\t\t\tlabel: \"target\",\n\t\t\tvalue: target\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migration check\",\n\t\t\tdescription: \"Verify artifact and graph integrity\",\n\t\t\tdetails,\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t}\n\tconst loadedAggregate = await buildReadAggregate(config, { migrationsDir });\n\tif (!loadedAggregate.ok) return {\n\t\terror: loadedAggregate.failure,\n\t\texitCode: 2\n\t};\n\tconst spaces = await enumerateCheckSpaces(loadedAggregate.value.aggregate, migrationsDir);\n\tif (target) return await checkSingleTarget(target, {\n\t\tspaces,\n\t\t...options.space !== void 0 ? { spaceFilter: options.space } : {},\n\t\tappMigrationsDir,\n\t\tappMigrationsRelative\n\t});\n\tconst checkResult = await runMigrationCheck({\n\t\tspaces,\n\t\t...options.space !== void 0 ? { spaceFilter: options.space } : {}\n\t});\n\tif (!checkResult.ok) return {\n\t\terror: checkResult.failure,\n\t\texitCode: 2\n\t};\n\tconst failures = [...checkResult.value.failures];\n\tconst allViolations = await loadAggregateIntegrityViolations(config, migrationsDir);\n\tconst scopedViolations = options.space === void 0 ? allViolations : allViolations.filter((v) => v.kind !== \"disjointness\" && v.spaceId === options.space);\n\tfor (const violation of scopedViolations) failures.push(integrityViolationToCheckFailure(violation, migrationsDir));\n\tif (failures.length === 0) return {\n\t\tresult: {\n\t\t\tok: true,\n\t\t\tfailures: [],\n\t\t\tsummary: \"All checks passed\"\n\t\t},\n\t\texitCode: 0\n\t};\n\treturn {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures,\n\t\t\tsummary: `${failures.length} integrity failure(s)`\n\t\t},\n\t\texitCode: 4\n\t};\n}\n/**\n* Ranks ref-resolution failure kinds by how informative they are, so a\n* single-target check surfaces the most useful failure across spaces instead of\n* whichever space failed first. `not-found` (the input matched nothing here)\n* says the least; a malformed input, a wrong grammar, or an in-space ambiguity\n* all say more.\n*/\nfunction refFailureSpecificity(error) {\n\tswitch (error.kind) {\n\t\tcase \"wrong-grammar\": return 3;\n\t\tcase \"ambiguous\": return 2;\n\t\tcase \"invalid-format\": return 1;\n\t\tcase \"not-found\": return 0;\n\t}\n}\n/**\n* Single-target (`check <ref/path>`) mode — resolves a migration reference\n* across all contract spaces (or the one space narrowed by `--space <id>`).\n*\n* Resolution:\n* - filesystem path → find the owning space by checking which space's\n* `migrationsDir` contains the resolved path; falls back to app-relative\n* validation when the path is outside every space dir.\n* - ref → `parseMigrationRef` against each in-scope space; collect every\n* (space, package) hit; 0 hits = not-found, 1 = check it, >1 = ambiguity\n* error (qualify with `--space`).\n*\n* `--space <id>` is validated the same way the holistic path does it:\n* invalid id → `errorInvalidSpaceId`; no on-disk space → `errorSpaceNotFound`.\n*/\nasync function checkSingleTarget(target, inputs) {\n\tconst { spaces, spaceFilter, appMigrationsDir, appMigrationsRelative } = inputs;\n\tif (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return {\n\t\terror: errorInvalidSpaceId(spaceFilter),\n\t\texitCode: 2\n\t};\n\tif (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return {\n\t\terror: errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()),\n\t\texitCode: 2\n\t};\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;\n\tlet matchedSpace;\n\tlet matchedPkg;\n\tif (looksLikePath(target)) {\n\t\tconst resolvedPath = resolveTargetPathAcrossSpaces(target, scopedSpaces);\n\t\tif (resolvedPath !== null) for (const space of scopedSpaces) {\n\t\t\tconst found = findPackageByDirPath(space.packages, resolvedPath);\n\t\t\tif (found) {\n\t\t\t\tmatchedSpace = space;\n\t\t\t\tmatchedPkg = found;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tconst resolved = resolveAppTargetPath(target, appMigrationsDir, appMigrationsRelative);\n\t\t\tif (!resolved.ok) return {\n\t\t\t\terror: resolved.failure,\n\t\t\t\texitCode: 2\n\t\t\t};\n\t\t\tconst appSpace = scopedSpaces.find((s) => s.spaceId === \"app\");\n\t\t\tif (appSpace) {\n\t\t\t\tmatchedSpace = appSpace;\n\t\t\t\tmatchedPkg = findPackageByDirPath(appSpace.packages, resolved.value);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconst hits = [];\n\t\tlet bestParseFailure;\n\t\tfor (const space of scopedSpaces) {\n\t\t\tconst migResult = parseMigrationRef(target, {\n\t\t\t\tgraph: space.graph,\n\t\t\t\trefs: space.refs\n\t\t\t});\n\t\t\tif (!migResult.ok) {\n\t\t\t\tif (bestParseFailure === void 0 || refFailureSpecificity(migResult.failure) > refFailureSpecificity(bestParseFailure)) bestParseFailure = migResult.failure;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst pkg = space.packages.find((p) => p.metadata.migrationHash === migResult.value.migrationHash);\n\t\t\tif (pkg) hits.push({\n\t\t\t\tspace,\n\t\t\t\tpkg\n\t\t\t});\n\t\t}\n\t\tif (hits.length > 1) return {\n\t\t\terror: errorAmbiguousMigrationRef(target, hits.map((h) => h.space.spaceId)),\n\t\t\texitCode: 2\n\t\t};\n\t\tif (hits.length === 1) {\n\t\t\tmatchedSpace = hits[0].space;\n\t\t\tmatchedPkg = hits[0].pkg;\n\t\t} else if (bestParseFailure !== void 0) return {\n\t\t\terror: mapRefResolutionError(bestParseFailure),\n\t\t\texitCode: 2\n\t\t};\n\t}\n\tif (!matchedPkg || !matchedSpace) return {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures: [],\n\t\t\tsummary: `Migration package for \"${target}\" not found on disk`\n\t\t},\n\t\texitCode: 2\n\t};\n\tconst failures = [...checkManifestFilesPresent(matchedSpace)];\n\tfor (const f of [\"migration.json\", \"ops.json\"]) {\n\t\tconst fail = checkFileExists(matchedSpace.spaceId, matchedPkg.dirPath, matchedPkg.dirName, f);\n\t\tif (fail) failures.push(fail);\n\t}\n\tconst verification = verifyMigrationHash(matchedPkg);\n\tif (!verification.ok) failures.push({\n\t\tspace: matchedSpace.spaceId,\n\t\tcode: \"MIGRATION.CHECK_HASH_MISMATCH\",\n\t\twhere: migrationFileRelative(matchedPkg.dirPath, \"migration.json\"),\n\t\twhy: `Stored hash ${verification.storedHash} does not match recomputed hash ${verification.computedHash}`,\n\t\tfix: \"Re-emit the migration package or restore from version control.\"\n\t});\n\tconst snapshotFailure = await checkSnapshotConsistency(matchedSpace.spaceId, matchedPkg, matchedSpace.projectMigrationsDir);\n\tif (snapshotFailure) failures.push(snapshotFailure);\n\tconst resolvedSpaceId = matchedSpace.spaceId !== \"app\" ? matchedSpace.spaceId : void 0;\n\tif (failures.length === 0) return {\n\t\tresult: {\n\t\t\tok: true,\n\t\t\tfailures: [],\n\t\t\tsummary: \"All checks passed\"\n\t\t},\n\t\texitCode: 0,\n\t\t...ifDefined(\"resolvedSpaceId\", resolvedSpaceId)\n\t};\n\treturn {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures,\n\t\t\tsummary: `${failures.length} integrity failure(s)`\n\t\t},\n\t\texitCode: 4,\n\t\t...ifDefined(\"resolvedSpaceId\", resolvedSpaceId)\n\t};\n}\nfunction createMigrationCheckCommand() {\n\tconst command = new Command(\"check\");\n\tsetCommandDescriptions(command, \"Verify artifact and graph integrity\", \"Validates that on-disk migration packages are internally consistent\\n(hashes match, manifests are complete) and that the graph is well-formed\\n(edges connect, refs point at valid nodes). The whole-graph check spans\\nevery contract space by default; pass --space <id> to narrow to one. A\\nmigration reference checks a single package, resolved across all contract\\nspaces (narrow with --space; an ambiguous reference is a precondition failure).\\nOffline — does not consult the database.\\nExit codes: 0 = all checks passed, 2 = precondition failed\\n(unresolved target or unknown --space), 4 = integrity failure(s) found.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration check\",\n\t\t\"prisma-next migration check --space app\",\n\t\t\"prisma-next migration check 20260101-add-users\",\n\t\t\"prisma-next migration check 20260101-add-users --space app\",\n\t\t\"prisma-next migration check --json\"\n\t]);\n\tsetCommandSeeAlso(command, [\n\t\t{\n\t\t\tverb: \"migration status\",\n\t\t\toneLiner: \"Show migration path and pending status\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration list\",\n\t\t\toneLiner: \"List on-disk migrations\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration graph\",\n\t\t\toneLiner: \"Show the migration graph topology\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration show\",\n\t\t\toneLiner: \"Display migration package contents\"\n\t\t}\n\t]);\n\tcommand.exitOverride();\n\taddGlobalOptions(command).argument(\"[target]\", \"Migration reference: directory name, hash/prefix, ref, or path\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--space <id>\", \"Narrow output to a single contract space\").action(async (target, options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tlet outcome;\n\t\ttry {\n\t\t\toutcome = await executeMigrationCheckCommand(target, options, flags, ui);\n\t\t} catch (error) {\n\t\t\toutcome = {\n\t\t\t\tresult: {\n\t\t\t\t\tok: false,\n\t\t\t\t\tfailures: [],\n\t\t\t\t\tsummary: error instanceof Error ? error.message : String(error)\n\t\t\t\t},\n\t\t\t\texitCode: 2\n\t\t\t};\n\t\t}\n\t\tif (outcome.error) {\n\t\t\tconst envelope = outcome.error.toEnvelope();\n\t\t\tif (flags.json) ui.output(formatErrorJson(envelope));\n\t\t\telse if (!flags.quiet) ui.error(formatErrorOutput(envelope, flags));\n\t\t\tprocess.exit(outcome.exitCode);\n\t\t}\n\t\tconst result = outcome.result ?? {\n\t\t\tok: false,\n\t\t\tfailures: [],\n\t\t\tsummary: \"No check result produced\"\n\t\t};\n\t\tif (flags.json) ui.output(JSON.stringify(result, null, 2));\n\t\telse if (!flags.quiet) if (result.ok) {\n\t\t\tconst spaceSuffix = outcome.resolvedSpaceId !== void 0 ? ` (space: ${outcome.resolvedSpaceId})` : \"\";\n\t\t\tui.log(`✔ ${result.summary}${spaceSuffix}`);\n\t\t} else {\n\t\t\tfor (const f of result.failures) {\n\t\t\t\tui.log(`✗ [${f.code}] ${f.where}: ${f.why}`);\n\t\t\t\tui.log(` fix: ${f.fix}`);\n\t\t\t}\n\t\t\tui.log(`\\n${result.summary}`);\n\t\t}\n\t\tprocess.exit(outcome.exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { enumerateCheckSpaces as n, runMigrationCheck as r, createMigrationCheckCommand as t };\n\n//# sourceMappingURL=migration-check-DcwUnadt.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,SAAS,wBAAwB,SAAS;CACzC,OAAO,SAAS,QAAQ,IAAI,GAAG,OAAO;AACvC;AACA,SAAS,wBAAwB,SAAS,UAAU;CACnD,OAAO,KAAK,wBAAwB,OAAO,GAAG,QAAQ;AACvD;;;;;AAKA,SAAS,iCAAiC,WAAW,eAAe;CACnE,MAAM,iBAAiB,YAAY,wBAAwB,KAAK,eAAe,OAAO,CAAC;CACvF,MAAM,mBAAmB,SAAS,YAAY,wBAAwB,KAAK,eAAe,SAAS,OAAO,CAAC;CAC3G,MAAM,eAAe,SAAS,YAAY,wBAAwB,KAAK,eAAe,SAAS,QAAQ,GAAG,QAAQ,MAAM,CAAC;CACzH,QAAQ,UAAU,MAAlB;EACC,KAAK,gBAAgB,OAAO;GAC3B,OAAO,UAAU;GACjB,MA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AAG,OAAO,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;OACpD,IAAI,CAAC,MAAM,OAAO,IAAI,OAAO,IAAI;GACrC,MAAM,cAAc,QAAQ,oBAAoB,KAAK,IAAI,aAAa,QAAQ,gBAAgB,KAAK;GACnG,GAAG,IAAI,KAAK,OAAO,UAAU,aAAa;EAC3C,OAAO;GACN,KAAK,MAAM,KAAK,OAAO,UAAU;IAChC,GAAG,IAAI,MAAM,EAAE,KAAK,IAAI,EAAE,MAAM,IAAI,EAAE,KAAK;IAC3C,GAAG,IAAI,UAAU,EAAE,KAAK;GACzB;GACA,GAAG,IAAI,KAAK,OAAO,SAAS;EAC7B;EACA,QAAQ,KAAK,QAAQ,QAAQ;CAC9B,CAAC;CACD,OAAO;AACR"}
@@ -13,7 +13,7 @@ import { ifDefined } from "@prisma/orm-framework/utils/defined";
13
13
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
14
14
  import { dim, yellow } from "colorette";
15
15
  import { Command } from "commander";
16
- //#region ../../../1-framework/3-tooling/cli/dist/migration-status-CFlzlRmu.mjs
16
+ //#region ../../../1-framework/3-tooling/cli/dist/migration-status-CE7cQLDq.mjs
17
17
  function deriveStatusEdgeAnnotations(input) {
18
18
  const annotations = /* @__PURE__ */ new Map();
19
19
  if (input.showAppliedOverlay) {
@@ -441,4 +441,4 @@ function createMigrationStatusCommand() {
441
441
  //#endregion
442
442
  export { formatStatusHumanOutput as a, executeMigrationStatusCommand as i, buildStatusHeadline as n, formatStatusSummary as o, createMigrationStatusCommand as r, buildNoPathSummary as t };
443
443
 
444
- //# sourceMappingURL=migration-status-CFlzlRmu-DewBN8Ys.mjs.map
444
+ //# sourceMappingURL=migration-status-CE7cQLDq-B1jDVmqG.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-status-CE7cQLDq-B1jDVmqG.mjs","names":["CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-status-CE7cQLDq.mjs"],"sourcesContent":["import { A as formatStyledHeader, F as CliStructuredError, _ as createTerminalUI, a as readContractEnvelope, ct as errorUnexpected, d as setCommandSeeAlso, dt as requireLiveDatabase, g as parseGlobalFlagsOrExit, i as maskConnectionUrl, l as setCommandDescriptions, lt as mapMigrationToolsError, n as collectDeclaredInvariants, p as toStructuralEdge, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, ut as mapRefResolutionError, y as handleResult } from \"./command-helpers-CAoXqAY9.mjs\";\nimport { n as buildReadAggregate, o as refusePackageCorruptionOnAggregate, r as loadContractRawSafely } from \"./contract-space-aggregate-loader-CFH-336b.mjs\";\nimport { t as createControlClient } from \"./client-75qrAPqf.mjs\";\nimport { a as renderMigrationGraphLegend, f as indentMigrationGraphTreeBlock, l as computeGlobalMaxDirNameWidth, p as renderMigrationGraphSpaceTree, u as computeGlobalMaxEdgeTreePrefixWidth } from \"./migration-graph-command-render-BKrg6BPv.mjs\";\nimport { c as validateLegendOptions, i as migrationSpaceListEntriesFromAggregate, o as runMigrationList, r as listRefsByContractHash, s as shouldShowLegend } from \"./migration-list-BFBeo1_X.mjs\";\nimport \"./schemas-KhXMzNA_.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { dim, yellow } from \"colorette\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { MigrationToolsError, errorNoInvariantPath, errorUnknownInvariant } from \"@internal/migration-tools/errors\";\nimport { findPath, findPathWithDecision } from \"@internal/migration-tools/migration-graph\";\nimport { readRefs } from \"@internal/migration-tools/refs\";\nimport { parseContractRef } from \"@internal/migration-tools/ref-resolution\";\n//#region src/commands/migration-status-overlay.ts\nfunction deriveStatusEdgeAnnotations(input) {\n\tconst annotations = /* @__PURE__ */ new Map();\n\tif (input.showAppliedOverlay) {\n\t\tfor (const edge of input.graph.migrationByHash.values()) if (input.appliedMigrationHashes.has(edge.migrationHash)) annotations.set(edge.migrationHash, { status: \"applied\" });\n\t}\n\tif (!input.graph.nodes.has(input.originHash)) return annotations;\n\tconst pendingPath = findPath(input.graph, input.originHash, input.targetHash);\n\tif (!pendingPath) return annotations;\n\tfor (const edge of pendingPath) {\n\t\tif (input.appliedMigrationHashes.has(edge.migrationHash)) continue;\n\t\tif (annotations.get(edge.migrationHash)?.status === \"applied\") continue;\n\t\tannotations.set(edge.migrationHash, { status: \"pending\" });\n\t}\n\treturn annotations;\n}\nfunction appliedHashesFromLedger(ledgerEntries) {\n\treturn new Set(ledgerEntries.map((entry) => entry.migrationHash));\n}\nfunction statusForMigrationHash(migrationHash, annotations) {\n\treturn annotations.get(migrationHash)?.status ?? null;\n}\n//#endregion\n//#region src/commands/migration-status.ts\nfunction shortDisplayHash(hash) {\n\treturn hash.slice(0, 12);\n}\nfunction resolveTarget(contractHash, activeRefHash) {\n\treturn activeRefHash ?? contractHash;\n}\nfunction buildStatusMigrations(listMigrations, annotations) {\n\treturn listMigrations.map((migration) => ({\n\t\t...migration,\n\t\tstatus: statusForMigrationHash(migration.hash, annotations)\n\t}));\n}\nfunction renderSpaceTree(args) {\n\tconst graph = args.space.graph();\n\tif (graph.nodes.size === 0) return \"\";\n\treturn renderMigrationGraphSpaceTree({\n\t\tgraph,\n\t\tmigrations: args.migrations,\n\t\tliveContractHash: args.liveContractHash,\n\t\trefsByHash: listRefsByContractHash(args.space),\n\t\tstatusOverlayByHash: args.statusOverlay,\n\t\tcolorize: args.colorize,\n\t\tglyphMode: args.glyphMode,\n\t\tisAppSpace: args.isAppSpace,\n\t\t...args.showDbMarker && args.markerHash !== void 0 ? { dbHash: args.markerHash } : {},\n\t\t...args.globalMaxEdgeTreePrefixWidth !== void 0 ? { globalMaxEdgeTreePrefixWidth: args.globalMaxEdgeTreePrefixWidth } : {},\n\t\t...args.globalMaxDirNameWidth !== void 0 ? { globalMaxDirNameWidth: args.globalMaxDirNameWidth } : {}\n\t});\n}\nfunction countPending(migrations) {\n\treturn migrations.filter((m) => m.status === \"pending\").length;\n}\nfunction buildNoPathSummary(args) {\n\tconst markerPart = args.markerHash !== void 0 ? `the database state (${shortDisplayHash(args.markerHash)})` : \"the database state\";\n\tconst targetShort = shortDisplayHash(args.targetHash);\n\tif (!args.explicitTarget) return `No migration path from ${markerPart} to the application's contract (${targetShort}). Run \\`prisma-next migration plan --name <name>\\` to author one.`;\n\treturn `No migration path from ${markerPart} to ${args.refName !== void 0 ? `the target (${targetShort} via \\`${args.refName}\\`)` : `the target (${targetShort})`}. Run \\`prisma-next migration plan --name <name>\\` to author one, or pass \\`--to <contract>\\` to pick a reachable target.`;\n}\nfunction buildStatusHeadline(args) {\n\tif (args.markerDiverged && args.markerHash !== void 0) return `Database marker ${shortDisplayHash(args.markerHash)} is not in the on-disk migration graph`;\n\tif (args.pendingCount === 0) return \"Up to date\";\n\treturn `${args.pendingCount} pending — run \\`prisma-next migrate --to ${shortDisplayHash(args.targetHash)}\\``;\n}\nfunction formatStatusSummary(result, colorize) {\n\tconst c = (fn, s) => colorize ? fn(s) : s;\n\tconst lines = [];\n\tconst pendingTotal = result.spaces.reduce((sum, space) => sum + countPending(space.migrations), 0);\n\tif (result.diagnostics.some((d) => d.code === \"MIGRATION.MARKER_NOT_IN_HISTORY\") || pendingTotal > 0) lines.push(c(yellow, result.summary));\n\telse lines.push(result.summary);\n\tconst missingInvariantsDiagnostic = result.diagnostics.find((d) => d.code === \"MIGRATION.MISSING_INVARIANTS\");\n\tif (missingInvariantsDiagnostic !== void 0) lines.push(c(dim, missingInvariantsDiagnostic.message));\n\treturn lines.join(\"\\n\");\n}\nfunction formatStatusHumanOutput(result, colorize) {\n\tconst sections = [];\n\tfor (const section of result.treeSections) {\n\t\tif (section.showHeading) sections.push(`${section.space}:`);\n\t\tif (section.tree.length > 0) sections.push(section.tree);\n\t\telse sections.push(\"(no migrations)\");\n\t\tsections.push(\"\");\n\t}\n\tsections.push(formatStatusSummary(result, colorize));\n\treturn sections.join(\"\\n\").trimEnd();\n}\nasync function readMarkersAndLedgers(args) {\n\tconst markersBySpace = /* @__PURE__ */ new Map();\n\tconst all = await args.client.readAllMarkers();\n\tfor (const [spaceId, marker] of all) markersBySpace.set(spaceId, marker);\n\tconst ledgersBySpace = /* @__PURE__ */ new Map();\n\tfor (const spaceId of args.spaceIds) ledgersBySpace.set(spaceId, await args.client.readLedger(spaceId));\n\treturn {\n\t\tmarkersBySpace,\n\t\tledgersBySpace\n\t};\n}\nasync function executeMigrationStatusCommand(options, flags, ui) {\n\tconst config = await loadConfig(options.config);\n\tconst { configPath, migrationsDir, migrationsRelative, refsDir } = resolveMigrationPaths(options.config, config);\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tconst hasDriver = !!config.driver;\n\tconst usingFromOverride = options.from !== void 0;\n\tif (!usingFromOverride) {\n\t\tconst missingDb = requireLiveDatabase({\n\t\t\tdbConnection,\n\t\t\thasDriver,\n\t\t\twhy: \"migration status needs a database connection to read the marker and ledger (or pass --from for offline path preview)\",\n\t\t\tretryCommand: \"prisma-next migration status --from <contract>\"\n\t\t});\n\t\tif (missingDb) return notOk(missingDb);\n\t}\n\tlet allRefs = {};\n\ttry {\n\t\tallRefs = await readRefs(refsDir);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));\n\t\tthrow error;\n\t}\n\tconst diagnostics = [];\n\tlet contractHash = EMPTY_CONTRACT_HASH;\n\ttry {\n\t\tcontractHash = (await readContractEnvelope(config)).storageHash;\n\t} catch (error) {\n\t\tdiagnostics.push({\n\t\t\tcode: \"CONTRACT.UNREADABLE\",\n\t\t\tseverity: \"warn\",\n\t\t\tmessage: `Could not read contract: ${error instanceof Error ? error.message : \"unknown error\"}`,\n\t\t\thints: [\"Run 'prisma-next contract emit' to generate a valid contract\"]\n\t\t});\n\t}\n\tconst loaded = await buildReadAggregate(config, { migrationsDir });\n\tif (!loaded.ok) return notOk(loaded.failure);\n\tconst { aggregate } = loaded.value;\n\tif (await loadContractRawSafely(config) !== null) {\n\t\tconst corruptionFailure = refusePackageCorruptionOnAggregate(aggregate);\n\t\tif (corruptionFailure) return notOk(corruptionFailure);\n\t}\n\tconst appGraph = aggregate.app.graph();\n\tlet activeRefHash;\n\tlet activeRefName;\n\tlet activeRefEntry;\n\tlet fromOverrideHash;\n\tif (options.to) {\n\t\tconst refResult = parseContractRef(options.to, {\n\t\t\tgraph: appGraph,\n\t\t\trefs: allRefs\n\t\t});\n\t\tif (!refResult.ok) return notOk(mapRefResolutionError(refResult.failure));\n\t\tactiveRefHash = refResult.value.hash;\n\t\tif (refResult.value.provenance.kind === \"ref\") {\n\t\t\tactiveRefName = refResult.value.provenance.refName;\n\t\t\tactiveRefEntry = allRefs[activeRefName];\n\t\t}\n\t}\n\tif (options.from) {\n\t\tconst fromResult = parseContractRef(options.from, {\n\t\t\tgraph: appGraph,\n\t\t\trefs: allRefs\n\t\t});\n\t\tif (!fromResult.ok) return notOk(mapRefResolutionError(fromResult.failure));\n\t\tfromOverrideHash = fromResult.value.hash;\n\t}\n\tconst requiredInvariants = [...activeRefEntry?.invariants ?? []].sort();\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: configPath\n\t\t}, {\n\t\t\tlabel: \"migrations\",\n\t\t\tvalue: migrationsRelative\n\t\t}];\n\t\tif (dbConnection && hasDriver) details.push({\n\t\t\tlabel: \"database\",\n\t\t\tvalue: maskConnectionUrl(String(dbConnection))\n\t\t});\n\t\tif (activeRefName) details.push({\n\t\t\tlabel: \"ref\",\n\t\t\tvalue: activeRefName\n\t\t});\n\t\tif (options.from) details.push({\n\t\t\tlabel: \"from\",\n\t\t\tvalue: options.from\n\t\t});\n\t\tif (options.space) details.push({\n\t\t\tlabel: \"space\",\n\t\t\tvalue: options.space\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migration status\",\n\t\t\tdescription: \"Show migration history and applied status\",\n\t\t\tdetails,\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t\tif (shouldShowLegend(options, flags)) {\n\t\t\tui.stderr(renderMigrationGraphLegend({\n\t\t\t\tcolorize: flags.color !== false,\n\t\t\t\tglyphMode: ui.resolveGlyphMode(options.ascii === true)\n\t\t\t}));\n\t\t\tui.stderr(\"\");\n\t\t}\n\t}\n\tconst listResult = runMigrationList({\n\t\tspaces: await migrationSpaceListEntriesFromAggregate(aggregate, migrationsDir),\n\t\t...ifDefined(\"spaceFilter\", options.space)\n\t});\n\tif (!listResult.ok) return listResult;\n\tconst scopedSpaces = listResult.value.spaces;\n\tconst showSpaceHeadings = scopedSpaces.length > 1;\n\tlet markersBySpace = /* @__PURE__ */ new Map();\n\tlet ledgersBySpace = /* @__PURE__ */ new Map();\n\tlet connected = false;\n\tif (dbConnection && hasDriver && !usingFromOverride) {\n\t\tconst client = createControlClient({\n\t\t\tfamily: config.family,\n\t\t\ttarget: config.target,\n\t\t\tadapter: config.adapter,\n\t\t\tdriver: config.driver,\n\t\t\textensions: config.extensions ?? []\n\t\t});\n\t\ttry {\n\t\t\tawait client.connect(dbConnection);\n\t\t\tconnected = true;\n\t\t\tconst read = await readMarkersAndLedgers({\n\t\t\t\tclient,\n\t\t\t\tspaceIds: scopedSpaces.map((s) => s.space)\n\t\t\t});\n\t\t\tmarkersBySpace = new Map(read.markersBySpace);\n\t\t\tledgersBySpace = new Map(read.ledgersBySpace);\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read database state: ${error instanceof Error ? error.message : String(error)}` }));\n\t\t} finally {\n\t\t\tawait client.close();\n\t\t}\n\t}\n\tif (activeRefEntry && activeRefEntry.invariants.length > 0 && connected) {\n\t\tconst declared = collectDeclaredInvariants(appGraph);\n\t\tconst markerInvariants = markersBySpace.get(aggregate.app.spaceId)?.invariants ?? [];\n\t\tconst known = new Set(declared);\n\t\tfor (const id of markerInvariants) known.add(id);\n\t\tconst unknown = activeRefEntry.invariants.filter((id) => !known.has(id));\n\t\tif (unknown.length > 0) return notOk(mapMigrationToolsError(errorUnknownInvariant({\n\t\t\t...ifDefined(\"refName\", activeRefName),\n\t\t\tunknown,\n\t\t\tdeclared: [...declared].sort()\n\t\t})));\n\t}\n\tconst showAppliedOverlay = connected && !usingFromOverride;\n\tconst showDbMarker = connected && !usingFromOverride;\n\tconst glyphMode = ui.resolveGlyphMode(options.ascii === true);\n\tconst colorize = flags.color !== false;\n\tconst statusSpaces = [];\n\tconst treeSections = [];\n\tlet markerDiverged = false;\n\tlet markerCannotReachTarget = false;\n\tlet headlineTargetHash = activeRefHash ?? contractHash;\n\tlet totalPending = 0;\n\tconst globalLayoutInputs = showSpaceHeadings ? scopedSpaces.filter((spaceEntry) => spaceEntry.migrations.length > 0).map((spaceEntry) => ({\n\t\tgraph: aggregate.space(spaceEntry.space).graph(),\n\t\tliveContractHash: contractHash\n\t})) : [];\n\tconst globalMaxEdgeTreePrefixWidth = globalLayoutInputs.length > 0 ? computeGlobalMaxEdgeTreePrefixWidth(globalLayoutInputs) : void 0;\n\tconst globalMaxDirNameWidth = globalLayoutInputs.length > 0 ? computeGlobalMaxDirNameWidth(globalLayoutInputs) : void 0;\n\tfor (const spaceEntry of scopedSpaces) {\n\t\tconst space = aggregate.space(spaceEntry.space);\n\t\tif (space === void 0) continue;\n\t\tconst graph = space.graph();\n\t\tconst spaceContractHash = space.contract().storage.storageHash;\n\t\tconst targetHash = resolveTarget(spaceContractHash, activeRefHash);\n\t\tif (spaceEntry.space === aggregate.app.spaceId) headlineTargetHash = targetHash;\n\t\tconst markerRecord = markersBySpace.get(spaceEntry.space);\n\t\tconst markerHash = usingFromOverride ? fromOverrideHash : markerRecord?.storageHash ?? void 0;\n\t\tconst originHash = markerHash ?? EMPTY_CONTRACT_HASH;\n\t\tconst markerInGraph = markerHash === void 0 || graph.nodes.has(markerHash) || markerHash === spaceContractHash;\n\t\tif (connected && !usingFromOverride && markerInGraph && originHash !== targetHash && findPath(graph, originHash, targetHash) === null) markerCannotReachTarget = true;\n\t\tif (connected && !usingFromOverride && markerHash !== void 0 && !markerInGraph) {\n\t\t\tmarkerDiverged = true;\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"MIGRATION.MARKER_NOT_IN_HISTORY\",\n\t\t\t\tseverity: \"warn\",\n\t\t\t\tmessage: \"Database was updated outside the migration system (marker does not match any migration)\",\n\t\t\t\thints: [\"Run 'prisma-next db sign' to overwrite the marker if the database already matches the contract\", \"Run 'prisma-next db update' to push the current contract to the database\"]\n\t\t\t});\n\t\t}\n\t\tconst ledger = ledgersBySpace.get(spaceEntry.space) ?? [];\n\t\tconst annotations = deriveStatusEdgeAnnotations({\n\t\t\tgraph,\n\t\t\ttargetHash,\n\t\t\toriginHash,\n\t\t\tappliedMigrationHashes: showAppliedOverlay ? appliedHashesFromLedger(ledger) : /* @__PURE__ */ new Set(),\n\t\t\tshowAppliedOverlay\n\t\t});\n\t\tconst isAppSpace = spaceEntry.space === aggregate.app.spaceId;\n\t\tconst tree = renderSpaceTree({\n\t\t\tspace,\n\t\t\tliveContractHash: contractHash,\n\t\t\tmigrations: spaceEntry.migrations,\n\t\t\tmarkerHash,\n\t\t\tshowDbMarker,\n\t\t\tstatusOverlay: annotations,\n\t\t\tcolorize,\n\t\t\tglyphMode,\n\t\t\tisAppSpace,\n\t\t\t...globalMaxEdgeTreePrefixWidth !== void 0 ? { globalMaxEdgeTreePrefixWidth } : {},\n\t\t\t...globalMaxDirNameWidth !== void 0 ? { globalMaxDirNameWidth } : {}\n\t\t});\n\t\tconst migrations = buildStatusMigrations(spaceEntry.migrations, annotations);\n\t\tconst pending = countPending(migrations);\n\t\ttotalPending += pending;\n\t\tstatusSpaces.push({\n\t\t\tspace: spaceEntry.space,\n\t\t\tcurrentContract: markerHash ?? null,\n\t\t\ttargetContract: targetHash,\n\t\t\tmigrations: [...migrations]\n\t\t});\n\t\tconst displayTree = showSpaceHeadings && tree.length > 0 ? indentMigrationGraphTreeBlock(tree, \" \") : tree;\n\t\ttreeSections.push({\n\t\t\tspace: spaceEntry.space,\n\t\t\ttree: displayTree,\n\t\t\tshowHeading: showSpaceHeadings\n\t\t});\n\t}\n\tif (connected && requiredInvariants.length > 0) {\n\t\tconst markerInvariants = markersBySpace.get(aggregate.app.spaceId)?.invariants ?? [];\n\t\tconst markerSet = new Set(markerInvariants);\n\t\tconst missing = requiredInvariants.filter((id) => !markerSet.has(id));\n\t\tif (missing.length > 0) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"MIGRATION.MISSING_INVARIANTS\",\n\t\t\t\t...ifDefined(\"ref\", activeRefName),\n\t\t\t\tinvariants: missing,\n\t\t\t\tmessage: `missing invariant(s): ${missing.join(\", \")}`\n\t\t\t});\n\t\t\tif (activeRefHash !== void 0) {\n\t\t\t\tconst outcome = findPathWithDecision(appGraph, markersBySpace.get(aggregate.app.spaceId)?.storageHash ?? EMPTY_CONTRACT_HASH, activeRefHash, {\n\t\t\t\t\t...ifDefined(\"refName\", activeRefName),\n\t\t\t\t\trequired: new Set(missing)\n\t\t\t\t});\n\t\t\t\tif (outcome.kind === \"unsatisfiable\") return notOk(mapMigrationToolsError(errorNoInvariantPath({\n\t\t\t\t\t...ifDefined(\"refName\", activeRefName),\n\t\t\t\t\trequired: [...missing].sort(),\n\t\t\t\t\tmissing: outcome.missing,\n\t\t\t\t\tstructuralPath: outcome.structuralPath.map(toStructuralEdge)\n\t\t\t\t})));\n\t\t\t}\n\t\t}\n\t}\n\tconst appMarkerHash = markersBySpace.get(aggregate.app.spaceId)?.storageHash;\n\tconst summary = markerCannotReachTarget ? buildNoPathSummary({\n\t\tmarkerHash: appMarkerHash,\n\t\ttargetHash: headlineTargetHash,\n\t\texplicitTarget: options.to !== void 0,\n\t\trefName: activeRefName\n\t}) : buildStatusHeadline({\n\t\tpendingCount: totalPending,\n\t\ttargetHash: headlineTargetHash,\n\t\tmarkerDiverged,\n\t\tmarkerHash: appMarkerHash\n\t});\n\tif (scopedSpaces.every((s) => s.migrations.length === 0)) return ok({\n\t\tok: true,\n\t\tspaces: statusSpaces,\n\t\tsummary: \"No migrations found\",\n\t\tdiagnostics,\n\t\ttreeSections\n\t});\n\treturn ok({\n\t\tok: true,\n\t\tspaces: statusSpaces,\n\t\tsummary,\n\t\tdiagnostics,\n\t\ttreeSections\n\t});\n}\nfunction createMigrationStatusCommand() {\n\tconst command = new Command(\"status\");\n\tsetCommandDescriptions(command, \"Show migration path and pending status\", \"Shows which migrations are pending between the database marker and\\nthe target contract. Requires a database connection.\\nPass --from for an offline path preview without a database.\\nUse `migration graph` for topology, `migration log` for history,\\nand `migration list` for on-disk enumeration.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration status --db $DATABASE_URL\",\n\t\t\"prisma-next migration status --to production --db $DATABASE_URL\",\n\t\t\"prisma-next migration status --from abc123 --to production\",\n\t\t\"prisma-next migration status --from abc123 --to production --json\",\n\t\t\"prisma-next migration status --ascii --from abc123 --to production\",\n\t\t\"prisma-next migration status --legend --from abc123 --to production\"\n\t]);\n\tsetCommandSeeAlso(command, [\n\t\t{\n\t\t\tverb: \"migration log\",\n\t\t\toneLiner: \"Show executed migration history\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration list\",\n\t\t\toneLiner: \"List on-disk migrations\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration graph\",\n\t\t\toneLiner: \"Show the migration graph topology\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration show\",\n\t\t\toneLiner: \"Display migration package contents\"\n\t\t}\n\t]);\n\taddGlobalOptions(command).option(\"--db <url>\", \"Database connection string\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--space <id>\", \"Narrow output to a single contract space\").option(\"--to <contract>\", \"Target contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)\").option(\"--from <contract>\", \"Origin contract reference; same grammar as --to. Supplying --from switches to offline path computation.\").option(\"--legend\", \"Print a key for the tree glyphs and lane colors\").option(\"--ascii\", \"Use ASCII glyphs (pipe-friendly)\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst legendValidation = validateLegendOptions(options, flags);\n\t\tif (!legendValidation.ok) process.exit(handleResult(legendValidation, flags, ui));\n\t\tconst exitCode = handleResult(await executeMigrationStatusCommand(options, flags, ui), flags, ui, (statusResult) => {\n\t\t\tif (flags.json) {\n\t\t\t\tconst jsonResult = {\n\t\t\t\t\tok: true,\n\t\t\t\t\tspaces: [...statusResult.spaces],\n\t\t\t\t\tsummary: statusResult.summary,\n\t\t\t\t\tdiagnostics: [...statusResult.diagnostics]\n\t\t\t\t};\n\t\t\t\tui.output(JSON.stringify(jsonResult, null, 2));\n\t\t\t} else if (!flags.quiet) ui.output(formatStatusHumanOutput(statusResult, flags.color !== false));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { formatStatusHumanOutput as a, executeMigrationStatusCommand as i, buildStatusHeadline as n, formatStatusSummary as o, createMigrationStatusCommand as r, buildNoPathSummary as t };\n\n//# sourceMappingURL=migration-status-CE7cQLDq.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAiBA,SAAS,4BAA4B,OAAO;CAC3C,MAAM,8BAA8B,IAAI,IAAI;CAC5C,IAAI,MAAM,oBACJ;OAAA,MAAM,QAAQ,MAAM,MAAM,gBAAgB,OAAO,GAAG,IAAI,MAAM,uBAAuB,IAAI,KAAK,aAAa,GAAG,YAAY,IAAI,KAAK,eAAe,EAAE,QAAQ,UAAU,CAAC;CAAA;CAE7K,IAAI,CAAC,MAAM,MAAM,MAAM,IAAI,MAAM,UAAU,GAAG,OAAO;CACrD,MAAM,cAAc,SAAS,MAAM,OAAO,MAAM,YAAY,MAAM,UAAU;CAC5E,IAAI,CAAC,aAAa,OAAO;CACzB,KAAK,MAAM,QAAQ,aAAa;EAC/B,IAAI,MAAM,uBA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iBAAiB,KAAK;EACjC,MAAM,mBAAmB,sBAAsB,SAAS,KAAK;EAC7D,IAAI,CAAC,iBAAiB,IAAI,QAAQ,KAAK,aAAa,kBAAkB,OAAO,EAAE,CAAC;EAChF,MAAM,WAAW,aAAa,MAAM,8BAA8B,SAAS,OAAO,EAAE,GAAG,OAAO,KAAK,iBAAiB;GACnH,IAAI,MAAM,MAAM;IACf,MAAM,aAAa;KAClB,IAAI;KACJ,QAAQ,CAAC,GAAG,aAAa,MAAM;KAC/B,SAAS,aAAa;KACtB,aAAa,CAAC,GAAG,aAAa,WAAW;IAC1C;IACA,GAAG,OAAO,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC;GAC9C,OAAO,IAAI,CAAC,MAAM,OAAO,GAAG,OAAO,wBAAwB,cAAc,MAAM,UAAU,KAAK,CAAC;EAChG,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/orm-toolchain",
3
- "version": "0.16.0-dev.36",
3
+ "version": "0.16.0-dev.38",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "dependencies": {
15
15
  "@clack/prompts": "^1.7.0",
16
- "@prisma/orm-framework": "0.16.0-dev.36",
16
+ "@prisma/orm-framework": "0.16.0-dev.38",
17
17
  "@vercel/detect-agent": "^1.2.3",
18
18
  "arktype": "^2.2.2",
19
19
  "c12": "^3.3.4",
@@ -34,16 +34,16 @@
34
34
  "wrap-ansi": "^10.0.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@internal/cli": "0.16.0-dev.36",
38
- "@internal/cli-telemetry": "0.16.0-dev.36",
39
- "@internal/config-loader": "0.16.0-dev.36",
40
- "@internal/emitter": "0.16.0-dev.36",
41
- "@internal/language-server": "0.16.0-dev.36",
42
- "@internal/migration-tools": "0.16.0-dev.36",
43
- "@internal/publish-surface": "0.16.0-dev.36",
44
- "@repo/tsconfig": "0.16.0-dev.36",
45
- "@repo/tsdown": "0.16.0-dev.36",
46
- "@internal/vite-plugin-contract-emit": "0.16.0-dev.36",
37
+ "@internal/cli": "0.16.0-dev.38",
38
+ "@internal/cli-telemetry": "0.16.0-dev.38",
39
+ "@internal/config-loader": "0.16.0-dev.38",
40
+ "@internal/emitter": "0.16.0-dev.38",
41
+ "@internal/language-server": "0.16.0-dev.38",
42
+ "@internal/migration-tools": "0.16.0-dev.38",
43
+ "@internal/publish-surface": "0.16.0-dev.38",
44
+ "@repo/tsconfig": "0.16.0-dev.38",
45
+ "@repo/tsdown": "0.16.0-dev.38",
46
+ "@internal/vite-plugin-contract-emit": "0.16.0-dev.38",
47
47
  "tsdown": "0.22.14",
48
48
  "typescript": "5.9.3"
49
49
  },
@@ -1 +0,0 @@
1
- {"version":3,"file":"migration-check-CcG-fB8r-CDs5C9vt.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-check-CcG-fB8r.mjs"],"sourcesContent":["import { A as formatStyledHeader, K as errorInvalidSpaceId, L as errorAmbiguousMigrationRef, _ as createTerminalUI, at as errorSpaceNotFound, b as formatErrorJson, d as setCommandSeeAlso, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, o as resolveContractPath, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, ut as mapRefResolutionError, x as formatErrorOutput } from \"./command-helpers-CAoXqAY9.mjs\";\nimport { n as buildReadAggregate, s as toDeclaredExtensionsFromRaw } from \"./contract-space-aggregate-loader-CFH-336b.mjs\";\nimport { i as resolveTargetPathAcrossSpaces, n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from \"./migration-path-target-D3Sj55PI.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { join, relative } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { existsSync, readdirSync, statSync } from \"node:fs\";\nimport { isValidSpaceId, listContractSpaceDirectories, spaceMigrationDirectory, spaceRefsDirectory } from \"@internal/migration-tools/spaces\";\nimport { loadContractSpaceAggregate } from \"@internal/migration-tools/aggregate\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { MigrationToolsError } from \"@internal/migration-tools/errors\";\nimport { contractSnapshotDir, readContractSnapshotJson } from \"@internal/migration-tools/contract-snapshot-store\";\nimport { parseMigrationRef } from \"@internal/migration-tools/ref-resolution\";\nimport { verifyMigrationHash } from \"@internal/migration-tools/hash\";\n//#region src/utils/integrity-violation-to-check-failure.ts\nfunction migrationPathRelative$1(dirPath) {\n\treturn relative(process.cwd(), dirPath);\n}\nfunction migrationFileRelative$1(dirPath, fileName) {\n\treturn join(migrationPathRelative$1(dirPath), fileName);\n}\n/**\n* Map one {@link IntegrityViolation} onto a `migration check` failure row.\n* Sole catalogue mapping from integrity violations to `MIGRATION.CHECK_*` codes.\n*/\nfunction integrityViolationToCheckFailure(violation, migrationsDir) {\n\tconst spaceRelative = (spaceId) => migrationPathRelative$1(join(migrationsDir, spaceId));\n\tconst packageRelative = (spaceId, dirName) => migrationPathRelative$1(join(migrationsDir, spaceId, dirName));\n\tconst refRelative = (spaceId, refName) => migrationPathRelative$1(join(migrationsDir, spaceId, \"refs\", `${refName}.json`));\n\tswitch (violation.kind) {\n\t\tcase \"hashMismatch\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_HASH_MISMATCH\",\n\t\t\twhere: migrationFileRelative$1(join(migrationsDir, violation.spaceId, violation.dirName), \"migration.json\"),\n\t\t\twhy: `Stored hash ${violation.stored} does not match recomputed hash ${violation.computed}`,\n\t\t\tfix: \"Re-emit the migration package or restore from version control.\"\n\t\t};\n\t\tcase \"providedInvariantsMismatch\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_PROVIDED_INVARIANTS_MISMATCH\",\n\t\t\twhere: packageRelative(violation.spaceId, violation.dirName),\n\t\t\twhy: `Migration \"${violation.dirName}\" providedInvariants in migration.json disagrees with ops.json.`,\n\t\t\tfix: \"Re-emit the migration package so migration.json and ops.json agree.\"\n\t\t};\n\t\tcase \"packageUnloadable\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_PACKAGE_UNLOADABLE\",\n\t\t\twhere: packageRelative(violation.spaceId, violation.dirName),\n\t\t\twhy: `Migration \"${violation.dirName}\" could not be loaded: ${violation.detail}`,\n\t\t\tfix: \"Re-emit the migration package or restore from version control.\"\n\t\t};\n\t\tcase \"sameSourceAndTarget\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_NOOP_SELF_EDGE\",\n\t\t\twhere: packageRelative(violation.spaceId, violation.dirName),\n\t\t\twhy: `Migration \"${violation.dirName}\" in space \"${violation.spaceId}\" has source equal to target (${violation.hash}) with no data invariant — a true no-op self-edge.`,\n\t\t\tfix: \"Add a data operation if this self-edge was meant to carry a data invariant, or delete the migration if it is a true no-op.\"\n\t\t};\n\t\tcase \"orphanSpaceDir\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_ORPHAN_SPACE_DIR\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Contract-space directory \"${violation.spaceId}\" exists on disk but no extension declares it.`,\n\t\t\tfix: \"Remove the orphan directory, or declare the extension in `extensions`.\"\n\t\t};\n\t\tcase \"declaredButUnmigrated\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_DECLARED_BUT_UNMIGRATED\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Extension \"${violation.spaceId}\" is declared in \\`extensions\\` but has no on-disk migrations directory.`,\n\t\t\tfix: \"Re-emit the extension contract-space artefacts with `prisma-next contract emit` and migration planning, or remove the extension from `extensions` if it is unused.\"\n\t\t};\n\t\tcase \"headRefMissing\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_HEAD_REF_MISSING\",\n\t\t\twhere: refRelative(violation.spaceId, \"head\"),\n\t\t\twhy: `Head ref \\`refs/head.json\\` is missing for contract space \"${violation.spaceId}\".`,\n\t\t\tfix: \"Re-emit the contract-space migrations and head ref artefacts, or restore `refs/head.json` from version control.\"\n\t\t};\n\t\tcase \"headRefNotInGraph\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_HEAD_REF_NOT_IN_GRAPH\",\n\t\t\twhere: refRelative(violation.spaceId, \"head\"),\n\t\t\twhy: `Head ref ${violation.hash} for contract space \"${violation.spaceId}\" is not present in its migration graph.`,\n\t\t\tfix: \"Re-emit the contract space migrations, or restore the missing migration package.\"\n\t\t};\n\t\tcase \"refUnreadable\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_REF_UNREADABLE\",\n\t\t\twhere: refRelative(violation.spaceId, violation.refName),\n\t\t\twhy: `Ref \"${violation.refName}\" for contract space \"${violation.spaceId}\" is unreadable: ${violation.detail}`,\n\t\t\tfix: \"Repair or remove the corrupt ref file.\"\n\t\t};\n\t\tcase \"targetMismatch\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_TARGET_MISMATCH\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Contract space \"${violation.spaceId}\" targets \"${violation.actual}\" but the project targets \"${violation.expected}\".`,\n\t\t\tfix: \"Update the extension to target the configured database, or change the project target.\"\n\t\t};\n\t\tcase \"disjointness\": return {\n\t\t\tspace: \"app\",\n\t\t\tcode: \"MIGRATION.CHECK_SPACE_DISJOINTNESS_VIOLATION\",\n\t\t\twhere: migrationPathRelative$1(migrationsDir),\n\t\t\twhy: `Storage element \"${violation.element}\" is claimed by multiple contract spaces: ${violation.claimedBy.join(\", \")}.`,\n\t\t\tfix: \"Update the contracts so each storage element is owned by exactly one contract space.\"\n\t\t};\n\t\tcase \"contractUnreadable\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_CONTRACT_UNREADABLE\",\n\t\t\twhere: migrationFileRelative$1(join(migrationsDir, violation.spaceId), \"contract.json\"),\n\t\t\twhy: `Contract for space \"${violation.spaceId}\" is unreadable: ${violation.detail}`,\n\t\t\tfix: \"Re-emit the extension contract artefacts, or fix the descriptor producing the invalid contract.\"\n\t\t};\n\t\tcase \"duplicateMigrationHash\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_DUPLICATE_MIGRATION_HASH\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Multiple migrations in space \"${violation.spaceId}\" share migrationHash \"${violation.migrationHash}\" (${violation.dirNames.join(\", \")}).`,\n\t\t\tfix: \"Re-emit one of the conflicting packages so each migrationHash is unique.\"\n\t\t};\n\t}\n}\n//#endregion\n//#region src/commands/migration-check.ts\nfunction migrationPathRelative(dirPath) {\n\treturn relative(process.cwd(), dirPath);\n}\nfunction migrationFileRelative(dirPath, fileName) {\n\treturn join(migrationPathRelative(dirPath), fileName);\n}\nfunction checkFileExists(spaceId, dirPath, dirName, fileName) {\n\tif (!existsSync(join(dirPath, fileName))) return {\n\t\tspace: spaceId,\n\t\tcode: \"MIGRATION.CHECK_FILE_MISSING\",\n\t\twhere: migrationFileRelative(dirPath, fileName),\n\t\twhy: `${fileName} is missing from ${dirName}`,\n\t\tfix: \"Re-emit the migration package or restore from version control.\"\n\t};\n\treturn null;\n}\n/**\n* Snapshot-store consistency check for one migration package (D6.5):\n* absent store entry is not an issue (runner independence, ADR 199 — a\n* package dir with only `migration.json` + `ops.json` is legitimate); a\n* present entry whose inner `storage.storageHash` disagrees with\n* `pkg.metadata.to` is `MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH`; an unparseable store\n* entry (or a malformed `to`) is `MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE`.\n*/\nasync function checkSnapshotConsistency(spaceId, pkg, migrationsDir) {\n\tlet snapshotDir;\n\ttry {\n\t\tsnapshotDir = contractSnapshotDir(migrationsDir, pkg.metadata.to);\n\t} catch {\n\t\treturn {\n\t\t\tspace: spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE\",\n\t\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\t\twhy: `Migration \"${pkg.dirName}\" declares to=\"${pkg.metadata.to}\", which is not a well-formed contract snapshot hash.`,\n\t\t\tfix: \"Re-emit the migration package so migration.json declares a valid 64-hex to-hash.\"\n\t\t};\n\t}\n\tlet raw;\n\ttry {\n\t\traw = await readContractSnapshotJson(migrationsDir, pkg.metadata.to);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error) && error.code === \"MIGRATION.CONTRACT_SNAPSHOT_MISSING\") return null;\n\t\treturn {\n\t\t\tspace: spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE\",\n\t\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\t\twhy: `Migration \"${pkg.dirName}\" has an unparseable contract snapshot at ${snapshotDir}/contract.json.`,\n\t\t\tfix: \"Restore migrations/snapshots/ from version control, or re-run the command that produced this migration to regenerate its snapshot.\"\n\t\t};\n\t}\n\tconst snapshotHash = (raw !== null && typeof raw === \"object\" ? raw : {})[\"storage\"]?.[\"storageHash\"];\n\tif (typeof snapshotHash === \"string\" && snapshotHash !== pkg.metadata.to) return {\n\t\tspace: spaceId,\n\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH\",\n\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\twhy: `Migration \"${pkg.dirName}\" declares to=${pkg.metadata.to} but its contract snapshot has storageHash=${snapshotHash}`,\n\t\tfix: \"Re-emit the migration package so migration.json and its contract snapshot agree.\"\n\t};\n\treturn null;\n}\n/**\n* Project the loaded {@link ContractSpaceAggregate} into the\n* {@link CheckSpace} rows the multi-space check iterates — one per on-disk\n* contract-space directory, in the aggregate's `app`-first ordering. Mirrors\n* `migration list`'s `migrationSpaceListEntriesFromAggregate`: space\n* membership matches the on-disk directories, package / ref / graph data come\n* from `aggregate.space(id)`.\n*/\nasync function enumerateCheckSpaces(aggregate, projectMigrationsDir) {\n\tconst candidateDirs = await listContractSpaceDirectories(projectMigrationsDir);\n\tconst onDiskSpaceIds = new Set(candidateDirs.filter(isValidSpaceId));\n\tconst spaces = [];\n\tfor (const space of aggregate.spaces()) {\n\t\tconst spaceId = space.spaceId;\n\t\tif (!isValidSpaceId(spaceId)) continue;\n\t\tif (!onDiskSpaceIds.has(spaceId)) continue;\n\t\tconst migrationsDir = spaceMigrationDirectory(projectMigrationsDir, spaceId);\n\t\tspaces.push({\n\t\t\tspaceId,\n\t\t\tpackages: space.packages,\n\t\t\trefs: space.refs,\n\t\t\tgraph: space.graph(),\n\t\t\tmigrationsDir,\n\t\t\trefsDir: spaceRefsDirectory(migrationsDir),\n\t\t\tprojectMigrationsDir\n\t\t});\n\t}\n\treturn spaces;\n}\nfunction checkManifestFilesPresent(space) {\n\tif (!existsSync(space.migrationsDir)) return [];\n\tconst loadedDirNames = new Set(space.packages.map((p) => p.dirName));\n\tconst failures = [];\n\tlet entries;\n\ttry {\n\t\tentries = readdirSync(space.migrationsDir);\n\t} catch {\n\t\treturn failures;\n\t}\n\tfor (const entry of entries) {\n\t\tif (entry.startsWith(\".\") || entry.startsWith(\"_\") || entry === \"refs\") continue;\n\t\tconst entryPath = join(space.migrationsDir, entry);\n\t\ttry {\n\t\t\tif (!statSync(entryPath).isDirectory()) continue;\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tif (!loadedDirNames.has(entry)) for (const f of [\"migration.json\", \"ops.json\"]) {\n\t\t\tconst fail = checkFileExists(space.spaceId, entryPath, entry, f);\n\t\t\tif (fail) failures.push(fail);\n\t\t}\n\t}\n\treturn failures;\n}\nfunction checkReachability(space) {\n\tconst allToHashes = new Set(space.packages.map((p) => p.metadata.to));\n\tconst failures = [];\n\tfor (const pkg of space.packages) if (!(pkg.metadata.from === null || allToHashes.has(pkg.metadata.from) || pkg.metadata.from === EMPTY_CONTRACT_HASH)) failures.push({\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_UNREACHABLE_MIGRATION\",\n\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\twhy: `Migration \"${pkg.dirName}\" starts from ${pkg.metadata.from} which no other migration produces`,\n\t\tfix: \"This migration is unreachable in the graph. Delete it or re-emit a connecting migration.\"\n\t});\n\treturn failures;\n}\nfunction checkDanglingRefs(space) {\n\tconst failures = [];\n\tfor (const [name, entry] of Object.entries(space.refs)) if (!space.graph.nodes.has(entry.hash)) failures.push({\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_DANGLING_REF\",\n\t\twhere: relative(process.cwd(), join(space.refsDir, `${name}.json`)),\n\t\twhy: `Ref \"${name}\" points at ${entry.hash} which does not exist in the migration graph`,\n\t\tfix: `Update the ref with \\`prisma-next ref set ${name} <valid-hash>\\` or delete it.`\n\t});\n\treturn failures;\n}\nasync function checkSpace(space) {\n\tconst snapshotFailures = await Promise.all(space.packages.map((pkg) => checkSnapshotConsistency(space.spaceId, pkg, space.projectMigrationsDir)));\n\treturn [\n\t\t...checkManifestFilesPresent(space),\n\t\t...snapshotFailures.filter((f) => f !== null),\n\t\t...checkReachability(space),\n\t\t...checkDanglingRefs(space)\n\t];\n}\n/**\n* Policy core of the holistic `migration check`: validates `--space`,\n* narrows the pre-enumerated spaces, and runs the per-space explicit graph\n* checks (file-existence, snapshot consistency, reachability, dangling\n* refs), aggregating every failure into one {@link MigrationCheckResult}.\n*\n* `--space` validation mirrors `migration list`: an invalid id →\n* {@link errorInvalidSpaceId}; an id with no on-disk space →\n* {@link errorSpaceNotFound}. Both map to exit `PRECONDITION` at the shell.\n* Aggregate-integrity violations (which already span every space) are folded\n* in by the caller, not here.\n*/\nasync function runMigrationCheck(inputs) {\n\tconst { spaces, spaceFilter } = inputs;\n\tif (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return notOk(errorInvalidSpaceId(spaceFilter));\n\tif (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()));\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;\n\tconst failures = (await Promise.all(scopedSpaces.map(checkSpace))).flat();\n\tif (failures.length === 0) return ok({\n\t\tok: true,\n\t\tfailures: [],\n\t\tsummary: \"All checks passed\"\n\t});\n\treturn ok({\n\t\tok: false,\n\t\tfailures,\n\t\tsummary: `${failures.length} integrity failure(s)`\n\t});\n}\nasync function loadAggregateIntegrityViolations(config, migrationsDir) {\n\ttry {\n\t\tconst contractJsonContent = await readFile(resolveContractPath(config), \"utf-8\");\n\t\tconst familyInstance = config.family.create(createControlStack(config));\n\t\tconst declaredExtensions = toDeclaredExtensionsFromRaw(config.extensions ?? []);\n\t\tconst parsedAppContract = JSON.parse(contractJsonContent);\n\t\treturn (await loadContractSpaceAggregate({\n\t\t\tmigrationsDir,\n\t\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json),\n\t\t\tappContract: familyInstance.deserializeContract(parsedAppContract)\n\t\t})).checkIntegrity({\n\t\t\tdeclaredExtensions,\n\t\t\tcheckContracts: true\n\t\t});\n\t} catch {\n\t\treturn [];\n\t}\n}\nasync function executeMigrationCheckCommand(target, options, flags, ui) {\n\tconst config = await loadConfig(options.config);\n\tconst { configPath, migrationsDir, appMigrationsDir, appMigrationsRelative } = resolveMigrationPaths(options.config, config);\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: configPath\n\t\t}, {\n\t\t\tlabel: \"migrations\",\n\t\t\tvalue: appMigrationsRelative\n\t\t}];\n\t\tif (target) details.push({\n\t\t\tlabel: \"target\",\n\t\t\tvalue: target\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migration check\",\n\t\t\tdescription: \"Verify artifact and graph integrity\",\n\t\t\tdetails,\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t}\n\tconst loadedAggregate = await buildReadAggregate(config, { migrationsDir });\n\tif (!loadedAggregate.ok) return {\n\t\terror: loadedAggregate.failure,\n\t\texitCode: 2\n\t};\n\tconst spaces = await enumerateCheckSpaces(loadedAggregate.value.aggregate, migrationsDir);\n\tif (target) return await checkSingleTarget(target, {\n\t\tspaces,\n\t\t...options.space !== void 0 ? { spaceFilter: options.space } : {},\n\t\tappMigrationsDir,\n\t\tappMigrationsRelative\n\t});\n\tconst checkResult = await runMigrationCheck({\n\t\tspaces,\n\t\t...options.space !== void 0 ? { spaceFilter: options.space } : {}\n\t});\n\tif (!checkResult.ok) return {\n\t\terror: checkResult.failure,\n\t\texitCode: 2\n\t};\n\tconst failures = [...checkResult.value.failures];\n\tconst allViolations = await loadAggregateIntegrityViolations(config, migrationsDir);\n\tconst scopedViolations = options.space === void 0 ? allViolations : allViolations.filter((v) => v.kind !== \"disjointness\" && v.spaceId === options.space);\n\tfor (const violation of scopedViolations) failures.push(integrityViolationToCheckFailure(violation, migrationsDir));\n\tif (failures.length === 0) return {\n\t\tresult: {\n\t\t\tok: true,\n\t\t\tfailures: [],\n\t\t\tsummary: \"All checks passed\"\n\t\t},\n\t\texitCode: 0\n\t};\n\treturn {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures,\n\t\t\tsummary: `${failures.length} integrity failure(s)`\n\t\t},\n\t\texitCode: 4\n\t};\n}\n/**\n* Ranks ref-resolution failure kinds by how informative they are, so a\n* single-target check surfaces the most useful failure across spaces instead of\n* whichever space failed first. `not-found` (the input matched nothing here)\n* says the least; a malformed input, a wrong grammar, or an in-space ambiguity\n* all say more.\n*/\nfunction refFailureSpecificity(error) {\n\tswitch (error.kind) {\n\t\tcase \"wrong-grammar\": return 3;\n\t\tcase \"ambiguous\": return 2;\n\t\tcase \"invalid-format\": return 1;\n\t\tcase \"not-found\": return 0;\n\t}\n}\n/**\n* Single-target (`check <ref/path>`) mode — resolves a migration reference\n* across all contract spaces (or the one space narrowed by `--space <id>`).\n*\n* Resolution:\n* - filesystem path → find the owning space by checking which space's\n* `migrationsDir` contains the resolved path; falls back to app-relative\n* validation when the path is outside every space dir.\n* - ref → `parseMigrationRef` against each in-scope space; collect every\n* (space, package) hit; 0 hits = not-found, 1 = check it, >1 = ambiguity\n* error (qualify with `--space`).\n*\n* `--space <id>` is validated the same way the holistic path does it:\n* invalid id → `errorInvalidSpaceId`; no on-disk space → `errorSpaceNotFound`.\n*/\nasync function checkSingleTarget(target, inputs) {\n\tconst { spaces, spaceFilter, appMigrationsDir, appMigrationsRelative } = inputs;\n\tif (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return {\n\t\terror: errorInvalidSpaceId(spaceFilter),\n\t\texitCode: 2\n\t};\n\tif (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return {\n\t\terror: errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()),\n\t\texitCode: 2\n\t};\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;\n\tlet matchedSpace;\n\tlet matchedPkg;\n\tif (looksLikePath(target)) {\n\t\tconst resolvedPath = resolveTargetPathAcrossSpaces(target, scopedSpaces);\n\t\tif (resolvedPath !== null) for (const space of scopedSpaces) {\n\t\t\tconst found = findPackageByDirPath(space.packages, resolvedPath);\n\t\t\tif (found) {\n\t\t\t\tmatchedSpace = space;\n\t\t\t\tmatchedPkg = found;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tconst resolved = resolveAppTargetPath(target, appMigrationsDir, appMigrationsRelative);\n\t\t\tif (!resolved.ok) return {\n\t\t\t\terror: resolved.failure,\n\t\t\t\texitCode: 2\n\t\t\t};\n\t\t\tconst appSpace = scopedSpaces.find((s) => s.spaceId === \"app\");\n\t\t\tif (appSpace) {\n\t\t\t\tmatchedSpace = appSpace;\n\t\t\t\tmatchedPkg = findPackageByDirPath(appSpace.packages, resolved.value);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconst hits = [];\n\t\tlet bestParseFailure;\n\t\tfor (const space of scopedSpaces) {\n\t\t\tconst migResult = parseMigrationRef(target, {\n\t\t\t\tgraph: space.graph,\n\t\t\t\trefs: space.refs\n\t\t\t});\n\t\t\tif (!migResult.ok) {\n\t\t\t\tif (bestParseFailure === void 0 || refFailureSpecificity(migResult.failure) > refFailureSpecificity(bestParseFailure)) bestParseFailure = migResult.failure;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst pkg = space.packages.find((p) => p.metadata.migrationHash === migResult.value.migrationHash);\n\t\t\tif (pkg) hits.push({\n\t\t\t\tspace,\n\t\t\t\tpkg\n\t\t\t});\n\t\t}\n\t\tif (hits.length > 1) return {\n\t\t\terror: errorAmbiguousMigrationRef(target, hits.map((h) => h.space.spaceId)),\n\t\t\texitCode: 2\n\t\t};\n\t\tif (hits.length === 1) {\n\t\t\tmatchedSpace = hits[0].space;\n\t\t\tmatchedPkg = hits[0].pkg;\n\t\t} else if (bestParseFailure !== void 0) return {\n\t\t\terror: mapRefResolutionError(bestParseFailure),\n\t\t\texitCode: 2\n\t\t};\n\t}\n\tif (!matchedPkg || !matchedSpace) return {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures: [],\n\t\t\tsummary: `Migration package for \"${target}\" not found on disk`\n\t\t},\n\t\texitCode: 2\n\t};\n\tconst failures = [...checkManifestFilesPresent(matchedSpace)];\n\tfor (const f of [\"migration.json\", \"ops.json\"]) {\n\t\tconst fail = checkFileExists(matchedSpace.spaceId, matchedPkg.dirPath, matchedPkg.dirName, f);\n\t\tif (fail) failures.push(fail);\n\t}\n\tconst verification = verifyMigrationHash(matchedPkg);\n\tif (!verification.ok) failures.push({\n\t\tspace: matchedSpace.spaceId,\n\t\tcode: \"MIGRATION.CHECK_HASH_MISMATCH\",\n\t\twhere: migrationFileRelative(matchedPkg.dirPath, \"migration.json\"),\n\t\twhy: `Stored hash ${verification.storedHash} does not match recomputed hash ${verification.computedHash}`,\n\t\tfix: \"Re-emit the migration package or restore from version control.\"\n\t});\n\tconst snapshotFailure = await checkSnapshotConsistency(matchedSpace.spaceId, matchedPkg, matchedSpace.projectMigrationsDir);\n\tif (snapshotFailure) failures.push(snapshotFailure);\n\tconst resolvedSpaceId = matchedSpace.spaceId !== \"app\" ? matchedSpace.spaceId : void 0;\n\tif (failures.length === 0) return {\n\t\tresult: {\n\t\t\tok: true,\n\t\t\tfailures: [],\n\t\t\tsummary: \"All checks passed\"\n\t\t},\n\t\texitCode: 0,\n\t\t...ifDefined(\"resolvedSpaceId\", resolvedSpaceId)\n\t};\n\treturn {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures,\n\t\t\tsummary: `${failures.length} integrity failure(s)`\n\t\t},\n\t\texitCode: 4,\n\t\t...ifDefined(\"resolvedSpaceId\", resolvedSpaceId)\n\t};\n}\nfunction createMigrationCheckCommand() {\n\tconst command = new Command(\"check\");\n\tsetCommandDescriptions(command, \"Verify artifact and graph integrity\", \"Validates that on-disk migration packages are internally consistent\\n(hashes match, manifests are complete) and that the graph is well-formed\\n(edges connect, refs point at valid nodes). The whole-graph check spans\\nevery contract space by default; pass --space <id> to narrow to one. A\\nmigration reference checks a single package, resolved across all contract\\nspaces (narrow with --space; an ambiguous reference is a precondition failure).\\nOffline — does not consult the database.\\nExit codes: 0 = all checks passed, 2 = precondition failed\\n(unresolved target or unknown --space), 4 = integrity failure(s) found.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration check\",\n\t\t\"prisma-next migration check --space app\",\n\t\t\"prisma-next migration check 20260101-add-users\",\n\t\t\"prisma-next migration check 20260101-add-users --space app\",\n\t\t\"prisma-next migration check --json\"\n\t]);\n\tsetCommandSeeAlso(command, [\n\t\t{\n\t\t\tverb: \"migration status\",\n\t\t\toneLiner: \"Show migration path and pending status\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration list\",\n\t\t\toneLiner: \"List on-disk migrations\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration graph\",\n\t\t\toneLiner: \"Show the migration graph topology\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration show\",\n\t\t\toneLiner: \"Display migration package contents\"\n\t\t}\n\t]);\n\tcommand.exitOverride();\n\taddGlobalOptions(command).argument(\"[target]\", \"Migration reference: directory name, hash/prefix, ref, or path\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--space <id>\", \"Narrow output to a single contract space\").action(async (target, options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tlet outcome;\n\t\ttry {\n\t\t\toutcome = await executeMigrationCheckCommand(target, options, flags, ui);\n\t\t} catch (error) {\n\t\t\toutcome = {\n\t\t\t\tresult: {\n\t\t\t\t\tok: false,\n\t\t\t\t\tfailures: [],\n\t\t\t\t\tsummary: error instanceof Error ? error.message : String(error)\n\t\t\t\t},\n\t\t\t\texitCode: 2\n\t\t\t};\n\t\t}\n\t\tif (outcome.error) {\n\t\t\tconst envelope = outcome.error.toEnvelope();\n\t\t\tif (flags.json) ui.output(formatErrorJson(envelope));\n\t\t\telse if (!flags.quiet) ui.error(formatErrorOutput(envelope, flags));\n\t\t\tprocess.exit(outcome.exitCode);\n\t\t}\n\t\tconst result = outcome.result ?? {\n\t\t\tok: false,\n\t\t\tfailures: [],\n\t\t\tsummary: \"No check result produced\"\n\t\t};\n\t\tif (flags.json) ui.output(JSON.stringify(result, null, 2));\n\t\telse if (!flags.quiet) if (result.ok) {\n\t\t\tconst spaceSuffix = outcome.resolvedSpaceId !== void 0 ? ` (space: ${outcome.resolvedSpaceId})` : \"\";\n\t\t\tui.log(`✔ ${result.summary}${spaceSuffix}`);\n\t\t} else {\n\t\t\tfor (const f of result.failures) {\n\t\t\t\tui.log(`✗ [${f.code}] ${f.where}: ${f.why}`);\n\t\t\t\tui.log(` fix: ${f.fix}`);\n\t\t\t}\n\t\t\tui.log(`\\n${result.summary}`);\n\t\t}\n\t\tprocess.exit(outcome.exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { enumerateCheckSpaces as n, runMigrationCheck as r, createMigrationCheckCommand as t };\n\n//# sourceMappingURL=migration-check-CcG-fB8r.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,SAAS,wBAAwB,SAAS;CACzC,OAAO,SAAS,QAAQ,IAAI,GAAG,OAAO;AACvC;AACA,SAAS,wBAAwB,SAAS,UAAU;CACnD,OAAO,KAAK,wBAAwB,OAAO,GAAG,QAAQ;AACvD;;;;;AAKA,SAAS,iCAAiC,WAAW,eAAe;CACnE,MAAM,iBAAiB,YAAY,wBAAwB,KAAK,eAAe,OAAO,CAAC;CACvF,MAAM,mBAAmB,SAAS,YAAY,wBAAwB,KAAK,eAAe,SAAS,OAAO,CAAC;CAC3G,MAAM,eAAe,SAAS,YAAY,wBAAwB,KAAK,eAAe,SAAS,QAAQ,GAAG,QAAQ,MAAM,CAAC;CACzH,QAAQ,UAAU,MAAlB;EACC,KAAK,gBAAgB,OAAO;GAC3B,OAAO,UAAU;GACjB,MAAM;GACN,OAAO,wBAAwB,KAAK,eAAe,UAAU,SAAS,UAAU,OAAO,GAAG,gBAAgB;GAC1G,KAAK,eAAe,UAAU,OAAO,kCAAkC,UAAU;GACjF,KAAK;EACN;EACA,KAAK,8BAA8B,OAAO;GACzC,OAAO,UAAU;GACjB,MAAM;GACN,OAAO,gBAAgB,UAAU,SAAS,UAAU,OAAO;GAC3D,KAAK,cAAc,UAAU,QAAQ;GACrC,KAAK;EACN;EACA,KAAK,qBAAqB,OAAO;GAChC,OAAO,UAAU;GACjB,MAAM;GACN,OAAO,gBAAgB,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AAE,KAAK;GACzB;GACA,GAAG,IAAI,KAAK,OAAO,SAAS;EAC7B;EACA,QAAQ,KAAK,QAAQ,QAAQ;CAC9B,CAAC;CACD,OAAO;AACR"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"migration-status-CFlzlRmu-DewBN8Ys.mjs","names":["CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-status-CFlzlRmu.mjs"],"sourcesContent":["import { A as formatStyledHeader, F as CliStructuredError, _ as createTerminalUI, a as readContractEnvelope, ct as errorUnexpected, d as setCommandSeeAlso, dt as requireLiveDatabase, g as parseGlobalFlagsOrExit, i as maskConnectionUrl, l as setCommandDescriptions, lt as mapMigrationToolsError, n as collectDeclaredInvariants, p as toStructuralEdge, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, ut as mapRefResolutionError, y as handleResult } from \"./command-helpers-CAoXqAY9.mjs\";\nimport { n as buildReadAggregate, o as refusePackageCorruptionOnAggregate, r as loadContractRawSafely } from \"./contract-space-aggregate-loader-CFH-336b.mjs\";\nimport { t as createControlClient } from \"./client-75qrAPqf.mjs\";\nimport { a as renderMigrationGraphLegend, f as indentMigrationGraphTreeBlock, l as computeGlobalMaxDirNameWidth, p as renderMigrationGraphSpaceTree, u as computeGlobalMaxEdgeTreePrefixWidth } from \"./migration-graph-command-render-BKrg6BPv.mjs\";\nimport { c as validateLegendOptions, i as migrationSpaceListEntriesFromAggregate, o as runMigrationList, r as listRefsByContractHash, s as shouldShowLegend } from \"./migration-list-BFBeo1_X.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { dim, yellow } from \"colorette\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { MigrationToolsError, errorNoInvariantPath, errorUnknownInvariant } from \"@internal/migration-tools/errors\";\nimport { findPath, findPathWithDecision } from \"@internal/migration-tools/migration-graph\";\nimport { readRefs } from \"@internal/migration-tools/refs\";\nimport { parseContractRef } from \"@internal/migration-tools/ref-resolution\";\n//#region src/commands/migration-status-overlay.ts\nfunction deriveStatusEdgeAnnotations(input) {\n\tconst annotations = /* @__PURE__ */ new Map();\n\tif (input.showAppliedOverlay) {\n\t\tfor (const edge of input.graph.migrationByHash.values()) if (input.appliedMigrationHashes.has(edge.migrationHash)) annotations.set(edge.migrationHash, { status: \"applied\" });\n\t}\n\tif (!input.graph.nodes.has(input.originHash)) return annotations;\n\tconst pendingPath = findPath(input.graph, input.originHash, input.targetHash);\n\tif (!pendingPath) return annotations;\n\tfor (const edge of pendingPath) {\n\t\tif (input.appliedMigrationHashes.has(edge.migrationHash)) continue;\n\t\tif (annotations.get(edge.migrationHash)?.status === \"applied\") continue;\n\t\tannotations.set(edge.migrationHash, { status: \"pending\" });\n\t}\n\treturn annotations;\n}\nfunction appliedHashesFromLedger(ledgerEntries) {\n\treturn new Set(ledgerEntries.map((entry) => entry.migrationHash));\n}\nfunction statusForMigrationHash(migrationHash, annotations) {\n\treturn annotations.get(migrationHash)?.status ?? null;\n}\n//#endregion\n//#region src/commands/migration-status.ts\nfunction shortDisplayHash(hash) {\n\treturn hash.slice(0, 12);\n}\nfunction resolveTarget(contractHash, activeRefHash) {\n\treturn activeRefHash ?? contractHash;\n}\nfunction buildStatusMigrations(listMigrations, annotations) {\n\treturn listMigrations.map((migration) => ({\n\t\t...migration,\n\t\tstatus: statusForMigrationHash(migration.hash, annotations)\n\t}));\n}\nfunction renderSpaceTree(args) {\n\tconst graph = args.space.graph();\n\tif (graph.nodes.size === 0) return \"\";\n\treturn renderMigrationGraphSpaceTree({\n\t\tgraph,\n\t\tmigrations: args.migrations,\n\t\tliveContractHash: args.liveContractHash,\n\t\trefsByHash: listRefsByContractHash(args.space),\n\t\tstatusOverlayByHash: args.statusOverlay,\n\t\tcolorize: args.colorize,\n\t\tglyphMode: args.glyphMode,\n\t\tisAppSpace: args.isAppSpace,\n\t\t...args.showDbMarker && args.markerHash !== void 0 ? { dbHash: args.markerHash } : {},\n\t\t...args.globalMaxEdgeTreePrefixWidth !== void 0 ? { globalMaxEdgeTreePrefixWidth: args.globalMaxEdgeTreePrefixWidth } : {},\n\t\t...args.globalMaxDirNameWidth !== void 0 ? { globalMaxDirNameWidth: args.globalMaxDirNameWidth } : {}\n\t});\n}\nfunction countPending(migrations) {\n\treturn migrations.filter((m) => m.status === \"pending\").length;\n}\nfunction buildNoPathSummary(args) {\n\tconst markerPart = args.markerHash !== void 0 ? `the database state (${shortDisplayHash(args.markerHash)})` : \"the database state\";\n\tconst targetShort = shortDisplayHash(args.targetHash);\n\tif (!args.explicitTarget) return `No migration path from ${markerPart} to the application's contract (${targetShort}). Run \\`prisma-next migration plan --name <name>\\` to author one.`;\n\treturn `No migration path from ${markerPart} to ${args.refName !== void 0 ? `the target (${targetShort} via \\`${args.refName}\\`)` : `the target (${targetShort})`}. Run \\`prisma-next migration plan --name <name>\\` to author one, or pass \\`--to <contract>\\` to pick a reachable target.`;\n}\nfunction buildStatusHeadline(args) {\n\tif (args.markerDiverged && args.markerHash !== void 0) return `Database marker ${shortDisplayHash(args.markerHash)} is not in the on-disk migration graph`;\n\tif (args.pendingCount === 0) return \"Up to date\";\n\treturn `${args.pendingCount} pending — run \\`prisma-next migrate --to ${shortDisplayHash(args.targetHash)}\\``;\n}\nfunction formatStatusSummary(result, colorize) {\n\tconst c = (fn, s) => colorize ? fn(s) : s;\n\tconst lines = [];\n\tconst pendingTotal = result.spaces.reduce((sum, space) => sum + countPending(space.migrations), 0);\n\tif (result.diagnostics.some((d) => d.code === \"MIGRATION.MARKER_NOT_IN_HISTORY\") || pendingTotal > 0) lines.push(c(yellow, result.summary));\n\telse lines.push(result.summary);\n\tconst missingInvariantsDiagnostic = result.diagnostics.find((d) => d.code === \"MIGRATION.MISSING_INVARIANTS\");\n\tif (missingInvariantsDiagnostic !== void 0) lines.push(c(dim, missingInvariantsDiagnostic.message));\n\treturn lines.join(\"\\n\");\n}\nfunction formatStatusHumanOutput(result, colorize) {\n\tconst sections = [];\n\tfor (const section of result.treeSections) {\n\t\tif (section.showHeading) sections.push(`${section.space}:`);\n\t\tif (section.tree.length > 0) sections.push(section.tree);\n\t\telse sections.push(\"(no migrations)\");\n\t\tsections.push(\"\");\n\t}\n\tsections.push(formatStatusSummary(result, colorize));\n\treturn sections.join(\"\\n\").trimEnd();\n}\nasync function readMarkersAndLedgers(args) {\n\tconst markersBySpace = /* @__PURE__ */ new Map();\n\tconst all = await args.client.readAllMarkers();\n\tfor (const [spaceId, marker] of all) markersBySpace.set(spaceId, marker);\n\tconst ledgersBySpace = /* @__PURE__ */ new Map();\n\tfor (const spaceId of args.spaceIds) ledgersBySpace.set(spaceId, await args.client.readLedger(spaceId));\n\treturn {\n\t\tmarkersBySpace,\n\t\tledgersBySpace\n\t};\n}\nasync function executeMigrationStatusCommand(options, flags, ui) {\n\tconst config = await loadConfig(options.config);\n\tconst { configPath, migrationsDir, migrationsRelative, refsDir } = resolveMigrationPaths(options.config, config);\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tconst hasDriver = !!config.driver;\n\tconst usingFromOverride = options.from !== void 0;\n\tif (!usingFromOverride) {\n\t\tconst missingDb = requireLiveDatabase({\n\t\t\tdbConnection,\n\t\t\thasDriver,\n\t\t\twhy: \"migration status needs a database connection to read the marker and ledger (or pass --from for offline path preview)\",\n\t\t\tretryCommand: \"prisma-next migration status --from <contract>\"\n\t\t});\n\t\tif (missingDb) return notOk(missingDb);\n\t}\n\tlet allRefs = {};\n\ttry {\n\t\tallRefs = await readRefs(refsDir);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));\n\t\tthrow error;\n\t}\n\tconst diagnostics = [];\n\tlet contractHash = EMPTY_CONTRACT_HASH;\n\ttry {\n\t\tcontractHash = (await readContractEnvelope(config)).storageHash;\n\t} catch (error) {\n\t\tdiagnostics.push({\n\t\t\tcode: \"CONTRACT.UNREADABLE\",\n\t\t\tseverity: \"warn\",\n\t\t\tmessage: `Could not read contract: ${error instanceof Error ? error.message : \"unknown error\"}`,\n\t\t\thints: [\"Run 'prisma-next contract emit' to generate a valid contract\"]\n\t\t});\n\t}\n\tconst loaded = await buildReadAggregate(config, { migrationsDir });\n\tif (!loaded.ok) return notOk(loaded.failure);\n\tconst { aggregate } = loaded.value;\n\tif (await loadContractRawSafely(config) !== null) {\n\t\tconst corruptionFailure = refusePackageCorruptionOnAggregate(aggregate);\n\t\tif (corruptionFailure) return notOk(corruptionFailure);\n\t}\n\tconst appGraph = aggregate.app.graph();\n\tlet activeRefHash;\n\tlet activeRefName;\n\tlet activeRefEntry;\n\tlet fromOverrideHash;\n\tif (options.to) {\n\t\tconst refResult = parseContractRef(options.to, {\n\t\t\tgraph: appGraph,\n\t\t\trefs: allRefs\n\t\t});\n\t\tif (!refResult.ok) return notOk(mapRefResolutionError(refResult.failure));\n\t\tactiveRefHash = refResult.value.hash;\n\t\tif (refResult.value.provenance.kind === \"ref\") {\n\t\t\tactiveRefName = refResult.value.provenance.refName;\n\t\t\tactiveRefEntry = allRefs[activeRefName];\n\t\t}\n\t}\n\tif (options.from) {\n\t\tconst fromResult = parseContractRef(options.from, {\n\t\t\tgraph: appGraph,\n\t\t\trefs: allRefs\n\t\t});\n\t\tif (!fromResult.ok) return notOk(mapRefResolutionError(fromResult.failure));\n\t\tfromOverrideHash = fromResult.value.hash;\n\t}\n\tconst requiredInvariants = [...activeRefEntry?.invariants ?? []].sort();\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: configPath\n\t\t}, {\n\t\t\tlabel: \"migrations\",\n\t\t\tvalue: migrationsRelative\n\t\t}];\n\t\tif (dbConnection && hasDriver) details.push({\n\t\t\tlabel: \"database\",\n\t\t\tvalue: maskConnectionUrl(String(dbConnection))\n\t\t});\n\t\tif (activeRefName) details.push({\n\t\t\tlabel: \"ref\",\n\t\t\tvalue: activeRefName\n\t\t});\n\t\tif (options.from) details.push({\n\t\t\tlabel: \"from\",\n\t\t\tvalue: options.from\n\t\t});\n\t\tif (options.space) details.push({\n\t\t\tlabel: \"space\",\n\t\t\tvalue: options.space\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migration status\",\n\t\t\tdescription: \"Show migration history and applied status\",\n\t\t\tdetails,\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t\tif (shouldShowLegend(options, flags)) {\n\t\t\tui.stderr(renderMigrationGraphLegend({\n\t\t\t\tcolorize: flags.color !== false,\n\t\t\t\tglyphMode: ui.resolveGlyphMode(options.ascii === true)\n\t\t\t}));\n\t\t\tui.stderr(\"\");\n\t\t}\n\t}\n\tconst listResult = runMigrationList({\n\t\tspaces: await migrationSpaceListEntriesFromAggregate(aggregate, migrationsDir),\n\t\t...ifDefined(\"spaceFilter\", options.space)\n\t});\n\tif (!listResult.ok) return listResult;\n\tconst scopedSpaces = listResult.value.spaces;\n\tconst showSpaceHeadings = scopedSpaces.length > 1;\n\tlet markersBySpace = /* @__PURE__ */ new Map();\n\tlet ledgersBySpace = /* @__PURE__ */ new Map();\n\tlet connected = false;\n\tif (dbConnection && hasDriver && !usingFromOverride) {\n\t\tconst client = createControlClient({\n\t\t\tfamily: config.family,\n\t\t\ttarget: config.target,\n\t\t\tadapter: config.adapter,\n\t\t\tdriver: config.driver,\n\t\t\textensions: config.extensions ?? []\n\t\t});\n\t\ttry {\n\t\t\tawait client.connect(dbConnection);\n\t\t\tconnected = true;\n\t\t\tconst read = await readMarkersAndLedgers({\n\t\t\t\tclient,\n\t\t\t\tspaceIds: scopedSpaces.map((s) => s.space)\n\t\t\t});\n\t\t\tmarkersBySpace = new Map(read.markersBySpace);\n\t\t\tledgersBySpace = new Map(read.ledgersBySpace);\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read database state: ${error instanceof Error ? error.message : String(error)}` }));\n\t\t} finally {\n\t\t\tawait client.close();\n\t\t}\n\t}\n\tif (activeRefEntry && activeRefEntry.invariants.length > 0 && connected) {\n\t\tconst declared = collectDeclaredInvariants(appGraph);\n\t\tconst markerInvariants = markersBySpace.get(aggregate.app.spaceId)?.invariants ?? [];\n\t\tconst known = new Set(declared);\n\t\tfor (const id of markerInvariants) known.add(id);\n\t\tconst unknown = activeRefEntry.invariants.filter((id) => !known.has(id));\n\t\tif (unknown.length > 0) return notOk(mapMigrationToolsError(errorUnknownInvariant({\n\t\t\t...ifDefined(\"refName\", activeRefName),\n\t\t\tunknown,\n\t\t\tdeclared: [...declared].sort()\n\t\t})));\n\t}\n\tconst showAppliedOverlay = connected && !usingFromOverride;\n\tconst showDbMarker = connected && !usingFromOverride;\n\tconst glyphMode = ui.resolveGlyphMode(options.ascii === true);\n\tconst colorize = flags.color !== false;\n\tconst statusSpaces = [];\n\tconst treeSections = [];\n\tlet markerDiverged = false;\n\tlet markerCannotReachTarget = false;\n\tlet headlineTargetHash = activeRefHash ?? contractHash;\n\tlet totalPending = 0;\n\tconst globalLayoutInputs = showSpaceHeadings ? scopedSpaces.filter((spaceEntry) => spaceEntry.migrations.length > 0).map((spaceEntry) => ({\n\t\tgraph: aggregate.space(spaceEntry.space).graph(),\n\t\tliveContractHash: contractHash\n\t})) : [];\n\tconst globalMaxEdgeTreePrefixWidth = globalLayoutInputs.length > 0 ? computeGlobalMaxEdgeTreePrefixWidth(globalLayoutInputs) : void 0;\n\tconst globalMaxDirNameWidth = globalLayoutInputs.length > 0 ? computeGlobalMaxDirNameWidth(globalLayoutInputs) : void 0;\n\tfor (const spaceEntry of scopedSpaces) {\n\t\tconst space = aggregate.space(spaceEntry.space);\n\t\tif (space === void 0) continue;\n\t\tconst graph = space.graph();\n\t\tconst spaceContractHash = space.contract().storage.storageHash;\n\t\tconst targetHash = resolveTarget(spaceContractHash, activeRefHash);\n\t\tif (spaceEntry.space === aggregate.app.spaceId) headlineTargetHash = targetHash;\n\t\tconst markerRecord = markersBySpace.get(spaceEntry.space);\n\t\tconst markerHash = usingFromOverride ? fromOverrideHash : markerRecord?.storageHash ?? void 0;\n\t\tconst originHash = markerHash ?? EMPTY_CONTRACT_HASH;\n\t\tconst markerInGraph = markerHash === void 0 || graph.nodes.has(markerHash) || markerHash === spaceContractHash;\n\t\tif (connected && !usingFromOverride && markerInGraph && originHash !== targetHash && findPath(graph, originHash, targetHash) === null) markerCannotReachTarget = true;\n\t\tif (connected && !usingFromOverride && markerHash !== void 0 && !markerInGraph) {\n\t\t\tmarkerDiverged = true;\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"MIGRATION.MARKER_NOT_IN_HISTORY\",\n\t\t\t\tseverity: \"warn\",\n\t\t\t\tmessage: \"Database was updated outside the migration system (marker does not match any migration)\",\n\t\t\t\thints: [\"Run 'prisma-next db sign' to overwrite the marker if the database already matches the contract\", \"Run 'prisma-next db update' to push the current contract to the database\"]\n\t\t\t});\n\t\t}\n\t\tconst ledger = ledgersBySpace.get(spaceEntry.space) ?? [];\n\t\tconst annotations = deriveStatusEdgeAnnotations({\n\t\t\tgraph,\n\t\t\ttargetHash,\n\t\t\toriginHash,\n\t\t\tappliedMigrationHashes: showAppliedOverlay ? appliedHashesFromLedger(ledger) : /* @__PURE__ */ new Set(),\n\t\t\tshowAppliedOverlay\n\t\t});\n\t\tconst isAppSpace = spaceEntry.space === aggregate.app.spaceId;\n\t\tconst tree = renderSpaceTree({\n\t\t\tspace,\n\t\t\tliveContractHash: contractHash,\n\t\t\tmigrations: spaceEntry.migrations,\n\t\t\tmarkerHash,\n\t\t\tshowDbMarker,\n\t\t\tstatusOverlay: annotations,\n\t\t\tcolorize,\n\t\t\tglyphMode,\n\t\t\tisAppSpace,\n\t\t\t...globalMaxEdgeTreePrefixWidth !== void 0 ? { globalMaxEdgeTreePrefixWidth } : {},\n\t\t\t...globalMaxDirNameWidth !== void 0 ? { globalMaxDirNameWidth } : {}\n\t\t});\n\t\tconst migrations = buildStatusMigrations(spaceEntry.migrations, annotations);\n\t\tconst pending = countPending(migrations);\n\t\ttotalPending += pending;\n\t\tstatusSpaces.push({\n\t\t\tspace: spaceEntry.space,\n\t\t\tcurrentContract: markerHash ?? null,\n\t\t\ttargetContract: targetHash,\n\t\t\tmigrations: [...migrations]\n\t\t});\n\t\tconst displayTree = showSpaceHeadings && tree.length > 0 ? indentMigrationGraphTreeBlock(tree, \" \") : tree;\n\t\ttreeSections.push({\n\t\t\tspace: spaceEntry.space,\n\t\t\ttree: displayTree,\n\t\t\tshowHeading: showSpaceHeadings\n\t\t});\n\t}\n\tif (connected && requiredInvariants.length > 0) {\n\t\tconst markerInvariants = markersBySpace.get(aggregate.app.spaceId)?.invariants ?? [];\n\t\tconst markerSet = new Set(markerInvariants);\n\t\tconst missing = requiredInvariants.filter((id) => !markerSet.has(id));\n\t\tif (missing.length > 0) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"MIGRATION.MISSING_INVARIANTS\",\n\t\t\t\t...ifDefined(\"ref\", activeRefName),\n\t\t\t\tinvariants: missing,\n\t\t\t\tmessage: `missing invariant(s): ${missing.join(\", \")}`\n\t\t\t});\n\t\t\tif (activeRefHash !== void 0) {\n\t\t\t\tconst outcome = findPathWithDecision(appGraph, markersBySpace.get(aggregate.app.spaceId)?.storageHash ?? EMPTY_CONTRACT_HASH, activeRefHash, {\n\t\t\t\t\t...ifDefined(\"refName\", activeRefName),\n\t\t\t\t\trequired: new Set(missing)\n\t\t\t\t});\n\t\t\t\tif (outcome.kind === \"unsatisfiable\") return notOk(mapMigrationToolsError(errorNoInvariantPath({\n\t\t\t\t\t...ifDefined(\"refName\", activeRefName),\n\t\t\t\t\trequired: [...missing].sort(),\n\t\t\t\t\tmissing: outcome.missing,\n\t\t\t\t\tstructuralPath: outcome.structuralPath.map(toStructuralEdge)\n\t\t\t\t})));\n\t\t\t}\n\t\t}\n\t}\n\tconst appMarkerHash = markersBySpace.get(aggregate.app.spaceId)?.storageHash;\n\tconst summary = markerCannotReachTarget ? buildNoPathSummary({\n\t\tmarkerHash: appMarkerHash,\n\t\ttargetHash: headlineTargetHash,\n\t\texplicitTarget: options.to !== void 0,\n\t\trefName: activeRefName\n\t}) : buildStatusHeadline({\n\t\tpendingCount: totalPending,\n\t\ttargetHash: headlineTargetHash,\n\t\tmarkerDiverged,\n\t\tmarkerHash: appMarkerHash\n\t});\n\tif (scopedSpaces.every((s) => s.migrations.length === 0)) return ok({\n\t\tok: true,\n\t\tspaces: statusSpaces,\n\t\tsummary: \"No migrations found\",\n\t\tdiagnostics,\n\t\ttreeSections\n\t});\n\treturn ok({\n\t\tok: true,\n\t\tspaces: statusSpaces,\n\t\tsummary,\n\t\tdiagnostics,\n\t\ttreeSections\n\t});\n}\nfunction createMigrationStatusCommand() {\n\tconst command = new Command(\"status\");\n\tsetCommandDescriptions(command, \"Show migration path and pending status\", \"Shows which migrations are pending between the database marker and\\nthe target contract. Requires a database connection.\\nPass --from for an offline path preview without a database.\\nUse `migration graph` for topology, `migration log` for history,\\nand `migration list` for on-disk enumeration.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration status --db $DATABASE_URL\",\n\t\t\"prisma-next migration status --to production --db $DATABASE_URL\",\n\t\t\"prisma-next migration status --from abc123 --to production\",\n\t\t\"prisma-next migration status --from abc123 --to production --json\",\n\t\t\"prisma-next migration status --ascii --from abc123 --to production\",\n\t\t\"prisma-next migration status --legend --from abc123 --to production\"\n\t]);\n\tsetCommandSeeAlso(command, [\n\t\t{\n\t\t\tverb: \"migration log\",\n\t\t\toneLiner: \"Show executed migration history\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration list\",\n\t\t\toneLiner: \"List on-disk migrations\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration graph\",\n\t\t\toneLiner: \"Show the migration graph topology\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration show\",\n\t\t\toneLiner: \"Display migration package contents\"\n\t\t}\n\t]);\n\taddGlobalOptions(command).option(\"--db <url>\", \"Database connection string\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--space <id>\", \"Narrow output to a single contract space\").option(\"--to <contract>\", \"Target contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)\").option(\"--from <contract>\", \"Origin contract reference; same grammar as --to. Supplying --from switches to offline path computation.\").option(\"--legend\", \"Print a key for the tree glyphs and lane colors\").option(\"--ascii\", \"Use ASCII glyphs (pipe-friendly)\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst legendValidation = validateLegendOptions(options, flags);\n\t\tif (!legendValidation.ok) process.exit(handleResult(legendValidation, flags, ui));\n\t\tconst exitCode = handleResult(await executeMigrationStatusCommand(options, flags, ui), flags, ui, (statusResult) => {\n\t\t\tif (flags.json) {\n\t\t\t\tconst jsonResult = {\n\t\t\t\t\tok: true,\n\t\t\t\t\tspaces: [...statusResult.spaces],\n\t\t\t\t\tsummary: statusResult.summary,\n\t\t\t\t\tdiagnostics: [...statusResult.diagnostics]\n\t\t\t\t};\n\t\t\t\tui.output(JSON.stringify(jsonResult, null, 2));\n\t\t\t} else if (!flags.quiet) ui.output(formatStatusHumanOutput(statusResult, flags.color !== false));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { formatStatusHumanOutput as a, executeMigrationStatusCommand as i, buildStatusHeadline as n, formatStatusSummary as o, createMigrationStatusCommand as r, buildNoPathSummary as t };\n\n//# sourceMappingURL=migration-status-CFlzlRmu.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAgBA,SAAS,4BAA4B,OAAO;CAC3C,MAAM,8BAA8B,IAAI,IAAI;CAC5C,IAAI,MAAM,oBACJ;OAAA,MAAM,QAAQ,MAAM,MAAM,gBAAgB,OAAO,GAAG,IAAI,MAAM,uBAAuB,IAAI,KAAK,aAAa,GAAG,YAAY,IAAI,KAAK,eAAe,EA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