create-prisma 0.9.1 → 0.9.2-pr.63.231.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/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import "./create-C2KUxZsd.mjs";
2
+ import "./create-B4dcx9oX.mjs";
3
3
  import { createCreatePrismaCli } from "./index.mjs";
4
4
 
5
5
  //#region src/cli.ts
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { z } from "zod";
3
- import { cancel, confirm, intro, isCancel, log, note, outro, select, spinner, text } from "@clack/prompts";
3
+ import { cancel, confirm, intro, isCancel, log, note, outro, select, spinner, taskLog, text } from "@clack/prompts";
4
4
  import fs from "fs-extra";
5
5
  import path from "node:path";
6
6
  import { randomUUID } from "node:crypto";
@@ -10,24 +10,16 @@ import Handlebars from "handlebars";
10
10
  import { existsSync } from "node:fs";
11
11
  import { fileURLToPath } from "node:url";
12
12
  import { execa } from "execa";
13
+ import { createInterface } from "node:readline";
13
14
  import { styleText } from "node:util";
14
15
 
15
16
  //#region src/telemetry/client.ts
16
- const TELEMETRY_API_KEY = "phc_cmc85avbWyuJ2JyKdGPdv7dxXli8xLdWDBPbvIXWJfs";
17
+ const TELEMETRY_API_KEY = "";
17
18
  const TELEMETRY_HOST = "https://us.i.posthog.com";
18
19
  const TELEMETRY_CONFIG_FILE = "telemetry.json";
19
20
  const UUID_V4_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
20
- function isTruthyEnvValue(value) {
21
- return [
22
- "1",
23
- "true",
24
- "yes",
25
- "on"
26
- ].includes(String(value ?? "").trim().toLowerCase());
27
- }
28
21
  function shouldDisableTelemetry() {
29
- if (isTruthyEnvValue(process.env.CI) || isTruthyEnvValue(process.env.GITHUB_ACTIONS)) return true;
30
- return process.env.CREATE_PRISMA_DISABLE_TELEMETRY !== void 0 || process.env.CREATE_PRISMA_TELEMETRY_DISABLED !== void 0 || process.env.DO_NOT_TRACK !== void 0;
22
+ return true;
31
23
  }
32
24
  function getTelemetryConfigDir() {
33
25
  if (process.platform === "darwin") return path.join(os.homedir(), "Library", "Application Support", "create-prisma");
@@ -49,7 +41,7 @@ async function getAnonymousId() {
49
41
  }
50
42
  function getCommonProperties() {
51
43
  return {
52
- "cli-version": "0.9.1",
44
+ "cli-version": "0.9.2-pr.63.231.1",
53
45
  "node-version": process.version,
54
46
  platform: process.platform,
55
47
  arch: process.arch
@@ -479,21 +471,21 @@ async function scaffoldCreateFrameworkTemplate(opts) {
479
471
  const dependencyVersionMap = {
480
472
  "@astrojs/node": "^10.0.2",
481
473
  "@elysiajs/node": "^1.4.5",
482
- "@prisma/cli-engine": "0.2.0",
483
- "@prisma/composer": "0.10.0",
484
- "@prisma/composer-prisma-cloud": "0.10.0",
474
+ "@prisma/composer": "0.12.0",
475
+ "@prisma/composer-prisma-cloud": "0.12.0",
485
476
  "@prisma/orm-mongo": "8.0.0-rc.4",
486
477
  "@prisma/orm-postgres": "8.0.0-rc.4",
487
478
  "@sveltejs/adapter-node": "^5.3.2",
488
479
  "@types/node": "^25.6.2",
489
- alchemy: "2.0.0-beta.67",
480
+ alchemy: "2.0.0-beta.74",
490
481
  arktype: "^2.2.3",
491
482
  dotenv: "^17.4.2",
492
483
  esbuild: "^0.28.1",
493
- effect: "4.0.0-beta.103",
484
+ effect: "4.0.0-rc.111",
494
485
  mongodb: "^7.1.0",
495
486
  "mongodb-memory-server": "^11.1.0",
496
487
  nitro: "^3.0.260610-beta",
488
+ prisma: "next",
497
489
  tsx: "^4.21.0",
498
490
  typescript: "^5.9.3"
499
491
  };
@@ -511,7 +503,7 @@ function getCreateTemplateDependencies(template, _packageManager) {
511
503
  "@prisma/composer-prisma-cloud",
512
504
  "alchemy"
513
505
  ];
514
- const devDependencies = ["@prisma/cli-engine"];
506
+ const devDependencies = [];
515
507
  if (usesEsbuild(template)) devDependencies.push("esbuild");
516
508
  if (template === "minimal" || usesEsbuild(template)) devDependencies.push("tsx");
517
509
  if (template === "minimal") devDependencies.push("typescript");
@@ -559,7 +551,7 @@ function getPrismaScriptMap(packageManager) {
559
551
  "migration:show": prismaCommand(true, "migration", "show")
560
552
  };
561
553
  }
562
- const prismaCommand = (...args) => getPackageExecutionCommand(packageManager, [PRISMA_PLATFORM_CLI_PACKAGE, ...args]);
554
+ const prismaCommand = (...args) => ["prisma", ...args].join(" ");
563
555
  return {
564
556
  "contract:emit": prismaCommand("contract", "emit"),
565
557
  "db:init": prismaCommand("db", "init"),
@@ -568,16 +560,17 @@ function getPrismaScriptMap(packageManager) {
568
560
  "migration:plan": prismaCommand("migration", "plan"),
569
561
  migrate: prismaCommand("db", "migrate"),
570
562
  "migration:status": prismaCommand("migration", "status"),
571
- "migration:show": prismaCommand("migration", "show")
563
+ "migration:show": prismaCommand("migration", "show"),
564
+ "skills:sync": `${prismaCommand("skills", "sync")} || exit 0`
572
565
  };
573
566
  }
574
567
  function getComposerScriptMap(packageManager) {
575
568
  if (packageManager === "deno") return {};
576
- const composerCommand = (subcommand) => getPackageExecutionCommand(packageManager, [
577
- PRISMA_PLATFORM_CLI_PACKAGE,
569
+ const composerCommand = (subcommand) => [
570
+ "prisma",
578
571
  subcommand,
579
572
  "module.ts"
580
- ]);
573
+ ].join(" ");
581
574
  return {
582
575
  "composer:dev": composerCommand("dev"),
583
576
  "composer:deploy": composerCommand("deploy"),
@@ -625,7 +618,7 @@ async function writePrismaDependencies(provider, packageManager, _authoring, pro
625
618
  if (packageManager === "deno") dependencies.push("dotenv");
626
619
  await addPackageDependency({
627
620
  dependencies,
628
- devDependencies: packageManager === "deno" ? ["@types/node"] : ["@prisma/cli-engine", "@types/node"],
621
+ devDependencies: packageManager === "deno" ? ["@types/node"] : ["@types/node", "prisma"],
629
622
  scripts: getPrismaScriptMap(packageManager),
630
623
  projectDir
631
624
  });
@@ -702,12 +695,16 @@ async function runPrismaJsonCommand(options) {
702
695
  "--json",
703
696
  "--no-interactive"
704
697
  ]);
705
- const result = await execa(invocation.command, invocation.args, {
698
+ const subprocess = execa(invocation.command, invocation.args, {
706
699
  cwd: options.projectDir,
707
700
  env: process.env,
708
701
  reject: false
709
702
  });
710
- if (options.forwardStderr && result.stderr) process.stderr.write(result.stderr.endsWith("\n") ? result.stderr : `${result.stderr}\n`);
703
+ const stderrLines = options.onStderrLine && subprocess.stderr ? (async () => {
704
+ const lines = createInterface({ input: subprocess.stderr });
705
+ for await (const line of lines) if (line.trim()) options.onStderrLine?.(line);
706
+ })() : Promise.resolve();
707
+ const [result] = await Promise.all([subprocess, stderrLines]);
711
708
  let envelope;
712
709
  try {
713
710
  envelope = parsePrismaCliEnvelope(result.stdout);
@@ -721,6 +718,19 @@ async function runPrismaJsonCommand(options) {
721
718
  }
722
719
  return envelope.result;
723
720
  }
721
+ function findProjectNameCollisions(projects, appName) {
722
+ return projects.filter((project) => project.name === appName);
723
+ }
724
+ async function ensureProjectNameAvailable(options) {
725
+ const collisions = findProjectNameCollisions((await runPrismaJsonCommand({
726
+ packageManager: options.packageManager,
727
+ projectDir: options.projectDir,
728
+ args: ["project", "list"]
729
+ })).items, options.appName);
730
+ if (collisions.length === 0) return;
731
+ const projectIds = collisions.map((project) => project.id).join(", ");
732
+ throw new Error(`A Prisma project named "${options.appName}" already exists in workspace ${workspaceLabel(options.workspace)} (${options.workspace.id}). Choose a different project name or delete the existing project (${projectIds}) in Prisma Console, then retry.`);
733
+ }
724
734
  async function ensureAuthentication(packageManager, projectDir, beforeInteractiveLogin) {
725
735
  const whoami = () => runPrismaJsonCommand({
726
736
  packageManager,
@@ -844,6 +854,7 @@ async function getProjectDetails(options) {
844
854
  }
845
855
  async function deployWithComposer(options) {
846
856
  const progress = options.verbose ? void 0 : spinner();
857
+ let deploymentLog;
847
858
  let progressRunning = false;
848
859
  const showProgress = (message) => {
849
860
  if (!progress) return;
@@ -874,6 +885,14 @@ async function deployWithComposer(options) {
874
885
  ...options.workspace ? { workspace: options.workspace } : {}
875
886
  });
876
887
  if (!selectedWorkspace) return;
888
+ showProgress("Checking Prisma project name...");
889
+ if (options.verbose) log.step("Checking Prisma project name.");
890
+ await ensureProjectNameAvailable({
891
+ appName: options.appName,
892
+ packageManager: options.packageManager,
893
+ projectDir: options.projectDir,
894
+ workspace: selectedWorkspace
895
+ });
877
896
  showProgress("Building for deployment...");
878
897
  if (options.verbose) log.step("Building for deployment.");
879
898
  const build = getRunScriptArgs(options.packageManager, "build");
@@ -882,22 +901,40 @@ async function deployWithComposer(options) {
882
901
  env: process.env,
883
902
  stdio: options.verbose ? "inherit" : "pipe"
884
903
  });
885
- showProgress("Deploying to Prisma...");
886
- if (options.verbose) log.step("Deploying to Prisma.");
904
+ clearProgress();
905
+ const deployCommand = getPackageExecutionCommand(options.packageManager, [
906
+ PRISMA_PLATFORM_CLI_PACKAGE,
907
+ "deploy",
908
+ "module.ts"
909
+ ]);
910
+ if (options.verbose) log.step(`Deploying to Prisma with ${deployCommand}.`);
911
+ else {
912
+ deploymentLog = taskLog({
913
+ title: "Deploying to Prisma...",
914
+ limit: 10
915
+ });
916
+ deploymentLog.message(`$ ${deployCommand}`);
917
+ }
887
918
  const deployment = parseComposerDeployResult(await runPrismaJsonCommand({
888
919
  packageManager: options.packageManager,
889
920
  projectDir: options.projectDir,
890
921
  args: ["deploy", "module.ts"],
891
- forwardStderr: options.verbose
922
+ onStderrLine: (line) => {
923
+ const redactedLine = redactSecrets(line);
924
+ if (options.verbose) process.stderr.write(`${redactedLine}\n`);
925
+ else deploymentLog?.message(redactedLine);
926
+ }
892
927
  }));
893
928
  const appName = deployment?.appName ?? options.appName;
894
- showProgress("Loading deployment details...");
929
+ if (options.verbose) log.step("Loading deployment details.");
930
+ else deploymentLog?.message("Loading deployment details...");
895
931
  const details = await getProjectDetails({
896
932
  packageManager: options.packageManager,
897
933
  projectDir: options.projectDir,
898
934
  appName
899
935
  });
900
- progress?.stop("Deployed to Prisma.");
936
+ deploymentLog?.success("Deployed to Prisma.");
937
+ deploymentLog = void 0;
901
938
  progressRunning = false;
902
939
  if (options.verbose) log.success("Deployed to Prisma.");
903
940
  const workspace = details?.workspace ?? selectedWorkspace;
@@ -908,7 +945,10 @@ async function deployWithComposer(options) {
908
945
  project: details?.project ?? { name: appName }
909
946
  };
910
947
  } catch (error) {
911
- progress?.error("Deployment failed.");
948
+ if (deploymentLog) {
949
+ deploymentLog.error("Deployment failed.");
950
+ deploymentLog = void 0;
951
+ } else progress?.error("Deployment failed.");
912
952
  progressRunning = false;
913
953
  log.error(`Deploy failed: ${getErrorMessage(error)}`);
914
954
  return;
@@ -1077,6 +1117,23 @@ async function runPrismaInit(context, projectDir) {
1077
1117
  });
1078
1118
  if (context.packageManager === "deno") await fs.remove(path.join(projectDir, "prisma-next.md"));
1079
1119
  }
1120
+ async function initializeAgentSkills(context, projectDir) {
1121
+ if (context.packageManager === "deno") return;
1122
+ const invocation = getPrismaCliInvocation(context.packageManager, [
1123
+ "init",
1124
+ "--yes",
1125
+ "--no-interactive"
1126
+ ]);
1127
+ if (context.verbose) log.step(`Running ${[invocation.command, ...invocation.args].join(" ")}`);
1128
+ await execa(invocation.command, invocation.args, {
1129
+ cwd: projectDir,
1130
+ stdio: context.verbose ? "inherit" : "pipe",
1131
+ env: {
1132
+ ...process.env,
1133
+ CI: "1"
1134
+ }
1135
+ });
1136
+ }
1080
1137
  async function ensureGitignoreEntry(projectDir, entry) {
1081
1138
  const gitignorePath = path.join(projectDir, ".gitignore");
1082
1139
  const existing = await fs.pathExists(gitignorePath) ? await fs.readFile(gitignorePath, "utf8") : "";
@@ -1165,6 +1222,8 @@ async function executePrismaSetupContext(context, options = {}) {
1165
1222
  if (context.databaseProvider === "mongo") await ensureMongoEnvironment(projectDir);
1166
1223
  progress?.message(`Installing dependencies with ${getInstallCommand(context.packageManager)}...`);
1167
1224
  await installProjectDependencies(context.packageManager, projectDir, { verbose: context.verbose });
1225
+ progress?.message("Installing Prisma agent skills...");
1226
+ await initializeAgentSkills(context, projectDir);
1168
1227
  progress?.message("Generating Prisma 8 contract artifacts...");
1169
1228
  await emitContract(context, projectDir);
1170
1229
  progress?.stop("Prisma 8 project ready.");
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { a as DatabaseProviderSchema, i as CreateTemplateSchema, n as AuthoringStyleSchema, o as PackageManagerSchema, r as CreateCommandInputSchema, t as runCreateCommand } from "./create-C2KUxZsd.mjs";
2
+ import { a as DatabaseProviderSchema, i as CreateTemplateSchema, n as AuthoringStyleSchema, o as PackageManagerSchema, r as CreateCommandInputSchema, t as runCreateCommand } from "./create-B4dcx9oX.mjs";
3
3
  import { os } from "@orpc/server";
4
4
  import { createCli } from "trpc-cli";
5
5
  import { z } from "zod";
6
6
 
7
7
  //#region src/index.ts
8
- const CLI_VERSION = "0.9.1";
8
+ const CLI_VERSION = "0.9.2-pr.63.231.1";
9
9
  const CreateCliInputSchema = z.tuple([z.string().trim().min(1, "Please enter a valid project name").optional().describe("Project name / directory"), CreateCommandInputSchema]);
10
10
  function normalizeCreateCliInput(input) {
11
11
  const [projectName, options] = input;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma",
3
- "version": "0.9.1",
3
+ "version": "0.9.2-pr.63.231.1",
4
4
  "private": false,
5
5
  "description": "Create Prisma 8 projects with first-party templates and great DX.",
6
6
  "homepage": "https://github.com/prisma/create-prisma",
@@ -12,5 +12,5 @@ allowBuilds:
12
12
  minimumReleaseAgeExclude:
13
13
  - "@prisma/*"
14
14
  overrides:
15
- effect: "4.0.0-beta.103"
15
+ effect: "4.0.0-rc.111"
16
16
  {{/if}}
@@ -1,8 +1,11 @@
1
1
  {{#unless (eq packageManager "deno")}}
2
- import { definePrismaConfig } from "@prisma/cli-engine";
2
+ import { definePrismaConfig } from "prisma/config";
3
3
  import { defineConfig as ormConfig } from "@prisma/orm-{{#if (eq provider "postgres")}}postgres{{else}}mongo{{/if}}/config";
4
4
 
5
5
  export default definePrismaConfig({
6
+ skills: {
7
+ agents: ["claude", "cursor", "agents", "devin"],
8
+ },
6
9
  orm: ormConfig({
7
10
  contract: "./src/prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}",
8
11
  {{#if (eq authoring "typescript")}}
@@ -11,7 +11,7 @@
11
11
  "dev": "nuxt dev",
12
12
  "generate": "nuxt generate",
13
13
  "preview": "nuxt preview",
14
- "postinstall": "nuxt prepare",
14
+ "postinstall": "nuxt prepare && {{runScriptCommand packageManager "skills:sync"}}",
15
15
  "typecheck": "nuxt typecheck"
16
16
  },
17
17
  "dependencies": {