Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions docs/oss/release-automation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The unified CLI is assembled from three repositories. This page explains how a n
| --- | --- | --- |
| `prisma/prisma-cli` (this one) | `@prisma/cli-engine`, `@prisma/cli`, `prisma` | — |
| `prisma/composer` | `@prisma/composer-cli` (and the `@prisma/composer` library) | a dependency of the shell |
| `prisma/prisma` | `@prisma/orm-toolchain` (and `@prisma/orm-framework`, listed so the shell does not rely on the toolchain bringing it; the toolchain names it as a peer from the ORM release after 8.0.0-rc.25) | dependencies of the shell, always at the same version |
| `prisma/prisma` | `@prisma/orm-toolchain`, plus the ORM packages named as peers along the way, listed so they move together rather than relying on another package to bring them: `@prisma/orm-framework` (named by the toolchain), `@prisma/orm-postgres` (named by Composer's Prisma Cloud target), and `@prisma/orm-family-sql` and `@prisma/orm-target-postgres` (named by `@prisma/orm-postgres`) | dependencies of the shell, always at the same version |

One more repository depends on this CLI instead of feeding it: `prisma/cloud-deploy-action`, whose test this repository runs (see [Keeping `prisma/cloud-deploy-action` working](#keeping-prismacloud-deploy-action-working)).

Expand All @@ -17,7 +17,7 @@ A **release** of the CLI depends only on **released** versions of the products.
## What happens when a product publishes

1. The product repository's publish workflow finishes and sends a `repository_dispatch` event of type `product-published` to `prisma/prisma-cli`.
2. [`update-product-versions.yml`](../../.github/workflows/update-product-versions.yml) runs [`scripts/update-product-versions.mjs`](../../scripts/update-product-versions.mjs), which asks the registry for each watched package's version at its **release** dist-tag and rewrites `packages/cli/package.json` and `packages/prisma/package.json` where they differ. The ORM and Composer publish each release under `next` and move `latest` later, once the releases are checked together, as this repository does (see [versioning.md](versioning.md)). So the script reads both `next` and `latest` and takes the newer version; the order of the candidate tags only decides a tie. A product that does not publish `next` yet is read from `latest`. Reading `next` lets a product release reach the CLI as soon as it publishes, and keeps the script from moving pins back to an older `latest` while a release waits to be promoted. `@prisma/orm-framework` reads no tag of its own: it takes the version found for `@prisma/orm-toolchain`, because the two must agree (from the ORM release after 8.0.0-rc.25 the toolchain names it as an exact peer) and a run during the ORM's publish must not pin the two apart. Each package that reads a tag of its own (`@prisma/composer-cli`, `@prisma/composer` and `@prisma/orm-toolchain`; the rest copy one of these) carries a list of candidate tags rather than one name, most-preferred first, so a product moving where it publishes does not silently freeze the CLI on an old version — and a package that publishes none of its candidates fails the run instead of looking like "nothing to update".
2. [`update-product-versions.yml`](../../.github/workflows/update-product-versions.yml) runs [`scripts/update-product-versions.mjs`](../../scripts/update-product-versions.mjs), which asks the registry for each watched package's version at its **release** dist-tag and rewrites `packages/cli/package.json` and `packages/prisma/package.json` where they differ. The ORM and Composer publish each release under `next` and move `latest` later, once the releases are checked together, as this repository does (see [versioning.md](versioning.md)). So the script reads both `next` and `latest` and takes the newer version; the order of the candidate tags only decides a tie. A product that does not publish `next` yet is read from `latest`. Reading `next` lets a product release reach the CLI as soon as it publishes, and keeps the script from moving pins back to an older `latest` while a release waits to be promoted. `@prisma/orm-framework`, `@prisma/orm-postgres`, `@prisma/orm-family-sql` and `@prisma/orm-target-postgres` read no tag of their own: each takes the version found for `@prisma/orm-toolchain`, because they name each other as peers and a run during the ORM's publish must not pin them apart. This holds while the ORM publishes all of them together at one version. A package published apart from the toolchain, such as an Early Access package (`8.x.y-ea.N`) or a patch release of one package, would need its own entry. Each package that reads a tag of its own (`@prisma/composer-cli`, `@prisma/composer` and `@prisma/orm-toolchain`; the rest copy one of these) carries a list of candidate tags rather than one name, most-preferred first, so a product moving where it publishes does not silently freeze the CLI on an old version — and a package that publishes none of its candidates fails the run instead of looking like "nothing to update".
3. If any pin changed, or `main` holds pins the last release (its `v<version>` tag) did not ship, the workflow bumps the CLI to its next version with `pnpm bump-version` (which also refreshes `pnpm-lock.yaml`), opens a pull request titled `Release <version>: follow the products' released versions: ...`, and arms auto-merge. Every earlier open pull request from this workflow, and every open `Bump to version` release pull request, is closed first: each bumps the same version, so only one can merge.
4. The pull request runs the full quality and conformance checks. When they pass and CodeRabbit approves it (the `main` ruleset requires one approving review), it merges, and that push to `main` changes the root version, so [`publish.yml`](../../.github/workflows/publish.yml) publishes the release under `next` with the committed product versions, plus the usual `dev` build. `latest` moves when a maintainer promotes the release with [`promote.yml`](../../.github/workflows/promote.yml).

Expand Down Expand Up @@ -58,6 +58,16 @@ When the change is made in this repository itself, the pull request's CLI report

Making the action detect the arguments without relying on the version number is tracked in [prisma/cloud-deploy-action#27](https://github.com/prisma/cloud-deploy-action/issues/27).

## When a product adds, renames or removes a command

The shell mounts every product command by its path in `packages/cli/src/cli.ts`, and `check:grammar` fails when a family has a command the tree does not mount. So when a product's dev build adds a command, the CLI's dev publish fails at that check until the command is mounted. The mount cannot land on `main` before the product releases it: on the released pins the command does not exist, and the engine fails to build the command tree, so every command would fail to start.

The change therefore lands as one pull request that mounts the command and moves the pins:

1. Mount the command on a branch and check it against the product's dev build (`node scripts/update-product-versions.mjs --channel dev`, then the build, `check:grammar` and conformance with `PUBLISH_CHANNEL=dev`). Before committing, put the released pins back, restore `pnpm-lock.yaml` from `main` and run `pnpm install --lockfile-only`, so the lockfile changes only for what the branch adds. Open the pull request as a draft.
2. When every product it needs has released, run `node scripts/update-product-versions.mjs --channel release` and `pnpm bump-version` on the branch, push, and mark it ready. First check with `npm view` that the pinned Composer release names, as its peers, the ORM version the branch now pins; otherwise the install carries two copies of the ORM. Title it `Release <version>: ...`, not `Bump to version ...`: the `update-product-versions.yml` workflow closes open pull requests with that title.
3. The workflow's own `product-versions/...` pull request, opened when the product published, fails `check:grammar`. Close it once this one merges; the next run then finds nothing to change.

## The shared secret: `DEPLOY_GITHUB_TOKEN`

One fine-grained personal access token, stored under the same secret name in all three repositories.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prisma-cli",
"version": "8.0.0-rc.36",
"version": "8.0.0-rc.37",
"private": true,
"engines": {
"node": "^24.11.0 || >=26.0.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/cli-conformance/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@repo/cli-conformance",
"private": true,
"version": "8.0.0-rc.36",
"version": "8.0.0-rc.37",
"description": "Reusable conformance checks for the engine's consumers: import purity over built output, config-section validators that never throw, and verification of the tarballs a registry would receive. Depends on no package it checks.",
"type": "module",
"exports": {
Expand All @@ -24,7 +24,7 @@
"test": "pnpm run typecheck && vitest run"
},
"devDependencies": {
"@repo/tsconfig": "workspace:8.0.0-rc.36",
"@repo/tsconfig": "workspace:8.0.0-rc.37",
"@types/node": "^22.19.19",
"es-module-lexer": "^2.1.0",
"tsx": "^4.22.4",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli-engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
},
"devDependencies": {
"@prisma/management-api-sdk": "1.101.0",
"@repo/cli-conformance": "workspace:8.0.0-rc.36",
"@repo/tsconfig": "workspace:8.0.0-rc.36",
"@repo/cli-conformance": "workspace:8.0.0-rc.37",
"@repo/tsconfig": "workspace:8.0.0-rc.37",
"@types/node": "^22.19.19",
"ci-info": "^4.3.1",
"tsdown": "^0.21.10",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli-telemetry/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@repo/cli-telemetry",
"private": true,
"version": "8.0.0-rc.36",
"version": "8.0.0-rc.37",
"description": "CLI telemetry child sender: the detached subprocess the engine hands a composed payload to, its system probes, and the POST",
"type": "module",
"sideEffects": [
Expand Down Expand Up @@ -35,7 +35,7 @@
"@vercel/detect-agent": "^1.2.3"
},
"devDependencies": {
"@repo/tsconfig": "workspace:8.0.0-rc.36",
"@repo/tsconfig": "workspace:8.0.0-rc.37",
"@types/node": "^22.19.19",
"tsdown": "^0.21.10",
"typescript": "^6.0.3",
Expand Down
22 changes: 12 additions & 10 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@prisma/cli",
"version": "8.0.0-rc.36",
"version": "8.0.0-rc.37",
"description": "Command-line interface for the Prisma Developer Platform.",
"type": "module",
"bin": {
Expand Down Expand Up @@ -50,14 +50,16 @@
"dependencies": {
"@manypkg/tools": "^2.1.2",
"@prisma/cli-engine": "workspace:0.10.4",
"@prisma/composer": "0.40.0",
"@prisma/composer-cli": "0.40.0",
"@prisma/composer-prisma-cloud": "0.40.0",
"@prisma/composer": "0.41.0",
"@prisma/composer-cli": "0.41.0",
"@prisma/composer-prisma-cloud": "0.41.0",
"@prisma/compute-sdk": "0.47.0",
"@prisma/management-api-sdk": "1.101.0",
"@prisma/orm-framework": "8.0.0-rc.25",
"@prisma/orm-postgres": "8.0.0-rc.25",
"@prisma/orm-toolchain": "8.0.0-rc.25",
"@prisma/orm-family-sql": "8.0.0-rc.26",
"@prisma/orm-framework": "8.0.0-rc.26",
"@prisma/orm-postgres": "8.0.0-rc.26",
"@prisma/orm-target-postgres": "8.0.0-rc.26",
"@prisma/orm-toolchain": "8.0.0-rc.26",
"@vercel/detect-agent": "^1.2.3",
"better-result": "^2.9.2",
"cross-spawn": "^7.0.6",
Expand All @@ -67,9 +69,9 @@
},
"devDependencies": {
"@prisma/credentials-store": "^7.8.0",
"@repo/cli-conformance": "workspace:8.0.0-rc.36",
"@repo/cli-telemetry": "workspace:8.0.0-rc.36",
"@repo/tsconfig": "workspace:8.0.0-rc.36",
"@repo/cli-conformance": "workspace:8.0.0-rc.37",
"@repo/cli-telemetry": "workspace:8.0.0-rc.37",
"@repo/tsconfig": "workspace:8.0.0-rc.37",
"@types/node": "^22.19.19",
"@types/cross-spawn": "^6.0.6",
"tsdown": "^0.21.10",
Expand Down
5 changes: 5 additions & 0 deletions packages/cli/scripts/shell-conformance-inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
// @prisma/composer-prisma-cloud names @prisma/orm-postgres as a peer and
// imports it when it loads, so the shell lists it for the `deploy` of a
// repository with no Composer config. The shell's own code never imports it.
// @prisma/orm-postgres in turn names @prisma/orm-family-sql and
// @prisma/orm-target-postgres as peers, so the shell lists
// them too, at the toolchain's version, so all of them move together.
export const SHELL_ALLOWED_UNIMPORTED: readonly string[] = [
"@prisma/orm-family-sql",
"@prisma/orm-framework",
"@prisma/orm-postgres",
"@prisma/orm-target-postgres",
];
17 changes: 15 additions & 2 deletions packages/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,16 @@ export const cliGroups: Readonly<
"A migration is an on-disk package describing one schema change, derived from edits to your contract (the PSL description of your data model). Plan writes one; the rest inspect, check integrity, and track what has run where. Apply them with 'db migrate'.",
},
"migration ref": {
brief: "Manage refs: named pointers to contracts. Set, list, delete",
brief:
"Manage refs: named environments, such as staging or production, each pointing to a contract. Set, list, delete, and declare policies",
description:
"A ref names an environment, such as staging or production, and points to the contract its database should be at, so commands can target that contract by the environment's name. A ref can also declare policies: how its database may change. Set, list, and delete refs here; 'policy' reads and writes their policies.",
},
"migration ref policy": {
brief:
"Manage how a ref's database may change: by migrations or db update, and whether a change may lose data. Set, show, delete",
description:
"A ref is a named pointer to a contract, letting commands target a contract by a stable name. Set, list, and delete refs here.",
"A ref names an environment, such as staging or production, and its policies say how that environment's database may change. The change policy says whether it changes through migrations (migrate), through 'db update' (reconcile), or both. The data protection policy says whether a change may lose data, and whether it may widen who can read or write data. A policy the ref does not declare keeps its default: both ways of changing are allowed, and losing data or widening access needs your explicit consent. These commands read and write only the ref's file under migrations/app/refs/, and never connect to a database.",
},
orm: { brief: "Initialize a Prisma ORM project" },
deploy: {
Expand Down Expand Up @@ -487,6 +494,12 @@ export const mountedCommands: Readonly<Record<string, AnyCommand>> = {
"migration ref delete": ormCommandFamily.commands["migration ref delete"],
"migration ref list": ormCommandFamily.commands["migration ref list"],
"migration ref set": ormCommandFamily.commands["migration ref set"],
"migration ref policy delete":
ormCommandFamily.commands["migration ref policy delete"],
"migration ref policy set":
ormCommandFamily.commands["migration ref policy set"],
"migration ref policy show":
ormCommandFamily.commands["migration ref policy show"],
// Local utilities: no owning package, no config section, no API.
init: initCommand,
"skills sync": skillsCommandFamily.commands.sync,
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/tests/e2e-coverage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ const EXCLUSIONS: Readonly<Record<string, string>> = {
"migration ref delete": ORM_FAMILY_REASON,
"migration ref list": ORM_FAMILY_REASON,
"migration ref set": ORM_FAMILY_REASON,
"migration ref policy delete": ORM_FAMILY_REASON,
"migration ref policy set": ORM_FAMILY_REASON,
"migration ref policy show": ORM_FAMILY_REASON,
init: "Writes a package.json script, scaffolds prisma.config.ts and syncs skills from installed packages. No management API is involved; its credential-free happy path against the built binary lives in e2e/init.e2e.ts.",
"skills sync":
"Copies files from installed packages into the project's skill directories. No management API is involved, and the whole surface is filesystem behavior the unit fixtures drive directly.",
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/tests/mount-coverage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ const EXPECTED_MOUNT_PATHS: readonly string[] = [
"migration plan",
"migration ref delete",
"migration ref list",
"migration ref policy delete",
"migration ref policy set",
"migration ref policy show",
"migration ref set",
"migration show",
"migration status",
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/tests/orm-mount.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ describe("the ORM family answers from the assembled tree", () => {
[["migration", "ref", "list"], "migration ref list"],
[["migration", "ref", "set"], "migration ref set"],
[["migration", "ref", "delete"], "migration ref delete"],
[["migration", "ref", "policy", "set"], "migration ref policy set"],
[["migration", "ref", "policy", "show"], "migration ref policy show"],
[["migration", "ref", "policy", "delete"], "migration ref policy delete"],
[["orm", "init"], "orm init"],
])("renders %j help with the mounted spelling, not the family key", async (path, mounted) => {
const result = await shell().run([...path, "--help"], {
Expand Down
2 changes: 1 addition & 1 deletion packages/compute/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"test": "vitest run"
},
"devDependencies": {
"@repo/tsconfig": "workspace:8.0.0-rc.36",
"@repo/tsconfig": "workspace:8.0.0-rc.37",
"@types/node": "^22.19.19",
"tsdown": "^0.21.10",
"typescript": "^6.0.3",
Expand Down
22 changes: 12 additions & 10 deletions packages/prisma/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prisma",
"version": "8.0.0-rc.36",
"version": "8.0.0-rc.37",
"description": "The Prisma CLI: one binary for the ORM, Composer, and the Prisma Developer Platform.",
"type": "module",
"bin": {
Expand Down Expand Up @@ -51,14 +51,16 @@
"dependencies": {
"@manypkg/tools": "^2.1.2",
"@prisma/cli-engine": "workspace:0.10.4",
"@prisma/composer": "0.40.0",
"@prisma/composer-cli": "0.40.0",
"@prisma/composer-prisma-cloud": "0.40.0",
"@prisma/composer": "0.41.0",
"@prisma/composer-cli": "0.41.0",
"@prisma/composer-prisma-cloud": "0.41.0",
"@prisma/compute-sdk": "0.47.0",
"@prisma/management-api-sdk": "1.101.0",
"@prisma/orm-framework": "8.0.0-rc.25",
"@prisma/orm-postgres": "8.0.0-rc.25",
"@prisma/orm-toolchain": "8.0.0-rc.25",
"@prisma/orm-family-sql": "8.0.0-rc.26",
"@prisma/orm-framework": "8.0.0-rc.26",
"@prisma/orm-postgres": "8.0.0-rc.26",
"@prisma/orm-target-postgres": "8.0.0-rc.26",
"@prisma/orm-toolchain": "8.0.0-rc.26",
"@vercel/detect-agent": "^1.2.3",
"better-result": "^2.9.2",
"cross-spawn": "^7.0.6",
Expand All @@ -67,10 +69,10 @@
"open": "^11.0.0"
},
"devDependencies": {
"@prisma/cli": "workspace:8.0.0-rc.36",
"@prisma/cli": "workspace:8.0.0-rc.37",
"@prisma/credentials-store": "^7.8.0",
"@repo/cli-telemetry": "workspace:8.0.0-rc.36",
"@repo/tsconfig": "workspace:8.0.0-rc.36",
"@repo/cli-telemetry": "workspace:8.0.0-rc.37",
"@repo/tsconfig": "workspace:8.0.0-rc.37",
"@types/node": "^22.19.19",
"tsdown": "^0.21.10",
"typescript": "^6.0.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/tsconfig/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@repo/tsconfig",
"private": true,
"version": "8.0.0-rc.36",
"version": "8.0.0-rc.37",
"description": "Base tsconfig providing package for the monorepo",
"license": "Apache-2.0",
"files": [
Expand Down
Loading
Loading