@prisma/cli 8.0.0-rc.1 → 8.0.0-rc.10

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 (110) hide show
  1. package/README.md +25 -29
  2. package/dist/cli.js +14551 -16
  3. package/dist/{v8/sender.js → sender.js} +1 -1
  4. package/package.json +17 -18
  5. package/dist/adapters/git.js +0 -54
  6. package/dist/adapters/local-state.js +0 -155
  7. package/dist/auth/client.js +0 -30
  8. package/dist/auth/errors.js +0 -50
  9. package/dist/auth/guard.js +0 -39
  10. package/dist/auth/login.js +0 -471
  11. package/dist/auth/operations.js +0 -208
  12. package/dist/auth/recipient.js +0 -42
  13. package/dist/auth/token-storage.js +0 -439
  14. package/dist/auth/workspaces.js +0 -171
  15. package/dist/cli-command.js +0 -14
  16. package/dist/cli-name.js +0 -12
  17. package/dist/cli2.js +0 -136
  18. package/dist/command-arguments.js +0 -12
  19. package/dist/commands/agent/index.js +0 -60
  20. package/dist/commands/app/index.js +0 -350
  21. package/dist/commands/auth/index.js +0 -95
  22. package/dist/commands/branch/index.js +0 -27
  23. package/dist/commands/bucket/index.js +0 -123
  24. package/dist/commands/build/index.js +0 -29
  25. package/dist/commands/database/index.js +0 -249
  26. package/dist/commands/env.js +0 -99
  27. package/dist/commands/feedback/index.js +0 -20
  28. package/dist/commands/git/index.js +0 -36
  29. package/dist/commands/init/index.js +0 -33
  30. package/dist/commands/project/index.js +0 -118
  31. package/dist/commands/version/index.js +0 -18
  32. package/dist/controllers/agent-setup.js +0 -52
  33. package/dist/controllers/agent.js +0 -228
  34. package/dist/controllers/app-env-api.js +0 -55
  35. package/dist/controllers/app-env-file.js +0 -181
  36. package/dist/controllers/app-env.js +0 -502
  37. package/dist/controllers/app.js +0 -2508
  38. package/dist/controllers/auth.js +0 -124
  39. package/dist/controllers/branch.js +0 -92
  40. package/dist/controllers/bucket.js +0 -184
  41. package/dist/controllers/build.js +0 -88
  42. package/dist/controllers/database.js +0 -463
  43. package/dist/controllers/feedback.js +0 -90
  44. package/dist/controllers/init.js +0 -814
  45. package/dist/controllers/project.js +0 -892
  46. package/dist/controllers/select-prompt-port.js +0 -13
  47. package/dist/controllers/version.js +0 -12
  48. package/dist/errors.js +0 -102
  49. package/dist/lib/agent/cli-command.js +0 -20
  50. package/dist/lib/agent/constants.js +0 -12
  51. package/dist/lib/agent/package-manager.js +0 -99
  52. package/dist/lib/agent/setup-status.js +0 -83
  53. package/dist/lib/app/app-provider.js +0 -617
  54. package/dist/lib/app/branch-database-api.js +0 -102
  55. package/dist/lib/app/branch-database-deploy.js +0 -353
  56. package/dist/lib/app/branch-database.js +0 -234
  57. package/dist/lib/app/build-settings.js +0 -98
  58. package/dist/lib/app/build.js +0 -82
  59. package/dist/lib/app/bun-project.js +0 -45
  60. package/dist/lib/app/compute-config.js +0 -145
  61. package/dist/lib/app/deploy-output.js +0 -24
  62. package/dist/lib/app/deploy-plan.js +0 -59
  63. package/dist/lib/app/deploy-progress.js +0 -100
  64. package/dist/lib/app/domain-guidance.js +0 -14
  65. package/dist/lib/app/env-config.js +0 -67
  66. package/dist/lib/app/env-file.js +0 -82
  67. package/dist/lib/app/env-vars.js +0 -50
  68. package/dist/lib/app/local-dev.js +0 -109
  69. package/dist/lib/app/production-deploy-gate.js +0 -162
  70. package/dist/lib/app/read-branch.js +0 -30
  71. package/dist/lib/bucket/provider.js +0 -139
  72. package/dist/lib/database/provider.js +0 -385
  73. package/dist/lib/diagnostics.js +0 -16
  74. package/dist/lib/feedback.js +0 -15
  75. package/dist/lib/fs/home-path.js +0 -24
  76. package/dist/lib/git/local-branch.js +0 -53
  77. package/dist/lib/git/local-status.js +0 -57
  78. package/dist/lib/project/interactive-setup.js +0 -57
  79. package/dist/lib/project/local-pin.js +0 -200
  80. package/dist/lib/project/provider.js +0 -93
  81. package/dist/lib/project/resolution.js +0 -389
  82. package/dist/lib/project/setup.js +0 -138
  83. package/dist/lib/version.js +0 -56
  84. package/dist/lib/workspace-id.js +0 -18
  85. package/dist/output/patterns.js +0 -90
  86. package/dist/presenters/agent.js +0 -74
  87. package/dist/presenters/app-env.js +0 -265
  88. package/dist/presenters/app.js +0 -672
  89. package/dist/presenters/auth.js +0 -184
  90. package/dist/presenters/branch.js +0 -46
  91. package/dist/presenters/bucket.js +0 -174
  92. package/dist/presenters/database.js +0 -462
  93. package/dist/presenters/feedback.js +0 -26
  94. package/dist/presenters/init.js +0 -30
  95. package/dist/presenters/project.js +0 -268
  96. package/dist/presenters/verbose-context.js +0 -64
  97. package/dist/presenters/version.js +0 -29
  98. package/dist/shell/cli-command.js +0 -2
  99. package/dist/shell/command-meta.js +0 -923
  100. package/dist/shell/command-runner.js +0 -119
  101. package/dist/shell/diagnostics-output.js +0 -57
  102. package/dist/shell/global-flags.js +0 -37
  103. package/dist/shell/help.js +0 -90
  104. package/dist/shell/output.js +0 -144
  105. package/dist/shell/prompt.js +0 -48
  106. package/dist/shell/runtime.js +0 -38
  107. package/dist/shell/ui.js +0 -116
  108. package/dist/state-dir.js +0 -12
  109. package/dist/update-check.js +0 -248
  110. package/dist/v8/cli.js +0 -14699
@@ -1,4 +1,4 @@
1
- import { t as isParentToSenderPayload } from "../payload-B88Qvzxk-CrtTXSOe.js";
1
+ import { t as isParentToSenderPayload } from "./payload-B88Qvzxk-CrtTXSOe.js";
2
2
  import { join } from "node:path";
3
3
  import { readFileSync } from "node:fs";
4
4
  import { determineAgent } from "@vercel/detect-agent";
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@prisma/cli",
3
- "version": "8.0.0-rc.1",
3
+ "version": "8.0.0-rc.10",
4
4
  "description": "Command-line interface for the Prisma Developer Platform.",
5
5
  "type": "module",
6
6
  "bin": {
7
- "prisma-cli": "./dist/v8/cli.js"
7
+ "prisma-cli": "./dist/cli.js"
8
8
  },
9
9
  "exports": {
10
- "./package.json": "./package.json"
10
+ "./package.json": "./package.json",
11
+ "./src/bin": "./src/bin.ts"
11
12
  },
12
13
  "files": [
13
14
  "dist",
@@ -38,27 +39,24 @@
38
39
  },
39
40
  "license": "Apache-2.0",
40
41
  "dependencies": {
41
- "@clack/prompts": "1.5.0",
42
- "@prisma/cli-engine": "8.0.0-rc.1",
43
- "@prisma/composer": "0.6.0-dev.16",
42
+ "@manypkg/tools": "^2.1.2",
43
+ "@prisma/cli-engine": "0.2.3",
44
+ "@prisma/composer-cli": "0.14.0",
44
45
  "@prisma/compute-sdk": "0.39.0",
45
46
  "@prisma/credentials-store": "^7.8.0",
46
47
  "@prisma/management-api-sdk": "1.55.0",
47
- "@prisma/orm-toolchain": "8.0.0-rc.1-dev.40",
48
+ "@prisma/orm-toolchain": "8.0.0-rc.7",
48
49
  "@vercel/detect-agent": "^1.2.3",
49
50
  "better-result": "^2.9.2",
50
- "colorette": "^2.0.20",
51
- "commander": "^14.0.3",
52
51
  "dotenv": "^17.4.2",
53
52
  "execa": "^9.6.1",
54
- "open": "^11.0.0",
55
- "string-width": "^8.2.1",
56
- "strip-ansi": "^7.2.0",
57
- "wrap-ansi": "^10.0.0"
53
+ "open": "^11.0.0"
58
54
  },
59
55
  "devDependencies": {
60
- "@repo/cli-telemetry": "8.0.0-rc.1",
61
- "@repo/tsconfig": "8.0.0-rc.1",
56
+ "@prisma/composer": "0.14.0",
57
+ "@repo/cli-conformance": "8.0.0-rc.10",
58
+ "@repo/cli-telemetry": "8.0.0-rc.10",
59
+ "@repo/tsconfig": "8.0.0-rc.10",
62
60
  "@types/node": "^22.19.19",
63
61
  "tsdown": "^0.21.10",
64
62
  "tsx": "^4.22.4",
@@ -67,9 +65,10 @@
67
65
  },
68
66
  "scripts": {
69
67
  "build": "tsdown",
70
- "check:grammar": "vitest run tests/v8-mount-coverage.test.ts",
68
+ "check:grammar": "vitest run tests/mount-coverage.test.ts",
71
69
  "typecheck": "tsc --noEmit",
72
- "test": "vitest run",
73
- "test:e2e": "vitest run --config vitest.e2e.config.ts"
70
+ "test": "pnpm run build && vitest run",
71
+ "test:e2e": "vitest run --config vitest.e2e.config.ts",
72
+ "conformance": "tsx scripts/conformance.ts"
74
73
  }
75
74
  }
@@ -1,54 +0,0 @@
1
- import { execFile } from "node:child_process";
2
- import { promisify } from "node:util";
3
- //#region src/adapters/git.ts
4
- const execFileAsync = promisify(execFile);
5
- async function readGitOriginRemote(cwd, signal) {
6
- try {
7
- const { stdout } = await execFileAsync("git", [
8
- "config",
9
- "--get",
10
- "remote.origin.url"
11
- ], {
12
- cwd,
13
- timeout: 5e3,
14
- signal
15
- });
16
- const remote = stdout.trim();
17
- return remote.length > 0 ? remote : null;
18
- } catch (error) {
19
- if (signal?.aborted || isAbortError(error)) throw error;
20
- return null;
21
- }
22
- }
23
- function isAbortError(error) {
24
- return error instanceof Error && error.name === "AbortError";
25
- }
26
- function parseGitHubRepositoryUrl(value) {
27
- const input = value.trim();
28
- const shorthand = input.match(/^git@github\.com:([^/\s]+)\/([^/\s]+?)(?:\.git)?$/);
29
- if (shorthand) return toGitHubRepositoryReference(shorthand[1], shorthand[2]);
30
- let parsed;
31
- try {
32
- parsed = new URL(input);
33
- } catch {
34
- return null;
35
- }
36
- if (parsed.hostname !== "github.com") return null;
37
- if (parsed.protocol !== "https:" && parsed.protocol !== "http:" && parsed.protocol !== "ssh:") return null;
38
- const parts = parsed.pathname.split("/").filter(Boolean);
39
- if (parts.length !== 2) return null;
40
- const [owner, rawName] = parts;
41
- return toGitHubRepositoryReference(owner, rawName.endsWith(".git") ? rawName.slice(0, -4) : rawName);
42
- }
43
- function toGitHubRepositoryReference(owner, name) {
44
- if (!owner || !name || owner.includes("/") || name.includes("/")) return null;
45
- return {
46
- provider: "github",
47
- owner,
48
- name,
49
- fullName: `${owner}/${name}`,
50
- url: `https://github.com/${owner}/${name}`
51
- };
52
- }
53
- //#endregion
54
- export { parseGitHubRepositoryUrl, readGitOriginRemote };
@@ -1,155 +0,0 @@
1
- import path from "node:path";
2
- import { mkdir, readFile, writeFile } from "node:fs/promises";
3
- //#region src/adapters/local-state.ts
4
- const DEFAULT_STATE = {
5
- auth: null,
6
- project: {
7
- rememberedByWorkspace: {},
8
- lastResolved: null,
9
- repositoryConnectionsByProject: {}
10
- },
11
- branch: { active: "preview" },
12
- app: {
13
- selectedByProject: {},
14
- knownLiveDeploymentByProject: {}
15
- },
16
- agent: { setupPromptDismissedAt: null }
17
- };
18
- const DEFAULT_STATE_FILE_NAME = "state.json";
19
- function resolveLocalStateFilePath(stateDir) {
20
- return path.join(stateDir, DEFAULT_STATE_FILE_NAME);
21
- }
22
- var LocalStateStore = class {
23
- stateFilePath;
24
- constructor(stateDir, signal) {
25
- this.signal = signal;
26
- this.stateFilePath = resolveLocalStateFilePath(stateDir);
27
- }
28
- async read() {
29
- this.signal?.throwIfAborted();
30
- try {
31
- const raw = await readFile(this.stateFilePath, {
32
- encoding: "utf8",
33
- signal: this.signal
34
- });
35
- const parsed = JSON.parse(raw);
36
- return {
37
- auth: parsed.auth ?? structuredClone(DEFAULT_STATE.auth),
38
- project: {
39
- rememberedByWorkspace: parsed.project?.rememberedByWorkspace ?? {},
40
- lastResolved: parsed.project?.lastResolved ?? null,
41
- repositoryConnectionsByProject: parsed.project?.repositoryConnectionsByProject ?? {}
42
- },
43
- branch: { active: parsed.branch?.active ?? DEFAULT_STATE.branch.active },
44
- app: {
45
- selectedByProject: parsed.app?.selectedByProject ?? {},
46
- knownLiveDeploymentByProject: parsed.app?.knownLiveDeploymentByProject ?? {}
47
- },
48
- agent: { setupPromptDismissedAt: parsed.agent?.setupPromptDismissedAt ?? null }
49
- };
50
- } catch (error) {
51
- if (error.code === "ENOENT") return structuredClone(DEFAULT_STATE);
52
- throw error;
53
- }
54
- }
55
- async write(state) {
56
- this.signal?.throwIfAborted();
57
- await mkdir(path.dirname(this.stateFilePath), { recursive: true });
58
- this.signal?.throwIfAborted();
59
- await writeFile(this.stateFilePath, `${JSON.stringify(state, null, 2)}\n`, { encoding: "utf8" });
60
- this.signal?.throwIfAborted();
61
- }
62
- async setAuthSession(session) {
63
- const state = await this.read();
64
- state.auth = session;
65
- await this.write(state);
66
- return state;
67
- }
68
- async clearAuthSession() {
69
- const state = await this.read();
70
- state.auth = null;
71
- await this.write(state);
72
- return state;
73
- }
74
- async setActiveBranch(active) {
75
- const state = await this.read();
76
- state.branch.active = active;
77
- await this.write(state);
78
- return state;
79
- }
80
- async readRememberedProject(workspaceId) {
81
- return (await this.read()).project.rememberedByWorkspace[workspaceId] ?? null;
82
- }
83
- async readLastResolvedProject() {
84
- return (await this.read()).project.lastResolved;
85
- }
86
- async setRememberedProject(project) {
87
- const state = await this.read();
88
- state.project.rememberedByWorkspace[project.workspaceId] = project;
89
- state.project.lastResolved = project;
90
- await this.write(state);
91
- return state;
92
- }
93
- async readRepositoryConnection(projectId) {
94
- return (await this.read()).project.repositoryConnectionsByProject[projectId] ?? null;
95
- }
96
- async setRepositoryConnection(projectId, connection) {
97
- const state = await this.read();
98
- state.project.repositoryConnectionsByProject[projectId] = connection;
99
- await this.write(state);
100
- return state;
101
- }
102
- async clearRepositoryConnection(projectId) {
103
- const state = await this.read();
104
- delete state.project.repositoryConnectionsByProject[projectId];
105
- await this.write(state);
106
- return state;
107
- }
108
- async readSelectedApp(projectId) {
109
- return (await this.read()).app.selectedByProject[projectId] ?? null;
110
- }
111
- async setSelectedApp(projectId, app) {
112
- const state = await this.read();
113
- state.app.selectedByProject[projectId] = app;
114
- await this.write(state);
115
- return state;
116
- }
117
- async clearSelectedApp(projectId, appId) {
118
- const state = await this.read();
119
- const selectedApp = state.app.selectedByProject[projectId];
120
- if (!selectedApp || selectedApp.id !== appId) return state;
121
- delete state.app.selectedByProject[projectId];
122
- await this.write(state);
123
- return state;
124
- }
125
- async readKnownLiveDeployment(projectId, appId) {
126
- return (await this.read()).app.knownLiveDeploymentByProject[projectId]?.[appId] ?? null;
127
- }
128
- async setKnownLiveDeployment(projectId, appId, deploymentId) {
129
- const state = await this.read();
130
- state.app.knownLiveDeploymentByProject[projectId] ??= {};
131
- state.app.knownLiveDeploymentByProject[projectId][appId] = deploymentId;
132
- await this.write(state);
133
- return state;
134
- }
135
- async clearKnownLiveDeployment(projectId, appId) {
136
- const state = await this.read();
137
- const projectDeployments = state.app.knownLiveDeploymentByProject[projectId];
138
- if (!projectDeployments || !(appId in projectDeployments)) return state;
139
- delete projectDeployments[appId];
140
- if (Object.keys(projectDeployments).length === 0) delete state.app.knownLiveDeploymentByProject[projectId];
141
- await this.write(state);
142
- return state;
143
- }
144
- async readAgentSetupPromptDismissedAt() {
145
- return (await this.read()).agent.setupPromptDismissedAt;
146
- }
147
- async setAgentSetupPromptDismissedAt(dismissedAt) {
148
- const state = await this.read();
149
- state.agent.setupPromptDismissedAt = dismissedAt;
150
- await this.write(state);
151
- return state;
152
- }
153
- };
154
- //#endregion
155
- export { LocalStateStore, resolveLocalStateFilePath };
@@ -1,30 +0,0 @@
1
- import path from "node:path";
2
- import os from "node:os";
3
- //#region src/auth/client.ts
4
- const CLIENT_ID = "cmm3lndn701oo0uefvxzo0ivw";
5
- const AUTH_FILE_ENV_VAR = "PRISMA_COMPUTE_AUTH_FILE";
6
- /**
7
- * The SDK's config demands a redirect URI even for a client that only
8
- * ever makes API calls with tokens it already has. Port 0 is the
9
- * honest value: no browser is ever sent here, and nothing listens.
10
- */
11
- const UNUSED_REDIRECT_URI = "http://localhost:0/auth/callback";
12
- function getApiBaseUrl(env = process.env) {
13
- return env.PRISMA_MANAGEMENT_API_URL?.trim() || "https://api.prisma.io";
14
- }
15
- function getAuthFilePath(env = process.env) {
16
- const configured = env[AUTH_FILE_ENV_VAR];
17
- if (configured?.trim()) return path.resolve(configured);
18
- return defaultAuthFilePath(env);
19
- }
20
- function defaultAuthFilePath(env = process.env) {
21
- if (process.platform === "darwin") return path.join(os.homedir(), "Library", "Application Support", "prisma", "auth.json");
22
- if (process.platform === "win32") {
23
- const appData = env.APPDATA ?? path.join(os.homedir(), "AppData", "Roaming");
24
- return path.join(appData, "prisma", "auth.json");
25
- }
26
- const xdgConfigHome = env.XDG_CONFIG_HOME ?? path.join(os.homedir(), ".config");
27
- return path.join(xdgConfigHome, "prisma", "auth.json");
28
- }
29
- //#endregion
30
- export { CLIENT_ID, UNUSED_REDIRECT_URI, getApiBaseUrl, getAuthFilePath };
@@ -1,50 +0,0 @@
1
- import { CliError } from "../errors.js";
2
- //#region src/auth/errors.ts
3
- /**
4
- * Auth-specific error constructors, owned by the auth module. The
5
- * CliError base class still lives in the legacy shell (`shell/errors`);
6
- * it is the one remaining legacy dependency of this module and is
7
- * named as an S2d survivor until the operations layer throws structured
8
- * errors directly. The shell re-exports these constructors so legacy
9
- * imports keep working.
10
- */
11
- function workspaceSwitchUnavailableError() {
12
- return new CliError({
13
- code: "WORKSPACE_SWITCH_UNAVAILABLE",
14
- domain: "auth",
15
- summary: "Workspace switching is unavailable",
16
- why: "PRISMA_SERVICE_TOKEN is set, so authenticated commands use that token instead of local OAuth workspaces.",
17
- fix: "Unset PRISMA_SERVICE_TOKEN to switch between local OAuth workspaces, or use a token for the workspace you want.",
18
- exitCode: 1,
19
- nextSteps: ["unset PRISMA_SERVICE_TOKEN", "prisma-cli auth workspace list"]
20
- });
21
- }
22
- function workspaceNotAuthenticatedError(workspaceRef) {
23
- return new CliError({
24
- code: "WORKSPACE_NOT_AUTHENTICATED",
25
- domain: "auth",
26
- summary: "Workspace is not authenticated",
27
- why: `No stored OAuth session matched "${workspaceRef}".`,
28
- fix: "Run prisma-cli auth login and authorize that workspace, then switch to it.",
29
- meta: { workspaceRef },
30
- exitCode: 1,
31
- nextSteps: ["prisma-cli auth workspace list", "prisma-cli auth login"]
32
- });
33
- }
34
- function workspaceAmbiguousError(workspaceRef, matches) {
35
- return new CliError({
36
- code: "WORKSPACE_AMBIGUOUS",
37
- domain: "auth",
38
- summary: "Workspace name is ambiguous",
39
- why: `Multiple authenticated workspaces matched "${workspaceRef}".`,
40
- fix: "Run prisma-cli auth workspace list and switch by workspace id.",
41
- meta: {
42
- workspaceRef,
43
- matches
44
- },
45
- exitCode: 2,
46
- nextSteps: ["prisma-cli auth workspace list"]
47
- });
48
- }
49
- //#endregion
50
- export { workspaceAmbiguousError, workspaceNotAuthenticatedError, workspaceSwitchUnavailableError };
@@ -1,39 +0,0 @@
1
- import { CLIENT_ID, UNUSED_REDIRECT_URI, getApiBaseUrl } from "./client.js";
2
- import { FileTokenStorage } from "./token-storage.js";
3
- import { createManagementApiClient, createManagementApiSdk } from "@prisma/management-api-sdk";
4
- import { SERVICE_TOKEN_ENV_VAR } from "@prisma/cli-engine";
5
- //#region src/auth/guard.ts
6
- /**
7
- * Resolve authentication and return a ManagementApiClient.
8
- *
9
- * Priority:
10
- * 1. PRISMA_SERVICE_TOKEN env var → service token (CI / headless)
11
- * 2. Stored OAuth tokens → SDK with auto-refresh
12
- *
13
- * Returns null if not authenticated.
14
- */
15
- async function authenticatedManagementApiClient(env = process.env, signal) {
16
- signal?.throwIfAborted();
17
- const rawToken = env[SERVICE_TOKEN_ENV_VAR];
18
- if (rawToken !== void 0) {
19
- const token = rawToken.trim();
20
- if (token.length === 0) throw new Error(`${SERVICE_TOKEN_ENV_VAR} is set but empty. Provide a valid token or unset the variable.`);
21
- return createManagementApiClient({
22
- baseUrl: getApiBaseUrl(env),
23
- token
24
- });
25
- }
26
- const tokenStorage = new FileTokenStorage(env, signal, {
27
- activateOnSetTokens: false,
28
- lockSetTokens: false
29
- });
30
- if (!await tokenStorage.getTokens()) return null;
31
- return createManagementApiSdk({
32
- clientId: CLIENT_ID,
33
- redirectUri: UNUSED_REDIRECT_URI,
34
- tokenStorage,
35
- apiBaseUrl: getApiBaseUrl(env)
36
- }).client;
37
- }
38
- //#endregion
39
- export { authenticatedManagementApiClient };