@prisma/orm-toolchain 0.16.0-dev.36
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.
- package/LICENSE +201 -0
- package/README.md +28 -0
- package/dist/aggregate-B4mhR4Sk.mjs +1012 -0
- package/dist/aggregate-B4mhR4Sk.mjs.map +1 -0
- package/dist/aggregate-BflrjWPO.d.mts +803 -0
- package/dist/aggregate-BflrjWPO.d.mts.map +1 -0
- package/dist/bin__prisma-next.mjs +800 -0
- package/dist/bin__prisma-next.mjs.map +1 -0
- package/dist/cli-telemetry.d.mts +367 -0
- package/dist/cli-telemetry.d.mts.map +1 -0
- package/dist/cli-telemetry.mjs +48 -0
- package/dist/cli-telemetry.mjs.map +1 -0
- package/dist/cli-telemetry__sender.d.mts +1 -0
- package/dist/cli-telemetry__sender.mjs +1 -0
- package/dist/cli.d.mts +31 -0
- package/dist/cli.d.mts.map +1 -0
- package/dist/cli.mjs +180 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/cli__commands__contract-emit.d.mts +2 -0
- package/dist/cli__commands__contract-emit.mjs +2 -0
- package/dist/cli__commands__contract-infer.d.mts +7 -0
- package/dist/cli__commands__contract-infer.d.mts.map +1 -0
- package/dist/cli__commands__contract-infer.mjs +2 -0
- package/dist/cli__commands__db-init.d.mts +7 -0
- package/dist/cli__commands__db-init.d.mts.map +1 -0
- package/dist/cli__commands__db-init.mjs +2 -0
- package/dist/cli__commands__db-schema.d.mts +7 -0
- package/dist/cli__commands__db-schema.d.mts.map +1 -0
- package/dist/cli__commands__db-schema.mjs +2 -0
- package/dist/cli__commands__db-sign.d.mts +7 -0
- package/dist/cli__commands__db-sign.d.mts.map +1 -0
- package/dist/cli__commands__db-sign.mjs +2 -0
- package/dist/cli__commands__db-update.d.mts +7 -0
- package/dist/cli__commands__db-update.d.mts.map +1 -0
- package/dist/cli__commands__db-update.mjs +2 -0
- package/dist/cli__commands__db-verify.d.mts +7 -0
- package/dist/cli__commands__db-verify.d.mts.map +1 -0
- package/dist/cli__commands__db-verify.mjs +2 -0
- package/dist/cli__commands__migrate.d.mts +66 -0
- package/dist/cli__commands__migrate.d.mts.map +1 -0
- package/dist/cli__commands__migrate.mjs +2 -0
- package/dist/cli__commands__migration-check.d.mts +64 -0
- package/dist/cli__commands__migration-check.d.mts.map +1 -0
- package/dist/cli__commands__migration-check.mjs +3 -0
- package/dist/cli__commands__migration-graph.d.mts +36 -0
- package/dist/cli__commands__migration-graph.d.mts.map +1 -0
- package/dist/cli__commands__migration-graph.mjs +2 -0
- package/dist/cli__commands__migration-list.d.mts +79 -0
- package/dist/cli__commands__migration-list.d.mts.map +1 -0
- package/dist/cli__commands__migration-list.mjs +2 -0
- package/dist/cli__commands__migration-log.d.mts +20 -0
- package/dist/cli__commands__migration-log.d.mts.map +1 -0
- package/dist/cli__commands__migration-log.mjs +2 -0
- package/dist/cli__commands__migration-new.d.mts +7 -0
- package/dist/cli__commands__migration-new.d.mts.map +1 -0
- package/dist/cli__commands__migration-new.mjs +2 -0
- package/dist/cli__commands__migration-plan.d.mts +79 -0
- package/dist/cli__commands__migration-plan.d.mts.map +1 -0
- package/dist/cli__commands__migration-plan.mjs +2 -0
- package/dist/cli__commands__migration-show.d.mts +27 -0
- package/dist/cli__commands__migration-show.d.mts.map +1 -0
- package/dist/cli__commands__migration-show.mjs +2 -0
- package/dist/cli__commands__migration-status.d.mts +55 -0
- package/dist/cli__commands__migration-status.d.mts.map +1 -0
- package/dist/cli__commands__migration-status.mjs +3 -0
- package/dist/cli__commands__ref.d.mts +34 -0
- package/dist/cli__commands__ref.d.mts.map +1 -0
- package/dist/cli__commands__ref.mjs +2 -0
- package/dist/cli__commands__telemetry.d.mts +7 -0
- package/dist/cli__commands__telemetry.d.mts.map +1 -0
- package/dist/cli__commands__telemetry.mjs +2 -0
- package/dist/cli__config-types.d.mts +2 -0
- package/dist/cli__config-types.mjs +2 -0
- package/dist/cli__control-api.d.mts +141 -0
- package/dist/cli__control-api.d.mts.map +1 -0
- package/dist/cli__control-api.mjs +4 -0
- package/dist/cli__init-output.d.mts +37 -0
- package/dist/cli__init-output.d.mts.map +1 -0
- package/dist/cli__init-output.mjs +2 -0
- package/dist/cli__migration-cli.d.mts +79 -0
- package/dist/cli__migration-cli.d.mts.map +1 -0
- package/dist/cli__migration-cli.mjs +407 -0
- package/dist/cli__migration-cli.mjs.map +1 -0
- package/dist/client-75qrAPqf-DZAVUxFa.mjs +1606 -0
- package/dist/client-75qrAPqf-DZAVUxFa.mjs.map +1 -0
- package/dist/command-helpers-CAoXqAY9-DWUBcTXM.mjs +1671 -0
- package/dist/command-helpers-CAoXqAY9-DWUBcTXM.mjs.map +1 -0
- package/dist/config-loader.d.mts +18 -0
- package/dist/config-loader.d.mts.map +1 -0
- package/dist/config-loader.mjs +2 -0
- package/dist/constants-CM-w38DQ-Cz_EXbOc.mjs +10 -0
- package/dist/constants-CM-w38DQ-Cz_EXbOc.mjs.map +1 -0
- package/dist/constants-Dkcn8Qu4.d.mts +10 -0
- package/dist/constants-Dkcn8Qu4.d.mts.map +1 -0
- package/dist/contract-at-errors-BX7w-p19-SxA8eaV2.mjs +36 -0
- package/dist/contract-at-errors-BX7w-p19-SxA8eaV2.mjs.map +1 -0
- package/dist/contract-emit-0hSjbuxp-BBOKldTZ.mjs +148 -0
- package/dist/contract-emit-0hSjbuxp-BBOKldTZ.mjs.map +1 -0
- package/dist/contract-emit-B65_UiFn.d.mts +7 -0
- package/dist/contract-emit-B65_UiFn.d.mts.map +1 -0
- package/dist/contract-emit-B6odMoem-CK3diBPk.mjs +359 -0
- package/dist/contract-emit-B6odMoem-CK3diBPk.mjs.map +1 -0
- package/dist/contract-enrichment-DrMvvY2A-DxNGeF4d.mjs +56 -0
- package/dist/contract-enrichment-DrMvvY2A-DxNGeF4d.mjs.map +1 -0
- package/dist/contract-infer-BnkqpftN-DVM2eKJ3.mjs +73 -0
- package/dist/contract-infer-BnkqpftN-DVM2eKJ3.mjs.map +1 -0
- package/dist/contract-snapshot-store-CbqynbtE.d.mts +28 -0
- package/dist/contract-snapshot-store-CbqynbtE.d.mts.map +1 -0
- package/dist/contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs +118 -0
- package/dist/contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs.map +1 -0
- package/dist/contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs +302 -0
- package/dist/contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs.map +1 -0
- package/dist/db-init-Vbkb_TKZ.mjs +153 -0
- package/dist/db-init-Vbkb_TKZ.mjs.map +1 -0
- package/dist/db-schema-ClQCu3xY.mjs +47 -0
- package/dist/db-schema-ClQCu3xY.mjs.map +1 -0
- package/dist/db-sign-jjXDgQ1u.mjs +175 -0
- package/dist/db-sign-jjXDgQ1u.mjs.map +1 -0
- package/dist/db-update-BQlrqtDD.mjs +183 -0
- package/dist/db-update-BQlrqtDD.mjs.map +1 -0
- package/dist/db-verify-CKPsRFrj-3udprZQD.mjs +396 -0
- package/dist/db-verify-CKPsRFrj-3udprZQD.mjs.map +1 -0
- package/dist/domain-type-generation-DAn9y5d2-BgoT5uKI.mjs +334 -0
- package/dist/domain-type-generation-DAn9y5d2-BgoT5uKI.mjs.map +1 -0
- package/dist/domain-type-generation-PkAb39ob-Ct8AGqow.d.mts +63 -0
- package/dist/domain-type-generation-PkAb39ob-Ct8AGqow.d.mts.map +1 -0
- package/dist/emitter.d.mts +75 -0
- package/dist/emitter.d.mts.map +1 -0
- package/dist/emitter.mjs +3 -0
- package/dist/emitter__domain-type-generation.d.mts +2 -0
- package/dist/emitter__domain-type-generation.mjs +2 -0
- package/dist/emitter__type-expression-safety.d.mts +6 -0
- package/dist/emitter__type-expression-safety.d.mts.map +1 -0
- package/dist/emitter__type-expression-safety.mjs +2 -0
- package/dist/errors--qsXZUtL.d.mts +72 -0
- package/dist/errors--qsXZUtL.d.mts.map +1 -0
- package/dist/errors-IpZm1Skp-BH495dRd.mjs +378 -0
- package/dist/errors-IpZm1Skp-BH495dRd.mjs.map +1 -0
- package/dist/exports-BN0vFTxG.mjs +276 -0
- package/dist/exports-BN0vFTxG.mjs.map +1 -0
- package/dist/exports-B_xhKZmC.mjs +1436 -0
- package/dist/exports-B_xhKZmC.mjs.map +1 -0
- package/dist/exports-D3-NwrMA-CadaBGQ3.mjs +154 -0
- package/dist/exports-D3-NwrMA-CadaBGQ3.mjs.map +1 -0
- package/dist/exports-Dl2aGAk7.mjs +119 -0
- package/dist/exports-Dl2aGAk7.mjs.map +1 -0
- package/dist/format-ByDm2goZ-DKLyhNHo.mjs +101 -0
- package/dist/format-ByDm2goZ-DKLyhNHo.mjs.map +1 -0
- package/dist/framework-components-CjshQKHA-Dlp6Leo5.mjs +58 -0
- package/dist/framework-components-CjshQKHA-Dlp6Leo5.mjs.map +1 -0
- package/dist/global-flags-BpoOYtNZ-CHZD3fud.d.mts +35 -0
- package/dist/global-flags-BpoOYtNZ-CHZD3fud.d.mts.map +1 -0
- package/dist/graph-bDjJ4GL9-BhFevsJS.d.mts +28 -0
- package/dist/graph-bDjJ4GL9-BhFevsJS.d.mts.map +1 -0
- package/dist/graph-membership-DW6nnbyQ-Bp2KcVwR.mjs +14 -0
- package/dist/graph-membership-DW6nnbyQ-Bp2KcVwR.mjs.map +1 -0
- package/dist/hash-DH8hl5Rq-BpM2t3Nu.mjs +64 -0
- package/dist/hash-DH8hl5Rq-BpM2t3Nu.mjs.map +1 -0
- package/dist/hash-XZYYKJ-i.d.mts +53 -0
- package/dist/hash-XZYYKJ-i.d.mts.map +1 -0
- package/dist/import-roots-B6CtsWXb.d.mts +119 -0
- package/dist/import-roots-B6CtsWXb.d.mts.map +1 -0
- package/dist/import-roots-NDOIEDVj.mjs +217 -0
- package/dist/import-roots-NDOIEDVj.mjs.map +1 -0
- package/dist/init-DHctXAI9-DSlaaYXN.mjs +2186 -0
- package/dist/init-DHctXAI9-DSlaaYXN.mjs.map +1 -0
- package/dist/inspect-live-schema-CnwYTRZ0-BErPHMni.mjs +91 -0
- package/dist/inspect-live-schema-CnwYTRZ0-BErPHMni.mjs.map +1 -0
- package/dist/invariants-B5wLrgQS.d.mts +39 -0
- package/dist/invariants-B5wLrgQS.d.mts.map +1 -0
- package/dist/invariants-lXzy6txi-DAoP4nTE.mjs +57 -0
- package/dist/invariants-lXzy6txi-DAoP4nTE.mjs.map +1 -0
- package/dist/io-C8TdyBKt-DloEBi70.mjs +313 -0
- package/dist/io-C8TdyBKt-DloEBi70.mjs.map +1 -0
- package/dist/io-DYfeLJxR.d.mts +1 -0
- package/dist/io-sr4CO9_t-C3eV_kn-.d.mts +125 -0
- package/dist/io-sr4CO9_t-C3eV_kn-.d.mts.map +1 -0
- package/dist/ledger-origin-BGRN77Oy.d.mts +6 -0
- package/dist/ledger-origin-BGRN77Oy.d.mts.map +1 -0
- package/dist/ledger-origin-D7PN4Fon.mjs +9 -0
- package/dist/ledger-origin-D7PN4Fon.mjs.map +1 -0
- package/dist/metadata-2nbOAGsV-uYNeq2Cp.d.mts +2 -0
- package/dist/metadata-BtscDay2.d.mts +1 -0
- package/dist/migrate-Cb_iv264.mjs +500 -0
- package/dist/migrate-Cb_iv264.mjs.map +1 -0
- package/dist/migration-B2ljMJim.d.mts +155 -0
- package/dist/migration-B2ljMJim.d.mts.map +1 -0
- package/dist/migration-BuUmO7It.mjs +209 -0
- package/dist/migration-BuUmO7It.mjs.map +1 -0
- package/dist/migration-check-CcG-fB8r-CDs5C9vt.mjs +597 -0
- package/dist/migration-check-CcG-fB8r-CDs5C9vt.mjs.map +1 -0
- package/dist/migration-command-scaffold-BCuoeAki-B1pVGX8d.mjs +103 -0
- package/dist/migration-command-scaffold-BCuoeAki-B1pVGX8d.mjs.map +1 -0
- package/dist/migration-graph-CBf9ORe7-B4xAF8GN.mjs +500 -0
- package/dist/migration-graph-CBf9ORe7-B4xAF8GN.mjs.map +1 -0
- package/dist/migration-graph-DkoCC0Qy.mjs +185 -0
- package/dist/migration-graph-DkoCC0Qy.mjs.map +1 -0
- package/dist/migration-graph-Dqndu0i5.d.mts +9 -0
- package/dist/migration-graph-Dqndu0i5.d.mts.map +1 -0
- package/dist/migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs +1945 -0
- package/dist/migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs.map +1 -0
- package/dist/migration-graph-tarTxJ99-BrGBANeE.d.mts +124 -0
- package/dist/migration-graph-tarTxJ99-BrGBANeE.d.mts.map +1 -0
- package/dist/migration-list-BFBeo1_X-c0kqYokL.mjs +228 -0
- package/dist/migration-list-BFBeo1_X-c0kqYokL.mjs.map +1 -0
- package/dist/migration-log-CS5IWcNq-BQ-32Low.mjs +220 -0
- package/dist/migration-log-CS5IWcNq-BQ-32Low.mjs.map +1 -0
- package/dist/migration-new-BurCjyaQ.mjs +168 -0
- package/dist/migration-new-BurCjyaQ.mjs.map +1 -0
- package/dist/migration-path-target-D3Sj55PI-BICblCuk.mjs +38 -0
- package/dist/migration-path-target-D3Sj55PI-BICblCuk.mjs.map +1 -0
- package/dist/migration-plan-q_L84PN1-BWE0LTH6.mjs +759 -0
- package/dist/migration-plan-q_L84PN1-BWE0LTH6.mjs.map +1 -0
- package/dist/migration-show-Bx5I5aW9.mjs +171 -0
- package/dist/migration-show-Bx5I5aW9.mjs.map +1 -0
- package/dist/migration-status-CFlzlRmu-DewBN8Ys.mjs +444 -0
- package/dist/migration-status-CFlzlRmu-DewBN8Ys.mjs.map +1 -0
- package/dist/migration-tools.d.mts +23 -0
- package/dist/migration-tools.mjs +17 -0
- package/dist/migration-tools__aggregate.d.mts +2 -0
- package/dist/migration-tools__aggregate.mjs +2 -0
- package/dist/migration-tools__constants.d.mts +2 -0
- package/dist/migration-tools__constants.mjs +2 -0
- package/dist/migration-tools__contract-snapshot-store.d.mts +2 -0
- package/dist/migration-tools__contract-snapshot-store.mjs +2 -0
- package/dist/migration-tools__errors.d.mts +2 -0
- package/dist/migration-tools__errors.mjs +2 -0
- package/dist/migration-tools__graph.d.mts +2 -0
- package/dist/migration-tools__graph.mjs +1 -0
- package/dist/migration-tools__hash.d.mts +2 -0
- package/dist/migration-tools__hash.mjs +2 -0
- package/dist/migration-tools__invariants.d.mts +2 -0
- package/dist/migration-tools__invariants.mjs +2 -0
- package/dist/migration-tools__io.d.mts +3 -0
- package/dist/migration-tools__io.mjs +2 -0
- package/dist/migration-tools__ledger-origin.d.mts +2 -0
- package/dist/migration-tools__ledger-origin.mjs +2 -0
- package/dist/migration-tools__metadata.d.mts +3 -0
- package/dist/migration-tools__metadata.mjs +1 -0
- package/dist/migration-tools__migration-graph.d.mts +3 -0
- package/dist/migration-tools__migration-graph.mjs +3 -0
- package/dist/migration-tools__migration-ts.d.mts +2 -0
- package/dist/migration-tools__migration-ts.mjs +2 -0
- package/dist/migration-tools__migration.d.mts +2 -0
- package/dist/migration-tools__migration.mjs +2 -0
- package/dist/migration-tools__package.d.mts +3 -0
- package/dist/migration-tools__package.mjs +1 -0
- package/dist/migration-tools__ref-resolution.d.mts +2 -0
- package/dist/migration-tools__ref-resolution.mjs +2 -0
- package/dist/migration-tools__refs.d.mts +2 -0
- package/dist/migration-tools__refs.mjs +2 -0
- package/dist/migration-tools__spaces.d.mts +3 -0
- package/dist/migration-tools__spaces.mjs +3 -0
- package/dist/migration-ts-CNaAtK8C.d.mts +38 -0
- package/dist/migration-ts-CNaAtK8C.d.mts.map +1 -0
- package/dist/migration-ts-FyF55c4M.mjs +67 -0
- package/dist/migration-ts-FyF55c4M.mjs.map +1 -0
- package/dist/op-schema-BSVHzEQN-DIWt28D8.mjs +13 -0
- package/dist/op-schema-BSVHzEQN-DIWt28D8.mjs.map +1 -0
- package/dist/output-DWNYqZGc-D2sRgLAm.mjs +109 -0
- package/dist/output-DWNYqZGc-D2sRgLAm.mjs.map +1 -0
- package/dist/package-CfWiDNrr-ZR4HM_Iz.d.mts +21 -0
- package/dist/package-CfWiDNrr-ZR4HM_Iz.d.mts.map +1 -0
- package/dist/package-N9PPdFV_.d.mts +3 -0
- package/dist/progress-adapter-CjAeTxY_-BXYSd1eY.mjs +43 -0
- package/dist/progress-adapter-CjAeTxY_-BXYSd1eY.mjs.map +1 -0
- package/dist/project-import-root-CpwLCDLY-DkVwAnWj.mjs +99 -0
- package/dist/project-import-root-CpwLCDLY-DkVwAnWj.mjs.map +1 -0
- package/dist/publish-surface.d.mts +3 -0
- package/dist/publish-surface.mjs +3 -0
- package/dist/publish-surface__import-roots.d.mts +2 -0
- package/dist/publish-surface__import-roots.mjs +2 -0
- package/dist/publish-surface__shells.d.mts +2 -0
- package/dist/publish-surface__shells.mjs +2 -0
- package/dist/quick-reference-mongo.md +114 -0
- package/dist/quick-reference-postgres.md +93 -0
- package/dist/readme-mongo.md +35 -0
- package/dist/readme-postgres.md +34 -0
- package/dist/ref-B6cTthTi.mjs +171 -0
- package/dist/ref-B6cTthTi.mjs.map +1 -0
- package/dist/ref-advancement-CSPMoQs3-fEipZrdu.mjs +57 -0
- package/dist/ref-advancement-CSPMoQs3-fEipZrdu.mjs.map +1 -0
- package/dist/ref-resolution-BjJBWPjX.mjs +250 -0
- package/dist/ref-resolution-BjJBWPjX.mjs.map +1 -0
- package/dist/ref-resolution-COGOSL57.d.mts +127 -0
- package/dist/ref-resolution-COGOSL57.d.mts.map +1 -0
- package/dist/refs-BDbB9BRB-D6Za3Q49.mjs +241 -0
- package/dist/refs-BDbB9BRB-D6Za3Q49.mjs.map +1 -0
- package/dist/refs-BNCUu58Y-BIso5Jfg.d.mts +43 -0
- package/dist/refs-BNCUu58Y-BIso5Jfg.d.mts.map +1 -0
- package/dist/schemas-CeGMYFYX-h3OcU__O.d.mts +192 -0
- package/dist/schemas-CeGMYFYX-h3OcU__O.d.mts.map +1 -0
- package/dist/schemas-KhXMzNA_-CzZ7GFX_.mjs +112 -0
- package/dist/schemas-KhXMzNA_-CzZ7GFX_.mjs.map +1 -0
- package/dist/shells-BenrJHp2.mjs +602 -0
- package/dist/shells-BenrJHp2.mjs.map +1 -0
- package/dist/shells-COHV_Ozf.d.mts +135 -0
- package/dist/shells-COHV_Ozf.d.mts.map +1 -0
- package/dist/spaces-C27bA-xc.mjs +267 -0
- package/dist/spaces-C27bA-xc.mjs.map +1 -0
- package/dist/spaces-DxFj5y8l.d.mts +415 -0
- package/dist/spaces-DxFj5y8l.d.mts.map +1 -0
- package/dist/telemetry-CmbCa3Ld-CmE5zcIG.mjs +120 -0
- package/dist/telemetry-CmbCa3Ld-CmE5zcIG.mjs.map +1 -0
- package/dist/terminal-ui-BN4QOsm5-Bf3pim46.d.mts +133 -0
- package/dist/terminal-ui-BN4QOsm5-Bf3pim46.d.mts.map +1 -0
- package/dist/type-expression-safety-CgHTWypx.mjs +8 -0
- package/dist/type-expression-safety-CgHTWypx.mjs.map +1 -0
- package/dist/types-DZWEs4si-D8UlyJI0.d.mts +893 -0
- package/dist/types-DZWEs4si-D8UlyJI0.d.mts.map +1 -0
- package/dist/verify-DnVNjc5C-BGdsblBK.mjs +283 -0
- package/dist/verify-DnVNjc5C-BGdsblBK.mjs.map +1 -0
- package/dist/verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs +252 -0
- package/dist/verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs.map +1 -0
- package/dist/verify-contract-spaces-Cc1u_wJo-BilPJS2S.d.mts +136 -0
- package/dist/verify-contract-spaces-Cc1u_wJo-BilPJS2S.d.mts.map +1 -0
- package/dist/vite-plugin-contract-emit.d.mts +54 -0
- package/dist/vite-plugin-contract-emit.d.mts.map +1 -0
- package/dist/vite-plugin-contract-emit.mjs +303 -0
- package/dist/vite-plugin-contract-emit.mjs.map +1 -0
- package/package.json +127 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-DHctXAI9-DSlaaYXN.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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E;;;;;;;;AAQA,eAAe,QAAQ,KAAK;CAC3B,MAAM,UAAU,IAAI,GAAG,QAAQ;CAC/B,QAAQ,MAAM,sBAAsB;CACpC,IAAI;EACH,MAAM,EAAE,wBAAwB,MAAM,OAAO,wCAA+B,CAAA,MAAA,MAAA,EAAA,CAAA,CAAA,CAAC,MAAM,MAAM,EAAE,CAAC;EAC5F,MAAM,oBAAoB,EAAE,YAAY,KAAK,IAAI,SAAS,uBAAuB,EAAE,CAAC;EACpF,QAAQ,KAAK,kBAAkB;CAChC,SAAS,KAAK;EACb,QAAQ,KAAK,0BAA0B;EACvC,MAAM,oBAAoB;GACzB,aAAa,IAAI;GACjB,cAAc,IAAI;GAClB,OAAO,aAAa,GAAG;EACxB,CAAC;CACF;AACD;AACA,SAAS,aAAa,KAAK;CAC1B,IAAI,eAAe,OAAO,OAAO,IAAI;CACrC,OAAO,OAAO,GAAG;AAClB;;;;;;;;;;;;;;;;AAgBA,SAAS,0BAA0B,SAAS;CAC3C,OAAO,GAAG,KAAK,UAAU;EACxB,MAAM,oBAAoB,OAAO;EACjC,SAAS;EACT,SAAS;EACT,MAAM;CACP,GAAG,MAAM,CAAC,EAAE;AACb;;;;;;;;AAQA,SAAS,oBAAoB,KAAK;CACjC,MAAM,UAAU,IAAI,YAAY,CAAC,CAAC,QAAQ,kBAAkB,GAAG,CAAC,CAAC,QAAQ,WAAW,EAAE,CAAC,CAAC,QAAQ,OAAO,GAAG;CAC1G,OAAO,QAAQ,SAAS,IAAI,UAAU;AACvC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { $ as maskConnectionUrl, N as errorUnexpected, W as formatStyledHeader, f as errorDatabaseConnectionRequired, m as errorDriverRequired, ot as sanitizeErrorMessage, t as CliStructuredError$1 } from "./command-helpers-CAoXqAY9-DWUBcTXM.mjs";
|
|
2
|
+
import { r as loadConfig } from "./exports-Dl2aGAk7.mjs";
|
|
3
|
+
import { t as createProgressAdapter } from "./progress-adapter-CjAeTxY_-BXYSd1eY.mjs";
|
|
4
|
+
import { t as createControlClient } from "./client-75qrAPqf-DZAVUxFa.mjs";
|
|
5
|
+
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
6
|
+
import { relative, resolve } from "pathe";
|
|
7
|
+
//#region ../../../1-framework/3-tooling/cli/dist/inspect-live-schema-CnwYTRZ0.mjs
|
|
8
|
+
async function inspectLiveSchema(options, flags, ui, startTime, context) {
|
|
9
|
+
let config;
|
|
10
|
+
try {
|
|
11
|
+
config = await loadConfig(options.config);
|
|
12
|
+
} catch (error) {
|
|
13
|
+
if (CliStructuredError$1.is(error)) return notOk(error);
|
|
14
|
+
return notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: "Failed to load config" }));
|
|
15
|
+
}
|
|
16
|
+
const configPath = options.config ? relative(process.cwd(), resolve(options.config)) : "prisma-next.config.ts";
|
|
17
|
+
if (!flags.json && !flags.quiet) {
|
|
18
|
+
const details = [{
|
|
19
|
+
label: "config",
|
|
20
|
+
value: configPath
|
|
21
|
+
}];
|
|
22
|
+
if (options.db) details.push({
|
|
23
|
+
label: "database",
|
|
24
|
+
value: maskConnectionUrl(options.db)
|
|
25
|
+
});
|
|
26
|
+
else if (config.db?.connection && typeof config.db.connection === "string") details.push({
|
|
27
|
+
label: "database",
|
|
28
|
+
value: maskConnectionUrl(config.db.connection)
|
|
29
|
+
});
|
|
30
|
+
ui.stderr(formatStyledHeader({
|
|
31
|
+
command: context.commandName,
|
|
32
|
+
description: context.description,
|
|
33
|
+
url: context.url,
|
|
34
|
+
details,
|
|
35
|
+
flags
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
const dbConnection = options.db ?? config.db?.connection;
|
|
39
|
+
if (!dbConnection) return notOk(errorDatabaseConnectionRequired({
|
|
40
|
+
why: `Database connection is required for ${context.commandName} (set db.connection in ${configPath}, or pass --db <url>)`,
|
|
41
|
+
commandName: context.commandName
|
|
42
|
+
}));
|
|
43
|
+
if (!config.driver) return notOk(errorDriverRequired({ why: `Config.driver is required for ${context.commandName}` }));
|
|
44
|
+
const client = createControlClient({
|
|
45
|
+
family: config.family,
|
|
46
|
+
target: config.target,
|
|
47
|
+
adapter: config.adapter,
|
|
48
|
+
driver: config.driver,
|
|
49
|
+
extensions: config.extensions ?? []
|
|
50
|
+
});
|
|
51
|
+
const onProgress = createProgressAdapter({
|
|
52
|
+
ui,
|
|
53
|
+
flags
|
|
54
|
+
});
|
|
55
|
+
try {
|
|
56
|
+
const schema = await client.introspect({
|
|
57
|
+
connection: dbConnection,
|
|
58
|
+
onProgress
|
|
59
|
+
});
|
|
60
|
+
const schemaView = client.toSchemaView(schema);
|
|
61
|
+
const pslContractAst = client.inferPslContract(schema);
|
|
62
|
+
const pslBlockDescriptors = client.getPslBlockDescriptors();
|
|
63
|
+
const dbUrl = typeof dbConnection === "string" ? maskConnectionUrl(dbConnection) : void 0;
|
|
64
|
+
return ok({
|
|
65
|
+
config,
|
|
66
|
+
schema,
|
|
67
|
+
schemaView,
|
|
68
|
+
pslContractAst,
|
|
69
|
+
pslBlockDescriptors,
|
|
70
|
+
target: {
|
|
71
|
+
familyId: config.family.familyId,
|
|
72
|
+
id: config.target.targetId
|
|
73
|
+
},
|
|
74
|
+
meta: {
|
|
75
|
+
configPath,
|
|
76
|
+
...dbUrl ? { dbUrl } : {}
|
|
77
|
+
},
|
|
78
|
+
timings: { total: Date.now() - startTime }
|
|
79
|
+
});
|
|
80
|
+
} catch (error) {
|
|
81
|
+
if (CliStructuredError$1.is(error)) return notOk(error);
|
|
82
|
+
const safeMessage = sanitizeErrorMessage(error instanceof Error ? error.message : String(error), typeof dbConnection === "string" ? dbConnection : void 0);
|
|
83
|
+
return notOk(errorUnexpected(safeMessage, { why: `Unexpected error during ${context.commandName}: ${safeMessage}` }));
|
|
84
|
+
} finally {
|
|
85
|
+
await client.close();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
export { inspectLiveSchema as t };
|
|
90
|
+
|
|
91
|
+
//# sourceMappingURL=inspect-live-schema-CnwYTRZ0-BErPHMni.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect-live-schema-CnwYTRZ0-BErPHMni.mjs","names":["CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/inspect-live-schema-CnwYTRZ0.mjs"],"sourcesContent":["import { A as formatStyledHeader, F as CliStructuredError, U as errorDriverRequired, V as errorDatabaseConnectionRequired, c as sanitizeErrorMessage, ct as errorUnexpected, i as maskConnectionUrl } from \"./command-helpers-CAoXqAY9.mjs\";\nimport { t as createProgressAdapter } from \"./progress-adapter-CjAeTxY_.mjs\";\nimport { t as createControlClient } from \"./client-75qrAPqf.mjs\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { relative, resolve } from \"pathe\";\n//#region src/commands/inspect-live-schema.ts\nasync function inspectLiveSchema(options, flags, ui, startTime, context) {\n\tlet config;\n\ttry {\n\t\tconfig = await loadConfig(options.config);\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: \"Failed to load config\" }));\n\t}\n\tconst configPath = options.config ? relative(process.cwd(), resolve(options.config)) : \"prisma-next.config.ts\";\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: configPath\n\t\t}];\n\t\tif (options.db) details.push({\n\t\t\tlabel: \"database\",\n\t\t\tvalue: maskConnectionUrl(options.db)\n\t\t});\n\t\telse if (config.db?.connection && typeof config.db.connection === \"string\") details.push({\n\t\t\tlabel: \"database\",\n\t\t\tvalue: maskConnectionUrl(config.db.connection)\n\t\t});\n\t\tui.stderr(formatStyledHeader({\n\t\t\tcommand: context.commandName,\n\t\t\tdescription: context.description,\n\t\t\turl: context.url,\n\t\t\tdetails,\n\t\t\tflags\n\t\t}));\n\t}\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tif (!dbConnection) return notOk(errorDatabaseConnectionRequired({\n\t\twhy: `Database connection is required for ${context.commandName} (set db.connection in ${configPath}, or pass --db <url>)`,\n\t\tcommandName: context.commandName\n\t}));\n\tif (!config.driver) return notOk(errorDriverRequired({ why: `Config.driver is required for ${context.commandName}` }));\n\tconst client = createControlClient({\n\t\tfamily: config.family,\n\t\ttarget: config.target,\n\t\tadapter: config.adapter,\n\t\tdriver: config.driver,\n\t\textensions: config.extensions ?? []\n\t});\n\tconst onProgress = createProgressAdapter({\n\t\tui,\n\t\tflags\n\t});\n\ttry {\n\t\tconst schema = await client.introspect({\n\t\t\tconnection: dbConnection,\n\t\t\tonProgress\n\t\t});\n\t\tconst schemaView = client.toSchemaView(schema);\n\t\tconst pslContractAst = client.inferPslContract(schema);\n\t\tconst pslBlockDescriptors = client.getPslBlockDescriptors();\n\t\tconst dbUrl = typeof dbConnection === \"string\" ? maskConnectionUrl(dbConnection) : void 0;\n\t\treturn ok({\n\t\t\tconfig,\n\t\t\tschema,\n\t\t\tschemaView,\n\t\t\tpslContractAst,\n\t\t\tpslBlockDescriptors,\n\t\t\ttarget: {\n\t\t\t\tfamilyId: config.family.familyId,\n\t\t\t\tid: config.target.targetId\n\t\t\t},\n\t\t\tmeta: {\n\t\t\t\tconfigPath,\n\t\t\t\t...dbUrl ? { dbUrl } : {}\n\t\t\t},\n\t\t\ttimings: { total: Date.now() - startTime }\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tconst safeMessage = sanitizeErrorMessage(error instanceof Error ? error.message : String(error), typeof dbConnection === \"string\" ? dbConnection : void 0);\n\t\treturn notOk(errorUnexpected(safeMessage, { why: `Unexpected error during ${context.commandName}: ${safeMessage}` }));\n\t} finally {\n\t\tawait client.close();\n\t}\n}\n//#endregion\nexport { inspectLiveSchema as t };\n\n//# sourceMappingURL=inspect-live-schema-CnwYTRZ0.mjs.map"],"mappings":";;;;;;;AAOA,eAAe,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AC;CACD,MAAM,aAAa,sBAAsB;EACxC;EACA;CACD,CAAC;CACD,IAAI;EACH,MAAM,SAAS,MAAM,OAAO,WAAW;GACtC,YAAY;GACZ;EACD,CAAC;EACD,MAAM,aAAa,OAAO,aAAa,MAAM;EAC7C,MAAM,iBAAiB,OAAO,iBAAiB,MAAM;EACrD,MAAM,sBAAsB,OAAO,uBAAuB;EAC1D,MAAM,QAAQ,OAAO,iBAAiB,WAAW,kBAAkB,YAAY,IAAI,KAAK;EACxF,OAAO,GAAG;GACT;GACA;GACA;GACA;GACA;GACA,QAAQ;IACP,UAAU,OAAO,OAAO;IACxB,IAAI,OAAO,OAAO;GACnB;GACA,MAAM;IACL;IACA,GAAG,QAAQ,EAAE,MAAM,IAAI,CAAC;GACzB;GACA,SAAS,EAAE,OAAO,KAAK,IAAI,IAAI,UAAU;EAC1C,CAAC;CACF,SAAS,OAAO;EACf,IAAIA,qBAAmB,GAAG,KAAK,GAAG,OAAO,MAAM,KAAK;EACpD,MAAM,cAAc,qBAAqB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG,OAAO,iBAAiB,WAAW,eAAe,KAAK,CAAC;EACzJ,OAAO,MAAM,gBAAgB,aAAa,EAAE,KAAK,2BAA2B,QAAQ,YAAY,IAAI,cAAc,CAAC,CAAC;CACrH,UAAU;EACT,MAAM,OAAO,MAAM;CACpB;AACD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { t as MigrationOps } from "./package-CfWiDNrr-ZR4HM_Iz.mjs";
|
|
2
|
+
//#region ../../../1-framework/3-tooling/migration/dist/exports/invariants.d.mts
|
|
3
|
+
//#region src/invariants.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Hygiene check for `invariantId`. Rejects empty values plus any
|
|
6
|
+
* whitespace or control character (including Unicode whitespace like
|
|
7
|
+
* NBSP and em space, which are visually identical to ASCII space and
|
|
8
|
+
* routinely sneak in via paste).
|
|
9
|
+
*/
|
|
10
|
+
declare function validateInvariantId(invariantId: string): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Walk a migration's operations and produce its `providedInvariants`
|
|
13
|
+
* aggregate: the sorted, deduplicated list of `invariantId`s declared
|
|
14
|
+
* by ops in the migration. Ops without an `invariantId` are skipped.
|
|
15
|
+
*
|
|
16
|
+
* Both `data`-class ops (data-transforms, e.g. backfills) and
|
|
17
|
+
* `additive`-class opaque DDL (e.g. cipherstash's vendored EQL bundle
|
|
18
|
+
* via `installEqlBundleOp`) may declare invariantIds: the
|
|
19
|
+
* `operationClass` axis classifies *policy gating* (which kinds of ops
|
|
20
|
+
* a `db init` / `db update` policy permits), while `invariantId`
|
|
21
|
+
* classifies *marker bookkeeping* (which named bundles of work a
|
|
22
|
+
* future regeneration knows to skip). The two concerns are
|
|
23
|
+
* intentionally orthogonal — an extension can ship additive
|
|
24
|
+
* non-IR-derivable DDL (the only way the planner can know the bundle
|
|
25
|
+
* is already applied is via the invariantId on the marker) without
|
|
26
|
+
* needing to mis-classify it as `data`-class.
|
|
27
|
+
*
|
|
28
|
+
* Throws `MIGRATION.INVALID_INVARIANT_ID` on a malformed id and
|
|
29
|
+
* `MIGRATION.DUPLICATE_INVARIANT_IN_EDGE` on duplicates.
|
|
30
|
+
*
|
|
31
|
+
* @see docs/architecture docs/adrs/ADR 212 - Contract spaces.md
|
|
32
|
+
* — extension migrations carry `invariantId`s on additive ops; e.g.
|
|
33
|
+
* cipherstash's `installEqlBundle` and structural `create-*` ops are
|
|
34
|
+
* additive-class but carry `cipherstash:*` invariantIds.
|
|
35
|
+
*/
|
|
36
|
+
declare function deriveProvidedInvariants(ops: MigrationOps): readonly string[];
|
|
37
|
+
//#endregion
|
|
38
|
+
export { validateInvariantId as n, deriveProvidedInvariants as t };
|
|
39
|
+
//# sourceMappingURL=invariants-B5wLrgQS.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invariants-B5wLrgQS.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/invariants.d.mts"],"mappings":";;;;;;;;;iBAQiB,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0BpB,yBAAyB,KAAK"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { d as errorDuplicateInvariantInEdge, h as errorInvalidInvariantId } from "./errors-IpZm1Skp-BH495dRd.mjs";
|
|
2
|
+
//#region ../../../1-framework/3-tooling/migration/dist/invariants-lXzy6txi.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Hygiene check for `invariantId`. Rejects empty values plus any
|
|
5
|
+
* whitespace or control character (including Unicode whitespace like
|
|
6
|
+
* NBSP and em space, which are visually identical to ASCII space and
|
|
7
|
+
* routinely sneak in via paste).
|
|
8
|
+
*/
|
|
9
|
+
function validateInvariantId(invariantId) {
|
|
10
|
+
if (invariantId.length === 0) return false;
|
|
11
|
+
return !/[\p{Cc}\p{White_Space}]/u.test(invariantId);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Walk a migration's operations and produce its `providedInvariants`
|
|
15
|
+
* aggregate: the sorted, deduplicated list of `invariantId`s declared
|
|
16
|
+
* by ops in the migration. Ops without an `invariantId` are skipped.
|
|
17
|
+
*
|
|
18
|
+
* Both `data`-class ops (data-transforms, e.g. backfills) and
|
|
19
|
+
* `additive`-class opaque DDL (e.g. cipherstash's vendored EQL bundle
|
|
20
|
+
* via `installEqlBundleOp`) may declare invariantIds: the
|
|
21
|
+
* `operationClass` axis classifies *policy gating* (which kinds of ops
|
|
22
|
+
* a `db init` / `db update` policy permits), while `invariantId`
|
|
23
|
+
* classifies *marker bookkeeping* (which named bundles of work a
|
|
24
|
+
* future regeneration knows to skip). The two concerns are
|
|
25
|
+
* intentionally orthogonal — an extension can ship additive
|
|
26
|
+
* non-IR-derivable DDL (the only way the planner can know the bundle
|
|
27
|
+
* is already applied is via the invariantId on the marker) without
|
|
28
|
+
* needing to mis-classify it as `data`-class.
|
|
29
|
+
*
|
|
30
|
+
* Throws `MIGRATION.INVALID_INVARIANT_ID` on a malformed id and
|
|
31
|
+
* `MIGRATION.DUPLICATE_INVARIANT_IN_EDGE` on duplicates.
|
|
32
|
+
*
|
|
33
|
+
* @see docs/architecture docs/adrs/ADR 212 - Contract spaces.md
|
|
34
|
+
* — extension migrations carry `invariantId`s on additive ops; e.g.
|
|
35
|
+
* cipherstash's `installEqlBundle` and structural `create-*` ops are
|
|
36
|
+
* additive-class but carry `cipherstash:*` invariantIds.
|
|
37
|
+
*/
|
|
38
|
+
function deriveProvidedInvariants(ops) {
|
|
39
|
+
const seen = /* @__PURE__ */ new Set();
|
|
40
|
+
for (const op of ops) {
|
|
41
|
+
const invariantId = readInvariantId(op);
|
|
42
|
+
if (invariantId === void 0) continue;
|
|
43
|
+
if (!validateInvariantId(invariantId)) throw errorInvalidInvariantId(invariantId);
|
|
44
|
+
if (seen.has(invariantId)) throw errorDuplicateInvariantInEdge(invariantId);
|
|
45
|
+
seen.add(invariantId);
|
|
46
|
+
}
|
|
47
|
+
return [...seen].sort();
|
|
48
|
+
}
|
|
49
|
+
function readInvariantId(op) {
|
|
50
|
+
if (!Object.hasOwn(op, "invariantId")) return void 0;
|
|
51
|
+
const candidate = op.invariantId;
|
|
52
|
+
return typeof candidate === "string" ? candidate : void 0;
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { validateInvariantId as n, deriveProvidedInvariants as t };
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=invariants-lXzy6txi-DAoP4nTE.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invariants-lXzy6txi-DAoP4nTE.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/invariants-lXzy6txi.mjs"],"sourcesContent":["import { d as errorDuplicateInvariantInEdge, h as errorInvalidInvariantId } from \"./errors-IpZm1Skp.mjs\";\n//#region src/invariants.ts\n/**\n* Hygiene check for `invariantId`. Rejects empty values plus any\n* whitespace or control character (including Unicode whitespace like\n* NBSP and em space, which are visually identical to ASCII space and\n* routinely sneak in via paste).\n*/\nfunction validateInvariantId(invariantId) {\n\tif (invariantId.length === 0) return false;\n\treturn !/[\\p{Cc}\\p{White_Space}]/u.test(invariantId);\n}\n/**\n* Walk a migration's operations and produce its `providedInvariants`\n* aggregate: the sorted, deduplicated list of `invariantId`s declared\n* by ops in the migration. Ops without an `invariantId` are skipped.\n*\n* Both `data`-class ops (data-transforms, e.g. backfills) and\n* `additive`-class opaque DDL (e.g. cipherstash's vendored EQL bundle\n* via `installEqlBundleOp`) may declare invariantIds: the\n* `operationClass` axis classifies *policy gating* (which kinds of ops\n* a `db init` / `db update` policy permits), while `invariantId`\n* classifies *marker bookkeeping* (which named bundles of work a\n* future regeneration knows to skip). The two concerns are\n* intentionally orthogonal — an extension can ship additive\n* non-IR-derivable DDL (the only way the planner can know the bundle\n* is already applied is via the invariantId on the marker) without\n* needing to mis-classify it as `data`-class.\n*\n* Throws `MIGRATION.INVALID_INVARIANT_ID` on a malformed id and\n* `MIGRATION.DUPLICATE_INVARIANT_IN_EDGE` on duplicates.\n*\n* @see docs/architecture docs/adrs/ADR 212 - Contract spaces.md\n* — extension migrations carry `invariantId`s on additive ops; e.g.\n* cipherstash's `installEqlBundle` and structural `create-*` ops are\n* additive-class but carry `cipherstash:*` invariantIds.\n*/\nfunction deriveProvidedInvariants(ops) {\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const op of ops) {\n\t\tconst invariantId = readInvariantId(op);\n\t\tif (invariantId === void 0) continue;\n\t\tif (!validateInvariantId(invariantId)) throw errorInvalidInvariantId(invariantId);\n\t\tif (seen.has(invariantId)) throw errorDuplicateInvariantInEdge(invariantId);\n\t\tseen.add(invariantId);\n\t}\n\treturn [...seen].sort();\n}\nfunction readInvariantId(op) {\n\tif (!Object.hasOwn(op, \"invariantId\")) return void 0;\n\tconst candidate = op.invariantId;\n\treturn typeof candidate === \"string\" ? candidate : void 0;\n}\n//#endregion\nexport { validateInvariantId as n, deriveProvidedInvariants as t };\n\n//# sourceMappingURL=invariants-lXzy6txi.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,oBAAoB,aAAa;CACzC,IAAI,YAAY,WAAW,GAAG,OAAO;CACrC,OAAO,CAAC,2BAA2B,KAAK,WAAW;AACpD;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAS,yBAAyB,KAAK;CACtC,MAAM,uBAAuB,IAAI,IAAI;CACrC,KAAK,MAAM,MAAM,KAAK;EACrB,MAAM,cAAc,gBAAgB,EAAE;EACtC,IAAI,gBAAgB,KAAK,GAAG;EAC5B,IAAI,CAAC,oBAAoB,WAAW,GAAG,MAAM,wBAAwB,WAAW;EAChF,IAAI,KAAK,IAAI,WAAW,GAAG,MAAM,8BAA8B,WAAW;EAC1E,KAAK,IAAI,WAAW;CACrB;CACA,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,KAAK;AACvB;AACA,SAAS,gBAAgB,IAAI;CAC5B,IAAI,CAAC,OAAO,OAAO,IAAI,aAAa,GAAG,OAAO,KAAK;CACnD,MAAM,YAAY,GAAG;CACrB,OAAO,OAAO,cAAc,WAAW,YAAY,KAAK;AACzD"}
|