@vibe-agent-toolkit/cli 0.2.0-rc.10 → 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 +94 -40
  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 +94 -40
  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 +31 -63
  87. package/dist/commands/ard/emit.d.ts.map +1 -1
  88. package/dist/commands/ard/emit.js +124 -68
  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 +17 -10
  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 +415 -397
  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 +87 -2
  148. package/dist/commands/claude/context.d.ts.map +1 -1
  149. package/dist/commands/claude/context.js +116 -57
  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 +13 -10
  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 -145
  355. package/dist/commands/okf/validate.d.ts.map +1 -1
  356. package/dist/commands/okf/validate.js +63 -52
  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 +79 -13
  404. package/dist/commands/resources/check-progress.d.ts.map +1 -1
  405. package/dist/commands/resources/check-progress.js +112 -11
  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 +329 -71
  412. package/dist/commands/resources/check-supervisor.d.ts.map +1 -1
  413. package/dist/commands/resources/check-supervisor.js +507 -107
  414. package/dist/commands/resources/check-supervisor.js.map +1 -1
  415. package/dist/commands/resources/check.d.ts +88 -254
  416. package/dist/commands/resources/check.d.ts.map +1 -1
  417. package/dist/commands/resources/check.js +537 -310
  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 +189 -103
  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 +18 -13
  427. package/dist/commands/resources/query.d.ts.map +1 -1
  428. package/dist/commands/resources/query.js +61 -49
  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 -77
  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 -28
  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 +44 -5
  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 +18 -11
  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 +78 -32
  665. package/dist/utils/resource-loader.d.ts.map +1 -1
  666. package/dist/utils/resource-loader.js +134 -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 +17 -20
  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 +228 -107
  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 +280 -118
  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 -189
  753. package/dist/utils/command-error.d.ts.map +0 -1
  754. package/dist/utils/command-error.js +0 -230
  755. package/dist/utils/command-error.js.map +0 -1
@@ -29,106 +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, ExitCode, 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
- /** Whether the projection was derived this run or read from the store. */
100
- population: z.enum(['derived', 'store']),
101
- /** What the population cost — charged to no check, see `CheckCost`. */
102
- populationSecs: z.number().nonnegative(),
103
- /** What evaluating the lenses cost, paid before the first statement ran. */
104
- lensSecs: z.number().nonnegative(),
105
- /**
106
- * Which lenses that covers — the derived relations this run's checks could
107
- * actually read. 🔑 An empty list says "no check asked for a derived relation"
108
- * rather than "a lens stopped running"; without it `lensSecs: 0` is the same
109
- * document either way, and a gate whose rules silently read empty relations is
110
- * a gate that cannot fail.
111
- */
112
- lensesEvaluated: z.array(z.string()),
113
- /**
114
- * The prose frame {@link CheckDataSchema.limits} is read under. Present
115
- * exactly when a lens with stated bounds was evaluated.
116
- */
117
- boundsStatement: z.string().optional(),
118
- /**
119
- * What the derived rows this run could read do NOT settle — signed and
120
- * directional, the same list `vat claude context` publishes beside its own
121
- * answer. Absent when no bounded lens ran: an empty list would claim nothing
122
- * bounds the answer, which is stronger than "the answer holds no such row".
123
- */
124
- limits: z.array(StatedLimitSchema).optional(),
125
- /** The number of rules that EXECUTED. Derived from `checks`, never carried beside it. */
126
- checksRun: z.number().int().nonnegative(),
127
- /** What each rule cost, directly under the denominator it is the breakdown of. */
128
- checks: z.array(PublishedCheckCostSchema),
129
- }).strict();
130
- /** The document this command publishes. */
131
- 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';
132
48
  /**
133
49
  * The refusal for a run in which NO check executed.
134
50
  *
@@ -156,10 +72,10 @@ export const CHECK_REPORT_SCHEMA = reportSchema(CheckDataSchema);
156
72
  * having to remember it. It also lands after `resolveIssueSeverity`, which is
157
73
  * belt and braces: the code is already unreachable from a `severity` key.
158
74
  *
159
- * The mechanism — ask the DENOMINATOR never the config, one report per
160
- * situation, stand down behind an existing run-integrity finding — is the shared
161
- * {@link nothingCheckedFinding}; this wrapper owns only the message. The
162
- * 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
163
79
  * the kill landed before the first statement finished and already carries
164
80
  * {@link interruptedRunFinding}, the more specific of the two claims. A `--check`
165
81
  * filter that matched nothing is refused earlier by {@link requireKnownCheck},
@@ -177,13 +93,15 @@ export const CHECK_REPORT_SCHEMA = reportSchema(CheckDataSchema);
177
93
  * @returns The finding, or nothing when at least one check ran
178
94
  */
179
95
  function noCheckRanFinding(costs, issues) {
180
- return nothingCheckedFinding(costs.length, issues, () => 'No check ran at all, so this document is not a verdict: a gate that checked nothing'
181
- + ' produces the same report as a gate that was removed, and this run cannot tell'
182
- + ' you which happened.'
183
- + ' This is not an absent `resources.checks` block — VAT\'s own built-in checks run'
184
- + ' whether or not a project declares any, so reaching zero means not even those'
185
- + ' executed. Re-run with --debug and report it; if the run was filtered, check that'
186
- + ' --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.')];
187
105
  }
188
106
  /**
189
107
  * Build the check report.
@@ -208,6 +126,13 @@ function noCheckRanFinding(costs, issues) {
208
126
  * passes through, so deriving the refusal in it is what makes "checked nothing,
209
127
  * status clean" unrepresentable rather than merely unwritten.
210
128
  *
129
+ * 🔑 **A run with no population is `status: error`, and that is decided HERE.**
130
+ * Nothing was examined, so it is not a gate that failed (exit 1) but a command
131
+ * that could not do its job (exit 2) — the exit code follows from the document
132
+ * through `exitCodeForReport`, so no caller can publish one and exit the other.
133
+ * The document is still published, with the population fields `null`, and the
134
+ * reason moves from `findings` to `error` as the envelope's error branch requires.
135
+ *
211
136
  * 🪤 The findings are NOT run through `relativizePathEntries`. Every other
212
137
  * payload builder re-bases here because its producer keeps absolute paths
213
138
  * internally; these arrive project-relative instead, and re-basing an
@@ -224,35 +149,20 @@ function noCheckRanFinding(costs, issues) {
224
149
  */
225
150
  export function buildCheckOutputData(input) {
226
151
  const issues = [...noCheckRanFinding(input.costs, input.issues), ...input.issues];
227
- return buildReport({
152
+ const { populated } = input;
153
+ const report = buildReport({
154
+ // `vat resources check` offers no `--strict`: warnings never fail it.
155
+ gate: { strict: false },
228
156
  // The OTHER denominator, and the one whose absence shipped a green gate over
229
157
  // an empty repository. `checksRun` counts rules; this counts what they ran
230
- // against.
231
- examined: input.membersEnumerated,
158
+ // against. 🔑 0 for a run with no population is not a placeholder: nothing
159
+ // WAS examined, and the interrupted run's own finding says why.
160
+ examined: populated === null ? 0 : populated.membersEnumerated,
232
161
  findings: toFindings(issues),
233
162
  durationMs: input.durationMs,
234
163
  data: {
235
164
  root: input.root,
236
- population: input.population,
237
- // Beside the origin, because a `population: store` a reader cannot price is
238
- // a label taken on faith. Charged to no check — see {@link CheckCost}.
239
- populationSecs: formatDurationSecs(input.populationMs),
240
- // Published here too, and not only by `query`, because this verb pays it
241
- // identically — the lens is evaluated before the first statement runs. A
242
- // document that priced the population but not the lens would attribute the
243
- // lens's cost to whichever rule the reader happened to be looking at, which
244
- // is the same defect `populationSecs` exists to prevent.
245
- lensSecs: formatDurationSecs(input.lensMs),
246
- // What that number covers — see `CheckDataSchema.lensesEvaluated`. Copied
247
- // into a plain array so the published document owns no reference into the
248
- // run's own state.
249
- lensesEvaluated: [...input.lensesEvaluated],
250
- // The bounds of the rows those lenses produced, stated ONCE and only when
251
- // a bounded lens ran. This is the verb an adopter makes GATE, so it is the
252
- // one that most owes them — `utils/relation-limits.ts` carries why.
253
- // Copied out of the readonly registry lists: the published document owns
254
- // no reference into module state a later render could mutate.
255
- ...structuredBounds(input.lensesEvaluated),
165
+ ...populationData(populated),
256
166
  // The denominator of rules. Derived from `checks`, never carried beside it.
257
167
  checksRun: input.costs.length,
258
168
  // What each rule cost, directly under the denominator it is a breakdown
@@ -278,6 +188,65 @@ export function buildCheckOutputData(input) {
278
188
  })),
279
189
  },
280
190
  });
191
+ return populated === null ? couldNotRun(report) : report;
192
+ }
193
+ /**
194
+ * The error branch of the envelope, for a run that never had a population.
195
+ *
196
+ * `status: error`, nothing in `findings`, zero `summary`, and the reason in
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.
201
+ *
202
+ * @param report - The document as the findings would have built it
203
+ * @returns The same document on the error branch
204
+ */
205
+ function couldNotRun(report) {
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,
212
+ findings: [],
213
+ data: report.data,
214
+ });
215
+ }
216
+ /**
217
+ * The document's population fields — all present, or all `null`.
218
+ *
219
+ * @param populated - What the population reported, or null when it never completed
220
+ * @returns The fields to spread into `data`
221
+ */
222
+ function populationData(populated) {
223
+ if (populated === null) {
224
+ return { population: null, populationSecs: null, lensSecs: null, lensesEvaluated: null, lensPopulation: null };
225
+ }
226
+ return {
227
+ population: populated.population,
228
+ // Beside the origin, because a `population: store` a reader cannot price is
229
+ // a label taken on faith. Charged to no check — see {@link CheckCost}.
230
+ populationSecs: formatDurationSecs(populated.populationMs),
231
+ // Published here too, and not only by `query`, because this verb pays it
232
+ // identically — the lens is evaluated before the first statement runs. A
233
+ // document that priced the population but not the lens would attribute the
234
+ // lens's cost to whichever rule the reader happened to be looking at, which
235
+ // is the same defect `populationSecs` exists to prevent.
236
+ lensSecs: formatDurationSecs(populated.lensMs),
237
+ // What that number covers — see `CheckDataSchema.lensesEvaluated`. Copied
238
+ // into a plain array so the published document owns no reference into the
239
+ // run's own state.
240
+ lensesEvaluated: [...populated.lensesEvaluated],
241
+ // Where those lenses' own populations came from — see `CheckDataSchema.lensPopulation`.
242
+ lensPopulation: populated.lensPopulation,
243
+ // The bounds of the rows those lenses produced, stated ONCE and only when
244
+ // a bounded lens ran. This is the verb an adopter makes GATE, so it is the
245
+ // one that most owes them — `utils/relation-limits.ts` carries why.
246
+ // Copied out of the readonly registry lists: the published document owns
247
+ // no reference into module state a later render could mutate.
248
+ ...relationBoundsFor(populated.lensesEvaluated),
249
+ };
281
250
  }
282
251
  /**
283
252
  * Run a thunk between two readings of the clock, and report both.
@@ -505,7 +474,7 @@ export function requireKnownCheck(builtinNames, checks, only) {
505
474
  if (only === undefined || builtinNames.includes(only) || Object.hasOwn(checks, only))
506
475
  return;
507
476
  const declared = Object.keys(checks);
508
- throw new Error(`No check named "${only}" exists. `
477
+ throw new CommandRefusalError('USAGE_INVALID', `No check named "${only}" exists. `
509
478
  + `Built in: ${builtinNames.join(', ')}. `
510
479
  + (declared.length === 0
511
480
  ? 'This project declares none of its own — add them under `resources.checks` in'
@@ -579,10 +548,10 @@ export function warnUndeclaredOverrides(checks, validation, logger) {
579
548
  * nothing all produce it — and because population DECLINES ignored members
580
549
  * rather than flagging them, the tables carry no trace of the difference.
581
550
  *
582
- * The precedent is `population-wiring.ts`, which makes `onBlobPopulation`
583
- * mandatory because "a tree whose every document was declined as binary
584
- * otherwise populates as empty and reports success". That guard covers blob
585
- * 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.
586
555
  *
587
556
  * 🪤 **Only when checks actually RAN.** A run with no rules at all is refused
588
557
  * too — it is the same class one level further out — but by
@@ -612,6 +581,28 @@ function emptyCorpusFinding(checksRun, membersEnumerated) {
612
581
  + ' `root` in this report is the directory you meant.'
613
582
  + ' `vat resources scan` over the same path lists what an enumeration finds.')];
614
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
+ }
615
606
  /**
616
607
  * Where the run was when it stopped, as a phrase.
617
608
  *
@@ -619,6 +610,10 @@ function emptyCorpusFinding(checksRun, membersEnumerated) {
619
610
  * @returns A clause naming the unit
620
611
  */
621
612
  function inFlightPhrase(inFlight) {
613
+ if (inFlight.kind === 'startup')
614
+ return 'before the child process had finished starting';
615
+ if (inFlight.kind === 'population')
616
+ return 'before its population completed';
622
617
  if (inFlight.kind === 'check')
623
618
  return `while the check "${inFlight.name}" was running`;
624
619
  if (inFlight.kind === 'reporting') {
@@ -637,6 +632,8 @@ function inFlightPhrase(inFlight) {
637
632
  return 'while no check was running — either between the population and the first'
638
633
  + ' statement, or after the last one had filed its cost';
639
634
  }
635
+ /** The supervisor's kind for a child whose exit contradicts its own complete document. */
636
+ const EXIT_DISAGREES = 'exit-disagrees';
640
637
  /**
641
638
  * What ended the child, as a phrase.
642
639
  *
@@ -650,12 +647,21 @@ function deathPhrase(death) {
650
647
  return `the child process could not be started at all (${death.binary}: ${death.detail})`;
651
648
  }
652
649
  if (death.kind === 'kill-failed') {
653
- return 'the budget was blown and the SIGKILL that should have ended the run was REFUSED'
654
- + ` (${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})`;
655
653
  }
656
654
  if (death.kind === 'no-output') {
657
655
  return `the child process exited ${death.code} and published no report at all`;
658
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
+ }
659
665
  return 'the child process ended with neither an exit code nor a signal';
660
666
  }
661
667
  /**
@@ -681,21 +687,25 @@ function spawnFailedRemedy(detail) {
681
687
  + ' anything about the SQL.';
682
688
  }
683
689
  /**
684
- * 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.
685
691
  *
686
692
  * ⛔ This must never be composed from the spawn-failure sentence, however
687
693
  * similar the plumbing is. The two are opposites: one child never existed, and
688
694
  * this one is, as far as this process can tell, STILL RUNNING.
689
695
  *
690
- * @param death - The refused kill, and the pid it left behind
696
+ * @param death - The kill that failed, and the pid it left behind
691
697
  * @returns The remedy sentence
692
698
  */
693
- function killFailedRemedy(detail, pid) {
694
- const handle = pid === undefined
699
+ function killFailedRemedy(death) {
700
+ const handle = death.pid === undefined
695
701
  ? ' The child\'s pid is not known to this process.'
696
- : ` 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).';
697
707
  return ' The run started, ran past its budget, and then REFUSED TO DIE: the watchdog sent'
698
- + ` SIGKILL and the kernel would not deliver it (${detail}), which normally means EPERM.`
708
+ + how
699
709
  + handle
700
710
  + ' It may still be running and still holding whatever the statement was holding, so'
701
711
  + ' check for it and end it by hand before starting another run. Nothing about the SQL'
@@ -803,7 +813,7 @@ function noOutputRemedy(code) {
803
813
  + ' — surfaces as an exit code what macOS and Linux report as SIGABRT itself, and it is the'
804
814
  + ' same event.' + signalRemedy('SIGABRT');
805
815
  }
806
- 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`
807
817
  + ' every path through this command ends by writing — so this is either a termination from'
808
818
  + ' outside that left an exit code instead of a signal, or a defect in vat. The child\'s stderr'
809
819
  + ' was inherited, so whatever it managed to say is above this report; if there is nothing'
@@ -829,16 +839,33 @@ function noOutputRemedy(code) {
829
839
  */
830
840
  function deathRemedy(death) {
831
841
  if (death.kind === 'kill-failed')
832
- return killFailedRemedy(death.detail, death.pid);
842
+ return killFailedRemedy(death);
833
843
  if (death.kind === 'spawn-failed')
834
844
  return spawnFailedRemedy(death.detail) + WATCHDOG_UNINVOLVED;
835
845
  if (death.kind === 'signal')
836
846
  return signalRemedy(death.signal) + WATCHDOG_UNINVOLVED;
837
- if (death.kind === 'no-output')
847
+ if (death.kind === 'no-output' || death.kind === 'unparseable-output') {
838
848
  return noOutputRemedy(death.code) + WATCHDOG_UNINVOLVED;
849
+ }
850
+ if (death.kind === EXIT_DISAGREES)
851
+ return EXIT_DISAGREES_REMEDY + WATCHDOG_UNINVOLVED;
839
852
  return ' The cause is outside anything this command can observe; the child left no exit code'
840
853
  + ' to report.' + WATCHDOG_UNINVOLVED;
841
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.';
842
869
  /**
843
870
  * The sentence that keeps an abnormal death from being blamed on the bound.
844
871
  *
@@ -852,6 +879,9 @@ const WATCHDOG_UNINVOLVED = ' The budget was not what ended this run — the wat
852
879
  /**
853
880
  * The sentence that says what this document does NOT contain.
854
881
  *
882
+ * @param checksCompleted - How many checks filed a cost before the run stopped
883
+ * @returns The sentence
884
+ *
855
885
  * 🚨 Load-bearing, and shared by both endings. The progress log records COSTS,
856
886
  * not findings: a check that completed contributes its `rows` (how many rows its
857
887
  * statement selected) but not the violations those rows would have become,
@@ -859,9 +889,18 @@ const WATCHDOG_UNINVOLVED = ' The budget was not what ended this run — the wat
859
889
  * issue list as the complete account would conclude the finished rules found
860
890
  * nothing.
861
891
  */
862
- const INCOMPLETE_NOTICE = ' ⚠️ The checks listed under `checks` DID complete and `rows` is what each'
863
- + ' statement selected, but their individual violations are NOT in `issues`: the'
864
- + ' progress log records costs, not findings. Read that list as incomplete.';
892
+ function incompleteNotice(checksCompleted) {
893
+ // 🚨 Only when something completed. It used to be appended unconditionally,
894
+ // so a run killed before its first statement told the operator that the
895
+ // checks under an EMPTY `checks` list "DID complete".
896
+ if (checksCompleted === 0) {
897
+ return ' No check completed before the run stopped, so `checks` is empty and no result'
898
+ + ' of this run is missing from `issues` — there were none.';
899
+ }
900
+ return ' ⚠️ The checks listed under `checks` DID complete and `rows` is what each'
901
+ + ' statement selected, but their individual violations are NOT in `issues`: the'
902
+ + ' progress log records costs, not findings. Read that list as incomplete.';
903
+ }
865
904
  /**
866
905
  * The finding for a run that was interrupted, however it was interrupted.
867
906
  *
@@ -878,16 +917,35 @@ const INCOMPLETE_NOTICE = ' ⚠️ The checks listed under `checks` DID complete
878
917
  *
879
918
  * @param inFlight - What the run was doing when the log stopped growing
880
919
  * @param ending - Which way the run ended, and what the operator can do
920
+ * @param checksCompleted - How many checks filed a cost before it stopped
881
921
  * @returns The run-integrity finding
882
922
  */
883
- function interruptedRunFinding(inFlight, ending) {
923
+ function interruptedRunFinding(inFlight, ending, checksCompleted) {
884
924
  const where = inFlightPhrase(inFlight);
885
925
  const message = ending.kind === 'budget'
886
- ? budgetKillMessage(inFlight, ending.budgetSecs, where)
887
- : `This run DIED before it finished: ${deathPhrase(ending.death)} ${where}, so the checks`
888
- + ' after it never executed and this document is not a verdict.'
889
- + deathRemedy(ending.death);
890
- return runIntegrityFinding(message + INCOMPLETE_NOTICE);
926
+ ? budgetKillMessage(inFlight, ending, where)
927
+ : deathMessage(ending.death, where);
928
+ return runIntegrityFinding(message + incompleteNotice(checksCompleted));
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);
891
949
  }
892
950
  /**
893
951
  * What a WATCHDOG kill means, which depends entirely on what was in flight.
@@ -906,12 +964,23 @@ function interruptedRunFinding(inFlight, ending) {
906
964
  * issues takes ~17 s after `checks-complete` is filed, which is one budget
907
965
  * window on its own.
908
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
+ *
909
970
  * @param inFlight - What the log's last state says
910
- * @param budgetSecs - The bound that was blown
971
+ * @param ending - The kill: the bound that was blown, and who ran the checks
911
972
  * @param where - The clause naming the unit, from {@link inFlightPhrase}
912
973
  * @returns The message body
913
974
  */
914
- function budgetKillMessage(inFlight, budgetSecs, where) {
975
+ function budgetKillMessage(inFlight, ending, where) {
976
+ const { budgetSecs, invocation } = ending;
977
+ const raise = raiseBoundSentence(invocation);
978
+ if (inFlight.kind === 'startup' || inFlight.kind === 'population') {
979
+ return `This run made no progress for ${budgetSecs}s and was killed ${where}, so no`
980
+ + ' check ran and this document is not a verdict. There is no projection, so the'
981
+ + ' population fields in `data` are null and `examined` is 0.'
982
+ + (inFlight.kind === 'startup' ? startupRemedy(raise) : populationRemedy(raise));
983
+ }
915
984
  if (inFlight.kind === 'reporting') {
916
985
  return `This run made no progress for ${budgetSecs}s and was killed ${where}.`
917
986
  + ' Every declared check had already finished and filed its cost, so no statement was'
@@ -919,37 +988,48 @@ function budgetKillMessage(inFlight, budgetSecs, where) {
919
988
  + ' being assembled, not a rule that would not return. Serialising a large result is'
920
989
  + ' linear in how much there is — 2,000,000 issues take about 17 seconds — so look at'
921
990
  + ' the rules under `checks` that produced the most rows and narrow them (a `LIMIT`, or'
922
- + ' one row per violation rather than one per member), or raise the bound with'
923
- + ' `--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}`;
924
993
  }
925
994
  return `This run made no progress for ${budgetSecs}s and was killed ${where}, so the`
926
995
  + ' checks after it never executed and this document is not a verdict.'
927
996
  + ' A statement that will not finish cannot be stopped from inside the process —'
928
997
  + ' the query is synchronous and holds the event loop — so the bound is enforced by'
929
- + ' killing the run. Raise it with `--budget <seconds>` if the work is legitimately'
930
- + ' 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
+ : '');
931
1003
  }
932
1004
  /**
933
- * The refusal when there is no population line to build a document from.
1005
+ * What to do about a kill that landed before the child had BOOTED.
934
1006
  *
935
- * Separate wording per ending for the same reason the finding is: telling an
936
- * operator whose child was OOM-killed to raise `--budget` sends them to change
937
- * the one thing that had nothing to do with it.
1007
+ * Nothing had touched the tree yet — Node and the CLI were still loading — so
1008
+ * sizing the budget against the population would be advice about a unit that
1009
+ * never began. A boot that outlasts the budget is a saturated machine or a bound
1010
+ * too small to be one.
938
1011
  *
939
- * @param ending - Which way the run ended
940
- * @returns The operator-error message
1012
+ * @param raise - How to raise the bound, from {@link raiseBoundSentence}
1013
+ * @returns The remedy sentence
941
1014
  */
942
- function noPopulationMessage(ending) {
943
- const tail = ' There is no projection to report on and no honest document to publish.';
944
- if (ending.kind === 'abnormal') {
945
- return `This run DIED before its population completed: ${deathPhrase(ending.death)}.`
946
- + tail + deathRemedy(ending.death);
947
- }
948
- return `The run made no progress for ${ending.budgetSecs}s and was killed before its`
949
- + ' population completed.' + tail
950
- + ' Population is legitimately slow on a large tree, and it reports progress only when it'
951
- + ' FINISHES, so the budget is a total bound for that one unit — raise it with'
952
- + ' `--budget <seconds>` before assuming the crawl is stuck.'
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
+ }
1020
+ /**
1021
+ * What to do about a kill that landed during the population.
1022
+ *
1023
+ * 🔑 The measured numbers are labelled as someone else's trees. An operator
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
1028
+ */
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}`
953
1033
  + ' For scale, two MEASURED trees, neither of them yours: VAT\'s own repository is ~1.2s'
954
1034
  + ' warm and 33-35s with a cold parse cache; a 10,000-file adopter tree is ~5s warm and'
955
1035
  + ' 16.5s cold. Your tree is a third number.';
@@ -967,12 +1047,15 @@ function noPopulationMessage(ending) {
967
1047
  * keep in step with every future field — and the failure mode is silent, because
968
1048
  * nobody reads an interrupted run's document until the day they need it.
969
1049
  *
970
- * 🚨 **A run interrupted during POPULATION gets no document at all.** There is no
971
- * projection, so `population`, `populationSecs` and `membersEnumerated` have no
972
- * honest value — and inventing `membersEnumerated: 0` would be worse than a
973
- * blank, because that value already MEANS "this gate ran over an empty corpus",
974
- * which is a different and wrong claim. The throw becomes an operator error
975
- * (exit 2) through the same `handleReportCommandError` path everything else here uses.
1050
+ * 🚨 **The exit code follows the CAUSE, and the cause is what was in flight.**
1051
+ * A run killed or dead while a check's statement ran examined the tree, and
1052
+ * that check is broken: `status: findings`, `RESOURCE_CHECK_BROKEN`, exit 1. A
1053
+ * run stopped during STARTUP or POPULATION examined nothing: it is a command
1054
+ * that could not do its job — `status: error`, exit 2 — decided by
1055
+ * {@link buildCheckOutputData} from `populated: null`, never by the caller. It
1056
+ * used to THROW there, which lost the document; now the document is published,
1057
+ * with the population's fields `null` rather than invented, and the reason in
1058
+ * `error`.
976
1059
  *
977
1060
  * @param options - The wreckage
978
1061
  * @param options.entries - What `parseProgressLog` recovered
@@ -980,34 +1063,37 @@ function noPopulationMessage(ending) {
980
1063
  * @param options.ending - Which way the run was interrupted
981
1064
  * @param options.durationMs - Wall time from spawn to ending
982
1065
  * @returns The input to {@link buildCheckOutputData}
983
- * @throws When the child never reported a completed population
984
1066
  */
985
1067
  export function buildInterruptedCheckInput(options) {
986
1068
  const { entries, root, ending, durationMs } = options;
987
1069
  const population = entries.find((entry) => entry.kind === 'population');
988
- if (population === undefined)
989
- throw new Error(noPopulationMessage(ending));
1070
+ // 🪤 Rebuilt field by field rather than passed through. The log's check
1071
+ // entry carries a `kind` discriminator that `CheckCost` does not, and the
1072
+ // conditional spreads keep `rows`/`broken` ABSENT rather than `undefined` —
1073
+ // which is what makes `rows: 0` on a statement that never returned
1074
+ // impossible, exactly as it is on the completed path.
1075
+ const costs = entries.filter((entry) => entry.kind === 'check').map((entry) => ({
1076
+ name: entry.name,
1077
+ durationMs: entry.durationMs,
1078
+ ...(entry.rows === undefined ? {} : { rows: entry.rows }),
1079
+ ...(entry.broken === undefined ? {} : { broken: entry.broken }),
1080
+ ...(entry.builtin === undefined ? {} : { builtin: entry.builtin }),
1081
+ }));
990
1082
  return {
991
1083
  root,
992
1084
  durationMs,
993
- population: population.population,
994
- populationMs: population.populationMs,
995
- lensMs: population.lensMs,
996
- lensesEvaluated: population.lensesEvaluated,
997
- membersEnumerated: population.membersEnumerated,
998
- issues: [interruptedRunFinding(unitInFlight(entries), ending)],
999
- // 🪤 Rebuilt field by field rather than passed through. The log's check
1000
- // entry carries a `kind` discriminator that `CheckCost` does not, and the
1001
- // conditional spreads keep `rows`/`broken` ABSENT rather than `undefined` —
1002
- // which is what makes `rows: 0` on a statement that never returned
1003
- // impossible, exactly as it is on the completed path.
1004
- costs: entries.filter((entry) => entry.kind === 'check').map((entry) => ({
1005
- name: entry.name,
1006
- durationMs: entry.durationMs,
1007
- ...(entry.rows === undefined ? {} : { rows: entry.rows }),
1008
- ...(entry.broken === undefined ? {} : { broken: entry.broken }),
1009
- ...(entry.builtin === undefined ? {} : { builtin: entry.builtin }),
1010
- })),
1085
+ populated: population === undefined
1086
+ ? null
1087
+ : {
1088
+ population: population.population,
1089
+ lensPopulation: population.lensPopulation,
1090
+ populationMs: population.populationMs,
1091
+ lensMs: population.lensMs,
1092
+ lensesEvaluated: population.lensesEvaluated,
1093
+ membersEnumerated: population.membersEnumerated,
1094
+ },
1095
+ issues: [interruptedRunFinding(unitInFlight(entries), ending, costs.length)],
1096
+ costs,
1011
1097
  };
1012
1098
  }
1013
1099
  /**
@@ -1090,42 +1176,43 @@ export function runProjectChecks(options) {
1090
1176
  costs,
1091
1177
  };
1092
1178
  }
1093
- /**
1094
- * Serialize the document in the format the operator asked for.
1095
- *
1096
- * Extracted because BOTH endings publish one — a completed run and a killed one
1097
- * — and two copies of a two-branch format switch is how one of them ends up
1098
- * ignoring `--format json`.
1099
- *
1100
- * @param payload - The document
1101
- * @param format - `json`, or anything else for YAML
1102
- */
1103
- function emitCheckDocument(payload, format) {
1104
- writeStructuredOutput(payload, format);
1105
- }
1106
1179
  /**
1107
1180
  * The child's argv — this very command, plus the hidden flag that stops it
1108
1181
  * spawning a child of its own.
1109
1182
  *
1110
- * 🚨 `--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
1111
1184
  * presence is the sole discriminator between "supervise a child" and "do the
1112
- * work"; a path that built these arguments without it would fork bomb.
1113
- *
1114
- * @param pathArg - The corpus root the operator named, or undefined
1115
- * @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
1116
1202
  * @param logPath - The progress log both sides watch
1117
1203
  * @returns The child's arguments after the CLI entry point
1118
1204
  */
1119
- function childArgs(pathArg, options, logPath) {
1205
+ function childArgs(root, request, logPath) {
1120
1206
  return [
1121
1207
  'resources',
1122
1208
  'check',
1123
- ...(pathArg === undefined ? [] : [pathArg]),
1124
- ...(options.check === undefined ? [] : ['--check', options.check]),
1125
- ...(options.format === undefined ? [] : ['--format', options.format]),
1126
- ...(options.debug === true ? ['--debug'] : []),
1127
- '--cost-log',
1128
- 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 }),
1129
1216
  ];
1130
1217
  }
1131
1218
  /**
@@ -1138,27 +1225,23 @@ function childArgs(pathArg, options, logPath) {
1138
1225
  * which are all of them but one, that would accumulate.
1139
1226
  *
1140
1227
  * @param options - The run
1141
- * @param options.pathArg - The corpus root the operator named, or undefined
1142
- * @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
1143
1231
  * @param options.budgetSecs - The bound, in seconds
1144
1232
  * @returns What to publish, and with what exit code
1145
- * @throws When the child was killed before its population completed
1146
1233
  */
1147
1234
  async function superviseCheckRun(options) {
1148
- const startDir = options.pathArg ?? process.cwd();
1149
- // 🪤 The SILENT resolution, deliberately. `projectRootOrLoudCwd` warns on
1150
- // stderr when there is no project ancestor, and the CHILD runs that policy for
1151
- // real — a parent that ran it too would print the same warning twice for one
1152
- // run. The parent needs a root only to label a KILLED run's document.
1153
- const root = projectRootOrNull(startDir) ?? safePath.resolve(startDir);
1154
- return withProgressLog(async (logPath) => {
1235
+ const { root, request } = options;
1236
+ const { value: ending, leftover } = await withProgressLog(async (log) => {
1155
1237
  const run = await superviseCheck({
1156
- args: childArgs(options.pathArg, options.options, logPath),
1157
- logPath,
1238
+ args: childArgs(root, request, log.path),
1239
+ log,
1158
1240
  budgetMs: options.budgetSecs * 1000,
1241
+ format: request.format,
1159
1242
  });
1160
1243
  if (run.outcome === 'completed')
1161
- return { forward: run.stdout, code: run.code };
1244
+ return { forward: run.document };
1162
1245
  return {
1163
1246
  payload: buildCheckOutputData(buildInterruptedCheckInput({
1164
1247
  entries: parseProgressLog(run.log),
@@ -1169,12 +1252,76 @@ async function superviseCheckRun(options) {
1169
1252
  // argument — so a child that aborted on its heap limit printed nothing
1170
1253
  // and exited 0, on precisely the runaway shape the bound exists for.
1171
1254
  ending: run.outcome === 'killed'
1172
- ? { kind: 'budget', budgetSecs: options.budgetSecs }
1255
+ ? { kind: 'budget', budgetSecs: options.budgetSecs, invocation: request.invocation }
1173
1256
  : { kind: 'abnormal', death: run.death },
1174
1257
  durationMs: run.elapsedMs,
1175
1258
  })),
1176
1259
  };
1177
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.');
1178
1325
  }
1179
1326
  /**
1180
1327
  * Run the project's declared checks against its projection.
@@ -1187,11 +1334,14 @@ async function superviseCheckRun(options) {
1187
1334
  *
1188
1335
  * `query`'s author is at the keyboard, and Ctrl-C already works for them. It
1189
1336
  * works for one reason worth stating, because it is fragile: NO signal handler
1190
- * 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
1191
1338
  * `node:sqlite` dies instantly on SIGINT while that remains true, and SURVIVES
1192
1339
  * SIGINT and SIGTERM the moment a handler exists — the handler is a JS callback
1193
1340
  * and the event loop that would schedule it is the blocked resource. Adding one
1194
- * 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`.)
1195
1345
  *
1196
1346
  * `check` runs unattended in CI, where nobody is there to press it. So it gets a
1197
1347
  * bound enforced from outside itself, and a hang becomes a bounded failure
@@ -1212,89 +1362,163 @@ async function superviseCheckRun(options) {
1212
1362
  export async function checkCommand(pathArg, options) {
1213
1363
  const logger = createLogger({ debug: options.debug ?? false });
1214
1364
  const startTime = Date.now();
1365
+ // The two formats this verb offers (Commander refuses any other).
1366
+ const format = options.format === 'json' ? 'json' : 'yaml';
1215
1367
  try {
1216
1368
  if (pathArg !== undefined)
1217
1369
  assertDirectoryArgument(pathArg);
1218
1370
  const budgetSecs = parseBudgetSeconds(options.budget);
1219
1371
  // Before anything is spawned: a budget the fork below would silently ignore
1220
1372
  // is an operator error, not a bound.
1221
- requireSupervisableFlags({
1222
- costLog: options.costLog,
1373
+ const child = requireSupervisableFlags({
1374
+ supervisedBy: options.supervisedBy,
1223
1375
  budgetRaw: options.budget,
1224
1376
  budgetSecs,
1225
1377
  });
1226
- // 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
1227
1386
  // the operator declined the bound; both run the work here, and the second
1228
1387
  // can therefore hang forever, which its help text says.
1229
- if (!runsInThisProcess({ costLog: options.costLog, budgetSecs })) {
1230
- const ending = await superviseCheckRun({ pathArg, options, budgetSecs });
1231
- if ('forward' in ending) {
1232
- // Verbatim. The child already built the document the operator's
1233
- // `--format` asked for, and re-serializing it here would be a second
1234
- // place for that shape to live.
1235
- //
1236
- // ⚠️ `durationSecs` in it is therefore the CHILD's wall time and does
1237
- // not include this process's own startup and spawn (~0.15 s measured).
1238
- // Deliberate: the field is a breakdown that `populationSecs` and the
1239
- // per-rule costs have to reconcile against, and folding in a supervisor
1240
- // overhead none of them can account for would leave a remainder a
1241
- // reader would attribute to whichever rule they were looking at — the
1242
- // exact defect `CheckCost` documents.
1243
- writeStdoutSync(ending.forward);
1244
- process.exit(ending.code);
1245
- }
1246
- emitCheckDocument(ending.payload, options.format);
1247
- // ⛔ Never OK. A run that did not finish — killed by the watchdog OR dead of
1248
- // its own memory — must not look like a pass. FINDINGS, because the
1249
- // document it just published says `status: findings` with the killed
1250
- // check named as one: the checks that completed are kept, and the exit
1251
- // code follows the document, as everywhere else.
1252
- process.exit(ExitCode.FINDINGS);
1253
- }
1254
- const projectRoot = projectRootOrLoudCwd(pathArg ?? process.cwd(), logger);
1255
- const config = loadConfigCached(projectRoot);
1256
- const checks = config?.resources?.checks;
1257
- if (checks === undefined || Object.keys(checks).length === 0) {
1258
- // 🪤 Stderr only, and it decides NOTHING — the document is what the exit
1259
- // code is computed from and what CI parses. ⚠️ It does not stand beside a
1260
- // refusal: the built-in set runs here, so this run DID assert something.
1261
- // What the operator needs to know is that the project is relying entirely
1262
- // on VAT's defaults, which is what a deleted `checks:` block looks like.
1263
- logger.warn(`No checks of this project's own are declared, so this run asserted only VAT's`
1264
- + ` built-in set (${BUILTIN_CHECK_NAMES.join(', ')}).`
1265
- + ' Add your own under `resources.checks` in vibe-agent-toolkit.config.yaml;'
1266
- + ' each is a description plus one SQL statement selecting the rows that VIOLATE it.'
1267
- + ' `vat resources check --help` prints the SQL each built-in is equivalent to,'
1268
- + ' 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);
1269
1407
  }
1270
- // Before the crawl: a mistyped flag is an operator error and pays nothing.
1271
- requireKnownCheck(BUILTIN_CHECK_NAMES, checks ?? {}, options.check);
1272
- // Also before the crawl, and for the same reason: an override that overrides
1273
- // nothing is knowable from the config alone, and the operator should read it
1274
- // beside the other config news rather than after a full population.
1275
- warnUndeclaredOverrides(checks ?? {}, config?.resources?.validation, logger);
1276
- const outcome = await runOutcome({
1277
- root: projectRoot,
1278
- checks: checks ?? {},
1279
- only: options.check,
1280
- logger,
1281
- validation: config?.resources?.validation,
1282
- onProgress: options.costLog === undefined
1283
- ? undefined
1284
- : createProgressWriter(options.costLog),
1285
- });
1286
- const payload = buildCheckOutputData({
1287
- ...outcome,
1288
- root: projectRoot,
1289
- durationMs: Date.now() - startTime,
1290
- });
1291
- emitCheckDocument(payload, options.format);
1292
- process.exit(payload.summary.errors > 0 ? ExitCode.FINDINGS : ExitCode.OK);
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);
1293
1412
  }
1294
1413
  catch (error) {
1295
- 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);
1296
1416
  }
1297
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
+ }
1298
1522
  /**
1299
1523
  * Populate once, run the checks, resolve their severities.
1300
1524
  *
@@ -1308,7 +1532,7 @@ export async function checkCommand(pathArg, options) {
1308
1532
  * outside this process, or undefined when nothing is watching
1309
1533
  * @returns The findings and the provenance of the population behind them
1310
1534
  */
1311
- async function runOutcome(options) {
1535
+ function runOutcome(options) {
1312
1536
  const { root, checks, only, logger, validation, onProgress } = options;
1313
1537
  // 🪤 **No `preflight` here, deliberately.** `withQueriedProjection` can compile
1314
1538
  // statements against the empty schema before populating — `vat resources query`
@@ -1336,6 +1560,7 @@ async function runOutcome(options) {
1336
1560
  onProgress?.({
1337
1561
  kind: 'population',
1338
1562
  population: provenance.population,
1563
+ lensPopulation: provenance.lensPopulation,
1339
1564
  populationMs: provenance.populationMs,
1340
1565
  lensMs: provenance.lensMs,
1341
1566
  lensesEvaluated: [...provenance.lensesEvaluated],
@@ -1362,4 +1587,6 @@ async function runOutcome(options) {
1362
1587
  return { ...ran, ...provenance, ...extent };
1363
1588
  });
1364
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 };
1365
1592
  //# sourceMappingURL=check.js.map