@prisma/cli 3.0.0-alpha.0 → 3.0.0-alpha.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 (55) hide show
  1. package/README.md +1 -16
  2. package/dist/adapters/git.js +49 -0
  3. package/dist/adapters/local-state.js +39 -1
  4. package/dist/cli2.js +60 -4
  5. package/dist/commands/app/index.js +43 -30
  6. package/dist/commands/auth/index.js +3 -2
  7. package/dist/commands/branch/index.js +2 -1
  8. package/dist/commands/env.js +87 -0
  9. package/dist/commands/git/index.js +36 -0
  10. package/dist/commands/project/index.js +12 -14
  11. package/dist/commands/version/index.js +18 -0
  12. package/dist/controllers/app-env.js +223 -0
  13. package/dist/controllers/app.js +1051 -173
  14. package/dist/controllers/auth.js +9 -9
  15. package/dist/controllers/branch.js +6 -6
  16. package/dist/controllers/project.js +451 -161
  17. package/dist/controllers/version.js +12 -0
  18. package/dist/lib/app/bun-project.js +1 -1
  19. package/dist/lib/app/deploy-output.js +15 -0
  20. package/dist/lib/app/env-config.js +57 -0
  21. package/dist/lib/app/env-vars.js +4 -4
  22. package/dist/lib/app/local-dev.js +2 -1
  23. package/dist/lib/app/preview-build.js +130 -144
  24. package/dist/lib/app/preview-interaction.js +2 -35
  25. package/dist/lib/app/preview-progress.js +43 -58
  26. package/dist/lib/app/preview-provider.js +125 -24
  27. package/dist/lib/auth/auth-ops.js +58 -13
  28. package/dist/lib/auth/client.js +1 -1
  29. package/dist/lib/auth/guard.js +1 -1
  30. package/dist/lib/auth/login.js +115 -4
  31. package/dist/lib/project/local-pin.js +51 -0
  32. package/dist/lib/project/resolution.js +201 -0
  33. package/dist/lib/version.js +55 -0
  34. package/dist/output/patterns.js +15 -18
  35. package/dist/presenters/app-env.js +129 -0
  36. package/dist/presenters/app.js +16 -29
  37. package/dist/presenters/auth.js +2 -2
  38. package/dist/presenters/branch.js +6 -6
  39. package/dist/presenters/project.js +87 -44
  40. package/dist/presenters/version.js +29 -0
  41. package/dist/shell/command-meta.js +150 -84
  42. package/dist/shell/command-runner.js +32 -2
  43. package/dist/shell/errors.js +8 -3
  44. package/dist/shell/global-flags.js +13 -1
  45. package/dist/shell/help.js +8 -7
  46. package/dist/shell/output.js +29 -12
  47. package/dist/shell/prompt.js +12 -2
  48. package/dist/shell/runtime.js +1 -1
  49. package/dist/shell/ui.js +19 -1
  50. package/dist/use-cases/auth.js +9 -12
  51. package/dist/use-cases/branch.js +20 -20
  52. package/dist/use-cases/create-cli-gateways.js +3 -13
  53. package/dist/use-cases/project.js +2 -48
  54. package/package.json +3 -3
  55. package/dist/adapters/config.js +0 -74
@@ -0,0 +1,201 @@
1
+ import { CliError } from "../../shell/errors.js";
2
+ import { canPrompt } from "../../shell/runtime.js";
3
+ import { readFile } from "node:fs/promises";
4
+ import path from "node:path";
5
+ //#region src/lib/project/resolution.ts
6
+ async function resolveProjectTarget(options) {
7
+ const projects = await options.listProjects();
8
+ const inferredName = await inferTargetName(options.context.runtime.cwd);
9
+ if (options.explicitProject) return rememberIfRequested(options, resolveExplicitProject(options.explicitProject, projects, options.workspace), "explicit", {
10
+ targetName: options.explicitProject,
11
+ targetNameSource: "explicit"
12
+ });
13
+ const platformMapping = await resolveDurablePlatformMapping();
14
+ if (platformMapping) return rememberIfRequested(options, platformMapping, "platform-mapping");
15
+ let staleRemembered = false;
16
+ if (!options.allowCreate) {
17
+ const rememberedResult = await resolveRememberedProject(options, projects);
18
+ if (rememberedResult.target) return rememberedResult.target;
19
+ staleRemembered = rememberedResult.stale;
20
+ }
21
+ const packageName = inferredName.source === "package-name" ? inferredName.name : null;
22
+ if (packageName) {
23
+ const matches = projects.filter((project) => projectMatchesPackageName(project, packageName));
24
+ if (matches.length === 1) return rememberIfRequested(options, matches[0], "package-name", {
25
+ targetName: packageName,
26
+ targetNameSource: "package-name"
27
+ });
28
+ if (matches.length > 1) return resolveAmbiguousProject(options, matches, packageName, "package-name");
29
+ }
30
+ if (options.allowCreate && options.createProject) {
31
+ if (inferredName.name) {
32
+ const existing = projects.filter((project) => projectMatchesPackageName(project, inferredName.name));
33
+ if (existing.length === 1) return rememberIfRequested(options, existing[0], inferredName.source, {
34
+ targetName: inferredName.name,
35
+ targetNameSource: inferredName.source
36
+ });
37
+ if (existing.length > 1) return resolveAmbiguousProject(options, existing, inferredName.name, inferredName.source);
38
+ return rememberIfRequested(options, await options.createProject(inferredName.name), "created", {
39
+ targetName: inferredName.name,
40
+ targetNameSource: inferredName.source
41
+ });
42
+ }
43
+ }
44
+ if (options.prompt && canPrompt(options.context) && projects.length > 0) return rememberIfRequested(options, await options.prompt.select({
45
+ message: "Select a project",
46
+ choices: sortProjects(projects).map((project) => ({
47
+ label: `${project.name} (${project.id})`,
48
+ value: project
49
+ }))
50
+ }), "prompt");
51
+ if (staleRemembered && projects.length > 1) throw localStateStaleError();
52
+ throw projectUnresolvedError();
53
+ }
54
+ async function resolveRememberedProject(options, projects) {
55
+ const remembered = await options.context.stateStore.readRememberedProject(options.workspace.id);
56
+ if (!remembered) return {
57
+ target: null,
58
+ stale: false
59
+ };
60
+ const matched = projects.find((project) => project.id === remembered.id);
61
+ if (!matched) return {
62
+ target: null,
63
+ stale: true
64
+ };
65
+ return {
66
+ target: await rememberIfRequested(options, matched, "remembered-local", {
67
+ targetName: remembered.name,
68
+ targetNameSource: "remembered-local"
69
+ }),
70
+ stale: false
71
+ };
72
+ }
73
+ function projectNotFoundError(projectRef, workspace) {
74
+ return new CliError({
75
+ code: "PROJECT_NOT_FOUND",
76
+ domain: "project",
77
+ summary: "Project not found",
78
+ why: `The project "${projectRef}" does not exist in workspace "${workspace.name}" or is not accessible.`,
79
+ fix: "Pass a project id or name from prisma-cli project list.",
80
+ exitCode: 1,
81
+ nextSteps: ["prisma-cli project list"]
82
+ });
83
+ }
84
+ function projectAmbiguousError(projectRef, matches) {
85
+ const firstMatch = matches[0];
86
+ const nextSteps = ["prisma-cli project list"];
87
+ if (firstMatch) nextSteps.push(`prisma-cli app deploy --project ${firstMatch.id}`);
88
+ return new CliError({
89
+ code: "PROJECT_AMBIGUOUS",
90
+ domain: "project",
91
+ summary: "Project resolution is ambiguous",
92
+ why: projectRef ? `Multiple projects matched "${projectRef}".` : "Multiple projects matched the current directory context.",
93
+ fix: "Pass --project <id-or-name> to choose the project explicitly.",
94
+ meta: { matches: matches.map((project) => ({
95
+ id: project.id,
96
+ name: project.name
97
+ })) },
98
+ exitCode: 1,
99
+ nextSteps
100
+ });
101
+ }
102
+ function projectUnresolvedError() {
103
+ return new CliError({
104
+ code: "PROJECT_UNRESOLVED",
105
+ domain: "project",
106
+ summary: "No project is resolved for this directory",
107
+ why: "No project could be resolved from explicit input, platform mappings, remembered local context, or package metadata.",
108
+ fix: "Pass --project <id-or-name> on the command that needs a project, or add a package.json name that matches an accessible project.",
109
+ exitCode: 1,
110
+ nextSteps: ["prisma-cli project list", "prisma-cli project show --project <id-or-name>"]
111
+ });
112
+ }
113
+ function localStateStaleError() {
114
+ return new CliError({
115
+ code: "LOCAL_STATE_STALE",
116
+ domain: "project",
117
+ summary: "Remembered project context is stale",
118
+ why: "The remembered project is no longer available in the selected workspace, and automatic resolution would be ambiguous.",
119
+ fix: "Pass --project <id-or-name> to choose the project explicitly.",
120
+ exitCode: 1,
121
+ nextSteps: ["prisma-cli project list"]
122
+ });
123
+ }
124
+ async function readPackageName(cwd) {
125
+ try {
126
+ const raw = await readFile(path.join(cwd, "package.json"), "utf8");
127
+ const parsed = JSON.parse(raw);
128
+ if (!parsed || typeof parsed !== "object") return null;
129
+ const packageName = "name" in parsed ? parsed.name : null;
130
+ return typeof packageName === "string" && packageName.trim().length > 0 ? packageName.trim() : null;
131
+ } catch (error) {
132
+ if (error.code === "ENOENT") return null;
133
+ if (error instanceof SyntaxError) return null;
134
+ throw error;
135
+ }
136
+ }
137
+ async function inferTargetName(cwd) {
138
+ const packageName = await readPackageName(cwd);
139
+ if (packageName && isValidInferredTargetName(packageName)) return {
140
+ name: packageName,
141
+ source: "package-name"
142
+ };
143
+ return {
144
+ name: path.basename(cwd),
145
+ source: "directory-name"
146
+ };
147
+ }
148
+ function isValidInferredTargetName(value) {
149
+ return /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(value);
150
+ }
151
+ function sortProjects(projects) {
152
+ return projects.slice().sort((left, right) => left.name.localeCompare(right.name) || left.id.localeCompare(right.id));
153
+ }
154
+ function resolveExplicitProject(projectRef, projects, workspace) {
155
+ const matches = projects.filter((project) => project.id === projectRef || project.name === projectRef);
156
+ if (matches.length === 1) return matches[0];
157
+ if (matches.length > 1) throw projectAmbiguousError(projectRef, matches);
158
+ throw projectNotFoundError(projectRef, workspace);
159
+ }
160
+ function resolveAmbiguousProject(options, matches, projectRef, targetNameSource) {
161
+ if (options.prompt && canPrompt(options.context)) return options.prompt.select({
162
+ message: "Select a project",
163
+ choices: sortProjects(matches).map((project) => ({
164
+ label: `${project.name} (${project.id})`,
165
+ value: project
166
+ }))
167
+ }).then((selected) => rememberIfRequested(options, selected, "prompt", {
168
+ targetName: projectRef,
169
+ targetNameSource
170
+ }));
171
+ throw projectAmbiguousError(projectRef, matches);
172
+ }
173
+ function projectMatchesPackageName(project, packageName) {
174
+ return project.id === packageName || project.name === packageName || project.slug === packageName;
175
+ }
176
+ async function resolveDurablePlatformMapping() {
177
+ return null;
178
+ }
179
+ async function rememberIfRequested(options, project, projectSource, resolutionDetails) {
180
+ if (options.remember) await options.context.stateStore.setRememberedProject({
181
+ id: project.id,
182
+ name: project.name,
183
+ workspaceId: options.workspace.id
184
+ });
185
+ return {
186
+ workspace: options.workspace,
187
+ project: toProjectSummary(project),
188
+ resolution: {
189
+ projectSource,
190
+ ...resolutionDetails
191
+ }
192
+ };
193
+ }
194
+ function toProjectSummary(project) {
195
+ return {
196
+ id: project.id,
197
+ name: project.name
198
+ };
199
+ }
200
+ //#endregion
201
+ export { inferTargetName, projectNotFoundError, resolveProjectTarget, sortProjects };
@@ -0,0 +1,55 @@
1
+ import { CliError } from "../shell/errors.js";
2
+ import { createRequire } from "node:module";
3
+ import process from "node:process";
4
+ //#region src/lib/version.ts
5
+ const requireFromHere = createRequire(import.meta.url);
6
+ function readPackageMetadata() {
7
+ try {
8
+ return requireFromHere("../../package.json");
9
+ } catch {
10
+ return {};
11
+ }
12
+ }
13
+ function getCliVersion() {
14
+ const pkg = readPackageMetadata();
15
+ if (!pkg.version) throw new CliError({
16
+ code: "VERSION_UNAVAILABLE",
17
+ domain: "cli",
18
+ summary: "CLI version metadata is missing from the installed package",
19
+ why: "The bundled package.json could not be read or did not contain a version field.",
20
+ fix: "Reinstall the CLI from the npm registry, or check your install path is intact.",
21
+ exitCode: 1
22
+ });
23
+ return pkg.version;
24
+ }
25
+ function getCliName() {
26
+ return "prisma-cli";
27
+ }
28
+ function detectInvocation(env, argv) {
29
+ if (env.npm_config_user_agent?.startsWith("bun")) return "bunx";
30
+ const normalizedExecPath = env.npm_execpath?.replace(/\\/g, "/").toLowerCase();
31
+ const normalizedUserAgent = env.npm_config_user_agent?.toLowerCase();
32
+ if (env.npm_lifecycle_event === "npx" || normalizedExecPath?.includes("/_npx/") || normalizedUserAgent?.includes("npx")) return "npx";
33
+ const entry = (argv[1] ?? "").replace(/\\/g, "/").toLowerCase();
34
+ if (entry.endsWith(".ts") || entry.includes("/tsx/")) return "dev";
35
+ if (entry.includes("/_npx/")) return "npx";
36
+ if (entry.includes("/.bun/")) return "bunx";
37
+ if (entry.includes("/node_modules/.bin/") || /\/prisma-cli(\.cmd|\.exe)?$/.test(entry)) return "global";
38
+ return "unknown";
39
+ }
40
+ function buildVersionResult(env, argv) {
41
+ return {
42
+ cli: {
43
+ name: getCliName(),
44
+ version: getCliVersion()
45
+ },
46
+ node: { version: process.version },
47
+ os: {
48
+ platform: process.platform,
49
+ arch: process.arch
50
+ },
51
+ invocation: detectInvocation(env, argv)
52
+ };
53
+ }
54
+ //#endregion
55
+ export { buildVersionResult, getCliName, getCliVersion };
@@ -1,15 +1,14 @@
1
- import { formatDescriptorLabel } from "../shell/command-meta.js";
2
1
  import { maskValue, padDisplay, renderSummaryLine } from "../shell/ui.js";
2
+ import { formatDescriptorLabel } from "../shell/command-meta.js";
3
3
  import stringWidth from "string-width";
4
4
  //#region src/output/patterns.ts
5
5
  function renderList(input, ui) {
6
- const keyWidth = Math.max(stringWidth(`${input.parentContext.key}:`), ...input.items.map((item) => stringWidth(`⚬ ${item.noun}:`)), stringWidth("Read more"));
6
+ const keyWidth = Math.max(stringWidth(`${input.parentContext.key}:`), ...input.items.map((item) => stringWidth(`⚬ ${item.noun}:`)), ...readMoreWidth(input.descriptor));
7
7
  const lines = renderCardTitle(input.descriptor, input.title, ui);
8
8
  lines.push(renderCardRow(ui, keyWidth, input.parentContext.key, input.parentContext.value));
9
9
  if (input.items.length === 0) lines.push(renderPlainCardLine(ui, ui.dim(input.emptyMessage)));
10
10
  else for (const item of input.items) lines.push(renderCardRow(ui, keyWidth, `⚬ ${item.noun}`, formatListItemValue(ui, item)));
11
- lines.push(renderCardDivider(ui));
12
- lines.push(renderReadMore(ui, keyWidth, input.descriptor));
11
+ pushReadMore(lines, ui, keyWidth, input.descriptor);
13
12
  return lines;
14
13
  }
15
14
  function serializeList(input) {
@@ -24,24 +23,18 @@ function serializeList(input) {
24
23
  };
25
24
  }
26
25
  function renderShow(input, ui) {
27
- const keyWidth = Math.max(...input.fields.map((field) => stringWidth(`${field.key}:`)), stringWidth("Read more"));
26
+ const keyWidth = Math.max(0, ...input.fields.map((field) => stringWidth(`${field.key}:`)), ...readMoreWidth(input.descriptor));
28
27
  const lines = renderCardTitle(input.descriptor, input.title, ui);
29
28
  for (const field of input.fields) lines.push(renderCardRow(ui, keyWidth, field.key, formatValue(ui, field.value, field.tone, field.sensitive)));
30
- lines.push(renderCardDivider(ui));
31
- lines.push(renderReadMore(ui, keyWidth, input.descriptor));
29
+ pushReadMore(lines, ui, keyWidth, input.descriptor);
32
30
  return lines;
33
31
  }
34
32
  function renderMutate(input, ui) {
35
- const rows = [...input.context, {
36
- key: "mode",
37
- value: "apply",
38
- tone: "dim"
39
- }];
40
- const keyWidth = Math.max(...rows.map((row) => stringWidth(`${row.key}:`)), stringWidth("Read more"));
33
+ const rows = input.context;
34
+ const keyWidth = Math.max(0, ...rows.map((row) => stringWidth(`${row.key}:`)), ...readMoreWidth(input.descriptor));
41
35
  const lines = renderCardTitle(input.descriptor, input.title, ui);
42
36
  for (const row of rows) lines.push(renderCardRow(ui, keyWidth, row.key, formatValue(ui, row.value, row.tone, row.sensitive)));
43
- lines.push(renderCardDivider(ui));
44
- lines.push(renderReadMore(ui, keyWidth, input.descriptor));
37
+ pushReadMore(lines, ui, keyWidth, input.descriptor);
45
38
  lines.push("");
46
39
  lines.push(`${ui.warning("◇")} ${input.operationDescription}...`);
47
40
  lines.push(renderSummaryLine(ui, "success", `Applied ${input.operationCount} operation(s)`));
@@ -64,8 +57,13 @@ function renderPlainCardLine(ui, text) {
64
57
  function renderCardDivider(ui) {
65
58
  return renderCardRail(ui);
66
59
  }
67
- function renderReadMore(ui, keyWidth, descriptor) {
68
- return `${renderCardRail(ui)} ${ui.accent(padDisplay("Read more", keyWidth))} ${ui.link(descriptor.docsPath ?? "")}`;
60
+ function readMoreWidth(descriptor) {
61
+ return descriptor.docsPath ? [stringWidth("Read more")] : [];
62
+ }
63
+ function pushReadMore(lines, ui, keyWidth, descriptor) {
64
+ if (!descriptor.docsPath) return;
65
+ lines.push(renderCardDivider(ui));
66
+ lines.push(`${renderCardRail(ui)} ${ui.accent(padDisplay("Read more", keyWidth))} ${ui.link(descriptor.docsPath)}`);
69
67
  }
70
68
  function renderCardRail(ui) {
71
69
  return ui.dim("│");
@@ -76,7 +74,6 @@ function formatListItemValue(ui, item) {
76
74
  }
77
75
  function renderAnnotation(ui, status) {
78
76
  if (status === "active") return ui.success("(active)");
79
- if (status === "linked") return ui.accent("(linked)");
80
77
  if (status === "default") return ui.dim("(default)");
81
78
  return "";
82
79
  }
@@ -0,0 +1,129 @@
1
+ import { renderList, renderShow, serializeList } from "../output/patterns.js";
2
+ //#region src/presenters/app-env.ts
3
+ function scopeLabel(scope) {
4
+ return scope.role;
5
+ }
6
+ function renderEnvAdd(context, descriptor, result) {
7
+ return renderShow({
8
+ title: "Setting a new environment variable.",
9
+ descriptor,
10
+ fields: [
11
+ {
12
+ key: "project",
13
+ value: result.projectId
14
+ },
15
+ {
16
+ key: "scope",
17
+ value: scopeLabel(result.scope)
18
+ },
19
+ {
20
+ key: "key",
21
+ value: result.variable.key
22
+ },
23
+ {
24
+ key: "id",
25
+ value: result.variable.id,
26
+ tone: "dim"
27
+ },
28
+ {
29
+ key: "last updated",
30
+ value: result.variable.updatedAt,
31
+ tone: "dim"
32
+ }
33
+ ]
34
+ }, context.ui);
35
+ }
36
+ function serializeEnvAdd(result) {
37
+ return result;
38
+ }
39
+ function renderEnvUpdate(context, descriptor, result) {
40
+ return renderShow({
41
+ title: "Replacing the environment variable's value.",
42
+ descriptor,
43
+ fields: [
44
+ {
45
+ key: "project",
46
+ value: result.projectId
47
+ },
48
+ {
49
+ key: "scope",
50
+ value: scopeLabel(result.scope)
51
+ },
52
+ {
53
+ key: "key",
54
+ value: result.variable.key
55
+ },
56
+ {
57
+ key: "id",
58
+ value: result.variable.id,
59
+ tone: "dim"
60
+ },
61
+ {
62
+ key: "last updated",
63
+ value: result.variable.updatedAt,
64
+ tone: "dim"
65
+ }
66
+ ]
67
+ }, context.ui);
68
+ }
69
+ function serializeEnvUpdate(result) {
70
+ return result;
71
+ }
72
+ function renderEnvList(context, descriptor, result) {
73
+ return renderList({
74
+ title: "Listing environment variables for the selected scope.",
75
+ descriptor,
76
+ parentContext: {
77
+ key: "scope",
78
+ value: scopeLabel(result.scope)
79
+ },
80
+ items: result.variables.map((variable) => ({
81
+ noun: "variable",
82
+ label: variable.key,
83
+ id: variable.id,
84
+ status: variable.isManagedBySystem ? "default" : null
85
+ })),
86
+ emptyMessage: "No environment variables defined in this scope."
87
+ }, context.ui);
88
+ }
89
+ function serializeEnvList(result) {
90
+ return {
91
+ projectId: result.projectId,
92
+ scope: result.scope,
93
+ ...serializeList({
94
+ context: { scope: scopeLabel(result.scope) },
95
+ items: result.variables.map((variable) => ({
96
+ noun: "variable",
97
+ label: variable.key,
98
+ id: variable.id,
99
+ status: variable.isManagedBySystem ? "default" : null
100
+ }))
101
+ }),
102
+ variables: result.variables
103
+ };
104
+ }
105
+ function renderEnvRm(context, descriptor, result) {
106
+ return renderShow({
107
+ title: "Removing the environment variable from the scope.",
108
+ descriptor,
109
+ fields: [
110
+ {
111
+ key: "project",
112
+ value: result.projectId
113
+ },
114
+ {
115
+ key: "scope",
116
+ value: scopeLabel(result.scope)
117
+ },
118
+ {
119
+ key: "key",
120
+ value: result.key
121
+ }
122
+ ]
123
+ }, context.ui);
124
+ }
125
+ function serializeEnvRm(result) {
126
+ return result;
127
+ }
128
+ //#endregion
129
+ export { renderEnvAdd, renderEnvList, renderEnvRm, renderEnvUpdate, serializeEnvAdd, serializeEnvList, serializeEnvRm, serializeEnvUpdate };
@@ -1,3 +1,4 @@
1
+ import { renderDeployOutputRows } from "../lib/app/deploy-output.js";
1
2
  import { renderList, renderShow, serializeList } from "../output/patterns.js";
2
3
  //#region src/presenters/app.ts
3
4
  function renderAppBuild(context, descriptor, result) {
@@ -25,37 +26,23 @@ function serializeAppBuild(result) {
25
26
  return result;
26
27
  }
27
28
  function renderAppDeploy(context, descriptor, result) {
28
- return renderShow({
29
- title: "Deploying the selected app.",
30
- descriptor,
31
- fields: [
32
- {
33
- key: "project",
34
- value: result.projectId
35
- },
36
- {
37
- key: "app",
38
- value: result.app.name
39
- },
40
- {
41
- key: "deployment",
42
- value: result.deployment.id
43
- },
44
- {
45
- key: "status",
46
- value: result.deployment.status,
47
- tone: toneForStatus(result.deployment.status)
48
- },
49
- ...result.deployment.url ? [{
50
- key: "url",
51
- value: result.deployment.url,
52
- tone: "link"
53
- }] : []
54
- ]
55
- }, context.ui);
29
+ return [
30
+ `Live in ${formatDuration(result.durationMs)}`,
31
+ ...result.deployment.url ? [context.ui.link(result.deployment.url)] : [],
32
+ "",
33
+ ...renderDeployOutputRows(context.ui, [{
34
+ label: "Logs",
35
+ value: "prisma-cli app logs"
36
+ }])
37
+ ];
56
38
  }
57
39
  function serializeAppDeploy(result) {
58
- return result;
40
+ const { localPin: _localPin, ...serialized } = result;
41
+ return serialized;
42
+ }
43
+ function formatDuration(durationMs) {
44
+ if (durationMs < 1e3) return `${durationMs}ms`;
45
+ return `${(durationMs / 1e3).toFixed(1)}s`;
59
46
  }
60
47
  function renderAppUpdateEnv(context, descriptor, result) {
61
48
  return renderShow({
@@ -9,7 +9,7 @@ function renderAuthSuccess(context, descriptor, command, result) {
9
9
  });
10
10
  if (result.user) rows.push({
11
11
  key: "user",
12
- value: `${result.user.name} <${result.user.email}>`
12
+ value: result.user.email
13
13
  });
14
14
  if (result.workspace?.name) rows.push({
15
15
  key: "workspace",
@@ -47,7 +47,7 @@ function renderAuthSuccess(context, descriptor, command, result) {
47
47
  },
48
48
  ...result.user ? [{
49
49
  key: "user",
50
- value: `${result.user.name} <${result.user.email}>`
50
+ value: result.user.email
51
51
  }] : [],
52
52
  ...result.provider ? [{
53
53
  key: "provider",
@@ -2,11 +2,11 @@ import { renderList, renderMutate, renderShow, serializeList } from "../output/p
2
2
  //#region src/presenters/branch.ts
3
3
  function renderBranchList(context, descriptor, result) {
4
4
  return renderList({
5
- title: "Listing branches for the linked project.",
5
+ title: "Listing branches for the resolved project.",
6
6
  descriptor,
7
7
  parentContext: {
8
8
  key: "project",
9
- value: result.projectName ?? "not linked"
9
+ value: result.projectName ?? "not resolved"
10
10
  },
11
11
  items: result.branches.map((branch) => ({
12
12
  noun: "branch",
@@ -19,7 +19,7 @@ function renderBranchList(context, descriptor, result) {
19
19
  }
20
20
  function serializeBranchList(result) {
21
21
  return serializeList({
22
- context: { project: result.projectName ?? "not linked" },
22
+ context: { project: result.projectName ?? "not resolved" },
23
23
  items: result.branches.map((branch) => ({
24
24
  noun: "branch",
25
25
  label: branch.name,
@@ -30,7 +30,7 @@ function serializeBranchList(result) {
30
30
  }
31
31
  function serializeBranchShow(result) {
32
32
  return {
33
- linkedProjectId: result.linkedProjectId,
33
+ projectId: result.projectId,
34
34
  projectName: result.projectName,
35
35
  branch: {
36
36
  name: result.branch.name,
@@ -45,7 +45,7 @@ function renderBranchShow(context, descriptor, result) {
45
45
  const fields = [
46
46
  {
47
47
  key: "project",
48
- value: result.projectName ?? "not linked",
48
+ value: result.projectName ?? "not resolved",
49
49
  tone: result.projectName ? "default" : "dim"
50
50
  },
51
51
  {
@@ -92,7 +92,7 @@ function renderBranchUse(context, descriptor, result) {
92
92
  descriptor,
93
93
  context: [{
94
94
  key: "project",
95
- value: result.projectName ?? "not linked",
95
+ value: result.projectName ?? "not resolved",
96
96
  tone: result.projectName ? "default" : "dim"
97
97
  }, {
98
98
  key: "branch",