@prisma/cli 3.0.0-beta.1 → 3.0.0-beta.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 (61) hide show
  1. package/README.md +5 -3
  2. package/dist/adapters/git.js +8 -3
  3. package/dist/adapters/local-state.js +12 -4
  4. package/dist/adapters/mock-api.js +81 -2
  5. package/dist/adapters/token-storage.js +63 -22
  6. package/dist/cli.js +17 -2
  7. package/dist/cli2.js +7 -3
  8. package/dist/commands/app/index.js +22 -10
  9. package/dist/commands/branch/index.js +2 -27
  10. package/dist/commands/database/index.js +159 -0
  11. package/dist/commands/env.js +8 -4
  12. package/dist/controllers/app-env-api.js +54 -0
  13. package/dist/controllers/app-env-file.js +181 -0
  14. package/dist/controllers/app-env.js +283 -129
  15. package/dist/controllers/app.js +247 -106
  16. package/dist/controllers/auth.js +8 -8
  17. package/dist/controllers/branch.js +78 -48
  18. package/dist/controllers/database.js +318 -0
  19. package/dist/controllers/project.js +153 -82
  20. package/dist/lib/app/branch-database-deploy.js +373 -0
  21. package/dist/lib/app/branch-database.js +316 -0
  22. package/dist/lib/app/bun-project.js +12 -5
  23. package/dist/lib/app/deploy-output.js +10 -1
  24. package/dist/lib/app/env-config.js +1 -1
  25. package/dist/lib/app/env-file.js +82 -0
  26. package/dist/lib/app/env-vars.js +28 -2
  27. package/dist/lib/app/local-dev.js +34 -18
  28. package/dist/lib/app/preview-branch-database.js +102 -0
  29. package/dist/lib/app/preview-build-settings.js +385 -0
  30. package/dist/lib/app/preview-build.js +272 -81
  31. package/dist/lib/app/preview-provider.js +163 -54
  32. package/dist/lib/app/production-deploy-gate.js +161 -0
  33. package/dist/lib/auth/auth-ops.js +30 -21
  34. package/dist/lib/auth/guard.js +3 -2
  35. package/dist/lib/auth/login.js +109 -14
  36. package/dist/lib/database/provider.js +167 -0
  37. package/dist/lib/diagnostics.js +15 -0
  38. package/dist/lib/git/local-branch.js +41 -0
  39. package/dist/lib/git/local-status.js +57 -0
  40. package/dist/lib/project/interactive-setup.js +1 -1
  41. package/dist/lib/project/local-pin.js +182 -33
  42. package/dist/lib/project/resolution.js +203 -49
  43. package/dist/lib/project/setup.js +59 -15
  44. package/dist/presenters/app-env.js +149 -14
  45. package/dist/presenters/app.js +170 -20
  46. package/dist/presenters/branch.js +37 -102
  47. package/dist/presenters/database.js +274 -0
  48. package/dist/presenters/project.js +63 -39
  49. package/dist/presenters/verbose-context.js +64 -0
  50. package/dist/shell/command-meta.js +103 -13
  51. package/dist/shell/command-runner.js +34 -6
  52. package/dist/shell/diagnostics-output.js +63 -0
  53. package/dist/shell/errors.js +12 -1
  54. package/dist/shell/output.js +10 -1
  55. package/dist/shell/runtime.js +3 -3
  56. package/dist/shell/ui.js +23 -1
  57. package/dist/shell/update-check.js +247 -0
  58. package/dist/use-cases/branch.js +20 -68
  59. package/dist/use-cases/create-cli-gateways.js +2 -17
  60. package/dist/use-cases/project.js +2 -1
  61. package/package.json +12 -10
@@ -0,0 +1,274 @@
1
+ import { formatColumns, renderSummaryLine } from "../shell/ui.js";
2
+ import { formatDescriptorLabel } from "../shell/command-meta.js";
3
+ import { renderMutate, renderShow, serializeList } from "../output/patterns.js";
4
+ import { renderResolvedProjectContextBlock, stripVerboseContext } from "./verbose-context.js";
5
+ //#region src/presenters/database.ts
6
+ function renderDatabaseList(context, descriptor, result) {
7
+ const ui = context.ui;
8
+ const lines = [`${ui.strong(formatDescriptorLabel(descriptor))} ${ui.dim("→")} ${ui.dim("Listing databases for the resolved project.")}`, ""];
9
+ const rail = ui.dim("│");
10
+ lines.push(`${rail} ${ui.accent("project:")} ${result.projectName}`);
11
+ if (result.branchName) lines.push(`${rail} ${ui.accent("branch:")} ${result.branchName}`);
12
+ lines.push(rail);
13
+ if (result.databases.length === 0) {
14
+ lines.push(`${rail} ${ui.dim("No databases found.")}`);
15
+ lines.push(...renderResolvedProjectContextBlock(context.ui, result.verboseContext));
16
+ return lines;
17
+ }
18
+ const rows = result.databases.map((database) => [
19
+ database.name,
20
+ database.branchName ?? "unscoped",
21
+ database.region ?? "unknown",
22
+ formatStatus(database),
23
+ database.id
24
+ ]);
25
+ const widths = [
26
+ Math.max(4, ...rows.map((row) => row[0].length)),
27
+ Math.max(6, ...rows.map((row) => row[1].length)),
28
+ Math.max(6, ...rows.map((row) => row[2].length)),
29
+ Math.max(6, ...rows.map((row) => row[3].length)),
30
+ Math.max(2, ...rows.map((row) => row[4].length))
31
+ ];
32
+ lines.push(`${rail} ${ui.accent(formatColumns([
33
+ "Name",
34
+ "Branch",
35
+ "Region",
36
+ "Status",
37
+ "Id"
38
+ ], widths))}`);
39
+ for (const row of rows) lines.push(`${rail} ${formatColumns(row, widths)}`);
40
+ lines.push(...renderResolvedProjectContextBlock(context.ui, result.verboseContext));
41
+ return lines;
42
+ }
43
+ function serializeDatabaseList(result) {
44
+ return {
45
+ ...serializeList({
46
+ context: {
47
+ project: result.projectName,
48
+ ...result.branchName ? { branch: result.branchName } : {}
49
+ },
50
+ items: result.databases.map((database) => ({
51
+ noun: "database",
52
+ label: database.name,
53
+ id: database.id,
54
+ status: database.isDefault ? "default" : null
55
+ }))
56
+ }),
57
+ projectId: result.projectId,
58
+ branchName: result.branchName,
59
+ databases: result.databases
60
+ };
61
+ }
62
+ function renderDatabaseShow(context, descriptor, result) {
63
+ const lines = renderShow({
64
+ title: "Showing database metadata.",
65
+ descriptor,
66
+ fields: [
67
+ {
68
+ key: "project",
69
+ value: result.projectName
70
+ },
71
+ {
72
+ key: "database",
73
+ value: result.database.name
74
+ },
75
+ {
76
+ key: "id",
77
+ value: result.database.id,
78
+ tone: "dim"
79
+ },
80
+ {
81
+ key: "branch",
82
+ value: result.database.branchName ?? "unscoped",
83
+ tone: result.database.branchName ? "default" : "dim"
84
+ },
85
+ {
86
+ key: "region",
87
+ value: result.database.region ?? "unknown",
88
+ tone: result.database.region ? "default" : "dim"
89
+ },
90
+ {
91
+ key: "status",
92
+ value: formatStatus(result.database)
93
+ },
94
+ {
95
+ key: "connections",
96
+ value: String(result.connections.length)
97
+ }
98
+ ]
99
+ }, context.ui);
100
+ lines.push(...renderResolvedProjectContextBlock(context.ui, result.verboseContext));
101
+ return lines;
102
+ }
103
+ function serializeDatabaseShow(result) {
104
+ return stripVerboseContext(result);
105
+ }
106
+ function renderDatabaseCreateStdout(_context, _descriptor, result) {
107
+ return [result.connectionString];
108
+ }
109
+ function renderDatabaseCreate(context, _descriptor, result) {
110
+ const ui = context.ui;
111
+ const lines = [
112
+ "Creating database...",
113
+ renderSummaryLine(ui, "success", `Created database "${result.database.name}" in ${formatDatabaseTarget(result.projectName, result.database.branchName)}.`),
114
+ " The connection URL below is shown once, so save it now."
115
+ ];
116
+ if (ui.verbose) {
117
+ lines.push("");
118
+ lines.push(...renderDatabaseCreateVerboseRows(context, result));
119
+ }
120
+ return lines;
121
+ }
122
+ function serializeDatabaseCreate(result) {
123
+ return stripVerboseContext(result);
124
+ }
125
+ function renderDatabaseRemove(context, descriptor, result) {
126
+ const lines = renderMutate({
127
+ title: "Removing database.",
128
+ descriptor,
129
+ context: [
130
+ {
131
+ key: "project",
132
+ value: result.projectName
133
+ },
134
+ {
135
+ key: "database",
136
+ value: result.database.name
137
+ },
138
+ {
139
+ key: "id",
140
+ value: result.database.id,
141
+ tone: "dim"
142
+ }
143
+ ],
144
+ operationDescription: "Removing database",
145
+ operationCount: 1,
146
+ details: ["Database and its connection metadata were removed."]
147
+ }, context.ui);
148
+ lines.push(...renderResolvedProjectContextBlock(context.ui, result.verboseContext));
149
+ return lines;
150
+ }
151
+ function serializeDatabaseRemove(result) {
152
+ return stripVerboseContext(result);
153
+ }
154
+ function renderDatabaseConnectionList(context, descriptor, result) {
155
+ const ui = context.ui;
156
+ const lines = [`${ui.strong(formatDescriptorLabel(descriptor))} ${ui.dim("→")} ${ui.dim("Listing database connection metadata.")}`, ""];
157
+ const rail = ui.dim("│");
158
+ lines.push(`${rail} ${ui.accent("database:")} ${result.database.name}`);
159
+ lines.push(rail);
160
+ if (result.connections.length === 0) {
161
+ lines.push(`${rail} ${ui.dim("No database connections found.")}`);
162
+ lines.push(...renderResolvedProjectContextBlock(context.ui, result.verboseContext));
163
+ return lines;
164
+ }
165
+ const rows = result.connections.map((connection) => [
166
+ connection.name,
167
+ connection.id,
168
+ connection.createdAt ?? "unknown"
169
+ ]);
170
+ const widths = [
171
+ Math.max(4, ...rows.map((row) => row[0].length)),
172
+ Math.max(2, ...rows.map((row) => row[1].length)),
173
+ Math.max(7, ...rows.map((row) => row[2].length))
174
+ ];
175
+ lines.push(`${rail} ${ui.accent(formatColumns([
176
+ "Name",
177
+ "Id",
178
+ "Created"
179
+ ], widths))}`);
180
+ for (const row of rows) lines.push(`${rail} ${formatColumns(row, widths)}`);
181
+ lines.push(...renderResolvedProjectContextBlock(context.ui, result.verboseContext));
182
+ return lines;
183
+ }
184
+ function serializeDatabaseConnectionList(result) {
185
+ return {
186
+ ...serializeList({
187
+ context: {
188
+ project: result.projectName,
189
+ database: result.database.name
190
+ },
191
+ items: result.connections.map((connection) => ({
192
+ noun: "connection",
193
+ label: connection.name,
194
+ id: connection.id,
195
+ status: null
196
+ }))
197
+ }),
198
+ projectId: result.projectId,
199
+ database: result.database,
200
+ connections: result.connections
201
+ };
202
+ }
203
+ function renderDatabaseConnectionCreateStdout(_context, _descriptor, result) {
204
+ return [result.connectionString];
205
+ }
206
+ function renderDatabaseConnectionCreate(context, _descriptor, result) {
207
+ const ui = context.ui;
208
+ const lines = [
209
+ "Creating connection...",
210
+ renderSummaryLine(ui, "success", `Added a connection to "${result.database.name}" in ${formatDatabaseTarget(result.projectName, result.database.branchName)}.`),
211
+ " The connection URL below is shown once, so save it now."
212
+ ];
213
+ if (ui.verbose) {
214
+ lines.push("");
215
+ lines.push(...renderDatabaseConnectionCreateVerboseRows(context, result));
216
+ }
217
+ return lines;
218
+ }
219
+ function serializeDatabaseConnectionCreate(result) {
220
+ return stripVerboseContext(result);
221
+ }
222
+ function renderDatabaseConnectionRemove(context, descriptor, result) {
223
+ return renderMutate({
224
+ title: "Removing database connection.",
225
+ descriptor,
226
+ context: [{
227
+ key: "connection",
228
+ value: result.connection.id,
229
+ tone: "dim"
230
+ }],
231
+ operationDescription: "Removing database connection",
232
+ operationCount: 1,
233
+ details: ["The connection metadata was removed. Existing one-time secrets were not shown."]
234
+ }, context.ui);
235
+ }
236
+ function serializeDatabaseConnectionRemove(result) {
237
+ return result;
238
+ }
239
+ function formatStatus(database) {
240
+ return database.status ?? (database.isDefault ? "default" : "unknown");
241
+ }
242
+ function formatDatabaseTarget(projectName, branchName) {
243
+ return branchName ? `${projectName} / ${branchName}` : projectName;
244
+ }
245
+ function renderDatabaseCreateVerboseRows(context, result) {
246
+ return renderMetadataRows([
247
+ ...renderWorkspaceProjectRows(result),
248
+ ["branch", result.database.branchName ?? "unscoped"],
249
+ ["database", formatResourceWithId(context, result.database.name, result.database.id)],
250
+ ["region", result.database.region ?? "unknown"],
251
+ ["status", formatStatus(result.database)],
252
+ ["connection", formatResourceWithId(context, result.connection.name, result.connection.id)]
253
+ ]);
254
+ }
255
+ function renderDatabaseConnectionCreateVerboseRows(context, result) {
256
+ return renderMetadataRows([
257
+ ...renderWorkspaceProjectRows(result),
258
+ ["branch", result.database.branchName ?? "unscoped"],
259
+ ["database", formatResourceWithId(context, result.database.name, result.database.id)],
260
+ ["connection", formatResourceWithId(context, result.connection.name, result.connection.id)]
261
+ ]);
262
+ }
263
+ function renderWorkspaceProjectRows(result) {
264
+ return [...result.verboseContext ? [["workspace", result.verboseContext.workspace.name]] : [], ["project", result.projectName]];
265
+ }
266
+ function formatResourceWithId(context, name, id) {
267
+ return `${name} ${context.ui.dim(`(${id})`)}`;
268
+ }
269
+ function renderMetadataRows(rows) {
270
+ const widths = [Math.max(...rows.map((row) => row[0].length)), 0];
271
+ return rows.map(([key, value]) => ` ${formatColumns([key, value], widths)}`);
272
+ }
273
+ //#endregion
274
+ export { renderDatabaseConnectionCreate, renderDatabaseConnectionCreateStdout, renderDatabaseConnectionList, renderDatabaseConnectionRemove, renderDatabaseCreate, renderDatabaseCreateStdout, renderDatabaseList, renderDatabaseRemove, renderDatabaseShow, serializeDatabaseConnectionCreate, serializeDatabaseConnectionList, serializeDatabaseConnectionRemove, serializeDatabaseCreate, serializeDatabaseList, serializeDatabaseRemove, serializeDatabaseShow };
@@ -1,23 +1,25 @@
1
- import { renderNextSteps, renderSummaryLine } from "../shell/ui.js";
1
+ import { padDisplay, renderNextSteps, renderSummaryLine, renderVerboseBlock } from "../shell/ui.js";
2
+ import { formatDescriptorLabel } from "../shell/command-meta.js";
2
3
  import { formatCommandArgument } from "../shell/command-arguments.js";
3
- import { renderList, renderMutate, renderShow, serializeList } from "../output/patterns.js";
4
+ import { renderMutate, renderShow, serializeList } from "../output/patterns.js";
5
+ import { renderResolvedProjectContextBlock } from "./verbose-context.js";
6
+ import path from "node:path";
7
+ import stringWidth from "string-width";
4
8
  //#region src/presenters/project.ts
5
9
  function renderProjectList(context, descriptor, result) {
6
- const lines = renderList({
7
- title: "Listing projects for the authenticated workspace.",
8
- descriptor,
9
- parentContext: {
10
- key: "workspace",
11
- value: result.workspace.name
12
- },
13
- items: result.projects.map((project) => ({
14
- noun: "project",
15
- label: project.name,
16
- id: project.id,
17
- status: null
18
- })),
19
- emptyMessage: "No projects found."
20
- }, context.ui);
10
+ const ui = context.ui;
11
+ const rail = ui.dim("│");
12
+ const lines = [`${ui.strong(formatDescriptorLabel(descriptor))} ${ui.dim("→")} ${ui.dim("Listing projects for the authenticated workspace.")}`, ""];
13
+ lines.push(`${rail} ${ui.accent("workspace:")} ${result.workspace.name}`);
14
+ if (result.projects.length === 0) {
15
+ lines.push(`${rail} ${ui.dim("No projects found.")}`);
16
+ if (result.localBinding?.status === "not-linked" || result.localBinding?.status === "invalid") lines.push(...renderNextSteps(["Link an existing Project you choose: prisma-cli project link <id-or-name>", "Create a new Project: prisma-cli project create <name>"]));
17
+ return lines;
18
+ }
19
+ const nameWidth = Math.max(4, ...result.projects.map((project) => stringWidth(project.name)));
20
+ lines.push(rail);
21
+ lines.push(`${rail} ${ui.accent(padDisplay("name", nameWidth))} ${ui.accent("id")}`);
22
+ for (const project of result.projects) lines.push(`${rail} ${padDisplay(project.name, nameWidth)} ${project.id}`);
21
23
  if (result.localBinding?.status === "not-linked" || result.localBinding?.status === "invalid") lines.push(...renderNextSteps(["Link an existing Project you choose: prisma-cli project link <id-or-name>", "Create a new Project: prisma-cli project create <name>"]));
22
24
  return lines;
23
25
  }
@@ -49,27 +51,29 @@ function renderProjectShow(context, descriptor, result) {
49
51
  tone: "warning"
50
52
  }]
51
53
  }, context.ui);
52
- lines.push(...renderNextSteps(["Link an existing Project you choose: prisma-cli project link <id-or-name>", `Create a new Project: prisma-cli project create ${formatCommandArgument(result.suggestedProjectName)}`]));
53
- return lines;
54
- }
55
- return renderShow({
56
- title: "Showing this directory's Project binding.",
57
- descriptor,
58
- fields: [
54
+ lines.push(...renderVerboseBlock(context.ui, [
59
55
  {
60
56
  key: "workspace",
61
57
  value: result.workspace.name
62
58
  },
63
59
  {
64
- key: "project",
65
- value: result.project.name
60
+ key: "workspace id",
61
+ value: result.workspace.id,
62
+ tone: "dim"
66
63
  },
67
64
  {
68
- key: "resolution",
69
- value: formatProjectSource(result.resolution.projectSource)
65
+ key: "project source",
66
+ value: "unbound"
67
+ },
68
+ {
69
+ key: "suggested name",
70
+ value: `${result.suggestedProjectName} (${result.suggestedProjectNameSource})`
70
71
  }
71
- ]
72
- }, context.ui);
72
+ ], { title: "Resolved context" }));
73
+ lines.push(...renderNextSteps(["Link an existing Project you choose: prisma-cli project link <id-or-name>", `Create a new Project: prisma-cli project create ${formatCommandArgument(result.suggestedProjectName)}`]));
74
+ return lines;
75
+ }
76
+ return renderBoundProjectShow(context, descriptor, result);
73
77
  }
74
78
  function serializeProjectShow(result) {
75
79
  return result;
@@ -133,16 +137,36 @@ function renderGitDisconnect(context, descriptor, result) {
133
137
  details: ["GitHub branch automation is no longer active for this project."]
134
138
  }, context.ui);
135
139
  }
136
- function formatProjectSource(source) {
137
- switch (source) {
138
- case "explicit": return "explicit";
139
- case "env": return "environment";
140
- case "local-pin": return "local pin";
141
- case "platform-mapping": return "platform mapping";
142
- case "created": return "created";
143
- case "prompt": return "prompt";
144
- case "unbound": return "unbound";
140
+ function renderBoundProjectShow(context, descriptor, result) {
141
+ const { ui } = context;
142
+ const rail = ui.dim("");
143
+ const keyWidth = 10;
144
+ const platform = `${result.workspace.name} / ${result.project.name}`;
145
+ const lines = [
146
+ `${ui.strong(formatDescriptorLabel(descriptor))} ${ui.dim("")} ${ui.dim("This directory is linked to the following platform project.")}`,
147
+ "",
148
+ `${rail} ${ui.accent(padDisplay("local repo", keyWidth))} ${formatLocalRepoPath(context.runtime.cwd, context.runtime.env)}`,
149
+ `${rail} ${ui.accent(padDisplay("platform", keyWidth))} ${ui.strong(platform)}`
150
+ ];
151
+ if (result.project.url) {
152
+ lines.push(rail);
153
+ lines.push(`${rail} ${ui.dim("→")} ${ui.link(result.project.url)}`);
154
+ }
155
+ lines.push(...renderResolvedProjectContextBlock(context.ui, {
156
+ workspace: result.workspace,
157
+ project: result.project,
158
+ resolution: result.resolution
159
+ }));
160
+ return lines;
161
+ }
162
+ function formatLocalRepoPath(cwd, env) {
163
+ const resolved = path.resolve(cwd);
164
+ const home = env.HOME ? path.resolve(env.HOME) : null;
165
+ if (home && (resolved === home || resolved.startsWith(`${home}${path.sep}`))) {
166
+ const relative = path.relative(home, resolved);
167
+ return relative ? `~/${relative}` : "~";
145
168
  }
169
+ return resolved;
146
170
  }
147
171
  function formatGitConnectionDetail(status) {
148
172
  switch (status) {
@@ -0,0 +1,64 @@
1
+ import { renderVerboseBlock } from "../shell/ui.js";
2
+ //#region src/presenters/verbose-context.ts
3
+ function renderResolvedProjectContextBlock(ui, context, options = {}) {
4
+ if (!context) return [];
5
+ return renderVerboseBlock(ui, [...projectResolutionRows(context), ...options.extraRows ?? []], { title: options.title ?? "Resolved context" });
6
+ }
7
+ function projectResolutionRows(context) {
8
+ return [
9
+ {
10
+ key: "workspace",
11
+ value: context.workspace.name
12
+ },
13
+ {
14
+ key: "workspace id",
15
+ value: context.workspace.id,
16
+ tone: "dim"
17
+ },
18
+ {
19
+ key: "project",
20
+ value: context.project.name
21
+ },
22
+ {
23
+ key: "project id",
24
+ value: context.project.id,
25
+ tone: "dim"
26
+ },
27
+ {
28
+ key: "project source",
29
+ value: formatProjectSource(context.resolution.projectSource)
30
+ },
31
+ ...context.resolution.targetName ? [{
32
+ key: "target name",
33
+ value: formatTargetName(context.resolution)
34
+ }] : [],
35
+ ...context.branch ? [{
36
+ key: "branch",
37
+ value: `${context.branch.name} (${context.branch.kind})`
38
+ }, ...context.branch.id ? [{
39
+ key: "branch id",
40
+ value: context.branch.id,
41
+ tone: "dim"
42
+ }] : []] : []
43
+ ];
44
+ }
45
+ function stripVerboseContext(result) {
46
+ const { verboseContext: _verboseContext, ...serialized } = result;
47
+ return serialized;
48
+ }
49
+ function formatProjectSource(source) {
50
+ switch (source) {
51
+ case "explicit": return "--project";
52
+ case "env": return "environment";
53
+ case "local-pin": return ".prisma/local.json";
54
+ case "platform-mapping": return "platform mapping";
55
+ case "created": return "created";
56
+ case "prompt": return "prompt";
57
+ case "unbound": return "unbound";
58
+ }
59
+ }
60
+ function formatTargetName(resolution) {
61
+ return resolution.targetNameSource ? `${resolution.targetName} (${resolution.targetNameSource})` : String(resolution.targetName);
62
+ }
63
+ //#endregion
64
+ export { renderResolvedProjectContextBlock, stripVerboseContext };
@@ -69,8 +69,18 @@ const DESCRIPTORS = [
69
69
  {
70
70
  id: "branch",
71
71
  path: ["prisma", "branch"],
72
- description: "View your active Platform branches",
73
- examples: ["prisma-cli branch list", "prisma-cli branch show"]
72
+ description: "View your Platform branches",
73
+ examples: ["prisma-cli branch list"]
74
+ },
75
+ {
76
+ id: "database",
77
+ path: ["prisma", "database"],
78
+ description: "Manage Prisma Postgres databases for a project",
79
+ examples: [
80
+ "prisma-cli database list",
81
+ "prisma-cli database create my-db",
82
+ "prisma-cli database connection create db_123"
83
+ ]
74
84
  },
75
85
  {
76
86
  id: "git",
@@ -153,28 +163,99 @@ const DESCRIPTORS = [
153
163
  "branch",
154
164
  "list"
155
165
  ],
156
- description: "List active Platform branches for the resolved project",
166
+ description: "List Platform branches for the resolved project",
157
167
  examples: ["prisma-cli branch list", "prisma-cli branch list --json"]
158
168
  },
159
169
  {
160
- id: "branch.show",
170
+ id: "database.list",
161
171
  path: [
162
172
  "prisma",
163
- "branch",
173
+ "database",
174
+ "list"
175
+ ],
176
+ description: "List Prisma Postgres databases for the resolved project",
177
+ examples: [
178
+ "prisma-cli database list",
179
+ "prisma-cli database list --branch feature/foo",
180
+ "prisma-cli database list --json"
181
+ ]
182
+ },
183
+ {
184
+ id: "database.show",
185
+ path: [
186
+ "prisma",
187
+ "database",
164
188
  "show"
165
189
  ],
166
- description: "Show the Platform branch matching your current Git branch",
167
- examples: ["prisma-cli branch show", "prisma-cli branch show --json"]
190
+ description: "Show database metadata without secret values",
191
+ examples: ["prisma-cli database show db_123", "prisma-cli database show acme-preview --branch preview --json"]
168
192
  },
169
193
  {
170
- id: "branch.use",
194
+ id: "database.create",
171
195
  path: [
172
196
  "prisma",
173
- "branch",
174
- "use"
197
+ "database",
198
+ "create"
199
+ ],
200
+ description: "Create a Prisma Postgres database and print its one-time connection URL",
201
+ examples: ["prisma-cli database create my-db", "prisma-cli database create my-db --branch feature/foo --region eu-central-1"]
202
+ },
203
+ {
204
+ id: "database.remove",
205
+ path: [
206
+ "prisma",
207
+ "database",
208
+ "remove"
175
209
  ],
176
- description: "Change the local default branch context.",
177
- examples: ["prisma-cli branch use", "prisma-cli branch use production"]
210
+ description: "Remove a database after exact id confirmation",
211
+ examples: ["prisma-cli database remove db_123 --confirm db_123"]
212
+ },
213
+ {
214
+ id: "database.connection",
215
+ path: [
216
+ "prisma",
217
+ "database",
218
+ "connection"
219
+ ],
220
+ description: "Manage one-time-view database connection strings",
221
+ examples: [
222
+ "prisma-cli database connection list db_123",
223
+ "prisma-cli database connection create db_123",
224
+ "prisma-cli database connection remove conn_123 --confirm conn_123"
225
+ ]
226
+ },
227
+ {
228
+ id: "database.connection.list",
229
+ path: [
230
+ "prisma",
231
+ "database",
232
+ "connection",
233
+ "list"
234
+ ],
235
+ description: "List database connection metadata without secret values",
236
+ examples: ["prisma-cli database connection list db_123", "prisma-cli database connection list acme-preview --branch preview --json"]
237
+ },
238
+ {
239
+ id: "database.connection.create",
240
+ path: [
241
+ "prisma",
242
+ "database",
243
+ "connection",
244
+ "create"
245
+ ],
246
+ description: "Create a database connection and print its one-time connection URL",
247
+ examples: ["prisma-cli database connection create db_123", "prisma-cli database connection create db_123 --name readonly"]
248
+ },
249
+ {
250
+ id: "database.connection.remove",
251
+ path: [
252
+ "prisma",
253
+ "database",
254
+ "connection",
255
+ "remove"
256
+ ],
257
+ description: "Remove a database connection after exact id confirmation",
258
+ examples: ["prisma-cli database connection remove conn_123 --confirm conn_123"]
178
259
  },
179
260
  {
180
261
  id: "app.build",
@@ -214,8 +295,12 @@ const DESCRIPTORS = [
214
295
  "prisma-cli app deploy --project proj_123",
215
296
  "prisma-cli app deploy --create-project my-app --yes",
216
297
  "prisma-cli app deploy --app my-app --env DATABASE_URL=postgresql://example",
298
+ "prisma-cli app deploy --env .env",
299
+ "prisma-cli app deploy --db",
300
+ "prisma-cli app deploy --db --yes",
217
301
  "prisma-cli app deploy --app my-app --framework nextjs --http-port 3000",
218
302
  "prisma-cli app deploy --branch feat-login --framework hono",
303
+ "prisma-cli app deploy --prod --yes",
219
304
  "pnpm dlx skills@latest add prisma/prisma-cli/skills#cli-v<cli-version> --all",
220
305
  "prisma-cli app deploy --framework bun --entry src/server.ts"
221
306
  ]
@@ -378,8 +463,9 @@ const DESCRIPTORS = [
378
463
  ],
379
464
  description: "Manage environment variables for the active project",
380
465
  examples: [
381
- "prisma-cli project env list --role production",
466
+ "prisma-cli project env list",
382
467
  "prisma-cli project env add STRIPE_KEY=sk_test_xxx --role production",
468
+ "prisma-cli project env add --file .env --role preview",
383
469
  "prisma-cli project env add DATABASE_URL=postgresql://branch --branch feature/foo",
384
470
  "prisma-cli project env remove STRIPE_KEY --role preview"
385
471
  ]
@@ -396,7 +482,9 @@ const DESCRIPTORS = [
396
482
  examples: [
397
483
  "prisma-cli project env add STRIPE_KEY=sk_test_xxx --role production",
398
484
  "prisma-cli project env add STRIPE_KEY=sk_test_xxx --role preview",
485
+ "prisma-cli project env add --file .env --role preview",
399
486
  "prisma-cli project env add DATABASE_URL=postgresql://branch --branch feature/foo",
487
+ "prisma-cli project env add --file .env.local --branch feature/foo",
400
488
  "API_URL=https://api.example prisma-cli project env add API_URL --project proj_123 --role preview"
401
489
  ]
402
490
  },
@@ -412,6 +500,7 @@ const DESCRIPTORS = [
412
500
  examples: [
413
501
  "prisma-cli project env update STRIPE_KEY=sk_new_xxx --role production",
414
502
  "prisma-cli project env update STRIPE_KEY=sk_new_xxx --role preview",
503
+ "prisma-cli project env update --file .env --role production",
415
504
  "prisma-cli project env update DATABASE_URL=postgresql://branch --branch feature/foo"
416
505
  ]
417
506
  },
@@ -425,6 +514,7 @@ const DESCRIPTORS = [
425
514
  ],
426
515
  description: "List environment variable metadata for a scope (no values).",
427
516
  examples: [
517
+ "prisma-cli project env list",
428
518
  "prisma-cli project env list --role production",
429
519
  "prisma-cli project env list --role preview",
430
520
  "prisma-cli project env list --branch feature/foo"