create-prisma 0.11.6 → 0.11.7-pr.96.327.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 +2 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +8 -4
- package/dist/index.mjs +20 -11
- package/dist/{json-output--8Kk1Yoh.mjs → json-output-x_Hb-EIN.mjs} +110 -23
- package/package.json +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
|
@@ -60,8 +60,9 @@ older cached version. Prisma Compute does not support Deno deployments yet.
|
|
|
60
60
|
- `--package-manager npm|pnpm|yarn|bun|deno`
|
|
61
61
|
- `--deploy` / `--no-deploy`
|
|
62
62
|
- `--workspace <id-or-name>`
|
|
63
|
+
- `--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
64
|
- `--yes`
|
|
64
|
-
- `--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.
|
|
65
|
+
- `--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
66
|
- `--verbose`
|
|
66
67
|
- `--json`
|
|
67
68
|
|
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-x_Hb-EIN.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-x_Hb-EIN.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.11.
|
|
7
|
+
const CLI_VERSION = "0.11.7-pr.96.327.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,7 +17,8 @@ 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
|
-
|
|
20
|
+
skills: optionalString("skills", `Agents to install skills for, comma-separated (${agentSkillTargets.join(", ")}); 'none' installs no agent skill files`),
|
|
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"),
|
|
23
24
|
json: optionalBoolean("json", "Emit one quiet JSON result for agents and automation (non-interactive; deploys unless --no-deploy)")
|
|
@@ -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 };
|
|
@@ -38,6 +38,7 @@ const CreateFailureReasonSchema = Schema.Literals([
|
|
|
38
38
|
"invalid_project_name",
|
|
39
39
|
"target_path_not_directory",
|
|
40
40
|
"target_directory_not_empty",
|
|
41
|
+
"target_has_migrations",
|
|
41
42
|
"unsupported_configuration",
|
|
42
43
|
"template_scaffold_failed",
|
|
43
44
|
"prisma_init_failed",
|
|
@@ -65,6 +66,7 @@ const CreateCancellationStageSchema = Schema.Literals([
|
|
|
65
66
|
"database_provider",
|
|
66
67
|
"authoring_style",
|
|
67
68
|
"package_manager",
|
|
69
|
+
"agent_skills",
|
|
68
70
|
"deployment_intent",
|
|
69
71
|
"select_workspace"
|
|
70
72
|
]);
|
|
@@ -114,6 +116,13 @@ const packageManagers = [
|
|
|
114
116
|
"deno"
|
|
115
117
|
];
|
|
116
118
|
const authoringStyles = ["psl", "typescript"];
|
|
119
|
+
const agentSkillTargets = [
|
|
120
|
+
"claude",
|
|
121
|
+
"cursor",
|
|
122
|
+
"agents",
|
|
123
|
+
"devin"
|
|
124
|
+
];
|
|
125
|
+
const SKILLS_NONE = "none";
|
|
117
126
|
const createTemplates = [
|
|
118
127
|
"minimal",
|
|
119
128
|
"hono",
|
|
@@ -129,6 +138,7 @@ const DatabaseProviderInputSchema = Schema.Literals(databaseProviderInputs);
|
|
|
129
138
|
const DatabaseProviderSchema = Schema.Literals(databaseProviders);
|
|
130
139
|
const PackageManagerSchema = Schema.Literals(packageManagers);
|
|
131
140
|
const AuthoringStyleSchema = Schema.Literals(authoringStyles);
|
|
141
|
+
const AgentSkillTargetSchema = Schema.Literals(agentSkillTargets);
|
|
132
142
|
const CreateTemplateSchema = Schema.Literals(createTemplates);
|
|
133
143
|
const OptionalBoolean = Schema.optionalKey(Schema.Boolean);
|
|
134
144
|
const OptionalTrimmedString = Schema.optionalKey(Schema.Trim);
|
|
@@ -143,7 +153,8 @@ const PrismaSetupOptionsSchema = Schema.Struct({
|
|
|
143
153
|
authoring: Schema.optionalKey(AuthoringStyleSchema),
|
|
144
154
|
packageManager: Schema.optionalKey(PackageManagerSchema),
|
|
145
155
|
deploy: OptionalBoolean,
|
|
146
|
-
workspace: OptionalNonEmptyTrimmedString
|
|
156
|
+
workspace: OptionalNonEmptyTrimmedString,
|
|
157
|
+
skills: OptionalNonEmptyTrimmedString
|
|
147
158
|
});
|
|
148
159
|
const PrismaSetupCommandInputSchema = Schema.Struct({
|
|
149
160
|
...CommonCommandOptionsSchema.fields,
|
|
@@ -166,6 +177,37 @@ function normalizeDatabaseProvider(value) {
|
|
|
166
177
|
default: return value;
|
|
167
178
|
}
|
|
168
179
|
}
|
|
180
|
+
function isAgentSkillTarget(name) {
|
|
181
|
+
return agentSkillTargets.includes(name);
|
|
182
|
+
}
|
|
183
|
+
/** Parses `--skills`: a comma-separated list of agent names, or `none`. */
|
|
184
|
+
function parseAgentSkillSelection(value) {
|
|
185
|
+
const names = value.split(",").map((name) => name.trim()).filter((name) => name.length > 0);
|
|
186
|
+
const known = agentSkillTargets.join(", ");
|
|
187
|
+
if (names.includes(SKILLS_NONE)) return names.length === 1 ? {
|
|
188
|
+
ok: true,
|
|
189
|
+
agents: []
|
|
190
|
+
} : {
|
|
191
|
+
ok: false,
|
|
192
|
+
message: `--skills ${SKILLS_NONE} cannot be combined with agent names.`
|
|
193
|
+
};
|
|
194
|
+
const agents = [];
|
|
195
|
+
for (const name of names) {
|
|
196
|
+
if (!isAgentSkillTarget(name)) return {
|
|
197
|
+
ok: false,
|
|
198
|
+
message: `--skills names '${name}', which is not a known agent. Use a comma-separated list of ${known}, or ${SKILLS_NONE}.`
|
|
199
|
+
};
|
|
200
|
+
if (!agents.includes(name)) agents.push(name);
|
|
201
|
+
}
|
|
202
|
+
if (agents.length === 0) return {
|
|
203
|
+
ok: false,
|
|
204
|
+
message: `--skills was given no agent names. Use a comma-separated list of ${known}, or ${SKILLS_NONE}.`
|
|
205
|
+
};
|
|
206
|
+
return {
|
|
207
|
+
ok: true,
|
|
208
|
+
agents
|
|
209
|
+
};
|
|
210
|
+
}
|
|
169
211
|
|
|
170
212
|
//#endregion
|
|
171
213
|
//#region src/result.ts
|
|
@@ -309,20 +351,14 @@ const applicationRuntime = ManagedRuntime.make(ApplicationLayer);
|
|
|
309
351
|
|
|
310
352
|
//#endregion
|
|
311
353
|
//#region src/telemetry/client.ts
|
|
312
|
-
const TELEMETRY_API_KEY = "
|
|
354
|
+
const TELEMETRY_API_KEY = "";
|
|
313
355
|
const TELEMETRY_HOST = "https://us.i.posthog.com";
|
|
314
356
|
const TELEMETRY_CONFIG_FILE = "telemetry.json";
|
|
315
357
|
const TELEMETRY_TIMEOUT_MS = 2e3;
|
|
316
358
|
const AnonymousId = Schema.String.check(Schema.isUUID(4));
|
|
317
359
|
const decodeAnonymousId = Schema.decodeUnknownExit(AnonymousId);
|
|
318
|
-
const isTruthyEnvValue = (value) => [
|
|
319
|
-
"1",
|
|
320
|
-
"true",
|
|
321
|
-
"yes",
|
|
322
|
-
"on"
|
|
323
|
-
].includes(String(value ?? "").trim().toLowerCase());
|
|
324
360
|
function shouldDisableTelemetry() {
|
|
325
|
-
return
|
|
361
|
+
return true;
|
|
326
362
|
}
|
|
327
363
|
function getTelemetryConfigDir() {
|
|
328
364
|
if (process.platform === "darwin") return path.join(os.homedir(), "Library", "Application Support", "create-prisma");
|
|
@@ -345,7 +381,7 @@ const getAnonymousIdEffect = Effect.fn("Telemetry.getAnonymousId")(function* ()
|
|
|
345
381
|
return anonymousId;
|
|
346
382
|
});
|
|
347
383
|
const getCommonProperties = () => ({
|
|
348
|
-
"cli-version": "0.11.
|
|
384
|
+
"cli-version": "0.11.7-pr.96.327.1",
|
|
349
385
|
"node-version": process.version,
|
|
350
386
|
platform: process.platform,
|
|
351
387
|
arch: process.arch
|
|
@@ -387,6 +423,7 @@ const expectedRejectionReasons = new Set([
|
|
|
387
423
|
"invalid_project_name",
|
|
388
424
|
"target_path_not_directory",
|
|
389
425
|
"target_directory_not_empty",
|
|
426
|
+
"target_has_migrations",
|
|
390
427
|
"unsupported_configuration",
|
|
391
428
|
"not_authenticated",
|
|
392
429
|
"workspace_missing",
|
|
@@ -413,6 +450,7 @@ function getBaseCreateProperties(input, context) {
|
|
|
413
450
|
"database-provider": context?.prismaSetupContext.databaseProvider ?? input.provider ?? null,
|
|
414
451
|
"authoring-style": context?.prismaSetupContext.authoring ?? input.authoring ?? null,
|
|
415
452
|
"package-manager": context?.prismaSetupContext.packageManager ?? input.packageManager ?? null,
|
|
453
|
+
"agent-skills": context ? [...context.prismaSetupContext.skillAgents] : input.skills ?? null,
|
|
416
454
|
"should-deploy": context?.prismaSetupContext.shouldDeploy ?? input.deploy ?? null,
|
|
417
455
|
"target-directory-state": context ? getTargetDirectoryState(context) : null
|
|
418
456
|
};
|
|
@@ -728,6 +766,7 @@ function createTemplateContext(options) {
|
|
|
728
766
|
provider: options.provider,
|
|
729
767
|
authoring: options.authoring,
|
|
730
768
|
packageManager: options.packageManager,
|
|
769
|
+
skillAgents: options.skillAgents ?? agentSkillTargets,
|
|
731
770
|
tsdownEntry: tsdownEntries[options.template] ?? null
|
|
732
771
|
};
|
|
733
772
|
}
|
|
@@ -841,7 +880,7 @@ const runSetupCommand = Effect.fn("runSetupCommand")(function* (options) {
|
|
|
841
880
|
|
|
842
881
|
//#endregion
|
|
843
882
|
//#region src/tasks/install.ts
|
|
844
|
-
function getPrismaScriptMap(packageManager) {
|
|
883
|
+
function getPrismaScriptMap(packageManager, skillsSync) {
|
|
845
884
|
if (packageManager === "deno") {
|
|
846
885
|
const prismaCommand = (needsDatabase, ...args) => [
|
|
847
886
|
"deno run -A",
|
|
@@ -870,7 +909,7 @@ function getPrismaScriptMap(packageManager) {
|
|
|
870
909
|
migrate: prismaCommand("db", "migrate"),
|
|
871
910
|
"migration:status": prismaCommand("migration", "status"),
|
|
872
911
|
"migration:show": prismaCommand("migration", "show"),
|
|
873
|
-
"skills:sync": `${prismaCommand("skills", "sync")} || exit 0`
|
|
912
|
+
...skillsSync ? { "skills:sync": `${prismaCommand("skills", "sync")} || exit 0` } : {}
|
|
874
913
|
};
|
|
875
914
|
}
|
|
876
915
|
function getComposerScriptMap(packageManager) {
|
|
@@ -931,7 +970,7 @@ const addPackageDependencyEffect = Effect.fn("Dependencies.add")(function* (opts
|
|
|
931
970
|
packageJson.scripts = sortRecord(packageJson.scripts);
|
|
932
971
|
yield* writePackageJson(packageJsonPath, packageJson);
|
|
933
972
|
});
|
|
934
|
-
const writePrismaDependenciesEffect = Effect.fn("Dependencies.writePrisma")(function* (provider, packageManager, _authoring, projectDir = process.cwd()) {
|
|
973
|
+
const writePrismaDependenciesEffect = Effect.fn("Dependencies.writePrisma")(function* (provider, packageManager, _authoring, projectDir = process.cwd(), options = {}) {
|
|
935
974
|
const dependencies = [getDbPackages(provider)];
|
|
936
975
|
if (provider === "postgres" && packageManager !== "deno") dependencies.push("temporal-polyfill");
|
|
937
976
|
if (provider === "mongo") dependencies.push("arktype", "mongodb");
|
|
@@ -939,7 +978,7 @@ const writePrismaDependenciesEffect = Effect.fn("Dependencies.writePrisma")(func
|
|
|
939
978
|
yield* addPackageDependencyEffect({
|
|
940
979
|
dependencies,
|
|
941
980
|
devDependencies: ["@types/node", "prisma"],
|
|
942
|
-
scripts: getPrismaScriptMap(packageManager),
|
|
981
|
+
scripts: getPrismaScriptMap(packageManager, options.skillsSync ?? true),
|
|
943
982
|
projectDir
|
|
944
983
|
});
|
|
945
984
|
});
|
|
@@ -1480,8 +1519,12 @@ const runPrismaInit = Effect.fn("PrismaSetup.init")(function* (context, projectD
|
|
|
1480
1519
|
if (context.packageManager === "deno") yield* (yield* FileSystem.FileSystem).remove(path.join(projectDir, "prisma-next.md"), { force: true });
|
|
1481
1520
|
});
|
|
1482
1521
|
const initializeAgentSkills = Effect.fn("PrismaSetup.initializeSkills")(function* (context, projectDir) {
|
|
1483
|
-
if (context.
|
|
1484
|
-
yield* runPrismaCli(context, projectDir, [
|
|
1522
|
+
if (context.skillAgents.length === 0) return;
|
|
1523
|
+
yield* runPrismaCli(context, projectDir, [
|
|
1524
|
+
"init",
|
|
1525
|
+
"--yes",
|
|
1526
|
+
`--skills=${context.skillAgents.join(",")}`
|
|
1527
|
+
]);
|
|
1485
1528
|
});
|
|
1486
1529
|
|
|
1487
1530
|
//#endregion
|
|
@@ -1578,6 +1621,29 @@ const promptForPackageManager = Effect.fn("Prompts.packageManager")(function* (d
|
|
|
1578
1621
|
}
|
|
1579
1622
|
return yield* decodePromptValue(PackageManagerSchema, value);
|
|
1580
1623
|
});
|
|
1624
|
+
const promptForAgentSkills = Effect.fn("Prompts.agentSkills")(function* (output) {
|
|
1625
|
+
const value = yield* Effect.tryPromise(() => confirm({
|
|
1626
|
+
message: "Install agent skills for coding assistants (Claude Code, Cursor, Codex, Devin)?",
|
|
1627
|
+
initialValue: true,
|
|
1628
|
+
output
|
|
1629
|
+
}));
|
|
1630
|
+
if (isCancel(value)) {
|
|
1631
|
+
yield* Effect.sync(() => cancel("Operation cancelled.", { output }));
|
|
1632
|
+
return yield* new CreateCancellationError({ stage: "agent_skills" });
|
|
1633
|
+
}
|
|
1634
|
+
return value ? agentSkillTargets : [];
|
|
1635
|
+
});
|
|
1636
|
+
const resolveRequestedAgentSkills = Effect.fn("PrismaSetup.resolveSkills")(function* (value, output) {
|
|
1637
|
+
const selection = parseAgentSkillSelection(value);
|
|
1638
|
+
if (selection.ok) return selection.agents;
|
|
1639
|
+
yield* Effect.sync(() => cancel(selection.message, { output }));
|
|
1640
|
+
return yield* new CreateFailure({
|
|
1641
|
+
stage: "collect_context",
|
|
1642
|
+
reason: "invalid_input",
|
|
1643
|
+
message: selection.message,
|
|
1644
|
+
errorReported: true
|
|
1645
|
+
});
|
|
1646
|
+
});
|
|
1581
1647
|
const promptForDeployment = Effect.fn("Prompts.deployment")(function* (output) {
|
|
1582
1648
|
const value = yield* Effect.tryPromise(() => confirm({
|
|
1583
1649
|
message: "Deploy to Prisma now?",
|
|
@@ -1593,6 +1659,7 @@ const promptForDeployment = Effect.fn("Prompts.deployment")(function* (output) {
|
|
|
1593
1659
|
const collectPrismaSetupContextEffect = Effect.fn("PrismaSetup.collectContext")(function* (input, options = {}) {
|
|
1594
1660
|
const projectDir = path.resolve(options.projectDir ?? process.cwd());
|
|
1595
1661
|
const { json, output, useDefaults } = resolveExecutionSettings(input);
|
|
1662
|
+
const requestedSkillAgents = input.skills === void 0 ? void 0 : yield* resolveRequestedAgentSkills(input.skills, output);
|
|
1596
1663
|
const databaseProvider = input.provider ?? (useDefaults ? DEFAULT_DATABASE_PROVIDER : yield* promptForDatabaseProvider(output));
|
|
1597
1664
|
const authoring = input.authoring ?? (useDefaults ? DEFAULT_AUTHORING : yield* promptForAuthoringStyle(output));
|
|
1598
1665
|
const detectedPackageManager = yield* detectPackageManagerEffect(projectDir);
|
|
@@ -1612,6 +1679,7 @@ const collectPrismaSetupContextEffect = Effect.fn("PrismaSetup.collectContext")(
|
|
|
1612
1679
|
reason: "unsupported_configuration",
|
|
1613
1680
|
message: "Prisma Compute does not support Deno deployments yet. Use --no-deploy."
|
|
1614
1681
|
});
|
|
1682
|
+
const skillAgents = packageManager === "deno" ? [] : requestedSkillAgents ?? (useDefaults ? agentSkillTargets : yield* promptForAgentSkills(output));
|
|
1615
1683
|
const shouldDeploy = packageManager === "deno" ? false : input.deploy ?? (json ? true : useDefaults ? false : yield* promptForDeployment(output));
|
|
1616
1684
|
return {
|
|
1617
1685
|
projectDir,
|
|
@@ -1621,6 +1689,7 @@ const collectPrismaSetupContextEffect = Effect.fn("PrismaSetup.collectContext")(
|
|
|
1621
1689
|
databaseProvider,
|
|
1622
1690
|
authoring,
|
|
1623
1691
|
packageManager,
|
|
1692
|
+
skillAgents,
|
|
1624
1693
|
shouldDeploy,
|
|
1625
1694
|
shouldPromptForWorkspace: !useDefaults,
|
|
1626
1695
|
...input.workspace ? { workspace: input.workspace } : {}
|
|
@@ -1706,9 +1775,10 @@ const executePrismaSetupContextEffect = Effect.fn("PrismaSetup.execute")(functio
|
|
|
1706
1775
|
template,
|
|
1707
1776
|
provider: context.databaseProvider,
|
|
1708
1777
|
authoring: context.authoring,
|
|
1709
|
-
packageManager: context.packageManager
|
|
1778
|
+
packageManager: context.packageManager,
|
|
1779
|
+
skillAgents: context.skillAgents
|
|
1710
1780
|
}), "configure_project", "project_configuration_failed");
|
|
1711
|
-
yield* atCreateStage(writePrismaDependenciesEffect(context.databaseProvider, context.packageManager, context.authoring, projectDir), "configure_project", "project_configuration_failed");
|
|
1781
|
+
yield* atCreateStage(writePrismaDependenciesEffect(context.databaseProvider, context.packageManager, context.authoring, projectDir, { skillsSync: context.skillAgents.length > 0 }), "configure_project", "project_configuration_failed");
|
|
1712
1782
|
yield* Effect.sync(() => progress?.message(`Installing dependencies with ${getInstallCommand(context.packageManager)}...`));
|
|
1713
1783
|
yield* atCreateStage(installProjectDependenciesEffect(context.packageManager, projectDir, {
|
|
1714
1784
|
verbose: context.verbose,
|
|
@@ -1723,7 +1793,8 @@ const executePrismaSetupContextEffect = Effect.fn("PrismaSetup.execute")(functio
|
|
|
1723
1793
|
template,
|
|
1724
1794
|
provider: context.databaseProvider,
|
|
1725
1795
|
authoring: context.authoring,
|
|
1726
|
-
packageManager: context.packageManager
|
|
1796
|
+
packageManager: context.packageManager,
|
|
1797
|
+
skillAgents: context.skillAgents
|
|
1727
1798
|
});
|
|
1728
1799
|
yield* ensureComposerTypeScriptOptions(projectDir);
|
|
1729
1800
|
if (context.databaseProvider === "mongo") yield* ensureMongoEnvironment(projectDir);
|
|
@@ -1732,8 +1803,10 @@ const executePrismaSetupContextEffect = Effect.fn("PrismaSetup.execute")(functio
|
|
|
1732
1803
|
yield* ensureGitignoreEntry(projectDir, "/.prisma-composer");
|
|
1733
1804
|
}
|
|
1734
1805
|
}), "configure_project", "project_configuration_failed");
|
|
1735
|
-
|
|
1736
|
-
|
|
1806
|
+
if (context.skillAgents.length > 0) {
|
|
1807
|
+
yield* Effect.sync(() => progress?.message("Installing Prisma agent skills..."));
|
|
1808
|
+
yield* atCreateStage(initializeAgentSkills(context, projectDir), "initialize_agent_skills", "agent_skills_init_failed");
|
|
1809
|
+
}
|
|
1737
1810
|
yield* Effect.sync(() => progress?.message("Generating Prisma 8 contract artifacts..."));
|
|
1738
1811
|
yield* atCreateStage(runPrismaCli(context, projectDir, ["contract", "emit"]), "emit_contract", "contract_emit_failed");
|
|
1739
1812
|
if (context.databaseProvider === "postgres") {
|
|
@@ -1984,6 +2057,19 @@ const collectCreateContext = Effect.fn("Create.collectContext")(function* (input
|
|
|
1984
2057
|
errorReported: true
|
|
1985
2058
|
});
|
|
1986
2059
|
}
|
|
2060
|
+
if (force && targetPathState.exists) {
|
|
2061
|
+
const migrations = yield* inspectTargetPath(path.join(targetDirectory, "migrations"));
|
|
2062
|
+
if (migrations.exists && !migrations.isEmptyDirectory) {
|
|
2063
|
+
const message = `Target directory ${formatPathForDisplay(targetDirectory)} contains migration history. Create a starter in a new directory, or continue working in the existing project with the Prisma CLI. --force cannot overwrite a project with existing migrations.`;
|
|
2064
|
+
yield* Effect.sync(() => cancel(message, { output }));
|
|
2065
|
+
return yield* new CreateFailure({
|
|
2066
|
+
stage: "collect_context",
|
|
2067
|
+
reason: "target_has_migrations",
|
|
2068
|
+
message,
|
|
2069
|
+
errorReported: true
|
|
2070
|
+
});
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
1987
2073
|
const prismaSetupContext = yield* collectPrismaSetupContextEffect(input, {
|
|
1988
2074
|
projectDir: targetDirectory,
|
|
1989
2075
|
template
|
|
@@ -2013,7 +2099,8 @@ const executeCreateContext = Effect.fn("Create.execute")(function* (context) {
|
|
|
2013
2099
|
template: context.template,
|
|
2014
2100
|
provider: context.prismaSetupContext.databaseProvider,
|
|
2015
2101
|
authoring: context.prismaSetupContext.authoring,
|
|
2016
|
-
packageManager: context.prismaSetupContext.packageManager
|
|
2102
|
+
packageManager: context.prismaSetupContext.packageManager,
|
|
2103
|
+
skillAgents: context.prismaSetupContext.skillAgents
|
|
2017
2104
|
}).pipe(Effect.andThen(writeCreateTemplateDependenciesEffect({
|
|
2018
2105
|
template: context.template,
|
|
2019
2106
|
packageManager: context.prismaSetupContext.packageManager,
|
|
@@ -2141,4 +2228,4 @@ function isJsonOutputRequested(argv) {
|
|
|
2141
2228
|
const writeJsonResult = Effect.fn("JsonOutput.write")((result) => Effect.sync(() => process.stdout.write(`${JSON.stringify(result)}\n`)));
|
|
2142
2229
|
|
|
2143
2230
|
//#endregion
|
|
2144
|
-
export {
|
|
2231
|
+
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
|
@@ -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": {
|