@cnc-tools/storm 0.8.1 → 0.9.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/bin/storm.js +3 -14
- package/dist/application.d.ts +18 -10
- package/dist/application.js +10 -11
- package/dist/bin/storm.js +97 -41
- package/dist/build-info.js +1 -1
- package/dist/chunks/chunk-5CQCRX2L.js +5768 -0
- package/dist/chunks/chunk-5U5Q6VZR.js +556 -0
- package/dist/chunks/chunk-7O6UN63H.js +63 -0
- package/dist/chunks/chunk-I5GZLOLQ.js +38 -0
- package/dist/chunks/chunk-NX55IJ5S.js +1842 -0
- package/dist/chunks/chunk-OCZJE5XV.js +910 -0
- package/dist/chunks/chunk-RRQ2ZGSE.js +1512 -0
- package/dist/chunks/chunk-S5NAIZYS.js +13 -0
- package/dist/chunks/chunk-UHO5OCEX.js +360 -0
- package/dist/chunks/chunk-WBIHJM7D.js +188 -0
- package/dist/chunks/chunk-WV6WQFC6.js +436 -0
- package/dist/chunks/live-app-X3PW2W42.js +89 -0
- package/dist/chunks/version-X7RMSKZI.js +12 -0
- package/dist/commands/exec/command.d.ts +32 -0
- package/dist/commands/exec/command.js +35 -21
- package/dist/commands/exec/metadata.js +66 -58
- package/dist/commands/exec/outcomes.d.ts +67 -0
- package/dist/commands/exec/outcomes.js +50 -0
- package/dist/commands/exec/redaction.js +1 -1
- package/dist/commands/exec/run-collector.d.ts +1 -1
- package/dist/commands/exec/run-collector.js +1 -1
- package/dist/commands/exec/run-command.d.ts +17 -11
- package/dist/commands/exec/run-command.js +33 -16
- package/dist/commands/exec/run-record.d.ts +1 -1
- package/dist/commands/exec/tests-summary.d.ts +1 -1
- package/dist/commands/exec/worker-chart.d.ts +1 -1
- package/dist/commands/runs/list/command.js +136 -33
- package/dist/commands/runs/list/metadata.js +22 -18
- package/dist/commands/runs/logs/command.js +131 -48
- package/dist/commands/runs/logs/metadata.js +24 -20
- package/dist/commands/runs/metadata.js +6 -2
- package/dist/commands/runs/past-run.d.ts +1 -1
- package/dist/commands/runs/past-run.js +1 -1
- package/dist/commands/runs/show/command.js +396 -74
- package/dist/commands/runs/show/metadata.js +24 -20
- package/dist/commands/vitest/command.d.ts +32 -0
- package/dist/commands/vitest/command.js +195 -128
- package/dist/commands/vitest/metadata.js +45 -37
- package/dist/commands/vitest/outcomes.d.ts +16 -0
- package/dist/context.d.ts +1 -1
- package/dist/core/events.d.ts +1 -1
- package/dist/core/payload.d.ts +1 -1
- package/dist/core/payload.js +1 -1
- package/dist/core/provider.d.ts +12 -2
- package/dist/core/run.d.ts +6 -1
- package/dist/core/run.js +2 -2
- package/dist/live-app.d.ts +9 -0
- package/dist/live-app.js +21 -0
- package/dist/resource-commands.d.ts +13 -0
- package/dist/resource-commands.js +22 -0
- package/dist/resources/github/provider.d.ts +1 -1
- package/dist/resources/testserver/command-tree.d.ts +4 -0
- package/dist/resources/testserver/command-tree.js +12 -0
- package/dist/resources/testserver/commands/create/command.js +373 -194
- package/dist/resources/testserver/commands/create/metadata.js +52 -48
- package/dist/resources/testserver/commands/list/command.js +195 -50
- package/dist/resources/testserver/commands/list/metadata.js +12 -8
- package/dist/resources/testserver/provider.d.ts +1 -1
- package/dist/resources/testserver/resource-provider.js +2 -8
- package/dist/resources.d.ts +0 -3
- package/dist/resources.js +5 -10
- package/dist/runner/index.d.ts +2 -1
- package/dist/runner/index.js +1 -0
- package/dist/runner/prepare.d.ts +7 -6
- package/dist/runner/prepare.js +1 -1
- package/dist/runner/ready.d.ts +6 -0
- package/dist/runner/ready.js +33 -5
- package/dist/runner/recipe.d.ts +33 -6
- package/dist/runner/recipe.js +151 -23
- package/dist/runner/remote-command.js +1 -1
- package/dist/runner/secrets.d.ts +42 -0
- package/dist/runner/secrets.js +44 -0
- package/dist/runner/snapshot-build.d.ts +5 -2
- package/dist/runner/snapshot-build.js +12 -5
- package/dist/runner/snapshot-cache.d.ts +3 -3
- package/dist/runner/snapshot-cache.js +2 -2
- package/dist/runner/snapshot-key.d.ts +19 -12
- package/dist/runner/snapshot-key.js +25 -16
- package/dist/runner/snapshot-save.d.ts +5 -3
- package/dist/runner/snapshot-save.js +7 -5
- package/dist/runner/steps.d.ts +6 -1
- package/dist/runner/steps.js +5 -2
- package/dist/sdk/host.d.ts +2 -0
- package/dist/sdk/host.js +7 -0
- package/dist/version.d.ts +2 -2
- package/dist/version.js +10 -11
- package/dist/vitest/config.d.ts +4 -8
- package/dist/vitest/config.js +5 -9
- package/dist/vitest/container-scope.d.ts +12 -5
- package/dist/vitest/container-scope.js +27 -4
- package/dist/vitest/diagnostics.d.ts +8 -2
- package/dist/vitest/diagnostics.js +7 -4
- package/dist/vitest/fixtures.d.ts +4 -1
- package/dist/vitest/fixtures.js +17 -6
- package/dist/vitest/plan.d.ts +1 -1
- package/dist/vitest/plan.js +2 -2
- package/dist/vitest/sandbox.d.ts +6 -0
- package/dist/vitest/sandbox.js +6 -0
- package/package.json +4 -3
- package/skills/overview.md +1 -0
- package/bin/node-version.js +0 -24
- package/dist/closed-terminal.d.ts +0 -7
- package/dist/closed-terminal.js +0 -18
|
@@ -1,36 +1,139 @@
|
|
|
1
|
+
import {
|
|
2
|
+
branchText,
|
|
3
|
+
commandText,
|
|
4
|
+
exitText,
|
|
5
|
+
exitTone,
|
|
6
|
+
onBranch,
|
|
7
|
+
runFacts,
|
|
8
|
+
runFactsSchema,
|
|
9
|
+
runScope,
|
|
10
|
+
runnerCell,
|
|
11
|
+
runsInScope,
|
|
12
|
+
runsUnreadable,
|
|
13
|
+
scopeFacts,
|
|
14
|
+
scopeSchema,
|
|
15
|
+
scopeText,
|
|
16
|
+
startedText,
|
|
17
|
+
tookText,
|
|
18
|
+
totalsText,
|
|
19
|
+
totalsTone
|
|
20
|
+
} from "../../../chunks/chunk-UHO5OCEX.js";
|
|
21
|
+
import "../../../chunks/chunk-5U5Q6VZR.js";
|
|
22
|
+
import "../../../chunks/chunk-NX55IJ5S.js";
|
|
23
|
+
import {
|
|
24
|
+
findConfigFile
|
|
25
|
+
} from "../../../chunks/chunk-OCZJE5XV.js";
|
|
26
|
+
import "../../../chunks/chunk-5CQCRX2L.js";
|
|
27
|
+
import "../../../chunks/chunk-S5NAIZYS.js";
|
|
28
|
+
|
|
29
|
+
// src/commands/runs/list/command.ts
|
|
30
|
+
import { z as z2 } from "zod";
|
|
31
|
+
|
|
32
|
+
// src/commands/runs/list/outcomes.ts
|
|
33
|
+
import { muted, path, renderOutcome, status } from "@vercel/clinkr/vcli-kit";
|
|
34
|
+
import { defineOutcomes } from "@vercel/clinkr";
|
|
1
35
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
var listedSchema = z.object({
|
|
37
|
+
/** Which runs it listed: one config file's, or every run. */
|
|
38
|
+
scope: scopeSchema,
|
|
39
|
+
/** The branch --branch named, which every listed run started on; null without --branch. */
|
|
40
|
+
branch: z.string().nullable(),
|
|
41
|
+
/** How many runs are in the scope, and on the branch, listed or not. */
|
|
42
|
+
total: z.number(),
|
|
43
|
+
/** The newest runs in the scope, newest first, at most --limit. */
|
|
44
|
+
runs: z.array(runFactsSchema)
|
|
45
|
+
});
|
|
46
|
+
function emptyText({ scope, branch }) {
|
|
47
|
+
if (branch === null)
|
|
48
|
+
return scope.kind === "config" ? "No runs of this config file. Pass --all to see every run." : "No runs.";
|
|
49
|
+
return scope.kind === "config" ? "No runs of this config file match this filter. Remove --branch to see all of them, or pass --all to look through every run." : "No runs match this filter. Remove --branch to see all runs.";
|
|
50
|
+
}
|
|
51
|
+
function cell(text, tone) {
|
|
52
|
+
if (text === "-") return muted(text);
|
|
53
|
+
return tone === void 0 ? text : status(text, tone);
|
|
54
|
+
}
|
|
55
|
+
function branchCell(run) {
|
|
56
|
+
const text = branchText(run);
|
|
57
|
+
return run.git === null || run.git.branch === null ? muted(text) : text;
|
|
58
|
+
}
|
|
59
|
+
var outcomes = defineOutcomes({
|
|
60
|
+
results: {
|
|
61
|
+
listed: {
|
|
62
|
+
schema: listedSchema,
|
|
63
|
+
description: "The newest runs in the scope; none is an empty list.",
|
|
64
|
+
render: (listed) => renderOutcome({
|
|
65
|
+
rows: [
|
|
66
|
+
["Runs of", listed.scope.kind === "config" ? path(listed.scope.configFile) : scopeText(listed.scope)],
|
|
67
|
+
...listed.branch === null ? [] : [["Branch", listed.branch]]
|
|
68
|
+
],
|
|
69
|
+
...listed.runs.length === 0 ? { message: emptyText(listed) } : {
|
|
70
|
+
table: {
|
|
71
|
+
columns: ["RUN", "STARTED", "TOOK", "EXIT", "RUNNER", "BRANCH", "TESTS", "COMMAND"],
|
|
72
|
+
// The exit and the tests in the color of how they went, the runner sandbox in a link's color, and
|
|
73
|
+
// what is unknown or not a place muted.
|
|
74
|
+
rows: listed.runs.map((run) => [
|
|
75
|
+
run.id,
|
|
76
|
+
cell(startedText(run)),
|
|
77
|
+
cell(tookText(run)),
|
|
78
|
+
cell(exitText(run), exitTone(run)),
|
|
79
|
+
runnerCell(run),
|
|
80
|
+
branchCell(run),
|
|
81
|
+
cell(totalsText(run), totalsTone(run)),
|
|
82
|
+
cell(commandText(run))
|
|
83
|
+
])
|
|
84
|
+
}
|
|
34
85
|
},
|
|
35
|
-
|
|
86
|
+
...listed.total > listed.runs.length ? {
|
|
87
|
+
next: [
|
|
88
|
+
{
|
|
89
|
+
type: "command",
|
|
90
|
+
argv: [
|
|
91
|
+
"storm",
|
|
92
|
+
"runs",
|
|
93
|
+
"list",
|
|
94
|
+
...listed.scope.kind === "all" && listed.scope.why === "flag" ? ["--all"] : [],
|
|
95
|
+
...listed.branch === null ? [] : ["--branch", listed.branch],
|
|
96
|
+
"--limit",
|
|
97
|
+
String(listed.total)
|
|
98
|
+
],
|
|
99
|
+
label: `List all ${listed.total} runs`
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
} : {}
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
errors: {
|
|
107
|
+
runsUnreadable
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// src/commands/runs/list/command.ts
|
|
112
|
+
var DEFAULT_LIMIT = 20;
|
|
113
|
+
function command(cmd) {
|
|
114
|
+
return cmd.define({
|
|
115
|
+
requestSchema: z2.object({
|
|
116
|
+
all: z2.boolean().default(false),
|
|
117
|
+
limit: z2.number().int().min(1).default(DEFAULT_LIMIT),
|
|
118
|
+
branch: z2.string().min(1).optional()
|
|
119
|
+
}),
|
|
120
|
+
response: outcomes,
|
|
121
|
+
handler: async ({ app }, request) => {
|
|
122
|
+
const now = app.context.clock.now();
|
|
123
|
+
const listed = await app.context.runDirectories.list({ now });
|
|
124
|
+
if (!listed.ok) return outcomes.runsUnreadable({ ...listed.failure });
|
|
125
|
+
const scope = runScope(request.all, await findConfigFile(app.context.config, app.cwd));
|
|
126
|
+
const runs = onBranch(runsInScope(listed.runs, scope), request.branch);
|
|
127
|
+
return outcomes.listed({
|
|
128
|
+
scope: scopeFacts(scope),
|
|
129
|
+
branch: request.branch ?? null,
|
|
130
|
+
total: runs.length,
|
|
131
|
+
runs: runs.slice(0, request.limit).map((run) => runFacts(run, now))
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
});
|
|
36
135
|
}
|
|
136
|
+
export {
|
|
137
|
+
DEFAULT_LIMIT,
|
|
138
|
+
command
|
|
139
|
+
};
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
// src/commands/runs/list/metadata.ts
|
|
2
|
+
var metadata = {
|
|
3
|
+
description: "List past runs, newest first, from their run directories under ${XDG_STATE_HOME:-~/.local/state}/storm/runs/ on this machine: each run's id, when it started, how long its command took, how it ended, the runner its command ran on (local for this machine, with --local, or the runner sandbox's name, linked to its page in the Vercel dashboard on a terminal that takes color, with how long it has left while the run keeps it running), the branch it started from, its tests' totals and its command, the exit and the totals in the color of how the run went on a terminal that takes color. By default only the runs of the storm.config.ts found from the working directory, so each worktree sees its own; every run when none is found. --branch keeps only the runs started on one branch, whichever worktree ran them when given with --all. Changes nothing.",
|
|
4
|
+
summary: "List past runs.",
|
|
5
|
+
aliases: ["ls"],
|
|
6
|
+
fields: {
|
|
7
|
+
all: { description: "List every run, whatever config file it ran with, including runs from an older storm." },
|
|
8
|
+
limit: { valueLabel: "N", description: "List at most N runs, the newest; default 20." },
|
|
9
|
+
branch: {
|
|
10
|
+
valueLabel: "BRANCH",
|
|
11
|
+
description: "List only the runs started with BRANCH checked out. With --all, from every worktree."
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
examples: [
|
|
15
|
+
{ argv: "", description: "List this config file's newest 20 runs." },
|
|
16
|
+
{ argv: "--all --limit 100", description: "List the newest 100 runs on this machine." },
|
|
17
|
+
{ argv: "--all --branch my-feature", description: "List the runs of branch my-feature, from any worktree." },
|
|
18
|
+
{ argv: "--json", description: "List the runs as JSON, each with its run.json facts." }
|
|
19
|
+
]
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
metadata
|
|
19
23
|
};
|
|
@@ -1,51 +1,134 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LOG_STEPS,
|
|
3
|
+
newest,
|
|
4
|
+
runNotFound,
|
|
5
|
+
runScope,
|
|
6
|
+
runsInScope,
|
|
7
|
+
runsUnreadable,
|
|
8
|
+
scopeFacts,
|
|
9
|
+
scopeSchema
|
|
10
|
+
} from "../../../chunks/chunk-UHO5OCEX.js";
|
|
11
|
+
import "../../../chunks/chunk-5U5Q6VZR.js";
|
|
12
|
+
import "../../../chunks/chunk-NX55IJ5S.js";
|
|
13
|
+
import {
|
|
14
|
+
findConfigFile
|
|
15
|
+
} from "../../../chunks/chunk-OCZJE5XV.js";
|
|
16
|
+
import "../../../chunks/chunk-5CQCRX2L.js";
|
|
17
|
+
import "../../../chunks/chunk-S5NAIZYS.js";
|
|
18
|
+
|
|
19
|
+
// src/commands/runs/logs/command.ts
|
|
20
|
+
import { z as z2 } from "zod";
|
|
21
|
+
|
|
22
|
+
// src/commands/runs/logs/outcomes.ts
|
|
23
|
+
import { renderOutcome } from "@vercel/clinkr/vcli-kit";
|
|
24
|
+
import { defineOutcomes } from "@vercel/clinkr";
|
|
1
25
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
var stepSchema = z.enum(LOG_STEPS);
|
|
27
|
+
var printedSchema = z.object({
|
|
28
|
+
/** The run id. */
|
|
29
|
+
runId: z.string(),
|
|
30
|
+
/** The run log: `command` for the command's output, or a step's log. */
|
|
31
|
+
step: stepSchema,
|
|
32
|
+
/** The run log's file. */
|
|
33
|
+
path: z.string(),
|
|
34
|
+
/** The run log's text, as it is now. A step's log starts each line with its time. */
|
|
35
|
+
text: z.string()
|
|
36
|
+
});
|
|
37
|
+
var outcomes = defineOutcomes({
|
|
38
|
+
results: {
|
|
39
|
+
printed: {
|
|
40
|
+
schema: printedSchema,
|
|
41
|
+
description: "The run log's text, as it is.",
|
|
42
|
+
render: ({ text }) => renderOutcome({ text })
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
errors: {
|
|
46
|
+
runsUnreadable,
|
|
47
|
+
runNotFound,
|
|
48
|
+
noRuns: {
|
|
49
|
+
exitCode: 1,
|
|
50
|
+
description: "Without an id, the scope has no run.",
|
|
51
|
+
schema: z.object({
|
|
52
|
+
/** Which runs it looked through. */
|
|
53
|
+
scope: scopeSchema
|
|
54
|
+
}),
|
|
55
|
+
render: ({ scope }) => scope.kind === "config" ? {
|
|
56
|
+
message: `Couldn't find a run of ${scope.configFile}.`,
|
|
57
|
+
next: [
|
|
58
|
+
{
|
|
59
|
+
type: "command",
|
|
60
|
+
argv: ["storm", "runs", "logs", "--all"],
|
|
61
|
+
label: "Print the newest run's command log, of any config file"
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
} : {
|
|
65
|
+
message: "Couldn't find a run.",
|
|
66
|
+
next: [{ type: "text", text: "Start one with storm vitest or storm exec." }]
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
logNotFound: {
|
|
70
|
+
exitCode: 1,
|
|
71
|
+
description: "The run has no log for the step given: the step didn't run, or hasn't written output yet.",
|
|
72
|
+
schema: z.object({
|
|
73
|
+
/** The run id. */
|
|
74
|
+
id: z.string(),
|
|
75
|
+
/** The step given. */
|
|
76
|
+
step: stepSchema,
|
|
77
|
+
/** The run logs the run has. */
|
|
78
|
+
logs: z.array(stepSchema)
|
|
79
|
+
}),
|
|
80
|
+
render: ({ id, step, logs }) => {
|
|
81
|
+
const first = logs[0];
|
|
82
|
+
return {
|
|
83
|
+
message: `Run ${id} has no ${step} log.`,
|
|
84
|
+
rows: [["Logs", logs.length === 0 ? "none" : logs.join(", ")]],
|
|
85
|
+
next: first === void 0 ? [{ type: "command", argv: ["storm", "runs", "show", id], label: "Show the run" }] : [
|
|
86
|
+
{
|
|
87
|
+
type: "command",
|
|
88
|
+
argv: ["storm", "runs", "logs", id, "--step", first],
|
|
89
|
+
label: `Print its ${first} log`
|
|
33
90
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
91
|
+
]
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// src/commands/runs/logs/command.ts
|
|
99
|
+
function command(cmd) {
|
|
100
|
+
return cmd.define({
|
|
101
|
+
requestSchema: z2.object({
|
|
102
|
+
id: z2.string().min(1).optional(),
|
|
103
|
+
step: z2.enum(LOG_STEPS).default("command"),
|
|
104
|
+
all: z2.boolean().default(false)
|
|
105
|
+
}),
|
|
106
|
+
cli: { positionals: ["id"] },
|
|
107
|
+
response: outcomes,
|
|
108
|
+
handler: async ({ app }, request) => {
|
|
109
|
+
const now = app.context.clock.now();
|
|
110
|
+
let id = request.id;
|
|
111
|
+
if (id === void 0) {
|
|
112
|
+
const listed = await app.context.runDirectories.list({ now });
|
|
113
|
+
if (!listed.ok) return outcomes.runsUnreadable({ ...listed.failure });
|
|
114
|
+
const scope = runScope(request.all, await findConfigFile(app.context.config, app.cwd));
|
|
115
|
+
const run = newest(runsInScope(listed.runs, scope));
|
|
116
|
+
if (run === void 0) return outcomes.noRuns({ scope: scopeFacts(scope) });
|
|
117
|
+
id = run.id;
|
|
118
|
+
}
|
|
119
|
+
const read = await app.context.runDirectories.read({ id, now });
|
|
120
|
+
if (read.kind === "failed") return outcomes.runsUnreadable({ ...read.failure });
|
|
121
|
+
if (read.kind === "not-found") return outcomes.runNotFound({ id });
|
|
122
|
+
const logs = LOG_STEPS.filter((log2) => read.directory.logs.includes(log2));
|
|
123
|
+
const notFound = () => outcomes.logNotFound({ id, step: request.step, logs: [...logs] });
|
|
124
|
+
if (!logs.includes(request.step)) return notFound();
|
|
125
|
+
const log = await app.context.runDirectories.readLog({ id, log: request.step });
|
|
126
|
+
if (log.kind === "failed") return outcomes.runsUnreadable({ ...log.failure });
|
|
127
|
+
if (log.kind === "not-found") return notFound();
|
|
128
|
+
return outcomes.printed({ runId: id, step: request.step, path: log.path, text: log.text });
|
|
129
|
+
}
|
|
130
|
+
});
|
|
51
131
|
}
|
|
132
|
+
export {
|
|
133
|
+
command
|
|
134
|
+
};
|
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
step: {
|
|
11
|
-
valueLabel: "STEP",
|
|
12
|
-
description: "The log to print: command (the default) for the output of the command, or install, build, apply or snapshot for the log of that step.",
|
|
13
|
-
},
|
|
14
|
-
all: { description: "Without an id, use the newest run of any config file." },
|
|
1
|
+
// src/commands/runs/logs/metadata.ts
|
|
2
|
+
var metadata = {
|
|
3
|
+
description: "Print a log of a run from its run directory, as it is, on stdout. The command log holds all the output of the command: the output of its tests, and output that no test owns, such as the output of a beforeAll, a global setup, a raw write to stdout or stderr, or a child process. A step log holds the output of one step of a runner run: install, build, apply or snapshot. Each line of a step log starts with its time. Without an id, it prints a log of the newest run of the storm.config.ts found from the working directory, or of every config with --all. That run can still be going: then it prints the log as it is now. Changes nothing.",
|
|
4
|
+
summary: "Print the command log or a step log of a run.",
|
|
5
|
+
usages: ["[<id>] [--step command|install|build|apply|snapshot] [--all]"],
|
|
6
|
+
fields: {
|
|
7
|
+
id: {
|
|
8
|
+
valueLabel: "id",
|
|
9
|
+
description: "The run id, such as 20261103T192655-8277, which `storm vitest`, `storm exec` and `storm runs list` print."
|
|
15
10
|
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
step: {
|
|
12
|
+
valueLabel: "STEP",
|
|
13
|
+
description: "The log to print: command (the default) for the output of the command, or install, build, apply or snapshot for the log of that step."
|
|
14
|
+
},
|
|
15
|
+
all: { description: "Without an id, use the newest run of any config file." }
|
|
16
|
+
},
|
|
17
|
+
examples: [
|
|
18
|
+
{ argv: "20261103T192655-8277", description: "Print the command log of a run." },
|
|
19
|
+
{ argv: "", description: "Print the command log of the newest run. Pipe it to grep to find lines." },
|
|
20
|
+
{ argv: "20261103T192655-8277 --step install", description: "Print the install log of a runner run." },
|
|
21
|
+
{ argv: "20261103T192655-8277 --json", description: "Print the command log as JSON, with its path." }
|
|
22
|
+
]
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
metadata
|
|
22
26
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { z } from "zod";
|
|
2
2
|
import type { ListedRunDirectory, PastRunDirectory } from "../../core/index.ts";
|
|
3
3
|
import type { StormTimeline } from "../../resources.ts";
|
|
4
|
-
import { type TestEvent, type TestResultEvent } from "../../sdk/
|
|
4
|
+
import { type TestEvent, type TestResultEvent } from "../../sdk/host.ts";
|
|
5
5
|
import { timelineSchema } from "../exec/outcomes.ts";
|
|
6
6
|
import { type RunRecord } from "../exec/run-record.ts";
|
|
7
7
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// `run.json`, `tests.jsonl` and `timeline.json` say, and how a person reads those facts. Pure: the commands hand it
|
|
3
3
|
// what the run directory gateway read. Files it can't read, or from an older storm, leave facts unknown, never
|
|
4
4
|
// an error.
|
|
5
|
-
import { parseTestEvent } from "../../sdk/
|
|
5
|
+
import { parseTestEvent } from "../../sdk/host.js";
|
|
6
6
|
import { timelineSchema } from "../exec/outcomes.js";
|
|
7
7
|
import { parseRunRecord } from "../exec/run-record.js";
|
|
8
8
|
/** The scope for `--all` and the config file found from the working directory, if any. */
|