@duyquangnvx/agent-cli 0.27.0 → 0.28.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/CHANGELOG.md +27 -0
- package/dist/agent-cli.js +9 -2
- package/dist/agent-cli.js.map +1 -1
- package/dist/built-ins/agents-md.d.ts +3 -2
- package/dist/built-ins/agents-md.js +8 -9
- package/dist/built-ins/agents-md.js.map +1 -1
- package/dist/built-ins/commands.d.ts +2 -1
- package/dist/built-ins/commands.js.map +1 -1
- package/dist/built-ins/doctor-rows.js +1 -1
- package/dist/built-ins/doctor-rows.js.map +1 -1
- package/dist/built-ins/doctor.d.ts +0 -1
- package/dist/built-ins/doctor.js +21 -8
- package/dist/built-ins/doctor.js.map +1 -1
- package/dist/built-ins/install/dependency.js +23 -23
- package/dist/built-ins/install/dependency.js.map +1 -1
- package/dist/built-ins/install/global-npm.d.ts +6 -3
- package/dist/built-ins/install/global-npm.js +19 -14
- package/dist/built-ins/install/global-npm.js.map +1 -1
- package/dist/built-ins/install/global.js +6 -7
- package/dist/built-ins/install/global.js.map +1 -1
- package/dist/built-ins/install/install.d.ts +0 -3
- package/dist/built-ins/install/install.js +0 -1
- package/dist/built-ins/install/install.js.map +1 -1
- package/dist/built-ins/install/release-check.js +10 -17
- package/dist/built-ins/install/release-check.js.map +1 -1
- package/dist/built-ins/npm.d.ts +8 -7
- package/dist/built-ins/npm.js +20 -12
- package/dist/built-ins/npm.js.map +1 -1
- package/dist/built-ins/project-root.d.ts +4 -4
- package/dist/built-ins/project-root.js +12 -22
- package/dist/built-ins/project-root.js.map +1 -1
- package/dist/built-ins/read.d.ts +5 -0
- package/dist/built-ins/read.js +29 -0
- package/dist/built-ins/read.js.map +1 -0
- package/dist/built-ins/setup.d.ts +1 -2
- package/dist/built-ins/setup.js +32 -26
- package/dist/built-ins/setup.js.map +1 -1
- package/dist/built-ins/skill/home.d.ts +2 -1
- package/dist/built-ins/skill/home.js +19 -17
- package/dist/built-ins/skill/home.js.map +1 -1
- package/dist/built-ins/skill/install-command.d.ts +2 -1
- package/dist/built-ins/skill/install-command.js +13 -11
- package/dist/built-ins/skill/install-command.js.map +1 -1
- package/dist/built-ins/skill/project.js +6 -7
- package/dist/built-ins/skill/project.js.map +1 -1
- package/dist/built-ins/skill/sync.d.ts +4 -3
- package/dist/built-ins/skill/sync.js +24 -17
- package/dist/built-ins/skill/sync.js.map +1 -1
- package/dist/built-ins/update.d.ts +1 -1
- package/dist/built-ins/update.js +9 -7
- package/dist/built-ins/update.js.map +1 -1
- package/dist/built-ins/upgrades.d.ts +2 -1
- package/dist/built-ins/upgrades.js +5 -12
- package/dist/built-ins/upgrades.js.map +1 -1
- package/dist/check-examples.js +5 -23
- package/dist/check-examples.js.map +1 -1
- package/dist/check-next-steps.d.ts +3 -9
- package/dist/check-next-steps.js +20 -32
- package/dist/check-next-steps.js.map +1 -1
- package/dist/command-line/line-problem.d.ts +14 -0
- package/dist/command-line/line-problem.js +41 -0
- package/dist/command-line/line-problem.js.map +1 -0
- package/dist/context/files.d.ts +3 -0
- package/dist/context/files.js +17 -2
- package/dist/context/files.js.map +1 -1
- package/dist/context/outputs.d.ts +13 -24
- package/dist/context/outputs.js +37 -37
- package/dist/context/outputs.js.map +1 -1
- package/dist/context/spawn.js +3 -1
- package/dist/context/spawn.js.map +1 -1
- package/dist/context/tools.d.ts +9 -4
- package/dist/context/tools.js +12 -12
- package/dist/context/tools.js.map +1 -1
- package/dist/context.d.ts +3 -1
- package/dist/define-command.d.ts +19 -12
- package/dist/define-command.js +5 -3
- package/dist/define-command.js.map +1 -1
- package/dist/define.d.ts +10 -3
- package/dist/define.js.map +1 -1
- package/dist/errors.d.ts +3 -6
- package/dist/errors.js +17 -28
- package/dist/errors.js.map +1 -1
- package/dist/execute.d.ts +7 -16
- package/dist/execute.js +11 -14
- package/dist/execute.js.map +1 -1
- package/dist/exit-classes.d.ts +7 -10
- package/dist/exit-classes.js +20 -81
- package/dist/exit-classes.js.map +1 -1
- package/dist/failure.d.ts +36 -0
- package/dist/failure.js +65 -0
- package/dist/failure.js.map +1 -0
- package/dist/help-json.js +5 -3
- package/dist/help-json.js.map +1 -1
- package/dist/help.js +3 -3
- package/dist/help.js.map +1 -1
- package/dist/output.d.ts +3 -10
- package/dist/output.js +14 -24
- package/dist/output.js.map +1 -1
- package/dist/run-cli.js +7 -5
- package/dist/run-cli.js.map +1 -1
- package/dist/run-command.d.ts +6 -1
- package/dist/run-command.js +31 -158
- package/dist/run-command.js.map +1 -1
- package/dist/run-options.d.ts +5 -2
- package/dist/run-scope.d.ts +35 -0
- package/dist/run-scope.js +138 -0
- package/dist/run-scope.js.map +1 -0
- package/dist/runtime-codes.d.ts +140 -1
- package/dist/runtime-codes.js +60 -4
- package/dist/runtime-codes.js.map +1 -1
- package/docs/example/cli.test.ts +9 -2
- package/docs/example/cli.ts +1 -0
- package/docs/example/folder.ts +1 -0
- package/docs/guides/commands.md +1 -1
- package/docs/guides/doctor.md +2 -1
- package/docs/guides/errors.md +1 -1
- package/docs/guides/testing.md +2 -1
- package/package.json +1 -1
- package/dist/command-errors.d.ts +0 -8
- package/dist/command-errors.js +0 -25
- package/dist/command-errors.js.map +0 -1
- package/dist/command-line/route-line.d.ts +0 -15
- package/dist/command-line/route-line.js +0 -18
- package/dist/command-line/route-line.js.map +0 -1
package/dist/run-command.js
CHANGED
|
@@ -1,27 +1,18 @@
|
|
|
1
1
|
import { installOf } from "./built-ins/install/install.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { changedArgv, commandLineOf } from "./command-line/invocation.js";
|
|
5
|
-
import { knownFlags, parseCommand, stdinArgOf, } from "./command-line/parse-input.js";
|
|
2
|
+
import { commandLineOf } from "./command-line/invocation.js";
|
|
3
|
+
import { parseCommand } from "./command-line/parse-input.js";
|
|
6
4
|
import { commandLabel } from "./command-spec.js";
|
|
7
|
-
import { fileErrorOf } from "./context/errno.js";
|
|
8
|
-
import { classifiedFiles, realFiles } from "./context/files.js";
|
|
9
5
|
import { RunControl } from "./context/interrupts.js";
|
|
10
6
|
import { checkOperator } from "./context/operator.js";
|
|
11
|
-
import { outputsGuard } from "./context/outputs.js";
|
|
12
7
|
import { projectOf } from "./context/project.js";
|
|
13
|
-
import { envFileOf, isNeeded, secretOf } from "./context/secrets.js";
|
|
14
8
|
import { noSideTask, startSideTask } from "./context/side-task.js";
|
|
15
|
-
import { contextSpawn, contextSpawnDetached, realSpawn, realSpawnDetached, } from "./context/spawn.js";
|
|
16
9
|
import { spillTo } from "./context/spill.js";
|
|
17
10
|
import { isTerminal, readingLine, readStdin, stdinStalled } from "./context/stdin.js";
|
|
18
|
-
import { cliErrorOf } from "./error-table.js";
|
|
19
11
|
import { isDebug, traceOf } from "./errors.js";
|
|
20
12
|
import { dataOutcome, execute } from "./execute.js";
|
|
21
13
|
import { manifestAt } from "./manifest.js";
|
|
22
|
-
import { commandResult, errorResult,
|
|
23
|
-
import {
|
|
24
|
-
import { buildStamp } from "./version.js";
|
|
14
|
+
import { commandResult, errorResult, STOPPED_RESULT, startedOutput, } from "./output.js";
|
|
15
|
+
import { contextOf, once, runScopeOf } from "./run-scope.js";
|
|
25
16
|
function stdinNeverEndedHint(callerLine) {
|
|
26
17
|
return `stdin never ended: pipe the text into \`${callerLine}\`, or redirect a file into it`;
|
|
27
18
|
}
|
|
@@ -30,108 +21,19 @@ function runDeadlineAdvice(resumed, pipedLine) {
|
|
|
30
21
|
? { hint: stdinNeverEndedHint(pipedLine) }
|
|
31
22
|
: { hint: "run the Next step to continue the work", next: [resumed] };
|
|
32
23
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// A test that fakes `spawn` expects no real child, detached ones included.
|
|
40
|
-
function spawnDetachedOf({ spawn, spawnDetached }) {
|
|
41
|
-
if (spawnDetached !== undefined)
|
|
42
|
-
return spawnDetached;
|
|
43
|
-
return spawn === undefined ? realSpawnDetached : unfakedSpawnDetached;
|
|
44
|
-
}
|
|
45
|
-
function portsOf(cli, replacement) {
|
|
46
|
-
if (replacement !== undefined)
|
|
47
|
-
return () => replacement;
|
|
48
|
-
return cli.ports ?? (() => ({}));
|
|
49
|
-
}
|
|
50
|
-
function portsBaseOf(scope, signal) {
|
|
51
|
-
const { cli, options, packageRoot, progress, fileError, rerun, clock, files } = scope;
|
|
52
|
-
const { cwd, env } = options;
|
|
53
|
-
const envFile = envFileOf(cli.name, env);
|
|
54
|
-
return {
|
|
55
|
-
cwd,
|
|
56
|
-
env,
|
|
57
|
-
packageRoot,
|
|
58
|
-
progress,
|
|
59
|
-
secret: (name) => secretOf({ envFile, env, fileError }, name),
|
|
60
|
-
envFile,
|
|
61
|
-
fileError,
|
|
62
|
-
version: cli.version,
|
|
63
|
-
build: buildStamp(),
|
|
64
|
-
self: selfOf(cli.name, options.bin),
|
|
65
|
-
signal,
|
|
66
|
-
clock,
|
|
67
|
-
files,
|
|
68
|
-
spawn: contextSpawn(options.spawn ?? realSpawn, { cwd, env, signal }, { fileError, rerun }),
|
|
69
|
-
spawnDetached: contextSpawnDetached(spawnDetachedOf(options), { cwd, env, signal }, { fileError, rerun }),
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
function contextOf(portsBase, control, parts) {
|
|
73
|
-
const { ports, project, force, dryRun, secrets = [], rerun, deliver, notice } = parts;
|
|
74
|
-
const declared = new Map(secrets.map((declaration) => [declaration.name, declaration]));
|
|
75
|
-
function secret(name) {
|
|
76
|
-
const declaration = declared.get(name);
|
|
77
|
-
// Only a cast reaches an undeclared name, and only a `.env` edited mid-run a missing value.
|
|
78
|
-
if (declaration === undefined) {
|
|
79
|
-
throw new Error(`ctx.secret("${name}") names a Secret the Command does not declare`);
|
|
80
|
-
}
|
|
81
|
-
const found = portsBase.secret(name);
|
|
82
|
-
if (found === undefined && isNeeded(declaration)) {
|
|
83
|
-
throw new Error(`ctx.secret("${name}") found no value`);
|
|
84
|
-
}
|
|
85
|
-
return found;
|
|
86
|
-
}
|
|
87
|
-
return {
|
|
88
|
-
...portsBase,
|
|
89
|
-
secret,
|
|
90
|
-
fail: cliErrorOf,
|
|
91
|
-
deadline: (ms, options) => control.deadline(ms, options),
|
|
92
|
-
runToEnd: (name, work) => control.runToEnd(name, work),
|
|
93
|
-
// Built on first read, so a factory that throws fails only what needs the ports, never `doctor`.
|
|
94
|
-
get ports() {
|
|
95
|
-
return ports();
|
|
96
|
-
},
|
|
97
|
-
project,
|
|
98
|
-
force,
|
|
99
|
-
dryRun,
|
|
100
|
-
rerun,
|
|
101
|
-
poll: (check, { intervalMs, signal: stop }) => poll(portsBase.clock, check, intervalMs, stop === undefined ? control.signal : AbortSignal.any([control.signal, stop])),
|
|
102
|
-
deliver,
|
|
103
|
-
notice,
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
/** Leaves the Side task running, so the caller writes the result before it waits for it. */
|
|
24
|
+
/**
|
|
25
|
+
* Leaves the Side task running, so the caller writes the result before it waits for it.
|
|
26
|
+
*
|
|
27
|
+
* A gate that needs no `ctx` (operator, parse, Project file) runs here; one that does (tools,
|
|
28
|
+
* Secrets, the Plan's) runs in `execute`, after the Notices, so a failing run still delivers them.
|
|
29
|
+
*/
|
|
107
30
|
export async function runCommand(cli, routed, options, write, baseFormat) {
|
|
108
31
|
const { command, commandLine, builtIn } = routed.spec;
|
|
109
32
|
const { cwd, env } = options;
|
|
110
|
-
const clock = options.clock ?? realClock;
|
|
111
|
-
const files = options.files ?? realFiles();
|
|
112
33
|
const stdin = options.stdin ?? "";
|
|
113
|
-
const
|
|
114
|
-
const
|
|
115
|
-
const packageRoot = packageRootOf(options.bin, cwd);
|
|
116
|
-
const progress = (message) => write.stderr(progressLine(message, routed.json));
|
|
117
|
-
const invocation = {
|
|
118
|
-
...baseFormat.invocation,
|
|
119
|
-
flags: knownFlags(routed.spec),
|
|
120
|
-
stdinArg: stdinArgOf(routed),
|
|
121
|
-
};
|
|
122
|
-
const rerunOf = (change) => ({
|
|
123
|
-
kind: "rerun",
|
|
124
|
-
words: changedArgv(invocation, change),
|
|
125
|
-
stdinArg: invocation.stdinArg,
|
|
126
|
-
});
|
|
34
|
+
const scope = runScopeOf(cli, routed, options, write, baseFormat.invocation);
|
|
35
|
+
const { invocation, rerun: rerunOf, fileError, clock, outputs, progress, platform } = scope;
|
|
127
36
|
const rerun = rerunOf();
|
|
128
|
-
const fileError = fileErrorOf({ rerun, env, platform });
|
|
129
|
-
const format = {
|
|
130
|
-
...baseFormat,
|
|
131
|
-
bugs: () => manifestAt(packageRoot).bugs,
|
|
132
|
-
json: routed.json,
|
|
133
|
-
invocation,
|
|
134
|
-
};
|
|
135
37
|
// A stdin that never ended was fed by the caller's own pipe, so its hint names no file to redirect.
|
|
136
38
|
const pipedLine = commandLineOf({ ...invocation, stdinArg: undefined });
|
|
137
39
|
// Set once the input is parsed; a deadline before that can only have cut off the stdin read.
|
|
@@ -150,9 +52,17 @@ export async function runCommand(cli, routed, options, write, baseFormat) {
|
|
|
150
52
|
advice: () => runDeadlineAdvice(resumed, pipedLine),
|
|
151
53
|
},
|
|
152
54
|
});
|
|
153
|
-
const
|
|
55
|
+
const format = {
|
|
56
|
+
...baseFormat,
|
|
57
|
+
command: routed.spec,
|
|
58
|
+
control,
|
|
59
|
+
bugs: () => manifestAt(scope.packageRoot).bugs,
|
|
60
|
+
json: routed.json,
|
|
61
|
+
invocation,
|
|
62
|
+
};
|
|
63
|
+
const failed = async (error, finishSideTask) => {
|
|
154
64
|
control.close();
|
|
155
|
-
return { result: errorResult(error, format), finishSideTask };
|
|
65
|
+
return { result: await errorResult(error, format), finishSideTask };
|
|
156
66
|
};
|
|
157
67
|
let parsed;
|
|
158
68
|
try {
|
|
@@ -171,21 +81,9 @@ export async function runCommand(cli, routed, options, write, baseFormat) {
|
|
|
171
81
|
}
|
|
172
82
|
const { input, flags } = parsed;
|
|
173
83
|
resumed = command.deadline?.resume(input, rerunOf);
|
|
174
|
-
const outputs = outputsGuard(classifiedFiles(files, { cwd, fileError }), cwd);
|
|
175
|
-
const scope = {
|
|
176
|
-
cli,
|
|
177
|
-
options,
|
|
178
|
-
packageRoot,
|
|
179
|
-
progress,
|
|
180
|
-
fileError,
|
|
181
|
-
rerun,
|
|
182
|
-
clock,
|
|
183
|
-
files: outputs.files,
|
|
184
|
-
};
|
|
185
|
-
const portsBase = portsBaseOf(scope, control.signal);
|
|
186
84
|
const finishSideTask = startSideTask(builtIn ? undefined : cli.sideTask?.bind(cli), (sideSignal) => {
|
|
187
|
-
const sideBase =
|
|
188
|
-
const sidePorts = once(() => ports(sideBase));
|
|
85
|
+
const sideBase = scope.portsBase(sideSignal);
|
|
86
|
+
const sidePorts = once(() => scope.ports(sideBase));
|
|
189
87
|
return {
|
|
190
88
|
...sideBase,
|
|
191
89
|
command: routed.spec.path,
|
|
@@ -214,14 +112,10 @@ export async function runCommand(cli, routed, options, write, baseFormat) {
|
|
|
214
112
|
}
|
|
215
113
|
// Parsed only when printed, so a Command that catches around `deliver` cannot hide a rejection.
|
|
216
114
|
let delivered;
|
|
217
|
-
const ctx = contextOf(
|
|
218
|
-
|
|
115
|
+
const ctx = contextOf(scope, control, {
|
|
116
|
+
command,
|
|
117
|
+
flags,
|
|
219
118
|
project,
|
|
220
|
-
force: flags.force,
|
|
221
|
-
dryRun: flags.dryRun,
|
|
222
|
-
secrets: command.secrets,
|
|
223
|
-
rerun: rerunOf,
|
|
224
|
-
notice: (text) => write.stderr(noticeLine(text, routed.json)),
|
|
225
119
|
deliver: (data) => {
|
|
226
120
|
delivered = () => dataOutcome(command, data, commandLine);
|
|
227
121
|
},
|
|
@@ -239,18 +133,14 @@ export async function runCommand(cli, routed, options, write, baseFormat) {
|
|
|
239
133
|
try {
|
|
240
134
|
const outcome = await control.settle(
|
|
241
135
|
// The Notices come first, so they reach the caller even when the Command fails.
|
|
242
|
-
noticesOf(cli, { builtIn, bin: options.bin, node: options.node }, ctx).then(() => execute(command, input, ctx, {
|
|
243
|
-
|
|
244
|
-
confirm: flags.confirm,
|
|
245
|
-
yes: flags.yes,
|
|
246
|
-
page: flags.page,
|
|
136
|
+
noticesOf(cli, { builtIn, bin: options.bin, node: options.node, platform }, ctx).then(() => execute(command, input, ctx, {
|
|
137
|
+
flags,
|
|
247
138
|
commandLine,
|
|
248
139
|
started: async (outcome) => {
|
|
249
140
|
write.stdout(await startedOutput(outcome, format, spill));
|
|
250
141
|
served = true;
|
|
251
142
|
},
|
|
252
|
-
|
|
253
|
-
guardOutputs: outputs.guard,
|
|
143
|
+
outputs,
|
|
254
144
|
})));
|
|
255
145
|
// A serve Command that ended itself printed its data when it started.
|
|
256
146
|
if (served)
|
|
@@ -264,7 +154,7 @@ export async function runCommand(cli, routed, options, write, baseFormat) {
|
|
|
264
154
|
}
|
|
265
155
|
settled = {
|
|
266
156
|
ok: false,
|
|
267
|
-
error
|
|
157
|
+
error,
|
|
268
158
|
delivered,
|
|
269
159
|
};
|
|
270
160
|
}
|
|
@@ -273,23 +163,6 @@ export async function runCommand(cli, routed, options, write, baseFormat) {
|
|
|
273
163
|
finishSideTask,
|
|
274
164
|
};
|
|
275
165
|
}
|
|
276
|
-
/** `build` runs on the first call; later calls give its value or throw its error again. */
|
|
277
|
-
function once(build) {
|
|
278
|
-
let outcome;
|
|
279
|
-
return () => {
|
|
280
|
-
if (outcome === undefined) {
|
|
281
|
-
try {
|
|
282
|
-
outcome = { ok: true, value: build() };
|
|
283
|
-
}
|
|
284
|
-
catch (error) {
|
|
285
|
-
outcome = { ok: false, error };
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
if (outcome.ok)
|
|
289
|
-
return outcome.value;
|
|
290
|
-
throw outcome.error;
|
|
291
|
-
};
|
|
292
|
-
}
|
|
293
166
|
async function noticesOf(cli, launch, ctx) {
|
|
294
167
|
await installOf(cli).notice(launch, ctx);
|
|
295
168
|
}
|
package/dist/run-command.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-command.js","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YACD,OAAO;SACR,CAAC,CACH,CACF,CAAC;QACF,sEAAsE;QACtE,IAAI,MAAM;YAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,CAAC;QAC9D,OAAO,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAClC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,yFAAyF;QACzF,IAAI,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACrC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,CAAC;QACpD,CAAC;QACD,OAAO,GAAG;YACR,EAAE,EAAE,KAAK;YACT,KAAK;YACL,SAAS;SACV,CAAC;IACJ,CAAC;IACD,OAAO;QACL,MAAM,EAAE,MAAM,aAAa,CAAC,OAAO,EAAE,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,KAAK,CAAC;QAChF,cAAc;KACf,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,SAAS,CAAC,GAAQ,EAAE,MAAoB,EAAE,GAAY;IACnE,MAAM,SAAS,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC3C,CAAC"}
|
package/dist/run-options.d.ts
CHANGED
|
@@ -41,8 +41,11 @@ export interface RunOptions<Ports = NoPorts> {
|
|
|
41
41
|
/** What an arg given `-` reads; absent, it reads an empty text. */
|
|
42
42
|
readonly stdin?: StdinSource;
|
|
43
43
|
/**
|
|
44
|
-
* Replaces `process.platform`
|
|
45
|
-
* how to end stdin,
|
|
44
|
+
* Replaces `process.platform` wherever the Runtime reads it: the wording of hints, such as
|
|
45
|
+
* `PERMISSION_DENIED`'s and how to end stdin, which file a declared tool is on `PATH` (Windows
|
|
46
|
+
* adds `PATHEXT`), and npm's file and folders in the Built-in Commands. A test passes `"win32"`
|
|
47
|
+
* to run the Windows branches on any OS; starting a real child and retrying a real file rename
|
|
48
|
+
* still follow the host.
|
|
46
49
|
*/
|
|
47
50
|
readonly platform?: NodeJS.Platform;
|
|
48
51
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type Clock } from "./clock.js";
|
|
2
|
+
import { type Invocation } from "./command-line/invocation.js";
|
|
3
|
+
import { type StandardValues } from "./command-line/parse-input.js";
|
|
4
|
+
import type { CommandRoute } from "./command-line/route.js";
|
|
5
|
+
import { type FileError } from "./context/errno.js";
|
|
6
|
+
import type { RunControl } from "./context/interrupts.js";
|
|
7
|
+
import { type Outputs } from "./context/outputs.js";
|
|
8
|
+
import type { Context, PortsBase, Project } from "./context.js";
|
|
9
|
+
import type { Cli, Command } from "./define.js";
|
|
10
|
+
import type { RunSettings, Writers } from "./run-options.js";
|
|
11
|
+
/** What one Command run shares between its `ctx`, its Side task and its output. */
|
|
12
|
+
export interface RunScope {
|
|
13
|
+
readonly invocation: Invocation;
|
|
14
|
+
readonly rerun: Context["rerun"];
|
|
15
|
+
readonly fileError: FileError;
|
|
16
|
+
readonly clock: Clock;
|
|
17
|
+
readonly platform: NodeJS.Platform;
|
|
18
|
+
readonly outputs: Outputs;
|
|
19
|
+
readonly progress: (message: string) => void;
|
|
20
|
+
readonly notice: (text: string) => void;
|
|
21
|
+
readonly packageRoot: string;
|
|
22
|
+
/** The CLI's ports factory, or the test's replacement. */
|
|
23
|
+
readonly ports: (base: PortsBase) => unknown;
|
|
24
|
+
portsBase(signal: AbortSignal): PortsBase;
|
|
25
|
+
}
|
|
26
|
+
export declare function runScopeOf(cli: Cli, routed: CommandRoute, settings: RunSettings<unknown>, write: Writers, baseInvocation: Invocation): RunScope;
|
|
27
|
+
export interface Parsed {
|
|
28
|
+
readonly command: Command;
|
|
29
|
+
readonly flags: StandardValues;
|
|
30
|
+
readonly project: Project | undefined;
|
|
31
|
+
readonly deliver: Context["deliver"];
|
|
32
|
+
}
|
|
33
|
+
export declare function contextOf(scope: RunScope, control: RunControl, { command, flags, project, deliver }: Parsed): Context;
|
|
34
|
+
/** `build` runs on the first call; later calls give its value or throw its error again. */
|
|
35
|
+
export declare function once<T>(build: () => T): () => T;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { poll, realClock } from "./clock.js";
|
|
2
|
+
import { changedArgv } from "./command-line/invocation.js";
|
|
3
|
+
import { knownFlags, stdinArgOf } from "./command-line/parse-input.js";
|
|
4
|
+
import { fileErrorOf } from "./context/errno.js";
|
|
5
|
+
import { realFiles } from "./context/files.js";
|
|
6
|
+
import { outputsOf } from "./context/outputs.js";
|
|
7
|
+
import { envFileOf, isNeeded, secretOf } from "./context/secrets.js";
|
|
8
|
+
import { contextSpawn, contextSpawnDetached, realSpawn, realSpawnDetached, } from "./context/spawn.js";
|
|
9
|
+
import { cliErrorOf } from "./error-table.js";
|
|
10
|
+
import { noticeLine, progressLine } from "./output.js";
|
|
11
|
+
import { packageRootOf } from "./package-root.js";
|
|
12
|
+
import { buildStamp } from "./version.js";
|
|
13
|
+
function selfOf(name, bin) {
|
|
14
|
+
return bin === undefined ? [name] : [process.execPath, ...process.execArgv, bin];
|
|
15
|
+
}
|
|
16
|
+
const unfakedSpawnDetached = async () => {
|
|
17
|
+
throw new Error("runCli was given a fake spawn but no spawnDetached: pass spawnDetached to runCli, so the test starts no real child");
|
|
18
|
+
};
|
|
19
|
+
// A test that fakes `spawn` expects no real child, detached ones included.
|
|
20
|
+
function spawnDetachedOf({ spawn, spawnDetached }) {
|
|
21
|
+
if (spawnDetached !== undefined)
|
|
22
|
+
return spawnDetached;
|
|
23
|
+
return spawn === undefined ? realSpawnDetached : unfakedSpawnDetached;
|
|
24
|
+
}
|
|
25
|
+
function portsOf(cli, replacement) {
|
|
26
|
+
if (replacement !== undefined)
|
|
27
|
+
return () => replacement;
|
|
28
|
+
return cli.ports ?? (() => ({}));
|
|
29
|
+
}
|
|
30
|
+
export function runScopeOf(cli, routed, settings, write, baseInvocation) {
|
|
31
|
+
const { cwd, env } = settings;
|
|
32
|
+
const clock = settings.clock ?? realClock;
|
|
33
|
+
const platform = settings.platform ?? process.platform;
|
|
34
|
+
const invocation = {
|
|
35
|
+
...baseInvocation,
|
|
36
|
+
flags: knownFlags(routed.spec),
|
|
37
|
+
stdinArg: stdinArgOf(routed),
|
|
38
|
+
};
|
|
39
|
+
const rerun = (change) => ({
|
|
40
|
+
kind: "rerun",
|
|
41
|
+
words: changedArgv(invocation, change),
|
|
42
|
+
stdinArg: invocation.stdinArg,
|
|
43
|
+
});
|
|
44
|
+
const fileError = fileErrorOf({
|
|
45
|
+
rerun: rerun(),
|
|
46
|
+
env,
|
|
47
|
+
platform,
|
|
48
|
+
});
|
|
49
|
+
const outputs = outputsOf(settings.files ?? realFiles(), { cwd, fileError });
|
|
50
|
+
const packageRoot = packageRootOf(settings.bin, cwd);
|
|
51
|
+
const progress = (message) => write.stderr(progressLine(message, routed.json));
|
|
52
|
+
const envFile = envFileOf(cli.name, env);
|
|
53
|
+
const spawning = { fileError, rerun: rerun() };
|
|
54
|
+
return {
|
|
55
|
+
invocation,
|
|
56
|
+
rerun,
|
|
57
|
+
fileError,
|
|
58
|
+
clock,
|
|
59
|
+
platform,
|
|
60
|
+
outputs,
|
|
61
|
+
progress,
|
|
62
|
+
notice: (text) => write.stderr(noticeLine(text, routed.json)),
|
|
63
|
+
packageRoot,
|
|
64
|
+
ports: portsOf(cli, settings.ports),
|
|
65
|
+
portsBase: (signal) => ({
|
|
66
|
+
cwd,
|
|
67
|
+
env,
|
|
68
|
+
platform,
|
|
69
|
+
packageRoot,
|
|
70
|
+
progress,
|
|
71
|
+
secret: (name) => secretOf({ envFile, env, fileError }, name),
|
|
72
|
+
envFile,
|
|
73
|
+
fileError,
|
|
74
|
+
version: cli.version,
|
|
75
|
+
build: buildStamp(),
|
|
76
|
+
self: selfOf(cli.name, settings.bin),
|
|
77
|
+
signal,
|
|
78
|
+
clock,
|
|
79
|
+
files: outputs.files,
|
|
80
|
+
spawn: contextSpawn(settings.spawn ?? realSpawn, { cwd, env, signal }, spawning),
|
|
81
|
+
spawnDetached: contextSpawnDetached(spawnDetachedOf(settings), { cwd, env, signal }, spawning),
|
|
82
|
+
}),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
export function contextOf(scope, control, { command, flags, project, deliver }) {
|
|
86
|
+
const portsBase = scope.portsBase(control.signal);
|
|
87
|
+
const ports = once(() => scope.ports(portsBase));
|
|
88
|
+
// The only Secrets `ctx.secret` reads.
|
|
89
|
+
const declared = new Map((command.secrets ?? []).map((declaration) => [declaration.name, declaration]));
|
|
90
|
+
function secret(name) {
|
|
91
|
+
const declaration = declared.get(name);
|
|
92
|
+
// Only a cast reaches an undeclared name, and only a `.env` edited mid-run a missing value.
|
|
93
|
+
if (declaration === undefined) {
|
|
94
|
+
throw new Error(`ctx.secret("${name}") names a Secret the Command does not declare`);
|
|
95
|
+
}
|
|
96
|
+
const found = portsBase.secret(name);
|
|
97
|
+
if (found === undefined && isNeeded(declaration)) {
|
|
98
|
+
throw new Error(`ctx.secret("${name}") found no value`);
|
|
99
|
+
}
|
|
100
|
+
return found;
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
...portsBase,
|
|
104
|
+
secret,
|
|
105
|
+
fail: cliErrorOf,
|
|
106
|
+
deadline: (ms, options) => control.deadline(ms, options),
|
|
107
|
+
runToEnd: (name, work) => control.runToEnd(name, work),
|
|
108
|
+
// Built on first read, so a factory that throws fails only what needs the ports, never `doctor`.
|
|
109
|
+
get ports() {
|
|
110
|
+
return ports();
|
|
111
|
+
},
|
|
112
|
+
project,
|
|
113
|
+
force: flags.force,
|
|
114
|
+
dryRun: flags.dryRun,
|
|
115
|
+
rerun: scope.rerun,
|
|
116
|
+
poll: (check, { intervalMs, signal: stop }) => poll(portsBase.clock, check, intervalMs, stop === undefined ? control.signal : AbortSignal.any([control.signal, stop])),
|
|
117
|
+
deliver,
|
|
118
|
+
notice: scope.notice,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/** `build` runs on the first call; later calls give its value or throw its error again. */
|
|
122
|
+
export function once(build) {
|
|
123
|
+
let outcome;
|
|
124
|
+
return () => {
|
|
125
|
+
if (outcome === undefined) {
|
|
126
|
+
try {
|
|
127
|
+
outcome = { ok: true, value: build() };
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
outcome = { ok: false, error };
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (outcome.ok)
|
|
134
|
+
return outcome.value;
|
|
135
|
+
throw outcome.error;
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=run-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-scope.js","sourceRoot":"","sources":["../src/run-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,IAAI,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,WAAW,EAAmB,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAuB,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE5F,OAAO,EAAkB,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAgB,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,SAAS,EACT,iBAAiB,GAElB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAkB1C,SAAS,MAAM,CAAC,IAA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OAA2E,CAAC;IAChF,OAAO,GAAG,EAAE;QACV,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,IAAI,CAAC;gBACH,OAAO,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC;YACzC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;YACjC,CAAC;QACH,CAAC;QACD,IAAI,OAAO,CAAC,EAAE;YAAE,OAAO,OAAO,CAAC,KAAK,CAAC;QACrC,MAAM,OAAO,CAAC,KAAK,CAAC;IACtB,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/runtime-codes.d.ts
CHANGED
|
@@ -1,3 +1,138 @@
|
|
|
1
|
+
import type { ErrorTable } from "./error-table.js";
|
|
2
|
+
import type { ExitClass } from "./exit-classes.js";
|
|
3
|
+
export declare const DOCTOR_PROBLEMS = "DOCTOR_PROBLEMS";
|
|
4
|
+
export declare const NOT_GLOBAL_INSTALL = "NOT_GLOBAL_INSTALL";
|
|
5
|
+
export declare const NOT_ON_PATH = "NOT_ON_PATH";
|
|
6
|
+
export declare const REGISTRY_UNREACHABLE = "REGISTRY_UNREACHABLE";
|
|
7
|
+
export declare const REGISTRY_AUTH = "REGISTRY_AUTH";
|
|
8
|
+
export declare const INSTALL_FAILED = "INSTALL_FAILED";
|
|
9
|
+
export declare const NPM_FAILED = "NPM_FAILED";
|
|
10
|
+
export declare const NO_LATEST = "NO_LATEST";
|
|
11
|
+
/**
|
|
12
|
+
* The Runtime codes only some Commands reach: each Command that throws one, Built-in or the CLI's
|
|
13
|
+
* own, declares it in `errors`, as it does a code of the CLI's Error table.
|
|
14
|
+
*/
|
|
15
|
+
export declare const declaredRuntimeErrors: {
|
|
16
|
+
readonly DOCTOR_PROBLEMS: {
|
|
17
|
+
readonly class: "operator";
|
|
18
|
+
};
|
|
19
|
+
readonly NOT_GLOBAL_INSTALL: {
|
|
20
|
+
readonly class: "operator";
|
|
21
|
+
};
|
|
22
|
+
readonly NOT_ON_PATH: {
|
|
23
|
+
readonly class: "operator";
|
|
24
|
+
};
|
|
25
|
+
readonly REGISTRY_UNREACHABLE: {
|
|
26
|
+
readonly class: "operator";
|
|
27
|
+
};
|
|
28
|
+
readonly REGISTRY_AUTH: {
|
|
29
|
+
readonly class: "operator";
|
|
30
|
+
};
|
|
31
|
+
readonly INSTALL_FAILED: {
|
|
32
|
+
readonly class: "operator";
|
|
33
|
+
};
|
|
34
|
+
readonly NPM_FAILED: {
|
|
35
|
+
readonly class: "operator";
|
|
36
|
+
};
|
|
37
|
+
readonly NO_LATEST: {
|
|
38
|
+
readonly class: "source";
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
/** The Runtime's own Error table: every code it fails a run with, and the class that must act. */
|
|
42
|
+
export declare const runtimeErrors: {
|
|
43
|
+
readonly INVALID_INPUT: {
|
|
44
|
+
readonly class: "caller";
|
|
45
|
+
};
|
|
46
|
+
readonly UNKNOWN_OPTION: {
|
|
47
|
+
readonly class: "caller";
|
|
48
|
+
};
|
|
49
|
+
readonly UNKNOWN_COMMAND: {
|
|
50
|
+
readonly class: "caller";
|
|
51
|
+
};
|
|
52
|
+
readonly UNKNOWN_FIELD: {
|
|
53
|
+
readonly class: "caller";
|
|
54
|
+
};
|
|
55
|
+
readonly CONFIRMATION_REQUIRED: {
|
|
56
|
+
readonly class: "caller";
|
|
57
|
+
};
|
|
58
|
+
readonly CONFIRMATION_MISMATCH: {
|
|
59
|
+
readonly class: "caller";
|
|
60
|
+
};
|
|
61
|
+
readonly NOT_CONFIRMED: {
|
|
62
|
+
readonly class: "operator";
|
|
63
|
+
};
|
|
64
|
+
readonly NEEDS_OPERATOR: {
|
|
65
|
+
readonly class: "operator";
|
|
66
|
+
};
|
|
67
|
+
readonly OUTPUT_EXISTS: {
|
|
68
|
+
readonly class: "caller";
|
|
69
|
+
};
|
|
70
|
+
readonly STDIN_STALLED: {
|
|
71
|
+
readonly class: "caller";
|
|
72
|
+
};
|
|
73
|
+
readonly INTERRUPTED: {
|
|
74
|
+
readonly class: "interrupted";
|
|
75
|
+
};
|
|
76
|
+
readonly DEADLINE_EXCEEDED: {
|
|
77
|
+
readonly class: "wait";
|
|
78
|
+
};
|
|
79
|
+
readonly INTERNAL: {
|
|
80
|
+
readonly class: "bug";
|
|
81
|
+
};
|
|
82
|
+
readonly PERMISSION_DENIED: {
|
|
83
|
+
readonly class: "operator";
|
|
84
|
+
};
|
|
85
|
+
readonly DISK_FULL: {
|
|
86
|
+
readonly class: "operator";
|
|
87
|
+
};
|
|
88
|
+
readonly NOT_FOUND: {
|
|
89
|
+
readonly class: "caller";
|
|
90
|
+
};
|
|
91
|
+
readonly ALREADY_EXISTS: {
|
|
92
|
+
readonly class: "caller";
|
|
93
|
+
};
|
|
94
|
+
readonly NOT_A_FILE: {
|
|
95
|
+
readonly class: "caller";
|
|
96
|
+
};
|
|
97
|
+
readonly TOOL_FAILED: {
|
|
98
|
+
readonly class: "operator";
|
|
99
|
+
};
|
|
100
|
+
readonly TOOL_MISSING: {
|
|
101
|
+
readonly class: "operator";
|
|
102
|
+
};
|
|
103
|
+
readonly SECRET_MISSING: {
|
|
104
|
+
readonly class: "operator";
|
|
105
|
+
};
|
|
106
|
+
readonly PROJECT_INVALID: {
|
|
107
|
+
readonly class: "operator";
|
|
108
|
+
};
|
|
109
|
+
readonly DOCTOR_PROBLEMS: {
|
|
110
|
+
readonly class: "operator";
|
|
111
|
+
};
|
|
112
|
+
readonly NOT_GLOBAL_INSTALL: {
|
|
113
|
+
readonly class: "operator";
|
|
114
|
+
};
|
|
115
|
+
readonly NOT_ON_PATH: {
|
|
116
|
+
readonly class: "operator";
|
|
117
|
+
};
|
|
118
|
+
readonly REGISTRY_UNREACHABLE: {
|
|
119
|
+
readonly class: "operator";
|
|
120
|
+
};
|
|
121
|
+
readonly REGISTRY_AUTH: {
|
|
122
|
+
readonly class: "operator";
|
|
123
|
+
};
|
|
124
|
+
readonly INSTALL_FAILED: {
|
|
125
|
+
readonly class: "operator";
|
|
126
|
+
};
|
|
127
|
+
readonly NPM_FAILED: {
|
|
128
|
+
readonly class: "operator";
|
|
129
|
+
};
|
|
130
|
+
readonly NO_LATEST: {
|
|
131
|
+
readonly class: "source";
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
export type RuntimeCode = keyof typeof runtimeErrors;
|
|
135
|
+
export type DeclaredRuntimeErrors = typeof declaredRuntimeErrors;
|
|
1
136
|
/** Every code the Runtime fails a run with, keyed by itself, to catch or assert one. */
|
|
2
137
|
export declare const runtimeCodes: {
|
|
3
138
|
readonly INVALID_INPUT: "INVALID_INPUT";
|
|
@@ -31,4 +166,8 @@ export declare const runtimeCodes: {
|
|
|
31
166
|
readonly NPM_FAILED: "NPM_FAILED";
|
|
32
167
|
readonly NO_LATEST: "NO_LATEST";
|
|
33
168
|
};
|
|
34
|
-
export
|
|
169
|
+
export declare const anyCommandClasses: readonly ExitClass[];
|
|
170
|
+
export declare function isRuntimeCode(code: string): code is RuntimeCode;
|
|
171
|
+
export declare function isDeclaredRuntimeCode(code: string): code is keyof DeclaredRuntimeErrors;
|
|
172
|
+
/** Whether a Command or `doctor` row throwing `code` must declare it: a code of `table`, or a Runtime one only some reach. */
|
|
173
|
+
export declare function mustDeclare(code: string, table: ErrorTable): boolean;
|