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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (504) hide show
  1. package/README.md +4 -5
  2. package/dist/bin/vat +95 -28
  3. package/dist/bin/vat.js +95 -28
  4. package/dist/bin/vat.js.map +1 -1
  5. package/dist/bin.js +115 -76
  6. package/dist/bin.js.map +1 -1
  7. package/dist/command-loaders.d.ts +44 -0
  8. package/dist/command-loaders.d.ts.map +1 -0
  9. package/dist/command-loaders.js +60 -0
  10. package/dist/command-loaders.js.map +1 -0
  11. package/dist/commands/agent/build.d.ts.map +1 -1
  12. package/dist/commands/agent/build.js +2 -1
  13. package/dist/commands/agent/build.js.map +1 -1
  14. package/dist/commands/agent/import.d.ts.map +1 -1
  15. package/dist/commands/agent/import.js +3 -2
  16. package/dist/commands/agent/import.js.map +1 -1
  17. package/dist/commands/agent/index.js +1 -1
  18. package/dist/commands/agent/install-path.d.ts +36 -0
  19. package/dist/commands/agent/install-path.d.ts.map +1 -0
  20. package/dist/commands/agent/install-path.js +44 -0
  21. package/dist/commands/agent/install-path.js.map +1 -0
  22. package/dist/commands/agent/install.d.ts.map +1 -1
  23. package/dist/commands/agent/install.js +66 -13
  24. package/dist/commands/agent/install.js.map +1 -1
  25. package/dist/commands/agent/installed.d.ts.map +1 -1
  26. package/dist/commands/agent/installed.js +22 -12
  27. package/dist/commands/agent/installed.js.map +1 -1
  28. package/dist/commands/agent/list.d.ts.map +1 -1
  29. package/dist/commands/agent/list.js +2 -1
  30. package/dist/commands/agent/list.js.map +1 -1
  31. package/dist/commands/agent/run.d.ts.map +1 -1
  32. package/dist/commands/agent/run.js +2 -1
  33. package/dist/commands/agent/run.js.map +1 -1
  34. package/dist/commands/agent/uninstall.d.ts.map +1 -1
  35. package/dist/commands/agent/uninstall.js +13 -6
  36. package/dist/commands/agent/uninstall.js.map +1 -1
  37. package/dist/commands/agent/validate.d.ts.map +1 -1
  38. package/dist/commands/agent/validate.js +3 -2
  39. package/dist/commands/agent/validate.js.map +1 -1
  40. package/dist/commands/ard/emit.d.ts +153 -0
  41. package/dist/commands/ard/emit.d.ts.map +1 -0
  42. package/dist/commands/ard/emit.js +276 -0
  43. package/dist/commands/ard/emit.js.map +1 -0
  44. package/dist/commands/ard/index.d.ts +12 -0
  45. package/dist/commands/ard/index.d.ts.map +1 -0
  46. package/dist/commands/ard/index.js +80 -0
  47. package/dist/commands/ard/index.js.map +1 -0
  48. package/dist/commands/ard/surfaces.d.ts +56 -0
  49. package/dist/commands/ard/surfaces.d.ts.map +1 -0
  50. package/dist/commands/ard/surfaces.js +150 -0
  51. package/dist/commands/ard/surfaces.js.map +1 -0
  52. package/dist/commands/audit/distributed-tree.d.ts +2 -2
  53. package/dist/commands/audit/distributed-tree.d.ts.map +1 -1
  54. package/dist/commands/audit/distributed-tree.js +11 -7
  55. package/dist/commands/audit/distributed-tree.js.map +1 -1
  56. package/dist/commands/audit/git-url-clone.d.ts +1 -1
  57. package/dist/commands/audit/git-url-clone.d.ts.map +1 -1
  58. package/dist/commands/audit/git-url-clone.js.map +1 -1
  59. package/dist/commands/audit/hierarchical-output.d.ts +1 -1
  60. package/dist/commands/audit/hierarchical-output.d.ts.map +1 -1
  61. package/dist/commands/audit/hierarchical-output.js +1 -1
  62. package/dist/commands/audit/hierarchical-output.js.map +1 -1
  63. package/dist/commands/audit/provenance.d.ts.map +1 -1
  64. package/dist/commands/audit/provenance.js +4 -3
  65. package/dist/commands/audit/provenance.js.map +1 -1
  66. package/dist/commands/audit/scan-population.d.ts +158 -0
  67. package/dist/commands/audit/scan-population.d.ts.map +1 -0
  68. package/dist/commands/audit/scan-population.js +292 -0
  69. package/dist/commands/audit/scan-population.js.map +1 -0
  70. package/dist/commands/audit-settings.d.ts.map +1 -1
  71. package/dist/commands/audit-settings.js +6 -5
  72. package/dist/commands/audit-settings.js.map +1 -1
  73. package/dist/commands/audit.d.ts +98 -8
  74. package/dist/commands/audit.d.ts.map +1 -1
  75. package/dist/commands/audit.js +1126 -394
  76. package/dist/commands/audit.js.map +1 -1
  77. package/dist/commands/build.d.ts +1 -1
  78. package/dist/commands/build.d.ts.map +1 -1
  79. package/dist/commands/build.js +40 -36
  80. package/dist/commands/build.js.map +1 -1
  81. package/dist/commands/cache/cache-control.d.ts +82 -0
  82. package/dist/commands/cache/cache-control.d.ts.map +1 -0
  83. package/dist/commands/cache/cache-control.js +86 -0
  84. package/dist/commands/cache/cache-control.js.map +1 -0
  85. package/dist/commands/cache/clear.d.ts +34 -6
  86. package/dist/commands/cache/clear.d.ts.map +1 -1
  87. package/dist/commands/cache/clear.js +101 -15
  88. package/dist/commands/cache/clear.js.map +1 -1
  89. package/dist/commands/cache/index.d.ts +13 -63
  90. package/dist/commands/cache/index.d.ts.map +1 -1
  91. package/dist/commands/cache/index.js +47 -79
  92. package/dist/commands/cache/index.js.map +1 -1
  93. package/dist/commands/claude/claude-config.d.ts.map +1 -1
  94. package/dist/commands/claude/claude-config.js +6 -0
  95. package/dist/commands/claude/claude-config.js.map +1 -1
  96. package/dist/commands/claude/context.d.ts +340 -0
  97. package/dist/commands/claude/context.d.ts.map +1 -0
  98. package/dist/commands/claude/context.js +1080 -0
  99. package/dist/commands/claude/context.js.map +1 -0
  100. package/dist/commands/claude/index.d.ts +14 -0
  101. package/dist/commands/claude/index.d.ts.map +1 -1
  102. package/dist/commands/claude/index.js +22 -2
  103. package/dist/commands/claude/index.js.map +1 -1
  104. package/dist/commands/claude/marketplace/changelog-utils.d.ts +1 -1
  105. package/dist/commands/claude/marketplace/changelog-utils.d.ts.map +1 -1
  106. package/dist/commands/claude/marketplace/changelog-utils.js +1 -2
  107. package/dist/commands/claude/marketplace/changelog-utils.js.map +1 -1
  108. package/dist/commands/claude/marketplace/git-publish.d.ts.map +1 -1
  109. package/dist/commands/claude/marketplace/git-publish.js +40 -31
  110. package/dist/commands/claude/marketplace/git-publish.js.map +1 -1
  111. package/dist/commands/claude/marketplace/license-utils.d.ts.map +1 -1
  112. package/dist/commands/claude/marketplace/license-utils.js +0 -1
  113. package/dist/commands/claude/marketplace/license-utils.js.map +1 -1
  114. package/dist/commands/claude/marketplace/publish-tree.d.ts.map +1 -1
  115. package/dist/commands/claude/marketplace/publish-tree.js +0 -6
  116. package/dist/commands/claude/marketplace/publish-tree.js.map +1 -1
  117. package/dist/commands/claude/marketplace/publish.d.ts.map +1 -1
  118. package/dist/commands/claude/marketplace/publish.js +2 -1
  119. package/dist/commands/claude/marketplace/publish.js.map +1 -1
  120. package/dist/commands/claude/marketplace/validate.d.ts +73 -22
  121. package/dist/commands/claude/marketplace/validate.d.ts.map +1 -1
  122. package/dist/commands/claude/marketplace/validate.js +407 -72
  123. package/dist/commands/claude/marketplace/validate.js.map +1 -1
  124. package/dist/commands/claude/org/api-keys.d.ts +0 -3
  125. package/dist/commands/claude/org/api-keys.d.ts.map +1 -1
  126. package/dist/commands/claude/org/api-keys.js +2 -1
  127. package/dist/commands/claude/org/api-keys.js.map +1 -1
  128. package/dist/commands/claude/org/helpers.d.ts +54 -1
  129. package/dist/commands/claude/org/helpers.d.ts.map +1 -1
  130. package/dist/commands/claude/org/helpers.js +42 -7
  131. package/dist/commands/claude/org/helpers.js.map +1 -1
  132. package/dist/commands/claude/org/index.d.ts.map +1 -1
  133. package/dist/commands/claude/org/index.js +24 -16
  134. package/dist/commands/claude/org/index.js.map +1 -1
  135. package/dist/commands/claude/org/invites.d.ts +0 -3
  136. package/dist/commands/claude/org/invites.d.ts.map +1 -1
  137. package/dist/commands/claude/org/invites.js +3 -2
  138. package/dist/commands/claude/org/invites.js.map +1 -1
  139. package/dist/commands/claude/org/skills.d.ts +527 -0
  140. package/dist/commands/claude/org/skills.d.ts.map +1 -1
  141. package/dist/commands/claude/org/skills.js +1414 -108
  142. package/dist/commands/claude/org/skills.js.map +1 -1
  143. package/dist/commands/claude/org/users.d.ts +0 -3
  144. package/dist/commands/claude/org/users.d.ts.map +1 -1
  145. package/dist/commands/claude/org/users.js +6 -3
  146. package/dist/commands/claude/org/users.js.map +1 -1
  147. package/dist/commands/claude/org/workspaces.d.ts +0 -3
  148. package/dist/commands/claude/org/workspaces.d.ts.map +1 -1
  149. package/dist/commands/claude/org/workspaces.js +11 -7
  150. package/dist/commands/claude/org/workspaces.js.map +1 -1
  151. package/dist/commands/claude/plugin/build.d.ts +41 -3
  152. package/dist/commands/claude/plugin/build.d.ts.map +1 -1
  153. package/dist/commands/claude/plugin/build.js +147 -80
  154. package/dist/commands/claude/plugin/build.js.map +1 -1
  155. package/dist/commands/claude/plugin/helpers.d.ts.map +1 -1
  156. package/dist/commands/claude/plugin/helpers.js +2 -7
  157. package/dist/commands/claude/plugin/helpers.js.map +1 -1
  158. package/dist/commands/claude/plugin/install.d.ts +12 -0
  159. package/dist/commands/claude/plugin/install.d.ts.map +1 -1
  160. package/dist/commands/claude/plugin/install.js +93 -62
  161. package/dist/commands/claude/plugin/install.js.map +1 -1
  162. package/dist/commands/claude/plugin/list.d.ts.map +1 -1
  163. package/dist/commands/claude/plugin/list.js +3 -2
  164. package/dist/commands/claude/plugin/list.js.map +1 -1
  165. package/dist/commands/claude/plugin/marketplace-json.d.ts +24 -9
  166. package/dist/commands/claude/plugin/marketplace-json.d.ts.map +1 -1
  167. package/dist/commands/claude/plugin/marketplace-json.js +10 -9
  168. package/dist/commands/claude/plugin/marketplace-json.js.map +1 -1
  169. package/dist/commands/claude/plugin/plugin-changelog.d.ts.map +1 -1
  170. package/dist/commands/claude/plugin/plugin-changelog.js +0 -2
  171. package/dist/commands/claude/plugin/plugin-changelog.js.map +1 -1
  172. package/dist/commands/claude/plugin/plugin-files.d.ts.map +1 -1
  173. package/dist/commands/claude/plugin/plugin-files.js +3 -6
  174. package/dist/commands/claude/plugin/plugin-files.js.map +1 -1
  175. package/dist/commands/claude/plugin/plugin-validators.d.ts.map +1 -1
  176. package/dist/commands/claude/plugin/plugin-validators.js +3 -6
  177. package/dist/commands/claude/plugin/plugin-validators.js.map +1 -1
  178. package/dist/commands/claude/plugin/tree-copy.d.ts +73 -0
  179. package/dist/commands/claude/plugin/tree-copy.d.ts.map +1 -1
  180. package/dist/commands/claude/plugin/tree-copy.js +221 -14
  181. package/dist/commands/claude/plugin/tree-copy.js.map +1 -1
  182. package/dist/commands/claude/plugin/uninstall.d.ts.map +1 -1
  183. package/dist/commands/claude/plugin/uninstall.js +4 -4
  184. package/dist/commands/claude/plugin/uninstall.js.map +1 -1
  185. package/dist/commands/consistency-check.d.ts +17 -15
  186. package/dist/commands/consistency-check.d.ts.map +1 -1
  187. package/dist/commands/consistency-check.js +152 -106
  188. package/dist/commands/consistency-check.js.map +1 -1
  189. package/dist/commands/corpus/index.d.ts.map +1 -1
  190. package/dist/commands/corpus/index.js +3 -0
  191. package/dist/commands/corpus/index.js.map +1 -1
  192. package/dist/commands/corpus/report.d.ts +1 -2
  193. package/dist/commands/corpus/report.d.ts.map +1 -1
  194. package/dist/commands/corpus/report.js +1 -3
  195. package/dist/commands/corpus/report.js.map +1 -1
  196. package/dist/commands/corpus/runner.d.ts +58 -1
  197. package/dist/commands/corpus/runner.d.ts.map +1 -1
  198. package/dist/commands/corpus/runner.js +95 -41
  199. package/dist/commands/corpus/runner.js.map +1 -1
  200. package/dist/commands/corpus/scan.d.ts.map +1 -1
  201. package/dist/commands/corpus/scan.js +20 -12
  202. package/dist/commands/corpus/scan.js.map +1 -1
  203. package/dist/commands/corpus/seed.d.ts +4 -4
  204. package/dist/commands/corpus/seed.d.ts.map +1 -1
  205. package/dist/commands/corpus/seed.js +1 -3
  206. package/dist/commands/corpus/seed.js.map +1 -1
  207. package/dist/commands/doctor.d.ts +50 -0
  208. package/dist/commands/doctor.d.ts.map +1 -1
  209. package/dist/commands/doctor.js +245 -52
  210. package/dist/commands/doctor.js.map +1 -1
  211. package/dist/commands/inventory.d.ts +13 -1
  212. package/dist/commands/inventory.d.ts.map +1 -1
  213. package/dist/commands/inventory.js +121 -17
  214. package/dist/commands/inventory.js.map +1 -1
  215. package/dist/commands/mcp/collections.d.ts +1 -1
  216. package/dist/commands/mcp/collections.d.ts.map +1 -1
  217. package/dist/commands/mcp/list-collections.d.ts.map +1 -1
  218. package/dist/commands/mcp/list-collections.js +2 -1
  219. package/dist/commands/mcp/list-collections.js.map +1 -1
  220. package/dist/commands/mcp/serve.d.ts.map +1 -1
  221. package/dist/commands/mcp/serve.js +3 -2
  222. package/dist/commands/mcp/serve.js.map +1 -1
  223. package/dist/commands/okf/index.d.ts +11 -0
  224. package/dist/commands/okf/index.d.ts.map +1 -0
  225. package/dist/commands/okf/index.js +114 -0
  226. package/dist/commands/okf/index.js.map +1 -0
  227. package/dist/commands/okf/validate.d.ts +191 -0
  228. package/dist/commands/okf/validate.d.ts.map +1 -0
  229. package/dist/commands/okf/validate.js +190 -0
  230. package/dist/commands/okf/validate.js.map +1 -0
  231. package/dist/commands/phase-utils.d.ts +182 -114
  232. package/dist/commands/phase-utils.d.ts.map +1 -1
  233. package/dist/commands/phase-utils.js +154 -163
  234. package/dist/commands/phase-utils.js.map +1 -1
  235. package/dist/commands/positional-args.d.ts.map +1 -1
  236. package/dist/commands/positional-args.js +3 -2
  237. package/dist/commands/positional-args.js.map +1 -1
  238. package/dist/commands/rag/clear-command.d.ts.map +1 -1
  239. package/dist/commands/rag/clear-command.js +2 -1
  240. package/dist/commands/rag/clear-command.js.map +1 -1
  241. package/dist/commands/rag/index-command.d.ts +64 -0
  242. package/dist/commands/rag/index-command.d.ts.map +1 -1
  243. package/dist/commands/rag/index-command.js +72 -6
  244. package/dist/commands/rag/index-command.js.map +1 -1
  245. package/dist/commands/rag/index.d.ts.map +1 -1
  246. package/dist/commands/rag/index.js +23 -10
  247. package/dist/commands/rag/index.js.map +1 -1
  248. package/dist/commands/rag/query-command.d.ts.map +1 -1
  249. package/dist/commands/rag/query-command.js +2 -1
  250. package/dist/commands/rag/query-command.js.map +1 -1
  251. package/dist/commands/rag/stats-command.d.ts.map +1 -1
  252. package/dist/commands/rag/stats-command.js +2 -1
  253. package/dist/commands/rag/stats-command.js.map +1 -1
  254. package/dist/commands/resources/builtin-help.d.ts +27 -0
  255. package/dist/commands/resources/builtin-help.d.ts.map +1 -0
  256. package/dist/commands/resources/builtin-help.js +46 -0
  257. package/dist/commands/resources/builtin-help.js.map +1 -0
  258. package/dist/commands/resources/check-progress.d.ts +154 -0
  259. package/dist/commands/resources/check-progress.d.ts.map +1 -0
  260. package/dist/commands/resources/check-progress.js +222 -0
  261. package/dist/commands/resources/check-progress.js.map +1 -0
  262. package/dist/commands/resources/check-supervisor.d.ts +465 -0
  263. package/dist/commands/resources/check-supervisor.d.ts.map +1 -0
  264. package/dist/commands/resources/check-supervisor.js +573 -0
  265. package/dist/commands/resources/check-supervisor.js.map +1 -0
  266. package/dist/commands/resources/check.d.ts +593 -0
  267. package/dist/commands/resources/check.d.ts.map +1 -0
  268. package/dist/commands/resources/check.js +1365 -0
  269. package/dist/commands/resources/check.js.map +1 -0
  270. package/dist/commands/resources/index.d.ts.map +1 -1
  271. package/dist/commands/resources/index.js +418 -4
  272. package/dist/commands/resources/index.js.map +1 -1
  273. package/dist/commands/resources/query.d.ts +106 -0
  274. package/dist/commands/resources/query.d.ts.map +1 -0
  275. package/dist/commands/resources/query.js +177 -0
  276. package/dist/commands/resources/query.js.map +1 -0
  277. package/dist/commands/resources/scan.d.ts +24 -0
  278. package/dist/commands/resources/scan.d.ts.map +1 -1
  279. package/dist/commands/resources/scan.js +17 -8
  280. package/dist/commands/resources/scan.js.map +1 -1
  281. package/dist/commands/resources/validate.d.ts +42 -2
  282. package/dist/commands/resources/validate.d.ts.map +1 -1
  283. package/dist/commands/resources/validate.js +208 -55
  284. package/dist/commands/resources/validate.js.map +1 -1
  285. package/dist/commands/skill/review-checklist.d.ts +3 -2
  286. package/dist/commands/skill/review-checklist.d.ts.map +1 -1
  287. package/dist/commands/skill/review-checklist.js +40 -2
  288. package/dist/commands/skill/review-checklist.js.map +1 -1
  289. package/dist/commands/skill/review.d.ts +247 -0
  290. package/dist/commands/skill/review.d.ts.map +1 -1
  291. package/dist/commands/skill/review.js +99 -62
  292. package/dist/commands/skill/review.js.map +1 -1
  293. package/dist/commands/skill/test/configure.d.ts +56 -0
  294. package/dist/commands/skill/test/configure.d.ts.map +1 -1
  295. package/dist/commands/skill/test/configure.js +75 -16
  296. package/dist/commands/skill/test/configure.js.map +1 -1
  297. package/dist/commands/skill/test/run.d.ts +63 -10
  298. package/dist/commands/skill/test/run.d.ts.map +1 -1
  299. package/dist/commands/skill/test/run.js +258 -77
  300. package/dist/commands/skill/test/run.js.map +1 -1
  301. package/dist/commands/skills/build.d.ts +94 -4
  302. package/dist/commands/skills/build.d.ts.map +1 -1
  303. package/dist/commands/skills/build.js +325 -97
  304. package/dist/commands/skills/build.js.map +1 -1
  305. package/dist/commands/skills/install.d.ts +2 -1
  306. package/dist/commands/skills/install.d.ts.map +1 -1
  307. package/dist/commands/skills/install.js +20 -31
  308. package/dist/commands/skills/install.js.map +1 -1
  309. package/dist/commands/skills/list.d.ts +2 -1
  310. package/dist/commands/skills/list.d.ts.map +1 -1
  311. package/dist/commands/skills/list.js +44 -26
  312. package/dist/commands/skills/list.js.map +1 -1
  313. package/dist/commands/skills/package.d.ts +1 -1
  314. package/dist/commands/skills/package.d.ts.map +1 -1
  315. package/dist/commands/skills/package.js +6 -8
  316. package/dist/commands/skills/package.js.map +1 -1
  317. package/dist/commands/skills/scope-guard.d.ts.map +1 -1
  318. package/dist/commands/skills/scope-guard.js +3 -5
  319. package/dist/commands/skills/scope-guard.js.map +1 -1
  320. package/dist/commands/skills/shared.d.ts.map +1 -1
  321. package/dist/commands/skills/shared.js +2 -4
  322. package/dist/commands/skills/shared.js.map +1 -1
  323. package/dist/commands/skills/skill-discovery.d.ts +47 -6
  324. package/dist/commands/skills/skill-discovery.d.ts.map +1 -1
  325. package/dist/commands/skills/skill-discovery.js +61 -11
  326. package/dist/commands/skills/skill-discovery.js.map +1 -1
  327. package/dist/commands/skills/source-resolvers.d.ts +15 -0
  328. package/dist/commands/skills/source-resolvers.d.ts.map +1 -1
  329. package/dist/commands/skills/source-resolvers.js +25 -4
  330. package/dist/commands/skills/source-resolvers.js.map +1 -1
  331. package/dist/commands/skills/validate-command.d.ts.map +1 -1
  332. package/dist/commands/skills/validate-command.js +11 -3
  333. package/dist/commands/skills/validate-command.js.map +1 -1
  334. package/dist/commands/skills/validate.d.ts +140 -4
  335. package/dist/commands/skills/validate.d.ts.map +1 -1
  336. package/dist/commands/skills/validate.js +224 -67
  337. package/dist/commands/skills/validate.js.map +1 -1
  338. package/dist/commands/validate.d.ts +1 -1
  339. package/dist/commands/validate.d.ts.map +1 -1
  340. package/dist/commands/validate.js +63 -27
  341. package/dist/commands/validate.js.map +1 -1
  342. package/dist/commands/verify.d.ts +119 -15
  343. package/dist/commands/verify.d.ts.map +1 -1
  344. package/dist/commands/verify.js +357 -142
  345. package/dist/commands/verify.js.map +1 -1
  346. package/dist/index.d.ts +0 -1
  347. package/dist/index.d.ts.map +1 -1
  348. package/dist/index.js +5 -1
  349. package/dist/index.js.map +1 -1
  350. package/dist/report-schemas.d.ts +45 -0
  351. package/dist/report-schemas.d.ts.map +1 -0
  352. package/dist/report-schemas.js +100 -0
  353. package/dist/report-schemas.js.map +1 -0
  354. package/dist/skill-resolution/classify.js +2 -2
  355. package/dist/skill-resolution/classify.js.map +1 -1
  356. package/dist/skill-resolution/packaging-config.d.ts +49 -5
  357. package/dist/skill-resolution/packaging-config.d.ts.map +1 -1
  358. package/dist/skill-resolution/packaging-config.js +59 -19
  359. package/dist/skill-resolution/packaging-config.js.map +1 -1
  360. package/dist/skill-resolution/resolve-skill-reference.d.ts.map +1 -1
  361. package/dist/skill-resolution/resolve-skill-reference.js +55 -57
  362. package/dist/skill-resolution/resolve-skill-reference.js.map +1 -1
  363. package/dist/utils/agent-discovery.d.ts.map +1 -1
  364. package/dist/utils/agent-discovery.js +22 -11
  365. package/dist/utils/agent-discovery.js.map +1 -1
  366. package/dist/utils/agent-runner.d.ts.map +1 -1
  367. package/dist/utils/agent-runner.js +7 -4
  368. package/dist/utils/agent-runner.js.map +1 -1
  369. package/dist/utils/claude-context-lens.d.ts +34 -0
  370. package/dist/utils/claude-context-lens.d.ts.map +1 -0
  371. package/dist/utils/claude-context-lens.js +39 -0
  372. package/dist/utils/claude-context-lens.js.map +1 -0
  373. package/dist/utils/command-error.d.ts +138 -20
  374. package/dist/utils/command-error.d.ts.map +1 -1
  375. package/dist/utils/command-error.js +172 -36
  376. package/dist/utils/command-error.js.map +1 -1
  377. package/dist/utils/config-loader.d.ts +2 -1
  378. package/dist/utils/config-loader.d.ts.map +1 -1
  379. package/dist/utils/config-loader.js +40 -14
  380. package/dist/utils/config-loader.js.map +1 -1
  381. package/dist/utils/corpus-target.d.ts +26 -0
  382. package/dist/utils/corpus-target.d.ts.map +1 -0
  383. package/dist/utils/corpus-target.js +35 -0
  384. package/dist/utils/corpus-target.js.map +1 -0
  385. package/dist/utils/edge-lens-evaluation.d.ts +83 -0
  386. package/dist/utils/edge-lens-evaluation.d.ts.map +1 -0
  387. package/dist/utils/edge-lens-evaluation.js +110 -0
  388. package/dist/utils/edge-lens-evaluation.js.map +1 -0
  389. package/dist/utils/help-loader.d.ts.map +1 -1
  390. package/dist/utils/help-loader.js +0 -1
  391. package/dist/utils/help-loader.js.map +1 -1
  392. package/dist/utils/issue-anchor.d.ts +2 -2
  393. package/dist/utils/issue-anchor.d.ts.map +1 -1
  394. package/dist/utils/issue-anchor.js +1 -1
  395. package/dist/utils/issue-rendering.d.ts +3 -3
  396. package/dist/utils/issue-rendering.d.ts.map +1 -1
  397. package/dist/utils/issue-rendering.js +3 -3
  398. package/dist/utils/issue-rendering.js.map +1 -1
  399. package/dist/utils/issue-severity.d.ts +12 -5
  400. package/dist/utils/issue-severity.d.ts.map +1 -1
  401. package/dist/utils/issue-severity.js +1 -1
  402. package/dist/utils/issue-severity.js.map +1 -1
  403. package/dist/utils/optional-backend.d.ts +78 -0
  404. package/dist/utils/optional-backend.d.ts.map +1 -0
  405. package/dist/utils/optional-backend.js +117 -0
  406. package/dist/utils/optional-backend.js.map +1 -0
  407. package/dist/utils/output.d.ts +26 -0
  408. package/dist/utils/output.d.ts.map +1 -1
  409. package/dist/utils/output.js +35 -0
  410. package/dist/utils/output.js.map +1 -1
  411. package/dist/utils/package-json.d.ts +24 -0
  412. package/dist/utils/package-json.d.ts.map +1 -0
  413. package/dist/utils/package-json.js +49 -0
  414. package/dist/utils/package-json.js.map +1 -0
  415. package/dist/utils/population-wiring.d.ts +100 -0
  416. package/dist/utils/population-wiring.d.ts.map +1 -0
  417. package/dist/utils/population-wiring.js +98 -0
  418. package/dist/utils/population-wiring.js.map +1 -0
  419. package/dist/utils/project-root-policy.d.ts +20 -0
  420. package/dist/utils/project-root-policy.d.ts.map +1 -1
  421. package/dist/utils/project-root-policy.js +30 -0
  422. package/dist/utils/project-root-policy.js.map +1 -1
  423. package/dist/utils/projection-lenses.d.ts +98 -0
  424. package/dist/utils/projection-lenses.d.ts.map +1 -0
  425. package/dist/utils/projection-lenses.js +203 -0
  426. package/dist/utils/projection-lenses.js.map +1 -0
  427. package/dist/utils/projection-query.d.ts +324 -0
  428. package/dist/utils/projection-query.d.ts.map +1 -0
  429. package/dist/utils/projection-query.js +357 -0
  430. package/dist/utils/projection-query.js.map +1 -0
  431. package/dist/utils/projection-store.d.ts +335 -0
  432. package/dist/utils/projection-store.d.ts.map +1 -0
  433. package/dist/utils/projection-store.js +522 -0
  434. package/dist/utils/projection-store.js.map +1 -0
  435. package/dist/utils/relation-limits.d.ts +50 -0
  436. package/dist/utils/relation-limits.d.ts.map +1 -0
  437. package/dist/utils/relation-limits.js +50 -0
  438. package/dist/utils/relation-limits.js.map +1 -0
  439. package/dist/utils/repeatable-option.d.ts +37 -0
  440. package/dist/utils/repeatable-option.d.ts.map +1 -0
  441. package/dist/utils/repeatable-option.js +39 -0
  442. package/dist/utils/repeatable-option.js.map +1 -0
  443. package/dist/utils/resource-loader.d.ts +132 -2
  444. package/dist/utils/resource-loader.d.ts.map +1 -1
  445. package/dist/utils/resource-loader.js +288 -27
  446. package/dist/utils/resource-loader.js.map +1 -1
  447. package/dist/utils/root-argv.d.ts +53 -0
  448. package/dist/utils/root-argv.d.ts.map +1 -0
  449. package/dist/utils/root-argv.js +215 -0
  450. package/dist/utils/root-argv.js.map +1 -0
  451. package/dist/utils/run-integrity.d.ts +95 -0
  452. package/dist/utils/run-integrity.d.ts.map +1 -0
  453. package/dist/utils/run-integrity.js +102 -0
  454. package/dist/utils/run-integrity.js.map +1 -0
  455. package/dist/utils/skill-discovery.d.ts.map +1 -1
  456. package/dist/utils/skill-discovery.js +2 -1
  457. package/dist/utils/skill-discovery.js.map +1 -1
  458. package/dist/utils/skill-packaging-config.d.ts +63 -1
  459. package/dist/utils/skill-packaging-config.d.ts.map +1 -1
  460. package/dist/utils/skill-packaging-config.js +56 -1
  461. package/dist/utils/skill-packaging-config.js.map +1 -1
  462. package/dist/utils/sqlite-experimental-warning.d.ts +69 -0
  463. package/dist/utils/sqlite-experimental-warning.d.ts.map +1 -0
  464. package/dist/utils/sqlite-experimental-warning.js +144 -0
  465. package/dist/utils/sqlite-experimental-warning.js.map +1 -0
  466. package/dist/utils/url-redact.d.ts.map +1 -1
  467. package/dist/utils/url-redact.js +4 -6
  468. package/dist/utils/url-redact.js.map +1 -1
  469. package/dist/utils/user-context-scanner.d.ts +8 -0
  470. package/dist/utils/user-context-scanner.d.ts.map +1 -1
  471. package/dist/utils/user-context-scanner.js +4 -2
  472. package/dist/utils/user-context-scanner.js.map +1 -1
  473. package/dist/utils/validate-help-files.d.ts.map +1 -1
  474. package/dist/utils/validate-help-files.js +12 -6
  475. package/dist/utils/validate-help-files.js.map +1 -1
  476. package/dist/utils/vat-bin-path.d.ts +36 -0
  477. package/dist/utils/vat-bin-path.d.ts.map +1 -0
  478. package/dist/utils/vat-bin-path.js +48 -0
  479. package/dist/utils/vat-bin-path.js.map +1 -0
  480. package/dist/utils/verdict-helpers.d.ts +1 -1
  481. package/dist/utils/verdict-helpers.d.ts.map +1 -1
  482. package/dist/utils/verdict-helpers.js +1 -1
  483. package/dist/utils/verdict-helpers.js.map +1 -1
  484. package/dist/version.d.ts.map +1 -1
  485. package/dist/version.js +1 -3
  486. package/dist/version.js.map +1 -1
  487. package/docs/agent.md +2 -2
  488. package/docs/audit.md +141 -37
  489. package/docs/doctor.md +7 -6
  490. package/docs/index.md +19 -11
  491. package/docs/mcp.md +2 -2
  492. package/docs/rag.md +3 -2
  493. package/docs/resources.md +13 -3
  494. package/docs/skill-test.md +10 -9
  495. package/docs/skills.md +53 -69
  496. package/package.json +35 -26
  497. package/schemas/ard-emit.json +149 -0
  498. package/schemas/okf-validate.json +170 -0
  499. package/schemas/resources-check.json +229 -0
  500. package/schemas/skill-review.json +230 -0
  501. package/dist/commands/resources/command-helpers.d.ts +0 -5
  502. package/dist/commands/resources/command-helpers.d.ts.map +0 -1
  503. package/dist/commands/resources/command-helpers.js +0 -6
  504. package/dist/commands/resources/command-helpers.js.map +0 -1
@@ -0,0 +1,522 @@
1
+ /**
2
+ * Selecting, opening and keying the **projection store** — the cross-process
3
+ * cache that makes a second population of an unchanged tree cheap.
4
+ *
5
+ * ## Why the CLI owns this and `resources` does not
6
+ *
7
+ * `@vibe-agent-toolkit/resources` states the {@link ProjectionStore} contract
8
+ * and never picks a backend, for the same reason it states the parse contract
9
+ * and never picks a parser: it is the toolkit's most widely installed package,
10
+ * and a storage engine is a *choice*. The choice is made here, at the edge that
11
+ * already owns every other optional backend — see `optional-backend.ts`, whose
12
+ * header names a projection store as one of the shapes it exists for.
13
+ *
14
+ * So `populate()` takes a {@link PopulationCache} it is handed, and this module
15
+ * is the only place in the toolkit that knows `@vibe-agent-toolkit/projection-
16
+ * sqlite` exists.
17
+ *
18
+ * ## The key, and why it is a whole-repository tree hash
19
+ *
20
+ * A stored extent is filed under `(rootId, treeHash)`. `populate()` derives the
21
+ * root id itself so a caller cannot file one root's contents under another's;
22
+ * this module supplies the other half.
23
+ *
24
+ * {@link gitTreeSnapshot} answers it with `git write-tree` against a throwaway
25
+ * index, which covers staged edits, unstaged edits and untracked files, and
26
+ * carries **no timestamp** — byte-identical content always produces the same
27
+ * hash. 🪤 Never `git stash create`: a stash is a *commit*, so two calls over
28
+ * identical content agree only within the same wall-clock second, and every
29
+ * read would miss.
30
+ *
31
+ * ⚠️ That hash covers the whole **repository**, not the subtree the root names.
32
+ * An edit anywhere in the repository therefore cools the cache for every root
33
+ * inside it. This is conservative in the safe direction and cheap to be
34
+ * conservative about — `git write-tree` against a throwaway index is the same
35
+ * call `vibe-validate` makes on every commit.
36
+ *
37
+ * ## An opted-in cache that quietly does nothing is worse than no cache
38
+ *
39
+ * Every failure here is loud, and that is deliberate rather than harsh. A
40
+ * selector nobody honours produces a measurement arm that believes it is
41
+ * testing a cache and is testing an ordinary cold run — the "subject that
42
+ * exercises nothing looks like a clean result" failure that has already cost
43
+ * this project one whole A/B. So an uninstalled backend exits with the seam's
44
+ * standard legible error, and a tree that cannot be keyed says so on stderr
45
+ * rather than silently declining.
46
+ */
47
+ import { AsyncLocalStorage } from 'node:async_hooks';
48
+ import { parseEnvBoolean } from '@vibe-agent-toolkit/utils';
49
+ import { freshGitTreeSnapshot, gitTreeSnapshot, withGitSnapshotCache } from '@vibe-agent-toolkit/utils/git';
50
+ import { isModuleMissing, reportMissingBackend } from './optional-backend.js';
51
+ import { installSqliteWarningFilter } from './sqlite-experimental-warning.js';
52
+ /**
53
+ * The env var that selects — or now, DESELECTS — a projection store for this
54
+ * process.
55
+ *
56
+ * 🔑 **The store is on by default, so this is the escape hatch rather than the
57
+ * selector.** Same shape and same reason as `VAT_RESOURCES_CRAWL`: any value the
58
+ * off-parser does not read as false leaves the store selected, including the
59
+ * historical `sqlite`, so every script and lab arm that names it explicitly
60
+ * keeps working and keeps MEANING the same thing. See
61
+ * {@link PROJECTION_STORE_OFF} for the one way out.
62
+ *
63
+ * An environment switch rather than a config field, for the same reason
64
+ * `VAT_INVENTORY_CRAWL` and `VAT_RESOURCES_CRAWL` are: it selects which
65
+ * INSTRUMENT runs, not what the project means, and it has to be reachable from
66
+ * the lab, which spawns the binary and controls its environment. A config field
67
+ * would put the A and B arms inside the subject's own tree, where a measurement
68
+ * edits the thing it measures.
69
+ *
70
+ * 🔑 It is read from the environment, and **every phase now runs in the process
71
+ * that read it**, so `vat validate`'s phases cannot fail to see the selection
72
+ * their orchestrator did. Which lanes share a store within one verb and across
73
+ * invocations, with the measurements, and the ⚠️ one packaging enumeration still
74
+ * on the walk: `docs/architecture/resource-scanning-and-caching.md` §3.7.
75
+ */
76
+ export const PROJECTION_STORE_ENV = 'VAT_PROJECTION_STORE';
77
+ /**
78
+ * {@link PROJECTION_STORE_ENV}'s value that names the SQLite backend. Redundant
79
+ * with the default now, and kept — see
80
+ * `docs/architecture/resource-scanning-and-caching.md` §3.7.
81
+ */
82
+ export const PROJECTION_STORE_SQLITE = 'sqlite';
83
+ /**
84
+ * The value that turns the store OFF while leaving VAT's other caches on.
85
+ *
86
+ * Read through the same {@link parseEnvBoolean} as every other VAT switch, so
87
+ * `0`, `false`, `no` and `n` work too. The empty string joins them: unlike
88
+ * {@link PROJECTION_STORE_DIR_ENV}, where empty falls back to a default
89
+ * directory that means something, there is nothing else for a cleared selector
90
+ * to mean.
91
+ */
92
+ export const PROJECTION_STORE_OFF = 'off';
93
+ /**
94
+ * Where the projection store's database lives, overriding the default.
95
+ *
96
+ * The default is `tmpdir/.vat-cache/<version>/projection-<shapeDigest>` — one
97
+ * database per VAT release, shared by every root on the machine. This names a
98
+ * different one **explicitly**, which is what an adopter with a per-job cache
99
+ * directory, a shared build agent running two jobs at once, or a test arm that
100
+ * must not touch the developer's live cache actually needs.
101
+ *
102
+ * 🪤 **What it replaces is redirecting `TMPDIR`, which works and is the wrong
103
+ * instrument.** `defaultStoreDirectory()` resolves through
104
+ * `vatCacheNamespaceRoot()` → `normalizedTmpdir()`, so pointing the OS temp
105
+ * directory elsewhere does move the store — along with every other temp
106
+ * consumer in the process, on a variable whose name is not the same on both
107
+ * platforms (`TMPDIR` on POSIX; `TEMP`, then `TMP`, on Windows, so setting one
108
+ * is silently inert on the other). It relocates the store as a side effect of
109
+ * relocating something larger. This variable says the one thing meant.
110
+ *
111
+ * ⚠️ It does **not** consult `XDG_CACHE_HOME` or `HOME`. A caller that set
112
+ * those believed it had its own database and was writing into the shared one;
113
+ * the fix is to name the directory here, not to add more implicit roots.
114
+ *
115
+ * An environment variable rather than a config field, for the same reason
116
+ * {@link PROJECTION_STORE_ENV} is one: it says where an INSTRUMENT keeps its
117
+ * scratch space, not what the project means, and it has to be reachable from a
118
+ * harness that spawns the binary.
119
+ */
120
+ export const PROJECTION_STORE_DIR_ENV = 'VAT_PROJECTION_STORE_DIR';
121
+ /**
122
+ * The env var that turns VAT's disk caches off for a run.
123
+ *
124
+ * Not this module's invention — `ParseCache` has read it since the parse cache
125
+ * shipped, and `vat`'s root `--no-cache` exports it from a `preAction` hook so
126
+ * the decision reaches every spawned phase. Named here rather than spelled
127
+ * inline so the projection store is visibly the same tenant as the caches the
128
+ * flag was written for.
129
+ */
130
+ export const CACHE_ENV = 'VAT_CACHE';
131
+ /**
132
+ * The backend as a user is told to install it.
133
+ *
134
+ * Named separately from the RAG backend's entry because the *reason* it ships
135
+ * apart is different, and the install message is the only place a user learns
136
+ * it: RAG carries a platform-native binary, while this one carries a Node
137
+ * version floor.
138
+ */
139
+ /** What Node throws for `import('node:sqlite')` when it is absent or still flagged. */
140
+ const UNKNOWN_BUILTIN_MODULE = 'ERR_UNKNOWN_BUILTIN_MODULE';
141
+ const PROJECTION_STORE_BACKEND = {
142
+ feature: 'The projection store',
143
+ packageName: '@vibe-agent-toolkit/projection-sqlite',
144
+ };
145
+ /**
146
+ * Whether this process should read and write a projection store.
147
+ *
148
+ * **On unless turned off.** It used to be the opposite; the measurement that
149
+ * paid for the flip, and the blob-tier bound that had to land first, are in
150
+ * `docs/architecture/resource-scanning-and-caching.md` §3.7.
151
+ *
152
+ * Read from the environment at each call rather than memoized at module load:
153
+ * `vitest.setup.js` deletes every `VAT_*` variable before any test module
154
+ * loads, so a module-level binding would make the switch unobservable to every
155
+ * test that sets it.
156
+ *
157
+ * ## The two switches are AND-ed, and the second one is a veto
158
+ *
159
+ * {@link PROJECTION_STORE_ENV} turns off THIS cache; {@link CACHE_ENV} says
160
+ * whether this run caches at all. A store selected while `VAT_CACHE=0` was
161
+ * measured writing a 9.8 MB, 18,079-row store on this repository and hitting it
162
+ * on the next run — a user who asked for no cache silently got one, and
163
+ * `vat cache`'s own help text described three caches while a fourth was being
164
+ * written beside them.
165
+ *
166
+ * 🪤 Read through `parseEnvBoolean`, never for truthiness — `VAT_CACHE=1` is
167
+ * the value an operator writes to turn caching ON, and a truthiness test would
168
+ * read it as a reason to decline. It was previously a comparison against the
169
+ * literal `'0'`, which is the same shape `ParseCache` carried and the same
170
+ * defect: `VAT_CACHE=false` disabled nothing. The two now share one parser
171
+ * (`@vibe-agent-toolkit/utils`) so the variable cannot be read two ways again.
172
+ *
173
+ * Only an explicit `false` vetoes. `parseEnvBoolean` returns `undefined` for a
174
+ * value it cannot read, and an unreadable value is not something the operator
175
+ * said — the veto has to be a statement, not a shrug. That reading is why both
176
+ * variables can be read through ONE parser even though they now sit on
177
+ * opposite default sides: each asks only whether the operator SAID no.
178
+ *
179
+ * @returns `true` when a store is selected
180
+ */
181
+ export function projectionStoreSelected() {
182
+ if (parseEnvBoolean(process.env[CACHE_ENV]) === false)
183
+ return false;
184
+ const selector = process.env[PROJECTION_STORE_ENV];
185
+ // Unset is the default and the default is on.
186
+ if (selector === undefined)
187
+ return true;
188
+ // `VAT_PROJECTION_STORE=` — see PROJECTION_STORE_OFF on why empty is off here
189
+ // and unset-equivalent in the directory variable.
190
+ if (selector.trim() === '')
191
+ return false;
192
+ return parseEnvBoolean(selector) !== false;
193
+ }
194
+ /**
195
+ * Open the projection store this process selected, keyed to one tree.
196
+ *
197
+ * Returns `undefined` when no store is selected, and when the tree cannot be
198
+ * keyed — the two "carry on without a cache" answers. It does **not** return
199
+ * `undefined` for an uninstalled backend: the store is on unless a user turned it
200
+ * off, and answering that by silently not having one is how a default-on cache
201
+ * becomes an unmeasured one.
202
+ *
203
+ * @param options - Where the corpus is
204
+ * @param options.root - The absolute corpus root. Used to find the repository;
205
+ * the resulting hash covers that whole repository, not this subtree
206
+ * @returns The cache and its closer, or `undefined` to populate uncached
207
+ */
208
+ export async function openPopulationCache(options) {
209
+ if (!projectionStoreSelected())
210
+ return undefined;
211
+ // Before the import, so a corpus outside a repository costs nothing and says
212
+ // why. `gitTreeSnapshot` returns null for every "git could not answer" case —
213
+ // no `git` on PATH, not a repository, a bare or unreadable one — and an empty
214
+ // snapshot of an initialized repository stays distinguishable from it.
215
+ const snapshot = gitTreeSnapshot({ cwd: options.root });
216
+ if (snapshot === null) {
217
+ // Not "the selector is set": the store is on by default, so most users who
218
+ // see this never wrote the variable.
219
+ process.stderr.write(`The projection store is on, but ${options.root} is not inside a readable git`
220
+ + ' repository, so there is no deterministic key to store a projection under.'
221
+ + ` Populating without a cache. Set ${PROJECTION_STORE_ENV}=${PROJECTION_STORE_OFF} to silence this.\n`);
222
+ return undefined;
223
+ }
224
+ const store = await loadStore();
225
+ const cwd = options.root;
226
+ return {
227
+ cache: {
228
+ store,
229
+ treeHash: snapshot.hash,
230
+ treeUnchanged: () => freshGitTreeSnapshot({ cwd })?.hash === snapshot.hash,
231
+ },
232
+ close: () => store.close(),
233
+ };
234
+ }
235
+ /**
236
+ * Load the selected backend, or report it as uninstalled and exit.
237
+ *
238
+ * 🪤 Only `ERR_MODULE_NOT_FOUND` means "not installed". A Node older than
239
+ * 22.13.0 has no `node:sqlite` at all and fails with a *different* code, which
240
+ * must propagate as itself: "install this package" would be the wrong repair
241
+ * for "upgrade Node", and diagnosing a version floor as a missing dependency
242
+ * sends a user round a loop that cannot terminate.
243
+ *
244
+ * @returns The opened store, typed as the engine-free contract — the SQLite
245
+ * backend really does return a `SqlQueryableStore`, and this narrows it away
246
+ * on purpose so the population path cannot grow a query
247
+ */
248
+ async function loadStore() {
249
+ const directory = process.env[PROJECTION_STORE_DIR_ENV];
250
+ // Spread rather than passed, because the backend defaults the field when it is
251
+ // ABSENT and an explicit `undefined` is a different argument under
252
+ // `exactOptionalPropertyTypes`. Empty string is treated as unset: an unset
253
+ // variable and one exported as `''` are the same intent, and `''` would
254
+ // otherwise resolve to the process cwd.
255
+ return (await loadBackend()).openSqliteProjectionStore(directory === undefined || directory === '' ? {} : { directory });
256
+ }
257
+ /**
258
+ * Open a store that lives only in this process's memory.
259
+ *
260
+ * 🔑 **This is what keeps the query surface an ANSWER rather than a privilege.**
261
+ * A caller with no store selected — CI's first run, or a developer who never set
262
+ * the selector — still gets the same SQL over the same schema; the on-disk store
263
+ * only makes the second run cheap. Without it, "what does this tree contain"
264
+ * would be answerable only where a cache happened to exist, and two callers
265
+ * would hold differently-shaped views of one tree.
266
+ *
267
+ * It is a cache that cannot hit: nothing survives the close, so a caller must
268
+ * write the projection into it before asking anything.
269
+ *
270
+ * @returns An open, empty store; close it when done
271
+ */
272
+ export async function openEphemeralQueryStore() {
273
+ return (await loadBackend()).openEphemeralProjectionStore();
274
+ }
275
+ /**
276
+ * Open a compile-only probe over the full queryable schema, derived relations
277
+ * included — for checking statements BEFORE any population or lens has run.
278
+ *
279
+ * ⚠️ Not {@link openEphemeralQueryStore}: that store has no table for a derived
280
+ * relation until a lens fills it, which is how an unevaluated one is refused.
281
+ *
282
+ * @returns An open probe; close it when done
283
+ */
284
+ export async function openCompileProbe() {
285
+ return (await loadBackend()).openProjectionCompileProbe();
286
+ }
287
+ /**
288
+ * Load the selected backend module, or report it as uninstalled and exit.
289
+ *
290
+ * @returns The backend's module namespace
291
+ */
292
+ async function loadBackend() {
293
+ // `node:sqlite` emits one ExperimentalWarning as it loads, even on a Node that
294
+ // needs no flag for it. `projection-sqlite` refuses to suppress that itself —
295
+ // correctly, since a blanket NODE_NO_WARNINGS hides real warnings — and
296
+ // assigns the filter to whichever caller turns the backend on by default.
297
+ // That caller is this module, and this import is the boundary.
298
+ //
299
+ // Restored immediately afterwards: the warning fires at module evaluation, so
300
+ // holding the filter open any longer would start hiding warnings this import
301
+ // did not cause.
302
+ const restoreWarnings = installSqliteWarningFilter();
303
+ try {
304
+ return await import('@vibe-agent-toolkit/projection-sqlite');
305
+ }
306
+ catch (error) {
307
+ const floor = nodeSqliteFloorFailure(error);
308
+ if (floor !== undefined)
309
+ throw floor;
310
+ if (!isModuleMissing(error))
311
+ throw error;
312
+ reportMissingBackend(PROJECTION_STORE_BACKEND);
313
+ }
314
+ finally {
315
+ restoreWarnings();
316
+ }
317
+ }
318
+ /**
319
+ * The legible failure for "your Node is too old", or `undefined` when this is
320
+ * some other failure — including "the package is absent".
321
+ *
322
+ * Exported, and returning the error rather than throwing it, so the DIAGNOSIS
323
+ * is unit-testable without a mocked dynamic import. A test cannot make a mocked
324
+ * `import()` reject with a plain `{ code }` — the test runner wraps whatever a
325
+ * module factory throws in its own error, so the code never survives to be
326
+ * read — and the branch's whole value is the message it produces.
327
+ *
328
+ * 🪤 The two are **different error codes**, and only one of them reaches
329
+ * {@link isModuleMissing}. `@vibe-agent-toolkit/projection-sqlite` imports
330
+ * `node:sqlite`, which loads unflagged from Node 22.13.0 (it was added in 22.5.0
331
+ * behind `--experimental-sqlite`); on 22.0–22.12 an ordinary import fails
332
+ * with `ERR_UNKNOWN_BUILTIN_MODULE`, not `ERR_MODULE_NOT_FOUND`. Without this
333
+ * branch the user gets a bare `No such built-in module: node:sqlite` — which
334
+ * names neither the version floor nor the fix.
335
+ *
336
+ * ⚠️ It is reachable on an ordinary run and is not a corner: the query lane has
337
+ * always fallen back to {@link openEphemeralQueryStore} when no store is
338
+ * selected, which is the default, so `node:sqlite` is required on a default
339
+ * `vat resources query` whichever way the lane resolves its store.
340
+ *
341
+ * 🪤 This used to say "EVERY `vat resources query`/`check` run", and that was
342
+ * too strong for `check`. Measured against the built CLI on Node v24.13.1 by
343
+ * counting the `ExperimentalWarning` `node:sqlite` emits at load — the only
344
+ * externally visible tell that the module was reached at all:
345
+ *
346
+ * | Command | Warnings | Backend loaded? |
347
+ * |---|---|---|
348
+ * | `vat resources query "SELECT …"` | 1 | yes |
349
+ * | `vat resources check`, no checks declared | 0 | **no** |
350
+ *
351
+ * `check` reaches a store only when the project declares checks for it to
352
+ * evaluate, so a repo with none never loads the backend and never needed the
353
+ * floor for that command. The floor argument is unaffected — `query` alone
354
+ * establishes it — but "every default run of those two commands" was a claim
355
+ * nothing had counted.
356
+ *
357
+ * ✅ **VAT's declared floor is now `>=22.13.0`, so this no longer fires on a
358
+ * SUPPORTED Node.** It used to: the manifests said `>=22.0.0` while these two
359
+ * commands could not run below 22.13.0, which meant thirteen Node patch
360
+ * releases were advertised as supported and hard-failed here. The floor was
361
+ * raised to stop advertising what VAT cannot do. The branch stays load-bearing
362
+ * for the Node that is merely *installed* rather than supported — `engines` is
363
+ * a warning in npm and nothing at all under most runners, so a user on 22.4
364
+ * still reaches this and still deserves to be told which number is wrong.
365
+ *
366
+ * The repair stays distinct from the missing-package one on purpose:
367
+ * "install this package" is the wrong instruction for "upgrade Node", and
368
+ * sending someone round that loop cannot terminate.
369
+ *
370
+ * @param error - Whatever the dynamic import threw
371
+ * @returns The error to raise when Node itself lacks the builtin; `undefined`
372
+ * when this failure is something else and the caller should keep diagnosing
373
+ */
374
+ export function nodeSqliteFloorFailure(error) {
375
+ const isFloor = typeof error === 'object'
376
+ && error !== null
377
+ && 'code' in error
378
+ && error.code === UNKNOWN_BUILTIN_MODULE;
379
+ if (!isFloor)
380
+ return undefined;
381
+ return new Error('The projection store needs `node:sqlite`, which this Node does not have.'
382
+ // States the NODE fact (when the module arrived), never VAT's floor. The
383
+ // floor lives in `engines.node` and `vat doctor` derives it from there
384
+ // precisely so it has one home; restating it in a string would be the
385
+ // second copy that change exists to remove, and it would go stale silently
386
+ // the next time the floor moves.
387
+ + ` \`node:sqlite\` loads unflagged from Node 22.13.0 (added in 22.5.0 behind`
388
+ + ` \`--experimental-sqlite\`) — you are on ${process.version}.`
389
+ + ' Upgrade Node to 22.13.0 or newer. Installing a package will not help:'
390
+ + ' the module is built into Node, not published to npm.');
391
+ }
392
+ /**
393
+ * The population scope this async context is already inside, if any.
394
+ *
395
+ * `AsyncLocalStorage` and not a module-level variable, for the reason
396
+ * `withGitSnapshotCache` uses one: a scope has to end when its own frame ends
397
+ * and not when some other frame happens to finish, and a plain binding would
398
+ * leak the outer scope into anything that ran after it in the same tick.
399
+ */
400
+ const populationScope = new AsyncLocalStorage();
401
+ /**
402
+ * The already-open cache this scope may join, or `undefined` to open its own.
403
+ *
404
+ * Wrapped in a one-field object rather than returned bare, because `undefined`
405
+ * is a legitimate thing to JOIN — a run with the store off — and a bare return
406
+ * could not tell that from "open your own".
407
+ *
408
+ * @param active - The scope already open in this async context
409
+ * @param root - The corpus root the nested caller named
410
+ * @returns The cache to reuse (possibly `undefined`), or `undefined` to open
411
+ */
412
+ function joinableCache(active, root) {
413
+ // No store in this process, so there is nothing to key and every scope's
414
+ // answer is the same `undefined`. Also keeps uncached nesting free: no
415
+ // snapshot, no `gitFindRoot`.
416
+ if (!projectionStoreSelected())
417
+ return { cache: undefined };
418
+ // Selected, but the enclosing scope could not key its own root — outside a
419
+ // readable repository. That says nothing about THIS root, so ask again.
420
+ if (active === undefined)
421
+ return undefined;
422
+ // Memoized by the enclosing `withGitSnapshotCache` bracket, so a map lookup
423
+ // for a repository it has visited and a real snapshot only for one it has not.
424
+ const snapshot = gitTreeSnapshot({ cwd: root });
425
+ // 🔑 The tree hash, never "a scope is open". An extent is filed under
426
+ // `(rootId, treeHash)`, so a lane in another repository handed this one's hash
427
+ // would file its extent under a key that does not describe it — silently. Two
428
+ // roots inside ONE repository do share a hash: the key covers the repository.
429
+ return snapshot !== null && snapshot.hash === active.cache.treeHash ? { cache: active.cache } : undefined;
430
+ }
431
+ /**
432
+ * Open a store for this scope, run the work inside it, and close it.
433
+ *
434
+ * @param options - Where the corpus is
435
+ * @param options.root - The absolute corpus root
436
+ * @param work - Given the cache, or `undefined` when there is none to give
437
+ * @returns Whatever `work` returned
438
+ */
439
+ async function runOwnedScope(options, work) {
440
+ const opened = await openPopulationCache(options);
441
+ try {
442
+ // Registered even when nothing was opened, so a nested scope can tell "no
443
+ // store in this process" from "no scope above me" — and so the nested scope
444
+ // stays inside THIS scope's git-snapshot memo either way.
445
+ return await populationScope.run({ opened }, () => work(opened?.cache));
446
+ }
447
+ finally {
448
+ await opened?.close();
449
+ }
450
+ }
451
+ /**
452
+ * Run one command's work with a projection store open for its whole duration,
453
+ * and closed however it ends.
454
+ *
455
+ * A scope rather than a bare open/close pair, because the store must outlive the
456
+ * call that builds a population source and not merely the call that uses it: the
457
+ * inventory extractor MEMOIZES its population provider and may reach it well
458
+ * after the frame that supplied it has returned. A store closed at the end of
459
+ * that frame would be closed under its own consumer.
460
+ *
461
+ * It is also the `withGitSnapshotCache` bracket for the work inside it, so the
462
+ * key and the extent filed under it come from ONE git snapshot — see the note
463
+ * in the body.
464
+ *
465
+ * `undefined` on a run with no store selected, which is the shape every
466
+ * population lane wants: no store means re-derive, not fail.
467
+ *
468
+ * ⚠️ A caller that wants to run SQL must NOT query this store. It is one
469
+ * database per VAT release, shared by every root on the machine, so arbitrary
470
+ * SQL over it answers from other repositories — see `projection-query.ts`.
471
+ * That is also why this is the ONLY scope over the opened store: there is no
472
+ * separate "opened handle" bracket for a caller wanting more than the cache,
473
+ * because there is nothing legitimate for such a caller to want.
474
+ *
475
+ * ## 🔑 It NESTS, and the outermost scope wins
476
+ *
477
+ * A scope opened inside another over the same repository **joins** it: same
478
+ * cache by identity, no second database, no second `git write-tree`, and the
479
+ * inner scope does not close what it did not open. That lets an orchestrator
480
+ * hold one bracket over a whole run (`vat validate` does) while each lane
481
+ * underneath keeps its own and stays correct run alone. Reuse is gated on the
482
+ * TREE HASH, never on "a scope is open" — see {@link joinableCache}.
483
+ *
484
+ * ⚠️ The whole nest shares ONE snapshot, so work that must see its own edits as
485
+ * they land must not run inside a single scope. That is why a hoist is a
486
+ * decision rather than a refactor.
487
+ *
488
+ * @param options - Where the corpus is
489
+ * @param options.root - The absolute corpus root
490
+ * @param work - Given the cache, or `undefined` when there is none to give
491
+ * @returns Whatever `work` returned
492
+ */
493
+ export async function withPopulationCache(options, work) {
494
+ const active = populationScope.getStore();
495
+ if (active !== undefined) {
496
+ const joinable = joinableCache(active.opened, options.root);
497
+ // 🪤 No new git bracket on either path: an inner scope stays inside the
498
+ // outer one's memo, which is where the deduplication lives. A fresh bracket
499
+ // here would start an empty memo and re-snapshot the same repository — a
500
+ // dedupe that does nothing while looking exactly like one that works.
501
+ return joinable === undefined ? runOwnedScope(options, work) : work(joinable.cache);
502
+ }
503
+ // ONE git snapshot for the whole scope, and this is the level that gets it:
504
+ // `openPopulationCache` below takes one to derive the store key, and the crawl
505
+ // that runs inside `work` takes another to enumerate the extent — same
506
+ // repository, sequentially, ~195 ms and ~159 ms measured on a large monorepo.
507
+ //
508
+ // The correctness half matters more than the saving. Taken separately, a
509
+ // working-tree edit landing between them makes the two snapshots DIFFERENT
510
+ // answers, and the extent from the second is then filed under the key from the
511
+ // first: a cache entry whose key does not describe its contents, written
512
+ // silently. The bracket closes that race rather than merely deduplicating.
513
+ //
514
+ // Opened here rather than around either consumer because it must enclose BOTH
515
+ // — a bracket opened deeper than one of them dedupes nothing while looking
516
+ // exactly like a bracket that works. Every CLI entry into the projection lane
517
+ // (`inventory`, `resource-loader`'s two) reaches the store through this scope,
518
+ // and `vat validate`'s orchestrator holds one OUTSIDE all of them, which the
519
+ // nesting above is what makes safe.
520
+ return withGitSnapshotCache(() => runOwnedScope(options, work));
521
+ }
522
+ //# sourceMappingURL=projection-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projection-store.js","sourceRoot":"","sources":["../../src/utils/projection-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
2
+ * The stated bounds a SQL answer over the derived relations is published with.
3
+ *
4
+ * ## Why the SQL route states bounds at all
5
+ *
6
+ * `vat claude context` attaches `CLAUDE_CONTEXT_LIMITS` to every answer it
7
+ * gives, on the rule spelled in that module: *a limit a reader has to go and
8
+ * find is a limit that does not reach the person acting on the number.* The
9
+ * same measurement is reachable as `claude_context_chains` /
10
+ * `claude_context_loads` rows, and this route published none of them — so the
11
+ * lane an adopter can make GATE their build was the lane with no caveats
12
+ * attached, which is the wrong way round. VAT ships no context budget of its
13
+ * own; the adopter's `resources.checks` statement is the budget, and this is
14
+ * the list it is owed beside the number it thresholds.
15
+ *
16
+ * ## Keyed on the LENS, never on the statement's text
17
+ *
18
+ * The limits bound what the relations MEAN, so they ride exactly when a row
19
+ * from them could be in the answer: the run evaluated the claude-context lens.
20
+ * Reading the statement for a table name would be a second implementation of
21
+ * lens selection, and the two would disagree the first time one of them missed
22
+ * a spelling — the defect class this release already fixed once, by deleting
23
+ * the refusal that re-scanned the SQL and letting SQLite answer instead.
24
+ *
25
+ * ⛔ They belong to the REPORT, once, never to a row or a finding. A per-row
26
+ * copy is invisible to any assertion that checks presence rather than counting
27
+ * occurrences, and it is the defect the context lane shipped once already.
28
+ */
29
+ import { type StatedLimit } from '@vibe-agent-toolkit/resources';
30
+ /** What a report carries when a lens with stated bounds was evaluated. */
31
+ interface RelationBounds {
32
+ /** The prose frame the limits are read under, stated once. */
33
+ readonly boundsStatement?: string;
34
+ /** The signed, directional list — what the rows do NOT settle. */
35
+ readonly limits?: readonly StatedLimit[];
36
+ }
37
+ /**
38
+ * The bounds to publish beside an answer, given the lenses the run evaluated.
39
+ *
40
+ * Spread into the payload: a run that evaluated no bounded lens contributes no
41
+ * keys at all, rather than an empty list a reader has to interpret. An empty
42
+ * `limits: []` would read as "nothing bounds this answer", which is a stronger
43
+ * claim than "this answer contains no row anything bounds".
44
+ *
45
+ * @param lensesEvaluated - The run's `lensesEvaluated`, as the provenance names them
46
+ * @returns The bounds keys, or an empty object
47
+ */
48
+ export declare function relationBoundsFor(lensesEvaluated: readonly string[]): RelationBounds;
49
+ export {};
50
+ //# sourceMappingURL=relation-limits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relation-limits.d.ts","sourceRoot":"","sources":["../../src/utils/relation-limits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,+BAA+B,CAAC;AAIvC,0EAA0E;AAC1E,UAAU,cAAc;IACtB,8DAA8D;IAC9D,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,kEAAkE;IAClE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;CAC1C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,GAAG,cAAc,CAMpF"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * The stated bounds a SQL answer over the derived relations is published with.
3
+ *
4
+ * ## Why the SQL route states bounds at all
5
+ *
6
+ * `vat claude context` attaches `CLAUDE_CONTEXT_LIMITS` to every answer it
7
+ * gives, on the rule spelled in that module: *a limit a reader has to go and
8
+ * find is a limit that does not reach the person acting on the number.* The
9
+ * same measurement is reachable as `claude_context_chains` /
10
+ * `claude_context_loads` rows, and this route published none of them — so the
11
+ * lane an adopter can make GATE their build was the lane with no caveats
12
+ * attached, which is the wrong way round. VAT ships no context budget of its
13
+ * own; the adopter's `resources.checks` statement is the budget, and this is
14
+ * the list it is owed beside the number it thresholds.
15
+ *
16
+ * ## Keyed on the LENS, never on the statement's text
17
+ *
18
+ * The limits bound what the relations MEAN, so they ride exactly when a row
19
+ * from them could be in the answer: the run evaluated the claude-context lens.
20
+ * Reading the statement for a table name would be a second implementation of
21
+ * lens selection, and the two would disagree the first time one of them missed
22
+ * a spelling — the defect class this release already fixed once, by deleting
23
+ * the refusal that re-scanned the SQL and letting SQLite answer instead.
24
+ *
25
+ * ⛔ They belong to the REPORT, once, never to a row or a finding. A per-row
26
+ * copy is invisible to any assertion that checks presence rather than counting
27
+ * occurrences, and it is the defect the context lane shipped once already.
28
+ */
29
+ import { CLAUDE_CONTEXT_BOUNDS_STATEMENT, CLAUDE_CONTEXT_RELATION_LIMITS, } from '@vibe-agent-toolkit/resources';
30
+ import { CLAUDE_CONTEXT_LENS } from './projection-lenses.js';
31
+ /**
32
+ * The bounds to publish beside an answer, given the lenses the run evaluated.
33
+ *
34
+ * Spread into the payload: a run that evaluated no bounded lens contributes no
35
+ * keys at all, rather than an empty list a reader has to interpret. An empty
36
+ * `limits: []` would read as "nothing bounds this answer", which is a stronger
37
+ * claim than "this answer contains no row anything bounds".
38
+ *
39
+ * @param lensesEvaluated - The run's `lensesEvaluated`, as the provenance names them
40
+ * @returns The bounds keys, or an empty object
41
+ */
42
+ export function relationBoundsFor(lensesEvaluated) {
43
+ if (!lensesEvaluated.includes(CLAUDE_CONTEXT_LENS.name))
44
+ return {};
45
+ return {
46
+ boundsStatement: CLAUDE_CONTEXT_BOUNDS_STATEMENT,
47
+ limits: CLAUDE_CONTEXT_RELATION_LIMITS,
48
+ };
49
+ }
50
+ //# sourceMappingURL=relation-limits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relation-limits.js","sourceRoot":"","sources":["../../src/utils/relation-limits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EACL,+BAA+B,EAC/B,8BAA8B,GAE/B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAU7D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAAC,eAAkC;IAClE,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IACnE,OAAO;QACL,eAAe,EAAE,+BAA+B;QAChD,MAAM,EAAE,8BAA8B;KACvC,CAAC;AACJ,CAAC"}