@prisma/cli-engine 0.7.0 → 0.9.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.
- package/README.md +15 -1
- package/dist/{engine-DVJ5Ie5H.js → engine-BBuDSD7p.js} +104 -41
- package/dist/index.d.ts +6 -4
- package/dist/index.js +14 -10
- package/dist/{report-CQ30sy_e.d.ts → report-C6k54wjM.d.ts} +5 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The execution engine of the unified Prisma CLI: it owns the path from argv to exit code — parsing, execution, rendering, and error handling.
|
|
4
4
|
|
|
5
|
-
Every command describes its output once, as blocks, and the engine renders it in one of three formats chosen by `--format`: `human` for a person at a terminal (padded, aligned, coloured, on stderr, with the machine-usable data lines on stdout), `json` for a program (a stream of frames ending in a result envelope on stdout), and `markdown` for an agent that reads the output as text (plain Markdown with every value labelled, everything on stdout, nothing on stderr).
|
|
5
|
+
Every command describes its output once, as blocks, and the engine renders it in one of three formats chosen by `--format`: `human` for a person at a terminal (padded, aligned, coloured, on stderr, with the machine-usable data lines on stdout), `json` for a program (a stream of frames ending in a result envelope on stdout), and `markdown` for an agent that reads the output as text (plain Markdown with every value labelled, everything on stdout, nothing on stderr). Without a format flag the format is `human`, whether stdout is a terminal or a pipe: a pipe receives the command's data lines and nothing else. `json` and `markdown` are only ever explicit.
|
|
6
6
|
|
|
7
7
|
## Entry points
|
|
8
8
|
|
|
@@ -10,6 +10,20 @@ Every command describes its output once, as blocks, and the engine renders it in
|
|
|
10
10
|
- `@prisma/cli-engine/protocol` — the wire types for machine-readable (JSON) output.
|
|
11
11
|
- `@prisma/cli-engine/testing` — the test harness for running commands in-process.
|
|
12
12
|
|
|
13
|
+
## Mounting commands
|
|
14
|
+
|
|
15
|
+
`createCli` takes commands by path. Every path with more than one word needs its group declared in `groups`, and the group's `brief` is its row on the parent's help card. A path can be a command and a group at once:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
createCli({
|
|
19
|
+
groups: { dev: { brief: "Run the app locally. Start it, print URLs, stop it" } },
|
|
20
|
+
commands: { dev, "dev url": devUrl, "dev stop": devStop },
|
|
21
|
+
// ...
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`dev module.ts` runs `dev` with the positional `module.ts`, and `dev url gateway` runs `dev url`. When the word after `dev` names a command beneath it, that command runs, so `dev url` never reaches `dev` as a positional. To pass such a word as the positional, put `--` before it: `dev -- url` runs `dev` with `url`. A retired path declared as a redirect, such as `dev up`, wins over the positional the same way. `dev --help` shows the `dev` command's help and lists `url` and `stop`.
|
|
26
|
+
|
|
13
27
|
## Statement prompts
|
|
14
28
|
|
|
15
29
|
A command asks what the user means to happen to something with `ctx.prompt.statement`. The answer is a verb and free text, and the command validates it.
|
|
@@ -1230,6 +1230,12 @@ function runCommand(manager, request) {
|
|
|
1230
1230
|
//#endregion
|
|
1231
1231
|
//#region src/presentation.ts
|
|
1232
1232
|
const PRESENTED = Symbol.for("prisma.cli-engine.presented");
|
|
1233
|
+
/** The `stdout` of a command whose only result is that it succeeded,
|
|
1234
|
+
* such as a delete. The reason says why the command has no data, where
|
|
1235
|
+
* its presentation is defined. */
|
|
1236
|
+
function noDataLines(_reason) {
|
|
1237
|
+
return () => [];
|
|
1238
|
+
}
|
|
1233
1239
|
//#endregion
|
|
1234
1240
|
//#region src/credential-manager.ts
|
|
1235
1241
|
/** The environment variables that supply a credential to a process: a
|
|
@@ -2110,12 +2116,13 @@ const SHARED_ALIASES = {
|
|
|
2110
2116
|
};
|
|
2111
2117
|
/** The pre-parse format decision: json framing must be in effect before
|
|
2112
2118
|
* stricli parses (its own failure output is framed too), so the format
|
|
2113
|
-
* flags are read from raw argv
|
|
2114
|
-
|
|
2115
|
-
|
|
2119
|
+
* flags are read from raw argv. Where stdout goes never picks the
|
|
2120
|
+
* format: a pipe gets human output, whose stdout is the data lines. */
|
|
2121
|
+
function sniffFormat(argv) {
|
|
2122
|
+
return formatFlagGiven(argv) ?? "human";
|
|
2116
2123
|
}
|
|
2117
2124
|
function applySharedFlags(state, shared, runtime) {
|
|
2118
|
-
state.format = shared.format ??
|
|
2125
|
+
state.format = shared.format ?? (shared.json === true ? "json" : "human");
|
|
2119
2126
|
state.yes = shared.yes === true;
|
|
2120
2127
|
state.confirmValues = [...shared.confirm ?? []];
|
|
2121
2128
|
state.interactive = shared.interactive ?? defaultInteractive(runtime);
|
|
@@ -2146,10 +2153,6 @@ function resolveColorEnabled(shared, runtime) {
|
|
|
2146
2153
|
function defaultInteractive(runtime) {
|
|
2147
2154
|
return runtime.isTty.stdin && !resolveIsCI(runtime);
|
|
2148
2155
|
}
|
|
2149
|
-
function resolveAutoFormat(shared, runtime) {
|
|
2150
|
-
if (shared.json === true) return "json";
|
|
2151
|
-
return runtime.isTty.stdout ? "human" : "json";
|
|
2152
|
-
}
|
|
2153
2156
|
/** --quiet and --verbose are log-level shorthands; either one beats an
|
|
2154
2157
|
* explicit --log-level given alongside it. */
|
|
2155
2158
|
function resolveLogLevel(shared) {
|
|
@@ -2183,17 +2186,19 @@ function statementBrief(verb, spec) {
|
|
|
2183
2186
|
return spec.brief ?? `Say what happens to <subject>: ${verb}, instead of being asked (repeatable)`;
|
|
2184
2187
|
}
|
|
2185
2188
|
/** The command argv routes to, found the way the parser routes: the
|
|
2186
|
-
* leading words, group by group, until one names a command.
|
|
2187
|
-
*
|
|
2189
|
+
* leading words, group by group, until one names a command. A group
|
|
2190
|
+
* with its own command routes to it at the first word that names no
|
|
2191
|
+
* child. Like the parser, a kebab-case word matches a camelCase name. */
|
|
2188
2192
|
function routedCommand(tree, argv) {
|
|
2189
2193
|
let node = tree;
|
|
2190
2194
|
for (const token of argv) {
|
|
2191
2195
|
const entry = node.commands.get(token) ?? node.commands.get(camelCase(token));
|
|
2192
2196
|
if (entry !== void 0) return entry;
|
|
2193
2197
|
const child = node.children.get(token) ?? node.children.get(camelCase(token));
|
|
2194
|
-
if (child === void 0) return;
|
|
2198
|
+
if (child === void 0) return node.ownCommand;
|
|
2195
2199
|
node = child;
|
|
2196
2200
|
}
|
|
2201
|
+
return node.ownCommand;
|
|
2197
2202
|
}
|
|
2198
2203
|
function statementFlagIn(token, statements) {
|
|
2199
2204
|
if (!token.startsWith("--")) return;
|
|
@@ -2323,30 +2328,43 @@ function validateSpawnDeclarations(path, def) {
|
|
|
2323
2328
|
}
|
|
2324
2329
|
function emptyNode() {
|
|
2325
2330
|
return {
|
|
2331
|
+
ownCommand: void 0,
|
|
2326
2332
|
commands: /* @__PURE__ */ new Map(),
|
|
2327
2333
|
children: /* @__PURE__ */ new Map()
|
|
2328
2334
|
};
|
|
2329
2335
|
}
|
|
2330
|
-
function
|
|
2336
|
+
function childNode(node, segment) {
|
|
2337
|
+
let child = node.children.get(segment);
|
|
2338
|
+
if (child === void 0) {
|
|
2339
|
+
child = emptyNode();
|
|
2340
|
+
node.children.set(segment, child);
|
|
2341
|
+
}
|
|
2342
|
+
return child;
|
|
2343
|
+
}
|
|
2344
|
+
/** Every path some other mounted path extends: `dev` when `dev url` is
|
|
2345
|
+
* mounted. */
|
|
2346
|
+
function groupPathsOf(paths) {
|
|
2347
|
+
const groups = /* @__PURE__ */ new Set();
|
|
2348
|
+
for (const path of paths) {
|
|
2349
|
+
const segments = path.split(" ");
|
|
2350
|
+
for (let depth = 1; depth < segments.length; depth += 1) groups.add(segments.slice(0, depth).join(" "));
|
|
2351
|
+
}
|
|
2352
|
+
return groups;
|
|
2353
|
+
}
|
|
2354
|
+
/** A path that is also a group keeps its command on the group's node,
|
|
2355
|
+
* so the node's children and its own command meet in one place. */
|
|
2356
|
+
function insertCommand(root, path, def, docsBaseUrl, isGroup) {
|
|
2331
2357
|
const segments = path.split(" ");
|
|
2332
2358
|
if (segments.some((segment) => segment.length === 0)) throw constructionError(`invalid command path '${path}'`);
|
|
2333
|
-
|
|
2334
|
-
for (const segment of segments.slice(0, -1)) {
|
|
2335
|
-
if (node.commands.has(segment)) throw constructionError(`command path '${path}' collides with a command mounted at a prefix of it`);
|
|
2336
|
-
let child = node.children.get(segment);
|
|
2337
|
-
if (child === void 0) {
|
|
2338
|
-
child = emptyNode();
|
|
2339
|
-
node.children.set(segment, child);
|
|
2340
|
-
}
|
|
2341
|
-
node = child;
|
|
2342
|
-
}
|
|
2343
|
-
const leaf = segments[segments.length - 1];
|
|
2344
|
-
if (node.commands.has(leaf) || node.children.has(leaf)) throw constructionError(`command path '${path}' collides with another mounted command`);
|
|
2345
|
-
node.commands.set(leaf, {
|
|
2359
|
+
const entry = {
|
|
2346
2360
|
def,
|
|
2347
2361
|
id: segments.join("."),
|
|
2348
2362
|
docsBaseUrl
|
|
2349
|
-
}
|
|
2363
|
+
};
|
|
2364
|
+
const parent = segments.slice(0, -1).reduce((node, segment) => childNode(node, segment), root);
|
|
2365
|
+
const leaf = segments[segments.length - 1];
|
|
2366
|
+
if (isGroup) childNode(parent, leaf).ownCommand = entry;
|
|
2367
|
+
else parent.commands.set(leaf, entry);
|
|
2350
2368
|
}
|
|
2351
2369
|
/** A command belongs to the family whose commands record contains it
|
|
2352
2370
|
* (identity). Harness-mounted commands with no family are unowned. */
|
|
@@ -2389,6 +2407,7 @@ function buildCommandTree(spec) {
|
|
|
2389
2407
|
if (paths.length === 0) throw constructionError("createCli requires at least one mounted command");
|
|
2390
2408
|
validateDocsBaseUrls(spec);
|
|
2391
2409
|
validateConfigSectionNames(spec);
|
|
2410
|
+
const groupPaths = groupPathsOf(paths);
|
|
2392
2411
|
const root = emptyNode();
|
|
2393
2412
|
for (const path of paths) {
|
|
2394
2413
|
const def = spec.commands[path];
|
|
@@ -2403,7 +2422,7 @@ function buildCommandTree(spec) {
|
|
|
2403
2422
|
const groupPath = segments.slice(0, depth).join(" ");
|
|
2404
2423
|
if (spec.groups[groupPath] === void 0) throw constructionError(`command path '${path}' references unknown group '${groupPath}' (declare it in createCli's groups)`);
|
|
2405
2424
|
}
|
|
2406
|
-
insertCommand(root, path, def, commandFamilyOf(spec, def)?.docsBaseUrl);
|
|
2425
|
+
insertCommand(root, path, def, commandFamilyOf(spec, def)?.docsBaseUrl, groupPaths.has(path));
|
|
2407
2426
|
}
|
|
2408
2427
|
return root;
|
|
2409
2428
|
}
|
|
@@ -2732,15 +2751,30 @@ function toStricliCommand(entry, cliName, runEntry) {
|
|
|
2732
2751
|
docs: commandDocs(entry.def, cliName)
|
|
2733
2752
|
});
|
|
2734
2753
|
}
|
|
2754
|
+
/** The route a group's own command sits under, hidden from listings.
|
|
2755
|
+
* A child's name is one path segment and never contains a space, so no
|
|
2756
|
+
* child can take this name. A user can still type it, so it is dropped
|
|
2757
|
+
* from the path the parser reports. */
|
|
2758
|
+
const OWN_COMMAND_ROUTE = "<own command>";
|
|
2735
2759
|
function buildRoutes(spec, node, groupPath, runEntry) {
|
|
2736
2760
|
const routes = {};
|
|
2761
|
+
if (node.ownCommand !== void 0) routes[OWN_COMMAND_ROUTE] = toStricliCommand(node.ownCommand, spec.name, runEntry);
|
|
2737
2762
|
for (const [name, entry] of node.commands) routes[name] = toStricliCommand(entry, spec.name, runEntry);
|
|
2738
2763
|
for (const [name, child] of node.children) routes[name] = buildRoutes(spec, child, groupPath === "" ? name : `${groupPath} ${name}`, runEntry);
|
|
2764
|
+
const docs = groupPath === "" ? { brief: spec.name } : {
|
|
2765
|
+
brief: spec.groups[groupPath].brief,
|
|
2766
|
+
fullDescription: spec.groups[groupPath].description
|
|
2767
|
+
};
|
|
2768
|
+
if (node.ownCommand === void 0) return buildRouteMap({
|
|
2769
|
+
routes,
|
|
2770
|
+
docs
|
|
2771
|
+
});
|
|
2739
2772
|
return buildRouteMap({
|
|
2740
2773
|
routes,
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2774
|
+
defaultCommand: OWN_COMMAND_ROUTE,
|
|
2775
|
+
docs: {
|
|
2776
|
+
...docs,
|
|
2777
|
+
hideRoute: { [OWN_COMMAND_ROUTE]: true }
|
|
2744
2778
|
}
|
|
2745
2779
|
});
|
|
2746
2780
|
}
|
|
@@ -5000,7 +5034,8 @@ function helpPath(argv) {
|
|
|
5000
5034
|
return segments;
|
|
5001
5035
|
}
|
|
5002
5036
|
/** Walks as far as the segments stay recognized; help for `project
|
|
5003
|
-
* frobnicate` is project's help, not a dead end.
|
|
5037
|
+
* frobnicate` is project's help, not a dead end. A group with its own
|
|
5038
|
+
* command answers with that command's help. */
|
|
5004
5039
|
function resolveTarget(root, segments) {
|
|
5005
5040
|
let node = root;
|
|
5006
5041
|
const path = [];
|
|
@@ -5008,8 +5043,9 @@ function resolveTarget(root, segments) {
|
|
|
5008
5043
|
const entry = node.commands.get(segment);
|
|
5009
5044
|
if (entry !== void 0) return {
|
|
5010
5045
|
target: {
|
|
5011
|
-
kind: "
|
|
5012
|
-
entry
|
|
5046
|
+
kind: "command",
|
|
5047
|
+
entry,
|
|
5048
|
+
subcommands: void 0
|
|
5013
5049
|
},
|
|
5014
5050
|
path: [...path, segment]
|
|
5015
5051
|
};
|
|
@@ -5018,6 +5054,14 @@ function resolveTarget(root, segments) {
|
|
|
5018
5054
|
node = child;
|
|
5019
5055
|
path.push(segment);
|
|
5020
5056
|
}
|
|
5057
|
+
if (node.ownCommand !== void 0) return {
|
|
5058
|
+
target: {
|
|
5059
|
+
kind: "command",
|
|
5060
|
+
entry: node.ownCommand,
|
|
5061
|
+
subcommands: node
|
|
5062
|
+
},
|
|
5063
|
+
path
|
|
5064
|
+
};
|
|
5021
5065
|
return {
|
|
5022
5066
|
target: {
|
|
5023
5067
|
kind: "node",
|
|
@@ -5029,8 +5073,9 @@ function resolveTarget(root, segments) {
|
|
|
5029
5073
|
/** A BARE group invocation (`prisma-cli project`, or no argv at all)
|
|
5030
5074
|
* is a help request; anything carrying flags or extra tokens is not —
|
|
5031
5075
|
* `cli --unknown` and `cli project --frobnicate` must reach routing
|
|
5032
|
-
* and usage validation, not exit 0 with a help card. A bare leaf
|
|
5033
|
-
*
|
|
5076
|
+
* and usage validation, not exit 0 with a help card. A bare leaf, or
|
|
5077
|
+
* a bare group with its own command, is a command run and is left
|
|
5078
|
+
* alone. The format-selection flags do not
|
|
5034
5079
|
* count: `cli project --format markdown` asks for the group's help in
|
|
5035
5080
|
* Markdown. */
|
|
5036
5081
|
function bareGroupInvocation(root, rawArgv) {
|
|
@@ -5051,7 +5096,7 @@ function renderHelp(spec, root, argv, options, out) {
|
|
|
5051
5096
|
}
|
|
5052
5097
|
function helpCard(spec, root, argv) {
|
|
5053
5098
|
const { target, path } = resolveTarget(root, helpPath(argv));
|
|
5054
|
-
return target.kind === "
|
|
5099
|
+
return target.kind === "command" ? leafCard(spec, target.entry, target.subcommands, path) : nodeCard(spec, target.node, path);
|
|
5055
5100
|
}
|
|
5056
5101
|
function nodeCard(spec, node, path) {
|
|
5057
5102
|
const atRoot = path.length === 0;
|
|
@@ -5073,7 +5118,7 @@ function nodeCard(spec, node, path) {
|
|
|
5073
5118
|
docsUrl: atRoot ? spec.help?.docsUrl : void 0
|
|
5074
5119
|
};
|
|
5075
5120
|
}
|
|
5076
|
-
function leafCard(spec, entry, path) {
|
|
5121
|
+
function leafCard(spec, entry, subcommands, path) {
|
|
5077
5122
|
const def = entry.def;
|
|
5078
5123
|
const usage = [
|
|
5079
5124
|
spec.name,
|
|
@@ -5089,7 +5134,7 @@ function leafCard(spec, entry, path) {
|
|
|
5089
5134
|
tagline: def.help.summary,
|
|
5090
5135
|
usage,
|
|
5091
5136
|
description: def.help.description,
|
|
5092
|
-
commands: [],
|
|
5137
|
+
commands: subcommands === void 0 ? [] : nodeRows(spec, subcommands, path),
|
|
5093
5138
|
workflow: [],
|
|
5094
5139
|
arguments: Object.values(def.args.positionals).map((spec) => positionalRuntime(spec)).map((runtime) => ({
|
|
5095
5140
|
name: runtime.placeholder,
|
|
@@ -5124,6 +5169,7 @@ function renderHelpTerminal(card, paint) {
|
|
|
5124
5169
|
lines.push(rail(paint));
|
|
5125
5170
|
proseLines(card.description, paint, lines);
|
|
5126
5171
|
}
|
|
5172
|
+
if (card.kind === "leaf") rowSection("Commands", card.commands, paint, lines);
|
|
5127
5173
|
workflowLines(card.workflow, paint, lines);
|
|
5128
5174
|
rowSection("Arguments", card.arguments, paint, lines);
|
|
5129
5175
|
rowSection("Options", card.options, paint, lines);
|
|
@@ -5647,7 +5693,7 @@ function settleCommandMoved(spec, invocation, redirect, commandId) {
|
|
|
5647
5693
|
}
|
|
5648
5694
|
/** The command path stricli resolved, without the binary name. */
|
|
5649
5695
|
function commandSegments(spec, prefix) {
|
|
5650
|
-
return prefix[0] === spec.name ? prefix.slice(1) : prefix;
|
|
5696
|
+
return (prefix[0] === spec.name ? prefix.slice(1) : prefix).filter((segment) => segment !== OWN_COMMAND_ROUTE);
|
|
5651
5697
|
}
|
|
5652
5698
|
/** Maps stricli's own settlement (parse/route failures, framework bugs)
|
|
5653
5699
|
* onto the engine protocol when the pipeline never settled. A failure
|
|
@@ -5768,7 +5814,7 @@ var EngineImpl = class {
|
|
|
5768
5814
|
this.redirects = buildRedirectTable(spec);
|
|
5769
5815
|
}
|
|
5770
5816
|
async execute(argv, runtime, hooks) {
|
|
5771
|
-
const format = sniffFormat(argv
|
|
5817
|
+
const format = sniffFormat(argv);
|
|
5772
5818
|
const state = {
|
|
5773
5819
|
commandId: "",
|
|
5774
5820
|
docsBaseUrl: void 0,
|
|
@@ -5859,6 +5905,13 @@ var EngineImpl = class {
|
|
|
5859
5905
|
}, stream);
|
|
5860
5906
|
return 0;
|
|
5861
5907
|
}
|
|
5908
|
+
const retired = this.retiredPathBeneathCommand(argv);
|
|
5909
|
+
if (retired !== void 0) {
|
|
5910
|
+
unsubscribe();
|
|
5911
|
+
const exitCode = settleCommandMoved(this.spec, invocation, retired, retired.from.replaceAll(" ", "."));
|
|
5912
|
+
this.fireOnSettled(invocation, exitCode, startedAtMs);
|
|
5913
|
+
return exitCode;
|
|
5914
|
+
}
|
|
5862
5915
|
const stricliArgv = this.takeStatementFlags(invocation, argv, startedAtMs);
|
|
5863
5916
|
if (stricliArgv === void 0) {
|
|
5864
5917
|
unsubscribe();
|
|
@@ -5925,6 +5978,16 @@ var EngineImpl = class {
|
|
|
5925
5978
|
state.statementValues = extraction.values;
|
|
5926
5979
|
return extraction.argv;
|
|
5927
5980
|
}
|
|
5981
|
+
/** A retired path beneath a mounted command, such as `dev up` beside
|
|
5982
|
+
* `dev`. The parser would hand `up` to `dev` as a positional, so the
|
|
5983
|
+
* redirect is matched first: a retired child's name wins over the
|
|
5984
|
+
* positional, as a live child's name does. */
|
|
5985
|
+
retiredPathBeneathCommand(argv) {
|
|
5986
|
+
const routed = routedCommand(this.tree, argv);
|
|
5987
|
+
if (routed === void 0) return;
|
|
5988
|
+
const redirect = matchVerbRedirect(this.redirects, attemptedPath(argv));
|
|
5989
|
+
return redirect !== void 0 && redirect.from.split(" ").length > routed.id.split(".").length ? redirect : void 0;
|
|
5990
|
+
}
|
|
5928
5991
|
/** stricli routed or parsed nothing runnable. When the redirect table
|
|
5929
5992
|
* claims the invocation the user typed, the run names its
|
|
5930
5993
|
* replacement; otherwise it settles as the usage error it is. */
|
|
@@ -6168,4 +6231,4 @@ function distributePositionals(def, values) {
|
|
|
6168
6231
|
return positionals;
|
|
6169
6232
|
}
|
|
6170
6233
|
//#endregion
|
|
6171
|
-
export {
|
|
6234
|
+
export { noSessionForWorkspaceError as A, claimedIdentity as C, credentialWorkspaceMismatchError as D, credentialRejectedError as E, credentialsRequiredError as O, claimedExpiresAt as S, authServiceError as T, exitWithChildStatus as _, definePrismaConfig as a, positional as b, PRISMA_CONFIG_VERSION as c, PRESENTED as d, noDataLines as f, resolveGating as g, writeUserConfig as h, CONFIG_FILE_NAME as i, emptyServiceTokenError as k, SERVICE_TOKEN_ENV_VAR as l, userConfigPath as m, resolveSectionOverChain as n, loadConfig as o, readUserConfig as p, resolveSectionPath as r, realpathOr as s, buildEngine as t, WORKSPACE_ID_ENV_VAR as u, detectCI as v, credentialWorkspaceId as w, readActiveAccessToken as x, flag as y };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
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-C6k54wjM.js";
|
|
2
2
|
import { n as CliStructuredError } from "./protocol-YjqPCCOG.js";
|
|
3
3
|
|
|
4
4
|
//#region src/active-access-token.d.ts
|
|
@@ -37,8 +37,10 @@ interface Cli {
|
|
|
37
37
|
run(argv: readonly string[], runtime: Runtime, hooks?: CliRunHooks): Promise<number>;
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
|
-
* Shell-side construction. Group help is declared with the mount.
|
|
41
|
-
*
|
|
40
|
+
* Shell-side construction. Group help is declared with the mount. A
|
|
41
|
+
* path may be both a command and a group (`dev` beside `dev url`); a
|
|
42
|
+
* child's name wins over the command's positional. Redirects onto
|
|
43
|
+
* mounted paths, unknown groups, reserved-flag violations, grammar
|
|
42
44
|
* violations, and foreign-section references fail construction (build
|
|
43
45
|
* time, not run time).
|
|
44
46
|
*/
|
|
@@ -225,4 +227,4 @@ declare function claimedExpiresAt(token: string): Date | undefined;
|
|
|
225
227
|
*/
|
|
226
228
|
declare function claimedIdentity(token: string): CredentialIdentity | undefined;
|
|
227
229
|
//#endregion
|
|
228
|
-
export { type ActiveAccessTokenOptions, type ActiveCredential, type AnyCommand, type Args, type ArgsSpec, type Block, type BrowserWaitRequest, type Char, type ChildResult, type ChildStatusSettlement, type Cli, type CliRunHooks, type CommandArgs, type CommandContext, type CommandDefinition, type CommandFamily, type CommandHandler, type CommandHelp, type CommandNeeds, type CommandRedirect, type CompletedEnvelope, type ConfigSchema, type ConfigSchemaValue, type ConfigSection, type Credential, type CredentialIdentity, type CredentialManager, type CredentialOrigin, type CredentialRefreshResult, type CredentialRefresher, type CredentialsRequiredReason, type EngineCommandSnapshot, type EngineEvent, EnvironmentCredentialManager, type ErroredEnvelope, type ExitWithChildStatusOptions, type FlagSpec, type Format, type Handler, type HelpSpec, type Host, type HostProcess, type InputStream, type LoadedConfig, type LoadedConfigFile, type ManagementApiClient, type ManagementApiClientConfig, type MountedTree, type NeedsSpec, type OpenUrlOutcome, type OpenUrlRequest, type Outcome, type OutputStream, PRESENTED, PRISMA_CONFIG_VERSION, type PackageManagerId, type PackageManagerRunRequest, type PackageManagerRunResult, type PackageManagerRunner, type PackageOperations, type PositionalSpec, type Presentations, type PresentedResult, type PromptSurface, type RedirectSpec, type ResolvedSection, type RunSummary, type Runtime, SERVICE_TOKEN_ENV_VAR, type SectionProvenance, type SectionValidation, type ServerCommandDefinition, type Session, type SessionCommandDefinition, type Severity, type Span, type SpawnChild, type SpawnDeclarations, type SpawnOptions, type SpawnRequest, type SpawnedChild, type StatementAnswer, type StatementOptions, type StatementQuestion, type StatementSpec, type StatementSurface, type StatementsOptions, type Status, type StoredSessions, type StreamEvent, type StreamMeta, type TelemetryDeclaration, type TelemetryPayload, type TelemetryStatus, type TelemetryStatusReason, type Text, type TokenStorage, type Tone, type TreeNode, type Ui, type WorkflowStep, authServiceError, claimedExpiresAt, claimedIdentity, configSchema, createCli, credentialRejectedError, credentialWorkspaceId, credentialWorkspaceMismatchError, credentialsRequiredError, defineCommand, defineCommandFamily, defineConfigSection, definePrismaConfig, defineServerCommand, defineSessionCommand, detectCI, emptyServiceTokenError, exitWithChildStatus, flag, loadConfig, noSessionForWorkspaceError, positional, readActiveAccessToken, realpathOr, reference, resolveSectionOverChain, resolveSectionPath, telemetryCommandGroup, validateSectionWithSchema };
|
|
230
|
+
export { type ActiveAccessTokenOptions, type ActiveCredential, type AnyCommand, type Args, type ArgsSpec, type Block, type BrowserWaitRequest, type Char, type ChildResult, type ChildStatusSettlement, type Cli, type CliRunHooks, type CommandArgs, type CommandContext, type CommandDefinition, type CommandFamily, type CommandHandler, type CommandHelp, type CommandNeeds, type CommandRedirect, type CompletedEnvelope, type ConfigSchema, type ConfigSchemaValue, type ConfigSection, type Credential, type CredentialIdentity, type CredentialManager, type CredentialOrigin, type CredentialRefreshResult, type CredentialRefresher, type CredentialsRequiredReason, type EngineCommandSnapshot, type EngineEvent, EnvironmentCredentialManager, type ErroredEnvelope, type ExitWithChildStatusOptions, type FlagSpec, type Format, type Handler, type HelpSpec, type Host, type HostProcess, type InputStream, type LoadedConfig, type LoadedConfigFile, type ManagementApiClient, type ManagementApiClientConfig, type MountedTree, type NeedsSpec, type OpenUrlOutcome, type OpenUrlRequest, type Outcome, type OutputStream, PRESENTED, PRISMA_CONFIG_VERSION, type PackageManagerId, type PackageManagerRunRequest, type PackageManagerRunResult, type PackageManagerRunner, type PackageOperations, type PositionalSpec, type Presentations, type PresentedResult, type PromptSurface, type RedirectSpec, type ResolvedSection, type RunSummary, type Runtime, SERVICE_TOKEN_ENV_VAR, type SectionProvenance, type SectionValidation, type ServerCommandDefinition, type Session, type SessionCommandDefinition, type Severity, type Span, type SpawnChild, type SpawnDeclarations, type SpawnOptions, type SpawnRequest, type SpawnedChild, type StatementAnswer, type StatementOptions, type StatementQuestion, type StatementSpec, type StatementSurface, type StatementsOptions, type Status, type StoredSessions, type StreamEvent, type StreamMeta, type TelemetryDeclaration, type TelemetryPayload, type TelemetryStatus, type TelemetryStatusReason, type Text, type TokenStorage, type Tone, type TreeNode, type Ui, type WorkflowStep, authServiceError, claimedExpiresAt, claimedIdentity, configSchema, createCli, credentialRejectedError, credentialWorkspaceId, credentialWorkspaceMismatchError, credentialsRequiredError, defineCommand, defineCommandFamily, defineConfigSection, definePrismaConfig, defineServerCommand, defineSessionCommand, detectCI, emptyServiceTokenError, exitWithChildStatus, flag, loadConfig, noDataLines, noSessionForWorkspaceError, positional, readActiveAccessToken, realpathOr, reference, resolveSectionOverChain, resolveSectionPath, telemetryCommandGroup, validateSectionWithSchema };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { i as ok, r as notOk, t as CliStructuredError } from "./protocol-TtNVkeVS.js";
|
|
2
|
-
import { C as
|
|
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-BBuDSD7p.js";
|
|
3
3
|
import { dirname, isAbsolute, resolve } from "node:path";
|
|
4
4
|
import { scope, type } from "arktype";
|
|
5
5
|
//#region src/cli.ts
|
|
6
6
|
/**
|
|
7
|
-
* Shell-side construction. Group help is declared with the mount.
|
|
8
|
-
*
|
|
7
|
+
* Shell-side construction. Group help is declared with the mount. A
|
|
8
|
+
* path may be both a command and a group (`dev` beside `dev url`); a
|
|
9
|
+
* child's name wins over the command's positional. Redirects onto
|
|
10
|
+
* mounted paths, unknown groups, reserved-flag violations, grammar
|
|
9
11
|
* violations, and foreign-section references fail construction (build
|
|
10
12
|
* time, not run time).
|
|
11
13
|
*/
|
|
@@ -472,11 +474,14 @@ const REASON_EXPLANATION = {
|
|
|
472
474
|
function statusSummaryLine(status) {
|
|
473
475
|
return `Telemetry is ${status.enabled ? "enabled" : "disabled"}: ${REASON_EXPLANATION[status.reason]}`;
|
|
474
476
|
}
|
|
477
|
+
/** `key<TAB>value` data lines; the reason is its code, such as
|
|
478
|
+
* `stored-opt-out`, which is what a script compares against. */
|
|
475
479
|
function formatTelemetryStatusLines(status) {
|
|
476
480
|
return [
|
|
477
|
-
|
|
478
|
-
`
|
|
479
|
-
`
|
|
481
|
+
`enabled\t${status.enabled}`,
|
|
482
|
+
`reason\t${status.reason}`,
|
|
483
|
+
`config file\t${status.configPath}`,
|
|
484
|
+
`installation id stored\t${status.installationIdStored}`
|
|
480
485
|
];
|
|
481
486
|
}
|
|
482
487
|
function statusPresentations(status) {
|
|
@@ -500,8 +505,7 @@ function statusPresentations(status) {
|
|
|
500
505
|
next: () => []
|
|
501
506
|
};
|
|
502
507
|
}
|
|
503
|
-
/** One confirmation line,
|
|
504
|
-
* the json result. */
|
|
508
|
+
/** One confirmation line, with the stored decision as the json result. */
|
|
505
509
|
function consentPresentations(line, json) {
|
|
506
510
|
return {
|
|
507
511
|
human: () => [{
|
|
@@ -509,7 +513,7 @@ function consentPresentations(line, json) {
|
|
|
509
513
|
status: "ok",
|
|
510
514
|
text: line
|
|
511
515
|
}],
|
|
512
|
-
stdout: (
|
|
516
|
+
stdout: noDataLines("Storing a preference has no data; telemetry status reports it."),
|
|
513
517
|
json: () => json,
|
|
514
518
|
next: () => []
|
|
515
519
|
};
|
|
@@ -595,4 +599,4 @@ Telemetry is on by default (opt-out); see ${options.docsUrl}\nfor what is collec
|
|
|
595
599
|
};
|
|
596
600
|
}
|
|
597
601
|
//#endregion
|
|
598
|
-
export { EnvironmentCredentialManager, PRESENTED, PRISMA_CONFIG_VERSION, SERVICE_TOKEN_ENV_VAR, authServiceError, claimedExpiresAt, claimedIdentity, configSchema, createCli, credentialRejectedError, credentialWorkspaceId, credentialWorkspaceMismatchError, credentialsRequiredError, defineCommand, defineCommandFamily, defineConfigSection, definePrismaConfig, defineServerCommand, defineSessionCommand, detectCI, emptyServiceTokenError, exitWithChildStatus, flag, loadConfig, noSessionForWorkspaceError, positional, readActiveAccessToken, realpathOr, reference, resolveSectionOverChain, resolveSectionPath, telemetryCommandGroup, validateSectionWithSchema };
|
|
602
|
+
export { EnvironmentCredentialManager, PRESENTED, PRISMA_CONFIG_VERSION, SERVICE_TOKEN_ENV_VAR, authServiceError, claimedExpiresAt, claimedIdentity, configSchema, createCli, credentialRejectedError, credentialWorkspaceId, credentialWorkspaceMismatchError, credentialsRequiredError, defineCommand, defineCommandFamily, defineConfigSection, definePrismaConfig, defineServerCommand, defineSessionCommand, detectCI, emptyServiceTokenError, exitWithChildStatus, flag, loadConfig, noDataLines, noSessionForWorkspaceError, positional, readActiveAccessToken, realpathOr, reference, resolveSectionOverChain, resolveSectionPath, telemetryCommandGroup, validateSectionWithSchema };
|
|
@@ -1078,6 +1078,10 @@ interface Presentations {
|
|
|
1078
1078
|
readonly json: () => unknown;
|
|
1079
1079
|
readonly next: () => readonly NextAction[];
|
|
1080
1080
|
}
|
|
1081
|
+
/** The `stdout` of a command whose only result is that it succeeded,
|
|
1082
|
+
* such as a delete. The reason says why the command has no data, where
|
|
1083
|
+
* its presentation is defined. */
|
|
1084
|
+
declare function noDataLines(_reason: string): () => readonly string[];
|
|
1081
1085
|
/**
|
|
1082
1086
|
* What happened: it selects the glyph (✔ ✘ ⚠ ℹ) and carries a default
|
|
1083
1087
|
* Tone of the same name. Separate from Tone because a failure can be
|
|
@@ -1835,4 +1839,4 @@ interface TelemetryDeclaration {
|
|
|
1835
1839
|
readonly docsUrl: string;
|
|
1836
1840
|
}
|
|
1837
1841
|
//#endregion
|
|
1838
|
-
export {
|
|
1842
|
+
export { SectionValidation as $, ManagementApiClient$1 as $t, StatementAnswer as A, PackageManagerRunRequest as At, PresentedResult as B, flag as Bt, defineServerCommand as C, ExitWithChildStatusOptions as Ct, OpenUrlOutcome as D, SpawnedChild as Dt, CommandContext as E, SpawnRequest as Et, Block as F, ArgsSpec as Ft, TreeNode as G, CredentialIdentity as Gt, Status as H, ActiveAccessTokenOptions as Ht, Format as I, Char as It, EngineEvent as J, SERVICE_TOKEN_ENV_VAR as Jt, Ui as K, CredentialManager as Kt, Outcome as L, CommandArgs as Lt, StatementQuestion as M, PackageManagerRunner as Mt, StatementSurface as N, PackageOperations as Nt, OpenUrlRequest as O, exitWithChildStatus as Ot, StatementsOptions as P, Args as Pt, ConfigSection as Q, CredentialRefresher as Qt, PRESENTED as R, FlagSpec as Rt, defineCommand as S, ChildStatusSettlement as St, BrowserWaitRequest as T, SpawnOptions as Tt, Text as U, ActiveCredential as Ut, Span as V, positional as Vt, Tone as W, Credential as Wt, StreamEvent as X, StoredSessions as Xt, Severity as Y, Session as Yt, StreamMeta as Z, CredentialRefreshResult as Zt, ServerCommandDefinition as _, Runtime as _t, RedirectSpec as a, validateSectionWithSchema as at, StatementSpec as b, RunSummary as bt, CommandDefinition as c, resolveSectionOverChain as ct, CommandNeeds as d, HostProcess as dt, ManagementApiClientConfig as en, defineConfigSection as et, CompletedEnvelope as f, InputStream as ft, NeedsSpec as g, PRISMA_CONFIG_VERSION as gt, HelpSpec as h, OutputStream as ht, MountedTree as i, reference as it, StatementOptions as j, PackageManagerRunResult as jt, PromptSurface as k, PackageManagerId as kt, CommandHandler as l, resolveSectionPath as lt, Handler as m, LoadedConfigFile as mt, CommandFamily as n, ConfigSchemaValue as nt, defineCommandFamily as o, ResolvedSection as ot, ErroredEnvelope as p, LoadedConfig as pt, noDataLines as q, CredentialOrigin as qt, CommandRedirect as r, configSchema as rt, AnyCommand as s, SectionProvenance as st, TelemetryDeclaration as t, TokenStorage$1 as tn, ConfigSchema as tt, CommandHelp as u, Host as ut, SessionCommandDefinition as v, TelemetryPayload as vt, defineSessionCommand as w, SpawnChild as wt, WorkflowStep as x, ChildResult as xt, SpawnDeclarations as y, EngineCommandSnapshot as yt, Presentations as z, PositionalSpec as zt };
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $t as
|
|
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-C6k54wjM.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 {
|
|
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-BBuDSD7p.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.9.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.23-dev.153",
|
|
57
|
+
"@repo/tsconfig": "8.0.0-rc.23-dev.153",
|
|
58
58
|
"@types/node": "^22.19.19",
|
|
59
59
|
"ci-info": "^4.3.1",
|
|
60
60
|
"tsdown": "^0.21.10",
|