@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,184 +0,0 @@
1
- import { formatDescriptorLabel } from "../shell/command-meta.js";
2
- import { padDisplay } from "../shell/ui.js";
3
- import { renderMutate, renderShow } from "../output/patterns.js";
4
- import stringWidth from "string-width";
5
- import { SERVICE_TOKEN_ENV_VAR } from "@prisma/cli-engine";
6
- //#region src/presenters/auth.ts
7
- function renderAuthSuccess(context, descriptor, command, result) {
8
- if (command === "auth.login") {
9
- const rows = [];
10
- if (result.provider) rows.push({
11
- key: "provider",
12
- value: providerLabel(result.provider)
13
- });
14
- const userLabel = authUserLabel(result);
15
- if (userLabel) rows.push({
16
- key: "user",
17
- value: userLabel
18
- });
19
- if (result.workspace?.name) rows.push({
20
- key: "workspace",
21
- value: result.workspace.name
22
- });
23
- return renderMutate({
24
- title: "Starting an authenticated CLI session.",
25
- descriptor,
26
- context: rows,
27
- operationDescription: "Applying authentication session changes",
28
- operationCount: 1,
29
- details: ["Session stored in local CLI state.", ...result.agentSetupTip ? [`Install Prisma skills for this project with ${result.agentSetupTip.command}.`] : []]
30
- }, context.ui);
31
- }
32
- if (command === "auth.logout") return renderMutate({
33
- title: "Clearing the current CLI session.",
34
- descriptor,
35
- context: [{
36
- key: "session",
37
- value: "local CLI state",
38
- tone: "dim"
39
- }],
40
- operationDescription: "Applying authentication session changes",
41
- operationCount: 1,
42
- details: ["Session removed from local CLI state."]
43
- }, context.ui);
44
- return renderShow({
45
- title: "Showing the current authenticated identity.",
46
- descriptor,
47
- fields: result.authenticated ? [
48
- {
49
- key: "status",
50
- value: "signed in",
51
- tone: "success"
52
- },
53
- ...authUserRows(result),
54
- ...result.provider ? [{
55
- key: "provider",
56
- value: providerLabel(result.provider)
57
- }] : [],
58
- ...result.workspace?.name ? [{
59
- key: "workspace",
60
- value: result.workspace.name
61
- }] : []
62
- ] : [{
63
- key: "status",
64
- value: "signed out",
65
- tone: "dim"
66
- }]
67
- }, context.ui);
68
- }
69
- function renderAuthWorkspaceList(context, descriptor, result) {
70
- const ui = context.ui;
71
- const rail = ui.dim("│");
72
- const lines = [
73
- `${ui.strong(formatDescriptorLabel(descriptor))} ${ui.dim("→")} ${ui.dim("Listing authenticated workspaces on this machine.")}`,
74
- "",
75
- `${rail} ${ui.accent("auth source:")} ${authSourceLabel(result.authSource)}`
76
- ];
77
- const hasMixedSources = new Set(result.workspaces.map((workspace) => workspace.source)).size > 1;
78
- if (result.workspaces.length === 0) {
79
- lines.push(`${rail} ${ui.dim("No local OAuth workspaces found.")}`);
80
- return lines;
81
- }
82
- const nameWidth = Math.max(4, ...result.workspaces.map((workspace) => stringWidth(workspace.name)));
83
- const idWidth = Math.max(2, ...result.workspaces.map((workspace) => stringWidth(workspace.id)));
84
- const sourceWidth = hasMixedSources ? Math.max(6, ...result.workspaces.map((workspace) => stringWidth(workspaceSourceLabel(workspace.source)))) : 0;
85
- lines.push(rail);
86
- lines.push(hasMixedSources ? `${rail} ${ui.accent(padDisplay("name", nameWidth))} ${ui.accent(padDisplay("id", idWidth))} ${ui.accent(padDisplay("source", sourceWidth))} ${ui.accent("status")}` : `${rail} ${ui.accent(padDisplay("name", nameWidth))} ${ui.accent(padDisplay("id", idWidth))} ${ui.accent("status")}`);
87
- for (const workspace of result.workspaces) {
88
- const status = workspace.active ? "active" : "";
89
- const source = workspaceSourceLabel(workspace.source);
90
- lines.push(hasMixedSources ? `${rail} ${padDisplay(workspace.name, nameWidth)} ${padDisplay(workspace.id, idWidth)} ${padDisplay(source, sourceWidth)} ${status}` : `${rail} ${padDisplay(workspace.name, nameWidth)} ${padDisplay(workspace.id, idWidth)} ${status}`);
91
- }
92
- return lines;
93
- }
94
- function serializeAuthWorkspaceList(result) {
95
- return {
96
- context: {
97
- authSource: result.authSource,
98
- activeWorkspaceId: result.activeWorkspace?.id ?? null,
99
- activeWorkspaceName: result.activeWorkspace?.name ?? null
100
- },
101
- items: result.workspaces.map((workspace) => ({
102
- id: workspace.id,
103
- name: workspace.name,
104
- status: workspace.active ? "active" : null,
105
- source: workspace.source,
106
- switchable: workspace.switchable,
107
- credentialWorkspaceId: workspace.credentialWorkspaceId,
108
- lastSeenAt: workspace.lastSeenAt
109
- })),
110
- count: result.workspaces.length
111
- };
112
- }
113
- function renderAuthWorkspaceUse(context, descriptor, result) {
114
- return renderMutate({
115
- title: "Switching the local CLI workspace.",
116
- descriptor,
117
- context: [...result.previousWorkspace ? [{
118
- key: "previous",
119
- value: result.previousWorkspace.name
120
- }] : [], {
121
- key: "workspace",
122
- value: result.workspace.name
123
- }],
124
- operationDescription: "Applying workspace selection",
125
- operationCount: 1,
126
- details: ["Local OAuth workspace selection updated."]
127
- }, context.ui);
128
- }
129
- function serializeAuthWorkspaceUse(result) {
130
- return result;
131
- }
132
- function renderAuthWorkspaceLogout(context, descriptor, result) {
133
- return renderMutate({
134
- title: "Removing a local OAuth workspace session.",
135
- descriptor,
136
- context: [{
137
- key: "workspace",
138
- value: result.workspace.name
139
- }, ...result.activeWorkspace ? [{
140
- key: "active",
141
- value: result.activeWorkspace.name
142
- }] : [{
143
- key: "active",
144
- value: "none",
145
- tone: "dim"
146
- }]],
147
- operationDescription: "Removing workspace session",
148
- operationCount: 1,
149
- details: [result.wasActive ? "Removed active workspace session; no replacement workspace was selected." : "Removed workspace session."]
150
- }, context.ui);
151
- }
152
- function serializeAuthWorkspaceLogout(result) {
153
- return result;
154
- }
155
- function providerLabel(provider) {
156
- if (provider === "github") return "GitHub";
157
- if (provider === "google") return "Google";
158
- return "";
159
- }
160
- function authSourceLabel(source) {
161
- if (source === "oauth") return "local OAuth";
162
- if (source === "service_token") return SERVICE_TOKEN_ENV_VAR;
163
- return "none";
164
- }
165
- function workspaceSourceLabel(source) {
166
- return source === "service_token" ? "service token" : "OAuth";
167
- }
168
- function authUserLabel(result) {
169
- return result.user?.email ?? credentialUserLabel(result);
170
- }
171
- function authUserRows(result) {
172
- const userLabel = authUserLabel(result);
173
- return userLabel ? [{
174
- key: "user",
175
- value: userLabel
176
- }] : [];
177
- }
178
- function credentialUserLabel(result) {
179
- if (result.credential?.type === "service_token") return result.credential.name ? `<service token: ${result.credential.name}>` : "<service token>";
180
- if (result.credential?.type === "management_token") return result.credential.name ? `<management token: ${result.credential.name}>` : "<management token>";
181
- return null;
182
- }
183
- //#endregion
184
- export { renderAuthSuccess, renderAuthWorkspaceList, renderAuthWorkspaceLogout, renderAuthWorkspaceUse, serializeAuthWorkspaceList, serializeAuthWorkspaceLogout, serializeAuthWorkspaceUse };
@@ -1,46 +0,0 @@
1
- import { formatDescriptorLabel } from "../shell/command-meta.js";
2
- import { formatColumns } from "../shell/ui.js";
3
- import { renderResolvedProjectContextBlock } from "./verbose-context.js";
4
- //#region src/presenters/branch.ts
5
- function renderBranchList(context, descriptor, result) {
6
- const ui = context.ui;
7
- const lines = [`${ui.strong(formatDescriptorLabel(descriptor))} ${ui.dim("→")} ${ui.dim("Listing branches for the resolved project.")}`, ""];
8
- const rail = ui.dim("│");
9
- lines.push(`${rail} ${ui.accent("project:")} ${result.projectName}`);
10
- lines.push(rail);
11
- if (result.branches.length === 0) {
12
- lines.push(`${rail} ${ui.dim("No branches found.")}`);
13
- lines.push(...renderBranchResolvedContextBlock(context, result));
14
- return lines;
15
- }
16
- const widths = [
17
- Math.max(4, ...result.branches.map((branch) => branch.name.length)),
18
- Math.max(4, ...result.branches.map((branch) => branch.role.length)),
19
- Math.max(7, ...result.branches.map((branch) => branch.envMap.length))
20
- ];
21
- lines.push(`${rail} ${ui.accent(formatColumns([
22
- "Name",
23
- "Role",
24
- "Env map"
25
- ], widths))}`);
26
- for (const branch of result.branches) lines.push(`${rail} ${formatColumns([
27
- branch.name,
28
- branch.role,
29
- branch.envMap
30
- ], widths)}`);
31
- lines.push(...renderBranchResolvedContextBlock(context, result));
32
- return lines;
33
- }
34
- function serializeBranchList(result) {
35
- const { verboseContext: _verboseContext, ...serializable } = result;
36
- return {
37
- projectId: serializable.projectId,
38
- projectName: serializable.projectName,
39
- branches: serializable.branches
40
- };
41
- }
42
- function renderBranchResolvedContextBlock(context, result) {
43
- return renderResolvedProjectContextBlock(context.ui, result.verboseContext);
44
- }
45
- //#endregion
46
- export { renderBranchList, serializeBranchList };
@@ -1,174 +0,0 @@
1
- import { formatDescriptorLabel } from "../shell/command-meta.js";
2
- import { formatColumns, renderSummaryLine } from "../shell/ui.js";
3
- import { renderMutate, serializeList } from "../output/patterns.js";
4
- import { renderResolvedProjectContextBlock, stripVerboseContext } from "./verbose-context.js";
5
- //#region src/presenters/bucket.ts
6
- function renderBucketList(context, descriptor, result) {
7
- const ui = context.ui;
8
- const lines = [`${ui.strong(formatDescriptorLabel(descriptor))} ${ui.dim("→")} ${ui.dim("Listing object-store buckets 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.buckets.length === 0) {
14
- lines.push(`${rail} ${ui.dim("No buckets found.")}`);
15
- lines.push(...renderResolvedProjectContextBlock(context.ui, result.verboseContext));
16
- return lines;
17
- }
18
- const rows = result.buckets.map((bucket) => [
19
- bucket.name,
20
- bucket.id,
21
- bucket.status,
22
- bucket.branchId ?? "unscoped",
23
- bucket.createdAt
24
- ]);
25
- const widths = [
26
- Math.max(4, ...rows.map((row) => row[0].length)),
27
- Math.max(2, ...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(7, ...rows.map((row) => row[4].length))
31
- ];
32
- lines.push(`${rail} ${ui.accent(formatColumns([
33
- "Name",
34
- "Id",
35
- "Status",
36
- "Branch",
37
- "Created"
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 serializeBucketList(result) {
44
- return {
45
- context: {
46
- project: result.projectName,
47
- ...result.branchName ? { branch: result.branchName } : {}
48
- },
49
- items: result.buckets.map((bucket) => ({
50
- name: bucket.name,
51
- id: bucket.id,
52
- status: bucket.status
53
- })),
54
- count: result.buckets.length,
55
- projectId: result.projectId,
56
- branchName: result.branchName,
57
- buckets: result.buckets
58
- };
59
- }
60
- function renderBucketCreate(context, _descriptor, result) {
61
- const ui = context.ui;
62
- return ["Creating bucket...", renderSummaryLine(ui, "success", `Created bucket "${result.bucket.name}" in ${formatBucketTarget(result.projectName, result.bucket.branchId)}.`)];
63
- }
64
- function serializeBucketCreate(result) {
65
- return stripVerboseContext(result);
66
- }
67
- function renderBucketDelete(context, descriptor, result) {
68
- return renderMutate({
69
- title: "Deleting object-store bucket.",
70
- descriptor,
71
- context: [{
72
- key: "bucket",
73
- value: result.bucket.id,
74
- tone: "dim"
75
- }],
76
- operationDescription: "Deleting bucket",
77
- operationCount: 1,
78
- details: ["Bucket and all its access keys were removed."]
79
- }, context.ui);
80
- }
81
- function serializeBucketDelete(result) {
82
- return { bucket: result.bucket };
83
- }
84
- function renderBucketKeyList(context, descriptor, result) {
85
- const ui = context.ui;
86
- const lines = [`${ui.strong(formatDescriptorLabel(descriptor))} ${ui.dim("→")} ${ui.dim("Listing access keys for bucket.")}`, ""];
87
- const rail = ui.dim("│");
88
- lines.push(`${rail} ${ui.accent("bucket:")} ${result.bucketId}`);
89
- lines.push(rail);
90
- if (result.keys.length === 0) {
91
- lines.push(`${rail} ${ui.dim("No keys found.")}`);
92
- return lines;
93
- }
94
- const rows = result.keys.map((key) => [
95
- key.name,
96
- key.id,
97
- key.role,
98
- key.valueHint,
99
- key.createdAt
100
- ]);
101
- const widths = [
102
- Math.max(4, ...rows.map((row) => row[0].length)),
103
- Math.max(2, ...rows.map((row) => row[1].length)),
104
- Math.max(4, ...rows.map((row) => row[2].length)),
105
- Math.max(4, ...rows.map((row) => row[3].length)),
106
- Math.max(7, ...rows.map((row) => row[4].length))
107
- ];
108
- lines.push(`${rail} ${ui.accent(formatColumns([
109
- "Name",
110
- "Id",
111
- "Role",
112
- "Hint",
113
- "Created"
114
- ], widths))}`);
115
- for (const row of rows) lines.push(`${rail} ${formatColumns(row, widths)}`);
116
- return lines;
117
- }
118
- function serializeBucketKeyList(result) {
119
- return {
120
- ...serializeList({
121
- context: { bucket: result.bucketId },
122
- items: result.keys.map((key) => ({
123
- noun: "key",
124
- label: key.name,
125
- id: key.id,
126
- status: null
127
- }))
128
- }),
129
- bucketId: result.bucketId,
130
- keys: result.keys
131
- };
132
- }
133
- function renderBucketKeyCreateStdout(_context, _descriptor, result) {
134
- return [
135
- `S3_ENDPOINT=${result.endpoint}`,
136
- `S3_ACCESS_KEY_ID=${result.accessKeyId}`,
137
- `S3_SECRET_ACCESS_KEY=${result.secretAccessKey}`,
138
- `S3_BUCKET=${result.bucketName}`
139
- ];
140
- }
141
- function renderBucketKeyCreate(context, _descriptor, result) {
142
- const ui = context.ui;
143
- return [
144
- "Creating bucket key...",
145
- renderSummaryLine(ui, "success", `Created key "${result.key.name}" for bucket "${result.bucketName}".`),
146
- " The credentials below are shown once — copy them now.",
147
- " Set these environment variables to use this bucket:"
148
- ];
149
- }
150
- function serializeBucketKeyCreate(result) {
151
- return result;
152
- }
153
- function renderBucketKeyDelete(context, descriptor, result) {
154
- return renderMutate({
155
- title: "Deleting bucket access key.",
156
- descriptor,
157
- context: [{
158
- key: "key",
159
- value: result.key.id,
160
- tone: "dim"
161
- }],
162
- operationDescription: "Deleting bucket key",
163
- operationCount: 1,
164
- details: ["The access key was revoked and removed."]
165
- }, context.ui);
166
- }
167
- function serializeBucketKeyDelete(result) {
168
- return { key: result.key };
169
- }
170
- function formatBucketTarget(projectName, branchId) {
171
- return branchId ? `${projectName} / ${branchId}` : projectName;
172
- }
173
- //#endregion
174
- export { renderBucketCreate, renderBucketDelete, renderBucketKeyCreate, renderBucketKeyCreateStdout, renderBucketKeyDelete, renderBucketKeyList, renderBucketList, serializeBucketCreate, serializeBucketDelete, serializeBucketKeyCreate, serializeBucketKeyDelete, serializeBucketKeyList, serializeBucketList };