@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,13 +0,0 @@
1
- import { selectPrompt } from "../shell/prompt.js";
2
- //#region src/controllers/select-prompt-port.ts
3
- function createSelectPromptPort(context) {
4
- return { select: ({ message, choices }) => selectPrompt({
5
- input: context.runtime.stdin,
6
- output: context.runtime.stderr,
7
- signal: context.runtime.signal,
8
- message,
9
- choices
10
- }) };
11
- }
12
- //#endregion
13
- export { createSelectPromptPort };
@@ -1,12 +0,0 @@
1
- import { buildVersionResult } from "../lib/version.js";
2
- //#region src/controllers/version.ts
3
- async function runVersion(context) {
4
- return {
5
- command: "version",
6
- result: buildVersionResult(context.runtime.env, context.runtime.argv),
7
- warnings: [],
8
- nextSteps: []
9
- };
10
- }
11
- //#endregion
12
- export { runVersion };
package/dist/errors.js DELETED
@@ -1,102 +0,0 @@
1
- //#region src/errors.ts
2
- var CliError = class extends Error {
3
- code;
4
- domain;
5
- severity;
6
- summary;
7
- why;
8
- fix;
9
- debug;
10
- where;
11
- meta;
12
- docsUrl;
13
- exitCode;
14
- nextSteps;
15
- nextActions;
16
- humanLines;
17
- constructor(options) {
18
- super(options.summary);
19
- this.name = "CliError";
20
- this.code = options.code;
21
- this.domain = options.domain;
22
- this.severity = "error";
23
- this.summary = options.summary;
24
- this.why = options.why;
25
- this.fix = options.fix;
26
- this.debug = options.debug ?? null;
27
- this.where = options.where ?? null;
28
- this.meta = options.meta ?? {};
29
- this.docsUrl = options.docsUrl ?? null;
30
- this.exitCode = options.exitCode ?? 1;
31
- this.nextSteps = options.nextSteps ?? [];
32
- this.nextActions = options.nextActions ?? [];
33
- this.humanLines = options.humanLines && options.humanLines.length > 0 ? [...options.humanLines] : null;
34
- }
35
- };
36
- function usageError(summary, why, fix, nextSteps = [], domain = "cli") {
37
- return new CliError({
38
- code: "USAGE_ERROR",
39
- domain,
40
- summary,
41
- why,
42
- fix,
43
- exitCode: 2,
44
- nextSteps
45
- });
46
- }
47
- function isUsageError(error, summary) {
48
- return isErrorRecord(error) && error.code === "USAGE_ERROR" && (summary === void 0 || error.summary === summary);
49
- }
50
- function isErrorRecord(error) {
51
- return typeof error === "object" && error !== null;
52
- }
53
- function authRequiredError(nextSteps = ["prisma-cli auth login"], options = {}) {
54
- return new CliError({
55
- code: "AUTH_REQUIRED",
56
- domain: "auth",
57
- summary: "Authentication required",
58
- why: "This command needs an authenticated session.",
59
- fix: "Run prisma-cli auth login, or rerun the command in a TTY to sign in interactively.",
60
- debug: options.debug,
61
- exitCode: 1,
62
- nextSteps
63
- });
64
- }
65
- function authConfigInvalidError(message) {
66
- return new CliError({
67
- code: "AUTH_CONFIG_INVALID",
68
- domain: "auth",
69
- summary: "Authentication configuration is invalid",
70
- why: message,
71
- fix: "Provide a valid PRISMA_SERVICE_TOKEN value, or unset the variable to use local OAuth login.",
72
- exitCode: 1,
73
- nextSteps: ["prisma-cli auth login"]
74
- });
75
- }
76
- function commandCanceledError() {
77
- return new CliError({
78
- code: "COMMAND_CANCELED",
79
- domain: "cli",
80
- summary: "Command canceled",
81
- why: null,
82
- fix: null,
83
- exitCode: 130,
84
- humanLines: ["Command canceled [COMMAND_CANCELED]"]
85
- });
86
- }
87
- function workspaceRequiredError() {
88
- return usageError("Workspace required", "This command needs an active workspace, but the authenticated session does not have one.", "Run prisma-cli auth login and choose a workspace.", ["prisma-cli auth login"], "auth");
89
- }
90
- function featureUnavailableError(summary, why, fix, nextSteps = [], domain = "cli") {
91
- return new CliError({
92
- code: "FEATURE_UNAVAILABLE",
93
- domain,
94
- summary,
95
- why,
96
- fix,
97
- exitCode: 1,
98
- nextSteps
99
- });
100
- }
101
- //#endregion
102
- export { CliError, authConfigInvalidError, authRequiredError, commandCanceledError, featureUnavailableError, isUsageError, usageError, workspaceRequiredError };
@@ -1,20 +0,0 @@
1
- import { formatPrismaCliCommand } from "../../cli-command.js";
2
- import { resolvePackageRunner, resolvePackageRunnerSync } from "./package-manager.js";
3
- //#region src/lib/agent/cli-command.ts
4
- async function resolvePrismaCliPackageCommandFormatter(options) {
5
- return createPrismaCliPackageCommandFormatter(await resolvePackageRunner(options));
6
- }
7
- async function resolvePrismaCliPackageCommand(options) {
8
- return (await resolvePrismaCliPackageCommandFormatter(options))(options.args);
9
- }
10
- function resolvePrismaCliPackageCommandFormatterSync(cwd) {
11
- return createPrismaCliPackageCommandFormatter(resolvePackageRunnerSync(cwd));
12
- }
13
- function resolvePrismaCliPackageCommandSync(cwd, args) {
14
- return resolvePrismaCliPackageCommandFormatterSync(cwd)(args);
15
- }
16
- function createPrismaCliPackageCommandFormatter(packageRunner) {
17
- return (args) => formatPrismaCliCommand(args, { packageRunner });
18
- }
19
- //#endregion
20
- export { resolvePrismaCliPackageCommand, resolvePrismaCliPackageCommandFormatterSync, resolvePrismaCliPackageCommandSync };
@@ -1,12 +0,0 @@
1
- //#region src/lib/agent/constants.ts
2
- const PRISMA_SKILLS_SOURCE = "prisma/skills";
3
- const PRISMA_SKILLS_LOCK_FILENAME = "skills-lock.json";
4
- const SKILLS_CLI_PACKAGE = "skills@latest";
5
- const DEFAULT_PRISMA_AGENT_SKILLS = ["*"];
6
- const PRISMA_COMPUTE_AGENT_SKILL = "prisma-compute";
7
- const DEFAULT_PRISMA_AGENT_TARGETS = ["codex", "claude-code"];
8
- const PRISMA_AGENT_INSTALL_ARGS = ["agent", "install"];
9
- const PRISMA_AGENT_UPDATE_ARGS = ["agent", "update"];
10
- const PRISMA_AGENT_STATUS_ARGS = ["agent", "status"];
11
- //#endregion
12
- export { DEFAULT_PRISMA_AGENT_SKILLS, DEFAULT_PRISMA_AGENT_TARGETS, PRISMA_AGENT_INSTALL_ARGS, PRISMA_AGENT_STATUS_ARGS, PRISMA_AGENT_UPDATE_ARGS, PRISMA_COMPUTE_AGENT_SKILL, PRISMA_SKILLS_LOCK_FILENAME, PRISMA_SKILLS_SOURCE, SKILLS_CLI_PACKAGE };
@@ -1,99 +0,0 @@
1
- import { readFileSync, statSync } from "node:fs";
2
- import path from "node:path";
3
- //#region src/lib/agent/package-manager.ts
4
- const LOCKFILE_PACKAGE_MANAGERS = [
5
- {
6
- packageManager: "bun",
7
- fileNames: ["bun.lock", "bun.lockb"]
8
- },
9
- {
10
- packageManager: "pnpm",
11
- fileNames: ["pnpm-lock.yaml", "pnpm-workspace.yaml"]
12
- },
13
- {
14
- packageManager: "yarn",
15
- fileNames: ["yarn.lock"]
16
- },
17
- {
18
- packageManager: "npm",
19
- fileNames: ["package-lock.json", "npm-shrinkwrap.json"]
20
- }
21
- ];
22
- async function resolveSkillsPackageRunner(options) {
23
- return resolvePackageRunner(options);
24
- }
25
- async function resolvePackageRunner(options) {
26
- options.signal.throwIfAborted();
27
- const packageManager = detectPackageManagerSync(options.cwd, options.signal) ?? "npm";
28
- options.signal.throwIfAborted();
29
- return packageRunnerForPackageManager(packageManager);
30
- }
31
- function resolvePackageRunnerSync(cwd) {
32
- return packageRunnerForPackageManager(detectPackageManagerSync(cwd) ?? "npm");
33
- }
34
- function detectPackageManagerSync(cwd, signal) {
35
- let directory = path.resolve(cwd);
36
- while (true) {
37
- signal?.throwIfAborted();
38
- const packageJsonManager = readPackageJsonPackageManager(directory);
39
- if (packageJsonManager) return packageJsonManager;
40
- const lockfileManager = readLockfilePackageManager(directory, signal);
41
- if (lockfileManager) return lockfileManager;
42
- const parent = path.dirname(directory);
43
- if (parent === directory) return null;
44
- directory = parent;
45
- }
46
- }
47
- function readPackageJsonPackageManager(directory) {
48
- const packageJsonPath = path.join(directory, "package.json");
49
- let content;
50
- try {
51
- content = readFileSync(packageJsonPath, "utf8");
52
- } catch (error) {
53
- if (isMissingFileError(error)) return null;
54
- throw error;
55
- }
56
- try {
57
- return parsePackageManager(JSON.parse(content).packageManager);
58
- } catch {
59
- return null;
60
- }
61
- }
62
- function readLockfilePackageManager(directory, signal) {
63
- for (const candidate of LOCKFILE_PACKAGE_MANAGERS) for (const fileName of candidate.fileNames) {
64
- signal?.throwIfAborted();
65
- if (fileExists(path.join(directory, fileName))) return candidate.packageManager;
66
- }
67
- return null;
68
- }
69
- function fileExists(filePath) {
70
- try {
71
- return statSync(filePath).isFile();
72
- } catch (error) {
73
- if (isMissingFileError(error)) return false;
74
- throw error;
75
- }
76
- }
77
- function parsePackageManager(value) {
78
- if (typeof value !== "string") return null;
79
- const normalized = value.trim().toLowerCase();
80
- if (normalized === "bun" || normalized.startsWith("bun@")) return "bun";
81
- if (normalized === "pnpm" || normalized.startsWith("pnpm@")) return "pnpm";
82
- if (normalized === "yarn" || normalized.startsWith("yarn@")) return "yarn";
83
- if (normalized === "npm" || normalized.startsWith("npm@")) return "npm";
84
- return null;
85
- }
86
- function packageRunnerForPackageManager(packageManager) {
87
- switch (packageManager) {
88
- case "bun": return ["bunx"];
89
- case "pnpm": return ["pnpm", "dlx"];
90
- case "yarn": return ["yarn", "dlx"];
91
- case "npm": return ["npx", "-y"];
92
- }
93
- }
94
- function isMissingFileError(error) {
95
- const code = error.code;
96
- return code === "ENOENT" || code === "ENOTDIR";
97
- }
98
- //#endregion
99
- export { detectPackageManagerSync, resolvePackageRunner, resolvePackageRunnerSync, resolveSkillsPackageRunner };
@@ -1,83 +0,0 @@
1
- import { PRISMA_SKILLS_LOCK_FILENAME } from "./constants.js";
2
- import path from "node:path";
3
- import { readFile, stat } from "node:fs/promises";
4
- import { findComputeConfigDir } from "@prisma/compute-sdk/config";
5
- //#region src/lib/agent/setup-status.ts
6
- async function readPrismaAgentSetupStatus(options) {
7
- const setupCwd = await resolvePrismaAgentSetupCwd(options);
8
- const skillsLockPath = path.join(setupCwd, PRISMA_SKILLS_LOCK_FILENAME);
9
- const [skillsInstalled, promptDismissedAt] = await Promise.all([hasPrismaSkillsLock(skillsLockPath, options.signal, options.requiredSkill), options.stateStore?.readAgentSetupPromptDismissedAt() ?? null]);
10
- return {
11
- skillsLockPath: path.basename(skillsLockPath),
12
- skillsInstalled,
13
- promptDismissedAt
14
- };
15
- }
16
- async function resolvePrismaAgentSetupCwd(options) {
17
- options.signal.throwIfAborted();
18
- const configDir = await findComputeConfigDir(options.cwd, options.signal);
19
- options.signal.throwIfAborted();
20
- return configDir ?? options.cwd;
21
- }
22
- function isPrismaAgentSetupComplete(status) {
23
- return status.skillsInstalled;
24
- }
25
- function shouldOfferPrismaAgentSetup(status) {
26
- return !isPrismaAgentSetupComplete(status) && !status.promptDismissedAt;
27
- }
28
- async function isLikelyProjectDirectory(options) {
29
- return (await Promise.all([
30
- "package.json",
31
- "prisma.compute.ts",
32
- "prisma.config.ts",
33
- ".git"
34
- ].map((fileName) => pathExists(path.join(options.cwd, fileName), options.signal)))).some(Boolean);
35
- }
36
- async function hasPrismaSkillsLock(filePath, signal, requiredSkill) {
37
- try {
38
- const raw = await readFile(filePath, {
39
- encoding: "utf8",
40
- signal
41
- });
42
- return hasPrismaSkillsLockEntry(JSON.parse(raw), requiredSkill);
43
- } catch (error) {
44
- if (isNotFoundError(error) || error instanceof SyntaxError) return false;
45
- throw error;
46
- }
47
- }
48
- function hasPrismaSkillsLockEntry(value, requiredSkill) {
49
- if (!isRecord(value)) return false;
50
- if (requiredSkill) return skillLockEntryUsesPrismaSource(readSkillLockEntries(value)[requiredSkill]);
51
- if (readLegacySources(value).includes("prisma/skills")) return true;
52
- return Object.values(readSkillLockEntries(value)).some(skillLockEntryUsesPrismaSource);
53
- }
54
- function readLegacySources(value) {
55
- return Array.isArray(value.sources) ? value.sources.filter((source) => typeof source === "string") : [];
56
- }
57
- function readSkillLockEntries(value) {
58
- return isRecord(value.skills) ? value.skills : {};
59
- }
60
- function skillLockEntryUsesPrismaSource(value) {
61
- return isRecord(value) && value.source === "prisma/skills";
62
- }
63
- function isRecord(value) {
64
- return typeof value === "object" && value !== null;
65
- }
66
- async function pathExists(filePath, signal) {
67
- signal.throwIfAborted();
68
- try {
69
- await stat(filePath);
70
- signal.throwIfAborted();
71
- return true;
72
- } catch (error) {
73
- if (signal.aborted) throw error;
74
- if (isNotFoundError(error)) return false;
75
- throw error;
76
- }
77
- }
78
- function isNotFoundError(error) {
79
- const code = error.code;
80
- return code === "ENOENT" || code === "ENOTDIR";
81
- }
82
- //#endregion
83
- export { isLikelyProjectDirectory, readPrismaAgentSetupStatus, resolvePrismaAgentSetupCwd, shouldOfferPrismaAgentSetup };