@vibe-agent-toolkit/cli 0.2.0-rc.1 → 0.2.0-rc.10

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 (504) hide show
  1. package/README.md +4 -5
  2. package/dist/bin/vat +95 -28
  3. package/dist/bin/vat.js +95 -28
  4. package/dist/bin/vat.js.map +1 -1
  5. package/dist/bin.js +115 -76
  6. package/dist/bin.js.map +1 -1
  7. package/dist/command-loaders.d.ts +44 -0
  8. package/dist/command-loaders.d.ts.map +1 -0
  9. package/dist/command-loaders.js +60 -0
  10. package/dist/command-loaders.js.map +1 -0
  11. package/dist/commands/agent/build.d.ts.map +1 -1
  12. package/dist/commands/agent/build.js +2 -1
  13. package/dist/commands/agent/build.js.map +1 -1
  14. package/dist/commands/agent/import.d.ts.map +1 -1
  15. package/dist/commands/agent/import.js +3 -2
  16. package/dist/commands/agent/import.js.map +1 -1
  17. package/dist/commands/agent/index.js +1 -1
  18. package/dist/commands/agent/install-path.d.ts +36 -0
  19. package/dist/commands/agent/install-path.d.ts.map +1 -0
  20. package/dist/commands/agent/install-path.js +44 -0
  21. package/dist/commands/agent/install-path.js.map +1 -0
  22. package/dist/commands/agent/install.d.ts.map +1 -1
  23. package/dist/commands/agent/install.js +66 -13
  24. package/dist/commands/agent/install.js.map +1 -1
  25. package/dist/commands/agent/installed.d.ts.map +1 -1
  26. package/dist/commands/agent/installed.js +22 -12
  27. package/dist/commands/agent/installed.js.map +1 -1
  28. package/dist/commands/agent/list.d.ts.map +1 -1
  29. package/dist/commands/agent/list.js +2 -1
  30. package/dist/commands/agent/list.js.map +1 -1
  31. package/dist/commands/agent/run.d.ts.map +1 -1
  32. package/dist/commands/agent/run.js +2 -1
  33. package/dist/commands/agent/run.js.map +1 -1
  34. package/dist/commands/agent/uninstall.d.ts.map +1 -1
  35. package/dist/commands/agent/uninstall.js +13 -6
  36. package/dist/commands/agent/uninstall.js.map +1 -1
  37. package/dist/commands/agent/validate.d.ts.map +1 -1
  38. package/dist/commands/agent/validate.js +3 -2
  39. package/dist/commands/agent/validate.js.map +1 -1
  40. package/dist/commands/ard/emit.d.ts +153 -0
  41. package/dist/commands/ard/emit.d.ts.map +1 -0
  42. package/dist/commands/ard/emit.js +276 -0
  43. package/dist/commands/ard/emit.js.map +1 -0
  44. package/dist/commands/ard/index.d.ts +12 -0
  45. package/dist/commands/ard/index.d.ts.map +1 -0
  46. package/dist/commands/ard/index.js +80 -0
  47. package/dist/commands/ard/index.js.map +1 -0
  48. package/dist/commands/ard/surfaces.d.ts +56 -0
  49. package/dist/commands/ard/surfaces.d.ts.map +1 -0
  50. package/dist/commands/ard/surfaces.js +150 -0
  51. package/dist/commands/ard/surfaces.js.map +1 -0
  52. package/dist/commands/audit/distributed-tree.d.ts +2 -2
  53. package/dist/commands/audit/distributed-tree.d.ts.map +1 -1
  54. package/dist/commands/audit/distributed-tree.js +11 -7
  55. package/dist/commands/audit/distributed-tree.js.map +1 -1
  56. package/dist/commands/audit/git-url-clone.d.ts +1 -1
  57. package/dist/commands/audit/git-url-clone.d.ts.map +1 -1
  58. package/dist/commands/audit/git-url-clone.js.map +1 -1
  59. package/dist/commands/audit/hierarchical-output.d.ts +1 -1
  60. package/dist/commands/audit/hierarchical-output.d.ts.map +1 -1
  61. package/dist/commands/audit/hierarchical-output.js +1 -1
  62. package/dist/commands/audit/hierarchical-output.js.map +1 -1
  63. package/dist/commands/audit/provenance.d.ts.map +1 -1
  64. package/dist/commands/audit/provenance.js +4 -3
  65. package/dist/commands/audit/provenance.js.map +1 -1
  66. package/dist/commands/audit/scan-population.d.ts +158 -0
  67. package/dist/commands/audit/scan-population.d.ts.map +1 -0
  68. package/dist/commands/audit/scan-population.js +292 -0
  69. package/dist/commands/audit/scan-population.js.map +1 -0
  70. package/dist/commands/audit-settings.d.ts.map +1 -1
  71. package/dist/commands/audit-settings.js +6 -5
  72. package/dist/commands/audit-settings.js.map +1 -1
  73. package/dist/commands/audit.d.ts +98 -8
  74. package/dist/commands/audit.d.ts.map +1 -1
  75. package/dist/commands/audit.js +1126 -394
  76. package/dist/commands/audit.js.map +1 -1
  77. package/dist/commands/build.d.ts +1 -1
  78. package/dist/commands/build.d.ts.map +1 -1
  79. package/dist/commands/build.js +40 -36
  80. package/dist/commands/build.js.map +1 -1
  81. package/dist/commands/cache/cache-control.d.ts +82 -0
  82. package/dist/commands/cache/cache-control.d.ts.map +1 -0
  83. package/dist/commands/cache/cache-control.js +86 -0
  84. package/dist/commands/cache/cache-control.js.map +1 -0
  85. package/dist/commands/cache/clear.d.ts +34 -6
  86. package/dist/commands/cache/clear.d.ts.map +1 -1
  87. package/dist/commands/cache/clear.js +101 -15
  88. package/dist/commands/cache/clear.js.map +1 -1
  89. package/dist/commands/cache/index.d.ts +13 -63
  90. package/dist/commands/cache/index.d.ts.map +1 -1
  91. package/dist/commands/cache/index.js +47 -79
  92. package/dist/commands/cache/index.js.map +1 -1
  93. package/dist/commands/claude/claude-config.d.ts.map +1 -1
  94. package/dist/commands/claude/claude-config.js +6 -0
  95. package/dist/commands/claude/claude-config.js.map +1 -1
  96. package/dist/commands/claude/context.d.ts +340 -0
  97. package/dist/commands/claude/context.d.ts.map +1 -0
  98. package/dist/commands/claude/context.js +1080 -0
  99. package/dist/commands/claude/context.js.map +1 -0
  100. package/dist/commands/claude/index.d.ts +14 -0
  101. package/dist/commands/claude/index.d.ts.map +1 -1
  102. package/dist/commands/claude/index.js +22 -2
  103. package/dist/commands/claude/index.js.map +1 -1
  104. package/dist/commands/claude/marketplace/changelog-utils.d.ts +1 -1
  105. package/dist/commands/claude/marketplace/changelog-utils.d.ts.map +1 -1
  106. package/dist/commands/claude/marketplace/changelog-utils.js +1 -2
  107. package/dist/commands/claude/marketplace/changelog-utils.js.map +1 -1
  108. package/dist/commands/claude/marketplace/git-publish.d.ts.map +1 -1
  109. package/dist/commands/claude/marketplace/git-publish.js +40 -31
  110. package/dist/commands/claude/marketplace/git-publish.js.map +1 -1
  111. package/dist/commands/claude/marketplace/license-utils.d.ts.map +1 -1
  112. package/dist/commands/claude/marketplace/license-utils.js +0 -1
  113. package/dist/commands/claude/marketplace/license-utils.js.map +1 -1
  114. package/dist/commands/claude/marketplace/publish-tree.d.ts.map +1 -1
  115. package/dist/commands/claude/marketplace/publish-tree.js +0 -6
  116. package/dist/commands/claude/marketplace/publish-tree.js.map +1 -1
  117. package/dist/commands/claude/marketplace/publish.d.ts.map +1 -1
  118. package/dist/commands/claude/marketplace/publish.js +2 -1
  119. package/dist/commands/claude/marketplace/publish.js.map +1 -1
  120. package/dist/commands/claude/marketplace/validate.d.ts +73 -22
  121. package/dist/commands/claude/marketplace/validate.d.ts.map +1 -1
  122. package/dist/commands/claude/marketplace/validate.js +407 -72
  123. package/dist/commands/claude/marketplace/validate.js.map +1 -1
  124. package/dist/commands/claude/org/api-keys.d.ts +0 -3
  125. package/dist/commands/claude/org/api-keys.d.ts.map +1 -1
  126. package/dist/commands/claude/org/api-keys.js +2 -1
  127. package/dist/commands/claude/org/api-keys.js.map +1 -1
  128. package/dist/commands/claude/org/helpers.d.ts +54 -1
  129. package/dist/commands/claude/org/helpers.d.ts.map +1 -1
  130. package/dist/commands/claude/org/helpers.js +42 -7
  131. package/dist/commands/claude/org/helpers.js.map +1 -1
  132. package/dist/commands/claude/org/index.d.ts.map +1 -1
  133. package/dist/commands/claude/org/index.js +24 -16
  134. package/dist/commands/claude/org/index.js.map +1 -1
  135. package/dist/commands/claude/org/invites.d.ts +0 -3
  136. package/dist/commands/claude/org/invites.d.ts.map +1 -1
  137. package/dist/commands/claude/org/invites.js +3 -2
  138. package/dist/commands/claude/org/invites.js.map +1 -1
  139. package/dist/commands/claude/org/skills.d.ts +527 -0
  140. package/dist/commands/claude/org/skills.d.ts.map +1 -1
  141. package/dist/commands/claude/org/skills.js +1414 -108
  142. package/dist/commands/claude/org/skills.js.map +1 -1
  143. package/dist/commands/claude/org/users.d.ts +0 -3
  144. package/dist/commands/claude/org/users.d.ts.map +1 -1
  145. package/dist/commands/claude/org/users.js +6 -3
  146. package/dist/commands/claude/org/users.js.map +1 -1
  147. package/dist/commands/claude/org/workspaces.d.ts +0 -3
  148. package/dist/commands/claude/org/workspaces.d.ts.map +1 -1
  149. package/dist/commands/claude/org/workspaces.js +11 -7
  150. package/dist/commands/claude/org/workspaces.js.map +1 -1
  151. package/dist/commands/claude/plugin/build.d.ts +41 -3
  152. package/dist/commands/claude/plugin/build.d.ts.map +1 -1
  153. package/dist/commands/claude/plugin/build.js +147 -80
  154. package/dist/commands/claude/plugin/build.js.map +1 -1
  155. package/dist/commands/claude/plugin/helpers.d.ts.map +1 -1
  156. package/dist/commands/claude/plugin/helpers.js +2 -7
  157. package/dist/commands/claude/plugin/helpers.js.map +1 -1
  158. package/dist/commands/claude/plugin/install.d.ts +12 -0
  159. package/dist/commands/claude/plugin/install.d.ts.map +1 -1
  160. package/dist/commands/claude/plugin/install.js +93 -62
  161. package/dist/commands/claude/plugin/install.js.map +1 -1
  162. package/dist/commands/claude/plugin/list.d.ts.map +1 -1
  163. package/dist/commands/claude/plugin/list.js +3 -2
  164. package/dist/commands/claude/plugin/list.js.map +1 -1
  165. package/dist/commands/claude/plugin/marketplace-json.d.ts +24 -9
  166. package/dist/commands/claude/plugin/marketplace-json.d.ts.map +1 -1
  167. package/dist/commands/claude/plugin/marketplace-json.js +10 -9
  168. package/dist/commands/claude/plugin/marketplace-json.js.map +1 -1
  169. package/dist/commands/claude/plugin/plugin-changelog.d.ts.map +1 -1
  170. package/dist/commands/claude/plugin/plugin-changelog.js +0 -2
  171. package/dist/commands/claude/plugin/plugin-changelog.js.map +1 -1
  172. package/dist/commands/claude/plugin/plugin-files.d.ts.map +1 -1
  173. package/dist/commands/claude/plugin/plugin-files.js +3 -6
  174. package/dist/commands/claude/plugin/plugin-files.js.map +1 -1
  175. package/dist/commands/claude/plugin/plugin-validators.d.ts.map +1 -1
  176. package/dist/commands/claude/plugin/plugin-validators.js +3 -6
  177. package/dist/commands/claude/plugin/plugin-validators.js.map +1 -1
  178. package/dist/commands/claude/plugin/tree-copy.d.ts +73 -0
  179. package/dist/commands/claude/plugin/tree-copy.d.ts.map +1 -1
  180. package/dist/commands/claude/plugin/tree-copy.js +221 -14
  181. package/dist/commands/claude/plugin/tree-copy.js.map +1 -1
  182. package/dist/commands/claude/plugin/uninstall.d.ts.map +1 -1
  183. package/dist/commands/claude/plugin/uninstall.js +4 -4
  184. package/dist/commands/claude/plugin/uninstall.js.map +1 -1
  185. package/dist/commands/consistency-check.d.ts +17 -15
  186. package/dist/commands/consistency-check.d.ts.map +1 -1
  187. package/dist/commands/consistency-check.js +152 -106
  188. package/dist/commands/consistency-check.js.map +1 -1
  189. package/dist/commands/corpus/index.d.ts.map +1 -1
  190. package/dist/commands/corpus/index.js +3 -0
  191. package/dist/commands/corpus/index.js.map +1 -1
  192. package/dist/commands/corpus/report.d.ts +1 -2
  193. package/dist/commands/corpus/report.d.ts.map +1 -1
  194. package/dist/commands/corpus/report.js +1 -3
  195. package/dist/commands/corpus/report.js.map +1 -1
  196. package/dist/commands/corpus/runner.d.ts +58 -1
  197. package/dist/commands/corpus/runner.d.ts.map +1 -1
  198. package/dist/commands/corpus/runner.js +95 -41
  199. package/dist/commands/corpus/runner.js.map +1 -1
  200. package/dist/commands/corpus/scan.d.ts.map +1 -1
  201. package/dist/commands/corpus/scan.js +20 -12
  202. package/dist/commands/corpus/scan.js.map +1 -1
  203. package/dist/commands/corpus/seed.d.ts +4 -4
  204. package/dist/commands/corpus/seed.d.ts.map +1 -1
  205. package/dist/commands/corpus/seed.js +1 -3
  206. package/dist/commands/corpus/seed.js.map +1 -1
  207. package/dist/commands/doctor.d.ts +50 -0
  208. package/dist/commands/doctor.d.ts.map +1 -1
  209. package/dist/commands/doctor.js +245 -52
  210. package/dist/commands/doctor.js.map +1 -1
  211. package/dist/commands/inventory.d.ts +13 -1
  212. package/dist/commands/inventory.d.ts.map +1 -1
  213. package/dist/commands/inventory.js +121 -17
  214. package/dist/commands/inventory.js.map +1 -1
  215. package/dist/commands/mcp/collections.d.ts +1 -1
  216. package/dist/commands/mcp/collections.d.ts.map +1 -1
  217. package/dist/commands/mcp/list-collections.d.ts.map +1 -1
  218. package/dist/commands/mcp/list-collections.js +2 -1
  219. package/dist/commands/mcp/list-collections.js.map +1 -1
  220. package/dist/commands/mcp/serve.d.ts.map +1 -1
  221. package/dist/commands/mcp/serve.js +3 -2
  222. package/dist/commands/mcp/serve.js.map +1 -1
  223. package/dist/commands/okf/index.d.ts +11 -0
  224. package/dist/commands/okf/index.d.ts.map +1 -0
  225. package/dist/commands/okf/index.js +114 -0
  226. package/dist/commands/okf/index.js.map +1 -0
  227. package/dist/commands/okf/validate.d.ts +191 -0
  228. package/dist/commands/okf/validate.d.ts.map +1 -0
  229. package/dist/commands/okf/validate.js +190 -0
  230. package/dist/commands/okf/validate.js.map +1 -0
  231. package/dist/commands/phase-utils.d.ts +182 -114
  232. package/dist/commands/phase-utils.d.ts.map +1 -1
  233. package/dist/commands/phase-utils.js +154 -163
  234. package/dist/commands/phase-utils.js.map +1 -1
  235. package/dist/commands/positional-args.d.ts.map +1 -1
  236. package/dist/commands/positional-args.js +3 -2
  237. package/dist/commands/positional-args.js.map +1 -1
  238. package/dist/commands/rag/clear-command.d.ts.map +1 -1
  239. package/dist/commands/rag/clear-command.js +2 -1
  240. package/dist/commands/rag/clear-command.js.map +1 -1
  241. package/dist/commands/rag/index-command.d.ts +64 -0
  242. package/dist/commands/rag/index-command.d.ts.map +1 -1
  243. package/dist/commands/rag/index-command.js +72 -6
  244. package/dist/commands/rag/index-command.js.map +1 -1
  245. package/dist/commands/rag/index.d.ts.map +1 -1
  246. package/dist/commands/rag/index.js +23 -10
  247. package/dist/commands/rag/index.js.map +1 -1
  248. package/dist/commands/rag/query-command.d.ts.map +1 -1
  249. package/dist/commands/rag/query-command.js +2 -1
  250. package/dist/commands/rag/query-command.js.map +1 -1
  251. package/dist/commands/rag/stats-command.d.ts.map +1 -1
  252. package/dist/commands/rag/stats-command.js +2 -1
  253. package/dist/commands/rag/stats-command.js.map +1 -1
  254. package/dist/commands/resources/builtin-help.d.ts +27 -0
  255. package/dist/commands/resources/builtin-help.d.ts.map +1 -0
  256. package/dist/commands/resources/builtin-help.js +46 -0
  257. package/dist/commands/resources/builtin-help.js.map +1 -0
  258. package/dist/commands/resources/check-progress.d.ts +154 -0
  259. package/dist/commands/resources/check-progress.d.ts.map +1 -0
  260. package/dist/commands/resources/check-progress.js +222 -0
  261. package/dist/commands/resources/check-progress.js.map +1 -0
  262. package/dist/commands/resources/check-supervisor.d.ts +465 -0
  263. package/dist/commands/resources/check-supervisor.d.ts.map +1 -0
  264. package/dist/commands/resources/check-supervisor.js +573 -0
  265. package/dist/commands/resources/check-supervisor.js.map +1 -0
  266. package/dist/commands/resources/check.d.ts +593 -0
  267. package/dist/commands/resources/check.d.ts.map +1 -0
  268. package/dist/commands/resources/check.js +1365 -0
  269. package/dist/commands/resources/check.js.map +1 -0
  270. package/dist/commands/resources/index.d.ts.map +1 -1
  271. package/dist/commands/resources/index.js +418 -4
  272. package/dist/commands/resources/index.js.map +1 -1
  273. package/dist/commands/resources/query.d.ts +106 -0
  274. package/dist/commands/resources/query.d.ts.map +1 -0
  275. package/dist/commands/resources/query.js +177 -0
  276. package/dist/commands/resources/query.js.map +1 -0
  277. package/dist/commands/resources/scan.d.ts +24 -0
  278. package/dist/commands/resources/scan.d.ts.map +1 -1
  279. package/dist/commands/resources/scan.js +17 -8
  280. package/dist/commands/resources/scan.js.map +1 -1
  281. package/dist/commands/resources/validate.d.ts +42 -2
  282. package/dist/commands/resources/validate.d.ts.map +1 -1
  283. package/dist/commands/resources/validate.js +208 -55
  284. package/dist/commands/resources/validate.js.map +1 -1
  285. package/dist/commands/skill/review-checklist.d.ts +3 -2
  286. package/dist/commands/skill/review-checklist.d.ts.map +1 -1
  287. package/dist/commands/skill/review-checklist.js +40 -2
  288. package/dist/commands/skill/review-checklist.js.map +1 -1
  289. package/dist/commands/skill/review.d.ts +247 -0
  290. package/dist/commands/skill/review.d.ts.map +1 -1
  291. package/dist/commands/skill/review.js +99 -62
  292. package/dist/commands/skill/review.js.map +1 -1
  293. package/dist/commands/skill/test/configure.d.ts +56 -0
  294. package/dist/commands/skill/test/configure.d.ts.map +1 -1
  295. package/dist/commands/skill/test/configure.js +75 -16
  296. package/dist/commands/skill/test/configure.js.map +1 -1
  297. package/dist/commands/skill/test/run.d.ts +63 -10
  298. package/dist/commands/skill/test/run.d.ts.map +1 -1
  299. package/dist/commands/skill/test/run.js +258 -77
  300. package/dist/commands/skill/test/run.js.map +1 -1
  301. package/dist/commands/skills/build.d.ts +94 -4
  302. package/dist/commands/skills/build.d.ts.map +1 -1
  303. package/dist/commands/skills/build.js +325 -97
  304. package/dist/commands/skills/build.js.map +1 -1
  305. package/dist/commands/skills/install.d.ts +2 -1
  306. package/dist/commands/skills/install.d.ts.map +1 -1
  307. package/dist/commands/skills/install.js +20 -31
  308. package/dist/commands/skills/install.js.map +1 -1
  309. package/dist/commands/skills/list.d.ts +2 -1
  310. package/dist/commands/skills/list.d.ts.map +1 -1
  311. package/dist/commands/skills/list.js +44 -26
  312. package/dist/commands/skills/list.js.map +1 -1
  313. package/dist/commands/skills/package.d.ts +1 -1
  314. package/dist/commands/skills/package.d.ts.map +1 -1
  315. package/dist/commands/skills/package.js +6 -8
  316. package/dist/commands/skills/package.js.map +1 -1
  317. package/dist/commands/skills/scope-guard.d.ts.map +1 -1
  318. package/dist/commands/skills/scope-guard.js +3 -5
  319. package/dist/commands/skills/scope-guard.js.map +1 -1
  320. package/dist/commands/skills/shared.d.ts.map +1 -1
  321. package/dist/commands/skills/shared.js +2 -4
  322. package/dist/commands/skills/shared.js.map +1 -1
  323. package/dist/commands/skills/skill-discovery.d.ts +47 -6
  324. package/dist/commands/skills/skill-discovery.d.ts.map +1 -1
  325. package/dist/commands/skills/skill-discovery.js +61 -11
  326. package/dist/commands/skills/skill-discovery.js.map +1 -1
  327. package/dist/commands/skills/source-resolvers.d.ts +15 -0
  328. package/dist/commands/skills/source-resolvers.d.ts.map +1 -1
  329. package/dist/commands/skills/source-resolvers.js +25 -4
  330. package/dist/commands/skills/source-resolvers.js.map +1 -1
  331. package/dist/commands/skills/validate-command.d.ts.map +1 -1
  332. package/dist/commands/skills/validate-command.js +11 -3
  333. package/dist/commands/skills/validate-command.js.map +1 -1
  334. package/dist/commands/skills/validate.d.ts +140 -4
  335. package/dist/commands/skills/validate.d.ts.map +1 -1
  336. package/dist/commands/skills/validate.js +224 -67
  337. package/dist/commands/skills/validate.js.map +1 -1
  338. package/dist/commands/validate.d.ts +1 -1
  339. package/dist/commands/validate.d.ts.map +1 -1
  340. package/dist/commands/validate.js +63 -27
  341. package/dist/commands/validate.js.map +1 -1
  342. package/dist/commands/verify.d.ts +119 -15
  343. package/dist/commands/verify.d.ts.map +1 -1
  344. package/dist/commands/verify.js +357 -142
  345. package/dist/commands/verify.js.map +1 -1
  346. package/dist/index.d.ts +0 -1
  347. package/dist/index.d.ts.map +1 -1
  348. package/dist/index.js +5 -1
  349. package/dist/index.js.map +1 -1
  350. package/dist/report-schemas.d.ts +45 -0
  351. package/dist/report-schemas.d.ts.map +1 -0
  352. package/dist/report-schemas.js +100 -0
  353. package/dist/report-schemas.js.map +1 -0
  354. package/dist/skill-resolution/classify.js +2 -2
  355. package/dist/skill-resolution/classify.js.map +1 -1
  356. package/dist/skill-resolution/packaging-config.d.ts +49 -5
  357. package/dist/skill-resolution/packaging-config.d.ts.map +1 -1
  358. package/dist/skill-resolution/packaging-config.js +59 -19
  359. package/dist/skill-resolution/packaging-config.js.map +1 -1
  360. package/dist/skill-resolution/resolve-skill-reference.d.ts.map +1 -1
  361. package/dist/skill-resolution/resolve-skill-reference.js +55 -57
  362. package/dist/skill-resolution/resolve-skill-reference.js.map +1 -1
  363. package/dist/utils/agent-discovery.d.ts.map +1 -1
  364. package/dist/utils/agent-discovery.js +22 -11
  365. package/dist/utils/agent-discovery.js.map +1 -1
  366. package/dist/utils/agent-runner.d.ts.map +1 -1
  367. package/dist/utils/agent-runner.js +7 -4
  368. package/dist/utils/agent-runner.js.map +1 -1
  369. package/dist/utils/claude-context-lens.d.ts +34 -0
  370. package/dist/utils/claude-context-lens.d.ts.map +1 -0
  371. package/dist/utils/claude-context-lens.js +39 -0
  372. package/dist/utils/claude-context-lens.js.map +1 -0
  373. package/dist/utils/command-error.d.ts +138 -20
  374. package/dist/utils/command-error.d.ts.map +1 -1
  375. package/dist/utils/command-error.js +172 -36
  376. package/dist/utils/command-error.js.map +1 -1
  377. package/dist/utils/config-loader.d.ts +2 -1
  378. package/dist/utils/config-loader.d.ts.map +1 -1
  379. package/dist/utils/config-loader.js +40 -14
  380. package/dist/utils/config-loader.js.map +1 -1
  381. package/dist/utils/corpus-target.d.ts +26 -0
  382. package/dist/utils/corpus-target.d.ts.map +1 -0
  383. package/dist/utils/corpus-target.js +35 -0
  384. package/dist/utils/corpus-target.js.map +1 -0
  385. package/dist/utils/edge-lens-evaluation.d.ts +83 -0
  386. package/dist/utils/edge-lens-evaluation.d.ts.map +1 -0
  387. package/dist/utils/edge-lens-evaluation.js +110 -0
  388. package/dist/utils/edge-lens-evaluation.js.map +1 -0
  389. package/dist/utils/help-loader.d.ts.map +1 -1
  390. package/dist/utils/help-loader.js +0 -1
  391. package/dist/utils/help-loader.js.map +1 -1
  392. package/dist/utils/issue-anchor.d.ts +2 -2
  393. package/dist/utils/issue-anchor.d.ts.map +1 -1
  394. package/dist/utils/issue-anchor.js +1 -1
  395. package/dist/utils/issue-rendering.d.ts +3 -3
  396. package/dist/utils/issue-rendering.d.ts.map +1 -1
  397. package/dist/utils/issue-rendering.js +3 -3
  398. package/dist/utils/issue-rendering.js.map +1 -1
  399. package/dist/utils/issue-severity.d.ts +12 -5
  400. package/dist/utils/issue-severity.d.ts.map +1 -1
  401. package/dist/utils/issue-severity.js +1 -1
  402. package/dist/utils/issue-severity.js.map +1 -1
  403. package/dist/utils/optional-backend.d.ts +78 -0
  404. package/dist/utils/optional-backend.d.ts.map +1 -0
  405. package/dist/utils/optional-backend.js +117 -0
  406. package/dist/utils/optional-backend.js.map +1 -0
  407. package/dist/utils/output.d.ts +26 -0
  408. package/dist/utils/output.d.ts.map +1 -1
  409. package/dist/utils/output.js +35 -0
  410. package/dist/utils/output.js.map +1 -1
  411. package/dist/utils/package-json.d.ts +24 -0
  412. package/dist/utils/package-json.d.ts.map +1 -0
  413. package/dist/utils/package-json.js +49 -0
  414. package/dist/utils/package-json.js.map +1 -0
  415. package/dist/utils/population-wiring.d.ts +100 -0
  416. package/dist/utils/population-wiring.d.ts.map +1 -0
  417. package/dist/utils/population-wiring.js +98 -0
  418. package/dist/utils/population-wiring.js.map +1 -0
  419. package/dist/utils/project-root-policy.d.ts +20 -0
  420. package/dist/utils/project-root-policy.d.ts.map +1 -1
  421. package/dist/utils/project-root-policy.js +30 -0
  422. package/dist/utils/project-root-policy.js.map +1 -1
  423. package/dist/utils/projection-lenses.d.ts +98 -0
  424. package/dist/utils/projection-lenses.d.ts.map +1 -0
  425. package/dist/utils/projection-lenses.js +203 -0
  426. package/dist/utils/projection-lenses.js.map +1 -0
  427. package/dist/utils/projection-query.d.ts +324 -0
  428. package/dist/utils/projection-query.d.ts.map +1 -0
  429. package/dist/utils/projection-query.js +357 -0
  430. package/dist/utils/projection-query.js.map +1 -0
  431. package/dist/utils/projection-store.d.ts +335 -0
  432. package/dist/utils/projection-store.d.ts.map +1 -0
  433. package/dist/utils/projection-store.js +522 -0
  434. package/dist/utils/projection-store.js.map +1 -0
  435. package/dist/utils/relation-limits.d.ts +50 -0
  436. package/dist/utils/relation-limits.d.ts.map +1 -0
  437. package/dist/utils/relation-limits.js +50 -0
  438. package/dist/utils/relation-limits.js.map +1 -0
  439. package/dist/utils/repeatable-option.d.ts +37 -0
  440. package/dist/utils/repeatable-option.d.ts.map +1 -0
  441. package/dist/utils/repeatable-option.js +39 -0
  442. package/dist/utils/repeatable-option.js.map +1 -0
  443. package/dist/utils/resource-loader.d.ts +132 -2
  444. package/dist/utils/resource-loader.d.ts.map +1 -1
  445. package/dist/utils/resource-loader.js +288 -27
  446. package/dist/utils/resource-loader.js.map +1 -1
  447. package/dist/utils/root-argv.d.ts +53 -0
  448. package/dist/utils/root-argv.d.ts.map +1 -0
  449. package/dist/utils/root-argv.js +215 -0
  450. package/dist/utils/root-argv.js.map +1 -0
  451. package/dist/utils/run-integrity.d.ts +95 -0
  452. package/dist/utils/run-integrity.d.ts.map +1 -0
  453. package/dist/utils/run-integrity.js +102 -0
  454. package/dist/utils/run-integrity.js.map +1 -0
  455. package/dist/utils/skill-discovery.d.ts.map +1 -1
  456. package/dist/utils/skill-discovery.js +2 -1
  457. package/dist/utils/skill-discovery.js.map +1 -1
  458. package/dist/utils/skill-packaging-config.d.ts +63 -1
  459. package/dist/utils/skill-packaging-config.d.ts.map +1 -1
  460. package/dist/utils/skill-packaging-config.js +56 -1
  461. package/dist/utils/skill-packaging-config.js.map +1 -1
  462. package/dist/utils/sqlite-experimental-warning.d.ts +69 -0
  463. package/dist/utils/sqlite-experimental-warning.d.ts.map +1 -0
  464. package/dist/utils/sqlite-experimental-warning.js +144 -0
  465. package/dist/utils/sqlite-experimental-warning.js.map +1 -0
  466. package/dist/utils/url-redact.d.ts.map +1 -1
  467. package/dist/utils/url-redact.js +4 -6
  468. package/dist/utils/url-redact.js.map +1 -1
  469. package/dist/utils/user-context-scanner.d.ts +8 -0
  470. package/dist/utils/user-context-scanner.d.ts.map +1 -1
  471. package/dist/utils/user-context-scanner.js +4 -2
  472. package/dist/utils/user-context-scanner.js.map +1 -1
  473. package/dist/utils/validate-help-files.d.ts.map +1 -1
  474. package/dist/utils/validate-help-files.js +12 -6
  475. package/dist/utils/validate-help-files.js.map +1 -1
  476. package/dist/utils/vat-bin-path.d.ts +36 -0
  477. package/dist/utils/vat-bin-path.d.ts.map +1 -0
  478. package/dist/utils/vat-bin-path.js +48 -0
  479. package/dist/utils/vat-bin-path.js.map +1 -0
  480. package/dist/utils/verdict-helpers.d.ts +1 -1
  481. package/dist/utils/verdict-helpers.d.ts.map +1 -1
  482. package/dist/utils/verdict-helpers.js +1 -1
  483. package/dist/utils/verdict-helpers.js.map +1 -1
  484. package/dist/version.d.ts.map +1 -1
  485. package/dist/version.js +1 -3
  486. package/dist/version.js.map +1 -1
  487. package/docs/agent.md +2 -2
  488. package/docs/audit.md +141 -37
  489. package/docs/doctor.md +7 -6
  490. package/docs/index.md +19 -11
  491. package/docs/mcp.md +2 -2
  492. package/docs/rag.md +3 -2
  493. package/docs/resources.md +13 -3
  494. package/docs/skill-test.md +10 -9
  495. package/docs/skills.md +53 -69
  496. package/package.json +35 -26
  497. package/schemas/ard-emit.json +149 -0
  498. package/schemas/okf-validate.json +170 -0
  499. package/schemas/resources-check.json +229 -0
  500. package/schemas/skill-review.json +230 -0
  501. package/dist/commands/resources/command-helpers.d.ts +0 -5
  502. package/dist/commands/resources/command-helpers.d.ts.map +0 -1
  503. package/dist/commands/resources/command-helpers.js +0 -6
  504. package/dist/commands/resources/command-helpers.js.map +0 -1
@@ -1,12 +1,10 @@
1
1
  /**
2
2
  * Shared utilities for top-level phase orchestration commands (vat build, vat verify, vat validate).
3
3
  */
4
- import { spawnSync } from 'node:child_process';
5
- import { safePath } from '@vibe-agent-toolkit/utils';
4
+ import { ExitCode, isExitCode } from '@vibe-agent-toolkit/schema';
6
5
  import { Option } from 'commander';
7
- import * as YAML from 'yaml';
8
6
  import { createLogger } from '../utils/logger.js';
9
- import { writeYamlOutput } from '../utils/output.js';
7
+ import { writeJsonOutput, writeYamlOutput } from '../utils/output.js';
10
8
  /**
11
9
  * Declare `--only` on a command that has RETIRED it, solely so the command can
12
10
  * explain itself instead of emitting Commander's bare `error: unknown option
@@ -51,65 +49,51 @@ export function rejectRetiredOnly(only, command, seconds) {
51
49
  `\n` +
52
50
  ` Fix: drop the flag — '${command}' runs every configured surface.\n` +
53
51
  ` Still selective: 'vat build --only <phase>', where a phase is minutes, not seconds.\n`);
54
- process.exit(1);
52
+ process.exit(ExitCode.ERROR);
55
53
  }
56
54
  /** The phase outcome for "we did not learn what this phase would have said". */
57
55
  export const SYSTEM_ERROR = 'system-error';
58
- /**
59
- * Resolve the absolute path to the vat binary.
60
- * This file lives in commands/, one level above bin/.
61
- */
62
- export function resolveBinPath() {
63
- // Use bin.js directly (not the vat.js wrapper) so phase subprocesses always
64
- // run the same binary that is currently executing, regardless of cwd or
65
- // context detection (which would pick up the adopter project's local install).
66
- return safePath.resolve(safePath.join(import.meta.dirname, '../bin.js'));
67
- }
68
56
  /**
69
57
  * Create the shared phase command context: logger, startTime, and bin path.
70
58
  *
71
- * It used to THROW when the phase list came out empty — and it was called
72
- * before the command's try block, so an unroutable `--only` reached the user as
73
- * a raw Node stack trace with zero bytes of stdout and an exit 1 that looked
74
- * like "validation errors". `--only` routing is decided by
75
- * {@link decidePhaseSelection} and reported by {@link applyPhaseSelection} now,
76
- * which emit the command's normal structured document.
59
+ * Total by design: it builds the context and decides nothing.
60
+ *
61
+ * ⚠️ This runs BEFORE the command's try block, so anything that throws here
62
+ * reaches the user as a raw Node stack trace with zero bytes of stdout and an
63
+ * exit 1 indistinguishable from "validation errors". Phase routing therefore
64
+ * belongs to {@link decidePhaseSelection} and {@link applyPhaseSelection}, which
65
+ * emit the command's normal structured document.
77
66
  */
78
67
  export function createPhaseContext(debugFlag) {
79
68
  return {
80
69
  logger: createLogger(debugFlag ? { debug: true } : {}),
81
70
  startTime: Date.now(),
82
- binPath: resolveBinPath(),
83
71
  };
84
72
  }
85
73
  /**
86
74
  * Decide what an orchestrator should do with its `--only` value and the phase
87
75
  * list its config produced.
88
76
  *
89
- * Shared by all three orchestrators because they used to disagree: `vat verify`
90
- * built its phase list without consulting the config at all, so `vat verify
91
- * --only skills` in a project with no `skills:` block exited 0 while `vat
92
- * validate --only skills` on the same project exited 1 — opposite verdicts on
93
- * the same question. (`vat verify` has since retired `--only` entirely and now
94
- * always passes `only: undefined`; `vat validate` and `vat build` still route
95
- * their own `--only` through here.)
77
+ * THE single decision site for all three orchestrators, so they cannot answer
78
+ * the same question differently. An orchestrator that builds its phase list
79
+ * without consulting the config exits 0 on `--only skills` in a project with no
80
+ * `skills:` block while another exits 1 — opposite verdicts on one question.
81
+ * `vat verify` has retired `--only` and always passes `only: undefined`;
82
+ * `vat validate` and `vat build` route their own `--only` through here.
96
83
  *
97
- * There used to be a third option, `emptyIsValid`, which existed solely so
98
- * `vat verify --only consistency` could run with an empty SUBPROCESS list
99
- * (consistency runs in-process). It was checked BEFORE `unreadableConfig`, so
100
- * `vat verify --only consistency` against an unparseable config answered the
101
- * confidently-wrong "no skills: block" instead of reporting the config error.
102
- * `--only` is gone from verify, `emptyIsValid` went with it, and that ordering
103
- * hazard cannot recur: nothing short-circuits ahead of the config-error arm.
84
+ * ⚠️ **Nothing may short-circuit ahead of the config-error arm.** A check
85
+ * evaluated before `unreadableConfig` answers a confident "not configured" for a
86
+ * tree whose config could not be parsed — which is the one answer this function
87
+ * must never give, because it is indistinguishable from a correct one.
104
88
  *
105
89
  * @param unreadableConfig - The config-load error, when the config exists but
106
90
  * could not be parsed. A broken config is NOT "the phase is unconfigured":
107
91
  * we do not know what it declares, so we must not answer with a confident
108
92
  * "not configured". Only `vat verify` passes it, and only defensively — its
109
- * phase builder pushes every subprocess phase when the config is unreadable
110
- * (so the CHILD reports the real error), which makes the list non-empty and
111
- * this arm unreachable by construction today. It is kept because the arm that
112
- * would otherwise catch an empty list is the "not configured" lie.
93
+ * phase builder pushes every configured phase when the config is unreadable
94
+ * (so the phase itself reports the real error), which makes the list non-empty
95
+ * and this arm unreachable by construction today. It is kept because the arm
96
+ * that would otherwise catch an empty list is the "not configured" lie.
113
97
  */
114
98
  export function decidePhaseSelection(only, phases, vocab, options = {}) {
115
99
  const lower = vocab.noun.toLowerCase();
@@ -139,9 +123,9 @@ export function decidePhaseSelection(only, phases, vocab, options = {}) {
139
123
  * Act on a {@link PhaseSelection}: return the phases to run, or emit the
140
124
  * command's normal structured document and exit.
141
125
  *
142
- * Both terminal arms go through `writeYamlOutput` deliberately. A `--only`
143
- * failure used to be an uncaught throw, so the one output a scripted caller
144
- * parses — the YAML document on stdout — was never written at all.
126
+ * Both terminal arms go through `writeYamlOutput` deliberately: the YAML
127
+ * document on stdout is the one output a scripted caller parses, so a routing
128
+ * failure has to publish one rather than throw past it.
145
129
  */
146
130
  export function applyPhaseSelection(selection, logger, startTime) {
147
131
  if (selection.kind === 'run') {
@@ -155,7 +139,10 @@ export function applyPhaseSelection(selection, logger, startTime) {
155
139
  error: selection.message,
156
140
  duration: `${Date.now() - startTime}ms`,
157
141
  });
158
- return process.exit(1);
142
+ // A selection that cannot run — an unknown `--only` name, an unreadable
143
+ // config, nothing configured for what was asked — is the command failing
144
+ // to do its job, not a finding about the tree.
145
+ return process.exit(ExitCode.ERROR);
159
146
  }
160
147
  logger.warn(selection.warning);
161
148
  writeYamlOutput({
@@ -164,7 +151,7 @@ export function applyPhaseSelection(selection, logger, startTime) {
164
151
  note: selection.note,
165
152
  duration: `${Date.now() - startTime}ms`,
166
153
  });
167
- return process.exit(0);
154
+ return process.exit(ExitCode.OK);
168
155
  }
169
156
  /** Rank used by {@link worseOf}: later wins. */
170
157
  const PHASE_STATUS_ORDER = ['success', 'warning', 'error', 'system-error'];
@@ -172,54 +159,28 @@ const PHASE_STATUS_ORDER = ['success', 'warning', 'error', 'system-error'];
172
159
  export function worseOf(a, b) {
173
160
  return PHASE_STATUS_ORDER.indexOf(b) > PHASE_STATUS_ORDER.indexOf(a) ? b : a;
174
161
  }
175
- /** Every value a child may legitimately report as its own `status`. */
162
+ /** Every value a phase may legitimately report as its own `status`. */
176
163
  const REPORTABLE_STATUSES = new Set(PHASE_STATUS_ORDER);
177
164
  /**
178
- * Parse the child's captured stdout into its reported document.
179
- *
180
- * Takes the LAST non-empty document in the stream: every orchestrated child
181
- * writes its summary last, and a child that happens to emit more than one
182
- * document must not make the summary unreadable.
165
+ * The status an exit code alone implies, before the phase's report is read.
183
166
  *
184
- * Empty stdout is NOT a failure — `vat skills validate` legitimately exits 0
185
- * printing nothing when there is no `skills:` block. Stdout that exists but
186
- * cannot be parsed IS a failure: the child crashed mid-answer, and the phase
187
- * must degrade to `system-error` rather than throw an unhandled exception out
188
- * of the orchestrator.
167
+ * A code outside the `ExitCode` contract is a DEFECT in the phase, not a
168
+ * status to round: the old table folded "anything else" into `system-error`,
169
+ * which let a phase ending on a code no reader could interpret pass as a
170
+ * merely broken environment. It throws, and {@link runPhase}'s backstop files
171
+ * the phase as `system-error` with the defect named.
189
172
  */
190
- function parseChildReport(name, stdout) {
191
- if (stdout === undefined || stdout === null || stdout.trim() === '') {
192
- return {};
193
- }
194
- let documents;
195
- try {
196
- documents = YAML.parseAllDocuments(stdout);
197
- }
198
- catch (error) {
199
- return { parseError: unparseableMessage(name, error) };
200
- }
201
- const last = documents.findLast((doc) => doc.contents !== null);
202
- if (last === undefined) {
203
- return {};
204
- }
205
- if (last.errors.length > 0) {
206
- return { parseError: unparseableMessage(name, last.errors[0]) };
207
- }
208
- return { report: last.toJS() };
209
- }
210
- function unparseableMessage(name, cause) {
211
- const detail = cause instanceof Error ? cause.message : String(cause);
212
- return `Phase '${name}' wrote unparseable output on stdout: ${detail}`;
213
- }
214
- /** The status an exit code alone implies, before the child's report is read. */
215
173
  function statusFromExitCode(status) {
216
- if (status === 0)
174
+ if (!isExitCode(status)) {
175
+ throw new Error(`exit code ${status} is not in the ExitCode contract (0 ok, 1 findings, 2 error)`);
176
+ }
177
+ if (status === ExitCode.OK)
217
178
  return 'success';
218
- if (status === 1)
179
+ if (status === ExitCode.FINDINGS)
219
180
  return 'error';
220
181
  return SYSTEM_ERROR;
221
182
  }
222
- /** The status the child claimed for itself, when it claimed a recognized one. */
183
+ /** The status the phase claimed for itself, when it claimed a recognized one. */
223
184
  function statusFromReport(report) {
224
185
  if (typeof report !== 'object' || report === null)
225
186
  return undefined;
@@ -229,49 +190,31 @@ function statusFromReport(report) {
229
190
  : undefined;
230
191
  }
231
192
  /**
232
- * Map a spawn outcome to a phase outcome. The pure core of {@link runPhase}.
193
+ * Map what a phase produced to its outcome. The pure core of {@link runPhase}.
233
194
  *
234
- * Every branch that is NOT "the child ran and told us what it found" is a
235
- * system error, because the orchestrator learned nothing about the artifact:
195
+ * | exit code | phase status | why |
196
+ * |-----------------------|----------------|-----------------------------------------|
197
+ * | `OK` (0) | `success` | ran, found nothing actionable |
198
+ * | `FINDINGS` (1) | `error` | ran, found validation errors |
199
+ * | `ERROR` (2) | `system-error` | the phase itself reported a system error |
200
+ * | anything else | throws | a defect in the phase, filed by `runPhase` as `system-error` |
236
201
  *
237
- * | spawn outcome | phase status | why |
238
- * |--------------------------|----------------|--------------------------------------------|
239
- * | `error` set | `system-error` | the child never ran |
240
- * | killed by a signal | `system-error` | the child was cut off mid-answer |
241
- * | no exit code, no signal | `system-error` | there is no answer to read |
242
- * | stdout not parseable | `system-error` | the child's answer cannot be read |
243
- * | exit 0 | `success` | ran, found nothing actionable |
244
- * | exit 1 | `error` | ran, found validation errors |
245
- * | exit 2 (or any other) | `system-error` | the child itself reported a system error |
202
+ * The exit code is then reconciled with the phase's OWN reported `status`,
203
+ * worst-wins. An exit code has three values and cannot express `warning`:
204
+ * `vat skills validate` exits 0 while reporting `status: warning`, so its exit
205
+ * code alone reads as `success` — including on the tree VAT's CI dogfoods on
206
+ * VAT itself.
246
207
  *
247
- * The exit code is then reconciled with the child's OWN reported `status`,
248
- * worst-wins. An exit code has three values and cannot express `warning`, so
249
- * `vat skills validate` — which exits 0 while reporting `status: warning` —
250
- * was being recorded as `success` by every orchestrator, including the one
251
- * VAT's CI dogfoods on VAT itself.
208
+ * The table has no row for a signal kill, a missing status code, or a document
209
+ * that fails to parse, and that is the design rather than an omission. A phase
210
+ * runs in this process: there is no serialization step in which to lose a
211
+ * document, and no signal that could take a phase without taking the
212
+ * orchestrator with it.
252
213
  */
253
- export function phaseResultFromSpawn(name, outcome) {
254
- if (outcome.error !== undefined) {
255
- return { name, status: SYSTEM_ERROR, error: `Failed to spawn phase: ${outcome.error.message}` };
256
- }
257
- if (outcome.signal !== null) {
258
- return {
259
- name,
260
- status: SYSTEM_ERROR,
261
- signal: outcome.signal,
262
- error: `Phase '${name}' was killed by signal ${outcome.signal}`,
263
- };
264
- }
265
- if (outcome.status === null) {
266
- return { name, status: SYSTEM_ERROR, error: `Phase '${name}' exited without a status code` };
267
- }
268
- const exitCode = outcome.status;
269
- const { report, parseError } = parseChildReport(name, outcome.stdout);
270
- if (parseError !== undefined) {
271
- return { name, status: SYSTEM_ERROR, exitCode, error: parseError };
272
- }
214
+ export function phaseResultFromOutcome(name, outcome) {
215
+ const { exitCode, document } = outcome;
273
216
  const exitStatus = statusFromExitCode(exitCode);
274
- const reported = statusFromReport(report);
217
+ const reported = statusFromReport(document);
275
218
  const status = reported === undefined ? exitStatus : worseOf(exitStatus, reported);
276
219
  return {
277
220
  name,
@@ -280,37 +223,85 @@ export function phaseResultFromSpawn(name, outcome) {
280
223
  ...(exitStatus === SYSTEM_ERROR
281
224
  ? { error: `Phase '${name}' exited with system-error code ${exitCode}` }
282
225
  : {}),
283
- ...(report === undefined ? {} : { report }),
226
+ ...(document === undefined ? {} : { report: document }),
284
227
  };
285
228
  }
286
229
  /**
287
- * Cap on a captured child document, well above the ~2.3 MB a large real project
288
- * produces. spawnSync's 1 MB default would set ENOBUFS and hand back a
289
- * TRUNCATED (and therefore unparseable) document; exceeding this cap surfaces
290
- * as a loud `system-error`, never as a silently shortened report.
230
+ * End a command-line run from a phase outcome: publish the document, then exit.
231
+ *
232
+ * THE single place the two lanes diverge, so they cannot diverge anywhere else.
233
+ * A phase hands back the same `{ document, exitCode }` either way; this decides
234
+ * what a *command* does with it, while an orchestrator folds it into
235
+ * `phases[].report` instead.
236
+ *
237
+ * Three cases, and the middle one is the one to get right:
238
+ * - an unexpected failure publishes the shared envelope in the format the
239
+ * operator asked for, matching `handleCommandError`;
240
+ * - a command's own report goes through the command's own `render`;
241
+ * - no document at all (an unconfigured run, a dry run) publishes nothing.
242
+ *
243
+ * 🔑 **`format` is REQUIRED, and that is the whole point of it being a
244
+ * parameter.** This arm hardcoded `writeYamlOutput`, and it is `vat resources
245
+ * validate`'s ONLY error exit — so `--format json` silently produced YAML on the
246
+ * one path a scripted consumer most needs to parse. The sibling
247
+ * `handleCommandError` has the same parameter as an OPTIONAL one carrying a
248
+ * docstring that says a caller with a `--format` option must pass it, and two
249
+ * commands added in the same change dropped it anyway: a docstring is not a
250
+ * mechanism. Here the type system asks, so a new caller cannot forget. A command
251
+ * that offers no `--format` passes `undefined` and says so at its call site.
252
+ *
253
+ * ⚠️ It governs the FAILURE envelope only. A command's own report still goes
254
+ * through `render`, which is what a `--format text` lane needs.
255
+ *
256
+ * @param outcome - What the phase produced
257
+ * @param render - How this command publishes its OWN report shape
258
+ * @param format - What the operator asked for: `json`, or anything else (and
259
+ * `undefined`) for YAML — the same two-branch switch `handleCommandError` and
260
+ * every success path use
291
261
  */
292
- const MAX_PHASE_STDOUT_BYTES = 256 * 1024 * 1024;
262
+ export function finishCommand(outcome, render, format) {
263
+ if (outcome.failed === true) {
264
+ if (format === 'json') {
265
+ writeJsonOutput(outcome.document);
266
+ }
267
+ else {
268
+ writeYamlOutput(outcome.document);
269
+ }
270
+ }
271
+ else if (outcome.document !== undefined) {
272
+ render(outcome.document);
273
+ }
274
+ return process.exit(outcome.exitCode);
275
+ }
293
276
  /**
294
- * Run a single phase by spawning the vat binary with the phase args.
277
+ * Run a single phase in THIS process and fold its outcome into a result.
278
+ *
279
+ * In THIS process, because everything an orchestrator reads back from a phase is
280
+ * the {@link PhaseOutcome} pair. A process per phase buys neither half of it and
281
+ * charges, on every phase, a full Node startup and the whole module graph again
282
+ * (~730 ms of remark per isolate), a parse cache whose miss counters restart
283
+ * from zero, and a worker pool built and torn down before the next phase begins.
284
+ * Phases run sequentially, so none of that cost is ever overlapped with work.
285
+ *
286
+ * The `catch` is a BACKSTOP, not the error path. Every phase function reports
287
+ * its own failures through `reportCommandError` and returns them as a document.
295
288
  *
296
- * stdout is CAPTURED, not inherited: the child's YAML document belongs in this
297
- * phase's `report`, and letting it stream onto the parent's stdout is what made
298
- * `vat validate`'s output a run of documents with no `---` between them.
299
- * stderr stays inherited — progress output is on stderr by design and must keep
300
- * streaming live rather than arriving in one lump at the end.
289
+ * ⚠️ This arm exists for a throw that escaped that handling. Sharing the
290
+ * orchestrator's process is what makes it load-bearing: an escaped throw aborts
291
+ * the orchestrator itself and silently skips every later phase.
301
292
  */
302
- export function runPhase(binPath, phase) {
303
- const result = spawnSync(process.execPath, [binPath, ...phase.args], {
304
- stdio: ['inherit', 'pipe', 'inherit'],
305
- encoding: 'utf8',
306
- maxBuffer: MAX_PHASE_STDOUT_BYTES,
307
- });
308
- return phaseResultFromSpawn(phase.name, {
309
- status: result.status,
310
- signal: result.signal,
311
- error: result.error,
312
- stdout: result.stdout,
313
- });
293
+ export async function runPhase(phase) {
294
+ try {
295
+ return phaseResultFromOutcome(phase.name, await phase.run());
296
+ }
297
+ catch (error) {
298
+ const detail = error instanceof Error ? error.message : String(error);
299
+ return {
300
+ name: phase.name,
301
+ status: SYSTEM_ERROR,
302
+ error: `Phase '${phase.name}' threw past its own error handling: ${detail}`,
303
+ };
304
+ }
314
305
  }
315
306
  /**
316
307
  * Worst-wins aggregate across phases. `system-error` outranks `error`: "we could
@@ -326,16 +317,16 @@ export function aggregatePhaseStatus(results) {
326
317
  /**
327
318
  * One phase's per-severity distribution, wherever that phase keeps it.
328
319
  *
329
- * An in-process phase holds its own findings and publishes {@link
330
- * PhaseResult.issueCounts}. A subprocess phase deliberately does not — the child
331
- * owns its findings, and its document rides verbatim in {@link
332
- * PhaseResult.report}. Reading only the former is why an orchestrator's header
333
- * could report `{0, 0, 0}` over children that had just reported 12 warnings.
320
+ * A phase that holds its own findings publishes {@link PhaseResult.issueCounts}.
321
+ * A phase that publishes its own document deliberately does not — it owns its
322
+ * findings, and its document rides verbatim in {@link PhaseResult.report}.
323
+ *
324
+ * ⚠️ Both places must be read. Reading only `issueCounts` makes an
325
+ * orchestrator's header report `{0, 0, 0}` over phases that just reported 12
326
+ * warnings.
334
327
  *
335
328
  * Absent or malformed counts read as zero rather than throwing: a phase that
336
- * published no distribution contributes nothing to the total, which is the same
337
- * answer as before this function existed — just no longer the answer for phases
338
- * that DID publish one.
329
+ * publishes no distribution contributes nothing to the total.
339
330
  */
340
331
  export function phaseIssueCounts(result) {
341
332
  if (result.issueCounts)
@@ -354,10 +345,10 @@ export function phaseIssueCounts(result) {
354
345
  * Sum every phase's distribution, so an orchestrator's header total reconciles
355
346
  * against the phases printed beneath it.
356
347
  *
357
- * The companion to {@link aggregatePhaseStatus}: status has always been
358
- * worst-wins ACROSS phases, and a header whose `status` can see the children
359
- * while its `issueCounts` cannot is the same contradiction in one document —
360
- * `status: warning` beside `warnings: 0`.
348
+ * The companion to {@link aggregatePhaseStatus}: status is worst-wins ACROSS
349
+ * phases, so a header whose `status` can see the phases while its `issueCounts`
350
+ * cannot publishes a contradiction in one document — `status: warning` beside
351
+ * `warnings: 0`.
361
352
  */
362
353
  export function aggregatePhaseIssueCounts(results) {
363
354
  const total = { errors: 0, warnings: 0, info: 0 };
@@ -371,14 +362,14 @@ export function aggregatePhaseIssueCounts(results) {
371
362
  }
372
363
  /**
373
364
  * The process exit code for a set of phase outcomes, per the exit-code contract
374
- * every orchestrator's help text documents: 0 pass, 1 validation failure,
375
- * 2 system error. Warnings do not fail a run — they are published in the status
376
- * and counts instead.
365
+ * every orchestrator's help text documents: `OK` pass, `FINDINGS` validation
366
+ * failure, `ERROR` system error. Warnings do not fail a run — they are
367
+ * published in the status and counts instead.
377
368
  */
378
369
  export function exitCodeForPhases(results) {
379
370
  const worst = aggregatePhaseStatus(results);
380
371
  if (worst === SYSTEM_ERROR)
381
- return 2;
382
- return worst === 'error' ? 1 : 0;
372
+ return ExitCode.ERROR;
373
+ return worst === 'error' ? ExitCode.FINDINGS : ExitCode.OK;
383
374
  }
384
375
  //# sourceMappingURL=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AAQ,CAAC;QAC3B,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC;IACrB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAA+B;IAC/D,MAAM,KAAK,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC5C,IAAI,KAAK,KAAK,YAAY;QAAE,OAAO,QAAQ,CAAC,KAAK,CAAC;IAClD,OAAO,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;AAC7D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"positional-args.d.ts","sourceRoot":"","sources":["../../src/commands/positional-args.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GACjB,IAAI,CAmBN"}
1
+ {"version":3,"file":"positional-args.d.ts","sourceRoot":"","sources":["../../src/commands/positional-args.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GACjB,IAAI,CAmBN"}
@@ -5,6 +5,7 @@
5
5
  * `vat validate`), which operate on the whole project as the config describes
6
6
  * it and have no path-shaped subject at all.
7
7
  */
8
+ import { ExitCode } from '@vibe-agent-toolkit/schema';
8
9
  /**
9
10
  * Fail the run when a caller passed a positional argument to a command that
10
11
  * takes none, naming the argument and where to take it instead.
@@ -46,7 +47,7 @@ export function rejectPositionalArguments(operands, command, operatesOn) {
46
47
  `\n` +
47
48
  ` Fix: run '${command}' with no arguments, and scope it in\n` +
48
49
  ` vibe-agent-toolkit.config.yaml.\n` +
49
- ` To inspect ONE skill or bundle by path, use: vat audit <path>\n`);
50
- process.exit(2);
50
+ ` To inspect ONE skill or bundle by path, use: vat skill review <path>\n`);
51
+ process.exit(ExitCode.ERROR);
51
52
  }
52
53
  //# sourceMappingURL=positional-args.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"positional-args.js","sourceRoot":"","sources":["../../src/commands/positional-args.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,yBAAyB,CACvC,QAA2B,EAC3B,OAAe,EACf,UAAkB;IAElB,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAElC,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEpE,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,WAAW,OAAO,yCAAyC,MAAM,MAAM;QACrE,IAAI;QACJ,MAAM,OAAO,KAAK,UAAU,8CAA8C;QAC1E,2EAA2E;QAC3E,4EAA4E;QAC5E,4EAA4E;QAC5E,qBAAqB;QACrB,IAAI;QACJ,eAAe,OAAO,wCAAwC;QAC9D,qCAAqC;QACrC,mEAAmE,CACtE,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
1
+ {"version":3,"file":"positional-args.js","sourceRoot":"","sources":["../../src/commands/positional-args.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,yBAAyB,CACvC,QAA2B,EAC3B,OAAe,EACf,UAAkB;IAElB,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAElC,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEpE,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,WAAW,OAAO,yCAAyC,MAAM,MAAM;QACrE,IAAI;QACJ,MAAM,OAAO,KAAK,UAAU,8CAA8C;QAC1E,2EAA2E;QAC3E,4EAA4E;QAC5E,4EAA4E;QAC5E,qBAAqB;QACrB,IAAI;QACJ,eAAe,OAAO,wCAAwC;QAC9D,qCAAqC;QACrC,0EAA0E,CAC7E,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"clear-command.d.ts","sourceRoot":"","sources":["../../../src/commands/rag/clear-command.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,UAAU,YAAY;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBvE"}
1
+ {"version":3,"file":"clear-command.d.ts","sourceRoot":"","sources":["../../../src/commands/rag/clear-command.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,UAAU,YAAY;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBvE"}
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * RAG clear command - remove all indexed data from database
3
3
  */
4
+ import { ExitCode } from '@vibe-agent-toolkit/schema';
4
5
  import { writeYamlOutput } from '../../utils/output.js';
5
6
  import { executeRagOperation, formatDuration } from './command-helpers.js';
6
7
  export async function clearCommand(options) {
@@ -17,6 +18,6 @@ export async function clearCommand(options) {
17
18
  message: 'Database cleared',
18
19
  duration: formatDuration(duration),
19
20
  });
20
- process.exit(0);
21
+ process.exit(ExitCode.OK);
21
22
  }
22
23
  //# sourceMappingURL=clear-command.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clear-command.js","sourceRoot":"","sources":["../../../src/commands/rag/clear-command.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAO3E,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAqB;IACtD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE7B,MAAM,mBAAmB,CACvB,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,kCAAkC;IACnE,KAAK,EAAE,WAAW,EAAE,EAAE;QACpB,kEAAkE;QAClE,MAAO,WAAgC,CAAC,KAAK,EAAE,CAAC;IAClD,CAAC,EACD,OAAO,CACR,CAAC;IAEF,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;IAExC,iBAAiB;IACjB,eAAe,CAAC;QACd,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,kBAAkB;QAC3B,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC;KACnC,CAAC,CAAC;IAEH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
1
+ {"version":3,"file":"clear-command.js","sourceRoot":"","sources":["../../../src/commands/rag/clear-command.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAO3E,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAqB;IACtD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE7B,MAAM,mBAAmB,CACvB,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,kCAAkC;IACnE,KAAK,EAAE,WAAW,EAAE,EAAE;QACpB,kEAAkE;QAClE,MAAO,WAAgC,CAAC,KAAK,EAAE,CAAC;IAClD,CAAC,EACD,OAAO,CACR,CAAC;IAEF,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;IAExC,iBAAiB;IACjB,eAAe,CAAC;QACd,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,kBAAkB;QAC3B,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC;KACnC,CAAC,CAAC;IAEH,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC5B,CAAC"}
@@ -1,10 +1,74 @@
1
1
  /**
2
2
  * RAG index command - index markdown resources into vector database
3
3
  */
4
+ import type { IndexResult } from '@vibe-agent-toolkit/rag';
5
+ import type { UnreadableResource } from '@vibe-agent-toolkit/resources';
4
6
  interface IndexOptions {
5
7
  db?: string;
6
8
  debug?: boolean;
7
9
  }
10
+ /**
11
+ * What an index run is allowed to report, and the exit code that agrees with it.
12
+ *
13
+ * `partial` is spelled the way `vat cache clear` spells it (see
14
+ * `../cache/clear.ts` — `status: 'success' | 'partial'`, exiting
15
+ * `partial ? 1 : 0`): a command that finished, published a complete report, and
16
+ * did not do all of what was asked. The vocabulary is deliberately the sibling's
17
+ * rather than a new one.
18
+ *
19
+ * Exit 1, not 2. This command family documents `1 - reported/expected failure`
20
+ * and `2 - system error` (`vat claude budget`, and the `Exit Codes:` block on
21
+ * every `vat rag` subcommand). A run that indexed most of a corpus and named the
22
+ * resources it dropped is a REPORTED outcome — the report on stdout is complete
23
+ * and parseable. 2 belongs to a command that could not run at all, which here is
24
+ * the `handleCommandError` path below.
25
+ */
26
+ export interface IndexOutcome {
27
+ status: 'success' | 'partial';
28
+ exitCode: 0 | 1;
29
+ }
30
+ /**
31
+ * Derive the reported status and exit code from what indexing actually did.
32
+ *
33
+ * This existed as a hardcoded `status: 'success'` next to an unconditional
34
+ * `process.exit(0)`, so a run that failed a fifth of its corpus told the user —
35
+ * and any CI step parsing it — that everything was fine, while the dropped
36
+ * documents were simply unsearchable. A status field that cannot express failure
37
+ * is the defect; the particular failures it hid are incidental, and
38
+ * `indexResources` can fail a resource for any reason (unreadable file,
39
+ * embedding-provider error, provider unavailable).
40
+ *
41
+ * `errors` is optional on `IndexResult`'s schema, so a provider MAY omit it;
42
+ * `LanceDBRAGProvider` never does (it always carries `errors: []` when nothing
43
+ * failed). Both shapes are success here, because the schema allows both.
44
+ *
45
+ * @param indexResult - The result of the indexing run (only `errors` is read)
46
+ * @returns The status to publish and the exit code that agrees with it
47
+ */
48
+ export declare function indexOutcome(indexResult: Pick<IndexResult, 'errors'>): IndexOutcome;
49
+ /** One entry of `IndexResult['errors']`. */
50
+ type IndexError = NonNullable<IndexResult['errors']>[number];
51
+ /**
52
+ * The resources the crawl enumerated but could not read, as index errors.
53
+ *
54
+ * Such a file never reaches `indexResources`: the crawl reads and parses every
55
+ * file itself, so an unreadable one is dropped before the provider sees it. It
56
+ * is therefore in none of the provider's counters and not in its `errors` —
57
+ * the registry keeps the reconciliation log (`getUnreadableResources()`), and
58
+ * this command did not read it, so a corpus with a document missing from the
59
+ * index was reported `status: success`, exit 0, on both crawl lanes. Folding
60
+ * the log into the same `errors` list the provider's failures land in is what
61
+ * lets one status and one exit code cover "did not index everything asked".
62
+ *
63
+ * The id is the path relative to the crawl root: the registry never assigned
64
+ * one (it could not read the file to), and the relative path is what an
65
+ * operator needs to find it.
66
+ *
67
+ * @param unreadable - The registry's read-failure log
68
+ * @param crawlRoot - The directory the crawl was rooted at
69
+ * @returns One error per unreadable file, in the order the crawl met them
70
+ */
71
+ export declare function unreadableIndexErrors(unreadable: readonly UnreadableResource[], crawlRoot: string): IndexError[];
8
72
  export declare function indexCommand(pathArg: string | undefined, options: IndexOptions): Promise<void>;
9
73
  export {};
10
74
  //# sourceMappingURL=index-command.d.ts.map