@prisma/cli 3.0.0-dev.123.1 → 3.0.0-dev.125.1

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.
@@ -0,0 +1,52 @@
1
+ import { resolvePrismaCliPackageCommand } from "../lib/agent/cli-command.js";
2
+ import { PRISMA_AGENT_INSTALL_ARGS, PRISMA_COMPUTE_AGENT_SKILL } from "../lib/agent/constants.js";
3
+ import { readPrismaAgentSetupStatus, shouldOfferPrismaAgentSetup } from "../lib/agent/setup-status.js";
4
+ import { runAgentInstall } from "./agent.js";
5
+ import { renderSummaryLine } from "../shell/ui.js";
6
+ import { canPrompt } from "../shell/runtime.js";
7
+ import { confirmPrompt } from "../shell/prompt.js";
8
+ //#region src/controllers/agent-setup.ts
9
+ /**
10
+ * One-time interactive offer to install the Prisma Compute skill for the
11
+ * project. Shared by the commands that establish a project setup (init,
12
+ * deploy); the answer is remembered, so whichever command runs first asks.
13
+ * Returns warnings; a failed install must not fail the calling command.
14
+ */
15
+ async function maybePromptForAgentSetup(context, projectDir) {
16
+ if (!canPrompt(context) || context.flags.yes || context.flags.quiet) return [];
17
+ if (!shouldOfferPrismaAgentSetup(await readPrismaAgentSetupStatus({
18
+ cwd: projectDir,
19
+ stateStore: context.stateStore,
20
+ signal: context.runtime.signal,
21
+ requiredSkill: "prisma-compute"
22
+ }))) return [];
23
+ if (!await confirmPrompt({
24
+ input: context.runtime.stdin,
25
+ output: context.runtime.stderr,
26
+ signal: context.runtime.signal,
27
+ message: "Install the Prisma Compute skill for this project?",
28
+ initialValue: true
29
+ })) {
30
+ await context.stateStore.setAgentSetupPromptDismissedAt((/* @__PURE__ */ new Date()).toISOString());
31
+ return [];
32
+ }
33
+ try {
34
+ await runAgentInstall(context, { skill: [PRISMA_COMPUTE_AGENT_SKILL] }, "install", { cwd: projectDir });
35
+ if (!context.flags.quiet && !context.flags.json) context.output.stderr.write(`${renderSummaryLine(context.ui, "success", "Installed the Prisma Compute skill for this project.")}\n\n`);
36
+ return [];
37
+ } catch (error) {
38
+ const message = error instanceof Error ? error.message : "Prisma skill install failed.";
39
+ if (!context.flags.quiet && !context.flags.json) context.output.stderr.write(`${renderSummaryLine(context.ui, "warning", `Skipped Prisma skill install: ${message}`)}\n\n`);
40
+ return [`The Prisma Compute skill was not installed. Run ${await resolvePrismaCliPackageCommand({
41
+ cwd: projectDir,
42
+ signal: context.runtime.signal,
43
+ args: [
44
+ ...PRISMA_AGENT_INSTALL_ARGS,
45
+ "--skill",
46
+ PRISMA_COMPUTE_AGENT_SKILL
47
+ ]
48
+ })} to try again.`];
49
+ }
50
+ }
51
+ //#endregion
52
+ export { maybePromptForAgentSetup };
@@ -1,10 +1,6 @@
1
- import { resolvePrismaCliPackageCommand } from "../lib/agent/cli-command.js";
2
- import { PRISMA_AGENT_INSTALL_ARGS, PRISMA_COMPUTE_AGENT_SKILL } from "../lib/agent/constants.js";
3
- import { readPrismaAgentSetupStatus, shouldOfferPrismaAgentSetup } from "../lib/agent/setup-status.js";
4
1
  import { formatCommandArgument } from "../shell/command-arguments.js";
5
2
  import { CliError, authRequiredError, featureUnavailableError, usageError, workspaceRequiredError } from "../shell/errors.js";
6
- import { runAgentInstall } from "./agent.js";
7
- import { renderCommandHeader, renderSummaryLine } from "../shell/ui.js";
3
+ import { renderCommandHeader } from "../shell/ui.js";
8
4
  import { canPrompt } from "../shell/runtime.js";
9
5
  import { writeJsonEvent } from "../shell/output.js";
10
6
  import { SERVICE_TOKEN_ENV_VAR, getApiBaseUrl } from "../lib/auth/client.js";
@@ -32,6 +28,7 @@ import { requireComputeAuth } from "../lib/auth/guard.js";
32
28
  import { readAuthState } from "../lib/auth/auth-ops.js";
33
29
  import { readLocalGitBranch } from "../lib/git/local-branch.js";
34
30
  import { promptForProjectSetupChoice } from "../lib/project/interactive-setup.js";
31
+ import { maybePromptForAgentSetup } from "./agent-setup.js";
35
32
  import { createSelectPromptPort } from "./select-prompt-port.js";
36
33
  import { requireAuthenticatedAuthState } from "./auth.js";
37
34
  import { listRealWorkspaceProjects } from "./project.js";
@@ -2096,42 +2093,6 @@ function maybeRenderProjectLinked(context, directory, projectName, localPinPath)
2096
2093
  if (context.flags.json || context.flags.quiet) return;
2097
2094
  context.output.stderr.write(`${context.ui.success("✔")} Linked "${directory}" to Project "${projectName}"\nSaved ${localPinPath}\n\n`);
2098
2095
  }
2099
- async function maybePromptForAgentSetup(context, projectDir) {
2100
- if (!canPrompt(context) || context.flags.yes) return [];
2101
- if (!shouldOfferPrismaAgentSetup(await readPrismaAgentSetupStatus({
2102
- cwd: projectDir,
2103
- stateStore: context.stateStore,
2104
- signal: context.runtime.signal,
2105
- requiredSkill: "prisma-compute"
2106
- }))) return [];
2107
- if (!await confirmPrompt({
2108
- input: context.runtime.stdin,
2109
- output: context.runtime.stderr,
2110
- signal: context.runtime.signal,
2111
- message: "Install the Prisma Compute skill for this project?",
2112
- initialValue: true
2113
- })) {
2114
- await context.stateStore.setAgentSetupPromptDismissedAt((/* @__PURE__ */ new Date()).toISOString());
2115
- return [];
2116
- }
2117
- try {
2118
- await runAgentInstall(context, { skill: [PRISMA_COMPUTE_AGENT_SKILL] }, "install", { cwd: projectDir });
2119
- if (!context.flags.quiet && !context.flags.json) context.output.stderr.write(`${renderSummaryLine(context.ui, "success", "Installed the Prisma Compute skill for this project.")}\n\n`);
2120
- return [];
2121
- } catch (error) {
2122
- const message = error instanceof Error ? error.message : "Prisma skill install failed.";
2123
- if (!context.flags.quiet && !context.flags.json) context.output.stderr.write(`${renderSummaryLine(context.ui, "warning", `Skipped Prisma skill install: ${message}`)}\n\n`);
2124
- return [`The Prisma Compute skill was not installed. Run ${await resolvePrismaCliPackageCommand({
2125
- cwd: projectDir,
2126
- signal: context.runtime.signal,
2127
- args: [
2128
- ...PRISMA_AGENT_INSTALL_ARGS,
2129
- "--skill",
2130
- PRISMA_COMPUTE_AGENT_SKILL
2131
- ]
2132
- })} to try again.`];
2133
- }
2134
- }
2135
2096
  async function maybeCustomizeDeploySettings(context, options) {
2136
2097
  if (!options.firstDeploy || context.flags.yes || options.explicitFramework || options.explicitEntrypoint || options.explicitHttpPort || !canPrompt(context)) return {
2137
2098
  framework: options.framework,
@@ -5,6 +5,7 @@ import { canPrompt } from "../shell/runtime.js";
5
5
  import { confirmPrompt, isPromptCancelError, selectPrompt, textPrompt } from "../shell/prompt.js";
6
6
  import { readLocalResolutionPin } from "../lib/project/local-pin.js";
7
7
  import { readBunPackageEntrypoint, readBunPackageJson } from "../lib/app/bun-project.js";
8
+ import { maybePromptForAgentSetup } from "./agent-setup.js";
8
9
  import { runProjectLink } from "./project.js";
9
10
  import { detectDeployFramework } from "./app.js";
10
11
  import { execa } from "execa";
@@ -112,6 +113,7 @@ async function runInit(context, flags) {
112
113
  onWarning: (message) => warnings.push(message),
113
114
  formatCommand
114
115
  });
116
+ warnings.push(...await maybePromptForAgentSetup(context, cwd));
115
117
  const unlinked = link.status !== "linked" && link.status !== "already-linked";
116
118
  const typesMissing = types.status !== "installed" && types.status !== "already-installed";
117
119
  return {
@@ -391,6 +393,7 @@ async function runInitConversion(context, flags, jsonConfigPath, formatCommand)
391
393
  onWarning: (message) => warnings.push(message),
392
394
  formatCommand
393
395
  });
396
+ warnings.push(...await maybePromptForAgentSetup(stepContext, loaded.configDir));
394
397
  const unlinked = link.status !== "already-linked" && link.status !== "linked";
395
398
  const typesMissing = types.status !== "installed" && types.status !== "already-installed";
396
399
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/cli",
3
- "version": "3.0.0-dev.123.1",
3
+ "version": "3.0.0-dev.125.1",
4
4
  "description": "Command-line interface for the Prisma Developer Platform.",
5
5
  "type": "module",
6
6
  "bin": {