Skip to content

Commit 7833e62

Browse files
feat(cli): migrate Compute commands to the App/Deployment surface (#99)
**M6 client migration for `@prisma/cli`** ([PRS-90](https://linear.app/prisma-company/issue/PRS-90)). Points the CLI at the renamed `@prisma/compute-sdk@0.30.0` and the new `/v1/apps` + `/v1/deployments` Management API surface (both already shipped + deployed). Compile-only / behavior-preserving — the CLI's user-facing `compute app` / `compute deployment` commands and help text are unchanged. ## What changed **1. compute-SDK call sites → App/Deployment** `showService`→`showApp`, `listServices`→`listApps`, `createService`→`createApp`, `listVersions`→`listDeployments`, `showVersion`→`showDeployment` (+ start/stop/delete/destroy); option keys `serviceId`→`appId`, `versionId`→`deploymentId`, `serviceName`→`appName`; response fields `.appEndpointDomain` / `.latestDeploymentId` / `.deploymentId` / `.previous*`; the progress callbacks the CLI implements (`onVersionCreated`→`onDeploymentCreated`, `selectService`→`selectApp`, …); and the SDK error/domain types (`ServiceInfo`→`AppInfo`, `NoExistingVersionError`→`NoExistingDeploymentError`, …). **2. Raw Management API calls → `/v1/apps`** The CLI also makes raw HTTP calls (outside the SDK) for app reads/domains. Repointed `GET /v1/compute-services` → `GET /v1/apps`, `GET/POST /v1/compute-services/:id/domains` → `/v1/apps/:appId/domains`, `POST /v1/compute-services` → `POST /v1/apps`; `RawComputeServiceRecord` → `RawAppRecord` (`latestVersionId`→`latestDeploymentId`, `serviceEndpointDomain`→`appEndpointDomain`, `type: "app"`). **3. Dependencies** - `@prisma/compute-sdk` → `0.30.0` (the renamed SDK). - `@prisma/management-api-sdk` → `^1.44.0` (first version exposing `/v1/apps` typed paths; also satisfies the compute-sdk peer). - `minimumReleaseAgeExclude`: **package-level** exempts for `@prisma/compute-sdk` and `@prisma/management-api-sdk` (our own internal packages; version-pinned exempts aren't honored by pnpm's lockfile supply-chain check). ## Validation | Gate | Result | | --- | --- | | `pnpm --recursive exec tsc --noEmit` | ✅ 0 errors (was 38) | | `pnpm --recursive test` (vitest) | ✅ 531 passed (cli 523 / compute 8) | | `pnpm exec biome ci .` | ✅ exit 0 | | supply-chain (lockfile) | ✅ passes | `grep -rE "/v1/compute-services|showService|listServices|latestVersionId|serviceEndpointDomain" packages/cli/src` → no SDK/old-surface leftovers. ## Note Implemented by sub-agents against a precise spec; I independently re-ran every gate and hardened the min-age exempt before opening. Companion PR: **build-runner** (pdp-control-plane) bumps the same SDK next. --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 3a25c73 commit 7833e62

9 files changed

Lines changed: 154 additions & 155 deletions

File tree

packages/cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
},
4545
"dependencies": {
4646
"@clack/prompts": "^1.5.0",
47-
"@prisma/compute-sdk": "^0.29.0",
47+
"@prisma/compute-sdk": "0.30.0",
4848
"@prisma/credentials-store": "^7.8.0",
49-
"@prisma/management-api-sdk": "^1.37.0",
49+
"@prisma/management-api-sdk": "^1.44.0",
5050
"better-result": "^2.9.2",
5151
"colorette": "^2.0.20",
5252
"commander": "^14.0.3",

packages/cli/src/controllers/app.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4656,10 +4656,10 @@ function appDeployFailedError(
46564656
const phaseHeadline = progress.containerLive
46574657
? "The deployment started, but the app is not ready yet."
46584658
: "Deploy failed after the build completed.";
4659-
const recoveryLines = progress.versionId
4659+
const recoveryLines = progress.deploymentId
46604660
? [
46614661
"See what happened",
4662-
`prisma-cli app logs --deployment ${progress.versionId}`,
4662+
`prisma-cli app logs --deployment ${progress.deploymentId}`,
46634663
]
46644664
: [
46654665
"Fix",
@@ -4689,8 +4689,8 @@ function appDeployFailedError(
46894689
"",
46904690
...recoveryLines,
46914691
];
4692-
const fix = progress.versionId
4693-
? `Inspect logs with prisma-cli app logs --deployment ${progress.versionId}.`
4692+
const fix = progress.deploymentId
4693+
? `Inspect logs with prisma-cli app logs --deployment ${progress.deploymentId}.`
46944694
: "Retry the command, or rerun with --trace for more detailed diagnostics.";
46954695

46964696
return new CliError({
@@ -4702,7 +4702,7 @@ function appDeployFailedError(
47024702
debug,
47034703
meta: {
47044704
phase: progress.containerLive ? "runtime_ready" : "deploy",
4705-
deploymentId: progress.versionId,
4705+
deploymentId: progress.deploymentId,
47064706
deploymentUrl: progress.deploymentUrl,
47074707
},
47084708
humanLines,

packages/cli/src/lib/app/app-interaction.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type {
2+
AppInfo,
23
DeployInteraction,
34
RegionInfo,
4-
ServiceInfo,
55
} from "@prisma/compute-sdk";
66

77
import { selectPrompt, textPrompt } from "../../shell/prompt";
@@ -14,8 +14,8 @@ export function createDeployInteraction(
1414
context: CommandContext,
1515
): DeployInteraction {
1616
return {
17-
async selectService(services: ServiceInfo[]): Promise<string | null> {
18-
const sorted = services
17+
async selectApp(apps: AppInfo[]): Promise<string | null> {
18+
const sorted = apps
1919
.slice()
2020
.sort(
2121
(left, right) =>
@@ -28,9 +28,9 @@ export function createDeployInteraction(
2828
output: context.runtime.stderr,
2929
message: "Select an app",
3030
choices: [
31-
...sorted.map((service) => ({
32-
label: service.name,
33-
value: service.id as string | null,
31+
...sorted.map((app) => ({
32+
label: app.name,
33+
value: app.id as string | null,
3434
})),
3535
{
3636
label: "Create a new app",
@@ -41,7 +41,7 @@ export function createDeployInteraction(
4141

4242
return selection === CREATE_NEW_APP ? null : selection;
4343
},
44-
async provideServiceName(): Promise<string> {
44+
async provideAppName(): Promise<string> {
4545
return textPrompt({
4646
input: context.runtime.stdin,
4747
output: context.runtime.stderr,

0 commit comments

Comments
 (0)