@prisma/cli-engine 0.0.9 → 8.0.0-rc.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.
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as PRESENTED, A as EngineCommandSnapshot, At as FlagSpec, B as OpenUrlRequest, C as HostProcess, Ct as ConfigSection, D as PRISMA_CONFIG_VERSION, Dt as ArgsSpec, E as OutputStream, Et as Args, F as PackageManagerRunner, G as SpawnChild, H as ChildResult, I as PackageOperations, J as SpawnedChild, K as SpawnOptions, L as BrowserWaitRequest, M as PackageManagerId, Mt as flag, N as PackageManagerRunRequest, Nt as positional, O as Runtime, Ot as Char, P as PackageManagerRunResult, Q as Outcome, R as CommandContext, S as defineSessionCommand, St as TokenStorage, T as LoadedConfig, Tt as defineConfigSection, U as ChildStatusSettlement, V as PromptSurface, W as ExitWithChildStatusOptions, X as Block, Y as exitWithChildStatus, Z as Format, _ as ServerCommandDefinition, _t as SERVICE_TOKEN_ENV_VAR, a as RedirectSpec, at as Tone, b as defineCommand, bt as ManagementApiClient, c as CommandDefinition, ct as EngineEvent, d as CommandNeeds, dt as StreamMeta, et as Presentations, f as CompletedEnvelope, ft as ActiveCredential, g as NeedsSpec, gt as CredentialOrigin, h as HelpSpec, ht as CredentialManager, i as MountedTree, it as Text, j as RunSummary, jt as PositionalSpec, k as TelemetryPayload, kt as CommandArgs, l as CommandHandler, lt as Severity, m as Handler, mt as CredentialIdentity, n as CommandFamily, nt as Span, o as defineCommandFamily, ot as TreeNode, p as ErroredEnvelope, pt as Credential, q as SpawnRequest, r as CommandRedirect, rt as Status, s as AnyCommand, st as Ui, t as TelemetryDeclaration, tt as PresentedResult, u as CommandHelp, ut as StreamEvent, v as SessionCommandDefinition, vt as Session, w as InputStream, wt as SectionValidation, x as defineServerCommand, xt as ManagementApiClientConfig, y as SpawnDeclarations, yt as StoredSessions, z as OpenUrlOutcome } from "./report-
|
|
1
|
+
import { $ as PRESENTED, A as EngineCommandSnapshot, At as FlagSpec, B as OpenUrlRequest, C as HostProcess, Ct as ConfigSection, D as PRISMA_CONFIG_VERSION, Dt as ArgsSpec, E as OutputStream, Et as Args, F as PackageManagerRunner, G as SpawnChild, H as ChildResult, I as PackageOperations, J as SpawnedChild, K as SpawnOptions, L as BrowserWaitRequest, M as PackageManagerId, Mt as flag, N as PackageManagerRunRequest, Nt as positional, O as Runtime, Ot as Char, P as PackageManagerRunResult, Q as Outcome, R as CommandContext, S as defineSessionCommand, St as TokenStorage, T as LoadedConfig, Tt as defineConfigSection, U as ChildStatusSettlement, V as PromptSurface, W as ExitWithChildStatusOptions, X as Block, Y as exitWithChildStatus, Z as Format, _ as ServerCommandDefinition, _t as SERVICE_TOKEN_ENV_VAR, a as RedirectSpec, at as Tone, b as defineCommand, bt as ManagementApiClient, c as CommandDefinition, ct as EngineEvent, d as CommandNeeds, dt as StreamMeta, et as Presentations, f as CompletedEnvelope, ft as ActiveCredential, g as NeedsSpec, gt as CredentialOrigin, h as HelpSpec, ht as CredentialManager, i as MountedTree, it as Text, j as RunSummary, jt as PositionalSpec, k as TelemetryPayload, kt as CommandArgs, l as CommandHandler, lt as Severity, m as Handler, mt as CredentialIdentity, n as CommandFamily, nt as Span, o as defineCommandFamily, ot as TreeNode, p as ErroredEnvelope, pt as Credential, q as SpawnRequest, r as CommandRedirect, rt as Status, s as AnyCommand, st as Ui, t as TelemetryDeclaration, tt as PresentedResult, u as CommandHelp, ut as StreamEvent, v as SessionCommandDefinition, vt as Session, w as InputStream, wt as SectionValidation, x as defineServerCommand, xt as ManagementApiClientConfig, y as SpawnDeclarations, yt as StoredSessions, z as OpenUrlOutcome } from "./report-B7M-sp7P.js";
|
|
2
2
|
import { n as CliStructuredError } from "./protocol-YjqPCCOG.js";
|
|
3
3
|
|
|
4
4
|
//#region src/cli.d.ts
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as flag, S as exitWithChildStatus, _ as PRESENTED, b as writeUserConfig, c as PRISMA_CONFIG_VERSION, d as authServiceError, f as credentialRejectedError, g as noSessionForWorkspaceError, h as emptyServiceTokenError, i as buildEngine, l as SERVICE_TOKEN_ENV_VAR, m as credentialsRequiredError, n as claimedIdentity, o as defineConfig, p as credentialWorkspaceMismatchError, r as credentialWorkspaceId, s as loadConfig, t as claimedExpiresAt, u as WORKSPACE_ID_ENV_VAR, v as readUserConfig, w as positional, x as resolveGating, y as userConfigPath } from "./token-claims-
|
|
1
|
+
import { C as flag, S as exitWithChildStatus, _ as PRESENTED, b as writeUserConfig, c as PRISMA_CONFIG_VERSION, d as authServiceError, f as credentialRejectedError, g as noSessionForWorkspaceError, h as emptyServiceTokenError, i as buildEngine, l as SERVICE_TOKEN_ENV_VAR, m as credentialsRequiredError, n as claimedIdentity, o as defineConfig, p as credentialWorkspaceMismatchError, r as credentialWorkspaceId, s as loadConfig, t as claimedExpiresAt, u as WORKSPACE_ID_ENV_VAR, v as readUserConfig, w as positional, x as resolveGating, y as userConfigPath } from "./token-claims-Cwrz7N2O.js";
|
|
2
2
|
import { i as ok, r as notOk, t as CliStructuredError } from "./protocol-D1CRNkhv.js";
|
|
3
3
|
//#region src/cli.ts
|
|
4
4
|
/**
|
|
@@ -705,9 +705,10 @@ interface CommandContext<TConfig = undefined, TCode extends number = never> {
|
|
|
705
705
|
*/
|
|
706
706
|
readonly env: Readonly<Record<string, string | undefined>>;
|
|
707
707
|
/**
|
|
708
|
-
*
|
|
709
|
-
*
|
|
710
|
-
*
|
|
708
|
+
* Whether this run is in CI: detected from the environment the host
|
|
709
|
+
* injected, or forced by Runtime.isCIOverride. This is what telemetry
|
|
710
|
+
* gates on. It is one input to the engine's interactivity decision
|
|
711
|
+
* rather than the whole of it (which also weighs a TTY stdin and
|
|
711
712
|
* --interactive/--no-interactive), so prompts and spinners follow
|
|
712
713
|
* ctx.prompt and the engine's interaction handling, not this.
|
|
713
714
|
*/
|
|
@@ -972,12 +973,17 @@ interface Runtime {
|
|
|
972
973
|
readonly stderr: boolean;
|
|
973
974
|
};
|
|
974
975
|
/**
|
|
975
|
-
*
|
|
976
|
-
*
|
|
977
|
-
*
|
|
978
|
-
*
|
|
976
|
+
* Forces the answer to "is this CI", where telemetry never reports.
|
|
977
|
+
* Absent — the normal case — means the engine detects CI from `env`
|
|
978
|
+
* using ci-info's vendor table, which is why no host has to answer:
|
|
979
|
+
* unlike a TTY, CI-ness is derivable from the environment the host
|
|
980
|
+
* already injects, and every host computing the same boolean was the
|
|
981
|
+
* same detection table forked N ways. Set it only where detection
|
|
982
|
+
* cannot be right — an exotic platform, or a test that needs both
|
|
983
|
+
* sides of the branch. Absence means detected, never false, so a host
|
|
984
|
+
* that says nothing still stays silent in CI.
|
|
979
985
|
*/
|
|
980
|
-
readonly
|
|
986
|
+
readonly isCIOverride?: boolean;
|
|
981
987
|
/**
|
|
982
988
|
* Ends the process. The bin passes process.exit; the engine is the
|
|
983
989
|
* only caller (second-signal force exit, 130/143).
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as PackageManagerRunner, G as SpawnChild, H as ChildResult, M as PackageManagerId, O as Runtime, St as TokenStorage, bt as ManagementApiClient, ct as EngineEvent, ft as ActiveCredential, ht as CredentialManager, i as MountedTree, j as RunSummary, k as TelemetryPayload, n as CommandFamily, pt as Credential, q as SpawnRequest, t as TelemetryDeclaration, tt as PresentedResult, ut as StreamEvent, vt as Session, xt as ManagementApiClientConfig, yt as StoredSessions } from "./report-
|
|
1
|
+
import { F as PackageManagerRunner, G as SpawnChild, H as ChildResult, M as PackageManagerId, O as Runtime, St as TokenStorage, bt as ManagementApiClient, ct as EngineEvent, ft as ActiveCredential, ht as CredentialManager, i as MountedTree, j as RunSummary, k as TelemetryPayload, n as CommandFamily, pt as Credential, q as SpawnRequest, t as TelemetryDeclaration, tt as PresentedResult, ut as StreamEvent, vt as Session, xt as ManagementApiClientConfig, yt as StoredSessions } from "./report-B7M-sp7P.js";
|
|
2
2
|
|
|
3
3
|
//#region src/in-memory-credential-manager.d.ts
|
|
4
4
|
/** A stored session with its credential material — what the manager
|
|
@@ -137,7 +137,8 @@ interface TestCli {
|
|
|
137
137
|
};
|
|
138
138
|
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
139
139
|
/** Overrides the CLI-level seed, so one harness can assert both
|
|
140
|
-
* sides of the CI branch.
|
|
140
|
+
* sides of the CI branch. Absent leaves the engine to detect CI
|
|
141
|
+
* from `env`, which is how a test asserts detection itself. */
|
|
141
142
|
readonly isCI?: boolean;
|
|
142
143
|
}): Promise<{
|
|
143
144
|
readonly exitCode: number;
|
|
@@ -229,7 +230,9 @@ declare function createTestCli(spec: {
|
|
|
229
230
|
* the run result either way; pass a spy to assert ordering, a
|
|
230
231
|
* thrower to exercise failure isolation, or `null` to model a host
|
|
231
232
|
* that wires no seam at all. */
|
|
232
|
-
readonly telemetrySpawner?: ((payload: TelemetryPayload) => void) | null;
|
|
233
|
+
readonly telemetrySpawner?: ((payload: TelemetryPayload) => void) | null;
|
|
234
|
+
/** Forces the CI answer for every run; `run({ isCI })` overrides it.
|
|
235
|
+
* Absent leaves the engine to detect CI from the run's `env`. */
|
|
233
236
|
readonly isCI?: boolean;
|
|
234
237
|
}): TestCli;
|
|
235
238
|
//#endregion
|
package/dist/testing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as noSessionForWorkspaceError, i as buildEngine, m as credentialsRequiredError, n as claimedIdentity, p as credentialWorkspaceMismatchError, r as credentialWorkspaceId, t as claimedExpiresAt } from "./token-claims-
|
|
1
|
+
import { g as noSessionForWorkspaceError, i as buildEngine, m as credentialsRequiredError, n as claimedIdentity, p as credentialWorkspaceMismatchError, r as credentialWorkspaceId, t as claimedExpiresAt } from "./token-claims-Cwrz7N2O.js";
|
|
2
2
|
import { Buffer } from "node:buffer";
|
|
3
3
|
//#region src/in-memory-credential-manager.ts
|
|
4
4
|
/**
|
|
@@ -420,7 +420,7 @@ function createTestCli(spec) {
|
|
|
420
420
|
stdout: opts?.isTty?.stdout ?? false,
|
|
421
421
|
stderr: opts?.isTty?.stderr ?? false
|
|
422
422
|
},
|
|
423
|
-
|
|
423
|
+
isCIOverride: opts?.isCI ?? spec.isCI,
|
|
424
424
|
exit: (code) => {
|
|
425
425
|
throw new Error(`@prisma/cli-engine: runtime.exit(${code}) reached the test harness`);
|
|
426
426
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { a as okVoid, r as notOk, t as CliStructuredError } from "./protocol-D1CRNkhv.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { FlagNotFoundError, buildApplication, buildCommand, buildRouteMap, run, text_en } from "@stricli/core";
|
|
4
|
+
import vendors from "ci-info/vendors.json" with { type: "json" };
|
|
4
5
|
import { randomUUID } from "node:crypto";
|
|
5
6
|
import { existsSync, mkdirSync, readFileSync, realpathSync, renameSync, writeFileSync } from "node:fs";
|
|
6
7
|
import { dirname, join, resolve } from "node:path";
|
|
@@ -157,6 +158,67 @@ function isChildStatusSettlement(value) {
|
|
|
157
158
|
return typeof value === "object" && value !== null && value[CHILD_STATUS] === true;
|
|
158
159
|
}
|
|
159
160
|
//#endregion
|
|
161
|
+
//#region src/ci.ts
|
|
162
|
+
/**
|
|
163
|
+
* ci-info's own list of CI providers, read from the installed package
|
|
164
|
+
* rather than copied here, so upgrading ci-info is what teaches the
|
|
165
|
+
* engine a new provider. Its `isCI` export cannot be used instead: that
|
|
166
|
+
* module evaluates against the real `process.env` the moment it is
|
|
167
|
+
* imported, and the engine may only read the environment its host
|
|
168
|
+
* injected.
|
|
169
|
+
*/
|
|
170
|
+
const VENDORS = vendors;
|
|
171
|
+
/**
|
|
172
|
+
* The variables ci-info checks outside the vendor table, catching CI
|
|
173
|
+
* systems that set a conventional variable but have no table entry.
|
|
174
|
+
* These are cross-vendor conventions rather than per-vendor facts,
|
|
175
|
+
* which is why this list holds still while the table grows.
|
|
176
|
+
*/
|
|
177
|
+
const CONVENTIONAL_CI_VARS = [
|
|
178
|
+
"BUILD_ID",
|
|
179
|
+
"BUILD_NUMBER",
|
|
180
|
+
"CI",
|
|
181
|
+
"CI_APP_ID",
|
|
182
|
+
"CI_BUILD_ID",
|
|
183
|
+
"CI_BUILD_NUMBER",
|
|
184
|
+
"CI_NAME",
|
|
185
|
+
"CONTINUOUS_INTEGRATION",
|
|
186
|
+
"RUN_ID"
|
|
187
|
+
];
|
|
188
|
+
function isSet(value) {
|
|
189
|
+
return value !== void 0 && value !== "";
|
|
190
|
+
}
|
|
191
|
+
function checkMatches(check, env) {
|
|
192
|
+
if (typeof check === "string") return isSet(env[check]);
|
|
193
|
+
const { env: variable, includes, any } = check;
|
|
194
|
+
if (typeof variable === "string" && typeof includes === "string") return env[variable]?.includes(includes) === true;
|
|
195
|
+
if (Array.isArray(any)) return any.some((name) => isSet(env[String(name)]));
|
|
196
|
+
return Object.entries(check).every(([name, value]) => env[name] === value);
|
|
197
|
+
}
|
|
198
|
+
function vendorMatches(vendor, env) {
|
|
199
|
+
return (Array.isArray(vendor.env) ? vendor.env : [vendor.env]).every((check) => checkMatches(check, env));
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Whether this environment is a CI environment, by ci-info's rules
|
|
203
|
+
* applied to the environment the host injected rather than to
|
|
204
|
+
* `process.env`. `CI=false` is an explicit denial that stops every
|
|
205
|
+
* other check, exactly as ci-info treats it.
|
|
206
|
+
*/
|
|
207
|
+
function detectCI(env) {
|
|
208
|
+
if (env.CI === "false") return false;
|
|
209
|
+
if (CONVENTIONAL_CI_VARS.some((name) => isSet(env[name]))) return true;
|
|
210
|
+
return VENDORS.some((vendor) => vendorMatches(vendor, env));
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* The engine's one answer to "is this run in CI", read by telemetry
|
|
214
|
+
* gating, `ctx.isCI` and the default interactivity decision. A host
|
|
215
|
+
* that says nothing gets detection, so forgetting to answer cannot turn
|
|
216
|
+
* a CI run into a reporting one.
|
|
217
|
+
*/
|
|
218
|
+
function resolveIsCI(host) {
|
|
219
|
+
return host.isCIOverride ?? detectCI(host.env);
|
|
220
|
+
}
|
|
221
|
+
//#endregion
|
|
160
222
|
//#region src/telemetry/endpoint.ts
|
|
161
223
|
/**
|
|
162
224
|
* Production endpoint pinned to the deployed Prisma Compute backend.
|
|
@@ -466,7 +528,7 @@ function reportCommandStart(inputs) {
|
|
|
466
528
|
if (!resolveGating({
|
|
467
529
|
env: host.env,
|
|
468
530
|
config,
|
|
469
|
-
inCI: host
|
|
531
|
+
inCI: resolveIsCI(host)
|
|
470
532
|
}).enabled) return;
|
|
471
533
|
const stored = config.installationId;
|
|
472
534
|
const installationId = typeof stored === "string" && stored.length > 0 ? stored : discloseAndMint(inputs);
|
|
@@ -1363,9 +1425,13 @@ function resolveColorEnabled(shared, runtime) {
|
|
|
1363
1425
|
* --no-interactive override in either direction. Format never decides
|
|
1364
1426
|
* interactivity (operator ruling, 2026-08-09): an interactive json run
|
|
1365
1427
|
* may prompt — the prompt UI writes to stderr, so stdout stays a clean
|
|
1366
|
-
* frame stream.
|
|
1428
|
+
* frame stream.
|
|
1429
|
+
*
|
|
1430
|
+
* This asks the engine's CI detection rather than testing `CI` for
|
|
1431
|
+
* being set at all: a Jenkins, TeamCity or Azure Pipelines job sets no
|
|
1432
|
+
* `CI` variable, and used to be offered a prompt no one could answer. */
|
|
1367
1433
|
function defaultInteractive(runtime) {
|
|
1368
|
-
return runtime.isTty.stdin && runtime
|
|
1434
|
+
return runtime.isTty.stdin && !resolveIsCI(runtime);
|
|
1369
1435
|
}
|
|
1370
1436
|
function resolveAutoFormat(shared, runtime) {
|
|
1371
1437
|
if (shared.json === true) return "json";
|
|
@@ -2962,7 +3028,7 @@ function makeContext(invocation, def, config, capabilities) {
|
|
|
2962
3028
|
signal: invocation.signal,
|
|
2963
3029
|
cwd: invocation.runtime.cwd,
|
|
2964
3030
|
env: invocation.runtime.env,
|
|
2965
|
-
isCI: invocation.runtime
|
|
3031
|
+
isCI: resolveIsCI(invocation.runtime),
|
|
2966
3032
|
requireDependency: async (specifier) => {
|
|
2967
3033
|
if (dependencyResolvable(specifier, invocation.runtime.cwd)) return okVoid();
|
|
2968
3034
|
return notOk(missingDependencyError(specifier, await resolvePackageManager({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/cli-engine",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "8.0.0-rc.1",
|
|
4
4
|
"description": "The execution engine of the unified Prisma CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -39,26 +39,26 @@
|
|
|
39
39
|
"url": "https://github.com/prisma/prisma-cli/issues"
|
|
40
40
|
},
|
|
41
41
|
"license": "Apache-2.0",
|
|
42
|
-
"scripts": {
|
|
43
|
-
"build": "tsdown",
|
|
44
|
-
"prepack": "pnpm run build",
|
|
45
|
-
"typecheck": "tsc --noEmit",
|
|
46
|
-
"test": "pnpm run build && pnpm run typecheck && vitest run"
|
|
47
|
-
},
|
|
48
42
|
"dependencies": {
|
|
49
43
|
"@clack/prompts": "1.5.0",
|
|
50
44
|
"@prisma/management-api-sdk": "1.55.0",
|
|
51
45
|
"@stricli/core": "1.3.0",
|
|
52
46
|
"c12": "3.3.4",
|
|
47
|
+
"ci-info": "^4.3.1",
|
|
53
48
|
"colorette": "^2.0.20",
|
|
54
49
|
"package-manager-detector": "1.8.0",
|
|
55
50
|
"string-width": "^8.2.1"
|
|
56
51
|
},
|
|
57
52
|
"devDependencies": {
|
|
58
|
-
"@repo/tsconfig": "
|
|
53
|
+
"@repo/tsconfig": "8.0.0-rc.1",
|
|
59
54
|
"@types/node": "^22.19.19",
|
|
60
55
|
"tsdown": "^0.21.10",
|
|
61
56
|
"typescript": "^6.0.3",
|
|
62
57
|
"vitest": "^4.1.8"
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "tsdown",
|
|
61
|
+
"typecheck": "tsc --noEmit",
|
|
62
|
+
"test": "pnpm run build && pnpm run typecheck && vitest run"
|
|
63
63
|
}
|
|
64
|
-
}
|
|
64
|
+
}
|