@prisma/cli 3.0.0-beta.16 → 3.0.0-beta.18

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.
Files changed (47) hide show
  1. package/dist/adapters/local-state.js +14 -3
  2. package/dist/adapters/token-storage.js +1 -1
  3. package/dist/cli2.js +4 -2
  4. package/dist/commands/agent/index.js +60 -0
  5. package/dist/commands/app/index.js +5 -3
  6. package/dist/commands/auth/index.js +1 -1
  7. package/dist/commands/git/index.js +1 -1
  8. package/dist/commands/project/index.js +1 -1
  9. package/dist/controllers/agent.js +228 -0
  10. package/dist/controllers/app.js +184 -100
  11. package/dist/controllers/auth.js +38 -3
  12. package/dist/controllers/project.js +2 -2
  13. package/dist/controllers/select-prompt-port.js +1 -0
  14. package/dist/lib/agent/cli-command.js +17 -0
  15. package/dist/lib/agent/constants.js +12 -0
  16. package/dist/lib/agent/package-manager.js +99 -0
  17. package/dist/lib/agent/setup-status.js +83 -0
  18. package/dist/lib/app/app-provider.js +56 -56
  19. package/dist/lib/app/branch-database-deploy.js +3 -2
  20. package/dist/lib/app/branch-database.js +2 -1
  21. package/dist/lib/app/build-settings.js +1 -1
  22. package/dist/lib/app/build.js +14 -12
  23. package/dist/lib/app/bun-project.js +1 -1
  24. package/dist/lib/app/compute-config.js +27 -29
  25. package/dist/lib/app/deploy-plan.js +1 -0
  26. package/dist/lib/app/deploy-progress.js +7 -7
  27. package/dist/lib/app/env-file.js +1 -1
  28. package/dist/lib/app/local-dev.js +1 -1
  29. package/dist/lib/app/production-deploy-gate.js +2 -1
  30. package/dist/lib/auth/login.js +1 -1
  31. package/dist/lib/git/local-branch.js +1 -1
  32. package/dist/lib/project/interactive-setup.js +1 -0
  33. package/dist/lib/project/local-pin.js +1 -1
  34. package/dist/lib/project/resolution.js +2 -2
  35. package/dist/lib/project/setup.js +1 -1
  36. package/dist/presenters/agent.js +74 -0
  37. package/dist/presenters/auth.js +1 -1
  38. package/dist/presenters/project.js +1 -1
  39. package/dist/shell/cli-command.js +12 -0
  40. package/dist/shell/command-arguments.js +7 -1
  41. package/dist/shell/command-meta.js +72 -0
  42. package/dist/shell/command-runner.js +1 -1
  43. package/dist/shell/help.js +6 -5
  44. package/dist/shell/prompt.js +7 -3
  45. package/dist/shell/runtime.js +2 -2
  46. package/dist/shell/update-check.js +2 -2
  47. package/package.json +4 -3
@@ -0,0 +1,99 @@
1
+ import { readFileSync, statSync } from "node:fs";
2
+ import path from "node:path";
3
+ //#region src/lib/agent/package-manager.ts
4
+ const LOCKFILE_PACKAGE_MANAGERS = [
5
+ {
6
+ packageManager: "bun",
7
+ fileNames: ["bun.lock", "bun.lockb"]
8
+ },
9
+ {
10
+ packageManager: "pnpm",
11
+ fileNames: ["pnpm-lock.yaml", "pnpm-workspace.yaml"]
12
+ },
13
+ {
14
+ packageManager: "yarn",
15
+ fileNames: ["yarn.lock"]
16
+ },
17
+ {
18
+ packageManager: "npm",
19
+ fileNames: ["package-lock.json", "npm-shrinkwrap.json"]
20
+ }
21
+ ];
22
+ async function resolveSkillsPackageRunner(options) {
23
+ return resolvePackageRunner(options);
24
+ }
25
+ async function resolvePackageRunner(options) {
26
+ options.signal.throwIfAborted();
27
+ const packageManager = detectPackageManagerSync(options.cwd, options.signal) ?? "npm";
28
+ options.signal.throwIfAborted();
29
+ return packageRunnerForPackageManager(packageManager);
30
+ }
31
+ function resolvePackageRunnerSync(cwd) {
32
+ return packageRunnerForPackageManager(detectPackageManagerSync(cwd) ?? "npm");
33
+ }
34
+ function detectPackageManagerSync(cwd, signal) {
35
+ let directory = path.resolve(cwd);
36
+ while (true) {
37
+ signal?.throwIfAborted();
38
+ const packageJsonManager = readPackageJsonPackageManager(directory);
39
+ if (packageJsonManager) return packageJsonManager;
40
+ const lockfileManager = readLockfilePackageManager(directory, signal);
41
+ if (lockfileManager) return lockfileManager;
42
+ const parent = path.dirname(directory);
43
+ if (parent === directory) return null;
44
+ directory = parent;
45
+ }
46
+ }
47
+ function readPackageJsonPackageManager(directory) {
48
+ const packageJsonPath = path.join(directory, "package.json");
49
+ let content;
50
+ try {
51
+ content = readFileSync(packageJsonPath, "utf8");
52
+ } catch (error) {
53
+ if (isMissingFileError(error)) return null;
54
+ throw error;
55
+ }
56
+ try {
57
+ return parsePackageManager(JSON.parse(content).packageManager);
58
+ } catch {
59
+ return null;
60
+ }
61
+ }
62
+ function readLockfilePackageManager(directory, signal) {
63
+ for (const candidate of LOCKFILE_PACKAGE_MANAGERS) for (const fileName of candidate.fileNames) {
64
+ signal?.throwIfAborted();
65
+ if (fileExists(path.join(directory, fileName))) return candidate.packageManager;
66
+ }
67
+ return null;
68
+ }
69
+ function fileExists(filePath) {
70
+ try {
71
+ return statSync(filePath).isFile();
72
+ } catch (error) {
73
+ if (isMissingFileError(error)) return false;
74
+ throw error;
75
+ }
76
+ }
77
+ function parsePackageManager(value) {
78
+ if (typeof value !== "string") return null;
79
+ const normalized = value.trim().toLowerCase();
80
+ if (normalized === "bun" || normalized.startsWith("bun@")) return "bun";
81
+ if (normalized === "pnpm" || normalized.startsWith("pnpm@")) return "pnpm";
82
+ if (normalized === "yarn" || normalized.startsWith("yarn@")) return "yarn";
83
+ if (normalized === "npm" || normalized.startsWith("npm@")) return "npm";
84
+ return null;
85
+ }
86
+ function packageRunnerForPackageManager(packageManager) {
87
+ switch (packageManager) {
88
+ case "bun": return ["bunx"];
89
+ case "pnpm": return ["pnpm", "dlx"];
90
+ case "yarn": return ["yarn", "dlx"];
91
+ case "npm": return ["npx", "-y"];
92
+ }
93
+ }
94
+ function isMissingFileError(error) {
95
+ const code = error.code;
96
+ return code === "ENOENT" || code === "ENOTDIR";
97
+ }
98
+ //#endregion
99
+ export { resolvePackageRunner, resolvePackageRunnerSync, resolveSkillsPackageRunner };
@@ -0,0 +1,83 @@
1
+ import { PRISMA_SKILLS_LOCK_FILENAME } from "./constants.js";
2
+ import path from "node:path";
3
+ import { readFile, stat } from "node:fs/promises";
4
+ import { findComputeConfigDir } from "@prisma/compute-sdk/config";
5
+ //#region src/lib/agent/setup-status.ts
6
+ async function readPrismaAgentSetupStatus(options) {
7
+ const setupCwd = await resolvePrismaAgentSetupCwd(options);
8
+ const skillsLockPath = path.join(setupCwd, PRISMA_SKILLS_LOCK_FILENAME);
9
+ const [skillsInstalled, promptDismissedAt] = await Promise.all([hasPrismaSkillsLock(skillsLockPath, options.signal, options.requiredSkill), options.stateStore?.readAgentSetupPromptDismissedAt() ?? null]);
10
+ return {
11
+ skillsLockPath: path.basename(skillsLockPath),
12
+ skillsInstalled,
13
+ promptDismissedAt
14
+ };
15
+ }
16
+ async function resolvePrismaAgentSetupCwd(options) {
17
+ options.signal.throwIfAborted();
18
+ const configDir = await findComputeConfigDir(options.cwd, options.signal);
19
+ options.signal.throwIfAborted();
20
+ return configDir ?? options.cwd;
21
+ }
22
+ function isPrismaAgentSetupComplete(status) {
23
+ return status.skillsInstalled;
24
+ }
25
+ function shouldOfferPrismaAgentSetup(status) {
26
+ return !isPrismaAgentSetupComplete(status) && !status.promptDismissedAt;
27
+ }
28
+ async function isLikelyProjectDirectory(options) {
29
+ return (await Promise.all([
30
+ "package.json",
31
+ "prisma.compute.ts",
32
+ "prisma.config.ts",
33
+ ".git"
34
+ ].map((fileName) => pathExists(path.join(options.cwd, fileName), options.signal)))).some(Boolean);
35
+ }
36
+ async function hasPrismaSkillsLock(filePath, signal, requiredSkill) {
37
+ try {
38
+ const raw = await readFile(filePath, {
39
+ encoding: "utf8",
40
+ signal
41
+ });
42
+ return hasPrismaSkillsLockEntry(JSON.parse(raw), requiredSkill);
43
+ } catch (error) {
44
+ if (isNotFoundError(error) || error instanceof SyntaxError) return false;
45
+ throw error;
46
+ }
47
+ }
48
+ function hasPrismaSkillsLockEntry(value, requiredSkill) {
49
+ if (!isRecord(value)) return false;
50
+ if (requiredSkill) return skillLockEntryUsesPrismaSource(readSkillLockEntries(value)[requiredSkill]);
51
+ if (readLegacySources(value).includes("prisma/skills")) return true;
52
+ return Object.values(readSkillLockEntries(value)).some(skillLockEntryUsesPrismaSource);
53
+ }
54
+ function readLegacySources(value) {
55
+ return Array.isArray(value.sources) ? value.sources.filter((source) => typeof source === "string") : [];
56
+ }
57
+ function readSkillLockEntries(value) {
58
+ return isRecord(value.skills) ? value.skills : {};
59
+ }
60
+ function skillLockEntryUsesPrismaSource(value) {
61
+ return isRecord(value) && value.source === "prisma/skills";
62
+ }
63
+ function isRecord(value) {
64
+ return typeof value === "object" && value !== null;
65
+ }
66
+ async function pathExists(filePath, signal) {
67
+ signal.throwIfAborted();
68
+ try {
69
+ await stat(filePath);
70
+ signal.throwIfAborted();
71
+ return true;
72
+ } catch (error) {
73
+ if (signal.aborted) throw error;
74
+ if (isNotFoundError(error)) return false;
75
+ throw error;
76
+ }
77
+ }
78
+ function isNotFoundError(error) {
79
+ const code = error.code;
80
+ return code === "ENOENT" || code === "ENOTDIR";
81
+ }
82
+ //#endregion
83
+ export { isLikelyProjectDirectory, readPrismaAgentSetupStatus, resolvePrismaAgentSetupCwd, shouldOfferPrismaAgentSetup };
@@ -68,14 +68,14 @@ function createAppProvider(client, options) {
68
68
  return deleteEnvironmentVariable(client, options);
69
69
  },
70
70
  async removeApp(appId, options) {
71
- const appResult = await sdk.showService({
72
- serviceId: appId,
71
+ const appResult = await sdk.showApp({
72
+ appId,
73
73
  signal: options?.signal
74
74
  });
75
75
  if (appResult.isErr()) throw new Error(appResult.error.message);
76
- const destroyResult = await sdk.destroyService({
77
- serviceId: appId,
78
- keepService: false,
76
+ const destroyResult = await sdk.destroyApp({
77
+ appId,
78
+ keepApp: false,
79
79
  timeoutSeconds: 120,
80
80
  pollIntervalMs: 2e3,
81
81
  signal: options?.signal
@@ -90,8 +90,8 @@ function createAppProvider(client, options) {
90
90
  return listComputeServiceDomains(client, appId, options?.signal);
91
91
  },
92
92
  async addDomain(options) {
93
- const result = await client.POST("/v1/compute-services/{computeServiceId}/domains", {
94
- params: { path: { computeServiceId: options.appId } },
93
+ const result = await client.POST("/v1/apps/{appId}/domains", {
94
+ params: { path: { appId: options.appId } },
95
95
  body: { hostname: options.hostname },
96
96
  signal: options.signal
97
97
  });
@@ -135,8 +135,8 @@ function createAppProvider(client, options) {
135
135
  },
136
136
  async promoteDeployment(options) {
137
137
  const promoteResult = await sdk.promote({
138
- serviceId: options.appId,
139
- versionId: options.deploymentId,
138
+ appId: options.appId,
139
+ deploymentId: options.deploymentId,
140
140
  timeoutSeconds: 120,
141
141
  pollIntervalMs: 2e3,
142
142
  signal: options.signal,
@@ -169,8 +169,8 @@ function createAppProvider(client, options) {
169
169
  buildSettings: options.buildSettings
170
170
  }),
171
171
  projectId: options.projectId,
172
- serviceId: resolvedApp.appId,
173
- serviceName: resolvedApp.appName,
172
+ appId: resolvedApp.appId,
173
+ appName: resolvedApp.appName,
174
174
  region: resolvedApp.region,
175
175
  portMapping: options.portMapping,
176
176
  envVars: options.envVars,
@@ -185,22 +185,22 @@ function createAppProvider(client, options) {
185
185
  return {
186
186
  projectId: deployed.projectId,
187
187
  app: {
188
- id: deployed.serviceId,
189
- name: deployed.serviceName,
188
+ id: deployed.appId,
189
+ name: deployed.appName,
190
190
  region: deployed.region ?? null,
191
- liveDeploymentId: deployed.versionId,
192
- liveUrl: toAbsoluteUrl(deployed.serviceEndpointDomain ?? null)
191
+ liveDeploymentId: deployed.deploymentId,
192
+ liveUrl: toAbsoluteUrl(deployed.appEndpointDomain ?? null)
193
193
  },
194
194
  deployment: {
195
- id: deployed.versionId,
195
+ id: deployed.deploymentId,
196
196
  status: "running",
197
- url: toAbsoluteUrl(deployed.serviceEndpointDomain ?? deployed.versionEndpointDomain ?? null)
197
+ url: toAbsoluteUrl(deployed.appEndpointDomain ?? deployed.deploymentEndpointDomain ?? null)
198
198
  }
199
199
  };
200
200
  },
201
201
  async updateAppEnv(options) {
202
202
  const updateResult = await sdk.updateEnv({
203
- serviceId: options.appId,
203
+ appId: options.appId,
204
204
  envVars: options.envVars,
205
205
  timeoutSeconds: 120,
206
206
  pollIntervalMs: 2e3,
@@ -209,19 +209,19 @@ function createAppProvider(client, options) {
209
209
  });
210
210
  if (updateResult.isErr()) throw new Error(updateResult.error.message);
211
211
  const promoteResult = await sdk.promote({
212
- serviceId: options.appId,
213
- versionId: updateResult.value.versionId,
212
+ appId: options.appId,
213
+ deploymentId: updateResult.value.deploymentId,
214
214
  timeoutSeconds: 120,
215
215
  pollIntervalMs: 2e3,
216
216
  signal: options.signal,
217
217
  progress: options.promoteProgress
218
218
  });
219
219
  if (promoteResult.isErr()) throw new Error(promoteResult.error.message);
220
- const [serviceResult, versionResult] = await Promise.all([sdk.showService({
221
- serviceId: options.appId,
220
+ const [serviceResult, versionResult] = await Promise.all([sdk.showApp({
221
+ appId: options.appId,
222
222
  signal: options.signal
223
- }), sdk.showVersion({
224
- versionId: updateResult.value.versionId,
223
+ }), sdk.showDeployment({
224
+ deploymentId: updateResult.value.deploymentId,
225
225
  signal: options.signal
226
226
  })]);
227
227
  if (serviceResult.isErr()) throw new Error(serviceResult.error.message);
@@ -232,25 +232,25 @@ function createAppProvider(client, options) {
232
232
  id: serviceResult.value.id,
233
233
  name: serviceResult.value.name,
234
234
  region: serviceResult.value.region ?? null,
235
- liveDeploymentId: serviceResult.value.latestVersionId ?? null,
236
- liveUrl: toAbsoluteUrl(serviceResult.value.serviceEndpointDomain ?? null)
235
+ liveDeploymentId: serviceResult.value.latestDeploymentId ?? null,
236
+ liveUrl: toAbsoluteUrl(serviceResult.value.appEndpointDomain ?? null)
237
237
  },
238
238
  deployment: {
239
239
  id: versionResult.value.id,
240
240
  status: versionResult.value.status,
241
241
  createdAt: versionResult.value.createdAt,
242
- url: toAbsoluteUrl(serviceResult.value.serviceEndpointDomain ?? versionResult.value.previewDomain ?? null),
242
+ url: toAbsoluteUrl(serviceResult.value.appEndpointDomain ?? versionResult.value.previewDomain ?? null),
243
243
  live: true
244
244
  },
245
245
  variables: envVarNames(versionResult.value.envVars)
246
246
  };
247
247
  },
248
248
  async listAppEnvNames(options) {
249
- const [serviceResult, versionResult] = await Promise.all([sdk.showService({
250
- serviceId: options.appId,
249
+ const [serviceResult, versionResult] = await Promise.all([sdk.showApp({
250
+ appId: options.appId,
251
251
  signal: options.signal
252
- }), sdk.showVersion({
253
- versionId: options.deploymentId,
252
+ }), sdk.showDeployment({
253
+ deploymentId: options.deploymentId,
254
254
  signal: options.signal
255
255
  })]);
256
256
  if (serviceResult.isErr()) throw new Error(serviceResult.error.message);
@@ -261,25 +261,25 @@ function createAppProvider(client, options) {
261
261
  id: serviceResult.value.id,
262
262
  name: serviceResult.value.name,
263
263
  region: serviceResult.value.region ?? null,
264
- liveDeploymentId: serviceResult.value.latestVersionId ?? null,
265
- liveUrl: toAbsoluteUrl(serviceResult.value.serviceEndpointDomain ?? null)
264
+ liveDeploymentId: serviceResult.value.latestDeploymentId ?? null,
265
+ liveUrl: toAbsoluteUrl(serviceResult.value.appEndpointDomain ?? null)
266
266
  },
267
267
  deployment: {
268
268
  id: versionResult.value.id,
269
269
  status: versionResult.value.status,
270
270
  createdAt: versionResult.value.createdAt,
271
271
  url: toAbsoluteUrl(versionResult.value.previewDomain ?? null),
272
- live: serviceResult.value.latestVersionId === versionResult.value.id
272
+ live: serviceResult.value.latestDeploymentId === versionResult.value.id
273
273
  },
274
274
  variables: envVarNames(versionResult.value.envVars)
275
275
  };
276
276
  },
277
277
  async listDeployments(appId, options) {
278
- const [appResult, versionsResult] = await Promise.all([sdk.showService({
279
- serviceId: appId,
278
+ const [appResult, versionsResult] = await Promise.all([sdk.showApp({
279
+ appId,
280
280
  signal: options?.signal
281
- }), sdk.listVersions({
282
- serviceId: appId,
281
+ }), sdk.listDeployments({
282
+ appId,
283
283
  signal: options?.signal
284
284
  })]);
285
285
  if (appResult.isErr()) throw new Error(appResult.error.message);
@@ -289,8 +289,8 @@ function createAppProvider(client, options) {
289
289
  id: appResult.value.id,
290
290
  name: appResult.value.name,
291
291
  region: appResult.value.region ?? null,
292
- liveDeploymentId: appResult.value.latestVersionId ?? null,
293
- liveUrl: toAbsoluteUrl(appResult.value.serviceEndpointDomain ?? null)
292
+ liveDeploymentId: appResult.value.latestDeploymentId ?? null,
293
+ liveUrl: toAbsoluteUrl(appResult.value.appEndpointDomain ?? null)
294
294
  },
295
295
  deployments: versionsResult.value.slice().sort((left, right) => {
296
296
  const byDate = right.createdAt.localeCompare(left.createdAt);
@@ -305,8 +305,8 @@ function createAppProvider(client, options) {
305
305
  };
306
306
  },
307
307
  async showDeployment(deploymentId, options) {
308
- const deploymentResult = await sdk.showVersion({
309
- versionId: deploymentId,
308
+ const deploymentResult = await sdk.showDeployment({
309
+ deploymentId,
310
310
  signal: options?.signal
311
311
  });
312
312
  if (deploymentResult.isErr()) {
@@ -329,7 +329,7 @@ function createAppProvider(client, options) {
329
329
  const result = await streamLogs({
330
330
  baseUrl: options.baseUrl,
331
331
  token: await options.getToken(),
332
- versionId: streamOptions.deploymentId,
332
+ deploymentId: streamOptions.deploymentId,
333
333
  signal: streamOptions.signal
334
334
  }, streamOptions.onRecord);
335
335
  if (result.isErr()) {
@@ -382,7 +382,7 @@ async function listComputeServices(client, options) {
382
382
  const services = [];
383
383
  let cursor;
384
384
  while (true) {
385
- const result = await client.GET("/v1/compute-services", {
385
+ const result = await client.GET("/v1/apps", {
386
386
  params: { query: {
387
387
  projectId: options.projectId,
388
388
  branchGitName: options.branchGitName,
@@ -400,13 +400,13 @@ async function listComputeServices(client, options) {
400
400
  name: service.name,
401
401
  region: service.region.id ?? null,
402
402
  branchId: service.branchId,
403
- liveDeploymentId: service.latestVersionId ?? null,
404
- liveUrl: toAbsoluteUrl(service.serviceEndpointDomain ?? null)
403
+ liveDeploymentId: service.latestDeploymentId ?? null,
404
+ liveUrl: toAbsoluteUrl(service.appEndpointDomain ?? null)
405
405
  }));
406
406
  }
407
407
  async function listComputeServiceDomains(client, computeServiceId, signal) {
408
- const result = await client.GET("/v1/compute-services/{computeServiceId}/domains", {
409
- params: { path: { computeServiceId } },
408
+ const result = await client.GET("/v1/apps/{appId}/domains", {
409
+ params: { path: { appId: computeServiceId } },
410
410
  signal
411
411
  });
412
412
  if (result.error || !result.data) throw domainApiCallError("Failed to list custom domains", result.response, result.error);
@@ -453,7 +453,7 @@ async function createBranchApp(client, options) {
453
453
  gitName: options.branchName,
454
454
  signal: options.signal
455
455
  });
456
- const result = await client.POST("/v1/compute-services", {
456
+ const result = await client.POST("/v1/apps", {
457
457
  body: {
458
458
  projectId: options.projectId,
459
459
  branchId: branch.id,
@@ -503,7 +503,7 @@ async function findAppForDeployment(sdk, deploymentId, signal) {
503
503
  const projectsResult = await sdk.listProjects({ signal });
504
504
  if (projectsResult.isErr()) throw new Error(projectsResult.error.message);
505
505
  for (const project of projectsResult.value) {
506
- const servicesResult = await sdk.listServices({
506
+ const servicesResult = await sdk.listApps({
507
507
  projectId: project.id,
508
508
  signal
509
509
  });
@@ -516,8 +516,8 @@ async function findAppForDeployment(sdk, deploymentId, signal) {
516
516
  return null;
517
517
  }
518
518
  async function findServiceAppForDeployment(sdk, serviceId, deploymentId, signal) {
519
- const detailResult = await sdk.showService({
520
- serviceId,
519
+ const detailResult = await sdk.showApp({
520
+ appId: serviceId,
521
521
  signal
522
522
  });
523
523
  if (detailResult.isErr()) throw new Error(detailResult.error.message);
@@ -525,12 +525,12 @@ async function findServiceAppForDeployment(sdk, serviceId, deploymentId, signal)
525
525
  id: detailResult.value.id,
526
526
  name: detailResult.value.name,
527
527
  region: detailResult.value.region ?? null,
528
- liveDeploymentId: detailResult.value.latestVersionId ?? null,
529
- liveUrl: toAbsoluteUrl(detailResult.value.serviceEndpointDomain ?? null)
528
+ liveDeploymentId: detailResult.value.latestDeploymentId ?? null,
529
+ liveUrl: toAbsoluteUrl(detailResult.value.appEndpointDomain ?? null)
530
530
  };
531
531
  if (app.liveDeploymentId === deploymentId) return app;
532
- const versionsResult = await sdk.listVersions({
533
- serviceId,
532
+ const versionsResult = await sdk.listDeployments({
533
+ appId: serviceId,
534
534
  signal
535
535
  });
536
536
  if (versionsResult.isErr()) throw new Error(versionsResult.error.message);
@@ -1,8 +1,8 @@
1
+ import { formatCommandArgument } from "../../shell/command-arguments.js";
1
2
  import { CliError, usageError } from "../../shell/errors.js";
2
- import { confirmPrompt } from "../../shell/prompt.js";
3
3
  import { renderSummaryLine } from "../../shell/ui.js";
4
4
  import { canPrompt } from "../../shell/runtime.js";
5
- import { formatCommandArgument } from "../../shell/command-arguments.js";
5
+ import { confirmPrompt } from "../../shell/prompt.js";
6
6
  import "../project/setup.js";
7
7
  import { hasBranchDatabaseSignal, inspectBranchDatabaseSignal } from "./branch-database.js";
8
8
  import path from "node:path";
@@ -51,6 +51,7 @@ async function maybeSetupBranchDatabase(context, provider, projectId, branch, op
51
51
  if (!await confirmPrompt({
52
52
  input: context.runtime.stdin,
53
53
  output: context.output.stderr,
54
+ signal: context.runtime.signal,
54
55
  message: databasePromptMessage(branch),
55
56
  initialValue: false
56
57
  })) return emptyBranchDatabaseSetupOutcome();
@@ -1,8 +1,9 @@
1
- import { access, readFile, readdir, stat } from "node:fs/promises";
2
1
  import path from "node:path";
2
+ import { access, readFile, readdir, stat } from "node:fs/promises";
3
3
  //#region src/lib/app/branch-database.ts
4
4
  const SKIPPED_DIRECTORIES = new Set([
5
5
  ".git",
6
+ ".agents",
6
7
  ".next",
7
8
  ".nuxt",
8
9
  ".output",
@@ -1,5 +1,5 @@
1
- import { readFile } from "node:fs/promises";
2
1
  import path from "node:path";
2
+ import { readFile } from "node:fs/promises";
3
3
  import { resolveBuildSettings, resolveConfiguredBuildSettings } from "@prisma/compute-sdk";
4
4
  //#region src/lib/app/build-settings.ts
5
5
  /** Legacy build-settings file: no longer read or written, only detected for migration. */
@@ -1,18 +1,20 @@
1
1
  import "./build-settings.js";
2
- import "node:fs/promises";
3
2
  import "node:path";
3
+ import "node:fs/promises";
4
+ import { FRAMEWORKS } from "@prisma/compute-sdk/config";
4
5
  import { normalizeArtifactSymlinks, resolveBuildStrategy } from "@prisma/compute-sdk";
5
6
  //#region src/lib/app/build.ts
6
- const APP_BUILD_TYPES = [
7
- "auto",
8
- "bun",
9
- "nextjs",
10
- "nuxt",
11
- "astro",
12
- "nestjs",
13
- "tanstack-start"
14
- ];
15
- const RESOLVED_APP_BUILD_TYPES = APP_BUILD_TYPES.filter((buildType) => buildType !== "auto");
7
+ const RESOLVED_APP_BUILD_TYPES = [...frameworkBuildTypesByLastOccurrence()];
8
+ const APP_BUILD_TYPES = ["auto", ...RESOLVED_APP_BUILD_TYPES];
9
+ const APP_BUILD_TYPE_LABELS = APP_BUILD_TYPES.join(", ");
10
+ function frameworkBuildTypesByLastOccurrence() {
11
+ const buildTypes = /* @__PURE__ */ new Set();
12
+ for (const framework of FRAMEWORKS) {
13
+ if (buildTypes.has(framework.buildType)) buildTypes.delete(framework.buildType);
14
+ buildTypes.add(framework.buildType);
15
+ }
16
+ return buildTypes;
17
+ }
16
18
  var AppBuildStrategy = class {
17
19
  #appPath;
18
20
  #entrypoint;
@@ -77,4 +79,4 @@ async function resolveAppBuildStrategy(options) {
77
79
  });
78
80
  }
79
81
  //#endregion
80
- export { APP_BUILD_TYPES, AppBuildStrategy, RESOLVED_APP_BUILD_TYPES, executeAppBuild };
82
+ export { APP_BUILD_TYPES, APP_BUILD_TYPE_LABELS, AppBuildStrategy, RESOLVED_APP_BUILD_TYPES, executeAppBuild };
@@ -1,5 +1,5 @@
1
- import { access, readFile } from "node:fs/promises";
2
1
  import path from "node:path";
2
+ import { access, readFile } from "node:fs/promises";
3
3
  //#region src/lib/app/bun-project.ts
4
4
  async function readBunPackageJson(appPath, signal) {
5
5
  const packageJsonPath = path.join(appPath, "package.json");
@@ -1,6 +1,6 @@
1
1
  import { CliError } from "../../shell/errors.js";
2
- import { COMPUTE_CONFIG_FILENAME, COMPUTE_CONFIG_FILENAME as COMPUTE_CONFIG_FILENAME$1, ComputeConfigTargetRequiredError, computeTargetAppDir, frameworkByKey, inferComputeTargetFromCwd, loadComputeConfig, selectComputeDeployTarget } from "@prisma/compute-sdk/config";
3
2
  import path from "node:path";
3
+ import { COMPUTE_CONFIG_FILENAME, COMPUTE_CONFIG_FILENAME as COMPUTE_CONFIG_FILENAME$1, ComputeConfigTargetRequiredError, computeTargetAppDir, frameworkByKey, inferComputeTargetFromCwd, loadComputeConfig, selectComputeDeployTarget } from "@prisma/compute-sdk/config";
4
4
  import { matchError } from "better-result";
5
5
  //#region src/lib/app/compute-config.ts
6
6
  /**
@@ -18,47 +18,45 @@ function computeFrameworkToBuildType(framework) {
18
18
  function mergeComputeDeployInputs(options) {
19
19
  const { cli, target, configFilename } = options;
20
20
  const configAnnotation = `set by ${configFilename}`;
21
- const framework = cli.framework ? {
22
- value: cli.framework,
23
- annotation: "set by --framework"
24
- } : target?.framework ? {
25
- value: target.framework,
26
- annotation: configAnnotation
27
- } : void 0;
28
- const entrypoint = cli.entrypoint ? {
29
- value: cli.entrypoint,
30
- annotation: "set by --entry"
31
- } : target?.entry ? {
32
- value: target.entry,
33
- annotation: configAnnotation
34
- } : void 0;
35
- const httpPort = cli.httpPort ? {
36
- value: cli.httpPort,
37
- annotation: "set by --http-port"
38
- } : target?.httpPort ? {
39
- value: String(target.httpPort),
40
- annotation: configAnnotation
41
- } : void 0;
21
+ const framework = mergeStringInput(cli.framework, "set by --framework", target?.framework ?? void 0, configAnnotation);
22
+ const entrypoint = mergeStringInput(cli.entrypoint, "set by --entry", target?.entry ?? void 0, configAnnotation);
23
+ const httpPort = mergeStringInput(cli.httpPort, "set by --http-port", target?.httpPort ? String(target.httpPort) : void 0, configAnnotation);
24
+ const region = mergeStringInput(cli.region, "set by --region", target?.region ?? void 0, configAnnotation);
42
25
  const cliEnvInputs = cli.envInputs && cli.envInputs.length > 0 ? cli.envInputs : void 0;
43
26
  const configEnvInputs = target && target.envInputs.length > 0 ? target.envInputs : void 0;
44
27
  const envInputs = cliEnvInputs ?? configEnvInputs;
45
- const configAppName = target?.name ? {
46
- value: target.name,
47
- annotation: configAnnotation
48
- } : target?.key ? {
49
- value: target.key,
50
- annotation: configAnnotation
51
- } : void 0;
28
+ const configAppName = readConfigAppName(target, configAnnotation);
52
29
  return {
53
30
  framework,
54
31
  entrypoint,
55
32
  httpPort,
33
+ region,
56
34
  envInputs,
57
35
  envInputsFromConfig: !cliEnvInputs && configEnvInputs !== void 0,
58
36
  configAppName,
59
37
  appRoot: target?.root ?? void 0
60
38
  };
61
39
  }
40
+ function mergeStringInput(cliValue, cliAnnotation, configValue, configAnnotation) {
41
+ if (cliValue !== void 0) return {
42
+ value: cliValue,
43
+ annotation: cliAnnotation
44
+ };
45
+ if (configValue) return {
46
+ value: configValue,
47
+ annotation: configAnnotation
48
+ };
49
+ }
50
+ function readConfigAppName(target, configAnnotation) {
51
+ if (target?.name) return {
52
+ value: target.name,
53
+ annotation: configAnnotation
54
+ };
55
+ if (target?.key) return {
56
+ value: target.key,
57
+ annotation: configAnnotation
58
+ };
59
+ }
62
60
  /**
63
61
  * Merges CLI inputs for the local `app build` and `app run` commands with a
64
62
  * selected config target. Explicit flags win; `--build-type auto` is the
@@ -30,6 +30,7 @@ function perAppInputsForDeployAll(inputs) {
30
30
  ["--framework", inputs.framework],
31
31
  ["--entry", inputs.entrypoint],
32
32
  ["--http-port", inputs.httpPort],
33
+ ["--region", inputs.region],
33
34
  ["--env", inputs.envAssignments?.length ? inputs.envAssignments : void 0],
34
35
  [inputs.appIdEnvVar.name, inputs.appIdEnvVar.value]
35
36
  ].filter(([, value]) => value !== void 0).map(([flag]) => flag);
@@ -6,7 +6,7 @@ function createDeployProgressState() {
6
6
  buildCompleted: false,
7
7
  archiveReady: false,
8
8
  uploadCompleted: false,
9
- versionId: null,
9
+ deploymentId: null,
10
10
  startRequested: false,
11
11
  containerLive: false,
12
12
  deploymentUrl: null,
@@ -39,8 +39,8 @@ function createDeployProgress(output, ui, enabled, state = createDeployProgressS
39
39
  onUploadStart() {
40
40
  write("Uploading...");
41
41
  },
42
- onVersionCreated(versionId) {
43
- state.versionId = versionId;
42
+ onDeploymentCreated(deploymentId) {
43
+ state.deploymentId = deploymentId;
44
44
  },
45
45
  onUploadComplete() {
46
46
  state.uploadCompleted = true;
@@ -69,16 +69,16 @@ function createPromoteProgress(output, enabled) {
69
69
  output.write(`${line}\n`);
70
70
  };
71
71
  return {
72
- onVersionStarting(versionId) {
73
- write(`Starting deployment ${versionId}...`);
72
+ onDeploymentStarting(deploymentId) {
73
+ write(`Starting deployment ${deploymentId}...`);
74
74
  },
75
- onVersionStartRequested() {
75
+ onDeploymentStartRequested() {
76
76
  write("Requesting deployment start...");
77
77
  },
78
78
  onStatusChange(status) {
79
79
  write(`Status: ${status}`);
80
80
  },
81
- onVersionRunning() {
81
+ onDeploymentRunning() {
82
82
  write("Deployment is running.");
83
83
  },
84
84
  onPromoteStart() {