@vibe-agent-toolkit/cli 0.2.0-rc.3 â 0.2.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/vat +2 -1
- package/dist/bin/vat.js +2 -1
- package/dist/bin/vat.js.map +1 -1
- package/dist/bin.js +37 -3
- package/dist/bin.js.map +1 -1
- package/dist/commands/audit/distributed-tree.d.ts +1 -1
- package/dist/commands/audit/distributed-tree.d.ts.map +1 -1
- package/dist/commands/audit/distributed-tree.js +2 -1
- package/dist/commands/audit/distributed-tree.js.map +1 -1
- package/dist/commands/audit/git-url-clone.d.ts +1 -1
- package/dist/commands/audit/git-url-clone.d.ts.map +1 -1
- package/dist/commands/audit/git-url-clone.js.map +1 -1
- package/dist/commands/audit.d.ts.map +1 -1
- package/dist/commands/audit.js +25 -6
- package/dist/commands/audit.js.map +1 -1
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +14 -11
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/cache/cache-control.d.ts +16 -7
- package/dist/commands/cache/cache-control.d.ts.map +1 -1
- package/dist/commands/cache/cache-control.js +17 -8
- package/dist/commands/cache/cache-control.js.map +1 -1
- package/dist/commands/claude/budget.js +1 -1
- package/dist/commands/claude/budget.js.map +1 -1
- package/dist/commands/claude/context.d.ts +138 -9
- package/dist/commands/claude/context.d.ts.map +1 -1
- package/dist/commands/claude/context.js +450 -80
- package/dist/commands/claude/context.js.map +1 -1
- package/dist/commands/claude/marketplace/git-publish.d.ts.map +1 -1
- package/dist/commands/claude/marketplace/git-publish.js +2 -1
- package/dist/commands/claude/marketplace/git-publish.js.map +1 -1
- package/dist/commands/claude/marketplace/validate.d.ts +18 -0
- package/dist/commands/claude/marketplace/validate.d.ts.map +1 -1
- package/dist/commands/claude/marketplace/validate.js +40 -20
- package/dist/commands/claude/marketplace/validate.js.map +1 -1
- package/dist/commands/claude/plugin/build.d.ts +17 -1
- package/dist/commands/claude/plugin/build.d.ts.map +1 -1
- package/dist/commands/claude/plugin/build.js +45 -16
- package/dist/commands/claude/plugin/build.js.map +1 -1
- package/dist/commands/claude/plugin/helpers.d.ts.map +1 -1
- package/dist/commands/claude/plugin/helpers.js +2 -1
- package/dist/commands/claude/plugin/helpers.js.map +1 -1
- package/dist/commands/claude/plugin/install.d.ts.map +1 -1
- package/dist/commands/claude/plugin/install.js +2 -2
- package/dist/commands/claude/plugin/install.js.map +1 -1
- package/dist/commands/claude/plugin/tree-copy.d.ts.map +1 -1
- package/dist/commands/claude/plugin/tree-copy.js +2 -1
- package/dist/commands/claude/plugin/tree-copy.js.map +1 -1
- package/dist/commands/consistency-check.d.ts.map +1 -1
- package/dist/commands/consistency-check.js +2 -1
- package/dist/commands/consistency-check.js.map +1 -1
- package/dist/commands/corpus/runner.d.ts.map +1 -1
- package/dist/commands/corpus/runner.js +3 -20
- package/dist/commands/corpus/runner.js.map +1 -1
- package/dist/commands/corpus/scan.d.ts.map +1 -1
- package/dist/commands/corpus/scan.js +2 -1
- package/dist/commands/corpus/scan.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +3 -2
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/inventory.js +2 -2
- package/dist/commands/inventory.js.map +1 -1
- package/dist/commands/phase-utils.d.ts +154 -103
- package/dist/commands/phase-utils.d.ts.map +1 -1
- package/dist/commands/phase-utils.js +109 -155
- package/dist/commands/phase-utils.js.map +1 -1
- package/dist/commands/resources/check-progress.d.ts +145 -0
- package/dist/commands/resources/check-progress.d.ts.map +1 -0
- package/dist/commands/resources/check-progress.js +205 -0
- package/dist/commands/resources/check-progress.js.map +1 -0
- package/dist/commands/resources/check-supervisor.d.ts +465 -0
- package/dist/commands/resources/check-supervisor.d.ts.map +1 -0
- package/dist/commands/resources/check-supervisor.js +566 -0
- package/dist/commands/resources/check-supervisor.js.map +1 -0
- package/dist/commands/resources/check.d.ts +454 -0
- package/dist/commands/resources/check.d.ts.map +1 -0
- package/dist/commands/resources/check.js +1237 -0
- package/dist/commands/resources/check.js.map +1 -0
- package/dist/commands/resources/index.d.ts.map +1 -1
- package/dist/commands/resources/index.js +277 -6
- package/dist/commands/resources/index.js.map +1 -1
- package/dist/commands/resources/query.d.ts +89 -0
- package/dist/commands/resources/query.d.ts.map +1 -0
- package/dist/commands/resources/query.js +146 -0
- package/dist/commands/resources/query.js.map +1 -0
- package/dist/commands/resources/scan.d.ts.map +1 -1
- package/dist/commands/resources/scan.js +2 -2
- package/dist/commands/resources/scan.js.map +1 -1
- package/dist/commands/resources/validate.d.ts +11 -0
- package/dist/commands/resources/validate.d.ts.map +1 -1
- package/dist/commands/resources/validate.js +96 -48
- package/dist/commands/resources/validate.js.map +1 -1
- package/dist/commands/skill/test/run.d.ts.map +1 -1
- package/dist/commands/skill/test/run.js +11 -2
- package/dist/commands/skill/test/run.js.map +1 -1
- package/dist/commands/skills/build.d.ts +10 -0
- package/dist/commands/skills/build.d.ts.map +1 -1
- package/dist/commands/skills/build.js +83 -25
- package/dist/commands/skills/build.js.map +1 -1
- package/dist/commands/skills/install.js +0 -1
- package/dist/commands/skills/install.js.map +1 -1
- package/dist/commands/skills/skill-discovery.d.ts.map +1 -1
- package/dist/commands/skills/skill-discovery.js +6 -3
- package/dist/commands/skills/skill-discovery.js.map +1 -1
- package/dist/commands/skills/validate.d.ts +78 -1
- package/dist/commands/skills/validate.d.ts.map +1 -1
- package/dist/commands/skills/validate.js +67 -32
- package/dist/commands/skills/validate.js.map +1 -1
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +26 -16
- package/dist/commands/validate.js.map +1 -1
- package/dist/commands/verify.d.ts +9 -8
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +46 -35
- package/dist/commands/verify.js.map +1 -1
- package/dist/utils/agent-runner.d.ts.map +1 -1
- package/dist/utils/agent-runner.js +7 -3
- package/dist/utils/agent-runner.js.map +1 -1
- package/dist/utils/command-error.d.ts +88 -2
- package/dist/utils/command-error.d.ts.map +1 -1
- package/dist/utils/command-error.js +98 -11
- package/dist/utils/command-error.js.map +1 -1
- package/dist/utils/config-loader.d.ts.map +1 -1
- package/dist/utils/config-loader.js +10 -3
- package/dist/utils/config-loader.js.map +1 -1
- package/dist/utils/issue-severity.d.ts +12 -5
- package/dist/utils/issue-severity.d.ts.map +1 -1
- package/dist/utils/issue-severity.js +1 -1
- package/dist/utils/issue-severity.js.map +1 -1
- package/dist/utils/population-wiring.d.ts +47 -6
- package/dist/utils/population-wiring.d.ts.map +1 -1
- package/dist/utils/population-wiring.js +45 -2
- package/dist/utils/population-wiring.js.map +1 -1
- package/dist/utils/projection-query.d.ts +263 -0
- package/dist/utils/projection-query.d.ts.map +1 -0
- package/dist/utils/projection-query.js +262 -0
- package/dist/utils/projection-query.js.map +1 -0
- package/dist/utils/projection-store.d.ts +110 -6
- package/dist/utils/projection-store.d.ts.map +1 -1
- package/dist/utils/projection-store.js +133 -9
- package/dist/utils/projection-store.js.map +1 -1
- package/dist/utils/resource-loader.d.ts +1 -1
- package/dist/utils/resource-loader.d.ts.map +1 -1
- package/dist/utils/resource-loader.js +11 -1
- package/dist/utils/resource-loader.js.map +1 -1
- package/dist/utils/vat-bin-path.d.ts +36 -0
- package/dist/utils/vat-bin-path.d.ts.map +1 -0
- package/dist/utils/vat-bin-path.js +49 -0
- package/dist/utils/vat-bin-path.js.map +1 -0
- package/package.json +25 -14
- package/dist/commands/resources/command-helpers.d.ts +0 -5
- package/dist/commands/resources/command-helpers.d.ts.map +0 -1
- package/dist/commands/resources/command-helpers.js +0 -6
- package/dist/commands/resources/command-helpers.js.map +0 -1
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared utilities for top-level phase orchestration commands (vat build, vat verify, vat validate).
|
|
3
3
|
*/
|
|
4
|
-
import { spawnSync } from 'node:child_process';
|
|
5
|
-
import { safePath } from '@vibe-agent-toolkit/utils';
|
|
6
4
|
import { Option } from 'commander';
|
|
7
|
-
import * as YAML from 'yaml';
|
|
8
5
|
import { createLogger } from '../utils/logger.js';
|
|
9
6
|
import { writeYamlOutput } from '../utils/output.js';
|
|
10
7
|
/**
|
|
@@ -55,61 +52,47 @@ export function rejectRetiredOnly(only, command, seconds) {
|
|
|
55
52
|
}
|
|
56
53
|
/** The phase outcome for "we did not learn what this phase would have said". */
|
|
57
54
|
export const SYSTEM_ERROR = 'system-error';
|
|
58
|
-
/**
|
|
59
|
-
* Resolve the absolute path to the vat binary.
|
|
60
|
-
* This file lives in commands/, one level above bin/.
|
|
61
|
-
*/
|
|
62
|
-
export function resolveBinPath() {
|
|
63
|
-
// Use bin.js directly (not the vat.js wrapper) so phase subprocesses always
|
|
64
|
-
// run the same binary that is currently executing, regardless of cwd or
|
|
65
|
-
// context detection (which would pick up the adopter project's local install).
|
|
66
|
-
return safePath.resolve(safePath.join(import.meta.dirname, '../bin.js'));
|
|
67
|
-
}
|
|
68
55
|
/**
|
|
69
56
|
* Create the shared phase command context: logger, startTime, and bin path.
|
|
70
57
|
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
58
|
+
* Total by design: it builds the context and decides nothing.
|
|
59
|
+
*
|
|
60
|
+
* â ïļ This runs BEFORE the command's try block, so anything that throws here
|
|
61
|
+
* reaches the user as a raw Node stack trace with zero bytes of stdout and an
|
|
62
|
+
* exit 1 indistinguishable from "validation errors". Phase routing therefore
|
|
63
|
+
* belongs to {@link decidePhaseSelection} and {@link applyPhaseSelection}, which
|
|
64
|
+
* emit the command's normal structured document.
|
|
77
65
|
*/
|
|
78
66
|
export function createPhaseContext(debugFlag) {
|
|
79
67
|
return {
|
|
80
68
|
logger: createLogger(debugFlag ? { debug: true } : {}),
|
|
81
69
|
startTime: Date.now(),
|
|
82
|
-
binPath: resolveBinPath(),
|
|
83
70
|
};
|
|
84
71
|
}
|
|
85
72
|
/**
|
|
86
73
|
* Decide what an orchestrator should do with its `--only` value and the phase
|
|
87
74
|
* list its config produced.
|
|
88
75
|
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* their own `--only` through here.)
|
|
76
|
+
* THE single decision site for all three orchestrators, so they cannot answer
|
|
77
|
+
* the same question differently. An orchestrator that builds its phase list
|
|
78
|
+
* without consulting the config exits 0 on `--only skills` in a project with no
|
|
79
|
+
* `skills:` block while another exits 1 â opposite verdicts on one question.
|
|
80
|
+
* `vat verify` has retired `--only` and always passes `only: undefined`;
|
|
81
|
+
* `vat validate` and `vat build` route their own `--only` through here.
|
|
96
82
|
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* confidently-wrong "no skills: block" instead of reporting the config error.
|
|
102
|
-
* `--only` is gone from verify, `emptyIsValid` went with it, and that ordering
|
|
103
|
-
* hazard cannot recur: nothing short-circuits ahead of the config-error arm.
|
|
83
|
+
* â ïļ **Nothing may short-circuit ahead of the config-error arm.** A check
|
|
84
|
+
* evaluated before `unreadableConfig` answers a confident "not configured" for a
|
|
85
|
+
* tree whose config could not be parsed â which is the one answer this function
|
|
86
|
+
* must never give, because it is indistinguishable from a correct one.
|
|
104
87
|
*
|
|
105
88
|
* @param unreadableConfig - The config-load error, when the config exists but
|
|
106
89
|
* could not be parsed. A broken config is NOT "the phase is unconfigured":
|
|
107
90
|
* we do not know what it declares, so we must not answer with a confident
|
|
108
91
|
* "not configured". Only `vat verify` passes it, and only defensively â its
|
|
109
|
-
* phase builder pushes every
|
|
110
|
-
* (so the
|
|
111
|
-
* this arm unreachable by construction today. It is kept because the arm
|
|
112
|
-
* would otherwise catch an empty list is the "not configured" lie.
|
|
92
|
+
* phase builder pushes every configured phase when the config is unreadable
|
|
93
|
+
* (so the phase itself reports the real error), which makes the list non-empty
|
|
94
|
+
* and this arm unreachable by construction today. It is kept because the arm
|
|
95
|
+
* that would otherwise catch an empty list is the "not configured" lie.
|
|
113
96
|
*/
|
|
114
97
|
export function decidePhaseSelection(only, phases, vocab, options = {}) {
|
|
115
98
|
const lower = vocab.noun.toLowerCase();
|
|
@@ -139,9 +122,9 @@ export function decidePhaseSelection(only, phases, vocab, options = {}) {
|
|
|
139
122
|
* Act on a {@link PhaseSelection}: return the phases to run, or emit the
|
|
140
123
|
* command's normal structured document and exit.
|
|
141
124
|
*
|
|
142
|
-
* Both terminal arms go through `writeYamlOutput` deliberately
|
|
143
|
-
*
|
|
144
|
-
*
|
|
125
|
+
* Both terminal arms go through `writeYamlOutput` deliberately: the YAML
|
|
126
|
+
* document on stdout is the one output a scripted caller parses, so a routing
|
|
127
|
+
* failure has to publish one rather than throw past it.
|
|
145
128
|
*/
|
|
146
129
|
export function applyPhaseSelection(selection, logger, startTime) {
|
|
147
130
|
if (selection.kind === 'run') {
|
|
@@ -172,46 +155,9 @@ const PHASE_STATUS_ORDER = ['success', 'warning', 'error', 'system-error'];
|
|
|
172
155
|
export function worseOf(a, b) {
|
|
173
156
|
return PHASE_STATUS_ORDER.indexOf(b) > PHASE_STATUS_ORDER.indexOf(a) ? b : a;
|
|
174
157
|
}
|
|
175
|
-
/** Every value a
|
|
158
|
+
/** Every value a phase may legitimately report as its own `status`. */
|
|
176
159
|
const REPORTABLE_STATUSES = new Set(PHASE_STATUS_ORDER);
|
|
177
|
-
/**
|
|
178
|
-
* Parse the child's captured stdout into its reported document.
|
|
179
|
-
*
|
|
180
|
-
* Takes the LAST non-empty document in the stream: every orchestrated child
|
|
181
|
-
* writes its summary last, and a child that happens to emit more than one
|
|
182
|
-
* document must not make the summary unreadable.
|
|
183
|
-
*
|
|
184
|
-
* Empty stdout is NOT a failure â `vat skills validate` legitimately exits 0
|
|
185
|
-
* printing nothing when there is no `skills:` block. Stdout that exists but
|
|
186
|
-
* cannot be parsed IS a failure: the child crashed mid-answer, and the phase
|
|
187
|
-
* must degrade to `system-error` rather than throw an unhandled exception out
|
|
188
|
-
* of the orchestrator.
|
|
189
|
-
*/
|
|
190
|
-
function parseChildReport(name, stdout) {
|
|
191
|
-
if (stdout === undefined || stdout === null || stdout.trim() === '') {
|
|
192
|
-
return {};
|
|
193
|
-
}
|
|
194
|
-
let documents;
|
|
195
|
-
try {
|
|
196
|
-
documents = YAML.parseAllDocuments(stdout);
|
|
197
|
-
}
|
|
198
|
-
catch (error) {
|
|
199
|
-
return { parseError: unparseableMessage(name, error) };
|
|
200
|
-
}
|
|
201
|
-
const last = documents.findLast((doc) => doc.contents !== null);
|
|
202
|
-
if (last === undefined) {
|
|
203
|
-
return {};
|
|
204
|
-
}
|
|
205
|
-
if (last.errors.length > 0) {
|
|
206
|
-
return { parseError: unparseableMessage(name, last.errors[0]) };
|
|
207
|
-
}
|
|
208
|
-
return { report: last.toJS() };
|
|
209
|
-
}
|
|
210
|
-
function unparseableMessage(name, cause) {
|
|
211
|
-
const detail = cause instanceof Error ? cause.message : String(cause);
|
|
212
|
-
return `Phase '${name}' wrote unparseable output on stdout: ${detail}`;
|
|
213
|
-
}
|
|
214
|
-
/** The status an exit code alone implies, before the child's report is read. */
|
|
160
|
+
/** The status an exit code alone implies, before the phase's report is read. */
|
|
215
161
|
function statusFromExitCode(status) {
|
|
216
162
|
if (status === 0)
|
|
217
163
|
return 'success';
|
|
@@ -219,7 +165,7 @@ function statusFromExitCode(status) {
|
|
|
219
165
|
return 'error';
|
|
220
166
|
return SYSTEM_ERROR;
|
|
221
167
|
}
|
|
222
|
-
/** The status the
|
|
168
|
+
/** The status the phase claimed for itself, when it claimed a recognized one. */
|
|
223
169
|
function statusFromReport(report) {
|
|
224
170
|
if (typeof report !== 'object' || report === null)
|
|
225
171
|
return undefined;
|
|
@@ -229,49 +175,30 @@ function statusFromReport(report) {
|
|
|
229
175
|
: undefined;
|
|
230
176
|
}
|
|
231
177
|
/**
|
|
232
|
-
* Map a
|
|
178
|
+
* Map what a phase produced to its outcome. The pure core of {@link runPhase}.
|
|
233
179
|
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
180
|
+
* | exit code | phase status | why |
|
|
181
|
+
* |-----------------------|----------------|-----------------------------------------|
|
|
182
|
+
* | 0 | `success` | ran, found nothing actionable |
|
|
183
|
+
* | 1 | `error` | ran, found validation errors |
|
|
184
|
+
* | 2 (or any other) | `system-error` | the phase itself reported a system error |
|
|
236
185
|
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
* | stdout not parseable | `system-error` | the child's answer cannot be read |
|
|
243
|
-
* | exit 0 | `success` | ran, found nothing actionable |
|
|
244
|
-
* | exit 1 | `error` | ran, found validation errors |
|
|
245
|
-
* | exit 2 (or any other) | `system-error` | the child itself reported a system error |
|
|
186
|
+
* The exit code is then reconciled with the phase's OWN reported `status`,
|
|
187
|
+
* worst-wins. An exit code has three values and cannot express `warning`:
|
|
188
|
+
* `vat skills validate` exits 0 while reporting `status: warning`, so its exit
|
|
189
|
+
* code alone reads as `success` â including on the tree VAT's CI dogfoods on
|
|
190
|
+
* VAT itself.
|
|
246
191
|
*
|
|
247
|
-
* The
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
192
|
+
* The table has no row for a signal kill, a missing status code, or a document
|
|
193
|
+
* that fails to parse, and that is the design rather than an omission. A phase
|
|
194
|
+
* runs in this process: there is no serialization step in which to lose a
|
|
195
|
+
* document, and no signal that could take a phase without taking the
|
|
196
|
+
* orchestrator with it.
|
|
252
197
|
*/
|
|
253
|
-
export function
|
|
254
|
-
|
|
255
|
-
return { name, status: SYSTEM_ERROR, error: `Failed to spawn phase: ${outcome.error.message}` };
|
|
256
|
-
}
|
|
257
|
-
if (outcome.signal !== null) {
|
|
258
|
-
return {
|
|
259
|
-
name,
|
|
260
|
-
status: SYSTEM_ERROR,
|
|
261
|
-
signal: outcome.signal,
|
|
262
|
-
error: `Phase '${name}' was killed by signal ${outcome.signal}`,
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
if (outcome.status === null) {
|
|
266
|
-
return { name, status: SYSTEM_ERROR, error: `Phase '${name}' exited without a status code` };
|
|
267
|
-
}
|
|
268
|
-
const exitCode = outcome.status;
|
|
269
|
-
const { report, parseError } = parseChildReport(name, outcome.stdout);
|
|
270
|
-
if (parseError !== undefined) {
|
|
271
|
-
return { name, status: SYSTEM_ERROR, exitCode, error: parseError };
|
|
272
|
-
}
|
|
198
|
+
export function phaseResultFromOutcome(name, outcome) {
|
|
199
|
+
const { exitCode, document } = outcome;
|
|
273
200
|
const exitStatus = statusFromExitCode(exitCode);
|
|
274
|
-
const reported = statusFromReport(
|
|
201
|
+
const reported = statusFromReport(document);
|
|
275
202
|
const status = reported === undefined ? exitStatus : worseOf(exitStatus, reported);
|
|
276
203
|
return {
|
|
277
204
|
name,
|
|
@@ -280,37 +207,64 @@ export function phaseResultFromSpawn(name, outcome) {
|
|
|
280
207
|
...(exitStatus === SYSTEM_ERROR
|
|
281
208
|
? { error: `Phase '${name}' exited with system-error code ${exitCode}` }
|
|
282
209
|
: {}),
|
|
283
|
-
...(
|
|
210
|
+
...(document === undefined ? {} : { report: document }),
|
|
284
211
|
};
|
|
285
212
|
}
|
|
286
213
|
/**
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
214
|
+
* End a command-line run from a phase outcome: publish the document, then exit.
|
|
215
|
+
*
|
|
216
|
+
* THE single place the two lanes diverge, so they cannot diverge anywhere else.
|
|
217
|
+
* A phase hands back the same `{ document, exitCode }` either way; this decides
|
|
218
|
+
* what a *command* does with it, while an orchestrator folds it into
|
|
219
|
+
* `phases[].report` instead.
|
|
220
|
+
*
|
|
221
|
+
* Three cases, and the middle one is the one to get right:
|
|
222
|
+
* - an unexpected failure publishes the shared envelope through
|
|
223
|
+
* `writeYamlOutput`, matching `handleCommandError`;
|
|
224
|
+
* - a command's own report goes through the command's own `render`;
|
|
225
|
+
* - no document at all (an unconfigured run, a dry run) publishes nothing.
|
|
226
|
+
*
|
|
227
|
+
* @param outcome - What the phase produced
|
|
228
|
+
* @param render - How this command publishes its OWN report shape
|
|
291
229
|
*/
|
|
292
|
-
|
|
230
|
+
export function finishCommand(outcome, render) {
|
|
231
|
+
if (outcome.failed === true) {
|
|
232
|
+
writeYamlOutput(outcome.document);
|
|
233
|
+
}
|
|
234
|
+
else if (outcome.document !== undefined) {
|
|
235
|
+
render(outcome.document);
|
|
236
|
+
}
|
|
237
|
+
return process.exit(outcome.exitCode);
|
|
238
|
+
}
|
|
293
239
|
/**
|
|
294
|
-
* Run a single phase
|
|
240
|
+
* Run a single phase in THIS process and fold its outcome into a result.
|
|
241
|
+
*
|
|
242
|
+
* In THIS process, because everything an orchestrator reads back from a phase is
|
|
243
|
+
* the {@link PhaseOutcome} pair. A process per phase buys neither half of it and
|
|
244
|
+
* charges, on every phase, a full Node startup and the whole module graph again
|
|
245
|
+
* (~730 ms of remark per isolate), a parse cache whose miss counters restart
|
|
246
|
+
* from zero, and a worker pool built and torn down before the next phase begins.
|
|
247
|
+
* Phases run sequentially, so none of that cost is ever overlapped with work.
|
|
248
|
+
*
|
|
249
|
+
* The `catch` is a BACKSTOP, not the error path. Every phase function reports
|
|
250
|
+
* its own failures through `reportCommandError` and returns them as a document.
|
|
295
251
|
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
* stderr stays inherited â progress output is on stderr by design and must keep
|
|
300
|
-
* streaming live rather than arriving in one lump at the end.
|
|
252
|
+
* â ïļ This arm exists for a throw that escaped that handling. Sharing the
|
|
253
|
+
* orchestrator's process is what makes it load-bearing: an escaped throw aborts
|
|
254
|
+
* the orchestrator itself and silently skips every later phase.
|
|
301
255
|
*/
|
|
302
|
-
export function runPhase(
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
}
|
|
256
|
+
export async function runPhase(phase) {
|
|
257
|
+
try {
|
|
258
|
+
return phaseResultFromOutcome(phase.name, await phase.run());
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
261
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
262
|
+
return {
|
|
263
|
+
name: phase.name,
|
|
264
|
+
status: SYSTEM_ERROR,
|
|
265
|
+
error: `Phase '${phase.name}' threw past its own error handling: ${detail}`,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
314
268
|
}
|
|
315
269
|
/**
|
|
316
270
|
* Worst-wins aggregate across phases. `system-error` outranks `error`: "we could
|
|
@@ -326,16 +280,16 @@ export function aggregatePhaseStatus(results) {
|
|
|
326
280
|
/**
|
|
327
281
|
* One phase's per-severity distribution, wherever that phase keeps it.
|
|
328
282
|
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
*
|
|
283
|
+
* A phase that holds its own findings publishes {@link PhaseResult.issueCounts}.
|
|
284
|
+
* A phase that publishes its own document deliberately does not â it owns its
|
|
285
|
+
* findings, and its document rides verbatim in {@link PhaseResult.report}.
|
|
286
|
+
*
|
|
287
|
+
* â ïļ Both places must be read. Reading only `issueCounts` makes an
|
|
288
|
+
* orchestrator's header report `{0, 0, 0}` over phases that just reported 12
|
|
289
|
+
* warnings.
|
|
334
290
|
*
|
|
335
291
|
* Absent or malformed counts read as zero rather than throwing: a phase that
|
|
336
|
-
*
|
|
337
|
-
* answer as before this function existed â just no longer the answer for phases
|
|
338
|
-
* that DID publish one.
|
|
292
|
+
* publishes no distribution contributes nothing to the total.
|
|
339
293
|
*/
|
|
340
294
|
export function phaseIssueCounts(result) {
|
|
341
295
|
if (result.issueCounts)
|
|
@@ -354,10 +308,10 @@ export function phaseIssueCounts(result) {
|
|
|
354
308
|
* Sum every phase's distribution, so an orchestrator's header total reconciles
|
|
355
309
|
* against the phases printed beneath it.
|
|
356
310
|
*
|
|
357
|
-
* The companion to {@link aggregatePhaseStatus}: status
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
* `
|
|
311
|
+
* The companion to {@link aggregatePhaseStatus}: status is worst-wins ACROSS
|
|
312
|
+
* phases, so a header whose `status` can see the phases while its `issueCounts`
|
|
313
|
+
* cannot publishes a contradiction in one document â `status: warning` beside
|
|
314
|
+
* `warnings: 0`.
|
|
361
315
|
*/
|
|
362
316
|
export function aggregatePhaseIssueCounts(results) {
|
|
363
317
|
const total = { errors: 0, warnings: 0, info: 0 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phase-utils.js","sourceRoot":"","sources":["../../src/commands/phase-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"phase-utils.js","sourceRoot":"","sources":["../../src/commands/phase-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAgB,MAAM,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAkDrD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,OAAO,OAAO,CAAC,SAAS,CACtB,IAAI,MAAM,CAAC,gBAAgB,EAAE,qCAAqC,CAAC,CAAC,QAAQ,EAAE,CAC/E,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAwB,EAAE,OAAe,EAAE,OAAe;IAC1F,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO;IAE/B,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,qCAAqC,OAAO,MAAM;QAChD,IAAI;QACJ,0BAA0B,OAAO,8CAA8C;QAC/E,8EAA8E;QAC9E,gFAAgF;QAChF,IAAI;QACJ,2BAA2B,OAAO,oCAA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,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAClE,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAC5D,KAAK,CAAC,MAAM,IAAI,MAAM,CAAC;QACvB,KAAK,CAAC,QAAQ,IAAI,QAAQ,CAAC;QAC3B,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC;IACrB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAA+B;IAC/D,MAAM,KAAK,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC5C,IAAI,KAAK,KAAK,YAAY;QAAE,OAAO,CAAC,CAAC;IACrC,OAAO,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The progress log a supervised `vat resources check` writes, and the reader
|
|
3
|
+
* that turns whatever survived into a report.
|
|
4
|
+
*
|
|
5
|
+
* ## ðĻ Why progress goes to a FILE, and never to stdout or IPC
|
|
6
|
+
*
|
|
7
|
+
* The run this log exists for is one that gets `SIGKILL`ed. That is not a design
|
|
8
|
+
* preference: a statement blocked inside synchronous `node:sqlite` never returns
|
|
9
|
+
* to the event loop, so nothing in-process can interrupt it â measured on Node
|
|
10
|
+
* 24.13.1, `worker.terminate()` never resolves against such a thread and the
|
|
11
|
+
* parent's own `process.exit()` does not exit either. An external `SIGKILL` is
|
|
12
|
+
* the only lever, and `SIGKILL` cannot be handled, deferred or flushed.
|
|
13
|
+
*
|
|
14
|
+
* So the child's report of what it has finished has to be DURABLE at every
|
|
15
|
+
* instant, not merely sent. stdout is buffered by the pipe and lost with the
|
|
16
|
+
* process; an IPC message needs a live event loop to be delivered, which is the
|
|
17
|
+
* exact resource the hung child does not have. An `appendFileSync` per unit is
|
|
18
|
+
* on disk before the next unit starts, which is the only property that matters.
|
|
19
|
+
*
|
|
20
|
+
* Keeping it off stdout has a second benefit worth stating: stdout stays the one
|
|
21
|
+
* parseable document this verb has always published, so `vat resources check |
|
|
22
|
+
* jq` is unaffected by a mechanism it should never have to know about.
|
|
23
|
+
*
|
|
24
|
+
* ## ðŠĪ The reader must expect DAMAGE, not merely tolerate it
|
|
25
|
+
*
|
|
26
|
+
* The signal lands wherever it lands, including part-way through a write, so the
|
|
27
|
+
* last line of a killed run's log is routinely half a JSON object. A reader that
|
|
28
|
+
* threw there would replace the bounded failure report with a stack trace at
|
|
29
|
+
* exactly the moment the report is the only thing the operator gets. A reader
|
|
30
|
+
* that GUESSED at a damaged line would be worse still: it would publish a cost
|
|
31
|
+
* record for a measurement nobody took, beside ones somebody did.
|
|
32
|
+
*
|
|
33
|
+
* Every line is therefore validated against a `.strict()` schema and silently
|
|
34
|
+
* dropped when it does not parse. That schema is also the whole of the format
|
|
35
|
+
* contract â there is no version integer here and there must never be one. This
|
|
36
|
+
* file is written and read by ONE process pair within ONE run of ONE build; the
|
|
37
|
+
* question a version integer pretends to answer ("can I read this?") is answered
|
|
38
|
+
* exactly and automatically by the schema the reader compiles with.
|
|
39
|
+
*/
|
|
40
|
+
import { z } from 'zod';
|
|
41
|
+
declare const ProgressEntrySchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
42
|
+
kind: z.ZodLiteral<"population">;
|
|
43
|
+
population: z.ZodUnion<[z.ZodLiteral<"derived">, z.ZodLiteral<"store">]>;
|
|
44
|
+
populationMs: z.ZodNumber;
|
|
45
|
+
membersEnumerated: z.ZodNumber;
|
|
46
|
+
}, "strict", z.ZodTypeAny, {
|
|
47
|
+
kind: "population";
|
|
48
|
+
population: "derived" | "store";
|
|
49
|
+
populationMs: number;
|
|
50
|
+
membersEnumerated: number;
|
|
51
|
+
}, {
|
|
52
|
+
kind: "population";
|
|
53
|
+
population: "derived" | "store";
|
|
54
|
+
populationMs: number;
|
|
55
|
+
membersEnumerated: number;
|
|
56
|
+
}>, z.ZodObject<{
|
|
57
|
+
kind: z.ZodLiteral<"start">;
|
|
58
|
+
name: z.ZodString;
|
|
59
|
+
}, "strict", z.ZodTypeAny, {
|
|
60
|
+
name: string;
|
|
61
|
+
kind: "start";
|
|
62
|
+
}, {
|
|
63
|
+
name: string;
|
|
64
|
+
kind: "start";
|
|
65
|
+
}>, z.ZodObject<{
|
|
66
|
+
kind: z.ZodLiteral<"check">;
|
|
67
|
+
name: z.ZodString;
|
|
68
|
+
durationMs: z.ZodNumber;
|
|
69
|
+
rows: z.ZodOptional<z.ZodNumber>;
|
|
70
|
+
broken: z.ZodOptional<z.ZodLiteral<true>>;
|
|
71
|
+
}, "strict", z.ZodTypeAny, {
|
|
72
|
+
name: string;
|
|
73
|
+
kind: "check";
|
|
74
|
+
durationMs: number;
|
|
75
|
+
rows?: number | undefined;
|
|
76
|
+
broken?: true | undefined;
|
|
77
|
+
}, {
|
|
78
|
+
name: string;
|
|
79
|
+
kind: "check";
|
|
80
|
+
durationMs: number;
|
|
81
|
+
rows?: number | undefined;
|
|
82
|
+
broken?: true | undefined;
|
|
83
|
+
}>, z.ZodObject<{
|
|
84
|
+
kind: z.ZodLiteral<"checks-complete">;
|
|
85
|
+
}, "strict", z.ZodTypeAny, {
|
|
86
|
+
kind: "checks-complete";
|
|
87
|
+
}, {
|
|
88
|
+
kind: "checks-complete";
|
|
89
|
+
}>]>;
|
|
90
|
+
/** One line of the progress log. */
|
|
91
|
+
export type ProgressEntry = z.infer<typeof ProgressEntrySchema>;
|
|
92
|
+
/**
|
|
93
|
+
* What the run was doing when it was killed.
|
|
94
|
+
*
|
|
95
|
+
* `idle` and `reporting` are both real answers and neither is a fallback.
|
|
96
|
+
* `idle` is the gap between the population and the first statement â nothing had
|
|
97
|
+
* started. `reporting` is the opposite end: every check finished and the child
|
|
98
|
+
* was assembling and serialising its document. Naming a rule in either would
|
|
99
|
+
* blame one that did not hang, and collapsing the two would tell an operator
|
|
100
|
+
* "between the population and the first statement" about a run that completed
|
|
101
|
+
* forty rules.
|
|
102
|
+
*/
|
|
103
|
+
export type UnitInFlight = {
|
|
104
|
+
readonly kind: 'population';
|
|
105
|
+
} | {
|
|
106
|
+
readonly kind: 'check';
|
|
107
|
+
readonly name: string;
|
|
108
|
+
} | {
|
|
109
|
+
readonly kind: 'reporting';
|
|
110
|
+
} | {
|
|
111
|
+
readonly kind: 'idle';
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Read whatever of the log survived.
|
|
115
|
+
*
|
|
116
|
+
* @param text - The log's raw contents, tail damage and all
|
|
117
|
+
* @returns The lines that validate, in the order they were written
|
|
118
|
+
*/
|
|
119
|
+
export declare function parseProgressLog(text: string): ProgressEntry[];
|
|
120
|
+
/**
|
|
121
|
+
* Which unit was running when the log stopped growing.
|
|
122
|
+
*
|
|
123
|
+
* ð The population sentinel is keyed on the population line's ABSENCE rather
|
|
124
|
+
* than on there being no `start` lines. Those are different states: a run killed
|
|
125
|
+
* during population has no projection and no honest document, while a run killed
|
|
126
|
+
* between the population and the first statement has both.
|
|
127
|
+
*
|
|
128
|
+
* @param entries - What {@link parseProgressLog} recovered
|
|
129
|
+
* @returns The unit in flight
|
|
130
|
+
*/
|
|
131
|
+
export declare function unitInFlight(entries: readonly ProgressEntry[]): UnitInFlight;
|
|
132
|
+
/**
|
|
133
|
+
* Open the log for append, and hand back the one-line-per-unit writer.
|
|
134
|
+
*
|
|
135
|
+
* â ïļ `appendFileSync`, and it must stay synchronous. The child that writes these
|
|
136
|
+
* lines is about to enter a blocking native call; an asynchronous write would be
|
|
137
|
+
* queued behind work the event loop never gets back to, so the line naming the
|
|
138
|
+
* rule that hangs would exist only in memory â where `SIGKILL` destroys it.
|
|
139
|
+
*
|
|
140
|
+
* @param path - Where the supervisor is watching
|
|
141
|
+
* @returns A writer that appends one entry and returns once it is on disk
|
|
142
|
+
*/
|
|
143
|
+
export declare function createProgressWriter(path: string): (entry: ProgressEntry) => void;
|
|
144
|
+
export {};
|
|
145
|
+
//# sourceMappingURL=check-progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-progress.d.ts","sourceRoot":"","sources":["../../../src/commands/resources/check-progress.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAIH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA0ExB,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKvB,CAAC;AAEH,oCAAoC;AACpC,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,YAAY,GACpB;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;CAAE,GAC/B;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjD;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;CAAE,GAC9B;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9B;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAQ9D;AAyBD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,GAAG,YAAY,CAuB5E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAKjF"}
|