@prisma/cli 8.0.0-rc.15-dev.114 → 8.0.0-rc.16-dev.119

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 (2) hide show
  1. package/dist/cli.js +54 -19
  2. package/package.json +8 -8
package/dist/cli.js CHANGED
@@ -1168,19 +1168,19 @@ async function login(options = {}) {
1168
1168
  if (completed) {
1169
1169
  const workspaceName = await state.resolveWorkspaceName();
1170
1170
  res.setHeader("Content-Type", "text/html; charset=utf-8");
1171
- res.end(renderSuccessPage(workspaceName));
1171
+ res.end(renderSuccessPage(workspaceName, options.uiContext));
1172
1172
  return;
1173
1173
  }
1174
1174
  try {
1175
1175
  await completeOnce(url);
1176
1176
  const workspaceName = await state.resolveWorkspaceName();
1177
1177
  res.setHeader("Content-Type", "text/html; charset=utf-8");
1178
- res.end(renderSuccessPage(workspaceName));
1178
+ res.end(renderSuccessPage(workspaceName, options.uiContext));
1179
1179
  settle(resolve);
1180
1180
  } catch (error) {
1181
1181
  res.statusCode = 400;
1182
1182
  res.setHeader("Content-Type", "text/plain; charset=utf-8");
1183
- res.end("Sign-in could not be completed. Return to your terminal.");
1183
+ res.end(options.uiContext === "prisma-plugin" ? "Sign-in couldn’t be completed. Return to your ChatGPT conversation to try again." : "Sign-in could not be completed. Return to your terminal.");
1184
1184
  settle(() => reject(error));
1185
1185
  return;
1186
1186
  }
@@ -1338,7 +1338,9 @@ var LoginState = class {
1338
1338
  return `${this.options.hostname}:${this.options.port}`;
1339
1339
  }
1340
1340
  };
1341
- function renderSuccessPage(workspaceName) {
1341
+ function renderSuccessPage(workspaceName, uiContext) {
1342
+ let body = workspaceName ? `Your terminal is now connected to your ${escapeHtml(workspaceName)} workspace. Head back to your terminal to continue.` : "Your terminal is now connected to your Prisma workspace. Head back to your terminal to continue.";
1343
+ if (uiContext === "prisma-plugin") body = "You’re connected to Prisma. Return to your ChatGPT conversation.";
1342
1344
  return `<!doctype html>
1343
1345
  <html lang="en">
1344
1346
  <head>
@@ -1512,8 +1514,8 @@ function renderSuccessPage(workspaceName) {
1512
1514
  <svg class="mark" width="36" height="36" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><path d="M25.21,24.21,12.739,27.928a.525.525,0,0,1-.667-.606L16.528,5.811a.43.43,0,0,1,.809-.094l8.249,17.661A.6.6,0,0,1,25.21,24.21Zm2.139-.878L17.8,2.883h0A1.531,1.531,0,0,0,16.491,2a1.513,1.513,0,0,0-1.4.729L4.736,19.648a1.592,1.592,0,0,0,.018,1.7l5.064,7.909a1.628,1.628,0,0,0,1.83.678l14.7-4.383a1.6,1.6,0,0,0,1-2.218Z" style="fill:#0c344b;fill-rule:evenodd"/></svg>
1513
1515
  <main>
1514
1516
  <h1>You're all set.</h1>
1515
- <p>${workspaceName ? `Your terminal is now connected to your ${escapeHtml(workspaceName)} workspace. Head back to your terminal to continue.` : "Your terminal is now connected to your Prisma workspace. Head back to your terminal to continue."}</p>
1516
- <section class="skills">
1517
+ <p>${body}</p>
1518
+ ${uiContext === "prisma-plugin" ? "" : `<section class="skills">
1517
1519
  <div class="skills-lead">
1518
1520
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"/><path d="M20 3v4"/><path d="M22 5h-4"/></svg>
1519
1521
  Using an AI coding agent? Add the Prisma skills:
@@ -1526,9 +1528,9 @@ function renderSuccessPage(workspaceName) {
1526
1528
  </button>
1527
1529
  </div>
1528
1530
  <span class="visually-hidden skills-status" role="status"></span>
1529
- </section>
1531
+ </section>`}
1530
1532
  </main>
1531
- <script>
1533
+ ${uiContext === "prisma-plugin" ? "" : `<script>
1532
1534
  (() => {
1533
1535
  const command = "npx skills add prisma/skills";
1534
1536
  const button = document.querySelector(".copy");
@@ -1557,7 +1559,7 @@ function renderSuccessPage(workspaceName) {
1557
1559
  }, 2000);
1558
1560
  });
1559
1561
  })();
1560
- <\/script>
1562
+ <\/script>`}
1561
1563
  </body>
1562
1564
  </html>`;
1563
1565
  }
@@ -1598,7 +1600,8 @@ async function performLogin(env, signal, options) {
1598
1600
  tokenStorage,
1599
1601
  env,
1600
1602
  signal,
1601
- onVerificationUrl: options?.onVerificationUrl
1603
+ onVerificationUrl: options?.onVerificationUrl,
1604
+ uiContext: options?.uiContext
1602
1605
  });
1603
1606
  const tokens = tokenStorage.tokens;
1604
1607
  if (!tokens) throw new AuthError$1("Sign-in finished without producing a credential.");
@@ -3449,12 +3452,16 @@ function presentationsFor$2(spec, result) {
3449
3452
  }
3450
3453
  const authLoginCommand = defineCommand({
3451
3454
  managesCredentials: true,
3455
+ args: { flags: { uiContext: flag.enum({
3456
+ values: ["prisma-plugin"],
3457
+ brief: "Show browser completion guidance for the Prisma plugin in ChatGPT (default: terminal guidance)"
3458
+ }) } },
3452
3459
  help: {
3453
3460
  summary: "Log in to your Prisma platform account",
3454
3461
  description: "Opens a browser sign-in and stores a session for one workspace, the account-level container that holds your Projects. Run it again to add a session for another workspace; 'auth workspace use' switches between stored sessions. In CI or other non-interactive environments, skip login and set PRISMA_SERVICE_TOKEN instead.",
3455
3462
  examples: ["auth login"]
3456
3463
  },
3457
- handler: async (_args, ctx) => {
3464
+ handler: async (args, ctx) => {
3458
3465
  const environmentSession = environmentCredentialInForce(ctx.env);
3459
3466
  ctx.report({
3460
3467
  kind: "step-started",
@@ -3462,11 +3469,14 @@ const authLoginCommand = defineCommand({
3462
3469
  });
3463
3470
  let session;
3464
3471
  try {
3465
- const credential = await performLogin(ctx.env, ctx.signal, { onVerificationUrl: (url) => ctx.report({
3466
- kind: "endpoint",
3467
- name: "verification",
3468
- url
3469
- }) });
3472
+ const credential = await performLogin(ctx.env, ctx.signal, {
3473
+ uiContext: args.flags.uiContext,
3474
+ onVerificationUrl: (url) => ctx.report({
3475
+ kind: "endpoint",
3476
+ name: "verification",
3477
+ url
3478
+ })
3479
+ });
3470
3480
  const workspaceId = credentialWorkspaceId(credential.token);
3471
3481
  if (workspaceId === void 0) throw loginWorkspaceUnknownError();
3472
3482
  session = await ctx.credentialManager.createSession(credential, workspaceId);
@@ -14732,13 +14742,38 @@ function memoizedConfigLoader(proc) {
14732
14742
  return load;
14733
14743
  };
14734
14744
  }
14735
- async function assembleRuntime(proc) {
14736
- const stdin = {
14745
+ /**
14746
+ * The engine returns the iterator when it has finished prompting. Node's
14747
+ * stdin iterator cannot honour that while it is awaiting a keystroke,
14748
+ * and a terminal being read keeps the process alive, so the adapter
14749
+ * unrefs stdin itself and settles at once. The underlying return is
14750
+ * left to complete whenever it can, and the next run refs stdin again
14751
+ * before it reads.
14752
+ */
14753
+ function makeStdin(proc) {
14754
+ return {
14737
14755
  setRawMode: proc.stdin.isTTY === true && proc.stdin.setRawMode !== void 0 ? (enabled) => {
14738
14756
  proc.stdin.setRawMode?.(enabled);
14739
14757
  } : void 0,
14740
- [Symbol.asyncIterator]: () => proc.stdin[Symbol.asyncIterator]()
14758
+ [Symbol.asyncIterator]: () => {
14759
+ proc.stdin.ref?.();
14760
+ const chunks = proc.stdin[Symbol.asyncIterator]();
14761
+ return {
14762
+ next: () => chunks.next(),
14763
+ return: async () => {
14764
+ proc.stdin.unref?.();
14765
+ chunks.return?.()?.catch(() => {});
14766
+ return {
14767
+ done: true,
14768
+ value: void 0
14769
+ };
14770
+ }
14771
+ };
14772
+ }
14741
14773
  };
14774
+ }
14775
+ async function assembleRuntime(proc) {
14776
+ const stdin = makeStdin(proc);
14742
14777
  warnOnDeprecatedStateFileEnvVar(proc);
14743
14778
  const apiBaseUrl = getApiBaseUrl(proc.env);
14744
14779
  const authBaseUrl = getAuthBaseUrl(proc.env);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/cli",
3
- "version": "8.0.0-rc.15-dev.114",
3
+ "version": "8.0.0-rc.16-dev.119",
4
4
  "description": "Command-line interface for the Prisma Developer Platform.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -40,11 +40,11 @@
40
40
  "license": "Apache-2.0",
41
41
  "dependencies": {
42
42
  "@manypkg/tools": "^2.1.2",
43
- "@prisma/cli-engine": "0.6.0",
44
- "@prisma/composer-cli": "0.21.0-dev.2",
43
+ "@prisma/cli-engine": "0.6.1",
44
+ "@prisma/composer-cli": "0.21.0-dev.5",
45
45
  "@prisma/compute-sdk": "0.42.0",
46
46
  "@prisma/management-api-sdk": "1.69.0",
47
- "@prisma/orm-toolchain": "8.0.0-rc.11-dev.38",
47
+ "@prisma/orm-toolchain": "8.0.0-rc.11-dev.53",
48
48
  "@vercel/detect-agent": "^1.2.3",
49
49
  "better-result": "^2.9.2",
50
50
  "cross-spawn": "^7.0.6",
@@ -53,11 +53,11 @@
53
53
  "open": "^11.0.0"
54
54
  },
55
55
  "devDependencies": {
56
- "@prisma/composer": "0.21.0-dev.2",
56
+ "@prisma/composer": "0.21.0-dev.5",
57
57
  "@prisma/credentials-store": "^7.8.0",
58
- "@repo/cli-conformance": "8.0.0-rc.15-dev.114",
59
- "@repo/cli-telemetry": "8.0.0-rc.15-dev.114",
60
- "@repo/tsconfig": "8.0.0-rc.15-dev.114",
58
+ "@repo/cli-conformance": "8.0.0-rc.16-dev.119",
59
+ "@repo/cli-telemetry": "8.0.0-rc.16-dev.119",
60
+ "@repo/tsconfig": "8.0.0-rc.16-dev.119",
61
61
  "@types/node": "^22.19.19",
62
62
  "@types/cross-spawn": "^6.0.6",
63
63
  "tsdown": "^0.21.10",