@vibe-agent-toolkit/cli 0.1.41-rc.6 → 0.1.41-rc.8

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.
Files changed (199) hide show
  1. package/README.md +4 -3
  2. package/dist/bin/vat +25 -2
  3. package/dist/bin/vat.js +25 -2
  4. package/dist/bin/vat.js.map +1 -1
  5. package/dist/bin.js +12 -1
  6. package/dist/bin.js.map +1 -1
  7. package/dist/commands/agent/list.d.ts +11 -0
  8. package/dist/commands/agent/list.d.ts.map +1 -1
  9. package/dist/commands/agent/list.js +30 -11
  10. package/dist/commands/agent/list.js.map +1 -1
  11. package/dist/commands/audit/hierarchical-output.d.ts +6 -2
  12. package/dist/commands/audit/hierarchical-output.d.ts.map +1 -1
  13. package/dist/commands/audit/hierarchical-output.js +93 -50
  14. package/dist/commands/audit/hierarchical-output.js.map +1 -1
  15. package/dist/commands/audit-settings.d.ts +35 -0
  16. package/dist/commands/audit-settings.d.ts.map +1 -1
  17. package/dist/commands/audit-settings.js +121 -51
  18. package/dist/commands/audit-settings.js.map +1 -1
  19. package/dist/commands/audit.d.ts +97 -2
  20. package/dist/commands/audit.d.ts.map +1 -1
  21. package/dist/commands/audit.js +505 -231
  22. package/dist/commands/audit.js.map +1 -1
  23. package/dist/commands/build.d.ts +14 -0
  24. package/dist/commands/build.d.ts.map +1 -1
  25. package/dist/commands/build.js +126 -32
  26. package/dist/commands/build.js.map +1 -1
  27. package/dist/commands/claude/marketplace/license-utils.d.ts +39 -2
  28. package/dist/commands/claude/marketplace/license-utils.d.ts.map +1 -1
  29. package/dist/commands/claude/marketplace/license-utils.js +114 -68
  30. package/dist/commands/claude/marketplace/license-utils.js.map +1 -1
  31. package/dist/commands/claude/marketplace/publish.js +5 -4
  32. package/dist/commands/claude/marketplace/publish.js.map +1 -1
  33. package/dist/commands/claude/marketplace/validate.d.ts +97 -0
  34. package/dist/commands/claude/marketplace/validate.d.ts.map +1 -1
  35. package/dist/commands/claude/marketplace/validate.js +157 -49
  36. package/dist/commands/claude/marketplace/validate.js.map +1 -1
  37. package/dist/commands/claude/org/skills.d.ts +11 -3
  38. package/dist/commands/claude/org/skills.d.ts.map +1 -1
  39. package/dist/commands/claude/org/skills.js +70 -20
  40. package/dist/commands/claude/org/skills.js.map +1 -1
  41. package/dist/commands/claude/org/stubs.d.ts +9 -1
  42. package/dist/commands/claude/org/stubs.d.ts.map +1 -1
  43. package/dist/commands/claude/org/stubs.js +11 -3
  44. package/dist/commands/claude/org/stubs.js.map +1 -1
  45. package/dist/commands/claude/plugin/build.d.ts +116 -0
  46. package/dist/commands/claude/plugin/build.d.ts.map +1 -1
  47. package/dist/commands/claude/plugin/build.js +173 -40
  48. package/dist/commands/claude/plugin/build.js.map +1 -1
  49. package/dist/commands/claude/plugin/marketplace-json.d.ts +36 -0
  50. package/dist/commands/claude/plugin/marketplace-json.d.ts.map +1 -0
  51. package/dist/commands/claude/plugin/marketplace-json.js +34 -0
  52. package/dist/commands/claude/plugin/marketplace-json.js.map +1 -0
  53. package/dist/commands/claude/plugin/plugin-json-merge.d.ts +30 -1
  54. package/dist/commands/claude/plugin/plugin-json-merge.d.ts.map +1 -1
  55. package/dist/commands/claude/plugin/plugin-json-merge.js +107 -14
  56. package/dist/commands/claude/plugin/plugin-json-merge.js.map +1 -1
  57. package/dist/commands/claude/plugin/tree-copy.d.ts.map +1 -1
  58. package/dist/commands/claude/plugin/tree-copy.js +0 -1
  59. package/dist/commands/claude/plugin/tree-copy.js.map +1 -1
  60. package/dist/commands/corpus/report.d.ts +22 -4
  61. package/dist/commands/corpus/report.d.ts.map +1 -1
  62. package/dist/commands/corpus/report.js +1 -0
  63. package/dist/commands/corpus/report.js.map +1 -1
  64. package/dist/commands/corpus/runner.d.ts +16 -1
  65. package/dist/commands/corpus/runner.d.ts.map +1 -1
  66. package/dist/commands/corpus/runner.js +55 -48
  67. package/dist/commands/corpus/runner.js.map +1 -1
  68. package/dist/commands/doctor.d.ts +57 -8
  69. package/dist/commands/doctor.d.ts.map +1 -1
  70. package/dist/commands/doctor.js +142 -67
  71. package/dist/commands/doctor.js.map +1 -1
  72. package/dist/commands/inventory.d.ts +2 -0
  73. package/dist/commands/inventory.d.ts.map +1 -1
  74. package/dist/commands/inventory.js +45 -4
  75. package/dist/commands/inventory.js.map +1 -1
  76. package/dist/commands/phase-utils.d.ts +240 -11
  77. package/dist/commands/phase-utils.d.ts.map +1 -1
  78. package/dist/commands/phase-utils.js +352 -15
  79. package/dist/commands/phase-utils.js.map +1 -1
  80. package/dist/commands/rag/query-command.d.ts +40 -0
  81. package/dist/commands/rag/query-command.d.ts.map +1 -1
  82. package/dist/commands/rag/query-command.js +47 -20
  83. package/dist/commands/rag/query-command.js.map +1 -1
  84. package/dist/commands/resources/index.d.ts.map +1 -1
  85. package/dist/commands/resources/index.js +38 -13
  86. package/dist/commands/resources/index.js.map +1 -1
  87. package/dist/commands/resources/scan.d.ts +37 -0
  88. package/dist/commands/resources/scan.d.ts.map +1 -1
  89. package/dist/commands/resources/scan.js +47 -32
  90. package/dist/commands/resources/scan.js.map +1 -1
  91. package/dist/commands/resources/validate.d.ts +136 -1
  92. package/dist/commands/resources/validate.d.ts.map +1 -1
  93. package/dist/commands/resources/validate.js +121 -68
  94. package/dist/commands/resources/validate.js.map +1 -1
  95. package/dist/commands/skill/review.d.ts.map +1 -1
  96. package/dist/commands/skill/review.js +40 -23
  97. package/dist/commands/skill/review.js.map +1 -1
  98. package/dist/commands/skill/test/run.d.ts +1 -1
  99. package/dist/commands/skill/test/run.d.ts.map +1 -1
  100. package/dist/commands/skill/test/run.js +8 -6
  101. package/dist/commands/skill/test/run.js.map +1 -1
  102. package/dist/commands/skills/build.d.ts +140 -0
  103. package/dist/commands/skills/build.d.ts.map +1 -1
  104. package/dist/commands/skills/build.js +348 -94
  105. package/dist/commands/skills/build.js.map +1 -1
  106. package/dist/commands/skills/command-helpers.d.ts +6 -10
  107. package/dist/commands/skills/command-helpers.d.ts.map +1 -1
  108. package/dist/commands/skills/command-helpers.js +6 -22
  109. package/dist/commands/skills/command-helpers.js.map +1 -1
  110. package/dist/commands/skills/list.d.ts +18 -0
  111. package/dist/commands/skills/list.d.ts.map +1 -1
  112. package/dist/commands/skills/list.js +41 -15
  113. package/dist/commands/skills/list.js.map +1 -1
  114. package/dist/commands/skills/package.d.ts +17 -0
  115. package/dist/commands/skills/package.d.ts.map +1 -1
  116. package/dist/commands/skills/package.js +72 -43
  117. package/dist/commands/skills/package.js.map +1 -1
  118. package/dist/commands/skills/skill-discovery.d.ts.map +1 -1
  119. package/dist/commands/skills/skill-discovery.js +9 -1
  120. package/dist/commands/skills/skill-discovery.js.map +1 -1
  121. package/dist/commands/skills/validate-command.d.ts.map +1 -1
  122. package/dist/commands/skills/validate-command.js +22 -6
  123. package/dist/commands/skills/validate-command.js.map +1 -1
  124. package/dist/commands/skills/validate.d.ts +79 -0
  125. package/dist/commands/skills/validate.d.ts.map +1 -1
  126. package/dist/commands/skills/validate.js +268 -79
  127. package/dist/commands/skills/validate.js.map +1 -1
  128. package/dist/commands/validate.d.ts +18 -0
  129. package/dist/commands/validate.d.ts.map +1 -1
  130. package/dist/commands/validate.js +79 -66
  131. package/dist/commands/validate.js.map +1 -1
  132. package/dist/commands/verify.d.ts +38 -1
  133. package/dist/commands/verify.d.ts.map +1 -1
  134. package/dist/commands/verify.js +247 -84
  135. package/dist/commands/verify.js.map +1 -1
  136. package/dist/index.d.ts +1 -1
  137. package/dist/index.d.ts.map +1 -1
  138. package/dist/index.js +7 -1
  139. package/dist/index.js.map +1 -1
  140. package/dist/skill-resolution/index.d.ts +1 -1
  141. package/dist/skill-resolution/index.d.ts.map +1 -1
  142. package/dist/skill-resolution/index.js +1 -1
  143. package/dist/skill-resolution/index.js.map +1 -1
  144. package/dist/skill-resolution/packaging-config.d.ts +15 -2
  145. package/dist/skill-resolution/packaging-config.d.ts.map +1 -1
  146. package/dist/skill-resolution/packaging-config.js +39 -2
  147. package/dist/skill-resolution/packaging-config.js.map +1 -1
  148. package/dist/utils/command-error.d.ts +34 -1
  149. package/dist/utils/command-error.d.ts.map +1 -1
  150. package/dist/utils/command-error.js +32 -1
  151. package/dist/utils/command-error.js.map +1 -1
  152. package/dist/utils/config-loader.d.ts.map +1 -1
  153. package/dist/utils/config-loader.js +0 -2
  154. package/dist/utils/config-loader.js.map +1 -1
  155. package/dist/utils/help-loader.d.ts +6 -2
  156. package/dist/utils/help-loader.d.ts.map +1 -1
  157. package/dist/utils/help-loader.js +9 -16
  158. package/dist/utils/help-loader.js.map +1 -1
  159. package/dist/utils/issue-anchor.d.ts +26 -0
  160. package/dist/utils/issue-anchor.d.ts.map +1 -0
  161. package/dist/utils/issue-anchor.js +39 -0
  162. package/dist/utils/issue-anchor.js.map +1 -0
  163. package/dist/utils/issue-rendering.d.ts +149 -0
  164. package/dist/utils/issue-rendering.d.ts.map +1 -0
  165. package/dist/utils/issue-rendering.js +229 -0
  166. package/dist/utils/issue-rendering.js.map +1 -0
  167. package/dist/utils/output.d.ts +80 -9
  168. package/dist/utils/output.d.ts.map +1 -1
  169. package/dist/utils/output.js +138 -23
  170. package/dist/utils/output.js.map +1 -1
  171. package/dist/utils/project-root-policy.d.ts +2 -2
  172. package/dist/utils/project-root-policy.js +2 -2
  173. package/dist/utils/relativize-paths.d.ts +45 -0
  174. package/dist/utils/relativize-paths.d.ts.map +1 -0
  175. package/dist/utils/relativize-paths.js +67 -0
  176. package/dist/utils/relativize-paths.js.map +1 -0
  177. package/dist/utils/resource-loader.d.ts +21 -2
  178. package/dist/utils/resource-loader.d.ts.map +1 -1
  179. package/dist/utils/resource-loader.js +85 -11
  180. package/dist/utils/resource-loader.js.map +1 -1
  181. package/dist/utils/skill-packaging-config.d.ts +22 -1
  182. package/dist/utils/skill-packaging-config.d.ts.map +1 -1
  183. package/dist/utils/skill-packaging-config.js +26 -0
  184. package/dist/utils/skill-packaging-config.js.map +1 -1
  185. package/dist/utils/validate-help-files.d.ts +3 -2
  186. package/dist/utils/validate-help-files.d.ts.map +1 -1
  187. package/dist/utils/validate-help-files.js +48 -5
  188. package/dist/utils/validate-help-files.js.map +1 -1
  189. package/dist/utils/verdict-helpers.d.ts +14 -5
  190. package/dist/utils/verdict-helpers.d.ts.map +1 -1
  191. package/dist/utils/verdict-helpers.js +19 -16
  192. package/dist/utils/verdict-helpers.js.map +1 -1
  193. package/docs/audit.md +40 -14
  194. package/docs/doctor.md +46 -10
  195. package/docs/index.md +1 -1
  196. package/docs/rag.md +9 -4
  197. package/docs/resources.md +54 -22
  198. package/docs/skills.md +11 -7
  199. package/package.json +12 -12
@@ -1,14 +1,98 @@
1
1
  /**
2
- * Shared utilities for top-level phase orchestration commands (vat build, vat verify).
2
+ * Shared utilities for top-level phase orchestration commands (vat build, vat verify, vat validate).
3
3
  */
4
+ import { type SeverityCounts } from '@vibe-agent-toolkit/agent-schema';
5
+ import { type Command } from 'commander';
4
6
  import { createLogger } from '../utils/logger.js';
5
7
  export interface Phase {
6
8
  name: string;
7
9
  args: string[];
8
10
  }
11
+ /**
12
+ * Declare `--only` on a command that has RETIRED it, solely so the command can
13
+ * explain itself instead of emitting Commander's bare `error: unknown option
14
+ * '--only'`.
15
+ *
16
+ * This is **not** a backward-compatibility shim — the pre-1.0 policy forbids
17
+ * those and this obeys it. The flag does not work: {@link rejectRetiredOnly}
18
+ * fails the run before any phase is selected, so no caller can keep depending
19
+ * on the old behaviour. What it buys is a diagnosis. An unknown-option error
20
+ * names the flag and nothing else; the reader cannot tell a typo from a removal
21
+ * and has no way to learn what replaced it, so the next move is a bug report or
22
+ * a version pin. Naming the removal, the measurement behind it, and the command
23
+ * where `--only` still exists turns a dead end into a one-line fix.
24
+ *
25
+ * Hidden from `--help` on purpose: a retired flag is not a feature to discover,
26
+ * and listing it would suggest it still selects something.
27
+ */
28
+ export declare function addRetiredOnlyOption(command: Command): Command;
29
+ /**
30
+ * Fail the run when a caller passed the retired `--only`, naming what changed.
31
+ *
32
+ * Exit 1, matching both Commander's usage-error convention and the exit code an
33
+ * unroutable `--only` already produced on these commands, so a CI gate that was
34
+ * failing on a bad `--only` keeps failing rather than flipping to green.
35
+ *
36
+ * @param only - The parsed `--only` value; `undefined` when it was not passed.
37
+ * @param command - Command name for the message, e.g. `vat validate`.
38
+ * @param seconds - The measured full-run duration that made the flag not worth
39
+ * its coverage risk. Cited so the removal reads as a decision with evidence
40
+ * rather than a preference.
41
+ */
42
+ export declare function rejectRetiredOnly(only: string | undefined, command: string, seconds: number): void;
43
+ /**
44
+ * Outcome of one orchestrated phase.
45
+ *
46
+ * `system-error` is a value of its own because **a phase that could not RUN is
47
+ * not a phase that found problems.** Collapsing it into `error` (which is what
48
+ * `result.status === 0 ? 'passed' : 'failed'` did) made the documented exit
49
+ * code 2 unreachable from every orchestrator, so a CI script could not tell an
50
+ * invalid config or a killed child from a broken link.
51
+ *
52
+ * `warning` reaches a subprocess phase through the child's own reported
53
+ * `status`, NOT through its exit code — `vat skills validate` exits 0 while
54
+ * reporting `status: warning`, so an exit-code-only mapping answered `success`
55
+ * on the very tree where the child said otherwise. In-process phases (e.g.
56
+ * verify's consistency check) emit it directly.
57
+ */
58
+ export type PhaseStatus = 'success' | 'warning' | 'error' | 'system-error';
59
+ /** The phase outcome for "we did not learn what this phase would have said". */
60
+ export declare const SYSTEM_ERROR: PhaseStatus;
9
61
  export interface PhaseResult {
10
62
  name: string;
11
- status: string;
63
+ status: PhaseStatus;
64
+ /** Child exit code, when the child ran and exited on its own. */
65
+ exitCode?: number;
66
+ /** POSIX signal that killed the child, when one did (then `exitCode` is absent). */
67
+ signal?: string;
68
+ /** Why the phase could not run at all (the spawn itself failed). */
69
+ error?: string;
70
+ /**
71
+ * Per-severity distribution for in-process phases that hold their own
72
+ * findings. Absent for subprocess phases: the child owns its own findings,
73
+ * and inventing counts here would be a second, weaker answer — the child's
74
+ * are carried verbatim in {@link PhaseResult.report} instead.
75
+ */
76
+ issueCounts?: SeverityCounts;
77
+ /**
78
+ * The child's own YAML document, parsed and folded in.
79
+ *
80
+ * The child used to write this straight onto the parent's stdout (`stdio:
81
+ * 'inherit'`), which concatenated N documents with no `---` between them: two
82
+ * phases produced one map carrying `status:` and `durationSecs:` twice, and
83
+ * `YAML.parse()` threw "Map keys must be unique". Nesting each child's
84
+ * document under its own phase makes the parent's stdout one parseable
85
+ * document again and loses nothing.
86
+ */
87
+ report?: unknown;
88
+ }
89
+ /** The subset of a `spawnSync` return that decides a phase's outcome. */
90
+ export interface PhaseSpawnOutcome {
91
+ status: number | null;
92
+ signal: NodeJS.Signals | null;
93
+ error?: Error | undefined;
94
+ /** The child's captured stdout, when it was piped rather than inherited. */
95
+ stdout?: string | null | undefined;
12
96
  }
13
97
  /**
14
98
  * Resolve the absolute path to the vat binary.
@@ -21,19 +105,164 @@ export interface PhaseContext {
21
105
  binPath: string;
22
106
  }
23
107
  /**
24
- * Create the shared phase command context: logger, startTime, and validated bin path.
25
- * Throws if the phases list is empty (indicating an unknown --only value).
108
+ * Create the shared phase command context: logger, startTime, and bin path.
109
+ *
110
+ * It used to THROW when the phase list came out empty — and it was called
111
+ * before the command's try block, so an unroutable `--only` reached the user as
112
+ * a raw Node stack trace with zero bytes of stdout and an exit 1 that looked
113
+ * like "validation errors". `--only` routing is decided by
114
+ * {@link decidePhaseSelection} and reported by {@link applyPhaseSelection} now,
115
+ * which emit the command's normal structured document.
116
+ */
117
+ export declare function createPhaseContext(debugFlag: boolean | undefined): PhaseContext;
118
+ /**
119
+ * The decision an orchestrator reaches about what `--only` asked for.
120
+ *
121
+ * Three arms, because the three answers carry different exit codes and none of
122
+ * them may be collapsed into another:
123
+ * - `run` — go ahead with these phases.
124
+ * - `fail` — the caller named a phase that is unrecognized, or recognized but
125
+ * not configured. Exit 1: a CI gate asked for coverage that cannot
126
+ * run and must not stay green.
127
+ * - `noop` — a bare run in a project that configures nothing. Exit 0, but
128
+ * WARNED, so a config typo is not indistinguishable from success.
129
+ */
130
+ export type PhaseSelection = {
131
+ kind: 'run';
132
+ phases: Phase[];
133
+ } | {
134
+ kind: 'fail';
135
+ message: string;
136
+ } | {
137
+ kind: 'noop';
138
+ warning: string;
139
+ note: string;
140
+ };
141
+ /** How one orchestrator names the things `--only` selects, for its messages. */
142
+ export interface PhaseVocabulary {
143
+ /** Capitalized singular: 'Phase' (build, verify) or 'Surface' (validate). */
144
+ noun: 'Phase' | 'Surface';
145
+ /** The verb in "nothing to <verb>": 'build', 'verify', 'validate'. */
146
+ verb: string;
147
+ /** Every name `--only` accepts, in help order. */
148
+ validNames: readonly string[];
149
+ /** Stderr warning + stdout note for a bare run with nothing configured. */
150
+ noop?: {
151
+ warning: string;
152
+ note: string;
153
+ };
154
+ }
155
+ /**
156
+ * Decide what an orchestrator should do with its `--only` value and the phase
157
+ * list its config produced.
158
+ *
159
+ * Shared by all three orchestrators because they used to disagree: `vat verify`
160
+ * built its phase list without consulting the config at all, so `vat verify
161
+ * --only skills` in a project with no `skills:` block exited 0 while `vat
162
+ * validate --only skills` on the same project exited 1 — opposite verdicts on
163
+ * the same question. (`vat verify` has since retired `--only` entirely and now
164
+ * always passes `only: undefined`; `vat validate` and `vat build` still route
165
+ * their own `--only` through here.)
166
+ *
167
+ * There used to be a third option, `emptyIsValid`, which existed solely so
168
+ * `vat verify --only consistency` could run with an empty SUBPROCESS list
169
+ * (consistency runs in-process). It was checked BEFORE `unreadableConfig`, so
170
+ * `vat verify --only consistency` against an unparseable config answered the
171
+ * confidently-wrong "no skills: block" instead of reporting the config error.
172
+ * `--only` is gone from verify, `emptyIsValid` went with it, and that ordering
173
+ * hazard cannot recur: nothing short-circuits ahead of the config-error arm.
174
+ *
175
+ * @param unreadableConfig - The config-load error, when the config exists but
176
+ * could not be parsed. A broken config is NOT "the phase is unconfigured":
177
+ * we do not know what it declares, so we must not answer with a confident
178
+ * "not configured". Only `vat verify` passes it, and only defensively — its
179
+ * phase builder pushes every subprocess phase when the config is unreadable
180
+ * (so the CHILD reports the real error), which makes the list non-empty and
181
+ * this arm unreachable by construction today. It is kept because the arm that
182
+ * would otherwise catch an empty list is the "not configured" lie.
183
+ */
184
+ export declare function decidePhaseSelection(only: string | undefined, phases: Phase[], vocab: PhaseVocabulary, options?: {
185
+ unreadableConfig?: string | undefined;
186
+ }): PhaseSelection;
187
+ /**
188
+ * Act on a {@link PhaseSelection}: return the phases to run, or emit the
189
+ * command's normal structured document and exit.
26
190
  *
27
- * @param debugFlag - Whether debug logging is enabled
28
- * @param phases - Pre-built list of phases to validate
29
- * @param onlyValue - The --only flag value (for the error message)
30
- * @param validPhaseNames - Human-readable list of valid phase names (for error message)
31
- * @returns Initialized phase context
32
- * @throws Error if phases list is empty
191
+ * Both terminal arms go through `writeYamlOutput` deliberately. A `--only`
192
+ * failure used to be an uncaught throw, so the one output a scripted caller
193
+ * parses — the YAML document on stdout — was never written at all.
33
194
  */
34
- export declare function createPhaseContext(debugFlag: boolean | undefined, phases: Phase[], onlyValue: string | undefined, validPhaseNames: string): PhaseContext;
195
+ export declare function applyPhaseSelection(selection: PhaseSelection, logger: ReturnType<typeof createLogger>, startTime: number): Phase[];
196
+ /** The worse of two phase statuses, per {@link PHASE_STATUS_ORDER}. */
197
+ export declare function worseOf(a: PhaseStatus, b: PhaseStatus): PhaseStatus;
198
+ /**
199
+ * Map a spawn outcome to a phase outcome. The pure core of {@link runPhase}.
200
+ *
201
+ * Every branch that is NOT "the child ran and told us what it found" is a
202
+ * system error, because the orchestrator learned nothing about the artifact:
203
+ *
204
+ * | spawn outcome | phase status | why |
205
+ * |--------------------------|----------------|--------------------------------------------|
206
+ * | `error` set | `system-error` | the child never ran |
207
+ * | killed by a signal | `system-error` | the child was cut off mid-answer |
208
+ * | no exit code, no signal | `system-error` | there is no answer to read |
209
+ * | stdout not parseable | `system-error` | the child's answer cannot be read |
210
+ * | exit 0 | `success` | ran, found nothing actionable |
211
+ * | exit 1 | `error` | ran, found validation errors |
212
+ * | exit 2 (or any other) | `system-error` | the child itself reported a system error |
213
+ *
214
+ * The exit code is then reconciled with the child's OWN reported `status`,
215
+ * worst-wins. An exit code has three values and cannot express `warning`, so
216
+ * `vat skills validate` — which exits 0 while reporting `status: warning` —
217
+ * was being recorded as `success` by every orchestrator, including the one
218
+ * VAT's CI dogfoods on VAT itself.
219
+ */
220
+ export declare function phaseResultFromSpawn(name: string, outcome: PhaseSpawnOutcome): PhaseResult;
35
221
  /**
36
222
  * Run a single phase by spawning the vat binary with the phase args.
223
+ *
224
+ * stdout is CAPTURED, not inherited: the child's YAML document belongs in this
225
+ * phase's `report`, and letting it stream onto the parent's stdout is what made
226
+ * `vat validate`'s output a run of documents with no `---` between them.
227
+ * stderr stays inherited — progress output is on stderr by design and must keep
228
+ * streaming live rather than arriving in one lump at the end.
37
229
  */
38
230
  export declare function runPhase(binPath: string, phase: Phase): PhaseResult;
231
+ /**
232
+ * Worst-wins aggregate across phases. `system-error` outranks `error`: "we could
233
+ * not determine the answer" must never be filed under "we determined it is bad".
234
+ */
235
+ export declare function aggregatePhaseStatus(results: readonly PhaseResult[]): PhaseStatus;
236
+ /**
237
+ * One phase's per-severity distribution, wherever that phase keeps it.
238
+ *
239
+ * An in-process phase holds its own findings and publishes {@link
240
+ * PhaseResult.issueCounts}. A subprocess phase deliberately does not — the child
241
+ * owns its findings, and its document rides verbatim in {@link
242
+ * PhaseResult.report}. Reading only the former is why an orchestrator's header
243
+ * could report `{0, 0, 0}` over children that had just reported 12 warnings.
244
+ *
245
+ * Absent or malformed counts read as zero rather than throwing: a phase that
246
+ * published no distribution contributes nothing to the total, which is the same
247
+ * answer as before this function existed — just no longer the answer for phases
248
+ * that DID publish one.
249
+ */
250
+ export declare function phaseIssueCounts(result: PhaseResult): SeverityCounts;
251
+ /**
252
+ * Sum every phase's distribution, so an orchestrator's header total reconciles
253
+ * against the phases printed beneath it.
254
+ *
255
+ * The companion to {@link aggregatePhaseStatus}: status has always been
256
+ * worst-wins ACROSS phases, and a header whose `status` can see the children
257
+ * while its `issueCounts` cannot is the same contradiction in one document —
258
+ * `status: warning` beside `warnings: 0`.
259
+ */
260
+ export declare function aggregatePhaseIssueCounts(results: readonly PhaseResult[]): SeverityCounts;
261
+ /**
262
+ * The process exit code for a set of phase outcomes, per the exit-code contract
263
+ * every orchestrator's help text documents: 0 pass, 1 validation failure,
264
+ * 2 system error. Warnings do not fail a run — they are published in the status
265
+ * and counts instead.
266
+ */
267
+ export declare function exitCodeForPhases(results: readonly PhaseResult[]): 0 | 1 | 2;
39
268
  //# sourceMappingURL=phase-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"phase-utils.d.ts","sourceRoot":"","sources":["../../src/commands/phase-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAKvC;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,OAAO,GAAG,SAAS,EAC9B,MAAM,EAAE,KAAK,EAAE,EACf,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,eAAe,EAAE,MAAM,GACtB,YAAY,CASd;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,WAAW,CAKnE"}
1
+ {"version":3,"file":"phase-utils.d.ts","sourceRoot":"","sources":["../../src/commands/phase-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,KA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