create-prisma 0.11.7 → 0.12.0-pr.99.334.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 +11 -0
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +8 -4
- package/dist/index.mjs +19 -10
- package/dist/{json-output-Cow6mEVn.mjs → json-output-5idSt2F5.mjs} +123 -29
- package/package.json +1 -1
- package/templates/create/_shared/prisma-composer.config.ts.hbs +1 -1
- package/templates/create/_shared/prisma.config.ts.hbs +1 -1
- package/templates/create/nuxt/package.json.hbs +1 -1
package/README.md
CHANGED
|
@@ -15,6 +15,11 @@ bunx create-prisma@latest my-app
|
|
|
15
15
|
|
|
16
16
|
The CLI initializes Prisma 8 with `prisma@latest`, installs dependencies, emits the contract, and generates a deployable Composer app. PostgreSQL projects use Composer's native Prisma Postgres provider, including migrations and a typed runtime client.
|
|
17
17
|
|
|
18
|
+
For npm, use 11.6.2 or newer. Older npm releases can crash resolving the dependency
|
|
19
|
+
tree (`Cannot read properties of null (reading 'edgesOut')`). Run
|
|
20
|
+
`npm install --global npm@11` to update. create-prisma checks the selected npm
|
|
21
|
+
version before writing project files and never upgrades your package manager automatically.
|
|
22
|
+
|
|
18
23
|
The deployment prompt is:
|
|
19
24
|
|
|
20
25
|
```text
|
|
@@ -23,6 +28,11 @@ Deploy to Prisma now?
|
|
|
23
28
|
|
|
24
29
|
Choose no to deploy later with the generated `deploy` script.
|
|
25
30
|
|
|
31
|
+
New apps explicitly use `us-east-1` in `prisma-composer.config.ts`. Change the
|
|
32
|
+
`prismaCloud({ region })` option before deploying if you need another region.
|
|
33
|
+
Composer requires a region when creating a new project; leaving it unspecified
|
|
34
|
+
only works when deploying into an existing project whose region can be inherited.
|
|
35
|
+
|
|
26
36
|
When multiple Prisma workspace sessions are available, the CLI asks which workspace should receive
|
|
27
37
|
the deployment. For unattended usage, pass `--workspace <id-or-name>` or omit it to use the active
|
|
28
38
|
workspace. Choosing another workspace also updates the Prisma CLI's active workspace session.
|
|
@@ -60,6 +70,7 @@ older cached version. Prisma Compute does not support Deno deployments yet.
|
|
|
60
70
|
- `--package-manager npm|pnpm|yarn|bun|deno`
|
|
61
71
|
- `--deploy` / `--no-deploy`
|
|
62
72
|
- `--workspace <id-or-name>`
|
|
73
|
+
- `--skills <agents>|none`: agents to install skill files for, comma-separated from `claude`, `cursor`, `agents`, `devin` (default: all). `--skills none` writes no `.claude/`, `.cursor/`, `.agents/`, or `.devin/` directories, no `postinstall` hook, and no `skills:sync` script, and records `skills: { agents: [] }` in `prisma.config.ts`. Interactive runs ask instead.
|
|
63
74
|
- `--yes`
|
|
64
75
|
- `--force`: overwrite generated starter and Prisma files in a non-empty directory. This replaces existing Prisma config, contract, and database-client files; back up edits first. A non-empty standard `migrations` path is protected: use a new directory for a fresh starter, or continue working in the existing project with the Prisma CLI. Custom migration paths are not detected.
|
|
65
76
|
- `--verbose`
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as ApplicationLayer } from "./json-output-
|
|
2
|
+
import { a as ApplicationLayer } from "./json-output-5idSt2F5.mjs";
|
|
3
3
|
import { runCreatePrismaCli } from "./index.mjs";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
import { NodeRuntime } from "@effect/platform-node-shared";
|
package/dist/index.d.mts
CHANGED
|
@@ -41,6 +41,7 @@ declare class CommandRunner extends CommandRunner_base {
|
|
|
41
41
|
declare const DatabaseProviderSchema: Schema.Literals<readonly ["postgres", "mongo"]>;
|
|
42
42
|
declare const PackageManagerSchema: Schema.Literals<readonly ["npm", "pnpm", "yarn", "bun", "deno"]>;
|
|
43
43
|
declare const AuthoringStyleSchema: Schema.Literals<readonly ["psl", "typescript"]>;
|
|
44
|
+
declare const AgentSkillTargetSchema: Schema.Literals<readonly ["claude", "cursor", "agents", "devin"]>;
|
|
44
45
|
declare const CreateTemplateSchema: Schema.Literals<readonly ["minimal", "hono", "elysia", "nest", "next", "svelte", "astro", "nuxt", "tanstack-start"]>;
|
|
45
46
|
declare const CreateCommandInputSchema: Schema.Struct<{
|
|
46
47
|
readonly name: Schema.optionalKey<Schema.Trim>;
|
|
@@ -51,6 +52,7 @@ declare const CreateCommandInputSchema: Schema.Struct<{
|
|
|
51
52
|
readonly packageManager: Schema.optionalKey<Schema.Literals<readonly ["npm", "pnpm", "yarn", "bun", "deno"]>>;
|
|
52
53
|
readonly deploy: Schema.optionalKey<Schema.Boolean>;
|
|
53
54
|
readonly workspace: Schema.optionalKey<Schema.decodeTo<Schema.NonEmptyString, Schema.Trim, never, never>>;
|
|
55
|
+
readonly skills: Schema.optionalKey<Schema.decodeTo<Schema.NonEmptyString, Schema.Trim, never, never>>;
|
|
54
56
|
readonly yes: Schema.optionalKey<Schema.Boolean>;
|
|
55
57
|
readonly verbose: Schema.optionalKey<Schema.Boolean>;
|
|
56
58
|
readonly json: Schema.optionalKey<Schema.Boolean>;
|
|
@@ -60,7 +62,7 @@ type CreateCommandInput = typeof CreateCommandInputSchema.Type;
|
|
|
60
62
|
//#region src/create-outcome.d.ts
|
|
61
63
|
declare const CreateFailureStageSchema: Schema.Literals<readonly ["validate_input", "collect_context", "scaffold_template", "initialize_prisma", "configure_project", "install_dependencies", "initialize_agent_skills", "emit_contract", "plan_migration", "initialize_git", "authenticate", "select_workspace", "check_project_name", "build", "composer_deploy", "unknown"]>;
|
|
62
64
|
type CreateFailureStage = typeof CreateFailureStageSchema.Type;
|
|
63
|
-
declare const CreateCancellationStageSchema: Schema.Literals<readonly ["project_name", "template", "database_provider", "authoring_style", "package_manager", "deployment_intent", "select_workspace"]>;
|
|
65
|
+
declare const CreateCancellationStageSchema: Schema.Literals<readonly ["project_name", "template", "database_provider", "authoring_style", "package_manager", "agent_skills", "deployment_intent", "select_workspace"]>;
|
|
64
66
|
type CreateCancellationStage = typeof CreateCancellationStageSchema.Type;
|
|
65
67
|
//#endregion
|
|
66
68
|
//#region src/result.d.ts
|
|
@@ -116,7 +118,7 @@ declare const CreateCommandFailureResultSchema: Schema.Struct<{
|
|
|
116
118
|
readonly schemaVersion: Schema.Literal<1>;
|
|
117
119
|
readonly ok: Schema.Literal<false>;
|
|
118
120
|
readonly error: Schema.Struct<{
|
|
119
|
-
readonly stage: Schema.Union<readonly [Schema.Literals<readonly ["validate_input", "collect_context", "scaffold_template", "initialize_prisma", "configure_project", "install_dependencies", "initialize_agent_skills", "emit_contract", "plan_migration", "initialize_git", "authenticate", "select_workspace", "check_project_name", "build", "composer_deploy", "unknown"]>, Schema.Literals<readonly ["project_name", "template", "database_provider", "authoring_style", "package_manager", "deployment_intent", "select_workspace"]>, Schema.Literal<"parse_arguments">]>;
|
|
121
|
+
readonly stage: Schema.Union<readonly [Schema.Literals<readonly ["validate_input", "collect_context", "scaffold_template", "initialize_prisma", "configure_project", "install_dependencies", "initialize_agent_skills", "emit_contract", "plan_migration", "initialize_git", "authenticate", "select_workspace", "check_project_name", "build", "composer_deploy", "unknown"]>, Schema.Literals<readonly ["project_name", "template", "database_provider", "authoring_style", "package_manager", "agent_skills", "deployment_intent", "select_workspace"]>, Schema.Literal<"parse_arguments">]>;
|
|
120
122
|
readonly message: Schema.String;
|
|
121
123
|
}>;
|
|
122
124
|
readonly project: Schema.optionalKey<Schema.Struct<{
|
|
@@ -163,7 +165,7 @@ declare const CreateCommandResultSchema: Schema.Union<readonly [Schema.Struct<{
|
|
|
163
165
|
readonly schemaVersion: Schema.Literal<1>;
|
|
164
166
|
readonly ok: Schema.Literal<false>;
|
|
165
167
|
readonly error: Schema.Struct<{
|
|
166
|
-
readonly stage: Schema.Union<readonly [Schema.Literals<readonly ["validate_input", "collect_context", "scaffold_template", "initialize_prisma", "configure_project", "install_dependencies", "initialize_agent_skills", "emit_contract", "plan_migration", "initialize_git", "authenticate", "select_workspace", "check_project_name", "build", "composer_deploy", "unknown"]>, Schema.Literals<readonly ["project_name", "template", "database_provider", "authoring_style", "package_manager", "deployment_intent", "select_workspace"]>, Schema.Literal<"parse_arguments">]>;
|
|
168
|
+
readonly stage: Schema.Union<readonly [Schema.Literals<readonly ["validate_input", "collect_context", "scaffold_template", "initialize_prisma", "configure_project", "install_dependencies", "initialize_agent_skills", "emit_contract", "plan_migration", "initialize_git", "authenticate", "select_workspace", "check_project_name", "build", "composer_deploy", "unknown"]>, Schema.Literals<readonly ["project_name", "template", "database_provider", "authoring_style", "package_manager", "agent_skills", "deployment_intent", "select_workspace"]>, Schema.Literal<"parse_arguments">]>;
|
|
167
169
|
readonly message: Schema.String;
|
|
168
170
|
}>;
|
|
169
171
|
readonly project: Schema.optionalKey<Schema.Struct<{
|
|
@@ -187,6 +189,7 @@ declare const createPrismaCommand: Command.Command<"create-prisma", {
|
|
|
187
189
|
readonly packageManager: "npm" | "pnpm" | "yarn" | "bun" | "deno" | undefined;
|
|
188
190
|
readonly deploy: boolean | undefined;
|
|
189
191
|
readonly workspace: string | undefined;
|
|
192
|
+
readonly skills: string | undefined;
|
|
190
193
|
readonly force: boolean | undefined;
|
|
191
194
|
readonly yes: boolean | undefined;
|
|
192
195
|
readonly verbose: boolean | undefined;
|
|
@@ -201,6 +204,7 @@ declare function createCreatePrismaCli(): Command.Command<"create-prisma", {
|
|
|
201
204
|
readonly packageManager: "npm" | "pnpm" | "yarn" | "bun" | "deno" | undefined;
|
|
202
205
|
readonly deploy: boolean | undefined;
|
|
203
206
|
readonly workspace: string | undefined;
|
|
207
|
+
readonly skills: string | undefined;
|
|
204
208
|
readonly force: boolean | undefined;
|
|
205
209
|
readonly yes: boolean | undefined;
|
|
206
210
|
readonly verbose: boolean | undefined;
|
|
@@ -209,4 +213,4 @@ declare function createCreatePrismaCli(): Command.Command<"create-prisma", {
|
|
|
209
213
|
declare function runCreatePrismaCli(argv?: readonly string[]): Effect.Effect<void, never, Command.Environment | CommandRunner>;
|
|
210
214
|
declare function create(input?: CreateCommandInput): Promise<void>;
|
|
211
215
|
//#endregion
|
|
212
|
-
export { AuthoringStyleSchema, CREATE_PRISMA_RESULT_SCHEMA_VERSION, type CreateCommandFailureResult, type CreateCommandFailureStage, type CreateCommandInput, CreateCommandInputSchema, type CreateCommandResult, CreateCommandResultSchema, type CreateCommandSuccessResult, type CreateNextStep, type CreateProjectResult, CreateTemplateSchema, DatabaseProviderSchema, PackageManagerSchema, create, createCreatePrismaCli, createPrismaCommand, runCreatePrismaCli };
|
|
216
|
+
export { AgentSkillTargetSchema, AuthoringStyleSchema, CREATE_PRISMA_RESULT_SCHEMA_VERSION, type CreateCommandFailureResult, type CreateCommandFailureStage, type CreateCommandInput, CreateCommandInputSchema, type CreateCommandResult, CreateCommandResultSchema, type CreateCommandSuccessResult, type CreateNextStep, type CreateProjectResult, CreateTemplateSchema, DatabaseProviderSchema, PackageManagerSchema, create, createCreatePrismaCli, createPrismaCommand, runCreatePrismaCli };
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { _ as
|
|
2
|
+
import { _ as authoringStyles, b as normalizeDatabaseProvider, c as CreateCommandResultSchema, d as AuthoringStyleSchema, f as CreateCommandInputSchema, g as agentSkillTargets, h as PackageManagerSchema, i as getErrorMessage, l as createCommandFailureResult, m as DatabaseProviderSchema, n as writeJsonResult, o as applicationRuntime, p as CreateTemplateSchema, r as runCreateCommandEffect, s as CREATE_PRISMA_RESULT_SCHEMA_VERSION, t as isJsonOutputRequested, u as AgentSkillTargetSchema, v as createTemplates, x as packageManagers, y as databaseProviderInputs } from "./json-output-5idSt2F5.mjs";
|
|
3
3
|
import { Console, Effect, Option } from "effect";
|
|
4
4
|
import { Argument, CliError, Command, Flag } from "effect/unstable/cli";
|
|
5
5
|
|
|
6
6
|
//#region src/index.ts
|
|
7
|
-
const CLI_VERSION = "0.
|
|
7
|
+
const CLI_VERSION = "0.12.0-pr.99.334.1";
|
|
8
8
|
const optionalArgument = (name, description) => Argument.string(name).pipe(Argument.withDescription(description), Argument.optional, Argument.map(Option.getOrUndefined));
|
|
9
9
|
const optionalBoolean = (name, description) => Flag.boolean(name).pipe(Flag.withDescription(description), Flag.optional, Flag.map(Option.getOrUndefined));
|
|
10
10
|
const optionalString = (name, description) => Flag.string(name).pipe(Flag.withDescription(description), Flag.optional, Flag.map(Option.getOrUndefined));
|
|
@@ -17,6 +17,7 @@ const createPrismaCommand = Command.make("create-prisma", {
|
|
|
17
17
|
packageManager: Flag.choice("package-manager", packageManagers).pipe(Flag.withDescription("Package manager used for dependency installation"), Flag.optional, Flag.map(Option.getOrUndefined)),
|
|
18
18
|
deploy: optionalBoolean("deploy", "Deploy the generated app to Prisma immediately"),
|
|
19
19
|
workspace: optionalString("workspace", "Prisma workspace id or name to deploy into"),
|
|
20
|
+
skills: optionalString("skills", `Agents to install skills for, comma-separated (${agentSkillTargets.join(", ")}); 'none' installs no agent skill files`),
|
|
20
21
|
force: optionalBoolean("force", "Overwrite generated starter and Prisma files; refuses a non-empty migrations path"),
|
|
21
22
|
yes: optionalBoolean("yes", "Skip prompts and accept default choices"),
|
|
22
23
|
verbose: optionalBoolean("verbose", "Show verbose command output during setup"),
|
|
@@ -30,6 +31,7 @@ const createPrismaCommand = Command.make("create-prisma", {
|
|
|
30
31
|
...options.packageManager ? { packageManager: options.packageManager } : {},
|
|
31
32
|
...options.deploy !== void 0 ? { deploy: options.deploy } : {},
|
|
32
33
|
...options.workspace ? { workspace: options.workspace } : {},
|
|
34
|
+
...options.skills ? { skills: options.skills } : {},
|
|
33
35
|
...options.force !== void 0 ? { force: options.force } : {},
|
|
34
36
|
...options.yes !== void 0 ? { yes: options.yes } : {},
|
|
35
37
|
...options.verbose !== void 0 ? { verbose: options.verbose } : {},
|
|
@@ -38,13 +40,20 @@ const createPrismaCommand = Command.make("create-prisma", {
|
|
|
38
40
|
const result = yield* runCreateCommandEffect(input);
|
|
39
41
|
if (input.json) yield* writeJsonResult(result);
|
|
40
42
|
if (!result.ok) yield* Effect.sync(() => void (process.exitCode = 1));
|
|
41
|
-
})).pipe(Command.withDescription("Create a new project with Prisma setup"), Command.withExamples([
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
})).pipe(Command.withDescription("Create a new project with Prisma setup"), Command.withExamples([
|
|
44
|
+
{
|
|
45
|
+
command: "create-prisma my-app",
|
|
46
|
+
description: "Create a project interactively"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
command: "create-prisma my-app --yes --json",
|
|
50
|
+
description: "Create and deploy with machine-readable output"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
command: "create-prisma my-app --yes --skills none",
|
|
54
|
+
description: "Create without agent skill files or the skills-sync postinstall hook"
|
|
55
|
+
}
|
|
56
|
+
]));
|
|
48
57
|
const silentConsole = Object.assign(Object.create(console), {
|
|
49
58
|
log() {},
|
|
50
59
|
error() {}
|
|
@@ -71,4 +80,4 @@ function create(input = {}) {
|
|
|
71
80
|
}
|
|
72
81
|
|
|
73
82
|
//#endregion
|
|
74
|
-
export { AuthoringStyleSchema, CREATE_PRISMA_RESULT_SCHEMA_VERSION, CreateCommandInputSchema, CreateCommandResultSchema, CreateTemplateSchema, DatabaseProviderSchema, PackageManagerSchema, create, createCreatePrismaCli, createPrismaCommand, runCreatePrismaCli };
|
|
83
|
+
export { AgentSkillTargetSchema, AuthoringStyleSchema, CREATE_PRISMA_RESULT_SCHEMA_VERSION, CreateCommandInputSchema, CreateCommandResultSchema, CreateTemplateSchema, DatabaseProviderSchema, PackageManagerSchema, create, createCreatePrismaCli, createPrismaCommand, runCreatePrismaCli };
|
|
@@ -35,6 +35,7 @@ const CreateFailureStageSchema = Schema.Literals([
|
|
|
35
35
|
const CreateFailureReasonSchema = Schema.Literals([
|
|
36
36
|
"invalid_input",
|
|
37
37
|
"unsupported_node_version",
|
|
38
|
+
"unsupported_package_manager_version",
|
|
38
39
|
"invalid_project_name",
|
|
39
40
|
"target_path_not_directory",
|
|
40
41
|
"target_directory_not_empty",
|
|
@@ -66,6 +67,7 @@ const CreateCancellationStageSchema = Schema.Literals([
|
|
|
66
67
|
"database_provider",
|
|
67
68
|
"authoring_style",
|
|
68
69
|
"package_manager",
|
|
70
|
+
"agent_skills",
|
|
69
71
|
"deployment_intent",
|
|
70
72
|
"select_workspace"
|
|
71
73
|
]);
|
|
@@ -115,6 +117,13 @@ const packageManagers = [
|
|
|
115
117
|
"deno"
|
|
116
118
|
];
|
|
117
119
|
const authoringStyles = ["psl", "typescript"];
|
|
120
|
+
const agentSkillTargets = [
|
|
121
|
+
"claude",
|
|
122
|
+
"cursor",
|
|
123
|
+
"agents",
|
|
124
|
+
"devin"
|
|
125
|
+
];
|
|
126
|
+
const SKILLS_NONE = "none";
|
|
118
127
|
const createTemplates = [
|
|
119
128
|
"minimal",
|
|
120
129
|
"hono",
|
|
@@ -130,6 +139,7 @@ const DatabaseProviderInputSchema = Schema.Literals(databaseProviderInputs);
|
|
|
130
139
|
const DatabaseProviderSchema = Schema.Literals(databaseProviders);
|
|
131
140
|
const PackageManagerSchema = Schema.Literals(packageManagers);
|
|
132
141
|
const AuthoringStyleSchema = Schema.Literals(authoringStyles);
|
|
142
|
+
const AgentSkillTargetSchema = Schema.Literals(agentSkillTargets);
|
|
133
143
|
const CreateTemplateSchema = Schema.Literals(createTemplates);
|
|
134
144
|
const OptionalBoolean = Schema.optionalKey(Schema.Boolean);
|
|
135
145
|
const OptionalTrimmedString = Schema.optionalKey(Schema.Trim);
|
|
@@ -144,7 +154,8 @@ const PrismaSetupOptionsSchema = Schema.Struct({
|
|
|
144
154
|
authoring: Schema.optionalKey(AuthoringStyleSchema),
|
|
145
155
|
packageManager: Schema.optionalKey(PackageManagerSchema),
|
|
146
156
|
deploy: OptionalBoolean,
|
|
147
|
-
workspace: OptionalNonEmptyTrimmedString
|
|
157
|
+
workspace: OptionalNonEmptyTrimmedString,
|
|
158
|
+
skills: OptionalNonEmptyTrimmedString
|
|
148
159
|
});
|
|
149
160
|
const PrismaSetupCommandInputSchema = Schema.Struct({
|
|
150
161
|
...CommonCommandOptionsSchema.fields,
|
|
@@ -167,6 +178,37 @@ function normalizeDatabaseProvider(value) {
|
|
|
167
178
|
default: return value;
|
|
168
179
|
}
|
|
169
180
|
}
|
|
181
|
+
function isAgentSkillTarget(name) {
|
|
182
|
+
return agentSkillTargets.includes(name);
|
|
183
|
+
}
|
|
184
|
+
/** Parses `--skills`: a comma-separated list of agent names, or `none`. */
|
|
185
|
+
function parseAgentSkillSelection(value) {
|
|
186
|
+
const names = value.split(",").map((name) => name.trim()).filter((name) => name.length > 0);
|
|
187
|
+
const known = agentSkillTargets.join(", ");
|
|
188
|
+
if (names.includes(SKILLS_NONE)) return names.length === 1 ? {
|
|
189
|
+
ok: true,
|
|
190
|
+
agents: []
|
|
191
|
+
} : {
|
|
192
|
+
ok: false,
|
|
193
|
+
message: `--skills ${SKILLS_NONE} cannot be combined with agent names.`
|
|
194
|
+
};
|
|
195
|
+
const agents = [];
|
|
196
|
+
for (const name of names) {
|
|
197
|
+
if (!isAgentSkillTarget(name)) return {
|
|
198
|
+
ok: false,
|
|
199
|
+
message: `--skills names '${name}', which is not a known agent. Use a comma-separated list of ${known}, or ${SKILLS_NONE}.`
|
|
200
|
+
};
|
|
201
|
+
if (!agents.includes(name)) agents.push(name);
|
|
202
|
+
}
|
|
203
|
+
if (agents.length === 0) return {
|
|
204
|
+
ok: false,
|
|
205
|
+
message: `--skills was given no agent names. Use a comma-separated list of ${known}, or ${SKILLS_NONE}.`
|
|
206
|
+
};
|
|
207
|
+
return {
|
|
208
|
+
ok: true,
|
|
209
|
+
agents
|
|
210
|
+
};
|
|
211
|
+
}
|
|
170
212
|
|
|
171
213
|
//#endregion
|
|
172
214
|
//#region src/result.ts
|
|
@@ -310,20 +352,14 @@ const applicationRuntime = ManagedRuntime.make(ApplicationLayer);
|
|
|
310
352
|
|
|
311
353
|
//#endregion
|
|
312
354
|
//#region src/telemetry/client.ts
|
|
313
|
-
const TELEMETRY_API_KEY = "
|
|
355
|
+
const TELEMETRY_API_KEY = "";
|
|
314
356
|
const TELEMETRY_HOST = "https://us.i.posthog.com";
|
|
315
357
|
const TELEMETRY_CONFIG_FILE = "telemetry.json";
|
|
316
358
|
const TELEMETRY_TIMEOUT_MS = 2e3;
|
|
317
359
|
const AnonymousId = Schema.String.check(Schema.isUUID(4));
|
|
318
360
|
const decodeAnonymousId = Schema.decodeUnknownExit(AnonymousId);
|
|
319
|
-
const isTruthyEnvValue = (value) => [
|
|
320
|
-
"1",
|
|
321
|
-
"true",
|
|
322
|
-
"yes",
|
|
323
|
-
"on"
|
|
324
|
-
].includes(String(value ?? "").trim().toLowerCase());
|
|
325
361
|
function shouldDisableTelemetry() {
|
|
326
|
-
return
|
|
362
|
+
return true;
|
|
327
363
|
}
|
|
328
364
|
function getTelemetryConfigDir() {
|
|
329
365
|
if (process.platform === "darwin") return path.join(os.homedir(), "Library", "Application Support", "create-prisma");
|
|
@@ -346,7 +382,7 @@ const getAnonymousIdEffect = Effect.fn("Telemetry.getAnonymousId")(function* ()
|
|
|
346
382
|
return anonymousId;
|
|
347
383
|
});
|
|
348
384
|
const getCommonProperties = () => ({
|
|
349
|
-
"cli-version": "0.
|
|
385
|
+
"cli-version": "0.12.0-pr.99.334.1",
|
|
350
386
|
"node-version": process.version,
|
|
351
387
|
platform: process.platform,
|
|
352
388
|
arch: process.arch
|
|
@@ -385,6 +421,7 @@ const CREATE_PRISMA_NEXT_CANCELLED_EVENT = "cli:create_prisma_next_command_cance
|
|
|
385
421
|
const expectedRejectionReasons = new Set([
|
|
386
422
|
"invalid_input",
|
|
387
423
|
"unsupported_node_version",
|
|
424
|
+
"unsupported_package_manager_version",
|
|
388
425
|
"invalid_project_name",
|
|
389
426
|
"target_path_not_directory",
|
|
390
427
|
"target_directory_not_empty",
|
|
@@ -415,6 +452,7 @@ function getBaseCreateProperties(input, context) {
|
|
|
415
452
|
"database-provider": context?.prismaSetupContext.databaseProvider ?? input.provider ?? null,
|
|
416
453
|
"authoring-style": context?.prismaSetupContext.authoring ?? input.authoring ?? null,
|
|
417
454
|
"package-manager": context?.prismaSetupContext.packageManager ?? input.packageManager ?? null,
|
|
455
|
+
"agent-skills": context ? [...context.prismaSetupContext.skillAgents] : input.skills ?? null,
|
|
418
456
|
"should-deploy": context?.prismaSetupContext.shouldDeploy ?? input.deploy ?? null,
|
|
419
457
|
"target-directory-state": context ? getTargetDirectoryState(context) : null
|
|
420
458
|
};
|
|
@@ -466,11 +504,27 @@ const trackCreateCancelledEffect = Effect.fn("Telemetry.createCancelled")(functi
|
|
|
466
504
|
//#region src/utils/package-manager.ts
|
|
467
505
|
const DENO_ALLOW_FRESH_DEPENDENCIES = "--minimum-dependency-age=0";
|
|
468
506
|
const packageManagerManifestValues = {
|
|
469
|
-
npm: "npm@
|
|
507
|
+
npm: "npm@11.6.2",
|
|
470
508
|
pnpm: "pnpm@11.21.0",
|
|
471
509
|
yarn: "yarn@4.13.0",
|
|
472
510
|
bun: "bun@1.3.9"
|
|
473
511
|
};
|
|
512
|
+
const verifyPackageManagerEffect = Effect.fn("PackageManager.verify")(function* (packageManager) {
|
|
513
|
+
if (packageManager !== "npm") return;
|
|
514
|
+
const version = (yield* (yield* CommandRunner).runChecked({
|
|
515
|
+
command: "npm",
|
|
516
|
+
args: ["--version"],
|
|
517
|
+
cwd: process.cwd()
|
|
518
|
+
})).stdout.trim();
|
|
519
|
+
const parts = version.split(".").map(Number);
|
|
520
|
+
if (parts.length !== 3 || parts.some((part) => !Number.isInteger(part) || part < 0)) return yield* Effect.fail(/* @__PURE__ */ new Error(`Could not determine the installed npm version: ${version}`));
|
|
521
|
+
const [major, minor, patch] = parts;
|
|
522
|
+
if (major < 11 || major === 11 && (minor < 6 || minor === 6 && patch < 2)) return yield* new CreateFailure({
|
|
523
|
+
stage: "validate_input",
|
|
524
|
+
reason: "unsupported_package_manager_version",
|
|
525
|
+
message: `npm ${version} is unsupported. Required: npm 11.6.2 or newer. Older npm releases can crash while resolving Prisma dependencies. Run npm install --global npm@11, then retry create-prisma.`
|
|
526
|
+
});
|
|
527
|
+
});
|
|
474
528
|
function parseUserAgent(userAgent) {
|
|
475
529
|
if (userAgent?.startsWith("pnpm")) return "pnpm";
|
|
476
530
|
if (userAgent?.startsWith("yarn")) return "yarn";
|
|
@@ -730,6 +784,7 @@ function createTemplateContext(options) {
|
|
|
730
784
|
provider: options.provider,
|
|
731
785
|
authoring: options.authoring,
|
|
732
786
|
packageManager: options.packageManager,
|
|
787
|
+
skillAgents: options.skillAgents ?? agentSkillTargets,
|
|
733
788
|
tsdownEntry: tsdownEntries[options.template] ?? null
|
|
734
789
|
};
|
|
735
790
|
}
|
|
@@ -765,10 +820,10 @@ const scaffoldCreateTemplateEffect = Effect.fn("Templates.scaffold")(function* (
|
|
|
765
820
|
const dependencyVersionMap = {
|
|
766
821
|
"@astrojs/node": "^10.0.2",
|
|
767
822
|
"@elysiajs/node": "^1.4.5",
|
|
768
|
-
"@prisma/composer": "0.
|
|
769
|
-
"@prisma/composer-prisma-cloud": "0.
|
|
770
|
-
"@prisma/orm-mongo": "8.0.0-rc.
|
|
771
|
-
"@prisma/orm-postgres": "8.0.0-rc.
|
|
823
|
+
"@prisma/composer": "0.19.0",
|
|
824
|
+
"@prisma/composer-prisma-cloud": "0.19.0",
|
|
825
|
+
"@prisma/orm-mongo": "8.0.0-rc.10",
|
|
826
|
+
"@prisma/orm-postgres": "8.0.0-rc.10",
|
|
772
827
|
"@sveltejs/adapter-node": "^5.3.2",
|
|
773
828
|
"@types/node": "^25.6.2",
|
|
774
829
|
alchemy: "2.0.0-beta.74",
|
|
@@ -843,7 +898,7 @@ const runSetupCommand = Effect.fn("runSetupCommand")(function* (options) {
|
|
|
843
898
|
|
|
844
899
|
//#endregion
|
|
845
900
|
//#region src/tasks/install.ts
|
|
846
|
-
function getPrismaScriptMap(packageManager) {
|
|
901
|
+
function getPrismaScriptMap(packageManager, skillsSync) {
|
|
847
902
|
if (packageManager === "deno") {
|
|
848
903
|
const prismaCommand = (needsDatabase, ...args) => [
|
|
849
904
|
"deno run -A",
|
|
@@ -872,7 +927,7 @@ function getPrismaScriptMap(packageManager) {
|
|
|
872
927
|
migrate: prismaCommand("db", "migrate"),
|
|
873
928
|
"migration:status": prismaCommand("migration", "status"),
|
|
874
929
|
"migration:show": prismaCommand("migration", "show"),
|
|
875
|
-
"skills:sync": `${prismaCommand("skills", "sync")} || exit 0`
|
|
930
|
+
...skillsSync ? { "skills:sync": `${prismaCommand("skills", "sync")} || exit 0` } : {}
|
|
876
931
|
};
|
|
877
932
|
}
|
|
878
933
|
function getComposerScriptMap(packageManager) {
|
|
@@ -933,7 +988,7 @@ const addPackageDependencyEffect = Effect.fn("Dependencies.add")(function* (opts
|
|
|
933
988
|
packageJson.scripts = sortRecord(packageJson.scripts);
|
|
934
989
|
yield* writePackageJson(packageJsonPath, packageJson);
|
|
935
990
|
});
|
|
936
|
-
const writePrismaDependenciesEffect = Effect.fn("Dependencies.writePrisma")(function* (provider, packageManager, _authoring, projectDir = process.cwd()) {
|
|
991
|
+
const writePrismaDependenciesEffect = Effect.fn("Dependencies.writePrisma")(function* (provider, packageManager, _authoring, projectDir = process.cwd(), options = {}) {
|
|
937
992
|
const dependencies = [getDbPackages(provider)];
|
|
938
993
|
if (provider === "postgres" && packageManager !== "deno") dependencies.push("temporal-polyfill");
|
|
939
994
|
if (provider === "mongo") dependencies.push("arktype", "mongodb");
|
|
@@ -941,7 +996,7 @@ const writePrismaDependenciesEffect = Effect.fn("Dependencies.writePrisma")(func
|
|
|
941
996
|
yield* addPackageDependencyEffect({
|
|
942
997
|
dependencies,
|
|
943
998
|
devDependencies: ["@types/node", "prisma"],
|
|
944
|
-
scripts: getPrismaScriptMap(packageManager),
|
|
999
|
+
scripts: getPrismaScriptMap(packageManager, options.skillsSync ?? true),
|
|
945
1000
|
projectDir
|
|
946
1001
|
});
|
|
947
1002
|
});
|
|
@@ -1479,11 +1534,18 @@ const runPrismaInit = Effect.fn("PrismaSetup.init")(function* (context, projectD
|
|
|
1479
1534
|
getContractPath(context.authoring),
|
|
1480
1535
|
"--skip-install"
|
|
1481
1536
|
]);
|
|
1482
|
-
if (context.packageManager === "deno")
|
|
1537
|
+
if (context.packageManager === "deno") {
|
|
1538
|
+
const fs = yield* FileSystem.FileSystem;
|
|
1539
|
+
for (const primer of ["prisma-8.md", "prisma-next.md"]) yield* fs.remove(path.join(projectDir, primer), { force: true });
|
|
1540
|
+
}
|
|
1483
1541
|
});
|
|
1484
1542
|
const initializeAgentSkills = Effect.fn("PrismaSetup.initializeSkills")(function* (context, projectDir) {
|
|
1485
|
-
if (context.
|
|
1486
|
-
yield* runPrismaCli(context, projectDir, [
|
|
1543
|
+
if (context.skillAgents.length === 0) return;
|
|
1544
|
+
yield* runPrismaCli(context, projectDir, [
|
|
1545
|
+
"init",
|
|
1546
|
+
"--yes",
|
|
1547
|
+
`--skills=${context.skillAgents.join(",")}`
|
|
1548
|
+
]);
|
|
1487
1549
|
});
|
|
1488
1550
|
|
|
1489
1551
|
//#endregion
|
|
@@ -1580,6 +1642,29 @@ const promptForPackageManager = Effect.fn("Prompts.packageManager")(function* (d
|
|
|
1580
1642
|
}
|
|
1581
1643
|
return yield* decodePromptValue(PackageManagerSchema, value);
|
|
1582
1644
|
});
|
|
1645
|
+
const promptForAgentSkills = Effect.fn("Prompts.agentSkills")(function* (output) {
|
|
1646
|
+
const value = yield* Effect.tryPromise(() => confirm({
|
|
1647
|
+
message: "Install agent skills for coding assistants (Claude Code, Cursor, Codex, Devin)?",
|
|
1648
|
+
initialValue: true,
|
|
1649
|
+
output
|
|
1650
|
+
}));
|
|
1651
|
+
if (isCancel(value)) {
|
|
1652
|
+
yield* Effect.sync(() => cancel("Operation cancelled.", { output }));
|
|
1653
|
+
return yield* new CreateCancellationError({ stage: "agent_skills" });
|
|
1654
|
+
}
|
|
1655
|
+
return value ? agentSkillTargets : [];
|
|
1656
|
+
});
|
|
1657
|
+
const resolveRequestedAgentSkills = Effect.fn("PrismaSetup.resolveSkills")(function* (value, output) {
|
|
1658
|
+
const selection = parseAgentSkillSelection(value);
|
|
1659
|
+
if (selection.ok) return selection.agents;
|
|
1660
|
+
yield* Effect.sync(() => cancel(selection.message, { output }));
|
|
1661
|
+
return yield* new CreateFailure({
|
|
1662
|
+
stage: "collect_context",
|
|
1663
|
+
reason: "invalid_input",
|
|
1664
|
+
message: selection.message,
|
|
1665
|
+
errorReported: true
|
|
1666
|
+
});
|
|
1667
|
+
});
|
|
1583
1668
|
const promptForDeployment = Effect.fn("Prompts.deployment")(function* (output) {
|
|
1584
1669
|
const value = yield* Effect.tryPromise(() => confirm({
|
|
1585
1670
|
message: "Deploy to Prisma now?",
|
|
@@ -1595,6 +1680,7 @@ const promptForDeployment = Effect.fn("Prompts.deployment")(function* (output) {
|
|
|
1595
1680
|
const collectPrismaSetupContextEffect = Effect.fn("PrismaSetup.collectContext")(function* (input, options = {}) {
|
|
1596
1681
|
const projectDir = path.resolve(options.projectDir ?? process.cwd());
|
|
1597
1682
|
const { json, output, useDefaults } = resolveExecutionSettings(input);
|
|
1683
|
+
const requestedSkillAgents = input.skills === void 0 ? void 0 : yield* resolveRequestedAgentSkills(input.skills, output);
|
|
1598
1684
|
const databaseProvider = input.provider ?? (useDefaults ? DEFAULT_DATABASE_PROVIDER : yield* promptForDatabaseProvider(output));
|
|
1599
1685
|
const authoring = input.authoring ?? (useDefaults ? DEFAULT_AUTHORING : yield* promptForAuthoringStyle(output));
|
|
1600
1686
|
const detectedPackageManager = yield* detectPackageManagerEffect(projectDir);
|
|
@@ -1614,6 +1700,7 @@ const collectPrismaSetupContextEffect = Effect.fn("PrismaSetup.collectContext")(
|
|
|
1614
1700
|
reason: "unsupported_configuration",
|
|
1615
1701
|
message: "Prisma Compute does not support Deno deployments yet. Use --no-deploy."
|
|
1616
1702
|
});
|
|
1703
|
+
const skillAgents = packageManager === "deno" ? [] : requestedSkillAgents ?? (useDefaults ? agentSkillTargets : yield* promptForAgentSkills(output));
|
|
1617
1704
|
const shouldDeploy = packageManager === "deno" ? false : input.deploy ?? (json ? true : useDefaults ? false : yield* promptForDeployment(output));
|
|
1618
1705
|
return {
|
|
1619
1706
|
projectDir,
|
|
@@ -1623,6 +1710,7 @@ const collectPrismaSetupContextEffect = Effect.fn("PrismaSetup.collectContext")(
|
|
|
1623
1710
|
databaseProvider,
|
|
1624
1711
|
authoring,
|
|
1625
1712
|
packageManager,
|
|
1713
|
+
skillAgents,
|
|
1626
1714
|
shouldDeploy,
|
|
1627
1715
|
shouldPromptForWorkspace: !useDefaults,
|
|
1628
1716
|
...input.workspace ? { workspace: input.workspace } : {}
|
|
@@ -1708,9 +1796,10 @@ const executePrismaSetupContextEffect = Effect.fn("PrismaSetup.execute")(functio
|
|
|
1708
1796
|
template,
|
|
1709
1797
|
provider: context.databaseProvider,
|
|
1710
1798
|
authoring: context.authoring,
|
|
1711
|
-
packageManager: context.packageManager
|
|
1799
|
+
packageManager: context.packageManager,
|
|
1800
|
+
skillAgents: context.skillAgents
|
|
1712
1801
|
}), "configure_project", "project_configuration_failed");
|
|
1713
|
-
yield* atCreateStage(writePrismaDependenciesEffect(context.databaseProvider, context.packageManager, context.authoring, projectDir), "configure_project", "project_configuration_failed");
|
|
1802
|
+
yield* atCreateStage(writePrismaDependenciesEffect(context.databaseProvider, context.packageManager, context.authoring, projectDir, { skillsSync: context.skillAgents.length > 0 }), "configure_project", "project_configuration_failed");
|
|
1714
1803
|
yield* Effect.sync(() => progress?.message(`Installing dependencies with ${getInstallCommand(context.packageManager)}...`));
|
|
1715
1804
|
yield* atCreateStage(installProjectDependenciesEffect(context.packageManager, projectDir, {
|
|
1716
1805
|
verbose: context.verbose,
|
|
@@ -1725,7 +1814,8 @@ const executePrismaSetupContextEffect = Effect.fn("PrismaSetup.execute")(functio
|
|
|
1725
1814
|
template,
|
|
1726
1815
|
provider: context.databaseProvider,
|
|
1727
1816
|
authoring: context.authoring,
|
|
1728
|
-
packageManager: context.packageManager
|
|
1817
|
+
packageManager: context.packageManager,
|
|
1818
|
+
skillAgents: context.skillAgents
|
|
1729
1819
|
});
|
|
1730
1820
|
yield* ensureComposerTypeScriptOptions(projectDir);
|
|
1731
1821
|
if (context.databaseProvider === "mongo") yield* ensureMongoEnvironment(projectDir);
|
|
@@ -1734,8 +1824,10 @@ const executePrismaSetupContextEffect = Effect.fn("PrismaSetup.execute")(functio
|
|
|
1734
1824
|
yield* ensureGitignoreEntry(projectDir, "/.prisma-composer");
|
|
1735
1825
|
}
|
|
1736
1826
|
}), "configure_project", "project_configuration_failed");
|
|
1737
|
-
|
|
1738
|
-
|
|
1827
|
+
if (context.skillAgents.length > 0) {
|
|
1828
|
+
yield* Effect.sync(() => progress?.message("Installing Prisma agent skills..."));
|
|
1829
|
+
yield* atCreateStage(initializeAgentSkills(context, projectDir), "initialize_agent_skills", "agent_skills_init_failed");
|
|
1830
|
+
}
|
|
1739
1831
|
yield* Effect.sync(() => progress?.message("Generating Prisma 8 contract artifacts..."));
|
|
1740
1832
|
yield* atCreateStage(runPrismaCli(context, projectDir, ["contract", "emit"]), "emit_contract", "contract_emit_failed");
|
|
1741
1833
|
if (context.databaseProvider === "postgres") {
|
|
@@ -2028,7 +2120,8 @@ const executeCreateContext = Effect.fn("Create.execute")(function* (context) {
|
|
|
2028
2120
|
template: context.template,
|
|
2029
2121
|
provider: context.prismaSetupContext.databaseProvider,
|
|
2030
2122
|
authoring: context.prismaSetupContext.authoring,
|
|
2031
|
-
packageManager: context.prismaSetupContext.packageManager
|
|
2123
|
+
packageManager: context.prismaSetupContext.packageManager,
|
|
2124
|
+
skillAgents: context.prismaSetupContext.skillAgents
|
|
2032
2125
|
}).pipe(Effect.andThen(writeCreateTemplateDependenciesEffect({
|
|
2033
2126
|
template: context.template,
|
|
2034
2127
|
packageManager: context.prismaSetupContext.packageManager,
|
|
@@ -2091,6 +2184,7 @@ const createProjectEffect = Effect.fn("Create.project")(function* (rawInput, inp
|
|
|
2091
2184
|
yield* Effect.sync(() => intro(getCreatePrismaIntro(), { output }));
|
|
2092
2185
|
const context = yield* atCreateStage(collectCreateContext(input), "collect_context", "unexpected_error");
|
|
2093
2186
|
yield* Ref.set(contextRef, Option.some(context));
|
|
2187
|
+
yield* atCreateStage(verifyPackageManagerEffect(context.prismaSetupContext.packageManager), "install_dependencies", "dependency_install_failed");
|
|
2094
2188
|
return {
|
|
2095
2189
|
input,
|
|
2096
2190
|
context,
|
|
@@ -2156,4 +2250,4 @@ function isJsonOutputRequested(argv) {
|
|
|
2156
2250
|
const writeJsonResult = Effect.fn("JsonOutput.write")((result) => Effect.sync(() => process.stdout.write(`${JSON.stringify(result)}\n`)));
|
|
2157
2251
|
|
|
2158
2252
|
//#endregion
|
|
2159
|
-
export {
|
|
2253
|
+
export { authoringStyles as _, ApplicationLayer as a, normalizeDatabaseProvider as b, CreateCommandResultSchema as c, AuthoringStyleSchema as d, CreateCommandInputSchema as f, agentSkillTargets as g, PackageManagerSchema as h, getErrorMessage as i, createCommandFailureResult as l, DatabaseProviderSchema as m, writeJsonResult as n, applicationRuntime as o, CreateTemplateSchema as p, runCreateCommandEffect as r, CREATE_PRISMA_RESULT_SCHEMA_VERSION as s, isJsonOutputRequested as t, AgentSkillTargetSchema as u, createTemplates as v, packageManagers as x, databaseProviderInputs as y };
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@ import { nextjsBuild } from "@prisma/composer/nextjs/control";
|
|
|
7
7
|
import { prismaCloud, prismaState } from "@prisma/composer-prisma-cloud/control";
|
|
8
8
|
|
|
9
9
|
export default defineConfig({
|
|
10
|
-
extensions: [prismaCloud(), nodeBuild(){{#if (eq template "next")}}, nextjsBuild(){{/if}}],
|
|
10
|
+
extensions: [prismaCloud({ region: "us-east-1" }), nodeBuild(){{#if (eq template "next")}}, nextjsBuild(){{/if}}],
|
|
11
11
|
state: prismaState(),
|
|
12
12
|
});
|
|
13
13
|
{{/unless}}
|
|
@@ -20,7 +20,7 @@ import { defineConfig as ormConfig } from "@prisma/orm-{{#if (eq provider "postg
|
|
|
20
20
|
|
|
21
21
|
export default definePrismaConfig({
|
|
22
22
|
skills: {
|
|
23
|
-
agents: [
|
|
23
|
+
agents: [{{#each skillAgents}}"{{this}}"{{#unless @last}}, {{/unless}}{{/each}}],
|
|
24
24
|
},
|
|
25
25
|
orm: ormConfig({
|
|
26
26
|
contract: "./src/prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dev": "nuxt dev",
|
|
12
12
|
"generate": "nuxt generate",
|
|
13
13
|
"preview": "nuxt preview",
|
|
14
|
-
"postinstall": "nuxt prepare && {{runScriptCommand packageManager "skills:sync"}}",
|
|
14
|
+
"postinstall": "nuxt prepare{{#if skillAgents.length}} && {{runScriptCommand packageManager "skills:sync"}}{{/if}}",
|
|
15
15
|
"typecheck": "nuxt typecheck"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|