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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (504) hide show
  1. package/README.md +4 -5
  2. package/dist/bin/vat +97 -28
  3. package/dist/bin/vat.js +97 -28
  4. package/dist/bin/vat.js.map +1 -1
  5. package/dist/bin.js +115 -76
  6. package/dist/bin.js.map +1 -1
  7. package/dist/command-loaders.d.ts +44 -0
  8. package/dist/command-loaders.d.ts.map +1 -0
  9. package/dist/command-loaders.js +60 -0
  10. package/dist/command-loaders.js.map +1 -0
  11. package/dist/commands/agent/build.d.ts.map +1 -1
  12. package/dist/commands/agent/build.js +2 -1
  13. package/dist/commands/agent/build.js.map +1 -1
  14. package/dist/commands/agent/import.d.ts.map +1 -1
  15. package/dist/commands/agent/import.js +3 -2
  16. package/dist/commands/agent/import.js.map +1 -1
  17. package/dist/commands/agent/index.js +1 -1
  18. package/dist/commands/agent/install-path.d.ts +36 -0
  19. package/dist/commands/agent/install-path.d.ts.map +1 -0
  20. package/dist/commands/agent/install-path.js +44 -0
  21. package/dist/commands/agent/install-path.js.map +1 -0
  22. package/dist/commands/agent/install.d.ts.map +1 -1
  23. package/dist/commands/agent/install.js +66 -13
  24. package/dist/commands/agent/install.js.map +1 -1
  25. package/dist/commands/agent/installed.d.ts.map +1 -1
  26. package/dist/commands/agent/installed.js +22 -12
  27. package/dist/commands/agent/installed.js.map +1 -1
  28. package/dist/commands/agent/list.d.ts.map +1 -1
  29. package/dist/commands/agent/list.js +2 -1
  30. package/dist/commands/agent/list.js.map +1 -1
  31. package/dist/commands/agent/run.d.ts.map +1 -1
  32. package/dist/commands/agent/run.js +2 -1
  33. package/dist/commands/agent/run.js.map +1 -1
  34. package/dist/commands/agent/uninstall.d.ts.map +1 -1
  35. package/dist/commands/agent/uninstall.js +13 -6
  36. package/dist/commands/agent/uninstall.js.map +1 -1
  37. package/dist/commands/agent/validate.d.ts.map +1 -1
  38. package/dist/commands/agent/validate.js +3 -2
  39. package/dist/commands/agent/validate.js.map +1 -1
  40. package/dist/commands/ard/emit.d.ts +165 -0
  41. package/dist/commands/ard/emit.d.ts.map +1 -0
  42. package/dist/commands/ard/emit.js +338 -0
  43. package/dist/commands/ard/emit.js.map +1 -0
  44. package/dist/commands/ard/index.d.ts +12 -0
  45. package/dist/commands/ard/index.d.ts.map +1 -0
  46. package/dist/commands/ard/index.js +84 -0
  47. package/dist/commands/ard/index.js.map +1 -0
  48. package/dist/commands/ard/surfaces.d.ts +56 -0
  49. package/dist/commands/ard/surfaces.d.ts.map +1 -0
  50. package/dist/commands/ard/surfaces.js +150 -0
  51. package/dist/commands/ard/surfaces.js.map +1 -0
  52. package/dist/commands/audit/distributed-tree.d.ts +2 -2
  53. package/dist/commands/audit/distributed-tree.d.ts.map +1 -1
  54. package/dist/commands/audit/distributed-tree.js +11 -7
  55. package/dist/commands/audit/distributed-tree.js.map +1 -1
  56. package/dist/commands/audit/git-url-clone.d.ts +1 -1
  57. package/dist/commands/audit/git-url-clone.d.ts.map +1 -1
  58. package/dist/commands/audit/git-url-clone.js.map +1 -1
  59. package/dist/commands/audit/hierarchical-output.d.ts +1 -1
  60. package/dist/commands/audit/hierarchical-output.d.ts.map +1 -1
  61. package/dist/commands/audit/hierarchical-output.js +1 -1
  62. package/dist/commands/audit/hierarchical-output.js.map +1 -1
  63. package/dist/commands/audit/provenance.d.ts.map +1 -1
  64. package/dist/commands/audit/provenance.js +4 -3
  65. package/dist/commands/audit/provenance.js.map +1 -1
  66. package/dist/commands/audit/scan-population.d.ts +158 -0
  67. package/dist/commands/audit/scan-population.d.ts.map +1 -0
  68. package/dist/commands/audit/scan-population.js +292 -0
  69. package/dist/commands/audit/scan-population.js.map +1 -0
  70. package/dist/commands/audit-settings.d.ts.map +1 -1
  71. package/dist/commands/audit-settings.js +6 -5
  72. package/dist/commands/audit-settings.js.map +1 -1
  73. package/dist/commands/audit.d.ts +98 -8
  74. package/dist/commands/audit.d.ts.map +1 -1
  75. package/dist/commands/audit.js +1150 -394
  76. package/dist/commands/audit.js.map +1 -1
  77. package/dist/commands/build.d.ts +1 -1
  78. package/dist/commands/build.d.ts.map +1 -1
  79. package/dist/commands/build.js +40 -36
  80. package/dist/commands/build.js.map +1 -1
  81. package/dist/commands/cache/cache-control.d.ts +82 -0
  82. package/dist/commands/cache/cache-control.d.ts.map +1 -0
  83. package/dist/commands/cache/cache-control.js +86 -0
  84. package/dist/commands/cache/cache-control.js.map +1 -0
  85. package/dist/commands/cache/clear.d.ts +34 -6
  86. package/dist/commands/cache/clear.d.ts.map +1 -1
  87. package/dist/commands/cache/clear.js +101 -15
  88. package/dist/commands/cache/clear.js.map +1 -1
  89. package/dist/commands/cache/index.d.ts +13 -63
  90. package/dist/commands/cache/index.d.ts.map +1 -1
  91. package/dist/commands/cache/index.js +47 -79
  92. package/dist/commands/cache/index.js.map +1 -1
  93. package/dist/commands/claude/claude-config.d.ts.map +1 -1
  94. package/dist/commands/claude/claude-config.js +6 -0
  95. package/dist/commands/claude/claude-config.js.map +1 -1
  96. package/dist/commands/claude/context.d.ts +372 -0
  97. package/dist/commands/claude/context.d.ts.map +1 -0
  98. package/dist/commands/claude/context.js +1115 -0
  99. package/dist/commands/claude/context.js.map +1 -0
  100. package/dist/commands/claude/index.d.ts +14 -0
  101. package/dist/commands/claude/index.d.ts.map +1 -1
  102. package/dist/commands/claude/index.js +22 -2
  103. package/dist/commands/claude/index.js.map +1 -1
  104. package/dist/commands/claude/marketplace/changelog-utils.d.ts +1 -1
  105. package/dist/commands/claude/marketplace/changelog-utils.d.ts.map +1 -1
  106. package/dist/commands/claude/marketplace/changelog-utils.js +1 -2
  107. package/dist/commands/claude/marketplace/changelog-utils.js.map +1 -1
  108. package/dist/commands/claude/marketplace/git-publish.d.ts.map +1 -1
  109. package/dist/commands/claude/marketplace/git-publish.js +40 -31
  110. package/dist/commands/claude/marketplace/git-publish.js.map +1 -1
  111. package/dist/commands/claude/marketplace/license-utils.d.ts.map +1 -1
  112. package/dist/commands/claude/marketplace/license-utils.js +0 -1
  113. package/dist/commands/claude/marketplace/license-utils.js.map +1 -1
  114. package/dist/commands/claude/marketplace/publish-tree.d.ts.map +1 -1
  115. package/dist/commands/claude/marketplace/publish-tree.js +0 -6
  116. package/dist/commands/claude/marketplace/publish-tree.js.map +1 -1
  117. package/dist/commands/claude/marketplace/publish.d.ts.map +1 -1
  118. package/dist/commands/claude/marketplace/publish.js +2 -1
  119. package/dist/commands/claude/marketplace/publish.js.map +1 -1
  120. package/dist/commands/claude/marketplace/validate.d.ts +73 -22
  121. package/dist/commands/claude/marketplace/validate.d.ts.map +1 -1
  122. package/dist/commands/claude/marketplace/validate.js +407 -72
  123. package/dist/commands/claude/marketplace/validate.js.map +1 -1
  124. package/dist/commands/claude/org/api-keys.d.ts +0 -3
  125. package/dist/commands/claude/org/api-keys.d.ts.map +1 -1
  126. package/dist/commands/claude/org/api-keys.js +2 -1
  127. package/dist/commands/claude/org/api-keys.js.map +1 -1
  128. package/dist/commands/claude/org/helpers.d.ts +54 -1
  129. package/dist/commands/claude/org/helpers.d.ts.map +1 -1
  130. package/dist/commands/claude/org/helpers.js +42 -7
  131. package/dist/commands/claude/org/helpers.js.map +1 -1
  132. package/dist/commands/claude/org/index.d.ts.map +1 -1
  133. package/dist/commands/claude/org/index.js +24 -16
  134. package/dist/commands/claude/org/index.js.map +1 -1
  135. package/dist/commands/claude/org/invites.d.ts +0 -3
  136. package/dist/commands/claude/org/invites.d.ts.map +1 -1
  137. package/dist/commands/claude/org/invites.js +3 -2
  138. package/dist/commands/claude/org/invites.js.map +1 -1
  139. package/dist/commands/claude/org/skills.d.ts +527 -0
  140. package/dist/commands/claude/org/skills.d.ts.map +1 -1
  141. package/dist/commands/claude/org/skills.js +1414 -108
  142. package/dist/commands/claude/org/skills.js.map +1 -1
  143. package/dist/commands/claude/org/users.d.ts +0 -3
  144. package/dist/commands/claude/org/users.d.ts.map +1 -1
  145. package/dist/commands/claude/org/users.js +6 -3
  146. package/dist/commands/claude/org/users.js.map +1 -1
  147. package/dist/commands/claude/org/workspaces.d.ts +0 -3
  148. package/dist/commands/claude/org/workspaces.d.ts.map +1 -1
  149. package/dist/commands/claude/org/workspaces.js +11 -7
  150. package/dist/commands/claude/org/workspaces.js.map +1 -1
  151. package/dist/commands/claude/plugin/build.d.ts +41 -3
  152. package/dist/commands/claude/plugin/build.d.ts.map +1 -1
  153. package/dist/commands/claude/plugin/build.js +147 -80
  154. package/dist/commands/claude/plugin/build.js.map +1 -1
  155. package/dist/commands/claude/plugin/helpers.d.ts.map +1 -1
  156. package/dist/commands/claude/plugin/helpers.js +2 -7
  157. package/dist/commands/claude/plugin/helpers.js.map +1 -1
  158. package/dist/commands/claude/plugin/install.d.ts +12 -0
  159. package/dist/commands/claude/plugin/install.d.ts.map +1 -1
  160. package/dist/commands/claude/plugin/install.js +93 -62
  161. package/dist/commands/claude/plugin/install.js.map +1 -1
  162. package/dist/commands/claude/plugin/list.d.ts.map +1 -1
  163. package/dist/commands/claude/plugin/list.js +3 -2
  164. package/dist/commands/claude/plugin/list.js.map +1 -1
  165. package/dist/commands/claude/plugin/marketplace-json.d.ts +24 -9
  166. package/dist/commands/claude/plugin/marketplace-json.d.ts.map +1 -1
  167. package/dist/commands/claude/plugin/marketplace-json.js +10 -9
  168. package/dist/commands/claude/plugin/marketplace-json.js.map +1 -1
  169. package/dist/commands/claude/plugin/plugin-changelog.d.ts.map +1 -1
  170. package/dist/commands/claude/plugin/plugin-changelog.js +0 -2
  171. package/dist/commands/claude/plugin/plugin-changelog.js.map +1 -1
  172. package/dist/commands/claude/plugin/plugin-files.d.ts.map +1 -1
  173. package/dist/commands/claude/plugin/plugin-files.js +3 -6
  174. package/dist/commands/claude/plugin/plugin-files.js.map +1 -1
  175. package/dist/commands/claude/plugin/plugin-validators.d.ts.map +1 -1
  176. package/dist/commands/claude/plugin/plugin-validators.js +3 -6
  177. package/dist/commands/claude/plugin/plugin-validators.js.map +1 -1
  178. package/dist/commands/claude/plugin/tree-copy.d.ts +73 -0
  179. package/dist/commands/claude/plugin/tree-copy.d.ts.map +1 -1
  180. package/dist/commands/claude/plugin/tree-copy.js +221 -14
  181. package/dist/commands/claude/plugin/tree-copy.js.map +1 -1
  182. package/dist/commands/claude/plugin/uninstall.d.ts.map +1 -1
  183. package/dist/commands/claude/plugin/uninstall.js +4 -4
  184. package/dist/commands/claude/plugin/uninstall.js.map +1 -1
  185. package/dist/commands/consistency-check.d.ts +17 -15
  186. package/dist/commands/consistency-check.d.ts.map +1 -1
  187. package/dist/commands/consistency-check.js +152 -106
  188. package/dist/commands/consistency-check.js.map +1 -1
  189. package/dist/commands/corpus/index.d.ts.map +1 -1
  190. package/dist/commands/corpus/index.js +3 -0
  191. package/dist/commands/corpus/index.js.map +1 -1
  192. package/dist/commands/corpus/report.d.ts +1 -2
  193. package/dist/commands/corpus/report.d.ts.map +1 -1
  194. package/dist/commands/corpus/report.js +1 -3
  195. package/dist/commands/corpus/report.js.map +1 -1
  196. package/dist/commands/corpus/runner.d.ts +58 -1
  197. package/dist/commands/corpus/runner.d.ts.map +1 -1
  198. package/dist/commands/corpus/runner.js +95 -41
  199. package/dist/commands/corpus/runner.js.map +1 -1
  200. package/dist/commands/corpus/scan.d.ts.map +1 -1
  201. package/dist/commands/corpus/scan.js +20 -12
  202. package/dist/commands/corpus/scan.js.map +1 -1
  203. package/dist/commands/corpus/seed.d.ts +4 -4
  204. package/dist/commands/corpus/seed.d.ts.map +1 -1
  205. package/dist/commands/corpus/seed.js +1 -3
  206. package/dist/commands/corpus/seed.js.map +1 -1
  207. package/dist/commands/doctor.d.ts +50 -0
  208. package/dist/commands/doctor.d.ts.map +1 -1
  209. package/dist/commands/doctor.js +245 -52
  210. package/dist/commands/doctor.js.map +1 -1
  211. package/dist/commands/inventory.d.ts +13 -1
  212. package/dist/commands/inventory.d.ts.map +1 -1
  213. package/dist/commands/inventory.js +121 -17
  214. package/dist/commands/inventory.js.map +1 -1
  215. package/dist/commands/mcp/collections.d.ts +1 -1
  216. package/dist/commands/mcp/collections.d.ts.map +1 -1
  217. package/dist/commands/mcp/list-collections.d.ts.map +1 -1
  218. package/dist/commands/mcp/list-collections.js +2 -1
  219. package/dist/commands/mcp/list-collections.js.map +1 -1
  220. package/dist/commands/mcp/serve.d.ts.map +1 -1
  221. package/dist/commands/mcp/serve.js +3 -2
  222. package/dist/commands/mcp/serve.js.map +1 -1
  223. package/dist/commands/okf/index.d.ts +11 -0
  224. package/dist/commands/okf/index.d.ts.map +1 -0
  225. package/dist/commands/okf/index.js +116 -0
  226. package/dist/commands/okf/index.js.map +1 -0
  227. package/dist/commands/okf/validate.d.ts +195 -0
  228. package/dist/commands/okf/validate.d.ts.map +1 -0
  229. package/dist/commands/okf/validate.js +199 -0
  230. package/dist/commands/okf/validate.js.map +1 -0
  231. package/dist/commands/phase-utils.d.ts +182 -114
  232. package/dist/commands/phase-utils.d.ts.map +1 -1
  233. package/dist/commands/phase-utils.js +154 -163
  234. package/dist/commands/phase-utils.js.map +1 -1
  235. package/dist/commands/positional-args.d.ts.map +1 -1
  236. package/dist/commands/positional-args.js +3 -2
  237. package/dist/commands/positional-args.js.map +1 -1
  238. package/dist/commands/rag/clear-command.d.ts.map +1 -1
  239. package/dist/commands/rag/clear-command.js +2 -1
  240. package/dist/commands/rag/clear-command.js.map +1 -1
  241. package/dist/commands/rag/index-command.d.ts +64 -0
  242. package/dist/commands/rag/index-command.d.ts.map +1 -1
  243. package/dist/commands/rag/index-command.js +72 -6
  244. package/dist/commands/rag/index-command.js.map +1 -1
  245. package/dist/commands/rag/index.d.ts.map +1 -1
  246. package/dist/commands/rag/index.js +23 -10
  247. package/dist/commands/rag/index.js.map +1 -1
  248. package/dist/commands/rag/query-command.d.ts.map +1 -1
  249. package/dist/commands/rag/query-command.js +2 -1
  250. package/dist/commands/rag/query-command.js.map +1 -1
  251. package/dist/commands/rag/stats-command.d.ts.map +1 -1
  252. package/dist/commands/rag/stats-command.js +2 -1
  253. package/dist/commands/rag/stats-command.js.map +1 -1
  254. package/dist/commands/resources/builtin-help.d.ts +27 -0
  255. package/dist/commands/resources/builtin-help.d.ts.map +1 -0
  256. package/dist/commands/resources/builtin-help.js +46 -0
  257. package/dist/commands/resources/builtin-help.js.map +1 -0
  258. package/dist/commands/resources/check-progress.d.ts +167 -0
  259. package/dist/commands/resources/check-progress.d.ts.map +1 -0
  260. package/dist/commands/resources/check-progress.js +250 -0
  261. package/dist/commands/resources/check-progress.js.map +1 -0
  262. package/dist/commands/resources/check-supervisor.d.ts +479 -0
  263. package/dist/commands/resources/check-supervisor.d.ts.map +1 -0
  264. package/dist/commands/resources/check-supervisor.js +587 -0
  265. package/dist/commands/resources/check-supervisor.js.map +1 -0
  266. package/dist/commands/resources/check.d.ts +620 -0
  267. package/dist/commands/resources/check.d.ts.map +1 -0
  268. package/dist/commands/resources/check.js +1452 -0
  269. package/dist/commands/resources/check.js.map +1 -0
  270. package/dist/commands/resources/index.d.ts.map +1 -1
  271. package/dist/commands/resources/index.js +430 -4
  272. package/dist/commands/resources/index.js.map +1 -1
  273. package/dist/commands/resources/query.d.ts +106 -0
  274. package/dist/commands/resources/query.d.ts.map +1 -0
  275. package/dist/commands/resources/query.js +177 -0
  276. package/dist/commands/resources/query.js.map +1 -0
  277. package/dist/commands/resources/scan.d.ts +24 -0
  278. package/dist/commands/resources/scan.d.ts.map +1 -1
  279. package/dist/commands/resources/scan.js +17 -8
  280. package/dist/commands/resources/scan.js.map +1 -1
  281. package/dist/commands/resources/validate.d.ts +42 -2
  282. package/dist/commands/resources/validate.d.ts.map +1 -1
  283. package/dist/commands/resources/validate.js +208 -55
  284. package/dist/commands/resources/validate.js.map +1 -1
  285. package/dist/commands/skill/review-checklist.d.ts +3 -2
  286. package/dist/commands/skill/review-checklist.d.ts.map +1 -1
  287. package/dist/commands/skill/review-checklist.js +40 -2
  288. package/dist/commands/skill/review-checklist.js.map +1 -1
  289. package/dist/commands/skill/review.d.ts +247 -0
  290. package/dist/commands/skill/review.d.ts.map +1 -1
  291. package/dist/commands/skill/review.js +100 -62
  292. package/dist/commands/skill/review.js.map +1 -1
  293. package/dist/commands/skill/test/configure.d.ts +56 -0
  294. package/dist/commands/skill/test/configure.d.ts.map +1 -1
  295. package/dist/commands/skill/test/configure.js +75 -16
  296. package/dist/commands/skill/test/configure.js.map +1 -1
  297. package/dist/commands/skill/test/run.d.ts +63 -10
  298. package/dist/commands/skill/test/run.d.ts.map +1 -1
  299. package/dist/commands/skill/test/run.js +258 -77
  300. package/dist/commands/skill/test/run.js.map +1 -1
  301. package/dist/commands/skills/build.d.ts +94 -4
  302. package/dist/commands/skills/build.d.ts.map +1 -1
  303. package/dist/commands/skills/build.js +325 -97
  304. package/dist/commands/skills/build.js.map +1 -1
  305. package/dist/commands/skills/install.d.ts +2 -1
  306. package/dist/commands/skills/install.d.ts.map +1 -1
  307. package/dist/commands/skills/install.js +20 -31
  308. package/dist/commands/skills/install.js.map +1 -1
  309. package/dist/commands/skills/list.d.ts +2 -1
  310. package/dist/commands/skills/list.d.ts.map +1 -1
  311. package/dist/commands/skills/list.js +44 -26
  312. package/dist/commands/skills/list.js.map +1 -1
  313. package/dist/commands/skills/package.d.ts +1 -1
  314. package/dist/commands/skills/package.d.ts.map +1 -1
  315. package/dist/commands/skills/package.js +6 -8
  316. package/dist/commands/skills/package.js.map +1 -1
  317. package/dist/commands/skills/scope-guard.d.ts.map +1 -1
  318. package/dist/commands/skills/scope-guard.js +8 -6
  319. package/dist/commands/skills/scope-guard.js.map +1 -1
  320. package/dist/commands/skills/shared.d.ts.map +1 -1
  321. package/dist/commands/skills/shared.js +2 -4
  322. package/dist/commands/skills/shared.js.map +1 -1
  323. package/dist/commands/skills/skill-discovery.d.ts +47 -6
  324. package/dist/commands/skills/skill-discovery.d.ts.map +1 -1
  325. package/dist/commands/skills/skill-discovery.js +61 -11
  326. package/dist/commands/skills/skill-discovery.js.map +1 -1
  327. package/dist/commands/skills/source-resolvers.d.ts +15 -0
  328. package/dist/commands/skills/source-resolvers.d.ts.map +1 -1
  329. package/dist/commands/skills/source-resolvers.js +25 -4
  330. package/dist/commands/skills/source-resolvers.js.map +1 -1
  331. package/dist/commands/skills/validate-command.d.ts.map +1 -1
  332. package/dist/commands/skills/validate-command.js +11 -3
  333. package/dist/commands/skills/validate-command.js.map +1 -1
  334. package/dist/commands/skills/validate.d.ts +140 -4
  335. package/dist/commands/skills/validate.d.ts.map +1 -1
  336. package/dist/commands/skills/validate.js +224 -67
  337. package/dist/commands/skills/validate.js.map +1 -1
  338. package/dist/commands/validate.d.ts +1 -1
  339. package/dist/commands/validate.d.ts.map +1 -1
  340. package/dist/commands/validate.js +63 -27
  341. package/dist/commands/validate.js.map +1 -1
  342. package/dist/commands/verify.d.ts +119 -15
  343. package/dist/commands/verify.d.ts.map +1 -1
  344. package/dist/commands/verify.js +357 -142
  345. package/dist/commands/verify.js.map +1 -1
  346. package/dist/index.d.ts +0 -1
  347. package/dist/index.d.ts.map +1 -1
  348. package/dist/index.js +5 -1
  349. package/dist/index.js.map +1 -1
  350. package/dist/report-schemas.d.ts +45 -0
  351. package/dist/report-schemas.d.ts.map +1 -0
  352. package/dist/report-schemas.js +100 -0
  353. package/dist/report-schemas.js.map +1 -0
  354. package/dist/skill-resolution/classify.js +2 -2
  355. package/dist/skill-resolution/classify.js.map +1 -1
  356. package/dist/skill-resolution/packaging-config.d.ts +49 -5
  357. package/dist/skill-resolution/packaging-config.d.ts.map +1 -1
  358. package/dist/skill-resolution/packaging-config.js +59 -19
  359. package/dist/skill-resolution/packaging-config.js.map +1 -1
  360. package/dist/skill-resolution/resolve-skill-reference.d.ts.map +1 -1
  361. package/dist/skill-resolution/resolve-skill-reference.js +55 -57
  362. package/dist/skill-resolution/resolve-skill-reference.js.map +1 -1
  363. package/dist/utils/agent-discovery.d.ts.map +1 -1
  364. package/dist/utils/agent-discovery.js +22 -11
  365. package/dist/utils/agent-discovery.js.map +1 -1
  366. package/dist/utils/agent-runner.d.ts.map +1 -1
  367. package/dist/utils/agent-runner.js +7 -4
  368. package/dist/utils/agent-runner.js.map +1 -1
  369. package/dist/utils/claude-context-lens.d.ts +34 -0
  370. package/dist/utils/claude-context-lens.d.ts.map +1 -0
  371. package/dist/utils/claude-context-lens.js +39 -0
  372. package/dist/utils/claude-context-lens.js.map +1 -0
  373. package/dist/utils/command-error.d.ts +143 -20
  374. package/dist/utils/command-error.d.ts.map +1 -1
  375. package/dist/utils/command-error.js +179 -36
  376. package/dist/utils/command-error.js.map +1 -1
  377. package/dist/utils/config-loader.d.ts +2 -1
  378. package/dist/utils/config-loader.d.ts.map +1 -1
  379. package/dist/utils/config-loader.js +40 -14
  380. package/dist/utils/config-loader.js.map +1 -1
  381. package/dist/utils/corpus-target.d.ts +26 -0
  382. package/dist/utils/corpus-target.d.ts.map +1 -0
  383. package/dist/utils/corpus-target.js +72 -0
  384. package/dist/utils/corpus-target.js.map +1 -0
  385. package/dist/utils/edge-lens-evaluation.d.ts +83 -0
  386. package/dist/utils/edge-lens-evaluation.d.ts.map +1 -0
  387. package/dist/utils/edge-lens-evaluation.js +110 -0
  388. package/dist/utils/edge-lens-evaluation.js.map +1 -0
  389. package/dist/utils/help-loader.d.ts.map +1 -1
  390. package/dist/utils/help-loader.js +0 -1
  391. package/dist/utils/help-loader.js.map +1 -1
  392. package/dist/utils/issue-anchor.d.ts +2 -2
  393. package/dist/utils/issue-anchor.d.ts.map +1 -1
  394. package/dist/utils/issue-anchor.js +1 -1
  395. package/dist/utils/issue-rendering.d.ts +3 -3
  396. package/dist/utils/issue-rendering.d.ts.map +1 -1
  397. package/dist/utils/issue-rendering.js +3 -3
  398. package/dist/utils/issue-rendering.js.map +1 -1
  399. package/dist/utils/issue-severity.d.ts +12 -5
  400. package/dist/utils/issue-severity.d.ts.map +1 -1
  401. package/dist/utils/issue-severity.js +1 -1
  402. package/dist/utils/issue-severity.js.map +1 -1
  403. package/dist/utils/optional-backend.d.ts +78 -0
  404. package/dist/utils/optional-backend.d.ts.map +1 -0
  405. package/dist/utils/optional-backend.js +117 -0
  406. package/dist/utils/optional-backend.js.map +1 -0
  407. package/dist/utils/output.d.ts +26 -0
  408. package/dist/utils/output.d.ts.map +1 -1
  409. package/dist/utils/output.js +35 -0
  410. package/dist/utils/output.js.map +1 -1
  411. package/dist/utils/package-json.d.ts +24 -0
  412. package/dist/utils/package-json.d.ts.map +1 -0
  413. package/dist/utils/package-json.js +49 -0
  414. package/dist/utils/package-json.js.map +1 -0
  415. package/dist/utils/population-wiring.d.ts +100 -0
  416. package/dist/utils/population-wiring.d.ts.map +1 -0
  417. package/dist/utils/population-wiring.js +98 -0
  418. package/dist/utils/population-wiring.js.map +1 -0
  419. package/dist/utils/project-root-policy.d.ts +20 -0
  420. package/dist/utils/project-root-policy.d.ts.map +1 -1
  421. package/dist/utils/project-root-policy.js +30 -0
  422. package/dist/utils/project-root-policy.js.map +1 -1
  423. package/dist/utils/projection-lenses.d.ts +98 -0
  424. package/dist/utils/projection-lenses.d.ts.map +1 -0
  425. package/dist/utils/projection-lenses.js +203 -0
  426. package/dist/utils/projection-lenses.js.map +1 -0
  427. package/dist/utils/projection-query.d.ts +324 -0
  428. package/dist/utils/projection-query.d.ts.map +1 -0
  429. package/dist/utils/projection-query.js +357 -0
  430. package/dist/utils/projection-query.js.map +1 -0
  431. package/dist/utils/projection-store.d.ts +335 -0
  432. package/dist/utils/projection-store.d.ts.map +1 -0
  433. package/dist/utils/projection-store.js +522 -0
  434. package/dist/utils/projection-store.js.map +1 -0
  435. package/dist/utils/relation-limits.d.ts +50 -0
  436. package/dist/utils/relation-limits.d.ts.map +1 -0
  437. package/dist/utils/relation-limits.js +50 -0
  438. package/dist/utils/relation-limits.js.map +1 -0
  439. package/dist/utils/repeatable-option.d.ts +37 -0
  440. package/dist/utils/repeatable-option.d.ts.map +1 -0
  441. package/dist/utils/repeatable-option.js +39 -0
  442. package/dist/utils/repeatable-option.js.map +1 -0
  443. package/dist/utils/resource-loader.d.ts +134 -2
  444. package/dist/utils/resource-loader.d.ts.map +1 -1
  445. package/dist/utils/resource-loader.js +290 -27
  446. package/dist/utils/resource-loader.js.map +1 -1
  447. package/dist/utils/root-argv.d.ts +53 -0
  448. package/dist/utils/root-argv.d.ts.map +1 -0
  449. package/dist/utils/root-argv.js +215 -0
  450. package/dist/utils/root-argv.js.map +1 -0
  451. package/dist/utils/run-integrity.d.ts +95 -0
  452. package/dist/utils/run-integrity.d.ts.map +1 -0
  453. package/dist/utils/run-integrity.js +102 -0
  454. package/dist/utils/run-integrity.js.map +1 -0
  455. package/dist/utils/skill-discovery.d.ts.map +1 -1
  456. package/dist/utils/skill-discovery.js +2 -1
  457. package/dist/utils/skill-discovery.js.map +1 -1
  458. package/dist/utils/skill-packaging-config.d.ts +63 -1
  459. package/dist/utils/skill-packaging-config.d.ts.map +1 -1
  460. package/dist/utils/skill-packaging-config.js +56 -1
  461. package/dist/utils/skill-packaging-config.js.map +1 -1
  462. package/dist/utils/sqlite-experimental-warning.d.ts +69 -0
  463. package/dist/utils/sqlite-experimental-warning.d.ts.map +1 -0
  464. package/dist/utils/sqlite-experimental-warning.js +144 -0
  465. package/dist/utils/sqlite-experimental-warning.js.map +1 -0
  466. package/dist/utils/url-redact.d.ts.map +1 -1
  467. package/dist/utils/url-redact.js +4 -6
  468. package/dist/utils/url-redact.js.map +1 -1
  469. package/dist/utils/user-context-scanner.d.ts +8 -0
  470. package/dist/utils/user-context-scanner.d.ts.map +1 -1
  471. package/dist/utils/user-context-scanner.js +4 -2
  472. package/dist/utils/user-context-scanner.js.map +1 -1
  473. package/dist/utils/validate-help-files.d.ts.map +1 -1
  474. package/dist/utils/validate-help-files.js +12 -6
  475. package/dist/utils/validate-help-files.js.map +1 -1
  476. package/dist/utils/vat-bin-path.d.ts +36 -0
  477. package/dist/utils/vat-bin-path.d.ts.map +1 -0
  478. package/dist/utils/vat-bin-path.js +48 -0
  479. package/dist/utils/vat-bin-path.js.map +1 -0
  480. package/dist/utils/verdict-helpers.d.ts +1 -1
  481. package/dist/utils/verdict-helpers.d.ts.map +1 -1
  482. package/dist/utils/verdict-helpers.js +1 -1
  483. package/dist/utils/verdict-helpers.js.map +1 -1
  484. package/dist/version.d.ts.map +1 -1
  485. package/dist/version.js +1 -3
  486. package/dist/version.js.map +1 -1
  487. package/docs/agent.md +2 -2
  488. package/docs/audit.md +143 -39
  489. package/docs/doctor.md +7 -6
  490. package/docs/index.md +19 -11
  491. package/docs/mcp.md +2 -2
  492. package/docs/rag.md +3 -2
  493. package/docs/resources.md +13 -3
  494. package/docs/skill-test.md +10 -9
  495. package/docs/skills.md +53 -69
  496. package/package.json +36 -27
  497. package/schemas/ard-emit.json +152 -0
  498. package/schemas/okf-validate.json +170 -0
  499. package/schemas/resources-check.json +257 -0
  500. package/schemas/skill-review.json +230 -0
  501. package/dist/commands/resources/command-helpers.d.ts +0 -5
  502. package/dist/commands/resources/command-helpers.d.ts.map +0 -1
  503. package/dist/commands/resources/command-helpers.js +0 -6
  504. package/dist/commands/resources/command-helpers.js.map +0 -1
@@ -0,0 +1,86 @@
1
+ /**
2
+ * The root-level `--no-cache` control surface, kept apart from the `cache`
3
+ * command itself.
4
+ *
5
+ * `bin.ts` must call {@link registerCacheControl} on every single invocation,
6
+ * before parsing. Co-locating it with `createCacheCommand` in `index.ts` meant
7
+ * that unavoidable call dragged in `./clear.js` and, behind it, the whole
8
+ * resources package — measured at ~1.2s of module load on Windows, paid even by
9
+ * `vat --version`. This module imports nothing but commander, so the always-on
10
+ * path stays cheap — keep it that way: any import added here is paid by every
11
+ * `vat` invocation, and `index.ts` deliberately does not re-export it, so
12
+ * reaching these functions through the command group cannot happen by accident.
13
+ */
14
+ /**
15
+ * Register the root-level `--no-cache` flag and the hook that gives it effect.
16
+ *
17
+ * ## Why this sets an environment variable instead of plumbing a flag
18
+ *
19
+ * ⚠️ The ORIGINAL reason has expired, and saying so is the point of this note.
20
+ * It was that `vat validate` / `vat verify` / `vat build` enumerated nothing in
21
+ * their own process — each `spawnSync`ed the vat binary once per phase, so a
22
+ * flag parsed in the parent never reached the process doing the parsing, while
23
+ * `process.env` crossed the boundary for free. Phases run in this process now,
24
+ * so that argument no longer holds.
25
+ *
26
+ * What still holds is narrower but sufficient: the flag has to reach code that
27
+ * no CLI option is threaded through. `ParseCache` is constructed deep inside
28
+ * `@vibe-agent-toolkit/resources`, by callers several layers below any command,
29
+ * and `bin.ts` leans on the same mechanism for `VAT_CONTEXT` /
30
+ * `VAT_CONTEXT_PATH`. Plumbing a `noCache` parameter down every one of those
31
+ * call chains is the alternative, and it is a real one — this is now a choice
32
+ * rather than a necessity, so treat it as revisitable rather than as settled.
33
+ *
34
+ * `VAT_CACHE=0` is read by `ParseCache` (packages/resources/src/parse-cache.ts)
35
+ * per construction, never at module load, so setting it from a `preAction` hook
36
+ * — after Commander has parsed, before any command body runs — is observed by
37
+ * every phase, all of which now start after that hook has run.
38
+ *
39
+ * ## The collision with `vat resources validate --no-cache`
40
+ *
41
+ * This root program does NOT use `enablePositionalOptions()`, so Commander scans
42
+ * the WHOLE argv for root options, including everything after the subcommand
43
+ * name. That is the same mechanism that let a root `-v` shadow the subcommands'
44
+ * own `-v, --verbose` (see the incident recorded in `bin.ts`). Measured against
45
+ * commander 12: `vat resources validate docs --no-cache` leaves the ROOT with
46
+ * `cache: false` and the SUBCOMMAND with `cache: true` — the subcommand's
47
+ * identically-named flag is swallowed before it ever sees it, which would have
48
+ * silently re-enabled the external-URL cache the flag exists to bypass.
49
+ *
50
+ * Rather than break a shipped flag, the hook hands the value back down to
51
+ * whichever action command declares a `cache` option of its own. `--no-cache` is
52
+ * a superset — every cache off — so the handoff is a strengthening, never a
53
+ * reversal.
54
+ *
55
+ * @param program - The root program to register the flag and hook on
56
+ */
57
+ export function registerCacheControl(program) {
58
+ program.option('--no-cache', "Disable VAT's disk caches for this run (every phase included)");
59
+ program.hook('preAction', (_thisCommand, actionCommand) => {
60
+ applyCacheControl(program.opts(), actionCommand);
61
+ });
62
+ }
63
+ /**
64
+ * Apply the root `--no-cache` decision: export it to child processes, and hand
65
+ * it down to an action command that declares its own `cache` option.
66
+ *
67
+ * Exported so a test can drive it from real parsed options rather than from a
68
+ * hand-built bag. Deliberately does nothing when the flag was not passed — a
69
+ * toggle that writes `VAT_CACHE=1` by default would be indistinguishable from
70
+ * one that is always on.
71
+ *
72
+ * @param rootOptions - Options bag from the ROOT program
73
+ * @param actionCommand - The command whose action is about to run
74
+ */
75
+ export function applyCacheControl(rootOptions, actionCommand) {
76
+ if (rootOptions.cache !== false)
77
+ return;
78
+ process.env['VAT_CACHE'] = '0';
79
+ // `attributeName()`, not `name()`: for `--no-cache` the latter returns
80
+ // 'no-cache', so a check written against it never matches and the handoff
81
+ // above becomes a no-op that looks like it works.
82
+ if (actionCommand.options.some((option) => option.attributeName() === 'cache')) {
83
+ actionCommand.setOptionValue('cache', false);
84
+ }
85
+ }
86
+ //# sourceMappingURL=cache-control.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-control.js","sourceRoot":"","sources":["../../../src/commands/cache/cache-control.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAeH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,+DAA+D,CAAC,CAAC;IAE9F,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,EAAE;QACxD,iBAAiB,CAAC,OAAO,CAAC,IAAI,EAAuB,EAAE,aAAa,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAAC,WAAgC,EAAE,aAAsB;IACxF,IAAI,WAAW,CAAC,KAAK,KAAK,KAAK;QAAE,OAAO;IAExC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,GAAG,CAAC;IAE/B,uEAAuE;IACvE,0EAA0E;IAC1E,kDAAkD;IAClD,IAAI,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,OAAO,CAAC,EAAE,CAAC;QAC/E,aAAa,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC"}
@@ -6,20 +6,48 @@
6
6
  * described in prose. This is that path, named once.
7
7
  *
8
8
  * Scope is the WHOLE `<tmpdir>/.vat-cache/` tree, not just the parse tenant.
9
- * That directory is shared — `external-links.json`, `auth-<user>/` and `parse/`
10
- * all live under it — and "clear the cache" cannot honestly mean "clear one of
11
- * the three". All of them are disposable by construction.
9
+ * That directory is shared — `external-links.json`, `auth-<user>/`, `parse/` and
10
+ * `<namespace>/projection-<shapeDigest>/projection.db` all live under it — and
11
+ * "clear the cache" cannot honestly mean "clear one of the four". All of them
12
+ * are disposable by construction.
13
+ *
14
+ * 🔑 **The projection store is the one that makes this command matter, and it is
15
+ * covered by SCOPE rather than by a clause about it.** `defaultStoreDirectory()`
16
+ * resolves through `vatCacheNamespaceRoot()`, so it is already inside the tree
17
+ * this removes; the tenant list above is the only thing that has to keep up. It
18
+ * is also by far the largest tenant (71 MB for one 12,602-file tree) and is on
19
+ * by DEFAULT, which is why reclaiming it had to be invocable before the flip.
20
+ *
21
+ * ⚠️ A store relocated with `VAT_PROJECTION_STORE_DIR` is outside this tree and
22
+ * is NOT removed — the variable names a directory this command was never told
23
+ * about, and a clear that hunted for stores by shape would delete directories
24
+ * the operator chose. Stated so nobody reads a clean `bytesRemoved` as "every
25
+ * store is gone".
12
26
  */
13
27
  export interface CacheClearOptions {
14
28
  debug?: boolean;
15
29
  }
16
- /** What a clear did, as published on stdout. */
30
+ /**
31
+ * What a clear did, as published on stdout.
32
+ *
33
+ * `partial` is not a failure mode bolted on — it is the *common* outcome when
34
+ * something else on the machine is writing to the shared tree, and it has to be
35
+ * reportable. A recursive delete that gives up part-way has already removed most
36
+ * of the cache; surfacing that as a bare thrown error told the operator only
37
+ * that the command failed, while leaving them to guess how much of their cache
38
+ * still existed. An honest count of what went and what stayed is the whole
39
+ * point of a report.
40
+ */
17
41
  export interface CacheClearReport {
18
- status: 'success';
42
+ status: 'success' | 'partial';
19
43
  cacheDir: string;
20
44
  existed: boolean;
21
- /** Top-level entries that were deleted, sorted. Empty when nothing was there. */
45
+ /** Top-level entries that are gone, sorted. Empty when nothing was there. */
22
46
  removed: string[];
47
+ /** Top-level entries that survived a partial clear, sorted. Absent on success. */
48
+ remaining?: string[];
49
+ /** Why the delete stopped short. Absent on success. */
50
+ reason?: string;
23
51
  entriesRemoved: number;
24
52
  bytesRemoved: number;
25
53
  }
@@ -1 +1 @@
1
- {"version":3,"file":"clear.d.ts","sourceRoot":"","sources":["../../../src/commands/cache/clear.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAeH,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,gDAAgD;AAChD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,SAAS,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,iFAAiF;IACjF,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;CACtB;AASD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAcrC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAkBrF;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAYtF"}
1
+ {"version":3,"file":"clear.d.ts","sourceRoot":"","sources":["../../../src/commands/cache/clear.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAgBH,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;CACtB;AA4BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAcrC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAwBrF;AA+CD;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBtF"}
@@ -6,20 +6,53 @@
6
6
  * described in prose. This is that path, named once.
7
7
  *
8
8
  * Scope is the WHOLE `<tmpdir>/.vat-cache/` tree, not just the parse tenant.
9
- * That directory is shared — `external-links.json`, `auth-<user>/` and `parse/`
10
- * all live under it — and "clear the cache" cannot honestly mean "clear one of
11
- * the three". All of them are disposable by construction.
9
+ * That directory is shared — `external-links.json`, `auth-<user>/`, `parse/` and
10
+ * `<namespace>/projection-<shapeDigest>/projection.db` all live under it — and
11
+ * "clear the cache" cannot honestly mean "clear one of the four". All of them
12
+ * are disposable by construction.
13
+ *
14
+ * 🔑 **The projection store is the one that makes this command matter, and it is
15
+ * covered by SCOPE rather than by a clause about it.** `defaultStoreDirectory()`
16
+ * resolves through `vatCacheNamespaceRoot()`, so it is already inside the tree
17
+ * this removes; the tenant list above is the only thing that has to keep up. It
18
+ * is also by far the largest tenant (71 MB for one 12,602-file tree) and is on
19
+ * by DEFAULT, which is why reclaiming it had to be invocable before the flip.
20
+ *
21
+ * ⚠️ A store relocated with `VAT_PROJECTION_STORE_DIR` is outside this tree and
22
+ * is NOT removed — the variable names a directory this command was never told
23
+ * about, and a clear that hunted for stores by shape would delete directories
24
+ * the operator chose. Stated so nobody reads a clean `bytesRemoved` as "every
25
+ * store is gone".
12
26
  */
13
27
  import { promises as fs } from 'node:fs';
14
28
  import { basename, dirname } from 'node:path';
15
29
  import { parseCacheDirectory } from '@vibe-agent-toolkit/resources';
16
- import { safePath } from '@vibe-agent-toolkit/utils';
30
+ import { ExitCode } from '@vibe-agent-toolkit/schema';
31
+ import { direntKind, isPathAbsentError, safePath } from '@vibe-agent-toolkit/utils';
17
32
  import { handleCommandError } from '../../utils/command-error.js';
18
33
  import { createLogger } from '../../utils/logger.js';
19
34
  import { writeYamlOutput } from '../../utils/output.js';
20
35
  /** The one name the shared cache root is allowed to have. See {@link vatCacheRoot}. */
21
36
  const VAT_CACHE_DIR_NAME = '.vat-cache';
22
37
  const EMPTY_USAGE = { entries: 0, bytes: 0 };
38
+ /**
39
+ * Retry budget for the recursive delete.
40
+ *
41
+ * Not defensive padding — observed. `<tmpdir>/.vat-cache` is shared by every VAT
42
+ * on the machine: other worktrees, other sessions, and any adopter running an
43
+ * *installed* vat all write into it under their own namespace. A `vat cache
44
+ * clear` issued while one of them is mid-run walks a tree that is growing
45
+ * underneath it and `rmdir` fails `ENOTEMPTY` on a shard that gained a file
46
+ * between the listing and the removal. Reproduced twice against a concurrent
47
+ * `vat verify`; the same command succeeded immediately once that run finished.
48
+ *
49
+ * Node retries exactly this error class (`EBUSY`, `EMFILE`, `ENFILE`,
50
+ * `ENOTEMPTY`, `EPERM`) with a linear backoff, which clears a short overlap.
51
+ * It cannot win against a writer that keeps going for the whole window — that
52
+ * case still surfaces as an error, which is correct: "some of your cache is
53
+ * gone and something is still writing" must not be reported as success.
54
+ */
55
+ const RM_RETRY = { maxRetries: 5, retryDelay: 100 };
23
56
  /**
24
57
  * The shared cache root, `<tmpdir>/.vat-cache`.
25
58
  *
@@ -80,16 +113,59 @@ export async function clearCacheDirectory(cacheDir) {
80
113
  return { status: 'success', cacheDir, existed: false, removed: [], entriesRemoved: 0, bytesRemoved: 0 };
81
114
  }
82
115
  const usage = await measureEntries(cacheDir, entries);
83
- await fs.rm(cacheDir, { recursive: true, force: true });
116
+ const names = entries.map((entry) => entry.name);
117
+ try {
118
+ await fs.rm(cacheDir, { recursive: true, force: true, ...RM_RETRY });
119
+ }
120
+ catch (error) {
121
+ return partialReport(cacheDir, names, usage, error);
122
+ }
84
123
  return {
85
124
  status: 'success',
86
125
  cacheDir,
87
126
  existed: true,
88
- removed: entries.map((entry) => entry.name).sort((a, b) => a.localeCompare(b)),
127
+ removed: sorted(names),
89
128
  entriesRemoved: usage.entries,
90
129
  bytesRemoved: usage.bytes,
91
130
  };
92
131
  }
132
+ /**
133
+ * Describe a delete that stopped part-way, by re-reading the tree.
134
+ *
135
+ * The survivors are read back off disk rather than inferred from the error,
136
+ * because the error names one path and says nothing about the other ninety-nine
137
+ * percent. Re-measuring what remains and subtracting is the only way the counts
138
+ * describe what actually happened rather than what was attempted.
139
+ *
140
+ * A concurrent writer can make the remainder *larger* than the original
141
+ * measurement, so the subtraction is floored at zero: reporting a negative
142
+ * number of removed bytes would be worse than reporting none.
143
+ *
144
+ * @param cacheDir - The tree that was being removed
145
+ * @param names - Top-level entry names as they were before the delete
146
+ * @param before - Usage measured before the delete
147
+ * @param error - Whatever `fs.rm` threw
148
+ * @returns A report naming what went, what stayed, and why
149
+ */
150
+ async function partialReport(cacheDir, names, before, error) {
151
+ const survivors = (await readdirOrNull(cacheDir)) ?? [];
152
+ const remaining = new Set(survivors.map((entry) => entry.name));
153
+ const after = await measureEntries(cacheDir, survivors);
154
+ return {
155
+ status: 'partial',
156
+ cacheDir,
157
+ existed: true,
158
+ removed: sorted(names.filter((name) => !remaining.has(name))),
159
+ remaining: sorted([...remaining]),
160
+ reason: error instanceof Error ? error.message : String(error),
161
+ entriesRemoved: Math.max(0, before.entries - after.entries),
162
+ bytesRemoved: Math.max(0, before.bytes - after.bytes),
163
+ };
164
+ }
165
+ /** Stable ordering for the reported entry lists. */
166
+ function sorted(names) {
167
+ return [...names].sort((left, right) => left.localeCompare(right));
168
+ }
93
169
  /**
94
170
  * Command entry point: clear the real cache root and publish the report.
95
171
  *
@@ -102,7 +178,12 @@ export async function cacheClearCommand(options = {}) {
102
178
  const report = await clearCacheDirectory(vatCacheRoot());
103
179
  logger.debug(`Cleared ${String(report.entriesRemoved)} cache entries from ${report.cacheDir}`);
104
180
  writeYamlOutput(report);
105
- process.exit(0);
181
+ // A partial clear publishes its report and *then* fails. Exiting through
182
+ // `handleCommandError` instead would suppress the report entirely, which is
183
+ // the defect this branch exists to fix: the operator most needs to know how
184
+ // much of the cache survived precisely when the command did not finish.
185
+ // A partial clear is a run that did not finish, not a finding about the tree.
186
+ process.exit(report.status === 'partial' ? ExitCode.ERROR : ExitCode.OK);
106
187
  }
107
188
  catch (error) {
108
189
  handleCommandError(error, logger, startTime, 'CacheClear');
@@ -117,7 +198,6 @@ export async function cacheClearCommand(options = {}) {
117
198
  */
118
199
  async function readdirOrNull(dir) {
119
200
  try {
120
- // eslint-disable-next-line security/detect-non-literal-fs-filename -- path is the derived cache root or a caller-injected test directory
121
201
  return await fs.readdir(dir, { withFileTypes: true });
122
202
  }
123
203
  catch (error) {
@@ -130,9 +210,11 @@ async function readdirOrNull(dir) {
130
210
  async function measureEntries(dir, entries) {
131
211
  const usages = await Promise.all(entries.map(async (entry) => {
132
212
  const child = safePath.join(dir, entry.name);
133
- // Not `isFile()`: a symlink or socket is still an entry that is about to
134
- // be removed, and counting only regular files would under-report it.
135
- return entry.isDirectory() ? measureTree(child) : { entries: 1, bytes: await sizeOf(child) };
213
+ // Not `isFile()`, and NOT followed: a symlink or socket is still an entry
214
+ // that is about to be removed, and counting only regular files would
215
+ // under-report it — while walking INTO a linked directory would count a
216
+ // tree `rm -rf` leaves untouched.
217
+ return direntKind(entry) === 'directory' ? measureTree(child) : { entries: 1, bytes: await sizeOf(child) };
136
218
  }));
137
219
  return usages.reduce((total, usage) => ({ entries: total.entries + usage.entries, bytes: total.bytes + usage.bytes }), EMPTY_USAGE);
138
220
  }
@@ -147,16 +229,20 @@ async function measureTree(dir) {
147
229
  * A file that disappears between the listing and the stat contributes 0 rather
148
230
  * than failing the clear — the whole tree is about to be deleted anyway, and a
149
231
  * concurrent vat run pruning its own temp file must not turn cleanup into an
150
- * error.
232
+ * error. Only a DISAPPEARANCE is 0: an entry the OS refuses to stat is still
233
+ * there, still about to be counted as reclaimed, and the `rm` that follows is
234
+ * about to meet the same refusal — so it is raised here, where it names the
235
+ * entry, rather than read as an empty file.
151
236
  */
152
237
  async function sizeOf(target) {
153
238
  try {
154
- // eslint-disable-next-line security/detect-non-literal-fs-filename -- path is inside the cache root being measured
155
239
  const stats = await fs.lstat(target);
156
240
  return stats.size;
157
241
  }
158
- catch {
159
- return 0;
242
+ catch (error) {
243
+ if (isPathAbsentError(error))
244
+ return 0;
245
+ throw error;
160
246
  }
161
247
  }
162
248
  //# sourceMappingURL=clear.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clear.js","sourceRoot":"","sources":["../../../src/commands/cache/clear.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAe,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,QAAQ,EAA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AAK,CAAC,IAAI,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,iBAAiB,CAAC,KAAK,CAAC;YAAE,OAAO,CAAC,CAAC;QACvC,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -1,68 +1,18 @@
1
1
  /**
2
- * Cache command group, plus the root-level `--no-cache` control surface.
3
- *
4
- * Both live here so the flag and the command that cleans up after it stay in one
5
- * place: `--no-cache` decides whether this run *writes* to the caches, `vat cache
6
- * clear` decides whether the caches *survive*.
2
+ * Cache command group.
3
+ *
4
+ * The paired `--no-cache` control surface lives in `./cache-control.js`:
5
+ * `--no-cache` decides whether this run *writes* to the caches, `vat cache
6
+ * clear` decides whether the caches *survive*. They are separate modules only
7
+ * because `bin.ts` registers the flag on every invocation and must not pay for
8
+ * this command's imports to do it.
9
+ *
10
+ * ⛔ Do NOT re-export `cache-control.js` from here for convenience. Importing it
11
+ * through this module pulls `./clear.js` and the whole resources package behind
12
+ * it — the exact ~1.2s that splitting the file removed — so a re-export leaves
13
+ * the expensive path one identical-looking import away, with nothing pinning
14
+ * the cheap one. Import from `./cache-control.js` directly.
7
15
  */
8
16
  import { Command } from 'commander';
9
- /**
10
- * Root options this module reads. Commander represents `--no-cache` as the
11
- * POSITIVE key `cache` — `true` by default, `false` only when the negated flag
12
- * is passed. It NEVER produces `noCache`; reading that key is the exact bug that
13
- * made three flags in this package silent no-ops (see
14
- * `test/commands/commander-option-keys.test.ts`).
15
- */
16
- export interface CacheControlOptions {
17
- cache?: boolean;
18
- }
19
- /**
20
- * Register the root-level `--no-cache` flag and the hook that gives it effect.
21
- *
22
- * ## Why this sets an environment variable instead of plumbing a flag
23
- *
24
- * `vat validate`, `vat verify` and `vat build` enumerate nothing in their own
25
- * process: each `spawnSync`s the vat binary once per phase, and the child is
26
- * what parses the corpus. A flag parsed in the parent therefore never reaches
27
- * the process whose caching it is supposed to control, whereas `process.env` is
28
- * inherited by every child for free. `bin.ts` already leans on exactly that for
29
- * `VAT_CONTEXT` / `VAT_CONTEXT_PATH`.
30
- *
31
- * `VAT_CACHE=0` is read by `ParseCache` (packages/resources/src/parse-cache.ts)
32
- * per construction, never at module load, so setting it from a `preAction` hook
33
- * — after Commander has parsed, before any command body runs — is observed.
34
- *
35
- * ## The collision with `vat resources validate --no-cache`
36
- *
37
- * This root program does NOT use `enablePositionalOptions()`, so Commander scans
38
- * the WHOLE argv for root options, including everything after the subcommand
39
- * name. That is the same mechanism that let a root `-v` shadow the subcommands'
40
- * own `-v, --verbose` (see the incident recorded in `bin.ts`). Measured against
41
- * commander 12: `vat resources validate docs --no-cache` leaves the ROOT with
42
- * `cache: false` and the SUBCOMMAND with `cache: true` — the subcommand's
43
- * identically-named flag is swallowed before it ever sees it, which would have
44
- * silently re-enabled the external-URL cache the flag exists to bypass.
45
- *
46
- * Rather than break a shipped flag, the hook hands the value back down to
47
- * whichever action command declares a `cache` option of its own. `--no-cache` is
48
- * a superset — every cache off — so the handoff is a strengthening, never a
49
- * reversal.
50
- *
51
- * @param program - The root program to register the flag and hook on
52
- */
53
- export declare function registerCacheControl(program: Command): void;
54
- /**
55
- * Apply the root `--no-cache` decision: export it to child processes, and hand
56
- * it down to an action command that declares its own `cache` option.
57
- *
58
- * Exported so a test can drive it from real parsed options rather than from a
59
- * hand-built bag. Deliberately does nothing when the flag was not passed — a
60
- * toggle that writes `VAT_CACHE=1` by default would be indistinguishable from
61
- * one that is always on.
62
- *
63
- * @param rootOptions - Options bag from the ROOT program
64
- * @param actionCommand - The command whose action is about to run
65
- */
66
- export declare function applyCacheControl(rootOptions: CacheControlOptions, actionCommand: Command): void;
67
17
  export declare function createCacheCommand(): Command;
68
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/cache/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAM3D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,mBAAmB,EAAE,aAAa,EAAE,OAAO,GAAG,IAAI,CAWhG;AAED,wBAAgB,kBAAkB,IAAI,OAAO,CA6D5C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/cache/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,kBAAkB,IAAI,OAAO,CAoF5C"}
@@ -1,75 +1,20 @@
1
1
  /**
2
- * Cache command group, plus the root-level `--no-cache` control surface.
2
+ * Cache command group.
3
3
  *
4
- * Both live here so the flag and the command that cleans up after it stay in one
5
- * place: `--no-cache` decides whether this run *writes* to the caches, `vat cache
6
- * clear` decides whether the caches *survive*.
4
+ * The paired `--no-cache` control surface lives in `./cache-control.js`:
5
+ * `--no-cache` decides whether this run *writes* to the caches, `vat cache
6
+ * clear` decides whether the caches *survive*. They are separate modules only
7
+ * because `bin.ts` registers the flag on every invocation and must not pay for
8
+ * this command's imports to do it.
9
+ *
10
+ * ⛔ Do NOT re-export `cache-control.js` from here for convenience. Importing it
11
+ * through this module pulls `./clear.js` and the whole resources package behind
12
+ * it — the exact ~1.2s that splitting the file removed — so a re-export leaves
13
+ * the expensive path one identical-looking import away, with nothing pinning
14
+ * the cheap one. Import from `./cache-control.js` directly.
7
15
  */
8
16
  import { Command } from 'commander';
9
17
  import { cacheClearCommand } from './clear.js';
10
- /**
11
- * Register the root-level `--no-cache` flag and the hook that gives it effect.
12
- *
13
- * ## Why this sets an environment variable instead of plumbing a flag
14
- *
15
- * `vat validate`, `vat verify` and `vat build` enumerate nothing in their own
16
- * process: each `spawnSync`s the vat binary once per phase, and the child is
17
- * what parses the corpus. A flag parsed in the parent therefore never reaches
18
- * the process whose caching it is supposed to control, whereas `process.env` is
19
- * inherited by every child for free. `bin.ts` already leans on exactly that for
20
- * `VAT_CONTEXT` / `VAT_CONTEXT_PATH`.
21
- *
22
- * `VAT_CACHE=0` is read by `ParseCache` (packages/resources/src/parse-cache.ts)
23
- * per construction, never at module load, so setting it from a `preAction` hook
24
- * — after Commander has parsed, before any command body runs — is observed.
25
- *
26
- * ## The collision with `vat resources validate --no-cache`
27
- *
28
- * This root program does NOT use `enablePositionalOptions()`, so Commander scans
29
- * the WHOLE argv for root options, including everything after the subcommand
30
- * name. That is the same mechanism that let a root `-v` shadow the subcommands'
31
- * own `-v, --verbose` (see the incident recorded in `bin.ts`). Measured against
32
- * commander 12: `vat resources validate docs --no-cache` leaves the ROOT with
33
- * `cache: false` and the SUBCOMMAND with `cache: true` — the subcommand's
34
- * identically-named flag is swallowed before it ever sees it, which would have
35
- * silently re-enabled the external-URL cache the flag exists to bypass.
36
- *
37
- * Rather than break a shipped flag, the hook hands the value back down to
38
- * whichever action command declares a `cache` option of its own. `--no-cache` is
39
- * a superset — every cache off — so the handoff is a strengthening, never a
40
- * reversal.
41
- *
42
- * @param program - The root program to register the flag and hook on
43
- */
44
- export function registerCacheControl(program) {
45
- program.option('--no-cache', "Disable VAT's disk caches for this run (also applies to spawned phases)");
46
- program.hook('preAction', (_thisCommand, actionCommand) => {
47
- applyCacheControl(program.opts(), actionCommand);
48
- });
49
- }
50
- /**
51
- * Apply the root `--no-cache` decision: export it to child processes, and hand
52
- * it down to an action command that declares its own `cache` option.
53
- *
54
- * Exported so a test can drive it from real parsed options rather than from a
55
- * hand-built bag. Deliberately does nothing when the flag was not passed — a
56
- * toggle that writes `VAT_CACHE=1` by default would be indistinguishable from
57
- * one that is always on.
58
- *
59
- * @param rootOptions - Options bag from the ROOT program
60
- * @param actionCommand - The command whose action is about to run
61
- */
62
- export function applyCacheControl(rootOptions, actionCommand) {
63
- if (rootOptions.cache !== false)
64
- return;
65
- process.env['VAT_CACHE'] = '0';
66
- // `attributeName()`, not `name()`: for `--no-cache` the latter returns
67
- // 'no-cache', so a check written against it never matches and the handoff
68
- // above becomes a no-op that looks like it works.
69
- if (actionCommand.options.some((option) => option.attributeName() === 'cache')) {
70
- actionCommand.setOptionValue('cache', false);
71
- }
72
- }
73
18
  export function createCacheCommand() {
74
19
  const cache = new Command('cache');
75
20
  cache
@@ -77,13 +22,25 @@ export function createCacheCommand() {
77
22
  .helpCommand(false)
78
23
  .addHelpText('after', `
79
24
  Description:
80
- VAT keeps three disposable caches under <tmpdir>/.vat-cache: parse facts
81
- keyed by file content, external-URL validation results, and per-OS-user
82
- authenticated-link content. None of them is durable — recovery is always
83
- "rescan", and the OS temp purge is the eviction policy.
25
+ VAT keeps four disposable caches under <tmpdir>/.vat-cache: parse facts
26
+ keyed by file content, external-URL validation results, per-OS-user
27
+ authenticated-link content, and the projection store — a SQLite database
28
+ holding one whole scanned tree per entry, on by default, and by far the
29
+ largest of the four. None of them is durable — recovery is always "rescan".
30
+
31
+ How large: one 12,602-file repository measured 71 MB of projection store,
32
+ and the file holds several trees per repository plus a shared blob tier, so
33
+ a machine that has scanned a few projects reaches the hundreds of MB. The
34
+ other three tenants are a few MB between them.
35
+
36
+ Only the projection store evicts anything on its own: it keeps the three
37
+ most recently written trees per root and the 50,000 most recently written
38
+ content keys, dropping the rest as it writes. The other three rely on the OS
39
+ temp purge, and every one of them is reclaimed in full by vat cache clear.
84
40
 
85
41
  To run WITHOUT the caches rather than remove them, use --no-cache on any
86
- command (or VAT_CACHE=0), which also applies to spawned phases.
42
+ command (or VAT_CACHE=0), which also applies to spawned phases and to the
43
+ projection store. VAT_PROJECTION_STORE=off turns off just the store.
87
44
 
88
45
  Example:
89
46
  $ vat cache clear # Reclaim the temp-directory cache tree
@@ -97,9 +54,15 @@ Example:
97
54
  .addHelpText('after', `
98
55
  Description:
99
56
  Removes <tmpdir>/.vat-cache in its entirety — the parse cache, the
100
- external-URL validation cache, and the per-OS-user authenticated-link cache.
101
- Every one of them is disposable by design: the next run repopulates what it
102
- needs, so the only cost of clearing is one cold pass.
57
+ external-URL validation cache, the per-OS-user authenticated-link cache, and
58
+ the projection store (<namespace>/projection-<shape>/projection.db), which is
59
+ usually most of the bytes this reclaims: 71 MB for a single 12,602-file
60
+ repository, and the hundreds of MB once a machine has scanned several. Every
61
+ one of them is disposable by design: the next run repopulates what it needs,
62
+ so the only cost of clearing is one cold pass.
63
+
64
+ A projection store relocated with VAT_PROJECTION_STORE_DIR lives outside
65
+ this tree and is not removed — delete that directory yourself.
103
66
 
104
67
  Runs regardless of --no-cache / VAT_CACHE=0. Turning caching off must not
105
68
  disarm the one command that reclaims the space.
@@ -107,16 +70,21 @@ Description:
107
70
  A cache directory that does not exist is not an error — nothing to remove is
108
71
  a successful clear.
109
72
 
73
+ The tree is shared by every VAT on the machine, so another run writing into
74
+ it can make the delete stop part-way. That is reported as status: partial,
75
+ naming what went and what stayed, rather than failing with no account of it.
76
+
110
77
  Output:
111
78
  - cacheDir: absolute path that was targeted
112
79
  - existed: whether the directory was there at all
113
- - removed: top-level entries that were deleted
114
- - entriesRemoved / bytesRemoved: file count and total size, measured before
115
- deletion
80
+ - removed: top-level entries that are now gone
81
+ - remaining / reason: what survived a partial clear, and why (partial only)
82
+ - entriesRemoved / bytesRemoved: file count and total size actually removed
116
83
 
117
84
  Exit Codes:
118
85
  0 - Cache cleared (or already absent)
119
- 2 - Could not remove the cache (permissions, busy file)
86
+ 1 - Cleared only in part, because something else is using the tree
87
+ 2 - Could not read or target the cache at all (permissions, unexpected layout)
120
88
 
121
89
  Example:
122
90
  $ vat cache clear # Reclaim the temp-directory cache tree
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/cache/index.ts"],"names":[],"mappings":"AAAA;;;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AiB,CAAC,IAAI,CAAC,eAAe,EAAuB,CAAC,CAAC;IACvE,CAAC,CAAC;SACD,WAAW,CACV,OAAO,EACP;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BL,CACI,CAAC;IAEJ,OAAO,KAAK,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/cache/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAA0B,MAAM,YAAY,CAAC;AAGvE,MAAM,UAAU,kBAAkB;IAChC,MAAM,KAAK,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAEnC,KAAK;SACF,WAAW,CAAC,iEAAiE,CAAC;SAC9E,WAAW,CAAC,KAAK,CAAC;SAClB,WAAW,CACV,OAAO,EACP;;;;;;;;;;;;;;;;;;;;;;;;CAwBL,CACI,CAAC;IAEJ,KAAK;SACF,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,gEAAgE,CAAC;SAC7E,MAAM,CAAC,KAAK;QACX,MAAM,iBAAiB,CAAC,IAAI,CAAC,eAAe,EAAuB,CAAC,CAAC;IACvE,CAAC,CAAC;SACD,WAAW,CACV,OAAO,EACP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCL,CACI,CAAC;IAEJ,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"claude-config.d.ts","sourceRoot":"","sources":["../../../src/commands/claude/claude-config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAGnF,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,YAAY,GAAG,SAAS,CAAC;CACxC,CAAC,CAWD"}
1
+ {"version":3,"file":"claude-config.d.ts","sourceRoot":"","sources":["../../../src/commands/claude/claude-config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAGnF,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,YAAY,GAAG,SAAS,CAAC;CACxC,CAAC,CAiBD"}
@@ -15,6 +15,12 @@ export async function loadClaudeProjectConfig() {
15
15
  if (!configPath) {
16
16
  throw new Error('No vibe-agent-toolkit.config.yaml found. Run from a project directory.');
17
17
  }
18
+ // No `onUnknownKeys` argument: `parseConfigFile` already DEFAULTS to writing
19
+ // the warning to stderr, which is exactly what this lane needs — unknown keys
20
+ // are a warning rather than a refusal, and stderr keeps the YAML document on
21
+ // stdout machine-readable. Passing a callback byte-identical to the default
22
+ // said "this command has an opinion here" while changing nothing, so a later
23
+ // reader would have to diff it against the default to learn it was dead.
18
24
  const config = await parseConfigFile(configPath);
19
25
  const configDir = dirname(configPath);
20
26
  return { configPath, configDir, claudeConfig: config.claude };