@prisma/cli 8.0.0-rc.1 → 8.0.0-rc.2-dev.49
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/cli.js +15410 -16
- package/dist/deploy-framework-C7bQM00A.js +23 -0
- package/dist/{v8/sender.js → sender.js} +2 -2
- package/package.json +11 -15
- package/dist/adapters/git.js +0 -54
- package/dist/adapters/local-state.js +0 -155
- package/dist/auth/client.js +0 -30
- package/dist/auth/errors.js +0 -50
- package/dist/auth/guard.js +0 -39
- package/dist/auth/login.js +0 -471
- package/dist/auth/operations.js +0 -208
- package/dist/auth/recipient.js +0 -42
- package/dist/auth/token-storage.js +0 -439
- package/dist/auth/workspaces.js +0 -171
- package/dist/cli-command.js +0 -14
- package/dist/cli-name.js +0 -12
- package/dist/cli2.js +0 -136
- package/dist/command-arguments.js +0 -12
- package/dist/commands/agent/index.js +0 -60
- package/dist/commands/app/index.js +0 -350
- package/dist/commands/auth/index.js +0 -95
- package/dist/commands/branch/index.js +0 -27
- package/dist/commands/bucket/index.js +0 -123
- package/dist/commands/build/index.js +0 -29
- package/dist/commands/database/index.js +0 -249
- package/dist/commands/env.js +0 -99
- package/dist/commands/feedback/index.js +0 -20
- package/dist/commands/git/index.js +0 -36
- package/dist/commands/init/index.js +0 -33
- package/dist/commands/project/index.js +0 -118
- package/dist/commands/version/index.js +0 -18
- package/dist/controllers/agent-setup.js +0 -52
- package/dist/controllers/agent.js +0 -228
- package/dist/controllers/app-env-api.js +0 -55
- package/dist/controllers/app-env-file.js +0 -181
- package/dist/controllers/app-env.js +0 -502
- package/dist/controllers/app.js +0 -2508
- package/dist/controllers/auth.js +0 -124
- package/dist/controllers/branch.js +0 -92
- package/dist/controllers/bucket.js +0 -184
- package/dist/controllers/build.js +0 -88
- package/dist/controllers/database.js +0 -463
- package/dist/controllers/feedback.js +0 -90
- package/dist/controllers/init.js +0 -814
- package/dist/controllers/project.js +0 -892
- package/dist/controllers/select-prompt-port.js +0 -13
- package/dist/controllers/version.js +0 -12
- package/dist/errors.js +0 -102
- package/dist/lib/agent/cli-command.js +0 -20
- package/dist/lib/agent/constants.js +0 -12
- package/dist/lib/agent/package-manager.js +0 -99
- package/dist/lib/agent/setup-status.js +0 -83
- package/dist/lib/app/app-provider.js +0 -617
- package/dist/lib/app/branch-database-api.js +0 -102
- package/dist/lib/app/branch-database-deploy.js +0 -353
- package/dist/lib/app/branch-database.js +0 -234
- package/dist/lib/app/build-settings.js +0 -98
- package/dist/lib/app/build.js +0 -82
- package/dist/lib/app/bun-project.js +0 -45
- package/dist/lib/app/compute-config.js +0 -145
- package/dist/lib/app/deploy-output.js +0 -24
- package/dist/lib/app/deploy-plan.js +0 -59
- package/dist/lib/app/deploy-progress.js +0 -100
- package/dist/lib/app/domain-guidance.js +0 -14
- package/dist/lib/app/env-config.js +0 -67
- package/dist/lib/app/env-file.js +0 -82
- package/dist/lib/app/env-vars.js +0 -50
- package/dist/lib/app/local-dev.js +0 -109
- package/dist/lib/app/production-deploy-gate.js +0 -162
- package/dist/lib/app/read-branch.js +0 -30
- package/dist/lib/bucket/provider.js +0 -139
- package/dist/lib/database/provider.js +0 -385
- package/dist/lib/diagnostics.js +0 -16
- package/dist/lib/feedback.js +0 -15
- package/dist/lib/fs/home-path.js +0 -24
- package/dist/lib/git/local-branch.js +0 -53
- package/dist/lib/git/local-status.js +0 -57
- package/dist/lib/project/interactive-setup.js +0 -57
- package/dist/lib/project/local-pin.js +0 -200
- package/dist/lib/project/provider.js +0 -93
- package/dist/lib/project/resolution.js +0 -389
- package/dist/lib/project/setup.js +0 -138
- package/dist/lib/version.js +0 -56
- package/dist/lib/workspace-id.js +0 -18
- package/dist/output/patterns.js +0 -90
- package/dist/presenters/agent.js +0 -74
- package/dist/presenters/app-env.js +0 -265
- package/dist/presenters/app.js +0 -672
- package/dist/presenters/auth.js +0 -184
- package/dist/presenters/branch.js +0 -46
- package/dist/presenters/bucket.js +0 -174
- package/dist/presenters/database.js +0 -462
- package/dist/presenters/feedback.js +0 -26
- package/dist/presenters/init.js +0 -30
- package/dist/presenters/project.js +0 -268
- package/dist/presenters/verbose-context.js +0 -64
- package/dist/presenters/version.js +0 -29
- package/dist/shell/cli-command.js +0 -2
- package/dist/shell/command-meta.js +0 -923
- package/dist/shell/command-runner.js +0 -119
- package/dist/shell/diagnostics-output.js +0 -57
- package/dist/shell/global-flags.js +0 -37
- package/dist/shell/help.js +0 -90
- package/dist/shell/output.js +0 -144
- package/dist/shell/prompt.js +0 -48
- package/dist/shell/runtime.js +0 -38
- package/dist/shell/ui.js +0 -116
- package/dist/state-dir.js +0 -12
- package/dist/update-check.js +0 -248
- 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 };
|