@hawkeyexl/manni 4.21.0 → 4.23.0

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 (316) hide show
  1. package/README.md +1 -1
  2. package/dist/{batch-C534YIAU.js → batch-DPYBMRVD.js} +21 -22
  3. package/dist/build-LEKUMGEC.js +36 -0
  4. package/dist/calibrate-TYONPNG4.js +42 -0
  5. package/dist/capture-2EPHIAZT.js +37 -0
  6. package/dist/check-ADCSXGBK.js +57 -0
  7. package/dist/check-HWEDHABD.js +30 -0
  8. package/dist/check-J2KQI7IW.js +33 -0
  9. package/dist/check-L5AUSTE6.js +57 -0
  10. package/dist/{check-LKPQPQWJ.js → check-SQVQE4E4.js} +23 -23
  11. package/dist/{chunk-D4QHRVDJ.js → chunk-2GPF4OEF.js} +3 -157
  12. package/dist/chunk-2GPF4OEF.js.map +1 -0
  13. package/dist/{chunk-IOJD2RFG.js → chunk-2MOXVM6H.js} +2 -2
  14. package/dist/{chunk-762MM6NA.js → chunk-2QK25SLZ.js} +4 -4
  15. package/dist/{chunk-HHJ2HFPP.js → chunk-2UJOQ6CB.js} +9 -9
  16. package/dist/{chunk-H5YWCCBO.js → chunk-3CBGLUJX.js} +3 -3
  17. package/dist/{chunk-E23KWEPL.js → chunk-3USSSKLA.js} +2 -2
  18. package/dist/{chunk-PTGXEZQD.js → chunk-3ZVRGBK6.js} +4 -4
  19. package/dist/{chunk-XI3BNZG4.js → chunk-5JXA75XB.js} +46 -7
  20. package/dist/chunk-5JXA75XB.js.map +1 -0
  21. package/dist/{chunk-IN5T22FP.js → chunk-6QNA7UX2.js} +2 -2
  22. package/dist/{chunk-CZIO37J5.js → chunk-6RENCXLC.js} +10 -5
  23. package/dist/chunk-6RENCXLC.js.map +1 -0
  24. package/dist/{chunk-WHVFHBL3.js → chunk-72UN462G.js} +11 -3
  25. package/dist/chunk-72UN462G.js.map +1 -0
  26. package/dist/{chunk-OWJLB2AF.js → chunk-76Y3JATE.js} +2 -2
  27. package/dist/chunk-7M3MBFG7.js +38 -0
  28. package/dist/chunk-7M3MBFG7.js.map +1 -0
  29. package/dist/{chunk-BHGFLRXM.js → chunk-7NSFGAAQ.js} +8 -7
  30. package/dist/chunk-7NSFGAAQ.js.map +1 -0
  31. package/dist/{chunk-3SFAB75L.js → chunk-AJCUKL43.js} +6 -6
  32. package/dist/{chunk-CREFJCWZ.js → chunk-AOLCEULZ.js} +8 -8
  33. package/dist/{chunk-Q76T6Y6X.js → chunk-AZKNB2T3.js} +3635 -3409
  34. package/dist/chunk-AZKNB2T3.js.map +1 -0
  35. package/dist/{chunk-2NGFDLIM.js → chunk-B4ECIBLF.js} +4 -4
  36. package/dist/{chunk-5UJKXOAD.js → chunk-B4POKRCS.js} +6 -6
  37. package/dist/chunk-BA7BQBWV.js +311 -0
  38. package/dist/chunk-BA7BQBWV.js.map +1 -0
  39. package/dist/{chunk-KBSTXL6L.js → chunk-BOCJTOKA.js} +4 -4
  40. package/dist/{chunk-CFMI74TP.js → chunk-BZ74YUYE.js} +2 -2
  41. package/dist/{chunk-NLJ3XIKT.js → chunk-C2QE4FSZ.js} +3 -3
  42. package/dist/{chunk-DENZLZ3Z.js → chunk-CLUUSZDY.js} +26 -17
  43. package/dist/chunk-CLUUSZDY.js.map +1 -0
  44. package/dist/{chunk-PACZEDOH.js → chunk-CWPRB7SA.js} +19 -15
  45. package/dist/chunk-CWPRB7SA.js.map +1 -0
  46. package/dist/{chunk-245W2Q7C.js → chunk-D4BGNAN5.js} +2 -2
  47. package/dist/{chunk-XBJKYXOR.js → chunk-DWUK6YNX.js} +11 -11
  48. package/dist/{chunk-MTCOBRCX.js → chunk-E75CMOR3.js} +4 -4
  49. package/dist/{chunk-TFVNEPMF.js → chunk-EAF4K7IK.js} +4 -4
  50. package/dist/{chunk-TFVNEPMF.js.map → chunk-EAF4K7IK.js.map} +1 -1
  51. package/dist/{chunk-KCWNJMSS.js → chunk-EBBJFXMX.js} +3 -3
  52. package/dist/{chunk-LWBNHK72.js → chunk-EPN67ZNX.js} +47 -29
  53. package/dist/chunk-EPN67ZNX.js.map +1 -0
  54. package/dist/{chunk-6XK3NTL5.js → chunk-FBIBR4CH.js} +35 -40
  55. package/dist/chunk-FBIBR4CH.js.map +1 -0
  56. package/dist/{chunk-5LE4NH3Z.js → chunk-FJYIPHWK.js} +6 -4
  57. package/dist/{chunk-5LE4NH3Z.js.map → chunk-FJYIPHWK.js.map} +1 -1
  58. package/dist/{chunk-A4QNKEX4.js → chunk-GCHEVTCJ.js} +2 -2
  59. package/dist/{chunk-GMOAW2EG.js → chunk-GIHIONJH.js} +3 -2
  60. package/dist/chunk-GIHIONJH.js.map +1 -0
  61. package/dist/{chunk-P7HAXMFN.js → chunk-I4KDAO6P.js} +5 -3
  62. package/dist/{chunk-P7HAXMFN.js.map → chunk-I4KDAO6P.js.map} +1 -1
  63. package/dist/chunk-INOVEO32.js +28 -0
  64. package/dist/chunk-INOVEO32.js.map +1 -0
  65. package/dist/{chunk-B2242FYO.js → chunk-JF4BC7ZD.js} +38 -3
  66. package/dist/chunk-JF4BC7ZD.js.map +1 -0
  67. package/dist/{chunk-RKACUTY5.js → chunk-JZWQQOUN.js} +9 -11
  68. package/dist/{chunk-RKACUTY5.js.map → chunk-JZWQQOUN.js.map} +1 -1
  69. package/dist/{chunk-BXCVOHEX.js → chunk-K4YR4PY2.js} +15 -13
  70. package/dist/{chunk-BXCVOHEX.js.map → chunk-K4YR4PY2.js.map} +1 -1
  71. package/dist/{chunk-BXE4L52Q.js → chunk-KX6HRTLH.js} +6599 -3508
  72. package/dist/chunk-KX6HRTLH.js.map +1 -0
  73. package/dist/{chunk-V2XJJEEF.js → chunk-L3DOX3UL.js} +4 -4
  74. package/dist/{chunk-FHJIH6XP.js → chunk-LHP56Q45.js} +16 -7
  75. package/dist/chunk-LHP56Q45.js.map +1 -0
  76. package/dist/{chunk-BLXRIAV2.js → chunk-LT3STF5K.js} +29 -4
  77. package/dist/chunk-LT3STF5K.js.map +1 -0
  78. package/dist/{chunk-SHXPE4D4.js → chunk-MGQNGW6I.js} +2 -2
  79. package/dist/{chunk-SHXPE4D4.js.map → chunk-MGQNGW6I.js.map} +1 -1
  80. package/dist/{chunk-JUUCCML3.js → chunk-MPRVAMO3.js} +4 -4
  81. package/dist/{chunk-JQA6RF4R.js → chunk-N2T6RLSE.js} +2 -2
  82. package/dist/{chunk-JQA6RF4R.js.map → chunk-N2T6RLSE.js.map} +1 -1
  83. package/dist/{chunk-JCTHXG33.js → chunk-NHOGTAPK.js} +2 -2
  84. package/dist/{chunk-VM7VAFJW.js → chunk-NVYDWVXN.js} +2 -1
  85. package/dist/{chunk-ARNI3SJT.js → chunk-OL3Z7KPQ.js} +9 -9
  86. package/dist/chunk-P6LRDWMJ.js +1875 -0
  87. package/dist/chunk-P6LRDWMJ.js.map +1 -0
  88. package/dist/{chunk-NUQF5F5J.js → chunk-PNDEKFF3.js} +2 -2
  89. package/dist/chunk-QJGPOFNB.js +409 -0
  90. package/dist/chunk-QJGPOFNB.js.map +1 -0
  91. package/dist/{chunk-DMVBIIP3.js → chunk-QJL57GPX.js} +3 -3
  92. package/dist/{chunk-AE6KBAAU.js → chunk-QR55QXJ7.js} +11 -11
  93. package/dist/{chunk-BJUEOC4G.js → chunk-QWVIGKBM.js} +3 -3
  94. package/dist/{chunk-E7OG5F6S.js → chunk-RZ6OONZU.js} +13 -11
  95. package/dist/{chunk-E7OG5F6S.js.map → chunk-RZ6OONZU.js.map} +1 -1
  96. package/dist/{chunk-U4OJ7U45.js → chunk-SZMJ24FR.js} +9 -9
  97. package/dist/{chunk-KQDRO6N6.js → chunk-TLY44PCL.js} +2 -2
  98. package/dist/{chunk-VLRIP4BQ.js → chunk-TOVSR2YO.js} +2 -2
  99. package/dist/chunk-TT5UDTDM.js +888 -0
  100. package/dist/chunk-TT5UDTDM.js.map +1 -0
  101. package/dist/{chunk-2YKUSTHS.js → chunk-TVLIJ6ZM.js} +5 -5
  102. package/dist/{chunk-RQPEKHZH.js → chunk-UQYDLEBS.js} +80 -16
  103. package/dist/chunk-UQYDLEBS.js.map +1 -0
  104. package/dist/{chunk-GMLOAKOA.js → chunk-VSDXZAQU.js} +4 -22
  105. package/dist/chunk-VSDXZAQU.js.map +1 -0
  106. package/dist/{chunk-22WGKOQ7.js → chunk-VTJAY3WN.js} +7 -7
  107. package/dist/{chunk-DPDG3FHL.js → chunk-WHECOVH2.js} +3 -3
  108. package/dist/{chunk-BKY6GAFA.js → chunk-WPHPLVS3.js} +53 -918
  109. package/dist/chunk-WPHPLVS3.js.map +1 -0
  110. package/dist/{chunk-SSQZB5SQ.js → chunk-XG6PVB5S.js} +11 -1
  111. package/dist/chunk-XG6PVB5S.js.map +1 -0
  112. package/dist/{chunk-R2CR62JV.js → chunk-XVL7DYWM.js} +4 -4
  113. package/dist/{chunk-CLPC3LKX.js → chunk-Y4O737F7.js} +4 -4
  114. package/dist/{chunk-YSZNJ2ID.js → chunk-YBPXVBSY.js} +2 -2
  115. package/dist/{chunk-2HOWRAWK.js → chunk-YJHH2DHV.js} +2 -2
  116. package/dist/{chunk-APAF4VWW.js → chunk-YUCH6WJY.js} +6 -405
  117. package/dist/chunk-YUCH6WJY.js.map +1 -0
  118. package/dist/chunk-ZAOJYN2D.js +159 -0
  119. package/dist/chunk-ZAOJYN2D.js.map +1 -0
  120. package/dist/{cli-77A46SB2.js → cli-4R5HIGG4.js} +33 -21
  121. package/dist/{cli-77A46SB2.js.map → cli-4R5HIGG4.js.map} +1 -1
  122. package/dist/{cli-6NKE6RMT.js → cli-BF6KB3EJ.js} +34 -22
  123. package/dist/{cli-6NKE6RMT.js.map → cli-BF6KB3EJ.js.map} +1 -1
  124. package/dist/{cli-3PBRPPMQ.js → cli-DXOHHWZK.js} +16 -19
  125. package/dist/{cli-3PBRPPMQ.js.map → cli-DXOHHWZK.js.map} +1 -1
  126. package/dist/{cli-AVHLY2AI.js → cli-MPMECIQH.js} +154 -65
  127. package/dist/cli-MPMECIQH.js.map +1 -0
  128. package/dist/cli-NDYBQ755.js +152 -0
  129. package/dist/cli-NDYBQ755.js.map +1 -0
  130. package/dist/{cli-K47XWDLJ.js → cli-SJA66MIP.js} +29 -30
  131. package/dist/{cli-K47XWDLJ.js.map → cli-SJA66MIP.js.map} +1 -1
  132. package/dist/{cli-FDXU7CGZ.js → cli-TBAOKTMV.js} +16 -19
  133. package/dist/{cli-FDXU7CGZ.js.map → cli-TBAOKTMV.js.map} +1 -1
  134. package/dist/{cli-MQXOK64K.js → cli-TWGGMUXX.js} +89 -45
  135. package/dist/cli-TWGGMUXX.js.map +1 -0
  136. package/dist/{cli-FSDJY5OC.js → cli-V2BJYNMF.js} +4 -4
  137. package/dist/{cli-JNYL6LB7.js → cli-XGCK2LUV.js} +19 -22
  138. package/dist/{cli-JNYL6LB7.js.map → cli-XGCK2LUV.js.map} +1 -1
  139. package/dist/{cli-MOKRUHZT.js → cli-XXN75A42.js} +9 -11
  140. package/dist/cli.js +15 -15
  141. package/dist/cli.js.map +1 -1
  142. package/dist/{config-BMWDC66C.js → config-2YJPJ36T.js} +5 -5
  143. package/dist/docmeta.js +8 -10
  144. package/dist/docmeta.js.map +1 -1
  145. package/dist/github-NQQTH5JK.js +33 -0
  146. package/dist/github-NWL2XGE7.js +48 -0
  147. package/dist/github-WBIEYSM7.js +28 -0
  148. package/dist/graph/runtime.js.map +1 -1
  149. package/dist/{host-YSTYO5DX.js → host-JT27OWTC.js} +3 -3
  150. package/dist/index.d.ts +363 -25
  151. package/dist/index.js +289 -270
  152. package/dist/index.js.map +1 -1
  153. package/dist/json-IVHRVOGQ.js +40 -0
  154. package/dist/{json-YTKUFNO3.js → json-J4TONMKY.js} +2 -2
  155. package/dist/{json-YIK72XAL.js → json-QQAK73QQ.js} +12 -15
  156. package/dist/{labels-X633ZPK7.js → labels-VI2I5YFD.js} +11 -14
  157. package/dist/{labels-X633ZPK7.js.map → labels-VI2I5YFD.js.map} +1 -1
  158. package/dist/lint-VB5A3ENL.js +32 -0
  159. package/dist/list-3XRFX2Y3.js +33 -0
  160. package/dist/list-LMYCD5G5.js +37 -0
  161. package/dist/list-LOS7FTFD.js +30 -0
  162. package/dist/{page-OMPEACUN.js → page-3Y4EGYUO.js} +11 -14
  163. package/dist/{prepare-B4JVDVOV.js → prepare-JK6XKBZB.js} +20 -22
  164. package/dist/{prepare-B4JVDVOV.js.map → prepare-JK6XKBZB.js.map} +1 -1
  165. package/dist/{pretty-U7ATCFBN.js → pretty-DR4GHOJG.js} +12 -15
  166. package/dist/pretty-G2J5UEXC.js +41 -0
  167. package/dist/pretty-GCEIQ3FP.js +65 -0
  168. package/dist/{provider-JY2I3VLF.js → provider-YWNTTQPA.js} +3 -3
  169. package/dist/{release-VHHASAG7.js → release-EFLQT3FW.js} +3 -3
  170. package/dist/{reporters-FAIEOTC4.js → reporters-43LBUWEE.js} +11 -14
  171. package/dist/{reporters-KE7AZR6C.js → reporters-OWYFZD4S.js} +6 -6
  172. package/dist/run-G6G55SWJ.js +36 -0
  173. package/dist/{sarif-DOGRSGTB.js → sarif-CN7RSIKH.js} +10 -13
  174. package/dist/sarif-FR26WNVT.js +49 -0
  175. package/dist/sarif-GWTNYCZJ.js +28 -0
  176. package/dist/strategy-3EZUOE2T.js +59 -0
  177. package/dist/{term-MDN3NJDW.js → term-5WITRS3M.js} +21 -25
  178. package/dist/{term-MDN3NJDW.js.map → term-5WITRS3M.js.map} +1 -1
  179. package/dist/{validate-QDYQ642J.js → validate-TDIEFXRQ.js} +6 -7
  180. package/package.json +1 -1
  181. package/plugin/manni/.claude-plugin/plugin.json +1 -1
  182. package/plugin/manni/hooks/graph-server.mjs +3 -3
  183. package/plugin/manni/hooks/page-metadata.mjs +81 -7
  184. package/plugin/manni/skills/fix/SKILL.md +3 -3
  185. package/shapes/graph/shapes-1.3.0.ttl +1250 -0
  186. package/dist/build-SVKT7QFU.js +0 -39
  187. package/dist/calibrate-AL3MH7TY.js +0 -43
  188. package/dist/capture-2F7B4DAD.js +0 -39
  189. package/dist/check-BI7OGIVE.js +0 -48
  190. package/dist/check-JZINDP3F.js +0 -45
  191. package/dist/check-OPUMZEVK.js +0 -35
  192. package/dist/check-OW7UD73D.js +0 -33
  193. package/dist/chunk-6XK3NTL5.js.map +0 -1
  194. package/dist/chunk-APAF4VWW.js.map +0 -1
  195. package/dist/chunk-B2242FYO.js.map +0 -1
  196. package/dist/chunk-BHGFLRXM.js.map +0 -1
  197. package/dist/chunk-BKY6GAFA.js.map +0 -1
  198. package/dist/chunk-BLXRIAV2.js.map +0 -1
  199. package/dist/chunk-BXE4L52Q.js.map +0 -1
  200. package/dist/chunk-CZIO37J5.js.map +0 -1
  201. package/dist/chunk-D4QHRVDJ.js.map +0 -1
  202. package/dist/chunk-D5GBYKDU.js +0 -164
  203. package/dist/chunk-D5GBYKDU.js.map +0 -1
  204. package/dist/chunk-DENZLZ3Z.js.map +0 -1
  205. package/dist/chunk-FHJIH6XP.js.map +0 -1
  206. package/dist/chunk-GMLOAKOA.js.map +0 -1
  207. package/dist/chunk-GMOAW2EG.js.map +0 -1
  208. package/dist/chunk-LWBNHK72.js.map +0 -1
  209. package/dist/chunk-PACZEDOH.js.map +0 -1
  210. package/dist/chunk-Q76T6Y6X.js.map +0 -1
  211. package/dist/chunk-RQPEKHZH.js.map +0 -1
  212. package/dist/chunk-RWXR3GJI.js +0 -441
  213. package/dist/chunk-RWXR3GJI.js.map +0 -1
  214. package/dist/chunk-S5G6T4VC.js +0 -3200
  215. package/dist/chunk-S5G6T4VC.js.map +0 -1
  216. package/dist/chunk-SSQZB5SQ.js.map +0 -1
  217. package/dist/chunk-UP6NBQ62.js +0 -2
  218. package/dist/chunk-WHVFHBL3.js.map +0 -1
  219. package/dist/chunk-XI3BNZG4.js.map +0 -1
  220. package/dist/chunk-ZPLVANY2.js +0 -15
  221. package/dist/chunk-ZPLVANY2.js.map +0 -1
  222. package/dist/cli-AVHLY2AI.js.map +0 -1
  223. package/dist/cli-LP5OE3BL.js +0 -84
  224. package/dist/cli-LP5OE3BL.js.map +0 -1
  225. package/dist/cli-MQXOK64K.js.map +0 -1
  226. package/dist/github-6GYTPSGV.js +0 -35
  227. package/dist/github-DJOLVNDD.js +0 -31
  228. package/dist/github-ZF2TQ3RP.js +0 -35
  229. package/dist/json-Y7625EFE.js +0 -42
  230. package/dist/lint-RF3B55W7.js +0 -35
  231. package/dist/list-5DW4QZ7P.js +0 -36
  232. package/dist/list-7CHWJ633.js +0 -39
  233. package/dist/list-UNWG6NPD.js +0 -33
  234. package/dist/pretty-PPNHHOEN.js +0 -52
  235. package/dist/pretty-XGYQ25PH.js +0 -43
  236. package/dist/run-MHJ3AYKG.js +0 -39
  237. package/dist/sarif-MIEMQOIK.js +0 -30
  238. package/dist/sarif-RGRG7VFX.js +0 -36
  239. package/dist/strategy-EK5VY5DG.js +0 -223
  240. package/dist/strategy-EK5VY5DG.js.map +0 -1
  241. /package/dist/{batch-C534YIAU.js.map → batch-DPYBMRVD.js.map} +0 -0
  242. /package/dist/{build-SVKT7QFU.js.map → build-LEKUMGEC.js.map} +0 -0
  243. /package/dist/{calibrate-AL3MH7TY.js.map → calibrate-TYONPNG4.js.map} +0 -0
  244. /package/dist/{capture-2F7B4DAD.js.map → capture-2EPHIAZT.js.map} +0 -0
  245. /package/dist/{check-BI7OGIVE.js.map → check-ADCSXGBK.js.map} +0 -0
  246. /package/dist/{check-JZINDP3F.js.map → check-HWEDHABD.js.map} +0 -0
  247. /package/dist/{check-OPUMZEVK.js.map → check-J2KQI7IW.js.map} +0 -0
  248. /package/dist/{check-OW7UD73D.js.map → check-L5AUSTE6.js.map} +0 -0
  249. /package/dist/{check-LKPQPQWJ.js.map → check-SQVQE4E4.js.map} +0 -0
  250. /package/dist/{chunk-IOJD2RFG.js.map → chunk-2MOXVM6H.js.map} +0 -0
  251. /package/dist/{chunk-762MM6NA.js.map → chunk-2QK25SLZ.js.map} +0 -0
  252. /package/dist/{chunk-HHJ2HFPP.js.map → chunk-2UJOQ6CB.js.map} +0 -0
  253. /package/dist/{chunk-H5YWCCBO.js.map → chunk-3CBGLUJX.js.map} +0 -0
  254. /package/dist/{chunk-E23KWEPL.js.map → chunk-3USSSKLA.js.map} +0 -0
  255. /package/dist/{chunk-PTGXEZQD.js.map → chunk-3ZVRGBK6.js.map} +0 -0
  256. /package/dist/{chunk-IN5T22FP.js.map → chunk-6QNA7UX2.js.map} +0 -0
  257. /package/dist/{chunk-OWJLB2AF.js.map → chunk-76Y3JATE.js.map} +0 -0
  258. /package/dist/{chunk-3SFAB75L.js.map → chunk-AJCUKL43.js.map} +0 -0
  259. /package/dist/{chunk-CREFJCWZ.js.map → chunk-AOLCEULZ.js.map} +0 -0
  260. /package/dist/{chunk-2NGFDLIM.js.map → chunk-B4ECIBLF.js.map} +0 -0
  261. /package/dist/{chunk-5UJKXOAD.js.map → chunk-B4POKRCS.js.map} +0 -0
  262. /package/dist/{chunk-KBSTXL6L.js.map → chunk-BOCJTOKA.js.map} +0 -0
  263. /package/dist/{chunk-CFMI74TP.js.map → chunk-BZ74YUYE.js.map} +0 -0
  264. /package/dist/{chunk-NLJ3XIKT.js.map → chunk-C2QE4FSZ.js.map} +0 -0
  265. /package/dist/{chunk-245W2Q7C.js.map → chunk-D4BGNAN5.js.map} +0 -0
  266. /package/dist/{chunk-XBJKYXOR.js.map → chunk-DWUK6YNX.js.map} +0 -0
  267. /package/dist/{chunk-MTCOBRCX.js.map → chunk-E75CMOR3.js.map} +0 -0
  268. /package/dist/{chunk-KCWNJMSS.js.map → chunk-EBBJFXMX.js.map} +0 -0
  269. /package/dist/{chunk-A4QNKEX4.js.map → chunk-GCHEVTCJ.js.map} +0 -0
  270. /package/dist/{chunk-V2XJJEEF.js.map → chunk-L3DOX3UL.js.map} +0 -0
  271. /package/dist/{chunk-JUUCCML3.js.map → chunk-MPRVAMO3.js.map} +0 -0
  272. /package/dist/{chunk-JCTHXG33.js.map → chunk-NHOGTAPK.js.map} +0 -0
  273. /package/dist/{chunk-VM7VAFJW.js.map → chunk-NVYDWVXN.js.map} +0 -0
  274. /package/dist/{chunk-ARNI3SJT.js.map → chunk-OL3Z7KPQ.js.map} +0 -0
  275. /package/dist/{chunk-NUQF5F5J.js.map → chunk-PNDEKFF3.js.map} +0 -0
  276. /package/dist/{chunk-DMVBIIP3.js.map → chunk-QJL57GPX.js.map} +0 -0
  277. /package/dist/{chunk-AE6KBAAU.js.map → chunk-QR55QXJ7.js.map} +0 -0
  278. /package/dist/{chunk-BJUEOC4G.js.map → chunk-QWVIGKBM.js.map} +0 -0
  279. /package/dist/{chunk-U4OJ7U45.js.map → chunk-SZMJ24FR.js.map} +0 -0
  280. /package/dist/{chunk-KQDRO6N6.js.map → chunk-TLY44PCL.js.map} +0 -0
  281. /package/dist/{chunk-VLRIP4BQ.js.map → chunk-TOVSR2YO.js.map} +0 -0
  282. /package/dist/{chunk-2YKUSTHS.js.map → chunk-TVLIJ6ZM.js.map} +0 -0
  283. /package/dist/{chunk-22WGKOQ7.js.map → chunk-VTJAY3WN.js.map} +0 -0
  284. /package/dist/{chunk-DPDG3FHL.js.map → chunk-WHECOVH2.js.map} +0 -0
  285. /package/dist/{chunk-R2CR62JV.js.map → chunk-XVL7DYWM.js.map} +0 -0
  286. /package/dist/{chunk-CLPC3LKX.js.map → chunk-Y4O737F7.js.map} +0 -0
  287. /package/dist/{chunk-YSZNJ2ID.js.map → chunk-YBPXVBSY.js.map} +0 -0
  288. /package/dist/{chunk-2HOWRAWK.js.map → chunk-YJHH2DHV.js.map} +0 -0
  289. /package/dist/{cli-FSDJY5OC.js.map → cli-V2BJYNMF.js.map} +0 -0
  290. /package/dist/{chunk-UP6NBQ62.js.map → cli-XXN75A42.js.map} +0 -0
  291. /package/dist/{cli-MOKRUHZT.js.map → config-2YJPJ36T.js.map} +0 -0
  292. /package/dist/{config-BMWDC66C.js.map → github-NQQTH5JK.js.map} +0 -0
  293. /package/dist/{github-6GYTPSGV.js.map → github-NWL2XGE7.js.map} +0 -0
  294. /package/dist/{github-DJOLVNDD.js.map → github-WBIEYSM7.js.map} +0 -0
  295. /package/dist/{github-ZF2TQ3RP.js.map → host-JT27OWTC.js.map} +0 -0
  296. /package/dist/{host-YSTYO5DX.js.map → json-IVHRVOGQ.js.map} +0 -0
  297. /package/dist/{json-Y7625EFE.js.map → json-J4TONMKY.js.map} +0 -0
  298. /package/dist/{json-YIK72XAL.js.map → json-QQAK73QQ.js.map} +0 -0
  299. /package/dist/{json-YTKUFNO3.js.map → lint-VB5A3ENL.js.map} +0 -0
  300. /package/dist/{lint-RF3B55W7.js.map → list-3XRFX2Y3.js.map} +0 -0
  301. /package/dist/{list-5DW4QZ7P.js.map → list-LMYCD5G5.js.map} +0 -0
  302. /package/dist/{list-7CHWJ633.js.map → list-LOS7FTFD.js.map} +0 -0
  303. /package/dist/{list-UNWG6NPD.js.map → page-3Y4EGYUO.js.map} +0 -0
  304. /package/dist/{page-OMPEACUN.js.map → pretty-DR4GHOJG.js.map} +0 -0
  305. /package/dist/{pretty-PPNHHOEN.js.map → pretty-G2J5UEXC.js.map} +0 -0
  306. /package/dist/{pretty-U7ATCFBN.js.map → pretty-GCEIQ3FP.js.map} +0 -0
  307. /package/dist/{pretty-XGYQ25PH.js.map → provider-YWNTTQPA.js.map} +0 -0
  308. /package/dist/{release-VHHASAG7.js.map → release-EFLQT3FW.js.map} +0 -0
  309. /package/dist/{provider-JY2I3VLF.js.map → reporters-43LBUWEE.js.map} +0 -0
  310. /package/dist/{reporters-FAIEOTC4.js.map → reporters-OWYFZD4S.js.map} +0 -0
  311. /package/dist/{reporters-KE7AZR6C.js.map → run-G6G55SWJ.js.map} +0 -0
  312. /package/dist/{run-MHJ3AYKG.js.map → sarif-CN7RSIKH.js.map} +0 -0
  313. /package/dist/{sarif-DOGRSGTB.js.map → sarif-FR26WNVT.js.map} +0 -0
  314. /package/dist/{sarif-MIEMQOIK.js.map → sarif-GWTNYCZJ.js.map} +0 -0
  315. /package/dist/{sarif-RGRG7VFX.js.map → strategy-3EZUOE2T.js.map} +0 -0
  316. /package/dist/{validate-QDYQ642J.js.map → validate-TDIEFXRQ.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/tracevals/capture/manifest.ts","../src/tracevals/trace/availability.ts","../src/tracevals/artifacts/availability.ts","../src/tracevals/artifacts/fs.ts","../src/tracevals/artifacts/resolve.ts","../src/tracevals/evals/schema.ts","../src/tracevals/evals/extract.ts"],"sourcesContent":["/**\n * Reading, locating, and comparing session manifests (ADR 01024).\n *\n * The consuming half. Deliberately free of any dependency on\n * `artifacts/discover.ts`: `artifacts/resolve.ts` imports this module, and\n * discovery imports resolution, so producing and consuming a manifest have to\n * live in separate files or the two would form a cycle. Building one is\n * `capture/build.ts`.\n */\nimport { createHash } from \"node:crypto\";\nimport { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport {\n dirname,\n extname,\n isAbsolute,\n join,\n relative,\n resolve,\n sep,\n} from \"node:path\";\nimport {\n MANIFEST_VERSION,\n type ContentCheck,\n type SessionManifest,\n} from \"./types.js\";\n\nexport function sha256Hex(data: Buffer | string): string {\n return createHash(\"sha256\").update(data).digest(\"hex\");\n}\n\n/** sha256 of a file's bytes, or null when it cannot be read. */\nexport async function hashFile(path: string): Promise<string | null> {\n try {\n // The bytes, not the decoded string: the digest has to mean \"this file\",\n // and a decode-then-re-encode would quietly normalize a BOM.\n return sha256Hex(await readFile(path));\n } catch {\n return null;\n }\n}\n\n/** `path` relative to `root`, POSIX-separated, or null when it escapes. */\nexport function relPosix(root: string, path: string): string | null {\n const rel = relative(resolve(root), resolve(path));\n if (rel === \"\" || rel.startsWith(\"..\") || isAbsolute(rel)) return null;\n return rel.split(sep).join(\"/\");\n}\n\n/**\n * A session id is a filename here, so it may not carry path syntax. Claude Code\n * writes UUIDs; a hand-passed `--session-id` is the case this guards, and a\n * `../` in one would write the manifest outside the directory it was aimed at.\n */\nexport function safeSessionId(sessionId: string): string {\n const cleaned = sessionId.replace(/[^A-Za-z0-9._-]/g, \"-\").replace(/^\\.+/, \"\");\n return cleaned.length > 0 ? cleaned.slice(0, 128) : \"session\";\n}\n\nexport function manifestPathFor(dir: string, sessionId: string): string {\n return join(dir, `${safeSessionId(sessionId)}.json`);\n}\n\n/** The `<trace>.manifest.json` sibling — a manifest placed beside its trace. */\nexport function siblingManifestPath(tracePath: string): string {\n const ext = extname(tracePath);\n const stem = ext === \"\" ? tracePath : tracePath.slice(0, -ext.length);\n return `${stem}.manifest.json`;\n}\n\n// ── Persisting ───────────────────────────────────────────────────\n\nexport async function writeManifest(\n path: string,\n manifest: SessionManifest,\n): Promise<void> {\n await mkdir(dirname(resolve(path)), { recursive: true });\n await writeFile(path, `${JSON.stringify(manifest, null, 2)}\\n`, \"utf-8\");\n}\n\n/**\n * Every member `run` actually consumes, checked one by one.\n *\n * A partial read is the dangerous failure here, not a loud one. An artifact\n * entry with no `path` puts `undefined` in the comparison map's key, and one\n * whose `sha256` is not a string puts a value no real digest can equal — so a\n * half-read manifest reports **`mismatch`**, \"this artifact changed since the\n * session\", which is the most alarming thing this feature can say and would be\n * said off nothing but the file's own corruption. A manifest is optional\n * evidence, so anything malformed has to read as *no* evidence.\n */\nfunction isManifestArtifact(value: unknown): boolean {\n if (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n return false;\n }\n const entry = value as Record<string, unknown>;\n return (\n typeof entry.path === \"string\" &&\n entry.path.length > 0 &&\n typeof entry.sha256 === \"string\" &&\n entry.sha256.length > 0 &&\n typeof entry.name === \"string\" &&\n typeof entry.type === \"string\" &&\n typeof entry.bytes === \"number\"\n );\n}\n\n/**\n * Read one manifest, or null. Absent, unreadable, unparseable, the wrong shape,\n * or written by a newer format version all produce null: consuming a manifest\n * is optional evidence-gathering, so every failure has to degrade to \"no\n * evidence\" rather than to a crash or, worse, to a partial read (ADR 01003).\n */\nexport async function readManifest(\n path: string,\n): Promise<SessionManifest | null> {\n let raw: string;\n try {\n raw = await readFile(path, \"utf-8\");\n } catch {\n return null;\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch {\n return null;\n }\n if (parsed === null || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n return null;\n }\n const record = parsed as Record<string, unknown>;\n if (typeof record.version !== \"number\" || record.version > MANIFEST_VERSION) {\n return null;\n }\n if (typeof record.sessionId !== \"string\") return null;\n // `capturedAt` is printed in the report and `root` is a base the join is\n // keyed on; both are consumed, so neither may be half-there.\n if (typeof record.capturedAt !== \"string\") return null;\n if (typeof record.root !== \"string\") return null;\n if (!Array.isArray(record.artifacts)) return null;\n if (!record.artifacts.every(isManifestArtifact)) return null;\n return parsed as SessionManifest;\n}\n\nexport interface FindManifestOptions {\n tracePath: string;\n /** The trace's own session id, when it recorded one. */\n sessionId?: string;\n /** Project root; the canonical manifest lives under it. */\n projectDir: string;\n /** Directory manifests are written to, relative to the project root. */\n captureDir: string;\n /** An explicitly named manifest, which is used without searching. */\n explicit?: string;\n /**\n * Called for each candidate that was readable but refused, with why. A\n * refusal that leaves no trace is indistinguishable from never having\n * captured anything, which is the wrong thing for a reader to conclude.\n */\n onRefused?: (path: string, reason: string) => void;\n}\n\nexport interface FoundManifest {\n path: string;\n manifest: SessionManifest;\n}\n\n/**\n * Find the manifest for a trace, most-specific location first.\n *\n * 1. `<trace>.manifest.json` — someone put it there deliberately, which is a\n * stronger statement of intent than any convention.\n * 2. `<trace dir>/<captureDir>/<session-id>.json` — a trace copied out of the\n * session store together with the state directory.\n * 3. `<projectDir>/<captureDir>/<session-id>.json` — where `capture` writes.\n *\n * **A manifest that cannot be shown to belong to this trace is refused**, not\n * used. It is evidence about some other session, and letting it stand in here\n * would be the one way a manifest could produce a confidently wrong answer.\n *\n * Two ways that can happen, and the trace's own id decides which:\n *\n * - The ids **disagree** — refused outright, however the manifest was reached.\n * - The trace records **no id at all**. A Claude Code session file whose\n * records predate `sessionId`, or a `claude -p` stream-json transcript\n * captured without its `system`/`init` record, both parse fine and both\n * arrive here with nothing to check against. A manifest found *by\n * convention* beside such a trace is refused, because convention is not\n * provenance and the file could describe any session on the machine.\n *\n * An **explicitly named** `--manifest` is the exception to that second case,\n * and only that one. Naming a file is the caller's own assertion that it\n * belongs to this trace — the assertion the ADR already treats as\n * load-bearing when it makes an unusable named manifest an error rather than a\n * shrug — and it is the only assertion available for a trace format that\n * records no id. Refusing it would leave `--manifest` structurally unusable\n * there while buying no safety a discovered manifest does not already get.\n */\nexport async function findManifest(\n options: FindManifestOptions,\n): Promise<FoundManifest | null> {\n const explicit = options.explicit !== undefined;\n const candidates: string[] = [];\n if (options.explicit !== undefined) {\n candidates.push(options.explicit);\n } else {\n candidates.push(siblingManifestPath(options.tracePath));\n if (options.sessionId !== undefined) {\n candidates.push(\n manifestPathFor(\n resolve(dirname(options.tracePath), options.captureDir),\n options.sessionId,\n ),\n manifestPathFor(\n resolve(options.projectDir, options.captureDir),\n options.sessionId,\n ),\n );\n }\n }\n\n for (const path of candidates) {\n const manifest = await readManifest(path);\n if (manifest === null) continue;\n const refusal = refuse(manifest, options.sessionId, explicit);\n if (refusal !== null) {\n options.onRefused?.(path, refusal);\n continue;\n }\n return { path, manifest };\n }\n return null;\n}\n\n/** Why this manifest cannot be trusted for this trace, or null if it can. */\nfunction refuse(\n manifest: SessionManifest,\n sessionId: string | undefined,\n explicit: boolean,\n): string | null {\n if (sessionId === undefined) {\n if (explicit) return null;\n return (\n `the trace records no session id, so a manifest found by convention ` +\n `cannot be verified as belonging to it (it records \"${manifest.sessionId}\"). ` +\n `Pass --manifest to use it anyway.`\n );\n }\n if (manifest.sessionId !== sessionId) {\n return `it was recorded for a different session (\"${manifest.sessionId}\", not \"${sessionId}\")`;\n }\n return null;\n}\n\n// ── Comparing ────────────────────────────────────────────────────\n\n/**\n * Compare the files one coverage row covers against what the manifest recorded.\n *\n * `actual` maps each covered file's project-relative POSIX path to its current\n * sha256. A row usually covers one file; project rules aggregate several, which\n * is why the outcome is decided over a set:\n *\n * - **any** recorded file whose digest differs → `mismatch`. One changed file\n * makes the row's instructions different, whatever the others say.\n * - **every** covered file recorded and equal → `match`.\n * - otherwise → `skipped`, naming what the manifest could not speak to. A\n * partial answer is not a clean one.\n */\nexport function checkContent(\n manifest: SessionManifest,\n actual: ReadonlyMap<string, string>,\n): ContentCheck {\n const recorded = new Map(manifest.artifacts.map((a) => [a.path, a.sha256]));\n const missing: string[] = [];\n let matched = 0;\n /**\n * The first agreeing pair, captured where both halves are in hand. `expected`\n * means \"what the manifest claimed\" in every branch, so it has to be read off\n * the manifest in every branch — going back to `actual` afterwards would\n * report the file twice, and on a match the two are equal, so nothing would\n * ever catch it.\n */\n let agreed: { expected: string; actual: string } | undefined;\n\n for (const [path, digest] of actual) {\n const expected = recorded.get(path);\n if (expected === undefined) {\n missing.push(path);\n continue;\n }\n if (expected !== digest) {\n return { status: \"mismatch\", expected, actual: digest };\n }\n agreed ??= { expected, actual: digest };\n matched += 1;\n }\n\n if (matched === 0) {\n return {\n status: \"skipped\",\n reason:\n actual.size === 0\n ? \"no file to compare\"\n : \"not recorded in the session manifest\",\n };\n }\n if (missing.length > 0) {\n return {\n status: \"skipped\",\n reason: `not recorded in the session manifest: ${missing.join(\", \")}`,\n };\n }\n // Digests only for a row covering one file: an aggregated project-rules row\n // has no single pair to report, and picking one of several would be a claim\n // about the row that is not true of it.\n return {\n status: \"match\",\n ...(actual.size === 1 && agreed !== undefined ? agreed : {}),\n };\n}\n\nexport * from \"./types.js\";\n","/**\n * The availability roster (ADR 01016): what a session was *offered*, whether or\n * not it used any of it.\n *\n * Claude Code records the roster in the transcript as structured `attachment`\n * records rather than as the prose the model reads, so it is recoverable\n * deterministically and **retroactively, on every session already on disk**:\n *\n * | `attachment.type` | Carries |\n * |---|---|\n * | `skill_listing` | `names`, `skillCount`, `isInitial`, and `content` — one `- name: description` line per skill |\n * | `agent_listing_delta` | `addedTypes`, `addedLines` (description plus tool grants), `removedTypes`, `isInitial` |\n * | `deferred_tools_delta` | `addedNames`, `removedNames`, `readdedNames`, and the MCP server state lists |\n *\n * Two properties of the real data drive the shape of this module, both\n * confirmed across the 606 `skill_listing` records in a 281-session store:\n *\n * 1. **`content` is the description source, `names` is the identity source.**\n * A plugin skill is named `plugin:skill`, so splitting a listing line on its\n * first colon truncates the name; every line is instead matched against the\n * `names` array (longest match wins). On that corpus the rule leaves zero\n * lines unjoined. Descriptions also wrap onto continuation lines, and the\n * listing text is capped near 30,000 characters — past the cap Claude Code\n * emits bare `- name` lines, so a description is genuinely optional.\n * 2. **Deltas are not idempotent.** `isInitial: true` replaces the set;\n * `isInitial: false` adds (and, for agents and tools, removes). Replay is\n * therefore ordered by record index, and per-index history is kept so a\n * consumer can ask what was available when a window opened rather than only\n * what was available at some point.\n */\nimport type {\n AvailabilityEntry,\n AvailabilityKind,\n McpServerStatus,\n TraceAvailability,\n} from \"./types.js\";\n\nexport function newAvailability(): TraceAvailability {\n return { recorded: false, skills: [], agents: [], tools: [], mcpServers: [] };\n}\n\n/** Entries whose interval covers `index`. */\nexport function availableAt(\n entries: readonly AvailabilityEntry[],\n index: number,\n): AvailabilityEntry[] {\n return entries.filter(\n (e) => e.offeredAt <= index && (e.withdrawnAt === undefined || index < e.withdrawnAt),\n );\n}\n\n/** Every distinct name that was offered at any point. */\nexport function offeredNames(entries: readonly AvailabilityEntry[]): Set<string> {\n return new Set(entries.map((e) => e.name));\n}\n\n/**\n * Join a listing's `content` lines onto its `names`.\n *\n * A line belongs to the longest name it starts with, so `plugin:skill` survives\n * intact; a line that starts no name is a continuation of the description above\n * it. Names with no line at all keep an absent description.\n */\nexport function joinDescriptions(\n content: string,\n names: readonly string[],\n): Map<string, string | undefined> {\n const byName = new Map<string, string | undefined>(\n names.map((name) => [name, undefined]),\n );\n let current: string | undefined;\n for (const raw of content.split(\"\\n\")) {\n const line = raw.trimEnd();\n if (line.startsWith(\"- \")) {\n const body = line.slice(2);\n let best: string | undefined;\n for (const name of names) {\n if (body !== name && !body.startsWith(`${name}:`)) continue;\n if (best === undefined || name.length > best.length) best = name;\n }\n // A `- ` line that names nothing on the roster is not a skill entry, so\n // it must not become the target for the lines that follow it either.\n current = best;\n if (best === undefined) continue;\n const rest = body.slice(best.length).replace(/^:\\s*/, \"\").trim();\n byName.set(best, rest.length > 0 ? rest : undefined);\n continue;\n }\n if (current === undefined) continue;\n const continued = line.trim();\n if (continued.length === 0) continue;\n const previous = byName.get(current);\n byName.set(current, previous ? `${previous}\\n${continued}` : continued);\n }\n return byName;\n}\n\n/** `- name: description` in one string, as the agent-listing deltas ship it. */\nfunction describedLines(\n names: readonly string[],\n lines: readonly string[],\n): Map<string, string | undefined> {\n const byName = new Map<string, string | undefined>();\n names.forEach((name, i) => {\n const line = lines[i];\n if (typeof line !== \"string\") {\n byName.set(name, undefined);\n return;\n }\n const body = line.startsWith(\"- \") ? line.slice(2) : line;\n const rest = body.startsWith(`${name}:`)\n ? body.slice(name.length + 1).trim()\n : body === name\n ? \"\"\n : body.trim();\n byName.set(name, rest.length > 0 ? rest : undefined);\n });\n return byName;\n}\n\nconst asStrings = (value: unknown): string[] =>\n Array.isArray(value) ? value.filter((v): v is string => typeof v === \"string\") : [];\n\n/** Mutable replay state: the open interval per name, per kind. */\nexport interface AvailabilityReplay {\n roster: TraceAvailability;\n open: Map<AvailabilityKind, Map<string, AvailabilityEntry>>;\n}\n\nexport function newReplay(): AvailabilityReplay {\n return {\n roster: newAvailability(),\n open: new Map<AvailabilityKind, Map<string, AvailabilityEntry>>([\n [\"skill\", new Map()],\n [\"agent\", new Map()],\n [\"tool\", new Map()],\n [\"mcp-server\", new Map()],\n ]),\n };\n}\n\nfunction listFor(\n roster: TraceAvailability,\n kind: AvailabilityKind,\n): AvailabilityEntry[] {\n if (kind === \"skill\") return roster.skills;\n if (kind === \"agent\") return roster.agents;\n if (kind === \"tool\") return roster.tools;\n return roster.mcpServers;\n}\n\nfunction offer(\n replay: AvailabilityReplay,\n kind: AvailabilityKind,\n name: string,\n index: number,\n description?: string,\n status?: McpServerStatus,\n): void {\n const open = replay.open.get(kind) as Map<string, AvailabilityEntry>;\n const existing = open.get(name);\n if (existing !== undefined) {\n // Already offered: keep the one interval and let a later listing fill in a\n // description the earlier, truncated one omitted.\n if (existing.description === undefined && description !== undefined) {\n existing.description = description;\n }\n if (status !== undefined) existing.status = status;\n return;\n }\n const entry: AvailabilityEntry = { kind, name, offeredAt: index };\n if (description !== undefined) entry.description = description;\n if (status !== undefined) entry.status = status;\n open.set(name, entry);\n listFor(replay.roster, kind).push(entry);\n}\n\nfunction withdraw(\n replay: AvailabilityReplay,\n kind: AvailabilityKind,\n name: string,\n index: number,\n): void {\n const open = replay.open.get(kind) as Map<string, AvailabilityEntry>;\n const entry = open.get(name);\n if (entry === undefined) return;\n entry.withdrawnAt = index;\n open.delete(name);\n}\n\n/** Names currently offered for a kind, in offer order. */\nfunction openNames(replay: AvailabilityReplay, kind: AvailabilityKind): string[] {\n return [...(replay.open.get(kind) as Map<string, AvailabilityEntry>).keys()];\n}\n\n/**\n * Fold one `attachment` payload into the roster. Anything unrecognised, or\n * shaped unexpectedly, is ignored rather than thrown: a listing record is\n * bookkeeping, and losing one must never cost the run its trace (ADR 01003).\n *\n * Returns true when the record was a listing record — which is what makes\n * `recorded` mean \"a roster was present\", as opposed to \"the roster was empty\".\n */\nexport function applyAvailabilityRecord(\n replay: AvailabilityReplay,\n attachment: unknown,\n index: number,\n): boolean {\n if (typeof attachment !== \"object\" || attachment === null) return false;\n const record = attachment as Record<string, unknown>;\n const type = record.type;\n\n if (type === \"skill_listing\") {\n const names = asStrings(record.names);\n const content = typeof record.content === \"string\" ? record.content : \"\";\n // A skill listing carries no removal member of its own: an initial listing\n // is the set, and a delta only adds.\n if (record.isInitial === true) {\n for (const name of openNames(replay, \"skill\")) {\n if (!names.includes(name)) withdraw(replay, \"skill\", name, index);\n }\n }\n const described = joinDescriptions(content, names);\n for (const name of names) {\n offer(replay, \"skill\", name, index, described.get(name));\n }\n return true;\n }\n\n if (type === \"agent_listing_delta\") {\n const added = asStrings(record.addedTypes);\n const lines = asStrings(record.addedLines);\n if (record.isInitial === true) {\n for (const name of openNames(replay, \"agent\")) {\n if (!added.includes(name)) withdraw(replay, \"agent\", name, index);\n }\n }\n const described = describedLines(added, lines);\n for (const name of added) {\n offer(replay, \"agent\", name, index, described.get(name));\n }\n for (const name of asStrings(record.removedTypes)) {\n withdraw(replay, \"agent\", name, index);\n }\n return true;\n }\n\n if (type === \"deferred_tools_delta\") {\n // Tool deltas carry no `isInitial` at all — verified across 431 records —\n // so they are purely additive/subtractive.\n for (const name of asStrings(record.removedNames)) {\n withdraw(replay, \"tool\", name, index);\n }\n // `addedLines` is the tool's own name again rather than a description, and\n // is sometimes empty while `addedNames` is not; there is no description to\n // recover for a tool.\n // `readdedNames` is the shape a re-offer actually takes: a tool that was\n // withdrawn and is offered again arrives there, not in `addedNames`.\n // Reading only `addedNames` left it withdrawn for the rest of the\n // session, so `availableAt` answered false for a tool the session could\n // still call.\n for (const name of [\n ...asStrings(record.addedNames),\n ...asStrings(record.readdedNames),\n ]) {\n offer(replay, \"tool\", name, index);\n }\n const servers: Array<[string, McpServerStatus]> = [\n ...asStrings(record.pendingMcpServers).map(\n (n): [string, McpServerStatus] => [n, \"pending\"],\n ),\n ...asStrings(record.needsAuthMcpServers).map(\n (n): [string, McpServerStatus] => [n, \"needs-auth\"],\n ),\n ...asStrings(record.failedMcpServers).map(\n (n): [string, McpServerStatus] => [n, \"failed\"],\n ),\n ];\n for (const [name, status] of servers) {\n offer(replay, \"mcp-server\", name, index, undefined, status);\n }\n return true;\n }\n\n return false;\n}\n\n/** Shift every ordinal through a remap, for the sidecar splice (ADR 01014). */\nexport function remapAvailability(\n roster: TraceAvailability,\n at: (index: number) => number,\n): TraceAvailability {\n const shift = (entries: AvailabilityEntry[]): AvailabilityEntry[] =>\n entries.map((entry) => ({\n ...entry,\n offeredAt: at(entry.offeredAt),\n ...(entry.withdrawnAt !== undefined\n ? { withdrawnAt: at(entry.withdrawnAt) }\n : {}),\n }));\n return {\n recorded: roster.recorded,\n skills: shift(roster.skills),\n agents: shift(roster.agents),\n tools: shift(roster.tools),\n mcpServers: shift(roster.mcpServers),\n };\n}\n\n/**\n * Fold a subagent branch's own roster into the session's.\n *\n * A subagent is offered its own roster — every sidecar transcript checked\n * carries `skill_listing` and `deferred_tools_delta` records of its own — and\n * that roster is a *different* set from the parent's. Replaying it as if it\n * were the main chain's would churn the parent's intervals, since a sidecar's\n * listing is `isInitial: true` and would withdraw everything the parent had.\n *\n * So only names the session never saw at all are added, tagged with the branch\n * that saw them and never withdrawn. That keeps the main chain's intervals\n * exact while making \"was this ever on the menu?\" — the question coverage asks\n * — answer correctly for a skill only a subagent was offered.\n */\nexport function foldBranchAvailability(\n roster: TraceAvailability,\n branch: TraceAvailability,\n branchId: string,\n spawnIndex: number,\n): void {\n if (!branch.recorded) return;\n roster.recorded = true;\n const merge = (into: AvailabilityEntry[], from: AvailabilityEntry[]): void => {\n const known = offeredNames(into);\n for (const entry of from) {\n if (known.has(entry.name)) continue;\n known.add(entry.name);\n into.push({\n ...entry,\n offeredAt: spawnIndex,\n branchId,\n ...(entry.withdrawnAt !== undefined ? { withdrawnAt: undefined } : {}),\n });\n }\n };\n merge(roster.skills, branch.skills);\n merge(roster.agents, branch.agents);\n merge(roster.tools, branch.tools);\n merge(roster.mcpServers, branch.mcpServers);\n}\n","/**\n * Offered versus used (ADR 01016).\n *\n * Artifact resolution starts from what the trace *used*, so a skill that should\n * have been invoked and was not resolves to nothing and is reported nowhere.\n * The availability roster closes that blind spot without a filesystem scan:\n * the evidence travels inside the trace, so it works on any machine and on\n * every session already recorded.\n *\n * Three states, never collapsed:\n *\n * - **offered and used** — the ordinary case.\n * - **offered and not used** — a judgement call for a person to make. Counted\n * by default and listed only on request, because a real roster runs to\n * hundreds of skills and would drown the report.\n * - **not offered** — the session referenced it but it was never on the menu.\n * That is a *configuration* bug, not an adherence failure, and it is the\n * state that is invisible today.\n *\n * This is an observation. It never becomes an eval outcome and never moves the\n * exit code.\n *\n * `discoverArtifacts` is deliberately not used here: it scans the project tree\n * for authoring, and the roster makes a scan unnecessary anyway.\n */\nimport { offeredNames } from \"../trace/availability.js\";\nimport type { Trace } from \"../trace/types.js\";\nimport type {\n AvailabilityCounts,\n AvailabilityReport,\n CoverageEntry,\n} from \"./types.js\";\n\nexport interface AvailabilityOptions {\n /** Include a coverage row per offered-but-unused artifact, not just a count. */\n listUnused?: boolean;\n}\n\nexport interface AvailabilityCoverage {\n report: AvailabilityReport;\n /** The rows handed in, annotated, plus the unused ones when listed. */\n coverage: CoverageEntry[];\n}\n\n/**\n * A fresh zero row per call. One shared object assigned to both `skills` and\n * `agents` would make a mutation of either silently move the other; every\n * caller is read-only today, which is exactly why it would go unnoticed.\n */\nconst empty = (): AvailabilityCounts => ({ offered: 0, used: 0, unused: 0 });\n\n/**\n * Kinds the roster says nothing about, so no row of theirs may carry a state.\n *\n * Project rules are never *offered* — they are in force from the first turn.\n * Slash commands have no listing record of any kind, so `not-offered` would be\n * a confident accusation drawn from evidence that was never collected — which\n * is precisely what a built-in command looked like before it had its own type\n * (ADR 01016's recorded limitation, closed by ADR 01023).\n */\nconst UNROSTERED = new Set<CoverageEntry[\"kind\"]>([\n \"project-rules\",\n \"slash-command\",\n]);\n\nexport function coverAvailability(\n trace: Trace,\n coverage: CoverageEntry[],\n options: AvailabilityOptions = {},\n): AvailabilityCoverage {\n const roster = trace.availability;\n if (!roster.recorded) {\n // No listing records: unknown, not zero. Every row says so rather than\n // implying the session was offered nothing.\n return {\n report: { recorded: false, skills: empty(), agents: empty(), listed: false },\n coverage: coverage.map((entry) =>\n UNROSTERED.has(entry.kind)\n ? entry\n : { ...entry, availability: \"unknown\" as const },\n ),\n };\n }\n\n const offeredSkills = offeredNames(roster.skills);\n const offeredAgents = offeredNames(roster.agents);\n const offeredFor = (kind: CoverageEntry[\"kind\"]): Set<string> =>\n kind === \"skill\" ? offeredSkills : offeredAgents;\n\n const usedSkills = new Set<string>();\n const usedAgents = new Set<string>();\n\n const annotated = coverage.map((entry) => {\n if (UNROSTERED.has(entry.kind)) return entry;\n const offered = offeredFor(entry.kind).has(entry.ref);\n if (offered) {\n (entry.kind === \"skill\" ? usedSkills : usedAgents).add(entry.ref);\n }\n return {\n ...entry,\n availability: offered ? (\"offered-and-used\" as const) : (\"not-offered\" as const),\n };\n });\n\n const listUnused = options.listUnused === true;\n const unusedRows: CoverageEntry[] = [];\n const collect = (kind: \"skill\" | \"agent\", used: Set<string>): number => {\n let unused = 0;\n // Ordered by first offer, and deduplicated: a name withdrawn and\n // re-offered is two intervals but one artifact.\n const seen = new Set<string>();\n for (const entry of kind === \"skill\" ? roster.skills : roster.agents) {\n if (seen.has(entry.name)) continue;\n seen.add(entry.name);\n if (used.has(entry.name)) continue;\n unused += 1;\n if (!listUnused) continue;\n unusedRows.push({\n ref: entry.name,\n kind,\n resolved: false,\n tried: [],\n note:\n entry.description === undefined\n ? \"offered, never used\"\n : `offered, never used — ${firstLine(entry.description)}`,\n availability: \"offered-not-used\",\n });\n }\n return unused;\n };\n\n const skillsUnused = collect(\"skill\", usedSkills);\n const agentsUnused = collect(\"agent\", usedAgents);\n\n return {\n report: {\n recorded: true,\n skills: {\n offered: offeredSkills.size,\n used: usedSkills.size,\n unused: skillsUnused,\n },\n agents: {\n offered: offeredAgents.size,\n used: usedAgents.size,\n unused: agentsUnused,\n },\n listed: listUnused,\n },\n coverage: [...annotated, ...unusedRows],\n };\n}\n\n/** Descriptions wrap over several lines; a table cell wants the first one. */\nfunction firstLine(description: string): string {\n const line = description.split(\"\\n\")[0] ?? \"\";\n return line.length > 160 ? `${line.slice(0, 157)}...` : line;\n}\n","/**\n * Filesystem helpers shared by trace-driven artifact resolution and static\n * artifact discovery. Every function degrades to null/empty rather than\n * throwing: a missing or unreadable path is a coverage note, never a crash.\n */\nimport { access, readdir, readFile, stat } from \"node:fs/promises\";\nimport { dirname, join, resolve, sep } from \"node:path\";\n\n/**\n * Directory names never worth walking. `.git` alone can hold more entries than\n * the rest of a repo combined, and `node_modules` hides vendored skills that\n * are not the project's to edit.\n */\n/**\n * Path split into segments with separators normalised, so convention\n * matching (\"is this under `.claude/commands/`?\") agrees between\n * trace-driven resolution and static discovery. Both had their own\n * byte-identical copy; a drift between them would classify one file two\n * ways in `run` and `fill`.\n */\nexport function segments(path: string): string[] {\n return path.split(sep).join(\"/\").split(\"/\");\n}\n\nexport const PRUNED_DIRS = new Set([\n \"node_modules\",\n \".git\",\n \"dist\",\n \"build\",\n \"coverage\",\n \".manni\",\n \".tmp\",\n \".next\",\n \".venv\",\n]);\n\n/** Nearest ancestor containing `.git` (a directory *or* a worktree file). */\nexport async function findGitRoot(start: string): Promise<string | null> {\n let current = resolve(start);\n for (let depth = 0; depth < 64; depth += 1) {\n try {\n await access(join(current, \".git\"));\n return current;\n } catch {\n // keep walking\n }\n const parent = dirname(current);\n if (parent === current) return null;\n current = parent;\n }\n return null;\n}\n\nexport async function safeRead(path: string): Promise<string | null> {\n try {\n return await readFile(path, \"utf-8\");\n } catch {\n return null;\n }\n}\n\n/**\n * Last-modified time of `path` as an ISO-8601 string, or null when it cannot\n * be read. Used for the staleness heuristic (ADR 01021); like everything else\n * here it degrades rather than throwing — an artifact whose mtime is\n * unreadable is simply one the report says nothing about.\n */\nexport async function safeMtime(path: string): Promise<string | null> {\n try {\n const info = await stat(path);\n return info.mtime.toISOString();\n } catch {\n return null;\n }\n}\n\n/** First file under `root` matching `match`, or null. */\nexport async function findInTree(\n root: string,\n match: (path: string) => boolean,\n): Promise<string | null> {\n let entries;\n try {\n entries = await readdir(root, { withFileTypes: true, recursive: true });\n } catch {\n return null;\n }\n for (const entry of entries) {\n if (!entry.isFile()) continue;\n const full = join(entry.parentPath, entry.name);\n if (match(full)) return full;\n }\n return null;\n}\n\nexport interface ListOptions {\n /** Directory names to skip; defaults to PRUNED_DIRS. */\n prune?: Set<string>;\n maxDepth?: number;\n}\n\n/**\n * Every file under `root` matching `match`, sorted for stable output.\n *\n * Hand-rolled rather than `readdir({recursive:true})` because pruning has to\n * happen *during* the walk — a recursive readdir would enumerate all of\n * `node_modules` before we could filter it. Symlinked directories report\n * `isDirectory() === false`, so loops are not followed.\n */\nexport async function listInTree(\n root: string,\n match: (path: string) => boolean,\n options: ListOptions = {},\n): Promise<string[]> {\n const prune = options.prune ?? PRUNED_DIRS;\n const maxDepth = options.maxDepth ?? 24;\n const found: string[] = [];\n\n async function walk(dir: string, depth: number): Promise<void> {\n if (depth > maxDepth) return;\n let entries;\n try {\n entries = await readdir(dir, { withFileTypes: true });\n } catch {\n return; // unreadable directory is a skip, not a failure\n }\n for (const entry of entries) {\n const full = join(dir, entry.name);\n if (entry.isDirectory()) {\n if (prune.has(entry.name)) continue;\n await walk(full, depth + 1);\n } else if (entry.isFile() && match(full)) {\n found.push(full);\n }\n }\n }\n\n await walk(resolve(root), 0);\n return found.sort();\n}\n","/**\n * Deterministic artifact resolution: map every skill/agent/project-rule\n * reference in a trace to a file on disk. Trace content + filesystem lookup\n * only — no LLM guessing. Unresolved refs degrade to coverage entries and\n * warnings, never a crash (ADR 01003).\n */\nimport { basename, dirname, join, resolve } from \"node:path\";\nimport { configDir } from \"../trace/discover.js\";\nimport { coverAvailability } from \"./availability.js\";\nimport { findGitRoot, findInTree, safeMtime, safeRead, segments } from \"./fs.js\";\nimport { checkContent, hashFile, relPosix } from \"../capture/manifest.js\";\nimport type { SessionManifest } from \"../capture/types.js\";\nimport type { Trace } from \"../trace/types.js\";\nimport type {\n CoverageEntry,\n ResolvedArtifact,\n ResolvedArtifacts,\n} from \"./types.js\";\n\nexport interface ResolveOptions {\n /** Overrides the trace's recorded cwd (for deleted workspaces). */\n projectDir?: string;\n /** Ceiling for the parent-directory walk; defaults to the git root. */\n projectRoot?: string;\n env?: Record<string, string | undefined>;\n /**\n * List every offered-but-unused artifact in the coverage table rather than\n * only counting them (ADR 01016). Off by default: a real roster runs to\n * hundreds of skills.\n */\n reportUnusedArtifacts?: boolean;\n /**\n * The session manifest for this trace, when one was found (ADR 01024). It\n * makes staleness exact for the artifacts it recorded and changes nothing\n * else — no eval outcome, no exit code, no resolution decision.\n */\n manifest?: SessionManifest;\n}\n\n/**\n * Project-rules filenames, in the order they are checked. Different agent\n * tools use different names for the same artifact; all are read the same way.\n */\nexport const PROJECT_RULES_FILENAMES = [\n \"CLAUDE.md\",\n \"AGENTS.md\",\n \"GEMINI.md\",\n] as const;\n\n/** Agents that ship with Claude Code and have no definition file on disk. */\nconst BUILTIN_AGENTS = new Set([\n \"general-purpose\",\n \"claude\",\n \"Explore\",\n \"Plan\",\n \"statusline-setup\",\n \"fork\",\n]);\n\nexport async function resolveArtifacts(\n trace: Trace,\n options: ResolveOptions = {},\n): Promise<ResolvedArtifacts> {\n const projectDir = resolve(options.projectDir ?? trace.cwd);\n const userDir = configDir(options.env);\n const projectRoot = resolve(\n options.projectRoot ?? (await findGitRoot(projectDir)) ?? projectDir,\n );\n\n const artifacts: ResolvedArtifact[] = [];\n const coverage: CoverageEntry[] = [];\n const warnings: string[] = [];\n const seenPaths = new Set<string>();\n const seenRefs = new Set<string>();\n\n const add = (artifact: ResolvedArtifact): void => {\n if (seenPaths.has(artifact.path)) return;\n seenPaths.add(artifact.path);\n artifacts.push(artifact);\n };\n\n /** Record a resolved skill once, however many refs reached it. */\n const addSkill = (\n name: string,\n artifact: ResolvedArtifact,\n tried: string[],\n ): void => {\n const refKey = `skill:${name}`;\n if (seenRefs.has(refKey)) return;\n seenRefs.add(refKey);\n add(artifact);\n coverage.push({\n ref: name,\n kind: \"skill\",\n resolved: true,\n path: artifact.path,\n tried,\n });\n };\n\n for (const invocation of trace.skillInvocations) {\n // A `<command-name>` injection is the slash-command mechanism, and a slash\n // command is one of three things: a `.claude/commands/*.md` file, a skill\n // surfaced under its slash form, or a built-in with no file anywhere. Only\n // the filesystem can say which, so the shape of the reference decides\n // nothing on its own (ADR 01023).\n if (invocation.via === \"command-injection\") {\n const refKey = `command:${invocation.name}`;\n if (seenRefs.has(refKey)) continue;\n seenRefs.add(refKey);\n\n const command = await resolveSlashCommand(\n invocation.name,\n projectDir,\n userDir,\n );\n if (command.artifact) {\n add(command.artifact);\n coverage.push({\n ref: invocation.name,\n kind: \"slash-command\",\n resolved: true,\n path: command.artifact.path,\n tried: command.tried,\n });\n continue;\n }\n\n const skill = await resolveSkill(invocation.name, projectDir, userDir);\n if (skill.artifact) {\n addSkill(invocation.name, skill.artifact, skill.tried);\n // Resolved as a skill, so the slash-command lookup below must not\n // also record it — one reference yields one coverage row.\n continue;\n }\n\n // No definition file in any place a command or a skill could live. Claude\n // Code's own commands (`/model`, `/compact`) have no file by design, so\n // this is reported rather than warned about — and reported as what it is\n // rather than as a skill that went missing, which is the defect ADR 01016\n // recorded. A hard-coded list of built-in names was rejected: it would go\n // stale with every Claude Code release.\n coverage.push({\n ref: invocation.name,\n kind: \"slash-command\",\n resolved: false,\n tried: [...command.tried, ...skill.tried],\n note: \"built-in slash command, or not installed here (no definition file)\",\n });\n continue;\n }\n\n // A `Skill` tool call is unambiguous: it names a skill.\n const refKey = `skill:${invocation.name}`;\n if (seenRefs.has(refKey)) continue;\n const { artifact, tried } = await resolveSkill(\n invocation.name,\n projectDir,\n userDir,\n );\n if (artifact) {\n addSkill(invocation.name, artifact, tried);\n } else {\n seenRefs.add(refKey);\n coverage.push({ ref: invocation.name, kind: \"skill\", resolved: false, tried });\n warnings.push(\n `skill \"${invocation.name}\" was invoked but no SKILL.md was found (${tried.length} location(s) tried)`,\n );\n }\n }\n\n for (const spawn of trace.agentSpawns) {\n const refKey = `agent:${spawn.subagentType}`;\n if (seenRefs.has(refKey)) continue;\n seenRefs.add(refKey);\n if (BUILTIN_AGENTS.has(spawn.subagentType)) {\n coverage.push({\n ref: spawn.subagentType,\n kind: \"agent\",\n resolved: false,\n tried: [],\n note: \"built-in agent (no definition file)\",\n });\n continue;\n }\n const { artifact, tried } = await resolveAgent(\n spawn.subagentType,\n projectDir,\n userDir,\n );\n if (artifact) {\n add(artifact);\n coverage.push({\n ref: spawn.subagentType,\n kind: \"agent\",\n resolved: true,\n path: artifact.path,\n tried,\n });\n } else {\n coverage.push({\n ref: spawn.subagentType,\n kind: \"agent\",\n resolved: false,\n tried,\n });\n warnings.push(\n `agent \"${spawn.subagentType}\" was spawned but no definition file was found (${tried.length} location(s) tried)`,\n );\n }\n }\n\n const rules = await resolveProjectRules(projectDir, projectRoot);\n for (const rule of rules.artifacts) add(rule);\n const rulesEntry: CoverageEntry = {\n ref: \"project rules\",\n kind: \"project-rules\",\n resolved: rules.artifacts.length > 0,\n tried: rules.tried,\n ...(rules.artifacts.length === 0\n ? { note: \"no CLAUDE.md or AGENTS.md found\" }\n : {}),\n };\n coverage.push(rulesEntry);\n\n // One aggregated entry covers several files, so it has no single `path` to\n // stat; name them explicitly. Every other entry stats the file it resolved to.\n //\n // Before the roster pass, not after: staleness only has something to say\n // about rows that resolved to a file, and the roster's own offered-but-unused\n // rows never do. Annotating first also keeps these flags on the entries the\n // roster copies forward.\n await annotateStaleness(\n trace,\n coverage,\n new Map([[rulesEntry, rules.artifacts.map((a) => a.path)]]),\n warnings,\n projectRoot,\n projectDir,\n options.manifest,\n );\n\n // What the session was *offered* is the other half of coverage: resolution\n // only ever sees what it used (ADR 01016).\n const availability = coverAvailability(trace, coverage, {\n ...(options.reportUnusedArtifacts !== undefined\n ? { listUnused: options.reportUnusedArtifacts }\n : {}),\n });\n\n return {\n artifacts,\n coverage: availability.coverage,\n availability: availability.report,\n warnings,\n };\n}\n\n// ── Staleness ────────────────────────────────────────────────────\n\n/**\n * Say, for every resolved artifact, whether it is still the one the session\n * followed. Evals are read from the artifact *as it is now* while the session\n * followed it *as it was then*, so editing a SKILL.md after a session grades\n * that session against instructions it never saw.\n *\n * Two sources of evidence, and the better one wins **only on its own question**:\n *\n * - **A session manifest** (ADR 01024) recorded a sha256 per artifact when the\n * session started. A digest that differs is an exact \"this changed\"; a digest\n * that matches is an exact \"this did not\". Either one settles the row.\n * - **mtime** (ADR 01021) is the fallback, and a soft one: it is not content\n * identity, a fresh clone rewrites every mtime, and an unreadable mtime says\n * nothing.\n *\n * A manifest may therefore quiet the mtime warning for an artifact it covers —\n * that is the entire point, since a checkout otherwise flags everything in CI —\n * and it may do nothing else. It never reaches an eval outcome, never moves the\n * exit code, and it cannot silence a row it has no entry for. The observation\n * itself (`modifiedAt`) is reported either way, so nothing is hidden; only the\n * conclusion drawn from it changes.\n */\nasync function annotateStaleness(\n trace: Trace,\n coverage: CoverageEntry[],\n extraPaths: Map<CoverageEntry, string[]>,\n warnings: string[],\n projectRoot: string,\n projectDir: string,\n manifest?: SessionManifest,\n): Promise<void> {\n // No session end means no ground for the *heuristic* to stand on, and\n // guessing one would manufacture a warning out of no evidence. A manifest\n // supplies its own ground, so it still has something to say here.\n const endedAt =\n trace.endedAt !== undefined ? Date.parse(trace.endedAt) : Number.NaN;\n const haveEnd = Number.isFinite(endedAt);\n if (!haveEnd && manifest === undefined) return;\n\n const base =\n manifest === undefined\n ? projectRoot\n : joinBase(manifest, coverage, extraPaths, [\n projectDir,\n projectRoot,\n manifest.root,\n ]);\n\n /** Refs still resting on the mtime guess. */\n const guessed: string[] = [];\n /** Refs the manifest proved changed. */\n const changed: string[] = [];\n /** Whether the manifest spoke to any row at all. */\n let joined = false;\n\n for (const entry of coverage) {\n if (!entry.resolved) continue;\n const paths = extraPaths.get(entry) ?? (entry.path ? [entry.path] : []);\n if (paths.length === 0) continue;\n\n let newest: string | undefined;\n let outside = false;\n const digests = new Map<string, string>();\n for (const path of paths) {\n const mtime = await safeMtime(path);\n if (mtime !== null && (newest === undefined || mtime > newest)) {\n newest = mtime;\n }\n if (manifest === undefined) continue;\n // Keyed on the path relative to the base **both sides agree on**, so the\n // manifest still joins after the repository has been checked out\n // somewhere else. An artifact outside that base — a user-level or plugin\n // skill — has no relative path, and `capture` is project-scoped, so it\n // was never recordable in the first place. That is a different sentence\n // from \"it changed\" and gets one.\n const rel = relPosix(base, path);\n if (rel === null) {\n outside = true;\n continue;\n }\n const digest = await hashFile(path);\n if (digest !== null) digests.set(rel, digest);\n }\n if (newest !== undefined) entry.modifiedAt = newest;\n\n const check =\n manifest === undefined\n ? ({\n status: \"skipped\",\n reason: \"no session manifest for this trace\",\n } as const)\n : outside && digests.size === 0\n ? ({\n status: \"skipped\",\n reason:\n \"outside the project root, so no session manifest could record it\",\n } as const)\n : checkContent(manifest, digests);\n entry.contentCheck = check;\n if (check.status !== \"skipped\") joined = true;\n\n if (check.status === \"mismatch\") {\n entry.stale = true;\n changed.push(entry.ref);\n continue;\n }\n if (check.status === \"match\") {\n // Exact, and it answers mtime's own question — so the guess does not run.\n entry.stale = false;\n continue;\n }\n if (!haveEnd || newest === undefined) continue;\n entry.stale = Date.parse(newest) > endedAt;\n if (entry.stale) guessed.push(entry.ref);\n }\n\n if (changed.length > 0) {\n warnings.push(\n `${changed.length} artifact(s) changed since the session started ` +\n `(${changed.join(\", \")}) — the session manifest recorded a different ` +\n `sha256, so their evals are not the instructions this session followed.`,\n );\n }\n if (guessed.length > 0) {\n // One warning, not one per artifact: a fresh checkout flags everything, and\n // a wall of identical lines is how a real signal gets tuned out.\n warnings.push(\n `${guessed.length} artifact(s) were modified after the session ended ` +\n `(${guessed.join(\", \")}) — their evals may not be the instructions ` +\n `this session followed. mtime is a heuristic, not content identity.`,\n );\n }\n // A manifest that speaks to nothing is a different problem from a manifest\n // with a gap in it, and it degrades row by row into the same sentence — the\n // one an absent manifest produces. Say it once, at the top.\n //\n // Only when it recorded something: a manifest with no artifacts in it — a\n // project whose instruction files all live outside the capture scope — has\n // nothing to match, which is not a join failure.\n if (manifest !== undefined && manifest.artifacts.length > 0 && !joined) {\n warnings.push(\n `the session manifest matched no artifact in this run — it recorded ` +\n `${manifest.artifacts.length} artifact(s) relative to \"${manifest.root}\", ` +\n `and nothing resolved here lines up with them, so every hash check ` +\n `fell back to the mtime heuristic. Check that --project names the ` +\n `directory the session ran in.`,\n );\n }\n}\n\n/**\n * Pick the base to key the manifest join on.\n *\n * `capture` writes each path relative to *its* project root — the session's\n * cwd — while resolution keys on the git root when `--project` is absent. In a\n * monorepo those are different directories, so one file gets two different\n * relative paths and every hash check silently degraded to `skipped`: exactly\n * the guesswork a manifest exists to remove, and quietly, row by row.\n *\n * Rather than pick a side, ask the data. Each candidate base is scored by how\n * many resolved artifacts it turns into a path the manifest actually recorded,\n * and the best score wins — with candidate order as the tiebreak, so a tie\n * keeps today's behaviour. `manifest.root` joins the candidates because it is\n * the capturing machine's own answer; it may have been redacted, or the\n * repository may have moved since, in which case it simply scores zero.\n */\nfunction joinBase(\n manifest: SessionManifest,\n coverage: CoverageEntry[],\n extraPaths: Map<CoverageEntry, string[]>,\n candidates: string[],\n): string {\n const recorded = new Set(manifest.artifacts.map((a) => a.path));\n const paths = coverage\n .filter((entry) => entry.resolved)\n .flatMap((entry) => extraPaths.get(entry) ?? (entry.path ? [entry.path] : []));\n\n let best = candidates[0] as string;\n let bestScore = -1;\n for (const candidate of candidates) {\n if (typeof candidate !== \"string\" || candidate.length === 0) continue;\n let score = 0;\n for (const path of paths) {\n let rel: string | null;\n try {\n rel = relPosix(candidate, path);\n } catch {\n // A redacted `root` can be anything, including something `resolve`\n // refuses. A candidate that cannot be used simply does not win.\n continue;\n }\n if (rel !== null && recorded.has(rel)) score += 1;\n }\n if (score > bestScore) {\n best = candidate;\n bestScore = score;\n }\n }\n return best;\n}\n\n// ── Skills ───────────────────────────────────────────────────────\n\nasync function resolveSkill(\n name: string,\n projectDir: string,\n userDir: string,\n): Promise<{ artifact: ResolvedArtifact | null; tried: string[] }> {\n const tried: string[] = [];\n // `plugin:skill` refs look up the skill by its short name inside the\n // user plugin store; plain refs check project dirs then the user store.\n const [pluginName, shortName] = splitPluginRef(name);\n\n const candidates: Array<{ path: string; origin: ResolvedArtifact[\"origin\"] }> =\n [];\n if (pluginName === null) {\n for (const dir of [\"skills\", join(\"src\", \"skills\"), join(\".claude\", \"skills\")]) {\n candidates.push({\n path: join(projectDir, dir, shortName, \"SKILL.md\"),\n origin: \"project\",\n });\n }\n candidates.push({\n path: join(userDir, \"skills\", shortName, \"SKILL.md\"),\n origin: \"user\",\n });\n }\n\n for (const candidate of candidates) {\n tried.push(candidate.path);\n const content = await safeRead(candidate.path);\n if (content !== null) {\n return {\n artifact: {\n name,\n type: \"skill\",\n path: candidate.path,\n content,\n origin: candidate.origin,\n },\n tried,\n };\n }\n }\n\n // Plugin store: ~/.claude/plugins/**/skills/<shortName>/SKILL.md. The store\n // layout varies (marketplace caches nest deeper), so search recursively.\n const pluginRoot = join(userDir, \"plugins\");\n tried.push(join(pluginRoot, \"**\", \"skills\", shortName, \"SKILL.md\"));\n const found = await findInTree(\n pluginRoot,\n (path) =>\n basename(path) === \"SKILL.md\" &&\n basename(dirname(path)) === shortName &&\n (pluginName === null || hasPathSegment(path, pluginName)),\n );\n if (found) {\n const content = await safeRead(found);\n if (content !== null) {\n return {\n artifact: { name, type: \"skill\", path: found, content, origin: \"plugin\" },\n tried,\n };\n }\n }\n\n return { artifact: null, tried };\n}\n\n// ── Slash commands ───────────────────────────────────────────────\n\n/**\n * `.claude/commands/<name>.md`, in the three places Claude Code reads them:\n * the project, the user's config directory, and the plugin store.\n *\n * Two shapes matter and neither is guessed at. Subdirectories under\n * `commands/` **organize** rather than namespace — `commands/release/tag.md`\n * is still invoked as `/tag` — so a plain name falls back to a recursive\n * search after the direct hit misses. A `plugin:command` name is plugin\n * namespacing and is looked up in the store by its short name, exactly as\n * `resolveSkill` does for `plugin:skill`; project and user directories are not\n * checked, because a namespace is not something a local file can claim.\n */\nasync function resolveSlashCommand(\n name: string,\n projectDir: string,\n userDir: string,\n): Promise<{ artifact: ResolvedArtifact | null; tried: string[] }> {\n const tried: string[] = [];\n const [pluginName, shortName] = splitPluginRef(name);\n\n const made = (\n path: string,\n content: string,\n origin: ResolvedArtifact[\"origin\"],\n ): { artifact: ResolvedArtifact; tried: string[] } => ({\n artifact: { name, type: \"slash-command\", path, content, origin },\n tried,\n });\n\n if (pluginName === null) {\n const dirs: Array<{ dir: string; origin: ResolvedArtifact[\"origin\"] }> = [\n { dir: join(projectDir, \".claude\", \"commands\"), origin: \"project\" },\n { dir: join(userDir, \"commands\"), origin: \"user\" },\n ];\n for (const { dir, origin } of dirs) {\n const path = join(dir, `${shortName}.md`);\n tried.push(path);\n const content = await safeRead(path);\n if (content !== null) return made(path, content, origin);\n }\n for (const { dir, origin } of dirs) {\n tried.push(join(dir, \"**\", `${shortName}.md`));\n const found = await findInTree(\n dir,\n (path) => basename(path) === `${shortName}.md`,\n );\n if (found === null) continue;\n const content = await safeRead(found);\n if (content !== null) return made(found, content, origin);\n }\n return { artifact: null, tried };\n }\n\n const pluginRoot = join(userDir, \"plugins\");\n tried.push(join(pluginRoot, \"**\", \"commands\", `${shortName}.md`));\n const found = await findInTree(\n pluginRoot,\n (path) =>\n basename(path) === `${shortName}.md` &&\n segments(path).includes(\"commands\") &&\n hasPathSegment(path, pluginName),\n );\n if (found !== null) {\n const content = await safeRead(found);\n if (content !== null) return made(found, content, \"plugin\");\n }\n return { artifact: null, tried };\n}\n\n/** Path segments, separator-normalized, for convention matching. */\n/**\n * Split `plugin:name` into its two halves.\n *\n * On the **first** colon, keeping the remainder: `split(\":\", 2)` throws away\n * everything past the second field, so `myplugin:release:tag` resolved as a\n * lookup for `release` — a different artifact, reported as if it were the one\n * asked for. The namespace is the part before the first colon; everything\n * after it is the name, whatever it contains.\n */\nfunction splitPluginRef(name: string): [string | null, string] {\n const at = name.indexOf(\":\");\n if (at === -1) return [null, name];\n return [name.slice(0, at), name.slice(at + 1)];\n}\n\n/**\n * True when `pluginName` is a *segment* of `path`.\n *\n * `path.includes(pluginName)` was unanchored over the whole absolute path, so\n * a plugin named `docs` matched `~/.claude/plugins/other-plugin/commands/\n * docs-helper/x.md` — and, on Windows, matched every path under a home\n * directory of `C:\\Users\\docs\\`. A plugin is a directory, so the test is\n * whether the path passes through a directory of that name.\n */\nfunction hasPathSegment(path: string, pluginName: string): boolean {\n return segments(path).includes(pluginName);\n}\n\n// ── Agents ───────────────────────────────────────────────────────\n\nasync function resolveAgent(\n subagentType: string,\n projectDir: string,\n userDir: string,\n): Promise<{ artifact: ResolvedArtifact | null; tried: string[] }> {\n const tried: string[] = [];\n // Plugin agents are referenced as `plugin:agent`; the file is the short name.\n const shortName = splitPluginRef(subagentType)[1];\n\n const candidates: Array<{ path: string; origin: ResolvedArtifact[\"origin\"] }> = [\n { path: join(projectDir, \".claude\", \"agents\", `${shortName}.md`), origin: \"project\" },\n { path: join(projectDir, \"agents\", `${shortName}.md`), origin: \"project\" },\n { path: join(userDir, \"agents\", `${shortName}.md`), origin: \"user\" },\n ];\n\n for (const candidate of candidates) {\n tried.push(candidate.path);\n const content = await safeRead(candidate.path);\n if (content !== null) {\n return {\n artifact: {\n name: subagentType,\n type: \"agent\",\n path: candidate.path,\n content,\n origin: candidate.origin,\n },\n tried,\n };\n }\n }\n return { artifact: null, tried };\n}\n\n// ── Project rules ────────────────────────────────────────────────\n\nasync function resolveProjectRules(\n projectDir: string,\n projectRoot: string,\n): Promise<{ artifacts: ResolvedArtifact[]; tried: string[] }> {\n const artifacts: ResolvedArtifact[] = [];\n const tried: string[] = [];\n\n // Walk from the cwd up to the project root (inclusive), then check .claude/.\n const dirs: string[] = [];\n let current = projectDir;\n for (let depth = 0; depth < 32; depth += 1) {\n dirs.push(current);\n if (current === projectRoot) break;\n const parent = dirname(current);\n if (parent === current) break;\n current = parent;\n }\n dirs.push(join(projectRoot, \".claude\"));\n\n for (const dir of dirs) {\n for (const filename of PROJECT_RULES_FILENAMES) {\n const path = join(dir, filename);\n tried.push(path);\n const content = await safeRead(path);\n if (content !== null) {\n artifacts.push({\n name: filename,\n type: \"project-rules\",\n path,\n content,\n origin: \"project\",\n });\n }\n }\n }\n return { artifacts, tried };\n}\n\n// Filesystem helpers live in ./fs.js, shared with static discovery.\n","/**\n * The artifact vocabulary `manni tracevals` implements:\n * `manni:artifact-evals:1.1.0`, the built-in the metadata tool registers\n * under `src/meta/schemas/` (proposal 0076). Artifacts are validated against\n * that schema itself, imported and bundled into the build, so tracevals and\n * `manni meta validate` read the same bytes and the built CLI never reads a\n * `schemas/` directory at runtime.\n *\n * 1.1.0 rather than 1.0.0 because it names `tool-order`, a grader this tool\n * ships. The open vocabulary accepts any kebab grader name at either version.\n *\n * tracevals ships no copy of the schema. A copy is a second artifact to keep\n * in step, and the two it used to publish had drifted: they kept\n * `eval-provenance` and the `info` severity after 0046 removed both. A\n * consumer who wants to validate artifacts names `manni:artifact-evals:1.1.0`\n * to `manni meta validate`, or validates against the object below.\n *\n * The validator is this tool's own Ajv rather than meta's `Validator`, which\n * takes refs it can load rather than a schema object. Violations are converted\n * to `FieldError` here so everything downstream — the planner, the reporters —\n * sees the one finding shape the family reports.\n */\nimport { Ajv2020 } from \"ajv/dist/2020.js\";\nimport type { DefinedError, ErrorObject } from \"ajv\";\nimport type { FieldError } from \"../../meta/index.js\";\nimport schema from \"../../meta/schemas/artifact-evals/1.1.0.json\" with { type: \"json\" };\n\n/** The artifact-evals vocabulary, for validators that accept an inline schema. */\nexport const artifactEvalsSchema = schema as unknown as Record<string, unknown>;\n\n/** The vocabulary's `$id`: `manni:artifact-evals:1.1.0`. */\nexport const ARTIFACT_EVALS_SCHEMA_ID: string = schema.$id;\n\nconst ajv = new Ajv2020({ allErrors: true, allowUnionTypes: true });\n// The vocabulary marks `metadata` `x-manni-location: external` (0047). The\n// mark is an annotation for `manni meta relocate`, not a constraint, so it is\n// registered rather than validated — but it has to be registered, or Ajv's\n// strict mode refuses to compile the schema at all.\najv.addKeyword({ keyword: \"x-manni-location\" });\nconst validateArtifact = ajv.compile(artifactEvalsSchema);\n\n/**\n * The stable identifier inside a violation, when its keyword names a *thing*.\n * Keywords whose parameter is a schema-authored value (`pattern`'s regex,\n * `enum`'s list) are deliberately left without one: including those would\n * change a finding's identity every time the schema author edited the rule.\n */\nfunction subjectOf(e: DefinedError): string | undefined {\n switch (e.keyword) {\n case \"required\":\n return e.params.missingProperty;\n case \"additionalProperties\":\n return e.params.additionalProperty;\n case \"format\":\n return e.params.format;\n case \"type\":\n return e.params.type;\n default:\n return undefined;\n }\n}\n\n/**\n * Validate an artifact's whole front matter against the vocabulary. The schema is\n * document-rooted — `metadata` stays open so other tools' members pass\n * untouched — which is why it is handed the entire object rather than the\n * `evals` value alone.\n */\nexport function artifactEvalsErrors(\n data: Record<string, unknown>,\n lineFor: (pointer: string) => number | undefined,\n): FieldError[] {\n if (validateArtifact(data)) return [];\n const errors: FieldError[] = [];\n for (const raw of validateArtifact.errors ?? []) {\n errors.push(toFieldError(raw, lineFor));\n }\n return errors;\n}\n\nfunction toFieldError(\n e: ErrorObject,\n lineFor: (pointer: string) => number | undefined,\n): FieldError {\n const subject = subjectOf(e as DefinedError);\n // `required` and `additionalProperties` point `instancePath` at the *parent*\n // and name the property in the message, so the property is spelled out\n // rather than left to the reader to find.\n const message =\n subject !== undefined && (e.keyword === \"required\" || e.keyword === \"additionalProperties\")\n ? `${e.message ?? \"is invalid\"} (\"${subject}\")`\n : (e.message ?? \"is invalid\");\n const line = lineFor(e.instancePath);\n return {\n schema: ARTIFACT_EVALS_SCHEMA_ID,\n instancePath: e.instancePath,\n message,\n keyword: e.keyword,\n ...(subject !== undefined ? { subject } : {}),\n ...(line !== undefined ? { line } : {}),\n };\n}\n","/**\n * Eval extraction: read the `metadata.evals` block from an artifact via the\n * metadata library and validate the artifact's whole front matter against\n * `manni:artifact-evals:1.1.0`. Invalid blocks are reported as errors with\n * source line numbers, never silently ignored (ADR 01002).\n *\n * The vocabulary is the metadata tool's registered built-in; this tool\n * implements behavior against it (ADR 01010) and bundles it rather than\n * shipping a copy — see `schema.ts`. The schema is document-rooted, which is\n * why validation is handed the entire front matter object rather than the\n * `evals` value alone.\n */\nimport {\n extractFrontmatter,\n type ExtractedMetadata,\n type FieldError,\n} from \"../../meta/index.js\";\nimport { metaProvenanceEntries } from \"../../meta/internal.js\";\nimport type { ResolvedArtifact } from \"../artifacts/types.js\";\nimport type { TraceTarget } from \"../core/target.js\";\nimport { ARTIFACT_EVALS_SCHEMA_ID, artifactEvalsErrors } from \"./schema.js\";\n\nexport { ARTIFACT_EVALS_SCHEMA_ID };\n\n/**\n * The family scale (`src/shared/severity.ts`): `notice | warning | error`.\n * proposal.2 spelled the quietest level `info`; proposal.4 spells it the way\n * every other manni tool does, so a finding reads the same everywhere.\n */\nexport type { Severity } from \"../../shared/severity.js\";\nimport type { Severity } from \"../../shared/severity.js\";\n\n/**\n * `capability` probes a boundary and is expected to fail sometimes;\n * `regression` protects behavior that already works. Reported, not enforced.\n */\nexport type EvalType = \"capability\" | \"regression\";\n\nexport interface EvalEntry {\n /** Stable identifier. Required by the schema on object entries. */\n id: string;\n /** Absent on graders whose options say everything. */\n assertion?: string;\n type: EvalType;\n /** \"ai\", \"human\", \"command\", or a deterministic grader kind. */\n grader: string;\n /** Overrides the configured judge provider for this eval only. */\n provider?: string;\n /** Overrides the judge model for this eval only; a CLI --model still wins. */\n model?: string;\n /** Ensemble runs for this eval only; a CLI --runs still wins. */\n runs?: number;\n /** Which bytes the grader receives. Absent means the whole transcript. */\n target?: TraceTarget;\n /** Relative contribution to the run's pass rate. Never changes the outcome. */\n weight?: number;\n options?: Record<string, unknown>;\n severity: Severity;\n evidence?: string;\n examples?: { pass?: string[]; fail?: string[] };\n /** Per-entry opt-out; reported as skipped, never silently dropped. */\n skip?: boolean;\n /**\n * Maps a `tool:*` grader's own severities onto eval severities. Accepted so\n * one entry vocabulary ports across both docmeta eval schemas; ignored here,\n * because this repo implements no `tool:*` graders.\n */\n severityMap?: Record<string, Severity>;\n /** Command-graded evals: argv, with `{trace}` substituted at grade time. */\n command?: string[];\n successExitCodes?: number[];\n timeoutMs?: number;\n /** sha256 of `assertion` when the check script was generated. */\n generatedAssertionHash?: string;\n}\n\nexport interface ExtractedEvals {\n evals: EvalEntry[];\n /** Schema violations in the front matter, with line numbers when known. */\n errors: FieldError[];\n /** Whether a `metadata.evals` block was present. */\n declared: boolean;\n /** `metadata.eval-skip` — skip this artifact's evals entirely. */\n skip: boolean;\n /**\n * Which model proposed each eval, by eval id, from\n * `metadata.meta-provenance` — the family's attribution record (0046),\n * written by `fill` through the same merge `manni meta fill` uses. Reading\n * it is what lets the judge notice it is grading an assertion it wrote\n * itself, which is bias on the *criterion* rather than on the session.\n *\n * Names are bare model names, the same spelling a provider's `modelName()`\n * returns, so the two sides of that comparison can actually match.\n *\n * A list because one id may appear under several `generated-by` entries —\n * a re-fill by a second model extends the block rather than replacing it.\n */\n proposedBy: Map<string, string[]>;\n}\n\n/**\n * Members of `metadata` this vocabulary claims. The schema cannot reject the\n * rest: `metadata` is the host tool's extension bag and must stay open, so a\n * misspelled `eval-skpi` would validate and quietly do nothing. Reserving the\n * `eval-` prefix at run time restores the closed block's loud-typo property.\n */\nconst CLAIMED_KEYS = [\"evals\", \"eval-skip\", \"meta-provenance\"] as const;\n\n/**\n * The one member under the reserved prefix this vocabulary keeps. proposal.4\n * narrowed the guard to `^eval-(?!skip$)`, so `eval-provenance` — proposal.2's\n * name for the attribution trail — is now an error rather than a member\n * everything downstream would silently ignore.\n */\nconst PREFIX_EXCEPTION = \"eval-skip\";\n\n/** A YAML mapping, as opposed to a list, a scalar, or null. */\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/**\n * `metadata` and everything under it, for one artifact.\n *\n * `supplied` is the seam for the external trail (`evals/external.ts`): the\n * artifact's front matter with a manifest-supplied `metadata` block already\n * merged in, by meta's own merge. It is the whole extraction rather than the\n * block alone, because the schema is document-rooted and validates the entire\n * front matter — handing it the block would validate the wrong document.\n * Omitted, the artifact's own front matter is read, which is what every caller\n * with no collections does.\n */\nexport function extractEvals(\n artifact: ResolvedArtifact,\n supplied?: ExtractedMetadata,\n): ExtractedEvals {\n const extracted = supplied ?? extractFrontmatter(artifact.content, \"markdown\");\n const metadata = extracted.data.metadata;\n // The schema types `metadata` as an object. Anything else — a string, a\n // list, a number — is a fault the validator must report, so it is kept\n // distinct from \"absent\" rather than folded into it.\n const bag = isPlainObject(metadata) ? metadata : undefined;\n const declared = bag !== undefined && bag.evals !== undefined;\n\n // `present` describes the *page*, and the merge leaves it alone. An artifact\n // with no front matter at all whose block a manifest supplies therefore reads\n // as absent unless the merged `metadata` is consulted too — the case a\n // relocated `CLAUDE.md` is in, since project rules rarely carry front matter.\n if (!extracted.present && metadata === undefined) {\n return { evals: [], errors: [], declared: false, skip: false, proposedBy: new Map() };\n }\n\n const typoErrors = reservedPrefixErrors(bag, extracted.lineFor);\n if (typoErrors.length > 0) {\n return { evals: [], errors: typoErrors, declared, skip: false, proposedBy: new Map() };\n }\n\n // Skip the validator only for an artifact this vocabulary has nothing to say\n // about: `metadata` absent, or a well-formed object claiming none of its\n // keys. A `metadata` that is not an object still has to be validated (the\n // schema types it), and so does one carrying only `meta-provenance` — the\n // block is malformed-or-not either way, and a malformed one is never\n // silently ignored.\n const wellFormed = metadata === undefined || bag !== undefined;\n const claimsNothing =\n bag === undefined ||\n !CLAIMED_KEYS.some((key) => bag[key] !== undefined);\n if (wellFormed && claimsNothing) {\n return {\n evals: [],\n errors: [],\n declared: false,\n skip: false,\n proposedBy: new Map(),\n };\n }\n\n const errors = artifactEvalsErrors(extracted.data, extracted.lineFor);\n if (errors.length > 0) {\n return { evals: [], errors, declared, skip: false, proposedBy: new Map() };\n }\n\n // Validation passed, so `metadata` is an object if it is present at all.\n const valid = bag ?? {};\n const skip = valid[\"eval-skip\"] === true;\n return {\n evals: normalizeBlock(valid.evals),\n errors: [],\n declared,\n skip,\n proposedBy: readProvenance(valid[\"meta-provenance\"]),\n };\n}\n\n/**\n * `metadata.meta-provenance` as eval id → the models that proposed it.\n *\n * The entries come from `metaProvenanceEntries`, the family's reader (0046),\n * so the block is read exactly the way `fill` wrote it and the way docevals\n * reads its own. Tolerant by design: the block has already passed the schema,\n * and a shape it did not constrain is not worth failing a run over — the worst\n * outcome of ignoring a malformed entry is one missing bias warning, while the\n * worst outcome of throwing is a run that will not start.\n */\nfunction readProvenance(raw: unknown): Map<string, string[]> {\n const out = new Map<string, string[]>();\n for (const entry of metaProvenanceEntries(raw)) {\n const by = entry[\"generated-by\"];\n for (const id of entry.evals) {\n const list = out.get(id) ?? [];\n if (!list.includes(by)) list.push(by);\n out.set(id, list);\n }\n }\n return out;\n}\n\n/**\n * A key inside `metadata` under the reserved `eval-` prefix that is not the\n * one member this vocabulary claims there. Reported against the offending key\n * so the fix is obvious.\n *\n * proposal.4's guard is `^eval-(?!skip$)`: `eval-provenance`, which proposal.2\n * excepted, now lands here rather than being read by nothing.\n */\nfunction reservedPrefixErrors(\n bag: Record<string, unknown> | undefined,\n lineFor: (pointer: string) => number | undefined,\n): FieldError[] {\n if (bag === undefined) return [];\n const errors: FieldError[] = [];\n for (const key of Object.keys(bag)) {\n // Detection is case-insensitive while the exception is not, deliberately:\n // YAML keys are case-sensitive, so `Eval-skip` is never a valid spelling of\n // `eval-skip` and should be reported rather than accepted. Do not \"fix\" the\n // asymmetry by matching the exception case-insensitively — that would\n // silently accept exactly the misspellings this guard exists to catch.\n if (!/^eval-/i.test(key) || key === PREFIX_EXCEPTION) continue;\n const line = lineFor(`/metadata/${key}`);\n errors.push({\n schema: ARTIFACT_EVALS_SCHEMA_ID,\n instancePath: `/metadata/${key}`,\n message:\n `unrecognized \"eval-\" key; the only one this vocabulary claims under ` +\n `that prefix is ${PREFIX_EXCEPTION} (its other members are ` +\n `${CLAIMED_KEYS.filter((k) => k !== PREFIX_EXCEPTION).join(\" and \")})`,\n keyword: \"additionalProperties\",\n subject: key,\n ...(line !== undefined ? { line } : {}),\n });\n }\n return errors;\n}\n\n/**\n * The block is one assertion as a string, or a list of entries. An absent key\n * yields nothing — an artifact with no evals omits it rather than declaring an\n * empty list, which the schema also refuses.\n */\nfunction normalizeBlock(raw: unknown): EvalEntry[] {\n if (typeof raw === \"string\") return [normalizeEntry(raw, 0)];\n if (!Array.isArray(raw)) return [];\n return raw.map((entry, index) => normalizeEntry(entry, index));\n}\n\nfunction normalizeEntry(raw: unknown, index: number): EvalEntry {\n // The string shorthand is the legitimately id-less form, so its identity is\n // positional. Object entries carry a required `id` precisely because a\n // position-derived name breaks the history join whenever entries move.\n if (typeof raw === \"string\") {\n return {\n id: `eval-${index + 1}`,\n assertion: raw,\n type: \"regression\",\n grader: \"ai\",\n severity: \"error\",\n };\n }\n\n const obj = raw as Record<string, unknown>;\n const entry: EvalEntry = {\n id: obj.id as string,\n // Optional since artifact-evals proposal.2: a `tool-usage` criterion says\n // everything in `options`, and demanding a sentence no grader reads was\n // the one place this vocabulary disagreed with the page side. The schema\n // still requires it for `ai`, `human`, and a bare entry (which defaults to\n // `ai`), so anything that actually needs an assertion still has one.\n ...(typeof obj.assertion === \"string\" ? { assertion: obj.assertion } : {}),\n type: (obj.type as EvalType | undefined) ?? \"regression\",\n grader: typeof obj.grader === \"string\" ? obj.grader : \"ai\",\n severity: (obj.severity as Severity | undefined) ?? \"error\",\n };\n if (typeof obj.provider === \"string\") entry.provider = obj.provider;\n if (typeof obj.model === \"string\") entry.model = obj.model;\n if (typeof obj.runs === \"number\") entry.runs = obj.runs;\n if (typeof obj.weight === \"number\") entry.weight = obj.weight;\n if (typeof obj.target === \"string\" || (obj.target && typeof obj.target === \"object\")) {\n entry.target = obj.target as TraceTarget;\n }\n if (obj.options && typeof obj.options === \"object\") {\n entry.options = obj.options as Record<string, unknown>;\n }\n if (typeof obj.evidence === \"string\") entry.evidence = obj.evidence;\n if (obj.examples && typeof obj.examples === \"object\") {\n entry.examples = normalizeExamples(obj.examples as Record<string, unknown>);\n }\n if (obj.skip === true) entry.skip = true;\n if (obj[\"severity-map\"] && typeof obj[\"severity-map\"] === \"object\") {\n entry.severityMap = obj[\"severity-map\"] as Record<string, Severity>;\n }\n if (Array.isArray(obj.command)) entry.command = obj.command as string[];\n if (Array.isArray(obj[\"success-exit-codes\"])) {\n entry.successExitCodes = obj[\"success-exit-codes\"] as number[];\n }\n if (typeof obj[\"timeout-ms\"] === \"number\") {\n entry.timeoutMs = obj[\"timeout-ms\"];\n }\n if (typeof obj[\"generated-assertion-hash\"] === \"string\") {\n entry.generatedAssertionHash = obj[\"generated-assertion-hash\"];\n }\n return entry;\n}\n\n/** Anchors are one example or a list of them; downstream sees only the list. */\nfunction normalizeExamples(\n raw: Record<string, unknown>,\n): { pass?: string[]; fail?: string[] } {\n const out: { pass?: string[]; fail?: string[] } = {};\n const pass = anchorList(raw.pass);\n const fail = anchorList(raw.fail);\n if (pass) out.pass = pass;\n if (fail) out.fail = fail;\n return out;\n}\n\nfunction anchorList(raw: unknown): string[] | undefined {\n if (typeof raw === \"string\") return [raw];\n if (Array.isArray(raw)) return raw.filter((e): e is string => typeof e === \"string\");\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AASA,SAAS,kBAAkB;AAC3B,SAAS,OAAO,UAAU,iBAAiB;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAOA,SAAS,UAAU,MAA+B;AACvD,SAAO,WAAW,QAAQ,EAAE,OAAO,IAAI,EAAE,OAAO,KAAK;AACvD;AAGA,eAAsB,SAAS,MAAsC;AACnE,MAAI;AAGF,WAAO,UAAU,MAAM,SAAS,IAAI,CAAC;AAAA,EACvC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGO,SAAS,SAAS,MAAc,MAA6B;AAClE,QAAM,MAAM,SAAS,QAAQ,IAAI,GAAG,QAAQ,IAAI,CAAC;AACjD,MAAI,QAAQ,MAAM,IAAI,WAAW,IAAI,KAAK,WAAW,GAAG,EAAG,QAAO;AAClE,SAAO,IAAI,MAAM,GAAG,EAAE,KAAK,GAAG;AAChC;AAOO,SAAS,cAAc,WAA2B;AACvD,QAAM,UAAU,UAAU,QAAQ,oBAAoB,GAAG,EAAE,QAAQ,QAAQ,EAAE;AAC7E,SAAO,QAAQ,SAAS,IAAI,QAAQ,MAAM,GAAG,GAAG,IAAI;AACtD;AAEO,SAAS,gBAAgB,KAAa,W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ACtD,MAAI,OAAO,QAAQ,SAAU,QAAO,CAAC,GAAG;AACxC,MAAI,MAAM,QAAQ,GAAG,EAAG,QAAO,IAAI,OAAO,CAAC,MAAmB,OAAO,MAAM,QAAQ;AACnF,SAAO;AACT;","names":["readFile","dirname","join","resolve","sep","dirname","join","resolve","resolve","refKey","join","dirname","found"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/shared/collections.ts","../src/shared/globs.ts","../src/shared/page-manifest.ts","../src/shared/encryption.ts","../src/shared/tools.ts","../src/shared/config-file.ts","../src/shared/git-root.ts"],"sourcesContent":["/**\n * `collections:`, the family-level home for document sets (proposal 0041).\n *\n * A collection names a set of documents once, at the top level of\n * `manni.config.yaml`, and every tool reads the same declaration: the metadata\n * tool validates its members, `query` exposes it as a view, and `a11y check`\n * seeds from its `url`. Only the *declaration* is shared. Loading a manifest\n * and merging it into `ExtractedMetadata` stays with the metadata tool,\n * because that type is the metadata tool's.\n *\n * Every refusal in this parser is a shape that would otherwise read as\n * configured and do nothing, or do something nobody can see. The manifest\n * rules are 0037's, moved here unchanged in substance: an entry with an empty\n * `keys` list owns nothing, one key under two manifests of a collection would need a\n * tiebreak (0020 refuses tiebreaks), and `$schema` from external metadata\n * would let a private file pick the schema a public document is judged by\n * (0015) with the provenance lost at the merge.\n */\nimport picomatch from \"picomatch\";\nimport { matchesFileGlob } from \"./globs.js\";\nimport { posix, win32 } from \"node:path\";\nimport {\n PAGE_PLACEHOLDER,\n hasPagePlaceholder,\n normalizeManifestPattern,\n} from \"./page-manifest.js\";\n\n/** One external-metadata manifest (proposals 0037, 0038, 0039) joined to a collection. */\nexport interface ExternalMetadataConfig {\n file: string;\n /**\n * The top-level keys the manifest owns. Absent (proposal 0068), it owns\n * what each page's schemas mark `x-manni-location: external`, as `ownsKey`\n * decides.\n */\n keys?: string[];\n tokenEnv?: string;\n join?: string;\n}\n\n/** One named document set, as declared under the top-level `collections:` key. */\nexport interface CollectionConfig {\n name: string;\n paths: string[];\n exclude: string[];\n externalMetadata: ExternalMetadataConfig[];\n /** Where the collection is published; `manni a11y check` seeds from it. */\n url?: string;\n}\n\nconst COLLECTION_KEYS = [\n \"name\",\n \"paths\",\n \"exclude\",\n \"url\",\n \"externalMetadata\",\n] as const;\n\nconst EXTERNAL_METADATA_KEYS = [\"file\", \"keys\", \"tokenEnv\", \"join\"] as const;\n\n/**\n * The join that names documents by path, and the default. The metadata tool\n * spells it `PATH_JOIN` in `src/meta/core/external-metadata.ts`; the literal\n * is repeated here for the same reason as `SCHEMA_KEY` below.\n */\nconst PATH_JOIN = \"path\";\n\n/**\n * The document-level schema key. The metadata tool spells it\n * `FILE_SCHEMA_KEY` in `src/meta/core/resolve-schema.ts`; the literal is\n * repeated here so the shared layer does not import a tool's module. Keep the\n * two in step.\n */\nconst SCHEMA_KEY = \"$schema\";\n\n/**\n * The label `load-files.ts` gives stdin (`STDIN_LABEL`). Repeated as a literal\n * for the same reason as `SCHEMA_KEY`: the shared layer does not depend on the\n * metadata tool. Stdin has no path, so it is a member of nothing.\n */\nconst STDIN = \"<stdin>\";\n\n/** Is this manifest reference a URL? The `url` branch of `classifyRef`. */\nfunction isUrlRef(ref: string): boolean {\n return /^https?:\\/\\//i.test(ref);\n}\n\n/**\n * Whether a URL may name an external-metadata manifest: `https://` anywhere,\n * or `http://` on a loopback host only, where plaintext leaks nothing.\n * Userinfo is refused because the URL is printed in every diagnostic and a\n * secret in it would print too. Returns the reason it may not, or `null`.\n */\nexport function externalMetadataUrlProblem(url: string): string | null {\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n return \"is not a valid URL\";\n }\n if (parsed.username !== \"\" || parsed.password !== \"\") {\n return 'carries a credential in the URL; put the token in an environment variable and name it with \"tokenEnv\"';\n }\n if (parsed.protocol === \"https:\") return null;\n if (parsed.protocol === \"http:\" && isLoopback(parsed.hostname)) return null;\n if (parsed.protocol === \"http:\") {\n return \"is plain http://; a bearer token over plaintext is a leak, and a public manifest is served over https too\";\n }\n return `has the unsupported scheme \"${parsed.protocol}\"`;\n}\n\nexport function isLoopback(host: string): boolean {\n return (\n host === \"localhost\" ||\n host === \"127.0.0.1\" ||\n host === \"[::1]\" ||\n host === \"::1\" ||\n host.startsWith(\"127.\")\n );\n}\n\nfunction rejectUnknownKeys(\n raw: Record<string, unknown>,\n allowed: readonly string[],\n where: string,\n source: string,\n toError: (message: string) => Error,\n): void {\n for (const key of Object.keys(raw)) {\n if (!allowed.includes(key)) {\n throw toError(\n `${source}: ${where} has unknown key \"${key}\". Supported keys: ${allowed.join(\", \")}.`,\n );\n }\n }\n}\n\nfunction isMapping(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isNonEmptyString(value: unknown): value is string {\n return typeof value === \"string\" && value.trim() !== \"\";\n}\n\n/**\n * Parse the top-level `collections:` value. Errors are built with `toError`,\n * so each tool reports a bad family file in its own error class.\n */\nexport function parseCollections(\n raw: unknown,\n source: string,\n toError: (message: string) => Error,\n): CollectionConfig[] {\n if (!Array.isArray(raw)) {\n throw toError(`${source}: \"collections\" must be a list.`);\n }\n if (raw.length === 0) {\n throw toError(\n `${source}: \"collections\" must name at least one collection; remove the key if there are none.`,\n );\n }\n // Names become SQL view names, and SQLite compares identifiers without\n // regard to case, so two names that differ only in case are one view.\n const taken = new Map<string, number>();\n return raw.map((entry, i) => {\n const where = `collections[${i}]`;\n if (!isMapping(entry)) {\n throw toError(`${source}: ${where} must be a mapping.`);\n }\n rejectUnknownKeys(entry, COLLECTION_KEYS, where, source, toError);\n\n if (!isNonEmptyString(entry.name)) {\n throw toError(`${source}: ${where}.name must be a non-empty string.`);\n }\n const name = entry.name;\n const folded = name.toLowerCase();\n if (folded === \"docs\") {\n throw toError(\n `${source}: ${where}.name \"${name}\" collides with the docs table every query reads. Pick another name, such as \"site\" or \"pages\".`,\n );\n }\n // The derived table (proposal 0040) is a view named `derived` over a\n // backing table named `_derived_rows`, built beside `docs` when a\n // statement asks for it, and `resolved` (proposal 0043) is the view over\n // `docs` and those rows. Any of the three would shadow it the same way.\n if (folded === \"derived\" || folded === \"_derived_rows\" || folded === \"resolved\") {\n throw toError(\n `${source}: ${where}.name \"${name}\" collides with the derived table a query builds beside docs (the derived view, its _derived_rows table, and the resolved view over both). Pick another name.`,\n );\n }\n if (folded.startsWith(\"sqlite_\")) {\n throw toError(\n `${source}: ${where}.name \"${name}\" starts with \"sqlite_\", which SQLite reserves for its own objects. Pick another name.`,\n );\n }\n const owner = taken.get(folded);\n if (owner !== undefined) {\n throw toError(\n `${source}: ${where}.name \"${name}\" is already taken by collections[${owner}]; names are compared case-insensitively because they become SQL views.`,\n );\n }\n taken.set(folded, i);\n\n if (\n !Array.isArray(entry.paths) ||\n entry.paths.length === 0 ||\n entry.paths.some((p) => !isNonEmptyString(p))\n ) {\n throw toError(\n `${source}: ${where}.paths must be a non-empty list of files, directories or globs.`,\n );\n }\n const paths = entry.paths as string[];\n\n let exclude: string[] = [];\n if (entry.exclude !== undefined) {\n if (\n !Array.isArray(entry.exclude) ||\n entry.exclude.some((g) => !isNonEmptyString(g))\n ) {\n throw toError(`${source}: ${where}.exclude must be a list of globs.`);\n }\n exclude = entry.exclude as string[];\n }\n\n let url: string | undefined;\n if (entry.url !== undefined) {\n if (typeof entry.url !== \"string\" || !isHttpUrl(entry.url)) {\n throw toError(`${source}: ${where}.url must be an http(s) URL.`);\n }\n url = entry.url;\n }\n\n let externalMetadata: ExternalMetadataConfig[] = [];\n if (entry.externalMetadata !== undefined) {\n if (!Array.isArray(entry.externalMetadata)) {\n throw toError(`${source}: ${where}.externalMetadata must be a list.`);\n }\n externalMetadata = parseExternalMetadata(\n entry.externalMetadata,\n where,\n source,\n toError,\n );\n }\n\n return {\n name,\n paths,\n exclude,\n externalMetadata,\n ...(url === undefined ? {} : { url }),\n };\n });\n}\n\nfunction isHttpUrl(value: string): boolean {\n let parsed: URL;\n try {\n parsed = new URL(value);\n } catch {\n return false;\n }\n return parsed.protocol === \"http:\" || parsed.protocol === \"https:\";\n}\n\n/**\n * Parse one collection's `externalMetadata:`. 0037's rules, with the error\n * path rewritten and the noun changed: ownership is now disjoint within a\n * collection rather than across the whole config, because two collections may\n * each own the same key.\n */\nfunction parseExternalMetadata(\n raw: readonly unknown[],\n collectionWhere: string,\n source: string,\n toError: (message: string) => Error,\n): ExternalMetadataConfig[] {\n const owners = new Map<string, number>();\n const patterns = new Map<string, number>();\n /** The one entry that omits `keys` (proposal 0068), once one does. */\n let keyless: number | undefined;\n const parsedEntries = raw.map((entry, i): ExternalMetadataConfig => {\n const where = `${collectionWhere}.externalMetadata[${i}]`;\n if (!isMapping(entry)) {\n throw toError(`${source}: ${where} must be a mapping.`);\n }\n rejectUnknownKeys(entry, EXTERNAL_METADATA_KEYS, where, source, toError);\n if (!isNonEmptyString(entry.file)) {\n throw toError(\n `${source}: ${where}.file must be a non-empty string naming the manifest, relative to the config file.`,\n );\n }\n const placeholderProblem = pagePlaceholderProblem(entry.file);\n if (placeholderProblem !== null) {\n throw toError(`${source}: ${where}.file ${placeholderProblem}`);\n }\n const perPage = hasPagePlaceholder(entry.file);\n if (perPage && (posix.isAbsolute(entry.file) || win32.isAbsolute(entry.file))) {\n throw toError(\n `${source}: ${where}.file uses ${PAGE_PLACEHOLDER} in an absolute path, so every manifest would sit outside the repository. Make it relative to the config file.`,\n );\n }\n // Absent keys (proposal 0068) is an ownership rule, not an empty list:\n // the manifest owns what each page's schemas mark external. Written, the\n // list still has to name something.\n if (\n entry.keys !== undefined &&\n (!Array.isArray(entry.keys) ||\n entry.keys.length === 0 ||\n entry.keys.some((k) => !isNonEmptyString(k)))\n ) {\n throw toError(\n `${source}: ${where}.keys must be a non-empty list of key names.`,\n );\n }\n if (entry.keys === undefined) {\n if (keyless !== undefined) {\n throw toError(\n `${source}: ${collectionWhere}.externalMetadata: entries ${String(keyless)} and ${String(i)} both omit keys; at most one manifest may own the external-marked fields`,\n );\n }\n keyless = i;\n }\n const isUrl = isUrlRef(entry.file);\n if (isUrl) {\n const problem = externalMetadataUrlProblem(entry.file);\n if (problem !== null) {\n throw toError(`${source}: ${where}.file ${problem}.`);\n }\n if (perPage) {\n throw toError(\n `${source}: ${where}.file uses ${PAGE_PLACEHOLDER} in a URL. A placeholder names a file this run can write, and a URL is not one.`,\n );\n }\n }\n if (entry.tokenEnv !== undefined) {\n if (!isNonEmptyString(entry.tokenEnv)) {\n throw toError(\n `${source}: ${where}.tokenEnv must be the name of an environment variable.`,\n );\n }\n if (!isUrl) {\n throw toError(\n `${source}: ${where}.tokenEnv is set, but \"file\" is a path, so no request is made and the token would go nowhere. Remove it, or make \"file\" a URL.`,\n );\n }\n }\n const keys = entry.keys === undefined ? undefined : (entry.keys as string[]);\n if (entry.join !== undefined) {\n if (!isNonEmptyString(entry.join)) {\n throw toError(\n `${source}: ${where}.join must be \"path\" or the name of a top-level frontmatter field.`,\n );\n }\n if (entry.join === SCHEMA_KEY) {\n throw toError(`${source}: ${where}.join may not be \"${SCHEMA_KEY}\".`);\n }\n if (keys?.includes(entry.join) === true) {\n throw toError(\n `${source}: ${where}.join names \"${entry.join}\", which the same entry owns — the value that selects an entry cannot come from the entry.`,\n );\n }\n }\n // An explicit `join: path` is the default spelled out, and a per-page\n // manifest is found by that path. A field would name the file by one\n // thing and key its entry by another (0058 § 6).\n if (perPage && typeof entry.join === \"string\" && entry.join !== PATH_JOIN) {\n throw toError(\n `${source}: ${where}.file uses ${PAGE_PLACEHOLDER}, and join is \"${entry.join}\". A per-page manifest is found by path, so it cannot be keyed by a field. Remove ${PAGE_PLACEHOLDER}, or remove join.`,\n );\n }\n const seen = new Set<string>();\n for (const key of keys ?? []) {\n if (key === SCHEMA_KEY) {\n throw toError(\n `${source}: ${where}.keys may not include \"${SCHEMA_KEY}\" — a manifest never chooses the schema a document is judged by; use \"overrides\".`,\n );\n }\n if (seen.has(key)) {\n throw toError(`${source}: ${where}.keys lists \"${key}\" twice.`);\n }\n seen.add(key);\n const owner = owners.get(key);\n if (owner !== undefined) {\n throw toError(\n `${source}: ${where}.keys claims \"${key}\", which externalMetadata[${owner}] already owns — a key has exactly one manifest in a collection.`,\n );\n }\n owners.set(key, i);\n }\n // Two spellings of one pattern are one manifest for every page (0058\n // stress test 10), compared once, with no page known yet. Two concrete\n // entries naming one file stay legal, as they were before placeholders.\n if (perPage) {\n const pattern = normalizeManifestPattern(entry.file);\n const first = patterns.get(pattern);\n if (first !== undefined) {\n throw toError(\n `${source}: ${where}.file resolves to the same manifest as externalMetadata[${String(first)}].file for every page. Give each entry its own file name.`,\n );\n }\n patterns.set(pattern, i);\n }\n const parsed: ExternalMetadataConfig = {\n file: entry.file,\n ...(keys === undefined ? {} : { keys }),\n ...(typeof entry.tokenEnv === \"string\" ? { tokenEnv: entry.tokenEnv } : {}),\n ...(typeof entry.join === \"string\" ? { join: entry.join } : {}),\n };\n origins.set(parsed, { source, where });\n return parsed;\n });\n // What each keyless manifest can never own, fixed here against the whole\n // declaration. A caller that narrows a collection to some of its manifests\n // still gets the answer the full collection gives.\n for (const manifest of parsedEntries) {\n if (manifest.keys === undefined) declaredNever.set(manifest, neverOwnedIn(parsedEntries, manifest));\n }\n return parsedEntries;\n}\n\n/**\n * The problem with `file`'s `{page}` placeholder grammar (0058 § 1), as the\n * tail of a sentence that starts with the entry's path, or `null` when there\n * is none. One token, spelled exactly, at most once; every other brace is\n * refused rather than read as a literal.\n */\nfunction pagePlaceholderProblem(file: string): string | null {\n for (const match of file.matchAll(/\\{[^{}]*\\}/g)) {\n if (match[0] !== PAGE_PLACEHOLDER) {\n return `uses \"${match[0]}\", which is not a placeholder. The only placeholder is ${PAGE_PLACEHOLDER}.`;\n }\n }\n const tokens = file.split(PAGE_PLACEHOLDER);\n const stray = /[{}]/.exec(tokens.join(\"\"));\n if (stray !== null) {\n return `contains \"${stray[0]}\" outside a ${PAGE_PLACEHOLDER} placeholder. Remove it, or write ${PAGE_PLACEHOLDER}.`;\n }\n if (tokens.length > 2) {\n return `uses ${PAGE_PLACEHOLDER} twice. One manifest names one page.`;\n }\n return null;\n}\n\n/**\n * Where a parsed `externalMetadata:` entry was declared: the config file as\n * the parse was told to name it, and the entry's\n * `collections[c].externalMetadata[i]` path. Kept beside the entry rather\n * than on it, so the entry's shape, its equality, and anything that\n * serializes it stay what they were. A copy made with a spread has no origin.\n */\nconst origins = new WeakMap<ExternalMetadataConfig, { source: string; where: string }>();\n\n/**\n * The config file and path an entry was parsed from, for a refusal that is\n * known only once a page is: a `{page}` manifest resolving above the config\n * directory. `undefined` for an entry `parseCollections` did not build.\n */\nexport function externalMetadataOrigin(\n entry: ExternalMetadataConfig,\n): { source: string; where: string } | undefined {\n return origins.get(entry);\n}\n\n/**\n * Does `manifest`, one of `collection`'s, own `key` for one page? The one\n * answer every reader and writer asks for (proposal 0068).\n *\n * A manifest with `keys` owns exactly those, for every page. One without owns\n * what `marked` holds: the top-level keys the page's resolved schema set marks\n * `x-manni-location: external`. It never owns a key another manifest of the\n * collection names in its own `keys`, because written keys win. Nor its own\n * join field, which the page carries to name its entry, nor `$schema`. With\n * `marked` undefined, because the page's schemas are not known, a keyless\n * manifest owns nothing.\n */\nexport function ownsKey(\n collection: Pick<CollectionConfig, \"externalMetadata\">,\n manifest: ExternalMetadataConfig,\n key: string,\n marked: ReadonlySet<string> | undefined,\n): boolean {\n if (manifest.keys !== undefined) return manifest.keys.includes(key);\n if (marked === undefined || !marked.has(key)) return false;\n return !neverOwned(collection, manifest).has(key);\n}\n\n/**\n * The keys a keyless manifest never owns, whatever a page marks: the keys\n * the collection's other manifests name, its join field, and `$schema`. An\n * entry setting one of them is refused when the manifest is read.\n */\nexport function neverOwned(\n collection: Pick<CollectionConfig, \"externalMetadata\">,\n manifest: ExternalMetadataConfig,\n): ReadonlySet<string> {\n return declaredNever.get(manifest) ?? neverOwnedIn(collection.externalMetadata, manifest);\n}\n\nfunction neverOwnedIn(\n manifests: readonly ExternalMetadataConfig[],\n manifest: ExternalMetadataConfig,\n): Set<string> {\n const out = new Set<string>([SCHEMA_KEY]);\n if (manifest.join !== undefined && manifest.join !== PATH_JOIN) out.add(manifest.join);\n for (const other of manifests) {\n if (other === manifest) continue;\n for (const key of other.keys ?? []) out.add(key);\n }\n return out;\n}\n\n/**\n * `neverOwned` for each keyless manifest `parseCollections` built, computed\n * over its whole collection. Kept beside the entry, as `origins` is, so a\n * copy of the collection filtered to some of its manifests does not forget a\n * key a manifest it left out names.\n */\nconst declaredNever = new WeakMap<ExternalMetadataConfig, ReadonlySet<string>>();\n\n/**\n * The collections a run covers: every one when `names` is undefined, else the\n * named ones in **declaration** order, however they were named on the command\n * line. Repeats collapse; an unknown name is an error, because a typo that\n * silently narrowed the run to nothing would read as a clean pass.\n */\nexport function selectCollections(\n collections: readonly CollectionConfig[],\n names: readonly string[] | undefined,\n source: string,\n toError: (message: string) => Error,\n): CollectionConfig[] {\n // An empty list means the same as no list: every collection. Commander's\n // repeatable-option collector defaults to `[]`, so \"the user passed no\n // --collection\" reaches this function as an empty array at least as often as\n // it reaches it as `undefined`. Were `[]` to select nothing, a plain\n // `manni meta validate` would validate zero files and exit 0 the moment a\n // caller forwarded the raw commander value — the false green proposal 0014\n // exists to end, and invisible in the exit code. Nothing needs to express\n // \"select no collections\", so the ambiguity is resolved in the safe\n // direction. Do not tighten this back.\n if (names === undefined || names.length === 0) return [...collections];\n const wanted = new Set(names);\n for (const name of wanted) {\n if (!collections.some((c) => c.name === name)) {\n const configured =\n collections.length === 0\n ? \"(none)\"\n : collections.map((c) => c.name).join(\", \");\n // Names are unique case-insensitively (they become SQL views) but are\n // selected by their one spelling. When the miss is only a casing miss,\n // say so — \"Configured: guides\" beside \"Guides\" reads as a contradiction\n // to anyone who does not already know the rule.\n const nearMiss = collections.find(\n (c) => c.name.toLowerCase() === name.toLowerCase(),\n );\n const hint =\n nearMiss === undefined\n ? \"\"\n : ` Names are case-sensitive; did you mean \"${nearMiss.name}\"?`;\n throw toError(\n `no collection named \"${name}\" in ${source}. Configured: ${configured}.${hint}`,\n );\n }\n }\n return collections.filter((c) => wanted.has(c.name));\n}\n\n/**\n * Is this file a member of the collection? `relPath` is posix and already\n * relative to the config file's directory, so this is arithmetic on a string:\n * no `stat`, nothing that can fail, and nothing that costs per file. A path\n * that climbed out of the config directory, and stdin, are members of nothing.\n */\nexport function isMember(\n collection: CollectionConfig,\n relPath: string,\n): boolean {\n if (relPath === STDIN) return false;\n if (relPath.startsWith(\"../\")) return false;\n return matchesCollectionPaths(collection, relPath);\n}\n\n/**\n * Do the collection's `paths:` and `exclude:` claim this path, before the two\n * guards `isMember` adds? Only a caller that has to *say* why a claimed path\n * is not a member needs this: a page above the config directory that a\n * `{page}` manifest would resolve outside the tree (proposal 0058). Everyone\n * else wants `isMember`.\n */\nexport function matchesCollectionPaths(\n collection: CollectionConfig,\n relPath: string,\n): boolean {\n const matched = collection.paths.some((entry) => {\n const normalized = normalizeEntry(entry);\n if (normalized === \"\") return false;\n if (isGlob(normalized)) return matchesFileGlob(relPath, normalized);\n return relPath === normalized || relPath.startsWith(`${normalized}/`);\n });\n if (!matched) return false;\n // `exclude` is globs only, whatever `paths` was written as.\n return !collection.exclude.some((glob) => matchesFileGlob(relPath, glob));\n}\n\n/** A `paths` entry as a posix path with no `./` prefix and no trailing `/`. */\nfunction normalizeEntry(entry: string): string {\n const posix = entry.replace(/\\\\/g, \"/\").replace(/^\\.\\//, \"\");\n return posix.endsWith(\"/\") ? posix.slice(0, -1) : posix;\n}\n\n/**\n * Is this `paths` entry a glob, by picomatch's own definition, rather than a\n * bare file or directory to match by prefix?\n *\n * picomatch decides, not a character class of our own: an extended glob such\n * as `docs/!(drafts)/**` or `@(a|b)` has no `*`, `?`, `[` or `{` of its own\n * and a hand-rolled test read it as a literal path — matching nothing and\n * excluding nothing, silently. The one cost is that a literal directory whose\n * name carries parentheses, `docs/notes (old)`, is also read as a glob and so\n * matches itself only, not everything beneath it. Spell such a path as\n * `docs/notes (old)/**` to get the prefix behaviour back.\n */\nfunction isGlob(entry: string): boolean {\n return picomatch.scan(entry).isGlob;\n}\n","/**\n * Glob matching, shared by every tool.\n *\n * One matcher, so that the two questions that look alike really are alike: is\n * this file in a collection (proposal 0041), and does it match a schema\n * override's `files:` (0015). It lived in the metadata tool's schema resolver\n * until membership needed it too; a second copy is how the two would start\n * disagreeing about a dot file or a `\\`.\n */\nimport picomatch from \"picomatch\";\n\n/**\n * One compiled matcher per distinct glob, kept for the life of the process.\n * Never evicted, on purpose: the set of globs a run sees is the config's plus\n * a handful of flags, which is dozens at most, and a compile is the expensive\n * step. This module is shared across the family, so if it ever sits inside a\n * long-lived host that feeds it unbounded user globs, this is the line to\n * revisit — bound it, or key it per run. Until then an eviction policy would\n * be machinery for a case that does not exist.\n */\nconst matcherCache = new Map<string, (p: string) => boolean>();\n\n/**\n * Does this file path match the glob — or, for the list form, any of them — by\n * the shared rules (picomatch, dot files included, `\\` normalized to `/`)?\n */\nexport function matchesFileGlob(\n relPath: string,\n glob: string | readonly string[],\n): boolean {\n // picomatch takes a pattern array natively, so the list form needs no loop\n // here — but the cache does need a *string* key. Keyed on the array itself\n // this Map would compare by identity: a hit only for the very same object,\n // and an entry retained for every config ever parsed. JSON.stringify is the\n // key because it separates the two shapes on its own — a lone \"a/**\" and\n // [\"a/**\"] serialize differently — with no separator char to collide with\n // one inside a glob.\n const key = JSON.stringify(glob);\n let m = matcherCache.get(key);\n if (!m) {\n m = picomatch(glob as string | string[], { dot: true });\n matcherCache.set(key, m);\n }\n // Normalize Windows separators so globs written with `/` still match.\n return m(relPath.replace(/\\\\/g, \"/\"));\n}\n","/**\n * The `{page}` placeholder in `externalMetadata[].file` (proposal 0058).\n *\n * A `file` holding `{page}` is a rule rather than a file: each page gets its\n * own manifest, named by substituting the page's path, relative to the config\n * file's directory and without its extension. `\"{page}.citations.yaml\"` puts\n * `docs/x/index.mdx`'s manifest at `docs/x/index.citations.yaml`.\n *\n * One normalization is used wherever a pattern or a page path is compared or\n * substituted (0058 § 1): strip one leading `./`, and write every separator as\n * a forward slash. It is deliberately that small. It is not `path.resolve`, so\n * `./a/../{page}.yaml` stays its own pattern, and it does not fold case.\n *\n * The grammar itself (one token, spelled exactly, never in a URL or an\n * absolute path) is enforced by the config parser in `collections.ts`, so\n * everything here may assume a `file` that passed it.\n *\n * Shared, so it imports nothing from a tool.\n */\nimport { readFileSync, realpathSync } from \"node:fs\";\nimport { isAbsolute, posix, relative, resolve, sep } from \"node:path\";\nimport fg from \"fast-glob\";\nimport { LineCounter, isMap, isNode, isScalar, parseDocument } from \"yaml\";\n\n/** The one placeholder `externalMetadata[].file` accepts. */\nexport const PAGE_PLACEHOLDER = \"{page}\";\n\n/** True when `file` contains the {page} token (assumes it already passed parse validation). */\nexport function hasPagePlaceholder(file: string): boolean {\n return file.includes(PAGE_PLACEHOLDER);\n}\n\n/** Every separator written as a forward slash. */\nfunction slashes(path: string): string {\n return path.split(sep).join(\"/\").replace(/\\\\/g, \"/\");\n}\n\n/**\n * 0058 § 1 normalization: strip one leading \"./\", backslashes to \"/\". No case\n * folding, no path.resolve, no \"..\" collapsing.\n */\nexport function normalizeManifestPattern(file: string): string {\n const forward = file.replace(/\\\\/g, \"/\");\n return forward.startsWith(\"./\") ? forward.slice(2) : forward;\n}\n\n/**\n * The manifest a page resolves to. `configDir` absolute; `pageAbs` absolute.\n *\n * `{page}` is `relative(configDir, pageAbs)` with its extension removed,\n * normalized as above, substituted into the normalized pattern. Returns the\n * manifest's absolute path and its posix path relative to `configDir`, or\n * `{ outside: true, pageRel }` when the page is not under the config\n * directory: its relative path climbs with `../`, or, across Windows drives,\n * there is no relative path at all.\n */\nexport function pageManifestPath(\n file: string,\n configDir: string,\n pageAbs: string,\n): { abs: string; rel: string } | { outside: true; pageRel: string } {\n const between = relative(configDir, pageAbs);\n const pageRel = slashes(between);\n if (isAbsolute(between) || pageRel === \"..\" || pageRel.startsWith(\"../\")) {\n return { outside: true, pageRel };\n }\n const ext = posix.extname(pageRel);\n const page = ext === \"\" ? pageRel : pageRel.slice(0, -ext.length);\n const named = normalizeManifestPattern(file).replace(PAGE_PLACEHOLDER, () => page);\n const abs = resolve(configDir, named);\n return { abs, rel: slashes(relative(configDir, abs)) };\n}\n\n/**\n * 0058 § 5: the glob every manifest of a pattern matches. The normalized\n * pattern is split at `{page}` and `**` + `/*` inserted, keeping the prefix\n * and the suffix. No page path reaches it, but the prefix and suffix are the\n * config author's own literal text, and a directory name may hold glob\n * syntax: read raw, `meta (v2)/` is an extglob group that matches nothing. So\n * both are escaped, and only the inserted `**` + `/*` is live.\n * `\"{page}.citations.yaml\"` gives `**` + `/*.citations.yaml`, and\n * `\"./meta/{page}.citations.yaml\"` gives `meta/**` + `/*.citations.yaml`.\n */\nexport function strayManifestGlob(file: string): string {\n const normalized = normalizeManifestPattern(file);\n const at = normalized.indexOf(PAGE_PLACEHOLDER);\n if (at < 0) return literal(normalized);\n const prefix = literal(normalized.slice(0, at));\n const suffix = literal(normalized.slice(at + PAGE_PLACEHOLDER.length));\n return `${prefix}**/*${suffix}`;\n}\n\n/** Text a glob matches exactly. fast-glob refuses to escape an empty string. */\nfunction literal(text: string): string {\n return text === \"\" ? \"\" : fg.escapePath(text);\n}\n\n/** One entry of a per-page manifest found on disk, naming the page it is for. */\nexport interface FoundPageEntry {\n /** The key exactly as the manifest spells it. */\n spelled: string;\n /** The page it names, absolute. */\n pageAbs: string;\n /** 1-based line of the key in the manifest, when known. */\n line?: number;\n}\n\n/** A manifest file a `{page}` pattern names, and the entries it holds for its own page. */\nexport interface FoundPageManifest {\n /** The manifest, absolute. */\n abs: string;\n entries: FoundPageEntry[];\n}\n\n/**\n * The manifests on disk that `file`, a `{page}` pattern, names (0058 § 5):\n * every file the pattern's `strayManifestGlob` matches under `configDir`,\n * kept when it holds an entry the pattern resolves back to that very file,\n * for a page `isMember` claims. `isMember` takes the page's posix path\n * relative to `configDir`. A file with no such entry is not this pattern's\n * manifest, whatever its name: a copy of the tree elsewhere, a fixture, or a\n * file that only looks like one.\n *\n * The walk does not consult `.gitignore`, because a manifest is config named\n * input rather than a discovered document. It skips `node_modules`, `.git`\n * and dot directories, as the document walk does, so a checkout nested under\n * a dot directory is never read as this one's. A file that cannot be read or\n * parsed is not recognizably a manifest, and is skipped.\n *\n * Synchronous, so a synchronous orphan check can call it. It runs once per\n * whole-corpus run, never for a run given paths. A match in `skip` (absolute\n * paths) is neither read nor returned: the orphan check passes the manifests\n * the run already loaded, which would otherwise be parsed a second time.\n */\nexport function findPageManifests(\n file: string,\n configDir: string,\n isMember: (relPath: string) => boolean,\n skip: ReadonlySet<string> = new Set(),\n): FoundPageManifest[] {\n const matched = fg\n .sync(strayManifestGlob(file), {\n cwd: configDir,\n absolute: true,\n onlyFiles: true,\n dot: false,\n ignore: [\"**/node_modules/**\", \"**/.git/**\"],\n })\n .map((path) => resolve(path))\n .sort();\n const found: FoundPageManifest[] = [];\n for (const abs of matched) {\n if (skip.has(abs)) continue;\n const entries = ownEntries(abs, file, configDir, isMember);\n if (entries.length > 0) found.push({ abs, entries });\n }\n return found;\n}\n\n/** The entries of the manifest at `abs` that `file` resolves back to `abs`. */\nfunction ownEntries(\n abs: string,\n file: string,\n configDir: string,\n isMember: (relPath: string) => boolean,\n): FoundPageEntry[] {\n let text: string;\n try {\n text = readFileSync(abs, \"utf8\");\n } catch {\n return [];\n }\n const lc = new LineCounter();\n const doc = parseDocument(text, { lineCounter: lc, uniqueKeys: false });\n const root = doc.contents;\n if (doc.errors.length > 0 || !isMap(root)) return [];\n const entries: FoundPageEntry[] = [];\n for (const pair of root.items) {\n const spelled = isScalar(pair.key) ? String(pair.key.value) : String(pair.key);\n const pageAbs = resolve(configDir, spelled);\n if (!isMember(slashes(relative(configDir, pageAbs)))) continue;\n const resolved = pageManifestPath(file, configDir, pageAbs);\n if (\"outside\" in resolved || !sameFile(resolved.abs, abs)) continue;\n const range = isNode(pair.key) ? pair.key.range : undefined;\n entries.push({\n spelled,\n pageAbs,\n ...(range ? { line: lc.linePos(range[0]).line } : {}),\n });\n }\n return entries;\n}\n\n/**\n * Are these one file, as the filesystem resolves them? Compared as files and\n * not as text (0058 stress test 8), so a case-only difference is one file on\n * a case-insensitive filesystem and two elsewhere.\n */\nexport function sameFile(a: string, b: string): boolean {\n if (a === b) return true;\n try {\n return realpathSync(a) === realpathSync(b);\n } catch {\n return false;\n }\n}\n","/**\n * The family's value encryption (proposal 0045).\n *\n * One ciphertext format for every tool: meta frontmatter values and cite\n * source paths encrypt the same way, under different contexts, so rotation\n * has one rule. Pure, and `node:crypto` only.\n *\n * The construction is SIV-style on AES-256-GCM, because Node has no SIV mode\n * (`aes-256-gcm-siv` and `aes-*-siv` are unknown ciphers in Node 24):\n *\n * - Three 32-byte subkeys come from the configured key with HKDF-SHA256 and an\n * empty salt, labelled `manni/v1/encrypt`, `manni/v1/nonce` and\n * `manni/v1/pin`. The key is expanded, not stretched: a hand-picked value is\n * only as strong as it is random, which is why `manni key set` generates 256\n * bits.\n * - The plaintext is the value's JSON, padded ISO/IEC 7816-4 style (`0x80`,\n * then `0x00` up to the next multiple of 32, always at least one pad byte),\n * so a token's length reveals a size class, not the value.\n * - The nonce is the first 12 bytes of `HMAC(nonceKey, context ‖ 0x00 ‖\n * padded)`. Equal plaintexts give equal tokens, which is what a join needs;\n * decryption checks the nonce is that HMAC, so every valid token is\n * canonical.\n * - The associated data is `0x01 ‖ context`, so the same text in two contexts\n * never reuses a nonce under different tags. The property name is not\n * bound: a value moved between fields stays readable.\n *\n * A token is `~` then unpadded base64url of `0x01 ‖ nonce ‖ ciphertext ‖\n * tag`: 61 bytes at the smallest, so 82 characters after the `~`.\n */\nimport {\n createCipheriv,\n createDecipheriv,\n createHmac,\n hkdfSync,\n randomBytes,\n timingSafeEqual,\n} from \"node:crypto\";\nimport { TextDecoder } from \"node:util\";\n\n/** Which kind of value a token holds. Bound as associated data. */\nexport type EncryptionContext = \"meta\" | \"cite-src\";\n\n/** An encrypted value: `~` and at least 82 base64url characters. */\nexport const ENCRYPTED_VALUE = /^~[A-Za-z0-9_-]{82,}$/;\n\n/** Whether `value` is shaped like a token. Says nothing about which key. */\nexport function isEncryptedValue(value: unknown): value is string {\n return typeof value === \"string\" && ENCRYPTED_VALUE.test(value);\n}\n\n/** A configured key: hex or base64url, at least 32 characters. */\nexport const ENCRYPTION_KEY_SHAPE = /^[A-Za-z0-9_-]{32,}$/;\n\nexport function isValidEncryptionKey(value: unknown): value is string {\n return typeof value === \"string\" && ENCRYPTION_KEY_SHAPE.test(value);\n}\n\n/** 256 random bits as 64 lowercase hex characters. */\nexport function generateEncryptionKey(): string {\n return randomBytes(32).toString(\"hex\");\n}\n\nconst VERSION = 0x01;\nconst NONCE_BYTES = 12;\nconst TAG_BYTES = 16;\nconst BLOCK = 32;\n/** Version byte, nonce, one padded block, tag. */\nconst MIN_BYTES = 1 + NONCE_BYTES + BLOCK + TAG_BYTES;\n\ninterface Subkeys {\n encrypt: Buffer;\n nonce: Buffer;\n pin: Buffer;\n}\n\n/**\n * Subkeys per configured key. A run sees one key, or two while rotating, so\n * the cache stays tiny; it saves three HKDF calls per value on a large tree.\n */\nconst subkeyCache = new Map<string, Subkeys>();\n\nfunction subkeys(key: string): Subkeys {\n const cached = subkeyCache.get(key);\n if (cached !== undefined) return cached;\n const ikm = Buffer.from(key, \"utf8\");\n const derive = (info: string): Buffer =>\n Buffer.from(hkdfSync(\"sha256\", ikm, Buffer.alloc(0), info, 32));\n const made: Subkeys = {\n encrypt: derive(\"manni/v1/encrypt\"),\n nonce: derive(\"manni/v1/nonce\"),\n pin: derive(\"manni/v1/pin\"),\n };\n subkeyCache.set(key, made);\n return made;\n}\n\nfunction requireKey(key: string, caller: string): void {\n if (!isValidEncryptionKey(key)) {\n // Never echo the value: it is key material.\n throw new Error(\n `${caller}: the key must be at least 32 hex or base64url characters.`,\n );\n }\n}\n\nfunction pad(data: Buffer): Buffer {\n const out = Buffer.alloc((Math.floor(data.length / BLOCK) + 1) * BLOCK);\n data.copy(out);\n out[data.length] = 0x80;\n return out;\n}\n\n/** The data before the padding, or `null` when the padding is not canonical. */\nfunction unpad(padded: Buffer): Buffer | null {\n let i = padded.length - 1;\n while (i >= 0 && padded[i] === 0) i--;\n if (i < 0 || padded[i] !== 0x80) return null;\n // Exactly the padding `pad` would have added: never a spare block.\n if (padded.length !== (Math.floor(i / BLOCK) + 1) * BLOCK) return null;\n return padded.subarray(0, i);\n}\n\nfunction nonceFor(keys: Subkeys, context: Buffer, padded: Buffer): Buffer {\n return createHmac(\"sha256\", keys.nonce)\n .update(context)\n .update(Buffer.from([0x00]))\n .update(padded)\n .digest()\n .subarray(0, NONCE_BYTES);\n}\n\nfunction aad(context: Buffer): Buffer {\n return Buffer.concat([Buffer.from([VERSION]), context]);\n}\n\n/**\n * Encrypt any JSON value. Throws for a value that is not JSON (`undefined`, a\n * function) and for a key that is not key-shaped: both are programming\n * errors, since keys arrive through `resolveEncryptionKey`.\n */\nexport function encryptValue(\n value: unknown,\n key: string,\n context: EncryptionContext,\n): string {\n requireKey(key, \"encryptValue\");\n // lib.d.ts types the result as `string`, but `undefined`, a function or a\n // symbol stringify to `undefined` at run time.\n const json = JSON.stringify(value) as string | undefined;\n if (json === undefined) {\n throw new TypeError(\"encryptValue: the value is not JSON.\");\n }\n const keys = subkeys(key);\n const ctx = Buffer.from(context, \"utf8\");\n const padded = pad(Buffer.from(json, \"utf8\"));\n const nonce = nonceFor(keys, ctx, padded);\n const cipher = createCipheriv(\"aes-256-gcm\", keys.encrypt, nonce, {\n authTagLength: TAG_BYTES,\n });\n cipher.setAAD(aad(ctx));\n const sealed = Buffer.concat([cipher.update(padded), cipher.final()]);\n const tag = cipher.getAuthTag();\n const bytes = Buffer.concat([Buffer.from([VERSION]), nonce, sealed, tag]);\n return `~${bytes.toString(\"base64url\")}`;\n}\n\nconst FAILED = { ok: false } as const;\n\n/**\n * Decrypt a token. `{ ok: false }` for anything that is not a canonical token\n * under this key and context; never throws.\n */\nexport function decryptValue(\n token: string,\n key: string,\n context: EncryptionContext,\n): { ok: true; value: unknown } | { ok: false } {\n try {\n return open(token, key, context);\n } catch {\n return FAILED;\n }\n}\n\nfunction open(\n token: string,\n key: string,\n context: EncryptionContext,\n): { ok: true; value: unknown } | { ok: false } {\n if (!isEncryptedValue(token) || !isValidEncryptionKey(key)) return FAILED;\n const body = token.slice(1);\n const bytes = Buffer.from(body, \"base64url\");\n // Buffer's decoder ignores stray trailing bits; a token is canonical only\n // if it is exactly what the encoder writes for these bytes.\n if (bytes.toString(\"base64url\") !== body) return FAILED;\n if (bytes.length < MIN_BYTES) return FAILED;\n if ((bytes.length - 1 - NONCE_BYTES - TAG_BYTES) % BLOCK !== 0) return FAILED;\n if (bytes[0] !== VERSION) return FAILED;\n\n const nonce = bytes.subarray(1, 1 + NONCE_BYTES);\n const sealed = bytes.subarray(1 + NONCE_BYTES, bytes.length - TAG_BYTES);\n const tag = bytes.subarray(bytes.length - TAG_BYTES);\n const keys = subkeys(key);\n const ctx = Buffer.from(context, \"utf8\");\n const decipher = createDecipheriv(\"aes-256-gcm\", keys.encrypt, nonce, {\n authTagLength: TAG_BYTES,\n });\n decipher.setAAD(aad(ctx));\n decipher.setAuthTag(tag);\n // `final` throws on a bad tag; the caller turns that into `{ ok: false }`.\n const padded = Buffer.concat([decipher.update(sealed), decipher.final()]);\n\n if (!timingSafeEqual(nonceFor(keys, ctx, padded), nonce)) return FAILED;\n const data = unpad(padded);\n if (data === null) return FAILED;\n const json = new TextDecoder(\"utf-8\", { fatal: true }).decode(data);\n const value: unknown = JSON.parse(json);\n return { ok: true, value };\n}\n\n/** The prefix a keyed pin carries, so it never reads as a plain hash of the text. */\nexport const KEYED_PIN_PREFIX = \"hmac-sha256-\";\n\n/**\n * A keyed fingerprint of `text`: `hmac-sha256-` and the hex HMAC-SHA256 under\n * the pin subkey. Stable per key, so it can be compared without being\n * reversible. The prefix says it is an HMAC: hashing the text by hand gives\n * a different value, and the prefix is why.\n */\nexport function keyedPin(text: string, key: string): string {\n requireKey(key, \"keyedPin\");\n const mac = createHmac(\"sha256\", subkeys(key).pin)\n .update(text, \"utf8\")\n .digest(\"hex\");\n return `${KEYED_PIN_PREFIX}${mac}`;\n}\n","/**\n * `tools:`, the family-level home for an outside tool's settings (proposal\n * 0052, in the shape lint's proposal 0050 recorded).\n *\n * An outside tool is not any one domain's, so its settings do not sit under a\n * domain's key. Vale is the case in point: `manni term lint` runs it, and so\n * does a docevals grader. Each should read one description of where Vale's\n * config lives, not two that can disagree.\n *\n * Each tool gets a namespace of its own keys rather than a shared\n * `{tool, config}` shape, because tools do not have the same settings. A\n * lowest-common-denominator shape would either lie or grow a passthrough blob.\n *\n * Only the declaration is shared. Running a tool stays with the domain that\n * runs it. Paths are kept as the user spelled them and resolved on use,\n * against the config file's directory, the way `collections:` keeps its globs;\n * whether the file exists is a question for the run that needs it.\n */\nimport { isAbsolute, resolve } from \"node:path\";\n\n/** Vale's settings under `tools.vale`. */\nexport interface ValeToolConfig {\n /** Vale's config file, as written, relative to `manni.config.yaml`. */\n config?: string;\n}\n\n/** DITA Open Toolkit's settings under `tools.dita-ot`. */\nexport interface DitaOtToolConfig {\n /**\n * DITA-OT's installation directory, as written, relative to\n * `manni.config.yaml`. Unset means the `dita` on PATH.\n *\n * A directory rather than a path to the launcher, because that is the unit\n * DITA-OT is distributed and documented as: the download unpacks to one\n * directory, and `bin/dita` inside it will not run from anywhere else.\n */\n home?: string;\n}\n\n/** Doc Detective's settings under `tools.doc-detective`. */\nexport interface DocDetectiveToolConfig {\n /**\n * Doc Detective's config file, as written, relative to `manni.config.yaml`.\n * Unset means Doc Detective finds its own in the working directory.\n */\n config?: string;\n}\n\n/** The document's top-level `tools:`, one namespace per outside tool. */\nexport interface ToolsConfig {\n vale?: ValeToolConfig;\n \"dita-ot\"?: DitaOtToolConfig;\n \"doc-detective\"?: DocDetectiveToolConfig;\n}\n\nconst TOOL_KEYS = [\"vale\", \"dita-ot\", \"doc-detective\"] as const;\n\nfunction isMapping(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction rejectUnknownKeys(\n raw: Record<string, unknown>,\n allowed: readonly string[],\n where: string,\n source: string,\n toError: (message: string) => Error,\n): void {\n for (const key of Object.keys(raw)) {\n if (!allowed.includes(key)) {\n throw toError(\n `${source}: ${where} has unknown key \"${key}\". Supported keys: ${allowed.join(\", \")}.`,\n );\n }\n }\n}\n\n/**\n * Parse the value under the top-level `tools:` key. A bare `tools:` (YAML\n * null) is no tools. Every refusal is a shape that would otherwise read as\n * configured and do nothing: a misspelled tool, or a key a tool never reads.\n */\nexport function parseTools(\n raw: unknown,\n source: string,\n toError: (message: string) => Error,\n): ToolsConfig {\n if (raw === null || raw === undefined) return {};\n if (!isMapping(raw)) {\n throw toError(`${source}: \"tools\" must be a mapping.`);\n }\n rejectUnknownKeys(raw, TOOL_KEYS, \"tools\", source, toError);\n\n const tools: ToolsConfig = {};\n if (Object.hasOwn(raw, \"vale\")) {\n tools.vale = parseStringKey(raw[\"vale\"], \"vale\", \"config\", source, toError);\n }\n if (Object.hasOwn(raw, \"dita-ot\")) {\n tools[\"dita-ot\"] = parseStringKey(raw[\"dita-ot\"], \"dita-ot\", \"home\", source, toError);\n }\n if (Object.hasOwn(raw, \"doc-detective\")) {\n tools[\"doc-detective\"] = parseStringKey(\n raw[\"doc-detective\"],\n \"doc-detective\",\n \"config\",\n source,\n toError,\n );\n }\n return tools;\n}\n\n/**\n * One tool's namespace, whose single key is a non-empty string. Every tool\n * read today has that shape; a tool with a second key or another type gets a\n * parser of its own.\n */\nfunction parseStringKey<K extends string>(\n raw: unknown,\n tool: string,\n key: K,\n source: string,\n toError: (message: string) => Error,\n): Partial<Record<K, string>> {\n if (!isMapping(raw)) {\n throw toError(`${source}: tools.${tool} must be a mapping.`);\n }\n rejectUnknownKeys(raw, [key], `tools.${tool}`, source, toError);\n\n const out: Partial<Record<K, string>> = {};\n if (Object.hasOwn(raw, key)) {\n const value = raw[key];\n if (typeof value !== \"string\" || value.trim() === \"\") {\n throw toError(`${source}: tools.${tool}.${key} must be a non-empty string.`);\n }\n out[key] = value;\n }\n return out;\n}\n\n/** A path as written in the config, made absolute against the config file's directory. */\nfunction fromConfigDir(path: string, configDir: string): string {\n return isAbsolute(path) ? path : resolve(configDir, path);\n}\n\n/**\n * The absolute path of Vale's config file, resolved against the directory of\n * the config file that declared it. `undefined` when none is set, which means\n * Vale finds its own config, as it does when a person runs it.\n */\nexport function valeConfigPath(tools: ToolsConfig, configDir: string): string | undefined {\n const config = tools.vale?.config;\n if (config === undefined) return undefined;\n return fromConfigDir(config, configDir);\n}\n\n/**\n * The absolute path of DITA-OT's installation directory, resolved against the\n * directory of the config file that declared it. `undefined` when none is set,\n * which means the `dita` on PATH, as when a person runs it.\n */\nexport function ditaOtHome(tools: ToolsConfig, configDir: string): string | undefined {\n const home = tools[\"dita-ot\"]?.home;\n if (home === undefined) return undefined;\n return fromConfigDir(home, configDir);\n}\n\n/**\n * The absolute path of Doc Detective's config file, resolved against the\n * directory of the config file that declared it. `undefined` when none is set,\n * which means Doc Detective finds its own in the working directory.\n */\nexport function docDetectiveConfigPath(\n tools: ToolsConfig,\n configDir: string,\n): string | undefined {\n const config = tools[\"doc-detective\"]?.config;\n if (config === undefined) return undefined;\n return fromConfigDir(config, configDir);\n}\n","/**\n * The family config file.\n *\n * One file per repository, `manni.config.yaml`, with one top-level key per\n * tool: `meta:` for the metadata tool, `docevals:`, `tracevals:`, `lint:`,\n * `graph:` as each lands. A tool reads its own key and leaves its siblings alone,\n * so adding a tool never invalidates a config that predates it.\n *\n * This module only finds the file and hands a tool its slice. What the slice\n * may contain is the tool's business; it validates the value with its own\n * parser and its own error class, which is why `toError` is an option rather\n * than an import. Four top-level keys belong to the family rather than to a\n * tool, and are parsed here once for every tool. They are `collections:`\n * (proposal 0041), `tools:` (proposal 0052) and `encryptionKey:` (proposal\n * 0045). The fourth is `providers:`, the inference provider settings every\n * tool that sends content to a model reads.\n *\n * One older spelling is still read, with a warning on discovery: each tool's\n * pre-family file (`docmeta.config.yaml` for the metadata tool), whose whole\n * document is the tool's section with no wrapper key.\n *\n * Within one directory the order is manni, then the legacy names, and\n * `.yaml` before `.yml`. A family file that exists but has neither a key for\n * this tool nor a family key is not this tool's config: discovery keeps\n * looking, first at the legacy names beside it (a repository mid-migration,\n * where a sibling tool moved to the family file first) and then up the tree.\n * The walk stops at the nearest `.git` boundary, nearest directory first, and\n * the first hit wins; ancestor files are never merged.\n *\n * An explicit path is read the same way minus the warning: the section key is\n * unwrapped when present, a document carrying a family key is a family file\n * with an empty section, and the whole document is taken otherwise, so a\n * `-c ./anything.yaml` needs no filename sniffing and no flag.\n *\n * The core is synchronous: some tools load config from synchronous library\n * entry points, and one small file read is not worth an `await` through their\n * public API. `findConfigFileSync` and `readConfigFileSync` expose it; the\n * async spellings are wrappers over the same core for callers that await.\n */\nimport { readFileSync } from \"node:fs\";\nimport { basename, dirname, join, relative, resolve } from \"node:path\";\nimport { parse as parseYaml } from \"yaml\";\nimport { parseCollections, type CollectionConfig } from \"./collections.js\";\nimport { isValidEncryptionKey } from \"./encryption.js\";\nimport { PROVIDERS_KEY, parseProviders, type ProvidersConfig } from \"./providers.js\";\nimport { searchPath } from \"./git-root.js\";\nimport { parseTools, type ToolsConfig } from \"./tools.js\";\nimport { warn } from \"./warn.js\";\nimport { errorMessage } from \"./errors.js\";\n\n/** The canonical family filenames, in discovery order. */\nexport const FAMILY_CONFIG_NAMES: readonly string[] = [\n \"manni.config.yaml\",\n \"manni.config.yml\",\n];\n\n/** The top-level key holding the family encryption key (proposal 0045). */\nexport const ENCRYPTION_KEY_FIELD = \"encryptionKey\";\n\n/**\n * The top-level key holding the key a rotation is replacing (proposal 0045).\n * Present only while a rotation is unfinished: `manni key rotate` writes it\n * beside the new key before it touches a page, and removes it once every page\n * is written. Read only by `manni key rotate`, which finishes the rotation.\n */\nexport const ENCRYPTION_KEY_PREVIOUS_FIELD = \"encryptionKeyPrevious\";\n\nexport interface ConfigFileOptions {\n /** The tool's key in a family file, e.g. `\"meta\"`. */\n section: string;\n /**\n * The tool's own filenames from before the family file, in discovery order.\n * Their whole document is the tool's section.\n */\n legacyNames: readonly string[];\n /** Build the error for an unreadable document, in the tool's own class. */\n toError: (message: string) => Error;\n}\n\nexport interface ConfigFile {\n /** Absolute path to the file. */\n path: string;\n /** Directory holding it; relative paths in the config resolve from here. */\n dir: string;\n /**\n * The file as the user would name it: relative to `cwd`, posix separators,\n * or the spelling they typed for an explicit path. For error messages.\n */\n source: string;\n /** The file's text, for a tool that rewrites the file in place. */\n text: string;\n /**\n * The tool's slice: the value under `section:` when `wrapped`, otherwise\n * the whole document. `null` for an empty file or an empty section; the\n * tool decides what empty means.\n */\n value: unknown;\n /** Whether `value` came from under `section:`. */\n wrapped: boolean;\n /** How the file was found. Explicit paths are never warned about. */\n kind: \"manni\" | \"legacy\" | \"explicit\";\n /**\n * The document's top-level `collections:` (proposal 0041), parsed once here\n * because every tool reads the same declaration. `[]` when the key is\n * absent, and always `[]` for a `legacy` file: a per-tool file's whole\n * document *is* the tool's section, so it carries no family-wide keys.\n */\n collections: CollectionConfig[];\n /**\n * The document's top-level `tools:` (proposal 0052), an outside tool's\n * settings, parsed once here for the same reason as `collections`. `{}` when\n * the key is absent, and always `{}` for a `legacy` file.\n */\n tools: ToolsConfig;\n /**\n * The document's top-level `encryptionKey:` (proposal 0045), validated\n * here. Absent when the key is, and always absent for a `legacy` file, for\n * the same reason as `collections`. `MANNI_ENCRYPTION_KEY` wins over it;\n * read it through `resolveEncryptionKey`, not directly.\n */\n encryptionKey?: string;\n /**\n * The document's top-level `encryptionKeyPrevious:`, validated here as\n * `encryptionKey` is. Present only while a rotation is unfinished, and read\n * only by `manni key rotate`, which finishes it.\n */\n encryptionKeyPrevious?: string;\n /**\n * The document's top-level `providers:`, parsed here with a relative\n * `llama-cpp.modelsDir` resolved against `dir`. Absent when the key is, and\n * always absent for a `legacy` file, for the same reason as `collections`.\n */\n providers?: ProvidersConfig;\n}\n\ntype ToError = (message: string) => Error;\n\ninterface Document {\n text: string;\n /** Parsed YAML: a mapping, or `null` for an empty file. */\n doc: Record<string, unknown> | null;\n}\n\nfunction readDocument(\n path: string,\n source: string,\n toError: ToError,\n): Document | null {\n let text: string;\n try {\n text = readFileSync(path, \"utf8\");\n } catch {\n return null;\n }\n return { text, doc: parseMapping(text, source, toError) };\n}\n\n/**\n * Parse outside any \"not found\" handling. A discovered file with a typo must\n * be reported, not skipped: falling through to the next candidate, or to no\n * config at all, would run the tool on defaults and read as a clean pass.\n */\nfunction parseMapping(\n text: string,\n source: string,\n toError: ToError,\n): Record<string, unknown> | null {\n let raw: unknown;\n try {\n raw = parseYaml(text);\n } catch (err) {\n throw toError(`${source}: invalid YAML: ${errorMessage(err)}`);\n }\n if (raw == null) return null;\n if (typeof raw !== \"object\" || Array.isArray(raw)) {\n throw toError(`${source}: top level must be a mapping.`);\n }\n return raw as Record<string, unknown>;\n}\n\n/** The top-level key holding the family's document sets. */\nconst COLLECTIONS_KEY = \"collections\";\n\n/** The top-level key holding outside tools' settings (proposal 0052). */\nconst TOOLS_KEY = \"tools\";\n\n/** The keys that belong to the family, not to any one tool. */\nconst FAMILY_KEYS: readonly string[] = [\n COLLECTIONS_KEY,\n TOOLS_KEY,\n ENCRYPTION_KEY_FIELD,\n PROVIDERS_KEY,\n];\n\nfunction slice(\n document: Document,\n opts: ConfigFileOptions,\n): { value: unknown; wrapped: boolean } | null {\n const { doc } = document;\n if (doc !== null && Object.hasOwn(doc, opts.section)) {\n return { value: doc[opts.section] ?? null, wrapped: true };\n }\n // A family file carrying a family key and no section is still this tool's\n // config: the documents are declared (0041), or the key is (0045), or the\n // provider settings are, and the tool just has no options of its own.\n // Handing back an empty section is what stops discovery walking past it.\n // For the key that matters twice: a\n // file the key prompt created holds nothing else, and the next run must\n // find it.\n if (doc !== null && FAMILY_KEYS.some((key) => Object.hasOwn(doc, key))) {\n return { value: null, wrapped: true };\n }\n return null;\n}\n\n/**\n * The document's collections. Parsed with the tool's own `toError`, so a bad\n * `collections:` is reported in the class the tool already catches.\n */\nfunction collectionsOf(\n document: Document,\n source: string,\n toError: ToError,\n): CollectionConfig[] {\n const { doc } = document;\n if (doc === null || !Object.hasOwn(doc, COLLECTIONS_KEY)) return [];\n return parseCollections(doc[COLLECTIONS_KEY], source, toError);\n}\n\n/**\n * The document's outside-tool settings. Parsed with the tool's own `toError`,\n * as `collections:` is.\n */\nfunction toolsOf(document: Document, source: string, toError: ToError): ToolsConfig {\n const { doc } = document;\n if (doc === null || !Object.hasOwn(doc, TOOLS_KEY)) return {};\n return parseTools(doc[TOOLS_KEY], source, toError);\n}\n\n/**\n * The document's encryption key, as a spreadable field. A malformed one is an\n * error in the tool's class, and the message never repeats the value: it is\n * key material, and a CI log is not the place for it.\n */\nfunction encryptionKeyOf(\n document: Document,\n source: string,\n toError: ToError,\n): { encryptionKey?: string; encryptionKeyPrevious?: string } {\n const { doc } = document;\n if (doc === null) return {};\n const keys: { encryptionKey?: string; encryptionKeyPrevious?: string } = {};\n if (Object.hasOwn(doc, ENCRYPTION_KEY_FIELD)) {\n const value = doc[ENCRYPTION_KEY_FIELD];\n if (!isValidEncryptionKey(value)) {\n throw toError(\n `${source}: \"${ENCRYPTION_KEY_FIELD}\" must be at least 32 hex or base64url characters. Run \\`manni key set\\` to generate one.`,\n );\n }\n keys.encryptionKey = value;\n }\n // The key an unfinished rotation is replacing. Key material too, so the\n // same shape rule and the same silence about the value. There is no advice\n // to generate one: `manni key rotate` writes it, and nothing else should.\n if (Object.hasOwn(doc, ENCRYPTION_KEY_PREVIOUS_FIELD)) {\n const value = doc[ENCRYPTION_KEY_PREVIOUS_FIELD];\n if (!isValidEncryptionKey(value)) {\n throw toError(\n `${source}: \"${ENCRYPTION_KEY_PREVIOUS_FIELD}\" must be at least 32 hex or base64url characters.`,\n );\n }\n keys.encryptionKeyPrevious = value;\n }\n return keys;\n}\n\n/**\n * The document's provider settings, as a spreadable field. Parsed with the\n * tool's own `toError`, and a relative path in them resolves from `dir`.\n */\nfunction providersOf(\n document: Document,\n source: string,\n dir: string,\n toError: ToError,\n): { providers?: ProvidersConfig } {\n const { doc } = document;\n if (doc === null || !Object.hasOwn(doc, PROVIDERS_KEY)) return {};\n return { providers: parseProviders(doc[PROVIDERS_KEY], source, dir, toError) };\n}\n\n/**\n * The family keys as `manni key` reads them: only valid ones, and a malformed\n * one is no error, because replacing it is what the caller is for.\n */\nfunction tolerantKeysOf(document: Document): {\n encryptionKey?: string;\n encryptionKeyPrevious?: string;\n} {\n const key = document.doc?.[ENCRYPTION_KEY_FIELD];\n const previous = document.doc?.[ENCRYPTION_KEY_PREVIOUS_FIELD];\n return {\n ...(isValidEncryptionKey(key) ? { encryptionKey: key } : {}),\n ...(isValidEncryptionKey(previous) ? { encryptionKeyPrevious: previous } : {}),\n };\n}\n\nfunction relativeSource(cwd: string, path: string): string {\n return relative(cwd, path).replace(/\\\\/g, \"/\");\n}\n\n/**\n * Discover the tool's config from `cwd` upward. `null` when nothing exists.\n */\nexport function findConfigFileSync(\n cwd: string,\n opts: ConfigFileOptions,\n): ConfigFile | null {\n const start = resolve(cwd);\n for (const dir of searchPath(start)) {\n for (const name of FAMILY_CONFIG_NAMES) {\n const path = join(dir, name);\n const source = relativeSource(start, path);\n const document = readDocument(path, source, opts.toError);\n if (document === null) continue;\n const found = slice(document, opts);\n // A family file without this tool's key belongs to a sibling. Keep\n // looking, rather than treating the file as an empty config.\n if (found === null) continue;\n return {\n path,\n dir,\n source,\n text: document.text,\n kind: \"manni\",\n collections: collectionsOf(document, source, opts.toError),\n tools: toolsOf(document, source, opts.toError),\n ...encryptionKeyOf(document, source, opts.toError),\n ...providersOf(document, source, dir, opts.toError),\n ...found,\n };\n }\n for (const name of opts.legacyNames) {\n const path = join(dir, name);\n const source = relativeSource(start, path);\n const document = readDocument(path, source, opts.toError);\n if (document === null) continue;\n warn(\n `\"${name}\" is a deprecated config file name. Move its keys under \\`${opts.section}:\\` in \"${FAMILY_CONFIG_NAMES[0] ?? \"manni.config.yaml\"}\", and its paths, exclude and sidecars keys to a top-level collections: list, where sidecars becomes externalMetadata.`,\n );\n return {\n path,\n dir,\n source,\n text: document.text,\n value: document.doc,\n wrapped: false,\n kind: \"legacy\",\n collections: [],\n tools: {},\n };\n }\n }\n return null;\n}\n\n/**\n * Read the config at an explicit path. Missing is an error: a `-c` pointing\n * at a file that is not there is a mistake worth failing on, not a reason to\n * quietly run against something else.\n */\nexport function readConfigFileSync(\n explicitPath: string,\n cwd: string,\n opts: ConfigFileOptions,\n): ConfigFile {\n const path = resolve(cwd, explicitPath);\n // Report the spelling the user typed, not the resolved absolute path.\n const document = readDocument(path, explicitPath, opts.toError);\n if (document === null) {\n throw opts.toError(`Config file not found: \"${explicitPath}\".`);\n }\n const found = slice(document, opts) ?? {\n value: document.doc,\n wrapped: false,\n };\n return {\n path,\n dir: dirname(path),\n source: explicitPath,\n text: document.text,\n kind: \"explicit\",\n collections: collectionsOf(document, explicitPath, opts.toError),\n tools: toolsOf(document, explicitPath, opts.toError),\n // An unwrapped document carries no family key (else it would be wrapped),\n // so this only ever reads a family file's key.\n ...encryptionKeyOf(document, explicitPath, opts.toError),\n ...providersOf(document, explicitPath, dirname(path), opts.toError),\n ...found,\n };\n}\n\n/** `findConfigFileSync`, for callers that await. */\nexport function findConfigFile(\n cwd: string,\n opts: ConfigFileOptions,\n): Promise<ConfigFile | null> {\n return Promise.resolve().then(() => findConfigFileSync(cwd, opts));\n}\n\n/** `readConfigFileSync`, for callers that await. */\nexport function readConfigFile(\n explicitPath: string,\n cwd: string,\n opts: ConfigFileOptions,\n): Promise<ConfigFile> {\n return Promise.resolve().then(() =>\n readConfigFileSync(explicitPath, cwd, opts),\n );\n}\n\n/**\n * The nearest family file from `cwd` upward, whatever it carries: any tool's\n * section, a family key, or nothing at all. For `manni key`, which writes the\n * family's key and so belongs to no one tool's section. Never a legacy\n * per-tool file, whose whole document is one tool's section.\n *\n * `value` is `null` and `wrapped` is `true`: no tool's section is handed\n * over. `encryptionKey` is set only when the file holds a valid one. A\n * malformed key is not an error here, unlike in `findConfigFile`, because\n * replacing it is what the caller is for.\n */\nexport function findFamilyConfigFile(\n cwd: string,\n toError: ToError,\n): Promise<ConfigFile | null> {\n return Promise.resolve().then(() => findFamilyConfigFileSync(cwd, toError));\n}\n\nfunction findFamilyConfigFileSync(\n cwd: string,\n toError: ToError,\n): ConfigFile | null {\n const start = resolve(cwd);\n for (const dir of searchPath(start)) {\n for (const name of FAMILY_CONFIG_NAMES) {\n const path = join(dir, name);\n const source = relativeSource(start, path);\n const document = readDocument(path, source, toError);\n if (document === null) continue;\n return {\n path,\n dir,\n source,\n text: document.text,\n value: null,\n wrapped: true,\n kind: \"manni\",\n collections: collectionsOf(document, source, toError),\n tools: toolsOf(document, source, toError),\n ...tolerantKeysOf(document),\n };\n }\n }\n return null;\n}\n\n/**\n * Read an explicit path as a family file, for `manni key set -c`, which writes\n * the family's key and so belongs to no one tool's section.\n *\n * The file is a family file when it is empty, carries a family key, or is\n * named as one (`manni.config.yaml`, `manni.config.yml`): its top-level keys\n * are then sections, whatever they are, and `value` is `null`. Anything else\n * is read whole as one tool's section (`wrapped: false`), which the key writer\n * refuses rather than turn into a family file under that tool's feet. Missing\n * is an error, as it is for `readConfigFile`. Keys are carried as\n * `findFamilyConfigFile` carries them.\n */\nexport function readFamilyConfigFile(\n explicitPath: string,\n cwd: string,\n toError: ToError,\n): Promise<ConfigFile> {\n return Promise.resolve().then(() =>\n readFamilyConfigFileSync(explicitPath, cwd, toError),\n );\n}\n\nfunction readFamilyConfigFileSync(\n explicitPath: string,\n cwd: string,\n toError: ToError,\n): ConfigFile {\n const path = resolve(cwd, explicitPath);\n const document = readDocument(path, explicitPath, toError);\n if (document === null) {\n throw toError(`Config file not found: \"${explicitPath}\".`);\n }\n const { doc } = document;\n const named = FAMILY_CONFIG_NAMES.includes(basename(path));\n const family =\n doc === null || named || FAMILY_KEYS.some((key) => Object.hasOwn(doc, key));\n return {\n path,\n dir: dirname(path),\n source: explicitPath,\n text: document.text,\n value: family ? null : doc,\n wrapped: family,\n kind: \"explicit\",\n collections: collectionsOf(document, explicitPath, toError),\n tools: toolsOf(document, explicitPath, toError),\n ...tolerantKeysOf(document),\n };\n}\n","/**\n * The project boundary: the nearest directory at or above `cwd` holding a\n * `.git` entry. A file or a directory, since a worktree's `.git` is a file.\n *\n * Two callers need it for opposite reasons and only one of them wants a\n * chain. Config discovery walks the chain and stops here. The SARIF reporter\n * needs the root itself, and needs \"there is no repository\" to be\n * distinguishable from \"the repository root is where you are standing\" — a\n * one-element chain conflates the two, and getting that wrong means emitting\n * paths GitHub silently drops.\n */\nimport { existsSync } from \"node:fs\";\nimport { dirname, join, resolve } from \"node:path\";\n\nexport function findGitRoot(cwd: string): string | null {\n let dir = resolve(cwd);\n for (;;) {\n if (existsSync(join(dir, \".git\"))) return dir;\n const parent = dirname(dir);\n if (parent === dir) return null;\n dir = parent;\n }\n}\n\n/**\n * The directories a discovery walk may look in, nearest first.\n *\n * The walk stops at the project boundary `findGitRoot` reports, which is\n * included in the search. Only that one call touches the filesystem; the chain\n * itself is then assembled from path strings.\n *\n * With **no** boundary anywhere above cwd, only cwd is considered. A\n * project-scoped config has no meaning without a project, and walking on would\n * let a stray config file in a home or temp directory silently govern\n * unrelated runs — including this repo's own tests, which work in OS temp\n * directories under the user's home.\n */\nexport function searchPath(cwd: string): string[] {\n const start = resolve(cwd);\n const root = findGitRoot(start);\n if (root === null) return [start];\n const chain: string[] = [];\n let dir = start;\n for (;;) {\n chain.push(dir);\n if (dir === root) return chain;\n const parent = dirname(dir);\n // `root` is an ancestor of `start` by construction, so this is unreachable\n // — but a filesystem race (the boundary removed mid-walk) must not loop.\n if (parent === dir) return chain;\n dir = parent;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAkBA,OAAOA,gBAAe;;;ACTtB,OAAO,eAAe;AAWtB,IAAM,eAAe,oBAAI,IAAoC;AAMtD,SAAS,gBACd,SACA,MACS;AAQT,QAAM,MAAM,KAAK,UAAU,IAAI;AAC/B,MAAI,IAAI,a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I,IAAI;AAChB,QAAM,QAAQ,oBAAoB,SAAS,SAAS,IAAI,CAAC;AACzD,QAAM,SACJ,QAAQ,QAAQ,SAAS,YAAY,KAAK,CAAC,QAAQ,OAAO,OAAO,KAAK,GAAG,CAAC;AAC5E,SAAO;AAAA,IACL;AAAA,IACA,KAAKE,SAAQ,IAAI;AAAA,IACjB,QAAQ;AAAA,IACR,MAAM,SAAS;AAAA,IACf,OAAO,SAAS,OAAO;AAAA,IACvB,SAAS;AAAA,IACT,MAAM;AAAA,IACN,aAAa,cAAc,UAAU,cAAc,OAAO;AAAA,IAC1D,OAAO,QAAQ,UAAU,cAAc,OAAO;AAAA,IAC9C,GAAG,eAAe,QAAQ;AAAA,EAC5B;AACF;","names":["picomatch","posix","isMember","posix","picomatch","isAbsolute","resolve","isMapping","rejectUnknownKeys","readFileSync","dirname","join","relative","resolve","resolve","readFileSync","relative","resolve","join","dirname"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/cite/reporters/sarif.ts"],"sourcesContent":["/**\n * SARIF for `check`. Meta's renderer builds the envelope, the\n * repository-relative uris and the fingerprints the baseline shares, from the\n * adapted results. What it cannot know is what a cite rule is: it describes\n * every rule as a schema keyword, links meta's fix page, and prefixes each\n * message with the JSON Pointer of the entry, `(root)` for a finding about no\n * entry. This renderer replaces those three with the cite rule's own\n * description, a link to its section of the cite fix page, and the message\n * the github annotation carries, which names the citation the pointer only\n * numbered. Each result also carries the rule's guidance, in its message and\n * in `properties.guidance`. A message is no part of a fingerprint, so the\n * baseline is unaffected.\n */\nimport { renderSarif, type FieldError, type ValidationResult } from \"../../meta/index.js\";\nimport { guidanceLines } from \"../../shared/guidance.js\";\nimport { errorSite } from \"../core/adapt.js\";\nimport { RULE_ID_PREFIX, guidanceFor, isCiteRule } from \"../core/severity.js\";\nimport type { CheckRun, CitationFinding } from \"../types.js\";\nimport { findingMessage } from \"./github.js\";\n\nconst INFORMATION_URI = \"https://hawkeyexl.github.io/manni/cite/\";\n\n/**\n * The label meta's reporters put before a message: `(root) ` for a finding\n * about no entry, `/citations/N ` for one about an entry. Nothing else ever\n * opens a cite finding's adapted message.\n */\nexport const ENTRY_LABEL = /^(?:\\(root\\)|\\/citations\\/\\d+) /;\n\nexport interface SarifRule {\n id: string;\n shortDescription: { text: string };\n fullDescription?: { text: string };\n helpUri?: string;\n}\n\n/** As much of meta's SARIF as this renderer and its tests read back. */\nexport interface SarifLog {\n runs: {\n tool: { driver: { informationUri: string; rules: SarifRule[] } };\n results: { ruleId: string; message: { text: string }; properties?: Record<string, unknown> }[];\n }[];\n}\n\n/**\n * The adapted results with each message rewritten by `compose`, the github\n * annotation's message unless told otherwise. An error is paired with its\n * finding by rule, entry, line and message, as the baseline split pairs them;\n * the baseline has already dropped the errors it forgives. `paired` hears\n * each rewritten error with the finding it came from.\n */\nexport function withFindingMessages(\n run: CheckRun,\n compose: (finding: CitationFinding) => string = findingMessage,\n paired?: (error: FieldError, finding: CitationFinding) => void,\n): ValidationResult[] {\n return run.results.map((result) => {\n const page = run.pages.find((p) => p.file === result.file);\n if (page === undefined) return result;\n const errors = result.errors.map((error) => {\n const finding = page.findings.find(\n (f) =>\n f.rule === error.keyword &&\n (f.index === undefined ? \"\" : `/citations/${String(f.index)}`) === error.instancePath &&\n f.message === error.message &&\n (errorSite(f).line ?? null) === (error.line ?? null),\n );\n if (finding === undefined) return error;\n const rewritten = { ...error, message: compose(finding) };\n paired?.(rewritten, finding);\n return rewritten;\n });\n return { ...result, errors };\n });\n}\n\n/** A rule as the citation tool describes it, linked to its section of the fix page. */\nfunction describe(rule: SarifRule): SarifRule {\n const name = rule.id.slice(RULE_ID_PREFIX.length + 1);\n if (!isCiteRule(name)) return rule;\n const { description, guide } = guidanceFor(name);\n const text = description ?? \"\";\n return {\n id: rule.id,\n shortDescription: { text },\n fullDescription: { text },\n ...(guide === null ? {} : { helpUri: guide }),\n };\n}\n\nexport function renderCheckSarif(run: CheckRun, opts: { onNotice?: (message: string) => void } = {}): string {\n const origin = new Map<FieldError, CitationFinding>();\n const results = withFindingMessages(\n run,\n (finding) => [findingMessage(finding), ...guidanceLines(finding.guidance)].join(\"\\n\"),\n (error, finding) => origin.set(error, finding),\n );\n const log = JSON.parse(\n renderSarif(results, {\n frame: run.frame,\n ...(opts.onNotice === undefined ? {} : { onNotice: opts.onNotice }),\n resultProperties: (error) => {\n const guidance = origin.get(error)?.guidance;\n return guidance == null ? undefined : { guidance };\n },\n }),\n ) as SarifLog;\n for (const sarifRun of log.runs) {\n sarifRun.tool.driver.informationUri = INFORMATION_URI;\n sarifRun.tool.driver.rules = sarifRun.tool.driver.rules.map(describe);\n for (const result of sarifRun.results) result.message.text = result.message.text.replace(ENTRY_LABEL, \"\");\n }\n return JSON.stringify(log, null, 2);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,IAAM,kBAAkB;AAOjB,IAAM,cAAc;AAwBpB,SAAS,oBACd,KACA,UAAgD,gBAChD,QACoB;AACpB,SAAO,IAAI,QAAQ,IAAI,CAAC,WAAW;AACjC,UAAM,OAAO,IAAI,MAAM,KAAK,CAAC,MAAM,EAAE,SAAS,OAAO,IAAI;AACzD,QAAI,SAAS,OAAW,QAAO;AAC/B,UAAM,SAAS,OAAO,OAAO,IAAI,CAAC,UAAU;AAC1C,YAAM,UAAU,KAAK,SAAS;AAAA,QAC5B,CAAC,MACC,EAAE,SAAS,MAAM,YAChB,EAAE,UAAU,SAAY,KAAK,cAAc,OAAO,EAAE,KAAK,CAAC,QAAQ,MAAM,gBACzE,EAAE,YAAY,MAAM,YACnB,UAAU,CAAC,EAAE,QAAQ,WAAW,MAAM,QAAQ;AAAA,MACnD;AACA,UAAI,YAAY,OAAW,QAAO;AAClC,YAAM,YAAY,EAAE,GAAG,OAAO,SAAS,QAAQ,OAAO,EAAE;AACxD,eAAS,WAAW,OAAO;AAC3B,aAAO;AAAA,IACT,CAAC;AACD,WAAO,EAAE,GAAG,QAAQ,OAAO;AAAA,EAC7B,CAAC;AACH;AAGA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