@vibe-agent-toolkit/cli 0.2.0-rc.6 → 0.2.0-rc.7

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 (194) hide show
  1. package/README.md +4 -4
  2. package/dist/bin.js +41 -158
  3. package/dist/bin.js.map +1 -1
  4. package/dist/command-loaders.d.ts +2 -2
  5. package/dist/command-loaders.d.ts.map +1 -1
  6. package/dist/command-loaders.js +4 -2
  7. package/dist/command-loaders.js.map +1 -1
  8. package/dist/commands/ard/emit.d.ts +104 -0
  9. package/dist/commands/ard/emit.d.ts.map +1 -0
  10. package/dist/commands/ard/emit.js +223 -0
  11. package/dist/commands/ard/emit.js.map +1 -0
  12. package/dist/commands/ard/index.d.ts +12 -0
  13. package/dist/commands/ard/index.d.ts.map +1 -0
  14. package/dist/commands/ard/index.js +79 -0
  15. package/dist/commands/ard/index.js.map +1 -0
  16. package/dist/commands/ard/surfaces.d.ts +56 -0
  17. package/dist/commands/ard/surfaces.d.ts.map +1 -0
  18. package/dist/commands/ard/surfaces.js +150 -0
  19. package/dist/commands/ard/surfaces.js.map +1 -0
  20. package/dist/commands/audit.d.ts +75 -8
  21. package/dist/commands/audit.d.ts.map +1 -1
  22. package/dist/commands/audit.js +605 -140
  23. package/dist/commands/audit.js.map +1 -1
  24. package/dist/commands/claude/budget.d.ts +13 -0
  25. package/dist/commands/claude/budget.d.ts.map +1 -1
  26. package/dist/commands/claude/budget.js +80 -28
  27. package/dist/commands/claude/budget.js.map +1 -1
  28. package/dist/commands/claude/context.js +1 -1
  29. package/dist/commands/claude/context.js.map +1 -1
  30. package/dist/commands/claude/marketplace/validate.d.ts +55 -22
  31. package/dist/commands/claude/marketplace/validate.d.ts.map +1 -1
  32. package/dist/commands/claude/marketplace/validate.js +380 -75
  33. package/dist/commands/claude/marketplace/validate.js.map +1 -1
  34. package/dist/commands/claude/org/skills.d.ts +84 -3
  35. package/dist/commands/claude/org/skills.d.ts.map +1 -1
  36. package/dist/commands/claude/org/skills.js +218 -46
  37. package/dist/commands/claude/org/skills.js.map +1 -1
  38. package/dist/commands/claude/plugin/build.d.ts +8 -0
  39. package/dist/commands/claude/plugin/build.d.ts.map +1 -1
  40. package/dist/commands/claude/plugin/build.js +16 -2
  41. package/dist/commands/claude/plugin/build.js.map +1 -1
  42. package/dist/commands/claude/plugin/tree-copy.d.ts +72 -0
  43. package/dist/commands/claude/plugin/tree-copy.d.ts.map +1 -1
  44. package/dist/commands/claude/plugin/tree-copy.js +215 -10
  45. package/dist/commands/claude/plugin/tree-copy.js.map +1 -1
  46. package/dist/commands/corpus/index.d.ts.map +1 -1
  47. package/dist/commands/corpus/index.js +3 -0
  48. package/dist/commands/corpus/index.js.map +1 -1
  49. package/dist/commands/corpus/report.d.ts +0 -1
  50. package/dist/commands/corpus/report.d.ts.map +1 -1
  51. package/dist/commands/corpus/report.js +0 -1
  52. package/dist/commands/corpus/report.js.map +1 -1
  53. package/dist/commands/corpus/runner.d.ts +58 -1
  54. package/dist/commands/corpus/runner.d.ts.map +1 -1
  55. package/dist/commands/corpus/runner.js +90 -15
  56. package/dist/commands/corpus/runner.js.map +1 -1
  57. package/dist/commands/corpus/scan.d.ts.map +1 -1
  58. package/dist/commands/corpus/scan.js +0 -1
  59. package/dist/commands/corpus/scan.js.map +1 -1
  60. package/dist/commands/doctor.d.ts +14 -0
  61. package/dist/commands/doctor.d.ts.map +1 -1
  62. package/dist/commands/doctor.js +96 -18
  63. package/dist/commands/doctor.js.map +1 -1
  64. package/dist/commands/okf/index.d.ts +11 -0
  65. package/dist/commands/okf/index.d.ts.map +1 -0
  66. package/dist/commands/okf/index.js +102 -0
  67. package/dist/commands/okf/index.js.map +1 -0
  68. package/dist/commands/okf/validate.d.ts +82 -0
  69. package/dist/commands/okf/validate.d.ts.map +1 -0
  70. package/dist/commands/okf/validate.js +157 -0
  71. package/dist/commands/okf/validate.js.map +1 -0
  72. package/dist/commands/phase-utils.d.ts +19 -3
  73. package/dist/commands/phase-utils.d.ts.map +1 -1
  74. package/dist/commands/phase-utils.js +26 -5
  75. package/dist/commands/phase-utils.js.map +1 -1
  76. package/dist/commands/rag/index-command.d.ts +27 -2
  77. package/dist/commands/rag/index-command.d.ts.map +1 -1
  78. package/dist/commands/rag/index-command.js +44 -7
  79. package/dist/commands/rag/index-command.js.map +1 -1
  80. package/dist/commands/rag/index.d.ts.map +1 -1
  81. package/dist/commands/rag/index.js +2 -0
  82. package/dist/commands/rag/index.js.map +1 -1
  83. package/dist/commands/resources/check-progress.d.ts +3 -0
  84. package/dist/commands/resources/check-progress.d.ts.map +1 -1
  85. package/dist/commands/resources/check-progress.js +6 -0
  86. package/dist/commands/resources/check-progress.js.map +1 -1
  87. package/dist/commands/resources/check.d.ts +33 -4
  88. package/dist/commands/resources/check.d.ts.map +1 -1
  89. package/dist/commands/resources/check.js +131 -44
  90. package/dist/commands/resources/check.js.map +1 -1
  91. package/dist/commands/resources/index.d.ts.map +1 -1
  92. package/dist/commands/resources/index.js +41 -9
  93. package/dist/commands/resources/index.js.map +1 -1
  94. package/dist/commands/resources/query.d.ts +18 -1
  95. package/dist/commands/resources/query.d.ts.map +1 -1
  96. package/dist/commands/resources/query.js +29 -4
  97. package/dist/commands/resources/query.js.map +1 -1
  98. package/dist/commands/resources/validate.d.ts +29 -0
  99. package/dist/commands/resources/validate.d.ts.map +1 -1
  100. package/dist/commands/resources/validate.js +116 -13
  101. package/dist/commands/resources/validate.js.map +1 -1
  102. package/dist/commands/skill/review.d.ts.map +1 -1
  103. package/dist/commands/skill/review.js +9 -2
  104. package/dist/commands/skill/review.js.map +1 -1
  105. package/dist/commands/skill/test/run.d.ts.map +1 -1
  106. package/dist/commands/skill/test/run.js +21 -6
  107. package/dist/commands/skill/test/run.js.map +1 -1
  108. package/dist/commands/skills/build.d.ts.map +1 -1
  109. package/dist/commands/skills/build.js +16 -3
  110. package/dist/commands/skills/build.js.map +1 -1
  111. package/dist/commands/skills/list.d.ts +2 -1
  112. package/dist/commands/skills/list.d.ts.map +1 -1
  113. package/dist/commands/skills/list.js +31 -9
  114. package/dist/commands/skills/list.js.map +1 -1
  115. package/dist/commands/skills/skill-discovery.d.ts +40 -1
  116. package/dist/commands/skills/skill-discovery.d.ts.map +1 -1
  117. package/dist/commands/skills/skill-discovery.js +32 -3
  118. package/dist/commands/skills/skill-discovery.js.map +1 -1
  119. package/dist/commands/skills/validate-command.d.ts.map +1 -1
  120. package/dist/commands/skills/validate-command.js +11 -3
  121. package/dist/commands/skills/validate-command.js.map +1 -1
  122. package/dist/commands/skills/validate.d.ts +66 -7
  123. package/dist/commands/skills/validate.d.ts.map +1 -1
  124. package/dist/commands/skills/validate.js +133 -29
  125. package/dist/commands/skills/validate.js.map +1 -1
  126. package/dist/commands/verify.d.ts +94 -3
  127. package/dist/commands/verify.d.ts.map +1 -1
  128. package/dist/commands/verify.js +192 -45
  129. package/dist/commands/verify.js.map +1 -1
  130. package/dist/skill-resolution/packaging-config.d.ts +49 -5
  131. package/dist/skill-resolution/packaging-config.d.ts.map +1 -1
  132. package/dist/skill-resolution/packaging-config.js +59 -19
  133. package/dist/skill-resolution/packaging-config.js.map +1 -1
  134. package/dist/skill-resolution/resolve-skill-reference.d.ts.map +1 -1
  135. package/dist/skill-resolution/resolve-skill-reference.js +6 -3
  136. package/dist/skill-resolution/resolve-skill-reference.js.map +1 -1
  137. package/dist/utils/command-error.d.ts +31 -0
  138. package/dist/utils/command-error.d.ts.map +1 -1
  139. package/dist/utils/command-error.js +45 -0
  140. package/dist/utils/command-error.js.map +1 -1
  141. package/dist/utils/edge-lens-evaluation.d.ts +83 -0
  142. package/dist/utils/edge-lens-evaluation.d.ts.map +1 -0
  143. package/dist/utils/edge-lens-evaluation.js +110 -0
  144. package/dist/utils/edge-lens-evaluation.js.map +1 -0
  145. package/dist/utils/optional-backend.d.ts +5 -4
  146. package/dist/utils/optional-backend.d.ts.map +1 -1
  147. package/dist/utils/optional-backend.js +5 -4
  148. package/dist/utils/optional-backend.js.map +1 -1
  149. package/dist/utils/project-root-policy.d.ts +20 -0
  150. package/dist/utils/project-root-policy.d.ts.map +1 -1
  151. package/dist/utils/project-root-policy.js +32 -0
  152. package/dist/utils/project-root-policy.js.map +1 -1
  153. package/dist/utils/projection-query.d.ts +41 -4
  154. package/dist/utils/projection-query.d.ts.map +1 -1
  155. package/dist/utils/projection-query.js +44 -10
  156. package/dist/utils/projection-query.js.map +1 -1
  157. package/dist/utils/projection-store.d.ts +41 -15
  158. package/dist/utils/projection-store.d.ts.map +1 -1
  159. package/dist/utils/projection-store.js +65 -18
  160. package/dist/utils/projection-store.js.map +1 -1
  161. package/dist/utils/repeatable-option.d.ts +37 -0
  162. package/dist/utils/repeatable-option.d.ts.map +1 -0
  163. package/dist/utils/repeatable-option.js +39 -0
  164. package/dist/utils/repeatable-option.js.map +1 -0
  165. package/dist/utils/resource-loader.d.ts +4 -3
  166. package/dist/utils/resource-loader.d.ts.map +1 -1
  167. package/dist/utils/resource-loader.js +61 -30
  168. package/dist/utils/resource-loader.js.map +1 -1
  169. package/dist/utils/root-argv.d.ts +53 -0
  170. package/dist/utils/root-argv.d.ts.map +1 -0
  171. package/dist/utils/root-argv.js +215 -0
  172. package/dist/utils/root-argv.js.map +1 -0
  173. package/dist/utils/run-integrity.d.ts +95 -0
  174. package/dist/utils/run-integrity.d.ts.map +1 -0
  175. package/dist/utils/run-integrity.js +102 -0
  176. package/dist/utils/run-integrity.js.map +1 -0
  177. package/dist/utils/sqlite-experimental-warning.d.ts +69 -0
  178. package/dist/utils/sqlite-experimental-warning.d.ts.map +1 -0
  179. package/dist/utils/sqlite-experimental-warning.js +144 -0
  180. package/dist/utils/sqlite-experimental-warning.js.map +1 -0
  181. package/dist/utils/user-context-scanner.d.ts +8 -0
  182. package/dist/utils/user-context-scanner.d.ts.map +1 -1
  183. package/dist/utils/user-context-scanner.js +4 -0
  184. package/dist/utils/user-context-scanner.js.map +1 -1
  185. package/dist/utils/validate-help-files.d.ts.map +1 -1
  186. package/dist/utils/validate-help-files.js +9 -2
  187. package/dist/utils/validate-help-files.js.map +1 -1
  188. package/docs/audit.md +120 -7
  189. package/docs/doctor.md +6 -6
  190. package/docs/index.md +1 -1
  191. package/docs/rag.md +3 -1
  192. package/docs/resources.md +5 -1
  193. package/docs/skills.md +47 -62
  194. package/package.json +18 -18
@@ -90,9 +90,10 @@ export declare const RESOURCES_CRAWL_WALK = "walk";
90
90
  *
91
91
  * ⚠️⚠️ **ONE DISAGREEMENT SURVIVES, AND IT DROPS FINDINGS: SYMLINKS.** The
92
92
  * `filesystem` extent crawls with `followSymlinks: false` and records no link's
93
- * own path, and `GitCrawlSource` skips mode `120000` deliberately to match it —
94
- * so BOTH projection extents omit a committed symlink that the incumbent walk
95
- * includes. For an out-of-tree target those bytes have no other path into the
93
+ * own path, and `GitCrawlSource` drops one at a single seam to match it (git's
94
+ * mode `120000` for the paths the tree snapshot described, an `lstat` for the
95
+ * collapsed `ls-files --others` entries that carry no mode) — so BOTH projection
96
+ * extents omit a symlink, committed or not, that the incumbent walk includes. For an out-of-tree target those bytes have no other path into the
96
97
  * population, which means **a broken symlink the walk reports as
97
98
  * `LINK_BROKEN_FILE` is not reported on this lane.** That is a real loss, it is
98
99
  * known, and it is the cost this default was accepted at; closing it is its own
@@ -1 +1 @@
1
- {"version":3,"file":"resource-loader.d.ts","sourceRoot":"","sources":["../../src/utils/resource-loader.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAIL,gBAAgB,EAEhB,KAAK,eAAe,EAEpB,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAE9B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,UAAU,EAAmB,MAAM,+BAA+B,CAAC;AAG5E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAI1C;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,YAAY,CAAC;AAEtD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MA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4BAA4B,CAAC,CAAC,EAClD,OAAO,EAAE;IACP,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IACpC,mBAAmB,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CACrE,EACD,IAAI,EAAE,CAAC,gBAAgB,EAAE,wBAAwB,GAAG,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,GAC3E,OAAO,CAAC,CAAC,CAAC,CAoBZ;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,kBAAkB,CAAC,CAwH7B"}
@@ -1,13 +1,37 @@
1
1
  /**
2
2
  * Utilities for loading and crawling resources
3
3
  */
4
- import { existsSync, statSync } from 'node:fs';
5
- import { buildResourcePopulation, DEFAULT_RESOURCE_INCLUDE, gitExtentSelected, ResourceRegistry, } from '@vibe-agent-toolkit/resources';
4
+ import { buildLinkAuthEngineConfig, buildResourcePopulation, DEFAULT_RESOURCE_INCLUDE, gitExtentSelected, ResourceRegistry, } from '@vibe-agent-toolkit/resources';
6
5
  import { safePath, toForwardSlash } from '@vibe-agent-toolkit/utils';
7
6
  import { GitTracker, gitTreeSnapshot } from '@vibe-agent-toolkit/utils/git';
8
7
  import { loadConfig } from './config-loader.js';
9
8
  import { collectionsOption } from './population-wiring.js';
9
+ import { assertDirectoryArgument } from './project-root-policy.js';
10
10
  import { withPopulationCache } from './projection-store.js';
11
+ /**
12
+ * Refuse a `resources.linkAuth` provider that cannot compile HERE, where the
13
+ * config is loaded, so every verb that loads it answers the same way.
14
+ *
15
+ * `buildLinkAuthEngineConfig` is the one place the per-provider compile check
16
+ * (`assertProviderCompiles`) lives, and the registry calls it only when it
17
+ * constructs the external-link validator — i.e. under `--check-external-urls`.
18
+ * Every other verb on this loader (`vat validate`, `vat resources validate`
19
+ * without the flag, `vat resources scan`, `vat rag index`) accepted an
20
+ * uncompilable `when` and exited 0, while the validation-code registry
21
+ * promised the refusal "at config load … and every other command that loads
22
+ * `resources.linkAuth`". The registry was right about what the contract should
23
+ * be; this makes the code keep it. The built config is discarded — the
24
+ * registry builds its own when the lane runs — because the value wanted is
25
+ * the throw, and calling the same function is how the two stay one check.
26
+ *
27
+ * @throws {LinkAuthConfigError} naming `providers[<n>]`, the host and the field;
28
+ * every caller's catch turns a thrown error into exit 2.
29
+ */
30
+ function assertLinkAuthProvidersCompile(config) {
31
+ const linkAuth = config.resources?.linkAuth;
32
+ if (linkAuth !== undefined)
33
+ buildLinkAuthEngineConfig(linkAuth);
34
+ }
11
35
  /**
12
36
  * Scope resource include patterns to a subdirectory of the crawl base.
13
37
  *
@@ -50,15 +74,29 @@ function crawlOptionsForPath(pathArg, projectRoot, config, logger) {
50
74
  // them silently — silent dropping is the bug this function exists to fix.
51
75
  logger.warn(`${resolved} is outside projectRoot ${projectRoot}; ` +
52
76
  `resources include/exclude patterns from the config do not apply to it`);
53
- return { baseDir: resolved };
77
+ return { baseDir: resolved, unreadable: RESOURCES_UNREADABLE };
54
78
  }
55
- assertCrawlableDirectory(resolved);
79
+ // The crawler used to perform this check itself, because it received the path
80
+ // argument as its `baseDir`. Now that `baseDir` is the project root, a bad path
81
+ // argument would otherwise degrade into a glob that matches nothing — a green
82
+ // run reporting `filesScanned: 0`.
83
+ assertDirectoryArgument(resolved);
56
84
  return {
57
85
  baseDir: projectRoot,
86
+ unreadable: RESOURCES_UNREADABLE,
58
87
  include: scopeIncludeToSubtree(DEFAULT_RESOURCE_INCLUDE, normalizedRelDir),
59
88
  ...(config?.resources?.exclude ? { exclude: config.resources.exclude } : {}),
60
89
  };
61
90
  }
91
+ /**
92
+ * The resources verbs' ruling for a directory the crawl cannot list: refuse
93
+ * the run by name, exit 2 — `vat resources validate`/`scan`/`check` and every
94
+ * verb that reaches this loader act on the registry as the whole population,
95
+ * and the projection lane behind `populationSource` refuses the same directory
96
+ * with the same sentence, so the two lanes cannot reach different exits.
97
+ * See `RegistryUnreadablePolicy` on the registry.
98
+ */
99
+ const RESOURCES_UNREADABLE = 'refuse';
62
100
  /**
63
101
  * The env var that selects the crawler behind every resources-crawling verb —
64
102
  * `vat resources scan`/`validate`, `vat rag index`, the pipeline oracles, and
@@ -94,9 +132,10 @@ export const RESOURCES_CRAWL_WALK = 'walk';
94
132
  *
95
133
  * ⚠️⚠️ **ONE DISAGREEMENT SURVIVES, AND IT DROPS FINDINGS: SYMLINKS.** The
96
134
  * `filesystem` extent crawls with `followSymlinks: false` and records no link's
97
- * own path, and `GitCrawlSource` skips mode `120000` deliberately to match it —
98
- * so BOTH projection extents omit a committed symlink that the incumbent walk
99
- * includes. For an out-of-tree target those bytes have no other path into the
135
+ * own path, and `GitCrawlSource` drops one at a single seam to match it (git's
136
+ * mode `120000` for the paths the tree snapshot described, an `lstat` for the
137
+ * collapsed `ls-files --others` entries that carry no mode) — so BOTH projection
138
+ * extents omit a symlink, committed or not, that the incumbent walk includes. For an out-of-tree target those bytes have no other path into the
100
139
  * population, which means **a broken symlink the walk reports as
101
140
  * `LINK_BROKEN_FILE` is not reported on this lane.** That is a real loss, it is
102
141
  * known, and it is the cost this default was accepted at; closing it is its own
@@ -171,7 +210,7 @@ function populationSourceFor(root, gitTracker, observeExtentSource, cache) {
171
210
  ...collectionsOption(enumeratedRoot),
172
211
  });
173
212
  observeExtentSource(population.extentSource);
174
- return population.paths;
213
+ return { paths: population.paths, conditions: population.conditions };
175
214
  },
176
215
  };
177
216
  }
@@ -230,24 +269,6 @@ export async function withResourcePopulationSource(options, work) {
230
269
  return work(populationSourceFor(options.root, gitTracker, options.observeExtentSource ?? (() => undefined), cache));
231
270
  });
232
271
  }
233
- /**
234
- * Fail loudly on a path argument that cannot be crawled.
235
- *
236
- * The crawler used to perform this check itself, because it received the path
237
- * argument as its `baseDir`. Now that `baseDir` is the project root, a bad path
238
- * argument would otherwise degrade into a glob that matches nothing — a green
239
- * run reporting `filesScanned: 0`.
240
- */
241
- function assertCrawlableDirectory(resolved) {
242
- // eslint-disable-next-line security/detect-non-literal-fs-filename -- CLI path argument, resolved above
243
- if (!existsSync(resolved)) {
244
- throw new Error(`Path does not exist: ${resolved}`);
245
- }
246
- // eslint-disable-next-line security/detect-non-literal-fs-filename -- CLI path argument, existence checked above
247
- if (!statSync(resolved).isDirectory()) {
248
- throw new Error(`Path is not a directory: ${resolved}`);
249
- }
250
- }
251
272
  /**
252
273
  * Load resources from a path with config support
253
274
  *
@@ -281,20 +302,29 @@ export async function loadResourcesWithConfig(pathArg, projectRoot, logger) {
281
302
  const config = loadConfig(projectRoot);
282
303
  if (config) {
283
304
  logger.debug(`Loaded config from ${projectRoot}`);
305
+ assertLinkAuthProvidersCompile(config);
284
306
  }
285
307
  // Built here, but deliberately NOT initialized here — see the call inside the
286
308
  // population-cache bracket below. The registry only reads the tracker during
287
309
  // `crawl`, which happens inside that bracket, so nothing observes it empty.
288
310
  const gitTracker = new GitTracker(projectRoot);
289
311
  // Create registry and crawl
290
- // Build options conditionally to satisfy exactOptionalPropertyTypes
312
+ // Build options conditionally to satisfy exactOptionalPropertyTypes.
313
+ //
314
+ // 🚨 The config is handed over WHENEVER one was loaded — never gated on one of
315
+ // its keys. This used to read `if (config?.resources?.collections)`, written
316
+ // when collections were the only thing the registry read from it. The registry
317
+ // has since grown a second consumer, `resources.linkAuth`, and the gate made
318
+ // it silently inert for every adopter who declared `linkAuth` without
319
+ // `collections`: no rewrite, no token, no `LINK_AUTH_*` code — the anonymous
320
+ // lane ran and the run reported success. Every read inside the registry is
321
+ // already `this.config?.resources?.<key>`-guarded, so an undeclared key costs
322
+ // nothing; a key-gate here can only ever hide the next consumer the same way.
291
323
  const registryOptions = {
292
324
  baseDir: projectRoot,
293
325
  gitTracker,
326
+ ...(config === undefined ? {} : { config }),
294
327
  };
295
- if (config?.resources?.collections) {
296
- registryOptions.config = config;
297
- }
298
328
  const registry = new ResourceRegistry(registryOptions);
299
329
  let crawlOptions;
300
330
  if (pathArg) {
@@ -309,6 +339,7 @@ export async function loadResourcesWithConfig(pathArg, projectRoot, logger) {
309
339
  logger.debug(`No path argument, using: ${projectRoot}`);
310
340
  crawlOptions = {
311
341
  baseDir: projectRoot,
342
+ unreadable: RESOURCES_UNREADABLE,
312
343
  // Apply include patterns from config (if specified)
313
344
  ...(config?.resources?.include ? { include: config.resources.include } : {}),
314
345
  // Apply exclude patterns from config (if specified)
@@ -1 +1 @@
1
- {"version":3,"file":"resource-loader.js","sourceRoot":"","sources":["../../src/utils/resource-loader.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,iBAAiB,EACjB,gBAAgB,GAOjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAE5E,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AA2C5D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAA0B,EAAE,MAAc;IAC9E,IAAI,MAAM,KAAK,EAAE,EAAE,CAAC;QAClB,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,MAAM,IAAI,OAAO,EAAE,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAS,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;YACN,2EAA2E;YAC3E,uEAAuE;YACvE,2EAA2E;YAC3E,uBAAuB;YACvB,MAAM,CAAC,KAAK,CAAC,uCAAuC,mBAAmB,SAAS,CAAC,CAAC;QACpF,CAAC;QAED,MAAM,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QACnC,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,QAAQ,EAAE,OAAO,IAAI,WAAW;QAChC,WAAW;QACX,MAAM;QACN,QAAQ;QACR,UAAU;QACV,IAAI;QACJ,YAAY;KACb,CAAC;AACJ,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * The argv grammar `bin.ts` needs BEFORE commander parses anything.
3
+ *
4
+ * Two decisions have to be made from raw argv: which command module to load
5
+ * (only one is, so `vat --version` does not pay for the whole CLI surface), and
6
+ * whether this invocation is one of the four `--verbose` help pages commander
7
+ * cannot render itself. Both must model commander's grammar rather than
8
+ * pattern-match the line, and getting that wrong is silent by construction —
9
+ * every failure mode below ended in a wrong page at exit 0.
10
+ *
11
+ * It lives here and not in `bin.ts` because `bin.ts` is the executable:
12
+ * importing it PARSES ARGV AND RUNS A COMMAND, so nothing there can be unit
13
+ * tested. Same reason `command-loaders.ts` is its own module.
14
+ */
15
+ import type { Option } from 'commander';
16
+ /** The argv questions `bin.ts` asks, bound to what the root program declares. */
17
+ export interface RootArgvGrammar {
18
+ /**
19
+ * The command the user actually asked for, or `undefined` when the whole tree
20
+ * is needed (or nothing is).
21
+ */
22
+ requestedCommand(argv: readonly string[]): string | undefined;
23
+ /** Whether this is `vat <group> --verbose` for the named command group. */
24
+ wantsGroupVerboseHelp(argv: readonly string[], group: string): boolean;
25
+ /** Whether this is a bare `vat --help --verbose`. */
26
+ wantsRootVerboseHelp(argv: readonly string[]): boolean;
27
+ }
28
+ /**
29
+ * Build the grammar from the root program's OWN option declarations.
30
+ *
31
+ * Read off commander's declarations rather than hardcoded, because the blast
32
+ * radius grows with every future root option. Today that is `--version`,
33
+ * `--cwd <dir>`, `--debug` and `--no-cache`; only `--cwd` takes a value.
34
+ *
35
+ * ⚠️ ORDERING MATTERS at the call site: this must be built AFTER
36
+ * `registerCacheControl(program)`, which is what puts `--no-cache` into
37
+ * `program.options`. Built before that call, `--no-cache` would read as
38
+ * unknown and every `vat --no-cache <verb>` would silently give up the lazy
39
+ * load and register the whole tree — a quiet perf regression with no failing
40
+ * test to announce it.
41
+ *
42
+ * Note what is deliberately NOT synthesised here: a `--no-x` twin for boolean
43
+ * options, and a positive `--cache` twin for `--no-cache`. Commander matches an
44
+ * option by exact string (`Option.is()` is `short === arg || long === arg`), so
45
+ * `--no-debug` and `--cache` are UNKNOWN options that end the parse in an
46
+ * error. Accepting them here would re-create the very bug this scan exists to
47
+ * avoid: a token commander rejects, treated by us as an ordinary flag to skip.
48
+ *
49
+ * @param rootOptions - `program.options`, after every root option is registered
50
+ * @returns The grammar, closed over what those options declare
51
+ */
52
+ export declare function createRootArgvGrammar(rootOptions: readonly Option[]): RootArgvGrammar;
53
+ //# sourceMappingURL=root-argv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root-argv.d.ts","sourceRoot":"","sources":["../../src/utils/root-argv.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AASxC,iFAAiF;AACjF,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,gBAAgB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAAC;IAC9D,2EAA2E;IAC3E,qBAAqB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IACvE,qDAAqD;IACrD,oBAAoB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC;CACxD;AAOD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,eAAe,CAyKrF"}
@@ -0,0 +1,215 @@
1
+ /**
2
+ * The argv grammar `bin.ts` needs BEFORE commander parses anything.
3
+ *
4
+ * Two decisions have to be made from raw argv: which command module to load
5
+ * (only one is, so `vat --version` does not pay for the whole CLI surface), and
6
+ * whether this invocation is one of the four `--verbose` help pages commander
7
+ * cannot render itself. Both must model commander's grammar rather than
8
+ * pattern-match the line, and getting that wrong is silent by construction —
9
+ * every failure mode below ended in a wrong page at exit 0.
10
+ *
11
+ * It lives here and not in `bin.ts` because `bin.ts` is the executable:
12
+ * importing it PARSES ARGV AND RUNS A COMMAND, so nothing there can be unit
13
+ * tested. Same reason `command-loaders.ts` is its own module.
14
+ */
15
+ /** How many argv slots a step occupies: a `pair` takes its value with it. */
16
+ function widthOf(step) {
17
+ return step === 'pair' ? 2 : 1;
18
+ }
19
+ /**
20
+ * Build the grammar from the root program's OWN option declarations.
21
+ *
22
+ * Read off commander's declarations rather than hardcoded, because the blast
23
+ * radius grows with every future root option. Today that is `--version`,
24
+ * `--cwd <dir>`, `--debug` and `--no-cache`; only `--cwd` takes a value.
25
+ *
26
+ * ⚠️ ORDERING MATTERS at the call site: this must be built AFTER
27
+ * `registerCacheControl(program)`, which is what puts `--no-cache` into
28
+ * `program.options`. Built before that call, `--no-cache` would read as
29
+ * unknown and every `vat --no-cache <verb>` would silently give up the lazy
30
+ * load and register the whole tree — a quiet perf regression with no failing
31
+ * test to announce it.
32
+ *
33
+ * Note what is deliberately NOT synthesised here: a `--no-x` twin for boolean
34
+ * options, and a positive `--cache` twin for `--no-cache`. Commander matches an
35
+ * option by exact string (`Option.is()` is `short === arg || long === arg`), so
36
+ * `--no-debug` and `--cache` are UNKNOWN options that end the parse in an
37
+ * error. Accepting them here would re-create the very bug this scan exists to
38
+ * avoid: a token commander rejects, treated by us as an ordinary flag to skip.
39
+ *
40
+ * @param rootOptions - `program.options`, after every root option is registered
41
+ * @returns The grammar, closed over what those options declare
42
+ */
43
+ export function createRootArgvGrammar(rootOptions) {
44
+ const declaredRootFlags = new Set(['-h', '--help']);
45
+ const valueTakingRootFlags = new Set();
46
+ const declareRootFlag = (flag, takesValue) => {
47
+ if (!flag)
48
+ return;
49
+ declaredRootFlags.add(flag);
50
+ if (takesValue)
51
+ valueTakingRootFlags.add(flag);
52
+ };
53
+ for (const option of rootOptions) {
54
+ const takesValue = Boolean(option.required || option.optional);
55
+ declareRootFlag(option.short, takesValue);
56
+ declareRootFlag(option.long, takesValue);
57
+ }
58
+ /**
59
+ * Classify an option-shaped token against what this program declares.
60
+ *
61
+ * The `--flag=value` case is not just "strip the suffix": commander only
62
+ * accepts the inline form for a VALUE-TAKING option — its `--foo=bar` branch
63
+ * requires `option.required || option.optional` — so `--debug=1` is an unknown
64
+ * option even though `--debug` is declared.
65
+ *
66
+ * Anything unrecognised is reported as `unknown` rather than guessed at.
67
+ * The cost of being wrong is asymmetric: a false `unknown` only forfeits
68
+ * the lazy-load saving, while a false "declared" ships a wrong help page at
69
+ * exit 0.
70
+ */
71
+ function classifyOptionToken(arg) {
72
+ const equalsIndex = arg.indexOf('=');
73
+ if (equalsIndex !== -1) {
74
+ return valueTakingRootFlags.has(arg.slice(0, equalsIndex)) ? 'flag' : 'unknown';
75
+ }
76
+ if (!declaredRootFlags.has(arg))
77
+ return 'unknown';
78
+ return valueTakingRootFlags.has(arg) ? 'pair' : 'flag';
79
+ }
80
+ /**
81
+ * How the scan steps over one token: an operand, or one of the option kinds.
82
+ *
83
+ * A lone `-` is an OPERAND — commander's `maybeOption` requires
84
+ * `arg.length > 1` — and so is anything not option-shaped. Shared by both
85
+ * scans below so the grammar cannot be modelled on one side of the command
86
+ * name and pattern-matched on the other, which is how `wantsGroupVerboseHelp`
87
+ * shipped.
88
+ */
89
+ function stepOver(arg) {
90
+ return arg.length > 1 && arg.startsWith('-') ? classifyOptionToken(arg) : 'operand';
91
+ }
92
+ /**
93
+ * Where in argv commander will read the command name, or `undefined` when it
94
+ * will not read one.
95
+ *
96
+ * This must model commander's grammar, not just "the first token without a
97
+ * dash". Ways a naive scan got it wrong, all shipped and all verified:
98
+ *
99
+ * - **An option's VALUE is not a verb.** `--cwd <dir>` takes a value that does
100
+ * not start with `-`, so `vat --cwd skills validate` picked `skills`,
101
+ * registered only that, and left `validate` unregistered — while
102
+ * `vat --cwd skills validate --help` printed ROOT help and exited **0**.
103
+ * Only the space-separated form was affected; `--cwd=skills` carries its
104
+ * value inline. The advertised `vat --cwd <dir> build` also lost the entire
105
+ * startup saving, since a non-colliding directory matched no loader key and
106
+ * fell through to loading everything.
107
+ * - **`--help` BEFORE the verb renders ROOT help**, which has to list every
108
+ * command. Loading only the named one made `vat --help audit` print a help
109
+ * page claiming the CLI has exactly one command, and exit 0. `vat audit
110
+ * --help` is the other order and returns on the verb before reaching the
111
+ * flag, so it still loads just `audit`.
112
+ * - **An UNDECLARED option is not a flag to skip over.** `--help` is only the
113
+ * most visible member of that class — it is not in `program.options` either,
114
+ * which is exactly why the bail-out above works. Commander's `parseOptions`
115
+ * switches its destination to `unknown` at the FIRST unrecognised
116
+ * option-shaped token and never switches back, so the verb after it never
117
+ * reaches `operands`; the run ends in `unknownOption()` +
118
+ * `showHelpAfterError()`, i.e. ROOT help. `vat --verbose audit` therefore
119
+ * printed an error page listing exactly one command. Every undeclared option
120
+ * gets the `--help` treatment for that reason.
121
+ * - **A lone `-` is an OPERAND, not an option.** Commander's `maybeOption`
122
+ * requires `arg.length > 1`, so `-` lands in `operands` and reaches the
123
+ * `command:*` handler as an unknown command — which again renders root help.
124
+ * Returning its index hands `-` to the dispatcher, where it matches no
125
+ * loader key and the whole tree loads.
126
+ *
127
+ * `--` is option-shaped by the length test but declared by nobody, so it takes
128
+ * the undeclared bail-out. That is the right answer: commander treats every
129
+ * token after it as an operand, and loading the whole tree is always
130
+ * behaviourally correct — the scan only ever trades away startup time.
131
+ */
132
+ function commandIndex(argv) {
133
+ let index = 0;
134
+ while (index < argv.length) {
135
+ const arg = argv[index] ?? '';
136
+ if (arg === '--help' || arg === '-h')
137
+ return undefined;
138
+ const step = stepOver(arg);
139
+ if (step === 'operand')
140
+ return index;
141
+ if (step === 'unknown')
142
+ return undefined;
143
+ index += widthOf(step);
144
+ }
145
+ return undefined;
146
+ }
147
+ return {
148
+ requestedCommand(argv) {
149
+ const index = commandIndex(argv);
150
+ return index === undefined ? undefined : argv[index];
151
+ },
152
+ /**
153
+ * Whether this is `vat <group> --verbose`, asked by POSITION.
154
+ *
155
+ * 🪤 The three shipped checks asked `process.argv.includes('<group>')
156
+ * && process.argv.includes('--verbose')`, which matches the word anywhere
157
+ * on the line — as another command's subcommand, as a path, as a value:
158
+ *
159
+ * vat inventory resources --verbose → printed RESOURCES' verbose help, exit 0
160
+ * vat resources scan rag --verbose → printed RAG's verbose help, exit 0
161
+ *
162
+ * Neither ran what the user typed and neither said so; the second exited 0
163
+ * having enumerated nothing at all, on a line whose only sin was naming a
164
+ * directory `rag`. So the group has to be the token commander itself would
165
+ * read as the command name — the same question the lazy loader asks — and
166
+ * `--verbose` has to follow it with no subcommand in between.
167
+ *
168
+ * 🪤 "No subcommand in between" is the SAME grammar as `commandIndex`, applied
169
+ * to the tokens after the group. Commander accepts a root option on either
170
+ * side of the command name, so `--cwd`'s value is no more a subcommand after
171
+ * the group than before it — but this branch read `after.some(!startsWith('-'))`,
172
+ * which is the naive scan the rest of this module replaced, and
173
+ * `vat resources --verbose --cwd docs` died on `unknown option '--verbose'`
174
+ * while `vat --cwd docs resources --verbose` printed the page. An undeclared
175
+ * option after the group is likewise commander's to refuse, not ours to skip:
176
+ * `vat resources --verbose --nonsense` printed the page at exit 0 with the
177
+ * typo silently dropped.
178
+ */
179
+ wantsGroupVerboseHelp(argv, group) {
180
+ const index = commandIndex(argv);
181
+ if (index === undefined || argv[index] !== group)
182
+ return false;
183
+ let verbose = false;
184
+ let cursor = index + 1;
185
+ while (cursor < argv.length) {
186
+ const arg = argv[cursor] ?? '';
187
+ if (arg === '--verbose') {
188
+ verbose = true;
189
+ cursor += 1;
190
+ continue;
191
+ }
192
+ // A subcommand of its own is commander's to run, and so is an option
193
+ // nobody declared; only the bare group has no page but the hand-written one.
194
+ const step = stepOver(arg);
195
+ if (step === 'operand' || step === 'unknown')
196
+ return false;
197
+ cursor += widthOf(step);
198
+ }
199
+ return verbose;
200
+ },
201
+ /**
202
+ * Whether this is a bare `vat --help --verbose`.
203
+ *
204
+ * "Bare" is decided the same way, and for the same reason: the shipped
205
+ * check treated any token without a leading dash as a subcommand, so
206
+ * `vat --cwd docs --help --verbose` read `docs` as the command and silently
207
+ * rendered the NON-verbose root page instead.
208
+ */
209
+ wantsRootVerboseHelp(argv) {
210
+ const hasHelp = argv.includes('--help') || argv.includes('-h');
211
+ return hasHelp && argv.includes('--verbose') && commandIndex(argv) === undefined;
212
+ },
213
+ };
214
+ }
215
+ //# sourceMappingURL=root-argv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root-argv.js","sourceRoot":"","sources":["../../src/utils/root-argv.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAwBH,6EAA6E;AAC7E,SAAS,OAAO,CAAC,IAAqB;IACpC,OAAO,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACjC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,qBAAqB,CAAC,WAA8B;IAClE,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC5D,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/C,MAAM,eAAe,GAAG,CAAC,IAAwB,EAAE,UAAmB,EAAQ,EAAE;QAC9E,IAAI,CAAC,IAAI;YAAE,OAAO;QAClB,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC5B,IAAI,UAAU;YA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qE;gBACrE,6EAA6E;gBAC7E,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;gBAC3B,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS;oBAAE,OAAO,KAAK,CAAC;gBAC3D,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;YAC1B,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;QAED;;;;;;;WAOG;QACH,oBAAoB,CAAC,IAAI;YACvB,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC/D,OAAO,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC;QACnF,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * The run-integrity refusal: ONE mechanism for every gate that must never
3
+ * answer `success` after checking nothing.
4
+ *
5
+ * ## The class this closes
6
+ *
7
+ * A gate that checked nothing produces the same document as a gate that was
8
+ * removed. `vat resources check` shipped it (no `checks:` block → `status:
9
+ * success`, exit 0), then `vat claude budget` (a path matching no working
10
+ * location), then the repo's own audit quality gate (a green path over zero
11
+ * parsed findings), then `vat resources validate` (a `--collection` matching
12
+ * nothing → `filesScanned: 0`, exit 0), `vat claude marketplace validate` (no
13
+ * `plugins/` to walk, no count published), `vat corpus scan` (an empty tree
14
+ * "audits cleanly"), `vat verify`'s `packaged-content` phase (a typo'd glob
15
+ * discovers no bundle and the phase reports `success`), then `vat skills
16
+ * validate` (the same typo'd glob: one info line, no document, exit 0 — and
17
+ * `vat validate` folded that into `success`) and `vat audit` (an existing tree
18
+ * with nothing auditable: `status: success` over `filesScanned: 0`). Nine
19
+ * instances of one shape, and each was first fixed by hand at its own site.
20
+ * This module is where that hand-fixing stops: every site derives its refusal
21
+ * through the same three functions, so the invariants below are properties of
22
+ * the mechanism rather than of each author's memory.
23
+ *
24
+ * ## The invariants
25
+ *
26
+ * 1. **Code {@link RUN_INTEGRITY_CODE} — `RESOURCE_CHECK_BROKEN` — and never a
27
+ * sibling per site.** It is the registry's one run-integrity claim — *these
28
+ * assertions did not execute meaningfully, so the green means nothing* — and
29
+ * `ValidationConfigSchema` refuses it as a `severity` key, which is what makes
30
+ * it non-overridable by construction. A code per site would buy a consumer
31
+ * nothing the message does not already say while adding one more thing an
32
+ * adopter's CI has to know to look for.
33
+ * 2. **Severity `error`, and not a parameter.** The one thing that must never be
34
+ * configurable about "the gate did not do its job" is whether it gates.
35
+ * 3. **Derived inside the DOCUMENT builder, never asserted in a handler.** The
36
+ * builder is the one function every lane's document passes through, so
37
+ * deriving the refusal there lands it after `resolveIssueSeverity` and
38
+ * `applyAllowFilter` and makes "denominator zero, status clean"
39
+ * unrepresentable rather than merely unwritten. A pure function, unit-testable
40
+ * without I/O.
41
+ * 4. **ONE finding per run**, however many things went unmatched. The claim is
42
+ * about the RUN; one per argument is per-finding duplication.
43
+ * 5. **The message says what did not run and what the operator can do.** It
44
+ * must not claim the corpus is broken — it claims the run is not a verdict.
45
+ * 6. **stderr may still carry a human warning; the document and the exit code
46
+ * must agree with it.** The human channel and the machine channel were what
47
+ * disagreed in every shipped instance, and only the machine channel gates.
48
+ */
49
+ import type { ValidationIssue } from '@vibe-agent-toolkit/schema';
50
+ /**
51
+ * The code every run-integrity refusal carries.
52
+ *
53
+ * 🔑 **One code for every refusal, on purpose.** A statement that would not
54
+ * compile, a corpus with no members, a run with no rules, a run that was killed,
55
+ * a scan that matched no file, a walk that missed a declared plugin, a phase that
56
+ * found no bundle — all are the same claim to a consumer, and they need the
57
+ * identical non-overridability, which
58
+ * `ValidationConfigSchema` grants by refusing this code as a `severity` key.
59
+ */
60
+ export declare const RUN_INTEGRITY_CODE = "RESOURCE_CHECK_BROKEN";
61
+ /**
62
+ * A run-integrity refusal: the non-overridable code, at `error`, always.
63
+ *
64
+ * The severity is not a parameter and must not become one. Every caller is
65
+ * reporting that the gate did not do its job, and the one thing that must never
66
+ * be configurable about that report is whether it gates.
67
+ *
68
+ * @param message - What did not run, and what the operator can do about it
69
+ * @returns The finding
70
+ */
71
+ export declare function runIntegrityFinding(message: string): ValidationIssue;
72
+ /**
73
+ * The refusal for a run whose denominator is zero — nothing was checked.
74
+ *
75
+ * 🪤 **It asks the DENOMINATOR, never the config.** A builder cannot see why
76
+ * nothing ran and deliberately does not ask. An absent config block, a filter
77
+ * that matched nothing, a glob with a typo, a directory that was never built —
78
+ * all arrive as the same document, and all of them are a gate that asserted
79
+ * nothing. The message is where a site names the likely causes and the remedy.
80
+ *
81
+ * 🪤 **One report per situation.** A run that already carries a run-integrity
82
+ * finding (an interrupted run, say) has the more specific of the two claims on
83
+ * the document, so this stands down rather than handing the operator two reports
84
+ * about one situation. Nothing weaker is needed: every such finding is `error`,
85
+ * so the status is already refused.
86
+ *
87
+ * @param denominator - How many things the run actually checked
88
+ * @param issues - What the run already found, so an existing run-integrity
89
+ * report is not duplicated
90
+ * @param message - The site's own account of what did not run and what to do;
91
+ * evaluated lazily so a populated run pays nothing for it
92
+ * @returns The one finding, or nothing when at least one thing was checked
93
+ */
94
+ export declare function nothingCheckedFinding(denominator: number, issues: readonly ValidationIssue[], message: () => string): readonly ValidationIssue[];
95
+ //# sourceMappingURL=run-integrity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-integrity.d.ts","sourceRoot":"","sources":["../../src/utils/run-integrity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAE1D;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAEpE;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,SAAS,eAAe,EAAE,EAClC,OAAO,EAAE,MAAM,MAAM,GACpB,SAAS,eAAe,EAAE,CAI5B"}