prisma 8.0.0-rc.13-dev.93 → 8.0.0-rc.13-dev.95

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/prisma.js CHANGED
@@ -27,6 +27,7 @@ import { fileURLToPath } from "node:url";
27
27
  import { execa } from "execa";
28
28
  import { Writable } from "node:stream";
29
29
  import { pipeline } from "node:stream/promises";
30
+ import spawn$1 from "cross-spawn";
30
31
  //#region \0rolldown/runtime.js
31
32
  var __create = Object.create;
32
33
  var __defProp = Object.defineProperty;
@@ -1823,7 +1824,8 @@ const SKILL_SOURCE_PACKAGES = [
1823
1824
  "@prisma/orm-postgres",
1824
1825
  "@prisma/orm-sqlite",
1825
1826
  "@prisma/orm-mongo",
1826
- "@prisma/composer"
1827
+ "@prisma/composer",
1828
+ "prisma"
1827
1829
  ];
1828
1830
  /** The directory inside a source package's tarball that holds its skill
1829
1831
  * trees, one directory per skill. */
@@ -14243,7 +14245,7 @@ const runPackageManager = async ({ file, args, cwd, signal, onOutput }) => {
14243
14245
  * must not wait on it, so the pipes are destroyed after this grace. */
14244
14246
  const POST_EXIT_DRAIN_GRACE_MS = 5e3;
14245
14247
  /**
14246
- * The engine's spawn seam, adapted to node:child_process. Human mode
14248
+ * The engine's spawn seam, adapted through cross-spawn. Human mode
14247
14249
  * inherits stdio; structured mode pipes both child output streams to
14248
14250
  * diagnostics. Neither mode detaches or opens a new console, so the child
14249
14251
  * stays in this process's group (POSIX) or console (Windows).
@@ -14257,7 +14259,7 @@ function makeSpawnChild(diagnostics, options) {
14257
14259
  const drainGraceMs = options?.drainGraceMs ?? POST_EXIT_DRAIN_GRACE_MS;
14258
14260
  return (request) => {
14259
14261
  const structured = request.output === "diagnostic";
14260
- const child = spawn(request.command, [...request.args], {
14262
+ const child = spawn$1(request.command, [...request.args], {
14261
14263
  cwd: request.cwd,
14262
14264
  env: request.env,
14263
14265
  stdio: structured ? [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prisma",
3
- "version": "8.0.0-rc.13-dev.93",
3
+ "version": "8.0.0-rc.13-dev.95",
4
4
  "description": "The Prisma CLI: one binary for the ORM, Composer, and the Prisma Developer Platform.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -15,6 +15,7 @@
15
15
  },
16
16
  "files": [
17
17
  "dist",
18
+ "skills",
18
19
  "README.md",
19
20
  "LICENSE"
20
21
  ],
@@ -47,18 +48,19 @@
47
48
  "@prisma/composer-cli": "0.17.0-dev.2",
48
49
  "@prisma/compute-sdk": "0.42.0",
49
50
  "@prisma/management-api-sdk": "1.69.0",
50
- "@prisma/orm-toolchain": "8.0.0-rc.8-dev.18",
51
+ "@prisma/orm-toolchain": "8.0.0-rc.9-dev.1",
51
52
  "@vercel/detect-agent": "^1.2.3",
52
53
  "better-result": "^2.9.2",
54
+ "cross-spawn": "^7.0.6",
53
55
  "dotenv": "^17.4.2",
54
56
  "execa": "^9.6.1",
55
57
  "open": "^11.0.0"
56
58
  },
57
59
  "devDependencies": {
58
- "@prisma/cli": "8.0.0-rc.13-dev.93",
60
+ "@prisma/cli": "8.0.0-rc.13-dev.95",
59
61
  "@prisma/credentials-store": "^7.8.0",
60
- "@repo/cli-telemetry": "8.0.0-rc.13-dev.93",
61
- "@repo/tsconfig": "8.0.0-rc.13-dev.93",
62
+ "@repo/cli-telemetry": "8.0.0-rc.13-dev.95",
63
+ "@repo/tsconfig": "8.0.0-rc.13-dev.95",
62
64
  "@types/node": "^22.19.19",
63
65
  "tsdown": "^0.21.10",
64
66
  "typescript": "^6.0.3",
@@ -0,0 +1,355 @@
1
+ ---
2
+ name: prisma-platform-core-concepts
3
+ metadata:
4
+ library: "prisma"
5
+ library_version: "8.0.0-rc.13-dev.95"
6
+ version: 2026.9.1
7
+ description: >-
8
+ Use when hosting, deploying, or operating an app on the Prisma Platform:
9
+ projects, branches, preview environments, services and their versions,
10
+ Prisma Postgres databases, object-store buckets, environment variables,
11
+ custom domains, logs, or the GitHub integration. Triggers on "Prisma
12
+ Platform", "Prisma Compute", "Prisma Postgres", "Prisma Storage",
13
+ "preview environment", `prisma deploy`, `prisma dev`, `prisma auth`,
14
+ `prisma project`, `prisma branch`, `prisma service`, `prisma postgres`,
15
+ `prisma bucket`, `prisma git`, `prisma.config.ts`, promote, rollback.
16
+ ---
17
+
18
+ # Prisma Platform core concepts
19
+
20
+ > **Isolated infrastructure for every branch.**
21
+
22
+ The Prisma Platform moves fast, and your training data about it is very
23
+ likely outdated. This skill ships inside the installed `prisma` package, so
24
+ it describes the exact version this project has: treat it as the source of
25
+ truth over anything you remember about Prisma hosting. If
26
+ `metadata.library_version` in this file's frontmatter does not match the
27
+ project's installed `prisma` package, run `prisma skills sync` and re-read.
28
+ Fuller documentation for everything here lives at prisma.io/docs; consult it
29
+ when a concept needs more depth than this file carries.
30
+
31
+ This file shares the platform's structures, hierarchies, relationships, and
32
+ workflows. It is not a CLI reference: commands appear only where a workflow
33
+ needs them. To learn a command surface, run `prisma --help`, or
34
+ `prisma <group> --help` for any group named below; most commands accept
35
+ `--json` for machine-readable output. The data contract, migrations, and
36
+ queries belong to the `prisma-orm-core-concepts` skill; declaring services
37
+ and modules in code belongs to `prisma-composer-core-concepts`.
38
+
39
+ ## The stack
40
+
41
+ One CLI, `prisma`, fronts a set of products designed to be used together:
42
+
43
+ | Product | What it is | Concepts live in |
44
+ | --- | --- | --- |
45
+ | Prisma ORM (Prisma 8) | Data contract, typed queries, migrations | `prisma-orm-core-concepts` |
46
+ | Prisma Composer | The app declaration: services, databases, buckets, wiring | `prisma-composer-core-concepts` |
47
+ | Prisma Compute | Hosting: runs your services next to your data | this skill |
48
+ | Prisma Postgres | Managed PostgreSQL | this skill |
49
+ | Prisma Storage | S3-compatible object storage | this skill |
50
+
51
+ **Every deployed app is a Composer app.** Your server code plus a declaration
52
+ (`module.ts`) naming its services, databases, and buckets. The declaration is
53
+ the source of truth: deploying converges the platform to it, re-deploying
54
+ applies only the difference, and removing a resource from the module removes
55
+ it from the platform on the next deploy. There is no separate provisioning
56
+ step and no connection strings to wire by hand; Composer injects them.
57
+
58
+ ## Project setup
59
+
60
+ The CLI carries every command named here, but an app's own code needs its
61
+ dependencies installed. Start from:
62
+
63
+ ```sh
64
+ npm install prisma @prisma/composer @prisma/composer-prisma-cloud
65
+ ```
66
+
67
+ `@prisma/composer` is what the module declaration imports;
68
+ `@prisma/composer-prisma-cloud` is the Prisma Cloud target and brings
69
+ `@prisma/orm-postgres` with it. The sibling skills travel inside these
70
+ packages (`prisma-composer-core-concepts` in `@prisma/composer`,
71
+ `prisma-orm-core-concepts` in `@prisma/orm-postgres`), so they appear after
72
+ this install plus `prisma skills sync`, not before.
73
+
74
+ Two config files with different owners:
75
+
76
+ 1. `prisma.config.ts` configures the CLI. Each top-level key is a section
77
+ owned by one product, and this CLI recognises exactly three: `orm`,
78
+ `composer`, and `skills`. The composed shape:
79
+
80
+ ```ts
81
+ import { definePrismaConfig } from "prisma/config";
82
+ import { defineConfig } from "@prisma/orm-postgres/config";
83
+
84
+ export default definePrismaConfig({
85
+ orm: defineConfig({ contract: "./src/prisma/contract.prisma" }),
86
+ skills: { agents: ["claude"] },
87
+ });
88
+ ```
89
+
90
+ 2. `prisma-composer.config.ts` configures Composer itself and is a separate,
91
+ mandatory file for `dev` and `deploy`: without it `dev` fails with
92
+ `CONFIG.FILE_MISSING`. Its contents belong to
93
+ `prisma-composer-core-concepts`.
94
+
95
+ ## The resource model
96
+
97
+ 1. **Workspace**: the account boundary. Members, billing, and projects live
98
+ here; the `auth` group manages which one you act in.
99
+ 2. **Project**: one product or codebase. Its region is chosen at creation and
100
+ is immutable afterwards; every resource in the project inherits it.
101
+ 3. **Branch**: the isolation boundary, named after a git branch. A branch is
102
+ an environment: it owns its own services, its own databases, its own
103
+ buckets, and its own environment-variable overrides.
104
+ 4. Inside a branch: **services** (HTTP apps, deployed as versions),
105
+ **databases**, and **buckets**.
106
+
107
+ The first branch of a project is the **production** branch. Every branch
108
+ after it is a **preview** branch. Production and previews differ in exactly
109
+ two ways: which environment-variable class they resolve (see below), and
110
+ lifecycle (previews can be reclaimed and torn down; production cannot).
111
+
112
+ A CLI invocation resolves its project from a directory binding, created when
113
+ a project is created from or linked to the directory and stored in the
114
+ gitignored `.prisma/local.json`. Resource commands take flags to target
115
+ another project or branch explicitly.
116
+
117
+ ## Branches are preview environments
118
+
119
+ There is no separate "preview environment" object to create or configure. The
120
+ branch is the environment, and branches come into being by deploying to them:
121
+
122
+ 1. **Push a git branch** (with the GitHub integration connected): the
123
+ platform creates the branch environment on the fly, builds, and deploys.
124
+ 2. **Deploy a stage from the CLI**: `prisma deploy module.ts --stage pr-42`
125
+ creates a branch named `pr-42` and deploys the identical app graph into
126
+ it. A stage name must be a valid git ref name; an invalid name is a hard
127
+ error.
128
+
129
+ A preview branch that needs a database gets a fresh, empty one, wired in as a
130
+ branch-scoped `DATABASE_URL`. Preview work can never touch production data
131
+ unless you explicitly point it there. Schema comes from your committed
132
+ migrations; data does not follow from production.
133
+
134
+ Preview lifecycle rules:
135
+
136
+ 1. Deleting the upstream git branch tears the whole environment down:
137
+ services, versions, and databases, including their data.
138
+ 2. An idle, unpinned preview branch can be reclaimed automatically. Pinning a
139
+ preview exempts it from idle reclamation, but not from teardown when its
140
+ git branch is deleted.
141
+ 3. The production branch is never reclaimed or torn down this way.
142
+
143
+ ## Two ways to deploy
144
+
145
+ **GitHub (recommended).** Install the Prisma GitHub app and connect the
146
+ repository: `prisma git connect`, or import the repository in the Console.
147
+ From then on, every push builds and deploys on the platform. A push to the
148
+ default branch deploys production; a push to any other branch creates or
149
+ updates that branch's preview environment. No workflow file is required, and
150
+ previews come free with every branch. Opening a pull request does not itself
151
+ deploy anything; previews track branch pushes.
152
+
153
+ **CLI.** `prisma deploy module.ts` deploys production directly; add
154
+ `--stage <name>` for a preview. Authenticate once with `prisma auth login`
155
+ (interactive), or set `PRISMA_SERVICE_TOKEN` (plus `PRISMA_WORKSPACE_ID`
156
+ when the token can see more than one workspace) for CI and other headless
157
+ runs. The first deploy creates the project, named after your module; the
158
+ name must be unique in the workspace, and `--name` deploys under a different
159
+ one.
160
+
161
+ Both paths converge the same declaration, so they are mutually idempotent:
162
+ a repo can be connected to GitHub and still be deployed from the CLI.
163
+
164
+ ## Services and versions
165
+
166
+ A **service** is an HTTP app inside a branch, reachable at a stable URL.
167
+ Every deploy of a service creates a new immutable **version**; exactly one
168
+ version is live behind the stable URL at a time. Versions can be inspected,
169
+ started, stopped, and deleted individually, and a version's logs can be read
170
+ or followed; the `service` group covers all of it.
171
+
172
+ Two movements between versions matter:
173
+
174
+ 1. **Promote** takes a version to production by rebuilding it with
175
+ production-class environment variables. A version built on a preview
176
+ branch never carries preview configuration into production.
177
+ 2. **Rollback** points production back at a previous version. A stopped
178
+ target is started and health-checked before traffic switches, so rollback
179
+ is zero-downtime.
180
+
181
+ **Custom domains** attach to a service's production branch only. The
182
+ workflow: add the domain, create the CNAME record the platform reports, and
183
+ wait for DNS verification and certificate provisioning; a verification that
184
+ failed on missing DNS is retried after the record exists.
185
+
186
+ ## The Compute runtime
187
+
188
+ Services run on Bun, next to their Prisma Postgres database. There is no
189
+ container image to author and no platform emulator to install locally.
190
+
191
+ The runtime has no global `Temporal` (stock Node 24 lacks one too). Code
192
+ that reads an ORM `DateTime` column compiles and deploys, then throws on
193
+ the first read. Either add the `temporal-polyfill` dependency and
194
+ `import 'temporal-polyfill/full/global'` at the service entry, or use the
195
+ `*String` column types such as `TimestamptzString`.
196
+
197
+ An idle service **sleeps**: the platform snapshots its memory after a short
198
+ period of inactivity and resumes it from the snapshot on the next request.
199
+ Request handling is unaffected, but background work outside the request
200
+ lifecycle (`setTimeout`, `setInterval`, floating promises) can be
201
+ interrupted mid-flight. The `@prisma/compute` package provides the two
202
+ keep-awake primitives:
203
+
204
+ 1. `waitUntil(promise, { signal })` keeps the instance awake until the
205
+ promise settles.
206
+ 2. `using guard = new KeepAwakeGuard({ signal })` holds the instance awake
207
+ for a scope; call `.release()` in a `finally` block where `using` is
208
+ unavailable.
209
+
210
+ Pass `AbortSignal.timeout(ms)` as a cost bound: the signal releases the
211
+ guard, it does not cancel your work. Do not build schedulers on `setInterval`
212
+ inside a service; sleeping makes them silently unreliable.
213
+
214
+ ## Prisma Postgres
215
+
216
+ To your application, a Prisma Postgres database is a regular PostgreSQL
217
+ database behind a connection string: any client works, including Prisma ORM,
218
+ psql, Kysely, and Drizzle. On top of plain PostgreSQL each database has
219
+ built-in connection pooling (no PgBouncer to run), optional query caching,
220
+ and automated backups.
221
+
222
+ Databases usually come from deploying a module that declares one. They can
223
+ also be created directly, in which case the connection URL prints exactly
224
+ once. Additional connection strings can be minted and rotated per database;
225
+ every secret is shown exactly once at creation, and no later read reveals
226
+ it. Backups are automated, listable, and restorable, and per-database usage
227
+ metrics are queryable; the `postgres` group covers all of it.
228
+
229
+ ## Object storage
230
+
231
+ Buckets are S3-compatible object stores that live inside the project,
232
+ optionally associated with a branch (the project's default branch when
233
+ omitted). A bucket cannot be renamed.
234
+
235
+ Access keys are bucket-scoped credentials with a role of `read` or
236
+ `read_write`. Creating one prints the access key id, secret, endpoint, and
237
+ provider bucket name exactly once; a lost secret is revoked and re-created,
238
+ never recovered. The `bucket` group manages both buckets and their keys.
239
+
240
+ On Compute, Bun's built-in S3 client picks up `S3_ENDPOINT`, `S3_BUCKET`,
241
+ `S3_ACCESS_KEY_ID`, and `S3_SECRET_ACCESS_KEY` from the environment, so a
242
+ bucket declared in the module needs no client configuration. Locally, a
243
+ Composer-declared bucket gets a local stand-in with the same S3 surface;
244
+ code written against it runs unchanged on the platform.
245
+
246
+ ## Environment variables
247
+
248
+ Configuration has two independent axes:
249
+
250
+ | Axis | Values | Meaning |
251
+ | --- | --- | --- |
252
+ | Class | `production`, `preview` | Which branches resolve it: production-class values reach the production branch, preview-class values reach every preview |
253
+ | Scope | project template, branch override | A template applies to all branches of its class; an override pins a value to one named preview branch |
254
+
255
+ Rules that bite:
256
+
257
+ 1. Branch overrides exist only for the preview class. Production
258
+ configuration is always the project template; there is no way to give one
259
+ production deploy a special value.
260
+ 2. Values are write-only. Listing shows names and scopes, never values, and
261
+ no API returns them. To change a value you replace it.
262
+ 3. Variables resolve at deploy time from the branch's class. You never pass
263
+ environment variables as part of a deploy.
264
+ 4. Templates, per-branch overrides, and wholesale dotenv import are all
265
+ managed through the `project env` group.
266
+ 5. `DATABASE_URL` is managed for you when the module declares a database:
267
+ previews get their own fresh database's URL, production gets the
268
+ production database's. Only set it yourself for databases the platform
269
+ does not manage.
270
+
271
+ ## Local development
272
+
273
+ The local stack is real, fast, and needs no cloud credentials. Prefer it
274
+ over deploying whenever you want to show the user a change or verify your
275
+ own work:
276
+
277
+ 1. Build the app exactly as you would for deploy, then run
278
+ `prisma dev module.ts`. It provisions a local Prisma Postgres database,
279
+ applies the schema, creates local stand-ins for declared buckets, starts
280
+ the services, and prints a local URL. It watches built output and
281
+ restarts a service when its build changes.
282
+ 2. Exercise the running app directly (for example with `curl` against the
283
+ printed URL) instead of reasoning about what the code would do.
284
+ 3. Stopping `dev` leaves local databases, buckets, and their data in place;
285
+ the next run is a warm start. `--fresh` wipes this app's local instances
286
+ and data first.
287
+ 4. Deploying is the same pipeline pointed at the platform: switching from
288
+ local to hosted is a configuration change, not a code change. Reach for
289
+ `prisma deploy --stage <name>` only when you need a shareable URL or
290
+ platform behaviour (sleeping, real DNS, production-like config).
291
+ 5. For pure frontend iteration the framework's own dev server also works;
292
+ the Composer local stack is what mirrors the deployed wiring.
293
+
294
+ Windows is not supported for the local stack yet.
295
+
296
+ ## Failure modes quick reference
297
+
298
+ 1. **A secret you need was shown once and is gone.** By design: database
299
+ URLs, connection strings, and bucket keys print exactly once at creation.
300
+ Rotate or re-create; do not hunt for a read path, none exists.
301
+ 2. **Deploy refuses the module name.** Module names are workspace-unique.
302
+ Deploy under `--name <other>`, or delete the conflicting project.
303
+ 3. **A preview environment vanished.** Its git branch was deleted, or it
304
+ sat idle unpinned and was reclaimed. Push or deploy the branch again to
305
+ re-create it; the database starts empty again.
306
+ 4. **Background work never ran in production.** The service slept.
307
+ Wrap the work in `waitUntil` or a `KeepAwakeGuard`, or move it out of the
308
+ service.
309
+ 5. **A custom domain stays unverified.** The CNAME to the reported target
310
+ must exist first. Fix DNS, then retry the verification.
311
+ 6. **Production shows a stale value after an environment-variable change.**
312
+ Variables are resolved at deploy time. Re-deploy (or promote) so the new
313
+ value is picked up.
314
+ 7. **A stage name is rejected.** Stage names must be valid git ref names;
315
+ rename it.
316
+ 8. **A resource disappeared from the platform after a deploy.** It was
317
+ removed from `module.ts`; the module is the source of truth and deploy
318
+ converges to it. Restore the declaration and re-deploy.
319
+ 9. **`dev` or `deploy` rejects the app graph (`COMPOSE.GRAPH_INVALID`) over
320
+ a name.** Resource ids declared in the module (`provision()` ids,
321
+ `compute({ name })`) allow `[A-Za-z0-9]` only. A hyphenated id passes
322
+ authoring and typecheck, then fails here. Module and project names do
323
+ accept hyphens, so never derive a resource id from them.
324
+ 10. **A deployed service errors on its first timestamp read
325
+ (`RUNTIME.TEMPORAL_UNAVAILABLE`).** The runtime has no global
326
+ `Temporal`; see the Compute runtime section for the polyfill.
327
+
328
+ ## What the platform doesn't do yet
329
+
330
+ Name the gap instead of inventing an API:
331
+
332
+ 1. **No branch create or delete from the CLI.** The `branch` group only
333
+ lists. Branches are created by pushing or by deploying a stage, and
334
+ removed by deleting the upstream git branch; there is no CLI teardown
335
+ verb for a stage yet.
336
+ 2. **No build retry.** A failed build is finished; the retry is the next
337
+ push or the next deploy.
338
+ 3. **No reading environment-variable values back**, anywhere. This is a
339
+ security stance, not a missing feature, but agents look for it often
340
+ enough to name here.
341
+ 4. **No bucket rename** and no bucket-to-branch re-association after
342
+ creation; re-create instead.
343
+
344
+ For anything else missing, run the nearest group with `--help` before
345
+ concluding it does not exist, and route requests with `prisma feedback`
346
+ rather than guessing.
347
+
348
+ ## Related skills
349
+
350
+ Everything inside the app is owned by the siblings: the data contract,
351
+ queries, and migrations by `prisma-orm-core-concepts` (and
352
+ `prisma-orm-migrations`), and the declaration of services, modules, wiring,
353
+ and testing seams by `prisma-composer-core-concepts`. The skills install
354
+ together via `prisma skills sync`; when a task crosses from platform
355
+ resources into app code, switch skills instead of guessing.