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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (422) hide show
  1. package/README.md +4 -5
  2. package/dist/bin/vat +34 -19
  3. package/dist/bin/vat.js +34 -19
  4. package/dist/bin/vat.js.map +1 -1
  5. package/dist/bin.js +44 -158
  6. package/dist/bin.js.map +1 -1
  7. package/dist/command-loaders.d.ts +2 -2
  8. package/dist/command-loaders.d.ts.map +1 -1
  9. package/dist/command-loaders.js +4 -2
  10. package/dist/command-loaders.js.map +1 -1
  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/install-path.d.ts +36 -0
  18. package/dist/commands/agent/install-path.d.ts.map +1 -0
  19. package/dist/commands/agent/install-path.js +44 -0
  20. package/dist/commands/agent/install-path.js.map +1 -0
  21. package/dist/commands/agent/install.d.ts.map +1 -1
  22. package/dist/commands/agent/install.js +22 -10
  23. package/dist/commands/agent/install.js.map +1 -1
  24. package/dist/commands/agent/installed.d.ts.map +1 -1
  25. package/dist/commands/agent/installed.js +22 -12
  26. package/dist/commands/agent/installed.js.map +1 -1
  27. package/dist/commands/agent/list.d.ts.map +1 -1
  28. package/dist/commands/agent/list.js +2 -1
  29. package/dist/commands/agent/list.js.map +1 -1
  30. package/dist/commands/agent/run.d.ts.map +1 -1
  31. package/dist/commands/agent/run.js +2 -1
  32. package/dist/commands/agent/run.js.map +1 -1
  33. package/dist/commands/agent/uninstall.d.ts.map +1 -1
  34. package/dist/commands/agent/uninstall.js +13 -6
  35. package/dist/commands/agent/uninstall.js.map +1 -1
  36. package/dist/commands/agent/validate.d.ts.map +1 -1
  37. package/dist/commands/agent/validate.js +3 -2
  38. package/dist/commands/agent/validate.js.map +1 -1
  39. package/dist/commands/ard/emit.d.ts +153 -0
  40. package/dist/commands/ard/emit.d.ts.map +1 -0
  41. package/dist/commands/ard/emit.js +276 -0
  42. package/dist/commands/ard/emit.js.map +1 -0
  43. package/dist/commands/ard/index.d.ts +12 -0
  44. package/dist/commands/ard/index.d.ts.map +1 -0
  45. package/dist/commands/ard/index.js +80 -0
  46. package/dist/commands/ard/index.js.map +1 -0
  47. package/dist/commands/ard/surfaces.d.ts +56 -0
  48. package/dist/commands/ard/surfaces.d.ts.map +1 -0
  49. package/dist/commands/ard/surfaces.js +150 -0
  50. package/dist/commands/ard/surfaces.js.map +1 -0
  51. package/dist/commands/audit/distributed-tree.d.ts.map +1 -1
  52. package/dist/commands/audit/distributed-tree.js +9 -6
  53. package/dist/commands/audit/distributed-tree.js.map +1 -1
  54. package/dist/commands/audit/scan-population.d.ts +158 -0
  55. package/dist/commands/audit/scan-population.d.ts.map +1 -0
  56. package/dist/commands/audit/scan-population.js +292 -0
  57. package/dist/commands/audit/scan-population.js.map +1 -0
  58. package/dist/commands/audit-settings.d.ts.map +1 -1
  59. package/dist/commands/audit-settings.js +6 -5
  60. package/dist/commands/audit-settings.js.map +1 -1
  61. package/dist/commands/audit.d.ts +78 -9
  62. package/dist/commands/audit.d.ts.map +1 -1
  63. package/dist/commands/audit.js +853 -473
  64. package/dist/commands/audit.js.map +1 -1
  65. package/dist/commands/build.d.ts.map +1 -1
  66. package/dist/commands/build.js +24 -24
  67. package/dist/commands/build.js.map +1 -1
  68. package/dist/commands/cache/clear.d.ts.map +1 -1
  69. package/dist/commands/cache/clear.js +17 -10
  70. package/dist/commands/cache/clear.js.map +1 -1
  71. package/dist/commands/claude/budget.d.ts +136 -24
  72. package/dist/commands/claude/budget.d.ts.map +1 -1
  73. package/dist/commands/claude/budget.js +152 -57
  74. package/dist/commands/claude/budget.js.map +1 -1
  75. package/dist/commands/claude/context.d.ts.map +1 -1
  76. package/dist/commands/claude/context.js +4 -3
  77. package/dist/commands/claude/context.js.map +1 -1
  78. package/dist/commands/claude/marketplace/changelog-utils.d.ts +1 -1
  79. package/dist/commands/claude/marketplace/changelog-utils.d.ts.map +1 -1
  80. package/dist/commands/claude/marketplace/changelog-utils.js +1 -2
  81. package/dist/commands/claude/marketplace/changelog-utils.js.map +1 -1
  82. package/dist/commands/claude/marketplace/git-publish.d.ts.map +1 -1
  83. package/dist/commands/claude/marketplace/git-publish.js +3 -2
  84. package/dist/commands/claude/marketplace/git-publish.js.map +1 -1
  85. package/dist/commands/claude/marketplace/license-utils.d.ts.map +1 -1
  86. package/dist/commands/claude/marketplace/license-utils.js +0 -1
  87. package/dist/commands/claude/marketplace/license-utils.js.map +1 -1
  88. package/dist/commands/claude/marketplace/publish-tree.d.ts.map +1 -1
  89. package/dist/commands/claude/marketplace/publish-tree.js +0 -6
  90. package/dist/commands/claude/marketplace/publish-tree.js.map +1 -1
  91. package/dist/commands/claude/marketplace/publish.d.ts.map +1 -1
  92. package/dist/commands/claude/marketplace/publish.js +2 -1
  93. package/dist/commands/claude/marketplace/publish.js.map +1 -1
  94. package/dist/commands/claude/marketplace/validate.d.ts +55 -22
  95. package/dist/commands/claude/marketplace/validate.d.ts.map +1 -1
  96. package/dist/commands/claude/marketplace/validate.js +392 -77
  97. package/dist/commands/claude/marketplace/validate.js.map +1 -1
  98. package/dist/commands/claude/org/api-keys.d.ts +0 -3
  99. package/dist/commands/claude/org/api-keys.d.ts.map +1 -1
  100. package/dist/commands/claude/org/api-keys.js +2 -1
  101. package/dist/commands/claude/org/api-keys.js.map +1 -1
  102. package/dist/commands/claude/org/helpers.d.ts +17 -22
  103. package/dist/commands/claude/org/helpers.d.ts.map +1 -1
  104. package/dist/commands/claude/org/helpers.js +6 -22
  105. package/dist/commands/claude/org/helpers.js.map +1 -1
  106. package/dist/commands/claude/org/invites.d.ts +0 -3
  107. package/dist/commands/claude/org/invites.d.ts.map +1 -1
  108. package/dist/commands/claude/org/invites.js +3 -2
  109. package/dist/commands/claude/org/invites.js.map +1 -1
  110. package/dist/commands/claude/org/skills.d.ts +103 -4
  111. package/dist/commands/claude/org/skills.d.ts.map +1 -1
  112. package/dist/commands/claude/org/skills.js +331 -123
  113. package/dist/commands/claude/org/skills.js.map +1 -1
  114. package/dist/commands/claude/org/users.d.ts +0 -3
  115. package/dist/commands/claude/org/users.d.ts.map +1 -1
  116. package/dist/commands/claude/org/users.js +3 -2
  117. package/dist/commands/claude/org/users.js.map +1 -1
  118. package/dist/commands/claude/org/workspaces.d.ts +0 -3
  119. package/dist/commands/claude/org/workspaces.d.ts.map +1 -1
  120. package/dist/commands/claude/org/workspaces.js +6 -5
  121. package/dist/commands/claude/org/workspaces.js.map +1 -1
  122. package/dist/commands/claude/plugin/build.d.ts +8 -0
  123. package/dist/commands/claude/plugin/build.d.ts.map +1 -1
  124. package/dist/commands/claude/plugin/build.js +28 -33
  125. package/dist/commands/claude/plugin/build.js.map +1 -1
  126. package/dist/commands/claude/plugin/helpers.d.ts.map +1 -1
  127. package/dist/commands/claude/plugin/helpers.js +0 -6
  128. package/dist/commands/claude/plugin/helpers.js.map +1 -1
  129. package/dist/commands/claude/plugin/install.d.ts +12 -0
  130. package/dist/commands/claude/plugin/install.d.ts.map +1 -1
  131. package/dist/commands/claude/plugin/install.js +71 -60
  132. package/dist/commands/claude/plugin/install.js.map +1 -1
  133. package/dist/commands/claude/plugin/list.d.ts.map +1 -1
  134. package/dist/commands/claude/plugin/list.js +3 -2
  135. package/dist/commands/claude/plugin/list.js.map +1 -1
  136. package/dist/commands/claude/plugin/plugin-changelog.d.ts.map +1 -1
  137. package/dist/commands/claude/plugin/plugin-changelog.js +0 -2
  138. package/dist/commands/claude/plugin/plugin-changelog.js.map +1 -1
  139. package/dist/commands/claude/plugin/plugin-files.d.ts.map +1 -1
  140. package/dist/commands/claude/plugin/plugin-files.js +0 -3
  141. package/dist/commands/claude/plugin/plugin-files.js.map +1 -1
  142. package/dist/commands/claude/plugin/plugin-validators.d.ts.map +1 -1
  143. package/dist/commands/claude/plugin/plugin-validators.js +3 -6
  144. package/dist/commands/claude/plugin/plugin-validators.js.map +1 -1
  145. package/dist/commands/claude/plugin/tree-copy.d.ts +73 -0
  146. package/dist/commands/claude/plugin/tree-copy.d.ts.map +1 -1
  147. package/dist/commands/claude/plugin/tree-copy.js +221 -15
  148. package/dist/commands/claude/plugin/tree-copy.js.map +1 -1
  149. package/dist/commands/claude/plugin/uninstall.d.ts.map +1 -1
  150. package/dist/commands/claude/plugin/uninstall.js +4 -4
  151. package/dist/commands/claude/plugin/uninstall.js.map +1 -1
  152. package/dist/commands/consistency-check.d.ts +9 -13
  153. package/dist/commands/consistency-check.d.ts.map +1 -1
  154. package/dist/commands/consistency-check.js +91 -81
  155. package/dist/commands/consistency-check.js.map +1 -1
  156. package/dist/commands/corpus/index.d.ts.map +1 -1
  157. package/dist/commands/corpus/index.js +3 -0
  158. package/dist/commands/corpus/index.js.map +1 -1
  159. package/dist/commands/corpus/report.d.ts +0 -1
  160. package/dist/commands/corpus/report.d.ts.map +1 -1
  161. package/dist/commands/corpus/report.js +1 -3
  162. package/dist/commands/corpus/report.js.map +1 -1
  163. package/dist/commands/corpus/runner.d.ts +58 -1
  164. package/dist/commands/corpus/runner.d.ts.map +1 -1
  165. package/dist/commands/corpus/runner.js +92 -21
  166. package/dist/commands/corpus/runner.js.map +1 -1
  167. package/dist/commands/corpus/scan.d.ts.map +1 -1
  168. package/dist/commands/corpus/scan.js +2 -4
  169. package/dist/commands/corpus/scan.js.map +1 -1
  170. package/dist/commands/corpus/seed.d.ts +4 -4
  171. package/dist/commands/corpus/seed.d.ts.map +1 -1
  172. package/dist/commands/corpus/seed.js +1 -3
  173. package/dist/commands/corpus/seed.js.map +1 -1
  174. package/dist/commands/doctor.d.ts +14 -0
  175. package/dist/commands/doctor.d.ts.map +1 -1
  176. package/dist/commands/doctor.js +147 -51
  177. package/dist/commands/doctor.js.map +1 -1
  178. package/dist/commands/inventory.d.ts.map +1 -1
  179. package/dist/commands/inventory.js +6 -7
  180. package/dist/commands/inventory.js.map +1 -1
  181. package/dist/commands/mcp/list-collections.d.ts.map +1 -1
  182. package/dist/commands/mcp/list-collections.js +2 -1
  183. package/dist/commands/mcp/list-collections.js.map +1 -1
  184. package/dist/commands/mcp/serve.d.ts.map +1 -1
  185. package/dist/commands/mcp/serve.js +3 -2
  186. package/dist/commands/mcp/serve.js.map +1 -1
  187. package/dist/commands/okf/index.d.ts +11 -0
  188. package/dist/commands/okf/index.d.ts.map +1 -0
  189. package/dist/commands/okf/index.js +114 -0
  190. package/dist/commands/okf/index.js.map +1 -0
  191. package/dist/commands/okf/validate.d.ts +191 -0
  192. package/dist/commands/okf/validate.d.ts.map +1 -0
  193. package/dist/commands/okf/validate.js +190 -0
  194. package/dist/commands/okf/validate.js.map +1 -0
  195. package/dist/commands/phase-utils.d.ts +30 -13
  196. package/dist/commands/phase-utils.d.ts.map +1 -1
  197. package/dist/commands/phase-utils.js +56 -19
  198. package/dist/commands/phase-utils.js.map +1 -1
  199. package/dist/commands/positional-args.d.ts.map +1 -1
  200. package/dist/commands/positional-args.js +2 -1
  201. package/dist/commands/positional-args.js.map +1 -1
  202. package/dist/commands/rag/clear-command.d.ts.map +1 -1
  203. package/dist/commands/rag/clear-command.js +2 -1
  204. package/dist/commands/rag/clear-command.js.map +1 -1
  205. package/dist/commands/rag/index-command.d.ts +27 -2
  206. package/dist/commands/rag/index-command.d.ts.map +1 -1
  207. package/dist/commands/rag/index-command.js +48 -8
  208. package/dist/commands/rag/index-command.js.map +1 -1
  209. package/dist/commands/rag/index.d.ts.map +1 -1
  210. package/dist/commands/rag/index.js +2 -0
  211. package/dist/commands/rag/index.js.map +1 -1
  212. package/dist/commands/rag/query-command.d.ts.map +1 -1
  213. package/dist/commands/rag/query-command.js +2 -1
  214. package/dist/commands/rag/query-command.js.map +1 -1
  215. package/dist/commands/rag/stats-command.d.ts.map +1 -1
  216. package/dist/commands/rag/stats-command.js +2 -1
  217. package/dist/commands/rag/stats-command.js.map +1 -1
  218. package/dist/commands/resources/check-progress.d.ts +3 -0
  219. package/dist/commands/resources/check-progress.d.ts.map +1 -1
  220. package/dist/commands/resources/check-progress.js +11 -2
  221. package/dist/commands/resources/check-progress.js.map +1 -1
  222. package/dist/commands/resources/check-supervisor.d.ts.map +1 -1
  223. package/dist/commands/resources/check-supervisor.js +14 -7
  224. package/dist/commands/resources/check-supervisor.js.map +1 -1
  225. package/dist/commands/resources/check.d.ts +168 -8
  226. package/dist/commands/resources/check.d.ts.map +1 -1
  227. package/dist/commands/resources/check.js +222 -118
  228. package/dist/commands/resources/check.js.map +1 -1
  229. package/dist/commands/resources/index.d.ts.map +1 -1
  230. package/dist/commands/resources/index.js +64 -29
  231. package/dist/commands/resources/index.js.map +1 -1
  232. package/dist/commands/resources/query.d.ts +18 -1
  233. package/dist/commands/resources/query.d.ts.map +1 -1
  234. package/dist/commands/resources/query.js +33 -12
  235. package/dist/commands/resources/query.js.map +1 -1
  236. package/dist/commands/resources/scan.d.ts.map +1 -1
  237. package/dist/commands/resources/scan.js +4 -8
  238. package/dist/commands/resources/scan.js.map +1 -1
  239. package/dist/commands/resources/validate.d.ts +30 -1
  240. package/dist/commands/resources/validate.d.ts.map +1 -1
  241. package/dist/commands/resources/validate.js +116 -14
  242. package/dist/commands/resources/validate.js.map +1 -1
  243. package/dist/commands/skill/review-checklist.d.ts +3 -2
  244. package/dist/commands/skill/review-checklist.d.ts.map +1 -1
  245. package/dist/commands/skill/review-checklist.js +4 -2
  246. package/dist/commands/skill/review-checklist.js.map +1 -1
  247. package/dist/commands/skill/review.d.ts +247 -0
  248. package/dist/commands/skill/review.d.ts.map +1 -1
  249. package/dist/commands/skill/review.js +98 -61
  250. package/dist/commands/skill/review.js.map +1 -1
  251. package/dist/commands/skill/test/configure.d.ts.map +1 -1
  252. package/dist/commands/skill/test/configure.js +0 -1
  253. package/dist/commands/skill/test/configure.js.map +1 -1
  254. package/dist/commands/skill/test/run.d.ts +12 -6
  255. package/dist/commands/skill/test/run.d.ts.map +1 -1
  256. package/dist/commands/skill/test/run.js +137 -67
  257. package/dist/commands/skill/test/run.js.map +1 -1
  258. package/dist/commands/skills/build.d.ts +69 -2
  259. package/dist/commands/skills/build.d.ts.map +1 -1
  260. package/dist/commands/skills/build.js +128 -42
  261. package/dist/commands/skills/build.js.map +1 -1
  262. package/dist/commands/skills/install.d.ts +2 -1
  263. package/dist/commands/skills/install.d.ts.map +1 -1
  264. package/dist/commands/skills/install.js +20 -30
  265. package/dist/commands/skills/install.js.map +1 -1
  266. package/dist/commands/skills/list.d.ts +2 -1
  267. package/dist/commands/skills/list.d.ts.map +1 -1
  268. package/dist/commands/skills/list.js +44 -26
  269. package/dist/commands/skills/list.js.map +1 -1
  270. package/dist/commands/skills/package.d.ts +1 -1
  271. package/dist/commands/skills/package.d.ts.map +1 -1
  272. package/dist/commands/skills/package.js +6 -8
  273. package/dist/commands/skills/package.js.map +1 -1
  274. package/dist/commands/skills/scope-guard.d.ts.map +1 -1
  275. package/dist/commands/skills/scope-guard.js +2 -4
  276. package/dist/commands/skills/scope-guard.js.map +1 -1
  277. package/dist/commands/skills/shared.d.ts.map +1 -1
  278. package/dist/commands/skills/shared.js +2 -4
  279. package/dist/commands/skills/shared.js.map +1 -1
  280. package/dist/commands/skills/skill-discovery.d.ts +40 -1
  281. package/dist/commands/skills/skill-discovery.d.ts.map +1 -1
  282. package/dist/commands/skills/skill-discovery.js +32 -4
  283. package/dist/commands/skills/skill-discovery.js.map +1 -1
  284. package/dist/commands/skills/source-resolvers.d.ts +15 -0
  285. package/dist/commands/skills/source-resolvers.d.ts.map +1 -1
  286. package/dist/commands/skills/source-resolvers.js +25 -4
  287. package/dist/commands/skills/source-resolvers.js.map +1 -1
  288. package/dist/commands/skills/validate-command.d.ts.map +1 -1
  289. package/dist/commands/skills/validate-command.js +11 -3
  290. package/dist/commands/skills/validate-command.js.map +1 -1
  291. package/dist/commands/skills/validate.d.ts +66 -7
  292. package/dist/commands/skills/validate.d.ts.map +1 -1
  293. package/dist/commands/skills/validate.js +133 -29
  294. package/dist/commands/skills/validate.js.map +1 -1
  295. package/dist/commands/validate.d.ts +1 -1
  296. package/dist/commands/validate.js +8 -6
  297. package/dist/commands/validate.js.map +1 -1
  298. package/dist/commands/verify.d.ts +102 -5
  299. package/dist/commands/verify.d.ts.map +1 -1
  300. package/dist/commands/verify.js +246 -69
  301. package/dist/commands/verify.js.map +1 -1
  302. package/dist/index.d.ts +0 -1
  303. package/dist/index.d.ts.map +1 -1
  304. package/dist/index.js +5 -1
  305. package/dist/index.js.map +1 -1
  306. package/dist/report-schemas.d.ts +45 -0
  307. package/dist/report-schemas.d.ts.map +1 -0
  308. package/dist/report-schemas.js +102 -0
  309. package/dist/report-schemas.js.map +1 -0
  310. package/dist/skill-resolution/packaging-config.d.ts +49 -5
  311. package/dist/skill-resolution/packaging-config.d.ts.map +1 -1
  312. package/dist/skill-resolution/packaging-config.js +59 -19
  313. package/dist/skill-resolution/packaging-config.js.map +1 -1
  314. package/dist/skill-resolution/resolve-skill-reference.d.ts.map +1 -1
  315. package/dist/skill-resolution/resolve-skill-reference.js +8 -6
  316. package/dist/skill-resolution/resolve-skill-reference.js.map +1 -1
  317. package/dist/utils/agent-discovery.d.ts.map +1 -1
  318. package/dist/utils/agent-discovery.js +22 -11
  319. package/dist/utils/agent-discovery.js.map +1 -1
  320. package/dist/utils/agent-runner.d.ts.map +1 -1
  321. package/dist/utils/agent-runner.js +0 -1
  322. package/dist/utils/agent-runner.js.map +1 -1
  323. package/dist/utils/command-error.d.ts +87 -55
  324. package/dist/utils/command-error.d.ts.map +1 -1
  325. package/dist/utils/command-error.js +113 -64
  326. package/dist/utils/command-error.js.map +1 -1
  327. package/dist/utils/config-loader.d.ts +2 -1
  328. package/dist/utils/config-loader.d.ts.map +1 -1
  329. package/dist/utils/config-loader.js +3 -6
  330. package/dist/utils/config-loader.js.map +1 -1
  331. package/dist/utils/context-budget-issues.d.ts +1 -1
  332. package/dist/utils/context-budget-issues.js +1 -1
  333. package/dist/utils/corpus-target.d.ts +5 -27
  334. package/dist/utils/corpus-target.d.ts.map +1 -1
  335. package/dist/utils/corpus-target.js +7 -33
  336. package/dist/utils/corpus-target.js.map +1 -1
  337. package/dist/utils/edge-lens-evaluation.d.ts +83 -0
  338. package/dist/utils/edge-lens-evaluation.d.ts.map +1 -0
  339. package/dist/utils/edge-lens-evaluation.js +110 -0
  340. package/dist/utils/edge-lens-evaluation.js.map +1 -0
  341. package/dist/utils/help-loader.d.ts.map +1 -1
  342. package/dist/utils/help-loader.js +0 -1
  343. package/dist/utils/help-loader.js.map +1 -1
  344. package/dist/utils/issue-rendering.d.ts +2 -2
  345. package/dist/utils/issue-rendering.js +2 -2
  346. package/dist/utils/optional-backend.d.ts +5 -4
  347. package/dist/utils/optional-backend.d.ts.map +1 -1
  348. package/dist/utils/optional-backend.js +7 -5
  349. package/dist/utils/optional-backend.js.map +1 -1
  350. package/dist/utils/output.d.ts +9 -0
  351. package/dist/utils/output.d.ts.map +1 -1
  352. package/dist/utils/output.js +16 -0
  353. package/dist/utils/output.js.map +1 -1
  354. package/dist/utils/package-json.d.ts +24 -0
  355. package/dist/utils/package-json.d.ts.map +1 -0
  356. package/dist/utils/package-json.js +49 -0
  357. package/dist/utils/package-json.js.map +1 -0
  358. package/dist/utils/project-root-policy.d.ts +20 -0
  359. package/dist/utils/project-root-policy.d.ts.map +1 -1
  360. package/dist/utils/project-root-policy.js +30 -0
  361. package/dist/utils/project-root-policy.js.map +1 -1
  362. package/dist/utils/projection-query.d.ts +41 -4
  363. package/dist/utils/projection-query.d.ts.map +1 -1
  364. package/dist/utils/projection-query.js +44 -10
  365. package/dist/utils/projection-query.js.map +1 -1
  366. package/dist/utils/projection-store.d.ts +41 -15
  367. package/dist/utils/projection-store.d.ts.map +1 -1
  368. package/dist/utils/projection-store.js +65 -18
  369. package/dist/utils/projection-store.js.map +1 -1
  370. package/dist/utils/repeatable-option.d.ts +37 -0
  371. package/dist/utils/repeatable-option.d.ts.map +1 -0
  372. package/dist/utils/repeatable-option.js +39 -0
  373. package/dist/utils/repeatable-option.js.map +1 -0
  374. package/dist/utils/resource-loader.d.ts +4 -3
  375. package/dist/utils/resource-loader.d.ts.map +1 -1
  376. package/dist/utils/resource-loader.js +63 -32
  377. package/dist/utils/resource-loader.js.map +1 -1
  378. package/dist/utils/root-argv.d.ts +53 -0
  379. package/dist/utils/root-argv.d.ts.map +1 -0
  380. package/dist/utils/root-argv.js +215 -0
  381. package/dist/utils/root-argv.js.map +1 -0
  382. package/dist/utils/run-integrity.d.ts +95 -0
  383. package/dist/utils/run-integrity.d.ts.map +1 -0
  384. package/dist/utils/run-integrity.js +102 -0
  385. package/dist/utils/run-integrity.js.map +1 -0
  386. package/dist/utils/skill-packaging-config.d.ts +27 -0
  387. package/dist/utils/skill-packaging-config.d.ts.map +1 -1
  388. package/dist/utils/skill-packaging-config.js +30 -0
  389. package/dist/utils/skill-packaging-config.js.map +1 -1
  390. package/dist/utils/sqlite-experimental-warning.d.ts +69 -0
  391. package/dist/utils/sqlite-experimental-warning.d.ts.map +1 -0
  392. package/dist/utils/sqlite-experimental-warning.js +144 -0
  393. package/dist/utils/sqlite-experimental-warning.js.map +1 -0
  394. package/dist/utils/url-redact.d.ts.map +1 -1
  395. package/dist/utils/url-redact.js +4 -6
  396. package/dist/utils/url-redact.js.map +1 -1
  397. package/dist/utils/user-context-scanner.d.ts +8 -0
  398. package/dist/utils/user-context-scanner.d.ts.map +1 -1
  399. package/dist/utils/user-context-scanner.js +4 -2
  400. package/dist/utils/user-context-scanner.js.map +1 -1
  401. package/dist/utils/validate-help-files.d.ts.map +1 -1
  402. package/dist/utils/validate-help-files.js +12 -6
  403. package/dist/utils/validate-help-files.js.map +1 -1
  404. package/dist/utils/vat-bin-path.d.ts.map +1 -1
  405. package/dist/utils/vat-bin-path.js +0 -1
  406. package/dist/utils/vat-bin-path.js.map +1 -1
  407. package/dist/version.d.ts.map +1 -1
  408. package/dist/version.js +1 -3
  409. package/dist/version.js.map +1 -1
  410. package/docs/audit.md +141 -37
  411. package/docs/doctor.md +7 -6
  412. package/docs/index.md +19 -11
  413. package/docs/rag.md +3 -2
  414. package/docs/resources.md +5 -2
  415. package/docs/skill-test.md +10 -9
  416. package/docs/skills.md +53 -69
  417. package/package.json +24 -29
  418. package/schemas/ard-emit.json +149 -0
  419. package/schemas/claude-budget.json +197 -0
  420. package/schemas/okf-validate.json +170 -0
  421. package/schemas/resources-check.json +186 -0
  422. package/schemas/skill-review.json +230 -0
@@ -1,12 +1,15 @@
1
1
  /**
2
2
  * Shared command error handling utilities.
3
3
  *
4
- * THE single implementation of each failure exit. `commands/skills/` used to
4
+ * The failure endings a command may take, each publishing a document and
5
+ * ending on one member of the `ExitCode` contract. `commands/skills/` used to
5
6
  * carry its own `handleCommandError` that logged to stderr and exited 2 having
6
7
  * written nothing to stdout — same name, same signature, same documented
7
- * contract, silently different behaviour. Every command family routes here.
8
+ * contract, silently different behaviour. A command that ends some other way
9
+ * still names its code from `ExitCode`; the lint rule
10
+ * `no-literal-process-exit` refuses a bare number.
8
11
  */
9
- import { type SeverityCounts, type ValidationIssue } from '@vibe-agent-toolkit/schema';
12
+ import { type ExitCodeValue, type SeverityCounts, type ValidationIssue } from '@vibe-agent-toolkit/schema';
10
13
  import type { Logger } from './logger.js';
11
14
  /**
12
15
  * Format duration for human readability
@@ -14,25 +17,6 @@ import type { Logger } from './logger.js';
14
17
  * @returns Formatted duration string (e.g., "500ms", "1.5s", "1.5m")
15
18
  */
16
19
  export declare function formatDuration(ms: number): string;
17
- /**
18
- * Everything about a thrown value that `error.message` alone discards.
19
- *
20
- * Exit 2 is the UNEXPECTED failure — an internal bug, not a usage mistake — and
21
- * the one thing a reader needs there is the frame that threw. A real `TypeError`
22
- * arrived here as a single line (`Cannot read properties of undefined (reading
23
- * 'readdir')`) with no file, no frames, and no flag that would produce them; the
24
- * only way to find the throw site was to hand-patch the built `dist`. A value
25
- * thrown that is not an `Error` fared worse still — the envelope flattens it to
26
- * the literal string `Unknown error`, which names neither its type nor its
27
- * contents.
28
- *
29
- * The result rides the logger's **debug** channel (`--debug`), so default output
30
- * is unchanged and no golden moves.
31
- *
32
- * @param error - The value that was thrown
33
- * @returns Stack trace for an `Error`, or an inspected rendering of a non-`Error`
34
- */
35
- export declare function errorDiagnostics(error: unknown): string;
36
20
  /** The document a command publishes when an unexpected failure stops it. */
37
21
  export interface CommandErrorDocument {
38
22
  status: 'error';
@@ -63,8 +47,8 @@ export declare function reportCommandError(error: unknown, logger: Logger, start
63
47
  /**
64
48
  * Handle command error with standard formatting and exit.
65
49
  *
66
- * The command-line ending for {@link reportCommandError}. Exit 2 is the
67
- * UNEXPECTED failure, per the exit-code contract every command's help documents.
50
+ * The command-line ending for {@link reportCommandError}. `ExitCode.ERROR` is
51
+ * the UNEXPECTED failure, per the exit-code contract every command's help documents.
68
52
  *
69
53
  * 🔑 **`format` is not decoration.** Every command offering `--format json`
70
54
  * honoured it on the success path and emitted YAML here, so the one document a
@@ -82,6 +66,65 @@ export declare function reportCommandError(error: unknown, logger: Logger, start
82
66
  * omitted) for YAML — matching the success path's own two-branch switch
83
67
  */
84
68
  export declare function handleCommandError(error: unknown, logger: Logger, startTime: number, commandName: string, format?: string | undefined): never;
69
+ /**
70
+ * Publish an EXPECTED failure in the format the operator asked for, then exit
71
+ * with the code the command's own contract assigns it.
72
+ *
73
+ * The third ending of one failure, beside {@link handleCommandError} (the
74
+ * UNEXPECTED failure, always `ERROR`) and {@link handleValidationGateFailure}
75
+ * (a validation gate, always `FINDINGS`, always YAML). This one covers the
76
+ * failure that is neither: the command ran, understood the project, and has a
77
+ * documented non-zero code for what it found — `vat ard emit` ending on
78
+ * `FINDINGS` for "this project declares no `ard:` block" or `ERROR` for "there
79
+ * is no config file here".
80
+ *
81
+ * 🔑 It exists because those endings were written inline, and an inline ending
82
+ * publishes nothing: `ard emit` honoured `--format json` on its success path
83
+ * and through `handleCommandError`, then wrote **zero bytes to stdout** on the
84
+ * two exits a repository actually reaches — the commonest being the first run
85
+ * of any repository that never opted into ARD. A CI wrapper reading stdout got
86
+ * an empty document and a bare non-zero code, which is the exact failure the
87
+ * `format` note on {@link handleCommandError} exists to forbid.
88
+ *
89
+ * The message goes to stderr as it always did — humans read it there — and the
90
+ * document goes to stdout, matching what both neighbours already do.
91
+ *
92
+ * @param message - What went wrong, in the command's own words
93
+ * @param exitCode - The code this command's `--help` assigns to this outcome
94
+ * @param startTime - Command start time (from Date.now()), so the document
95
+ * reports the run's real duration rather than a fabricated zero
96
+ * @param format - What the operator asked for: `json`, or anything else (and
97
+ * omitted) for YAML — the same two-branch switch the success path uses
98
+ */
99
+ export declare function handleExpectedFailure(message: string, exitCode: ExitCodeValue, startTime: number, format?: string | undefined): never;
100
+ /**
101
+ * {@link handleCommandError} for a command whose document is the shared
102
+ * `Report<T>` envelope: the failure document IS the envelope
103
+ * (`buildErrorReport`), so the emitted `schemas/<command>.json` describes the
104
+ * failed run too. Every command registered as `report` in `report-schemas.ts`
105
+ * ends its unexpected failures here; `handleCommandError`'s
106
+ * `CommandErrorDocument` is the shape the legacy documents keep.
107
+ *
108
+ * @param error - The value that was thrown
109
+ * @param logger - Logger instance for error output
110
+ * @param startTime - Command start time (from Date.now())
111
+ * @param commandName - Name of the command (for the stderr line)
112
+ * @param format - What the operator asked for: `json`, or anything else (and
113
+ * omitted) for YAML
114
+ */
115
+ export declare function handleReportCommandError(error: unknown, logger: Logger, startTime: number, commandName: string, format?: string | undefined): never;
116
+ /**
117
+ * {@link handleExpectedFailure} for a command whose document is the shared
118
+ * `Report<T>` envelope — same document as {@link handleReportCommandError},
119
+ * with the exit code the command's own contract assigns.
120
+ *
121
+ * @param message - What went wrong, in the command's own words
122
+ * @param exitCode - The code this command's `--help` assigns to this outcome
123
+ * @param startTime - Command start time (from Date.now())
124
+ * @param format - What the operator asked for: `json`, or anything else (and
125
+ * omitted) for YAML
126
+ */
127
+ export declare function handleReportExpectedFailure(message: string, exitCode: ExitCodeValue, startTime: number, format?: string | undefined): never;
85
128
  /** The payload a command publishes when its own validation gate stops it. */
86
129
  export interface ValidationGateFailure {
87
130
  status: 'error';
@@ -99,9 +142,9 @@ export interface ValidationGateFailure {
99
142
  export declare function buildValidationGateFailure(subject: string, issues: readonly ValidationIssue[]): ValidationGateFailure;
100
143
  /**
101
144
  * Publish the documented failure payload for a command stopped by its OWN
102
- * validation gate, then exit 1.
145
+ * validation gate, then end on `FINDINGS`.
103
146
  *
104
- * {@link handleCommandError} above covers the UNEXPECTED failure (exit 2). This
147
+ * {@link handleCommandError} above covers the UNEXPECTED failure (`ERROR`). This
105
148
  * covers the expected one, and `vat skills build` / `vat skills package` both
106
149
  * exited it after writing zero bytes to stdout — while their `--help` texts
107
150
  * document a YAML summary on stdout and reserve exit 1 for exactly this case.
@@ -109,40 +152,29 @@ export declare function buildValidationGateFailure(subject: string, issues: read
109
152
  * a bare non-zero code.
110
153
  */
111
154
  export declare function handleValidationGateFailure(subject: string, issues: readonly ValidationIssue[]): never;
112
- /**
113
- * The exit code a USAGE mistake ends on: a flag this program does not declare,
114
- * a verb it does not know, a missing or invalid argument.
115
- *
116
- * 🔑 **Two is not a style choice — one was a factual lie.** Every command's
117
- * `--help` publishes the same three-way contract: `0` no error-severity
118
- * findings, `1` at least one, `2` a system error. Commander's default for a
119
- * usage mistake is `process.exit(1)`, so `vat resources check --json` (the
120
- * option is `--format json`) exited **1** — which, read against the contract
121
- * the command itself prints, asserts that at least one check was violated.
122
- * Nothing had run. A CI wrapper spelled `if [ $? -ne 0 ]; then report_findings`
123
- * therefore reported findings that were never computed, and the operator went
124
- * looking for a violation that did not exist.
125
- *
126
- * The same hole swallowed a mistyped verb (`vat resources chekc`) and every
127
- * unknown option on all 69 commands. VAT's own refusals were already correct —
128
- * an unknown `--check` name and an unusable `--budget` both exit 2 — so the
129
- * inconsistency was Commander's default leaking through the one path VAT had
130
- * not claimed.
131
- *
132
- * ⚠️ **Help and `--version` are NOT usage mistakes.** They terminate through
133
- * the same `_exit` path with code 0 and must stay 0; only a non-zero commander
134
- * ending is remapped. See {@link exitCodeForCommanderEnding}.
135
- */
136
- export declare const USAGE_ERROR_EXIT_CODE = 2;
137
155
  /**
138
156
  * Map a commander termination to the exit code VAT's contract promises.
139
157
  *
158
+ * A USAGE mistake — a flag this program does not declare, a verb it does not
159
+ * know, a missing or invalid argument — ends on `ExitCode.ERROR`, and the
160
+ * reason is not style. Commander's default for a usage mistake is
161
+ * `process.exit(1)`, so `vat resources check --json` (the option is
162
+ * `--format json`) exited **1** — which, read against the contract the command
163
+ * itself prints, asserts that at least one check was violated. Nothing had
164
+ * run. A CI wrapper spelled `if [ $? -ne 0 ]; then report_findings` therefore
165
+ * reported findings that were never computed. The same hole swallowed a
166
+ * mistyped verb (`vat resources chekc`) and every unknown option on every
167
+ * command.
168
+ *
140
169
  * Commander reports BOTH successful and failing terminations through the same
141
170
  * `CommanderError`: `--help` and `--version` carry `exitCode` 0, while an
142
171
  * unknown option, an unknown command and `help({ error: true })` carry non-zero.
143
172
  * Anything non-zero is a usage mistake by construction — commander raises these
144
- * only while parsing, before any action runs — so it maps to
145
- * {@link USAGE_ERROR_EXIT_CODE}.
173
+ * only while parsing, before any action runs — so it maps to `ERROR`.
174
+ *
175
+ * ⚠️ **Help and `--version` are NOT usage mistakes.** They terminate through
176
+ * the same `_exit` path with code 0 and must stay `OK`; only a non-zero
177
+ * commander ending is remapped.
146
178
  *
147
179
  * 🪤 Do NOT switch on `error.code` (`commander.unknownOption`, `commander.help`,
148
180
  * …). The unknown-COMMAND path arrives as `commander.help` with exitCode 1,
@@ -151,7 +183,7 @@ export declare const USAGE_ERROR_EXIT_CODE = 2;
151
183
  * code commander already computed is the honest discriminator; the string is not.
152
184
  *
153
185
  * @param commanderExitCode - The `exitCode` commander put on its CommanderError
154
- * @returns 0 for a successful ending, {@link USAGE_ERROR_EXIT_CODE} otherwise
186
+ * @returns `OK` for a successful ending, `ERROR` otherwise
155
187
  */
156
- export declare function exitCodeForCommanderEnding(commanderExitCode: number): number;
188
+ export declare function exitCodeForCommanderEnding(commanderExitCode: number): ExitCodeValue;
157
189
  //# sourceMappingURL=command-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"command-error.d.ts","sourceRoot":"","sources":["../../src/utils/command-error.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAmB,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAExG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAMvD;AAED,4EAA4E;AAC5E,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAClB,oBAAoB,CAQtB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,GAC1B,KAAK,CAQP;AAED,6EAA6E;AAC7E,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,cAAc,CAAC;IAC5B,iFAAiF;IACjF,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH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,KAAK,CAGP;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,aAAa,EACvB,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,GAC1B,KAAK,CAQP;AAkBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,GAC1B,KAAK,CAGP;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,aAAa,EACvB,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,GAC1B,KAAK,CAGP;AAED,6EAA6E;AAC7E,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,cAAc,CAAC;IAC5B,iFAAiF;IACjF,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,SAAS,eAAe,EAAE,GACjC,qBAAqB,CAEvB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,SAAS,eAAe,EAAE,GACjC,KAAK,CAGP;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,0BAA0B,CAAC,iBAAiB,EAAE,MAAM,GAAG,aAAa,CAEnF"}
@@ -1,13 +1,15 @@
1
1
  /**
2
2
  * Shared command error handling utilities.
3
3
  *
4
- * THE single implementation of each failure exit. `commands/skills/` used to
4
+ * The failure endings a command may take, each publishing a document and
5
+ * ending on one member of the `ExitCode` contract. `commands/skills/` used to
5
6
  * carry its own `handleCommandError` that logged to stderr and exited 2 having
6
7
  * written nothing to stdout — same name, same signature, same documented
7
- * contract, silently different behaviour. Every command family routes here.
8
+ * contract, silently different behaviour. A command that ends some other way
9
+ * still names its code from `ExitCode`; the lint rule
10
+ * `no-literal-process-exit` refuses a bare number.
8
11
  */
9
- import { inspect } from 'node:util';
10
- import { countBySeverity } from '@vibe-agent-toolkit/schema';
12
+ import { ExitCode, buildErrorReport, countBySeverity, errorDiagnostics } from '@vibe-agent-toolkit/schema';
11
13
  import { writeJsonOutput, writeYamlOutput } from './output.js';
12
14
  /**
13
15
  * Format duration for human readability
@@ -23,31 +25,6 @@ export function formatDuration(ms) {
23
25
  }
24
26
  return `${(ms / 60000).toFixed(1)}m`;
25
27
  }
26
- /**
27
- * Everything about a thrown value that `error.message` alone discards.
28
- *
29
- * Exit 2 is the UNEXPECTED failure — an internal bug, not a usage mistake — and
30
- * the one thing a reader needs there is the frame that threw. A real `TypeError`
31
- * arrived here as a single line (`Cannot read properties of undefined (reading
32
- * 'readdir')`) with no file, no frames, and no flag that would produce them; the
33
- * only way to find the throw site was to hand-patch the built `dist`. A value
34
- * thrown that is not an `Error` fared worse still — the envelope flattens it to
35
- * the literal string `Unknown error`, which names neither its type nor its
36
- * contents.
37
- *
38
- * The result rides the logger's **debug** channel (`--debug`), so default output
39
- * is unchanged and no golden moves.
40
- *
41
- * @param error - The value that was thrown
42
- * @returns Stack trace for an `Error`, or an inspected rendering of a non-`Error`
43
- */
44
- export function errorDiagnostics(error) {
45
- if (error instanceof Error) {
46
- // `stack` is optional in the type and absent on some cross-realm errors.
47
- return error.stack ?? `${error.name}: ${error.message}`;
48
- }
49
- return `Non-Error value thrown: ${inspect(error, { depth: 3 })}`;
50
- }
51
28
  /**
52
29
  * Report an unexpected failure on stderr and return the document that describes
53
30
  * it, WITHOUT deciding how the caller ends.
@@ -78,8 +55,8 @@ export function reportCommandError(error, logger, startTime, commandName) {
78
55
  /**
79
56
  * Handle command error with standard formatting and exit.
80
57
  *
81
- * The command-line ending for {@link reportCommandError}. Exit 2 is the
82
- * UNEXPECTED failure, per the exit-code contract every command's help documents.
58
+ * The command-line ending for {@link reportCommandError}. `ExitCode.ERROR` is
59
+ * the UNEXPECTED failure, per the exit-code contract every command's help documents.
83
60
  *
84
61
  * 🔑 **`format` is not decoration.** Every command offering `--format json`
85
62
  * honoured it on the success path and emitted YAML here, so the one document a
@@ -98,13 +75,96 @@ export function reportCommandError(error, logger, startTime, commandName) {
98
75
  */
99
76
  export function handleCommandError(error, logger, startTime, commandName, format) {
100
77
  const document = reportCommandError(error, logger, startTime, commandName);
78
+ return publishFailure(document, format, ExitCode.ERROR);
79
+ }
80
+ /**
81
+ * Publish an EXPECTED failure in the format the operator asked for, then exit
82
+ * with the code the command's own contract assigns it.
83
+ *
84
+ * The third ending of one failure, beside {@link handleCommandError} (the
85
+ * UNEXPECTED failure, always `ERROR`) and {@link handleValidationGateFailure}
86
+ * (a validation gate, always `FINDINGS`, always YAML). This one covers the
87
+ * failure that is neither: the command ran, understood the project, and has a
88
+ * documented non-zero code for what it found — `vat ard emit` ending on
89
+ * `FINDINGS` for "this project declares no `ard:` block" or `ERROR` for "there
90
+ * is no config file here".
91
+ *
92
+ * 🔑 It exists because those endings were written inline, and an inline ending
93
+ * publishes nothing: `ard emit` honoured `--format json` on its success path
94
+ * and through `handleCommandError`, then wrote **zero bytes to stdout** on the
95
+ * two exits a repository actually reaches — the commonest being the first run
96
+ * of any repository that never opted into ARD. A CI wrapper reading stdout got
97
+ * an empty document and a bare non-zero code, which is the exact failure the
98
+ * `format` note on {@link handleCommandError} exists to forbid.
99
+ *
100
+ * The message goes to stderr as it always did — humans read it there — and the
101
+ * document goes to stdout, matching what both neighbours already do.
102
+ *
103
+ * @param message - What went wrong, in the command's own words
104
+ * @param exitCode - The code this command's `--help` assigns to this outcome
105
+ * @param startTime - Command start time (from Date.now()), so the document
106
+ * reports the run's real duration rather than a fabricated zero
107
+ * @param format - What the operator asked for: `json`, or anything else (and
108
+ * omitted) for YAML — the same two-branch switch the success path uses
109
+ */
110
+ export function handleExpectedFailure(message, exitCode, startTime, format) {
111
+ process.stderr.write(`${message}\n`);
112
+ const document = {
113
+ status: 'error',
114
+ error: message,
115
+ duration: formatDuration(Date.now() - startTime),
116
+ };
117
+ return publishFailure(document, format, exitCode);
118
+ }
119
+ /**
120
+ * Publish a failure document in the operator's format, then end on `exitCode`.
121
+ *
122
+ * @param document - What to write to stdout
123
+ * @param format - `json`, or anything else (and omitted) for YAML
124
+ * @param exitCode - The member of the contract this ending is
125
+ */
126
+ function publishFailure(document, format, exitCode) {
101
127
  if (format === 'json') {
102
128
  writeJsonOutput(document);
103
129
  }
104
130
  else {
105
131
  writeYamlOutput(document);
106
132
  }
107
- process.exit(2);
133
+ process.exit(exitCode);
134
+ }
135
+ /**
136
+ * {@link handleCommandError} for a command whose document is the shared
137
+ * `Report<T>` envelope: the failure document IS the envelope
138
+ * (`buildErrorReport`), so the emitted `schemas/<command>.json` describes the
139
+ * failed run too. Every command registered as `report` in `report-schemas.ts`
140
+ * ends its unexpected failures here; `handleCommandError`'s
141
+ * `CommandErrorDocument` is the shape the legacy documents keep.
142
+ *
143
+ * @param error - The value that was thrown
144
+ * @param logger - Logger instance for error output
145
+ * @param startTime - Command start time (from Date.now())
146
+ * @param commandName - Name of the command (for the stderr line)
147
+ * @param format - What the operator asked for: `json`, or anything else (and
148
+ * omitted) for YAML
149
+ */
150
+ export function handleReportCommandError(error, logger, startTime, commandName, format) {
151
+ const { error: message } = reportCommandError(error, logger, startTime, commandName);
152
+ return publishFailure(buildErrorReport(message, Date.now() - startTime), format, ExitCode.ERROR);
153
+ }
154
+ /**
155
+ * {@link handleExpectedFailure} for a command whose document is the shared
156
+ * `Report<T>` envelope — same document as {@link handleReportCommandError},
157
+ * with the exit code the command's own contract assigns.
158
+ *
159
+ * @param message - What went wrong, in the command's own words
160
+ * @param exitCode - The code this command's `--help` assigns to this outcome
161
+ * @param startTime - Command start time (from Date.now())
162
+ * @param format - What the operator asked for: `json`, or anything else (and
163
+ * omitted) for YAML
164
+ */
165
+ export function handleReportExpectedFailure(message, exitCode, startTime, format) {
166
+ process.stderr.write(`${message}\n`);
167
+ return publishFailure(buildErrorReport(message, Date.now() - startTime), format, exitCode);
108
168
  }
109
169
  /**
110
170
  * Pure: the document {@link handleValidationGateFailure} writes.
@@ -118,9 +178,9 @@ export function buildValidationGateFailure(subject, issues) {
118
178
  }
119
179
  /**
120
180
  * Publish the documented failure payload for a command stopped by its OWN
121
- * validation gate, then exit 1.
181
+ * validation gate, then end on `FINDINGS`.
122
182
  *
123
- * {@link handleCommandError} above covers the UNEXPECTED failure (exit 2). This
183
+ * {@link handleCommandError} above covers the UNEXPECTED failure (`ERROR`). This
124
184
  * covers the expected one, and `vat skills build` / `vat skills package` both
125
185
  * exited it after writing zero bytes to stdout — while their `--help` texts
126
186
  * document a YAML summary on stdout and reserve exit 1 for exactly this case.
@@ -129,42 +189,31 @@ export function buildValidationGateFailure(subject, issues) {
129
189
  */
130
190
  export function handleValidationGateFailure(subject, issues) {
131
191
  writeYamlOutput(buildValidationGateFailure(subject, issues));
132
- process.exit(1);
192
+ process.exit(ExitCode.FINDINGS);
133
193
  }
134
- /**
135
- * The exit code a USAGE mistake ends on: a flag this program does not declare,
136
- * a verb it does not know, a missing or invalid argument.
137
- *
138
- * 🔑 **Two is not a style choice — one was a factual lie.** Every command's
139
- * `--help` publishes the same three-way contract: `0` no error-severity
140
- * findings, `1` at least one, `2` a system error. Commander's default for a
141
- * usage mistake is `process.exit(1)`, so `vat resources check --json` (the
142
- * option is `--format json`) exited **1** — which, read against the contract
143
- * the command itself prints, asserts that at least one check was violated.
144
- * Nothing had run. A CI wrapper spelled `if [ $? -ne 0 ]; then report_findings`
145
- * therefore reported findings that were never computed, and the operator went
146
- * looking for a violation that did not exist.
147
- *
148
- * The same hole swallowed a mistyped verb (`vat resources chekc`) and every
149
- * unknown option on all 69 commands. VAT's own refusals were already correct —
150
- * an unknown `--check` name and an unusable `--budget` both exit 2 — so the
151
- * inconsistency was Commander's default leaking through the one path VAT had
152
- * not claimed.
153
- *
154
- * ⚠️ **Help and `--version` are NOT usage mistakes.** They terminate through
155
- * the same `_exit` path with code 0 and must stay 0; only a non-zero commander
156
- * ending is remapped. See {@link exitCodeForCommanderEnding}.
157
- */
158
- export const USAGE_ERROR_EXIT_CODE = 2;
159
194
  /**
160
195
  * Map a commander termination to the exit code VAT's contract promises.
161
196
  *
197
+ * A USAGE mistake — a flag this program does not declare, a verb it does not
198
+ * know, a missing or invalid argument — ends on `ExitCode.ERROR`, and the
199
+ * reason is not style. Commander's default for a usage mistake is
200
+ * `process.exit(1)`, so `vat resources check --json` (the option is
201
+ * `--format json`) exited **1** — which, read against the contract the command
202
+ * itself prints, asserts that at least one check was violated. Nothing had
203
+ * run. A CI wrapper spelled `if [ $? -ne 0 ]; then report_findings` therefore
204
+ * reported findings that were never computed. The same hole swallowed a
205
+ * mistyped verb (`vat resources chekc`) and every unknown option on every
206
+ * command.
207
+ *
162
208
  * Commander reports BOTH successful and failing terminations through the same
163
209
  * `CommanderError`: `--help` and `--version` carry `exitCode` 0, while an
164
210
  * unknown option, an unknown command and `help({ error: true })` carry non-zero.
165
211
  * Anything non-zero is a usage mistake by construction — commander raises these
166
- * only while parsing, before any action runs — so it maps to
167
- * {@link USAGE_ERROR_EXIT_CODE}.
212
+ * only while parsing, before any action runs — so it maps to `ERROR`.
213
+ *
214
+ * ⚠️ **Help and `--version` are NOT usage mistakes.** They terminate through
215
+ * the same `_exit` path with code 0 and must stay `OK`; only a non-zero
216
+ * commander ending is remapped.
168
217
  *
169
218
  * 🪤 Do NOT switch on `error.code` (`commander.unknownOption`, `commander.help`,
170
219
  * …). The unknown-COMMAND path arrives as `commander.help` with exitCode 1,
@@ -173,9 +222,9 @@ export const USAGE_ERROR_EXIT_CODE = 2;
173
222
  * code commander already computed is the honest discriminator; the string is not.
174
223
  *
175
224
  * @param commanderExitCode - The `exitCode` commander put on its CommanderError
176
- * @returns 0 for a successful ending, {@link USAGE_ERROR_EXIT_CODE} otherwise
225
+ * @returns `OK` for a successful ending, `ERROR` otherwise
177
226
  */
178
227
  export function exitCodeForCommanderEnding(commanderExitCode) {
179
- return commanderExitCode === 0 ? 0 : USAGE_ERROR_EXIT_CODE;
228
+ return commanderExitCode === 0 ? ExitCode.OK : ExitCode.ERROR;
180
229
  }
181
230
  //# sourceMappingURL=command-error.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"command-error.js","sourceRoot":"","sources":["../../src/utils/command-error.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,eAAe,EAA6C,MAAM,4BAA4B,CAAC;AAGxG,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE/D;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,EAAU;IACvC,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC;QACd,OAAO,GAAG,EAAE,IAAI,CAAC;IACnB,CAAC;IACD,IAAI,EAAE,GAAG,KAAK,EAAE,CAAC;QACf,OAAO,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IACtC,CAAC;IACD,OAAO,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AACvC,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,yEAAyE;QACzE,OAAO,KAAK,CAAC,KAAK,IAAI,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;IAC1D,CAAC;IACD,OAAO,2BAA2B,OAAO,CA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BAA0B,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7D,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,UAAU,0BAA0B,CAAC,iBAAyB;IAClE,OAAO,iBAAiB,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;AAChE,CAAC"}
@@ -5,6 +5,7 @@
5
5
  * - VAT_TEST_CONFIG: Override config file path for testing (absolute path)
6
6
  */
7
7
  import { type ProjectConfig } from '@vibe-agent-toolkit/resources';
8
+ import { VatError } from '@vibe-agent-toolkit/utils';
8
9
  /**
9
10
  * A `vibe-agent-toolkit.config.yaml` exists but failed to parse or validate.
10
11
  *
@@ -14,7 +15,7 @@ import { type ProjectConfig } from '@vibe-agent-toolkit/resources';
14
15
  * `vat skill test`) should surface this; a bulk linter (`vat audit`) may catch
15
16
  * it and fall back to config-free validation.
16
17
  */
17
- export declare class ConfigLoadError extends Error {
18
+ export declare class ConfigLoadError extends VatError {
18
19
  readonly projectRoot: string;
19
20
  constructor(projectRoot: string, cause: unknown);
20
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../src/utils/config-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAuD,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAaxH;;;;;;;;GAQG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;gBACjB,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;CAMhD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAkDzE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEvD;AAqBD;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAM7C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAgB/E"}
1
+ {"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../src/utils/config-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAuD,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACxH,OAAO,EAAY,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAY/D;;;;;;;;GAQG;AACH,qBAAa,eAAgB,SAAQ,QAAQ;IAC3C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;gBACjB,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;CAKhD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAgDzE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEvD;AAqBD;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAM7C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAgB/E"}
@@ -7,7 +7,7 @@
7
7
  import { readFileSync, existsSync } from 'node:fs';
8
8
  import { dirname } from 'node:path';
9
9
  import { parseConfigAllowingUnknownKeys, ProjectConfigSchema } from '@vibe-agent-toolkit/resources';
10
- import { safePath } from '@vibe-agent-toolkit/utils';
10
+ import { safePath, VatError } from '@vibe-agent-toolkit/utils';
11
11
  import * as yaml from 'yaml';
12
12
  const CONFIG_FILENAME = 'vibe-agent-toolkit.config.yaml';
13
13
  /**
@@ -25,11 +25,10 @@ const warnedConfigPaths = new Set();
25
25
  * `vat skill test`) should surface this; a bulk linter (`vat audit`) may catch
26
26
  * it and fall back to config-free validation.
27
27
  */
28
- export class ConfigLoadError extends Error {
28
+ export class ConfigLoadError extends VatError {
29
29
  projectRoot;
30
30
  constructor(projectRoot, cause) {
31
- super(cause instanceof Error ? cause.message : String(cause));
32
- this.name = 'ConfigLoadError';
31
+ super('CONFIG_LOAD', cause instanceof Error ? cause.message : String(cause));
33
32
  this.projectRoot = projectRoot;
34
33
  if (cause instanceof Error)
35
34
  this.cause = cause;
@@ -59,12 +58,10 @@ export class ConfigLoadError extends Error {
59
58
  export function loadConfig(projectRoot) {
60
59
  // Override for testing: VAT_TEST_CONFIG provides explicit config path
61
60
  const configPath = process.env['VAT_TEST_CONFIG'] ?? safePath.join(projectRoot, CONFIG_FILENAME);
62
- // eslint-disable-next-line security/detect-non-literal-fs-filename -- configPath is derived from projectRoot parameter or env override
63
61
  if (!existsSync(configPath)) {
64
62
  return undefined;
65
63
  }
66
64
  try {
67
- // eslint-disable-next-line security/detect-non-literal-fs-filename -- configPath is derived from projectRoot parameter
68
65
  const content = readFileSync(configPath, 'utf-8');
69
66
  const parsed = yaml.parse(content);
70
67
  // Validate with canonical schema from resources package.
@@ -1 +1 @@
1
- {"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../../src/utils/config-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,8BAA8B,EAAE,mBAAmB,EAAsB,MAAM,+BAA+B,CAAC;AACxH,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM,eAAe,GAAG,gCAAgC,CAAC;AAEzD;;;;GAIG;AACH,M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AAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,4EAA4E;QAC5E,8EAA8E;QAC9E,MAAM,SAAS,GAAG,GAAG,YAAY,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QAC/F,cAAc,CAAC,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QAC3C,MAAM,SAAS,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -11,7 +11,7 @@
11
11
  *
12
12
  * A sweep reports every working location, and locations sharing an instruction
13
13
  * chain share one budget — that is the whole point of the collapse. Re-measured
14
- * on VAT's own tree 2026-08-23, after the context population began declining the
14
+ * on VAT's own tree, after the context population began declining the
15
15
  * gitignored half: **366 of 589 directories** pay the single chain
16
16
  * `['CLAUDE.md']`, so emitting per location would print 366 byte-identical
17
17
  * findings, all blaming one file, the moment the root `CLAUDE.md` crossed the
@@ -11,7 +11,7 @@
11
11
  *
12
12
  * A sweep reports every working location, and locations sharing an instruction
13
13
  * chain share one budget — that is the whole point of the collapse. Re-measured
14
- * on VAT's own tree 2026-08-23, after the context population began declining the
14
+ * on VAT's own tree, after the context population began declining the
15
15
  * gitignored half: **366 of 589 directories** pay the single chain
16
16
  * `['CLAUDE.md']`, so emitting per location would print 366 byte-identical
17
17
  * findings, all blaming one file, the moment the root `CLAUDE.md` crossed the
@@ -5,34 +5,12 @@
5
5
  * about positions in it — `vat claude context` and `vat claude budget` today.
6
6
  * They ask different questions and default differently when no path is named,
7
7
  * but "is this argument inside the tree I enumerated, and what is it called
8
- * there" is one rule, and a second copy of it would be free to drift on the one
9
- * clause that only fails where nobody looks (see {@link escapesCorpusRoot}).
8
+ * there" is one rule. The predicate itself is `relativeEscapesRoot` from
9
+ * `@vibe-agent-toolkit/utils` — the one lexical classifier every lane shares,
10
+ * so the clause that only fails on Windows (a cross-drive `relative()` comes
11
+ * back ABSOLUTE, not `..`-prefixed) is tested once, there, with the string
12
+ * Windows really produces.
10
13
  */
11
- /**
12
- * Does a path already stated against the corpus root fall OUTSIDE it?
13
- *
14
- * Three spellings of "outside", not two, and the third is the one that could
15
- * only fail where nobody would see it. `safePath.relative` says "not under this
16
- * root" with a `..`-prefixed path in the ordinary case, but returns an ABSOLUTE
17
- * path when no relative route exists at all — which on Windows is exactly what a
18
- * different drive letter produces. Without the third test, `vat claude context
19
- * D:\elsewhere\doc.md` run from a `C:` repo passes the guard and answers `kind:
20
- * unknown`, indistinguishable from a typo inside the tree, which is the one
21
- * outcome {@link targetPathWithin}'s `@throws` claims to prevent. Its sibling
22
- * `escapesRoot` (`closure-extent.ts`) applies the same triple for the same
23
- * reason.
24
- *
25
- * ⛔ Exported so it can be TESTED. On POSIX `safePath.relative` between two
26
- * absolute paths never returns an absolute string, so the third clause is
27
- * unreachable through {@link targetPathWithin} on every machine a developer
28
- * runs — the branch has to be exercised directly or not at all, and "not at
29
- * all" is how it went missing in the first place.
30
- *
31
- * @param normalizedRelative - A forward-slashed path already stated against the
32
- * corpus root
33
- * @returns True when the corpus root does not contain it
34
- */
35
- export declare function escapesCorpusRoot(normalizedRelative: string): boolean;
36
14
  /**
37
15
  * The root-relative path to query, refusing anything outside the corpus.
38
16
  *
@@ -1 +1 @@
1
- {"version":3,"file":"corpus-target.d.ts","sourceRoot":"","sources":["../../src/utils/corpus-target.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,iBAAiB,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAIrE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,WAAW,EAAE,MAAM,GAClB,MAAM,CAUR"}
1
+ {"version":3,"file":"corpus-target.d.ts","sourceRoot":"","sources":["../../src/utils/corpus-target.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,WAAW,EAAE,MAAM,GAClB,MAAM,CAUR"}