@prisma/cli 3.0.0-beta.17 → 3.0.0-beta.19
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.
- package/dist/adapters/local-state.js +14 -3
- package/dist/adapters/token-storage.js +1 -1
- package/dist/cli2.js +6 -2
- package/dist/commands/agent/index.js +60 -0
- package/dist/commands/app/index.js +5 -3
- package/dist/commands/auth/index.js +1 -1
- package/dist/commands/build/index.js +29 -0
- package/dist/commands/git/index.js +1 -1
- package/dist/commands/project/index.js +1 -1
- package/dist/controllers/agent.js +228 -0
- package/dist/controllers/app.js +157 -73
- package/dist/controllers/auth.js +38 -3
- package/dist/controllers/build.js +88 -0
- package/dist/controllers/project.js +2 -2
- package/dist/controllers/select-prompt-port.js +1 -0
- package/dist/lib/agent/cli-command.js +17 -0
- package/dist/lib/agent/constants.js +12 -0
- package/dist/lib/agent/package-manager.js +99 -0
- package/dist/lib/agent/setup-status.js +83 -0
- package/dist/lib/app/app-provider.js +3 -3
- package/dist/lib/app/branch-database-deploy.js +3 -2
- package/dist/lib/app/branch-database.js +2 -1
- package/dist/lib/app/build-settings.js +1 -1
- package/dist/lib/app/build.js +2 -2
- package/dist/lib/app/bun-project.js +1 -1
- package/dist/lib/app/compute-config.js +27 -29
- package/dist/lib/app/deploy-plan.js +1 -0
- package/dist/lib/app/env-file.js +1 -1
- package/dist/lib/app/local-dev.js +1 -1
- package/dist/lib/app/production-deploy-gate.js +2 -1
- package/dist/lib/auth/login.js +1 -1
- package/dist/lib/git/local-branch.js +1 -1
- package/dist/lib/project/interactive-setup.js +1 -0
- package/dist/lib/project/local-pin.js +1 -1
- package/dist/lib/project/resolution.js +2 -2
- package/dist/lib/project/setup.js +1 -1
- package/dist/presenters/agent.js +74 -0
- package/dist/presenters/auth.js +1 -1
- package/dist/presenters/project.js +1 -1
- package/dist/shell/cli-command.js +12 -0
- package/dist/shell/command-arguments.js +7 -1
- package/dist/shell/command-meta.js +88 -0
- package/dist/shell/command-runner.js +3 -3
- package/dist/shell/help.js +6 -5
- package/dist/shell/prompt.js +7 -3
- package/dist/shell/runtime.js +2 -2
- package/dist/shell/update-check.js +2 -2
- package/package.json +4 -3
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import { resolvePrismaCliPackageCommandFormatterSync } from "../lib/agent/cli-command.js";
|
|
2
|
+
import { PRISMA_AGENT_INSTALL_ARGS, PRISMA_AGENT_STATUS_ARGS, PRISMA_AGENT_UPDATE_ARGS, PRISMA_COMPUTE_AGENT_SKILL } from "../lib/agent/constants.js";
|
|
1
3
|
//#region src/shell/command-meta.ts
|
|
2
4
|
const COMMAND_DESCRIPTOR_ID = Symbol("prisma.commandDescriptorId");
|
|
5
|
+
function agentCommandExamples(runtime, commands) {
|
|
6
|
+
const formatCommand = resolvePrismaCliPackageCommandFormatterSync(runtime.cwd);
|
|
7
|
+
return commands.map((command) => formatCommand(command));
|
|
8
|
+
}
|
|
3
9
|
const DESCRIPTORS = [
|
|
4
10
|
{
|
|
5
11
|
id: "root",
|
|
@@ -14,6 +20,71 @@ const DESCRIPTORS = [
|
|
|
14
20
|
description: "Show CLI build and environment",
|
|
15
21
|
examples: ["prisma-cli version", "prisma-cli version --json"]
|
|
16
22
|
},
|
|
23
|
+
{
|
|
24
|
+
id: "agent",
|
|
25
|
+
path: ["prisma", "agent"],
|
|
26
|
+
description: "Install Prisma context for AI coding agents",
|
|
27
|
+
examples: (runtime) => agentCommandExamples(runtime, [
|
|
28
|
+
PRISMA_AGENT_INSTALL_ARGS,
|
|
29
|
+
PRISMA_AGENT_UPDATE_ARGS,
|
|
30
|
+
PRISMA_AGENT_STATUS_ARGS
|
|
31
|
+
])
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "agent.install",
|
|
35
|
+
path: [
|
|
36
|
+
"prisma",
|
|
37
|
+
"agent",
|
|
38
|
+
"install"
|
|
39
|
+
],
|
|
40
|
+
description: "Install Prisma skills for AI coding agents",
|
|
41
|
+
examples: (runtime) => agentCommandExamples(runtime, [
|
|
42
|
+
PRISMA_AGENT_INSTALL_ARGS,
|
|
43
|
+
[
|
|
44
|
+
...PRISMA_AGENT_INSTALL_ARGS,
|
|
45
|
+
"--agent",
|
|
46
|
+
"codex"
|
|
47
|
+
],
|
|
48
|
+
[...PRISMA_AGENT_INSTALL_ARGS, "--all-agents"],
|
|
49
|
+
[
|
|
50
|
+
...PRISMA_AGENT_INSTALL_ARGS,
|
|
51
|
+
"--skill",
|
|
52
|
+
PRISMA_COMPUTE_AGENT_SKILL
|
|
53
|
+
]
|
|
54
|
+
])
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: "agent.update",
|
|
58
|
+
path: [
|
|
59
|
+
"prisma",
|
|
60
|
+
"agent",
|
|
61
|
+
"update"
|
|
62
|
+
],
|
|
63
|
+
description: "Refresh Prisma skills for AI coding agents",
|
|
64
|
+
examples: (runtime) => agentCommandExamples(runtime, [
|
|
65
|
+
PRISMA_AGENT_UPDATE_ARGS,
|
|
66
|
+
[
|
|
67
|
+
...PRISMA_AGENT_UPDATE_ARGS,
|
|
68
|
+
"--agent",
|
|
69
|
+
"codex"
|
|
70
|
+
],
|
|
71
|
+
[...PRISMA_AGENT_UPDATE_ARGS, "--all-agents"]
|
|
72
|
+
])
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: "agent.status",
|
|
76
|
+
path: [
|
|
77
|
+
"prisma",
|
|
78
|
+
"agent",
|
|
79
|
+
"status"
|
|
80
|
+
],
|
|
81
|
+
description: "Show installed Prisma skills",
|
|
82
|
+
examples: (runtime) => agentCommandExamples(runtime, [
|
|
83
|
+
PRISMA_AGENT_STATUS_ARGS,
|
|
84
|
+
[...PRISMA_AGENT_STATUS_ARGS, "--json"],
|
|
85
|
+
[...PRISMA_AGENT_STATUS_ARGS, "--global"]
|
|
86
|
+
])
|
|
87
|
+
},
|
|
17
88
|
{
|
|
18
89
|
id: "auth",
|
|
19
90
|
path: ["prisma", "auth"],
|
|
@@ -124,6 +195,22 @@ const DESCRIPTORS = [
|
|
|
124
195
|
description: "View your Platform branches",
|
|
125
196
|
examples: ["prisma-cli branch list"]
|
|
126
197
|
},
|
|
198
|
+
{
|
|
199
|
+
id: "build",
|
|
200
|
+
path: ["prisma", "build"],
|
|
201
|
+
description: "Inspect builds",
|
|
202
|
+
examples: ["prisma-cli build logs <build_id>"]
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
id: "build.logs",
|
|
206
|
+
path: [
|
|
207
|
+
"prisma",
|
|
208
|
+
"build",
|
|
209
|
+
"logs"
|
|
210
|
+
],
|
|
211
|
+
description: "Stream the logs for a build",
|
|
212
|
+
examples: ["prisma-cli build logs <build_id>", "prisma-cli build logs <build_id> --follow"]
|
|
213
|
+
},
|
|
127
214
|
{
|
|
128
215
|
id: "database",
|
|
129
216
|
path: ["prisma", "database"],
|
|
@@ -350,6 +437,7 @@ const DESCRIPTORS = [
|
|
|
350
437
|
"prisma-cli app deploy --db",
|
|
351
438
|
"prisma-cli app deploy --db --yes",
|
|
352
439
|
"prisma-cli app deploy --app my-app --framework nextjs --http-port 3000",
|
|
440
|
+
"prisma-cli app deploy --app my-app --region us-west-1",
|
|
353
441
|
"prisma-cli app deploy --branch feat-login --framework hono",
|
|
354
442
|
"prisma-cli app deploy --prod --yes",
|
|
355
443
|
"prisma-cli app deploy --framework bun --entry src/server.ts"
|
|
@@ -2,9 +2,9 @@ import { CliError, authConfigInvalidError, authRequiredError, commandCanceledErr
|
|
|
2
2
|
import { getCommandDescriptor } from "./command-meta.js";
|
|
3
3
|
import { resolveGlobalFlags } from "./global-flags.js";
|
|
4
4
|
import { createCommandContext } from "./runtime.js";
|
|
5
|
-
import { cliErrorToJson, writeHumanError, writeHumanLines, writeJsonError, writeJsonEvent, writeJsonSuccess } from "./output.js";
|
|
6
5
|
import { collectCommandDiagnostics } from "../lib/diagnostics.js";
|
|
7
6
|
import { renderCommandDiagnostics } from "./diagnostics-output.js";
|
|
7
|
+
import { cliErrorToJson, writeHumanError, writeHumanLines, writeJsonError, writeJsonEvent, writeJsonSuccess } from "./output.js";
|
|
8
8
|
import { AuthError } from "@prisma/management-api-sdk";
|
|
9
9
|
//#region src/shell/command-runner.ts
|
|
10
10
|
function toCliError(error, runtime) {
|
|
@@ -75,12 +75,12 @@ async function renderBestEffortCommandDiagnostics(context, options) {
|
|
|
75
75
|
return [];
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
async function runStreamingCommand(runtime, commandName, options, handler) {
|
|
78
|
+
async function runStreamingCommand(runtime, commandName, options, handler, streamOptions) {
|
|
79
79
|
const flags = resolveGlobalFlags(runtime.argv, options);
|
|
80
80
|
const context = await createCommandContext(runtime, flags);
|
|
81
81
|
try {
|
|
82
82
|
await handler(context);
|
|
83
|
-
if (flags.json) writeJsonEvent(context.output, {
|
|
83
|
+
if (flags.json && (streamOptions?.emitJsonSuccessEvent ?? true)) writeJsonEvent(context.output, {
|
|
84
84
|
type: "success",
|
|
85
85
|
command: commandName,
|
|
86
86
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
package/dist/shell/help.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { formatDescriptorLabel, getDescriptorForCommand } from "./command-meta.js";
|
|
2
|
-
import { COMPACT_GLOBAL_OPTION_FLAGS, resolveGlobalFlags } from "./global-flags.js";
|
|
3
2
|
import { createShellUi, padDisplay, wrapText } from "./ui.js";
|
|
3
|
+
import { COMPACT_GLOBAL_OPTION_FLAGS, resolveGlobalFlags } from "./global-flags.js";
|
|
4
4
|
//#region src/shell/help.ts
|
|
5
5
|
function renderHelp(command, runtime) {
|
|
6
6
|
const descriptor = getDescriptorForCommand(command);
|
|
@@ -12,7 +12,7 @@ function renderHelp(command, runtime) {
|
|
|
12
12
|
if (visibleCommands.length > 0) lines.push(...renderCommandRows(rail, ui, visibleCommands));
|
|
13
13
|
lines.push(...renderLongDescription(rail, ui, descriptor.longDescription));
|
|
14
14
|
lines.push(...renderVisibleOptions(rail, ui, visibleCommands, visibleOptions));
|
|
15
|
-
lines.push(...renderExamples(rail, descriptor.examples));
|
|
15
|
+
lines.push(...renderExamples(rail, runtime, descriptor.examples));
|
|
16
16
|
lines.push(...renderDocsPath(rail, ui, descriptor.docsPath));
|
|
17
17
|
lines.push("");
|
|
18
18
|
return `${lines.join("\n")}`;
|
|
@@ -30,12 +30,13 @@ function renderVisibleOptions(rail, ui, visibleCommands, visibleOptions) {
|
|
|
30
30
|
function shouldLabelGlobalOptions(visibleCommands, visibleOptions) {
|
|
31
31
|
return visibleCommands.length > 0 && visibleOptions.every((option) => COMPACT_GLOBAL_OPTION_FLAGS.includes(option.flags));
|
|
32
32
|
}
|
|
33
|
-
function renderExamples(rail, examples) {
|
|
34
|
-
|
|
33
|
+
function renderExamples(rail, runtime, examples) {
|
|
34
|
+
const resolvedExamples = typeof examples === "function" ? examples(runtime) : examples;
|
|
35
|
+
if (!resolvedExamples || resolvedExamples.length === 0) return [];
|
|
35
36
|
return [
|
|
36
37
|
`${rail}`,
|
|
37
38
|
`${rail} Examples:`,
|
|
38
|
-
...
|
|
39
|
+
...resolvedExamples.map((example) => `${rail} $ ${example}`)
|
|
39
40
|
];
|
|
40
41
|
}
|
|
41
42
|
function renderDocsPath(rail, ui, docsPath) {
|
package/dist/shell/prompt.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { usageError } from "./errors.js";
|
|
2
2
|
import { confirm, isCancel, select, text } from "@clack/prompts";
|
|
3
3
|
//#region src/shell/prompt.ts
|
|
4
|
+
const PROMPT_CANCELED_SUMMARY = "Interactive prompt canceled";
|
|
4
5
|
async function selectPrompt(options) {
|
|
5
6
|
const promptOptions = options.choices.map((choice) => ({
|
|
6
7
|
label: choice.label,
|
|
@@ -9,31 +10,34 @@ async function selectPrompt(options) {
|
|
|
9
10
|
const response = await select({
|
|
10
11
|
input: options.input,
|
|
11
12
|
output: options.output,
|
|
13
|
+
signal: options.signal,
|
|
12
14
|
message: options.message,
|
|
13
15
|
options: promptOptions
|
|
14
16
|
});
|
|
15
|
-
if (isCancel(response)) throw usageError(
|
|
17
|
+
if (isCancel(response)) throw usageError(PROMPT_CANCELED_SUMMARY, "The command was canceled before a selection was made.", "Re-run the command and choose an option to continue.");
|
|
16
18
|
return response;
|
|
17
19
|
}
|
|
18
20
|
async function textPrompt(options) {
|
|
19
21
|
const response = await text({
|
|
20
22
|
input: options.input,
|
|
21
23
|
output: options.output,
|
|
24
|
+
signal: options.signal,
|
|
22
25
|
message: options.message,
|
|
23
26
|
placeholder: options.placeholder,
|
|
24
27
|
validate: options.validate
|
|
25
28
|
});
|
|
26
|
-
if (isCancel(response)) throw usageError(
|
|
29
|
+
if (isCancel(response)) throw usageError(PROMPT_CANCELED_SUMMARY, "The command was canceled before a value was entered.", "Re-run the command and provide a value to continue.");
|
|
27
30
|
return response;
|
|
28
31
|
}
|
|
29
32
|
async function confirmPrompt(options) {
|
|
30
33
|
const response = await confirm({
|
|
31
34
|
input: options.input,
|
|
32
35
|
output: options.output,
|
|
36
|
+
signal: options.signal,
|
|
33
37
|
message: options.message,
|
|
34
38
|
initialValue: options.initialValue ?? false
|
|
35
39
|
});
|
|
36
|
-
if (isCancel(response)) throw usageError(
|
|
40
|
+
if (isCancel(response)) throw usageError(PROMPT_CANCELED_SUMMARY, "The command was canceled before a confirmation was made.", "Re-run the command and choose an option to continue.");
|
|
37
41
|
return response;
|
|
38
42
|
}
|
|
39
43
|
function disposePromptState(_input) {}
|
package/dist/shell/runtime.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { createShellUi } from "./ui.js";
|
|
1
2
|
import { LocalStateStore } from "../adapters/local-state.js";
|
|
2
3
|
import { MockApi } from "../adapters/mock-api.js";
|
|
3
|
-
import { createShellUi } from "./ui.js";
|
|
4
4
|
import { renderHelp } from "./help.js";
|
|
5
|
-
import { findComputeConfigDir } from "@prisma/compute-sdk/config";
|
|
6
5
|
import path from "node:path";
|
|
6
|
+
import { findComputeConfigDir } from "@prisma/compute-sdk/config";
|
|
7
7
|
//#region src/shell/runtime.ts
|
|
8
8
|
const DEFAULT_STATE_DIR_NAME = path.join(".prisma", "cli");
|
|
9
9
|
function configureRuntimeCommand(command, runtime) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getCliName, getCliVersion } from "../lib/version.js";
|
|
2
|
-
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
3
2
|
import path from "node:path";
|
|
3
|
+
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
4
|
+
import { spawn } from "node:child_process";
|
|
4
5
|
import { randomUUID } from "node:crypto";
|
|
5
6
|
import os from "node:os";
|
|
6
|
-
import { spawn } from "node:child_process";
|
|
7
7
|
//#region src/shell/update-check.ts
|
|
8
8
|
const UPDATE_CHECK_FILE_NAME = "update-check.json";
|
|
9
9
|
const FALLBACK_INSTALL_DOCS_URL = "https://www.prisma.io/docs/orm/tools/prisma-cli";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/cli",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.19",
|
|
4
4
|
"description": "Command-line interface for the Prisma Developer Platform.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -44,13 +44,14 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@clack/prompts": "^1.5.0",
|
|
47
|
-
"@prisma/compute-sdk": "0.
|
|
47
|
+
"@prisma/compute-sdk": "0.31.0",
|
|
48
48
|
"@prisma/credentials-store": "^7.8.0",
|
|
49
|
-
"@prisma/management-api-sdk": "^1.
|
|
49
|
+
"@prisma/management-api-sdk": "^1.46.0",
|
|
50
50
|
"better-result": "^2.9.2",
|
|
51
51
|
"colorette": "^2.0.20",
|
|
52
52
|
"commander": "^14.0.3",
|
|
53
53
|
"dotenv": "^17.4.2",
|
|
54
|
+
"execa": "^9.6.1",
|
|
54
55
|
"magicast": "^0.5.3",
|
|
55
56
|
"open": "^11.0.0",
|
|
56
57
|
"string-width": "^8.2.1",
|