@prisma/orm-toolchain 0.17.0-dev.4 → 0.17.0-dev.5
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.
|
@@ -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.17.0-dev.
|
|
30
|
+
var version = "0.17.0-dev.5";
|
|
31
31
|
/**
|
|
32
32
|
* The resolver a scaffold for `target` is written against.
|
|
33
33
|
*
|
|
@@ -333,7 +333,7 @@ Exit codes (see CLI Style Guide § Exit Codes):
|
|
|
333
333
|
"prisma-next init --no-skill # skip the skills install (air-gapped / restricted env)"
|
|
334
334
|
]);
|
|
335
335
|
return addGlobalOptions(command).option("--target <db>", "Database target: postgres or mongodb").option("--authoring <style>", "Schema authoring style: psl or typescript").option("--schema-path <path>", `Where to write the starter schema (default: ${defaultSchemaPath("psl")})`).option("--force", "Overwrite an existing scaffold without prompting").option("--write-env", "Write a .env file from .env.example (gitignored; default: only .env.example)").option("--probe-db", "Connect to DATABASE_URL once and check the server version against the target minimum (opt-in; off by default)").option("--strict-probe", "Treat a failed --probe-db as fatal (no-op without --probe-db; init is offline-by-default)").option("--no-install", "Skip dependency installation and contract emission").option("--no-skill", "Skip Prisma Next skills install (air-gapped CI, restricted registries, etc.)").action(async (options) => {
|
|
336
|
-
const { runInit } = await import("./init-
|
|
336
|
+
const { runInit } = await import("./init-BGm77aWc-BuTXxJgQ.mjs");
|
|
337
337
|
const flags = parseGlobalFlagsOrExit(options);
|
|
338
338
|
const canPrompt = deriveCanPrompt({
|
|
339
339
|
flagsInteractive: flags.interactive,
|
|
@@ -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-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.17.0-dev.4\";\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,sBAAsB;EACnF,OAAO,WAAW,UAAU,qBAAqB,OAAO,IAAI,wBAAwB,OAAO;CAC5F;CACA,OAAO,WAAW,UAAU,sBAAsB,IAAI,yBAAyB;AAChF;;;;;;;;;;AAUA,SAAS,aAAa,QAAQ,WAAW,yBAAyB,wBAAwB;CACzF,IAAI,cAAc,cAAc;EAC/B,MAAM,UAAU,iBAAiB,QAAQ,oBAAoB,sBAAsB;EACnF,OAAO,WAAW,UAAU,oBAAoB,OAAO,IAAI,uBAAuB,OAAO;CAC1F;CACA,OAAO,WAAW,UAAU,qBAAqB,IAAI,wBAAwB;AAC9E;AACA,SAAS,0BAA0B;CAClC,OAAO;;;;;;;;AAQR;A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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
|
+
{"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.17.0-dev.5\";\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-BGm77aWc.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,QAA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AO,IAAI,QAAQ,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"}
|
|
@@ -7,14 +7,14 @@ import { basename, dirname, extname, isAbsolute, join, normalize } from "pathe";
|
|
|
7
7
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
8
8
|
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
9
9
|
import * as clack from "@clack/prompts";
|
|
10
|
-
import { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
|
|
10
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
|
|
11
11
|
import { docsUrlFor } from "@prisma/orm-framework/utils/structured-error";
|
|
12
12
|
import { keepInternalSpecifiers } from "@prisma/orm-framework/components/emission";
|
|
13
13
|
import { execFile } from "node:child_process";
|
|
14
14
|
import { promisify } from "node:util";
|
|
15
15
|
import { detect, getUserAgent } from "package-manager-detector/detect";
|
|
16
16
|
import { applyEdits, modify, parse, printParseErrorCode } from "jsonc-parser";
|
|
17
|
-
//#region ../../../1-framework/3-tooling/cli/dist/init-
|
|
17
|
+
//#region ../../../1-framework/3-tooling/cli/dist/init-BGm77aWc.mjs
|
|
18
18
|
const KNOWN = /* @__PURE__ */ new Set([
|
|
19
19
|
"pnpm",
|
|
20
20
|
"npm",
|
|
@@ -1113,18 +1113,21 @@ const DEFAULT_SKILL_BASE = "prisma/prisma";
|
|
|
1113
1113
|
const DEFAULT_SKILL_SOURCES = [
|
|
1114
1114
|
{
|
|
1115
1115
|
subpath: "skills",
|
|
1116
|
+
skill: "prisma-8",
|
|
1116
1117
|
ref: "cli",
|
|
1117
|
-
description: "usage
|
|
1118
|
+
description: "usage skill (version-locked to installed Prisma Next)"
|
|
1118
1119
|
},
|
|
1119
1120
|
{
|
|
1120
|
-
subpath: "skills
|
|
1121
|
+
subpath: "skills",
|
|
1122
|
+
skill: "prisma-next-upgrade",
|
|
1121
1123
|
ref: null,
|
|
1122
1124
|
description: "upgrade skill (always tracks `main`)"
|
|
1123
1125
|
},
|
|
1124
1126
|
{
|
|
1125
|
-
subpath: "skills
|
|
1127
|
+
subpath: "skills",
|
|
1128
|
+
skill: "prisma-8-extension-upgrade",
|
|
1126
1129
|
ref: null,
|
|
1127
|
-
description: "extension-author skill (always tracks `main`)"
|
|
1130
|
+
description: "extension-author upgrade skill (always tracks `main`)"
|
|
1128
1131
|
}
|
|
1129
1132
|
];
|
|
1130
1133
|
/**
|
|
@@ -1176,8 +1179,9 @@ function formatSkillSourceUrl(source) {
|
|
|
1176
1179
|
* rest of the install step so a single project consistently uses one
|
|
1177
1180
|
* runner.
|
|
1178
1181
|
*
|
|
1179
|
-
* `--agent` takes space-separated slugs on one flag;
|
|
1180
|
-
* skip the multi-select prompts a
|
|
1182
|
+
* `--agent` takes space-separated slugs on one flag; the explicit
|
|
1183
|
+
* `--skill <name>` and `-y` skip the multi-select prompts a
|
|
1184
|
+
* non-interactive scaffold step cannot show.
|
|
1181
1185
|
*
|
|
1182
1186
|
* Exported for unit tests so the per-PM dispatch can be asserted
|
|
1183
1187
|
* without a live subprocess.
|
|
@@ -1191,7 +1195,7 @@ function formatSkillInstallCommand(args) {
|
|
|
1191
1195
|
"--agent",
|
|
1192
1196
|
...agents,
|
|
1193
1197
|
"--skill",
|
|
1194
|
-
|
|
1198
|
+
args.source.skill,
|
|
1195
1199
|
"-y"
|
|
1196
1200
|
];
|
|
1197
1201
|
return formatPackageManagerCommand(args.pm, cliArgs);
|
|
@@ -1219,8 +1223,9 @@ function formatPackageManagerCommand(pm, args) {
|
|
|
1219
1223
|
* format-then-parse split keeps the user-facing command string the same
|
|
1220
1224
|
* as the surface the structured error advertises, so a user who copies
|
|
1221
1225
|
* the error's `fix` line gets the same invocation that init just
|
|
1222
|
-
* attempted. Single
|
|
1223
|
-
*
|
|
1226
|
+
* attempted. Single-quoted tokens are preserved in the display form so
|
|
1227
|
+
* shell-sensitive characters stay copy-safe, then stripped before
|
|
1228
|
+
* `execFile`.
|
|
1224
1229
|
*/
|
|
1225
1230
|
function commandToExec(command) {
|
|
1226
1231
|
const tokens = (command.match(/'[^']*'|\S+/g) ?? []).map((token) => token.startsWith("'") && token.endsWith("'") ? token.slice(1, -1) : token);
|
|
@@ -1279,11 +1284,50 @@ function redactSecrets$1(stderr) {
|
|
|
1279
1284
|
return stderr.replace(/([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)([^/@\s]+)@/g, "$1***@");
|
|
1280
1285
|
}
|
|
1281
1286
|
/**
|
|
1282
|
-
*
|
|
1283
|
-
*
|
|
1284
|
-
*
|
|
1287
|
+
* Skill directories that predate the consolidated `prisma-8` skill:
|
|
1288
|
+
* the per-workflow usage cluster (including the renamed
|
|
1289
|
+
* `prisma-8-migration-review` spelling it briefly shipped under), the
|
|
1290
|
+
* pre-rename spellings of the consolidated skill and the
|
|
1291
|
+
* extension-author upgrade skill, and any hand-rolled `prisma-next`
|
|
1292
|
+
* stub. Projects initialised before the consolidation carry these as
|
|
1293
|
+
* sibling directories in each agent's install root; left in place
|
|
1294
|
+
* they compete with the current skills for activation, so init
|
|
1295
|
+
* removes them on every run.
|
|
1296
|
+
*/
|
|
1297
|
+
const RETIRED_SKILL_NAMES = [
|
|
1298
|
+
"prisma-next",
|
|
1299
|
+
"prisma-next-quickstart",
|
|
1300
|
+
"prisma-next-contract",
|
|
1301
|
+
"prisma-next-migrations",
|
|
1302
|
+
"prisma-next-migration-review",
|
|
1303
|
+
"prisma-8-migration-review",
|
|
1304
|
+
"prisma-next-queries",
|
|
1305
|
+
"prisma-next-runtime",
|
|
1306
|
+
"prisma-next-build",
|
|
1307
|
+
"prisma-next-supabase",
|
|
1308
|
+
"prisma-next-debug",
|
|
1309
|
+
"prisma-next-feedback",
|
|
1310
|
+
"prisma-next-extension-upgrade"
|
|
1311
|
+
];
|
|
1312
|
+
/**
|
|
1313
|
+
* Project-level install roots the upstream `skills` CLI uses for the
|
|
1314
|
+
* agents in `DEFAULT_SKILL_AGENTS`: cursor and codex install into
|
|
1315
|
+
* `.agents/skills`, claude-code into `.claude/skills`, windsurf into
|
|
1316
|
+
* `.windsurf/skills`.
|
|
1317
|
+
*/
|
|
1318
|
+
const AGENT_SKILL_ROOTS = [
|
|
1319
|
+
".agents/skills",
|
|
1320
|
+
".claude/skills",
|
|
1321
|
+
".windsurf/skills"
|
|
1322
|
+
];
|
|
1323
|
+
/**
|
|
1324
|
+
* Every directory a retired per-workflow skill may occupy in a
|
|
1325
|
+
* consumer project. Init deletes each (recursively) before running the
|
|
1326
|
+
* skill install.
|
|
1285
1327
|
*/
|
|
1286
|
-
|
|
1328
|
+
function legacySkillDirs() {
|
|
1329
|
+
return AGENT_SKILL_ROOTS.flatMap((root) => RETIRED_SKILL_NAMES.map((name) => `${root}/${name}`));
|
|
1330
|
+
}
|
|
1287
1331
|
/**
|
|
1288
1332
|
* The minimum supported server version for each target. The
|
|
1289
1333
|
* authoritative source of truth is each target package's
|
|
@@ -1659,7 +1703,7 @@ async function runInit(baseDir, runOptions) {
|
|
|
1659
1703
|
}
|
|
1660
1704
|
];
|
|
1661
1705
|
const filesToDelete = inputs.reinit ? [...findStaleArtifacts(baseDir, schemaDir)] : [];
|
|
1662
|
-
|
|
1706
|
+
const legacyDirsToDelete = legacySkillDirs().filter((rel) => existsSync(join(baseDir, rel)));
|
|
1663
1707
|
if (inputs.writeEnv) if (!existsSync(join(baseDir, ".env"))) filesToWrite.push({
|
|
1664
1708
|
path: ".env",
|
|
1665
1709
|
content: envFileContent(inputs.target)
|
|
@@ -1765,6 +1809,13 @@ async function runInit(baseDir, runOptions) {
|
|
|
1765
1809
|
if (!(err instanceof Error && "code" in err && err.code === "ENOENT")) throw err;
|
|
1766
1810
|
}
|
|
1767
1811
|
}
|
|
1812
|
+
for (const rel of legacyDirsToDelete) {
|
|
1813
|
+
rmSync(join(baseDir, rel), {
|
|
1814
|
+
recursive: true,
|
|
1815
|
+
force: true
|
|
1816
|
+
});
|
|
1817
|
+
filesDeleted.push(rel);
|
|
1818
|
+
}
|
|
1768
1819
|
const emitCommand = formatRunCommand(pm, "prisma-next", "contract emit");
|
|
1769
1820
|
let install;
|
|
1770
1821
|
try {
|
|
@@ -2183,4 +2234,4 @@ function sanitisePackageName(raw) {
|
|
|
2183
2234
|
//#endregion
|
|
2184
2235
|
export { runInit };
|
|
2185
2236
|
|
|
2186
|
-
//# sourceMappingURL=init-
|
|
2237
|
+
//# sourceMappingURL=init-BGm77aWc-BuTXxJgQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-BGm77aWc-BuTXxJgQ.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/init-BGm77aWc.mjs"],"sourcesContent":["import { F as CliStructuredError$1, _ as createTerminalUI, b as formatErrorJson, x as formatErrorOutput } from \"./command-helpers-CAoXqAY9.mjs\";\nimport { a as schemaSample, c as targetLabel, i as scaffoldSpecifierResolverFor, l as targetPackageName, n as dbFile, o as starterSchema, r as defaultSchemaPath, s as targetEntrypoint, t as configFile, u as version } from \"./cli.mjs\";\nimport { i as renderInitOutro, n as buildNextSteps, r as formatInitJson, t as InitOutputSchema } from \"./output-DWNYqZGc.mjs\";\nimport { createRequire } from \"node:module\";\nimport { CliStructuredError } from \"@internal/errors/control\";\nimport { basename, dirname, extname, isAbsolute, join, normalize } from \"pathe\";\nimport { existsSync, mkdirSync, readFileSync, rmSync, unlinkSync, writeFileSync } from \"node:fs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport * as clack from \"@clack/prompts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { docsUrlFor } from \"@internal/utils/structured-error\";\nimport { keepInternalSpecifiers } from \"@internal/framework-components/emission\";\nimport { execFile } from \"node:child_process\";\nimport { promisify } from \"node:util\";\nimport { detect, getUserAgent } from \"package-manager-detector/detect\";\nimport { applyEdits, modify, parse, printParseErrorCode } from \"jsonc-parser\";\n//#region src/commands/init/detect-package-manager.ts\nconst KNOWN = /* @__PURE__ */ new Set([\n\t\"pnpm\",\n\t\"npm\",\n\t\"yarn\",\n\t\"bun\",\n\t\"deno\"\n]);\nfunction isPackageManager(name) {\n\treturn KNOWN.has(name);\n}\n/**\n* Resolves the package manager `init` should drive for `add` / `install`\n* commands. Tries, in order:\n*\n* 1. **`detect()`** — walks up from `cwd` looking for a lockfile, the\n* `packageManager` field, the `devEngines.packageManager` field, or\n* install metadata. This is the right answer whenever the user is\n* anywhere inside an existing project, including a deep workspace\n* subdirectory.\n*\n* 2. **`getUserAgent()`** — parses `npm_config_user_agent`, the env var\n* every PM sets when it spawns a script. This catches the\n* bare-directory case where there's no project to walk up to but the\n* user invoked us via `pnpm dlx prisma-next init` / `bunx\n* prisma-next init` / `yarn dlx …`. Same signal used by every\n* `create-*` tool in the ecosystem (`create-vite`, `create-next-app`,\n* `create-astro`, `@antfu/ni`, …).\n*\n* 3. **`npm`** — final fallback. Always present alongside Node.\n*/\nasync function detectPackageManager(cwd) {\n\tconst detected = await detect({ cwd });\n\tif (detected && isPackageManager(detected.name)) return detected.name;\n\tconst userAgent = getUserAgent();\n\tif (userAgent !== null && isPackageManager(userAgent)) return userAgent;\n\treturn \"npm\";\n}\nfunction hasProjectManifest(cwd) {\n\treturn existsSync(join(cwd, \"package.json\")) || existsSync(join(cwd, \"deno.json\")) || existsSync(join(cwd, \"deno.jsonc\"));\n}\nfunction formatRunCommand(pm, bin, args) {\n\tif (pm === \"npm\") return `npx ${bin} ${args}`;\n\tif (pm === \"deno\") return `deno run npm:${bin} ${args}`;\n\treturn `${pm} ${bin} ${args}`;\n}\nfunction formatRunScriptCommand(pm, scriptName) {\n\tswitch (pm) {\n\t\tcase \"deno\": return `deno task ${scriptName}`;\n\t\tcase \"bun\": return `bun run ${scriptName}`;\n\t\tcase \"pnpm\": return `pnpm run ${scriptName}`;\n\t\tcase \"yarn\": return `yarn run ${scriptName}`;\n\t\tdefault: return `npm run ${scriptName}`;\n\t}\n}\nfunction formatAddArgs(pm, packages) {\n\tif (pm === \"deno\") return [\"add\", ...packages.map((p) => `npm:${p}`)];\n\treturn [\"add\", ...packages];\n}\nfunction formatAddDevArgs(pm, packages) {\n\tif (pm === \"deno\") return [\n\t\t\"add\",\n\t\t\"--dev\",\n\t\t...packages.map((p) => `npm:${p}`)\n\t];\n\treturn [\n\t\t\"add\",\n\t\t\"-D\",\n\t\t...packages\n\t];\n}\n//#endregion\n//#region src/commands/init/detect-pnpm-catalog.ts\n/**\n* Walks up from `baseDir` looking for `pnpm-workspace.yaml`, then scans\n* its top-level `catalog:` block for entries that match any of `packages`.\n*\n* Implements FR7.3 / Spec Decision 8 (honour-and-warn): when `init` runs\n* inside a pnpm workspace whose catalog overrides one of the packages it\n* installs, surface a structured warning so the user knows the catalog\n* version (not the published `latest`) is what ended up in their\n* `node_modules`. pnpm itself does this silently; the warning closes the\n* \"looks fine, must be wrong version six months later\" gap.\n*\n* Notes / scope:\n*\n* - We only inspect the unnamed top-level `catalog:` block. pnpm also\n* supports `catalogs:` (plural — *named* catalogs referenced via\n* `catalog:foo` specifiers); those don't apply to a vanilla\n* `pnpm add prisma-next` invocation, so we skip them.\n* - We don't validate YAML syntax exhaustively. The file format pnpm\n* ships is line-oriented and well-known; a minimal regex is more\n* robust than depending on a YAML parser for one warning.\n* - We don't compare against the registry's `latest` — pnpm uses the\n* catalog version regardless, so the warning fires whenever a match\n* exists. The user-facing copy explains how to opt out.\n*/\nfunction detectPnpmCatalogOverrides(baseDir, packages) {\n\tconst workspaceFile = findNearestPnpmWorkspaceFile(baseDir);\n\tif (workspaceFile === null) return null;\n\tconst catalog = extractCatalogBlock(readFileSync(workspaceFile, \"utf-8\"));\n\tif (catalog === null) return {\n\t\tworkspaceFile,\n\t\tentries: []\n\t};\n\tconst wanted = new Set(packages);\n\tconst entries = [];\n\tfor (const [name, version] of catalog) if (wanted.has(name)) entries.push({\n\t\tname,\n\t\tversion\n\t});\n\treturn {\n\t\tworkspaceFile,\n\t\tentries\n\t};\n}\nfunction findNearestPnpmWorkspaceFile(baseDir) {\n\tlet dir = baseDir;\n\tlet prev = \"\";\n\twhile (dir !== prev) {\n\t\tconst candidate = join(dir, \"pnpm-workspace.yaml\");\n\t\tif (existsSync(candidate)) return candidate;\n\t\tprev = dir;\n\t\tdir = dirname(dir);\n\t}\n\treturn null;\n}\n/**\n* Returns the entries inside the top-level `catalog:` block as `[name, version]`\n* pairs in document order, or `null` when no `catalog:` block exists.\n*\n* The parser is intentionally minimal: it reads line-by-line, locates the\n* top-level `catalog:` line (no leading whitespace), then collects every\n* subsequent indented line of the form `<key>: <value>` until the next\n* top-level key (or end of file). Quotes around `<key>` and `<value>`\n* are stripped; comments (`#…`) are ignored.\n*/\nfunction extractCatalogBlock(contents) {\n\tconst lines = contents.split(/\\r?\\n/);\n\tconst startIdx = lines.findIndex((line) => /^catalog\\s*:\\s*$/.test(line));\n\tif (startIdx === -1) return null;\n\tconst entries = [];\n\tfor (let i = startIdx + 1; i < lines.length; i++) {\n\t\tconst raw = lines[i] ?? \"\";\n\t\tif (raw.trim() === \"\" || /^\\s*#/.test(raw)) continue;\n\t\tif (!/^\\s/.test(raw)) break;\n\t\tconst match = raw.match(/^\\s+(?:'([^']+)'|\"([^\"]+)\"|([^:\\s'\"]+))\\s*:\\s*(.*?)\\s*(?:#.*)?$/);\n\t\tif (!match) continue;\n\t\tconst name = match[1] ?? match[2] ?? match[3];\n\t\tif (name === void 0) continue;\n\t\tconst version = stripQuotes((match[4] ?? \"\").trim());\n\t\tif (version === \"\") continue;\n\t\tentries.push([name, version]);\n\t}\n\treturn entries;\n}\nfunction stripQuotes(value) {\n\tif (value.length >= 2) {\n\t\tconst first = value[0];\n\t\tconst last = value[value.length - 1];\n\t\tif (first === \"\\\"\" && last === \"\\\"\" || first === \"'\" && last === \"'\") return value.slice(1, -1);\n\t}\n\treturn value;\n}\n//#endregion\n//#region src/commands/init/errors.ts\n/**\n* Re-init in non-interactive mode without `--force`. Distinct from the\n* decline-the-prompt path (which is `errorInitUserAborted`) because here\n* the user was never given the choice — `--force` is the contract.\n*/\nfunction errorInitReinitNeedsForce() {\n\treturn new CliStructuredError$1(\"CLI.INIT_REINIT_NEEDS_FORCE\", \"Project is already initialized\", {\n\t\twhy: \"A `prisma-next.config.ts` already exists in this directory. Re-running `init` would overwrite the scaffolded files; in non-interactive mode `init` will not do that without `--force`.\",\n\t\tfix: \"Pass `--force` to overwrite the existing scaffold, or run `init` interactively to confirm.\",\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_REINIT_NEEDS_FORCE\")\n\t});\n}\n/**\n* Non-interactive mode is missing one or more required inputs. Lists every\n* missing flag in the error so an agent / CI script can react without\n* needing to parse English.\n*\n* @param missing — kebab-case flag names without leading dashes\n* @param why — additional context (e.g. \"stdin is not a TTY\") that helps\n* the user understand why interactive fallback was skipped.\n*/\nfunction errorInitMissingFlags(options) {\n\tconst flagList = options.missing.map((flag) => `--${flag}`).join(\", \");\n\tconst fixList = options.missing.map((flag) => {\n\t\tswitch (flag) {\n\t\t\tcase \"target\": return \"--target postgres|mongodb\";\n\t\t\tcase \"authoring\": return \"--authoring psl|typescript\";\n\t\t\tcase \"schema-path\": return \"--schema-path <path>\";\n\t\t\tdefault: return `--${flag} <value>`;\n\t\t}\n\t}).join(\" \");\n\treturn new CliStructuredError$1(\"CLI.INIT_MISSING_FLAGS\", \"Missing required flags\", {\n\t\twhy: `${options.why} Missing required flag(s): ${flagList}.`,\n\t\tfix: `Re-run with the missing flag(s) supplied, e.g. \\`prisma-next init --yes ${fixList}\\`. Use \\`prisma-next init --help\\` to see every flag.`,\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_MISSING_FLAGS\"),\n\t\tmeta: { missingFlags: options.missing }\n\t});\n}\n/**\n* A flag value was supplied but is not in the allowed set. Lists the\n* allowed values in `meta` for machine-readable consumption.\n*/\nfunction errorInitInvalidFlagValue(options) {\n\treturn new CliStructuredError$1(\"CLI.INIT_INVALID_FLAG_VALUE\", `Invalid value for --${options.flag}`, {\n\t\twhy: `\\`--${options.flag} ${options.value}\\` is not one of: ${options.allowed.join(\", \")}.`,\n\t\tfix: `Use one of: ${options.allowed.map((v) => `--${options.flag} ${v}`).join(\", \")}.`,\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_INVALID_FLAG_VALUE\"),\n\t\tmeta: {\n\t\t\tflag: options.flag,\n\t\t\tvalue: options.value,\n\t\t\tallowed: options.allowed\n\t\t}\n\t});\n}\n/**\n* `--authoring` and `--schema-path` disagree on file extension (e.g. PSL\n* authoring with a `.ts` path). Surfaces before any scaffold files are\n* written so the project tree stays untouched.\n*/\nfunction errorInitAuthoringSchemaPathMismatch(options) {\n\tconst expectedAuthoring = options.expectedExtension === \".ts\" ? \"typescript\" : \"psl\";\n\treturn new CliStructuredError$1(\"CLI.INIT_AUTHORING_SCHEMA_PATH_MISMATCH\", \"Authoring and schema path do not match\", {\n\t\twhy: `\\`--authoring ${options.authoring}\\` requires a schema file ending in ${options.expectedExtension}, but \\`--schema-path ${options.schemaPath}\\` ends in ${options.actualExtension}.`,\n\t\tfix: `Use a matching pair, for example \\`--authoring ${expectedAuthoring} --schema-path <path>${options.expectedExtension}\\`, or change \\`--authoring\\` to match the path you supplied. You can also omit \\`--schema-path\\` to use the default for the chosen authoring.`,\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_AUTHORING_SCHEMA_PATH_MISMATCH\"),\n\t\tmeta: {\n\t\t\tauthoring: options.authoring,\n\t\t\tschemaPath: options.schemaPath,\n\t\t\tactualExtension: options.actualExtension,\n\t\t\texpectedExtension: options.expectedExtension\n\t\t}\n\t});\n}\n/**\n* The user cancelled an interactive prompt (Ctrl-C, escape, declined a\n* selection). Distinct from `errorInitReinitNeedsForce` because that path\n* applies to non-interactive mode where the user was never given the\n* choice; this one is the generic \"user said no\" path. Maps to exit code\n* 3 (USER_ABORTED).\n*/\nfunction errorInitUserAborted() {\n\treturn new CliStructuredError$1(\"CLI.INIT_USER_ABORTED\", \"Init cancelled\", {\n\t\twhy: \"The interactive prompt was cancelled before all required inputs were supplied. No files were modified.\",\n\t\tfix: \"Re-run `prisma-next init` and complete the prompts, or pass the required inputs as flags (see `--help`) for a non-interactive run.\",\n\t\tseverity: \"info\"\n\t});\n}\n/**\n* `--strict-probe` was supplied without `--probe-db`. Per FR8.3 / NFR9\n* (offline-by-default), `--strict-probe` is a no-op without `--probe-db` —\n* but rather than silently ignoring it we tell the user what they probably\n* meant. Without this guard, the flag combination silently does nothing,\n* which is exactly the kind of \"looks like it worked\" trap that a strict\n* mode is supposed to prevent.\n*/\nfunction errorInitStrictProbeWithoutProbe() {\n\treturn new CliStructuredError$1(\"CLI.INIT_STRICT_PROBE_WITHOUT_PROBE\", \"`--strict-probe` requires `--probe-db`\", {\n\t\twhy: \"`--strict-probe` only changes how a *failed* probe is reported; without `--probe-db` no probe is attempted in the first place. (`init` is offline-by-default — it never opens a connection to your database without explicit consent.)\",\n\t\tfix: \"Add `--probe-db` to opt in to the probe, or drop `--strict-probe` if you do not need the version check.\",\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_STRICT_PROBE_WITHOUT_PROBE\")\n\t});\n}\n/**\n* Dependency installation failed and the pnpm → npm fallback (FR7.2)\n* either did not apply (pm ≠ pnpm or stderr did not match a recognised\n* leak) or also failed. Files scaffolded before the install step are\n* already on disk; `meta.filesWritten` carries the list so a follow-up\n* agent can resume manually. Maps to exit code `4 = INSTALL_FAILED`.\n*/\nfunction errorInitInstallFailed(options) {\n\tconst trimmed = options.stderrLines.map((s) => s.trim()).filter(Boolean);\n\treturn new CliStructuredError$1(\"CLI.INIT_INSTALL_FAILED\", \"Failed to install dependencies\", {\n\t\twhy: trimmed.length === 0 ? \"The package manager exited with an error and no recoverable fallback applied.\" : `The package manager exited with: ${trimmed[0]}`,\n\t\tfix: `Install manually:\\n ${options.addCommand}\\n ${options.addDevCommand}\\nThen run \\`${options.emitCommand}\\` to emit the contract.`,\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_INSTALL_FAILED\"),\n\t\tmeta: {\n\t\t\tfilesWritten: options.filesWritten,\n\t\t\tstderr: trimmed\n\t\t}\n\t});\n}\n/**\n* The user's project manifest (typically `package.json`) failed to parse\n* as JSON. Init reads the manifest to merge `scripts` (FR3.5) and to\n* skip `@types/node` when it is already declared (FR2.1); a malformed\n* file would otherwise surface as an `INTERNAL_ERROR` with a raw\n* `SyntaxError` stack, which violates the FR1.6 contract that every\n* documented failure mode maps to a stable exit code.\n*\n* Maps to exit code `2 = PRECONDITION` — the user can fix the manifest\n* and re-run.\n*/\nfunction errorInitInvalidManifest(options) {\n\treturn new CliStructuredError$1(\"CLI.INIT_INVALID_MANIFEST\", `Failed to parse ${options.path}`, {\n\t\twhy: `\\`${options.path}\\` is not valid JSON: ${options.cause}`,\n\t\tfix: `Fix the JSON syntax in \\`${options.path}\\` (a missing comma or unbalanced brace is the most common cause), then re-run \\`prisma-next init\\`.`,\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_INVALID_MANIFEST\"),\n\t\tmeta: {\n\t\t\tpath: options.path,\n\t\t\tcause: options.cause\n\t\t}\n\t});\n}\n/**\n* The user's existing `tsconfig.json` could not be parsed even with JSONC\n* tolerance (comments + trailing commas) enabled. Init merges the\n* minimum compiler options the scaffolded files need (FR2.2), so an\n* unparseable tsconfig is a hard precondition failure: we cannot\n* faithfully edit a file we cannot read.\n*\n* Init must surface this **before** writing any scaffold file so the\n* user's working tree stays byte-identical (FR6.2 / NFR3) — see\n* `runInit` for the precondition gate.\n*\n* Maps to exit code `2 = PRECONDITION` — the user can fix the file and\n* re-run.\n*/\nfunction errorInitInvalidTsconfig(options) {\n\treturn new CliStructuredError$1(\"CLI.INIT_INVALID_TSCONFIG\", `Failed to parse ${options.path}`, {\n\t\twhy: `\\`${options.path}\\` is not valid JSON or JSONC: ${options.cause}`,\n\t\tfix: `Fix the syntax in \\`${options.path}\\` and re-run \\`prisma-next init\\`. \\`init\\` accepts JSONC (comments and trailing commas) but cannot recover from unbalanced braces or missing commas.`,\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_INVALID_TSCONFIG\"),\n\t\tmeta: {\n\t\t\tpath: options.path,\n\t\t\tcause: options.cause\n\t\t}\n\t});\n}\n/**\n* `--probe-db` was supplied along with `--strict-probe` and the probe\n* could not complete (no `DATABASE_URL`, network/auth error, the target\n* driver was not installed, …). Without `--strict-probe` the probe\n* surfaces these as warnings; `--strict-probe` escalates them to\n* fatal so a CI gate can rely on \"init exit code 2 means something\n* about the runtime environment is wrong\" (FR8.3).\n*\n* Maps to exit code `2 = PRECONDITION`. The caller's project files\n* are already on disk by this point — the probe runs after the write\n* phase — but the install/emit steps may or may not have completed\n* depending on `--no-install` and the exact failure mode; `meta`\n* carries `filesWritten` so a follow-up agent can resume manually.\n*/\nfunction errorInitProbeFailed(options) {\n\treturn new CliStructuredError$1(\"CLI.INIT_PROBE_FAILED\", \"Database probe failed\", {\n\t\twhy: `\\`--probe-db\\` could not complete and \\`--strict-probe\\` was set: ${options.cause}`,\n\t\tfix: \"Confirm `DATABASE_URL` points at a reachable server, or drop `--strict-probe` to treat probe failures as warnings.\",\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_PROBE_FAILED\"),\n\t\tmeta: {\n\t\t\tfilesWritten: options.filesWritten,\n\t\t\tcause: options.cause\n\t\t}\n\t});\n}\n/**\n* `prisma-next contract emit` failed after a successful install. Surface\n* the underlying error so the user can fix it and re-run; files and\n* dependencies remain on disk untouched. Maps to exit code\n* `5 = EMIT_FAILED`.\n*/\nfunction errorInitEmitFailed(options) {\n\treturn new CliStructuredError$1(\"CLI.INIT_EMIT_FAILED\", \"Failed to emit contract\", {\n\t\twhy: `\\`prisma-next contract emit\\` failed: ${options.cause}`,\n\t\tfix: `Inspect your contract file, fix the underlying issue, then re-run \\`${options.emitCommand}\\`. Pass \\`-v\\` for the full error envelope.`,\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_EMIT_FAILED\"),\n\t\tmeta: {\n\t\t\tfilesWritten: options.filesWritten,\n\t\t\tcause: options.cause\n\t\t}\n\t});\n}\n/**\n* The project-level skills install (`npx skills add\n* prisma/prisma#v<version>`) failed after a successful dependency\n* install + emit. The project's scaffold remains on disk; the user\n* can either fix the underlying issue (network, registry, PATH) and\n* run the install command manually, or re-run `init --no-skill` to\n* proceed without the skill.\n*\n* Non-rolling-back, matching the existing install/emit failure\n* semantics. Maps to exit code `6 = SKILL_INSTALL_FAILED`.\n*/\nfunction errorInitSkillInstallFailed(options) {\n\treturn new CliStructuredError$1(\"CLI.INIT_SKILL_INSTALL_FAILED\", \"Failed to install Prisma Next skills\", {\n\t\twhy: `\\`${options.skillInstallCommand}\\` exited with an error: ${options.cause}`,\n\t\tfix: `Either:\n - Re-run \\`prisma-next init --no-skill${options.filesWritten.length > 0 ? \" --force\" : \"\"}\\` to skip the skill install for this run, or\\n - Fix the underlying issue (network, npm registry, \\`npx skills\\` on PATH) and install manually:\\n ${options.skillInstallCommand}`,\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_SKILL_INSTALL_FAILED\"),\n\t\tmeta: {\n\t\t\tfilesWritten: options.filesWritten,\n\t\t\tskillInstallCommand: options.skillInstallCommand,\n\t\t\tcause: options.cause\n\t\t}\n\t});\n}\n//#endregion\n//#region src/commands/init/hygiene-gitattributes.ts\n/**\n* The `.gitattributes` entries written for a freshly initialised project\n* (FR3.4). Mirrors the relevant subset of the repo-root\n* [`.gitattributes`](../../../../../../../../.gitattributes):\n*\n* - **Today**: `contract.json`, `contract.d.ts` are emitted on every\n* `prisma-next contract emit`. Marking them `linguist-generated`\n* keeps GitHub's diff stats honest and collapses the file in code\n* review by default.\n* - **Forward-looking**: `ops.json`, `migration.json` are not yet emitted\n* by `init` flows but will be produced by adjacent commands (lower /\n* migration tooling). Adding them now matches Decision 5\n* (forward-looking subset) so the file does not need to be amended\n* every time a new artifact lands.\n*\n* `ARTIFACT_FILENAMES` entries are written relative to the schema\n* directory so a user who runs `init --schema-path db/contract.prisma`\n* gets `db/contract.json linguist-generated` — not the workspace-glob\n* form `<glob>/contract.json` (which would over-match any unrelated\n* `contract.json` the user has elsewhere) and not the absolute\n* `DEFAULT_CONTRACT_SOURCE_DIR/contract.json` (which would silently\n* break for a non-default schema path).\n*\n* The migration contract snapshot store (`migrations/snapshots/<hex>/`)\n* is anchored to the migrations root instead, not the schema directory:\n* migration package depth under `migrations/` varies (`app/<pkg>`,\n* `<space>/<pkg>`, or a bare `<pkg>` in extension source repos), so no\n* single schema-dir-relative pattern can reach every snapshot. See\n* `STORE_GITATTRIBUTES_LINES` below.\n*/\nconst ARTIFACT_FILENAMES$1 = [\n\t\"contract.json\",\n\t\"contract.d.ts\",\n\t\"ops.json\",\n\t\"migration.json\"\n];\nconst ATTRIBUTE = \"linguist-generated\";\n/**\n* Full `.gitattributes` lines for the migration contract snapshot store,\n* already anchored to the migrations root — unlike `ARTIFACT_FILENAMES`,\n* these are not combined with the schema-relative prefix.\n*/\nconst STORE_GITATTRIBUTES_LINES = [`migrations/snapshots/**/contract.json ${ATTRIBUTE}`, `migrations/snapshots/**/contract.d.ts ${ATTRIBUTE}`];\n/**\n* Computes the `.gitattributes` lines this scaffold expects to own. Each\n* line has the shape `<path> linguist-generated`. The `target` parameter\n* is currently unused but accepted for symmetry with the other hygiene\n* helpers and to leave room for target-specific entries (e.g. a future\n* family-specific artifact) without a signature break.\n*/\nfunction requiredGitattributesLines(schemaDir, _target) {\n\tconst dir = schemaDir === \".\" ? \"\" : schemaDir.replace(/\\/+$/, \"\");\n\tconst prefix = dir === \"\" ? \"\" : `${dir}/`;\n\treturn [...ARTIFACT_FILENAMES$1.map((file) => `${prefix}${file} ${ATTRIBUTE}`), ...STORE_GITATTRIBUTES_LINES];\n}\n/**\n* Idempotent `.gitattributes` merge (FR3.4 / FR9.3). Returns the new file\n* content given the existing content (or `undefined` if the file does\n* not yet exist).\n*\n* Equivalence is exact-line: a user-customised line like\n* `prisma/*.json linguist-generated` is *not* recognised as covering\n* `DEFAULT_CONTRACT_SOURCE_DIR/contract.json linguist-generated`. We accept that\n* over-specification — preserving the user's broad pattern *and*\n* appending the narrow one — because the narrow lines are what the\n* acceptance criteria pin (FR3.4 AC).\n*\n* Returns `null` when no changes are required (file already contains\n* every required entry).\n*/\nfunction mergeGitattributes(existing, required) {\n\tif (existing === void 0) return `${required.join(\"\\n\")}\\n`;\n\tconst presentLines = new Set(existing.split(\"\\n\").map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith(\"#\")));\n\tconst missing = required.filter((line) => !presentLines.has(line));\n\tif (missing.length === 0) return null;\n\treturn `${existing}${existing.length === 0 || existing.endsWith(\"\\n\") ? \"\" : \"\\n\"}${missing.join(\"\\n\")}\\n`;\n}\n//#endregion\n//#region src/commands/init/hygiene-gitignore.ts\n/**\n* The minimal `.gitignore` lines a Prisma Next scaffold needs (FR3.3).\n* Order matches what Node tooling typically writes today.\n*\n* `node_modules/` first because it's the byte-largest miss; `dist/`\n* because the scaffolded `tsconfig.json` writes there; `.env` last so\n* the secret-bearing file is the one most-recently visible in any diff\n* (a paranoid-correct ordering — humans skim from the top).\n*/\nconst REQUIRED_GITIGNORE_ENTRIES = [\n\t\"node_modules/\",\n\t\"dist/\",\n\t\".env\"\n];\n/**\n* Idempotent `.gitignore` merge (FR3.3 / FR9.3). Returns the new file\n* content given the existing content (or `undefined` if the file does\n* not yet exist). Adds only entries that are not already present and\n* never duplicates a line. Existing comments and blank lines are\n* preserved verbatim — `.gitignore` is parsed by `git` without a tree,\n* so any line modification risks changing semantics.\n*\n* Pattern equivalence is line-literal: `node_modules/` and `node_modules`\n* are treated as different entries. This is intentional — `git` treats\n* them differently (the trailing slash restricts the match to\n* directories), and the AC pins the trailing-slash form.\n*\n* Returns `null` when no changes are required (file already contains\n* every required entry). The caller can use this to decide whether to\n* include `.gitignore` in `filesWritten`.\n*/\nfunction mergeGitignore(existing) {\n\tif (existing === void 0) return `${REQUIRED_GITIGNORE_ENTRIES.join(\"\\n\")}\\n`;\n\tconst present = new Set(existing.split(\"\\n\").map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith(\"#\")));\n\tconst missing = REQUIRED_GITIGNORE_ENTRIES.filter((entry) => !present.has(entry));\n\tif (missing.length === 0) return null;\n\treturn `${existing}${existing.length === 0 || existing.endsWith(\"\\n\") ? \"\" : \"\\n\"}${missing.join(\"\\n\")}\\n`;\n}\n//#endregion\n//#region src/commands/init/hygiene-package-scripts.ts\nconst REQUIRED_SCRIPTS = [{\n\tname: \"contract:emit\",\n\tcommand: \"prisma-next contract emit\"\n}];\n/**\n* Idempotent `package.json#scripts` merge with collision detection\n* (FR3.5 / FR9.3):\n*\n* - If a required script is **missing**, append it.\n* - If a required script is **already present and identical**, leave\n* the file alone (idempotency).\n* - If a required script is **present but maps to a different command**,\n* skip the write for that script and surface a structured warning.\n* The user's override is sacred — `init` should never silently\n* overwrite a custom build pipeline.\n*\n* Preserves the existing key order (so a user who has alphabetised\n* their scripts does not see them reshuffled) and appends new entries\n* at the end.\n*\n* The `package.json` is parsed and re-stringified through `JSON` —\n* comments are not preserved (package.json does not support them per\n* spec). Trailing newline matches the original input's trailing\n* newline behaviour.\n*/\nfunction mergePackageScripts(existing, required = REQUIRED_SCRIPTS) {\n\tconst parsed = blindCast(JSON.parse(existing));\n\tconst scripts = typeof parsed[\"scripts\"] === \"object\" && parsed[\"scripts\"] !== null ? { ...blindCast(parsed[\"scripts\"]) } : {};\n\tconst warnings = [];\n\tlet mutated = false;\n\tfor (const { name, command } of required) {\n\t\tconst existingValue = scripts[name];\n\t\tif (existingValue === void 0) {\n\t\t\tscripts[name] = command;\n\t\t\tmutated = true;\n\t\t\tcontinue;\n\t\t}\n\t\tif (existingValue !== command) warnings.push(`package.json already has a \"${name}\" script with a different command — keeping yours.\\n existing: ${existingValue}\\n expected: ${command}\\nIf you want the default, remove your \"${name}\" script and re-run \\`init\\`.`);\n\t}\n\tif (!mutated) return {\n\t\tcontent: null,\n\t\twarnings\n\t};\n\tparsed[\"scripts\"] = scripts;\n\tconst trailingNewline = existing.endsWith(\"\\n\") ? \"\\n\" : \"\";\n\treturn {\n\t\tcontent: `${JSON.stringify(parsed, null, 2)}${trailingNewline}`,\n\t\twarnings\n\t};\n}\n/**\n* Idempotently sets `\"type\": \"module\"` on a `package.json` so the\n* scaffolded `prisma/db.ts` — which uses the ESM-only `with { type: 'json' }`\n* import attribute — loads as ES module under Node's loader (TML-2494).\n*\n* Without this field Node either:\n*\n* - emits `MODULE_TYPELESS_PACKAGE_JSON` and reparses the file as ESM\n* with a perf penalty (Node 22+ with `--experimental-strip-types`), or\n* - hard-fails with `ERR_*` because the CJS loader cannot parse the\n* import-attribute syntax (older Node, or any tool that doesn't\n* reparse).\n*\n* Behaviour:\n*\n* - **Field missing** → set to `\"module\"`. New entry is inserted right\n* after `\"name\"` (when present) so the diff lands in a conventional\n* spot for human review; falls through to the natural append position\n* otherwise.\n* - **Field already `\"module\"`** → no-op (idempotent).\n* - **Field set to anything else** (e.g. `\"commonjs\"`) → leave it alone\n* and surface a structured warning. The user explicitly opted out of\n* ESM and we don't silently overwrite that.\n*/\nfunction ensureEsmModuleType(existing) {\n\tconst parsed = blindCast(JSON.parse(existing));\n\tconst currentType = parsed[\"type\"];\n\tif (currentType === \"module\") return {\n\t\tcontent: null,\n\t\twarning: null\n\t};\n\tif (typeof currentType === \"string\" && currentType !== \"module\") return {\n\t\tcontent: null,\n\t\twarning: `package.json declares \"type\": \"${currentType}\" — keeping yours, but the scaffolded prisma/db.ts uses an ESM-only import attribute (\\`with { type: 'json' }\\`) and will not load under that module type.\\nIf you want the default, set \"type\": \"module\" in package.json.`\n\t};\n\tconst next = {};\n\tlet inserted = false;\n\tfor (const [key, value] of Object.entries(parsed)) {\n\t\tif (key === \"type\") continue;\n\t\tnext[key] = value;\n\t\tif (!inserted && key === \"name\") {\n\t\t\tnext[\"type\"] = \"module\";\n\t\t\tinserted = true;\n\t\t}\n\t}\n\tif (!inserted) next[\"type\"] = \"module\";\n\tconst trailingNewline = existing.endsWith(\"\\n\") ? \"\\n\" : \"\";\n\treturn {\n\t\tcontent: `${JSON.stringify(next, null, 2)}${trailingNewline}`,\n\t\twarning: null\n\t};\n}\n//#endregion\n//#region src/commands/init/inputs.ts\nconst TARGET_ALIASES = /* @__PURE__ */ new Map([\n\t[\"postgres\", \"postgres\"],\n\t[\"postgresql\", \"postgres\"],\n\t[\"mongo\", \"mongo\"],\n\t[\"mongodb\", \"mongo\"]\n]);\nconst AUTHORING_VALUES = /* @__PURE__ */ new Map([\n\t[\"psl\", \"psl\"],\n\t[\"typescript\", \"typescript\"],\n\t[\"ts\", \"typescript\"]\n]);\n/**\n* Resolves every required input for `runInit`. In interactive mode, missing\n* inputs are prompted via clack; in non-interactive mode, missing required\n* inputs throw a structured error listing exactly which flags are missing\n* (FR1.4). Throws `CliStructuredError` on any unrecoverable input issue.\n*\n* `canPrompt` is decoupled from `flags.interactive` so the action handler\n* (`./index.ts`) owns the merge of stdout-TTY (decoration) and stdin-TTY\n* (prompts). `flags.interactive` continues to gate `TerminalUI` decoration\n* — see [Style Guide § Interactivity](../../../../../../../docs/CLI%20Style%20Guide.md#interactivity).\n*/\nasync function resolveInitInputs(ctx) {\n\tconst { baseDir, options, flags, canPrompt } = ctx;\n\tconst force = Boolean(options.force);\n\tconst autoAcceptPrompts = Boolean(flags.yes);\n\tif (options.strictProbe && !options.probeDb) throw errorInitStrictProbeWithoutProbe();\n\tconst reinit = await resolveReinit({\n\t\tbaseDir,\n\t\tforce,\n\t\tcanPrompt,\n\t\tautoAcceptPrompts\n\t});\n\tconst target = resolveTarget(options.target);\n\tconst authoring = resolveAuthoring(options.authoring);\n\tconst missing = [];\n\tif (target === void 0) missing.push(\"target\");\n\tif (authoring === void 0) missing.push(\"authoring\");\n\tif (!canPrompt && missing.length > 0) throw errorInitMissingFlags({\n\t\tmissing,\n\t\twhy: process.stdin.isTTY ? \"Non-interactive mode is active (`--no-interactive` or stdout is piped).\" : \"stdin is not a TTY, so `init` cannot prompt interactively.\"\n\t});\n\tconst finalTarget = target ?? await promptTarget();\n\tconst finalAuthoring = authoring ?? await promptAuthoring();\n\tconst finalSchemaPath = options.schemaPath !== void 0 ? validateSchemaPath(options.schemaPath, finalAuthoring) : canPrompt ? await promptSchemaPath(finalAuthoring) : defaultSchemaPath(finalAuthoring);\n\tconst writeEnv = await resolveWriteEnv({\n\t\tflag: options.writeEnv,\n\t\tcanPrompt,\n\t\tautoAcceptPrompts\n\t});\n\tconst removePreviousFacade = await resolveRemovePreviousFacade({\n\t\tbaseDir,\n\t\ttarget: finalTarget,\n\t\treinit,\n\t\tforce,\n\t\tcanPrompt,\n\t\tautoAcceptPrompts\n\t});\n\tconst installProjectSkill = options.skill !== false;\n\treturn {\n\t\ttarget: finalTarget,\n\t\tauthoring: finalAuthoring,\n\t\tschemaPath: finalSchemaPath,\n\t\tinstall: options.install !== false,\n\t\twriteEnv,\n\t\tprobeDb: Boolean(options.probeDb),\n\t\tstrictProbe: Boolean(options.strictProbe),\n\t\treinit,\n\t\tremovePreviousFacade,\n\t\tinstallProjectSkill\n\t};\n}\nasync function resolveWriteEnv(opts) {\n\tif (opts.flag !== void 0) return Boolean(opts.flag);\n\tif (!opts.canPrompt || opts.autoAcceptPrompts) return false;\n\tconst result = await clack.confirm({\n\t\tmessage: \"Also write a .env file from .env.example? (gitignored)\",\n\t\tinitialValue: false,\n\t\toutput: process.stderr\n\t});\n\tif (clack.isCancel(result)) throw errorInitUserAborted();\n\treturn Boolean(result);\n}\n/**\n* FR9.2 — detects whether re-init is switching targets (the previous\n* facade differs from the chosen target's facade) and resolves the\n* remove-or-keep question.\n*\n* The non-interactive contract is the same as the `--force` re-init\n* gate above: a non-interactive run that reaches this helper always\n* has `--force` (otherwise `resolveReinit` would have thrown 5002), so\n* the removal proceeds without further prompting. Interactive runs see\n* a `clack.confirm` with `initialValue: true` — the destructive default\n* is correct because keeping both facades produces a project that\n* imports from one but pays for both in the lockfile, which is a\n* silent foot-gun the user almost never wants.\n*\n* Returns the previous facade package name when the user consented (or\n* was force-ed) to remove it, otherwise `null`. Parse failures on\n* `package.json` resolve to `null` here — `runInit`'s precondition\n* gate surfaces a structured 5010 error for the same file shortly\n* after, so we avoid double-reporting and keep this helper side-effect\n* free under hostile inputs.\n*/\nasync function resolveRemovePreviousFacade(opts) {\n\tif (!opts.reinit) return null;\n\tconst packageJsonPath = join(opts.baseDir, \"package.json\");\n\tif (!existsSync(packageJsonPath)) return null;\n\tconst otherTarget = opts.target === \"postgres\" ? \"mongo\" : \"postgres\";\n\tconst otherFacadeNames = [targetPackageName(otherTarget, scaffoldSpecifierResolverFor(otherTarget)), targetPackageName(otherTarget)];\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(readFileSync(packageJsonPath, \"utf-8\"));\n\t} catch {\n\t\treturn null;\n\t}\n\tconst deps = parsed[\"dependencies\"];\n\tif (deps === null || typeof deps !== \"object\" || Array.isArray(deps)) return null;\n\tconst otherFacade = otherFacadeNames.find((name) => Object.hasOwn(deps, name));\n\tif (otherFacade === void 0) return null;\n\tif (opts.force || opts.canPrompt && opts.autoAcceptPrompts) return otherFacade;\n\tif (!opts.canPrompt) return otherFacade;\n\tconst result = await clack.confirm({\n\t\tmessage: `Switching from ${targetLabel(otherTarget)} to ${targetLabel(opts.target)} — remove ${otherFacade} from package.json dependencies?`,\n\t\tinitialValue: true,\n\t\toutput: process.stderr\n\t});\n\tif (clack.isCancel(result)) throw errorInitUserAborted();\n\treturn result === true ? otherFacade : null;\n}\nasync function resolveReinit(opts) {\n\tif (!existsSync(join(opts.baseDir, \"prisma-next.config.ts\"))) return false;\n\tif (opts.force) return true;\n\tif (!opts.canPrompt) throw errorInitReinitNeedsForce();\n\tif (opts.autoAcceptPrompts) return true;\n\tconst result = await clack.confirm({\n\t\tmessage: \"This project is already initialized. Re-initialize? This will overwrite all generated files.\",\n\t\tinitialValue: false,\n\t\toutput: process.stderr\n\t});\n\tif (clack.isCancel(result) || result !== true) throw errorInitUserAborted();\n\treturn true;\n}\nfunction resolveTarget(value) {\n\tif (value === void 0) return void 0;\n\tconst mapped = TARGET_ALIASES.get(value.toLowerCase());\n\tif (mapped === void 0) throw errorInitInvalidFlagValue({\n\t\tflag: \"target\",\n\t\tvalue,\n\t\tallowed: [\"postgres\", \"mongodb\"]\n\t});\n\treturn mapped;\n}\nfunction resolveAuthoring(value) {\n\tif (value === void 0) return void 0;\n\tconst mapped = AUTHORING_VALUES.get(value.toLowerCase());\n\tif (mapped === void 0) throw errorInitInvalidFlagValue({\n\t\tflag: \"authoring\",\n\t\tvalue,\n\t\tallowed: [\"psl\", \"typescript\"]\n\t});\n\treturn mapped;\n}\n/**\n* Validates `--schema-path` against the chosen `--authoring` style: PSL\n* authoring requires a `.prisma` file and TypeScript authoring requires a\n* `.ts` file. Mismatched combinations would silently scaffold PSL content\n* into a `.ts` file (or vice versa); this validator surfaces the mistake\n* as a precondition error naming both flags.\n*/\nfunction validateSchemaPath(value, authoring) {\n\tconst trimmed = value.trim();\n\tif (trimmed.length === 0) throw errorInitInvalidFlagValue({\n\t\tflag: \"schema-path\",\n\t\tvalue,\n\t\tallowed: [\"<non-empty file path with .prisma or .ts extension>\"]\n\t});\n\tif (trimmed.endsWith(\"/\") || trimmed.endsWith(\"\\\\\")) throw errorInitInvalidFlagValue({\n\t\tflag: \"schema-path\",\n\t\tvalue,\n\t\tallowed: [\"<file path, not a directory>\"]\n\t});\n\tconst ext = extname(trimmed).toLowerCase();\n\tconst expected = authoring === \"typescript\" ? \".ts\" : \".prisma\";\n\tif (ext !== expected) throw errorInitAuthoringSchemaPathMismatch({\n\t\tauthoring,\n\t\tschemaPath: trimmed,\n\t\tactualExtension: ext.length > 0 ? ext : \"(none)\",\n\t\texpectedExtension: expected\n\t});\n\treturn normalize(trimmed);\n}\nasync function promptTarget() {\n\tconst result = await clack.select({\n\t\tmessage: \"What database are you using?\",\n\t\toptions: [{\n\t\t\tvalue: \"postgres\",\n\t\t\tlabel: \"PostgreSQL\"\n\t\t}, {\n\t\t\tvalue: \"mongo\",\n\t\t\tlabel: \"MongoDB\"\n\t\t}],\n\t\toutput: process.stderr\n\t});\n\tif (clack.isCancel(result)) throw errorInitUserAborted();\n\treturn result;\n}\nasync function promptAuthoring() {\n\tconst result = await clack.select({\n\t\tmessage: \"How do you want to write your schema?\",\n\t\toptions: [{\n\t\t\tvalue: \"psl\",\n\t\t\tlabel: \"Prisma Schema Language (.prisma)\"\n\t\t}, {\n\t\t\tvalue: \"typescript\",\n\t\t\tlabel: \"TypeScript (.ts)\"\n\t\t}],\n\t\toutput: process.stderr\n\t});\n\tif (clack.isCancel(result)) throw errorInitUserAborted();\n\treturn result;\n}\nasync function promptSchemaPath(authoring) {\n\tconst expectedExt = authoring === \"typescript\" ? \".ts\" : \".prisma\";\n\tconst result = await clack.text({\n\t\tmessage: \"Where should the schema file go?\",\n\t\tinitialValue: defaultSchemaPath(authoring),\n\t\tvalidate(value = \"\") {\n\t\t\tconst trimmed = value.trim();\n\t\t\tif (trimmed.length === 0) return \"Path cannot be empty\";\n\t\t\tif (trimmed.endsWith(\"/\") || trimmed.endsWith(\"\\\\\")) return \"Path must be a file, not a directory\";\n\t\t\tconst ext = extname(trimmed).toLowerCase();\n\t\t\tif (ext === \"\") return \"Path must include a file extension (e.g. .prisma or .ts)\";\n\t\t\tif (ext !== expectedExt) return `Schema path must end in ${expectedExt} for --authoring ${authoring} (got ${ext}).`;\n\t\t},\n\t\toutput: process.stderr\n\t});\n\tif (clack.isCancel(result)) throw errorInitUserAborted();\n\treturn validateSchemaPath(result, authoring);\n}\n//#endregion\n//#region src/commands/init/probe-db.ts\n/**\n* Connects (when configured) to the user's database and returns a\n* structured outcome describing whether the server meets the declared\n* minimum (FR8.1). Pure with respect to its inputs: no I/O happens\n* unless `databaseUrl` is set.\n*\n* The outcome is shaped so that `--strict-probe` can branch on the\n* `kind`/`meetsMinimum` pair without re-stringifying the message:\n*\n* - `ok` — informational; `init` continues.\n* - `below-minimum` — warning; `init` continues regardless of\n* `--strict-probe` (the spec scopes strict-probe to \"probe\n* *failures*\", and a successful probe that finds an old server is\n* not a failure).\n* - `no-database-url` / `connection-failed` / `driver-missing` —\n* warning by default, fatal under `--strict-probe`.\n*/\nasync function probeServerVersion(ctx, overrides = {}) {\n\tconst { databaseUrl, minVersion, target } = ctx;\n\tif (databaseUrl === void 0 || databaseUrl.trim().length === 0) return {\n\t\tkind: \"no-database-url\",\n\t\tminVersion,\n\t\tmeetsMinimum: null,\n\t\tmessage: \"Skipped --probe-db: DATABASE_URL is not set in the current shell environment. (init does not read .env for the probe; export the variable or drop --probe-db.)\"\n\t};\n\tlet driverResult;\n\ttry {\n\t\tif (target === \"postgres\") driverResult = overrides.probePostgres !== void 0 ? await overrides.probePostgres(databaseUrl) : await defaultProbePostgres(databaseUrl, ctx.baseDir, overrides);\n\t\telse driverResult = overrides.probeMongo !== void 0 ? await overrides.probeMongo(databaseUrl) : await defaultProbeMongo(databaseUrl, ctx.baseDir, overrides);\n\t} catch (err) {\n\t\tif (err instanceof DriverMissingError) return {\n\t\t\tkind: \"driver-missing\",\n\t\t\tminVersion,\n\t\t\tmeetsMinimum: null,\n\t\t\tcause: err.message,\n\t\t\tmessage: `Skipped --probe-db: ${err.message}. (Run with install enabled, or install the driver yourself, then re-run \\`prisma-next init --probe-db\\`.)`\n\t\t};\n\t\tconst cause = redactDatabaseUrlSecrets(causeMessage$1(err));\n\t\treturn {\n\t\t\tkind: \"connection-failed\",\n\t\t\tminVersion,\n\t\t\tmeetsMinimum: null,\n\t\t\tcause,\n\t\t\tmessage: `--probe-db could not connect: ${cause}.`\n\t\t};\n\t}\n\tif (compareVersionPrefix(driverResult.serverVersion, minVersion) < 0) return {\n\t\tkind: \"below-minimum\",\n\t\tserverVersion: driverResult.serverVersion,\n\t\tminVersion,\n\t\tmeetsMinimum: false,\n\t\tmessage: `--probe-db: server reports version ${driverResult.serverVersion}, below the declared minimum (${minVersion}). Some queries may fail until the server is upgraded.`\n\t};\n\treturn {\n\t\tkind: \"ok\",\n\t\tserverVersion: driverResult.serverVersion,\n\t\tminVersion,\n\t\tmeetsMinimum: true,\n\t\tmessage: `--probe-db: server reports version ${driverResult.serverVersion} (>= ${minVersion}).`\n\t};\n}\n/**\n* Compares two semver-prefix strings (\"14\", \"14.2\", \"6.0\", …) by\n* numeric components left-to-right. Returns a negative number when `a`\n* is older than `b`, zero when both versions agree on every numeric\n* component (treating missing trailing components as `0`), and a\n* positive number when `a` is newer.\n*\n* The loop runs over the **longer** of the two prefixes so that\n* `'14'` compares less than `'14.1'` — without that, the shorter\n* prefix would be silently accepted whenever the configured minimum\n* has a non-zero minor or patch.\n*\n* Exported for unit tests.\n*/\nfunction compareVersionPrefix(a, b) {\n\tconst aParts = parseNumericParts(a);\n\tconst bParts = parseNumericParts(b);\n\tconst len = Math.max(aParts.length, bParts.length);\n\tfor (let i = 0; i < len; i += 1) {\n\t\tconst aPart = aParts[i] ?? 0;\n\t\tconst bPart = bParts[i] ?? 0;\n\t\tif (aPart !== bPart) return aPart - bPart;\n\t}\n\treturn 0;\n}\nfunction parseNumericParts(version) {\n\tconst match = version.match(/^[^\\d]*(\\d+(?:\\.\\d+){0,3})/);\n\tif (match === null) return [];\n\treturn (match[1] ?? \"\").split(\".\").map((part) => Number.parseInt(part, 10));\n}\nvar DriverMissingError = class extends Error {};\nfunction causeMessage$1(err) {\n\tif (err instanceof Error) return err.message;\n\treturn String(err);\n}\n/**\n* Strips `user:password@` userinfo from any URL-shaped substring before\n* we surface the cause to the user. Mirrors `redactSecrets` in\n* `init.ts` — the probe path has its own redactor because the inputs\n* here include the raw connection string by construction (driver\n* errors echo the URL back).\n*\n* Exported for unit tests.\n*/\nfunction redactDatabaseUrlSecrets(text) {\n\tif (!text) return text;\n\treturn text.replace(/([a-zA-Z][a-zA-Z0-9+.-]*:\\/\\/)([^/@\\s]+)@/g, \"$1***@\");\n}\nasync function defaultProbePostgres(databaseUrl, baseDir, overrides) {\n\tconst client = new (requirePeer(\"pg\", baseDir, overrides)).Client({ connectionString: databaseUrl });\n\tawait client.connect();\n\ttry {\n\t\tconst result = await client.query(\"SELECT version() as version\");\n\t\treturn { serverVersion: parsePostgresVersion(String(result?.rows?.[0]?.version ?? \"\")) };\n\t} finally {\n\t\tawait client.end().catch(() => void 0);\n\t}\n}\n/**\n* Extracts the numeric prefix from a Postgres `version()` row, e.g.\n*\n* `PostgreSQL 14.10 on x86_64-pc-linux-gnu, ...` → `\"14.10\"`\n* `PostgreSQL 16beta1 on …` → `\"16\"` (we\n* conservatively drop the suffix; minimum-version comparisons\n* treat 16beta1 as 16, which is what every reasonable user\n* expects).\n*\n* Exported for unit tests.\n*/\nfunction parsePostgresVersion(versionString) {\n\tconst match = versionString.match(/PostgreSQL\\s+(\\d+(?:\\.\\d+)?)/i);\n\tif (match === null || match[1] === void 0) throw new CliStructuredError(\"CLI.INIT_PROBE_FAILED\", `Could not parse PostgreSQL version from \\`${versionString}\\``);\n\treturn match[1];\n}\nasync function defaultProbeMongo(databaseUrl, baseDir, overrides) {\n\tconst client = new (requirePeer(\"mongodb\", baseDir, overrides)).MongoClient(databaseUrl);\n\tawait client.connect();\n\ttry {\n\t\tconst buildInfo = await client.db().admin().command({ buildInfo: 1 });\n\t\tconst versionString = String(buildInfo.version ?? \"\");\n\t\tif (versionString.length === 0) throw new CliStructuredError(\"CLI.INIT_PROBE_FAILED\", \"buildInfo did not include a `version` field\");\n\t\treturn { serverVersion: versionString };\n\t} finally {\n\t\tawait client.close().catch(() => void 0);\n\t}\n}\n/**\n* Loads a peer driver (`pg` / `mongodb`) from the user's project\n* `node_modules`. We deliberately resolve from `baseDir` rather than\n* from the CLI bundle — the CLI does not depend on `pg` or `mongodb`\n* directly, but the user's `init`-generated `package.json` does (via\n* the target facade). Failure to resolve is folded into a typed\n* `DriverMissingError` so `probeServerVersion` can map it to a\n* `driver-missing` outcome rather than letting a `MODULE_NOT_FOUND`\n* leak as a generic connection failure.\n*/\nfunction requirePeer(moduleId, baseDir, overrides) {\n\ttry {\n\t\tif (overrides.requireFromBaseDir !== void 0) return overrides.requireFromBaseDir(baseDir, moduleId);\n\t\treturn createRequire(join(baseDir, \"package.json\"))(moduleId);\n\t} catch (err) {\n\t\tthrow new DriverMissingError(`\\`${moduleId}\\` is not installed in this project (resolved from ${baseDir}; cause: ${causeMessage$1(err)})`);\n\t}\n}\n//#endregion\n//#region src/commands/init/reinit-cleanup.ts\n/**\n* Filenames the contract pipeline emits next to the user's schema source\n* (`<schemaDir>/contract.json`, `<schemaDir>/contract.d.ts`, …). Mirrors\n* the schema-dir-relative `ARTIFACT_FILENAMES` in `hygiene-gitattributes.ts`\n* (not that file's migrations-root-anchored store lines, which are outside\n* this command's scope — reinit only ever touches `schemaDir`); kept as a\n* separate constant here because the cleanup contract is target-agnostic\n* and we deliberately do not want a stale artifact from a previous target\n* lingering after a re-init.\n*\n* If a future emit pipeline produces an additional schema-dir artifact,\n* add it here **and** to `ARTIFACT_FILENAMES` in `hygiene-gitattributes.ts`\n* — the two stay in lockstep so the file `init` advertises as\n* `linguist-generated` is exactly the file `init` is willing to delete on\n* re-init.\n*/\nconst ARTIFACT_FILENAMES = [\n\t\"contract.json\",\n\t\"contract.d.ts\",\n\t\"ops.json\",\n\t\"migration.json\"\n];\n/**\n* Returns the schema-relative paths of stale contract artifacts the\n* previous `init` run (or a `contract emit`) left behind in `schemaDir`.\n* Paths are returned relative to `baseDir` so the caller can plumb them\n* into `filesWritten`-style logging without re-deriving the path.\n*\n* Pure function: no filesystem mutation. Used by `runInit`'s precondition\n* phase (FR6.2 / NFR3 atomicity) so a downstream parse failure leaves\n* the artifacts on disk and the project byte-identical to its pre-init\n* state.\n*/\nfunction findStaleArtifacts(baseDir, schemaDir) {\n\tconst result = [];\n\tfor (const filename of ARTIFACT_FILENAMES) {\n\t\tconst rel = join(schemaDir, filename);\n\t\tif (existsSync(join(baseDir, rel))) result.push(rel);\n\t}\n\treturn result;\n}\n/**\n* Drops a single key from `package.json#dependencies`, returning the new\n* file content. Returns `null` when the dependency was already absent —\n* the caller can skip the write to keep re-init idempotent (FR9.3).\n*\n* Used by `runInit` for the FR9.2 target-switch path: when the user\n* re-inits a project from `--target postgres` to `--target mongodb` (or\n* vice versa), the previous facade is removed from `dependencies` so the\n* resulting project depends only on the chosen target's facade.\n*\n* Devs/peers/optional dep groups are intentionally *not* touched — the\n* facades are only ever in `dependencies` (FR4 / FR7), and broadening\n* the search would risk clobbering an unrelated dep with the same name\n* in `peerDependencies`.\n*\n* Throws `SyntaxError` if `existing` is not parseable as JSON; the\n* caller (`runInit`) already guards on that with a structured 5010\n* error before this helper is reached.\n*/\nfunction removeDependency(existing, depName) {\n\tconst parsed = JSON.parse(existing);\n\tconst deps = parsed[\"dependencies\"];\n\tif (deps === null || typeof deps !== \"object\" || Array.isArray(deps)) return null;\n\tif (!Object.hasOwn(deps, depName)) return null;\n\tconst next = { ...deps };\n\tdelete next[depName];\n\tparsed[\"dependencies\"] = next;\n\tconst trailingNewline = existing.endsWith(\"\\n\") ? \"\\n\" : \"\";\n\treturn `${JSON.stringify(parsed, null, 2)}${trailingNewline}`;\n}\n//#endregion\n//#region src/commands/init/skill-install.ts\nconst exec = promisify(execFile);\n/**\n* Default base for the GitHub-URL form `<owner>/<repo>` consumed by\n* upstream `skills add`. Each `SkillSource` joins this base with its\n* own subpath (and optional `#ref` for version-pinned clusters).\n*/\nconst DEFAULT_SKILL_BASE = \"prisma/prisma\";\nconst DEFAULT_SKILL_SOURCES = [\n\t{\n\t\tsubpath: \"skills\",\n\t\tskill: \"prisma-8\",\n\t\tref: \"cli\",\n\t\tdescription: \"usage skill (version-locked to installed Prisma Next)\"\n\t},\n\t{\n\t\tsubpath: \"skills\",\n\t\tskill: \"prisma-next-upgrade\",\n\t\tref: null,\n\t\tdescription: \"upgrade skill (always tracks `main`)\"\n\t},\n\t{\n\t\tsubpath: \"skills\",\n\t\tskill: \"prisma-8-extension-upgrade\",\n\t\tref: null,\n\t\tdescription: \"extension-author upgrade skill (always tracks `main`)\"\n\t}\n];\n/**\n* Test-only escape hatch for pinning the install base to a local\n* checkout. Production runs leave this unset, so installs always use\n* `DEFAULT_SKILL_BASE`.\n*\n* When set to an absolute filesystem path (typical for tests), the\n* `#ref` fragment is dropped — local-path mode in upstream's CLI does\n* not accept refs, and the local clone has whatever content the test\n* checked into it anyway. When set to anything else (e.g. a fork name\n* `myuser/prisma-next`), the ref policy is preserved.\n*/\nfunction resolveAgentSkillBase() {\n\tconst override = process.env[\"PRISMA_NEXT_SKILLS_BASE\"]?.trim();\n\treturn override && override.length > 0 ? override : DEFAULT_SKILL_BASE;\n}\nfunction isLocalPath(base) {\n\treturn base.startsWith(\"/\") || /^[a-zA-Z]:[\\\\/]/.test(base);\n}\n/**\n* Agents passed to every project-level init install. Upstream `skills add`\n* is the source of truth for per-agent install behaviour; the CLI lists\n* every supported runtime on one invocation and delegates the rest.\n*/\nconst DEFAULT_SKILL_AGENTS = [\n\t\"cursor\",\n\t\"claude-code\",\n\t\"codex\",\n\t\"windsurf\"\n];\n/**\n* Build the `<base>/<subpath>[#ref]` URL the `skills` CLI will\n* resolve. Exported for unit tests so the per-source format can be\n* asserted without going through the full install loop.\n*/\nfunction formatSkillSourceUrl(source) {\n\tconst base = resolveAgentSkillBase();\n\tconst url = `${base}/${source.subpath}`;\n\tif (source.ref === null) return url;\n\tif (isLocalPath(base)) return url;\n\tif (source.ref === \"cli\") return `${url}#v${version}`;\n\treturn url;\n}\n/**\n* The skill-install command for one source, formatted for the\n* project's detected package manager. `npx`/`pnpm dlx`/`bunx` are\n* interchangeable to the user; we pick the variant that matches the\n* rest of the install step so a single project consistently uses one\n* runner.\n*\n* `--agent` takes space-separated slugs on one flag; the explicit\n* `--skill <name>` and `-y` skip the multi-select prompts a\n* non-interactive scaffold step cannot show.\n*\n* Exported for unit tests so the per-PM dispatch can be asserted\n* without a live subprocess.\n*/\nfunction formatSkillInstallCommand(args) {\n\tconst agents = args.agents ?? DEFAULT_SKILL_AGENTS;\n\tconst cliArgs = [\n\t\t\"skills@latest\",\n\t\t\"add\",\n\t\tformatSkillSourceUrl(args.source),\n\t\t\"--agent\",\n\t\t...agents,\n\t\t\"--skill\",\n\t\targs.source.skill,\n\t\t\"-y\"\n\t];\n\treturn formatPackageManagerCommand(args.pm, cliArgs);\n}\n/**\n* Ordered skill-install commands for one init run. Exported for unit tests.\n*/\nfunction resolveProjectSkillInstallCommands(pm) {\n\treturn DEFAULT_SKILL_SOURCES.map((source) => formatSkillInstallCommand({\n\t\tpm,\n\t\tsource\n\t}));\n}\nfunction formatPackageManagerCommand(pm, args) {\n\tswitch (pm) {\n\t\tcase \"pnpm\": return `pnpm dlx ${args.join(\" \")}`;\n\t\tcase \"yarn\": return `yarn dlx ${args.join(\" \")}`;\n\t\tcase \"bun\": return `bunx ${args.join(\" \")}`;\n\t\tcase \"deno\": return `deno run -A npm:${args.join(\" \")}`;\n\t\tcase \"npm\": return `npx ${args.join(\" \")}`;\n\t}\n}\n/**\n* Parse the project-pm-formatted command into an exec call. The\n* format-then-parse split keeps the user-facing command string the same\n* as the surface the structured error advertises, so a user who copies\n* the error's `fix` line gets the same invocation that init just\n* attempted. Single-quoted tokens are preserved in the display form so\n* shell-sensitive characters stay copy-safe, then stripped before\n* `execFile`.\n*/\nfunction commandToExec(command) {\n\tconst tokens = (command.match(/'[^']*'|\\S+/g) ?? []).map((token) => token.startsWith(\"'\") && token.endsWith(\"'\") ? token.slice(1, -1) : token);\n\treturn {\n\t\tfile: tokens[0] ?? \"npx\",\n\t\targs: tokens.slice(1)\n\t};\n}\n/**\n* Runs the project-level skill install for every source in\n* `DEFAULT_SKILL_SOURCES`, in order. Returns\n* `{ ok: true, commands }` on success; throws a structured\n* `errorInitSkillInstallFailed` on the first failure (subsequent\n* sources are not attempted — the user opted into Prisma Next by\n* running `init` and a partial install would leave the project in an\n* ambiguous state). The throw is intentionally fatal — project-level\n* skill install is unconditional (modulo `--no-skill`).\n*/\nasync function runProjectLevelSkillInstall(ctx) {\n\tconst commands = [];\n\tconst installCommands = resolveProjectSkillInstallCommands(ctx.pm);\n\tfor (const command of installCommands) {\n\t\tconst { file, args } = commandToExec(command);\n\t\ttry {\n\t\t\tawait exec(file, args, { cwd: ctx.baseDir });\n\t\t\tcommands.push(command);\n\t\t} catch (err) {\n\t\t\tthrow errorInitSkillInstallFailed({\n\t\t\t\tskillInstallCommand: command,\n\t\t\t\tfilesWritten: ctx.filesWritten,\n\t\t\t\tcause: redactSecrets$1(readChildStderr$1(err)) || (err instanceof Error ? err.message : String(err))\n\t\t\t});\n\t\t}\n\t}\n\treturn {\n\t\tok: true,\n\t\tcommands\n\t};\n}\nfunction readChildStderr$1(err) {\n\tif (err instanceof Error && \"stderr\" in err) return String(err.stderr ?? \"\");\n\treturn \"\";\n}\n/**\n* Strips credentials from a `scheme://user:pass@host/...` URL anywhere\n* in `stderr`. Package-manager stderr regularly contains credentialed\n* registry URLs (private npm registries, GitHub Packages tokens), and\n* those bubble into the structured `errorInitSkillInstallFailed`\n* envelope, which ends up in logs and CI output. Redact at the\n* boundary so we never re-emit a secret.\n*\n* Exported for unit tests.\n*/\nfunction redactSecrets$1(stderr) {\n\tif (!stderr) return stderr;\n\treturn stderr.replace(/([a-zA-Z][a-zA-Z0-9+.-]*:\\/\\/)([^/@\\s]+)@/g, \"$1***@\");\n}\n/**\n* Skill directories that predate the consolidated `prisma-8` skill:\n* the per-workflow usage cluster (including the renamed\n* `prisma-8-migration-review` spelling it briefly shipped under), the\n* pre-rename spellings of the consolidated skill and the\n* extension-author upgrade skill, and any hand-rolled `prisma-next`\n* stub. Projects initialised before the consolidation carry these as\n* sibling directories in each agent's install root; left in place\n* they compete with the current skills for activation, so init\n* removes them on every run.\n*/\nconst RETIRED_SKILL_NAMES = [\n\t\"prisma-next\",\n\t\"prisma-next-quickstart\",\n\t\"prisma-next-contract\",\n\t\"prisma-next-migrations\",\n\t\"prisma-next-migration-review\",\n\t\"prisma-8-migration-review\",\n\t\"prisma-next-queries\",\n\t\"prisma-next-runtime\",\n\t\"prisma-next-build\",\n\t\"prisma-next-supabase\",\n\t\"prisma-next-debug\",\n\t\"prisma-next-feedback\",\n\t\"prisma-next-extension-upgrade\"\n];\n/**\n* Project-level install roots the upstream `skills` CLI uses for the\n* agents in `DEFAULT_SKILL_AGENTS`: cursor and codex install into\n* `.agents/skills`, claude-code into `.claude/skills`, windsurf into\n* `.windsurf/skills`.\n*/\nconst AGENT_SKILL_ROOTS = [\n\t\".agents/skills\",\n\t\".claude/skills\",\n\t\".windsurf/skills\"\n];\n/**\n* Every directory a retired per-workflow skill may occupy in a\n* consumer project. Init deletes each (recursively) before running the\n* skill install.\n*/\nfunction legacySkillDirs() {\n\treturn AGENT_SKILL_ROOTS.flatMap((root) => RETIRED_SKILL_NAMES.map((name) => `${root}/${name}`));\n}\n//#endregion\n//#region src/commands/init/templates/env.ts\n/**\n* The minimum supported server version for each target. The\n* authoritative source of truth is each target package's\n* `package.json#prismaNext.minServerVersion` field — this module\n* mirrors those values and a workspace-level test asserts the two\n* never drift (`templates/tsconfig-env.test.ts`).\n*\n* Bumping a value here in isolation is **not** safe: edit the\n* corresponding target package's `package.json` first, then mirror\n* here. The scaffold's `.env.example` and the \"Requirements\" section\n* of `prisma-next.md` both read from this constant, so a stale value\n* lies to every freshly initialised user.\n*/\nconst MIN_SERVER_VERSION = {\n\tpostgres: \"17\",\n\tmongo: \"8.0\"\n};\nconst TARGET_LABEL = {\n\tpostgres: \"PostgreSQL\",\n\tmongo: \"MongoDB\"\n};\n/**\n* Renders the placeholder body shared by `.env` and `.env.example`:\n* the target-specific connection-string requirement comments and the\n* commented-shape `DATABASE_URL` line. The output is identical for both\n* authoring styles — the env file is orthogonal to PSL vs TS schema\n* authoring.\n*/\nfunction envPlaceholderBody(target) {\n\tconst label = TARGET_LABEL[target];\n\tconst minVersion = MIN_SERVER_VERSION[target];\n\tconst lines = [];\n\tlines.push(`# Connection string for ${label}.`);\n\tlines.push(`# Requires ${label} >= ${minVersion}.`);\n\tlines.push(\"\");\n\tif (target === \"postgres\") lines.push(\"DATABASE_URL=\\\"postgresql://user:password@localhost:5432/mydb\\\"\");\n\telse {\n\t\tlines.push(\"# Standalone local mongod / `docker run mongo:8` — no replica set required for first-run queries.\");\n\t\tlines.push(\"# Transactions and change streams need a replica set; add ?replicaSet=... only after initiating one.\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"DATABASE_URL=\\\"mongodb://user:password@localhost:27017/mydb\\\"\");\n\t}\n\tlines.push(\"\");\n\treturn lines.join(\"\\n\");\n}\n/**\n* Renders the `.env.example` content for a given target:\n*\n* - Carries a \"Copy this file to `.env`…\" intro that only makes sense\n* for the example file (the real `.env` is the destination of that\n* copy and so does not get the same intro).\n* - Documents the `DATABASE_URL` placeholder in the target's native URL\n* shape (Postgres: standard `postgresql://`, Mongo: `mongodb://` plus\n* a `mydb` database segment so the lazy facade has a `dbName`).\n* - Carries a `# Requires <db> >= <version>` comment so a fresh user\n* knows the minimum supported server before they first try to connect.\n*/\nfunction envExampleContent(target) {\n\tconst lines = [];\n\tlines.push(\"# Copy this file to `.env` and replace the placeholder with your real connection string.\");\n\tlines.push(envPlaceholderBody(target));\n\treturn lines.join(\"\\n\");\n}\n/**\n* Renders the initial `.env` content for `--write-env` / interactive\n* opt-in. Same placeholder body as `.env.example`, **without** the\n* example file's \"Copy this file to `.env`…\" intro: the real `.env` is\n* the destination of that copy, so the line would lie. Writing this\n* file is gitignored (`.env` lands in `.gitignore` during init).\n*/\nfunction envFileContent(target) {\n\treturn envPlaceholderBody(target);\n}\n//#endregion\n//#region src/commands/init/templates/render.ts\nfunction renderTemplate(templateFile, variableNames, vars) {\n\tlet result = readFileSync(join(import.meta.dirname, templateFile), \"utf-8\");\n\tfor (const key of variableNames) {\n\t\tconst value = vars[key];\n\t\tif (value === void 0) throw new InternalError(`Template variable '${key}' is not defined`);\n\t\tresult = result.replaceAll(`{{${key}}}`, value);\n\t}\n\treturn result;\n}\n//#endregion\n//#region src/commands/init/templates/quick-reference.ts\nconst variables = [\n\t\"schemaPath\",\n\t\"schemaDir\",\n\t\"dbImportPath\",\n\t\"pkgRun\",\n\t\"pkg\",\n\t\"configEntrypoint\",\n\t\"schemaSample\",\n\t\"requirements\"\n];\nfunction quickReferenceMd(target, authoring, schemaPath, pkgRun, resolveImportSpecifier = keepInternalSpecifiers) {\n\tconst schemaDir = dirname(schemaPath);\n\tconst pkg = targetPackageName(target, resolveImportSpecifier);\n\tconst vars = {\n\t\tschemaPath,\n\t\tschemaDir,\n\t\tdbImportPath: `./${schemaDir}/db`,\n\t\tpkgRun,\n\t\tpkg,\n\t\tconfigEntrypoint: targetEntrypoint(target, \"config\", resolveImportSpecifier),\n\t\tschemaSample: schemaSample(target, authoring, resolveImportSpecifier),\n\t\trequirements: requirementsBlock(target)\n\t};\n\treturn renderTemplate(`quick-reference-${target}.md`, variables, vars);\n}\n/**\n* Renders the FR8.2 \"Requirements\" block injected into `prisma-next.md`\n* (the user-facing quick reference). Sources the minimum server\n* version from `MIN_SERVER_VERSION` — itself mirrored from each\n* target package's `package.json#prismaNext.minServerVersion`\n* (FR8.1).\n*\n* The verification command is target-specific — Postgres scaffolds\n* shouldn't ship Mongo's `db.runCommand` (and vice versa) just because\n* we couldn't be bothered to branch.\n*/\nfunction requirementsBlock(target) {\n\treturn [\n\t\t\"## Requirements\",\n\t\t\"\",\n\t\t`- **${TARGET_LABEL[target]} ${MIN_SERVER_VERSION[target]} or newer.** Older servers are not supported. Run ${target === \"postgres\" ? \"`SELECT version()`\" : \"`db.runCommand({ buildInfo: 1 })`\"} against your server to verify.`,\n\t\t\"- The CLI never connects to your database without explicit consent. Pass `--probe-db` to `prisma-next init` if you want `init` to verify the server version itself.\"\n\t].join(\"\\n\");\n}\n//#endregion\n//#region src/commands/init/templates/readme.ts\nconst sharedVariables = [\n\t\"projectName\",\n\t\"contractPath\",\n\t\"runDev\",\n\t\"runContractEmit\"\n];\nconst postgresVariables = [\n\t...sharedVariables,\n\t\"runDbInit\",\n\t\"runDbUpdate\",\n\t\"runMigrationPlan\",\n\t\"runMigrate\",\n\t\"runDbSeed\"\n];\nconst mongoVariables = [\n\t...sharedVariables,\n\t\"runDbUp\",\n\t\"runDbDown\",\n\t\"runDbReset\",\n\t\"runMigrationPlan\",\n\t\"runMigrate\",\n\t\"runDbSeed\"\n];\nfunction minimalProjectReadmeMd(target, schemaPath, projectName, pm) {\n\tconst run = (script) => formatRunScriptCommand(pm, script);\n\tconst shared = {\n\t\tprojectName,\n\t\tcontractPath: schemaPath,\n\t\trunDev: run(\"dev\"),\n\t\trunContractEmit: run(\"contract:emit\"),\n\t\trunMigrationPlan: run(\"migration:plan\"),\n\t\trunMigrate: run(\"migrate\"),\n\t\trunDbSeed: run(\"db:seed\")\n\t};\n\tif (target === \"mongo\") {\n\t\tconst vars = {\n\t\t\t...shared,\n\t\t\trunDbUp: run(\"db:up\"),\n\t\t\trunDbDown: run(\"db:down\"),\n\t\t\trunDbReset: run(\"db:reset\")\n\t\t};\n\t\treturn renderTemplate(\"readme-mongo.md\", mongoVariables, vars);\n\t}\n\tconst vars = {\n\t\t...shared,\n\t\trunDbInit: run(\"db:init\"),\n\t\trunDbUpdate: run(\"db:update\")\n\t};\n\treturn renderTemplate(\"readme-postgres.md\", postgresVariables, vars);\n}\n//#endregion\n//#region src/commands/init/templates/tsconfig.ts\n/**\n* Compiler options the scaffolded `prisma-next.config.ts` and `db.ts` need\n* to typecheck:\n*\n* - `module: 'preserve'` + `moduleResolution: 'bundler'` align with how\n* modern bundlers (and `tsdown`) consume our facade packages.\n* - `resolveJsonModule` lets `db.ts` import `contract.json with { type:\n* 'json' }` — the runtime path the facades document (FR4).\n*\n* `types: ['node']` is FR2.2 territory and lives in\n* `REQUIRED_COMPILER_OPTIONS_TYPES` because TS only honours an _array_\n* here, and a string-keyed merge would clobber any user-specified entries.\n* Merge handling preserves any extra `types` the user added.\n*/\nconst REQUIRED_COMPILER_OPTIONS = {\n\tmodule: \"preserve\",\n\tmoduleResolution: \"bundler\",\n\tresolveJsonModule: true\n};\n/**\n* Types that must be present in `compilerOptions.types` for the scaffold\n* to typecheck. With `moduleResolution: 'bundler'`, TypeScript does not\n* implicitly include all `@types/*` packages — `process.env` only resolves\n* when `node` is in this array (or `types` is omitted, but then any other\n* type listed here would force the same behaviour). Listing `node`\n* explicitly is the documented escape hatch (FR2.2).\n*/\nconst REQUIRED_COMPILER_OPTIONS_TYPES = [\"node\"];\nfunction defaultTsConfig() {\n\treturn JSON.stringify({\n\t\tcompilerOptions: {\n\t\t\ttarget: \"ES2022\",\n\t\t\t...REQUIRED_COMPILER_OPTIONS,\n\t\t\ttypes: [...REQUIRED_COMPILER_OPTIONS_TYPES],\n\t\t\tstrict: true,\n\t\t\tskipLibCheck: true,\n\t\t\tesModuleInterop: true,\n\t\t\toutDir: \"dist\"\n\t\t},\n\t\tinclude: [\"**/*.ts\"]\n\t}, null, 2);\n}\n/**\n* Thrown by `mergeTsConfig` when the user's existing `tsconfig.json` is\n* not parseable as JSONC (TypeScript's actual configured dialect — see\n* FR6.1). Carries the raw parse errors so the caller can render an\n* actionable, location-aware message.\n*\n* `runInit` catches this exception during the precondition phase and\n* maps it to a `CliStructuredError(5011)` so the user's working tree\n* stays byte-identical when init bails (FR6.2 / NFR3).\n*/\nvar TsConfigParseError = class extends Error {\n\terrors;\n\tconstructor(errors) {\n\t\tsuper(formatTsConfigParseErrors(errors));\n\t\tthis.errors = errors;\n\t\tthis.name = \"TsConfigParseError\";\n\t}\n};\nfunction formatTsConfigParseErrors(errors) {\n\tif (errors.length === 0) return \"tsconfig.json is empty or not an object\";\n\treturn errors.map((e) => `${printParseErrorCode(e.error)} at offset ${e.offset}`).join(\"; \");\n}\n/**\n* Merges the required compiler options into an existing `tsconfig.json`.\n*\n* Parsing is delegated to `jsonc-parser` so JSONC inputs (comments,\n* trailing commas) — TypeScript's real configuration dialect — survive\n* unchanged: edits are applied as text patches via `modify` /\n* `applyEdits`, preserving the user's formatting, key ordering, and\n* comments wherever the touched paths permit (FR6.1, AC \"Hostile\n* inputs\").\n*\n* Throws `TsConfigParseError` when the input is not parseable as JSONC.\n* The caller must catch this and surface a structured error before\n* writing any scaffold files (FR6.2 atomicity).\n*/\nfunction mergeTsConfig(existing) {\n\tconst { config } = parseTsConfigText(existing);\n\tconst formattingOptions = {\n\t\ttabSize: detectIndent(existing),\n\t\tinsertSpaces: true,\n\t\teol: existing.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\"\n\t};\n\tlet result = existing;\n\tfor (const [key, value] of Object.entries(REQUIRED_COMPILER_OPTIONS)) {\n\t\tconst edits = modify(result, [\"compilerOptions\", key], value, { formattingOptions });\n\t\tresult = applyEdits(result, edits);\n\t}\n\tconst existingTypes = config[\"compilerOptions\"]?.[\"types\"];\n\tconst mergedTypes = mergeTypesArray(existingTypes);\n\tconst typesEdits = modify(result, [\"compilerOptions\", \"types\"], mergedTypes, { formattingOptions });\n\tresult = applyEdits(result, typesEdits);\n\treturn result;\n}\n/**\n* Parses an existing `tsconfig.json` (JSONC) and returns the structured\n* config alongside any non-fatal parse warnings. Throws\n* `TsConfigParseError` if the input cannot be parsed at all or does\n* not resolve to a JSON object — both cases mean we cannot safely\n* apply edits.\n*\n* Exposed independently so callers (notably `runInit`'s precondition\n* gate) can validate the file *before* any scaffold file is written.\n*/\nfunction parseTsConfigText(text) {\n\tconst errors = [];\n\tconst value = parse(text, errors, {\n\t\tallowTrailingComma: true,\n\t\tdisallowComments: false,\n\t\tallowEmptyContent: false\n\t});\n\tif (value === void 0 || value === null || typeof value !== \"object\" || Array.isArray(value)) throw new TsConfigParseError(errors);\n\tif (errors.length > 0) throw new TsConfigParseError(errors);\n\treturn { config: value };\n}\nfunction detectIndent(text) {\n\tconst match = text.match(/^([ \\t]+)\\S/m);\n\tif (match === null) return 2;\n\tconst indent = match[1] ?? \"\";\n\tif (indent.startsWith(\"\t\")) return 1;\n\treturn indent.length || 2;\n}\n/**\n* Merges `REQUIRED_COMPILER_OPTIONS_TYPES` into the user's existing\n* `compilerOptions.types` array. Preserves order and dedupes. If the\n* user has no `types` array (or has set it to a non-array), we replace\n* with the required minimum — overwriting a non-array `types` is the\n* correct fix because anything other than a string array is invalid TS\n* config.\n*/\nfunction mergeTypesArray(existing) {\n\tconst result = [];\n\tif (Array.isArray(existing)) {\n\t\tfor (const item of existing) if (typeof item === \"string\" && !result.includes(item)) result.push(item);\n\t}\n\tfor (const required of REQUIRED_COMPILER_OPTIONS_TYPES) if (!result.includes(required)) result.push(required);\n\treturn result;\n}\n//#endregion\n//#region src/commands/init/init.ts\n/**\n* Runs the `init` command end-to-end and returns the exit code. Catches\n* structured CLI errors raised at every phase (input resolution, install,\n* emit) and renders them via the same UI surface as success output\n* (`--json` to stdout, human to stderr). Exit codes follow the documented\n* stable set in `./exit-codes.ts` and the\n* [Style Guide § Exit Codes](../../../../../../../docs/CLI%20Style%20Guide.md#exit-codes).\n*\n* Layered for testability: the action handler in `./index.ts` is\n* responsible for parsing flags and constructing `runOptions`; this\n* function does no flag parsing of its own.\n*/\nasync function runInit(baseDir, runOptions) {\n\tconst { options, flags, canPrompt, probeOverrides } = runOptions;\n\tconst ui = createTerminalUI(flags);\n\tconst warnings = [];\n\tconst filesWritten = [];\n\tconst filesDeleted = [];\n\tif (!flags.json && !flags.quiet) clack.intro(\"prisma-next init\", { output: process.stderr });\n\tlet inputs;\n\ttry {\n\t\tinputs = await resolveInitInputs({\n\t\t\tbaseDir,\n\t\t\toptions,\n\t\t\tflags,\n\t\t\tcanPrompt\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError$1.is(error)) return emitError(ui, flags, error);\n\t\tthrow error;\n\t}\n\tconst pm = await detectPackageManager(baseDir);\n\tconst pkgRun = formatRunCommand(pm, \"prisma-next\", \"\").trimEnd();\n\tconst schemaDir = dirname(inputs.schemaPath);\n\tconst configContractPath = isAbsolute(inputs.schemaPath) ? inputs.schemaPath : `./${inputs.schemaPath}`;\n\tconst resolveImportSpecifier = scaffoldSpecifierResolverFor(inputs.target);\n\tconst filesToWrite = [\n\t\t{\n\t\t\tpath: inputs.schemaPath,\n\t\t\tcontent: starterSchema(inputs.target, inputs.authoring, resolveImportSpecifier)\n\t\t},\n\t\t{\n\t\t\tpath: \"prisma-next.config.ts\",\n\t\t\tcontent: configFile(inputs.target, configContractPath, resolveImportSpecifier)\n\t\t},\n\t\t{\n\t\t\tpath: join(schemaDir, \"db.ts\"),\n\t\t\tcontent: dbFile(inputs.target, resolveImportSpecifier)\n\t\t},\n\t\t{\n\t\t\tpath: \"prisma-next.md\",\n\t\t\tcontent: quickReferenceMd(inputs.target, inputs.authoring, inputs.schemaPath, pkgRun, resolveImportSpecifier)\n\t\t},\n\t\t{\n\t\t\tpath: \".env.example\",\n\t\t\tcontent: envExampleContent(inputs.target)\n\t\t}\n\t];\n\tconst filesToDelete = inputs.reinit ? [...findStaleArtifacts(baseDir, schemaDir)] : [];\n\tconst legacyDirsToDelete = legacySkillDirs().filter((rel) => existsSync(join(baseDir, rel)));\n\tif (inputs.writeEnv) if (!existsSync(join(baseDir, \".env\"))) filesToWrite.push({\n\t\tpath: \".env\",\n\t\tcontent: envFileContent(inputs.target)\n\t});\n\telse warnings.push(\".env already exists; leaving it untouched. Compare with .env.example for any new keys.\");\n\tconst tsconfigPath = join(baseDir, \"tsconfig.json\");\n\tif (existsSync(tsconfigPath)) {\n\t\tconst existing = readFileSync(tsconfigPath, \"utf-8\");\n\t\tlet merged;\n\t\ttry {\n\t\t\tmerged = mergeTsConfig(existing);\n\t\t} catch (err) {\n\t\t\tif (err instanceof TsConfigParseError) return emitError(ui, flags, errorInitInvalidTsconfig({\n\t\t\t\tpath: \"tsconfig.json\",\n\t\t\t\tcause: err.message\n\t\t\t}));\n\t\t\tthrow err;\n\t\t}\n\t\tfilesToWrite.push({\n\t\t\tpath: \"tsconfig.json\",\n\t\t\tcontent: merged,\n\t\t\tlogMessage: \"Updated tsconfig.json with required compiler options.\"\n\t\t});\n\t} else filesToWrite.push({\n\t\tpath: \"tsconfig.json\",\n\t\tcontent: defaultTsConfig()\n\t});\n\tconst gitignorePath = join(baseDir, \".gitignore\");\n\tconst newGitignore = mergeGitignore(existsSync(gitignorePath) ? readFileSync(gitignorePath, \"utf-8\") : void 0);\n\tif (newGitignore !== null) filesToWrite.push({\n\t\tpath: \".gitignore\",\n\t\tcontent: newGitignore\n\t});\n\tconst gitattributesPath = join(baseDir, \".gitattributes\");\n\tconst newGitattributes = mergeGitattributes(existsSync(gitattributesPath) ? readFileSync(gitattributesPath, \"utf-8\") : void 0, requiredGitattributesLines(schemaDir, inputs.target));\n\tif (newGitattributes !== null) filesToWrite.push({\n\t\tpath: \".gitattributes\",\n\t\tcontent: newGitattributes\n\t});\n\tconst packageJsonPath = join(baseDir, \"package.json\");\n\tconst packageJsonExisted = existsSync(packageJsonPath);\n\tconst synthesisePackageJson = !packageJsonExisted && !hasProjectManifest(baseDir);\n\tlet parsedPackageJson = null;\n\tif (packageJsonExisted || synthesisePackageJson) {\n\t\tconst pkgRaw = packageJsonExisted ? readFileSync(packageJsonPath, \"utf-8\") : defaultPackageJsonContent(basename(baseDir));\n\t\ttry {\n\t\t\tparsedPackageJson = JSON.parse(pkgRaw);\n\t\t} catch (err) {\n\t\t\tif (err instanceof SyntaxError) return emitError(ui, flags, errorInitInvalidManifest({\n\t\t\t\tpath: \"package.json\",\n\t\t\t\tcause: err.message\n\t\t\t}));\n\t\t\tthrow err;\n\t\t}\n\t\tlet workingPkg = pkgRaw;\n\t\tlet pkgChanged = synthesisePackageJson;\n\t\tif (inputs.removePreviousFacade !== null) {\n\t\t\tconst next = removeDependency(workingPkg, inputs.removePreviousFacade);\n\t\t\tif (next !== null) {\n\t\t\t\tworkingPkg = next;\n\t\t\t\tpkgChanged = true;\n\t\t\t}\n\t\t}\n\t\tconst { content: nextPkg, warnings: scriptWarnings } = mergePackageScripts(workingPkg, REQUIRED_SCRIPTS);\n\t\tif (nextPkg !== null) {\n\t\t\tworkingPkg = nextPkg;\n\t\t\tpkgChanged = true;\n\t\t}\n\t\tconst { content: typedPkg, warning: typeWarning } = ensureEsmModuleType(workingPkg);\n\t\tif (typedPkg !== null) {\n\t\t\tworkingPkg = typedPkg;\n\t\t\tpkgChanged = true;\n\t\t}\n\t\tif (pkgChanged) filesToWrite.push({\n\t\t\tpath: \"package.json\",\n\t\t\tcontent: workingPkg\n\t\t});\n\t\twarnings.push(...scriptWarnings);\n\t\tif (typeWarning !== null) warnings.push(typeWarning);\n\t\tif (synthesisePackageJson) warnings.push(\"No package.json found in the target directory; created a minimal one. Edit `name` / `version` to taste.\");\n\t}\n\tif (existsSync(join(baseDir, \"src/index.ts\"))) if (!existsSync(join(baseDir, \"README.md\"))) {\n\t\tconst rawName = parsedPackageJson !== null && typeof parsedPackageJson[\"name\"] === \"string\" ? parsedPackageJson[\"name\"] : basename(baseDir);\n\t\tfilesToWrite.push({\n\t\t\tpath: \"README.md\",\n\t\t\tcontent: minimalProjectReadmeMd(inputs.target, inputs.schemaPath, sanitisePackageName(rawName), pm)\n\t\t});\n\t} else warnings.push(\"README.md already exists; leaving it untouched.\");\n\tfor (const file of filesToWrite) {\n\t\tconst fullPath = join(baseDir, file.path);\n\t\tmkdirSync(dirname(fullPath), { recursive: true });\n\t\twriteFileSync(fullPath, file.content, \"utf-8\");\n\t\tfilesWritten.push(file.path);\n\t\tif (file.logMessage !== void 0 && !flags.json && !flags.quiet) ui.log(file.logMessage);\n\t}\n\tfor (const rel of filesToDelete) {\n\t\tconst fullPath = join(baseDir, rel);\n\t\tif (!existsSync(fullPath)) continue;\n\t\ttry {\n\t\t\tunlinkSync(fullPath);\n\t\t\tfilesDeleted.push(rel);\n\t\t} catch (err) {\n\t\t\tif (!(err instanceof Error && \"code\" in err && err.code === \"ENOENT\")) throw err;\n\t\t}\n\t}\n\tfor (const rel of legacyDirsToDelete) {\n\t\trmSync(join(baseDir, rel), {\n\t\t\trecursive: true,\n\t\t\tforce: true\n\t\t});\n\t\tfilesDeleted.push(rel);\n\t}\n\tconst emitCommand = formatRunCommand(pm, \"prisma-next\", \"contract emit\");\n\tlet install;\n\ttry {\n\t\tinstall = await runInstall({\n\t\t\tbaseDir,\n\t\t\tpm,\n\t\t\ttarget: inputs.target,\n\t\t\tinstall: inputs.install,\n\t\t\tflags,\n\t\t\tui,\n\t\t\tfilesWritten,\n\t\t\tresolveImportSpecifier,\n\t\t\thasTypesNode: parsedPackageJson !== null ? hasDirectDep(parsedPackageJson, \"@types/node\") : false\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError$1.is(error)) return emitError(ui, flags, error);\n\t\tthrow error;\n\t}\n\twarnings.push(...install.warnings);\n\tlet contractEmitted = false;\n\tif (!install.skipped) try {\n\t\tawait runEmit({\n\t\t\tbaseDir,\n\t\t\tui,\n\t\t\tfilesWritten,\n\t\t\temitCommand\n\t\t});\n\t\tcontractEmitted = true;\n\t} catch (error) {\n\t\tif (CliStructuredError$1.is(error)) return emitError(ui, flags, error);\n\t\tthrow error;\n\t}\n\tif (inputs.probeDb) {\n\t\tconst escalated = applyProbeOutcome(await probeServerVersion({\n\t\t\tbaseDir,\n\t\t\ttarget: inputs.target,\n\t\t\tdatabaseUrl: process.env[\"DATABASE_URL\"],\n\t\t\tminVersion: MIN_SERVER_VERSION[inputs.target]\n\t\t}, probeOverrides ?? {}), {\n\t\t\tstrictProbe: inputs.strictProbe,\n\t\t\twarnings\n\t\t});\n\t\tif (escalated !== null) return emitError(ui, flags, errorInitProbeFailed({\n\t\t\tcause: escalated,\n\t\t\tfilesWritten\n\t\t}));\n\t}\n\tconst manualProjectSkillSummary = DEFAULT_SKILL_SOURCES.map((source) => formatSkillInstallCommand({\n\t\tpm: install.effectivePm,\n\t\tsource\n\t})).map((c) => `\\`${c}\\``).join(\" && \");\n\tlet skillRegistered = false;\n\tif (!inputs.installProjectSkill) warnings.push(`Skipped Prisma Next skills install (--no-skill). To install the skills later, run: ${manualProjectSkillSummary}`);\n\telse {\n\t\tconst spinner = ui.spinner();\n\t\tspinner.start(\"Registering Prisma Next skills with the agent runtime...\");\n\t\ttry {\n\t\t\tconst project = await runProjectLevelSkillInstall({\n\t\t\t\tbaseDir,\n\t\t\t\tpm: install.effectivePm,\n\t\t\t\tfilesWritten\n\t\t\t});\n\t\t\tspinner.stop(`Registered Prisma Next skills (project level) — ran ${project.commands.map((c) => `\\`${c}\\``).join(\", \")}`);\n\t\t\tskillRegistered = true;\n\t\t} catch (error) {\n\t\t\tspinner.stop(\"Agent-skill install failed\");\n\t\t\tif (CliStructuredError$1.is(error)) return emitError(ui, flags, error);\n\t\t\tthrow error;\n\t\t}\n\t}\n\tconst output = {\n\t\tok: true,\n\t\ttarget: inputs.target === \"mongo\" ? \"mongodb\" : \"postgres\",\n\t\tauthoring: inputs.authoring,\n\t\tschemaPath: inputs.schemaPath,\n\t\tfilesWritten,\n\t\tfilesDeleted,\n\t\tpackagesInstalled: {\n\t\t\tskipped: install.skipped,\n\t\t\tdeps: [...install.deps],\n\t\t\tdevDeps: [...install.devDeps]\n\t\t},\n\t\tcontractEmitted,\n\t\tnextSteps: buildNextSteps({\n\t\t\ttarget: inputs.target === \"mongo\" ? \"mongodb\" : \"postgres\",\n\t\t\tcontractEmitted,\n\t\t\temitCommand,\n\t\t\tschemaPath: inputs.schemaPath,\n\t\t\tskillRegistered\n\t\t}),\n\t\twarnings\n\t};\n\tconst validated = InitOutputSchema(output);\n\tif (validated instanceof Error || validated.problems !== void 0) return emitError(ui, flags, new CliStructuredError$1(\"CLI.INIT_INVALID_OUTPUT_DOCUMENT\", \"Init produced an invalid output document\", {\n\t\twhy: `The success document failed schema validation: ${String(validated)}`,\n\t\tfix: \"This is a bug in prisma-next. Please report it with the full `-v` output.\",\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_INVALID_OUTPUT_DOCUMENT\")\n\t}));\n\tif (flags.json) ui.output(formatInitJson(output));\n\telse {\n\t\trenderInitOutro(ui, output, flags);\n\t\tif (!flags.quiet) clack.outro(\"Done. Open prisma-next.md to get started.\", { output: process.stderr });\n\t}\n\treturn 0;\n}\n/**\n* Renders a structured CLI error to the right channel and returns the exit\n* code derived from the error's PN code. JSON-mode errors go to stdout\n* (so consumers always parse from one place); human-mode errors go to\n* stderr. Mirrors `handleResult` but returns init-specific exit codes\n* rather than the CLI/RUN binary.\n*/\nfunction emitError(ui, flags, error) {\n\tconst envelope = error.toEnvelope();\n\tif (flags.json) ui.output(formatErrorJson(envelope));\n\telse ui.error(formatErrorOutput(envelope, flags));\n\treturn exitCodeForError(error);\n}\n/**\n* Maps a structured init error to its documented exit code. Centralised so\n* the error → exit-code contract lives next to the codes themselves.\n*\n* `CLI.INIT_INVALID_OUTPUT_DOCUMENT` (and the unknown-code default branch)\n* routes to `INIT_EXIT_INTERNAL_ERROR` because those represent prisma-next\n* bugs the user did not cause — surfacing them as `PRECONDITION` would\n* mislead automation into thinking the caller mis-invoked the CLI.\n*\n* See [exit-codes.ts](./exit-codes.ts) for the canonical list and\n* [Style Guide § Exit Codes](../../../../../../../docs/CLI%20Style%20Guide.md#exit-codes)\n* for the reservation policy.\n*\n* Exported for unit tests so the mapping can be asserted without\n* round-tripping a full `runInit` invocation.\n*/\nfunction exitCodeForError(error) {\n\tswitch (error.code) {\n\t\tcase \"CLI.INIT_REINIT_NEEDS_FORCE\":\n\t\tcase \"CLI.INIT_MISSING_FLAGS\":\n\t\tcase \"CLI.INIT_INVALID_FLAG_VALUE\":\n\t\tcase \"CLI.INIT_STRICT_PROBE_WITHOUT_PROBE\":\n\t\tcase \"CLI.INIT_INVALID_MANIFEST\":\n\t\tcase \"CLI.INIT_INVALID_TSCONFIG\":\n\t\tcase \"CLI.INIT_PROBE_FAILED\":\n\t\tcase \"CLI.INIT_AUTHORING_SCHEMA_PATH_MISMATCH\": return 2;\n\t\tcase \"CLI.INIT_USER_ABORTED\": return 3;\n\t\tcase \"CLI.INIT_INSTALL_FAILED\": return 4;\n\t\tcase \"CLI.INIT_EMIT_FAILED\": return 5;\n\t\tcase \"CLI.INIT_INVALID_OUTPUT_DOCUMENT\": return 1;\n\t\tcase \"CLI.INIT_SKILL_INSTALL_FAILED\": return 6;\n\t\tdefault: return 1;\n\t}\n}\n/**\n* Folds a `ProbeOutcome` into init's warning channel and returns the\n* fatal cause string when `--strict-probe` should escalate. Mirrors\n* the FR8.3 contract:\n*\n* - `ok` — informational; nothing surfaced unless verbose. (We could\n* plumb a `note` here, but the spec only requires the warning side\n* of the contract; an \"all good\" line would just be noise on the\n* common path.)\n* - `below-minimum` — warning regardless of `--strict-probe`. The\n* probe ran successfully and found an old server; that is not a\n* probe *failure* (which is what `--strict-probe` escalates), it\n* is the probe doing its job.\n* - `no-database-url` / `connection-failed` / `driver-missing` —\n* warning by default, fatal under `--strict-probe`.\n*\n* Exported for unit tests so the branching contract can be asserted\n* without spinning up a full `runInit` round trip.\n*/\nfunction applyProbeOutcome(outcome, ctx) {\n\tswitch (outcome.kind) {\n\t\tcase \"ok\": return null;\n\t\tcase \"below-minimum\":\n\t\t\tctx.warnings.push(outcome.message);\n\t\t\treturn null;\n\t\tcase \"no-database-url\":\n\t\tcase \"connection-failed\":\n\t\tcase \"driver-missing\":\n\t\t\tif (ctx.strictProbe) return outcome.message;\n\t\t\tctx.warnings.push(outcome.message);\n\t\t\treturn null;\n\t}\n}\n/**\n* Drives the `pnpm add` / `npm install` step. Failures are escalated to\n* a structured `errorInitInstallFailed` (exit code 4) — the spec treats\n* an unrecoverable install as a hard outcome rather than a warning so\n* CI/agents can branch on the exit code (FR1.6).\n*\n* For pnpm specifically, we additionally implement the FR7.2 fallback:\n* if pnpm fails with a recognised workspace/catalog resolution error\n* class (typically caused by a registry version that leaked\n* `workspace:*` or `catalog:` specifiers), we retry the install using\n* `npm` and surface a non-fatal warning explaining the swap.\n*/\nasync function runInstall(ctx) {\n\tconst { baseDir, pm, target, install, flags, ui, filesWritten, hasTypesNode } = ctx;\n\tconst deps = [targetPackageName(target, ctx.resolveImportSpecifier), \"dotenv\"];\n\tconst devDeps = hasTypesNode ? [\"prisma-next\"] : [\"prisma-next\", \"@types/node\"];\n\tconst addCommand = `${pm} ${formatAddArgs(pm, deps).join(\" \")}`;\n\tconst addDevCommand = `${pm} ${formatAddDevArgs(pm, devDeps).join(\" \")}`;\n\tconst emitCommand = formatRunCommand(pm, \"prisma-next\", \"contract emit\");\n\tconst catalogWarnings = pm === \"pnpm\" ? buildCatalogWarnings(baseDir, [...deps, ...devDeps]) : [];\n\tif (!install) {\n\t\tif (!flags.json && !flags.quiet) ui.note([\n\t\t\t\"Run the following commands to complete setup:\",\n\t\t\t\"\",\n\t\t\t\" 1. Install dependencies:\",\n\t\t\t` ${addCommand}`,\n\t\t\t` ${addDevCommand}`,\n\t\t\t\"\",\n\t\t\t\" 2. Emit the contract:\",\n\t\t\t` ${emitCommand}`\n\t\t].join(\"\\n\"), \"Manual steps\");\n\t\treturn {\n\t\t\tskipped: true,\n\t\t\tdeps: [],\n\t\t\tdevDeps: [],\n\t\t\twarnings: catalogWarnings,\n\t\t\teffectivePm: pm\n\t\t};\n\t}\n\tconst exec = promisify(execFile);\n\tconst runPair = async (manager) => {\n\t\tawait exec(manager, formatAddArgs(manager, deps), { cwd: baseDir });\n\t\tawait exec(manager, formatAddDevArgs(manager, devDeps), { cwd: baseDir });\n\t};\n\tconst allPackages = [...deps, ...devDeps].join(\", \");\n\tconst spinner = ui.spinner();\n\tspinner.start(`Installing ${allPackages}...`);\n\ttry {\n\t\tawait runPair(pm);\n\t\tspinner.stop(`Installed ${allPackages}`);\n\t\treturn {\n\t\t\tskipped: false,\n\t\t\tdeps,\n\t\t\tdevDeps,\n\t\t\twarnings: catalogWarnings,\n\t\t\teffectivePm: pm\n\t\t};\n\t} catch (err) {\n\t\tconst stderrText = redactSecrets(readChildStderr(err));\n\t\tif (pm === \"pnpm\" && isRecognisedPnpmResolutionError(stderrText)) {\n\t\t\tspinner.message(\"pnpm could not resolve a workspace/catalog dependency, retrying with npm...\");\n\t\t\ttry {\n\t\t\t\tawait runPair(\"npm\");\n\t\t\t\tspinner.stop(`Installed ${allPackages} via npm (pnpm fallback)`);\n\t\t\t\treturn {\n\t\t\t\t\tskipped: false,\n\t\t\t\t\tdeps,\n\t\t\t\t\tdevDeps,\n\t\t\t\t\twarnings: [[\n\t\t\t\t\t\t\"pnpm could not install: a published Prisma Next dependency leaked a `workspace:*` or `catalog:` specifier.\",\n\t\t\t\t\t\t\"Falling back to `npm install` so init can complete.\",\n\t\t\t\t\t\tstderrText ? ` pnpm error: ${stderrText.trim().split(\"\\n\")[0]}` : \"\",\n\t\t\t\t\t\t\"Once the offending package republishes a clean version, re-run `pnpm install` to switch back.\"\n\t\t\t\t\t].filter(Boolean).join(\"\\n\")],\n\t\t\t\t\teffectivePm: \"npm\"\n\t\t\t\t};\n\t\t\t} catch (npmErr) {\n\t\t\t\tspinner.stop(\"Installation failed\");\n\t\t\t\tthrow errorInitInstallFailed({\n\t\t\t\t\taddCommand,\n\t\t\t\t\taddDevCommand,\n\t\t\t\t\temitCommand,\n\t\t\t\t\tfilesWritten,\n\t\t\t\t\tstderrLines: [stderrText, redactSecrets(readChildStderr(npmErr))]\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tspinner.stop(\"Installation failed\");\n\t\tthrow errorInitInstallFailed({\n\t\t\taddCommand,\n\t\t\taddDevCommand,\n\t\t\temitCommand,\n\t\t\tfilesWritten,\n\t\t\tstderrLines: [stderrText]\n\t\t});\n\t}\n}\n/**\n* Builds the FR7.3 catalog-honoured warning(s) for the surrounding pnpm\n* workspace, if any. Returns an empty array when no `pnpm-workspace.yaml`\n* exists in any ancestor or when the workspace's catalog has no entry\n* for any of the packages `init` is about to install.\n*\n* Exported for unit tests.\n*/\nfunction buildCatalogWarnings(baseDir, packages) {\n\tconst result = detectPnpmCatalogOverrides(baseDir, packages);\n\tif (result === null || result.entries.length === 0) return [];\n\treturn [formatCatalogWarning(result.workspaceFile, result.entries)];\n}\nfunction formatCatalogWarning(workspaceFile, entries) {\n\treturn [\n\t\t\"pnpm workspace catalog overrides detected — pnpm will install these versions instead of `latest`:\",\n\t\tentries.map((entry) => ` • ${entry.name}: ${entry.version}`).join(\"\\n\"),\n\t\t`Catalog source: ${workspaceFile}`,\n\t\t\"To use the published `latest` instead, remove or update the catalog entry, then re-run `pnpm install`.\"\n\t].join(\"\\n\");\n}\n/**\n* Recognised pnpm error signatures that justify a fallback to npm.\n*\n* These patterns indicate the published artifact itself is at fault\n* (a leaked `workspace:*` or `catalog:` specifier), not the user's\n* environment — pnpm is faithfully reporting \"I cannot resolve this\n* registry version\", and npm is willing to install it because npm\n* doesn't care about the protocol prefix when there's a fallback range.\n*\n* Exported for unit tests; do not depend on this from outside the init\n* command.\n*/\nfunction isRecognisedPnpmResolutionError(stderr) {\n\tif (!stderr) return false;\n\treturn stderr.includes(\"ERR_PNPM_WORKSPACE_PKG_NOT_FOUND\") || stderr.includes(\"ERR_PNPM_NO_MATCHING_VERSION\") || /No matching version found for .* in the catalog/i.test(stderr) || /workspace:[^\\s]+ is not a valid (version|spec)/i.test(stderr) || /catalog:[^\\s]* is not a valid (version|spec)/i.test(stderr);\n}\n/**\n* FR2.1 — true when the parsed `package.json` declares `name` directly\n* in either `dependencies` or `devDependencies`. We deliberately don't\n* inspect `peerDependencies` (irrelevant for a leaf project) or the\n* lockfile (transitive presence is brittle to detect and not the\n* realistic clobber-risk path).\n*\n* Exported for unit tests.\n*/\nfunction hasDirectDep(parsed, name) {\n\tfor (const field of [\"dependencies\", \"devDependencies\"]) {\n\t\tconst value = parsed[field];\n\t\tif (value !== null && typeof value === \"object\" && name in value) return true;\n\t}\n\treturn false;\n}\nfunction readChildStderr(err) {\n\tif (err instanceof Error && \"stderr\" in err) return String(err.stderr ?? \"\");\n\treturn \"\";\n}\n/**\n* Redacts userinfo (`user:password@`) from any URL-shaped substring inside\n* package-manager stderr before we surface it in a warning or error\n* meta. pnpm and npm both include the offending registry URL in resolve\n* errors, and that URL can carry an auth token (e.g. corporate registry\n* mirrors that bake `_authToken` into the URL). The Style Guide\n* (Testing & Accessibility — \"Security: never print secrets\") requires\n* we never surface those.\n*\n* Exported for unit tests.\n*/\nfunction redactSecrets(stderr) {\n\tif (!stderr) return stderr;\n\treturn stderr.replace(/([a-zA-Z][a-zA-Z0-9+.-]*:\\/\\/)([^/@\\s]+)@/g, \"$1***@\");\n}\n/**\n* Drives `prisma-next contract emit` against the freshly scaffolded\n* project. On failure, throws `errorInitEmitFailed` with the underlying\n* cause embedded in `meta.cause` so the user can re-run with `-v` to see\n* the full envelope and follow the fix steps. Maps to exit code\n* `5 = EMIT_FAILED` (FR1.6).\n*/\nasync function runEmit(ctx) {\n\tconst spinner = ctx.ui.spinner();\n\tspinner.start(\"Emitting contract...\");\n\ttry {\n\t\tconst { executeContractEmit } = await import(\"./contract-emit-B6odMoem.mjs\").then((n) => n.t);\n\t\tawait executeContractEmit({ configPath: join(ctx.baseDir, \"prisma-next.config.ts\") });\n\t\tspinner.stop(\"Contract emitted\");\n\t} catch (err) {\n\t\tspinner.stop(\"Contract emission failed\");\n\t\tthrow errorInitEmitFailed({\n\t\t\temitCommand: ctx.emitCommand,\n\t\t\tfilesWritten: ctx.filesWritten,\n\t\t\tcause: causeMessage(err)\n\t\t});\n\t}\n}\nfunction causeMessage(err) {\n\tif (err instanceof Error) return err.message;\n\treturn String(err);\n}\n/**\n* Minimal `package.json` content used when init runs in a directory\n* that has no project manifest (TML-2496). Mirrors the npm 11 `init -y`\n* defaults, with two deliberate deviations:\n*\n* - `\"private\": true` so a stray `npm publish` cannot leak the\n* placeholder. Users who want to publish have to opt in by removing\n* the field.\n* - `\"type\": \"module\"` so the scaffolded ESM imports in\n* `prisma-next.config.ts` and `db.ts` typecheck and run without\n* additional tsconfig coercion.\n*\n* Exported for unit tests so the canonical shape is asserted in one\n* place rather than re-derived at every call site.\n*/\nfunction defaultPackageJsonContent(rawName) {\n\treturn `${JSON.stringify({\n\t\tname: sanitisePackageName(rawName),\n\t\tversion: \"0.0.0\",\n\t\tprivate: true,\n\t\ttype: \"module\"\n\t}, null, 2)}\\n`;\n}\n/**\n* npm package names are restricted to lowercase, no leading dot/underscore,\n* and a small URL-safe character set. `basename(cwd)` happily returns\n* \"My Project\" or \".hidden\" — both rejected by `npm install` validation.\n* Coerce to a safe fallback rather than emit a manifest npm refuses to\n* read.\n*/\nfunction sanitisePackageName(raw) {\n\tconst trimmed = raw.toLowerCase().replace(/[^a-z0-9._~-]/g, \"-\").replace(/^[._-]+/, \"\").replace(/-+/g, \"-\");\n\treturn trimmed.length > 0 ? trimmed : \"my-app\";\n}\n//#endregion\nexport { runInit };\n\n//# sourceMappingURL=init-BGm77aWc.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAM,wBAAwB,IAAI,IAAI;CACrC;CACA;CACA;CACA;CACA;AACD,CAAC;AACD,SAAS,iBAAiB,MAAM;CAC/B,OAAO,MAAM,IAAI,IAAI;AACtB;;;;;;;;;;;;;;;;;;;;;AAqBA,eAAe,qBAAqB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ev.
|
|
3
|
+
"version": "0.17.0-dev.5",
|
|
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.17.0-dev.
|
|
16
|
+
"@prisma/orm-framework": "0.17.0-dev.5",
|
|
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.17.0-dev.
|
|
38
|
-
"@internal/cli-telemetry": "0.17.0-dev.
|
|
39
|
-
"@internal/config-loader": "0.17.0-dev.
|
|
40
|
-
"@internal/emitter": "0.17.0-dev.
|
|
41
|
-
"@internal/language-server": "0.17.0-dev.
|
|
42
|
-
"@internal/migration-tools": "0.17.0-dev.
|
|
43
|
-
"@internal/publish-surface": "0.17.0-dev.
|
|
44
|
-
"@repo/tsconfig": "0.17.0-dev.
|
|
45
|
-
"@repo/tsdown": "0.17.0-dev.
|
|
46
|
-
"@internal/vite-plugin-contract-emit": "0.17.0-dev.
|
|
37
|
+
"@internal/cli": "0.17.0-dev.5",
|
|
38
|
+
"@internal/cli-telemetry": "0.17.0-dev.5",
|
|
39
|
+
"@internal/config-loader": "0.17.0-dev.5",
|
|
40
|
+
"@internal/emitter": "0.17.0-dev.5",
|
|
41
|
+
"@internal/language-server": "0.17.0-dev.5",
|
|
42
|
+
"@internal/migration-tools": "0.17.0-dev.5",
|
|
43
|
+
"@internal/publish-surface": "0.17.0-dev.5",
|
|
44
|
+
"@repo/tsconfig": "0.17.0-dev.5",
|
|
45
|
+
"@repo/tsdown": "0.17.0-dev.5",
|
|
46
|
+
"@internal/vite-plugin-contract-emit": "0.17.0-dev.5",
|
|
47
47
|
"tsdown": "0.22.14",
|
|
48
48
|
"typescript": "5.9.3"
|
|
49
49
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init-DHctXAI9-DfuY-JG7.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/init-DHctXAI9.mjs"],"sourcesContent":["import { F as CliStructuredError$1, _ as createTerminalUI, b as formatErrorJson, x as formatErrorOutput } from \"./command-helpers-CAoXqAY9.mjs\";\nimport { a as schemaSample, c as targetLabel, i as scaffoldSpecifierResolverFor, l as targetPackageName, n as dbFile, o as starterSchema, r as defaultSchemaPath, s as targetEntrypoint, t as configFile, u as version } from \"./cli.mjs\";\nimport { i as renderInitOutro, n as buildNextSteps, r as formatInitJson, t as InitOutputSchema } from \"./output-DWNYqZGc.mjs\";\nimport { createRequire } from \"node:module\";\nimport { CliStructuredError } from \"@internal/errors/control\";\nimport { basename, dirname, extname, isAbsolute, join, normalize } from \"pathe\";\nimport { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from \"node:fs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport * as clack from \"@clack/prompts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { docsUrlFor } from \"@internal/utils/structured-error\";\nimport { keepInternalSpecifiers } from \"@internal/framework-components/emission\";\nimport { execFile } from \"node:child_process\";\nimport { promisify } from \"node:util\";\nimport { detect, getUserAgent } from \"package-manager-detector/detect\";\nimport { applyEdits, modify, parse, printParseErrorCode } from \"jsonc-parser\";\n//#region src/commands/init/detect-package-manager.ts\nconst KNOWN = /* @__PURE__ */ new Set([\n\t\"pnpm\",\n\t\"npm\",\n\t\"yarn\",\n\t\"bun\",\n\t\"deno\"\n]);\nfunction isPackageManager(name) {\n\treturn KNOWN.has(name);\n}\n/**\n* Resolves the package manager `init` should drive for `add` / `install`\n* commands. Tries, in order:\n*\n* 1. **`detect()`** — walks up from `cwd` looking for a lockfile, the\n* `packageManager` field, the `devEngines.packageManager` field, or\n* install metadata. This is the right answer whenever the user is\n* anywhere inside an existing project, including a deep workspace\n* subdirectory.\n*\n* 2. **`getUserAgent()`** — parses `npm_config_user_agent`, the env var\n* every PM sets when it spawns a script. This catches the\n* bare-directory case where there's no project to walk up to but the\n* user invoked us via `pnpm dlx prisma-next init` / `bunx\n* prisma-next init` / `yarn dlx …`. Same signal used by every\n* `create-*` tool in the ecosystem (`create-vite`, `create-next-app`,\n* `create-astro`, `@antfu/ni`, …).\n*\n* 3. **`npm`** — final fallback. Always present alongside Node.\n*/\nasync function detectPackageManager(cwd) {\n\tconst detected = await detect({ cwd });\n\tif (detected && isPackageManager(detected.name)) return detected.name;\n\tconst userAgent = getUserAgent();\n\tif (userAgent !== null && isPackageManager(userAgent)) return userAgent;\n\treturn \"npm\";\n}\nfunction hasProjectManifest(cwd) {\n\treturn existsSync(join(cwd, \"package.json\")) || existsSync(join(cwd, \"deno.json\")) || existsSync(join(cwd, \"deno.jsonc\"));\n}\nfunction formatRunCommand(pm, bin, args) {\n\tif (pm === \"npm\") return `npx ${bin} ${args}`;\n\tif (pm === \"deno\") return `deno run npm:${bin} ${args}`;\n\treturn `${pm} ${bin} ${args}`;\n}\nfunction formatRunScriptCommand(pm, scriptName) {\n\tswitch (pm) {\n\t\tcase \"deno\": return `deno task ${scriptName}`;\n\t\tcase \"bun\": return `bun run ${scriptName}`;\n\t\tcase \"pnpm\": return `pnpm run ${scriptName}`;\n\t\tcase \"yarn\": return `yarn run ${scriptName}`;\n\t\tdefault: return `npm run ${scriptName}`;\n\t}\n}\nfunction formatAddArgs(pm, packages) {\n\tif (pm === \"deno\") return [\"add\", ...packages.map((p) => `npm:${p}`)];\n\treturn [\"add\", ...packages];\n}\nfunction formatAddDevArgs(pm, packages) {\n\tif (pm === \"deno\") return [\n\t\t\"add\",\n\t\t\"--dev\",\n\t\t...packages.map((p) => `npm:${p}`)\n\t];\n\treturn [\n\t\t\"add\",\n\t\t\"-D\",\n\t\t...packages\n\t];\n}\n//#endregion\n//#region src/commands/init/detect-pnpm-catalog.ts\n/**\n* Walks up from `baseDir` looking for `pnpm-workspace.yaml`, then scans\n* its top-level `catalog:` block for entries that match any of `packages`.\n*\n* Implements FR7.3 / Spec Decision 8 (honour-and-warn): when `init` runs\n* inside a pnpm workspace whose catalog overrides one of the packages it\n* installs, surface a structured warning so the user knows the catalog\n* version (not the published `latest`) is what ended up in their\n* `node_modules`. pnpm itself does this silently; the warning closes the\n* \"looks fine, must be wrong version six months later\" gap.\n*\n* Notes / scope:\n*\n* - We only inspect the unnamed top-level `catalog:` block. pnpm also\n* supports `catalogs:` (plural — *named* catalogs referenced via\n* `catalog:foo` specifiers); those don't apply to a vanilla\n* `pnpm add prisma-next` invocation, so we skip them.\n* - We don't validate YAML syntax exhaustively. The file format pnpm\n* ships is line-oriented and well-known; a minimal regex is more\n* robust than depending on a YAML parser for one warning.\n* - We don't compare against the registry's `latest` — pnpm uses the\n* catalog version regardless, so the warning fires whenever a match\n* exists. The user-facing copy explains how to opt out.\n*/\nfunction detectPnpmCatalogOverrides(baseDir, packages) {\n\tconst workspaceFile = findNearestPnpmWorkspaceFile(baseDir);\n\tif (workspaceFile === null) return null;\n\tconst catalog = extractCatalogBlock(readFileSync(workspaceFile, \"utf-8\"));\n\tif (catalog === null) return {\n\t\tworkspaceFile,\n\t\tentries: []\n\t};\n\tconst wanted = new Set(packages);\n\tconst entries = [];\n\tfor (const [name, version] of catalog) if (wanted.has(name)) entries.push({\n\t\tname,\n\t\tversion\n\t});\n\treturn {\n\t\tworkspaceFile,\n\t\tentries\n\t};\n}\nfunction findNearestPnpmWorkspaceFile(baseDir) {\n\tlet dir = baseDir;\n\tlet prev = \"\";\n\twhile (dir !== prev) {\n\t\tconst candidate = join(dir, \"pnpm-workspace.yaml\");\n\t\tif (existsSync(candidate)) return candidate;\n\t\tprev = dir;\n\t\tdir = dirname(dir);\n\t}\n\treturn null;\n}\n/**\n* Returns the entries inside the top-level `catalog:` block as `[name, version]`\n* pairs in document order, or `null` when no `catalog:` block exists.\n*\n* The parser is intentionally minimal: it reads line-by-line, locates the\n* top-level `catalog:` line (no leading whitespace), then collects every\n* subsequent indented line of the form `<key>: <value>` until the next\n* top-level key (or end of file). Quotes around `<key>` and `<value>`\n* are stripped; comments (`#…`) are ignored.\n*/\nfunction extractCatalogBlock(contents) {\n\tconst lines = contents.split(/\\r?\\n/);\n\tconst startIdx = lines.findIndex((line) => /^catalog\\s*:\\s*$/.test(line));\n\tif (startIdx === -1) return null;\n\tconst entries = [];\n\tfor (let i = startIdx + 1; i < lines.length; i++) {\n\t\tconst raw = lines[i] ?? \"\";\n\t\tif (raw.trim() === \"\" || /^\\s*#/.test(raw)) continue;\n\t\tif (!/^\\s/.test(raw)) break;\n\t\tconst match = raw.match(/^\\s+(?:'([^']+)'|\"([^\"]+)\"|([^:\\s'\"]+))\\s*:\\s*(.*?)\\s*(?:#.*)?$/);\n\t\tif (!match) continue;\n\t\tconst name = match[1] ?? match[2] ?? match[3];\n\t\tif (name === void 0) continue;\n\t\tconst version = stripQuotes((match[4] ?? \"\").trim());\n\t\tif (version === \"\") continue;\n\t\tentries.push([name, version]);\n\t}\n\treturn entries;\n}\nfunction stripQuotes(value) {\n\tif (value.length >= 2) {\n\t\tconst first = value[0];\n\t\tconst last = value[value.length - 1];\n\t\tif (first === \"\\\"\" && last === \"\\\"\" || first === \"'\" && last === \"'\") return value.slice(1, -1);\n\t}\n\treturn value;\n}\n//#endregion\n//#region src/commands/init/errors.ts\n/**\n* Re-init in non-interactive mode without `--force`. Distinct from the\n* decline-the-prompt path (which is `errorInitUserAborted`) because here\n* the user was never given the choice — `--force` is the contract.\n*/\nfunction errorInitReinitNeedsForce() {\n\treturn new CliStructuredError$1(\"CLI.INIT_REINIT_NEEDS_FORCE\", \"Project is already initialized\", {\n\t\twhy: \"A `prisma-next.config.ts` already exists in this directory. Re-running `init` would overwrite the scaffolded files; in non-interactive mode `init` will not do that without `--force`.\",\n\t\tfix: \"Pass `--force` to overwrite the existing scaffold, or run `init` interactively to confirm.\",\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_REINIT_NEEDS_FORCE\")\n\t});\n}\n/**\n* Non-interactive mode is missing one or more required inputs. Lists every\n* missing flag in the error so an agent / CI script can react without\n* needing to parse English.\n*\n* @param missing — kebab-case flag names without leading dashes\n* @param why — additional context (e.g. \"stdin is not a TTY\") that helps\n* the user understand why interactive fallback was skipped.\n*/\nfunction errorInitMissingFlags(options) {\n\tconst flagList = options.missing.map((flag) => `--${flag}`).join(\", \");\n\tconst fixList = options.missing.map((flag) => {\n\t\tswitch (flag) {\n\t\t\tcase \"target\": return \"--target postgres|mongodb\";\n\t\t\tcase \"authoring\": return \"--authoring psl|typescript\";\n\t\t\tcase \"schema-path\": return \"--schema-path <path>\";\n\t\t\tdefault: return `--${flag} <value>`;\n\t\t}\n\t}).join(\" \");\n\treturn new CliStructuredError$1(\"CLI.INIT_MISSING_FLAGS\", \"Missing required flags\", {\n\t\twhy: `${options.why} Missing required flag(s): ${flagList}.`,\n\t\tfix: `Re-run with the missing flag(s) supplied, e.g. \\`prisma-next init --yes ${fixList}\\`. Use \\`prisma-next init --help\\` to see every flag.`,\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_MISSING_FLAGS\"),\n\t\tmeta: { missingFlags: options.missing }\n\t});\n}\n/**\n* A flag value was supplied but is not in the allowed set. Lists the\n* allowed values in `meta` for machine-readable consumption.\n*/\nfunction errorInitInvalidFlagValue(options) {\n\treturn new CliStructuredError$1(\"CLI.INIT_INVALID_FLAG_VALUE\", `Invalid value for --${options.flag}`, {\n\t\twhy: `\\`--${options.flag} ${options.value}\\` is not one of: ${options.allowed.join(\", \")}.`,\n\t\tfix: `Use one of: ${options.allowed.map((v) => `--${options.flag} ${v}`).join(\", \")}.`,\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_INVALID_FLAG_VALUE\"),\n\t\tmeta: {\n\t\t\tflag: options.flag,\n\t\t\tvalue: options.value,\n\t\t\tallowed: options.allowed\n\t\t}\n\t});\n}\n/**\n* `--authoring` and `--schema-path` disagree on file extension (e.g. PSL\n* authoring with a `.ts` path). Surfaces before any scaffold files are\n* written so the project tree stays untouched.\n*/\nfunction errorInitAuthoringSchemaPathMismatch(options) {\n\tconst expectedAuthoring = options.expectedExtension === \".ts\" ? \"typescript\" : \"psl\";\n\treturn new CliStructuredError$1(\"CLI.INIT_AUTHORING_SCHEMA_PATH_MISMATCH\", \"Authoring and schema path do not match\", {\n\t\twhy: `\\`--authoring ${options.authoring}\\` requires a schema file ending in ${options.expectedExtension}, but \\`--schema-path ${options.schemaPath}\\` ends in ${options.actualExtension}.`,\n\t\tfix: `Use a matching pair, for example \\`--authoring ${expectedAuthoring} --schema-path <path>${options.expectedExtension}\\`, or change \\`--authoring\\` to match the path you supplied. You can also omit \\`--schema-path\\` to use the default for the chosen authoring.`,\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_AUTHORING_SCHEMA_PATH_MISMATCH\"),\n\t\tmeta: {\n\t\t\tauthoring: options.authoring,\n\t\t\tschemaPath: options.schemaPath,\n\t\t\tactualExtension: options.actualExtension,\n\t\t\texpectedExtension: options.expectedExtension\n\t\t}\n\t});\n}\n/**\n* The user cancelled an interactive prompt (Ctrl-C, escape, declined a\n* selection). Distinct from `errorInitReinitNeedsForce` because that path\n* applies to non-interactive mode where the user was never given the\n* choice; this one is the generic \"user said no\" path. Maps to exit code\n* 3 (USER_ABORTED).\n*/\nfunction errorInitUserAborted() {\n\treturn new CliStructuredError$1(\"CLI.INIT_USER_ABORTED\", \"Init cancelled\", {\n\t\twhy: \"The interactive prompt was cancelled before all required inputs were supplied. No files were modified.\",\n\t\tfix: \"Re-run `prisma-next init` and complete the prompts, or pass the required inputs as flags (see `--help`) for a non-interactive run.\",\n\t\tseverity: \"info\"\n\t});\n}\n/**\n* `--strict-probe` was supplied without `--probe-db`. Per FR8.3 / NFR9\n* (offline-by-default), `--strict-probe` is a no-op without `--probe-db` —\n* but rather than silently ignoring it we tell the user what they probably\n* meant. Without this guard, the flag combination silently does nothing,\n* which is exactly the kind of \"looks like it worked\" trap that a strict\n* mode is supposed to prevent.\n*/\nfunction errorInitStrictProbeWithoutProbe() {\n\treturn new CliStructuredError$1(\"CLI.INIT_STRICT_PROBE_WITHOUT_PROBE\", \"`--strict-probe` requires `--probe-db`\", {\n\t\twhy: \"`--strict-probe` only changes how a *failed* probe is reported; without `--probe-db` no probe is attempted in the first place. (`init` is offline-by-default — it never opens a connection to your database without explicit consent.)\",\n\t\tfix: \"Add `--probe-db` to opt in to the probe, or drop `--strict-probe` if you do not need the version check.\",\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_STRICT_PROBE_WITHOUT_PROBE\")\n\t});\n}\n/**\n* Dependency installation failed and the pnpm → npm fallback (FR7.2)\n* either did not apply (pm ≠ pnpm or stderr did not match a recognised\n* leak) or also failed. Files scaffolded before the install step are\n* already on disk; `meta.filesWritten` carries the list so a follow-up\n* agent can resume manually. Maps to exit code `4 = INSTALL_FAILED`.\n*/\nfunction errorInitInstallFailed(options) {\n\tconst trimmed = options.stderrLines.map((s) => s.trim()).filter(Boolean);\n\treturn new CliStructuredError$1(\"CLI.INIT_INSTALL_FAILED\", \"Failed to install dependencies\", {\n\t\twhy: trimmed.length === 0 ? \"The package manager exited with an error and no recoverable fallback applied.\" : `The package manager exited with: ${trimmed[0]}`,\n\t\tfix: `Install manually:\\n ${options.addCommand}\\n ${options.addDevCommand}\\nThen run \\`${options.emitCommand}\\` to emit the contract.`,\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_INSTALL_FAILED\"),\n\t\tmeta: {\n\t\t\tfilesWritten: options.filesWritten,\n\t\t\tstderr: trimmed\n\t\t}\n\t});\n}\n/**\n* The user's project manifest (typically `package.json`) failed to parse\n* as JSON. Init reads the manifest to merge `scripts` (FR3.5) and to\n* skip `@types/node` when it is already declared (FR2.1); a malformed\n* file would otherwise surface as an `INTERNAL_ERROR` with a raw\n* `SyntaxError` stack, which violates the FR1.6 contract that every\n* documented failure mode maps to a stable exit code.\n*\n* Maps to exit code `2 = PRECONDITION` — the user can fix the manifest\n* and re-run.\n*/\nfunction errorInitInvalidManifest(options) {\n\treturn new CliStructuredError$1(\"CLI.INIT_INVALID_MANIFEST\", `Failed to parse ${options.path}`, {\n\t\twhy: `\\`${options.path}\\` is not valid JSON: ${options.cause}`,\n\t\tfix: `Fix the JSON syntax in \\`${options.path}\\` (a missing comma or unbalanced brace is the most common cause), then re-run \\`prisma-next init\\`.`,\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_INVALID_MANIFEST\"),\n\t\tmeta: {\n\t\t\tpath: options.path,\n\t\t\tcause: options.cause\n\t\t}\n\t});\n}\n/**\n* The user's existing `tsconfig.json` could not be parsed even with JSONC\n* tolerance (comments + trailing commas) enabled. Init merges the\n* minimum compiler options the scaffolded files need (FR2.2), so an\n* unparseable tsconfig is a hard precondition failure: we cannot\n* faithfully edit a file we cannot read.\n*\n* Init must surface this **before** writing any scaffold file so the\n* user's working tree stays byte-identical (FR6.2 / NFR3) — see\n* `runInit` for the precondition gate.\n*\n* Maps to exit code `2 = PRECONDITION` — the user can fix the file and\n* re-run.\n*/\nfunction errorInitInvalidTsconfig(options) {\n\treturn new CliStructuredError$1(\"CLI.INIT_INVALID_TSCONFIG\", `Failed to parse ${options.path}`, {\n\t\twhy: `\\`${options.path}\\` is not valid JSON or JSONC: ${options.cause}`,\n\t\tfix: `Fix the syntax in \\`${options.path}\\` and re-run \\`prisma-next init\\`. \\`init\\` accepts JSONC (comments and trailing commas) but cannot recover from unbalanced braces or missing commas.`,\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_INVALID_TSCONFIG\"),\n\t\tmeta: {\n\t\t\tpath: options.path,\n\t\t\tcause: options.cause\n\t\t}\n\t});\n}\n/**\n* `--probe-db` was supplied along with `--strict-probe` and the probe\n* could not complete (no `DATABASE_URL`, network/auth error, the target\n* driver was not installed, …). Without `--strict-probe` the probe\n* surfaces these as warnings; `--strict-probe` escalates them to\n* fatal so a CI gate can rely on \"init exit code 2 means something\n* about the runtime environment is wrong\" (FR8.3).\n*\n* Maps to exit code `2 = PRECONDITION`. The caller's project files\n* are already on disk by this point — the probe runs after the write\n* phase — but the install/emit steps may or may not have completed\n* depending on `--no-install` and the exact failure mode; `meta`\n* carries `filesWritten` so a follow-up agent can resume manually.\n*/\nfunction errorInitProbeFailed(options) {\n\treturn new CliStructuredError$1(\"CLI.INIT_PROBE_FAILED\", \"Database probe failed\", {\n\t\twhy: `\\`--probe-db\\` could not complete and \\`--strict-probe\\` was set: ${options.cause}`,\n\t\tfix: \"Confirm `DATABASE_URL` points at a reachable server, or drop `--strict-probe` to treat probe failures as warnings.\",\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_PROBE_FAILED\"),\n\t\tmeta: {\n\t\t\tfilesWritten: options.filesWritten,\n\t\t\tcause: options.cause\n\t\t}\n\t});\n}\n/**\n* `prisma-next contract emit` failed after a successful install. Surface\n* the underlying error so the user can fix it and re-run; files and\n* dependencies remain on disk untouched. Maps to exit code\n* `5 = EMIT_FAILED`.\n*/\nfunction errorInitEmitFailed(options) {\n\treturn new CliStructuredError$1(\"CLI.INIT_EMIT_FAILED\", \"Failed to emit contract\", {\n\t\twhy: `\\`prisma-next contract emit\\` failed: ${options.cause}`,\n\t\tfix: `Inspect your contract file, fix the underlying issue, then re-run \\`${options.emitCommand}\\`. Pass \\`-v\\` for the full error envelope.`,\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_EMIT_FAILED\"),\n\t\tmeta: {\n\t\t\tfilesWritten: options.filesWritten,\n\t\t\tcause: options.cause\n\t\t}\n\t});\n}\n/**\n* The project-level skills install (`npx skills add\n* prisma/prisma#v<version>`) failed after a successful dependency\n* install + emit. The project's scaffold remains on disk; the user\n* can either fix the underlying issue (network, registry, PATH) and\n* run the install command manually, or re-run `init --no-skill` to\n* proceed without the skill.\n*\n* Non-rolling-back, matching the existing install/emit failure\n* semantics. Maps to exit code `6 = SKILL_INSTALL_FAILED`.\n*/\nfunction errorInitSkillInstallFailed(options) {\n\treturn new CliStructuredError$1(\"CLI.INIT_SKILL_INSTALL_FAILED\", \"Failed to install Prisma Next skills\", {\n\t\twhy: `\\`${options.skillInstallCommand}\\` exited with an error: ${options.cause}`,\n\t\tfix: `Either:\n - Re-run \\`prisma-next init --no-skill${options.filesWritten.length > 0 ? \" --force\" : \"\"}\\` to skip the skill install for this run, or\\n - Fix the underlying issue (network, npm registry, \\`npx skills\\` on PATH) and install manually:\\n ${options.skillInstallCommand}`,\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_SKILL_INSTALL_FAILED\"),\n\t\tmeta: {\n\t\t\tfilesWritten: options.filesWritten,\n\t\t\tskillInstallCommand: options.skillInstallCommand,\n\t\t\tcause: options.cause\n\t\t}\n\t});\n}\n//#endregion\n//#region src/commands/init/hygiene-gitattributes.ts\n/**\n* The `.gitattributes` entries written for a freshly initialised project\n* (FR3.4). Mirrors the relevant subset of the repo-root\n* [`.gitattributes`](../../../../../../../../.gitattributes):\n*\n* - **Today**: `contract.json`, `contract.d.ts` are emitted on every\n* `prisma-next contract emit`. Marking them `linguist-generated`\n* keeps GitHub's diff stats honest and collapses the file in code\n* review by default.\n* - **Forward-looking**: `ops.json`, `migration.json` are not yet emitted\n* by `init` flows but will be produced by adjacent commands (lower /\n* migration tooling). Adding them now matches Decision 5\n* (forward-looking subset) so the file does not need to be amended\n* every time a new artifact lands.\n*\n* `ARTIFACT_FILENAMES` entries are written relative to the schema\n* directory so a user who runs `init --schema-path db/contract.prisma`\n* gets `db/contract.json linguist-generated` — not the workspace-glob\n* form `<glob>/contract.json` (which would over-match any unrelated\n* `contract.json` the user has elsewhere) and not the absolute\n* `DEFAULT_CONTRACT_SOURCE_DIR/contract.json` (which would silently\n* break for a non-default schema path).\n*\n* The migration contract snapshot store (`migrations/snapshots/<hex>/`)\n* is anchored to the migrations root instead, not the schema directory:\n* migration package depth under `migrations/` varies (`app/<pkg>`,\n* `<space>/<pkg>`, or a bare `<pkg>` in extension source repos), so no\n* single schema-dir-relative pattern can reach every snapshot. See\n* `STORE_GITATTRIBUTES_LINES` below.\n*/\nconst ARTIFACT_FILENAMES$1 = [\n\t\"contract.json\",\n\t\"contract.d.ts\",\n\t\"ops.json\",\n\t\"migration.json\"\n];\nconst ATTRIBUTE = \"linguist-generated\";\n/**\n* Full `.gitattributes` lines for the migration contract snapshot store,\n* already anchored to the migrations root — unlike `ARTIFACT_FILENAMES`,\n* these are not combined with the schema-relative prefix.\n*/\nconst STORE_GITATTRIBUTES_LINES = [`migrations/snapshots/**/contract.json ${ATTRIBUTE}`, `migrations/snapshots/**/contract.d.ts ${ATTRIBUTE}`];\n/**\n* Computes the `.gitattributes` lines this scaffold expects to own. Each\n* line has the shape `<path> linguist-generated`. The `target` parameter\n* is currently unused but accepted for symmetry with the other hygiene\n* helpers and to leave room for target-specific entries (e.g. a future\n* family-specific artifact) without a signature break.\n*/\nfunction requiredGitattributesLines(schemaDir, _target) {\n\tconst dir = schemaDir === \".\" ? \"\" : schemaDir.replace(/\\/+$/, \"\");\n\tconst prefix = dir === \"\" ? \"\" : `${dir}/`;\n\treturn [...ARTIFACT_FILENAMES$1.map((file) => `${prefix}${file} ${ATTRIBUTE}`), ...STORE_GITATTRIBUTES_LINES];\n}\n/**\n* Idempotent `.gitattributes` merge (FR3.4 / FR9.3). Returns the new file\n* content given the existing content (or `undefined` if the file does\n* not yet exist).\n*\n* Equivalence is exact-line: a user-customised line like\n* `prisma/*.json linguist-generated` is *not* recognised as covering\n* `DEFAULT_CONTRACT_SOURCE_DIR/contract.json linguist-generated`. We accept that\n* over-specification — preserving the user's broad pattern *and*\n* appending the narrow one — because the narrow lines are what the\n* acceptance criteria pin (FR3.4 AC).\n*\n* Returns `null` when no changes are required (file already contains\n* every required entry).\n*/\nfunction mergeGitattributes(existing, required) {\n\tif (existing === void 0) return `${required.join(\"\\n\")}\\n`;\n\tconst presentLines = new Set(existing.split(\"\\n\").map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith(\"#\")));\n\tconst missing = required.filter((line) => !presentLines.has(line));\n\tif (missing.length === 0) return null;\n\treturn `${existing}${existing.length === 0 || existing.endsWith(\"\\n\") ? \"\" : \"\\n\"}${missing.join(\"\\n\")}\\n`;\n}\n//#endregion\n//#region src/commands/init/hygiene-gitignore.ts\n/**\n* The minimal `.gitignore` lines a Prisma Next scaffold needs (FR3.3).\n* Order matches what Node tooling typically writes today.\n*\n* `node_modules/` first because it's the byte-largest miss; `dist/`\n* because the scaffolded `tsconfig.json` writes there; `.env` last so\n* the secret-bearing file is the one most-recently visible in any diff\n* (a paranoid-correct ordering — humans skim from the top).\n*/\nconst REQUIRED_GITIGNORE_ENTRIES = [\n\t\"node_modules/\",\n\t\"dist/\",\n\t\".env\"\n];\n/**\n* Idempotent `.gitignore` merge (FR3.3 / FR9.3). Returns the new file\n* content given the existing content (or `undefined` if the file does\n* not yet exist). Adds only entries that are not already present and\n* never duplicates a line. Existing comments and blank lines are\n* preserved verbatim — `.gitignore` is parsed by `git` without a tree,\n* so any line modification risks changing semantics.\n*\n* Pattern equivalence is line-literal: `node_modules/` and `node_modules`\n* are treated as different entries. This is intentional — `git` treats\n* them differently (the trailing slash restricts the match to\n* directories), and the AC pins the trailing-slash form.\n*\n* Returns `null` when no changes are required (file already contains\n* every required entry). The caller can use this to decide whether to\n* include `.gitignore` in `filesWritten`.\n*/\nfunction mergeGitignore(existing) {\n\tif (existing === void 0) return `${REQUIRED_GITIGNORE_ENTRIES.join(\"\\n\")}\\n`;\n\tconst present = new Set(existing.split(\"\\n\").map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith(\"#\")));\n\tconst missing = REQUIRED_GITIGNORE_ENTRIES.filter((entry) => !present.has(entry));\n\tif (missing.length === 0) return null;\n\treturn `${existing}${existing.length === 0 || existing.endsWith(\"\\n\") ? \"\" : \"\\n\"}${missing.join(\"\\n\")}\\n`;\n}\n//#endregion\n//#region src/commands/init/hygiene-package-scripts.ts\nconst REQUIRED_SCRIPTS = [{\n\tname: \"contract:emit\",\n\tcommand: \"prisma-next contract emit\"\n}];\n/**\n* Idempotent `package.json#scripts` merge with collision detection\n* (FR3.5 / FR9.3):\n*\n* - If a required script is **missing**, append it.\n* - If a required script is **already present and identical**, leave\n* the file alone (idempotency).\n* - If a required script is **present but maps to a different command**,\n* skip the write for that script and surface a structured warning.\n* The user's override is sacred — `init` should never silently\n* overwrite a custom build pipeline.\n*\n* Preserves the existing key order (so a user who has alphabetised\n* their scripts does not see them reshuffled) and appends new entries\n* at the end.\n*\n* The `package.json` is parsed and re-stringified through `JSON` —\n* comments are not preserved (package.json does not support them per\n* spec). Trailing newline matches the original input's trailing\n* newline behaviour.\n*/\nfunction mergePackageScripts(existing, required = REQUIRED_SCRIPTS) {\n\tconst parsed = blindCast(JSON.parse(existing));\n\tconst scripts = typeof parsed[\"scripts\"] === \"object\" && parsed[\"scripts\"] !== null ? { ...blindCast(parsed[\"scripts\"]) } : {};\n\tconst warnings = [];\n\tlet mutated = false;\n\tfor (const { name, command } of required) {\n\t\tconst existingValue = scripts[name];\n\t\tif (existingValue === void 0) {\n\t\t\tscripts[name] = command;\n\t\t\tmutated = true;\n\t\t\tcontinue;\n\t\t}\n\t\tif (existingValue !== command) warnings.push(`package.json already has a \"${name}\" script with a different command — keeping yours.\\n existing: ${existingValue}\\n expected: ${command}\\nIf you want the default, remove your \"${name}\" script and re-run \\`init\\`.`);\n\t}\n\tif (!mutated) return {\n\t\tcontent: null,\n\t\twarnings\n\t};\n\tparsed[\"scripts\"] = scripts;\n\tconst trailingNewline = existing.endsWith(\"\\n\") ? \"\\n\" : \"\";\n\treturn {\n\t\tcontent: `${JSON.stringify(parsed, null, 2)}${trailingNewline}`,\n\t\twarnings\n\t};\n}\n/**\n* Idempotently sets `\"type\": \"module\"` on a `package.json` so the\n* scaffolded `prisma/db.ts` — which uses the ESM-only `with { type: 'json' }`\n* import attribute — loads as ES module under Node's loader (TML-2494).\n*\n* Without this field Node either:\n*\n* - emits `MODULE_TYPELESS_PACKAGE_JSON` and reparses the file as ESM\n* with a perf penalty (Node 22+ with `--experimental-strip-types`), or\n* - hard-fails with `ERR_*` because the CJS loader cannot parse the\n* import-attribute syntax (older Node, or any tool that doesn't\n* reparse).\n*\n* Behaviour:\n*\n* - **Field missing** → set to `\"module\"`. New entry is inserted right\n* after `\"name\"` (when present) so the diff lands in a conventional\n* spot for human review; falls through to the natural append position\n* otherwise.\n* - **Field already `\"module\"`** → no-op (idempotent).\n* - **Field set to anything else** (e.g. `\"commonjs\"`) → leave it alone\n* and surface a structured warning. The user explicitly opted out of\n* ESM and we don't silently overwrite that.\n*/\nfunction ensureEsmModuleType(existing) {\n\tconst parsed = blindCast(JSON.parse(existing));\n\tconst currentType = parsed[\"type\"];\n\tif (currentType === \"module\") return {\n\t\tcontent: null,\n\t\twarning: null\n\t};\n\tif (typeof currentType === \"string\" && currentType !== \"module\") return {\n\t\tcontent: null,\n\t\twarning: `package.json declares \"type\": \"${currentType}\" — keeping yours, but the scaffolded prisma/db.ts uses an ESM-only import attribute (\\`with { type: 'json' }\\`) and will not load under that module type.\\nIf you want the default, set \"type\": \"module\" in package.json.`\n\t};\n\tconst next = {};\n\tlet inserted = false;\n\tfor (const [key, value] of Object.entries(parsed)) {\n\t\tif (key === \"type\") continue;\n\t\tnext[key] = value;\n\t\tif (!inserted && key === \"name\") {\n\t\t\tnext[\"type\"] = \"module\";\n\t\t\tinserted = true;\n\t\t}\n\t}\n\tif (!inserted) next[\"type\"] = \"module\";\n\tconst trailingNewline = existing.endsWith(\"\\n\") ? \"\\n\" : \"\";\n\treturn {\n\t\tcontent: `${JSON.stringify(next, null, 2)}${trailingNewline}`,\n\t\twarning: null\n\t};\n}\n//#endregion\n//#region src/commands/init/inputs.ts\nconst TARGET_ALIASES = /* @__PURE__ */ new Map([\n\t[\"postgres\", \"postgres\"],\n\t[\"postgresql\", \"postgres\"],\n\t[\"mongo\", \"mongo\"],\n\t[\"mongodb\", \"mongo\"]\n]);\nconst AUTHORING_VALUES = /* @__PURE__ */ new Map([\n\t[\"psl\", \"psl\"],\n\t[\"typescript\", \"typescript\"],\n\t[\"ts\", \"typescript\"]\n]);\n/**\n* Resolves every required input for `runInit`. In interactive mode, missing\n* inputs are prompted via clack; in non-interactive mode, missing required\n* inputs throw a structured error listing exactly which flags are missing\n* (FR1.4). Throws `CliStructuredError` on any unrecoverable input issue.\n*\n* `canPrompt` is decoupled from `flags.interactive` so the action handler\n* (`./index.ts`) owns the merge of stdout-TTY (decoration) and stdin-TTY\n* (prompts). `flags.interactive` continues to gate `TerminalUI` decoration\n* — see [Style Guide § Interactivity](../../../../../../../docs/CLI%20Style%20Guide.md#interactivity).\n*/\nasync function resolveInitInputs(ctx) {\n\tconst { baseDir, options, flags, canPrompt } = ctx;\n\tconst force = Boolean(options.force);\n\tconst autoAcceptPrompts = Boolean(flags.yes);\n\tif (options.strictProbe && !options.probeDb) throw errorInitStrictProbeWithoutProbe();\n\tconst reinit = await resolveReinit({\n\t\tbaseDir,\n\t\tforce,\n\t\tcanPrompt,\n\t\tautoAcceptPrompts\n\t});\n\tconst target = resolveTarget(options.target);\n\tconst authoring = resolveAuthoring(options.authoring);\n\tconst missing = [];\n\tif (target === void 0) missing.push(\"target\");\n\tif (authoring === void 0) missing.push(\"authoring\");\n\tif (!canPrompt && missing.length > 0) throw errorInitMissingFlags({\n\t\tmissing,\n\t\twhy: process.stdin.isTTY ? \"Non-interactive mode is active (`--no-interactive` or stdout is piped).\" : \"stdin is not a TTY, so `init` cannot prompt interactively.\"\n\t});\n\tconst finalTarget = target ?? await promptTarget();\n\tconst finalAuthoring = authoring ?? await promptAuthoring();\n\tconst finalSchemaPath = options.schemaPath !== void 0 ? validateSchemaPath(options.schemaPath, finalAuthoring) : canPrompt ? await promptSchemaPath(finalAuthoring) : defaultSchemaPath(finalAuthoring);\n\tconst writeEnv = await resolveWriteEnv({\n\t\tflag: options.writeEnv,\n\t\tcanPrompt,\n\t\tautoAcceptPrompts\n\t});\n\tconst removePreviousFacade = await resolveRemovePreviousFacade({\n\t\tbaseDir,\n\t\ttarget: finalTarget,\n\t\treinit,\n\t\tforce,\n\t\tcanPrompt,\n\t\tautoAcceptPrompts\n\t});\n\tconst installProjectSkill = options.skill !== false;\n\treturn {\n\t\ttarget: finalTarget,\n\t\tauthoring: finalAuthoring,\n\t\tschemaPath: finalSchemaPath,\n\t\tinstall: options.install !== false,\n\t\twriteEnv,\n\t\tprobeDb: Boolean(options.probeDb),\n\t\tstrictProbe: Boolean(options.strictProbe),\n\t\treinit,\n\t\tremovePreviousFacade,\n\t\tinstallProjectSkill\n\t};\n}\nasync function resolveWriteEnv(opts) {\n\tif (opts.flag !== void 0) return Boolean(opts.flag);\n\tif (!opts.canPrompt || opts.autoAcceptPrompts) return false;\n\tconst result = await clack.confirm({\n\t\tmessage: \"Also write a .env file from .env.example? (gitignored)\",\n\t\tinitialValue: false,\n\t\toutput: process.stderr\n\t});\n\tif (clack.isCancel(result)) throw errorInitUserAborted();\n\treturn Boolean(result);\n}\n/**\n* FR9.2 — detects whether re-init is switching targets (the previous\n* facade differs from the chosen target's facade) and resolves the\n* remove-or-keep question.\n*\n* The non-interactive contract is the same as the `--force` re-init\n* gate above: a non-interactive run that reaches this helper always\n* has `--force` (otherwise `resolveReinit` would have thrown 5002), so\n* the removal proceeds without further prompting. Interactive runs see\n* a `clack.confirm` with `initialValue: true` — the destructive default\n* is correct because keeping both facades produces a project that\n* imports from one but pays for both in the lockfile, which is a\n* silent foot-gun the user almost never wants.\n*\n* Returns the previous facade package name when the user consented (or\n* was force-ed) to remove it, otherwise `null`. Parse failures on\n* `package.json` resolve to `null` here — `runInit`'s precondition\n* gate surfaces a structured 5010 error for the same file shortly\n* after, so we avoid double-reporting and keep this helper side-effect\n* free under hostile inputs.\n*/\nasync function resolveRemovePreviousFacade(opts) {\n\tif (!opts.reinit) return null;\n\tconst packageJsonPath = join(opts.baseDir, \"package.json\");\n\tif (!existsSync(packageJsonPath)) return null;\n\tconst otherTarget = opts.target === \"postgres\" ? \"mongo\" : \"postgres\";\n\tconst otherFacadeNames = [targetPackageName(otherTarget, scaffoldSpecifierResolverFor(otherTarget)), targetPackageName(otherTarget)];\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(readFileSync(packageJsonPath, \"utf-8\"));\n\t} catch {\n\t\treturn null;\n\t}\n\tconst deps = parsed[\"dependencies\"];\n\tif (deps === null || typeof deps !== \"object\" || Array.isArray(deps)) return null;\n\tconst otherFacade = otherFacadeNames.find((name) => Object.hasOwn(deps, name));\n\tif (otherFacade === void 0) return null;\n\tif (opts.force || opts.canPrompt && opts.autoAcceptPrompts) return otherFacade;\n\tif (!opts.canPrompt) return otherFacade;\n\tconst result = await clack.confirm({\n\t\tmessage: `Switching from ${targetLabel(otherTarget)} to ${targetLabel(opts.target)} — remove ${otherFacade} from package.json dependencies?`,\n\t\tinitialValue: true,\n\t\toutput: process.stderr\n\t});\n\tif (clack.isCancel(result)) throw errorInitUserAborted();\n\treturn result === true ? otherFacade : null;\n}\nasync function resolveReinit(opts) {\n\tif (!existsSync(join(opts.baseDir, \"prisma-next.config.ts\"))) return false;\n\tif (opts.force) return true;\n\tif (!opts.canPrompt) throw errorInitReinitNeedsForce();\n\tif (opts.autoAcceptPrompts) return true;\n\tconst result = await clack.confirm({\n\t\tmessage: \"This project is already initialized. Re-initialize? This will overwrite all generated files.\",\n\t\tinitialValue: false,\n\t\toutput: process.stderr\n\t});\n\tif (clack.isCancel(result) || result !== true) throw errorInitUserAborted();\n\treturn true;\n}\nfunction resolveTarget(value) {\n\tif (value === void 0) return void 0;\n\tconst mapped = TARGET_ALIASES.get(value.toLowerCase());\n\tif (mapped === void 0) throw errorInitInvalidFlagValue({\n\t\tflag: \"target\",\n\t\tvalue,\n\t\tallowed: [\"postgres\", \"mongodb\"]\n\t});\n\treturn mapped;\n}\nfunction resolveAuthoring(value) {\n\tif (value === void 0) return void 0;\n\tconst mapped = AUTHORING_VALUES.get(value.toLowerCase());\n\tif (mapped === void 0) throw errorInitInvalidFlagValue({\n\t\tflag: \"authoring\",\n\t\tvalue,\n\t\tallowed: [\"psl\", \"typescript\"]\n\t});\n\treturn mapped;\n}\n/**\n* Validates `--schema-path` against the chosen `--authoring` style: PSL\n* authoring requires a `.prisma` file and TypeScript authoring requires a\n* `.ts` file. Mismatched combinations would silently scaffold PSL content\n* into a `.ts` file (or vice versa); this validator surfaces the mistake\n* as a precondition error naming both flags.\n*/\nfunction validateSchemaPath(value, authoring) {\n\tconst trimmed = value.trim();\n\tif (trimmed.length === 0) throw errorInitInvalidFlagValue({\n\t\tflag: \"schema-path\",\n\t\tvalue,\n\t\tallowed: [\"<non-empty file path with .prisma or .ts extension>\"]\n\t});\n\tif (trimmed.endsWith(\"/\") || trimmed.endsWith(\"\\\\\")) throw errorInitInvalidFlagValue({\n\t\tflag: \"schema-path\",\n\t\tvalue,\n\t\tallowed: [\"<file path, not a directory>\"]\n\t});\n\tconst ext = extname(trimmed).toLowerCase();\n\tconst expected = authoring === \"typescript\" ? \".ts\" : \".prisma\";\n\tif (ext !== expected) throw errorInitAuthoringSchemaPathMismatch({\n\t\tauthoring,\n\t\tschemaPath: trimmed,\n\t\tactualExtension: ext.length > 0 ? ext : \"(none)\",\n\t\texpectedExtension: expected\n\t});\n\treturn normalize(trimmed);\n}\nasync function promptTarget() {\n\tconst result = await clack.select({\n\t\tmessage: \"What database are you using?\",\n\t\toptions: [{\n\t\t\tvalue: \"postgres\",\n\t\t\tlabel: \"PostgreSQL\"\n\t\t}, {\n\t\t\tvalue: \"mongo\",\n\t\t\tlabel: \"MongoDB\"\n\t\t}],\n\t\toutput: process.stderr\n\t});\n\tif (clack.isCancel(result)) throw errorInitUserAborted();\n\treturn result;\n}\nasync function promptAuthoring() {\n\tconst result = await clack.select({\n\t\tmessage: \"How do you want to write your schema?\",\n\t\toptions: [{\n\t\t\tvalue: \"psl\",\n\t\t\tlabel: \"Prisma Schema Language (.prisma)\"\n\t\t}, {\n\t\t\tvalue: \"typescript\",\n\t\t\tlabel: \"TypeScript (.ts)\"\n\t\t}],\n\t\toutput: process.stderr\n\t});\n\tif (clack.isCancel(result)) throw errorInitUserAborted();\n\treturn result;\n}\nasync function promptSchemaPath(authoring) {\n\tconst expectedExt = authoring === \"typescript\" ? \".ts\" : \".prisma\";\n\tconst result = await clack.text({\n\t\tmessage: \"Where should the schema file go?\",\n\t\tinitialValue: defaultSchemaPath(authoring),\n\t\tvalidate(value = \"\") {\n\t\t\tconst trimmed = value.trim();\n\t\t\tif (trimmed.length === 0) return \"Path cannot be empty\";\n\t\t\tif (trimmed.endsWith(\"/\") || trimmed.endsWith(\"\\\\\")) return \"Path must be a file, not a directory\";\n\t\t\tconst ext = extname(trimmed).toLowerCase();\n\t\t\tif (ext === \"\") return \"Path must include a file extension (e.g. .prisma or .ts)\";\n\t\t\tif (ext !== expectedExt) return `Schema path must end in ${expectedExt} for --authoring ${authoring} (got ${ext}).`;\n\t\t},\n\t\toutput: process.stderr\n\t});\n\tif (clack.isCancel(result)) throw errorInitUserAborted();\n\treturn validateSchemaPath(result, authoring);\n}\n//#endregion\n//#region src/commands/init/probe-db.ts\n/**\n* Connects (when configured) to the user's database and returns a\n* structured outcome describing whether the server meets the declared\n* minimum (FR8.1). Pure with respect to its inputs: no I/O happens\n* unless `databaseUrl` is set.\n*\n* The outcome is shaped so that `--strict-probe` can branch on the\n* `kind`/`meetsMinimum` pair without re-stringifying the message:\n*\n* - `ok` — informational; `init` continues.\n* - `below-minimum` — warning; `init` continues regardless of\n* `--strict-probe` (the spec scopes strict-probe to \"probe\n* *failures*\", and a successful probe that finds an old server is\n* not a failure).\n* - `no-database-url` / `connection-failed` / `driver-missing` —\n* warning by default, fatal under `--strict-probe`.\n*/\nasync function probeServerVersion(ctx, overrides = {}) {\n\tconst { databaseUrl, minVersion, target } = ctx;\n\tif (databaseUrl === void 0 || databaseUrl.trim().length === 0) return {\n\t\tkind: \"no-database-url\",\n\t\tminVersion,\n\t\tmeetsMinimum: null,\n\t\tmessage: \"Skipped --probe-db: DATABASE_URL is not set in the current shell environment. (init does not read .env for the probe; export the variable or drop --probe-db.)\"\n\t};\n\tlet driverResult;\n\ttry {\n\t\tif (target === \"postgres\") driverResult = overrides.probePostgres !== void 0 ? await overrides.probePostgres(databaseUrl) : await defaultProbePostgres(databaseUrl, ctx.baseDir, overrides);\n\t\telse driverResult = overrides.probeMongo !== void 0 ? await overrides.probeMongo(databaseUrl) : await defaultProbeMongo(databaseUrl, ctx.baseDir, overrides);\n\t} catch (err) {\n\t\tif (err instanceof DriverMissingError) return {\n\t\t\tkind: \"driver-missing\",\n\t\t\tminVersion,\n\t\t\tmeetsMinimum: null,\n\t\t\tcause: err.message,\n\t\t\tmessage: `Skipped --probe-db: ${err.message}. (Run with install enabled, or install the driver yourself, then re-run \\`prisma-next init --probe-db\\`.)`\n\t\t};\n\t\tconst cause = redactDatabaseUrlSecrets(causeMessage$1(err));\n\t\treturn {\n\t\t\tkind: \"connection-failed\",\n\t\t\tminVersion,\n\t\t\tmeetsMinimum: null,\n\t\t\tcause,\n\t\t\tmessage: `--probe-db could not connect: ${cause}.`\n\t\t};\n\t}\n\tif (compareVersionPrefix(driverResult.serverVersion, minVersion) < 0) return {\n\t\tkind: \"below-minimum\",\n\t\tserverVersion: driverResult.serverVersion,\n\t\tminVersion,\n\t\tmeetsMinimum: false,\n\t\tmessage: `--probe-db: server reports version ${driverResult.serverVersion}, below the declared minimum (${minVersion}). Some queries may fail until the server is upgraded.`\n\t};\n\treturn {\n\t\tkind: \"ok\",\n\t\tserverVersion: driverResult.serverVersion,\n\t\tminVersion,\n\t\tmeetsMinimum: true,\n\t\tmessage: `--probe-db: server reports version ${driverResult.serverVersion} (>= ${minVersion}).`\n\t};\n}\n/**\n* Compares two semver-prefix strings (\"14\", \"14.2\", \"6.0\", …) by\n* numeric components left-to-right. Returns a negative number when `a`\n* is older than `b`, zero when both versions agree on every numeric\n* component (treating missing trailing components as `0`), and a\n* positive number when `a` is newer.\n*\n* The loop runs over the **longer** of the two prefixes so that\n* `'14'` compares less than `'14.1'` — without that, the shorter\n* prefix would be silently accepted whenever the configured minimum\n* has a non-zero minor or patch.\n*\n* Exported for unit tests.\n*/\nfunction compareVersionPrefix(a, b) {\n\tconst aParts = parseNumericParts(a);\n\tconst bParts = parseNumericParts(b);\n\tconst len = Math.max(aParts.length, bParts.length);\n\tfor (let i = 0; i < len; i += 1) {\n\t\tconst aPart = aParts[i] ?? 0;\n\t\tconst bPart = bParts[i] ?? 0;\n\t\tif (aPart !== bPart) return aPart - bPart;\n\t}\n\treturn 0;\n}\nfunction parseNumericParts(version) {\n\tconst match = version.match(/^[^\\d]*(\\d+(?:\\.\\d+){0,3})/);\n\tif (match === null) return [];\n\treturn (match[1] ?? \"\").split(\".\").map((part) => Number.parseInt(part, 10));\n}\nvar DriverMissingError = class extends Error {};\nfunction causeMessage$1(err) {\n\tif (err instanceof Error) return err.message;\n\treturn String(err);\n}\n/**\n* Strips `user:password@` userinfo from any URL-shaped substring before\n* we surface the cause to the user. Mirrors `redactSecrets` in\n* `init.ts` — the probe path has its own redactor because the inputs\n* here include the raw connection string by construction (driver\n* errors echo the URL back).\n*\n* Exported for unit tests.\n*/\nfunction redactDatabaseUrlSecrets(text) {\n\tif (!text) return text;\n\treturn text.replace(/([a-zA-Z][a-zA-Z0-9+.-]*:\\/\\/)([^/@\\s]+)@/g, \"$1***@\");\n}\nasync function defaultProbePostgres(databaseUrl, baseDir, overrides) {\n\tconst client = new (requirePeer(\"pg\", baseDir, overrides)).Client({ connectionString: databaseUrl });\n\tawait client.connect();\n\ttry {\n\t\tconst result = await client.query(\"SELECT version() as version\");\n\t\treturn { serverVersion: parsePostgresVersion(String(result?.rows?.[0]?.version ?? \"\")) };\n\t} finally {\n\t\tawait client.end().catch(() => void 0);\n\t}\n}\n/**\n* Extracts the numeric prefix from a Postgres `version()` row, e.g.\n*\n* `PostgreSQL 14.10 on x86_64-pc-linux-gnu, ...` → `\"14.10\"`\n* `PostgreSQL 16beta1 on …` → `\"16\"` (we\n* conservatively drop the suffix; minimum-version comparisons\n* treat 16beta1 as 16, which is what every reasonable user\n* expects).\n*\n* Exported for unit tests.\n*/\nfunction parsePostgresVersion(versionString) {\n\tconst match = versionString.match(/PostgreSQL\\s+(\\d+(?:\\.\\d+)?)/i);\n\tif (match === null || match[1] === void 0) throw new CliStructuredError(\"CLI.INIT_PROBE_FAILED\", `Could not parse PostgreSQL version from \\`${versionString}\\``);\n\treturn match[1];\n}\nasync function defaultProbeMongo(databaseUrl, baseDir, overrides) {\n\tconst client = new (requirePeer(\"mongodb\", baseDir, overrides)).MongoClient(databaseUrl);\n\tawait client.connect();\n\ttry {\n\t\tconst buildInfo = await client.db().admin().command({ buildInfo: 1 });\n\t\tconst versionString = String(buildInfo.version ?? \"\");\n\t\tif (versionString.length === 0) throw new CliStructuredError(\"CLI.INIT_PROBE_FAILED\", \"buildInfo did not include a `version` field\");\n\t\treturn { serverVersion: versionString };\n\t} finally {\n\t\tawait client.close().catch(() => void 0);\n\t}\n}\n/**\n* Loads a peer driver (`pg` / `mongodb`) from the user's project\n* `node_modules`. We deliberately resolve from `baseDir` rather than\n* from the CLI bundle — the CLI does not depend on `pg` or `mongodb`\n* directly, but the user's `init`-generated `package.json` does (via\n* the target facade). Failure to resolve is folded into a typed\n* `DriverMissingError` so `probeServerVersion` can map it to a\n* `driver-missing` outcome rather than letting a `MODULE_NOT_FOUND`\n* leak as a generic connection failure.\n*/\nfunction requirePeer(moduleId, baseDir, overrides) {\n\ttry {\n\t\tif (overrides.requireFromBaseDir !== void 0) return overrides.requireFromBaseDir(baseDir, moduleId);\n\t\treturn createRequire(join(baseDir, \"package.json\"))(moduleId);\n\t} catch (err) {\n\t\tthrow new DriverMissingError(`\\`${moduleId}\\` is not installed in this project (resolved from ${baseDir}; cause: ${causeMessage$1(err)})`);\n\t}\n}\n//#endregion\n//#region src/commands/init/reinit-cleanup.ts\n/**\n* Filenames the contract pipeline emits next to the user's schema source\n* (`<schemaDir>/contract.json`, `<schemaDir>/contract.d.ts`, …). Mirrors\n* the schema-dir-relative `ARTIFACT_FILENAMES` in `hygiene-gitattributes.ts`\n* (not that file's migrations-root-anchored store lines, which are outside\n* this command's scope — reinit only ever touches `schemaDir`); kept as a\n* separate constant here because the cleanup contract is target-agnostic\n* and we deliberately do not want a stale artifact from a previous target\n* lingering after a re-init.\n*\n* If a future emit pipeline produces an additional schema-dir artifact,\n* add it here **and** to `ARTIFACT_FILENAMES` in `hygiene-gitattributes.ts`\n* — the two stay in lockstep so the file `init` advertises as\n* `linguist-generated` is exactly the file `init` is willing to delete on\n* re-init.\n*/\nconst ARTIFACT_FILENAMES = [\n\t\"contract.json\",\n\t\"contract.d.ts\",\n\t\"ops.json\",\n\t\"migration.json\"\n];\n/**\n* Returns the schema-relative paths of stale contract artifacts the\n* previous `init` run (or a `contract emit`) left behind in `schemaDir`.\n* Paths are returned relative to `baseDir` so the caller can plumb them\n* into `filesWritten`-style logging without re-deriving the path.\n*\n* Pure function: no filesystem mutation. Used by `runInit`'s precondition\n* phase (FR6.2 / NFR3 atomicity) so a downstream parse failure leaves\n* the artifacts on disk and the project byte-identical to its pre-init\n* state.\n*/\nfunction findStaleArtifacts(baseDir, schemaDir) {\n\tconst result = [];\n\tfor (const filename of ARTIFACT_FILENAMES) {\n\t\tconst rel = join(schemaDir, filename);\n\t\tif (existsSync(join(baseDir, rel))) result.push(rel);\n\t}\n\treturn result;\n}\n/**\n* Drops a single key from `package.json#dependencies`, returning the new\n* file content. Returns `null` when the dependency was already absent —\n* the caller can skip the write to keep re-init idempotent (FR9.3).\n*\n* Used by `runInit` for the FR9.2 target-switch path: when the user\n* re-inits a project from `--target postgres` to `--target mongodb` (or\n* vice versa), the previous facade is removed from `dependencies` so the\n* resulting project depends only on the chosen target's facade.\n*\n* Devs/peers/optional dep groups are intentionally *not* touched — the\n* facades are only ever in `dependencies` (FR4 / FR7), and broadening\n* the search would risk clobbering an unrelated dep with the same name\n* in `peerDependencies`.\n*\n* Throws `SyntaxError` if `existing` is not parseable as JSON; the\n* caller (`runInit`) already guards on that with a structured 5010\n* error before this helper is reached.\n*/\nfunction removeDependency(existing, depName) {\n\tconst parsed = JSON.parse(existing);\n\tconst deps = parsed[\"dependencies\"];\n\tif (deps === null || typeof deps !== \"object\" || Array.isArray(deps)) return null;\n\tif (!Object.hasOwn(deps, depName)) return null;\n\tconst next = { ...deps };\n\tdelete next[depName];\n\tparsed[\"dependencies\"] = next;\n\tconst trailingNewline = existing.endsWith(\"\\n\") ? \"\\n\" : \"\";\n\treturn `${JSON.stringify(parsed, null, 2)}${trailingNewline}`;\n}\n//#endregion\n//#region src/commands/init/skill-install.ts\nconst exec = promisify(execFile);\n/**\n* Default base for the GitHub-URL form `<owner>/<repo>` consumed by\n* upstream `skills add`. Each `SkillSource` joins this base with its\n* own subpath (and optional `#ref` for version-pinned clusters).\n*/\nconst DEFAULT_SKILL_BASE = \"prisma/prisma\";\nconst DEFAULT_SKILL_SOURCES = [\n\t{\n\t\tsubpath: \"skills\",\n\t\tref: \"cli\",\n\t\tdescription: \"usage skills (version-locked to installed Prisma Next)\"\n\t},\n\t{\n\t\tsubpath: \"skills/upgrade\",\n\t\tref: null,\n\t\tdescription: \"upgrade skill (always tracks `main`)\"\n\t},\n\t{\n\t\tsubpath: \"skills/extension-author\",\n\t\tref: null,\n\t\tdescription: \"extension-author skill (always tracks `main`)\"\n\t}\n];\n/**\n* Test-only escape hatch for pinning the install base to a local\n* checkout. Production runs leave this unset, so installs always use\n* `DEFAULT_SKILL_BASE`.\n*\n* When set to an absolute filesystem path (typical for tests), the\n* `#ref` fragment is dropped — local-path mode in upstream's CLI does\n* not accept refs, and the local clone has whatever content the test\n* checked into it anyway. When set to anything else (e.g. a fork name\n* `myuser/prisma-next`), the ref policy is preserved.\n*/\nfunction resolveAgentSkillBase() {\n\tconst override = process.env[\"PRISMA_NEXT_SKILLS_BASE\"]?.trim();\n\treturn override && override.length > 0 ? override : DEFAULT_SKILL_BASE;\n}\nfunction isLocalPath(base) {\n\treturn base.startsWith(\"/\") || /^[a-zA-Z]:[\\\\/]/.test(base);\n}\n/**\n* Agents passed to every project-level init install. Upstream `skills add`\n* is the source of truth for per-agent install behaviour; the CLI lists\n* every supported runtime on one invocation and delegates the rest.\n*/\nconst DEFAULT_SKILL_AGENTS = [\n\t\"cursor\",\n\t\"claude-code\",\n\t\"codex\",\n\t\"windsurf\"\n];\n/**\n* Build the `<base>/<subpath>[#ref]` URL the `skills` CLI will\n* resolve. Exported for unit tests so the per-source format can be\n* asserted without going through the full install loop.\n*/\nfunction formatSkillSourceUrl(source) {\n\tconst base = resolveAgentSkillBase();\n\tconst url = `${base}/${source.subpath}`;\n\tif (source.ref === null) return url;\n\tif (isLocalPath(base)) return url;\n\tif (source.ref === \"cli\") return `${url}#v${version}`;\n\treturn url;\n}\n/**\n* The skill-install command for one source, formatted for the\n* project's detected package manager. `npx`/`pnpm dlx`/`bunx` are\n* interchangeable to the user; we pick the variant that matches the\n* rest of the install step so a single project consistently uses one\n* runner.\n*\n* `--agent` takes space-separated slugs on one flag; `--skill '*'` and `-y`\n* skip the multi-select prompts a non-interactive scaffold step cannot show.\n*\n* Exported for unit tests so the per-PM dispatch can be asserted\n* without a live subprocess.\n*/\nfunction formatSkillInstallCommand(args) {\n\tconst agents = args.agents ?? DEFAULT_SKILL_AGENTS;\n\tconst cliArgs = [\n\t\t\"skills@latest\",\n\t\t\"add\",\n\t\tformatSkillSourceUrl(args.source),\n\t\t\"--agent\",\n\t\t...agents,\n\t\t\"--skill\",\n\t\t\"'*'\",\n\t\t\"-y\"\n\t];\n\treturn formatPackageManagerCommand(args.pm, cliArgs);\n}\n/**\n* Ordered skill-install commands for one init run. Exported for unit tests.\n*/\nfunction resolveProjectSkillInstallCommands(pm) {\n\treturn DEFAULT_SKILL_SOURCES.map((source) => formatSkillInstallCommand({\n\t\tpm,\n\t\tsource\n\t}));\n}\nfunction formatPackageManagerCommand(pm, args) {\n\tswitch (pm) {\n\t\tcase \"pnpm\": return `pnpm dlx ${args.join(\" \")}`;\n\t\tcase \"yarn\": return `yarn dlx ${args.join(\" \")}`;\n\t\tcase \"bun\": return `bunx ${args.join(\" \")}`;\n\t\tcase \"deno\": return `deno run -A npm:${args.join(\" \")}`;\n\t\tcase \"npm\": return `npx ${args.join(\" \")}`;\n\t}\n}\n/**\n* Parse the project-pm-formatted command into an exec call. The\n* format-then-parse split keeps the user-facing command string the same\n* as the surface the structured error advertises, so a user who copies\n* the error's `fix` line gets the same invocation that init just\n* attempted. Single quotes are preserved in the display form so `*` is\n* safe to copy into a shell, then stripped before `execFile`.\n*/\nfunction commandToExec(command) {\n\tconst tokens = (command.match(/'[^']*'|\\S+/g) ?? []).map((token) => token.startsWith(\"'\") && token.endsWith(\"'\") ? token.slice(1, -1) : token);\n\treturn {\n\t\tfile: tokens[0] ?? \"npx\",\n\t\targs: tokens.slice(1)\n\t};\n}\n/**\n* Runs the project-level skill install for every source in\n* `DEFAULT_SKILL_SOURCES`, in order. Returns\n* `{ ok: true, commands }` on success; throws a structured\n* `errorInitSkillInstallFailed` on the first failure (subsequent\n* sources are not attempted — the user opted into Prisma Next by\n* running `init` and a partial install would leave the project in an\n* ambiguous state). The throw is intentionally fatal — project-level\n* skill install is unconditional (modulo `--no-skill`).\n*/\nasync function runProjectLevelSkillInstall(ctx) {\n\tconst commands = [];\n\tconst installCommands = resolveProjectSkillInstallCommands(ctx.pm);\n\tfor (const command of installCommands) {\n\t\tconst { file, args } = commandToExec(command);\n\t\ttry {\n\t\t\tawait exec(file, args, { cwd: ctx.baseDir });\n\t\t\tcommands.push(command);\n\t\t} catch (err) {\n\t\t\tthrow errorInitSkillInstallFailed({\n\t\t\t\tskillInstallCommand: command,\n\t\t\t\tfilesWritten: ctx.filesWritten,\n\t\t\t\tcause: redactSecrets$1(readChildStderr$1(err)) || (err instanceof Error ? err.message : String(err))\n\t\t\t});\n\t\t}\n\t}\n\treturn {\n\t\tok: true,\n\t\tcommands\n\t};\n}\nfunction readChildStderr$1(err) {\n\tif (err instanceof Error && \"stderr\" in err) return String(err.stderr ?? \"\");\n\treturn \"\";\n}\n/**\n* Strips credentials from a `scheme://user:pass@host/...` URL anywhere\n* in `stderr`. Package-manager stderr regularly contains credentialed\n* registry URLs (private npm registries, GitHub Packages tokens), and\n* those bubble into the structured `errorInitSkillInstallFailed`\n* envelope, which ends up in logs and CI output. Redact at the\n* boundary so we never re-emit a secret.\n*\n* Exported for unit tests.\n*/\nfunction redactSecrets$1(stderr) {\n\tif (!stderr) return stderr;\n\treturn stderr.replace(/([a-zA-Z][a-zA-Z0-9+.-]*:\\/\\/)([^/@\\s]+)@/g, \"$1***@\");\n}\n/**\n* Hand-rolled skill stub path that init must not leave behind. Removed\n* on every init run so a project's `.agents/skills/prisma-next/` does\n* not shadow the installed Prisma Next skill cluster.\n*/\nconst LEGACY_SKILL_FILE = \".agents/skills/prisma-next/SKILL.md\";\n//#endregion\n//#region src/commands/init/templates/env.ts\n/**\n* The minimum supported server version for each target. The\n* authoritative source of truth is each target package's\n* `package.json#prismaNext.minServerVersion` field — this module\n* mirrors those values and a workspace-level test asserts the two\n* never drift (`templates/tsconfig-env.test.ts`).\n*\n* Bumping a value here in isolation is **not** safe: edit the\n* corresponding target package's `package.json` first, then mirror\n* here. The scaffold's `.env.example` and the \"Requirements\" section\n* of `prisma-next.md` both read from this constant, so a stale value\n* lies to every freshly initialised user.\n*/\nconst MIN_SERVER_VERSION = {\n\tpostgres: \"17\",\n\tmongo: \"8.0\"\n};\nconst TARGET_LABEL = {\n\tpostgres: \"PostgreSQL\",\n\tmongo: \"MongoDB\"\n};\n/**\n* Renders the placeholder body shared by `.env` and `.env.example`:\n* the target-specific connection-string requirement comments and the\n* commented-shape `DATABASE_URL` line. The output is identical for both\n* authoring styles — the env file is orthogonal to PSL vs TS schema\n* authoring.\n*/\nfunction envPlaceholderBody(target) {\n\tconst label = TARGET_LABEL[target];\n\tconst minVersion = MIN_SERVER_VERSION[target];\n\tconst lines = [];\n\tlines.push(`# Connection string for ${label}.`);\n\tlines.push(`# Requires ${label} >= ${minVersion}.`);\n\tlines.push(\"\");\n\tif (target === \"postgres\") lines.push(\"DATABASE_URL=\\\"postgresql://user:password@localhost:5432/mydb\\\"\");\n\telse {\n\t\tlines.push(\"# Standalone local mongod / `docker run mongo:8` — no replica set required for first-run queries.\");\n\t\tlines.push(\"# Transactions and change streams need a replica set; add ?replicaSet=... only after initiating one.\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"DATABASE_URL=\\\"mongodb://user:password@localhost:27017/mydb\\\"\");\n\t}\n\tlines.push(\"\");\n\treturn lines.join(\"\\n\");\n}\n/**\n* Renders the `.env.example` content for a given target:\n*\n* - Carries a \"Copy this file to `.env`…\" intro that only makes sense\n* for the example file (the real `.env` is the destination of that\n* copy and so does not get the same intro).\n* - Documents the `DATABASE_URL` placeholder in the target's native URL\n* shape (Postgres: standard `postgresql://`, Mongo: `mongodb://` plus\n* a `mydb` database segment so the lazy facade has a `dbName`).\n* - Carries a `# Requires <db> >= <version>` comment so a fresh user\n* knows the minimum supported server before they first try to connect.\n*/\nfunction envExampleContent(target) {\n\tconst lines = [];\n\tlines.push(\"# Copy this file to `.env` and replace the placeholder with your real connection string.\");\n\tlines.push(envPlaceholderBody(target));\n\treturn lines.join(\"\\n\");\n}\n/**\n* Renders the initial `.env` content for `--write-env` / interactive\n* opt-in. Same placeholder body as `.env.example`, **without** the\n* example file's \"Copy this file to `.env`…\" intro: the real `.env` is\n* the destination of that copy, so the line would lie. Writing this\n* file is gitignored (`.env` lands in `.gitignore` during init).\n*/\nfunction envFileContent(target) {\n\treturn envPlaceholderBody(target);\n}\n//#endregion\n//#region src/commands/init/templates/render.ts\nfunction renderTemplate(templateFile, variableNames, vars) {\n\tlet result = readFileSync(join(import.meta.dirname, templateFile), \"utf-8\");\n\tfor (const key of variableNames) {\n\t\tconst value = vars[key];\n\t\tif (value === void 0) throw new InternalError(`Template variable '${key}' is not defined`);\n\t\tresult = result.replaceAll(`{{${key}}}`, value);\n\t}\n\treturn result;\n}\n//#endregion\n//#region src/commands/init/templates/quick-reference.ts\nconst variables = [\n\t\"schemaPath\",\n\t\"schemaDir\",\n\t\"dbImportPath\",\n\t\"pkgRun\",\n\t\"pkg\",\n\t\"configEntrypoint\",\n\t\"schemaSample\",\n\t\"requirements\"\n];\nfunction quickReferenceMd(target, authoring, schemaPath, pkgRun, resolveImportSpecifier = keepInternalSpecifiers) {\n\tconst schemaDir = dirname(schemaPath);\n\tconst pkg = targetPackageName(target, resolveImportSpecifier);\n\tconst vars = {\n\t\tschemaPath,\n\t\tschemaDir,\n\t\tdbImportPath: `./${schemaDir}/db`,\n\t\tpkgRun,\n\t\tpkg,\n\t\tconfigEntrypoint: targetEntrypoint(target, \"config\", resolveImportSpecifier),\n\t\tschemaSample: schemaSample(target, authoring, resolveImportSpecifier),\n\t\trequirements: requirementsBlock(target)\n\t};\n\treturn renderTemplate(`quick-reference-${target}.md`, variables, vars);\n}\n/**\n* Renders the FR8.2 \"Requirements\" block injected into `prisma-next.md`\n* (the user-facing quick reference). Sources the minimum server\n* version from `MIN_SERVER_VERSION` — itself mirrored from each\n* target package's `package.json#prismaNext.minServerVersion`\n* (FR8.1).\n*\n* The verification command is target-specific — Postgres scaffolds\n* shouldn't ship Mongo's `db.runCommand` (and vice versa) just because\n* we couldn't be bothered to branch.\n*/\nfunction requirementsBlock(target) {\n\treturn [\n\t\t\"## Requirements\",\n\t\t\"\",\n\t\t`- **${TARGET_LABEL[target]} ${MIN_SERVER_VERSION[target]} or newer.** Older servers are not supported. Run ${target === \"postgres\" ? \"`SELECT version()`\" : \"`db.runCommand({ buildInfo: 1 })`\"} against your server to verify.`,\n\t\t\"- The CLI never connects to your database without explicit consent. Pass `--probe-db` to `prisma-next init` if you want `init` to verify the server version itself.\"\n\t].join(\"\\n\");\n}\n//#endregion\n//#region src/commands/init/templates/readme.ts\nconst sharedVariables = [\n\t\"projectName\",\n\t\"contractPath\",\n\t\"runDev\",\n\t\"runContractEmit\"\n];\nconst postgresVariables = [\n\t...sharedVariables,\n\t\"runDbInit\",\n\t\"runDbUpdate\",\n\t\"runMigrationPlan\",\n\t\"runMigrate\",\n\t\"runDbSeed\"\n];\nconst mongoVariables = [\n\t...sharedVariables,\n\t\"runDbUp\",\n\t\"runDbDown\",\n\t\"runDbReset\",\n\t\"runMigrationPlan\",\n\t\"runMigrate\",\n\t\"runDbSeed\"\n];\nfunction minimalProjectReadmeMd(target, schemaPath, projectName, pm) {\n\tconst run = (script) => formatRunScriptCommand(pm, script);\n\tconst shared = {\n\t\tprojectName,\n\t\tcontractPath: schemaPath,\n\t\trunDev: run(\"dev\"),\n\t\trunContractEmit: run(\"contract:emit\"),\n\t\trunMigrationPlan: run(\"migration:plan\"),\n\t\trunMigrate: run(\"migrate\"),\n\t\trunDbSeed: run(\"db:seed\")\n\t};\n\tif (target === \"mongo\") {\n\t\tconst vars = {\n\t\t\t...shared,\n\t\t\trunDbUp: run(\"db:up\"),\n\t\t\trunDbDown: run(\"db:down\"),\n\t\t\trunDbReset: run(\"db:reset\")\n\t\t};\n\t\treturn renderTemplate(\"readme-mongo.md\", mongoVariables, vars);\n\t}\n\tconst vars = {\n\t\t...shared,\n\t\trunDbInit: run(\"db:init\"),\n\t\trunDbUpdate: run(\"db:update\")\n\t};\n\treturn renderTemplate(\"readme-postgres.md\", postgresVariables, vars);\n}\n//#endregion\n//#region src/commands/init/templates/tsconfig.ts\n/**\n* Compiler options the scaffolded `prisma-next.config.ts` and `db.ts` need\n* to typecheck:\n*\n* - `module: 'preserve'` + `moduleResolution: 'bundler'` align with how\n* modern bundlers (and `tsdown`) consume our facade packages.\n* - `resolveJsonModule` lets `db.ts` import `contract.json with { type:\n* 'json' }` — the runtime path the facades document (FR4).\n*\n* `types: ['node']` is FR2.2 territory and lives in\n* `REQUIRED_COMPILER_OPTIONS_TYPES` because TS only honours an _array_\n* here, and a string-keyed merge would clobber any user-specified entries.\n* Merge handling preserves any extra `types` the user added.\n*/\nconst REQUIRED_COMPILER_OPTIONS = {\n\tmodule: \"preserve\",\n\tmoduleResolution: \"bundler\",\n\tresolveJsonModule: true\n};\n/**\n* Types that must be present in `compilerOptions.types` for the scaffold\n* to typecheck. With `moduleResolution: 'bundler'`, TypeScript does not\n* implicitly include all `@types/*` packages — `process.env` only resolves\n* when `node` is in this array (or `types` is omitted, but then any other\n* type listed here would force the same behaviour). Listing `node`\n* explicitly is the documented escape hatch (FR2.2).\n*/\nconst REQUIRED_COMPILER_OPTIONS_TYPES = [\"node\"];\nfunction defaultTsConfig() {\n\treturn JSON.stringify({\n\t\tcompilerOptions: {\n\t\t\ttarget: \"ES2022\",\n\t\t\t...REQUIRED_COMPILER_OPTIONS,\n\t\t\ttypes: [...REQUIRED_COMPILER_OPTIONS_TYPES],\n\t\t\tstrict: true,\n\t\t\tskipLibCheck: true,\n\t\t\tesModuleInterop: true,\n\t\t\toutDir: \"dist\"\n\t\t},\n\t\tinclude: [\"**/*.ts\"]\n\t}, null, 2);\n}\n/**\n* Thrown by `mergeTsConfig` when the user's existing `tsconfig.json` is\n* not parseable as JSONC (TypeScript's actual configured dialect — see\n* FR6.1). Carries the raw parse errors so the caller can render an\n* actionable, location-aware message.\n*\n* `runInit` catches this exception during the precondition phase and\n* maps it to a `CliStructuredError(5011)` so the user's working tree\n* stays byte-identical when init bails (FR6.2 / NFR3).\n*/\nvar TsConfigParseError = class extends Error {\n\terrors;\n\tconstructor(errors) {\n\t\tsuper(formatTsConfigParseErrors(errors));\n\t\tthis.errors = errors;\n\t\tthis.name = \"TsConfigParseError\";\n\t}\n};\nfunction formatTsConfigParseErrors(errors) {\n\tif (errors.length === 0) return \"tsconfig.json is empty or not an object\";\n\treturn errors.map((e) => `${printParseErrorCode(e.error)} at offset ${e.offset}`).join(\"; \");\n}\n/**\n* Merges the required compiler options into an existing `tsconfig.json`.\n*\n* Parsing is delegated to `jsonc-parser` so JSONC inputs (comments,\n* trailing commas) — TypeScript's real configuration dialect — survive\n* unchanged: edits are applied as text patches via `modify` /\n* `applyEdits`, preserving the user's formatting, key ordering, and\n* comments wherever the touched paths permit (FR6.1, AC \"Hostile\n* inputs\").\n*\n* Throws `TsConfigParseError` when the input is not parseable as JSONC.\n* The caller must catch this and surface a structured error before\n* writing any scaffold files (FR6.2 atomicity).\n*/\nfunction mergeTsConfig(existing) {\n\tconst { config } = parseTsConfigText(existing);\n\tconst formattingOptions = {\n\t\ttabSize: detectIndent(existing),\n\t\tinsertSpaces: true,\n\t\teol: existing.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\"\n\t};\n\tlet result = existing;\n\tfor (const [key, value] of Object.entries(REQUIRED_COMPILER_OPTIONS)) {\n\t\tconst edits = modify(result, [\"compilerOptions\", key], value, { formattingOptions });\n\t\tresult = applyEdits(result, edits);\n\t}\n\tconst existingTypes = config[\"compilerOptions\"]?.[\"types\"];\n\tconst mergedTypes = mergeTypesArray(existingTypes);\n\tconst typesEdits = modify(result, [\"compilerOptions\", \"types\"], mergedTypes, { formattingOptions });\n\tresult = applyEdits(result, typesEdits);\n\treturn result;\n}\n/**\n* Parses an existing `tsconfig.json` (JSONC) and returns the structured\n* config alongside any non-fatal parse warnings. Throws\n* `TsConfigParseError` if the input cannot be parsed at all or does\n* not resolve to a JSON object — both cases mean we cannot safely\n* apply edits.\n*\n* Exposed independently so callers (notably `runInit`'s precondition\n* gate) can validate the file *before* any scaffold file is written.\n*/\nfunction parseTsConfigText(text) {\n\tconst errors = [];\n\tconst value = parse(text, errors, {\n\t\tallowTrailingComma: true,\n\t\tdisallowComments: false,\n\t\tallowEmptyContent: false\n\t});\n\tif (value === void 0 || value === null || typeof value !== \"object\" || Array.isArray(value)) throw new TsConfigParseError(errors);\n\tif (errors.length > 0) throw new TsConfigParseError(errors);\n\treturn { config: value };\n}\nfunction detectIndent(text) {\n\tconst match = text.match(/^([ \\t]+)\\S/m);\n\tif (match === null) return 2;\n\tconst indent = match[1] ?? \"\";\n\tif (indent.startsWith(\"\t\")) return 1;\n\treturn indent.length || 2;\n}\n/**\n* Merges `REQUIRED_COMPILER_OPTIONS_TYPES` into the user's existing\n* `compilerOptions.types` array. Preserves order and dedupes. If the\n* user has no `types` array (or has set it to a non-array), we replace\n* with the required minimum — overwriting a non-array `types` is the\n* correct fix because anything other than a string array is invalid TS\n* config.\n*/\nfunction mergeTypesArray(existing) {\n\tconst result = [];\n\tif (Array.isArray(existing)) {\n\t\tfor (const item of existing) if (typeof item === \"string\" && !result.includes(item)) result.push(item);\n\t}\n\tfor (const required of REQUIRED_COMPILER_OPTIONS_TYPES) if (!result.includes(required)) result.push(required);\n\treturn result;\n}\n//#endregion\n//#region src/commands/init/init.ts\n/**\n* Runs the `init` command end-to-end and returns the exit code. Catches\n* structured CLI errors raised at every phase (input resolution, install,\n* emit) and renders them via the same UI surface as success output\n* (`--json` to stdout, human to stderr). Exit codes follow the documented\n* stable set in `./exit-codes.ts` and the\n* [Style Guide § Exit Codes](../../../../../../../docs/CLI%20Style%20Guide.md#exit-codes).\n*\n* Layered for testability: the action handler in `./index.ts` is\n* responsible for parsing flags and constructing `runOptions`; this\n* function does no flag parsing of its own.\n*/\nasync function runInit(baseDir, runOptions) {\n\tconst { options, flags, canPrompt, probeOverrides } = runOptions;\n\tconst ui = createTerminalUI(flags);\n\tconst warnings = [];\n\tconst filesWritten = [];\n\tconst filesDeleted = [];\n\tif (!flags.json && !flags.quiet) clack.intro(\"prisma-next init\", { output: process.stderr });\n\tlet inputs;\n\ttry {\n\t\tinputs = await resolveInitInputs({\n\t\t\tbaseDir,\n\t\t\toptions,\n\t\t\tflags,\n\t\t\tcanPrompt\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError$1.is(error)) return emitError(ui, flags, error);\n\t\tthrow error;\n\t}\n\tconst pm = await detectPackageManager(baseDir);\n\tconst pkgRun = formatRunCommand(pm, \"prisma-next\", \"\").trimEnd();\n\tconst schemaDir = dirname(inputs.schemaPath);\n\tconst configContractPath = isAbsolute(inputs.schemaPath) ? inputs.schemaPath : `./${inputs.schemaPath}`;\n\tconst resolveImportSpecifier = scaffoldSpecifierResolverFor(inputs.target);\n\tconst filesToWrite = [\n\t\t{\n\t\t\tpath: inputs.schemaPath,\n\t\t\tcontent: starterSchema(inputs.target, inputs.authoring, resolveImportSpecifier)\n\t\t},\n\t\t{\n\t\t\tpath: \"prisma-next.config.ts\",\n\t\t\tcontent: configFile(inputs.target, configContractPath, resolveImportSpecifier)\n\t\t},\n\t\t{\n\t\t\tpath: join(schemaDir, \"db.ts\"),\n\t\t\tcontent: dbFile(inputs.target, resolveImportSpecifier)\n\t\t},\n\t\t{\n\t\t\tpath: \"prisma-next.md\",\n\t\t\tcontent: quickReferenceMd(inputs.target, inputs.authoring, inputs.schemaPath, pkgRun, resolveImportSpecifier)\n\t\t},\n\t\t{\n\t\t\tpath: \".env.example\",\n\t\t\tcontent: envExampleContent(inputs.target)\n\t\t}\n\t];\n\tconst filesToDelete = inputs.reinit ? [...findStaleArtifacts(baseDir, schemaDir)] : [];\n\tif (existsSync(join(baseDir, \".agents/skills/prisma-next/SKILL.md\"))) filesToDelete.push(LEGACY_SKILL_FILE);\n\tif (inputs.writeEnv) if (!existsSync(join(baseDir, \".env\"))) filesToWrite.push({\n\t\tpath: \".env\",\n\t\tcontent: envFileContent(inputs.target)\n\t});\n\telse warnings.push(\".env already exists; leaving it untouched. Compare with .env.example for any new keys.\");\n\tconst tsconfigPath = join(baseDir, \"tsconfig.json\");\n\tif (existsSync(tsconfigPath)) {\n\t\tconst existing = readFileSync(tsconfigPath, \"utf-8\");\n\t\tlet merged;\n\t\ttry {\n\t\t\tmerged = mergeTsConfig(existing);\n\t\t} catch (err) {\n\t\t\tif (err instanceof TsConfigParseError) return emitError(ui, flags, errorInitInvalidTsconfig({\n\t\t\t\tpath: \"tsconfig.json\",\n\t\t\t\tcause: err.message\n\t\t\t}));\n\t\t\tthrow err;\n\t\t}\n\t\tfilesToWrite.push({\n\t\t\tpath: \"tsconfig.json\",\n\t\t\tcontent: merged,\n\t\t\tlogMessage: \"Updated tsconfig.json with required compiler options.\"\n\t\t});\n\t} else filesToWrite.push({\n\t\tpath: \"tsconfig.json\",\n\t\tcontent: defaultTsConfig()\n\t});\n\tconst gitignorePath = join(baseDir, \".gitignore\");\n\tconst newGitignore = mergeGitignore(existsSync(gitignorePath) ? readFileSync(gitignorePath, \"utf-8\") : void 0);\n\tif (newGitignore !== null) filesToWrite.push({\n\t\tpath: \".gitignore\",\n\t\tcontent: newGitignore\n\t});\n\tconst gitattributesPath = join(baseDir, \".gitattributes\");\n\tconst newGitattributes = mergeGitattributes(existsSync(gitattributesPath) ? readFileSync(gitattributesPath, \"utf-8\") : void 0, requiredGitattributesLines(schemaDir, inputs.target));\n\tif (newGitattributes !== null) filesToWrite.push({\n\t\tpath: \".gitattributes\",\n\t\tcontent: newGitattributes\n\t});\n\tconst packageJsonPath = join(baseDir, \"package.json\");\n\tconst packageJsonExisted = existsSync(packageJsonPath);\n\tconst synthesisePackageJson = !packageJsonExisted && !hasProjectManifest(baseDir);\n\tlet parsedPackageJson = null;\n\tif (packageJsonExisted || synthesisePackageJson) {\n\t\tconst pkgRaw = packageJsonExisted ? readFileSync(packageJsonPath, \"utf-8\") : defaultPackageJsonContent(basename(baseDir));\n\t\ttry {\n\t\t\tparsedPackageJson = JSON.parse(pkgRaw);\n\t\t} catch (err) {\n\t\t\tif (err instanceof SyntaxError) return emitError(ui, flags, errorInitInvalidManifest({\n\t\t\t\tpath: \"package.json\",\n\t\t\t\tcause: err.message\n\t\t\t}));\n\t\t\tthrow err;\n\t\t}\n\t\tlet workingPkg = pkgRaw;\n\t\tlet pkgChanged = synthesisePackageJson;\n\t\tif (inputs.removePreviousFacade !== null) {\n\t\t\tconst next = removeDependency(workingPkg, inputs.removePreviousFacade);\n\t\t\tif (next !== null) {\n\t\t\t\tworkingPkg = next;\n\t\t\t\tpkgChanged = true;\n\t\t\t}\n\t\t}\n\t\tconst { content: nextPkg, warnings: scriptWarnings } = mergePackageScripts(workingPkg, REQUIRED_SCRIPTS);\n\t\tif (nextPkg !== null) {\n\t\t\tworkingPkg = nextPkg;\n\t\t\tpkgChanged = true;\n\t\t}\n\t\tconst { content: typedPkg, warning: typeWarning } = ensureEsmModuleType(workingPkg);\n\t\tif (typedPkg !== null) {\n\t\t\tworkingPkg = typedPkg;\n\t\t\tpkgChanged = true;\n\t\t}\n\t\tif (pkgChanged) filesToWrite.push({\n\t\t\tpath: \"package.json\",\n\t\t\tcontent: workingPkg\n\t\t});\n\t\twarnings.push(...scriptWarnings);\n\t\tif (typeWarning !== null) warnings.push(typeWarning);\n\t\tif (synthesisePackageJson) warnings.push(\"No package.json found in the target directory; created a minimal one. Edit `name` / `version` to taste.\");\n\t}\n\tif (existsSync(join(baseDir, \"src/index.ts\"))) if (!existsSync(join(baseDir, \"README.md\"))) {\n\t\tconst rawName = parsedPackageJson !== null && typeof parsedPackageJson[\"name\"] === \"string\" ? parsedPackageJson[\"name\"] : basename(baseDir);\n\t\tfilesToWrite.push({\n\t\t\tpath: \"README.md\",\n\t\t\tcontent: minimalProjectReadmeMd(inputs.target, inputs.schemaPath, sanitisePackageName(rawName), pm)\n\t\t});\n\t} else warnings.push(\"README.md already exists; leaving it untouched.\");\n\tfor (const file of filesToWrite) {\n\t\tconst fullPath = join(baseDir, file.path);\n\t\tmkdirSync(dirname(fullPath), { recursive: true });\n\t\twriteFileSync(fullPath, file.content, \"utf-8\");\n\t\tfilesWritten.push(file.path);\n\t\tif (file.logMessage !== void 0 && !flags.json && !flags.quiet) ui.log(file.logMessage);\n\t}\n\tfor (const rel of filesToDelete) {\n\t\tconst fullPath = join(baseDir, rel);\n\t\tif (!existsSync(fullPath)) continue;\n\t\ttry {\n\t\t\tunlinkSync(fullPath);\n\t\t\tfilesDeleted.push(rel);\n\t\t} catch (err) {\n\t\t\tif (!(err instanceof Error && \"code\" in err && err.code === \"ENOENT\")) throw err;\n\t\t}\n\t}\n\tconst emitCommand = formatRunCommand(pm, \"prisma-next\", \"contract emit\");\n\tlet install;\n\ttry {\n\t\tinstall = await runInstall({\n\t\t\tbaseDir,\n\t\t\tpm,\n\t\t\ttarget: inputs.target,\n\t\t\tinstall: inputs.install,\n\t\t\tflags,\n\t\t\tui,\n\t\t\tfilesWritten,\n\t\t\tresolveImportSpecifier,\n\t\t\thasTypesNode: parsedPackageJson !== null ? hasDirectDep(parsedPackageJson, \"@types/node\") : false\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError$1.is(error)) return emitError(ui, flags, error);\n\t\tthrow error;\n\t}\n\twarnings.push(...install.warnings);\n\tlet contractEmitted = false;\n\tif (!install.skipped) try {\n\t\tawait runEmit({\n\t\t\tbaseDir,\n\t\t\tui,\n\t\t\tfilesWritten,\n\t\t\temitCommand\n\t\t});\n\t\tcontractEmitted = true;\n\t} catch (error) {\n\t\tif (CliStructuredError$1.is(error)) return emitError(ui, flags, error);\n\t\tthrow error;\n\t}\n\tif (inputs.probeDb) {\n\t\tconst escalated = applyProbeOutcome(await probeServerVersion({\n\t\t\tbaseDir,\n\t\t\ttarget: inputs.target,\n\t\t\tdatabaseUrl: process.env[\"DATABASE_URL\"],\n\t\t\tminVersion: MIN_SERVER_VERSION[inputs.target]\n\t\t}, probeOverrides ?? {}), {\n\t\t\tstrictProbe: inputs.strictProbe,\n\t\t\twarnings\n\t\t});\n\t\tif (escalated !== null) return emitError(ui, flags, errorInitProbeFailed({\n\t\t\tcause: escalated,\n\t\t\tfilesWritten\n\t\t}));\n\t}\n\tconst manualProjectSkillSummary = DEFAULT_SKILL_SOURCES.map((source) => formatSkillInstallCommand({\n\t\tpm: install.effectivePm,\n\t\tsource\n\t})).map((c) => `\\`${c}\\``).join(\" && \");\n\tlet skillRegistered = false;\n\tif (!inputs.installProjectSkill) warnings.push(`Skipped Prisma Next skills install (--no-skill). To install the skills later, run: ${manualProjectSkillSummary}`);\n\telse {\n\t\tconst spinner = ui.spinner();\n\t\tspinner.start(\"Registering Prisma Next skills with the agent runtime...\");\n\t\ttry {\n\t\t\tconst project = await runProjectLevelSkillInstall({\n\t\t\t\tbaseDir,\n\t\t\t\tpm: install.effectivePm,\n\t\t\t\tfilesWritten\n\t\t\t});\n\t\t\tspinner.stop(`Registered Prisma Next skills (project level) — ran ${project.commands.map((c) => `\\`${c}\\``).join(\", \")}`);\n\t\t\tskillRegistered = true;\n\t\t} catch (error) {\n\t\t\tspinner.stop(\"Agent-skill install failed\");\n\t\t\tif (CliStructuredError$1.is(error)) return emitError(ui, flags, error);\n\t\t\tthrow error;\n\t\t}\n\t}\n\tconst output = {\n\t\tok: true,\n\t\ttarget: inputs.target === \"mongo\" ? \"mongodb\" : \"postgres\",\n\t\tauthoring: inputs.authoring,\n\t\tschemaPath: inputs.schemaPath,\n\t\tfilesWritten,\n\t\tfilesDeleted,\n\t\tpackagesInstalled: {\n\t\t\tskipped: install.skipped,\n\t\t\tdeps: [...install.deps],\n\t\t\tdevDeps: [...install.devDeps]\n\t\t},\n\t\tcontractEmitted,\n\t\tnextSteps: buildNextSteps({\n\t\t\ttarget: inputs.target === \"mongo\" ? \"mongodb\" : \"postgres\",\n\t\t\tcontractEmitted,\n\t\t\temitCommand,\n\t\t\tschemaPath: inputs.schemaPath,\n\t\t\tskillRegistered\n\t\t}),\n\t\twarnings\n\t};\n\tconst validated = InitOutputSchema(output);\n\tif (validated instanceof Error || validated.problems !== void 0) return emitError(ui, flags, new CliStructuredError$1(\"CLI.INIT_INVALID_OUTPUT_DOCUMENT\", \"Init produced an invalid output document\", {\n\t\twhy: `The success document failed schema validation: ${String(validated)}`,\n\t\tfix: \"This is a bug in prisma-next. Please report it with the full `-v` output.\",\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_INVALID_OUTPUT_DOCUMENT\")\n\t}));\n\tif (flags.json) ui.output(formatInitJson(output));\n\telse {\n\t\trenderInitOutro(ui, output, flags);\n\t\tif (!flags.quiet) clack.outro(\"Done. Open prisma-next.md to get started.\", { output: process.stderr });\n\t}\n\treturn 0;\n}\n/**\n* Renders a structured CLI error to the right channel and returns the exit\n* code derived from the error's PN code. JSON-mode errors go to stdout\n* (so consumers always parse from one place); human-mode errors go to\n* stderr. Mirrors `handleResult` but returns init-specific exit codes\n* rather than the CLI/RUN binary.\n*/\nfunction emitError(ui, flags, error) {\n\tconst envelope = error.toEnvelope();\n\tif (flags.json) ui.output(formatErrorJson(envelope));\n\telse ui.error(formatErrorOutput(envelope, flags));\n\treturn exitCodeForError(error);\n}\n/**\n* Maps a structured init error to its documented exit code. Centralised so\n* the error → exit-code contract lives next to the codes themselves.\n*\n* `CLI.INIT_INVALID_OUTPUT_DOCUMENT` (and the unknown-code default branch)\n* routes to `INIT_EXIT_INTERNAL_ERROR` because those represent prisma-next\n* bugs the user did not cause — surfacing them as `PRECONDITION` would\n* mislead automation into thinking the caller mis-invoked the CLI.\n*\n* See [exit-codes.ts](./exit-codes.ts) for the canonical list and\n* [Style Guide § Exit Codes](../../../../../../../docs/CLI%20Style%20Guide.md#exit-codes)\n* for the reservation policy.\n*\n* Exported for unit tests so the mapping can be asserted without\n* round-tripping a full `runInit` invocation.\n*/\nfunction exitCodeForError(error) {\n\tswitch (error.code) {\n\t\tcase \"CLI.INIT_REINIT_NEEDS_FORCE\":\n\t\tcase \"CLI.INIT_MISSING_FLAGS\":\n\t\tcase \"CLI.INIT_INVALID_FLAG_VALUE\":\n\t\tcase \"CLI.INIT_STRICT_PROBE_WITHOUT_PROBE\":\n\t\tcase \"CLI.INIT_INVALID_MANIFEST\":\n\t\tcase \"CLI.INIT_INVALID_TSCONFIG\":\n\t\tcase \"CLI.INIT_PROBE_FAILED\":\n\t\tcase \"CLI.INIT_AUTHORING_SCHEMA_PATH_MISMATCH\": return 2;\n\t\tcase \"CLI.INIT_USER_ABORTED\": return 3;\n\t\tcase \"CLI.INIT_INSTALL_FAILED\": return 4;\n\t\tcase \"CLI.INIT_EMIT_FAILED\": return 5;\n\t\tcase \"CLI.INIT_INVALID_OUTPUT_DOCUMENT\": return 1;\n\t\tcase \"CLI.INIT_SKILL_INSTALL_FAILED\": return 6;\n\t\tdefault: return 1;\n\t}\n}\n/**\n* Folds a `ProbeOutcome` into init's warning channel and returns the\n* fatal cause string when `--strict-probe` should escalate. Mirrors\n* the FR8.3 contract:\n*\n* - `ok` — informational; nothing surfaced unless verbose. (We could\n* plumb a `note` here, but the spec only requires the warning side\n* of the contract; an \"all good\" line would just be noise on the\n* common path.)\n* - `below-minimum` — warning regardless of `--strict-probe`. The\n* probe ran successfully and found an old server; that is not a\n* probe *failure* (which is what `--strict-probe` escalates), it\n* is the probe doing its job.\n* - `no-database-url` / `connection-failed` / `driver-missing` —\n* warning by default, fatal under `--strict-probe`.\n*\n* Exported for unit tests so the branching contract can be asserted\n* without spinning up a full `runInit` round trip.\n*/\nfunction applyProbeOutcome(outcome, ctx) {\n\tswitch (outcome.kind) {\n\t\tcase \"ok\": return null;\n\t\tcase \"below-minimum\":\n\t\t\tctx.warnings.push(outcome.message);\n\t\t\treturn null;\n\t\tcase \"no-database-url\":\n\t\tcase \"connection-failed\":\n\t\tcase \"driver-missing\":\n\t\t\tif (ctx.strictProbe) return outcome.message;\n\t\t\tctx.warnings.push(outcome.message);\n\t\t\treturn null;\n\t}\n}\n/**\n* Drives the `pnpm add` / `npm install` step. Failures are escalated to\n* a structured `errorInitInstallFailed` (exit code 4) — the spec treats\n* an unrecoverable install as a hard outcome rather than a warning so\n* CI/agents can branch on the exit code (FR1.6).\n*\n* For pnpm specifically, we additionally implement the FR7.2 fallback:\n* if pnpm fails with a recognised workspace/catalog resolution error\n* class (typically caused by a registry version that leaked\n* `workspace:*` or `catalog:` specifiers), we retry the install using\n* `npm` and surface a non-fatal warning explaining the swap.\n*/\nasync function runInstall(ctx) {\n\tconst { baseDir, pm, target, install, flags, ui, filesWritten, hasTypesNode } = ctx;\n\tconst deps = [targetPackageName(target, ctx.resolveImportSpecifier), \"dotenv\"];\n\tconst devDeps = hasTypesNode ? [\"prisma-next\"] : [\"prisma-next\", \"@types/node\"];\n\tconst addCommand = `${pm} ${formatAddArgs(pm, deps).join(\" \")}`;\n\tconst addDevCommand = `${pm} ${formatAddDevArgs(pm, devDeps).join(\" \")}`;\n\tconst emitCommand = formatRunCommand(pm, \"prisma-next\", \"contract emit\");\n\tconst catalogWarnings = pm === \"pnpm\" ? buildCatalogWarnings(baseDir, [...deps, ...devDeps]) : [];\n\tif (!install) {\n\t\tif (!flags.json && !flags.quiet) ui.note([\n\t\t\t\"Run the following commands to complete setup:\",\n\t\t\t\"\",\n\t\t\t\" 1. Install dependencies:\",\n\t\t\t` ${addCommand}`,\n\t\t\t` ${addDevCommand}`,\n\t\t\t\"\",\n\t\t\t\" 2. Emit the contract:\",\n\t\t\t` ${emitCommand}`\n\t\t].join(\"\\n\"), \"Manual steps\");\n\t\treturn {\n\t\t\tskipped: true,\n\t\t\tdeps: [],\n\t\t\tdevDeps: [],\n\t\t\twarnings: catalogWarnings,\n\t\t\teffectivePm: pm\n\t\t};\n\t}\n\tconst exec = promisify(execFile);\n\tconst runPair = async (manager) => {\n\t\tawait exec(manager, formatAddArgs(manager, deps), { cwd: baseDir });\n\t\tawait exec(manager, formatAddDevArgs(manager, devDeps), { cwd: baseDir });\n\t};\n\tconst allPackages = [...deps, ...devDeps].join(\", \");\n\tconst spinner = ui.spinner();\n\tspinner.start(`Installing ${allPackages}...`);\n\ttry {\n\t\tawait runPair(pm);\n\t\tspinner.stop(`Installed ${allPackages}`);\n\t\treturn {\n\t\t\tskipped: false,\n\t\t\tdeps,\n\t\t\tdevDeps,\n\t\t\twarnings: catalogWarnings,\n\t\t\teffectivePm: pm\n\t\t};\n\t} catch (err) {\n\t\tconst stderrText = redactSecrets(readChildStderr(err));\n\t\tif (pm === \"pnpm\" && isRecognisedPnpmResolutionError(stderrText)) {\n\t\t\tspinner.message(\"pnpm could not resolve a workspace/catalog dependency, retrying with npm...\");\n\t\t\ttry {\n\t\t\t\tawait runPair(\"npm\");\n\t\t\t\tspinner.stop(`Installed ${allPackages} via npm (pnpm fallback)`);\n\t\t\t\treturn {\n\t\t\t\t\tskipped: false,\n\t\t\t\t\tdeps,\n\t\t\t\t\tdevDeps,\n\t\t\t\t\twarnings: [[\n\t\t\t\t\t\t\"pnpm could not install: a published Prisma Next dependency leaked a `workspace:*` or `catalog:` specifier.\",\n\t\t\t\t\t\t\"Falling back to `npm install` so init can complete.\",\n\t\t\t\t\t\tstderrText ? ` pnpm error: ${stderrText.trim().split(\"\\n\")[0]}` : \"\",\n\t\t\t\t\t\t\"Once the offending package republishes a clean version, re-run `pnpm install` to switch back.\"\n\t\t\t\t\t].filter(Boolean).join(\"\\n\")],\n\t\t\t\t\teffectivePm: \"npm\"\n\t\t\t\t};\n\t\t\t} catch (npmErr) {\n\t\t\t\tspinner.stop(\"Installation failed\");\n\t\t\t\tthrow errorInitInstallFailed({\n\t\t\t\t\taddCommand,\n\t\t\t\t\taddDevCommand,\n\t\t\t\t\temitCommand,\n\t\t\t\t\tfilesWritten,\n\t\t\t\t\tstderrLines: [stderrText, redactSecrets(readChildStderr(npmErr))]\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tspinner.stop(\"Installation failed\");\n\t\tthrow errorInitInstallFailed({\n\t\t\taddCommand,\n\t\t\taddDevCommand,\n\t\t\temitCommand,\n\t\t\tfilesWritten,\n\t\t\tstderrLines: [stderrText]\n\t\t});\n\t}\n}\n/**\n* Builds the FR7.3 catalog-honoured warning(s) for the surrounding pnpm\n* workspace, if any. Returns an empty array when no `pnpm-workspace.yaml`\n* exists in any ancestor or when the workspace's catalog has no entry\n* for any of the packages `init` is about to install.\n*\n* Exported for unit tests.\n*/\nfunction buildCatalogWarnings(baseDir, packages) {\n\tconst result = detectPnpmCatalogOverrides(baseDir, packages);\n\tif (result === null || result.entries.length === 0) return [];\n\treturn [formatCatalogWarning(result.workspaceFile, result.entries)];\n}\nfunction formatCatalogWarning(workspaceFile, entries) {\n\treturn [\n\t\t\"pnpm workspace catalog overrides detected — pnpm will install these versions instead of `latest`:\",\n\t\tentries.map((entry) => ` • ${entry.name}: ${entry.version}`).join(\"\\n\"),\n\t\t`Catalog source: ${workspaceFile}`,\n\t\t\"To use the published `latest` instead, remove or update the catalog entry, then re-run `pnpm install`.\"\n\t].join(\"\\n\");\n}\n/**\n* Recognised pnpm error signatures that justify a fallback to npm.\n*\n* These patterns indicate the published artifact itself is at fault\n* (a leaked `workspace:*` or `catalog:` specifier), not the user's\n* environment — pnpm is faithfully reporting \"I cannot resolve this\n* registry version\", and npm is willing to install it because npm\n* doesn't care about the protocol prefix when there's a fallback range.\n*\n* Exported for unit tests; do not depend on this from outside the init\n* command.\n*/\nfunction isRecognisedPnpmResolutionError(stderr) {\n\tif (!stderr) return false;\n\treturn stderr.includes(\"ERR_PNPM_WORKSPACE_PKG_NOT_FOUND\") || stderr.includes(\"ERR_PNPM_NO_MATCHING_VERSION\") || /No matching version found for .* in the catalog/i.test(stderr) || /workspace:[^\\s]+ is not a valid (version|spec)/i.test(stderr) || /catalog:[^\\s]* is not a valid (version|spec)/i.test(stderr);\n}\n/**\n* FR2.1 — true when the parsed `package.json` declares `name` directly\n* in either `dependencies` or `devDependencies`. We deliberately don't\n* inspect `peerDependencies` (irrelevant for a leaf project) or the\n* lockfile (transitive presence is brittle to detect and not the\n* realistic clobber-risk path).\n*\n* Exported for unit tests.\n*/\nfunction hasDirectDep(parsed, name) {\n\tfor (const field of [\"dependencies\", \"devDependencies\"]) {\n\t\tconst value = parsed[field];\n\t\tif (value !== null && typeof value === \"object\" && name in value) return true;\n\t}\n\treturn false;\n}\nfunction readChildStderr(err) {\n\tif (err instanceof Error && \"stderr\" in err) return String(err.stderr ?? \"\");\n\treturn \"\";\n}\n/**\n* Redacts userinfo (`user:password@`) from any URL-shaped substring inside\n* package-manager stderr before we surface it in a warning or error\n* meta. pnpm and npm both include the offending registry URL in resolve\n* errors, and that URL can carry an auth token (e.g. corporate registry\n* mirrors that bake `_authToken` into the URL). The Style Guide\n* (Testing & Accessibility — \"Security: never print secrets\") requires\n* we never surface those.\n*\n* Exported for unit tests.\n*/\nfunction redactSecrets(stderr) {\n\tif (!stderr) return stderr;\n\treturn stderr.replace(/([a-zA-Z][a-zA-Z0-9+.-]*:\\/\\/)([^/@\\s]+)@/g, \"$1***@\");\n}\n/**\n* Drives `prisma-next contract emit` against the freshly scaffolded\n* project. On failure, throws `errorInitEmitFailed` with the underlying\n* cause embedded in `meta.cause` so the user can re-run with `-v` to see\n* the full envelope and follow the fix steps. Maps to exit code\n* `5 = EMIT_FAILED` (FR1.6).\n*/\nasync function runEmit(ctx) {\n\tconst spinner = ctx.ui.spinner();\n\tspinner.start(\"Emitting contract...\");\n\ttry {\n\t\tconst { executeContractEmit } = await import(\"./contract-emit-B6odMoem.mjs\").then((n) => n.t);\n\t\tawait executeContractEmit({ configPath: join(ctx.baseDir, \"prisma-next.config.ts\") });\n\t\tspinner.stop(\"Contract emitted\");\n\t} catch (err) {\n\t\tspinner.stop(\"Contract emission failed\");\n\t\tthrow errorInitEmitFailed({\n\t\t\temitCommand: ctx.emitCommand,\n\t\t\tfilesWritten: ctx.filesWritten,\n\t\t\tcause: causeMessage(err)\n\t\t});\n\t}\n}\nfunction causeMessage(err) {\n\tif (err instanceof Error) return err.message;\n\treturn String(err);\n}\n/**\n* Minimal `package.json` content used when init runs in a directory\n* that has no project manifest (TML-2496). Mirrors the npm 11 `init -y`\n* defaults, with two deliberate deviations:\n*\n* - `\"private\": true` so a stray `npm publish` cannot leak the\n* placeholder. Users who want to publish have to opt in by removing\n* the field.\n* - `\"type\": \"module\"` so the scaffolded ESM imports in\n* `prisma-next.config.ts` and `db.ts` typecheck and run without\n* additional tsconfig coercion.\n*\n* Exported for unit tests so the canonical shape is asserted in one\n* place rather than re-derived at every call site.\n*/\nfunction defaultPackageJsonContent(rawName) {\n\treturn `${JSON.stringify({\n\t\tname: sanitisePackageName(rawName),\n\t\tversion: \"0.0.0\",\n\t\tprivate: true,\n\t\ttype: \"module\"\n\t}, null, 2)}\\n`;\n}\n/**\n* npm package names are restricted to lowercase, no leading dot/underscore,\n* and a small URL-safe character set. `basename(cwd)` happily returns\n* \"My Project\" or \".hidden\" — both rejected by `npm install` validation.\n* Coerce to a safe fallback rather than emit a manifest npm refuses to\n* read.\n*/\nfunction sanitisePackageName(raw) {\n\tconst trimmed = raw.toLowerCase().replace(/[^a-z0-9._~-]/g, \"-\").replace(/^[._-]+/, \"\").replace(/-+/g, \"-\");\n\treturn trimmed.length > 0 ? trimmed : \"my-app\";\n}\n//#endregion\nexport { runInit };\n\n//# sourceMappingURL=init-DHctXAI9.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAM,wBAAwB,IAAI,IAAI;CACrC;CACA;CACA;CACA;CACA;AACD,CAAC;AACD,SAAS,iBAAiB,MAAM;CAC/B,OAAO,MAAM,IAAI,IAAI;AACtB;;;;;;;;;;;;;;;;;;;;;AAqBA,eAAe,qBAAqB,KAAK;CACxC,MAAM,WAAW,MAAM,OAAO,EAAE,IAAI,CAAC;CACrC,IAAI,YAAY,iBAAiB,SAAS,IAAI,GAAG,OAAO,SAAS;CACjE,MAAM,YAAY,aAAa;CAC/B,IAAI,cAAc,QAAQ,iBAAiB,SAAS,GAAG,OAAO;CAC9D,OAAO;AACR;AACA,SAAS,mBAAmB,KAAK;CAChC,OAAO,WAAW,KAAK,KAAK,cAAc,CAAC,KAAK,WAAW,KAAK,KAAK,WAAW,CAAC,KAAK,WAAW,KAAK,KAAK,YAAY,CAAC;AACzH;AACA,SAAS,iBAAiB,IAAI,KAAK,MAAM;CACxC,IAAI,OAAO,OAAO,OAAO,OAAO,IAAI,GAAG;CACvC,IAAI,OAAO,QAAQ,OAAO,gBAAgB,IAAI,GAAG;CACjD,OAAO,GAAG,GAAG,GAAG,IAAI,GAAG;AACxB;AACA,SAAS,uBAAuB,IAAI,YAAY;CAC/C,QAAQ,IAAR;EACC,KAAK,QAAQ,OAAO,aAAa;EACjC,KAA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