@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,268 +0,0 @@
1
- import { formatCommandArgument } from "../command-arguments.js";
2
- import { formatDescriptorLabel } from "../shell/command-meta.js";
3
- import { padDisplay, renderNextSteps, renderSummaryLine, renderVerboseBlock } from "../shell/ui.js";
4
- import { shortenHomePath } from "../lib/fs/home-path.js";
5
- import { renderMutate, renderShow, serializeList } from "../output/patterns.js";
6
- import { renderResolvedProjectContextBlock } from "./verbose-context.js";
7
- import stringWidth from "string-width";
8
- //#region src/presenters/project.ts
9
- function renderProjectList(context, descriptor, result) {
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
- const idWidth = Math.max(2, ...result.projects.map((project) => project.id.length));
21
- lines.push(rail);
22
- lines.push(`${rail} ${ui.accent(padDisplay("name", nameWidth))} ${ui.accent(padDisplay("id", idWidth))} ${ui.accent("region")}`);
23
- for (const project of result.projects) {
24
- const region = project.defaultRegion ? project.defaultRegion : ui.dim("none");
25
- lines.push(`${rail} ${padDisplay(project.name, nameWidth)} ${padDisplay(project.id, idWidth)} ${region}`);
26
- }
27
- 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>"]));
28
- return lines;
29
- }
30
- function serializeProjectList(result) {
31
- return {
32
- ...serializeList({
33
- context: { workspace: result.workspace.name },
34
- items: result.projects.map((project) => ({
35
- noun: "project",
36
- label: project.name,
37
- id: project.id,
38
- status: null
39
- }))
40
- }),
41
- localBinding: result.localBinding ?? null
42
- };
43
- }
44
- function renderProjectShow(context, descriptor, result) {
45
- if (result.project === null) {
46
- const lines = renderShow({
47
- title: "This directory is not linked to a Prisma Project.",
48
- descriptor,
49
- fields: [{
50
- key: "workspace",
51
- value: result.workspace.name
52
- }, {
53
- key: "project",
54
- value: "Not linked",
55
- tone: "warning"
56
- }]
57
- }, context.ui);
58
- lines.push(...renderVerboseBlock(context.ui, [
59
- {
60
- key: "workspace",
61
- value: result.workspace.name
62
- },
63
- {
64
- key: "workspace id",
65
- value: result.workspace.id,
66
- tone: "dim"
67
- },
68
- {
69
- key: "project source",
70
- value: "unbound"
71
- },
72
- {
73
- key: "suggested name",
74
- value: `${result.suggestedProjectName} (${result.suggestedProjectNameSource})`
75
- }
76
- ], { title: "Resolved context" }));
77
- 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)}`]));
78
- return lines;
79
- }
80
- return renderBoundProjectShow(context, descriptor, result);
81
- }
82
- function serializeProjectShow(result) {
83
- return result;
84
- }
85
- function renderProjectSetup(context, _descriptor, result) {
86
- const lines = result.action === "created" ? [renderSummaryLine(context.ui, "success", `Created Project "${result.project.name}"`)] : [];
87
- lines.push(renderSummaryLine(context.ui, "success", `Linked "${result.directory}" to Project "${result.project.name}"`), `Saved ${result.localPin.path}`);
88
- return lines;
89
- }
90
- function serializeProjectSetup(result) {
91
- return result;
92
- }
93
- function renderProjectRename(context, descriptor, result) {
94
- return renderMutate({
95
- title: "Renaming project.",
96
- descriptor,
97
- context: [
98
- {
99
- key: "workspace",
100
- value: result.workspace.name
101
- },
102
- {
103
- key: "project",
104
- value: result.previousName
105
- },
106
- {
107
- key: "id",
108
- value: result.project.id,
109
- tone: "dim"
110
- }
111
- ],
112
- operationDescription: "Renaming project",
113
- operationCount: 1,
114
- details: [`The project is now named "${result.project.name}". Directory bindings pin the project id, so they stay valid.`]
115
- }, context.ui);
116
- }
117
- function serializeProjectRename(result) {
118
- return result;
119
- }
120
- function renderProjectRemove(context, descriptor, result) {
121
- return renderMutate({
122
- title: "Removing project.",
123
- descriptor,
124
- context: [
125
- {
126
- key: "workspace",
127
- value: result.workspace.name
128
- },
129
- {
130
- key: "project",
131
- value: result.project.name
132
- },
133
- {
134
- key: "id",
135
- value: result.project.id,
136
- tone: "dim"
137
- }
138
- ],
139
- operationDescription: "Removing project",
140
- operationCount: 1,
141
- details: ["The project, its databases, and its apps were removed.", ...result.localPin.cleared ? ["This directory's local project binding was cleared."] : []]
142
- }, context.ui);
143
- }
144
- function serializeProjectRemove(result) {
145
- return result;
146
- }
147
- function renderProjectTransfer(context, descriptor, result) {
148
- return renderMutate({
149
- title: "Transferring project.",
150
- descriptor,
151
- context: [
152
- {
153
- key: "workspace",
154
- value: result.workspace.name
155
- },
156
- {
157
- key: "project",
158
- value: result.project.name
159
- },
160
- {
161
- key: "id",
162
- value: result.project.id,
163
- tone: "dim"
164
- },
165
- {
166
- key: "recipient",
167
- value: result.recipient.workspaceName ?? result.recipient.workspaceId ?? "workspace of the provided recipient token"
168
- }
169
- ],
170
- operationDescription: "Transferring project",
171
- operationCount: 1,
172
- details: [
173
- "The project now belongs to the recipient workspace; this workspace no longer has access.",
174
- ...result.localPin.action === "rewritten" ? ["This directory's local project binding now points at the recipient workspace."] : [],
175
- ...result.localPin.action === "cleared" ? ["This directory's local project binding was cleared."] : []
176
- ]
177
- }, context.ui);
178
- }
179
- function serializeProjectTransfer(result) {
180
- return result;
181
- }
182
- function renderGitConnect(context, descriptor, result) {
183
- const connection = result.repositoryConnection;
184
- return renderMutate({
185
- title: "Connecting Git to the resolved project.",
186
- descriptor,
187
- context: [
188
- {
189
- key: "project",
190
- value: result.project.name
191
- },
192
- {
193
- key: "workspace",
194
- value: result.workspace.name
195
- },
196
- {
197
- key: "repository",
198
- value: connection.repository.fullName
199
- },
200
- {
201
- key: "status",
202
- value: connection.status
203
- }
204
- ],
205
- operationDescription: "Applying repository connection",
206
- operationCount: 1,
207
- details: [formatGitConnectionDetail(connection.status)]
208
- }, context.ui);
209
- }
210
- function renderGitDisconnect(context, descriptor, result) {
211
- return renderMutate({
212
- title: "Disconnecting Git from the resolved project.",
213
- descriptor,
214
- context: [
215
- {
216
- key: "project",
217
- value: result.project.name
218
- },
219
- {
220
- key: "workspace",
221
- value: result.workspace.name
222
- },
223
- {
224
- key: "repository",
225
- value: result.repositoryConnection.repository.fullName
226
- }
227
- ],
228
- operationDescription: "Applying repository disconnection",
229
- operationCount: 1,
230
- details: ["GitHub branch automation is no longer active for this project."]
231
- }, context.ui);
232
- }
233
- function renderBoundProjectShow(context, descriptor, result) {
234
- const { ui } = context;
235
- const rail = ui.dim("│");
236
- const keyWidth = 10;
237
- const platform = `${result.workspace.name} / ${result.project.name}`;
238
- const lines = [
239
- `${ui.strong(formatDescriptorLabel(descriptor))} ${ui.dim("→")} ${ui.dim("This directory is linked to the following platform project.")}`,
240
- "",
241
- `${rail} ${ui.accent(padDisplay("local repo", keyWidth))} ${formatLocalRepoPath(context.runtime.cwd, context.runtime.env)}`,
242
- `${rail} ${ui.accent(padDisplay("platform", keyWidth))} ${ui.strong(platform)}`
243
- ];
244
- if (result.project.url) {
245
- lines.push(rail);
246
- lines.push(`${rail} ${ui.dim("→")} ${ui.link(result.project.url)}`);
247
- }
248
- if (result.project.defaultRegion) lines.push(`${rail} ${ui.accent(padDisplay("region", keyWidth))} ${ui.dim(result.project.defaultRegion)}`);
249
- lines.push(...renderResolvedProjectContextBlock(context.ui, {
250
- workspace: result.workspace,
251
- project: result.project,
252
- resolution: result.resolution
253
- }));
254
- return lines;
255
- }
256
- function formatLocalRepoPath(cwd, env) {
257
- return shortenHomePath(cwd, env);
258
- }
259
- function formatGitConnectionDetail(status) {
260
- switch (status) {
261
- case "active": return "GitHub branch automation is active for this project.";
262
- case "pending": return "GitHub branch automation is pending GitHub App installation.";
263
- case "archived": return "GitHub branch automation has been archived for this project.";
264
- default: return "GitHub repository is connected, but branch automation is not active.";
265
- }
266
- }
267
- //#endregion
268
- export { renderGitConnect, renderGitDisconnect, renderProjectList, renderProjectRemove, renderProjectRename, renderProjectSetup, renderProjectShow, renderProjectTransfer, serializeProjectList, serializeProjectRemove, serializeProjectRename, serializeProjectSetup, serializeProjectShow, serializeProjectTransfer };
@@ -1,64 +0,0 @@
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 };
@@ -1,29 +0,0 @@
1
- import { renderShow } from "../output/patterns.js";
2
- //#region src/presenters/version.ts
3
- function renderVersionSuccess(context, descriptor, result) {
4
- return renderShow({
5
- title: "Showing CLI build and environment.",
6
- descriptor,
7
- fields: [
8
- {
9
- key: result.cli.name,
10
- value: result.cli.version
11
- },
12
- {
13
- key: "node",
14
- value: result.node.version
15
- },
16
- {
17
- key: "os",
18
- value: `${result.os.platform} ${result.os.arch}`
19
- },
20
- {
21
- key: "invocation",
22
- value: result.invocation,
23
- tone: result.invocation === "unknown" ? "dim" : "default"
24
- }
25
- ]
26
- }, context.ui);
27
- }
28
- //#endregion
29
- export { renderVersionSuccess };
@@ -1,2 +0,0 @@
1
- import "../cli-command.js";
2
- export {};