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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (755) hide show
  1. package/README.md +3 -3
  2. package/dist/bin/supervise-cli.d.ts +45 -0
  3. package/dist/bin/supervise-cli.d.ts.map +1 -0
  4. package/dist/bin/supervise-cli.js +83 -0
  5. package/dist/bin/supervise-cli.js.map +1 -0
  6. package/dist/bin/vat +94 -40
  7. package/dist/bin/vat.d.ts +15 -4
  8. package/dist/bin/vat.d.ts.map +1 -1
  9. package/dist/bin/vat.js +94 -40
  10. package/dist/bin/vat.js.map +1 -1
  11. package/dist/bin.js +21 -29
  12. package/dist/bin.js.map +1 -1
  13. package/dist/command-tree.d.ts +45 -0
  14. package/dist/command-tree.d.ts.map +1 -0
  15. package/dist/command-tree.js +60 -0
  16. package/dist/command-tree.js.map +1 -0
  17. package/dist/commands/agent/build-schema.d.ts +100 -0
  18. package/dist/commands/agent/build-schema.d.ts.map +1 -0
  19. package/dist/commands/agent/build-schema.js +32 -0
  20. package/dist/commands/agent/build-schema.js.map +1 -0
  21. package/dist/commands/agent/build.d.ts +1 -0
  22. package/dist/commands/agent/build.d.ts.map +1 -1
  23. package/dist/commands/agent/build.js +63 -33
  24. package/dist/commands/agent/build.js.map +1 -1
  25. package/dist/commands/agent/import-schema.d.ts +75 -0
  26. package/dist/commands/agent/import-schema.d.ts.map +1 -0
  27. package/dist/commands/agent/import-schema.js +25 -0
  28. package/dist/commands/agent/import-schema.js.map +1 -0
  29. package/dist/commands/agent/import.d.ts.map +1 -1
  30. package/dist/commands/agent/import.js +33 -27
  31. package/dist/commands/agent/import.js.map +1 -1
  32. package/dist/commands/agent/index.d.ts.map +1 -1
  33. package/dist/commands/agent/index.js +132 -37
  34. package/dist/commands/agent/index.js.map +1 -1
  35. package/dist/commands/agent/install-path.d.ts.map +1 -1
  36. package/dist/commands/agent/install-path.js +2 -1
  37. package/dist/commands/agent/install-path.js.map +1 -1
  38. package/dist/commands/agent/install-schema.d.ts +89 -0
  39. package/dist/commands/agent/install-schema.d.ts.map +1 -0
  40. package/dist/commands/agent/install-schema.js +29 -0
  41. package/dist/commands/agent/install-schema.js.map +1 -0
  42. package/dist/commands/agent/install.d.ts +7 -1
  43. package/dist/commands/agent/install.d.ts.map +1 -1
  44. package/dist/commands/agent/install.js +78 -108
  45. package/dist/commands/agent/install.js.map +1 -1
  46. package/dist/commands/agent/installed-schema.d.ts +140 -0
  47. package/dist/commands/agent/installed-schema.d.ts.map +1 -0
  48. package/dist/commands/agent/installed-schema.js +36 -0
  49. package/dist/commands/agent/installed-schema.js.map +1 -0
  50. package/dist/commands/agent/installed.d.ts +1 -1
  51. package/dist/commands/agent/installed.d.ts.map +1 -1
  52. package/dist/commands/agent/installed.js +104 -75
  53. package/dist/commands/agent/installed.js.map +1 -1
  54. package/dist/commands/agent/list-schema.d.ts +128 -0
  55. package/dist/commands/agent/list-schema.d.ts.map +1 -0
  56. package/dist/commands/agent/list-schema.js +34 -0
  57. package/dist/commands/agent/list-schema.js.map +1 -0
  58. package/dist/commands/agent/list.d.ts +4 -3
  59. package/dist/commands/agent/list.d.ts.map +1 -1
  60. package/dist/commands/agent/list.js +50 -37
  61. package/dist/commands/agent/list.js.map +1 -1
  62. package/dist/commands/agent/run.d.ts +3 -0
  63. package/dist/commands/agent/run.d.ts.map +1 -1
  64. package/dist/commands/agent/run.js +8 -3
  65. package/dist/commands/agent/run.js.map +1 -1
  66. package/dist/commands/agent/uninstall-schema.d.ts +89 -0
  67. package/dist/commands/agent/uninstall-schema.d.ts.map +1 -0
  68. package/dist/commands/agent/uninstall-schema.js +29 -0
  69. package/dist/commands/agent/uninstall-schema.js.map +1 -0
  70. package/dist/commands/agent/uninstall.d.ts +5 -1
  71. package/dist/commands/agent/uninstall.d.ts.map +1 -1
  72. package/dist/commands/agent/uninstall.js +50 -38
  73. package/dist/commands/agent/uninstall.js.map +1 -1
  74. package/dist/commands/agent/validate-schema.d.ts +129 -0
  75. package/dist/commands/agent/validate-schema.d.ts.map +1 -0
  76. package/dist/commands/agent/validate-schema.js +35 -0
  77. package/dist/commands/agent/validate-schema.js.map +1 -0
  78. package/dist/commands/agent/validate.d.ts +6 -0
  79. package/dist/commands/agent/validate.d.ts.map +1 -1
  80. package/dist/commands/agent/validate.js +64 -36
  81. package/dist/commands/agent/validate.js.map +1 -1
  82. package/dist/commands/ard/emit-schema.d.ts +108 -0
  83. package/dist/commands/ard/emit-schema.d.ts.map +1 -0
  84. package/dist/commands/ard/emit-schema.js +37 -0
  85. package/dist/commands/ard/emit-schema.js.map +1 -0
  86. package/dist/commands/ard/emit.d.ts +31 -63
  87. package/dist/commands/ard/emit.d.ts.map +1 -1
  88. package/dist/commands/ard/emit.js +124 -68
  89. package/dist/commands/ard/emit.js.map +1 -1
  90. package/dist/commands/ard/index.d.ts.map +1 -1
  91. package/dist/commands/ard/index.js +17 -10
  92. package/dist/commands/ard/index.js.map +1 -1
  93. package/dist/commands/audit/compat-lane-findings.d.ts +65 -0
  94. package/dist/commands/audit/compat-lane-findings.d.ts.map +1 -0
  95. package/dist/commands/audit/compat-lane-findings.js +72 -0
  96. package/dist/commands/audit/compat-lane-findings.js.map +1 -0
  97. package/dist/commands/audit/distributed-tree.d.ts +2 -2
  98. package/dist/commands/audit/distributed-tree.d.ts.map +1 -1
  99. package/dist/commands/audit/distributed-tree.js +23 -12
  100. package/dist/commands/audit/distributed-tree.js.map +1 -1
  101. package/dist/commands/audit/git-url-clone.d.ts +15 -7
  102. package/dist/commands/audit/git-url-clone.d.ts.map +1 -1
  103. package/dist/commands/audit/git-url-clone.js +85 -42
  104. package/dist/commands/audit/git-url-clone.js.map +1 -1
  105. package/dist/commands/audit/hierarchical-output.d.ts +28 -4
  106. package/dist/commands/audit/hierarchical-output.d.ts.map +1 -1
  107. package/dist/commands/audit/hierarchical-output.js +44 -27
  108. package/dist/commands/audit/hierarchical-output.js.map +1 -1
  109. package/dist/commands/audit/scan-population.d.ts.map +1 -1
  110. package/dist/commands/audit/scan-population.js +2 -1
  111. package/dist/commands/audit/scan-population.js.map +1 -1
  112. package/dist/commands/audit-schema.d.ts +1247 -0
  113. package/dist/commands/audit-schema.d.ts.map +1 -0
  114. package/dist/commands/audit-schema.js +139 -0
  115. package/dist/commands/audit-schema.js.map +1 -0
  116. package/dist/commands/audit-settings-schema.d.ts +417 -0
  117. package/dist/commands/audit-settings-schema.d.ts.map +1 -0
  118. package/dist/commands/audit-settings-schema.js +77 -0
  119. package/dist/commands/audit-settings-schema.js.map +1 -0
  120. package/dist/commands/audit-settings.d.ts +28 -9
  121. package/dist/commands/audit-settings.d.ts.map +1 -1
  122. package/dist/commands/audit-settings.js +215 -151
  123. package/dist/commands/audit-settings.js.map +1 -1
  124. package/dist/commands/audit.d.ts +72 -33
  125. package/dist/commands/audit.d.ts.map +1 -1
  126. package/dist/commands/audit.js +415 -397
  127. package/dist/commands/audit.js.map +1 -1
  128. package/dist/commands/build.d.ts +61 -4
  129. package/dist/commands/build.d.ts.map +1 -1
  130. package/dist/commands/build.js +176 -190
  131. package/dist/commands/build.js.map +1 -1
  132. package/dist/commands/cache/clear-schema.d.ts +111 -0
  133. package/dist/commands/cache/clear-schema.d.ts.map +1 -0
  134. package/dist/commands/cache/clear-schema.js +37 -0
  135. package/dist/commands/cache/clear-schema.js.map +1 -0
  136. package/dist/commands/cache/clear.d.ts +28 -26
  137. package/dist/commands/cache/clear.d.ts.map +1 -1
  138. package/dist/commands/cache/clear.js +108 -103
  139. package/dist/commands/cache/clear.js.map +1 -1
  140. package/dist/commands/cache/index.d.ts.map +1 -1
  141. package/dist/commands/cache/index.js +13 -7
  142. package/dist/commands/cache/index.js.map +1 -1
  143. package/dist/commands/claude/claude-config.d.ts +23 -6
  144. package/dist/commands/claude/claude-config.d.ts.map +1 -1
  145. package/dist/commands/claude/claude-config.js +29 -15
  146. package/dist/commands/claude/claude-config.js.map +1 -1
  147. package/dist/commands/claude/context.d.ts +87 -2
  148. package/dist/commands/claude/context.d.ts.map +1 -1
  149. package/dist/commands/claude/context.js +116 -57
  150. package/dist/commands/claude/context.js.map +1 -1
  151. package/dist/commands/claude/marketplace/changelog-utils.js +2 -2
  152. package/dist/commands/claude/marketplace/changelog-utils.js.map +1 -1
  153. package/dist/commands/claude/marketplace/git-publish.d.ts +14 -1
  154. package/dist/commands/claude/marketplace/git-publish.d.ts.map +1 -1
  155. package/dist/commands/claude/marketplace/git-publish.js +135 -68
  156. package/dist/commands/claude/marketplace/git-publish.js.map +1 -1
  157. package/dist/commands/claude/marketplace/license-utils.d.ts +3 -5
  158. package/dist/commands/claude/marketplace/license-utils.d.ts.map +1 -1
  159. package/dist/commands/claude/marketplace/license-utils.js +16 -7
  160. package/dist/commands/claude/marketplace/license-utils.js.map +1 -1
  161. package/dist/commands/claude/marketplace/publish-schema.d.ts +137 -0
  162. package/dist/commands/claude/marketplace/publish-schema.d.ts.map +1 -0
  163. package/dist/commands/claude/marketplace/publish-schema.js +32 -0
  164. package/dist/commands/claude/marketplace/publish-schema.js.map +1 -0
  165. package/dist/commands/claude/marketplace/publish-tree.d.ts +6 -0
  166. package/dist/commands/claude/marketplace/publish-tree.d.ts.map +1 -1
  167. package/dist/commands/claude/marketplace/publish-tree.js +75 -17
  168. package/dist/commands/claude/marketplace/publish-tree.js.map +1 -1
  169. package/dist/commands/claude/marketplace/publish.d.ts +27 -0
  170. package/dist/commands/claude/marketplace/publish.d.ts.map +1 -1
  171. package/dist/commands/claude/marketplace/publish.js +84 -50
  172. package/dist/commands/claude/marketplace/publish.js.map +1 -1
  173. package/dist/commands/claude/marketplace/validate-schema.d.ts +362 -0
  174. package/dist/commands/claude/marketplace/validate-schema.d.ts.map +1 -0
  175. package/dist/commands/claude/marketplace/validate-schema.js +67 -0
  176. package/dist/commands/claude/marketplace/validate-schema.js.map +1 -0
  177. package/dist/commands/claude/marketplace/validate.d.ts +40 -53
  178. package/dist/commands/claude/marketplace/validate.d.ts.map +1 -1
  179. package/dist/commands/claude/marketplace/validate.js +358 -214
  180. package/dist/commands/claude/marketplace/validate.js.map +1 -1
  181. package/dist/commands/claude/org/api-keys.d.ts +3 -0
  182. package/dist/commands/claude/org/api-keys.d.ts.map +1 -1
  183. package/dist/commands/claude/org/api-keys.js +4 -5
  184. package/dist/commands/claude/org/api-keys.js.map +1 -1
  185. package/dist/commands/claude/org/code-analytics.js +1 -1
  186. package/dist/commands/claude/org/code-analytics.js.map +1 -1
  187. package/dist/commands/claude/org/cost.d.ts.map +1 -1
  188. package/dist/commands/claude/org/cost.js +11 -33
  189. package/dist/commands/claude/org/cost.js.map +1 -1
  190. package/dist/commands/claude/org/helpers.d.ts +40 -27
  191. package/dist/commands/claude/org/helpers.d.ts.map +1 -1
  192. package/dist/commands/claude/org/helpers.js +61 -66
  193. package/dist/commands/claude/org/helpers.js.map +1 -1
  194. package/dist/commands/claude/org/index.d.ts.map +1 -1
  195. package/dist/commands/claude/org/index.js +10 -4
  196. package/dist/commands/claude/org/index.js.map +1 -1
  197. package/dist/commands/claude/org/info.d.ts.map +1 -1
  198. package/dist/commands/claude/org/info.js +2 -3
  199. package/dist/commands/claude/org/info.js.map +1 -1
  200. package/dist/commands/claude/org/invites.d.ts +3 -0
  201. package/dist/commands/claude/org/invites.d.ts.map +1 -1
  202. package/dist/commands/claude/org/invites.js +5 -7
  203. package/dist/commands/claude/org/invites.js.map +1 -1
  204. package/dist/commands/claude/org/skills.d.ts +76 -21
  205. package/dist/commands/claude/org/skills.d.ts.map +1 -1
  206. package/dist/commands/claude/org/skills.js +273 -246
  207. package/dist/commands/claude/org/skills.js.map +1 -1
  208. package/dist/commands/claude/org/stubs-schema.d.ts +56 -0
  209. package/dist/commands/claude/org/stubs-schema.d.ts.map +1 -0
  210. package/dist/commands/claude/org/stubs-schema.js +23 -0
  211. package/dist/commands/claude/org/stubs-schema.js.map +1 -0
  212. package/dist/commands/claude/org/stubs.d.ts +8 -3
  213. package/dist/commands/claude/org/stubs.d.ts.map +1 -1
  214. package/dist/commands/claude/org/stubs.js +9 -9
  215. package/dist/commands/claude/org/stubs.js.map +1 -1
  216. package/dist/commands/claude/org/usage.d.ts.map +1 -1
  217. package/dist/commands/claude/org/usage.js +1 -2
  218. package/dist/commands/claude/org/usage.js.map +1 -1
  219. package/dist/commands/claude/org/users.d.ts +3 -0
  220. package/dist/commands/claude/org/users.d.ts.map +1 -1
  221. package/dist/commands/claude/org/users.js +6 -8
  222. package/dist/commands/claude/org/users.js.map +1 -1
  223. package/dist/commands/claude/org/workspaces.d.ts +3 -0
  224. package/dist/commands/claude/org/workspaces.d.ts.map +1 -1
  225. package/dist/commands/claude/org/workspaces.js +10 -15
  226. package/dist/commands/claude/org/workspaces.js.map +1 -1
  227. package/dist/commands/claude/plugin/build-schema.d.ts +642 -0
  228. package/dist/commands/claude/plugin/build-schema.d.ts.map +1 -0
  229. package/dist/commands/claude/plugin/build-schema.js +51 -0
  230. package/dist/commands/claude/plugin/build-schema.js.map +1 -0
  231. package/dist/commands/claude/plugin/build.d.ts +220 -45
  232. package/dist/commands/claude/plugin/build.d.ts.map +1 -1
  233. package/dist/commands/claude/plugin/build.js +466 -249
  234. package/dist/commands/claude/plugin/build.js.map +1 -1
  235. package/dist/commands/claude/plugin/helpers.d.ts +186 -24
  236. package/dist/commands/claude/plugin/helpers.d.ts.map +1 -1
  237. package/dist/commands/claude/plugin/helpers.js +110 -68
  238. package/dist/commands/claude/plugin/helpers.js.map +1 -1
  239. package/dist/commands/claude/plugin/install-schema.d.ts +144 -0
  240. package/dist/commands/claude/plugin/install-schema.d.ts.map +1 -0
  241. package/dist/commands/claude/plugin/install-schema.js +36 -0
  242. package/dist/commands/claude/plugin/install-schema.js.map +1 -0
  243. package/dist/commands/claude/plugin/install.d.ts +191 -11
  244. package/dist/commands/claude/plugin/install.d.ts.map +1 -1
  245. package/dist/commands/claude/plugin/install.js +688 -628
  246. package/dist/commands/claude/plugin/install.js.map +1 -1
  247. package/dist/commands/claude/plugin/kept-findings.d.ts +19 -0
  248. package/dist/commands/claude/plugin/kept-findings.d.ts.map +1 -0
  249. package/dist/commands/claude/plugin/kept-findings.js +24 -0
  250. package/dist/commands/claude/plugin/kept-findings.js.map +1 -0
  251. package/dist/commands/claude/plugin/list-schema.d.ts +223 -0
  252. package/dist/commands/claude/plugin/list-schema.d.ts.map +1 -0
  253. package/dist/commands/claude/plugin/list-schema.js +34 -0
  254. package/dist/commands/claude/plugin/list-schema.js.map +1 -0
  255. package/dist/commands/claude/plugin/list.d.ts +18 -0
  256. package/dist/commands/claude/plugin/list.d.ts.map +1 -1
  257. package/dist/commands/claude/plugin/list.js +53 -45
  258. package/dist/commands/claude/plugin/list.js.map +1 -1
  259. package/dist/commands/claude/plugin/npm-pack.d.ts +15 -0
  260. package/dist/commands/claude/plugin/npm-pack.d.ts.map +1 -0
  261. package/dist/commands/claude/plugin/npm-pack.js +39 -0
  262. package/dist/commands/claude/plugin/npm-pack.js.map +1 -0
  263. package/dist/commands/claude/plugin/plugin-changelog.d.ts +5 -1
  264. package/dist/commands/claude/plugin/plugin-changelog.d.ts.map +1 -1
  265. package/dist/commands/claude/plugin/plugin-changelog.js +9 -5
  266. package/dist/commands/claude/plugin/plugin-changelog.js.map +1 -1
  267. package/dist/commands/claude/plugin/plugin-files.d.ts +21 -2
  268. package/dist/commands/claude/plugin/plugin-files.d.ts.map +1 -1
  269. package/dist/commands/claude/plugin/plugin-files.js +65 -32
  270. package/dist/commands/claude/plugin/plugin-files.js.map +1 -1
  271. package/dist/commands/claude/plugin/plugin-validators.d.ts +13 -0
  272. package/dist/commands/claude/plugin/plugin-validators.d.ts.map +1 -1
  273. package/dist/commands/claude/plugin/plugin-validators.js +64 -16
  274. package/dist/commands/claude/plugin/plugin-validators.js.map +1 -1
  275. package/dist/commands/claude/plugin/tree-copy.d.ts.map +1 -1
  276. package/dist/commands/claude/plugin/tree-copy.js +63 -37
  277. package/dist/commands/claude/plugin/tree-copy.js.map +1 -1
  278. package/dist/commands/claude/plugin/uninstall-schema.d.ts +112 -0
  279. package/dist/commands/claude/plugin/uninstall-schema.d.ts.map +1 -0
  280. package/dist/commands/claude/plugin/uninstall-schema.js +28 -0
  281. package/dist/commands/claude/plugin/uninstall-schema.js.map +1 -0
  282. package/dist/commands/claude/plugin/uninstall.d.ts +57 -0
  283. package/dist/commands/claude/plugin/uninstall.d.ts.map +1 -1
  284. package/dist/commands/claude/plugin/uninstall.js +176 -64
  285. package/dist/commands/claude/plugin/uninstall.js.map +1 -1
  286. package/dist/commands/consistency-check.d.ts.map +1 -1
  287. package/dist/commands/consistency-check.js +8 -6
  288. package/dist/commands/consistency-check.js.map +1 -1
  289. package/dist/commands/corpus/index.d.ts.map +1 -1
  290. package/dist/commands/corpus/index.js +26 -10
  291. package/dist/commands/corpus/index.js.map +1 -1
  292. package/dist/commands/corpus/report.d.ts +34 -16
  293. package/dist/commands/corpus/report.d.ts.map +1 -1
  294. package/dist/commands/corpus/report.js +36 -18
  295. package/dist/commands/corpus/report.js.map +1 -1
  296. package/dist/commands/corpus/runner.d.ts +25 -20
  297. package/dist/commands/corpus/runner.d.ts.map +1 -1
  298. package/dist/commands/corpus/runner.js +123 -67
  299. package/dist/commands/corpus/runner.js.map +1 -1
  300. package/dist/commands/corpus/scan-schema.d.ts +127 -0
  301. package/dist/commands/corpus/scan-schema.d.ts.map +1 -0
  302. package/dist/commands/corpus/scan-schema.js +31 -0
  303. package/dist/commands/corpus/scan-schema.js.map +1 -0
  304. package/dist/commands/corpus/scan.d.ts +31 -0
  305. package/dist/commands/corpus/scan.d.ts.map +1 -1
  306. package/dist/commands/corpus/scan.js +124 -50
  307. package/dist/commands/corpus/scan.js.map +1 -1
  308. package/dist/commands/corpus/seed.d.ts +11 -8
  309. package/dist/commands/corpus/seed.d.ts.map +1 -1
  310. package/dist/commands/corpus/seed.js +29 -11
  311. package/dist/commands/corpus/seed.js.map +1 -1
  312. package/dist/commands/doctor-render.d.ts +52 -0
  313. package/dist/commands/doctor-render.d.ts.map +1 -0
  314. package/dist/commands/doctor-render.js +110 -0
  315. package/dist/commands/doctor-render.js.map +1 -0
  316. package/dist/commands/doctor-schema.d.ts +191 -0
  317. package/dist/commands/doctor-schema.d.ts.map +1 -0
  318. package/dist/commands/doctor-schema.js +44 -0
  319. package/dist/commands/doctor-schema.js.map +1 -0
  320. package/dist/commands/doctor.d.ts +7 -62
  321. package/dist/commands/doctor.d.ts.map +1 -1
  322. package/dist/commands/doctor.js +126 -165
  323. package/dist/commands/doctor.js.map +1 -1
  324. package/dist/commands/inventory-schema.d.ts +7297 -0
  325. package/dist/commands/inventory-schema.d.ts.map +1 -0
  326. package/dist/commands/inventory-schema.js +28 -0
  327. package/dist/commands/inventory-schema.js.map +1 -0
  328. package/dist/commands/inventory.d.ts +1 -1
  329. package/dist/commands/inventory.d.ts.map +1 -1
  330. package/dist/commands/inventory.js +89 -41
  331. package/dist/commands/inventory.js.map +1 -1
  332. package/dist/commands/mcp/index.d.ts.map +1 -1
  333. package/dist/commands/mcp/index.js +15 -0
  334. package/dist/commands/mcp/index.js.map +1 -1
  335. package/dist/commands/mcp/list-collections-schema.d.ts +101 -0
  336. package/dist/commands/mcp/list-collections-schema.d.ts.map +1 -0
  337. package/dist/commands/mcp/list-collections-schema.js +22 -0
  338. package/dist/commands/mcp/list-collections-schema.js.map +1 -0
  339. package/dist/commands/mcp/list-collections.d.ts +1 -1
  340. package/dist/commands/mcp/list-collections.d.ts.map +1 -1
  341. package/dist/commands/mcp/list-collections.js +19 -17
  342. package/dist/commands/mcp/list-collections.js.map +1 -1
  343. package/dist/commands/mcp/serve.d.ts +5 -0
  344. package/dist/commands/mcp/serve.d.ts.map +1 -1
  345. package/dist/commands/mcp/serve.js +29 -15
  346. package/dist/commands/mcp/serve.js.map +1 -1
  347. package/dist/commands/okf/index.d.ts.map +1 -1
  348. package/dist/commands/okf/index.js +13 -10
  349. package/dist/commands/okf/index.js.map +1 -1
  350. package/dist/commands/okf/validate-schema.d.ts +171 -0
  351. package/dist/commands/okf/validate-schema.d.ts.map +1 -0
  352. package/dist/commands/okf/validate-schema.js +44 -0
  353. package/dist/commands/okf/validate-schema.js.map +1 -0
  354. package/dist/commands/okf/validate.d.ts +16 -145
  355. package/dist/commands/okf/validate.d.ts.map +1 -1
  356. package/dist/commands/okf/validate.js +63 -52
  357. package/dist/commands/okf/validate.js.map +1 -1
  358. package/dist/commands/orchestrator-schema.d.ts +419 -0
  359. package/dist/commands/orchestrator-schema.d.ts.map +1 -0
  360. package/dist/commands/orchestrator-schema.js +91 -0
  361. package/dist/commands/orchestrator-schema.js.map +1 -0
  362. package/dist/commands/phase-utils.d.ts +188 -220
  363. package/dist/commands/phase-utils.d.ts.map +1 -1
  364. package/dist/commands/phase-utils.js +210 -258
  365. package/dist/commands/phase-utils.js.map +1 -1
  366. package/dist/commands/positional-args.d.ts +13 -11
  367. package/dist/commands/positional-args.d.ts.map +1 -1
  368. package/dist/commands/positional-args.js +16 -15
  369. package/dist/commands/positional-args.js.map +1 -1
  370. package/dist/commands/rag/admin-schema.d.ts +152 -0
  371. package/dist/commands/rag/admin-schema.d.ts.map +1 -0
  372. package/dist/commands/rag/admin-schema.js +31 -0
  373. package/dist/commands/rag/admin-schema.js.map +1 -0
  374. package/dist/commands/rag/clear-command.d.ts.map +1 -1
  375. package/dist/commands/rag/clear-command.js +30 -15
  376. package/dist/commands/rag/clear-command.js.map +1 -1
  377. package/dist/commands/rag/command-helpers.d.ts +31 -7
  378. package/dist/commands/rag/command-helpers.d.ts.map +1 -1
  379. package/dist/commands/rag/command-helpers.js +41 -21
  380. package/dist/commands/rag/command-helpers.js.map +1 -1
  381. package/dist/commands/rag/index-command.d.ts +37 -48
  382. package/dist/commands/rag/index-command.d.ts.map +1 -1
  383. package/dist/commands/rag/index-command.js +80 -65
  384. package/dist/commands/rag/index-command.js.map +1 -1
  385. package/dist/commands/rag/index-schema.d.ts +107 -0
  386. package/dist/commands/rag/index-schema.d.ts.map +1 -0
  387. package/dist/commands/rag/index-schema.js +34 -0
  388. package/dist/commands/rag/index-schema.js.map +1 -0
  389. package/dist/commands/rag/index.d.ts.map +1 -1
  390. package/dist/commands/rag/index.js +88 -41
  391. package/dist/commands/rag/index.js.map +1 -1
  392. package/dist/commands/rag/query-command.d.ts +18 -4
  393. package/dist/commands/rag/query-command.d.ts.map +1 -1
  394. package/dist/commands/rag/query-command.js +42 -27
  395. package/dist/commands/rag/query-command.js.map +1 -1
  396. package/dist/commands/rag/query-schema.d.ts +363 -0
  397. package/dist/commands/rag/query-schema.d.ts.map +1 -0
  398. package/dist/commands/rag/query-schema.js +59 -0
  399. package/dist/commands/rag/query-schema.js.map +1 -0
  400. package/dist/commands/rag/stats-command.d.ts.map +1 -1
  401. package/dist/commands/rag/stats-command.js +19 -18
  402. package/dist/commands/rag/stats-command.js.map +1 -1
  403. package/dist/commands/resources/check-progress.d.ts +79 -13
  404. package/dist/commands/resources/check-progress.d.ts.map +1 -1
  405. package/dist/commands/resources/check-progress.js +112 -11
  406. package/dist/commands/resources/check-progress.js.map +1 -1
  407. package/dist/commands/resources/check-schema.d.ts +335 -0
  408. package/dist/commands/resources/check-schema.d.ts.map +1 -0
  409. package/dist/commands/resources/check-schema.js +104 -0
  410. package/dist/commands/resources/check-schema.js.map +1 -0
  411. package/dist/commands/resources/check-supervisor.d.ts +329 -71
  412. package/dist/commands/resources/check-supervisor.d.ts.map +1 -1
  413. package/dist/commands/resources/check-supervisor.js +507 -107
  414. package/dist/commands/resources/check-supervisor.js.map +1 -1
  415. package/dist/commands/resources/check.d.ts +88 -254
  416. package/dist/commands/resources/check.d.ts.map +1 -1
  417. package/dist/commands/resources/check.js +537 -310
  418. package/dist/commands/resources/check.js.map +1 -1
  419. package/dist/commands/resources/index.d.ts.map +1 -1
  420. package/dist/commands/resources/index.js +189 -103
  421. package/dist/commands/resources/index.js.map +1 -1
  422. package/dist/commands/resources/query-schema.d.ts +188 -0
  423. package/dist/commands/resources/query-schema.d.ts.map +1 -0
  424. package/dist/commands/resources/query-schema.js +48 -0
  425. package/dist/commands/resources/query-schema.js.map +1 -0
  426. package/dist/commands/resources/query.d.ts +18 -13
  427. package/dist/commands/resources/query.d.ts.map +1 -1
  428. package/dist/commands/resources/query.js +61 -49
  429. package/dist/commands/resources/query.js.map +1 -1
  430. package/dist/commands/resources/scan-schema.d.ts +195 -0
  431. package/dist/commands/resources/scan-schema.d.ts.map +1 -0
  432. package/dist/commands/resources/scan-schema.js +53 -0
  433. package/dist/commands/resources/scan-schema.js.map +1 -0
  434. package/dist/commands/resources/scan.d.ts +26 -3
  435. package/dist/commands/resources/scan.d.ts.map +1 -1
  436. package/dist/commands/resources/scan.js +51 -53
  437. package/dist/commands/resources/scan.js.map +1 -1
  438. package/dist/commands/resources/validate-schema.d.ts +326 -0
  439. package/dist/commands/resources/validate-schema.d.ts.map +1 -0
  440. package/dist/commands/resources/validate-schema.js +60 -0
  441. package/dist/commands/resources/validate-schema.js.map +1 -0
  442. package/dist/commands/resources/validate.d.ts +45 -169
  443. package/dist/commands/resources/validate.d.ts.map +1 -1
  444. package/dist/commands/resources/validate.js +221 -485
  445. package/dist/commands/resources/validate.js.map +1 -1
  446. package/dist/commands/skill/review-checklist.d.ts.map +1 -1
  447. package/dist/commands/skill/review-checklist.js +0 -1
  448. package/dist/commands/skill/review-checklist.js.map +1 -1
  449. package/dist/commands/skill/review-schema.d.ts +278 -0
  450. package/dist/commands/skill/review-schema.d.ts.map +1 -0
  451. package/dist/commands/skill/review-schema.js +46 -0
  452. package/dist/commands/skill/review-schema.js.map +1 -0
  453. package/dist/commands/skill/review.d.ts +8 -234
  454. package/dist/commands/skill/review.d.ts.map +1 -1
  455. package/dist/commands/skill/review.js +54 -77
  456. package/dist/commands/skill/review.js.map +1 -1
  457. package/dist/commands/skill/test/auth-flags.d.ts +3 -0
  458. package/dist/commands/skill/test/auth-flags.d.ts.map +1 -1
  459. package/dist/commands/skill/test/auth-flags.js +6 -2
  460. package/dist/commands/skill/test/auth-flags.js.map +1 -1
  461. package/dist/commands/skill/test/configure-schema.d.ts +67 -0
  462. package/dist/commands/skill/test/configure-schema.d.ts.map +1 -0
  463. package/dist/commands/skill/test/configure-schema.js +27 -0
  464. package/dist/commands/skill/test/configure-schema.js.map +1 -0
  465. package/dist/commands/skill/test/configure.d.ts +12 -5
  466. package/dist/commands/skill/test/configure.d.ts.map +1 -1
  467. package/dist/commands/skill/test/configure.js +101 -31
  468. package/dist/commands/skill/test/configure.js.map +1 -1
  469. package/dist/commands/skill/test/run-schema.d.ts +107 -0
  470. package/dist/commands/skill/test/run-schema.d.ts.map +1 -0
  471. package/dist/commands/skill/test/run-schema.js +36 -0
  472. package/dist/commands/skill/test/run-schema.js.map +1 -0
  473. package/dist/commands/skill/test/run.d.ts +3 -2
  474. package/dist/commands/skill/test/run.d.ts.map +1 -1
  475. package/dist/commands/skill/test/run.js +316 -155
  476. package/dist/commands/skill/test/run.js.map +1 -1
  477. package/dist/commands/skills/build-schema.d.ts +199 -0
  478. package/dist/commands/skills/build-schema.d.ts.map +1 -0
  479. package/dist/commands/skills/build-schema.js +55 -0
  480. package/dist/commands/skills/build-schema.js.map +1 -0
  481. package/dist/commands/skills/build.d.ts +95 -298
  482. package/dist/commands/skills/build.d.ts.map +1 -1
  483. package/dist/commands/skills/build.js +415 -818
  484. package/dist/commands/skills/build.js.map +1 -1
  485. package/dist/commands/skills/command-helpers.d.ts +5 -11
  486. package/dist/commands/skills/command-helpers.d.ts.map +1 -1
  487. package/dist/commands/skills/command-helpers.js +7 -17
  488. package/dist/commands/skills/command-helpers.js.map +1 -1
  489. package/dist/commands/skills/index.js +12 -6
  490. package/dist/commands/skills/index.js.map +1 -1
  491. package/dist/commands/skills/install-schema.d.ts +153 -0
  492. package/dist/commands/skills/install-schema.d.ts.map +1 -0
  493. package/dist/commands/skills/install-schema.js +44 -0
  494. package/dist/commands/skills/install-schema.js.map +1 -0
  495. package/dist/commands/skills/install.d.ts +76 -8
  496. package/dist/commands/skills/install.d.ts.map +1 -1
  497. package/dist/commands/skills/install.js +230 -194
  498. package/dist/commands/skills/install.js.map +1 -1
  499. package/dist/commands/skills/list-schema.d.ts +145 -0
  500. package/dist/commands/skills/list-schema.d.ts.map +1 -0
  501. package/dist/commands/skills/list-schema.js +37 -0
  502. package/dist/commands/skills/list-schema.js.map +1 -0
  503. package/dist/commands/skills/list.d.ts +39 -8
  504. package/dist/commands/skills/list.d.ts.map +1 -1
  505. package/dist/commands/skills/list.js +110 -122
  506. package/dist/commands/skills/list.js.map +1 -1
  507. package/dist/commands/skills/package-schema.d.ts +98 -0
  508. package/dist/commands/skills/package-schema.d.ts.map +1 -0
  509. package/dist/commands/skills/package-schema.js +32 -0
  510. package/dist/commands/skills/package-schema.js.map +1 -0
  511. package/dist/commands/skills/package.d.ts +85 -14
  512. package/dist/commands/skills/package.d.ts.map +1 -1
  513. package/dist/commands/skills/package.js +288 -207
  514. package/dist/commands/skills/package.js.map +1 -1
  515. package/dist/commands/skills/scope-guard.d.ts +27 -20
  516. package/dist/commands/skills/scope-guard.d.ts.map +1 -1
  517. package/dist/commands/skills/scope-guard.js +43 -28
  518. package/dist/commands/skills/scope-guard.js.map +1 -1
  519. package/dist/commands/skills/skill-discovery.d.ts +1 -1
  520. package/dist/commands/skills/skill-discovery.d.ts.map +1 -1
  521. package/dist/commands/skills/skill-discovery.js +40 -19
  522. package/dist/commands/skills/skill-discovery.js.map +1 -1
  523. package/dist/commands/skills/source-resolvers.d.ts +58 -8
  524. package/dist/commands/skills/source-resolvers.d.ts.map +1 -1
  525. package/dist/commands/skills/source-resolvers.js +113 -38
  526. package/dist/commands/skills/source-resolvers.js.map +1 -1
  527. package/dist/commands/skills/validate-command.d.ts.map +1 -1
  528. package/dist/commands/skills/validate-command.js +31 -51
  529. package/dist/commands/skills/validate-command.js.map +1 -1
  530. package/dist/commands/skills/validate-schema.d.ts +199 -0
  531. package/dist/commands/skills/validate-schema.d.ts.map +1 -0
  532. package/dist/commands/skills/validate-schema.js +44 -0
  533. package/dist/commands/skills/validate-schema.js.map +1 -0
  534. package/dist/commands/skills/validate.d.ts +100 -136
  535. package/dist/commands/skills/validate.d.ts.map +1 -1
  536. package/dist/commands/skills/validate.js +257 -343
  537. package/dist/commands/skills/validate.js.map +1 -1
  538. package/dist/commands/validate.d.ts +17 -5
  539. package/dist/commands/validate.d.ts.map +1 -1
  540. package/dist/commands/validate.js +139 -94
  541. package/dist/commands/validate.js.map +1 -1
  542. package/dist/commands/verify.d.ts +121 -110
  543. package/dist/commands/verify.d.ts.map +1 -1
  544. package/dist/commands/verify.js +230 -294
  545. package/dist/commands/verify.js.map +1 -1
  546. package/dist/index.d.ts +1 -1
  547. package/dist/index.d.ts.map +1 -1
  548. package/dist/index.js +1 -1
  549. package/dist/index.js.map +1 -1
  550. package/dist/report-schemas.d.ts +12398 -35
  551. package/dist/report-schemas.d.ts.map +1 -1
  552. package/dist/report-schemas.js +624 -66
  553. package/dist/report-schemas.js.map +1 -1
  554. package/dist/skill-resolution/packaging-config.js +2 -2
  555. package/dist/skill-resolution/packaging-config.js.map +1 -1
  556. package/dist/skill-resolution/resolve-skill-reference.d.ts.map +1 -1
  557. package/dist/skill-resolution/resolve-skill-reference.js +20 -13
  558. package/dist/skill-resolution/resolve-skill-reference.js.map +1 -1
  559. package/dist/utils/agent-discovery.d.ts +34 -1
  560. package/dist/utils/agent-discovery.d.ts.map +1 -1
  561. package/dist/utils/agent-discovery.js +80 -38
  562. package/dist/utils/agent-discovery.js.map +1 -1
  563. package/dist/utils/claude-context-lens.d.ts +13 -6
  564. package/dist/utils/claude-context-lens.d.ts.map +1 -1
  565. package/dist/utils/claude-context-lens.js +11 -12
  566. package/dist/utils/claude-context-lens.js.map +1 -1
  567. package/dist/utils/command-error-codes.d.ts +12 -0
  568. package/dist/utils/command-error-codes.d.ts.map +1 -0
  569. package/dist/utils/command-error-codes.js +12 -0
  570. package/dist/utils/command-error-codes.js.map +1 -0
  571. package/dist/utils/command-refusal.d.ts +58 -0
  572. package/dist/utils/command-refusal.d.ts.map +1 -0
  573. package/dist/utils/command-refusal.js +170 -0
  574. package/dist/utils/command-refusal.js.map +1 -0
  575. package/dist/utils/commander-ending.d.ts +40 -0
  576. package/dist/utils/commander-ending.d.ts.map +1 -0
  577. package/dist/utils/commander-ending.js +42 -0
  578. package/dist/utils/commander-ending.js.map +1 -0
  579. package/dist/utils/config-loader.d.ts +13 -8
  580. package/dist/utils/config-loader.d.ts.map +1 -1
  581. package/dist/utils/config-loader.js +84 -45
  582. package/dist/utils/config-loader.js.map +1 -1
  583. package/dist/utils/corpus-target.d.ts +1 -1
  584. package/dist/utils/corpus-target.d.ts.map +1 -1
  585. package/dist/utils/corpus-target.js +44 -5
  586. package/dist/utils/corpus-target.js.map +1 -1
  587. package/dist/utils/debug-diagnostics.d.ts +18 -0
  588. package/dist/utils/debug-diagnostics.d.ts.map +1 -0
  589. package/dist/utils/debug-diagnostics.js +23 -0
  590. package/dist/utils/debug-diagnostics.js.map +1 -0
  591. package/dist/utils/document-writer.d.ts +191 -0
  592. package/dist/utils/document-writer.d.ts.map +1 -0
  593. package/dist/utils/document-writer.js +319 -0
  594. package/dist/utils/document-writer.js.map +1 -0
  595. package/dist/utils/help-loader.d.ts +2 -2
  596. package/dist/utils/help-loader.js +2 -2
  597. package/dist/utils/install-plan.d.ts +99 -0
  598. package/dist/utils/install-plan.d.ts.map +1 -0
  599. package/dist/utils/install-plan.js +146 -0
  600. package/dist/utils/install-plan.js.map +1 -0
  601. package/dist/utils/issue-anchor.d.ts +1 -1
  602. package/dist/utils/issue-anchor.d.ts.map +1 -1
  603. package/dist/utils/issue-anchor.js.map +1 -1
  604. package/dist/utils/issue-rendering.d.ts +8 -3
  605. package/dist/utils/issue-rendering.d.ts.map +1 -1
  606. package/dist/utils/issue-rendering.js +4 -0
  607. package/dist/utils/issue-rendering.js.map +1 -1
  608. package/dist/utils/lens-population.d.ts +20 -0
  609. package/dist/utils/lens-population.d.ts.map +1 -0
  610. package/dist/utils/lens-population.js +15 -0
  611. package/dist/utils/lens-population.js.map +1 -0
  612. package/dist/utils/marketplace-io.d.ts +63 -0
  613. package/dist/utils/marketplace-io.d.ts.map +1 -0
  614. package/dist/utils/marketplace-io.js +63 -0
  615. package/dist/utils/marketplace-io.js.map +1 -0
  616. package/dist/utils/operator-notices.d.ts +97 -0
  617. package/dist/utils/operator-notices.d.ts.map +1 -0
  618. package/dist/utils/operator-notices.js +115 -0
  619. package/dist/utils/operator-notices.js.map +1 -0
  620. package/dist/utils/optional-backend.d.ts +18 -15
  621. package/dist/utils/optional-backend.d.ts.map +1 -1
  622. package/dist/utils/optional-backend.js +22 -33
  623. package/dist/utils/optional-backend.js.map +1 -1
  624. package/dist/utils/output.d.ts +5 -43
  625. package/dist/utils/output.d.ts.map +1 -1
  626. package/dist/utils/output.js +8 -63
  627. package/dist/utils/output.js.map +1 -1
  628. package/dist/utils/package-json.d.ts +3 -4
  629. package/dist/utils/package-json.d.ts.map +1 -1
  630. package/dist/utils/package-json.js +8 -8
  631. package/dist/utils/package-json.js.map +1 -1
  632. package/dist/utils/population-wiring.d.ts +31 -38
  633. package/dist/utils/population-wiring.d.ts.map +1 -1
  634. package/dist/utils/population-wiring.js +38 -32
  635. package/dist/utils/population-wiring.js.map +1 -1
  636. package/dist/utils/project-root-policy.d.ts +74 -1
  637. package/dist/utils/project-root-policy.d.ts.map +1 -1
  638. package/dist/utils/project-root-policy.js +146 -8
  639. package/dist/utils/project-root-policy.js.map +1 -1
  640. package/dist/utils/projection-lenses.d.ts +25 -7
  641. package/dist/utils/projection-lenses.d.ts.map +1 -1
  642. package/dist/utils/projection-lenses.js +20 -6
  643. package/dist/utils/projection-lenses.js.map +1 -1
  644. package/dist/utils/projection-query.d.ts +18 -11
  645. package/dist/utils/projection-query.d.ts.map +1 -1
  646. package/dist/utils/projection-query.js +47 -28
  647. package/dist/utils/projection-query.js.map +1 -1
  648. package/dist/utils/projection-store.d.ts +2 -2
  649. package/dist/utils/projection-store.d.ts.map +1 -1
  650. package/dist/utils/projection-store.js +74 -45
  651. package/dist/utils/projection-store.js.map +1 -1
  652. package/dist/utils/rag-database.d.ts +61 -0
  653. package/dist/utils/rag-database.d.ts.map +1 -0
  654. package/dist/utils/rag-database.js +178 -0
  655. package/dist/utils/rag-database.js.map +1 -0
  656. package/dist/utils/relation-limits.d.ts +7 -2
  657. package/dist/utils/relation-limits.d.ts.map +1 -1
  658. package/dist/utils/relation-limits.js +6 -1
  659. package/dist/utils/relation-limits.js.map +1 -1
  660. package/dist/utils/relativize-paths.d.ts +23 -0
  661. package/dist/utils/relativize-paths.d.ts.map +1 -1
  662. package/dist/utils/relativize-paths.js +32 -1
  663. package/dist/utils/relativize-paths.js.map +1 -1
  664. package/dist/utils/resource-loader.d.ts +78 -32
  665. package/dist/utils/resource-loader.d.ts.map +1 -1
  666. package/dist/utils/resource-loader.js +134 -66
  667. package/dist/utils/resource-loader.js.map +1 -1
  668. package/dist/utils/run-integrity.d.ts +64 -31
  669. package/dist/utils/run-integrity.d.ts.map +1 -1
  670. package/dist/utils/run-integrity.js +76 -35
  671. package/dist/utils/run-integrity.js.map +1 -1
  672. package/dist/utils/scope-locations.d.ts +7 -5
  673. package/dist/utils/scope-locations.d.ts.map +1 -1
  674. package/dist/utils/scope-locations.js +37 -12
  675. package/dist/utils/scope-locations.js.map +1 -1
  676. package/dist/utils/staging-dir.d.ts +7 -0
  677. package/dist/utils/staging-dir.d.ts.map +1 -0
  678. package/dist/utils/staging-dir.js +12 -0
  679. package/dist/utils/staging-dir.js.map +1 -0
  680. package/dist/utils/url-redact.d.ts +9 -0
  681. package/dist/utils/url-redact.d.ts.map +1 -1
  682. package/dist/utils/url-redact.js +13 -0
  683. package/dist/utils/url-redact.js.map +1 -1
  684. package/dist/utils/user-context-scanner.d.ts +3 -2
  685. package/dist/utils/user-context-scanner.d.ts.map +1 -1
  686. package/dist/utils/user-context-scanner.js +24 -4
  687. package/dist/utils/user-context-scanner.js.map +1 -1
  688. package/dist/utils/validate-help-files.d.ts.map +1 -1
  689. package/dist/utils/validate-help-files.js +8 -14
  690. package/dist/utils/validate-help-files.js.map +1 -1
  691. package/dist/utils/vat-bin-path.d.ts.map +1 -1
  692. package/dist/utils/vat-bin-path.js +3 -3
  693. package/dist/utils/vat-bin-path.js.map +1 -1
  694. package/dist/utils/verdict-helpers.d.ts.map +1 -1
  695. package/dist/utils/verdict-helpers.js +5 -5
  696. package/dist/utils/verdict-helpers.js.map +1 -1
  697. package/docs/agent.md +347 -2
  698. package/docs/audit.md +312 -89
  699. package/docs/doctor.md +65 -19
  700. package/docs/index.md +571 -20
  701. package/docs/mcp.md +64 -12
  702. package/docs/rag.md +176 -48
  703. package/docs/resources.md +257 -71
  704. package/docs/skill-test.md +148 -19
  705. package/docs/skills.md +459 -174
  706. package/package.json +17 -20
  707. package/schemas/agent-build.json +268 -0
  708. package/schemas/agent-import.json +252 -0
  709. package/schemas/agent-install.json +260 -0
  710. package/schemas/agent-installed.json +287 -0
  711. package/schemas/agent-list.json +279 -0
  712. package/schemas/agent-uninstall.json +260 -0
  713. package/schemas/agent-validate.json +279 -0
  714. package/schemas/ard-emit.json +228 -107
  715. package/schemas/audit-settings.json +472 -0
  716. package/schemas/audit.json +635 -0
  717. package/schemas/cache-clear.json +273 -0
  718. package/schemas/claude-marketplace-publish.json +286 -0
  719. package/schemas/claude-marketplace-validate.json +352 -0
  720. package/schemas/claude-org-not-implemented.json +239 -0
  721. package/schemas/claude-plugin-build.json +446 -0
  722. package/schemas/claude-plugin-install.json +291 -0
  723. package/schemas/claude-plugin-list.json +326 -0
  724. package/schemas/claude-plugin-uninstall.json +272 -0
  725. package/schemas/corpus-audit.json +635 -0
  726. package/schemas/corpus-scan.json +293 -0
  727. package/schemas/doctor.json +299 -0
  728. package/schemas/inventory.json +982 -0
  729. package/schemas/mcp-list-collections.json +268 -0
  730. package/schemas/okf-validate.json +224 -106
  731. package/schemas/orchestrator.json +299 -0
  732. package/schemas/rag-clear.json +253 -0
  733. package/schemas/rag-index.json +273 -0
  734. package/schemas/rag-query.json +365 -0
  735. package/schemas/rag-stats.json +269 -0
  736. package/schemas/resources-check.json +280 -118
  737. package/schemas/resources-query.json +333 -0
  738. package/schemas/resources-scan.json +321 -0
  739. package/schemas/resources-validate.json +332 -0
  740. package/schemas/skill-review.json +224 -106
  741. package/schemas/skill-test-configure.json +256 -0
  742. package/schemas/skill-test-run.json +296 -0
  743. package/schemas/skills-build.json +325 -0
  744. package/schemas/skills-install.json +287 -0
  745. package/schemas/skills-list.json +283 -0
  746. package/schemas/skills-package.json +270 -0
  747. package/schemas/skills-validate.json +285 -0
  748. package/dist/commands/skills/shared.d.ts +0 -29
  749. package/dist/commands/skills/shared.d.ts.map +0 -1
  750. package/dist/commands/skills/shared.js +0 -33
  751. package/dist/commands/skills/shared.js.map +0 -1
  752. package/dist/utils/command-error.d.ts +0 -189
  753. package/dist/utils/command-error.d.ts.map +0 -1
  754. package/dist/utils/command-error.js +0 -230
  755. package/dist/utils/command-error.js.map +0 -1
@@ -6,29 +6,31 @@
6
6
  * (commands, hooks, agents, .mcp.json, skills/, .claude-plugin/plugin.json) and
7
7
  * imports pool skills (from dist/skills/) via the `skills:` selector.
8
8
  */
9
- import { cpSync, existsSync, readFileSync } from 'node:fs';
10
- import { mkdir, readdir, rm, writeFile } from 'node:fs/promises';
11
- import { conventionalSuiteProbe, createProjectRegistry, getPluginOutputDir, getPluginSourceDir, listPluginSourceSkillDirs, listUntrackedPluginSkillDirs, materializeIssue, packageSkill, packagingConfigToPackageOptions, skillNameToFsPath } from '@vibe-agent-toolkit/agent-skills';
12
- import { countBySeverity } from '@vibe-agent-toolkit/schema';
13
- import { direntKindFollowing, safePath, toForwardSlash } from '@vibe-agent-toolkit/utils';
9
+ import { mkdir, readdir } from 'node:fs/promises';
10
+ import { conventionalSuiteProbe, createProjectRegistry, getMarketplaceOutputDir, getPluginSourceDir, isSkillPackagingInputError, listPluginSourceSkillDirs, listUntrackedPluginSkillDirs, materializeIssue, packageSkillInto, packagingConfigToPackageOptions, pluginDirInMarketplace, skillNameToFsPath, stagedPathMapper } from '@vibe-agent-toolkit/agent-skills';
11
+ import { buildReport, toFindings } from '@vibe-agent-toolkit/schema';
12
+ import { applyTreePlan, compareCodeUnits, direntKindFollowing, everyInOrder, foldedSegment, forEachInOrder, isSingleFsSegment, issueLocation, isTreeChangeResidue, mapInOrder, pathPresent, planTreeChanges, relativeEscapesRoot, safePath, sideWithin, toForwardSlash, VatError, withFsFault, writeFileUnder } from '@vibe-agent-toolkit/utils';
13
+ import { onCrawlOutput } from '@vibe-agent-toolkit/utils/crawl';
14
14
  import { Command } from 'commander';
15
15
  import { readPluginLocalSkillName } from '../../../commands/skills/skill-discovery.js';
16
- import { reportCommandError } from '../../../utils/command-error.js';
16
+ import { CommandRefusalError, errorMessageOf, refusalCodeOf } from '../../../utils/command-refusal.js';
17
17
  import { loadConfig } from '../../../utils/config-loader.js';
18
- import { collectPostBuildIssues, formatIssueLines, formatIssueSetHeading, formatPackagedFileCount, issuesToRenderAtVerbosity, sumSeverityCounts, } from '../../../utils/issue-rendering.js';
18
+ import { endWithReport, leftoverFindingsOf, leftoverIssue, NOTHING_FINISHED, refusalReport } from '../../../utils/document-writer.js';
19
+ import { collectPostBuildIssues, formatIssueLines, formatIssueSetHeading, formatPackagedFileCount, issuesToRenderAtVerbosity, } from '../../../utils/issue-rendering.js';
19
20
  import { createLogger } from '../../../utils/logger.js';
20
- import { writeYamlOutput } from '../../../utils/output.js';
21
+ import { copyFileIntoMarketplace, copyTreeIntoMarketplace, writingMarketplace } from '../../../utils/marketplace-io.js';
21
22
  import { readPackageJsonOrAbsent } from '../../../utils/package-json.js';
23
+ import { requireInputPath } from '../../../utils/project-root-policy.js';
22
24
  import { withResourcePopulationSource } from '../../../utils/resource-loader.js';
23
25
  import { collectDeclaredEvalSuites, mergeSkillPackagingConfig, pluginLocalSkillConfigEntry } from '../../../utils/skill-packaging-config.js';
24
- import { finishCommand } from '../../phase-utils.js';
26
+ import { packagingFailedIssue } from '../../skills/build.js';
25
27
  import { discoverSkillsFromConfig } from '../../skills/skill-discovery.js';
26
- import { loadClaudeProjectConfig } from '../claude-config.js';
28
+ import { assertMarketplaceDeclared, loadClaudeProjectConfig } from '../claude-config.js';
27
29
  import { buildMarketplaceJson } from './marketplace-json.js';
28
30
  import { resolvePluginChangelogPath } from './plugin-changelog.js';
29
31
  import { applyPluginFiles } from './plugin-files.js';
30
32
  import { mergePluginJson, resolveVersion } from './plugin-json-merge.js';
31
- import { parsePluginJsonFiles, verifyNoCaseCollidingPluginNames, verifyPluginDirCaseMatch, } from './plugin-validators.js';
33
+ import { parsePluginJsonFiles, readAuthorPluginJson, verifyNoCaseCollidingPluginNames, verifyPluginDirCaseMatch, } from './plugin-validators.js';
32
34
  import { treeCopyPlugin } from './tree-copy.js';
33
35
  const CLAUDE_PLUGIN_DIRNAME = '.claude-plugin';
34
36
  export function createPluginBuildCommand() {
@@ -61,6 +63,10 @@ Description:
61
63
  wherever the other marketplace/repo actually publishes it. Use this to
62
64
  cherry-pick a plugin from one marketplace into another without vendoring it.
63
65
 
66
+ Each marketplace is built whole beside dist/.claude/plugins/marketplaces/
67
+ <marketplace> and swapped in once every plugin passed: a failure, or a plugin
68
+ the post-build gate stops, leaves the previous marketplace exactly as it was.
69
+
64
70
  Output structure:
65
71
  dist/.claude/plugins/marketplaces/<marketplace>/
66
72
  .claude-plugin/marketplace.json
@@ -69,63 +75,124 @@ Output structure:
69
75
  skills/<skillName>/SKILL.md
70
76
 
71
77
  Output:
72
- YAML summary -> stdout
78
+ YAML report -> stdout: status (ok | findings | error), summary, examined
79
+ (marketplaces built), findings (each with its location), and data:
80
+ marketplacesBuilt, pluginsBuilt, pluginsReferenced, skillsPackaged, and
81
+ marketplaces[] of { name, status, reason?, plugins[] { name, outputPath,
82
+ skills }, externalPlugins[] }. Paths are relative to the directory holding
83
+ vibe-agent-toolkit.config.yaml.
73
84
  Build progress -> stderr
74
85
 
75
86
  On stderr, each packaged skill's findings heading names the whole set and
76
87
  its severity breakdown, and errors are always printed in full beneath it.
77
88
  Warnings and info findings stay collapsed into that heading unless
78
- --verbose. The stdout YAML is NOT affected by --verbose: its issueCounts
79
- cover every finding at every verbosity.
89
+ --verbose. The stdout report is NOT affected by --verbose: its findings
90
+ are every finding at every verbosity.
80
91
 
81
92
  Exit Codes:
82
- 0 - Build successful
83
- 1 - Build error (empty plugin, invalid config)
84
- 2 - System error
93
+ 0 - Built; findings, if any, are warnings or info
94
+ 1 - An error-severity finding: a plugin-local skill failed the post-build
95
+ gate (the build stops there — that marketplace is not replaced and
96
+ nothing after it is built), or no marketplace is configured
97
+ (RESOURCE_CHECK_BROKEN)
98
+ 2 - The build could not run (error.code): USAGE_INVALID (an undeclared
99
+ --marketplace), CONFIG_INVALID (no config; an empty or colliding plugin
100
+ declaration; an invalid files[].dest), INPUT_UNREADABLE (a plugin file
101
+ that is not JSON, a pool skill or files[].source nothing built, a
102
+ symlink no bundle can ship, a file the build copies -- LICENSE,
103
+ README.md, CHANGELOG.md, a plugin file, a files[].source, a built skill
104
+ in dist/skills -- that the OS will not read), RUN_INCOMPLETE (the packager refused a
105
+ plugin-local skill's content, e.g. a skill files: source that does not
106
+ exist — the SKILL_PACKAGING_FAILED finding names the skill — or the OS
107
+ would not let the build write its output: a full disk, a read-only
108
+ dist/; no finding). Known gap: a disk so full that the git snapshot
109
+ of the project fails first is still INTERNAL_ERROR ("git did not
110
+ answer ...").
85
111
 
86
112
  Example:
87
113
  $ vat skills build && vat claude plugin build # Build skills then wrap for Claude
88
114
  `);
89
115
  return command;
90
116
  }
117
+ /**
118
+ * What `vat claude plugin build` writes in the project at `configDir`: every marketplace it
119
+ * replaces lives under this one tree. The one definition — the build's own declaration of its
120
+ * outputs, and what `vat build` tells its skills phase the run writes after it.
121
+ */
122
+ export function pluginBuildOutput(configDir) {
123
+ return safePath.join(configDir, 'dist', '.claude', 'plugins', 'marketplaces');
124
+ }
125
+ /**
126
+ * Which side of the run `dist/skills` — the pool skills this build copies in — is on. Under
127
+ * `vat claude plugin build` it is an INPUT another build wrote (`source`: a refusal is fixed by
128
+ * rebuilding it); under `vat build` the run's own skills phase wrote it, so it is one of the
129
+ * run's outputs (`destination`). Asked of the run's ONE declaration of what it writes
130
+ * (`onCrawlOutput`), never decided here a second way.
131
+ */
132
+ function distSkillsSide(distSkillsDir, outputs) {
133
+ return onCrawlOutput(distSkillsDir, outputs) ? 'destination' : 'source';
134
+ }
135
+ /**
136
+ * The side of each path a probe of a plugin's source directory touches, walked from the project root.
137
+ * The conventional `plugins/` directory (walked through, and listed to confirm an absence) is plugin
138
+ * source as a whole; a configured `source` is only itself — the directories above it are the project
139
+ * the build writes into.
140
+ */
141
+ function pluginSourceSideOf(configDir, plugin, pluginSourceDir) {
142
+ const inputRoot = plugin.source === undefined ? safePath.join(configDir, 'plugins') : pluginSourceDir;
143
+ return sideWithin(inputRoot, 'source', 'destination');
144
+ }
91
145
  /**
92
146
  * Discover available skill names by listing directories in dist/skills/.
147
+ *
148
+ * @param outputs - What the run writes (its one declaration), which decides `dist/skills`' side
93
149
  */
94
- async function discoverBuiltSkills(configDir) {
150
+ function discoverBuiltSkills(configDir, outputs) {
95
151
  const skillsDir = safePath.join(configDir, 'dist', 'skills');
96
- if (!existsSync(skillsDir)) {
97
- return [];
152
+ // A probe or a listing the OS refuses is on dist/skills' side of the run (see `distSkillsSide`);
153
+ // `dist/` itself, walked through and listed to confirm an absence, is the project's: the tree the build writes.
154
+ const side = distSkillsSide(skillsDir, outputs);
155
+ // "Not built" only once `dist/`'s listing agrees: a wrong absent silently builds every plugin without its skills.
156
+ if (!pathPresent(skillsDir, { follow: configDir }, sideWithin(skillsDir, side, 'destination'), 'confirmed')) {
157
+ return Promise.resolve([]);
98
158
  }
99
- const entries = await readdir(skillsDir, { withFileTypes: true });
100
- const kinds = await Promise.all(entries.map((entry) => direntKindFollowing(skillsDir, entry)));
101
- return entries.filter((_, i) => kinds[i] === 'directory').map((entry) => entry.name);
159
+ return withFsFault({ side, origin: 'content', action: 'list the built skills', path: skillsDir }, async () => {
160
+ const entries = await readdir(skillsDir, { withFileTypes: true });
161
+ const kinds = await Promise.all(entries.map((entry) => direntKindFollowing(skillsDir, entry, configDir)));
162
+ // A staged or parked tree a concurrent or killed `vat skills build` left beside a bundle is no skill.
163
+ return entries.filter((entry, i) => kinds[i] === 'directory' && !isTreeChangeResidue(entry.name)).map((entry) => entry.name);
164
+ });
102
165
  }
103
166
  /**
104
167
  * Build Claude plugin artifacts for a project — the non-exiting orchestration
105
168
  * core shared by the `vat claude plugin build` CLI action and `vat skill test`
106
169
  * (which builds a declared skill's owning marketplace before staging its dist).
107
170
  *
108
- * Throws on any build error; never calls `process.exit` and never emits the YAML
109
- * summary — those belong to the CLI wrapper. Returns one result per built
110
- * marketplace (empty when no `claude.marketplaces` are configured).
171
+ * Pushes each marketplace into `built` as it finishes, so a caller whose catch
172
+ * reads the same array publishes the marketplaces that finished before a throw.
173
+ * A marketplace whose plugin failed the gate ({@link MarketplaceBuildResult.gate})
174
+ * is pushed and ends the run. Never calls `process.exit` and never writes stdout.
111
175
  *
112
176
  * `configDir` is threaded in (the project root that holds
113
177
  * vibe-agent-toolkit.config.yaml), so callers that already know the root build
114
- * against it rather than re-discovering from cwd. `options.marketplace` restricts
115
- * the build to a single marketplace by name.
178
+ * against it rather than re-discovering from cwd. `projectConfig` is the config
179
+ * the caller already parsed from it, so the file is read (and any unknown-key
180
+ * warning printed) once per run. `options.marketplace` restricts
181
+ * the build to a single marketplace by name, and refuses a name the config does
182
+ * not declare.
116
183
  *
117
184
  * `options.verbose` affects the stderr findings report ONLY (see
118
- * `summarizePackagedSkillIssues`); it changes nothing this function returns, so a
119
- * programmatic caller — `vat skill test`, which builds a marketplace purely to
120
- * stage a skill — can leave it off and still get the same result objects.
185
+ * `summarizePackagedSkillIssues`); it changes nothing this function returns.
121
186
  */
122
- export async function runClaudePluginBuild(configDir, options = {}) {
123
- const logger = options.logger ?? createLogger({});
124
- const verbose = options.verbose === true;
125
- const projectConfig = loadConfig(configDir);
126
- const marketplaces = projectConfig?.claude?.marketplaces;
127
- if (!marketplaces || Object.keys(marketplaces).length === 0) {
128
- return [];
187
+ async function buildClaudePluginMarketplaces(configDir, projectConfig, options, built) {
188
+ const { logger, verbose } = options;
189
+ // The run's ONE declaration of what it writes: the marketplaces this build replaces, and what the
190
+ // run wrote before it. A fault on, in or above any of them is the destination's.
191
+ const outputs = [pluginBuildOutput(configDir), ...options.runOutputs];
192
+ const marketplaces = projectConfig?.claude?.marketplaces ?? {};
193
+ assertMarketplaceDeclared(options.marketplace, Object.keys(marketplaces));
194
+ if (Object.keys(marketplaces).length === 0) {
195
+ return;
129
196
  }
130
197
  // Read version from root package.json — lowest-precedence fallback in the
131
198
  // per-plugin version chain (config > plugin.json > root). Used so Claude
@@ -137,7 +204,7 @@ export async function runClaudePluginBuild(configDir, options = {}) {
137
204
  const rootPkg = readPackageJsonOrAbsent(safePath.join(configDir, 'package.json'));
138
205
  const rootVersion = typeof rootPkg?.['version'] === 'string' ? rootPkg['version'] : undefined;
139
206
  // Discover available skills from dist/skills/ for pool-to-plugin selectors
140
- const availableSkills = await discoverBuiltSkills(configDir);
207
+ const availableSkills = await discoverBuiltSkills(configDir, outputs);
141
208
  // Load the project's skills config (defaults + per-skill) so each plugin-local
142
209
  // skill is PACKAGED with its own effective packaging config — the same config
143
210
  // `vat skills build` would use for it. Undefined when no config, in which case
@@ -156,7 +223,10 @@ export async function runClaudePluginBuild(configDir, options = {}) {
156
223
  // store and ignore oracle `vat resources validate` uses. `createProjectRegistry`
157
224
  // re-applies its own markdown-only `include` to whatever the source offers, so
158
225
  // this is a change of COST, not of what the build sees.
159
- const sharedRegistry = await withResourcePopulationSource({ root: configDir }, async (populationSource) => createProjectRegistry(configDir, {
226
+ const sharedRegistry = await withResourcePopulationSource({ root: configDir }, (populationSource) => createProjectRegistry(configDir, {
227
+ // What this run writes (see `outputs` above). A fault on, in or above it (the project
228
+ // root included) is the destination's.
229
+ outputs,
160
230
  ...(populationSource !== undefined && { populationSource }),
161
231
  }));
162
232
  logger.debug(`Project registry: ${sharedRegistry.getAllResources().length} markdown resources (built once)`);
@@ -166,8 +236,8 @@ export async function runClaudePluginBuild(configDir, options = {}) {
166
236
  // a plugin-local skill's bundle must exclude the OTHER skills' suites too — not
167
237
  // just its own. Discovery is not free, hence once per run rather than per skill.
168
238
  // `'refuse'`: a bundle assembled around a directory discovery could not
169
- // list may ship another skill's answer key. The throw lands in this
170
- // command's catch → `reportCommandError`, exit 2.
239
+ // list may ship another skill's answer key. The throw carries the classified
240
+ // fault (a `source` listing), which the command publishes as the table says.
171
241
  const projectSkills = skillsConfig === undefined
172
242
  ? []
173
243
  : collectDeclaredEvalSuites(skillsConfig, await discoverSkillsFromConfig(skillsConfig, configDir, 'refuse'));
@@ -182,17 +252,18 @@ export async function runClaudePluginBuild(configDir, options = {}) {
182
252
  // Run-scoped, never module-scoped: the answer is a filesystem snapshot, and a cache
183
253
  // outliving the run would keep answering for a tree that has since changed.
184
254
  const suiteProbe = conventionalSuiteProbe();
185
- const results = [];
186
255
  const allPluginNames = [];
187
256
  for (const mp of Object.values(marketplaces)) {
188
257
  for (const p of mp.plugins)
189
258
  allPluginNames.push(p.name);
190
259
  }
191
260
  verifyNoCaseCollidingPluginNames(allPluginNames);
192
- for (const name of Object.keys(marketplaces)) {
261
+ // In order, stopping at the first gated marketplace: each writes its own tree
262
+ // and the log reads marketplace by marketplace.
263
+ await everyInOrder(Object.keys(marketplaces), async (name) => {
193
264
  // Skip if --marketplace filter specified and doesn't match
194
265
  if (options.marketplace && options.marketplace !== name) {
195
- continue;
266
+ return true;
196
267
  }
197
268
  const mpConfig = marketplaces[name];
198
269
  logger.info(`\n Building marketplace: ${name}`);
@@ -206,121 +277,138 @@ export async function runClaudePluginBuild(configDir, options = {}) {
206
277
  registry: sharedRegistry,
207
278
  projectSkills,
208
279
  suiteProbe,
280
+ outputs,
209
281
  logger,
210
282
  verbose,
211
283
  });
212
- results.push(result);
213
- if (result.status === 'error') {
214
- throw new Error(`Claude plugin build failed for marketplace '${name}': ${result.reason ?? 'unknown error'}`);
215
- }
284
+ built.push(result);
285
+ return result.gate === undefined;
286
+ });
287
+ }
288
+ /**
289
+ * {@link buildClaudePluginMarketplaces} for a programmatic caller that only
290
+ * wants the built tree: one result per marketplace built (empty when no
291
+ * `claude.marketplaces` are configured), and a throw — carrying the gate's
292
+ * reason — when a plugin failed the post-build gate, since there is then no
293
+ * complete marketplace to stage from.
294
+ */
295
+ export async function runClaudePluginBuild(configDir, options) {
296
+ const built = [];
297
+ await buildClaudePluginMarketplaces(configDir, loadConfig(configDir, 'destination'), { marketplace: options.marketplace, logger: options.logger ?? createLogger({}), verbose: options.verbose === true, runOutputs: options.runOutputs }, built);
298
+ const gated = built.find((result) => result.gate !== undefined)?.gate;
299
+ if (gated !== undefined)
300
+ throw new Error(gated.reason);
301
+ return built;
302
+ }
303
+ /** Plugin build has no `--strict`: warnings never fail it. */
304
+ const GATE = { strict: false };
305
+ /** Every finding the built marketplaces carry, the stopped plugin's included. */
306
+ function marketplaceIssues(result) {
307
+ return [...result.plugins.flatMap((plugin) => plugin.issues), ...(result.gate?.issues ?? []), ...result.residue];
308
+ }
309
+ /**
310
+ * The report's `data` for the marketplaces built — paths relative to
311
+ * `configDir`, the directory whose config the build read.
312
+ */
313
+ function pluginBuildData(configDir, built) {
314
+ const plugins = built.flatMap((result) => result.plugins);
315
+ return {
316
+ marketplacesBuilt: built.filter((result) => result.gate === undefined).length,
317
+ pluginsBuilt: plugins.length,
318
+ pluginsReferenced: built.flatMap((result) => result.externalPlugins).length,
319
+ skillsPackaged: plugins.flatMap((plugin) => plugin.skillsCopied).length,
320
+ marketplaces: built.map((result) => ({
321
+ name: result.name,
322
+ status: toFindings(marketplaceIssues(result)).length === 0 ? 'ok' : 'findings',
323
+ ...(result.gate === undefined ? {} : { reason: result.gate.reason }),
324
+ plugins: result.plugins.map((plugin) => ({
325
+ name: plugin.pluginName,
326
+ outputPath: toForwardSlash(safePath.relative(configDir, plugin.pluginDir)),
327
+ skills: plugin.skillsCopied,
328
+ })),
329
+ // Referenced, not built — no output path. `source` is the same object
330
+ // emitted verbatim into marketplace.json, so the report and the artifact
331
+ // can never disagree about what a reference points at.
332
+ externalPlugins: result.externalPlugins.map((plugin) => ({
333
+ name: plugin.pluginName,
334
+ ...(plugin.pluginVersion === undefined ? {} : { version: plugin.pluginVersion }),
335
+ source: plugin.source,
336
+ })),
337
+ })),
338
+ };
339
+ }
340
+ /**
341
+ * The packager refused one plugin-local skill's own CONTENT — a `files:` source
342
+ * that is not there, a bundled nested `SKILL.md`, a name that is no path segment.
343
+ *
344
+ * That is the project's to fix, so it is coded where it is caught: the run
345
+ * stopped (`RUN_INCOMPLETE`) on a `SKILL_PACKAGING_FAILED` finding at the skill —
346
+ * the refusal `vat skill test run` and `vat agent build` publish for the same
347
+ * cause. An uncoded packager throw is not wrapped: it stays a defect.
348
+ */
349
+ class SkillPackagingStop extends CommandRefusalError {
350
+ /** The refused skill's `SKILL.md`, absolute. */
351
+ skillPath;
352
+ constructor(cause, skillPath) {
353
+ super('RUN_INCOMPLETE', errorMessageOf(cause), { cause });
354
+ this.skillPath = skillPath;
216
355
  }
217
- return results;
218
356
  }
219
357
  /**
220
- * Build every configured plugin marketplace and hand back the document and exit
221
- * code, printing the document nowhere.
358
+ * `finished`, plus the `SKILL_PACKAGING_FAILED` finding a {@link SkillPackagingStop} stands for.
359
+ *
360
+ * @param finished - What the run finished before it stopped
361
+ * @param error - What stopped it
362
+ * @param configDir - The project root the finding's `location` is relative to, when known
363
+ */
364
+ function withPackagingStop(finished, error, configDir) {
365
+ if (!(error instanceof SkillPackagingStop))
366
+ return finished;
367
+ const relative = configDir === undefined ? undefined : issueLocation(error.skillPath, configDir);
368
+ const location = relative === undefined || relativeEscapesRoot(relative) ? undefined : relative;
369
+ return { ...finished, findings: [...finished.findings, ...toFindings([packagingFailedIssue(error.message, location, 'rebuild', error.cause)])] };
370
+ }
371
+ /** What the marketplaces built so far are, as the report or a refusal's finished work. */
372
+ function builtWork(configDir, built) {
373
+ return {
374
+ examined: built.length,
375
+ findings: toFindings(built.flatMap((result) => marketplaceIssues(result))),
376
+ data: pluginBuildData(configDir, built),
377
+ };
378
+ }
379
+ /**
380
+ * Build every configured plugin marketplace and hand back the report — the
381
+ * refusal branch when it could not run, carrying the marketplaces that
382
+ * finished — printing it nowhere.
222
383
  *
223
- * The phase entry point for `vat build`, whose `claude` phase is this command.
384
+ * ONE function for both lanes: `vat claude plugin build` publishes it with
385
+ * `endWithReport`, and `vat build`'s `claude` phase (run only when
386
+ * `claude.marketplaces` is configured) folds it. The report is the one BEFORE
387
+ * the writer's run-integrity pass.
224
388
  */
225
- export async function runClaudePluginBuildPhase(options) {
389
+ export async function runClaudePluginBuildPhase(options, runOutputs) {
226
390
  const logger = createLogger(options.debug ? { debug: true } : {});
227
391
  const startTime = Date.now();
392
+ const built = [];
393
+ let configDir;
228
394
  try {
229
- const { configDir, claudeConfig } = await loadClaudeProjectConfig();
230
- if (!claudeConfig?.marketplaces || Object.keys(claudeConfig.marketplaces).length === 0) {
231
- return {
232
- document: {
233
- status: 'success',
234
- message: 'No claude.marketplaces configured — nothing to build',
235
- duration: `${Date.now() - startTime}ms`,
236
- },
237
- exitCode: 0,
238
- };
239
- }
240
- const results = await runClaudePluginBuild(configDir, {
241
- ...(options.marketplace ? { marketplace: options.marketplace } : {}),
242
- logger,
243
- verbose: options.verbose === true,
244
- });
245
- const duration = Date.now() - startTime;
246
- const totalPlugins = results.flatMap((r) => r.plugins).length;
247
- const totalExternalPlugins = results.flatMap((r) => r.externalPlugins).length;
248
- const totalSkills = results.flatMap((r) => r.plugins).flatMap((p) => p.skillsCopied).length;
249
- const allPlugins = results.flatMap((r) => r.plugins);
250
- // KNOWN, DELIBERATELY NOT FIXED — this lane NAMES NOTHING. Every level of this
251
- // document publishes severity counts and no findings: `vat build --only claude`
252
- // on a real adopter monorepo published `warnings: 70, info: 30` with zero named
253
- // findings anywhere in the document, at any verbosity. A reader is told how many
254
- // things are wrong and never which. The findings exist — `summarizePackagedSkillIssues`
255
- // and `reportPluginIssues` render them — but only to stderr, where no CI consumer
256
- // reads them.
257
- //
258
- // Same class as the `validationFailedSkills` rows in ../../skills/build.ts, a
259
- // different lane. Fixing it means carrying `ValidationIssue[]` up through
260
- // `PluginBuildResult`/`MarketplaceBuildResult` beside the counts they already
261
- // carry, then publishing it on the plugin rows below.
262
- const document = {
263
- status: 'success',
264
- // The build gate is two-valued and a warning does not fail it, so the
265
- // distribution has to travel next to the status rather than inside it.
266
- issueCounts: sumSeverityCounts(allPlugins.map((p) => p.issueCounts)),
267
- marketplacesBuilt: results.filter((r) => r.status === 'built').length,
268
- pluginsBuilt: totalPlugins,
269
- pluginsReferenced: totalExternalPlugins,
270
- skillsPackaged: totalSkills,
271
- marketplaces: results.map((r) => ({
272
- name: r.name,
273
- status: r.status,
274
- ...(r.reason ? { reason: r.reason } : {}),
275
- plugins: r.plugins.map((p) => ({
276
- name: p.pluginName,
277
- // KNOWN, DELIBERATELY NOT FIXED — an ABSOLUTE path, so stdout carries
278
- // `$HOME`. Measured on a real adopter monorepo run: 5 places in the
279
- // published document. Failure MESSAGES in this change were scrubbed of
280
- // absolute project paths and are confirmed clean; the success-path fields
281
- // like this one were not, so the leak survives in the reports CI keeps.
282
- //
283
- // Do NOT relativize it on its own. It is blocked on the same undecided
284
- // question as `skills[].outputPath` in ../../skills/build.ts: which root
285
- // these reports anchor on. Picking one here picks it by accident, and the
286
- // two build lanes then publish paths in two coordinate systems.
287
- dir: p.pluginDir,
288
- skills: p.skillsCopied,
289
- commandsCopied: p.commandsCopied,
290
- hooksCopied: p.hooksCopied,
291
- agentsCopied: p.agentsCopied,
292
- mcpCopied: p.mcpCopied,
293
- treeFilesCopied: p.treeFilesCopied,
294
- symlinksCopied: p.symlinksCopied,
295
- explicitFilesCopied: p.explicitFilesCopied,
296
- localSkillsPackaged: p.localSkillsPackaged,
297
- issueCounts: p.issueCounts,
298
- })),
299
- // Referenced, not built — no dir, no counts to report. `source` is the
300
- // same object emitted verbatim into marketplace.json, so the report and
301
- // the artifact can never disagree about what a reference points at.
302
- externalPlugins: r.externalPlugins.map((p) => ({
303
- name: p.pluginName,
304
- ...(p.pluginVersion ? { version: p.pluginVersion } : {}),
305
- source: p.source,
306
- })),
307
- })),
308
- duration: `${duration}ms`,
309
- };
310
- return { document, exitCode: 0 };
395
+ const loaded = loadClaudeProjectConfig();
396
+ configDir = loaded.configDir;
397
+ // The config this lane already parsed is handed down, so the build reads it
398
+ // once (and warns about an unknown key once).
399
+ await buildClaudePluginMarketplaces(configDir, loaded.projectConfig, { marketplace: options.marketplace, logger, verbose: options.verbose === true, runOutputs }, built);
400
+ const work = builtWork(configDir, built);
401
+ return { report: buildReport({ ...work, gate: GATE, durationMs: Date.now() - startTime }) };
311
402
  }
312
403
  catch (error) {
313
- return {
314
- document: reportCommandError(error, logger, startTime, 'ClaudePluginBuild'),
315
- exitCode: 2,
316
- failed: true,
317
- };
404
+ const finished = configDir === undefined || built.length === 0 ? NOTHING_FINISHED : builtWork(configDir, built);
405
+ return { report: refusalReport(refusalCodeOf(error), error, GATE, withPackagingStop(finished, error, configDir)) };
318
406
  }
319
407
  }
320
408
  async function pluginBuildCommand(options) {
321
- // `undefined`: this command offers no `--format`, so its failure envelope is
322
- // YAML like its report.
323
- finishCommand(await runClaudePluginBuildPhase(options), writeYamlOutput, undefined);
409
+ // This command offers no `--format`: the report is YAML.
410
+ // On its own, this verb writes nothing before its marketplaces: `dist/skills` is an input.
411
+ endWithReport('claude plugin build', (await runClaudePluginBuildPhase(options, [])).report, 'yaml');
324
412
  }
325
413
  /**
326
414
  * Copy distribution files (LICENSE, README.md, CHANGELOG.md) to marketplace output.
@@ -331,11 +419,14 @@ async function copyDistributionFiles(marketplaceDir, configDir, config, logger)
331
419
  'README.md': config.publish?.readme,
332
420
  'CHANGELOG.md': config.publish?.changelog,
333
421
  };
334
- for (const file of ['LICENSE', 'README.md', 'CHANGELOG.md']) {
422
+ // In order: the log names the files in this order, and the first failed copy is the one reported.
423
+ await forEachInOrder(['LICENSE', 'README.md', 'CHANGELOG.md'], async (file) => {
335
424
  const override = overrides[file];
336
425
  const srcPath = override ? safePath.join(configDir, override) : safePath.join(configDir, file);
337
- if (existsSync(srcPath)) {
338
- cpSync(srcPath, safePath.join(marketplaceDir, file));
426
+ // Absent is skipped once the project root's listing agrees (a wrong absent silently ships less); a file the OS will not let the build examine refuses.
427
+ // The file is an input; the directories above it, and the root listed to confirm it absent, are the project the build writes into.
428
+ if (pathPresent(srcPath, { follow: configDir }, sideWithin(srcPath, 'source', 'destination'), 'confirmed')) {
429
+ await copyFileIntoMarketplace(srcPath, { root: marketplaceDir, relative: file }, issueLocation(srcPath, configDir), issueLocation(safePath.join(marketplaceDir, file), configDir));
339
430
  if (override) {
340
431
  logger.info(` ${file} (from publish.${file === 'README.md' ? 'readme' : 'changelog'}: ${override})`);
341
432
  }
@@ -343,20 +434,85 @@ async function copyDistributionFiles(marketplaceDir, configDir, config, logger)
343
434
  logger.info(` ${file} (copied from project root)`);
344
435
  }
345
436
  }
437
+ });
438
+ }
439
+ /**
440
+ * Thrown from a marketplace's staging fill when a plugin failed the gate: the plan discards what
441
+ * it staged, and the previous marketplace stays exactly as it was. One per marketplace.
442
+ */
443
+ class MarketplaceNotEarned extends VatError {
444
+ constructor(name) {
445
+ super('PLUGIN_BUILD_NOT_EARNED', `marketplace ${name}: a plugin failed the gate, so the build does not replace the previous marketplace`);
346
446
  }
347
447
  }
448
+ /**
449
+ * Build ONE marketplace as one tree-change plan: a `replace` of
450
+ * `dist/.claude/plugins/marketplaces/<name>` whose staged tree the whole build is written
451
+ * into ({@link buildMarketplaceInto}). It lands only when every plugin passed the gate; a
452
+ * failure anywhere — a refused write, a refused input, a gated plugin — leaves the previous
453
+ * marketplace byte-equal (orphaned plugins of a previous build go with the swap).
454
+ */
348
455
  async function buildMarketplace(input) {
349
- const { name, config, availableSkills, configDir, skillsConfig, rootVersion, registry, projectSkills, suiteProbe, logger, verbose } = input;
456
+ const { name, configDir } = input;
457
+ // The config schema already refuses a name that is not one path segment; this re-check keeps the
458
+ // replace below from ever aiming outside dist/ if a caller skips it.
459
+ if (!isSingleFsSegment(name)) {
460
+ throw new CommandRefusalError('CONFIG_INVALID', `Marketplace name ${JSON.stringify(name)} is not a single path segment; rename it in vibe-agent-toolkit.config.yaml under claude.marketplaces.`);
461
+ }
462
+ const marketplaceDir = getMarketplaceOutputDir(configDir, name);
463
+ const notEarned = new MarketplaceNotEarned(name);
464
+ // A holder, not a `let`: the fill assigns it inside the plan, where flow analysis cannot see.
465
+ const holder = {};
466
+ const plan = await planTreeChanges([{
467
+ op: 'replace',
468
+ dest: marketplaceDir,
469
+ ownership: { kind: 'vat-state' },
470
+ label: `marketplace ${name}`,
471
+ fill: {
472
+ from: 'write',
473
+ write: async (staged) => {
474
+ holder.staged = staged;
475
+ holder.built = await buildMarketplaceInto(input, staged);
476
+ if (holder.built.gate !== undefined)
477
+ throw notEarned;
478
+ },
479
+ },
480
+ }]);
481
+ let residue;
482
+ try {
483
+ residue = (await applyTreePlan(plan)).warnings.map(({ message, path }) => leftoverIssue(message, path));
484
+ }
485
+ catch (error) {
486
+ if (error !== notEarned)
487
+ throw error;
488
+ residue = leftoverFindingsOf(error);
489
+ }
490
+ const { built, staged } = holder;
491
+ // The plan resolves, or ends gated, only once its fill has run.
492
+ if (built === undefined || staged === undefined)
493
+ throw new Error(`plugin build: the plan for marketplace ${name} ended without building it`);
494
+ return landedMarketplace(built, stagedPathMapper(configDir, staged, marketplaceDir), residue);
495
+ }
496
+ /** A marketplace built into its staged tree, every path it names re-anchored onto where it landed. */
497
+ function landedMarketplace(built, landedPath, residue) {
498
+ const landedIssues = (issues) => issues.map((issue) => (issue.location === undefined ? issue : { ...issue, location: landedPath(issue.location) }));
499
+ return {
500
+ ...built,
501
+ plugins: built.plugins.map((plugin) => ({ ...plugin, pluginDir: landedPath(plugin.pluginDir), issues: landedIssues(plugin.issues) })),
502
+ gate: built.gate === undefined ? undefined : { ...built.gate, issues: landedIssues(built.gate.issues) },
503
+ residue,
504
+ };
505
+ }
506
+ /** The whole marketplace build, into `marketplaceDir`: its plan's staged tree. */
507
+ async function buildMarketplaceInto(input, marketplaceDir) {
508
+ const { name, config, availableSkills, configDir, skillsConfig, rootVersion, registry, projectSkills, suiteProbe, outputs, logger, verbose } = input;
350
509
  const plugins = [];
351
510
  const externalPlugins = [];
352
- // Clean stale marketplace directory before rebuilding — removes orphaned plugins
353
- const marketplaceBaseDir = safePath.join(configDir, 'dist', '.claude', 'plugins', 'marketplaces', name);
354
- if (existsSync(marketplaceBaseDir)) {
355
- await rm(marketplaceBaseDir, { recursive: true, force: true });
356
- }
357
511
  // Marketplace-level skills filter restricts pool available to plugins that use "*"
358
512
  const marketplaceAvailable = resolveMarketplaceAvailableSkills(config, availableSkills);
359
- for (const pluginDef of config.plugins) {
513
+ let gate;
514
+ // In order, stopping at the first gated plugin: each writes into this marketplace's tree.
515
+ await everyInOrder(config.plugins, async (pluginDef) => {
360
516
  // externalSource plugins are never built or copied — they route straight
361
517
  // to a marketplace.json entry referencing the other repo. Every phase
362
518
  // buildPlugin runs (empty-plugin guard, tree-copy, skills packaging,
@@ -372,10 +528,10 @@ async function buildMarketplace(input) {
372
528
  pluginVersion: pluginDef.version,
373
529
  source: pluginDef.externalSource,
374
530
  });
375
- continue;
531
+ return true;
376
532
  }
377
- const pluginResult = await buildPlugin({
378
- marketplaceName: name,
533
+ const outcome = await buildPlugin({
534
+ marketplaceDir,
379
535
  pluginDef,
380
536
  marketplaceAvailable,
381
537
  configDir,
@@ -385,15 +541,22 @@ async function buildMarketplace(input) {
385
541
  registry,
386
542
  projectSkills,
387
543
  suiteProbe,
544
+ outputs,
388
545
  logger,
389
546
  verbose,
390
547
  });
391
- plugins.push(pluginResult);
548
+ if (outcome.kind === 'gated') {
549
+ gate = outcome.failure;
550
+ return false;
551
+ }
552
+ plugins.push(outcome.result);
553
+ return true;
554
+ });
555
+ if (gate !== undefined) {
556
+ // No marketplace.json over a plugin that was never assembled: the plan discards the staged tree.
557
+ return { name, plugins, externalPlugins, gate, residue: [] };
392
558
  }
393
559
  // Generate .claude-plugin/marketplace.json
394
- const marketplaceDir = marketplaceBaseDir;
395
- const claudePluginDir = safePath.join(marketplaceDir, CLAUDE_PLUGIN_DIRNAME);
396
- await mkdir(claudePluginDir, { recursive: true });
397
560
  // Each BUILT entry's author is the plugin's own MERGED author (see
398
561
  // marketplace-json.ts), so marketplace.json and that plugin's plugin.json
399
562
  // cannot disagree. External entries carry no author — see marketplace-json.ts.
@@ -417,10 +580,11 @@ async function buildMarketplace(input) {
417
580
  })),
418
581
  ],
419
582
  });
420
- await writeFile(safePath.join(claudePluginDir, 'marketplace.json'), JSON.stringify(marketplaceJson, null, 2));
583
+ const marketplaceJsonPath = safePath.join(marketplaceDir, CLAUDE_PLUGIN_DIRNAME, 'marketplace.json');
584
+ await writingMarketplace(`write ${marketplaceJsonPath}`, () => writeFileUnder(marketplaceDir, `${CLAUDE_PLUGIN_DIRNAME}/marketplace.json`, JSON.stringify(marketplaceJson, null, 2), { existing: 'replace', writing: 'the marketplace manifest' }));
421
585
  logger.info(` .claude-plugin/marketplace.json`);
422
586
  await copyDistributionFiles(marketplaceDir, configDir, config, logger);
423
- return { name, status: 'built', plugins, externalPlugins };
587
+ return { name, plugins, externalPlugins, gate: undefined, residue: [] };
424
588
  }
425
589
  /**
426
590
  * Resolve which pool skills are available to plugins in this marketplace.
@@ -468,32 +632,27 @@ function resolvePluginSkills(pluginDef, availableSkills) {
468
632
  * Supports exact match and simple glob patterns (prefix*, suffix*, *contains*).
469
633
  */
470
634
  function matchesSelector(skillName, selector) {
471
- if (selector === '*') {
472
- return true;
473
- }
474
- // eslint-disable-next-line security/detect-non-literal-regexp -- selector is from project config, bounded by name format
475
- const regex = new RegExp(`^${selector.replaceAll('*', '.*')}$`);
476
- return regex.test(skillName);
477
- }
478
- /**
479
- * Read the author-supplied .claude-plugin/plugin.json from the plugin source dir,
480
- * if present. Returns undefined when the file doesn't exist; throws on invalid JSON.
481
- */
482
- function readAuthorPluginJson(pluginSourceDir) {
483
- const authorPluginJsonPath = safePath.join(pluginSourceDir, CLAUDE_PLUGIN_DIRNAME, 'plugin.json');
484
- if (!existsSync(authorPluginJsonPath)) {
485
- return undefined;
486
- }
487
- try {
488
- return JSON.parse(readFileSync(authorPluginJsonPath, 'utf-8'));
489
- }
490
- catch (e) {
491
- throw new Error(`Author .claude-plugin/plugin.json is not valid JSON: ${e.message}`);
635
+ // `*` is the selector's ONE wildcard (any run of characters, none included); every other character
636
+ // is itself. Matched by its literal pieces, in order — never compiled to a regular expression, where
637
+ // a `.` or a `(` in a skill name's selector would mean something else.
638
+ const pieces = selector.split('*');
639
+ const first = pieces[0] ?? '';
640
+ const last = pieces.at(-1) ?? '';
641
+ if (pieces.length === 1)
642
+ return skillName === selector;
643
+ if (skillName.length < first.length + last.length || !skillName.startsWith(first) || !skillName.endsWith(last))
644
+ return false;
645
+ const end = skillName.length - last.length;
646
+ let from = first.length;
647
+ for (const piece of pieces.slice(1, -1)) {
648
+ const at = skillName.indexOf(piece, from);
649
+ if (at === -1 || at + piece.length > end)
650
+ return false;
651
+ from = at + piece.length;
492
652
  }
653
+ return true;
493
654
  }
494
655
  async function writeMergedPluginJson(pluginDef, authorJson, pluginVersion, pluginDir, owner, logger) {
495
- const pluginJsonDir = safePath.join(pluginDir, CLAUDE_PLUGIN_DIRNAME);
496
- await mkdir(pluginJsonDir, { recursive: true });
497
656
  const { merged, author, warnings } = mergePluginJson({
498
657
  vat: {
499
658
  name: pluginDef.name,
@@ -505,10 +664,33 @@ async function writeMergedPluginJson(pluginDef, authorJson, pluginVersion, plugi
505
664
  });
506
665
  for (const w of warnings)
507
666
  logger.info(`warning: ${w}`);
508
- await writeFile(safePath.join(pluginJsonDir, 'plugin.json'), JSON.stringify(merged, null, 2));
667
+ const pluginJsonPath = safePath.join(pluginDir, CLAUDE_PLUGIN_DIRNAME, 'plugin.json');
668
+ await writingMarketplace(`write ${pluginJsonPath}`, () => writeFileUnder(pluginDir, `${CLAUDE_PLUGIN_DIRNAME}/plugin.json`, JSON.stringify(merged, null, 2), { existing: 'replace', writing: 'the merged plugin.json' }));
509
669
  logger.info(` .claude-plugin/plugin.json`);
510
670
  return author;
511
671
  }
672
+ /**
673
+ * The selected pool skills with the `skills/`-relative directory each lands in, in the order they are
674
+ * copied: by destination path, whatever order the selector or `readdir` named them in — every
675
+ * directory before anything under it, since a path sorts after each of its prefixes. A pool skill that
676
+ * holds a link is then always in place before a skill landing under it, so that layout is refused one
677
+ * way (the link, an input fault) and never as this run's own half-written output.
678
+ *
679
+ * Destinations are compared as a filesystem that folds names compares them (`Group/sub` is under
680
+ * `group` there); the skill's name breaks a tie, so two skills sent to one destination are also
681
+ * copied in one order on every host.
682
+ *
683
+ * Pure: it reads nothing.
684
+ */
685
+ function poolCopyOrder(selected, destOverrides) {
686
+ return selected
687
+ .map((skillName) => {
688
+ const fsPath = destOverrides.get(skillName) ?? skillNameToFsPath(skillName);
689
+ return { skillName, fsPath, placed: toForwardSlash(fsPath).split('/').map((segment) => foldedSegment(segment)).join('/') };
690
+ })
691
+ .toSorted((a, b) => compareCodeUnits(a.placed, b.placed) || compareCodeUnits(a.skillName, b.skillName))
692
+ .map(({ skillName, fsPath }) => ({ skillName, fsPath }));
693
+ }
512
694
  /**
513
695
  * Copy pool skills (from dist/skills/) selected by the plugin's skills: selector
514
696
  * into the plugin bundle's skills/ directory.
@@ -524,22 +706,25 @@ async function writeMergedPluginJson(pluginDef, authorJson, pluginVersion, plugi
524
706
  * `foo`) landed at `skills/foo`, and `vat skill test foo` then hard-failed looking for
525
707
  * a dist at `skills/group/foo` that the build never wrote.
526
708
  */
527
- async function copyPoolSkills(pluginDef, marketplaceAvailable, configDir, pluginDir, destOverrides, logger) {
528
- const selected = resolvePluginSkills(pluginDef, marketplaceAvailable);
709
+ async function copyPoolSkills(pluginDef, marketplaceAvailable, configDir, pluginDir, destOverrides, outputs, logger) {
710
+ const selected = poolCopyOrder(resolvePluginSkills(pluginDef, marketplaceAvailable), destOverrides);
529
711
  const copied = [];
530
- for (const skillName of selected) {
712
+ // In order: each copy writes into the plugin dir, `destOverrides` may collide, and the first failure wins.
713
+ await forEachInOrder(selected, async ({ skillName, fsPath }) => {
531
714
  const skillDistPath = safePath.join(configDir, 'dist', 'skills', skillName);
532
- if (!existsSync(skillDistPath)) {
533
- throw new Error(`Skill "${skillName}" not built at ${skillDistPath}. ` +
534
- `Run: vat skills build (or vat build to build everything)`);
535
- }
536
- const fsPath = destOverrides.get(skillName) ?? skillNameToFsPath(skillName);
715
+ requireInputPath(skillDistPath, configDir, {
716
+ origin: 'content',
717
+ message: `Skill "${skillName}" not built at dist/skills/${skillName}. Run: vat skills build (or vat build to build everything)`,
718
+ }, sideWithin(safePath.join(configDir, 'dist', 'skills'), distSkillsSide(skillDistPath, outputs), 'destination'));
537
719
  const destPath = safePath.join(pluginDir, 'skills', fsPath);
538
- await mkdir(destPath, { recursive: true });
539
- cpSync(skillDistPath, destPath, { recursive: true });
720
+ // A file in dist/skills the OS will not read is on dist/skills' side of the run (`distSkillsSide`):
721
+ // an input another build wrote (INPUT_UNREADABLE, fixed by rebuilding it), or this run's own output.
722
+ await copyTreeIntoMarketplace({ path: skillDistPath, side: distSkillsSide(skillDistPath, outputs) },
723
+ // From the plugin's own directory down: an earlier pool copy may have left a link on the way.
724
+ { root: pluginDir, relative: `skills/${toForwardSlash(fsPath)}` }, `dist/skills/${skillName}`, issueLocation(destPath, configDir));
540
725
  copied.push(fsPath);
541
726
  logger.info(` ${skillName} -> skills/${fsPath}`);
542
- }
727
+ });
543
728
  return copied;
544
729
  }
545
730
  /**
@@ -557,7 +742,7 @@ async function copyPoolSkills(pluginDef, marketplaceAvailable, configDir, plugin
557
742
  * gitignored/untracked skill dir must not be published by one producer when the
558
743
  * other would never have shipped it).
559
744
  */
560
- async function discoverPluginLocalSkills(pluginSourceDir, logger) {
745
+ function discoverPluginLocalSkills(pluginSourceDir, logger) {
561
746
  // Git visibility is the right filter, but a SILENT drop is not: a skill the author
562
747
  // just created and has not `git add`ed is simply absent from the built plugin, and
563
748
  // a build that says "success" while omitting it reads as one that shipped it.
@@ -567,15 +752,14 @@ async function discoverPluginLocalSkills(pluginSourceDir, logger) {
567
752
  `into this plugin (the plugin build ships tracked files only). Run \`git add\` on it, or ` +
568
753
  `add it to .gitignore to silence this.`);
569
754
  }
570
- const skills = [];
571
- for (const skillDirPath of listPluginSourceSkillDirs(pluginSourceDir)) {
755
+ // In order: a SKILL.md that will not read must be the first one named, deterministically.
756
+ return mapInOrder(listPluginSourceSkillDirs(pluginSourceDir), async (skillDirPath) => {
572
757
  const skillSourceDir = safePath.join(pluginSourceDir, 'skills', skillDirPath);
573
758
  // Resolved through the SAME reader `vat skills build` and `vat verify` use — per-skill
574
759
  // config is keyed by name, so two answers would mean two effective configs.
575
760
  const skillName = await readPluginLocalSkillName(skillSourceDir, skillDirPath);
576
- skills.push({ skillDirPath, skillPath: safePath.join(skillSourceDir, 'SKILL.md'), skillName });
577
- }
578
- return skills;
761
+ return { skillDirPath, skillPath: safePath.join(skillSourceDir, 'SKILL.md'), skillName };
762
+ });
579
763
  }
580
764
  /**
581
765
  * PACKAGE each plugin-local skill (a skill living in the plugin's own `skills/`
@@ -607,10 +791,13 @@ export async function packagePluginLocalSkills(input) {
607
791
  const packaged = [];
608
792
  // KNOWN GAP — NO PER-SKILL CONTAINMENT. `packageSkill` reports most problems by
609
793
  // RETURNING a result whose `hasErrors` is set, but it THROWS on structural packaging
610
- // failures (filename collisions, unreadable sources). This loop awaits it bare, so one
611
- // throw escapes the whole plugin build and discards every skill packaged before it —
612
- // while the partial `skills/<dir>/` trees already written stay on disk, described by
613
- // nothing.
794
+ // failures (filename collisions, unreadable sources). One throw escapes the whole
795
+ // plugin build and discards every skill packaged before it — while the partial
796
+ // `skills/<dir>/` trees already written stay on disk, described by nothing.
797
+ //
798
+ // What IS done: the packager's refusal of a skill's own content is CODED where it is
799
+ // caught below (`SkillPackagingStop`), so the stopped run names the skill and is not
800
+ // published as a defect in VAT. It still stops the run; containment is the gap.
614
801
  //
615
802
  // This is the SAME defect, in the same shape, that `packageSkills` had until commit
616
803
  // ba140fae ("fix(skills): one unbuildable skill no longer discards the whole build").
@@ -628,7 +815,8 @@ export async function packagePluginLocalSkills(input) {
628
815
  // collision no longer throws — it is a returned finding. The remaining throw paths
629
816
  // are an absent or unreadable `files:` source; do not use a collision as the fixture
630
817
  // when adding that guard, or the test will pass without the guard existing.
631
- for (const { skillDirPath, skillPath, skillName } of input.skills) {
818
+ // In order: every skill packages against the one shared registry, and the log follows `input.skills`.
819
+ await forEachInOrder(input.skills, async ({ skillDirPath, skillPath, skillName }) => {
632
820
  // Per-skill config goes through `pluginLocalSkillConfigEntry` — the one lookup
633
821
  // `vat verify` also uses to check what this packaged — so verify never checks
634
822
  // `files:` dests or severity overrides this build did not apply.
@@ -664,13 +852,16 @@ export async function packagePluginLocalSkills(input) {
664
852
  // bounded 17-entry reconciliation, not an unbounded one. UNVERIFIED how much of the
665
853
  // 17 - 14 delta is the false-positive class described above versus genuinely dead
666
854
  // entries; nobody has classified them entry by entry.
667
- const result = await packageSkill(skillPath, {
855
+ // In place: the plugin dir is inside the marketplace's staged tree, which its plan lands whole.
856
+ const { result } = await packageSkillInto(skillPath, skillOutputDir, {
668
857
  ...packagingConfigToPackageOptions(packagingConfig, { skillPath, outputPath: skillOutputDir }, input.projectSkills, input.suiteProbe),
669
858
  registry: input.registry,
859
+ }, input.outputs).catch((error) => {
860
+ throw isSkillPackagingInputError(error) ? new SkillPackagingStop(error, skillPath) : error;
670
861
  });
671
862
  input.logger.info(` ${skillName} -> skills/${skillDirPath} (${formatPackagedFileCount(result)})`);
672
863
  packaged.push({ skillDirPath, result });
673
- }
864
+ });
674
865
  return packaged;
675
866
  }
676
867
  /**
@@ -696,10 +887,10 @@ export async function packagePluginLocalSkills(input) {
696
887
  export function summarizePackagedSkillIssues(packaged, verbose) {
697
888
  const lines = [];
698
889
  const withErrors = [];
699
- const perSkillCounts = [];
890
+ const all = [];
700
891
  for (const { skillDirPath, result } of packaged) {
701
892
  const issues = collectPostBuildIssues(result);
702
- perSkillCounts.push(countBySeverity(issues));
893
+ all.push(...issues);
703
894
  if (issues.length > 0) {
704
895
  lines.push(` ${skillDirPath}: ${formatIssueSetHeading(issues, 'post-build')}`);
705
896
  for (const issue of issuesToRenderAtVerbosity(issues, verbose)) {
@@ -709,15 +900,15 @@ export function summarizePackagedSkillIssues(packaged, verbose) {
709
900
  if (result.hasErrors)
710
901
  withErrors.push(skillDirPath);
711
902
  }
712
- return { lines, withErrors, issueCounts: sumSeverityCounts(perSkillCounts) };
903
+ return { lines, withErrors, issues: all };
713
904
  }
714
905
  /** Print the summary to stderr and return what the caller gates on. */
715
906
  function reportPackagedSkillIssues(packaged, logger, verbose) {
716
- const { lines, withErrors, issueCounts } = summarizePackagedSkillIssues(packaged, verbose);
907
+ const { lines, withErrors, issues } = summarizePackagedSkillIssues(packaged, verbose);
717
908
  for (const line of lines) {
718
909
  logger.info(line);
719
910
  }
720
- return { withErrors, issueCounts };
911
+ return { withErrors, issues };
721
912
  }
722
913
  /**
723
914
  * Turn the tree-copy's dead `exclude:` patterns into located, coded findings.
@@ -740,7 +931,7 @@ function unusedExcludeIssues(unusedExcludePatterns, configDir, pluginSourceDir)
740
931
  }));
741
932
  }
742
933
  /**
743
- * Print the plugin-level findings to stderr and return their severity counts.
934
+ * Print the plugin-level findings to stderr.
744
935
  *
745
936
  * Rendered IN FULL at every verbosity — `issuesToRenderAtVerbosity(…, true)` —
746
937
  * rather than collapsing warnings into the heading. The verbosity collapse
@@ -760,7 +951,6 @@ function reportPluginIssues(issues, logger) {
760
951
  }
761
952
  }
762
953
  }
763
- return countBySeverity(issues);
764
954
  }
765
955
  /**
766
956
  * Split the plugin's own skills into those that COLLIDE with its resolved pool
@@ -808,19 +998,20 @@ function resolveCollidingSkills(skills, selectedSkillNames) {
808
998
  return { colliding, packageable, conflicts };
809
999
  }
810
1000
  async function buildPlugin(input) {
811
- const { marketplaceName, pluginDef, marketplaceAvailable, configDir, skillsConfig, owner, rootVersion, registry, projectSkills, suiteProbe, logger, verbose } = input;
812
- const pluginDir = getPluginOutputDir(configDir, marketplaceName, pluginDef.name);
1001
+ const { marketplaceDir, pluginDef, marketplaceAvailable, configDir, skillsConfig, owner, rootVersion, registry, projectSkills, suiteProbe, outputs, logger, verbose } = input;
1002
+ const pluginDir = pluginDirInMarketplace(marketplaceDir, pluginDef.name);
813
1003
  const pluginSourceDir = getPluginSourceDir(configDir, pluginDef);
814
1004
  logger.info(` Building plugin: ${pluginDef.name}`);
815
1005
  // Phase 1: validators.
816
1006
  await verifyPluginDirCaseMatch(configDir, pluginDef.name);
817
- const pluginSourceExists = existsSync(pluginSourceDir);
1007
+ // Confirmed: a wrong absent would silently build the plugin without its own directory.
1008
+ const pluginSourceExists = pathPresent(pluginSourceDir, { follow: configDir }, pluginSourceSideOf(configDir, pluginDef, pluginSourceDir), 'confirmed');
818
1009
  const hasExplicitFiles = (pluginDef.files?.length ?? 0) > 0;
819
1010
  const hasPoolSkills = pluginDef.skills === '*'
820
1011
  ? marketplaceAvailable.length > 0
821
1012
  : pluginDef.skills.length > 0;
822
1013
  if (!pluginSourceExists && !hasExplicitFiles && !hasPoolSkills) {
823
- throw new Error(`Plugin '${pluginDef.name}' has no content: no plugin dir found at ` +
1014
+ throw new CommandRefusalError('CONFIG_INVALID', `Plugin '${pluginDef.name}' has no content: no plugin dir found at ` +
824
1015
  `'${toForwardSlash(safePath.relative(configDir, pluginSourceDir))}', no files mapped, and no skills selected. ` +
825
1016
  `Add one of: (a) create the plugin directory, ` +
826
1017
  `(b) add files: [{ source, dest }, ...] in config, ` +
@@ -829,7 +1020,7 @@ async function buildPlugin(input) {
829
1020
  if (pluginSourceExists) {
830
1021
  await parsePluginJsonFiles(pluginSourceDir);
831
1022
  }
832
- await mkdir(pluginDir, { recursive: true });
1023
+ await writingMarketplace(`create ${pluginDir}`, () => mkdir(pluginDir, { recursive: true }));
833
1024
  // Phase 1.4: discover the plugin's own skills ONCE (recursive; git-visible only),
834
1025
  // resolving each declared name. Every phase below reads this list.
835
1026
  const localSkills = pluginSourceExists
@@ -844,7 +1035,7 @@ async function buildPlugin(input) {
844
1035
  const { colliding: collidingSkills, packageable, conflicts } = resolveCollidingSkills(localSkills, selectedSkillNames);
845
1036
  if (conflicts.length > 0) {
846
1037
  const pluginSourceRel = toForwardSlash(safePath.relative(configDir, pluginSourceDir));
847
- throw new Error(`Plugin '${pluginDef.name}': two DIFFERENT skills claim the same output directory.\n` +
1038
+ throw new CommandRefusalError('CONFIG_INVALID', `Plugin '${pluginDef.name}': two DIFFERENT skills claim the same output directory.\n` +
848
1039
  conflicts
849
1040
  .map(({ skill, poolSkillFsPath }) => ` - skills/${skill.skillDirPath} holds the plugin-local skill "${skill.skillName}", ` +
850
1041
  `but the plugin's skills: selector also copies a pool skill into skills/${poolSkillFsPath}.`)
@@ -876,12 +1067,19 @@ async function buildPlugin(input) {
876
1067
  registry,
877
1068
  projectSkills,
878
1069
  suiteProbe,
1070
+ outputs,
879
1071
  logger,
880
1072
  });
881
- const { withErrors: skillsWithErrors, issueCounts: localSkillCounts } = reportPackagedSkillIssues(packagedLocalSkills, logger, verbose);
1073
+ const { withErrors: skillsWithErrors, issues: localSkillIssues } = reportPackagedSkillIssues(packagedLocalSkills, logger, verbose);
882
1074
  if (skillsWithErrors.length > 0) {
883
- throw new Error(`Plugin '${pluginDef.name}': ${skillsWithErrors.length} plugin-local skill(s) emitted ` +
884
- `post-build validation errors: ${skillsWithErrors.join(', ')}`);
1075
+ return {
1076
+ kind: 'gated',
1077
+ failure: {
1078
+ reason: `Plugin '${pluginDef.name}': ${skillsWithErrors.length} plugin-local skill(s) emitted ` +
1079
+ `post-build validation errors: ${skillsWithErrors.join(', ')}`,
1080
+ issues: localSkillIssues,
1081
+ },
1082
+ };
885
1083
  }
886
1084
  const localSkillsPackaged = packagedLocalSkills.length;
887
1085
  // Phase 2b: tree copy of everything the other phases did NOT produce (commands,
@@ -934,12 +1132,13 @@ async function buildPlugin(input) {
934
1132
  logger.info(` ${link} (symlink, copied by content)`);
935
1133
  }
936
1134
  // Plugin-level findings: they belong to the plugin, not to any one skill, and
937
- // they are summed into the SAME `issueCounts` the skills' findings land in.
938
- // Anything else republishes the bug: a build that changed what ships while its
1135
+ // they join the SAME `issues` the skills' findings land in. Anything else
1136
+ // republishes the bug: a build that changed what ships while its
939
1137
  // machine-readable report said `warnings: 0`.
940
- const pluginIssueCounts = reportPluginIssues(unusedExcludeIssues(treeResult.unusedExcludePatterns, configDir, pluginSourceDir), logger);
1138
+ const pluginIssues = unusedExcludeIssues(treeResult.unusedExcludePatterns, configDir, pluginSourceDir);
1139
+ reportPluginIssues(pluginIssues, logger);
941
1140
  // Phase 3: pool-skill copy-in (from dist/skills/ via the plugin's skills: selector).
942
- const skillsCopied = await copyPoolSkills(pluginDef, marketplaceAvailable, configDir, pluginDir, poolDestOverrides, logger);
1141
+ const skillsCopied = await copyPoolSkills(pluginDef, marketplaceAvailable, configDir, pluginDir, poolDestOverrides, outputs, logger);
943
1142
  // Phase 4: files[] mapping (may overwrite tree-copied files).
944
1143
  let explicitFilesCopied = 0;
945
1144
  if (pluginDef.files && pluginDef.files.length > 0) {
@@ -961,26 +1160,44 @@ async function buildPlugin(input) {
961
1160
  // by default, or `entry.changelog` (relative to plugin source) when configured.
962
1161
  // No-op when neither resolves — marketplace-level CHANGELOG (handled in
963
1162
  // copyDistributionFiles) is unaffected.
964
- const changelogPath = resolvePluginChangelogPath(pluginSourceDir, pluginDef);
1163
+ const changelogPath = resolvePluginChangelogPath(pluginSourceDir, pluginDef, configDir);
965
1164
  if (changelogPath) {
966
- cpSync(changelogPath, safePath.join(pluginDir, 'CHANGELOG.md'));
1165
+ const target = { root: pluginDir, relative: 'CHANGELOG.md' };
1166
+ await copyFileIntoMarketplace(changelogPath, target, issueLocation(changelogPath, configDir), issueLocation(safePath.join(target.root, target.relative), configDir));
967
1167
  logger.info(` CHANGELOG.md`);
968
1168
  }
969
- return {
970
- pluginName: pluginDef.name,
971
- pluginDir,
972
- pluginVersion,
973
- pluginAuthor,
974
- skillsCopied,
975
- commandsCopied: treeResult.commandsCopied,
976
- hooksCopied: treeResult.hooksCopied,
977
- agentsCopied: treeResult.agentsCopied,
978
- mcpCopied: treeResult.mcpCopied,
979
- treeFilesCopied: treeResult.filesCopied,
980
- symlinksCopied: treeResult.symlinksCopied,
981
- explicitFilesCopied,
982
- localSkillsPackaged,
983
- issueCounts: sumSeverityCounts([localSkillCounts, pluginIssueCounts]),
984
- };
1169
+ return { kind: 'built', result: {
1170
+ pluginName: pluginDef.name,
1171
+ pluginDir,
1172
+ pluginVersion,
1173
+ pluginAuthor,
1174
+ skillsCopied,
1175
+ commandsCopied: treeResult.commandsCopied,
1176
+ hooksCopied: treeResult.hooksCopied,
1177
+ agentsCopied: treeResult.agentsCopied,
1178
+ mcpCopied: treeResult.mcpCopied,
1179
+ treeFilesCopied: treeResult.filesCopied,
1180
+ symlinksCopied: treeResult.symlinksCopied,
1181
+ explicitFilesCopied,
1182
+ localSkillsPackaged,
1183
+ issues: [...localSkillIssues, ...pluginIssues],
1184
+ } };
985
1185
  }
1186
+ /** Test-facing seam: the pure decisions of this module, reached by its unit tests. */
1187
+ export const __internal = {
1188
+ builtWork,
1189
+ landedMarketplace,
1190
+ marketplaceIssues,
1191
+ matchesSelector,
1192
+ pluginBuildData,
1193
+ poolCopyOrder,
1194
+ reportPackagedSkillIssues,
1195
+ reportPluginIssues,
1196
+ resolveCollidingSkills,
1197
+ resolveMarketplaceAvailableSkills,
1198
+ resolvePluginSkills,
1199
+ SkillPackagingStop,
1200
+ unusedExcludeIssues,
1201
+ withPackagingStop,
1202
+ };
986
1203
  //# sourceMappingURL=build.js.map