@vibe-agent-toolkit/cli 0.2.0-rc.11 → 0.2.0-rc.12

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 (755) hide show
  1. package/README.md +3 -3
  2. package/dist/bin/supervise-cli.d.ts +45 -0
  3. package/dist/bin/supervise-cli.d.ts.map +1 -0
  4. package/dist/bin/supervise-cli.js +83 -0
  5. package/dist/bin/supervise-cli.js.map +1 -0
  6. package/dist/bin/vat +95 -43
  7. package/dist/bin/vat.d.ts +15 -4
  8. package/dist/bin/vat.d.ts.map +1 -1
  9. package/dist/bin/vat.js +95 -43
  10. package/dist/bin/vat.js.map +1 -1
  11. package/dist/bin.js +21 -29
  12. package/dist/bin.js.map +1 -1
  13. package/dist/command-tree.d.ts +45 -0
  14. package/dist/command-tree.d.ts.map +1 -0
  15. package/dist/command-tree.js +60 -0
  16. package/dist/command-tree.js.map +1 -0
  17. package/dist/commands/agent/build-schema.d.ts +100 -0
  18. package/dist/commands/agent/build-schema.d.ts.map +1 -0
  19. package/dist/commands/agent/build-schema.js +32 -0
  20. package/dist/commands/agent/build-schema.js.map +1 -0
  21. package/dist/commands/agent/build.d.ts +1 -0
  22. package/dist/commands/agent/build.d.ts.map +1 -1
  23. package/dist/commands/agent/build.js +63 -33
  24. package/dist/commands/agent/build.js.map +1 -1
  25. package/dist/commands/agent/import-schema.d.ts +75 -0
  26. package/dist/commands/agent/import-schema.d.ts.map +1 -0
  27. package/dist/commands/agent/import-schema.js +25 -0
  28. package/dist/commands/agent/import-schema.js.map +1 -0
  29. package/dist/commands/agent/import.d.ts.map +1 -1
  30. package/dist/commands/agent/import.js +33 -27
  31. package/dist/commands/agent/import.js.map +1 -1
  32. package/dist/commands/agent/index.d.ts.map +1 -1
  33. package/dist/commands/agent/index.js +132 -37
  34. package/dist/commands/agent/index.js.map +1 -1
  35. package/dist/commands/agent/install-path.d.ts.map +1 -1
  36. package/dist/commands/agent/install-path.js +2 -1
  37. package/dist/commands/agent/install-path.js.map +1 -1
  38. package/dist/commands/agent/install-schema.d.ts +89 -0
  39. package/dist/commands/agent/install-schema.d.ts.map +1 -0
  40. package/dist/commands/agent/install-schema.js +29 -0
  41. package/dist/commands/agent/install-schema.js.map +1 -0
  42. package/dist/commands/agent/install.d.ts +7 -1
  43. package/dist/commands/agent/install.d.ts.map +1 -1
  44. package/dist/commands/agent/install.js +78 -108
  45. package/dist/commands/agent/install.js.map +1 -1
  46. package/dist/commands/agent/installed-schema.d.ts +140 -0
  47. package/dist/commands/agent/installed-schema.d.ts.map +1 -0
  48. package/dist/commands/agent/installed-schema.js +36 -0
  49. package/dist/commands/agent/installed-schema.js.map +1 -0
  50. package/dist/commands/agent/installed.d.ts +1 -1
  51. package/dist/commands/agent/installed.d.ts.map +1 -1
  52. package/dist/commands/agent/installed.js +104 -75
  53. package/dist/commands/agent/installed.js.map +1 -1
  54. package/dist/commands/agent/list-schema.d.ts +128 -0
  55. package/dist/commands/agent/list-schema.d.ts.map +1 -0
  56. package/dist/commands/agent/list-schema.js +34 -0
  57. package/dist/commands/agent/list-schema.js.map +1 -0
  58. package/dist/commands/agent/list.d.ts +4 -3
  59. package/dist/commands/agent/list.d.ts.map +1 -1
  60. package/dist/commands/agent/list.js +50 -37
  61. package/dist/commands/agent/list.js.map +1 -1
  62. package/dist/commands/agent/run.d.ts +3 -0
  63. package/dist/commands/agent/run.d.ts.map +1 -1
  64. package/dist/commands/agent/run.js +8 -3
  65. package/dist/commands/agent/run.js.map +1 -1
  66. package/dist/commands/agent/uninstall-schema.d.ts +89 -0
  67. package/dist/commands/agent/uninstall-schema.d.ts.map +1 -0
  68. package/dist/commands/agent/uninstall-schema.js +29 -0
  69. package/dist/commands/agent/uninstall-schema.js.map +1 -0
  70. package/dist/commands/agent/uninstall.d.ts +5 -1
  71. package/dist/commands/agent/uninstall.d.ts.map +1 -1
  72. package/dist/commands/agent/uninstall.js +50 -38
  73. package/dist/commands/agent/uninstall.js.map +1 -1
  74. package/dist/commands/agent/validate-schema.d.ts +129 -0
  75. package/dist/commands/agent/validate-schema.d.ts.map +1 -0
  76. package/dist/commands/agent/validate-schema.js +35 -0
  77. package/dist/commands/agent/validate-schema.js.map +1 -0
  78. package/dist/commands/agent/validate.d.ts +6 -0
  79. package/dist/commands/agent/validate.d.ts.map +1 -1
  80. package/dist/commands/agent/validate.js +64 -36
  81. package/dist/commands/agent/validate.js.map +1 -1
  82. package/dist/commands/ard/emit-schema.d.ts +108 -0
  83. package/dist/commands/ard/emit-schema.d.ts.map +1 -0
  84. package/dist/commands/ard/emit-schema.js +37 -0
  85. package/dist/commands/ard/emit-schema.js.map +1 -0
  86. package/dist/commands/ard/emit.d.ts +21 -65
  87. package/dist/commands/ard/emit.d.ts.map +1 -1
  88. package/dist/commands/ard/emit.js +68 -74
  89. package/dist/commands/ard/emit.js.map +1 -1
  90. package/dist/commands/ard/index.d.ts.map +1 -1
  91. package/dist/commands/ard/index.js +14 -11
  92. package/dist/commands/ard/index.js.map +1 -1
  93. package/dist/commands/audit/compat-lane-findings.d.ts +65 -0
  94. package/dist/commands/audit/compat-lane-findings.d.ts.map +1 -0
  95. package/dist/commands/audit/compat-lane-findings.js +72 -0
  96. package/dist/commands/audit/compat-lane-findings.js.map +1 -0
  97. package/dist/commands/audit/distributed-tree.d.ts +2 -2
  98. package/dist/commands/audit/distributed-tree.d.ts.map +1 -1
  99. package/dist/commands/audit/distributed-tree.js +23 -12
  100. package/dist/commands/audit/distributed-tree.js.map +1 -1
  101. package/dist/commands/audit/git-url-clone.d.ts +15 -7
  102. package/dist/commands/audit/git-url-clone.d.ts.map +1 -1
  103. package/dist/commands/audit/git-url-clone.js +85 -42
  104. package/dist/commands/audit/git-url-clone.js.map +1 -1
  105. package/dist/commands/audit/hierarchical-output.d.ts +28 -4
  106. package/dist/commands/audit/hierarchical-output.d.ts.map +1 -1
  107. package/dist/commands/audit/hierarchical-output.js +44 -27
  108. package/dist/commands/audit/hierarchical-output.js.map +1 -1
  109. package/dist/commands/audit/scan-population.d.ts.map +1 -1
  110. package/dist/commands/audit/scan-population.js +2 -1
  111. package/dist/commands/audit/scan-population.js.map +1 -1
  112. package/dist/commands/audit-schema.d.ts +1247 -0
  113. package/dist/commands/audit-schema.d.ts.map +1 -0
  114. package/dist/commands/audit-schema.js +139 -0
  115. package/dist/commands/audit-schema.js.map +1 -0
  116. package/dist/commands/audit-settings-schema.d.ts +417 -0
  117. package/dist/commands/audit-settings-schema.d.ts.map +1 -0
  118. package/dist/commands/audit-settings-schema.js +77 -0
  119. package/dist/commands/audit-settings-schema.js.map +1 -0
  120. package/dist/commands/audit-settings.d.ts +28 -9
  121. package/dist/commands/audit-settings.d.ts.map +1 -1
  122. package/dist/commands/audit-settings.js +215 -151
  123. package/dist/commands/audit-settings.js.map +1 -1
  124. package/dist/commands/audit.d.ts +72 -33
  125. package/dist/commands/audit.d.ts.map +1 -1
  126. package/dist/commands/audit.js +405 -411
  127. package/dist/commands/audit.js.map +1 -1
  128. package/dist/commands/build.d.ts +61 -4
  129. package/dist/commands/build.d.ts.map +1 -1
  130. package/dist/commands/build.js +176 -190
  131. package/dist/commands/build.js.map +1 -1
  132. package/dist/commands/cache/clear-schema.d.ts +111 -0
  133. package/dist/commands/cache/clear-schema.d.ts.map +1 -0
  134. package/dist/commands/cache/clear-schema.js +37 -0
  135. package/dist/commands/cache/clear-schema.js.map +1 -0
  136. package/dist/commands/cache/clear.d.ts +28 -26
  137. package/dist/commands/cache/clear.d.ts.map +1 -1
  138. package/dist/commands/cache/clear.js +108 -103
  139. package/dist/commands/cache/clear.js.map +1 -1
  140. package/dist/commands/cache/index.d.ts.map +1 -1
  141. package/dist/commands/cache/index.js +13 -7
  142. package/dist/commands/cache/index.js.map +1 -1
  143. package/dist/commands/claude/claude-config.d.ts +23 -6
  144. package/dist/commands/claude/claude-config.d.ts.map +1 -1
  145. package/dist/commands/claude/claude-config.js +29 -15
  146. package/dist/commands/claude/claude-config.js.map +1 -1
  147. package/dist/commands/claude/context.d.ts +55 -2
  148. package/dist/commands/claude/context.d.ts.map +1 -1
  149. package/dist/commands/claude/context.js +74 -50
  150. package/dist/commands/claude/context.js.map +1 -1
  151. package/dist/commands/claude/marketplace/changelog-utils.js +2 -2
  152. package/dist/commands/claude/marketplace/changelog-utils.js.map +1 -1
  153. package/dist/commands/claude/marketplace/git-publish.d.ts +14 -1
  154. package/dist/commands/claude/marketplace/git-publish.d.ts.map +1 -1
  155. package/dist/commands/claude/marketplace/git-publish.js +135 -68
  156. package/dist/commands/claude/marketplace/git-publish.js.map +1 -1
  157. package/dist/commands/claude/marketplace/license-utils.d.ts +3 -5
  158. package/dist/commands/claude/marketplace/license-utils.d.ts.map +1 -1
  159. package/dist/commands/claude/marketplace/license-utils.js +16 -7
  160. package/dist/commands/claude/marketplace/license-utils.js.map +1 -1
  161. package/dist/commands/claude/marketplace/publish-schema.d.ts +137 -0
  162. package/dist/commands/claude/marketplace/publish-schema.d.ts.map +1 -0
  163. package/dist/commands/claude/marketplace/publish-schema.js +32 -0
  164. package/dist/commands/claude/marketplace/publish-schema.js.map +1 -0
  165. package/dist/commands/claude/marketplace/publish-tree.d.ts +6 -0
  166. package/dist/commands/claude/marketplace/publish-tree.d.ts.map +1 -1
  167. package/dist/commands/claude/marketplace/publish-tree.js +75 -17
  168. package/dist/commands/claude/marketplace/publish-tree.js.map +1 -1
  169. package/dist/commands/claude/marketplace/publish.d.ts +27 -0
  170. package/dist/commands/claude/marketplace/publish.d.ts.map +1 -1
  171. package/dist/commands/claude/marketplace/publish.js +84 -50
  172. package/dist/commands/claude/marketplace/publish.js.map +1 -1
  173. package/dist/commands/claude/marketplace/validate-schema.d.ts +362 -0
  174. package/dist/commands/claude/marketplace/validate-schema.d.ts.map +1 -0
  175. package/dist/commands/claude/marketplace/validate-schema.js +67 -0
  176. package/dist/commands/claude/marketplace/validate-schema.js.map +1 -0
  177. package/dist/commands/claude/marketplace/validate.d.ts +40 -53
  178. package/dist/commands/claude/marketplace/validate.d.ts.map +1 -1
  179. package/dist/commands/claude/marketplace/validate.js +358 -214
  180. package/dist/commands/claude/marketplace/validate.js.map +1 -1
  181. package/dist/commands/claude/org/api-keys.d.ts +3 -0
  182. package/dist/commands/claude/org/api-keys.d.ts.map +1 -1
  183. package/dist/commands/claude/org/api-keys.js +4 -5
  184. package/dist/commands/claude/org/api-keys.js.map +1 -1
  185. package/dist/commands/claude/org/code-analytics.js +1 -1
  186. package/dist/commands/claude/org/code-analytics.js.map +1 -1
  187. package/dist/commands/claude/org/cost.d.ts.map +1 -1
  188. package/dist/commands/claude/org/cost.js +11 -33
  189. package/dist/commands/claude/org/cost.js.map +1 -1
  190. package/dist/commands/claude/org/helpers.d.ts +40 -27
  191. package/dist/commands/claude/org/helpers.d.ts.map +1 -1
  192. package/dist/commands/claude/org/helpers.js +61 -66
  193. package/dist/commands/claude/org/helpers.js.map +1 -1
  194. package/dist/commands/claude/org/index.d.ts.map +1 -1
  195. package/dist/commands/claude/org/index.js +10 -4
  196. package/dist/commands/claude/org/index.js.map +1 -1
  197. package/dist/commands/claude/org/info.d.ts.map +1 -1
  198. package/dist/commands/claude/org/info.js +2 -3
  199. package/dist/commands/claude/org/info.js.map +1 -1
  200. package/dist/commands/claude/org/invites.d.ts +3 -0
  201. package/dist/commands/claude/org/invites.d.ts.map +1 -1
  202. package/dist/commands/claude/org/invites.js +5 -7
  203. package/dist/commands/claude/org/invites.js.map +1 -1
  204. package/dist/commands/claude/org/skills.d.ts +76 -21
  205. package/dist/commands/claude/org/skills.d.ts.map +1 -1
  206. package/dist/commands/claude/org/skills.js +273 -246
  207. package/dist/commands/claude/org/skills.js.map +1 -1
  208. package/dist/commands/claude/org/stubs-schema.d.ts +56 -0
  209. package/dist/commands/claude/org/stubs-schema.d.ts.map +1 -0
  210. package/dist/commands/claude/org/stubs-schema.js +23 -0
  211. package/dist/commands/claude/org/stubs-schema.js.map +1 -0
  212. package/dist/commands/claude/org/stubs.d.ts +8 -3
  213. package/dist/commands/claude/org/stubs.d.ts.map +1 -1
  214. package/dist/commands/claude/org/stubs.js +9 -9
  215. package/dist/commands/claude/org/stubs.js.map +1 -1
  216. package/dist/commands/claude/org/usage.d.ts.map +1 -1
  217. package/dist/commands/claude/org/usage.js +1 -2
  218. package/dist/commands/claude/org/usage.js.map +1 -1
  219. package/dist/commands/claude/org/users.d.ts +3 -0
  220. package/dist/commands/claude/org/users.d.ts.map +1 -1
  221. package/dist/commands/claude/org/users.js +6 -8
  222. package/dist/commands/claude/org/users.js.map +1 -1
  223. package/dist/commands/claude/org/workspaces.d.ts +3 -0
  224. package/dist/commands/claude/org/workspaces.d.ts.map +1 -1
  225. package/dist/commands/claude/org/workspaces.js +10 -15
  226. package/dist/commands/claude/org/workspaces.js.map +1 -1
  227. package/dist/commands/claude/plugin/build-schema.d.ts +642 -0
  228. package/dist/commands/claude/plugin/build-schema.d.ts.map +1 -0
  229. package/dist/commands/claude/plugin/build-schema.js +51 -0
  230. package/dist/commands/claude/plugin/build-schema.js.map +1 -0
  231. package/dist/commands/claude/plugin/build.d.ts +220 -45
  232. package/dist/commands/claude/plugin/build.d.ts.map +1 -1
  233. package/dist/commands/claude/plugin/build.js +466 -249
  234. package/dist/commands/claude/plugin/build.js.map +1 -1
  235. package/dist/commands/claude/plugin/helpers.d.ts +186 -24
  236. package/dist/commands/claude/plugin/helpers.d.ts.map +1 -1
  237. package/dist/commands/claude/plugin/helpers.js +110 -68
  238. package/dist/commands/claude/plugin/helpers.js.map +1 -1
  239. package/dist/commands/claude/plugin/install-schema.d.ts +144 -0
  240. package/dist/commands/claude/plugin/install-schema.d.ts.map +1 -0
  241. package/dist/commands/claude/plugin/install-schema.js +36 -0
  242. package/dist/commands/claude/plugin/install-schema.js.map +1 -0
  243. package/dist/commands/claude/plugin/install.d.ts +191 -11
  244. package/dist/commands/claude/plugin/install.d.ts.map +1 -1
  245. package/dist/commands/claude/plugin/install.js +688 -628
  246. package/dist/commands/claude/plugin/install.js.map +1 -1
  247. package/dist/commands/claude/plugin/kept-findings.d.ts +19 -0
  248. package/dist/commands/claude/plugin/kept-findings.d.ts.map +1 -0
  249. package/dist/commands/claude/plugin/kept-findings.js +24 -0
  250. package/dist/commands/claude/plugin/kept-findings.js.map +1 -0
  251. package/dist/commands/claude/plugin/list-schema.d.ts +223 -0
  252. package/dist/commands/claude/plugin/list-schema.d.ts.map +1 -0
  253. package/dist/commands/claude/plugin/list-schema.js +34 -0
  254. package/dist/commands/claude/plugin/list-schema.js.map +1 -0
  255. package/dist/commands/claude/plugin/list.d.ts +18 -0
  256. package/dist/commands/claude/plugin/list.d.ts.map +1 -1
  257. package/dist/commands/claude/plugin/list.js +53 -45
  258. package/dist/commands/claude/plugin/list.js.map +1 -1
  259. package/dist/commands/claude/plugin/npm-pack.d.ts +15 -0
  260. package/dist/commands/claude/plugin/npm-pack.d.ts.map +1 -0
  261. package/dist/commands/claude/plugin/npm-pack.js +39 -0
  262. package/dist/commands/claude/plugin/npm-pack.js.map +1 -0
  263. package/dist/commands/claude/plugin/plugin-changelog.d.ts +5 -1
  264. package/dist/commands/claude/plugin/plugin-changelog.d.ts.map +1 -1
  265. package/dist/commands/claude/plugin/plugin-changelog.js +9 -5
  266. package/dist/commands/claude/plugin/plugin-changelog.js.map +1 -1
  267. package/dist/commands/claude/plugin/plugin-files.d.ts +21 -2
  268. package/dist/commands/claude/plugin/plugin-files.d.ts.map +1 -1
  269. package/dist/commands/claude/plugin/plugin-files.js +65 -32
  270. package/dist/commands/claude/plugin/plugin-files.js.map +1 -1
  271. package/dist/commands/claude/plugin/plugin-validators.d.ts +13 -0
  272. package/dist/commands/claude/plugin/plugin-validators.d.ts.map +1 -1
  273. package/dist/commands/claude/plugin/plugin-validators.js +64 -16
  274. package/dist/commands/claude/plugin/plugin-validators.js.map +1 -1
  275. package/dist/commands/claude/plugin/tree-copy.d.ts.map +1 -1
  276. package/dist/commands/claude/plugin/tree-copy.js +63 -37
  277. package/dist/commands/claude/plugin/tree-copy.js.map +1 -1
  278. package/dist/commands/claude/plugin/uninstall-schema.d.ts +112 -0
  279. package/dist/commands/claude/plugin/uninstall-schema.d.ts.map +1 -0
  280. package/dist/commands/claude/plugin/uninstall-schema.js +28 -0
  281. package/dist/commands/claude/plugin/uninstall-schema.js.map +1 -0
  282. package/dist/commands/claude/plugin/uninstall.d.ts +57 -0
  283. package/dist/commands/claude/plugin/uninstall.d.ts.map +1 -1
  284. package/dist/commands/claude/plugin/uninstall.js +176 -64
  285. package/dist/commands/claude/plugin/uninstall.js.map +1 -1
  286. package/dist/commands/consistency-check.d.ts.map +1 -1
  287. package/dist/commands/consistency-check.js +8 -6
  288. package/dist/commands/consistency-check.js.map +1 -1
  289. package/dist/commands/corpus/index.d.ts.map +1 -1
  290. package/dist/commands/corpus/index.js +26 -10
  291. package/dist/commands/corpus/index.js.map +1 -1
  292. package/dist/commands/corpus/report.d.ts +34 -16
  293. package/dist/commands/corpus/report.d.ts.map +1 -1
  294. package/dist/commands/corpus/report.js +36 -18
  295. package/dist/commands/corpus/report.js.map +1 -1
  296. package/dist/commands/corpus/runner.d.ts +25 -20
  297. package/dist/commands/corpus/runner.d.ts.map +1 -1
  298. package/dist/commands/corpus/runner.js +123 -67
  299. package/dist/commands/corpus/runner.js.map +1 -1
  300. package/dist/commands/corpus/scan-schema.d.ts +127 -0
  301. package/dist/commands/corpus/scan-schema.d.ts.map +1 -0
  302. package/dist/commands/corpus/scan-schema.js +31 -0
  303. package/dist/commands/corpus/scan-schema.js.map +1 -0
  304. package/dist/commands/corpus/scan.d.ts +31 -0
  305. package/dist/commands/corpus/scan.d.ts.map +1 -1
  306. package/dist/commands/corpus/scan.js +124 -50
  307. package/dist/commands/corpus/scan.js.map +1 -1
  308. package/dist/commands/corpus/seed.d.ts +11 -8
  309. package/dist/commands/corpus/seed.d.ts.map +1 -1
  310. package/dist/commands/corpus/seed.js +29 -11
  311. package/dist/commands/corpus/seed.js.map +1 -1
  312. package/dist/commands/doctor-render.d.ts +52 -0
  313. package/dist/commands/doctor-render.d.ts.map +1 -0
  314. package/dist/commands/doctor-render.js +110 -0
  315. package/dist/commands/doctor-render.js.map +1 -0
  316. package/dist/commands/doctor-schema.d.ts +191 -0
  317. package/dist/commands/doctor-schema.d.ts.map +1 -0
  318. package/dist/commands/doctor-schema.js +44 -0
  319. package/dist/commands/doctor-schema.js.map +1 -0
  320. package/dist/commands/doctor.d.ts +7 -62
  321. package/dist/commands/doctor.d.ts.map +1 -1
  322. package/dist/commands/doctor.js +126 -165
  323. package/dist/commands/doctor.js.map +1 -1
  324. package/dist/commands/inventory-schema.d.ts +7297 -0
  325. package/dist/commands/inventory-schema.d.ts.map +1 -0
  326. package/dist/commands/inventory-schema.js +28 -0
  327. package/dist/commands/inventory-schema.js.map +1 -0
  328. package/dist/commands/inventory.d.ts +1 -1
  329. package/dist/commands/inventory.d.ts.map +1 -1
  330. package/dist/commands/inventory.js +89 -41
  331. package/dist/commands/inventory.js.map +1 -1
  332. package/dist/commands/mcp/index.d.ts.map +1 -1
  333. package/dist/commands/mcp/index.js +15 -0
  334. package/dist/commands/mcp/index.js.map +1 -1
  335. package/dist/commands/mcp/list-collections-schema.d.ts +101 -0
  336. package/dist/commands/mcp/list-collections-schema.d.ts.map +1 -0
  337. package/dist/commands/mcp/list-collections-schema.js +22 -0
  338. package/dist/commands/mcp/list-collections-schema.js.map +1 -0
  339. package/dist/commands/mcp/list-collections.d.ts +1 -1
  340. package/dist/commands/mcp/list-collections.d.ts.map +1 -1
  341. package/dist/commands/mcp/list-collections.js +19 -17
  342. package/dist/commands/mcp/list-collections.js.map +1 -1
  343. package/dist/commands/mcp/serve.d.ts +5 -0
  344. package/dist/commands/mcp/serve.d.ts.map +1 -1
  345. package/dist/commands/mcp/serve.js +29 -15
  346. package/dist/commands/mcp/serve.js.map +1 -1
  347. package/dist/commands/okf/index.d.ts.map +1 -1
  348. package/dist/commands/okf/index.js +6 -5
  349. package/dist/commands/okf/index.js.map +1 -1
  350. package/dist/commands/okf/validate-schema.d.ts +171 -0
  351. package/dist/commands/okf/validate-schema.d.ts.map +1 -0
  352. package/dist/commands/okf/validate-schema.js +44 -0
  353. package/dist/commands/okf/validate-schema.js.map +1 -0
  354. package/dist/commands/okf/validate.d.ts +16 -149
  355. package/dist/commands/okf/validate.d.ts.map +1 -1
  356. package/dist/commands/okf/validate.js +64 -62
  357. package/dist/commands/okf/validate.js.map +1 -1
  358. package/dist/commands/orchestrator-schema.d.ts +419 -0
  359. package/dist/commands/orchestrator-schema.d.ts.map +1 -0
  360. package/dist/commands/orchestrator-schema.js +91 -0
  361. package/dist/commands/orchestrator-schema.js.map +1 -0
  362. package/dist/commands/phase-utils.d.ts +188 -220
  363. package/dist/commands/phase-utils.d.ts.map +1 -1
  364. package/dist/commands/phase-utils.js +210 -258
  365. package/dist/commands/phase-utils.js.map +1 -1
  366. package/dist/commands/positional-args.d.ts +13 -11
  367. package/dist/commands/positional-args.d.ts.map +1 -1
  368. package/dist/commands/positional-args.js +16 -15
  369. package/dist/commands/positional-args.js.map +1 -1
  370. package/dist/commands/rag/admin-schema.d.ts +152 -0
  371. package/dist/commands/rag/admin-schema.d.ts.map +1 -0
  372. package/dist/commands/rag/admin-schema.js +31 -0
  373. package/dist/commands/rag/admin-schema.js.map +1 -0
  374. package/dist/commands/rag/clear-command.d.ts.map +1 -1
  375. package/dist/commands/rag/clear-command.js +30 -15
  376. package/dist/commands/rag/clear-command.js.map +1 -1
  377. package/dist/commands/rag/command-helpers.d.ts +31 -7
  378. package/dist/commands/rag/command-helpers.d.ts.map +1 -1
  379. package/dist/commands/rag/command-helpers.js +41 -21
  380. package/dist/commands/rag/command-helpers.js.map +1 -1
  381. package/dist/commands/rag/index-command.d.ts +37 -48
  382. package/dist/commands/rag/index-command.d.ts.map +1 -1
  383. package/dist/commands/rag/index-command.js +80 -65
  384. package/dist/commands/rag/index-command.js.map +1 -1
  385. package/dist/commands/rag/index-schema.d.ts +107 -0
  386. package/dist/commands/rag/index-schema.d.ts.map +1 -0
  387. package/dist/commands/rag/index-schema.js +34 -0
  388. package/dist/commands/rag/index-schema.js.map +1 -0
  389. package/dist/commands/rag/index.d.ts.map +1 -1
  390. package/dist/commands/rag/index.js +88 -41
  391. package/dist/commands/rag/index.js.map +1 -1
  392. package/dist/commands/rag/query-command.d.ts +18 -4
  393. package/dist/commands/rag/query-command.d.ts.map +1 -1
  394. package/dist/commands/rag/query-command.js +42 -27
  395. package/dist/commands/rag/query-command.js.map +1 -1
  396. package/dist/commands/rag/query-schema.d.ts +363 -0
  397. package/dist/commands/rag/query-schema.d.ts.map +1 -0
  398. package/dist/commands/rag/query-schema.js +59 -0
  399. package/dist/commands/rag/query-schema.js.map +1 -0
  400. package/dist/commands/rag/stats-command.d.ts.map +1 -1
  401. package/dist/commands/rag/stats-command.js +19 -18
  402. package/dist/commands/rag/stats-command.js.map +1 -1
  403. package/dist/commands/resources/check-progress.d.ts +64 -11
  404. package/dist/commands/resources/check-progress.d.ts.map +1 -1
  405. package/dist/commands/resources/check-progress.js +77 -4
  406. package/dist/commands/resources/check-progress.js.map +1 -1
  407. package/dist/commands/resources/check-schema.d.ts +335 -0
  408. package/dist/commands/resources/check-schema.d.ts.map +1 -0
  409. package/dist/commands/resources/check-schema.js +104 -0
  410. package/dist/commands/resources/check-schema.js.map +1 -0
  411. package/dist/commands/resources/check-supervisor.d.ts +315 -71
  412. package/dist/commands/resources/check-supervisor.d.ts.map +1 -1
  413. package/dist/commands/resources/check-supervisor.js +493 -107
  414. package/dist/commands/resources/check-supervisor.js.map +1 -1
  415. package/dist/commands/resources/check.d.ts +56 -249
  416. package/dist/commands/resources/check.d.ts.map +1 -1
  417. package/dist/commands/resources/check.js +416 -276
  418. package/dist/commands/resources/check.js.map +1 -1
  419. package/dist/commands/resources/index.d.ts.map +1 -1
  420. package/dist/commands/resources/index.js +165 -91
  421. package/dist/commands/resources/index.js.map +1 -1
  422. package/dist/commands/resources/query-schema.d.ts +188 -0
  423. package/dist/commands/resources/query-schema.d.ts.map +1 -0
  424. package/dist/commands/resources/query-schema.js +48 -0
  425. package/dist/commands/resources/query-schema.js.map +1 -0
  426. package/dist/commands/resources/query.d.ts +17 -12
  427. package/dist/commands/resources/query.d.ts.map +1 -1
  428. package/dist/commands/resources/query.js +60 -48
  429. package/dist/commands/resources/query.js.map +1 -1
  430. package/dist/commands/resources/scan-schema.d.ts +195 -0
  431. package/dist/commands/resources/scan-schema.d.ts.map +1 -0
  432. package/dist/commands/resources/scan-schema.js +53 -0
  433. package/dist/commands/resources/scan-schema.js.map +1 -0
  434. package/dist/commands/resources/scan.d.ts +26 -3
  435. package/dist/commands/resources/scan.d.ts.map +1 -1
  436. package/dist/commands/resources/scan.js +51 -53
  437. package/dist/commands/resources/scan.js.map +1 -1
  438. package/dist/commands/resources/validate-schema.d.ts +326 -0
  439. package/dist/commands/resources/validate-schema.d.ts.map +1 -0
  440. package/dist/commands/resources/validate-schema.js +60 -0
  441. package/dist/commands/resources/validate-schema.js.map +1 -0
  442. package/dist/commands/resources/validate.d.ts +45 -169
  443. package/dist/commands/resources/validate.d.ts.map +1 -1
  444. package/dist/commands/resources/validate.js +221 -485
  445. package/dist/commands/resources/validate.js.map +1 -1
  446. package/dist/commands/skill/review-checklist.d.ts.map +1 -1
  447. package/dist/commands/skill/review-checklist.js +0 -1
  448. package/dist/commands/skill/review-checklist.js.map +1 -1
  449. package/dist/commands/skill/review-schema.d.ts +278 -0
  450. package/dist/commands/skill/review-schema.d.ts.map +1 -0
  451. package/dist/commands/skill/review-schema.js +46 -0
  452. package/dist/commands/skill/review-schema.js.map +1 -0
  453. package/dist/commands/skill/review.d.ts +8 -234
  454. package/dist/commands/skill/review.d.ts.map +1 -1
  455. package/dist/commands/skill/review.js +54 -78
  456. package/dist/commands/skill/review.js.map +1 -1
  457. package/dist/commands/skill/test/auth-flags.d.ts +3 -0
  458. package/dist/commands/skill/test/auth-flags.d.ts.map +1 -1
  459. package/dist/commands/skill/test/auth-flags.js +6 -2
  460. package/dist/commands/skill/test/auth-flags.js.map +1 -1
  461. package/dist/commands/skill/test/configure-schema.d.ts +67 -0
  462. package/dist/commands/skill/test/configure-schema.d.ts.map +1 -0
  463. package/dist/commands/skill/test/configure-schema.js +27 -0
  464. package/dist/commands/skill/test/configure-schema.js.map +1 -0
  465. package/dist/commands/skill/test/configure.d.ts +12 -5
  466. package/dist/commands/skill/test/configure.d.ts.map +1 -1
  467. package/dist/commands/skill/test/configure.js +101 -31
  468. package/dist/commands/skill/test/configure.js.map +1 -1
  469. package/dist/commands/skill/test/run-schema.d.ts +107 -0
  470. package/dist/commands/skill/test/run-schema.d.ts.map +1 -0
  471. package/dist/commands/skill/test/run-schema.js +36 -0
  472. package/dist/commands/skill/test/run-schema.js.map +1 -0
  473. package/dist/commands/skill/test/run.d.ts +3 -2
  474. package/dist/commands/skill/test/run.d.ts.map +1 -1
  475. package/dist/commands/skill/test/run.js +316 -155
  476. package/dist/commands/skill/test/run.js.map +1 -1
  477. package/dist/commands/skills/build-schema.d.ts +199 -0
  478. package/dist/commands/skills/build-schema.d.ts.map +1 -0
  479. package/dist/commands/skills/build-schema.js +55 -0
  480. package/dist/commands/skills/build-schema.js.map +1 -0
  481. package/dist/commands/skills/build.d.ts +95 -298
  482. package/dist/commands/skills/build.d.ts.map +1 -1
  483. package/dist/commands/skills/build.js +415 -818
  484. package/dist/commands/skills/build.js.map +1 -1
  485. package/dist/commands/skills/command-helpers.d.ts +5 -11
  486. package/dist/commands/skills/command-helpers.d.ts.map +1 -1
  487. package/dist/commands/skills/command-helpers.js +7 -17
  488. package/dist/commands/skills/command-helpers.js.map +1 -1
  489. package/dist/commands/skills/index.js +12 -6
  490. package/dist/commands/skills/index.js.map +1 -1
  491. package/dist/commands/skills/install-schema.d.ts +153 -0
  492. package/dist/commands/skills/install-schema.d.ts.map +1 -0
  493. package/dist/commands/skills/install-schema.js +44 -0
  494. package/dist/commands/skills/install-schema.js.map +1 -0
  495. package/dist/commands/skills/install.d.ts +76 -8
  496. package/dist/commands/skills/install.d.ts.map +1 -1
  497. package/dist/commands/skills/install.js +230 -194
  498. package/dist/commands/skills/install.js.map +1 -1
  499. package/dist/commands/skills/list-schema.d.ts +145 -0
  500. package/dist/commands/skills/list-schema.d.ts.map +1 -0
  501. package/dist/commands/skills/list-schema.js +37 -0
  502. package/dist/commands/skills/list-schema.js.map +1 -0
  503. package/dist/commands/skills/list.d.ts +39 -8
  504. package/dist/commands/skills/list.d.ts.map +1 -1
  505. package/dist/commands/skills/list.js +110 -122
  506. package/dist/commands/skills/list.js.map +1 -1
  507. package/dist/commands/skills/package-schema.d.ts +98 -0
  508. package/dist/commands/skills/package-schema.d.ts.map +1 -0
  509. package/dist/commands/skills/package-schema.js +32 -0
  510. package/dist/commands/skills/package-schema.js.map +1 -0
  511. package/dist/commands/skills/package.d.ts +85 -14
  512. package/dist/commands/skills/package.d.ts.map +1 -1
  513. package/dist/commands/skills/package.js +288 -207
  514. package/dist/commands/skills/package.js.map +1 -1
  515. package/dist/commands/skills/scope-guard.d.ts +27 -20
  516. package/dist/commands/skills/scope-guard.d.ts.map +1 -1
  517. package/dist/commands/skills/scope-guard.js +43 -32
  518. package/dist/commands/skills/scope-guard.js.map +1 -1
  519. package/dist/commands/skills/skill-discovery.d.ts +1 -1
  520. package/dist/commands/skills/skill-discovery.d.ts.map +1 -1
  521. package/dist/commands/skills/skill-discovery.js +40 -19
  522. package/dist/commands/skills/skill-discovery.js.map +1 -1
  523. package/dist/commands/skills/source-resolvers.d.ts +58 -8
  524. package/dist/commands/skills/source-resolvers.d.ts.map +1 -1
  525. package/dist/commands/skills/source-resolvers.js +113 -38
  526. package/dist/commands/skills/source-resolvers.js.map +1 -1
  527. package/dist/commands/skills/validate-command.d.ts.map +1 -1
  528. package/dist/commands/skills/validate-command.js +31 -51
  529. package/dist/commands/skills/validate-command.js.map +1 -1
  530. package/dist/commands/skills/validate-schema.d.ts +199 -0
  531. package/dist/commands/skills/validate-schema.d.ts.map +1 -0
  532. package/dist/commands/skills/validate-schema.js +44 -0
  533. package/dist/commands/skills/validate-schema.js.map +1 -0
  534. package/dist/commands/skills/validate.d.ts +100 -136
  535. package/dist/commands/skills/validate.d.ts.map +1 -1
  536. package/dist/commands/skills/validate.js +257 -343
  537. package/dist/commands/skills/validate.js.map +1 -1
  538. package/dist/commands/validate.d.ts +17 -5
  539. package/dist/commands/validate.d.ts.map +1 -1
  540. package/dist/commands/validate.js +139 -94
  541. package/dist/commands/validate.js.map +1 -1
  542. package/dist/commands/verify.d.ts +121 -110
  543. package/dist/commands/verify.d.ts.map +1 -1
  544. package/dist/commands/verify.js +230 -294
  545. package/dist/commands/verify.js.map +1 -1
  546. package/dist/index.d.ts +1 -1
  547. package/dist/index.d.ts.map +1 -1
  548. package/dist/index.js +1 -1
  549. package/dist/index.js.map +1 -1
  550. package/dist/report-schemas.d.ts +12398 -35
  551. package/dist/report-schemas.d.ts.map +1 -1
  552. package/dist/report-schemas.js +624 -66
  553. package/dist/report-schemas.js.map +1 -1
  554. package/dist/skill-resolution/packaging-config.js +2 -2
  555. package/dist/skill-resolution/packaging-config.js.map +1 -1
  556. package/dist/skill-resolution/resolve-skill-reference.d.ts.map +1 -1
  557. package/dist/skill-resolution/resolve-skill-reference.js +20 -13
  558. package/dist/skill-resolution/resolve-skill-reference.js.map +1 -1
  559. package/dist/utils/agent-discovery.d.ts +34 -1
  560. package/dist/utils/agent-discovery.d.ts.map +1 -1
  561. package/dist/utils/agent-discovery.js +80 -38
  562. package/dist/utils/agent-discovery.js.map +1 -1
  563. package/dist/utils/claude-context-lens.d.ts +13 -6
  564. package/dist/utils/claude-context-lens.d.ts.map +1 -1
  565. package/dist/utils/claude-context-lens.js +11 -12
  566. package/dist/utils/claude-context-lens.js.map +1 -1
  567. package/dist/utils/command-error-codes.d.ts +12 -0
  568. package/dist/utils/command-error-codes.d.ts.map +1 -0
  569. package/dist/utils/command-error-codes.js +12 -0
  570. package/dist/utils/command-error-codes.js.map +1 -0
  571. package/dist/utils/command-refusal.d.ts +58 -0
  572. package/dist/utils/command-refusal.d.ts.map +1 -0
  573. package/dist/utils/command-refusal.js +170 -0
  574. package/dist/utils/command-refusal.js.map +1 -0
  575. package/dist/utils/commander-ending.d.ts +40 -0
  576. package/dist/utils/commander-ending.d.ts.map +1 -0
  577. package/dist/utils/commander-ending.js +42 -0
  578. package/dist/utils/commander-ending.js.map +1 -0
  579. package/dist/utils/config-loader.d.ts +13 -8
  580. package/dist/utils/config-loader.d.ts.map +1 -1
  581. package/dist/utils/config-loader.js +84 -45
  582. package/dist/utils/config-loader.js.map +1 -1
  583. package/dist/utils/corpus-target.d.ts +1 -1
  584. package/dist/utils/corpus-target.d.ts.map +1 -1
  585. package/dist/utils/corpus-target.js +6 -4
  586. package/dist/utils/corpus-target.js.map +1 -1
  587. package/dist/utils/debug-diagnostics.d.ts +18 -0
  588. package/dist/utils/debug-diagnostics.d.ts.map +1 -0
  589. package/dist/utils/debug-diagnostics.js +23 -0
  590. package/dist/utils/debug-diagnostics.js.map +1 -0
  591. package/dist/utils/document-writer.d.ts +191 -0
  592. package/dist/utils/document-writer.d.ts.map +1 -0
  593. package/dist/utils/document-writer.js +319 -0
  594. package/dist/utils/document-writer.js.map +1 -0
  595. package/dist/utils/help-loader.d.ts +2 -2
  596. package/dist/utils/help-loader.js +2 -2
  597. package/dist/utils/install-plan.d.ts +99 -0
  598. package/dist/utils/install-plan.d.ts.map +1 -0
  599. package/dist/utils/install-plan.js +146 -0
  600. package/dist/utils/install-plan.js.map +1 -0
  601. package/dist/utils/issue-anchor.d.ts +1 -1
  602. package/dist/utils/issue-anchor.d.ts.map +1 -1
  603. package/dist/utils/issue-anchor.js.map +1 -1
  604. package/dist/utils/issue-rendering.d.ts +8 -3
  605. package/dist/utils/issue-rendering.d.ts.map +1 -1
  606. package/dist/utils/issue-rendering.js +4 -0
  607. package/dist/utils/issue-rendering.js.map +1 -1
  608. package/dist/utils/lens-population.d.ts +20 -0
  609. package/dist/utils/lens-population.d.ts.map +1 -0
  610. package/dist/utils/lens-population.js +15 -0
  611. package/dist/utils/lens-population.js.map +1 -0
  612. package/dist/utils/marketplace-io.d.ts +63 -0
  613. package/dist/utils/marketplace-io.d.ts.map +1 -0
  614. package/dist/utils/marketplace-io.js +63 -0
  615. package/dist/utils/marketplace-io.js.map +1 -0
  616. package/dist/utils/operator-notices.d.ts +97 -0
  617. package/dist/utils/operator-notices.d.ts.map +1 -0
  618. package/dist/utils/operator-notices.js +115 -0
  619. package/dist/utils/operator-notices.js.map +1 -0
  620. package/dist/utils/optional-backend.d.ts +18 -15
  621. package/dist/utils/optional-backend.d.ts.map +1 -1
  622. package/dist/utils/optional-backend.js +22 -33
  623. package/dist/utils/optional-backend.js.map +1 -1
  624. package/dist/utils/output.d.ts +5 -43
  625. package/dist/utils/output.d.ts.map +1 -1
  626. package/dist/utils/output.js +8 -63
  627. package/dist/utils/output.js.map +1 -1
  628. package/dist/utils/package-json.d.ts +3 -4
  629. package/dist/utils/package-json.d.ts.map +1 -1
  630. package/dist/utils/package-json.js +8 -8
  631. package/dist/utils/package-json.js.map +1 -1
  632. package/dist/utils/population-wiring.d.ts +31 -38
  633. package/dist/utils/population-wiring.d.ts.map +1 -1
  634. package/dist/utils/population-wiring.js +38 -32
  635. package/dist/utils/population-wiring.js.map +1 -1
  636. package/dist/utils/project-root-policy.d.ts +74 -1
  637. package/dist/utils/project-root-policy.d.ts.map +1 -1
  638. package/dist/utils/project-root-policy.js +146 -8
  639. package/dist/utils/project-root-policy.js.map +1 -1
  640. package/dist/utils/projection-lenses.d.ts +25 -7
  641. package/dist/utils/projection-lenses.d.ts.map +1 -1
  642. package/dist/utils/projection-lenses.js +20 -6
  643. package/dist/utils/projection-lenses.js.map +1 -1
  644. package/dist/utils/projection-query.d.ts +17 -10
  645. package/dist/utils/projection-query.d.ts.map +1 -1
  646. package/dist/utils/projection-query.js +47 -28
  647. package/dist/utils/projection-query.js.map +1 -1
  648. package/dist/utils/projection-store.d.ts +2 -2
  649. package/dist/utils/projection-store.d.ts.map +1 -1
  650. package/dist/utils/projection-store.js +74 -45
  651. package/dist/utils/projection-store.js.map +1 -1
  652. package/dist/utils/rag-database.d.ts +61 -0
  653. package/dist/utils/rag-database.d.ts.map +1 -0
  654. package/dist/utils/rag-database.js +178 -0
  655. package/dist/utils/rag-database.js.map +1 -0
  656. package/dist/utils/relation-limits.d.ts +7 -2
  657. package/dist/utils/relation-limits.d.ts.map +1 -1
  658. package/dist/utils/relation-limits.js +6 -1
  659. package/dist/utils/relation-limits.js.map +1 -1
  660. package/dist/utils/relativize-paths.d.ts +23 -0
  661. package/dist/utils/relativize-paths.d.ts.map +1 -1
  662. package/dist/utils/relativize-paths.js +32 -1
  663. package/dist/utils/relativize-paths.js.map +1 -1
  664. package/dist/utils/resource-loader.d.ts +76 -32
  665. package/dist/utils/resource-loader.d.ts.map +1 -1
  666. package/dist/utils/resource-loader.js +132 -66
  667. package/dist/utils/resource-loader.js.map +1 -1
  668. package/dist/utils/run-integrity.d.ts +64 -31
  669. package/dist/utils/run-integrity.d.ts.map +1 -1
  670. package/dist/utils/run-integrity.js +76 -35
  671. package/dist/utils/run-integrity.js.map +1 -1
  672. package/dist/utils/scope-locations.d.ts +7 -5
  673. package/dist/utils/scope-locations.d.ts.map +1 -1
  674. package/dist/utils/scope-locations.js +37 -12
  675. package/dist/utils/scope-locations.js.map +1 -1
  676. package/dist/utils/staging-dir.d.ts +7 -0
  677. package/dist/utils/staging-dir.d.ts.map +1 -0
  678. package/dist/utils/staging-dir.js +12 -0
  679. package/dist/utils/staging-dir.js.map +1 -0
  680. package/dist/utils/url-redact.d.ts +9 -0
  681. package/dist/utils/url-redact.d.ts.map +1 -1
  682. package/dist/utils/url-redact.js +13 -0
  683. package/dist/utils/url-redact.js.map +1 -1
  684. package/dist/utils/user-context-scanner.d.ts +3 -2
  685. package/dist/utils/user-context-scanner.d.ts.map +1 -1
  686. package/dist/utils/user-context-scanner.js +24 -4
  687. package/dist/utils/user-context-scanner.js.map +1 -1
  688. package/dist/utils/validate-help-files.d.ts.map +1 -1
  689. package/dist/utils/validate-help-files.js +8 -14
  690. package/dist/utils/validate-help-files.js.map +1 -1
  691. package/dist/utils/vat-bin-path.d.ts.map +1 -1
  692. package/dist/utils/vat-bin-path.js +3 -3
  693. package/dist/utils/vat-bin-path.js.map +1 -1
  694. package/dist/utils/verdict-helpers.d.ts.map +1 -1
  695. package/dist/utils/verdict-helpers.js +5 -5
  696. package/dist/utils/verdict-helpers.js.map +1 -1
  697. package/docs/agent.md +347 -2
  698. package/docs/audit.md +312 -89
  699. package/docs/doctor.md +65 -19
  700. package/docs/index.md +571 -20
  701. package/docs/mcp.md +64 -12
  702. package/docs/rag.md +176 -48
  703. package/docs/resources.md +257 -71
  704. package/docs/skill-test.md +148 -19
  705. package/docs/skills.md +459 -174
  706. package/package.json +16 -19
  707. package/schemas/agent-build.json +268 -0
  708. package/schemas/agent-import.json +252 -0
  709. package/schemas/agent-install.json +260 -0
  710. package/schemas/agent-installed.json +287 -0
  711. package/schemas/agent-list.json +279 -0
  712. package/schemas/agent-uninstall.json +260 -0
  713. package/schemas/agent-validate.json +279 -0
  714. package/schemas/ard-emit.json +224 -106
  715. package/schemas/audit-settings.json +472 -0
  716. package/schemas/audit.json +635 -0
  717. package/schemas/cache-clear.json +273 -0
  718. package/schemas/claude-marketplace-publish.json +286 -0
  719. package/schemas/claude-marketplace-validate.json +352 -0
  720. package/schemas/claude-org-not-implemented.json +239 -0
  721. package/schemas/claude-plugin-build.json +446 -0
  722. package/schemas/claude-plugin-install.json +291 -0
  723. package/schemas/claude-plugin-list.json +326 -0
  724. package/schemas/claude-plugin-uninstall.json +272 -0
  725. package/schemas/corpus-audit.json +635 -0
  726. package/schemas/corpus-scan.json +293 -0
  727. package/schemas/doctor.json +299 -0
  728. package/schemas/inventory.json +982 -0
  729. package/schemas/mcp-list-collections.json +268 -0
  730. package/schemas/okf-validate.json +224 -106
  731. package/schemas/orchestrator.json +299 -0
  732. package/schemas/rag-clear.json +253 -0
  733. package/schemas/rag-index.json +273 -0
  734. package/schemas/rag-query.json +365 -0
  735. package/schemas/rag-stats.json +269 -0
  736. package/schemas/resources-check.json +242 -108
  737. package/schemas/resources-query.json +333 -0
  738. package/schemas/resources-scan.json +321 -0
  739. package/schemas/resources-validate.json +332 -0
  740. package/schemas/skill-review.json +224 -106
  741. package/schemas/skill-test-configure.json +256 -0
  742. package/schemas/skill-test-run.json +296 -0
  743. package/schemas/skills-build.json +325 -0
  744. package/schemas/skills-install.json +287 -0
  745. package/schemas/skills-list.json +283 -0
  746. package/schemas/skills-package.json +270 -0
  747. package/schemas/skills-validate.json +285 -0
  748. package/dist/commands/skills/shared.d.ts +0 -29
  749. package/dist/commands/skills/shared.d.ts.map +0 -1
  750. package/dist/commands/skills/shared.js +0 -33
  751. package/dist/commands/skills/shared.js.map +0 -1
  752. package/dist/utils/command-error.d.ts +0 -194
  753. package/dist/utils/command-error.d.ts.map +0 -1
  754. package/dist/utils/command-error.js +0 -237
  755. package/dist/utils/command-error.js.map +0 -1
@@ -29,114 +29,22 @@
29
29
  * a runtime optimizer to schedule between.
30
30
  */
31
31
  import { performance } from 'node:perf_hooks';
32
- import { bindBuiltinChecks, BUILTIN_CHECK_NAMES, issuesFromCheckRows, LIMIT_DIRECTIONS, } from '@vibe-agent-toolkit/resources';
33
- import { buildReport, CUSTOM_CHECK_CODE_PREFIX, exitCodeForReport, exitCodeOfChild, isCustomCheckCode, reportSchema, toFindings, } from '@vibe-agent-toolkit/schema';
32
+ import { bindBuiltinChecks, BUILTIN_CHECK_NAMES, issuesFromCheckRows, } from '@vibe-agent-toolkit/resources';
33
+ import { buildErrorReport, buildReport, CUSTOM_CHECK_CODE_PREFIX, isCustomCheckCode, toFindings, withAddedFindings, } from '@vibe-agent-toolkit/schema';
34
34
  import { safePath } from '@vibe-agent-toolkit/utils';
35
- import { z } from 'zod';
36
- import { handleReportCommandError } from '../../utils/command-error.js';
35
+ import { CommandRefusalError, refusalCodeOf } from '../../utils/command-refusal.js';
37
36
  import { loadConfigCached } from '../../utils/config-loader.js';
37
+ import { endWithForwardedDocument, endWithRefusal, endWithReport, leftoverIssueOf, NOTHING_FINISHED, } from '../../utils/document-writer.js';
38
38
  import { formatDurationSecs } from '../../utils/duration.js';
39
39
  import { resolveIssueSeverity } from '../../utils/issue-severity.js';
40
40
  import { createLogger } from '../../utils/logger.js';
41
- import { writeStdoutSync, writeStructuredOutput } from '../../utils/output.js';
41
+ import { EVERY_NOTICE, withNoticeAudience } from '../../utils/operator-notices.js';
42
42
  import { assertDirectoryArgument, projectRootOrLoudCwd, projectRootOrNull } from '../../utils/project-root-policy.js';
43
43
  import { withQueriedProjection, } from '../../utils/projection-query.js';
44
44
  import { relationBoundsFor } from '../../utils/relation-limits.js';
45
- import { nothingCheckedFinding, runIntegrityFinding } from '../../utils/run-integrity.js';
46
- import { createProgressWriter, parseProgressLog, unitInFlight, } from './check-progress.js';
47
- import { parseBudgetSeconds, requireSupervisableFlags, runsInThisProcess, superviseCheck, withProgressLog, } from './check-supervisor.js';
48
- /** What one rule cost, as the document publishes it. */
49
- const PublishedCheckCostSchema = z.object({
50
- name: z.string(),
51
- /** Three significant figures, so a 0.4 ms rule serializes as 0.0004 rather than a zero that reads as "not measured". */
52
- durationSecs: z.number().nonnegative(),
53
- /** Rows the statement returned. ABSENT, never 0, when the statement did not complete. */
54
- rows: z.number().int().nonnegative().optional(),
55
- broken: z.literal(true).optional(),
56
- /** Present and `true` only for a rule VAT supplied — see {@link CheckCost.builtin}. */
57
- builtin: z.literal(true).optional(),
58
- }).strict();
59
- /**
60
- * The published copy of {@link relationBoundsFor}'s answer.
61
- *
62
- * The registry lists are `readonly` and this document is handed to a serializer,
63
- * so the arrays are copied rather than referenced — the same rule
64
- * `lensesEvaluated` follows one field above: a published document owns no
65
- * reference into the run's own state.
66
- *
67
- * @param lensesEvaluated - The lenses this run evaluated
68
- * @returns The bounds keys to spread, or nothing
69
- */
70
- function structuredBounds(lensesEvaluated) {
71
- const bounds = relationBoundsFor(lensesEvaluated);
72
- if (bounds.boundsStatement === undefined || bounds.limits === undefined)
73
- return {};
74
- return { boundsStatement: bounds.boundsStatement, limits: bounds.limits.map((limit) => ({ ...limit })) };
75
- }
76
- /**
77
- * A signed bound on what the derived rows settle, as `@vibe-agent-toolkit/resources`
78
- * states it.
79
- *
80
- * ⛔ The direction vocabulary is IMPORTED, never respelled: `LIMIT_DIRECTIONS`
81
- * is the one list, tied to `StatedLimit['direction']` by `satisfies`, so a
82
- * fifth direction cannot leave this schema quietly rejecting it.
83
- */
84
- const StatedLimitSchema = z.object({
85
- id: z.string(),
86
- direction: z.enum(LIMIT_DIRECTIONS),
87
- statement: z.string(),
88
- }).strict();
89
- /**
90
- * What the check run reports beyond its findings.
91
- *
92
- * The envelope's `examined` is `membersEnumerated` — what the rules ran
93
- * AGAINST. `checksRun` is the other denominator, the number of RULES, and both
94
- * are needed: zero findings is the pass condition and either number at zero
95
- * makes that pass vacuous.
96
- */
97
- export const CheckDataSchema = z.object({
98
- root: z.string(),
99
- /**
100
- * Whether the projection was derived this run or read from the store.
101
- *
102
- * 🔑 `null` — together with `populationSecs`, `lensSecs` and
103
- * `lensesEvaluated` — exactly when the run was interrupted before its
104
- * population completed. There was no projection, so there is no origin, cost
105
- * or lens set to report, and a `RESOURCE_CHECK_BROKEN` finding says why.
106
- */
107
- population: z.enum(['derived', 'store']).nullable(),
108
- /** What the population cost — charged to no check, see `CheckCost`. Null as `population` is. */
109
- populationSecs: z.number().nonnegative().nullable(),
110
- /** What evaluating the lenses cost, paid before the first statement ran. Null as `population` is. */
111
- lensSecs: z.number().nonnegative().nullable(),
112
- /**
113
- * Which lenses that covers — the derived relations this run's checks could
114
- * actually read. 🔑 An empty list says "no check asked for a derived relation"
115
- * rather than "a lens stopped running"; without it `lensSecs: 0` is the same
116
- * document either way, and a gate whose rules silently read empty relations is
117
- * a gate that cannot fail. Null as `population` is — `[]` would claim "no
118
- * check asked", about a run that never got far enough to ask.
119
- */
120
- lensesEvaluated: z.array(z.string()).nullable(),
121
- /**
122
- * The prose frame {@link CheckDataSchema.limits} is read under. Present
123
- * exactly when a lens with stated bounds was evaluated.
124
- */
125
- boundsStatement: z.string().optional(),
126
- /**
127
- * What the derived rows this run could read do NOT settle — signed and
128
- * directional, the same list `vat claude context` publishes beside its own
129
- * answer. Absent when no bounded lens ran: an empty list would claim nothing
130
- * bounds the answer, which is stronger than "the answer holds no such row".
131
- */
132
- limits: z.array(StatedLimitSchema).optional(),
133
- /** The number of rules that EXECUTED. Derived from `checks`, never carried beside it. */
134
- checksRun: z.number().int().nonnegative(),
135
- /** What each rule cost, directly under the denominator it is the breakdown of. */
136
- checks: z.array(PublishedCheckCostSchema),
137
- }).strict();
138
- /** The document this command publishes. */
139
- export const CHECK_REPORT_SCHEMA = reportSchema(CheckDataSchema);
45
+ import { RUN_INTEGRITY_CODE, runIntegrityFinding } from '../../utils/run-integrity.js';
46
+ import { createProgressWriter, endWhenSupervisorGone, letSupervisorLossSurface, parseProgressLog, unitInFlight, } from './check-progress.js';
47
+ import { DEFAULT_BUDGET_SECONDS, parseBudgetSeconds, requireSupervisableFlags, runsInThisProcess, SUPERVISED_BY_FLAG, superviseCheck, supervisedByValue, withProgressLog, } from './check-supervisor.js';
140
48
  /**
141
49
  * The refusal for a run in which NO check executed.
142
50
  *
@@ -164,10 +72,10 @@ export const CHECK_REPORT_SCHEMA = reportSchema(CheckDataSchema);
164
72
  * having to remember it. It also lands after `resolveIssueSeverity`, which is
165
73
  * belt and braces: the code is already unreachable from a `severity` key.
166
74
  *
167
- * The mechanism — ask the DENOMINATOR never the config, one report per
168
- * situation, stand down behind an existing run-integrity finding — is the shared
169
- * {@link nothingCheckedFinding}; this wrapper owns only the message. The
170
- * stand-down matters here for an interrupted run, which recovers zero costs when
75
+ * The writer refuses a run that examined no RESOURCE; this is the other
76
+ * denominator, CHECKS, which only this verb knows — so it asks that count,
77
+ * never the config, and stands down behind an existing run-integrity finding
78
+ * (one report per situation). The stand-down matters here for an interrupted run, which recovers zero costs when
171
79
  * the kill landed before the first statement finished and already carries
172
80
  * {@link interruptedRunFinding}, the more specific of the two claims. A `--check`
173
81
  * filter that matched nothing is refused earlier by {@link requireKnownCheck},
@@ -185,13 +93,15 @@ export const CHECK_REPORT_SCHEMA = reportSchema(CheckDataSchema);
185
93
  * @returns The finding, or nothing when at least one check ran
186
94
  */
187
95
  function noCheckRanFinding(costs, issues) {
188
- return nothingCheckedFinding(costs.length, issues, () => 'No check ran at all, so this document is not a verdict: a gate that checked nothing'
189
- + ' produces the same report as a gate that was removed, and this run cannot tell'
190
- + ' you which happened.'
191
- + ' This is not an absent `resources.checks` block — VAT\'s own built-in checks run'
192
- + ' whether or not a project declares any, so reaching zero means not even those'
193
- + ' executed. Re-run with --debug and report it; if the run was filtered, check that'
194
- + ' --check named a rule this build still ships.');
96
+ if (costs.length > 0 || issues.some((issue) => issue.code === RUN_INTEGRITY_CODE))
97
+ return [];
98
+ return [runIntegrityFinding('No check ran at all, so this document is not a verdict: a gate that checked nothing'
99
+ + ' produces the same report as a gate that was removed, and this run cannot tell'
100
+ + ' you which happened.'
101
+ + ' This is not an absent `resources.checks` block — VAT\'s own built-in checks run'
102
+ + ' whether or not a project declares any, so reaching zero means not even those'
103
+ + ' executed. Re-run with --debug and report it; if the run was filtered, check that'
104
+ + ' --check named a rule this build still ships.')];
195
105
  }
196
106
  /**
197
107
  * Build the check report.
@@ -241,6 +151,8 @@ export function buildCheckOutputData(input) {
241
151
  const issues = [...noCheckRanFinding(input.costs, input.issues), ...input.issues];
242
152
  const { populated } = input;
243
153
  const report = buildReport({
154
+ // `vat resources check` offers no `--strict`: warnings never fail it.
155
+ gate: { strict: false },
244
156
  // The OTHER denominator, and the one whose absence shipped a green gate over
245
157
  // an empty repository. `checksRun` counts rules; this counts what they ran
246
158
  // against. 🔑 0 for a run with no population is not a placeholder: nothing
@@ -282,21 +194,24 @@ export function buildCheckOutputData(input) {
282
194
  * The error branch of the envelope, for a run that never had a population.
283
195
  *
284
196
  * `status: error`, nothing in `findings`, zero `summary`, and the reason in
285
- * `error` — the shape `buildErrorReport` gives every other run that could not
286
- * do its job — but `data` is KEPT: it names the root and says, with `null`,
287
- * that there was no projection, which is more than `data: null` could.
197
+ * `error` under the registered refusal `RUN_INCOMPLETE` — the run started and
198
+ * stopped before its population completed — and `data` is KEPT: it names the
199
+ * root and says, with `null`, that there was no projection, which is more than
200
+ * `data: null` could. No `durationMs`: no refusal document carries one.
288
201
  *
289
202
  * @param report - The document as the findings would have built it
290
203
  * @returns The same document on the error branch
291
204
  */
292
205
  function couldNotRun(report) {
293
- return {
294
- ...report,
295
- status: 'error',
296
- error: report.findings.map((finding) => finding.message).join('\n'),
206
+ // The one construction of the error branch — the same `buildErrorReport`
207
+ // every refusal the writer publishes goes through.
208
+ return buildErrorReport({
209
+ error: { code: 'RUN_INCOMPLETE', message: report.findings.map((finding) => finding.message).join('\n') },
210
+ gate: report.gate,
211
+ examined: report.examined,
297
212
  findings: [],
298
- summary: { errors: 0, warnings: 0, info: 0 },
299
- };
213
+ data: report.data,
214
+ });
300
215
  }
301
216
  /**
302
217
  * The document's population fields — all present, or all `null`.
@@ -306,7 +221,7 @@ function couldNotRun(report) {
306
221
  */
307
222
  function populationData(populated) {
308
223
  if (populated === null) {
309
- return { population: null, populationSecs: null, lensSecs: null, lensesEvaluated: null };
224
+ return { population: null, populationSecs: null, lensSecs: null, lensesEvaluated: null, lensPopulation: null };
310
225
  }
311
226
  return {
312
227
  population: populated.population,
@@ -323,12 +238,14 @@ function populationData(populated) {
323
238
  // into a plain array so the published document owns no reference into the
324
239
  // run's own state.
325
240
  lensesEvaluated: [...populated.lensesEvaluated],
241
+ // Where those lenses' own populations came from — see `CheckDataSchema.lensPopulation`.
242
+ lensPopulation: populated.lensPopulation,
326
243
  // The bounds of the rows those lenses produced, stated ONCE and only when
327
244
  // a bounded lens ran. This is the verb an adopter makes GATE, so it is the
328
245
  // one that most owes them — `utils/relation-limits.ts` carries why.
329
246
  // Copied out of the readonly registry lists: the published document owns
330
247
  // no reference into module state a later render could mutate.
331
- ...structuredBounds(populated.lensesEvaluated),
248
+ ...relationBoundsFor(populated.lensesEvaluated),
332
249
  };
333
250
  }
334
251
  /**
@@ -557,7 +474,7 @@ export function requireKnownCheck(builtinNames, checks, only) {
557
474
  if (only === undefined || builtinNames.includes(only) || Object.hasOwn(checks, only))
558
475
  return;
559
476
  const declared = Object.keys(checks);
560
- throw new Error(`No check named "${only}" exists. `
477
+ throw new CommandRefusalError('USAGE_INVALID', `No check named "${only}" exists. `
561
478
  + `Built in: ${builtinNames.join(', ')}. `
562
479
  + (declared.length === 0
563
480
  ? 'This project declares none of its own — add them under `resources.checks` in'
@@ -631,10 +548,10 @@ export function warnUndeclaredOverrides(checks, validation, logger) {
631
548
  * nothing all produce it — and because population DECLINES ignored members
632
549
  * rather than flagging them, the tables carry no trace of the difference.
633
550
  *
634
- * The precedent is `population-wiring.ts`, which makes `onBlobPopulation`
635
- * mandatory because "a tree whose every document was declined as binary
636
- * otherwise populates as empty and reports success". That guard covers blob
637
- * refusals only; this one covers the extent.
551
+ * The precedent is `populateAndReport` in `population-wiring.ts`, which names
552
+ * a tree whose every document was declined as binary rather than letting it
553
+ * populate as empty and report success. That report covers blob refusals only;
554
+ * this guard covers the extent.
638
555
  *
639
556
  * 🪤 **Only when checks actually RAN.** A run with no rules at all is refused
640
557
  * too — it is the same class one level further out — but by
@@ -664,6 +581,28 @@ function emptyCorpusFinding(checksRun, membersEnumerated) {
664
581
  + ' `root` in this report is the directory you meant.'
665
582
  + ' `vat resources scan` over the same path lists what an enumeration finds.')];
666
583
  }
584
+ /**
585
+ * How to give the run more time, as one sentence — by who ran the checks.
586
+ *
587
+ * 🔑 A kill remedy names a flag only the verb that accepts it can be given. `--budget` is
588
+ * `vat resources check`'s alone, and in this release `vat validate` has NO way to give its checks
589
+ * phase more time: the phase always runs under {@link DEFAULT_BUDGET_SECONDS}. So the phase's
590
+ * sentence says exactly that — what the bound measures, its value, and that running the checks
591
+ * standalone with a larger `--budget` lets THEM pass but does not make `vat validate` pass. A
592
+ * remedy promising otherwise sends the operator round a loop that cannot end.
593
+ *
594
+ * @param invocation - Who ran the checks
595
+ * @returns The sentence, with a leading space
596
+ */
597
+ function raiseBoundSentence(invocation) {
598
+ return invocation === 'standalone'
599
+ ? ' Raise it with `--budget <seconds>`.'
600
+ : ' `vat validate` cannot give it more time: its checks phase always runs under the default'
601
+ + ` bound of ${DEFAULT_BUDGET_SECONDS}s WITHOUT PROGRESS (a total bound on the population,`
602
+ + ' which reports progress only when it finishes), and this release has no way to change'
603
+ + ' it. Running the same checks on their own with `vat resources check --budget <seconds>`'
604
+ + ' can let them pass there, but `vat validate` will still fail on this tree.';
605
+ }
667
606
  /**
668
607
  * Where the run was when it stopped, as a phrase.
669
608
  *
@@ -693,6 +632,8 @@ function inFlightPhrase(inFlight) {
693
632
  return 'while no check was running — either between the population and the first'
694
633
  + ' statement, or after the last one had filed its cost';
695
634
  }
635
+ /** The supervisor's kind for a child whose exit contradicts its own complete document. */
636
+ const EXIT_DISAGREES = 'exit-disagrees';
696
637
  /**
697
638
  * What ended the child, as a phrase.
698
639
  *
@@ -706,12 +647,21 @@ function deathPhrase(death) {
706
647
  return `the child process could not be started at all (${death.binary}: ${death.detail})`;
707
648
  }
708
649
  if (death.kind === 'kill-failed') {
709
- return 'the budget was blown and the SIGKILL that should have ended the run was REFUSED'
710
- + ` (${death.detail})`;
650
+ return death.refused
651
+ ? `the budget was blown and the SIGKILL that should have ended the run was REFUSED (${death.detail})`
652
+ : `the budget was blown and the SIGKILL that should have ended the run DID NOT END IT (${death.detail})`;
711
653
  }
712
654
  if (death.kind === 'no-output') {
713
655
  return `the child process exited ${death.code} and published no report at all`;
714
656
  }
657
+ if (death.kind === 'unparseable-output') {
658
+ return `the child process exited ${death.code} and published a report that is not this`
659
+ + ` command's document, most likely cut off mid-write (${death.detail})`;
660
+ }
661
+ if (death.kind === EXIT_DISAGREES) {
662
+ return `the child process published a complete report whose own verdict is exit ${death.documentExit},`
663
+ + ` and then exited ${death.code}`;
664
+ }
715
665
  return 'the child process ended with neither an exit code nor a signal';
716
666
  }
717
667
  /**
@@ -737,21 +687,25 @@ function spawnFailedRemedy(detail) {
737
687
  + ' anything about the SQL.';
738
688
  }
739
689
  /**
740
- * What to do about a kill the kernel refused.
690
+ * What to do about a kill that did not end the child — refused, or accepted and ineffective.
741
691
  *
742
692
  * ⛔ This must never be composed from the spawn-failure sentence, however
743
693
  * similar the plumbing is. The two are opposites: one child never existed, and
744
694
  * this one is, as far as this process can tell, STILL RUNNING.
745
695
  *
746
- * @param death - The refused kill, and the pid it left behind
696
+ * @param death - The kill that failed, and the pid it left behind
747
697
  * @returns The remedy sentence
748
698
  */
749
- function killFailedRemedy(detail, pid) {
750
- const handle = pid === undefined
699
+ function killFailedRemedy(death) {
700
+ const handle = death.pid === undefined
751
701
  ? ' The child\'s pid is not known to this process.'
752
- : ` The child was process ${pid}.`;
702
+ : ` The child was process ${death.pid}.`;
703
+ const how = death.refused
704
+ ? ` SIGKILL and the kernel would not deliver it (${death.detail}), which normally means EPERM.`
705
+ : ` SIGKILL, the kernel accepted it, and the process still did not end (${death.detail}) —`
706
+ + ' which normally means it is stuck in uninterruptible I/O (a hung network mount, a wedged disk).';
753
707
  return ' The run started, ran past its budget, and then REFUSED TO DIE: the watchdog sent'
754
- + ` SIGKILL and the kernel would not deliver it (${detail}), which normally means EPERM.`
708
+ + how
755
709
  + handle
756
710
  + ' It may still be running and still holding whatever the statement was holding, so'
757
711
  + ' check for it and end it by hand before starting another run. Nothing about the SQL'
@@ -859,7 +813,7 @@ function noOutputRemedy(code) {
859
813
  + ' — surfaces as an exit code what macOS and Linux report as SIGABRT itself, and it is the'
860
814
  + ' same event.' + signalRemedy('SIGABRT');
861
815
  }
862
- return ` Exit ${code} is not Node's abort code, and the child published none of the document`
816
+ return ` Exit ${code} is not Node's abort code, and the child published no usable copy of the document`
863
817
  + ' every path through this command ends by writing — so this is either a termination from'
864
818
  + ' outside that left an exit code instead of a signal, or a defect in vat. The child\'s stderr'
865
819
  + ' was inherited, so whatever it managed to say is above this report; if there is nothing'
@@ -885,16 +839,33 @@ function noOutputRemedy(code) {
885
839
  */
886
840
  function deathRemedy(death) {
887
841
  if (death.kind === 'kill-failed')
888
- return killFailedRemedy(death.detail, death.pid);
842
+ return killFailedRemedy(death);
889
843
  if (death.kind === 'spawn-failed')
890
844
  return spawnFailedRemedy(death.detail) + WATCHDOG_UNINVOLVED;
891
845
  if (death.kind === 'signal')
892
846
  return signalRemedy(death.signal) + WATCHDOG_UNINVOLVED;
893
- if (death.kind === 'no-output')
847
+ if (death.kind === 'no-output' || death.kind === 'unparseable-output') {
894
848
  return noOutputRemedy(death.code) + WATCHDOG_UNINVOLVED;
849
+ }
850
+ if (death.kind === EXIT_DISAGREES)
851
+ return EXIT_DISAGREES_REMEDY + WATCHDOG_UNINVOLVED;
895
852
  return ' The cause is outside anything this command can observe; the child left no exit code'
896
853
  + ' to report.' + WATCHDOG_UNINVOLVED;
897
854
  }
855
+ /**
856
+ * Why a child whose exit disagrees with its own document is not forwarded, and where to look.
857
+ *
858
+ * ⚠️ It does not guess which of the two is true. Every path through this command ends on the code
859
+ * its document derives, so the disagreement is either something ending the child after it wrote
860
+ * (a crash in teardown, an external termination that left a code) or a defect in vat — and the
861
+ * report cannot tell them apart.
862
+ */
863
+ const EXIT_DISAGREES_REMEDY = ' Every path through this command ends on the exit code its own document derives, so the two'
864
+ + ' should never disagree: either something ended the child AFTER it wrote its report — a crash'
865
+ + ' during shutdown, or a termination from outside that left an exit code — or vat has a defect.'
866
+ + ' Which one cannot be told from here, so the report is withheld rather than forwarded as the'
867
+ + ' verdict. The child\'s stderr was inherited, so whatever it said is above this report; re-run'
868
+ + ' it, and if the disagreement repeats, report the exit code with the platform.';
898
869
  /**
899
870
  * The sentence that keeps an abnormal death from being blamed on the bound.
900
871
  *
@@ -952,12 +923,30 @@ function incompleteNotice(checksCompleted) {
952
923
  function interruptedRunFinding(inFlight, ending, checksCompleted) {
953
924
  const where = inFlightPhrase(inFlight);
954
925
  const message = ending.kind === 'budget'
955
- ? budgetKillMessage(inFlight, ending.budgetSecs, where)
956
- : `This run DIED before it finished: ${deathPhrase(ending.death)} ${where}, so the checks`
957
- + ' after it never executed and this document is not a verdict.'
958
- + deathRemedy(ending.death);
926
+ ? budgetKillMessage(inFlight, ending, where)
927
+ : deathMessage(ending.death, where);
959
928
  return runIntegrityFinding(message + incompleteNotice(checksCompleted));
960
929
  }
930
+ /**
931
+ * What an abnormal death means.
932
+ *
933
+ * 🪤 A child whose exit disagrees with its document did NOT die mid-run — it finished every check
934
+ * and wrote a whole report — so it gets its own sentence rather than "DIED before it finished …
935
+ * the checks after it never executed", which would be false about it.
936
+ *
937
+ * @param death - The ending the supervisor resolved
938
+ * @param where - The clause naming the unit, from {@link inFlightPhrase}
939
+ * @returns The message body
940
+ */
941
+ function deathMessage(death, where) {
942
+ if (death.kind === EXIT_DISAGREES) {
943
+ return `This run's exit contradicts its own report: ${deathPhrase(death)}, so neither can be`
944
+ + ' trusted as the verdict and this document replaces the report.' + deathRemedy(death);
945
+ }
946
+ return `This run DIED before it finished: ${deathPhrase(death)} ${where}, so the checks`
947
+ + ' after it never executed and this document is not a verdict.'
948
+ + deathRemedy(death);
949
+ }
961
950
  /**
962
951
  * What a WATCHDOG kill means, which depends entirely on what was in flight.
963
952
  *
@@ -975,17 +964,22 @@ function interruptedRunFinding(inFlight, ending, checksCompleted) {
975
964
  * issues takes ~17 s after `checks-complete` is filed, which is one budget
976
965
  * window on its own.
977
966
  *
967
+ * 🔑 Every remedy names the bound through {@link raiseBoundSentence}, so a phase is never told to
968
+ * pass a flag its own verb (`vat validate`) rejects, nor promised a way to raise its bound.
969
+ *
978
970
  * @param inFlight - What the log's last state says
979
- * @param budgetSecs - The bound that was blown
971
+ * @param ending - The kill: the bound that was blown, and who ran the checks
980
972
  * @param where - The clause naming the unit, from {@link inFlightPhrase}
981
973
  * @returns The message body
982
974
  */
983
- function budgetKillMessage(inFlight, budgetSecs, where) {
975
+ function budgetKillMessage(inFlight, ending, where) {
976
+ const { budgetSecs, invocation } = ending;
977
+ const raise = raiseBoundSentence(invocation);
984
978
  if (inFlight.kind === 'startup' || inFlight.kind === 'population') {
985
979
  return `This run made no progress for ${budgetSecs}s and was killed ${where}, so no`
986
980
  + ' check ran and this document is not a verdict. There is no projection, so the'
987
981
  + ' population fields in `data` are null and `examined` is 0.'
988
- + (inFlight.kind === 'startup' ? STARTUP_REMEDY : POPULATION_REMEDY);
982
+ + (inFlight.kind === 'startup' ? startupRemedy(raise) : populationRemedy(raise));
989
983
  }
990
984
  if (inFlight.kind === 'reporting') {
991
985
  return `This run made no progress for ${budgetSecs}s and was killed ${where}.`
@@ -994,15 +988,18 @@ function budgetKillMessage(inFlight, budgetSecs, where) {
994
988
  + ' being assembled, not a rule that would not return. Serialising a large result is'
995
989
  + ' linear in how much there is — 2,000,000 issues take about 17 seconds — so look at'
996
990
  + ' the rules under `checks` that produced the most rows and narrow them (a `LIMIT`, or'
997
- + ' one row per violation rather than one per member), or raise the bound with'
998
- + ' `--budget <seconds>` so the document has time to be written.';
991
+ + ' one row per violation rather than one per member), or give the document more time to'
992
+ + ` be written.${raise}`;
999
993
  }
1000
994
  return `This run made no progress for ${budgetSecs}s and was killed ${where}, so the`
1001
995
  + ' checks after it never executed and this document is not a verdict.'
1002
996
  + ' A statement that will not finish cannot be stopped from inside the process —'
1003
997
  + ' the query is synchronous and holds the event loop — so the bound is enforced by'
1004
- + ' killing the run. Raise it with `--budget <seconds>` if the work is legitimately'
1005
- + ' slow, or `--budget 0` to remove it (the run can then hang forever).';
998
+ + ' killing the run. If the work is legitimately slow, it needs more time.'
999
+ + raise
1000
+ + (invocation === 'standalone'
1001
+ ? ' `--budget 0` removes it (the run can then hang forever).'
1002
+ : '');
1006
1003
  }
1007
1004
  /**
1008
1005
  * What to do about a kill that landed before the child had BOOTED.
@@ -1011,22 +1008,32 @@ function budgetKillMessage(inFlight, budgetSecs, where) {
1011
1008
  * sizing the budget against the population would be advice about a unit that
1012
1009
  * never began. A boot that outlasts the budget is a saturated machine or a bound
1013
1010
  * too small to be one.
1011
+ *
1012
+ * @param raise - How to raise the bound, from {@link raiseBoundSentence}
1013
+ * @returns The remedy sentence
1014
1014
  */
1015
- const STARTUP_REMEDY = ' Node and vat were still loading, so neither your tree nor your SQL is implicated: a'
1016
- + ' boot that outlasts the bound means a heavily loaded machine or a bound far smaller than'
1017
- + ' any run can meet. Raise it with `--budget <seconds>`.';
1015
+ function startupRemedy(raise) {
1016
+ return ' Node and vat were still loading, so neither your tree nor your SQL is implicated: a'
1017
+ + ' boot that outlasts the bound means a heavily loaded machine or a bound far smaller than'
1018
+ + ` any run can meet.${raise}`;
1019
+ }
1018
1020
  /**
1019
1021
  * What to do about a kill that landed during the population.
1020
1022
  *
1021
1023
  * 🔑 The measured numbers are labelled as someone else's trees. An operator
1022
1024
  * given one number reads it as a promise about theirs.
1025
+ *
1026
+ * @param raise - How to raise the bound, from {@link raiseBoundSentence}
1027
+ * @returns The remedy sentence
1023
1028
  */
1024
- const POPULATION_REMEDY = ' Population is legitimately slow on a large tree, and it reports progress only when it'
1025
- + ' FINISHES, so the budget is a total bound for that one unit — raise it with'
1026
- + ' `--budget <seconds>` before assuming the crawl is stuck.'
1027
- + ' For scale, two MEASURED trees, neither of them yours: VAT\'s own repository is ~1.2s'
1028
- + ' warm and 33-35s with a cold parse cache; a 10,000-file adopter tree is ~5s warm and'
1029
- + ' 16.5s cold. Your tree is a third number.';
1029
+ function populationRemedy(raise) {
1030
+ return ' Population is legitimately slow on a large tree, and it reports progress only when it'
1031
+ + ' FINISHES, so the budget is a total bound for that one unit — a crawl that outlasts it is'
1032
+ + ` not necessarily stuck.${raise}`
1033
+ + ' For scale, two MEASURED trees, neither of them yours: VAT\'s own repository is ~1.2s'
1034
+ + ' warm and 33-35s with a cold parse cache; a 10,000-file adopter tree is ~5s warm and'
1035
+ + ' 16.5s cold. Your tree is a third number.';
1036
+ }
1030
1037
  /**
1031
1038
  * Rebuild the document from what an INTERRUPTED run left on disk.
1032
1039
  *
@@ -1079,6 +1086,7 @@ export function buildInterruptedCheckInput(options) {
1079
1086
  ? null
1080
1087
  : {
1081
1088
  population: population.population,
1089
+ lensPopulation: population.lensPopulation,
1082
1090
  populationMs: population.populationMs,
1083
1091
  lensMs: population.lensMs,
1084
1092
  lensesEvaluated: population.lensesEvaluated,
@@ -1168,42 +1176,43 @@ export function runProjectChecks(options) {
1168
1176
  costs,
1169
1177
  };
1170
1178
  }
1171
- /**
1172
- * Serialize the document in the format the operator asked for.
1173
- *
1174
- * Extracted because BOTH endings publish one — a completed run and a killed one
1175
- * — and two copies of a two-branch format switch is how one of them ends up
1176
- * ignoring `--format json`.
1177
- *
1178
- * @param payload - The document
1179
- * @param format - `json`, or anything else for YAML
1180
- */
1181
- function emitCheckDocument(payload, format) {
1182
- writeStructuredOutput(payload, format);
1183
- }
1184
1179
  /**
1185
1180
  * The child's argv — this very command, plus the hidden flag that stops it
1186
1181
  * spawning a child of its own.
1187
1182
  *
1188
- * 🚨 `--cost-log` is ALWAYS appended, and that is the recursion guard. Its
1183
+ * 🚨 `--supervised-by` is ALWAYS appended, and that is the recursion guard. Its
1189
1184
  * presence is the sole discriminator between "supervise a child" and "do the
1190
- * work"; a path that built these arguments without it would fork bomb.
1191
- *
1192
- * @param pathArg - The corpus root the operator named, or undefined
1193
- * @param options - What the operator passed
1185
+ * work"; a path that built these arguments without it would fork bomb. Its one
1186
+ * value carries who started the child (which decides the notices the child owes
1187
+ * the operator), this process's pid (which the child checks is its parent's) and
1188
+ * the progress log — see `supervisedByValue`.
1189
+ *
1190
+ * 🔑 The operand is the root the PARENT resolved, always. The child is spawned
1191
+ * with no `cwd`, so without it the child would resolve its own root from the
1192
+ * INHERITED working directory — which differs from the parent's root whenever
1193
+ * the operator named the project rather than standing in it: `vat resources
1194
+ * check <inner>` run from an outer project would check the outer tree and
1195
+ * report it as the inner one. (`vat validate` takes no operand and resolves its
1196
+ * root from the working directory the child inherits, so for it the operand
1197
+ * restates what the child would have found — it is passed so the phase cannot
1198
+ * depend on that coincidence.)
1199
+ *
1200
+ * @param root - The project root the parent resolved
1201
+ * @param request - What the child is asked to run, and in which format
1194
1202
  * @param logPath - The progress log both sides watch
1195
1203
  * @returns The child's arguments after the CLI entry point
1196
1204
  */
1197
- function childArgs(pathArg, options, logPath) {
1205
+ function childArgs(root, request, logPath) {
1198
1206
  return [
1199
1207
  'resources',
1200
1208
  'check',
1201
- ...(pathArg === undefined ? [] : [pathArg]),
1202
- ...(options.check === undefined ? [] : ['--check', options.check]),
1203
- ...(options.format === undefined ? [] : ['--format', options.format]),
1204
- ...(options.debug === true ? ['--debug'] : []),
1205
- '--cost-log',
1206
- logPath,
1209
+ root,
1210
+ ...(request.check === undefined ? [] : ['--check', request.check]),
1211
+ '--format',
1212
+ request.format,
1213
+ ...(request.debug ? ['--debug'] : []),
1214
+ SUPERVISED_BY_FLAG,
1215
+ supervisedByValue({ invoker: request.invocation, progressLog: logPath }),
1207
1216
  ];
1208
1217
  }
1209
1218
  /**
@@ -1216,26 +1225,23 @@ function childArgs(pathArg, options, logPath) {
1216
1225
  * which are all of them but one, that would accumulate.
1217
1226
  *
1218
1227
  * @param options - The run
1219
- * @param options.pathArg - The corpus root the operator named, or undefined
1220
- * @param options.options - What the operator passed
1228
+ * @param options.root - The project root the caller resolved. REQUIRED: the
1229
+ * child checks exactly this tree, and a killed run's document is labelled with it
1230
+ * @param options.request - What the child is asked to run, and who asked
1221
1231
  * @param options.budgetSecs - The bound, in seconds
1222
1232
  * @returns What to publish, and with what exit code
1223
1233
  */
1224
1234
  async function superviseCheckRun(options) {
1225
- const startDir = options.pathArg ?? process.cwd();
1226
- // 🪤 The SILENT resolution, deliberately. `projectRootOrLoudCwd` warns on
1227
- // stderr when there is no project ancestor, and the CHILD runs that policy for
1228
- // real — a parent that ran it too would print the same warning twice for one
1229
- // run. The parent needs a root only to label a KILLED run's document.
1230
- const root = projectRootOrNull(startDir) ?? safePath.resolve(startDir);
1231
- return withProgressLog(async (logPath) => {
1235
+ const { root, request } = options;
1236
+ const { value: ending, leftover } = await withProgressLog(async (log) => {
1232
1237
  const run = await superviseCheck({
1233
- args: childArgs(options.pathArg, options.options, logPath),
1234
- logPath,
1238
+ args: childArgs(root, request, log.path),
1239
+ log,
1235
1240
  budgetMs: options.budgetSecs * 1000,
1241
+ format: request.format,
1236
1242
  });
1237
1243
  if (run.outcome === 'completed')
1238
- return { forward: run.stdout, code: run.code };
1244
+ return { forward: run.document };
1239
1245
  return {
1240
1246
  payload: buildCheckOutputData(buildInterruptedCheckInput({
1241
1247
  entries: parseProgressLog(run.log),
@@ -1246,12 +1252,76 @@ async function superviseCheckRun(options) {
1246
1252
  // argument — so a child that aborted on its heap limit printed nothing
1247
1253
  // and exited 0, on precisely the runaway shape the bound exists for.
1248
1254
  ending: run.outcome === 'killed'
1249
- ? { kind: 'budget', budgetSecs: options.budgetSecs }
1255
+ ? { kind: 'budget', budgetSecs: options.budgetSecs, invocation: request.invocation }
1250
1256
  : { kind: 'abnormal', death: run.death },
1251
1257
  durationMs: run.elapsedMs,
1252
1258
  })),
1253
1259
  };
1254
1260
  });
1261
+ return withLeftover(ending, leftover);
1262
+ }
1263
+ /**
1264
+ * `ending` with the progress log's directory, when the OS would not remove it, as one
1265
+ * `TREE_CLEANUP_INCOMPLETE` warning beside the checks that ran. A forwarded document is then
1266
+ * published re-built rather than byte for byte: it gained a finding the child never knew of.
1267
+ */
1268
+ function withLeftover(ending, leftover) {
1269
+ if (leftover === undefined)
1270
+ return ending;
1271
+ const added = toFindings([leftoverIssueOf(leftover)]);
1272
+ // The child's document was validated against this verb's schema when it was read.
1273
+ const report = 'forward' in ending ? ending.forward.report : ending.payload;
1274
+ return { payload: withAddedFindings(report, added) };
1275
+ }
1276
+ /**
1277
+ * The `checks` phase of an orchestrator: the same supervised child `vat resources check` runs,
1278
+ * over the whole project, and its report is the phase's report.
1279
+ *
1280
+ * 🔑 **The report is the ending's own, in both arms** — the child's forwarded document, or the
1281
+ * document a killed or dead child's progress log rebuilt. There is no per-arm exit mapping: the
1282
+ * report's status already says what was in flight (findings with `RESOURCE_CHECK_BROKEN` once
1283
+ * the population was recorded, `error` before it), and the orchestrator derives the exit from it
1284
+ * as it does for every phase.
1285
+ *
1286
+ * @param options - The phase
1287
+ * @param options.root - The project root the orchestrator resolved. REQUIRED, so no caller can
1288
+ * fall back to the working directory and check a different project from the one it validated
1289
+ * @param options.debug - Whether the orchestrator was run with `--debug`, forwarded to the child
1290
+ * @returns The phase's report
1291
+ */
1292
+ export async function runResourcesCheckPhase(options) {
1293
+ const ending = await superviseCheckRun({
1294
+ root: options.root,
1295
+ request: { check: undefined, format: 'json', debug: options.debug, invocation: 'phase' },
1296
+ budgetSecs: DEFAULT_BUDGET_SECONDS,
1297
+ });
1298
+ return { report: 'forward' in ending ? ending.forward.report : ending.payload };
1299
+ }
1300
+ /**
1301
+ * Warn, on the invoked process's stderr, that the project declares no checks of its own.
1302
+ *
1303
+ * 🪤 Stderr only, and it decides NOTHING — the document is what the exit code is computed from
1304
+ * and what CI parses. ⚠️ It does not stand beside a refusal: the built-in set runs, so the run
1305
+ * DID assert something. What the operator needs to know is that the project is relying entirely
1306
+ * on VAT's defaults, which is what a deleted `checks:` block looks like.
1307
+ *
1308
+ * Printed only by the process the operator ran as `vat resources check` — never by a supervised
1309
+ * child (any `--supervised-by` process) and so never by an orchestrator's `checks` phase, where a
1310
+ * project with `resources:` and no `resources.checks` still runs the built-ins and "no checks of
1311
+ * its own" is not news on every run.
1312
+ *
1313
+ * @param checks - The project's declared checks, or undefined
1314
+ * @param logger - Where the warning goes
1315
+ */
1316
+ function warnWhenNoOwnChecks(checks, logger) {
1317
+ if (checks !== undefined && Object.keys(checks).length > 0)
1318
+ return;
1319
+ logger.warn(`No checks of this project's own are declared, so this run asserted only VAT's`
1320
+ + ` built-in set (${BUILTIN_CHECK_NAMES.join(', ')}).`
1321
+ + ' Add your own under `resources.checks` in vibe-agent-toolkit.config.yaml;'
1322
+ + ' each is a description plus one SQL statement selecting the rows that VIOLATE it.'
1323
+ + ' `vat resources check --help` prints the SQL each built-in is equivalent to,'
1324
+ + ' as a starting point.');
1255
1325
  }
1256
1326
  /**
1257
1327
  * Run the project's declared checks against its projection.
@@ -1264,11 +1334,14 @@ async function superviseCheckRun(options) {
1264
1334
  *
1265
1335
  * `query`'s author is at the keyboard, and Ctrl-C already works for them. It
1266
1336
  * works for one reason worth stating, because it is fragile: NO signal handler
1267
- * is installed anywhere on this path. A process blocked in synchronous
1337
+ * is installed in a process that runs the SQL. A process blocked in synchronous
1268
1338
  * `node:sqlite` dies instantly on SIGINT while that remains true, and SURVIVES
1269
1339
  * SIGINT and SIGTERM the moment a handler exists — the handler is a JS callback
1270
1340
  * and the event loop that would schedule it is the blocked resource. Adding one
1271
- * would take Ctrl-C away from `query` without adding anything to `check`.
1341
+ * would take Ctrl-C away from `query`, and from `check`'s child and its
1342
+ * `--budget 0` run. (`check`'s SUPERVISING process does install handlers while
1343
+ * it supervises — its event loop is free — only to take its child down with it;
1344
+ * see `check-supervisor.ts`.)
1272
1345
  *
1273
1346
  * `check` runs unattended in CI, where nobody is there to press it. So it gets a
1274
1347
  * bound enforced from outside itself, and a hang becomes a bounded failure
@@ -1289,99 +1362,163 @@ async function superviseCheckRun(options) {
1289
1362
  export async function checkCommand(pathArg, options) {
1290
1363
  const logger = createLogger({ debug: options.debug ?? false });
1291
1364
  const startTime = Date.now();
1365
+ // The two formats this verb offers (Commander refuses any other).
1366
+ const format = options.format === 'json' ? 'json' : 'yaml';
1292
1367
  try {
1293
1368
  if (pathArg !== undefined)
1294
1369
  assertDirectoryArgument(pathArg);
1295
1370
  const budgetSecs = parseBudgetSeconds(options.budget);
1296
1371
  // Before anything is spawned: a budget the fork below would silently ignore
1297
1372
  // is an operator error, not a bound.
1298
- requireSupervisableFlags({
1299
- costLog: options.costLog,
1373
+ const child = requireSupervisableFlags({
1374
+ supervisedBy: options.supervisedBy,
1300
1375
  budgetRaw: options.budget,
1301
1376
  budgetSecs,
1302
1377
  });
1303
- // The presence of `--cost-log` says "you ARE the child". `--budget 0` says
1378
+ // The process the operator ran — never a supervised child — says when the
1379
+ // project declares no checks of its own, and prints the config's warnings
1380
+ // with it. See {@link warnWhenNoOwnChecks}.
1381
+ const root = standaloneRoot(pathArg);
1382
+ if (child === undefined) {
1383
+ warnWhenNoOwnChecks(loadConfigCached(root, 'source')?.resources?.checks, logger);
1384
+ }
1385
+ // The presence of `--supervised-by` says "you ARE the child". `--budget 0` says
1304
1386
  // the operator declined the bound; both run the work here, and the second
1305
1387
  // can therefore hang forever, which its help text says.
1306
- if (!runsInThisProcess({ costLog: options.costLog, budgetSecs })) {
1307
- const ending = await superviseCheckRun({ pathArg, options, budgetSecs });
1308
- if ('forward' in ending) {
1309
- // Verbatim. The child already built the document the operator's
1310
- // `--format` asked for, and re-serializing it here would be a second
1311
- // place for that shape to live.
1312
- //
1313
- // ⚠️ `durationSecs` in it is therefore the CHILD's wall time and does
1314
- // not include this process's own startup and spawn (~0.15 s measured).
1315
- // Deliberate: the field is a breakdown that `populationSecs` and the
1316
- // per-rule costs have to reconcile against, and folding in a supervisor
1317
- // overhead none of them can account for would leave a remainder a
1318
- // reader would attribute to whichever rule they were looking at — the
1319
- // exact defect `CheckCost` documents.
1320
- writeStdoutSync(ending.forward);
1321
- // The child derived its code from its own document; a code off the
1322
- // contract is not a verdict it published and is not forwarded.
1323
- process.exit(exitCodeOfChild(ending.code));
1324
- }
1325
- emitCheckDocument(ending.payload, options.format);
1326
- // ⛔ Never OK, and never decided here. A run that did not finish carries a
1327
- // RUN_INTEGRITY finding (a check was in flight: exit 1) or is on the error
1328
- // branch (nothing was examined: exit 2) — the document says which, and
1329
- // the code is derived from it, as everywhere else.
1330
- process.exit(exitCodeForReport(ending.payload));
1331
- }
1332
- // 🔑 FIRST, before anything that touches the tree: the child has booted.
1333
- // The watchdog's clock started at the spawn, so without this line Node's
1334
- // startup and the CLI's import were charged to the population — the one
1335
- // unit the budget is already a total bound for. See `StartedEntrySchema`.
1336
- const onProgress = options.costLog === undefined
1337
- ? undefined
1338
- : createProgressWriter(options.costLog);
1339
- onProgress?.({ kind: 'started' });
1340
- const projectRoot = projectRootOrLoudCwd(pathArg ?? process.cwd(), logger);
1341
- const config = loadConfigCached(projectRoot);
1342
- const checks = config?.resources?.checks;
1343
- if (checks === undefined || Object.keys(checks).length === 0) {
1344
- // 🪤 Stderr only, and it decides NOTHING — the document is what the exit
1345
- // code is computed from and what CI parses. ⚠️ It does not stand beside a
1346
- // refusal: the built-in set runs here, so this run DID assert something.
1347
- // What the operator needs to know is that the project is relying entirely
1348
- // on VAT's defaults, which is what a deleted `checks:` block looks like.
1349
- logger.warn(`No checks of this project's own are declared, so this run asserted only VAT's`
1350
- + ` built-in set (${BUILTIN_CHECK_NAMES.join(', ')}).`
1351
- + ' Add your own under `resources.checks` in vibe-agent-toolkit.config.yaml;'
1352
- + ' each is a description plus one SQL statement selecting the rows that VIOLATE it.'
1353
- + ' `vat resources check --help` prints the SQL each built-in is equivalent to,'
1354
- + ' as a starting point.');
1388
+ const ending = runsInThisProcess({ supervisedBy: options.supervisedBy, budgetSecs })
1389
+ ? { payload: await withNoticeAudience(noticeAudienceOf(child), () => runChecksHere(pathArg, options, child, logger, startTime)) }
1390
+ : await superviseStandalone(root, options, format, budgetSecs);
1391
+ if ('forward' in ending) {
1392
+ // Verbatim (unless `withLeftover` had to add a finding to it) — the supervisor already checked it is
1393
+ // this verb's document — and on the code that document derives. The child already built what the operator's `--format` asked for, and
1394
+ // re-serializing it here would be a second place for that shape to live.
1395
+ //
1396
+ // ⚠️ `durationSecs` in it is therefore the CHILD's wall time and does
1397
+ // not include this process's own startup and spawn (~0.15 s measured).
1398
+ // Deliberate: the field is a breakdown that `populationSecs` and the
1399
+ // per-rule costs have to reconcile against, and folding in a supervisor
1400
+ // overhead none of them can account for would leave a remainder a
1401
+ // reader would attribute to whichever rule they were looking at — the
1402
+ // exact defect `CheckCost` documents.
1403
+ //
1404
+ // 🪤 `return` it, though its type is `never`: under a test's returning
1405
+ // exit spy a bare call would fall through to the second ending below.
1406
+ return endWithForwardedDocument(ending.forward);
1355
1407
  }
1356
- // Before the crawl: a mistyped flag is an operator error and pays nothing.
1357
- requireKnownCheck(BUILTIN_CHECK_NAMES, checks ?? {}, options.check);
1358
- // Also before the crawl, and for the same reason: an override that overrides
1359
- // nothing is knowable from the config alone, and the operator should read it
1360
- // beside the other config news rather than after a full population.
1361
- warnUndeclaredOverrides(checks ?? {}, config?.resources?.validation, logger);
1362
- const outcome = await runOutcome({
1363
- root: projectRoot,
1364
- checks: checks ?? {},
1365
- only: options.check,
1366
- logger,
1367
- validation: config?.resources?.validation,
1368
- onProgress,
1369
- });
1370
- const { issues, costs, ...populated } = outcome;
1371
- const payload = buildCheckOutputData({
1372
- issues,
1373
- costs,
1374
- populated,
1375
- root: projectRoot,
1376
- durationMs: Date.now() - startTime,
1377
- });
1378
- emitCheckDocument(payload, options.format);
1379
- process.exit(exitCodeForReport(payload));
1408
+ // A killed child is never OK and never decided here: its document carries
1409
+ // a RUN_INTEGRITY finding (exit 1) or the error branch (exit 2), and the
1410
+ // writer derives the code from it, as everywhere else.
1411
+ endWithReport('resources check', ending.payload, format);
1380
1412
  }
1381
1413
  catch (error) {
1382
- handleReportCommandError(error, logger, startTime, 'Check', options.format);
1414
+ // `vat resources check` offers no `--strict`: warnings never fail it.
1415
+ endWithRefusal('resources check', refusalCodeOf(error), error, format, { strict: false }, NOTHING_FINISHED);
1383
1416
  }
1384
1417
  }
1418
+ /**
1419
+ * Which notices the process running the checks prints.
1420
+ *
1421
+ * Any process that is not a supervised child prints every notice. A supervised child prints no
1422
+ * config warning — its invoking process loaded the same config and printed them — and prints the
1423
+ * store notice only when a standalone `vat resources check` started it: that supervisor opens no
1424
+ * store (keying one is a git snapshot, unbounded work it must not do before its watchdog exists),
1425
+ * while `vat validate` opened its store scope, and printed the notice, before any phase ran.
1426
+ *
1427
+ * @param child - The supervised child this process is, or undefined when it is not one
1428
+ * @returns The audience
1429
+ */
1430
+ function noticeAudienceOf(child) {
1431
+ if (child === undefined)
1432
+ return EVERY_NOTICE;
1433
+ return { config: false, store: child.invoker === 'standalone' };
1434
+ }
1435
+ /**
1436
+ * Supervise the checks child for a standalone `vat resources check`.
1437
+ *
1438
+ * 🔑 Nothing unbounded runs here before the spawn: no store is opened and no tree is snapshotted,
1439
+ * so the watchdog exists before any work that could hang. The store notice is the child's to print
1440
+ * (see {@link noticeAudienceOf}).
1441
+ *
1442
+ * @param root - The project root this process resolved, which the child checks
1443
+ * @param options - Parsed command-line options
1444
+ * @param format - The document format the operator asked for
1445
+ * @param budgetSecs - The bound, in seconds
1446
+ * @returns What to publish
1447
+ */
1448
+ function superviseStandalone(root, options, format, budgetSecs) {
1449
+ return superviseCheckRun({
1450
+ root,
1451
+ request: { check: options.check, format, debug: options.debug === true, invocation: 'standalone' },
1452
+ budgetSecs,
1453
+ });
1454
+ }
1455
+ /**
1456
+ * The project root a standalone `vat resources check` names, resolved SILENTLY.
1457
+ *
1458
+ * 🪤 Silent deliberately. `projectRootOrLoudCwd` warns on stderr when there is
1459
+ * no project ancestor, and the process that runs the checks (the child, or this
1460
+ * one under `--budget 0`) runs that policy for real — resolving loudly here too
1461
+ * would print the same warning twice for one run.
1462
+ *
1463
+ * @param pathArg - Where to look for the project, or omitted for the current directory
1464
+ * @returns The project root, or the resolved start directory when there is none
1465
+ */
1466
+ function standaloneRoot(pathArg) {
1467
+ const startDir = pathArg ?? process.cwd();
1468
+ return projectRootOrNull(startDir) ?? safePath.resolve(startDir);
1469
+ }
1470
+ /**
1471
+ * Run the checks in this process and build the document.
1472
+ *
1473
+ * @param pathArg - Where to look for the project, or omitted for the current directory
1474
+ * @param options - Parsed command-line options
1475
+ * @param child - The supervised child this process is (its progress log), or undefined
1476
+ * @param logger - Where warnings go
1477
+ * @param startTime - When the command started (from Date.now())
1478
+ * @returns The document
1479
+ */
1480
+ async function runChecksHere(pathArg, options, child, logger, startTime) {
1481
+ // 🔑 FIRST, before anything that touches the tree: the child has booted.
1482
+ // The watchdog's clock started at the spawn, so without this line Node's
1483
+ // startup and the CLI's import were charged to the population — the one
1484
+ // unit the budget is already a total bound for. See `StartedEntrySchema`.
1485
+ // And before that line: the child that outlives its supervisor ends itself — see
1486
+ // `endWhenSupervisorGone` for when that can and cannot be noticed.
1487
+ if (child !== undefined)
1488
+ endWhenSupervisorGone(child.supervisorPid, process.stdin);
1489
+ const onProgress = child === undefined
1490
+ ? undefined
1491
+ : createProgressWriter(child);
1492
+ onProgress?.({ kind: 'started' });
1493
+ const projectRoot = projectRootOrLoudCwd(pathArg ?? process.cwd(), logger);
1494
+ const config = loadConfigCached(projectRoot, 'source');
1495
+ const checks = config?.resources?.checks;
1496
+ // Before the crawl: a mistyped flag is an operator error and pays nothing.
1497
+ requireKnownCheck(BUILTIN_CHECK_NAMES, checks ?? {}, options.check);
1498
+ // Also before the crawl, and for the same reason: an override that overrides
1499
+ // nothing is knowable from the config alone, and the operator should read it
1500
+ // beside the other config news rather than after a full population.
1501
+ warnUndeclaredOverrides(checks ?? {}, config?.resources?.validation, logger);
1502
+ const outcome = await runOutcome({
1503
+ root: projectRoot,
1504
+ checks: checks ?? {},
1505
+ only: options.check,
1506
+ logger,
1507
+ validation: config?.resources?.validation,
1508
+ onProgress,
1509
+ });
1510
+ const { issues, costs, ...populated } = outcome;
1511
+ // The checks ran synchronously: a supervisor lost meanwhile ends this child HERE, unpublished.
1512
+ if (child !== undefined)
1513
+ await letSupervisorLossSurface();
1514
+ return buildCheckOutputData({
1515
+ issues,
1516
+ costs,
1517
+ populated,
1518
+ root: projectRoot,
1519
+ durationMs: Date.now() - startTime,
1520
+ });
1521
+ }
1385
1522
  /**
1386
1523
  * Populate once, run the checks, resolve their severities.
1387
1524
  *
@@ -1395,7 +1532,7 @@ export async function checkCommand(pathArg, options) {
1395
1532
  * outside this process, or undefined when nothing is watching
1396
1533
  * @returns The findings and the provenance of the population behind them
1397
1534
  */
1398
- async function runOutcome(options) {
1535
+ function runOutcome(options) {
1399
1536
  const { root, checks, only, logger, validation, onProgress } = options;
1400
1537
  // 🪤 **No `preflight` here, deliberately.** `withQueriedProjection` can compile
1401
1538
  // statements against the empty schema before populating — `vat resources query`
@@ -1423,6 +1560,7 @@ async function runOutcome(options) {
1423
1560
  onProgress?.({
1424
1561
  kind: 'population',
1425
1562
  population: provenance.population,
1563
+ lensPopulation: provenance.lensPopulation,
1426
1564
  populationMs: provenance.populationMs,
1427
1565
  lensMs: provenance.lensMs,
1428
1566
  lensesEvaluated: [...provenance.lensesEvaluated],
@@ -1449,4 +1587,6 @@ async function runOutcome(options) {
1449
1587
  return { ...ran, ...provenance, ...extent };
1450
1588
  });
1451
1589
  }
1590
+ /** The test-facing seam: helpers the unit tests reach that are not part of this module's API. */
1591
+ export const __internal = { noticeAudienceOf };
1452
1592
  //# sourceMappingURL=check.js.map