@prisma/cli-engine 0.9.0 → 0.10.0
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.
|
@@ -2457,11 +2457,15 @@ function addFlagRedirect(spec, table, redirect, flag) {
|
|
|
2457
2457
|
if (table.has(key)) throw constructionError(`redirect for flag '${flag}' on '${redirect.from}' is declared twice`);
|
|
2458
2458
|
table.set(key, redirect);
|
|
2459
2459
|
}
|
|
2460
|
+
function describeRedirect(redirect) {
|
|
2461
|
+
return redirect.flag === void 0 ? `redirect '${redirect.from}'` : `redirect for flag '${redirect.flag}' on '${redirect.from}'`;
|
|
2462
|
+
}
|
|
2460
2463
|
function buildRedirectTable(spec) {
|
|
2461
2464
|
const byPath = /* @__PURE__ */ new Map();
|
|
2462
2465
|
const byFlag = /* @__PURE__ */ new Map();
|
|
2463
2466
|
for (const commandFamily of spec.commandFamilies) for (const redirect of commandFamily.redirects) {
|
|
2464
2467
|
if (redirect.from === "") throw constructionError("redirect declares an empty path, so no invocation can produce it");
|
|
2468
|
+
if (redirect.replacement.length === 0 && redirect.help === void 0 && redirect.docsUrl === void 0) throw constructionError(`${describeRedirect(redirect)} names no replacement, help, or docs URL, so it gives the user nowhere to go`);
|
|
2465
2469
|
if (redirect.flag === void 0) addVerbRedirect(spec, byPath, redirect);
|
|
2466
2470
|
else addFlagRedirect(spec, byFlag, redirect, redirect.flag);
|
|
2467
2471
|
}
|
|
@@ -5664,30 +5668,46 @@ function retiredInvocation(redirect) {
|
|
|
5664
5668
|
if (redirect.flag === void 0) return `\`${redirect.from}\``;
|
|
5665
5669
|
return `\`--${kebabCase(redirect.flag)}\` on \`${redirect.from}\``;
|
|
5666
5670
|
}
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5671
|
+
function redirectNextActions(redirect, cliName) {
|
|
5672
|
+
const steps = redirect.replacement.map((step, index) => ({
|
|
5673
|
+
kind: "run-command",
|
|
5674
|
+
label: redirect.replacement.length === 1 ? "Use the replacement" : `Step ${index + 1}`,
|
|
5675
|
+
command: resolveExample(step, cliName)
|
|
5676
|
+
}));
|
|
5677
|
+
const help = redirect.help === void 0 ? [] : [{
|
|
5678
|
+
kind: "run-command",
|
|
5679
|
+
label: "Read its help",
|
|
5680
|
+
command: resolveExample(`${redirect.help} --help`, cliName)
|
|
5681
|
+
}];
|
|
5682
|
+
const docs = redirect.docsUrl === void 0 ? [] : [{
|
|
5683
|
+
kind: "open-url",
|
|
5684
|
+
label: "Read the docs",
|
|
5685
|
+
url: redirect.docsUrl
|
|
5686
|
+
}];
|
|
5687
|
+
return [
|
|
5688
|
+
...steps,
|
|
5689
|
+
...help,
|
|
5690
|
+
...docs
|
|
5691
|
+
];
|
|
5692
|
+
}
|
|
5693
|
+
/** A retired flag can name a server command, whose stdout belongs to a
|
|
5670
5694
|
* foreign client — so this settlement renders to stderr for the same
|
|
5671
5695
|
* reason settleUnhandled does. */
|
|
5672
5696
|
function settleCommandMoved(spec, invocation, redirect, commandId) {
|
|
5673
5697
|
if (spec.commands[redirect.from]?.kind === "server-command") invocation.state.format = "human";
|
|
5674
|
-
const
|
|
5675
|
-
kind: "run-command",
|
|
5676
|
-
label: "Use the replacement",
|
|
5677
|
-
command: resolveExample(redirect.replacement, spec.name)
|
|
5678
|
-
};
|
|
5698
|
+
const nextActions = redirectNextActions(redirect, spec.name);
|
|
5679
5699
|
emitErrored(invocation, {
|
|
5680
5700
|
ok: false,
|
|
5681
5701
|
commandId,
|
|
5682
5702
|
error: {
|
|
5683
|
-
code: "CLI.COMMAND_MOVED",
|
|
5703
|
+
code: redirect.code ?? "CLI.COMMAND_MOVED",
|
|
5684
5704
|
severity: "error",
|
|
5685
|
-
summary: `${retiredInvocation(redirect)} has been replaced
|
|
5705
|
+
summary: redirect.summary === void 0 ? `${retiredInvocation(redirect)} has been replaced` : substituteBinName(redirect.summary, spec.name),
|
|
5686
5706
|
...redirect.reason === void 0 ? {} : { why: redirect.reason },
|
|
5687
|
-
nextActions
|
|
5707
|
+
nextActions
|
|
5688
5708
|
},
|
|
5689
5709
|
diagnostics: [],
|
|
5690
|
-
nextActions
|
|
5710
|
+
nextActions
|
|
5691
5711
|
});
|
|
5692
5712
|
return 2;
|
|
5693
5713
|
}
|
|
@@ -5988,9 +6008,7 @@ var EngineImpl = class {
|
|
|
5988
6008
|
const redirect = matchVerbRedirect(this.redirects, attemptedPath(argv));
|
|
5989
6009
|
return redirect !== void 0 && redirect.from.split(" ").length > routed.id.split(".").length ? redirect : void 0;
|
|
5990
6010
|
}
|
|
5991
|
-
/** stricli routed or parsed nothing runnable.
|
|
5992
|
-
* claims the invocation the user typed, the run names its
|
|
5993
|
-
* replacement; otherwise it settles as the usage error it is. */
|
|
6011
|
+
/** stricli routed or parsed nothing runnable. */
|
|
5994
6012
|
settleRouting(invocation, stricliExitCode) {
|
|
5995
6013
|
const matched = this.matchRedirect(invocation.state, stricliExitCode);
|
|
5996
6014
|
if (matched === void 0) return settleUnhandled(this.spec, invocation, stricliExitCode);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as SectionValidation, $t as ManagementApiClient, A as StatementAnswer, At as PackageManagerRunRequest, B as PresentedResult, Bt as flag, C as defineServerCommand, Ct as ExitWithChildStatusOptions, D as OpenUrlOutcome, Dt as SpawnedChild, E as CommandContext, Et as SpawnRequest, F as Block, Ft as ArgsSpec, G as TreeNode, Gt as CredentialIdentity, H as Status, Ht as ActiveAccessTokenOptions, I as Format, It as Char, J as EngineEvent, Jt as SERVICE_TOKEN_ENV_VAR, K as Ui, Kt as CredentialManager, L as Outcome, Lt as CommandArgs, M as StatementQuestion, Mt as PackageManagerRunner, N as StatementSurface, Nt as PackageOperations, O as OpenUrlRequest, Ot as exitWithChildStatus, P as StatementsOptions, Pt as Args, Q as ConfigSection, Qt as CredentialRefresher, R as PRESENTED, Rt as FlagSpec, S as defineCommand, St as ChildStatusSettlement, T as BrowserWaitRequest, Tt as SpawnOptions, U as Text, Ut as ActiveCredential, V as Span, Vt as positional, W as Tone, Wt as Credential, X as StreamEvent, Xt as StoredSessions, Y as Severity, Yt as Session, Z as StreamMeta, Zt as CredentialRefreshResult, _ as ServerCommandDefinition, _t as Runtime, a as RedirectSpec, at as validateSectionWithSchema, b as StatementSpec, bt as RunSummary, c as CommandDefinition, ct as resolveSectionOverChain, d as CommandNeeds, dt as HostProcess, en as ManagementApiClientConfig, et as defineConfigSection, f as CompletedEnvelope, ft as InputStream, g as NeedsSpec, gt as PRISMA_CONFIG_VERSION, h as HelpSpec, ht as OutputStream, i as MountedTree, it as reference, j as StatementOptions, jt as PackageManagerRunResult, k as PromptSurface, kt as PackageManagerId, l as CommandHandler, lt as resolveSectionPath, m as Handler, mt as LoadedConfigFile, n as CommandFamily, nt as ConfigSchemaValue, o as defineCommandFamily, ot as ResolvedSection, p as ErroredEnvelope, pt as LoadedConfig, q as noDataLines, qt as CredentialOrigin, r as CommandRedirect, rt as configSchema, s as AnyCommand, st as SectionProvenance, t as TelemetryDeclaration, tn as TokenStorage, tt as ConfigSchema, u as CommandHelp, ut as Host, v as SessionCommandDefinition, vt as TelemetryPayload, w as defineSessionCommand, wt as SpawnChild, x as WorkflowStep, xt as ChildResult, y as SpawnDeclarations, yt as EngineCommandSnapshot, z as Presentations, zt as PositionalSpec } from "./report-
|
|
1
|
+
import { $ as SectionValidation, $t as ManagementApiClient, A as StatementAnswer, At as PackageManagerRunRequest, B as PresentedResult, Bt as flag, C as defineServerCommand, Ct as ExitWithChildStatusOptions, D as OpenUrlOutcome, Dt as SpawnedChild, E as CommandContext, Et as SpawnRequest, F as Block, Ft as ArgsSpec, G as TreeNode, Gt as CredentialIdentity, H as Status, Ht as ActiveAccessTokenOptions, I as Format, It as Char, J as EngineEvent, Jt as SERVICE_TOKEN_ENV_VAR, K as Ui, Kt as CredentialManager, L as Outcome, Lt as CommandArgs, M as StatementQuestion, Mt as PackageManagerRunner, N as StatementSurface, Nt as PackageOperations, O as OpenUrlRequest, Ot as exitWithChildStatus, P as StatementsOptions, Pt as Args, Q as ConfigSection, Qt as CredentialRefresher, R as PRESENTED, Rt as FlagSpec, S as defineCommand, St as ChildStatusSettlement, T as BrowserWaitRequest, Tt as SpawnOptions, U as Text, Ut as ActiveCredential, V as Span, Vt as positional, W as Tone, Wt as Credential, X as StreamEvent, Xt as StoredSessions, Y as Severity, Yt as Session, Z as StreamMeta, Zt as CredentialRefreshResult, _ as ServerCommandDefinition, _t as Runtime, a as RedirectSpec, at as validateSectionWithSchema, b as StatementSpec, bt as RunSummary, c as CommandDefinition, ct as resolveSectionOverChain, d as CommandNeeds, dt as HostProcess, en as ManagementApiClientConfig, et as defineConfigSection, f as CompletedEnvelope, ft as InputStream, g as NeedsSpec, gt as PRISMA_CONFIG_VERSION, h as HelpSpec, ht as OutputStream, i as MountedTree, it as reference, j as StatementOptions, jt as PackageManagerRunResult, k as PromptSurface, kt as PackageManagerId, l as CommandHandler, lt as resolveSectionPath, m as Handler, mt as LoadedConfigFile, n as CommandFamily, nt as ConfigSchemaValue, o as defineCommandFamily, ot as ResolvedSection, p as ErroredEnvelope, pt as LoadedConfig, q as noDataLines, qt as CredentialOrigin, r as CommandRedirect, rt as configSchema, s as AnyCommand, st as SectionProvenance, t as TelemetryDeclaration, tn as TokenStorage, tt as ConfigSchema, u as CommandHelp, ut as Host, v as SessionCommandDefinition, vt as TelemetryPayload, w as defineSessionCommand, wt as SpawnChild, x as WorkflowStep, xt as ChildResult, y as SpawnDeclarations, yt as EngineCommandSnapshot, z as Presentations, zt as PositionalSpec } from "./report-JfFs29QS.js";
|
|
2
2
|
import { n as CliStructuredError } from "./protocol-YjqPCCOG.js";
|
|
3
3
|
|
|
4
4
|
//#region src/active-access-token.d.ts
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as ok, r as notOk, t as CliStructuredError } from "./protocol-TtNVkeVS.js";
|
|
2
|
-
import { A as noSessionForWorkspaceError, C as claimedIdentity, D as credentialWorkspaceMismatchError, E as credentialRejectedError, O as credentialsRequiredError, S as claimedExpiresAt, T as authServiceError, _ as exitWithChildStatus, a as definePrismaConfig, b as positional, c as PRISMA_CONFIG_VERSION, d as PRESENTED, f as noDataLines, g as resolveGating, h as writeUserConfig, k as emptyServiceTokenError, l as SERVICE_TOKEN_ENV_VAR, m as userConfigPath, n as resolveSectionOverChain, o as loadConfig, p as readUserConfig, r as resolveSectionPath, s as realpathOr, t as buildEngine, u as WORKSPACE_ID_ENV_VAR, v as detectCI, w as credentialWorkspaceId, x as readActiveAccessToken, y as flag } from "./engine-
|
|
2
|
+
import { A as noSessionForWorkspaceError, C as claimedIdentity, D as credentialWorkspaceMismatchError, E as credentialRejectedError, O as credentialsRequiredError, S as claimedExpiresAt, T as authServiceError, _ as exitWithChildStatus, a as definePrismaConfig, b as positional, c as PRISMA_CONFIG_VERSION, d as PRESENTED, f as noDataLines, g as resolveGating, h as writeUserConfig, k as emptyServiceTokenError, l as SERVICE_TOKEN_ENV_VAR, m as userConfigPath, n as resolveSectionOverChain, o as loadConfig, p as readUserConfig, r as resolveSectionPath, s as realpathOr, t as buildEngine, u as WORKSPACE_ID_ENV_VAR, v as detectCI, w as credentialWorkspaceId, x as readActiveAccessToken, y as flag } from "./engine-BevOmYu6.js";
|
|
3
3
|
import { dirname, isAbsolute, resolve } from "node:path";
|
|
4
4
|
import { scope, type } from "arktype";
|
|
5
5
|
//#region src/cli.ts
|
|
@@ -22,12 +22,21 @@ function createCli(spec) {
|
|
|
22
22
|
function normalizePath(from) {
|
|
23
23
|
return from.trim().replace(/\s+/g, " ");
|
|
24
24
|
}
|
|
25
|
+
function replacementSteps(replacement) {
|
|
26
|
+
if (replacement === void 0) return [];
|
|
27
|
+
if (typeof replacement === "string") return [replacement];
|
|
28
|
+
return [...replacement];
|
|
29
|
+
}
|
|
25
30
|
function normalizeRedirect(spec) {
|
|
26
31
|
return Object.freeze({
|
|
27
32
|
from: normalizePath(spec.from),
|
|
28
33
|
flag: spec.flag,
|
|
29
|
-
replacement: spec.replacement,
|
|
30
|
-
reason: spec.reason
|
|
34
|
+
replacement: Object.freeze(replacementSteps(spec.replacement)),
|
|
35
|
+
reason: spec.reason,
|
|
36
|
+
code: spec.code,
|
|
37
|
+
summary: spec.summary,
|
|
38
|
+
help: spec.help,
|
|
39
|
+
docsUrl: spec.docsUrl
|
|
31
40
|
});
|
|
32
41
|
}
|
|
33
42
|
function defineCommandFamily(spec) {
|
|
@@ -1765,10 +1765,9 @@ interface ErroredEnvelope {
|
|
|
1765
1765
|
//#endregion
|
|
1766
1766
|
//#region src/command-family.d.ts
|
|
1767
1767
|
/**
|
|
1768
|
-
* A retired invocation
|
|
1769
|
-
*
|
|
1770
|
-
*
|
|
1771
|
-
* resolve.
|
|
1768
|
+
* A retired invocation. Redirects are metadata, never commands: they
|
|
1769
|
+
* stay out of help and out of the command tree, and are consulted only
|
|
1770
|
+
* when an invocation fails to resolve.
|
|
1772
1771
|
*/
|
|
1773
1772
|
interface RedirectSpec {
|
|
1774
1773
|
/**
|
|
@@ -1784,21 +1783,24 @@ interface RedirectSpec {
|
|
|
1784
1783
|
* (rendered --kebab-case, as flag declarations are).
|
|
1785
1784
|
*/
|
|
1786
1785
|
readonly flag?: string;
|
|
1787
|
-
|
|
1788
|
-
* The replacement invocation, written the way help examples are
|
|
1789
|
-
* written: no binary name, `{bin}` available when the name has to sit
|
|
1790
|
-
* mid-string. Placeholder arguments use angle brackets (`<ref>`).
|
|
1791
|
-
*/
|
|
1792
|
-
readonly replacement: string;
|
|
1786
|
+
readonly replacement?: string | readonly string[];
|
|
1793
1787
|
/** One sentence of context, surfaced as the error's `why`. */
|
|
1794
1788
|
readonly reason?: string;
|
|
1789
|
+
readonly code?: `${string}.${string}`;
|
|
1790
|
+
readonly summary?: string;
|
|
1791
|
+
readonly help?: string;
|
|
1792
|
+
readonly docsUrl?: string;
|
|
1795
1793
|
}
|
|
1796
1794
|
/** The normalized redirect a command family carries. */
|
|
1797
1795
|
interface CommandRedirect {
|
|
1798
1796
|
readonly from: string;
|
|
1799
1797
|
readonly flag: string | undefined;
|
|
1800
|
-
readonly replacement: string;
|
|
1798
|
+
readonly replacement: readonly string[];
|
|
1801
1799
|
readonly reason: string | undefined;
|
|
1800
|
+
readonly code: `${string}.${string}` | undefined;
|
|
1801
|
+
readonly summary: string | undefined;
|
|
1802
|
+
readonly help: string | undefined;
|
|
1803
|
+
readonly docsUrl: string | undefined;
|
|
1802
1804
|
}
|
|
1803
1805
|
/**
|
|
1804
1806
|
* The unit of contribution and ownership a package exports for CLI
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $t as ManagementApiClient, B as PresentedResult, Et as SpawnRequest, Ht as ActiveAccessTokenOptions, J as EngineEvent, Kt as CredentialManager, Mt as PackageManagerRunner, Qt as CredentialRefresher, Ut as ActiveCredential, Wt as Credential, X as StreamEvent, Xt as StoredSessions, Yt as Session, _t as Runtime, bt as RunSummary, en as ManagementApiClientConfig, i as MountedTree, kt as PackageManagerId, n as CommandFamily, t as TelemetryDeclaration, tn as TokenStorage, ut as Host, vt as TelemetryPayload, wt as SpawnChild, x as WorkflowStep, xt as ChildResult } from "./report-
|
|
1
|
+
import { $t as ManagementApiClient, B as PresentedResult, Et as SpawnRequest, Ht as ActiveAccessTokenOptions, J as EngineEvent, Kt as CredentialManager, Mt as PackageManagerRunner, Qt as CredentialRefresher, Ut as ActiveCredential, Wt as Credential, X as StreamEvent, Xt as StoredSessions, Yt as Session, _t as Runtime, bt as RunSummary, en as ManagementApiClientConfig, i as MountedTree, kt as PackageManagerId, n as CommandFamily, t as TelemetryDeclaration, tn as TokenStorage, ut as Host, vt as TelemetryPayload, wt as SpawnChild, x as WorkflowStep, xt as ChildResult } from "./report-JfFs29QS.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
|
package/dist/testing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as noSessionForWorkspaceError, C as claimedIdentity, D as credentialWorkspaceMismatchError, O as credentialsRequiredError, S as claimedExpiresAt, t as buildEngine, w as credentialWorkspaceId, x as readActiveAccessToken } from "./engine-
|
|
1
|
+
import { A as noSessionForWorkspaceError, C as claimedIdentity, D as credentialWorkspaceMismatchError, O as credentialsRequiredError, S as claimedExpiresAt, t as buildEngine, w as credentialWorkspaceId, x as readActiveAccessToken } from "./engine-BevOmYu6.js";
|
|
2
2
|
import { Buffer } from "node:buffer";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
//#region src/in-memory-credential-manager.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/cli-engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "The execution engine of the unified Prisma CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@prisma/management-api-sdk": "1.80.0",
|
|
56
|
-
"@repo/cli-conformance": "8.0.0-rc.
|
|
57
|
-
"@repo/tsconfig": "8.0.0-rc.
|
|
56
|
+
"@repo/cli-conformance": "8.0.0-rc.33-dev.186",
|
|
57
|
+
"@repo/tsconfig": "8.0.0-rc.33-dev.186",
|
|
58
58
|
"@types/node": "^22.19.19",
|
|
59
59
|
"ci-info": "^4.3.1",
|
|
60
60
|
"tsdown": "^0.21.10",
|