create-prisma 0.4.2-next.37.81.1 → 0.4.2-next.37.83.1

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/README.md CHANGED
@@ -11,9 +11,10 @@ Scaffold a new app with Prisma Next already wired up.
11
11
  - scaffolds `prisma/contract.prisma` or `prisma/contract.ts`
12
12
  - scaffolds `prisma-next.config.ts`
13
13
  - writes a template-specific Prisma Next runtime helper
14
- - adds `contract:emit`, `db:init`, `db:update`, `db:seed`, `migration:plan`, and `migration:apply` scripts
14
+ - adds `contract:emit`, `db:init`, `db:update`, `db:verify`, `db:seed`, `migration:plan`, `migration:apply`, `migration:status`, and `migration:show` scripts
15
15
  - adds `db:up` / `db:down` and `docker-compose.yml` for default MongoDB projects
16
16
  - creates or updates `.env` with `DATABASE_URL`
17
+ - writes `.env.example`, appends a Prisma Next reference to `README.md`, and scaffolds `.agents/skills/prisma-next/SKILL.md`
17
18
  - can install dependencies and run `prisma-next contract emit`
18
19
 
19
20
  `db:init`, migrations, and seeding are never run automatically. PostgreSQL projects show
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import "./create-C-bVmrxB.mjs";
2
+ import "./create-CXc9jHIv.mjs";
3
3
  import { createCreatePrismaCli } from "./index.mjs";
4
4
 
5
5
  //#region src/cli.ts
@@ -40,7 +40,7 @@ async function getAnonymousId() {
40
40
  }
41
41
  function getCommonProperties() {
42
42
  return {
43
- "cli-version": "0.4.2-next.37.81.1",
43
+ "cli-version": "0.4.2-next.37.83.1",
44
44
  "node-version": process.version,
45
45
  platform: process.platform,
46
46
  arch: process.arch
@@ -149,9 +149,11 @@ const dependencyVersionMap = {
149
149
  "@prisma-next/mongo": "0.4.4",
150
150
  "@prisma-next/mongo-contract": "0.4.4",
151
151
  "@prisma-next/mongo-contract-ts": "0.4.4",
152
+ "@prisma-next/mongo-orm": "0.4.4",
152
153
  "@prisma-next/postgres": "0.4.4",
153
154
  "@prisma-next/sql-contract": "0.4.4",
154
155
  "@prisma-next/sql-contract-ts": "0.4.4",
156
+ "@prisma-next/sql-orm-client": "0.4.4",
155
157
  "@prisma-next/target-mongo": "0.4.4",
156
158
  "@prisma-next/target-postgres": "0.4.4",
157
159
  "@types/node": "^25.6.2",
@@ -621,9 +623,12 @@ function getPrismaNextScriptMap(packageManager) {
621
623
  "contract:emit": `${prismaNextCli} contract emit`,
622
624
  "db:init": `${prismaNextCli} db init`,
623
625
  "db:update": `${prismaNextCli} db update`,
626
+ "db:verify": `${prismaNextCli} db verify`,
624
627
  "db:seed": "deno run -A --env-file=.env prisma/seed.ts",
625
628
  "migration:plan": `${prismaNextCli} migration plan`,
626
- "migration:apply": `${prismaNextCli} migration apply`
629
+ "migration:apply": `${prismaNextCli} migration apply`,
630
+ "migration:status": `${prismaNextCli} migration status`,
631
+ "migration:show": `${prismaNextCli} migration show`
627
632
  };
628
633
  }
629
634
  if (packageManager === "bun") {
@@ -632,18 +637,24 @@ function getPrismaNextScriptMap(packageManager) {
632
637
  "contract:emit": `${prismaNextCli} contract emit`,
633
638
  "db:init": `${prismaNextCli} db init`,
634
639
  "db:update": `${prismaNextCli} db update`,
640
+ "db:verify": `${prismaNextCli} db verify`,
635
641
  "db:seed": "bun prisma/seed.ts",
636
642
  "migration:plan": `${prismaNextCli} migration plan`,
637
- "migration:apply": `${prismaNextCli} migration apply`
643
+ "migration:apply": `${prismaNextCli} migration apply`,
644
+ "migration:status": `${prismaNextCli} migration status`,
645
+ "migration:show": `${prismaNextCli} migration show`
638
646
  };
639
647
  }
640
648
  return {
641
649
  "contract:emit": "prisma-next contract emit",
642
650
  "db:init": "prisma-next db init",
643
651
  "db:update": "prisma-next db update",
652
+ "db:verify": "prisma-next db verify",
644
653
  "db:seed": "tsx prisma/seed.ts",
645
654
  "migration:plan": "prisma-next migration plan",
646
- "migration:apply": "prisma-next migration apply"
655
+ "migration:apply": "prisma-next migration apply",
656
+ "migration:status": "prisma-next migration status",
657
+ "migration:show": "prisma-next migration show"
647
658
  };
648
659
  }
649
660
  function getVersion(packageName) {
@@ -685,6 +696,10 @@ function getMigrationPackages(provider) {
685
696
  if (provider === "mongo") return ["@prisma-next/family-mongo", "@prisma-next/target-mongo"];
686
697
  return ["@prisma-next/target-postgres"];
687
698
  }
699
+ function getOrmTypePackages(provider) {
700
+ if (provider === "mongo") return ["@prisma-next/mongo-orm"];
701
+ return ["@prisma-next/sql-orm-client"];
702
+ }
688
703
  async function addPackageDependency(opts) {
689
704
  const { dependencies = [], devDependencies = [], customDependencies = {}, scripts = {}, scriptMode, projectDir } = opts;
690
705
  const pkgJsonPath = path.join(projectDir, "package.json");
@@ -722,9 +737,10 @@ async function writePrismaDependencies(provider, packageManager, authoring, proj
722
737
  "@prisma-next/cli",
723
738
  "@types/node"
724
739
  ];
740
+ devDependencies.push(...getGeneratedContractTypePackages(provider));
725
741
  devDependencies.push(...getMigrationPackages(provider));
742
+ devDependencies.push(...getOrmTypePackages(provider));
726
743
  if (authoring === "typescript") devDependencies.push(...getTypeScriptContractPackages(provider));
727
- else if (packageManager === "deno") devDependencies.push(...getGeneratedContractTypePackages(provider));
728
744
  await addPackageDependency({
729
745
  dependencies,
730
746
  devDependencies,
@@ -847,6 +863,11 @@ const mongoDockerScripts = {
847
863
  "db:up": "docker compose up -d --wait",
848
864
  "db:down": "docker compose down"
849
865
  };
866
+ const minimumServerVersion = {
867
+ postgres: "14",
868
+ mongo: "6.0"
869
+ };
870
+ const readmeSectionMarker = "<!-- prisma-next-reference -->";
850
871
  const requiredPrismaFileGroups = [
851
872
  [
852
873
  "prisma/contract.prisma",
@@ -868,6 +889,275 @@ async function resolvePrismaProjectDir(projectDir) {
868
889
  if (await fs.pathExists(path.join(monorepoDbDir, "prisma/contract.prisma")) || await fs.pathExists(path.join(monorepoDbDir, "prisma/contract.ts"))) return monorepoDbDir;
869
890
  return projectDir;
870
891
  }
892
+ function getDatabaseLabel(provider) {
893
+ return provider === "mongo" ? "MongoDB" : "PostgreSQL";
894
+ }
895
+ function getContractPath(authoring) {
896
+ return `prisma/contract${authoring === "typescript" ? ".ts" : ".prisma"}`;
897
+ }
898
+ function stripTypeScriptExtension(filePath) {
899
+ return filePath.endsWith(".ts") ? filePath.slice(0, -3) : filePath;
900
+ }
901
+ async function findFirstExistingRelativePath(projectDir, candidates) {
902
+ for (const candidate of candidates) if (await fs.pathExists(path.join(projectDir, candidate))) return candidate;
903
+ }
904
+ async function readPackageScripts(projectDir) {
905
+ const packageJsonPath = path.join(projectDir, "package.json");
906
+ if (!await fs.pathExists(packageJsonPath)) return {};
907
+ const packageJson = await fs.readJson(packageJsonPath);
908
+ return typeof packageJson.scripts === "object" && packageJson.scripts !== null ? packageJson.scripts : {};
909
+ }
910
+ async function writeFileIfMissing(filePath, content) {
911
+ if (await fs.pathExists(filePath)) return;
912
+ await fs.outputFile(filePath, content.endsWith("\n") ? content : `${content}\n`, "utf8");
913
+ }
914
+ async function appendReadmeSectionIfMissing(projectDir, content) {
915
+ const readmePath = path.join(projectDir, "README.md");
916
+ const section = `${readmeSectionMarker}\n${content.trim()}\n`;
917
+ if (!await fs.pathExists(readmePath)) {
918
+ await fs.outputFile(readmePath, `# Prisma Next\n\n${section}`, "utf8");
919
+ return;
920
+ }
921
+ const existingContent = await fs.readFile(readmePath, "utf8");
922
+ if (existingContent.includes(readmeSectionMarker)) return;
923
+ const separator = existingContent.endsWith("\n") ? "\n" : "\n\n";
924
+ await fs.writeFile(readmePath, `${existingContent}${separator}${section}`, "utf8");
925
+ }
926
+ function getEnvExampleContent(provider) {
927
+ const label = getDatabaseLabel(provider);
928
+ const minVersion = minimumServerVersion[provider];
929
+ const databaseUrl = provider === "mongo" ? "mongodb://localhost:27017/mydb?replicaSet=rs0&directConnection=true" : "postgresql://user:password@localhost:5432/mydb";
930
+ return [
931
+ "# Copy this file to .env and replace the placeholder with your connection string.",
932
+ `# Requires ${label} >= ${minVersion}.`,
933
+ `DATABASE_URL="${databaseUrl}"`,
934
+ ""
935
+ ].join("\n");
936
+ }
937
+ function formatCommandListItem(packageManager, scriptName, description) {
938
+ return `- \`${getRunScriptCommand(packageManager, scriptName)}\` - ${description}`;
939
+ }
940
+ function getPrismaNextReadmeSectionContent(options) {
941
+ const { provider, authoring, schemaPreset, packageManager, schemaPath, dbImportPath, scripts, rootScripts } = options;
942
+ const label = getDatabaseLabel(provider);
943
+ const minVersion = minimumServerVersion[provider];
944
+ const hasWorkspaceRootDbUp = typeof scripts["db:up"] !== "string" && typeof rootScripts["db:up"] === "string";
945
+ const hasDbUp = typeof scripts["db:up"] === "string" || hasWorkspaceRootDbUp;
946
+ const commandLines = [
947
+ formatCommandListItem(packageManager, "contract:emit", "emit contract.json and contract.d.ts after contract changes"),
948
+ ...hasDbUp ? [formatCommandListItem(packageManager, "db:up", hasWorkspaceRootDbUp ? "start the local MongoDB replica set with Docker from the workspace root" : "start the local MongoDB replica set with Docker")] : [],
949
+ formatCommandListItem(packageManager, "db:init", "bootstrap a new database from the contract"),
950
+ formatCommandListItem(packageManager, "db:update", "apply contract changes directly after confirmation"),
951
+ formatCommandListItem(packageManager, "db:verify", "compare the live database state against the contract"),
952
+ formatCommandListItem(packageManager, "migration:plan", "write an offline migration plan from contract changes"),
953
+ formatCommandListItem(packageManager, "migration:apply", "apply pending migrations"),
954
+ formatCommandListItem(packageManager, "migration:status", "show applied and pending migrations"),
955
+ formatCommandListItem(packageManager, "migration:show", "inspect a planned migration"),
956
+ ...schemaPreset === "basic" ? [formatCommandListItem(packageManager, "db:seed", "insert starter sample data")] : []
957
+ ];
958
+ const workflowLines = provider === "mongo" ? [
959
+ "1. Start MongoDB with Docker if you are using the generated local database.",
960
+ "2. Run `contract:emit` after editing the contract.",
961
+ "3. Run `migration:plan` and review the generated migration.",
962
+ "4. Run `migration:apply` to apply pending migrations.",
963
+ ...schemaPreset === "basic" ? ["5. Run `db:seed` if you want the starter sample data."] : []
964
+ ] : [
965
+ "1. Run `contract:emit` after editing the contract.",
966
+ "2. For first-time setup, run `db:init` to create and sign the database state.",
967
+ "3. For later contract changes, run `migration:plan` and `migration:apply`.",
968
+ ...schemaPreset === "basic" ? ["4. Run `db:seed` if you want the starter sample data."] : []
969
+ ];
970
+ const queryExample = provider === "mongo" ? [
971
+ "```ts",
972
+ `import { db } from "${dbImportPath}";`,
973
+ "",
974
+ "for await (const user of db.orm.users.select(\"_id\", \"email\").take(10).all()) {",
975
+ " console.log(user.email);",
976
+ "}",
977
+ "```",
978
+ "",
979
+ "MongoDB accessors use the emitted collection names, so the starter `User` model is queried through `db.orm.users`. The Mongo facade connects lazily on the first query; call `db.close()` when a script is done. Use `db.query` for typed aggregation pipelines when the ORM cannot express a query."
980
+ ] : [
981
+ "```ts",
982
+ `import { db } from "${dbImportPath}";`,
983
+ "",
984
+ "const users = await db.orm.User.select(\"id\", \"email\").take(10).all();",
985
+ "```",
986
+ "",
987
+ "PostgreSQL models use their contract model names, so the starter `User` model is queried through `db.orm.User`. Prefer `db.orm` for application queries and use raw SQL only when the ORM does not cover the operation."
988
+ ];
989
+ return [
990
+ "## Prisma Next Reference",
991
+ "",
992
+ `This project uses Prisma Next with ${label}. The contract is authored in ${authoring === "typescript" ? "TypeScript" : "PSL"} at \`${schemaPath}\`.`,
993
+ "",
994
+ "## Requirements",
995
+ "",
996
+ `- ${label} ${minVersion} or newer.`,
997
+ "- The generated `.env.example` shows the expected `DATABASE_URL` shape.",
998
+ ...provider === "mongo" ? ["- The generated Docker Compose setup starts MongoDB as a replica set for local migration workflows."] : [],
999
+ "",
1000
+ "## Contract Artifacts",
1001
+ "",
1002
+ "Prisma Next emits two generated files next to the contract:",
1003
+ "",
1004
+ "- `prisma/contract.json` - runtime contract metadata",
1005
+ "- `prisma/contract.d.ts` - TypeScript types for the contract",
1006
+ "",
1007
+ "Commit both generated files. Do not edit either one by hand.",
1008
+ "",
1009
+ "## Query Example",
1010
+ "",
1011
+ ...queryExample,
1012
+ "",
1013
+ "## Commands",
1014
+ "",
1015
+ ...commandLines,
1016
+ "",
1017
+ "## Workflow",
1018
+ "",
1019
+ ...workflowLines,
1020
+ ""
1021
+ ].join("\n");
1022
+ }
1023
+ function getPrismaNextAgentSkillContent(options) {
1024
+ const { provider, authoring, schemaPreset, packageManager, schemaPath, dbImportPath, scripts, rootScripts } = options;
1025
+ const label = getDatabaseLabel(provider);
1026
+ const runtimePackage = provider === "mongo" ? "@prisma-next/mongo" : "@prisma-next/postgres";
1027
+ const hasWorkspaceRootDbUp = typeof scripts["db:up"] !== "string" && typeof rootScripts["db:up"] === "string";
1028
+ const hasDbUp = typeof scripts["db:up"] === "string" || hasWorkspaceRootDbUp;
1029
+ const commands = [
1030
+ formatCommandListItem(packageManager, "contract:emit", "regenerate contract artifacts"),
1031
+ ...hasDbUp ? [formatCommandListItem(packageManager, "db:up", hasWorkspaceRootDbUp ? "start local MongoDB with Docker from the workspace root" : "start local MongoDB with Docker")] : [],
1032
+ formatCommandListItem(packageManager, "db:init", "bootstrap a new database"),
1033
+ formatCommandListItem(packageManager, "db:update", "apply contract changes directly"),
1034
+ formatCommandListItem(packageManager, "db:verify", "verify database state against the contract"),
1035
+ formatCommandListItem(packageManager, "migration:plan", "create an offline migration plan"),
1036
+ formatCommandListItem(packageManager, "migration:apply", "apply pending migrations"),
1037
+ formatCommandListItem(packageManager, "migration:status", "show migration status"),
1038
+ formatCommandListItem(packageManager, "migration:show", "inspect a migration"),
1039
+ ...schemaPreset === "basic" ? [formatCommandListItem(packageManager, "db:seed", "insert starter sample data")] : []
1040
+ ];
1041
+ const queryGuidance = provider === "mongo" ? [
1042
+ "- Use `db.orm`. Mongo root accessors are lowercased plural collection names emitted by `contract:emit`, for example `db.orm.users` and `db.orm.posts`.",
1043
+ "- `.all()` returns an async iterable result. Consume it with `for await` or await it to materialize an array.",
1044
+ "- Use `db.query` for typed aggregation pipelines when the ORM cannot express a query.",
1045
+ "- For direct MongoDB driver control, construct your own `MongoClient` and pass it through the `mongoClient` binding; keep that raw client reference for sessions, transactions, and change streams.",
1046
+ "- Do not use `db.runtime()` as a raw driver escape hatch. It returns Prisma Next's internal executor, not a `mongodb` `MongoClient` or `Db`.",
1047
+ "- The Mongo client connects lazily on the first query. Short-lived scripts should call `await db.close()` in `finally`.",
1048
+ "- Multi-document transactions and change streams require MongoDB to run as a replica set. The generated local Docker setup does this."
1049
+ ] : [
1050
+ "- Use `db.orm`. PostgreSQL root accessors follow contract model names, for example `db.orm.User` and `db.orm.Post`.",
1051
+ "- Prefer `db.orm` for application queries. Use raw SQL only when the ORM cannot express the operation or the user explicitly asks for it.",
1052
+ "- `.where(...)`, `.select(...)`, `.orderBy(...)`, `.take(...)`, `.all()`, `.first()`, and `.include(...)` are the primary ORM query methods.",
1053
+ "- Short-lived scripts should close the runtime with `await db.runtime().close()` when needed."
1054
+ ];
1055
+ const queryExamples = provider === "mongo" ? [
1056
+ "```ts",
1057
+ `import { db } from "${dbImportPath}";`,
1058
+ "",
1059
+ "const user = await db.orm.users.where({ email: \"alice@example.com\" }).first();",
1060
+ "",
1061
+ "for await (const user of db.orm.users.select(\"_id\", \"email\").take(10).all()) {",
1062
+ " console.log(user.email);",
1063
+ "}",
1064
+ "",
1065
+ "const usersWithPosts = await db.orm.users",
1066
+ " .select(\"_id\", \"email\")",
1067
+ " .include(\"posts\")",
1068
+ " .take(10)",
1069
+ " .all();",
1070
+ "```"
1071
+ ] : [
1072
+ "```ts",
1073
+ `import { db } from "${dbImportPath}";`,
1074
+ "",
1075
+ "const user = await db.orm.User",
1076
+ " .where((user) => user.email.eq(\"alice@example.com\"))",
1077
+ " .first();",
1078
+ "",
1079
+ "const users = await db.orm.User.select(\"id\", \"email\").take(10).all();",
1080
+ "",
1081
+ "const usersWithPosts = await db.orm.User",
1082
+ " .select(\"id\", \"email\")",
1083
+ " .include(\"posts\", (post) => post.select(\"id\", \"title\").take(5))",
1084
+ " .take(10)",
1085
+ " .all();",
1086
+ "```"
1087
+ ];
1088
+ return [
1089
+ "# Prisma Next - Project Skill",
1090
+ "",
1091
+ `This project uses **Prisma Next** with **${label}** via \`${runtimePackage}\`. The contract is \`${schemaPath}\` using ${authoring === "typescript" ? "TypeScript" : "PSL"} authoring.`,
1092
+ "",
1093
+ "## Files",
1094
+ "",
1095
+ `- **Contract**: \`${schemaPath}\` - edit this to add or change models.`,
1096
+ "- **Config**: `prisma-next.config.ts` - tells the CLI where the contract is and how to connect to the database.",
1097
+ `- **Database helper**: import \`db\` from \`${dbImportPath}\`. This is the entry point for queries.`,
1098
+ "- **Generated files**: `prisma/contract.json` and `prisma/contract.d.ts`. Do not edit these by hand.",
1099
+ "",
1100
+ "## Commands",
1101
+ "",
1102
+ ...commands,
1103
+ "",
1104
+ "## How To Write Queries",
1105
+ "",
1106
+ ...queryExamples,
1107
+ "",
1108
+ "## Rules",
1109
+ "",
1110
+ "- Never hand-edit `contract.json` or `contract.d.ts`. Regenerate them with `contract:emit`.",
1111
+ "- Always run `contract:emit` after changing the contract before writing code that depends on the changed models.",
1112
+ "- Do not auto-run `db:init`, migrations, or seed commands. These are manual project-owner actions.",
1113
+ "- Do not restructure the generated database helper unless the user explicitly asks.",
1114
+ "- `DATABASE_URL` lives in `.env`; `.env.example` documents the expected shape and minimum server version.",
1115
+ ...queryGuidance,
1116
+ "",
1117
+ "## Common Workflow",
1118
+ "",
1119
+ "- Edit the contract.",
1120
+ "- Run `contract:emit`.",
1121
+ "- For a new database, run `db:init`.",
1122
+ "- For existing databases, run `migration:plan`, review it, then run `migration:apply`.",
1123
+ "- Run `db:verify` or `migration:status` when checking state.",
1124
+ ""
1125
+ ].join("\n");
1126
+ }
1127
+ async function writePrismaNextProjectDocs(options) {
1128
+ const prismaProjectDir = await resolvePrismaProjectDir(options.projectDir);
1129
+ const schemaPath = getContractPath(options.authoring);
1130
+ const dbImportPath = `./${stripTypeScriptExtension(await findFirstExistingRelativePath(prismaProjectDir, [
1131
+ "src/lib/prisma.ts",
1132
+ "src/lib/prisma.server.ts",
1133
+ "src/lib/server/prisma.ts",
1134
+ "server/utils/prisma.ts",
1135
+ "src/client.ts"
1136
+ ]) ?? "src/lib/prisma.ts")}`;
1137
+ const scripts = await readPackageScripts(prismaProjectDir);
1138
+ const rootScripts = await readPackageScripts(options.projectDir);
1139
+ await writeFileIfMissing(path.join(prismaProjectDir, ".env.example"), getEnvExampleContent(options.provider));
1140
+ await appendReadmeSectionIfMissing(prismaProjectDir, getPrismaNextReadmeSectionContent({
1141
+ provider: options.provider,
1142
+ authoring: options.authoring,
1143
+ schemaPreset: options.schemaPreset,
1144
+ packageManager: options.packageManager,
1145
+ schemaPath,
1146
+ dbImportPath,
1147
+ scripts,
1148
+ rootScripts
1149
+ }));
1150
+ await writeFileIfMissing(path.join(prismaProjectDir, ".agents/skills/prisma-next/SKILL.md"), getPrismaNextAgentSkillContent({
1151
+ provider: options.provider,
1152
+ authoring: options.authoring,
1153
+ schemaPreset: options.schemaPreset,
1154
+ packageManager: options.packageManager,
1155
+ schemaPath,
1156
+ dbImportPath,
1157
+ scripts,
1158
+ rootScripts
1159
+ }));
1160
+ }
871
1161
  async function promptForDatabaseProvider() {
872
1162
  const databaseProvider = await select({
873
1163
  message: "Select your database",
@@ -1239,6 +1529,21 @@ async function finalizePrismaFilesForContext(context, projectDir, provisionResul
1239
1529
  return false;
1240
1530
  }
1241
1531
  }
1532
+ async function writePrismaNextProjectDocsForContext(context, projectDir) {
1533
+ try {
1534
+ await writePrismaNextProjectDocs({
1535
+ provider: context.databaseProvider,
1536
+ authoring: context.authoring,
1537
+ schemaPreset: context.schemaPreset,
1538
+ packageManager: context.packageManager,
1539
+ projectDir
1540
+ });
1541
+ return true;
1542
+ } catch (error) {
1543
+ cancel(getCommandErrorMessage(error));
1544
+ return false;
1545
+ }
1546
+ }
1242
1547
  function getPrismaNextCliCommand(packageManager, prismaNextArgs) {
1243
1548
  if (packageManager === "deno") return `deno run -A --env-file=.env npm:prisma-next@${dependencyVersionMap["prisma-next"]} ${prismaNextArgs.join(" ")}`;
1244
1549
  return getLocalPackageBinaryCommand(packageManager, "prisma-next", prismaNextArgs);
@@ -1339,6 +1644,7 @@ async function executePrismaSetupContext(context, options = {}) {
1339
1644
  if (!await installDependenciesForContext(context, projectDir)) return false;
1340
1645
  if (!await finalizePrismaFilesForContext(context, projectDir, provisionResult)) return false;
1341
1646
  if (!await writeMongoDockerHelpersForContext(context, projectDir)) return false;
1647
+ if (!await writePrismaNextProjectDocsForContext(context, projectDir)) return false;
1342
1648
  const emitResult = await emitPrismaNextContractForContext(context, projectDir);
1343
1649
  const warningLines = buildWarningLines(provisionResult.warning, emitResult.warning);
1344
1650
  const nextSteps = buildNextStepsForContext({
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { a as DatabaseProviderSchema, c as SchemaPresetSchema, i as CreateTemplateSchema, n as AuthoringStyleSchema, o as DatabaseUrlSchema, r as CreateCommandInputSchema, s as PackageManagerSchema, t as runCreateCommand } from "./create-C-bVmrxB.mjs";
2
+ import { a as DatabaseProviderSchema, c as SchemaPresetSchema, i as CreateTemplateSchema, n as AuthoringStyleSchema, o as DatabaseUrlSchema, r as CreateCommandInputSchema, s as PackageManagerSchema, t as runCreateCommand } from "./create-CXc9jHIv.mjs";
3
3
  import { os } from "@orpc/server";
4
4
  import { createCli } from "trpc-cli";
5
5
 
6
6
  //#region src/index.ts
7
- const CLI_VERSION = "0.4.2-next.37.81.1";
7
+ const CLI_VERSION = "0.4.2-next.37.83.1";
8
8
  const router = os.router({ create: os.meta({
9
9
  description: "Create a new project with Prisma setup",
10
10
  default: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma",
3
- "version": "0.4.2-next.37.81.1",
3
+ "version": "0.4.2-next.37.83.1",
4
4
  "private": false,
5
5
  "description": "Create Prisma Next projects with first-party templates and great DX.",
6
6
  "homepage": "https://github.com/prisma/create-prisma",
@@ -36,6 +36,8 @@ Database helper scripts are added to `package.json`:
36
36
  - `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
37
37
  {{/if}}
38
38
 
39
+ This README includes provider-specific Prisma Next reference notes below. Agent-specific project guidance is scaffolded in `.agents/skills/prisma-next/SKILL.md`.
40
+
39
41
  Node-based Prisma Next projects expect Node.js 24 LTS or newer.
40
42
  {{#if (eq schemaPreset "basic")}}
41
43
 
@@ -4,6 +4,13 @@ import mongo from "@prisma-next/mongo/runtime";
4
4
  {{else}}
5
5
  import postgres from "@prisma-next/postgres/runtime";
6
6
  {{/if}}
7
+ {{#if (eq schemaPreset "basic")}}
8
+ {{#if (eq provider "mongo")}}
9
+ import type { DefaultModelRow } from "@prisma-next/mongo-orm";
10
+ {{else}}
11
+ import type { DefaultModelRow } from "@prisma-next/sql-orm-client";
12
+ {{/if}}
13
+ {{/if}}
7
14
  import type { Contract } from "../../prisma/contract.d";
8
15
  import contractJson from "../../prisma/contract.json" with { type: "json" };
9
16
 
@@ -19,41 +26,50 @@ export const db = postgres<Contract>({
19
26
  });
20
27
  {{/if}}
21
28
 
22
- export type StarterUser = {
23
- id: string;
24
- email: string;
25
- name: string | null;
26
- createdAt: Date | null;
27
- };
29
+ {{#if (eq schemaPreset "basic")}}
30
+ type UserRow = DefaultModelRow<Contract, "User">;
31
+
32
+ {{#if (eq provider "mongo")}}
33
+ function toStarterUser(user: Pick<UserRow, "_id" | "email" | "name">) {
34
+ return {
35
+ id: String(user._id),
36
+ email: user.email,
37
+ name: user.name ?? null,
38
+ createdAt: null,
39
+ };
40
+ }
41
+ {{else}}
42
+ function toStarterUser(user: Pick<UserRow, "id" | "email" | "name" | "createdAt">) {
43
+ return {
44
+ id: String(user.id),
45
+ email: user.email,
46
+ name: user.name ?? null,
47
+ createdAt: user.createdAt,
48
+ };
49
+ }
50
+ {{/if}}
51
+ {{/if}}
28
52
 
29
- export async function listUsers(limit = 10): Promise<StarterUser[]> {
53
+ export async function listUsers(limit = 10) {
30
54
  {{#if (eq schemaPreset "basic")}}
31
55
  {{#if (eq provider "mongo")}}
32
- const users: StarterUser[] = [];
56
+ const users: ReturnType<typeof toStarterUser>[] = [];
33
57
 
34
58
  for await (const user of db.orm.users.select("_id", "email", "name").take(limit).all()) {
35
- users.push({
36
- id: String(user._id),
37
- email: user.email,
38
- name: user.name ?? null,
39
- createdAt: null,
40
- });
59
+ users.push(toStarterUser(user));
41
60
  }
42
61
 
43
62
  return users;
44
63
  {{else}}
45
64
  const users = await db.orm.User.select("id", "email", "name", "createdAt").take(limit).all();
46
65
 
47
- return users.map((user) => ({
48
- id: String(user.id),
49
- email: user.email,
50
- name: user.name ?? null,
51
- createdAt: user.createdAt,
52
- }));
66
+ return users.map(toStarterUser);
53
67
  {{/if}}
54
68
  {{else}}
55
69
  return [];
56
70
  {{/if}}
57
71
  }
58
72
 
73
+ export type StarterUser = Awaited<ReturnType<typeof listUsers>>[number];
74
+
59
75
  export default db;
@@ -34,6 +34,8 @@ Database helper scripts are added to `package.json`:
34
34
  - `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
35
35
  {{/if}}
36
36
 
37
+ This README includes provider-specific Prisma Next reference notes below. Agent-specific project guidance is scaffolded in `.agents/skills/prisma-next/SKILL.md`.
38
+
37
39
  Node-based Prisma Next projects expect Node.js 24 LTS or newer.
38
40
  {{#if (eq schemaPreset "basic")}}
39
41
 
@@ -4,6 +4,13 @@ import mongo from "@prisma-next/mongo/runtime";
4
4
  {{else}}
5
5
  import postgres from "@prisma-next/postgres/runtime";
6
6
  {{/if}}
7
+ {{#if (eq schemaPreset "basic")}}
8
+ {{#if (eq provider "mongo")}}
9
+ import type { DefaultModelRow } from "@prisma-next/mongo-orm";
10
+ {{else}}
11
+ import type { DefaultModelRow } from "@prisma-next/sql-orm-client";
12
+ {{/if}}
13
+ {{/if}}
7
14
  import type { Contract } from "../../prisma/contract.d";
8
15
  import contractJson from "../../prisma/contract.json" with { type: "json" };
9
16
 
@@ -19,41 +26,50 @@ export const db = postgres<Contract>({
19
26
  });
20
27
  {{/if}}
21
28
 
22
- export type StarterUser = {
23
- id: string;
24
- email: string;
25
- name: string | null;
26
- createdAt: Date | null;
27
- };
29
+ {{#if (eq schemaPreset "basic")}}
30
+ type UserRow = DefaultModelRow<Contract, "User">;
31
+
32
+ {{#if (eq provider "mongo")}}
33
+ function toStarterUser(user: Pick<UserRow, "_id" | "email" | "name">) {
34
+ return {
35
+ id: String(user._id),
36
+ email: user.email,
37
+ name: user.name ?? null,
38
+ createdAt: null,
39
+ };
40
+ }
41
+ {{else}}
42
+ function toStarterUser(user: Pick<UserRow, "id" | "email" | "name" | "createdAt">) {
43
+ return {
44
+ id: String(user.id),
45
+ email: user.email,
46
+ name: user.name ?? null,
47
+ createdAt: user.createdAt,
48
+ };
49
+ }
50
+ {{/if}}
51
+ {{/if}}
28
52
 
29
- export async function listUsers(limit = 10): Promise<StarterUser[]> {
53
+ export async function listUsers(limit = 10) {
30
54
  {{#if (eq schemaPreset "basic")}}
31
55
  {{#if (eq provider "mongo")}}
32
- const users: StarterUser[] = [];
56
+ const users: ReturnType<typeof toStarterUser>[] = [];
33
57
 
34
58
  for await (const user of db.orm.users.select("_id", "email", "name").take(limit).all()) {
35
- users.push({
36
- id: String(user._id),
37
- email: user.email,
38
- name: user.name ?? null,
39
- createdAt: null,
40
- });
59
+ users.push(toStarterUser(user));
41
60
  }
42
61
 
43
62
  return users;
44
63
  {{else}}
45
64
  const users = await db.orm.User.select("id", "email", "name", "createdAt").take(limit).all();
46
65
 
47
- return users.map((user) => ({
48
- id: String(user.id),
49
- email: user.email,
50
- name: user.name ?? null,
51
- createdAt: user.createdAt,
52
- }));
66
+ return users.map(toStarterUser);
53
67
  {{/if}}
54
68
  {{else}}
55
69
  return [];
56
70
  {{/if}}
57
71
  }
58
72
 
73
+ export type StarterUser = Awaited<ReturnType<typeof listUsers>>[number];
74
+
59
75
  export default db;
@@ -34,6 +34,8 @@ Database helper scripts are added to `package.json`:
34
34
  - `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
35
35
  {{/if}}
36
36
 
37
+ This README includes provider-specific Prisma Next reference notes below. Agent-specific project guidance is scaffolded in `.agents/skills/prisma-next/SKILL.md`.
38
+
37
39
  Node-based Prisma Next projects expect Node.js 24 LTS or newer.
38
40
  {{#if (eq schemaPreset "basic")}}
39
41