@hawkeyexl/manni 4.26.2 → 4.27.1

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 (270) hide show
  1. package/README.md +1 -1
  2. package/dist/{batch-4I5S6DXG.js → batch-FXJMZSYY.js} +14 -14
  3. package/dist/build-5O753VOV.js +37 -0
  4. package/dist/{calibrate-U4TQAXXD.js → calibrate-RF7YSQMK.js} +15 -15
  5. package/dist/{capture-ODSHL2XI.js → capture-EKYFKMBB.js} +14 -14
  6. package/dist/check-4YQUHDAP.js +58 -0
  7. package/dist/check-CG4UOXP7.js +34 -0
  8. package/dist/{check-YFLWJUZC.js → check-KI3HYODN.js} +15 -15
  9. package/dist/check-PWFSARDW.js +31 -0
  10. package/dist/check-VXTYP4XW.js +58 -0
  11. package/dist/{chunk-QNXNA2BR.js → chunk-35J3BP37.js} +300 -58
  12. package/dist/chunk-35J3BP37.js.map +1 -0
  13. package/dist/{chunk-SIDHDT4X.js → chunk-3G3TETDC.js} +8 -8
  14. package/dist/{chunk-4X3EH5VC.js → chunk-3VFYCN5N.js} +65 -47
  15. package/dist/chunk-3VFYCN5N.js.map +1 -0
  16. package/dist/{chunk-BREAC43H.js → chunk-43VLZO4W.js} +2 -2
  17. package/dist/{chunk-HJHDYROD.js → chunk-47CLJY6H.js} +4 -4
  18. package/dist/{chunk-RVATMGUL.js → chunk-4CBACRVT.js} +4 -4
  19. package/dist/{chunk-UT3CPOGN.js → chunk-4YTYUB77.js} +8 -8
  20. package/dist/{chunk-QWGAM3T6.js → chunk-5GQ7FF22.js} +3 -3
  21. package/dist/{chunk-B6YZINES.js → chunk-5UCBYX53.js} +173 -83
  22. package/dist/chunk-5UCBYX53.js.map +1 -0
  23. package/dist/{chunk-KHBOMLPS.js → chunk-6RGLJTXE.js} +4 -4
  24. package/dist/{chunk-KLTGAGB6.js → chunk-74E5D3DP.js} +3 -3
  25. package/dist/{chunk-UUGTQUKK.js → chunk-7DFAXPO6.js} +64 -11
  26. package/dist/chunk-7DFAXPO6.js.map +1 -0
  27. package/dist/{chunk-5KWMVAZZ.js → chunk-7VCMV247.js} +2 -2
  28. package/dist/{chunk-MC7U5IH4.js → chunk-BCRMMIY5.js} +1 -1
  29. package/dist/chunk-BCRMMIY5.js.map +1 -0
  30. package/dist/{chunk-3ZVRGBK6.js → chunk-BTFXOKCP.js} +2 -2
  31. package/dist/{chunk-4DFLLMIM.js → chunk-C2XLJICN.js} +3 -3
  32. package/dist/{chunk-JF4BC7ZD.js → chunk-CDX4QK6O.js} +29 -2
  33. package/dist/chunk-CDX4QK6O.js.map +1 -0
  34. package/dist/{chunk-PEZP4ZFP.js → chunk-CIGRVU5V.js} +31 -13
  35. package/dist/chunk-CIGRVU5V.js.map +1 -0
  36. package/dist/{chunk-K7UVWJJW.js → chunk-CUOJGVVA.js} +15 -7
  37. package/dist/chunk-CUOJGVVA.js.map +1 -0
  38. package/dist/{chunk-NTQ73IQL.js → chunk-D7V5MUXP.js} +2 -2
  39. package/dist/{chunk-NTQ73IQL.js.map → chunk-D7V5MUXP.js.map} +1 -1
  40. package/dist/{chunk-PX4QZLA2.js → chunk-F4CL337L.js} +3 -3
  41. package/dist/{chunk-KSDAAJJX.js → chunk-G2SEJDO6.js} +2 -2
  42. package/dist/{chunk-J7E4XAFG.js → chunk-GEBXLJKQ.js} +32 -22
  43. package/dist/chunk-GEBXLJKQ.js.map +1 -0
  44. package/dist/chunk-HMJZHUCJ.js +337 -0
  45. package/dist/chunk-HMJZHUCJ.js.map +1 -0
  46. package/dist/{chunk-GXC7SDLO.js → chunk-IHW7N3A6.js} +369 -89
  47. package/dist/chunk-IHW7N3A6.js.map +1 -0
  48. package/dist/{chunk-UOZZTK7T.js → chunk-JVWJYB7V.js} +6 -6
  49. package/dist/{chunk-P6QJPKZ2.js → chunk-K7742NWM.js} +31 -26
  50. package/dist/chunk-K7742NWM.js.map +1 -0
  51. package/dist/{chunk-PJ5YJS6L.js → chunk-KPXZZD66.js} +2 -2
  52. package/dist/{chunk-KLRTOQN4.js → chunk-KQ66NYWY.js} +13 -7
  53. package/dist/chunk-KQ66NYWY.js.map +1 -0
  54. package/dist/{chunk-GM5LWEDF.js → chunk-L7QHAAZC.js} +56 -27
  55. package/dist/chunk-L7QHAAZC.js.map +1 -0
  56. package/dist/{chunk-BAJ23I2H.js → chunk-LEGD33WJ.js} +14 -7
  57. package/dist/chunk-LEGD33WJ.js.map +1 -0
  58. package/dist/{chunk-Z2JBWLRF.js → chunk-M2XDU7QB.js} +9 -9
  59. package/dist/{chunk-H4JXCWLM.js → chunk-MHVS4LTZ.js} +7 -7
  60. package/dist/{chunk-7ODOTGU4.js → chunk-MRQTMVJZ.js} +3 -3
  61. package/dist/{chunk-RV2BYDJK.js → chunk-MZMVTI6Y.js} +24 -14
  62. package/dist/chunk-MZMVTI6Y.js.map +1 -0
  63. package/dist/{chunk-MMVT3ZP3.js → chunk-NFQH77XJ.js} +5 -5
  64. package/dist/{chunk-SHYEKYV4.js → chunk-OBZY2ZLQ.js} +2 -2
  65. package/dist/{chunk-TI4DA6DF.js → chunk-OPF3NOKF.js} +1 -1
  66. package/dist/chunk-OPF3NOKF.js.map +1 -0
  67. package/dist/{chunk-QFEEUI2Z.js → chunk-OVIWWR5N.js} +4 -4
  68. package/dist/{chunk-THFV3YVO.js → chunk-P3OV32LW.js} +4 -4
  69. package/dist/{chunk-NZ7RO6ZD.js → chunk-P4HSBQHG.js} +3 -3
  70. package/dist/{chunk-VNR7BQBZ.js → chunk-P6JCXNMG.js} +52 -4
  71. package/dist/chunk-P6JCXNMG.js.map +1 -0
  72. package/dist/{chunk-JDQFU2U6.js → chunk-QXSPGFT3.js} +9 -9
  73. package/dist/{chunk-BPVO3OED.js → chunk-RCP5V6KE.js} +6 -6
  74. package/dist/{chunk-P7MGBTY3.js → chunk-RHR64UXW.js} +3 -3
  75. package/dist/{chunk-A43A335C.js → chunk-RWGHG66G.js} +3 -3
  76. package/dist/{chunk-HAZQCHO5.js → chunk-S4ADL7Y4.js} +3 -3
  77. package/dist/{chunk-DPQAF2VR.js → chunk-SDUVH4J2.js} +2 -2
  78. package/dist/{chunk-LSH6HPKB.js → chunk-SJS6Z7JV.js} +4 -4
  79. package/dist/{chunk-K4X6GJKG.js → chunk-SJUEUKJD.js} +3 -3
  80. package/dist/{chunk-YG4GZXSA.js → chunk-TO6N7QVO.js} +2 -2
  81. package/dist/{chunk-OKLRZM2N.js → chunk-TXIZMTCQ.js} +5 -5
  82. package/dist/{chunk-LHFO4HF7.js → chunk-UGQPOFLW.js} +7 -7
  83. package/dist/{chunk-SJI7C7FY.js → chunk-VCJ6ZJDW.js} +14 -14
  84. package/dist/{chunk-EXCYL3S7.js → chunk-VH3X7GHC.js} +2 -2
  85. package/dist/{chunk-VDEE7AUI.js → chunk-VKIIG6DZ.js} +2 -2
  86. package/dist/{chunk-LURF4MTH.js → chunk-VPNKSEQU.js} +3 -3
  87. package/dist/{chunk-PWLUQLFH.js → chunk-W4RCGOLJ.js} +7 -7
  88. package/dist/{chunk-GCJPYCOV.js → chunk-WOCG36UV.js} +4 -4
  89. package/dist/{chunk-ZR33AQFW.js → chunk-XK3T6MKU.js} +10 -8
  90. package/dist/chunk-XK3T6MKU.js.map +1 -0
  91. package/dist/{chunk-A6LHTTNO.js → chunk-XOKLYJJT.js} +21 -12
  92. package/dist/chunk-XOKLYJJT.js.map +1 -0
  93. package/dist/{chunk-M6RB342K.js → chunk-YTW7A62V.js} +2 -2
  94. package/dist/{chunk-4IM6A2WK.js → chunk-YWJ453BG.js} +6 -6
  95. package/dist/{chunk-RZ65VMRW.js → chunk-ZBN2HEC2.js} +10 -10
  96. package/dist/{chunk-DGN4VVFG.js → chunk-ZMEDAKMB.js} +3 -3
  97. package/dist/{chunk-NXP3DG4L.js → chunk-ZMGME5NG.js} +4 -4
  98. package/dist/{chunk-XD4Z26HJ.js → chunk-ZMWQZF3F.js} +3 -3
  99. package/dist/{chunk-G5I2JTDK.js → chunk-ZWVYT2G6.js} +2 -2
  100. package/dist/{chunk-D4BGNAN5.js → chunk-ZZGHTXZ2.js} +159 -23
  101. package/dist/chunk-ZZGHTXZ2.js.map +1 -0
  102. package/dist/{cli-XM4F6ZC7.js → cli-545YXHOS.js} +26 -25
  103. package/dist/{cli-XM4F6ZC7.js.map → cli-545YXHOS.js.map} +1 -1
  104. package/dist/{cli-DKRISKSR.js → cli-6EPISRJR.js} +21 -21
  105. package/dist/{cli-WWNQFDMK.js → cli-6LJS32R2.js} +3 -3
  106. package/dist/{cli-RO4TNFXJ.js → cli-6N2VRKCW.js} +16 -15
  107. package/dist/{cli-RO4TNFXJ.js.map → cli-6N2VRKCW.js.map} +1 -1
  108. package/dist/{cli-SDW7JOTO.js → cli-6SDS7T2Q.js} +56 -55
  109. package/dist/{cli-SDW7JOTO.js.map → cli-6SDS7T2Q.js.map} +1 -1
  110. package/dist/{cli-3VAVQYQT.js → cli-DCGA5IQ4.js} +24 -42
  111. package/dist/cli-DCGA5IQ4.js.map +1 -0
  112. package/dist/{cli-AR6TOW7M.js → cli-E6JIYSKY.js} +20 -19
  113. package/dist/{cli-AR6TOW7M.js.map → cli-E6JIYSKY.js.map} +1 -1
  114. package/dist/{cli-CFDGH5HD.js → cli-K4SDAECI.js} +30 -29
  115. package/dist/{cli-CFDGH5HD.js.map → cli-K4SDAECI.js.map} +1 -1
  116. package/dist/{cli-6DOYYCTT.js → cli-KINREG4W.js} +29 -28
  117. package/dist/{cli-6DOYYCTT.js.map → cli-KINREG4W.js.map} +1 -1
  118. package/dist/{cli-7IPP6ZTQ.js → cli-XUWY3QTT.js} +37 -36
  119. package/dist/{cli-7IPP6ZTQ.js.map → cli-XUWY3QTT.js.map} +1 -1
  120. package/dist/{cli-C2OATF3N.js → cli-ZTYRATHT.js} +8 -8
  121. package/dist/cli.js +15 -15
  122. package/dist/{config-2YJPJ36T.js → config-Z3FYLJ6X.js} +3 -3
  123. package/dist/docmeta.js +7 -7
  124. package/dist/github-GW6UZTRR.js +29 -0
  125. package/dist/{github-GU23WNCU.js → github-IT66VVCM.js} +15 -14
  126. package/dist/github-UJTQPG6S.js +49 -0
  127. package/dist/index.d.ts +165 -6
  128. package/dist/index.js +55 -54
  129. package/dist/index.js.map +1 -1
  130. package/dist/{json-P4EDSVIC.js → json-KKNQHTAA.js} +13 -12
  131. package/dist/{json-YIZON5LE.js → json-X4XGVPXV.js} +16 -15
  132. package/dist/{labels-6RROJOYQ.js → labels-7UD5VT2S.js} +12 -11
  133. package/dist/{labels-6RROJOYQ.js.map → labels-7UD5VT2S.js.map} +1 -1
  134. package/dist/lint-L7QTMCCV.js +33 -0
  135. package/dist/list-R34MHZWK.js +31 -0
  136. package/dist/list-S6LJENZ3.js +49 -0
  137. package/dist/{list-UARFGS7C.js → list-URXKGZ5I.js} +15 -14
  138. package/dist/{page-JADAILE3.js → page-2H44PTPE.js} +10 -10
  139. package/dist/{prepare-B24HTUCX.js → prepare-ND2INKAJ.js} +13 -13
  140. package/dist/{pretty-XAMSAKAR.js → pretty-54GDW63J.js} +15 -14
  141. package/dist/{pretty-NHNYY7CP.js → pretty-BW6SLRBO.js} +25 -24
  142. package/dist/{pretty-5V3PWJ6L.js → pretty-ZVAM3XV6.js} +13 -12
  143. package/dist/{reporters-HTJKW7NG.js → reporters-6P74QNVX.js} +5 -5
  144. package/dist/{reporters-ULSSBAAG.js → reporters-LON6K3EN.js} +12 -12
  145. package/dist/run-KLO35LDY.js +52 -0
  146. package/dist/{sarif-LBODGUNE.js → sarif-2HOXOFAZ.js} +9 -9
  147. package/dist/sarif-DM5XJGBX.js +50 -0
  148. package/dist/{sarif-SOA76ESJ.js → sarif-WXGSULXG.js} +11 -11
  149. package/dist/{strategy-XI7QTY7T.js → strategy-FOZDCVLS.js} +22 -21
  150. package/dist/{term-UIBQBGMR.js → term-CAPJSZ6V.js} +19 -18
  151. package/dist/{term-UIBQBGMR.js.map → term-CAPJSZ6V.js.map} +1 -1
  152. package/dist/{validate-X257AMWS.js → validate-LSB6TBY6.js} +5 -5
  153. package/package.json +1 -1
  154. package/plugin/manni/.claude-plugin/plugin.json +1 -1
  155. package/plugin/manni/hooks/page-metadata.mjs +1 -1
  156. package/dist/build-OPWHXPXE.js +0 -36
  157. package/dist/check-4VOOUC5E.js +0 -33
  158. package/dist/check-M3ORYGTW.js +0 -57
  159. package/dist/check-QJ35SM3K.js +0 -57
  160. package/dist/check-UXS5LVFJ.js +0 -30
  161. package/dist/chunk-4X3EH5VC.js.map +0 -1
  162. package/dist/chunk-A6LHTTNO.js.map +0 -1
  163. package/dist/chunk-B6YZINES.js.map +0 -1
  164. package/dist/chunk-BAJ23I2H.js.map +0 -1
  165. package/dist/chunk-D4BGNAN5.js.map +0 -1
  166. package/dist/chunk-GM5LWEDF.js.map +0 -1
  167. package/dist/chunk-GXC7SDLO.js.map +0 -1
  168. package/dist/chunk-J7E4XAFG.js.map +0 -1
  169. package/dist/chunk-JF4BC7ZD.js.map +0 -1
  170. package/dist/chunk-K7UVWJJW.js.map +0 -1
  171. package/dist/chunk-KLRTOQN4.js.map +0 -1
  172. package/dist/chunk-MC7U5IH4.js.map +0 -1
  173. package/dist/chunk-P6QJPKZ2.js.map +0 -1
  174. package/dist/chunk-PEZP4ZFP.js.map +0 -1
  175. package/dist/chunk-QNXNA2BR.js.map +0 -1
  176. package/dist/chunk-RV2BYDJK.js.map +0 -1
  177. package/dist/chunk-TI4DA6DF.js.map +0 -1
  178. package/dist/chunk-UUGTQUKK.js.map +0 -1
  179. package/dist/chunk-VNR7BQBZ.js.map +0 -1
  180. package/dist/chunk-ZR33AQFW.js.map +0 -1
  181. package/dist/cli-3VAVQYQT.js.map +0 -1
  182. package/dist/github-RPHQGICU.js +0 -48
  183. package/dist/github-VKUOQE77.js +0 -28
  184. package/dist/lint-VXM7UKPY.js +0 -32
  185. package/dist/list-2Y7AM5BW.js +0 -30
  186. package/dist/list-ILJJM7EL.js +0 -48
  187. package/dist/run-EVPJ7SDL.js +0 -51
  188. package/dist/sarif-3PHFVX7D.js +0 -49
  189. /package/dist/{batch-4I5S6DXG.js.map → batch-FXJMZSYY.js.map} +0 -0
  190. /package/dist/{build-OPWHXPXE.js.map → build-5O753VOV.js.map} +0 -0
  191. /package/dist/{calibrate-U4TQAXXD.js.map → calibrate-RF7YSQMK.js.map} +0 -0
  192. /package/dist/{capture-ODSHL2XI.js.map → capture-EKYFKMBB.js.map} +0 -0
  193. /package/dist/{check-4VOOUC5E.js.map → check-4YQUHDAP.js.map} +0 -0
  194. /package/dist/{check-M3ORYGTW.js.map → check-CG4UOXP7.js.map} +0 -0
  195. /package/dist/{check-YFLWJUZC.js.map → check-KI3HYODN.js.map} +0 -0
  196. /package/dist/{check-QJ35SM3K.js.map → check-PWFSARDW.js.map} +0 -0
  197. /package/dist/{check-UXS5LVFJ.js.map → check-VXTYP4XW.js.map} +0 -0
  198. /package/dist/{chunk-SIDHDT4X.js.map → chunk-3G3TETDC.js.map} +0 -0
  199. /package/dist/{chunk-BREAC43H.js.map → chunk-43VLZO4W.js.map} +0 -0
  200. /package/dist/{chunk-HJHDYROD.js.map → chunk-47CLJY6H.js.map} +0 -0
  201. /package/dist/{chunk-RVATMGUL.js.map → chunk-4CBACRVT.js.map} +0 -0
  202. /package/dist/{chunk-UT3CPOGN.js.map → chunk-4YTYUB77.js.map} +0 -0
  203. /package/dist/{chunk-QWGAM3T6.js.map → chunk-5GQ7FF22.js.map} +0 -0
  204. /package/dist/{chunk-KHBOMLPS.js.map → chunk-6RGLJTXE.js.map} +0 -0
  205. /package/dist/{chunk-KLTGAGB6.js.map → chunk-74E5D3DP.js.map} +0 -0
  206. /package/dist/{chunk-5KWMVAZZ.js.map → chunk-7VCMV247.js.map} +0 -0
  207. /package/dist/{chunk-3ZVRGBK6.js.map → chunk-BTFXOKCP.js.map} +0 -0
  208. /package/dist/{chunk-4DFLLMIM.js.map → chunk-C2XLJICN.js.map} +0 -0
  209. /package/dist/{chunk-PX4QZLA2.js.map → chunk-F4CL337L.js.map} +0 -0
  210. /package/dist/{chunk-KSDAAJJX.js.map → chunk-G2SEJDO6.js.map} +0 -0
  211. /package/dist/{chunk-UOZZTK7T.js.map → chunk-JVWJYB7V.js.map} +0 -0
  212. /package/dist/{chunk-PJ5YJS6L.js.map → chunk-KPXZZD66.js.map} +0 -0
  213. /package/dist/{chunk-Z2JBWLRF.js.map → chunk-M2XDU7QB.js.map} +0 -0
  214. /package/dist/{chunk-H4JXCWLM.js.map → chunk-MHVS4LTZ.js.map} +0 -0
  215. /package/dist/{chunk-7ODOTGU4.js.map → chunk-MRQTMVJZ.js.map} +0 -0
  216. /package/dist/{chunk-MMVT3ZP3.js.map → chunk-NFQH77XJ.js.map} +0 -0
  217. /package/dist/{chunk-SHYEKYV4.js.map → chunk-OBZY2ZLQ.js.map} +0 -0
  218. /package/dist/{chunk-QFEEUI2Z.js.map → chunk-OVIWWR5N.js.map} +0 -0
  219. /package/dist/{chunk-THFV3YVO.js.map → chunk-P3OV32LW.js.map} +0 -0
  220. /package/dist/{chunk-NZ7RO6ZD.js.map → chunk-P4HSBQHG.js.map} +0 -0
  221. /package/dist/{chunk-JDQFU2U6.js.map → chunk-QXSPGFT3.js.map} +0 -0
  222. /package/dist/{chunk-BPVO3OED.js.map → chunk-RCP5V6KE.js.map} +0 -0
  223. /package/dist/{chunk-P7MGBTY3.js.map → chunk-RHR64UXW.js.map} +0 -0
  224. /package/dist/{chunk-A43A335C.js.map → chunk-RWGHG66G.js.map} +0 -0
  225. /package/dist/{chunk-HAZQCHO5.js.map → chunk-S4ADL7Y4.js.map} +0 -0
  226. /package/dist/{chunk-DPQAF2VR.js.map → chunk-SDUVH4J2.js.map} +0 -0
  227. /package/dist/{chunk-LSH6HPKB.js.map → chunk-SJS6Z7JV.js.map} +0 -0
  228. /package/dist/{chunk-K4X6GJKG.js.map → chunk-SJUEUKJD.js.map} +0 -0
  229. /package/dist/{chunk-YG4GZXSA.js.map → chunk-TO6N7QVO.js.map} +0 -0
  230. /package/dist/{chunk-OKLRZM2N.js.map → chunk-TXIZMTCQ.js.map} +0 -0
  231. /package/dist/{chunk-LHFO4HF7.js.map → chunk-UGQPOFLW.js.map} +0 -0
  232. /package/dist/{chunk-SJI7C7FY.js.map → chunk-VCJ6ZJDW.js.map} +0 -0
  233. /package/dist/{chunk-EXCYL3S7.js.map → chunk-VH3X7GHC.js.map} +0 -0
  234. /package/dist/{chunk-VDEE7AUI.js.map → chunk-VKIIG6DZ.js.map} +0 -0
  235. /package/dist/{chunk-LURF4MTH.js.map → chunk-VPNKSEQU.js.map} +0 -0
  236. /package/dist/{chunk-PWLUQLFH.js.map → chunk-W4RCGOLJ.js.map} +0 -0
  237. /package/dist/{chunk-GCJPYCOV.js.map → chunk-WOCG36UV.js.map} +0 -0
  238. /package/dist/{chunk-M6RB342K.js.map → chunk-YTW7A62V.js.map} +0 -0
  239. /package/dist/{chunk-4IM6A2WK.js.map → chunk-YWJ453BG.js.map} +0 -0
  240. /package/dist/{chunk-RZ65VMRW.js.map → chunk-ZBN2HEC2.js.map} +0 -0
  241. /package/dist/{chunk-DGN4VVFG.js.map → chunk-ZMEDAKMB.js.map} +0 -0
  242. /package/dist/{chunk-NXP3DG4L.js.map → chunk-ZMGME5NG.js.map} +0 -0
  243. /package/dist/{chunk-XD4Z26HJ.js.map → chunk-ZMWQZF3F.js.map} +0 -0
  244. /package/dist/{chunk-G5I2JTDK.js.map → chunk-ZWVYT2G6.js.map} +0 -0
  245. /package/dist/{cli-DKRISKSR.js.map → cli-6EPISRJR.js.map} +0 -0
  246. /package/dist/{cli-WWNQFDMK.js.map → cli-6LJS32R2.js.map} +0 -0
  247. /package/dist/{cli-C2OATF3N.js.map → cli-ZTYRATHT.js.map} +0 -0
  248. /package/dist/{config-2YJPJ36T.js.map → config-Z3FYLJ6X.js.map} +0 -0
  249. /package/dist/{github-GU23WNCU.js.map → github-GW6UZTRR.js.map} +0 -0
  250. /package/dist/{github-RPHQGICU.js.map → github-IT66VVCM.js.map} +0 -0
  251. /package/dist/{github-VKUOQE77.js.map → github-UJTQPG6S.js.map} +0 -0
  252. /package/dist/{json-P4EDSVIC.js.map → json-KKNQHTAA.js.map} +0 -0
  253. /package/dist/{json-YIZON5LE.js.map → json-X4XGVPXV.js.map} +0 -0
  254. /package/dist/{lint-VXM7UKPY.js.map → lint-L7QTMCCV.js.map} +0 -0
  255. /package/dist/{list-2Y7AM5BW.js.map → list-R34MHZWK.js.map} +0 -0
  256. /package/dist/{list-ILJJM7EL.js.map → list-S6LJENZ3.js.map} +0 -0
  257. /package/dist/{list-UARFGS7C.js.map → list-URXKGZ5I.js.map} +0 -0
  258. /package/dist/{page-JADAILE3.js.map → page-2H44PTPE.js.map} +0 -0
  259. /package/dist/{prepare-B24HTUCX.js.map → prepare-ND2INKAJ.js.map} +0 -0
  260. /package/dist/{pretty-5V3PWJ6L.js.map → pretty-54GDW63J.js.map} +0 -0
  261. /package/dist/{pretty-NHNYY7CP.js.map → pretty-BW6SLRBO.js.map} +0 -0
  262. /package/dist/{pretty-XAMSAKAR.js.map → pretty-ZVAM3XV6.js.map} +0 -0
  263. /package/dist/{reporters-HTJKW7NG.js.map → reporters-6P74QNVX.js.map} +0 -0
  264. /package/dist/{reporters-ULSSBAAG.js.map → reporters-LON6K3EN.js.map} +0 -0
  265. /package/dist/{run-EVPJ7SDL.js.map → run-KLO35LDY.js.map} +0 -0
  266. /package/dist/{sarif-3PHFVX7D.js.map → sarif-2HOXOFAZ.js.map} +0 -0
  267. /package/dist/{sarif-LBODGUNE.js.map → sarif-DM5XJGBX.js.map} +0 -0
  268. /package/dist/{sarif-SOA76ESJ.js.map → sarif-WXGSULXG.js.map} +0 -0
  269. /package/dist/{strategy-XI7QTY7T.js.map → strategy-FOZDCVLS.js.map} +0 -0
  270. /package/dist/{validate-X257AMWS.js.map → validate-LSB6TBY6.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/docevals/commands/generate.ts","../src/docevals/commands/fill.ts","../src/docevals/fill/cache.ts","../src/docevals/fill/prompt.ts","../src/docevals/commands/promote.ts","../src/docevals/commands/review.ts","../src/docevals/commands/calibrate.ts","../src/docevals/commands/init.ts"],"sourcesContent":["/**\n * `manni docevals generate` — generate check scripts for command-graded evals that\n * have a plain-language assertion but no command yet (or whose assertion\n * changed since generation), without running any evals.\n */\nimport { loadRunConfig } from \"../core/config.js\";\nimport {\n discoverPages,\n documentSet,\n runConfigOptions,\n type DocumentInputOptions,\n} from \"../core/discover.js\";\nimport { withExternalMetadata } from \"../core/external.js\";\nimport { resolvePages } from \"../core/resolve.js\";\nimport { assertRegisteredGraders } from \"../core/feasibility.js\";\nimport { makeGenerateScripts } from \"../graders/scriptgen.js\";\nimport {\n assertProviderSelection,\n makeProvider,\n selectProvider,\n} from \"../judge/provider.js\";\nimport { sha256 } from \"../judge/cache.js\";\nimport type { InferenceProvider } from \"@hawkeyexl/inference\";\nimport type { GraderTarget } from \"../graders/types.js\";\nimport type { GenerationRefusal } from \"../core/engine.js\";\n\nexport interface GenerateOptions extends DocumentInputOptions {\n provider?: string;\n model?: string;\n /** Run inference on this machine, with llama-cpp, over any configured or eval-level provider. */\n local?: boolean;\n cwd?: string;\n /** Injectable provider for tests and programmatic use. */\n providerInstance?: InferenceProvider;\n}\n\nexport interface GenerateRun {\n generatedPaths: string[];\n targets: number;\n /**\n * Evals whose command reference had nowhere to go (proposal 0047): the\n * manifest that owns the page's evals joins on a field the page lacks. Each\n * counts against `targets`, so the run reports a partial generation, and the\n * sentence says which page and why.\n */\n refusals: GenerationRefusal[];\n}\n\nexport async function runGenerate(\n paths: string[],\n options: GenerateOptions = {},\n): Promise<GenerateRun> {\n const cwd = options.cwd ?? process.cwd();\n const config = loadRunConfig(runConfigOptions(paths, options), cwd);\n const flags = { provider: options.provider, model: options.model, local: options.local };\n // Checked before discovery, and even when nothing needs generating: a typo\n // is a usage error on every run, not only on the runs that reach a model.\n assertProviderSelection(selectProvider(config, flags));\n const pages = await withExternalMetadata(\n discoverPages(config, documentSet(paths, options, \"read\"), cwd),\n config,\n cwd,\n );\n const plans = resolvePages(pages, config);\n assertRegisteredGraders(plans, config);\n\n const targets: GraderTarget[] = [];\n // A config-defined eval is one eval however many pages reference it, and\n // `makeGenerateScripts` already treats it that way (its `doneConfigEvals`\n // set writes one script). Counting it per page made the two disagree, and\n // `src/cli.ts` reads that disagreement as a partial generation: it printed\n // \"Generated 1/2\" and exited 1 on a completely successful run. `runPromote`\n // has carried the same guard from the start.\n const seenConfigEvals = new Set<string>();\n for (const plan of plans) {\n if (plan.skip || plan.problems.some((p) => p.level === \"error\")) continue;\n for (const ev of plan.evals) {\n if (ev.skip || ev.grader !== \"command\") continue;\n const missing = !ev.command;\n const stale =\n ev.command != null &&\n ev.generatedAssertionHash != null &&\n ev.assertion != null &&\n ev.generatedAssertionHash !== sha256(ev.assertion);\n if ((missing || stale) && ev.assertion) {\n if (ev.source === \"config\") {\n if (seenConfigEvals.has(ev.name)) continue;\n seenConfigEvals.add(ev.name);\n }\n targets.push({ plan, eval: ev });\n }\n }\n }\n // Nothing to generate: return before a provider is built, so a corpus with\n // no outstanding scripts needs no API key to be told so.\n if (targets.length === 0) return { generatedPaths: [], targets: 0, refusals: [] };\n\n const provider: InferenceProvider =\n options.providerInstance ?? (await makeProvider(config, flags));\n const generate = makeGenerateScripts({ provider, root: cwd });\n const { generatedPaths, refusals } = await generate(targets, config, {});\n return { generatedPaths, targets: targets.length, refusals: refusals ?? [] };\n}\n","/**\n * `manni docevals fill` — ask an LLM provider to propose frontmatter evals for each\n * page, gate the proposals on self-reported confidence, and append the\n * survivors to the page's frontmatter. Proposals are ai-graded only and\n * deduplicated against the page's resolved plan; existing evals are never\n * touched. See ADR 01001.\n */\nimport { writeFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { palette } from \"../../shared/color.js\";\nimport type { ColorOptions } from \"../reporters/pretty.js\";\nimport type { Severity } from \"../types.js\";\nimport { loadRunConfig } from \"../core/config.js\";\nimport {\n discoverPages,\n documentSet,\n leadingFrontmatterFormat,\n runConfigOptions,\n type DocumentInputOptions,\n} from \"../core/discover.js\";\nimport { withExternalMetadata } from \"../core/external.js\";\nimport { resolvePages, type ResolvedPagePlan } from \"../core/resolve.js\";\nimport {\n appendPageEvals,\n entryObject,\n type NewEvalEntry,\n} from \"../core/frontmatter-edit.js\";\nimport {\n EVALS_KEY,\n EvalWriter,\n META_PROVENANCE_KEY,\n manifestEvalList,\n type WriteHome,\n} from \"../core/write-location.js\";\nimport {\n parseFormat,\n SUMMARY_FORMATS,\n type SummaryFormat,\n} from \"../reporters/format.js\";\nimport {\n assertProviderSelection,\n constructProvider,\n resolveProviderIdentity,\n selectProvider,\n} from \"../judge/provider.js\";\nimport type { InferenceProvider } from \"@hawkeyexl/inference\";\nimport { FillCache, fillCacheKey } from \"../fill/cache.js\";\nimport {\n FILL_SYSTEM_PROMPT,\n buildFillUser,\n isValidProposal,\n PROPOSAL_SCHEMA,\n} from \"../fill/prompt.js\";\nimport { looksLikeOverflow, splitBody } from \"../core/split.js\";\nimport { errorMessage } from \"../../shared/errors.js\";\nimport { warn } from \"../../shared/warn.js\";\nimport type { Confirm } from \"../../shared/prompt.js\";\nimport {\n mergeMetaProvenance,\n type ExternalWrite,\n type RelocateResult,\n} from \"../../meta/internal.js\";\n\nexport interface FillOptions extends DocumentInputOptions {\n cwd?: string;\n /** Characters of page per inference call; longer pages are split. */\n chunkChars?: number;\n /** Report proposals without writing frontmatter. */\n dryRun?: boolean;\n /** Minimum confidence to write; overrides config `fill.confidenceThreshold`. */\n confidence?: number;\n /** Stop after this many inference calls; overrides config `fill.maxTurns`. */\n maxTurns?: number;\n noCache?: boolean;\n provider?: string;\n model?: string;\n /** Run inference on this machine, with llama-cpp, over any configured or eval-level provider. */\n local?: boolean;\n /** Test seam: bypasses provider construction entirely. */\n providerInstance?: InferenceProvider;\n /**\n * P1 (proposal 0047): asked once per collection when evals would land on a\n * page whose schema prefers them in external metadata. The CLI passes\n * `terminalConfirm()`, so off a terminal there is no question and the\n * warning is the only output.\n */\n confirm?: Confirm;\n /** A stderr diagnostic; the caller adds the `manni docevals: ` prefix. */\n onNotice?: (message: string) => void;\n /** What an accepted relocation moved, for the caller to report. */\n onRelocated?: (result: RelocateResult) => void;\n}\n\nexport type FillStatus =\n | \"filled\"\n | \"proposed\"\n | \"nothing-proposed\"\n | \"skipped\"\n | \"skipped-budget\"\n | \"error\";\n\nexport interface ProposedEval {\n id: string;\n assertion: string;\n confidence: number;\n examples: { pass: string; fail: string };\n type?: \"capability\" | \"regression\";\n evidence?: string;\n severity?: Severity;\n rationale?: string;\n}\n\n/**\n * One `meta-provenance` entry after `fill` merged into it: the model, the ids\n * of the evals it proposed, and the confidence each was written at. An entry\n * `fill` merged into keeps whatever else it held, `fields` included.\n */\nexport interface EvalsMetaProvenanceEntry {\n \"generated-by\": string;\n evals: string[];\n confidence: Record<string, number>;\n [other: string]: unknown;\n}\n\n/**\n * What became of this page's `meta-provenance` entry. Never a failure. The\n * shape is `manni meta fill`'s, and so are its reasons: the key follows its\n * own location (proposal 0047), so a local manifest holds the entry, a URL\n * manifest cannot be written, and a manifest joining on a field the page\n * lacks has no entry to hold it.\n */\nexport type EvalsMetaProvenanceReport =\n | {\n written: true;\n entry: EvalsMetaProvenanceEntry;\n /** The manifest the entry went into, when one owns `meta-provenance`. */\n destination?: string;\n }\n /** The page's `meta-provenance` is not a list, so there is nothing to merge into. */\n | { written: false; skipReason: \"schema-mismatch\" }\n /** A URL manifest owns the key, and nothing fetched can be written. */\n | { written: false; skipReason: \"manifest-owned\"; manifest: string }\n /** The owning manifest joins on a field this page does not carry. */\n | { written: false; skipReason: \"unwritable\" };\n\nexport interface FillPageResult {\n file: string;\n status: FillStatus;\n /** Appended (or, in a dry run, would-append) proposals. */\n written: ProposedEval[];\n /** Proposals below the confidence threshold — reported, never written. */\n belowThreshold: ProposedEval[];\n /** Fresh proposals dropped for exceeding `fill.maxEvalsPerPage`. */\n capped: ProposedEval[];\n /** Proposed ids that already exist in the page's resolved plan. */\n duplicates: string[];\n cached: boolean;\n error?: string;\n /**\n * Where the evals went (proposal 0047): `\"page\"`, or the manifest that owns\n * them, as the run reports its path. Absent when nothing was written.\n */\n wroteTo?: string;\n /**\n * The `meta-provenance` entry recording the evals this run wrote. Absent\n * when none was written; reported, not written, under `--dry-run`.\n */\n metaProvenance?: EvalsMetaProvenanceReport;\n}\n\nexport interface FillReport {\n results: FillPageResult[];\n threshold: number;\n /** Inference calls actually made. One per proposed page; a cache hit is none. */\n turns: number;\n exitCode: 0 | 1;\n}\n\n/**\n * Proposals become inline evals with explicit grader/type. Confidence is no\n * longer report-only — it is written to `meta-provenance` alongside the model\n * that proposed it, so the page itself records what a machine wrote and how\n * sure it was, and a reviewer retires the entry when they have checked it.\n */\nfunction toEntry(p: ProposedEval): NewEvalEntry {\n return {\n id: p.id,\n assertion: p.assertion,\n type: p.type ?? \"regression\",\n grader: \"ai\",\n evidence: p.evidence,\n examples: p.examples,\n severity: p.severity,\n };\n}\n\nexport async function runFill(\n paths: string[],\n options: FillOptions = {},\n): Promise<FillReport> {\n const cwd = options.cwd ?? process.cwd();\n let config = loadRunConfig(runConfigOptions(paths, options), cwd);\n const flags = { provider: options.provider, model: options.model, local: options.local };\n // Checked up front, and regardless of an injected provider: it costs nothing,\n // and a typo must fail on a run where no page needs a model too.\n assertProviderSelection(selectProvider(config, flags));\n const load = async (): Promise<ResolvedPagePlan[]> =>\n resolvePages(\n await withExternalMetadata(\n discoverPages(config, documentSet(paths, options, \"fill\"), cwd),\n config,\n cwd,\n ),\n config,\n );\n let plans = await load();\n\n // Proposal 0047: where each page's evals go. Built before the first model\n // request, so P1 is asked — and an accepted relocation applied — while\n // nothing has been proposed yet, exactly as `manni meta fill` asks it\n // between preparing a file and inferring for it.\n const writerFor = (): EvalWriter => EvalWriter.for(config, cwd, paths);\n let writer = writerFor();\n if (options.confirm !== undefined && options.dryRun !== true) {\n const flagged: ExternalWrite[] = [];\n for (const plan of plans) {\n if (plan.skip || plan.problems.some((p) => p.level === \"error\")) continue;\n const home = await writer.homeFor(\n plan.page.file,\n plan.page.frontmatter.data,\n EVALS_KEY,\n );\n if (home.kind === \"page\" && home.prefersExternal) {\n flagged.push({ label: plan.page.file, key: EVALS_KEY, home: home.proposed });\n }\n }\n const applied = await writer.offer(flagged, {\n confirm: options.confirm,\n ...(options.onNotice === undefined ? {} : { onNotice: options.onNotice }),\n ...(options.onRelocated === undefined ? {} : { onRelocated: options.onRelocated }),\n });\n if (applied) {\n // The config now declares a manifest, the pages no longer carry what it\n // owns, and this writer's context predates both.\n config = loadRunConfig(runConfigOptions(paths, options), cwd);\n plans = await load();\n writer = writerFor();\n }\n }\n\n const threshold = options.confidence ?? config.fill.confidenceThreshold;\n const maxTurns = options.maxTurns ?? config.fill.maxTurns;\n const temperature = config.fill.temperature;\n const maxEvals = config.fill.maxEvalsPerPage;\n const chunkChars = options.chunkChars ?? config.fill.chunkChars;\n const cache = new FillCache(\n resolve(cwd, config.fill.cacheDir),\n !options.noCache,\n );\n\n // Identity is resolved without constructing the provider, so a fully cached\n // run needs no API key, and on first use, so an all-skipped run never detects\n // a provider under `auto`. Resolved once, and shared by every page.\n const injected = options.providerInstance;\n let resolving: ReturnType<typeof resolveProviderIdentity> | undefined;\n const resolveOnce = (): ReturnType<typeof resolveProviderIdentity> =>\n (resolving ??= resolveProviderIdentity(config, flags));\n const getIdentity = async (): Promise<{ provider: string; model: string }> =>\n injected\n ? { provider: injected.provider(), model: injected.modelName() }\n : resolveOnce();\n let provider = injected;\n const getProvider = async (): Promise<InferenceProvider> =>\n (provider ??= constructProvider(config, await resolveOnce()));\n let turns = 0;\n const results: FillPageResult[] = [];\n\n for (const plan of plans) {\n results.push(await fillOne(plan));\n }\n\n // W1 and W2 (0047): evals that landed on a page whose schema prefers them in\n // external metadata. One line per collection, not per page.\n for (const line of writer.warnings(options.dryRun === true)) warn(line);\n\n return {\n results,\n threshold,\n turns,\n exitCode: results.some((r) => r.status === \"error\") ? 1 : 0,\n };\n\n async function fillOne(plan: ResolvedPagePlan): Promise<FillPageResult> {\n const base: FillPageResult = {\n file: plan.page.file,\n status: \"nothing-proposed\",\n written: [],\n belowThreshold: [],\n capped: [],\n duplicates: [],\n cached: false,\n };\n if (plan.skip) return { ...base, status: \"skipped\" };\n const problem = plan.problems.find((p) => p.level === \"error\");\n if (problem) return { ...base, status: \"error\", error: problem.message };\n // Reject non-YAML frontmatter before spending an LLM call: it can't be\n // appended to (appendPageEvals would otherwise refuse) and there is\n // nothing to fill.\n const format = leadingFrontmatterFormat(plan.page.content);\n if (format === \"toml\" || format === \"json\") {\n return {\n ...base,\n status: \"error\",\n error: `only YAML frontmatter can be filled (found ${format} frontmatter)`,\n };\n }\n\n const existing = plan.evals.map((e) => ({\n id: e.name,\n assertion: e.assertion,\n }));\n const existingNames = existing.map((e) => e.id).sort();\n // The RESOLVED model, so a provider default that changes changes the key.\n const identity = await getIdentity();\n // Keyed on the budget the proposals were actually produced at, not the\n // one the run asked for. Halve-and-retry means those differ: the split\n // boundaries move, so the parts differ, so the proposals differ. Storing\n // a halved-budget result under the full-budget key lets a later run that\n // did *not* overflow replay proposals from a split it never performed.\n const keyFor = (budget: number): string =>\n fillCacheKey(\n identity.provider,\n identity.model,\n temperature,\n maxEvals,\n plan.page.body,\n existingNames,\n budget,\n );\n // Deliberately no fallback lookup at the halved budget. Serving a halved\n // result to a run that asked for the full one is the collision itself,\n // just spread over two keys — and a page that overflows does so\n // deterministically for the same provider and body, so the retry path\n // finds its own entry from the second run onward.\n const key = keyFor(chunkChars);\n let raw = cache.get(key);\n const cached = raw !== undefined;\n if (!raw) {\n // Claimed before the call, not tallied after it (ADR 01019). A cache\n // hit never reaches here, so replaying a cached corpus spends no turns.\n if (maxTurns !== null && turns >= maxTurns) {\n return { ...base, status: \"skipped-budget\" };\n }\n // A page longer than the budget is proposed against in parts rather\n // than truncated. Each part is its own call; the results merge by eval\n // id, keeping the highest confidence — the metadata tool's `mergeProposals`.\n let budget = chunkChars;\n // This page's own parts. `turns` is the run-wide budget counter and\n // includes every earlier page, so reporting it as \"N of M parts\" names\n // a number that has nothing to do with this page.\n let partsRead = 0;\n let merged: Map<string, ProposedEval> | undefined;\n let failure: string | undefined;\n for (let attempt = 0; attempt < 2 && merged === undefined; attempt++) {\n const chunks = splitBody(plan.page.body, budget);\n const collected = new Map<string, ProposedEval>();\n let overflowed = false;\n let outOfTurns = false;\n partsRead = 0;\n for (const [i, chunk] of chunks.entries()) {\n if (maxTurns !== null && turns >= maxTurns) {\n outOfTurns = true;\n break;\n }\n turns += 1;\n partsRead += 1;\n let response;\n try {\n response = await (await getProvider()).completeJSON({\n system: FILL_SYSTEM_PROMPT,\n user: buildFillUser(\n plan.page.file,\n chunk,\n existing,\n maxEvals,\n chunks.length > 1 ? { index: i, total: chunks.length } : undefined,\n ),\n schema: PROPOSAL_SCHEMA,\n temperature,\n });\n } catch (e) {\n const message = errorMessage(e);\n failure = message;\n if (looksLikeOverflow(message)) overflowed = true;\n break;\n }\n if (!isValidProposal(response.json)) {\n failure = \"provider returned a proposal that does not match the schema\";\n break;\n }\n for (const proposal of (response.json as { evals: ProposedEval[] }).evals) {\n const held = collected.get(proposal.id);\n if (held === undefined || proposal.confidence > held.confidence) {\n collected.set(proposal.id, proposal);\n }\n }\n if (i === chunks.length - 1) merged = collected;\n }\n if (outOfTurns) {\n // Never a silent partial: a page read in part proposed from part of\n // itself, and saying so is the difference between \"nothing to add\"\n // and \"we stopped early\".\n return {\n ...base,\n status: \"skipped-budget\",\n ...(chunks.length > 1\n ? {\n error:\n `--max-turns reached after ${String(partsRead)} of ` +\n `${String(chunks.length)} part(s) of this page`,\n }\n : {}),\n };\n }\n if (merged === undefined && overflowed && attempt === 0) {\n budget = Math.max(1, Math.floor(budget / 2));\n continue;\n }\n if (merged === undefined) break;\n }\n if (merged === undefined) {\n return {\n ...base,\n status: \"error\",\n error: failure ?? \"the provider returned no proposal\",\n };\n }\n raw = { evals: [...merged.values()] };\n cache.set(keyFor(budget), raw);\n }\n\n // Drop duplicates (against the resolved plan and within the batch) before\n // applying the per-page cap, so duplicate names never crowd out fresh\n // proposals.\n const seen = new Set(existingNames);\n const duplicates: string[] = [];\n const fresh: ProposedEval[] = [];\n for (const p of raw.evals as ProposedEval[]) {\n if (seen.has(p.id)) {\n duplicates.push(p.id);\n continue;\n }\n seen.add(p.id);\n fresh.push(p);\n }\n // Proposals beyond the per-page cap are reported as `capped` rather than\n // silently dropped — they may be high-confidence, so folding them into\n // belowThreshold would misreport why they weren't written.\n const capped = fresh.slice(maxEvals);\n const belowThreshold: ProposedEval[] = [];\n const written: ProposedEval[] = [];\n for (const p of fresh.slice(0, maxEvals)) {\n if (p.confidence >= threshold) written.push(p);\n else belowThreshold.push(p);\n }\n\n const result = {\n ...base,\n written,\n belowThreshold,\n capped,\n duplicates,\n cached,\n };\n if (written.length === 0) return result;\n\n // Proposal 0047: where each key goes, settled before a byte is written.\n const label = plan.page.file;\n const data = plan.page.frontmatter.data;\n let evalsHome: WriteHome;\n let metaHome: WriteHome;\n try {\n evalsHome = await writer.homeFor(label, data, EVALS_KEY);\n metaHome = await writer.homeFor(label, data, META_PROVENANCE_KEY);\n } catch (e) {\n return { ...result, status: \"error\", error: errorMessage(e), written: [] };\n }\n if (evalsHome.kind === \"url\") throw writer.urlRefusal(evalsHome, EVALS_KEY);\n if (evalsHome.kind === \"no-entry\") {\n // The manifest owns the evals and has no entry for this page, so there\n // is nowhere to put them. Writing the page instead would put the key in\n // both places, which is the collision the routing exists to prevent.\n return { ...result, status: \"error\", error: evalsHome.message, written: [] };\n }\n\n // The evals this run proposed, recorded in the same write. A record that\n // cannot be merged is reported rather than failing the page: a side\n // record that could block filling would be worse than none, and neither\n // is `meta-provenance`'s own location a reason to fail a fill.\n const merged =\n metaHome.kind === \"url\" || metaHome.kind === \"no-entry\"\n ? undefined\n : mergeMetaProvenance(\n data[META_PROVENANCE_KEY],\n identity.model,\n \"evals\",\n written.map((p) => ({ name: p.id, confidence: p.confidence })),\n );\n const metaManifest = metaHome.kind === \"manifest\" ? metaHome : undefined;\n let metaProvenance: EvalsMetaProvenanceReport;\n if (metaHome.kind === \"url\") {\n metaProvenance = { written: false, skipReason: \"manifest-owned\", manifest: metaHome.file };\n } else if (metaHome.kind === \"no-entry\") {\n metaProvenance = { written: false, skipReason: \"unwritable\" };\n } else if (merged === undefined) {\n metaProvenance = { written: false, skipReason: \"schema-mismatch\" };\n } else if (metaManifest !== undefined) {\n metaProvenance = {\n written: true,\n entry: { ...merged.entry, evals: merged.names },\n destination: metaManifest.file,\n };\n } else {\n metaProvenance = { written: true, entry: { ...merged.entry, evals: merged.names } };\n }\n\n const manifest = evalsHome.kind === \"manifest\" ? evalsHome : undefined;\n const pageEntries = manifest === undefined ? written.map(toEntry) : [];\n const pageMeta =\n metaProvenance.written && metaManifest === undefined ? merged?.list : undefined;\n try {\n // The page first, as `meta fill` writes it, so a refused manifest leaves\n // no entry pointing at a page that was never changed.\n if (pageEntries.length > 0 || pageMeta !== undefined) {\n const updated = appendPageEvals(\n plan.page.content,\n label,\n pageEntries,\n pageMeta,\n );\n if (!options.dryRun && updated !== plan.page.content) {\n writeFileSync(plan.page.absPath, updated);\n }\n }\n if (!options.dryRun && manifest !== undefined) {\n const held = manifestEvalList(\n await writer.readManifest(manifest, EVALS_KEY),\n manifest.file,\n manifest.entry,\n );\n await writer.writeManifest(manifest, EVALS_KEY, [\n ...held,\n ...written.map((p) => entryObject(toEntry(p))),\n ]);\n }\n if (!options.dryRun && metaManifest !== undefined && merged !== undefined) {\n await writer.writeManifest(metaManifest, META_PROVENANCE_KEY, merged.list);\n }\n } catch (e) {\n return {\n ...result,\n status: \"error\",\n error: errorMessage(e),\n written: [],\n };\n }\n if (evalsHome.kind === \"page\" && evalsHome.prefersExternal) {\n writer.stayedOnPage(label, EVALS_KEY, evalsHome.proposed);\n }\n return {\n ...result,\n status: options.dryRun ? \"proposed\" : \"filled\",\n wroteTo: manifest === undefined ? \"page\" : manifest.file,\n metaProvenance,\n };\n }\n}\n\nconst STATUS_LABELS: Record<FillStatus, string> = {\n filled: \"filled\",\n proposed: \"proposed\",\n \"nothing-proposed\": \"no-op\",\n skipped: \"skipped\",\n \"skipped-budget\": \"skipped\",\n error: \"error\",\n};\n\nexport function renderFill(\n report: FillReport,\n format: SummaryFormat,\n opts: ColorOptions = {},\n): string {\n // See renderList — same reasoning, same public exposure via src/index.ts.\n parseFormat(format, SUMMARY_FORMATS, \"format\");\n if (format === \"json\") return JSON.stringify(report, null, 2);\n const pc = palette(opts.color === true);\n const lines: string[] = [];\n const names = (evals: ProposedEval[]) =>\n evals.map((p) => `${p.id} ${p.confidence.toFixed(2)}`).join(\", \");\n for (const r of report.results) {\n const label = STATUS_LABELS[r.status].padEnd(8);\n const cachedTag = r.cached ? \" [cached]\" : \"\";\n switch (r.status) {\n case \"filled\":\n lines.push(\n `${pc.green(label)} ${r.file} +${r.written.length} evals (${names(r.written)})${cachedTag}`,\n );\n break;\n case \"proposed\":\n lines.push(\n `${pc.cyan(label)} ${r.file} +${r.written.length} evals (${names(r.written)})${cachedTag} — dry run, not written`,\n );\n break;\n case \"nothing-proposed\":\n lines.push(`${pc.dim(label)} ${r.file} (nothing new proposed)${cachedTag}`);\n break;\n case \"skipped\":\n lines.push(`${pc.dim(label)} ${r.file} (evals.skip)`);\n break;\n case \"skipped-budget\":\n lines.push(`${pc.yellow(label)} ${r.file} (turn budget exhausted)`);\n break;\n case \"error\":\n lines.push(`${pc.red(label)} ${r.file}: ${r.error ?? \"unknown error\"}`);\n break;\n }\n // Where the evals went, when it was not the page (proposal 0047).\n if (r.wroteTo !== undefined && r.wroteTo !== \"page\") {\n lines.push(` ${pc.cyan(\"evals\")} → ${r.wroteTo}`);\n }\n const record = r.metaProvenance;\n if (record?.written === true) {\n const destination = record.destination === undefined ? \"\" : ` → ${record.destination}`;\n lines.push(\n ` ${pc.cyan(\"meta-provenance\")} ${record.entry[\"generated-by\"]}: ${record.entry.evals.join(\", \")}${destination}`,\n );\n } else if (record?.skipReason === \"schema-mismatch\") {\n lines.push(\n pc.dim(\" meta-provenance not written: this page's schemas do not allow it\"),\n );\n } else if (record?.skipReason === \"manifest-owned\") {\n lines.push(\n pc.dim(\n ` meta-provenance not written: owned by manifest ${record.manifest}, which is fetched and cannot be written`,\n ),\n );\n } else if (record?.skipReason === \"unwritable\") {\n lines.push(\n pc.dim(\" meta-provenance not written: its manifest has no entry for this page\"),\n );\n }\n if (r.belowThreshold.length > 0) {\n lines.push(\n pc.dim(\n ` below ${report.threshold}: ${names(r.belowThreshold)}`,\n ),\n );\n }\n if (r.capped.length > 0) {\n lines.push(\n pc.dim(` over per-page cap: ${names(r.capped)}`),\n );\n }\n if (r.duplicates.length > 0) {\n lines.push(pc.dim(` duplicates: ${r.duplicates.join(\", \")}`));\n }\n }\n lines.push(\"\");\n lines.push(\n `Threshold: ${report.threshold} · inference calls: ${report.turns}`,\n );\n return lines.join(\"\\n\");\n}\n","/**\n * Fill proposal cache: content-addressed JSON files storing the raw,\n * pre-gating proposal — re-running with a different confidence threshold\n * re-gates from cache with zero API calls. Folding the existing eval-name set\n * into the key means a post-fill re-run misses (the set changed) and asks for\n * additional coverage instead of replaying stale proposals. Separate from the\n * judge cache: different key scheme and value shape.\n */\nimport { mkdirSync, readFileSync, writeFileSync, existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { sha256 } from \"../judge/cache.js\";\nimport { FILL_PROMPT_VERSION, isValidProposal } from \"./prompt.js\";\nimport { warn } from \"../../shared/warn.js\";\nimport { errorMessage } from \"../../shared/errors.js\";\n\nexport function fillCacheKey(\n provider: string,\n model: string,\n temperature: number,\n maxEvals: number,\n body: string,\n existingNames: string[],\n chunkChars: number,\n): string {\n return sha256(\n [\n provider,\n model,\n `fill-v${FILL_PROMPT_VERSION}`,\n `t${temperature}`,\n `n${maxEvals}`,\n // The chunk budget decides how the page was split, and so which\n // proposals came back. Without it, two runs at different budgets share\n // a key and the second silently replays the first — and halve-and-retry\n // makes that a real collision, not a hypothetical one.\n `chunk${chunkChars}`,\n sha256(body),\n existingNames.join(\",\"),\n ].join(\"|\"),\n );\n}\n\nexport class FillCache {\n /** Cache-write failures warn once per run, not once per page. */\n private warned = false;\n\n constructor(\n private readonly dir: string,\n private readonly enabled: boolean = true,\n ) {}\n\n get(key: string): Record<string, unknown> | undefined {\n if (!this.enabled) return undefined;\n const path = join(this.dir, `${key}.json`);\n if (!existsSync(path)) return undefined;\n try {\n const proposal = JSON.parse(readFileSync(path, \"utf8\")) as unknown;\n // A schema-invalid entry (older format, corruption) is a miss, not an error.\n if (!isValidProposal(proposal)) return undefined;\n return proposal as Record<string, unknown>;\n } catch {\n return undefined; // Corrupt cache entry — treat as a miss.\n }\n }\n\n set(key: string, proposal: Record<string, unknown>): void {\n if (!this.enabled) return;\n // The cache is an optimization: a write failure must never abort a run\n // whose proposal already succeeded.\n try {\n mkdirSync(this.dir, { recursive: true });\n writeFileSync(\n join(this.dir, `${key}.json`),\n JSON.stringify(proposal, null, 2),\n );\n } catch (e) {\n if (!this.warned) {\n this.warned = true;\n warn(\n `could not write the fill cache at ${this.dir} (${errorMessage(e)}). Continuing without caching.`,\n );\n }\n }\n }\n}\n","/**\n * Fill prompt: asks the provider to propose ai-graded evals for a page, each\n * with a self-reported 0-1 confidence. Proposals are gated by the confidence\n * threshold downstream; the prompt itself only demands honesty and restraint.\n * `command` evals are deliberately out of scope — a command eval without a\n * command would seed script generation (and eventual execution) on the next\n * run, and determinism already flows through promote/generate.\n */\nimport { Ajv2020 } from \"ajv/dist/2020.js\";\nimport { partLabel } from \"../core/split.js\";\nimport { SEVERITIES } from \"../../shared/severity.js\";\n\n/** Part of the cache key: bump whenever the prompt or schema changes. */\nexport const FILL_PROMPT_VERSION = 4;\n\nexport const FILL_SYSTEM_PROMPT = [\n \"You propose evals for documentation pages. An eval is a plain-language\",\n \"assertion about a page that an LLM judge will grade against the page\",\n \"content on every future run — a durable quality contract, not a one-off\",\n \"observation.\",\n \"\",\n \"Rules for every proposal:\",\n \"- Assert durable, page-specific properties a maintainer would want\",\n \" guarded (structure, coverage, accuracy anchors) — never incidental\",\n \" phrasing, styling, or facts likely to change by design.\",\n \"- The assertion must be judgeable from the page content alone.\",\n \"- Ids are short kebab-case identifiers, unique on the page.\",\n \"- Provide examples.pass and examples.fail: one sentence each describing\",\n \" a state of the page that satisfies or violates the assertion.\",\n \"- Report an honest confidence between 0 and 1 that the assertion is\",\n \" correct, checkable, and worth guarding. Do not inflate it.\",\n \"- Do not duplicate or rephrase the page's existing evals.\",\n \"- Do NOT restate the page. An assertion derived from the page's own\",\n \" headings, or lifted from a style guide, passes by construction and keeps\",\n \" passing however the page rots. Anchor on what a reader would notice if it\",\n \" broke.\",\n \"- Prefer the cheapest check that can express the assertion. A verifiable\",\n \" fact — a string that must appear, a file that must exist — belongs in a\",\n \" deterministic eval; propose a judged assertion only for what genuinely\",\n \" needs reading comprehension.\",\n \"- A check lifted from a style rule is secondary: propose it at\",\n \" severity warning, never as a page's only guard.\",\n \"- Do not soften an assertion until it always passes. An eval that cannot\",\n \" fail is a vanity metric — if you cannot state a version that would catch\",\n \" a real regression, propose nothing for it.\",\n \"- Propose at most the requested number, fewer when the page offers\",\n \" little worth guarding, and nothing at all when nothing qualifies.\",\n].join(\"\\n\");\n\nexport const PROPOSAL_SCHEMA = {\n type: \"object\",\n required: [\"evals\"],\n properties: {\n evals: {\n type: \"array\",\n items: {\n type: \"object\",\n required: [\"id\", \"assertion\", \"confidence\", \"examples\"],\n properties: {\n id: { type: \"string\", pattern: \"^[a-z0-9][a-z0-9-]*$\" },\n assertion: { type: \"string\", minLength: 1 },\n type: { enum: [\"capability\", \"regression\"] },\n evidence: { type: \"string\" },\n examples: {\n type: \"object\",\n required: [\"pass\", \"fail\"],\n properties: {\n pass: { type: \"string\" },\n fail: { type: \"string\" },\n },\n additionalProperties: false,\n },\n severity: { enum: SEVERITIES },\n confidence: { type: \"number\", minimum: 0, maximum: 1 },\n rationale: { type: \"string\" },\n },\n additionalProperties: false,\n },\n },\n },\n additionalProperties: false,\n} as const;\n\nconst ajv = new Ajv2020({ allErrors: true });\nconst validateProposal = ajv.compile(\n PROPOSAL_SCHEMA as unknown as Record<string, unknown>,\n);\n\n/** True when `value` matches PROPOSAL_SCHEMA. */\nexport function isValidProposal(value: unknown): boolean {\n return validateProposal(value);\n}\n\nexport interface ExistingEval {\n id: string;\n assertion?: string;\n}\n\nexport function buildFillUser(\n file: string,\n body: string,\n existing: ExistingEval[],\n maxEvals: number,\n part?: { index: number; total: number },\n): string {\n const existingLines =\n existing.length === 0\n ? [\"(none)\"]\n : existing.map((e) =>\n e.assertion ? `- ${e.id}: ${e.assertion}` : `- ${e.id}`,\n );\n return [\n \"# Page path\",\n file,\n \"\",\n \"# Existing evals (do not duplicate these)\",\n ...existingLines,\n \"\",\n \"# Maximum proposals\",\n String(maxEvals),\n \"\",\n part === undefined\n ? \"# Page content\"\n : `# Page content (${partLabel(part.index, part.total)})`,\n \"\",\n // No cap. A page longer than one call is split and proposed against in\n // parts; truncating instead meant proposing evals for a page whose second\n // half the model never saw, with nothing in the output to say so.\n body,\n ].join(\"\\n\");\n}\n","/**\n * `manni docevals promote` — the grader hierarchy in tool form: review ai-graded\n * evals, ask the LLM which are expressible as deterministic checks, and (with\n * --write) rewrite them as command-graded evals backed by generated scripts.\n * Never runs automatically as part of `manni docevals run`.\n */\nimport { mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, relative } from \"node:path\";\nimport { loadRunConfig } from \"../core/config.js\";\nimport {\n discoverPages,\n documentSet,\n runConfigOptions,\n type DocumentInputOptions,\n} from \"../core/discover.js\";\nimport { withExternalMetadata } from \"../core/external.js\";\nimport { resolvePages } from \"../core/resolve.js\";\nimport { assertRegisteredGraders } from \"../core/feasibility.js\";\nimport {\n hasEditableEval,\n updateConfigEval,\n updatePageEval,\n} from \"../core/frontmatter-edit.js\";\nimport {\n EVALS_KEY,\n EvalWriter,\n manifestEvalList,\n updateManifestEval,\n} from \"../core/write-location.js\";\nimport { sha256 } from \"../judge/cache.js\";\nimport {\n assertProviderSelection,\n makeProvider,\n selectProvider,\n} from \"../judge/provider.js\";\nimport type { InferenceProvider } from \"@hawkeyexl/inference\";\nimport {\n SCRIPTGEN_SYSTEM_PROMPT,\n buildScriptgenUser,\n scriptLocationFor,\n} from \"../graders/scriptgen.js\";\nimport type { GraderTarget } from \"../graders/types.js\";\nimport { errorMessage } from \"../../shared/errors.js\";\n\nconst PROMOTE_SCHEMA = {\n type: \"object\",\n required: [\"promotable\", \"rationale\"],\n properties: {\n promotable: {\n type: \"boolean\",\n description:\n \"True only when the assertion can be fully checked by a deterministic script with no semantic judgment.\",\n },\n rationale: { type: \"string\" },\n code: {\n type: \"string\",\n description: \"The check script source, required when promotable is true.\",\n },\n },\n additionalProperties: false,\n} as const;\n\nconst PROMOTE_SYSTEM = [\n \"You review documentation eval assertions and decide whether each can be\",\n \"verified by a deterministic script instead of LLM judgment. Promote only\",\n \"assertions that are fully checkable with string/regex/structural logic —\",\n \"anything requiring semantic interpretation stays with the LLM judge.\",\n \"\",\n SCRIPTGEN_SYSTEM_PROMPT,\n \"\",\n 'Respond with JSON: { \"promotable\": bool, \"rationale\": \"...\", \"code\": \"...\" }',\n \"(omit code when not promotable).\",\n].join(\"\\n\");\n\nexport interface PromoteOptions extends DocumentInputOptions {\n write?: boolean;\n provider?: string;\n model?: string;\n /** Run inference on this machine, with llama-cpp, over any configured or eval-level provider. */\n local?: boolean;\n cwd?: string;\n /** Injectable provider for tests and programmatic use. */\n providerInstance?: InferenceProvider;\n}\n\nexport interface PromoteProposal {\n file: string;\n evalName: string;\n source: \"page\" | \"config\";\n promotable: boolean;\n rationale: string;\n scriptPath?: string;\n applied: boolean;\n /**\n * Why a promotable eval could not be rewritten (proposal 0047): the\n * manifest that owns this page's evals joins on a field the page lacks, so\n * there is no entry to hold the promoted eval. `applied` stays false.\n */\n error?: string;\n}\n\nasync function assess(\n provider: InferenceProvider,\n target: GraderTarget,\n): Promise<{ promotable: boolean; rationale: string; code?: string }> {\n try {\n const response = await provider.completeJSON({\n system: PROMOTE_SYSTEM,\n user: buildScriptgenUser(\n target.eval.assertion ?? \"\",\n target.eval.name,\n target.plan.page.file,\n target.plan.page.body,\n ),\n schema: PROMOTE_SCHEMA,\n temperature: 0,\n });\n const json = response.json as {\n promotable?: unknown;\n rationale?: unknown;\n code?: unknown;\n };\n return {\n promotable: json.promotable === true,\n rationale: typeof json.rationale === \"string\" ? json.rationale : \"\",\n code: typeof json.code === \"string\" ? json.code : undefined,\n };\n } catch (e) {\n return {\n promotable: false,\n rationale: `assessment failed: ${errorMessage(e)}`,\n };\n }\n}\n\nexport async function runPromote(\n paths: string[],\n options: PromoteOptions = {},\n): Promise<PromoteProposal[]> {\n const cwd = options.cwd ?? process.cwd();\n const config = loadRunConfig(runConfigOptions(paths, options), cwd);\n const flags = { provider: options.provider, model: options.model, local: options.local };\n // Checked before discovery, and even when nothing is ai-graded.\n assertProviderSelection(selectProvider(config, flags));\n const pages = await withExternalMetadata(\n discoverPages(config, documentSet(paths, options, \"read\"), cwd),\n config,\n cwd,\n );\n const plans = resolvePages(pages, config);\n assertRegisteredGraders(plans, config);\n\n // Built on first use, not up front. A corpus with no ai-graded evals has\n // nothing to assess, and demanding an API key to be told so is the same\n // needless gate `fill` already avoids by resolving identity lazily.\n let provider: InferenceProvider | undefined = options.providerInstance;\n const getProvider = async (): Promise<InferenceProvider> =>\n (provider ??= await makeProvider(config, flags));\n\n const proposals: PromoteProposal[] = [];\n const seenConfigEvals = new Set<string>();\n // Proposal 0047: a promoted eval is rewritten where it lives. Built on\n // first use, like the provider.\n let writer: EvalWriter | undefined;\n const getWriter = (): EvalWriter => (writer ??= EvalWriter.for(config, cwd, paths));\n\n for (const plan of plans) {\n if (plan.skip || plan.problems.some((p) => p.level === \"error\")) continue;\n for (const ev of plan.evals) {\n if (ev.skip || ev.grader !== \"ai\" || !ev.assertion) continue;\n if (ev.source === \"config\") {\n if (seenConfigEvals.has(ev.name)) continue;\n seenConfigEvals.add(ev.name);\n }\n\n const target: GraderTarget = { plan, eval: ev };\n const assessment = await assess(await getProvider(), target);\n const proposal: PromoteProposal = {\n file: plan.page.file,\n evalName: ev.name,\n source: ev.source,\n promotable: assessment.promotable,\n rationale: assessment.rationale,\n applied: false,\n };\n\n if (assessment.promotable && assessment.code && options.write) {\n const location = scriptLocationFor(target, config, cwd);\n mkdirSync(dirname(location.scriptAbsPath), { recursive: true });\n writeFileSync(location.scriptAbsPath, assessment.code);\n proposal.scriptPath = relative(cwd, location.scriptAbsPath).replace(\n /\\\\/g,\n \"/\",\n );\n const updates = {\n grader: \"command\",\n command: location.command,\n // The kebab key `applyUpdates` actually reads. This was the\n // pre-1.0 `generated: { assertionHash }` wrapper, which the update\n // type does not consume, so promoted evals were written with no\n // hash and never went stale when their assertion changed\n // (renamed by ADR 01009).\n \"generated-assertion-hash\": sha256(ev.assertion),\n };\n // Where the eval lives decides where the rewrite goes. The page's own\n // text is only consulted for a page-owned eval: a page whose evals a\n // manifest owns carries none of them, so `hasEditableEval` is false\n // there and the promotion used to be dropped without a word.\n const home =\n ev.source === \"page\"\n ? await getWriter().homeFor(\n plan.page.file,\n plan.page.frontmatter.data,\n EVALS_KEY,\n )\n : undefined;\n if (home?.kind === \"url\") {\n throw getWriter().urlRefusal(home, EVALS_KEY);\n }\n if (home?.kind === \"no-entry\") {\n proposal.error = home.message;\n } else if (home?.kind === \"manifest\") {\n const at = getWriter();\n const list = manifestEvalList(\n await at.readManifest(home, EVALS_KEY),\n home.file,\n home.entry,\n );\n const next = updateManifestEval(list, ev.name, updates);\n if (next === undefined) {\n proposal.error = `${home.file}: eval \"${ev.name}\" not found in the entry for ${home.entry}`;\n } else {\n await at.writeManifest(home, EVALS_KEY, next);\n proposal.applied = true;\n }\n } else if (\n ev.source === \"page\" &&\n hasEditableEval(plan.page.content, ev.name)\n ) {\n const updated = updatePageEval(\n readFileSync(plan.page.absPath, \"utf8\"),\n plan.page.file,\n ev.name,\n updates,\n );\n writeFileSync(plan.page.absPath, updated);\n proposal.applied = true;\n } else if (ev.source === \"config\") {\n const updated = updateConfigEval(\n readFileSync(config.configPath, \"utf8\"),\n config.configPath,\n ev.name,\n updates,\n );\n writeFileSync(config.configPath, updated);\n proposal.applied = true;\n }\n }\n proposals.push(proposal);\n }\n }\n return proposals;\n}\n","/**\n * `manni docevals review` — record human verdicts for evals in the human-review\n * zone. A verdict binds to the page's current content hash; edits to the page\n * return the eval to needs-review on the next run.\n *\n * manni docevals review # list recorded reviews\n * manni docevals review <file> <eval> pass # record a verdict\n */\nimport { existsSync } from \"node:fs\";\nimport { resolve, relative } from \"node:path\";\nimport { notFoundMessage } from \"../../meta/internal.js\";\nimport { palette } from \"../../shared/color.js\";\nimport type { ColorOptions } from \"../reporters/pretty.js\";\nimport { DocevalsError } from \"../types.js\";\nimport { readPage } from \"../core/discover.js\";\nimport {\n contentHash,\n loadReviews,\n recordReview,\n type ReviewEntry,\n} from \"../core/reviews.js\";\n\nexport interface ReviewOptions {\n reviewer?: string;\n note?: string;\n cwd?: string;\n}\n\nexport function listReviews(cwd = process.cwd()): ReviewEntry[] {\n return loadReviews(cwd);\n}\n\nexport function renderReviews(\n reviews: ReviewEntry[],\n opts: ColorOptions = {},\n): string {\n if (reviews.length === 0) return \"No recorded reviews.\";\n const pc = palette(opts.color === true);\n return reviews\n .map((r) => {\n const verdict =\n r.verdict === \"pass\" ? pc.green(r.verdict) : pc.red(r.verdict);\n const meta = [r.reviewer, r.date].filter(Boolean).join(\" \");\n return `${verdict} ${r.file} ${pc.bold(r.evalName)}${meta ? pc.dim(` (${meta})`) : \"\"}${r.note ? pc.dim(` — ${r.note}`) : \"\"}`;\n })\n .join(\"\\n\");\n}\n\nexport function runReview(\n file: string,\n evalName: string,\n verdict: string,\n options: ReviewOptions = {},\n): ReviewEntry {\n const cwd = options.cwd ?? process.cwd();\n if (verdict !== \"pass\" && verdict !== \"fail\") {\n throw new DocevalsError(`Verdict must be \"pass\" or \"fail\", got \"${verdict}\"`);\n }\n const absPath = resolve(cwd, file);\n if (!existsSync(absPath)) {\n throw new DocevalsError(notFoundMessage([file]));\n }\n const page = readPage(absPath, cwd);\n const entry: ReviewEntry = {\n file: relative(cwd, absPath).replace(/\\\\/g, \"/\"),\n evalName,\n contentHash: contentHash(page.body),\n verdict,\n reviewer: options.reviewer,\n date: new Date().toISOString().slice(0, 10),\n note: options.note,\n };\n recordReview(cwd, entry);\n return entry;\n}\n","/**\n * `manni docevals calibrate` — measure judge agreement against a human-verified\n * golden set (the book's step 3: calibrate judges before trusting them).\n * Golden cases live in YAML files under .manni/docevals/golden/ by default:\n *\n * - file: docs/install.md\n * eval: no-future-promises # ai-graded eval resolvable on that page\n * expected: pass\n * rationale: Mentions only shipped features.\n *\n * Below 70% agreement the command exits 1 — the criteria (usually) need to be\n * more specific, not the grading mechanism. A false-positive rate above\n * judge.falsePositiveAlert flags retuning.\n */\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport fg from \"fast-glob\";\nimport { parse as parseYaml, stringify as stringifyYaml } from \"yaml\";\nimport { palette } from \"../../shared/color.js\";\nimport type { ColorOptions } from \"../reporters/pretty.js\";\nimport { DocevalsError } from \"../types.js\";\nimport { loadConfig } from \"../core/config.js\";\nimport { readPage } from \"../core/discover.js\";\nimport { loadExternalReader } from \"../core/external.js\";\nimport { resolvePage } from \"../core/resolve.js\";\nimport { resolveReaders } from \"../core/readers.js\";\nimport { contentHash, loadReviews } from \"../core/reviews.js\";\nimport { makeJudge } from \"../judge/judge.js\";\nimport { isTurnBudgetSkip } from \"../judge/budget.js\";\nimport {\n assertProviderSelection,\n makeProvider,\n selectProvider,\n} from \"../judge/provider.js\";\nimport type { JudgeFn } from \"../core/engine.js\";\nimport type { GraderTarget } from \"../graders/types.js\";\n\nexport const AGREEMENT_THRESHOLD = 0.7;\n\n/** Default golden directory, relative to the working directory. */\nexport const GOLDEN_DIR = join(\".manni/docevals\", \"golden\");\n\n/** File `--seed` writes. Named so a hand-authored set beside it stays distinct. */\nexport const SEEDED_GOLDEN_FILE = \"from-reviews.yaml\";\n\nexport interface GoldenCase {\n file: string;\n eval: string;\n expected: \"pass\" | \"fail\";\n rationale?: string;\n /**\n * Whether a human has confirmed this case belongs in the golden set.\n *\n * Absent means `false`, deliberately. This is the instrument that measures\n * the judge, so a back-compatible default would silently bless every case\n * that already exists — including the seeded ones the bit exists to surface.\n */\n reviewed: boolean;\n /** Page body hash when the verdict was formed; mismatch means stale. */\n contentHash?: string;\n source?: \"review\" | \"manual\";\n reviewedBy?: string;\n}\n\nexport interface CalibrationCaseResult extends GoldenCase {\n judged?: \"pass\" | \"fail\";\n agrees?: boolean;\n error?: string;\n /**\n * Set when the turn budget, not the judge, is why this case has no verdict.\n * A flag rather than a substring of `error`: the message is user-facing and\n * interpolates a golden case's own `eval` value, so matching on it both\n * broke when the wording changed and miscounted a case named after it.\n */\n budgetSkipped?: boolean;\n /** The page no longer hashes to what this case was verified against. */\n stale?: boolean;\n}\n\nexport interface CalibrationReport {\n cases: CalibrationCaseResult[];\n total: number;\n agreements: number;\n agreementRate: number;\n falsePositives: number;\n falsePositiveRate: number;\n falseNegatives: number;\n /**\n * True when `agreementRate >= AGREEMENT_THRESHOLD` — a statement about\n * the cases that were *judged*, and nothing else.\n *\n * Read `unjudged === 0` alongside it. A budget-truncated or partly\n * unresolvable run can meet the rate on the sample it measured while\n * `unjudged > 0` says it measured less than the set. The CLI gates on both;\n * a consumer reading this field alone gets a pass on a partial run.\n */\n meetsThreshold: boolean;\n /** Judged cases a human marked `expected: pass`. */\n expectedPass: number;\n /** Judged cases a human marked `expected: fail`. */\n expectedFail: number;\n /**\n * True when both classes are represented among the judged cases.\n *\n * A golden set of only-passes certifies a judge that always answers pass:\n * agreement 100%, false negatives 0, threshold met. The measurement is\n * vacuous, not good. Kept out of `meetsThreshold` for the same reason\n * `unjudged` is (ADR 01018) — that stays a statement about agreement, and\n * this is a statement about whether the set could have detected a\n * disagreement at all. The CLI gates on all three.\n */\n balanced: boolean;\n fpAlert: boolean;\n /** Judged cases no human has confirmed. Counted, but reported. */\n unreviewed: number;\n /** Judged cases whose page has changed since verification. */\n stale: number;\n /** Cases the turn budget prevented from being judged at all. */\n budgetSkipped: number;\n /**\n * Cases that never reached a verdict, for any reason: a missing page, an\n * unresolvable eval, an errored judge, or the turn budget. The agreement\n * rate is over the rest, so a non-zero value means it measured a sample.\n *\n * Kept separate from `meetsThreshold` rather than folded into it, following\n * ADR 01018: the verdict stays a statement about agreement, and this stays a\n * statement about coverage. Overloading one boolean made the report print\n * \"refine your assertions\" at 100% agreement.\n */\n unjudged: number;\n}\n\nexport interface CalibrateOptions {\n config?: string;\n golden?: string;\n provider?: string;\n model?: string;\n /** Run inference on this machine, with llama-cpp, over any configured or eval-level provider. */\n local?: boolean;\n runs?: number;\n maxTurns?: number | null;\n noCache?: boolean;\n cwd?: string;\n /** Injectable judge for tests. */\n judge?: JudgeFn;\n}\n\n/** File keys are kebab-case (ADR 01010); everything downstream is camelCase. */\nfunction normalizeGoldenCase(raw: Record<string, unknown>): GoldenCase {\n return {\n file: raw.file as string,\n eval: raw.eval as string,\n expected: raw.expected as \"pass\" | \"fail\",\n ...(typeof raw.rationale === \"string\" ? { rationale: raw.rationale } : {}),\n reviewed: raw.reviewed === true,\n ...(typeof raw[\"content-hash\"] === \"string\"\n ? { contentHash: raw[\"content-hash\"] }\n : {}),\n ...(raw.source === \"review\" || raw.source === \"manual\"\n ? { source: raw.source }\n : {}),\n ...(typeof raw[\"reviewed-by\"] === \"string\"\n ? { reviewedBy: raw[\"reviewed-by\"] }\n : {}),\n };\n}\n\n/** camelCase back out to the kebab file vocabulary, dropping empty fields. */\nfunction serializeGoldenCase(c: GoldenCase): Record<string, unknown> {\n return {\n file: c.file,\n eval: c.eval,\n expected: c.expected,\n ...(c.rationale === undefined ? {} : { rationale: c.rationale }),\n reviewed: c.reviewed,\n ...(c.contentHash === undefined ? {} : { \"content-hash\": c.contentHash }),\n ...(c.source === undefined ? {} : { source: c.source }),\n ...(c.reviewedBy === undefined ? {} : { \"reviewed-by\": c.reviewedBy }),\n };\n}\n\nexport function loadGoldenCases(dir: string): GoldenCase[] {\n if (!existsSync(dir)) {\n throw new DocevalsError(\n `Golden set directory not found: ${dir} — seed it from recorded reviews with ` +\n `\\`manni docevals calibrate --seed\\`, or hand-author 20-50 verified cases`,\n );\n }\n const files = fg.sync(\"*.{yaml,yml}\", { cwd: dir, absolute: true });\n const cases: GoldenCase[] = [];\n for (const file of files) {\n const raw = parseYaml(readFileSync(file, \"utf8\")) as unknown;\n if (!Array.isArray(raw)) continue;\n for (const item of raw) {\n const c = item as Record<string, unknown>;\n if (\n typeof c.file === \"string\" &&\n typeof c.eval === \"string\" &&\n (c.expected === \"pass\" || c.expected === \"fail\")\n ) {\n cases.push(normalizeGoldenCase(c));\n } else {\n throw new DocevalsError(\n `Invalid golden case in ${file}: needs file, eval, expected: pass|fail`,\n );\n }\n }\n }\n if (cases.length === 0) {\n throw new DocevalsError(`No golden cases found in ${dir}`);\n }\n return cases;\n}\n\nexport interface SeedResult {\n path: string;\n added: number;\n updated: number;\n total: number;\n /** Cases in the written file still awaiting human confirmation. */\n unreviewed: number;\n}\n\n/**\n * Turn recorded human reviews into golden *candidates* (ADR 01016).\n *\n * Judges nothing and constructs no provider, which is what lets this run in CI\n * where there is no API key. Every case lands `reviewed: false`: a `review`\n * verdict is a call made on one page to clear a queue, and promoting it to\n * calibration ground truth without a second look conflates \"I unblocked this\n * build\" with \"this is what correct looks like\".\n */\nexport function seedGoldenCases(options: CalibrateOptions = {}): SeedResult {\n const cwd = options.cwd ?? process.cwd();\n const dir = resolve(cwd, options.golden ?? GOLDEN_DIR);\n const path = join(dir, SEEDED_GOLDEN_FILE);\n\n // An emptied or hand-broken seed file degrades to \"nothing recorded yet\"\n // rather than throwing, the same way `loadReviews` treats its own store: the\n // next seed then rebuilds it, where a throw would strand the user.\n const priorRaw: unknown = existsSync(path)\n ? parseYaml(readFileSync(path, \"utf8\"))\n : null;\n const existing: GoldenCase[] = Array.isArray(priorRaw)\n ? priorRaw\n .filter((i): i is Record<string, unknown> => typeof i === \"object\" && i !== null)\n .map(normalizeGoldenCase)\n : [];\n\n // NUL-separated, as the metadata tool's fingerprint keys are, and for the same reason:\n // a printable separator lets (\"a b\", \"c\") and (\"a\", \"b c\") collide into one\n // key. A file path may contain a space; nothing may contain a NUL.\n const byKey = new Map(existing.map((c) => [`${c.file}\\0${c.eval}`, c]));\n let added = 0;\n let updated = 0;\n\n for (const review of loadReviews(cwd)) {\n const key = `${review.file}\\0${review.evalName}`;\n const prior = byKey.get(key);\n // Re-seeding as reviews accumulate must not duplicate, and must not\n // silently un-review a case a human has already confirmed. But a confirmed\n // bit describes a *verdict*, not a filename: if the recorded verdict has\n // flipped since, this is materially a different case and has to be read\n // again. Carrying the bit across a flip would let `expected` change under a\n // human's signature.\n const confirmedStillApplies =\n prior?.reviewed === true && prior.expected === review.verdict;\n const next: GoldenCase = {\n file: review.file,\n eval: review.evalName,\n expected: review.verdict,\n // A review's note wins when it has one; otherwise keep whatever the\n // human wrote into the file. Rebuilding the entry from the review alone\n // erased the reasoning behind a case the same human had just marked\n // `reviewed: true` -- and it is the field renderCalibration prints on\n // every disagreement.\n ...(review.note !== undefined\n ? { rationale: review.note }\n : prior?.rationale !== undefined\n ? { rationale: prior.rationale }\n : {}),\n reviewed: confirmedStillApplies,\n contentHash: review.contentHash,\n source: \"review\",\n ...(confirmedStillApplies && prior.reviewedBy !== undefined\n ? { reviewedBy: prior.reviewedBy }\n : {}),\n };\n byKey.set(key, next);\n // A re-seed rewrites every case, but only a *changed* one is an update.\n // Counting every key that already existed made `updated` report movement\n // on a run that moved nothing — and the two counts are separate\n // (ADR 01016) precisely so the difference between runs is visible.\n if (!prior) added += 1;\n else if (\n JSON.stringify(serializeGoldenCase(prior)) !==\n JSON.stringify(serializeGoldenCase(next))\n ) {\n updated += 1;\n }\n }\n\n const cases = [...byKey.values()];\n if (cases.length > 0) {\n mkdirSync(dir, { recursive: true });\n writeFileSync(path, stringifyYaml(cases.map(serializeGoldenCase)));\n }\n return {\n path,\n added,\n updated,\n total: cases.length,\n unreviewed: cases.filter((c) => !c.reviewed).length,\n };\n}\n\nexport async function runCalibrate(\n options: CalibrateOptions = {},\n): Promise<CalibrationReport> {\n const cwd = options.cwd ?? process.cwd();\n const config = loadConfig(options.config, cwd);\n const flags = { provider: options.provider, model: options.model, local: options.local };\n // Checked before the golden set is read: a typo is a usage error on every run.\n assertProviderSelection(selectProvider(config, flags));\n const goldenDir = resolve(cwd, options.golden ?? GOLDEN_DIR);\n const cases = loadGoldenCases(goldenDir);\n\n // Resolve every case to a target first, then judge the whole set in one call\n // (ADR 01016). Judging case-by-case left the bounded-concurrency pool inside\n // makeJudge with one target at a time, and made a turn budget mean *per case*.\n const results: CalibrationCaseResult[] = [];\n const targets: GraderTarget[] = [];\n const targetIndex: number[] = [];\n // One load for the whole golden set, not one per case. The pages are named\n // so a collection that keeps its evals in one manifest per page (proposal\n // 0058) has a file to read; a case naming a page that is not there is\n // reported below rather than loaded.\n const external = await loadExternalReader(\n config,\n cwd,\n cases.map((c) => resolve(cwd, c.file)).filter((p) => existsSync(p)),\n );\n\n for (const goldenCase of cases) {\n const absPath = resolve(cwd, goldenCase.file);\n if (!existsSync(absPath)) {\n results.push({ ...goldenCase, error: \"page not found\" });\n continue;\n }\n const read = readPage(absPath, cwd);\n const page = external === null ? read : await external.forPage(read);\n const plan = resolvePage(page, config);\n const ev = plan.evals.find(\n (e) => e.name === goldenCase.eval && e.grader === \"ai\",\n );\n if (!ev) {\n results.push({\n ...goldenCase,\n error: `ai-graded eval \"${goldenCase.eval}\" not resolvable on this page`,\n });\n continue;\n }\n // A verdict is about the words a human read. Once the page no longer\n // hashes to what was verified, the case describes a document that no\n // longer exists — the same rule `findReview` applies to a review.\n const stale =\n goldenCase.contentHash !== undefined &&\n goldenCase.contentHash !== contentHash(plan.page.body);\n\n targetIndex.push(results.length);\n results.push({ ...goldenCase, ...(stale ? { stale } : {}) });\n targets.push({ plan, eval: ev });\n }\n\n if (targets.length > 0) {\n // A golden case on an opted-in eval measures the judge `run` would use,\n // readers and all (proposal 0111). A bad `readers` value has no report to\n // land in here; `run` reports it.\n await resolveReaders(\n targets.map((t) => t.plan),\n config,\n cwd,\n );\n const judge =\n options.judge ??\n makeJudge({\n provider: await makeProvider(config, flags),\n root: cwd,\n });\n const judged = await judge(targets, config, {\n // The flags reach the judge too, so a golden case whose eval names its\n // own provider or model is overridden by them as it is under `run`.\n ...flags,\n runs: options.runs,\n noCache: options.noCache,\n maxTurns: options.maxTurns,\n });\n for (const [i, at] of targetIndex.entries()) {\n const slot = results[at];\n if (slot === undefined) {\n throw new DocevalsError(\n `calibrate: no golden case at index ${at} for judged target ${i}`,\n );\n }\n const consensus = judged[i]?.consensus;\n if (!consensus) {\n // Distinguish \"the budget ran out\" from \"the judge failed\": the\n // first is a coverage problem that must not be allowed to certify\n // anything, and it used to disappear into the same error bucket.\n const reason = judged[i]?.skipReason;\n const fromBudget = isTurnBudgetSkip(reason);\n results[at] = {\n ...slot,\n ...(fromBudget ? { budgetSkipped: true } : {}),\n error: fromBudget ? `not judged: ${reason}` : \"judge returned no consensus\",\n };\n continue;\n }\n const verdict = consensus.verdict === \"pass\" ? \"pass\" : \"fail\";\n results[at] = {\n ...slot,\n judged: verdict,\n agrees: verdict === slot.expected,\n };\n }\n }\n\n const judgedCases = results.filter((r) => r.judged != null);\n const agreements = judgedCases.filter((r) => r.agrees).length;\n const expectedPass = judgedCases.filter((r) => r.expected === \"pass\");\n // False positive: the judge flags a failure a human verified as passing.\n const falsePositives = expectedPass.filter((r) => r.judged === \"fail\").length;\n const expectedFailCases = judgedCases.filter((r) => r.expected === \"fail\");\n const falseNegatives = expectedFailCases.filter(\n (r) => r.judged === \"pass\",\n ).length;\n const agreementRate = judgedCases.length > 0 ? agreements / judgedCases.length : 0;\n const falsePositiveRate =\n expectedPass.length > 0 ? falsePositives / expectedPass.length : 0;\n\n // A budget-truncated run measured a sample, and the agreement rate is over\n // that sample — so the run must not certify. The guard is in\n // `src/cli.ts` (`meetsThreshold && unjudged === 0`), not in `meetsThreshold`\n // itself: ADR 01018 keeps the verdict a statement about agreement and this a\n // statement about coverage. This is the same silent-green shape `runEvals`\n // guards against; `calibrate` is the command whose whole output is a trust\n // claim, so there it fails the run rather than merely warning.\n const budgetSkipped = results.filter((r) => r.budgetSkipped === true).length;\n const unjudged = results.length - judgedCases.length;\n\n return {\n cases: results,\n budgetSkipped,\n unjudged,\n unreviewed: judgedCases.filter((r) => !r.reviewed).length,\n stale: judgedCases.filter((r) => r.stale === true).length,\n total: results.length,\n agreements,\n agreementRate,\n falsePositives,\n falsePositiveRate,\n falseNegatives,\n meetsThreshold: agreementRate >= AGREEMENT_THRESHOLD,\n expectedPass: expectedPass.length,\n expectedFail: expectedFailCases.length,\n balanced: expectedPass.length > 0 && expectedFailCases.length > 0,\n fpAlert: falsePositiveRate > config.judge.falsePositiveAlert,\n };\n}\n\nexport function renderCalibration(\n report: CalibrationReport,\n opts: ColorOptions = {},\n): string {\n const pc = palette(opts.color === true);\n const lines: string[] = [];\n for (const c of report.cases) {\n if (c.error) {\n lines.push(`${pc.red(\"error\")} ${c.file} ${c.eval}: ${c.error}`);\n continue;\n }\n const tag = c.agrees ? pc.green(\"agree\") : pc.red(\"DISAGREE\");\n const flags = [\n c.reviewed ? \"\" : pc.yellow(\" [unreviewed]\"),\n c.stale ? pc.yellow(\" [stale]\") : \"\",\n ].join(\"\");\n lines.push(\n `${tag} ${c.file} ${pc.bold(c.eval)}${flags}: judge=${c.judged ?? \"(no verdict)\"} human=${c.expected}` +\n (!c.agrees && c.rationale ? pc.dim(` — human: ${c.rationale}`) : \"\"),\n );\n }\n lines.push(\"\");\n // Denominator stated explicitly: the rate is over the cases that were\n // actually judged, which is not `total` when pages are missing or the budget\n // ran out. Printing \"1/30 (100%)\" left those two numbers contradicting.\n const judged = report.cases.filter((c) => c.judged != null).length;\n lines.push(\n `Agreement: ${report.agreements}/${judged} judged (${(report.agreementRate * 100).toFixed(0)}%) — threshold ${(AGREEMENT_THRESHOLD * 100).toFixed(0)}%` +\n (judged === report.total ? \"\" : ` — ${report.total - judged} of ${report.total} case(s) not judged`),\n );\n lines.push(\n `False positives: ${report.falsePositives} (${(report.falsePositiveRate * 100).toFixed(0)}% of human-passes), false negatives: ${report.falseNegatives}`,\n );\n if (report.unjudged > 0) {\n lines.push(\n pc.red(\n `\n${report.unjudged} of ${report.total} case(s) never reached a verdict, so the rate above ` +\n `is over a sample. A calibration measured on part of the set does not certify the judge.`,\n ),\n );\n }\n if (judged > 0 && !report.balanced) {\n const missing = report.expectedFail === 0 ? \"fail\" : \"pass\";\n const always = missing === \"fail\" ? \"pass\" : \"fail\";\n lines.push(\n pc.red(\n `\nNo \\`expected: ${missing}\\` cases among the ${judged} judged. A judge that answered ` +\n `\"${always}\" every time would score 100% here, so this run cannot certify anything. ` +\n `Add at least one case the judge should ${missing === \"fail\" ? \"reject\" : \"accept\"}.`,\n ),\n );\n }\n // Only when something was actually measured. \"Refine the eval criteria\" is\n // advice about a rate, and there is no rate over zero judged cases.\n if (judged > 0 && !report.meetsThreshold) {\n lines.push(\n pc.red(\n \"\\nAgreement is below threshold. Refine the eval criteria first — make assertions more specific — before changing the grading mechanism.\",\n ),\n );\n }\n if (report.budgetSkipped > 0) {\n lines.push(\n pc.red(\n `\n${report.budgetSkipped} case(s) were never judged: the turn budget ran out. ` +\n `A rate measured over the rest is not a calibration — raise --max-turns and re-run.`,\n ),\n );\n }\n if (report.fpAlert) {\n lines.push(\n pc.yellow(\n \"\\nFalse-positive rate exceeds judge.falsePositiveAlert — the judge is flagging content humans accept. Consider tightening assertions or examples.\",\n ),\n );\n }\n // Counted, but never quietly. The rate above is the artifact handed to a\n // skeptic; a reader has to be able to discount it by exactly this much\n // (ADR 01016).\n if (report.unreviewed > 0) {\n lines.push(\n pc.yellow(\n `\\n${report.unreviewed} of ${report.total} case(s) are unreviewed — they count toward the rate above, ` +\n `but no human has confirmed they belong in the golden set. Read them and set \\`reviewed: true\\`.`,\n ),\n );\n }\n if (report.stale > 0) {\n lines.push(\n pc.yellow(\n `\\n${report.stale} case(s) are stale: the page changed since the verdict was recorded, so the case ` +\n `describes a document that no longer exists. Re-verify and update \\`content-hash\\`.`,\n ),\n );\n }\n return lines.join(\"\\n\");\n}\n","/** `manni docevals init` — scaffold a starter manni.config.yaml. */\nimport { existsSync, writeFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { DocevalsError } from \"../types.js\";\nimport { DEFAULT_CONFIG_FILENAME } from \"../core/config.js\";\n\nconst STARTER_CONFIG = `# manni.config.yaml — shared configuration for the manni family of tools.\n# Each tool reads its own top-level key; manni docevals reads \"docevals:\".\n# Docs: https://hawkeyexl.github.io/manni/docevals/\n\n# The documents every manni tool reads, declared once. A bare\n# \\`manni docevals run\\` evaluates every collection listed here; pass\n# --collection <name> to pick one, or name paths on the command line instead.\n# node_modules and .git are never read.\ncollections:\n - name: site\n paths:\n - \"docs/**/*.{md,mdx}\"\n\n# The inference provider, declared once for every manni tool that sends\n# content to a model: manni docevals and manni meta fill. auto detects what\n# this machine can use: an Anthropic key, then an OpenAI key, then the Claude\n# CLI, then a local model. Name one to pin it. A tool's own provider key, or\n# --provider, still wins for that tool.\nproviders:\n provider: auto # auto | anthropic | openai | claude-cli | llama-cpp\n # model: <id> # needs a named provider; unset takes that provider's default\n # anthropic: { apiKeyEnv: ANTHROPIC_API_KEY }\n # openai: { baseUrl: http://localhost:11434/v1, apiKeyEnv: OPENAI_API_KEY }\n # claude-cli: { command: claude } # uses local CLI auth, no API key\n # llama-cpp: { modelsDir: .manni/models, thoughtTokens: 0 } # modelsDir is relative to this file\n\ndocevals:\n defaults:\n # Suite applied to pages without an eval-suite frontmatter key. Naming the\n # suite defined at the bottom of this file is what makes a fresh corpus\n # check anything at all: with \"null\", a page carrying no eval frontmatter\n # resolves zero evals, and a run over zero evals is a usage error rather\n # than a green build (ADR 01041).\n suite: default\n failFast: false\n concurrency: 4\n\n judge:\n ensembleRuns: 3 # 3 isolated runs per eval; agreement is signal\n # NOTE: defaults.suite attaches an ai eval to every discovered page, so a\n # keyed run on a large corpus issues ensembleRuns x pages requests. Set\n # maxTurns once you know what a full pass costs you — deliberately, and\n # high enough to cover the corpus. A budget set *below* what a full pass\n # needs stops early, reports the remaining pages as skipped, and still exits\n # 0 (ADR 01019): partial coverage that reads as success. Start with\n # --deterministic-only, which needs no provider at all.\n temperature: 0\n zones:\n autoPass: 0.8 # unanimous pass + mean confidence >= 0.8\n autoFail: 0.8\n falsePositiveAlert: 0.15\n cacheDir: .manni/docevals/cache\n\n execution:\n # Every grant holds unless this list narrows it. frontmatter-commands lets\n # command evals declared in page frontmatter run. Write [] if you do not\n # trust whoever can edit this corpus's pages.\n allow: [frontmatter-commands]\n\n scripts:\n dir: \"{docDir}/manni-docevals\" # generated check scripts live beside the docs\n configDir: manni-docevals-scripts\n\n evals:\n no-future-promises:\n type: regression\n assertion: The page makes no claims about unreleased or future functionality.\n grader: ai\n evidence: All prose sections\n examples:\n pass: Describes only shipped behavior.\n fail: Says \"coming soon\" or references an unreleased version.\n no-todo-markers:\n assertion: The page carries no TODO, TBD or FIXME markers.\n grader: tool:regex\n options:\n pattern: \"\\\\\\\\b(TODO|TBD|FIXME)\\\\\\\\b\"\n match: not-contains\n severity: error\n\n suites:\n default:\n target-pass-rate: 1.0 # regression suites target ~100%\n evals: [no-future-promises, no-todo-markers]\n`;\n\nexport function runInit(cwd = process.cwd()): string {\n const path = resolve(cwd, DEFAULT_CONFIG_FILENAME);\n if (existsSync(path)) {\n throw new DocevalsError(`${DEFAULT_CONFIG_FILENAME} already exists`);\n }\n writeFileSync(path, STARTER_CONFIG);\n return path;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,eAA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,SAAO,MAAM,KAAK,IAAI;AACxB;;;ACxjBA,SAAS,cAAAK,aAAY,iBAAAC,sBAAqB;AAC1C,SAAS,WAAAC,gBAAe;AAIxB,IAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsFhB,SAAS,QAAQ,MAAM,QAAQ,IAAI,GAAW;AACnD,QAAM,OAAOC,SAAQ,KAAK,uBAAuB;AACjD,MAAIC,YAAW,IAAI,GAAG;AACpB,UAAM,IAAI,cAAc,GAAG,uBAAuB,iBAAiB;AAAA,EACrE;AACA,EAAAC,eAAc,MAAM,cAAc;AAClC,SAAO;AACT;","names":["writeFileSync","merged","writeFileSync","mkdirSync","readFileSync","writeFileSync","mkdirSync","writeFileSync","readFileSync","existsSync","resolve","relative","resolve","existsSync","relative","existsSync","mkdirSync","readFileSync","writeFileSync","join","resolve","join","existsSync","readFileSync","resolve","mkdirSync","writeFileSync","existsSync","writeFileSync","resolve","resolve","existsSync","writeFileSync"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lint/types.ts"],"sourcesContent":["/**\n * The contract every other module is written against.\n *\n * Two shapes matter. `DocumentTree` is what a parser owes the rest of the tool:\n * a nested section tree with real source positions, in a vocabulary that has\n * nothing to do with Markdown. `Finding` is what the tool owes its caller.\n * Everything between the two - matching, rules, reporting - touches neither\n * mdast nor Asciidoctor nor parse5, which is what lets a new input format be\n * one file plus a line in the parser registry.\n */\n\nimport { ToolError } from \"../shared/errors.js\";\nimport type { Severity } from \"../shared/severity.js\";\nimport type { Guidance } from \"../shared/guidance.js\";\n\n/**\n * Operational/usage failure. Exits 2; never used for lint findings.\n *\n * Extends the umbrella's `ToolError`, which is what the shared bin runner\n * matches on; the subclass stays so this tool's tests and library callers can\n * match on it by name. Named for its domain, as `A11yError`, `CiteError` and\n * `KeyError` are.\n */\nexport class LintError extends ToolError {\n constructor(message: string) {\n super(message);\n this.name = \"LintError\";\n }\n}\n\n/** A point in a source file. Line and column are 1-based, offset 0-based. */\nexport interface Point {\n line: number;\n column: number;\n offset: number;\n}\n\n/** A half-open source span, `start` inclusive and `end` exclusive. */\nexport interface Position {\n start: Point;\n end: Point;\n}\n\n/**\n * Content kinds a section can hold, named generically so a rule written once\n * works on every format. Each parser maps its own AST onto these: mdast\n * `paragraph`/`code`/`list`, Asciidoctor `paragraph`/`listing`/`ulist`|`olist`,\n * HTML `<p>`/`<pre>`/`<ul>` - all three onto `paragraph`/`codeBlock`/`list`.\n *\n * The vocabulary is wider than any one parser emits today. `table`,\n * `admonition`, `image`, `blockquote`, `definitionList`, and `element` are\n * declared here, and in each `DocumentParser.kinds`, only once a parser\n * actually produces them - see `src/lint/parsers/index.ts`.\n */\nexport type ContentKind =\n | \"paragraph\"\n | \"codeBlock\"\n | \"list\"\n | \"listItem\"\n | \"table\"\n | \"tableRow\"\n | \"tableCell\"\n | \"admonition\"\n | \"image\"\n | \"blockquote\"\n | \"definitionList\"\n | \"definitionItem\"\n | \"element\";\n\nexport interface ContentNodeBase {\n kind: ContentKind;\n position: Position;\n /** Plain-text rendering, used by pattern rules. */\n text: string;\n}\n\nexport interface ParagraphNode extends ContentNodeBase {\n kind: \"paragraph\";\n}\n\nexport interface CodeNode extends ContentNodeBase {\n kind: \"codeBlock\";\n /** Language, when the format carries one. */\n language?: string;\n /** The info-string tail after the language, when the format carries one. */\n fenceInfo?: string;\n}\n\nexport interface ListItemNode {\n kind: \"listItem\";\n position: Position;\n text: string;\n /** Nested content, so item-level paragraph/code/list rules can run. */\n children: ContentNode[];\n}\n\nexport interface ListNode extends ContentNodeBase {\n kind: \"list\";\n ordered: boolean;\n items: ListItemNode[];\n}\n\nexport interface TableCellNode extends ContentNodeBase {\n kind: \"tableCell\";\n children: ContentNode[];\n}\n\nexport interface TableRowNode extends ContentNodeBase {\n kind: \"tableRow\";\n header: boolean;\n children: TableCellNode[];\n}\n\nexport interface TableNode extends ContentNodeBase {\n kind: \"table\";\n children: TableRowNode[];\n}\n\n/**\n * A callout, and the flavor the source gave it.\n *\n * `variant` is optional because not every format names one this vocabulary\n * has. reStructuredText has `hint`, `attention`, `error` and a generic\n * `admonition` directive, and a bare HTML `<aside>` says nothing at all. Those\n * produce an admonition with no variant rather than an invented equivalence:\n * mapping `hint` onto `tip` would make `variant: tip` pass on a page that\n * never said tip. A `variant:` rule reports such a node as a mismatch, and a\n * plain count rule still counts it.\n */\nexport interface AdmonitionNode extends ContentNodeBase {\n kind: \"admonition\";\n variant?: \"note\" | \"tip\" | \"important\" | \"caution\" | \"warning\" | \"danger\";\n children: ContentNode[];\n}\n\nexport interface ImageNode extends ContentNodeBase {\n kind: \"image\";\n url: string;\n alt: string;\n title?: string;\n}\n\nexport interface BlockquoteNode extends ContentNodeBase {\n kind: \"blockquote\";\n children: ContentNode[];\n}\n\nexport interface DefinitionItemNode {\n kind: \"definitionItem\";\n position: Position;\n text: string;\n term: string;\n definition: ContentNode[];\n}\n\nexport interface DefinitionListNode extends ContentNodeBase {\n kind: \"definitionList\";\n children: DefinitionItemNode[];\n}\n\n/**\n * A named wrapper - an MDX/JSX component today, and where HTML and DITA may\n * eventually anchor a custom element. Its children are its own content, never\n * the enclosing section's: a rule reading a section's `children` must not see\n * inside an `<Element>` it did not ask about.\n */\nexport interface ElementNode extends ContentNodeBase {\n kind: \"element\";\n name: string;\n attributes?: Record<string, string | true>;\n children: ContentNode[];\n}\n\nexport type ContentNode =\n | ParagraphNode\n | CodeNode\n | ListNode\n | TableNode\n | AdmonitionNode\n | ImageNode\n | BlockquoteNode\n | DefinitionListNode\n | ElementNode;\n\n/**\n * One section of a document, demarcated by a heading.\n *\n * `slug`/`title`/`level`/`order`/`parentSlug` intentionally match manni graph's\n * `Section` (dockg/src/types.ts), so its graph can be built from this tree.\n *\n * `children` is in document order and is the single source of truth: the\n * paragraph/codeBlock/list counts every rule needs are queries over it, not\n * separately maintained arrays.\n */\nexport interface SectionNode {\n /** Slug of the heading, disambiguated across the document (`install-1`). */\n slug: string;\n /** Heading text, with inline markup flattened. */\n title: string;\n /** Heading level, 1-6. 0 for the implicit lead section before any heading. */\n level: number;\n /** 1-based position among siblings under the same parent. */\n order: number;\n /** Slug of the enclosing section, or null at the top level. */\n parentSlug: string | null;\n /** Span of the title itself. Null for the implicit lead section. */\n titlePosition: Position | null;\n /**\n * The anchor the source itself gives this section, verbatim - an HTML `id`,\n * a DITA `@id`, an AsciiDoc `[[id]]`, a reST `.. _label:` - when it gives\n * one. `slug` stays the slugged title either way: a link written against\n * the source's own id resolves through this, and nothing lint matches on\n * reads it.\n */\n id?: string;\n /**\n * Set on the level-1 section `withMetadataTitle` made from a metadata\n * `title`, so a consumer can tell it from a heading the author wrote. Its\n * `titlePosition` is not enough: a reST title read back as docinfo shares\n * its span with the frontmatter, written or not.\n */\n synthetic?: true;\n /** Span of the whole section: its heading through the last node before the next sibling heading. */\n position: Position;\n /** Direct content, in document order, excluding anything owned by a subsection. */\n children: ContentNode[];\n /** Nested sections, in document order. */\n sections: SectionNode[];\n}\n\n/** What a parser returns for one file. */\nexport interface DocumentTree {\n /** Name of the parser that produced this (`markdown`, `asciidoc`, ...). */\n format: string;\n /** Path the content came from, for error messages. */\n filePath: string;\n /** Raw frontmatter/metadata values, or null when the file carries none. */\n frontmatter: Record<string, unknown> | null;\n /** Span of the frontmatter block, for anchoring findings about it. */\n frontmatterPosition: Position | null;\n /** Top-level sections, in document order. */\n sections: SectionNode[];\n /**\n * Link targets exactly as the source wrote them, in document order, for\n * `manni graph`. No lint rule reads them. Each parser decides what counts:\n * an anchor to elsewhere does, and a stylesheet, a heading's own permalink,\n * or a key reference resolved only at build time does not.\n */\n links: { target: string; position: Position }[];\n}\n\n/**\n * A parser for one input format.\n *\n * Shaped after docmeta's `MetadataExtractor` so the two registries read the\n * same way. A format is registered only when its parser reads it, so every\n * registered format is one the tool reads, and an extension no parser claims is\n * skipped by name rather than parsed as Markdown.\n */\nexport interface DocumentParser {\n /** Stable name, also used as `DocumentTree.format`. */\n name: string;\n /** Human-readable label for `manni lint tools`. */\n label: string;\n /**\n * The content kinds this parser actually emits today. A capability\n * declaration, not the full `ContentKind` vocabulary: a kind absent here is\n * one no rule will ever see from this parser's trees, whatever the format\n * could in principle represent.\n */\n kinds: ContentKind[];\n /** Lowercase file extensions this parser handles, incl. dot (e.g. \".md\"). */\n extensions: string[];\n /**\n * Extensions safe to collect from a directory walk. Defaults to\n * `extensions`.\n *\n * The two differ when an extension is a generic container rather than a\n * documentation format. `.xml` is the case: this parser can read a DocBook\n * or DITA document named explicitly, but a docs tree also contains\n * `pom.xml`, `sitemap.xml`, and `.csproj`, and sweeping those in turns a\n * clean run into a failure about files the user never asked to lint.\n */\n walkExtensions?: string[];\n /**\n * Parse raw file content into the generic tree. AsciiDoc's parser returns a\n * promise, because Asciidoctor loads a document asynchronously; the others\n * return the tree itself. A caller awaits either.\n */\n parse(content: string, filePath: string): DocumentTree | Promise<DocumentTree>;\n}\n\n/**\n * How much a finding weighs, on the one scale every manni tool speaks\n * (`src/shared/severity.ts`): `notice | warning | error`.\n *\n * Almost every structural finding is an `error`, since a template either\n * describes a document or it does not. `unsupported_content_kind` is the\n * exception and is a `warning`: the rule never ran, so the page may still be\n * fine, and a warning never moves the exit code.\n *\n * The scale is the family's and not this tool's private pair, because a flag\n * or config key two domains both have carries the same name *and* the same\n * values. Re-exported so `lint.Severity` names the same type a caller already\n * has.\n */\nexport type { Severity };\n\n/**\n * One structural violation.\n *\n * The field set is pinned by manni docevals' tool adapter, which reads\n * `{ type, heading, message, position }` off the JSON reporter. Additions are\n * safe; renames are not.\n */\nexport interface Finding {\n /** Machine-readable rule id, e.g. `missing_section`. */\n type: string;\n /** Heading of the section the finding is anchored to, if any. */\n heading: string | null;\n message: string;\n position: Position;\n severity: Severity;\n /**\n * The template that judged the page and the rule this finding is about, so\n * an author reads what the section is for beside what is wrong with it.\n * `null` when no template stands behind the finding: a parse failure, an\n * unknown doctype, a broken template, or a tool other than manni.\n */\n template?: FindingTemplate | null;\n}\n\n/**\n * What a template asks for, as a finding carries it: the family's guidance\n * shape (`src/shared/guidance.ts`) under lint's released name.\n *\n * - `id` is the template's ref, as `manni lint templates` lists it and\n * `--template` takes it.\n * - `rule` is the rule's `id`. `null` for a rule without one, the template\n * itself, or no rule at all.\n * - `description` is the rule's `description`, or `null` when it has none.\n * - `guide` is the template's `guide`, after `extends`, or `null`.\n */\nexport type FindingTemplate = Guidance;\n\n/**\n * Why a file was not linted.\n *\n * `unreadable` is the one that is not about the document: the file was found,\n * claimed by a parser, and then could not be opened - a denied permission, a\n * symlink loop, a page a doc build moved between the walk and the read. It is a\n * skip rather than a finding because nothing was checked, and calling it a\n * finding would report the docs as wrong when the filesystem was.\n */\nexport type SkipReason = \"no-template\" | \"unsupported-format\" | \"unreadable\";\n\n/** Result of linting one file. */\nexport interface FileResult {\n file: string;\n /** True when the file was linted and produced no findings. */\n success: boolean;\n findings: Finding[];\n /** Template id/ref applied, or null when skipped. */\n template: string | null;\n /** Set when the file was skipped rather than linted. */\n skipped?: SkipReason;\n}\n"],"mappings":";;;;;;AAuBO,IAAM,YAAN,cAAwB,UAAU;AAAA,EACvC,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/docevals/judge/judge.ts","../src/docevals/judge/verdict-schema.json","../src/docevals/core/reviews.ts","../src/docevals/judge/provider.ts","../src/docevals/graders/scriptgen.ts","../src/docevals/core/frontmatter-edit.ts","../src/docevals/core/write-location.ts","../src/docevals/commands/run.ts"],"sourcesContent":["/**\n * The ensemble judge: N independent runs per (page, eval), each a fresh\n * request with no shared context (eval isolation), aggregated by consensus\n * and routed through confidence zones. Persisted human reviews resolve\n * needs-review outcomes for unchanged pages.\n *\n * The ensemble mechanics — retry-once, errored runs counting against\n * consensus, cache replay — live in `@hawkeyexl/inference` (ADR 01002). What\n * stays here is manni docevals' own orchestration: the bounded-concurrency pool\n * across targets, the turn budget, the self-judgment warning, and human-review\n * resolution.\n */\nimport {\n computeConsensus,\n runEnsemble,\n zoneFor,\n type InferenceProvider,\n} from \"@hawkeyexl/inference\";\nimport verdictSchemaJson from \"./verdict-schema.json\" with { type: \"json\" };\nimport type { EvalResult } from \"../types.js\";\nimport type { DocevalsConfig } from \"../core/config.js\";\nimport type { JudgeFn, JudgeOptions } from \"../core/engine.js\";\nimport type { GraderTarget } from \"../graders/types.js\";\nimport { findReview, loadReviews } from \"../core/reviews.js\";\nimport { cacheKey, judgeCacheBody, VerdictCache } from \"./cache.js\";\nimport { turnBudgetSkipReason } from \"./budget.js\";\nimport {\n JUDGE_SYSTEM_PROMPT,\n buildUserContent,\n EVIDENCE_SYSTEM_PROMPT,\n EVIDENCE_SCHEMA,\n buildEvidenceUser,\n renderEvidence,\n type PartEvidence,\n} from \"./prompt.js\";\nimport { splitBody } from \"../core/split.js\";\nimport { readTarget } from \"../core/target.js\";\nimport { selfPreferenceOf } from \"./self-preference.js\";\nimport {\n announceSelection,\n assertProviderSelection,\n makeProvider,\n selectProvider,\n} from \"./provider.js\";\nimport { DocevalsError } from \"../types.js\";\nimport type { ResolvedEval } from \"../core/resolve.js\";\nimport { resolve as resolvePath } from \"node:path\";\nimport { warn } from \"../../shared/warn.js\";\nimport { errorMessage } from \"../../shared/errors.js\";\n\n/**\n * manni docevals' own verdict wording. Structurally identical to the library's\n * canonical schema, but the field descriptions talk about pages rather than\n * generic subjects — and descriptions are prompt surface that steers the\n * model, so they are worth keeping (the inference library's own ADR 01001,\n * not this repo's).\n */\nconst verdictSchema = verdictSchemaJson as Record<string, unknown>;\n\nexport interface JudgeStageDeps {\n /** Provider for evals that do not override `provider`/`model`. */\n provider: InferenceProvider;\n root: string;\n /**\n * Build a provider for an eval that overrides `provider` or `model`.\n *\n * Injected so the engine's tests can drive per-eval overrides with a mock.\n * When absent, one is built from the resolved config — without it `provider`\n * and `model` would validate, appear in the schema, and do nothing, which is\n * worse than not offering them.\n */\n providerFor?: (ev: ResolvedEval) => InferenceProvider | Promise<InferenceProvider>;\n}\n\n/** Build the engine's judge stage around a concrete provider. */\nexport function makeJudge(deps: JudgeStageDeps): JudgeFn {\n return async (\n targets: GraderTarget[],\n config: DocevalsConfig,\n options: JudgeOptions,\n ): Promise<EvalResult[]> => {\n const { provider, root } = deps;\n\n // CLI > eval > config, the same precedence `runsFor` uses, settled by\n // `selectProvider` so the run's provider and an eval's are chosen by one\n // rule. Providers are memoized on the selection an eval *resolves to*, not\n // on what it wrote: with `--provider anthropic` in force, an eval naming\n // `openai` and one naming `mock` both resolve to the same provider, and\n // keying on the authored value would build it twice. The effective pair is\n // also what decides the short-circuit — an eval whose selection is the\n // run's own needs no provider of its own.\n //\n // Memoized as a promise, so a selection that detects or fails does so\n // once, and every eval sharing it gets the same provider or the same error.\n const overridden = new Map<string, Promise<InferenceProvider>>();\n const buildProvider =\n deps.providerFor ??\n ((ev: ResolvedEval): Promise<InferenceProvider> => makeProvider(config, options, ev));\n const keyOf = (s: { provider: string; model: string | undefined }): string =>\n `${s.provider}:${s.model ?? \"\"}`;\n const defaultKey = keyOf(selectProvider(config, options));\n const providerFor = (ev: ResolvedEval, file: string): Promise<InferenceProvider> => {\n // Only the eval's own two fields: a `ResolvedEval` carries a `source` of\n // its own, and the origin a `--local` notice names is the page's.\n const selection = selectProvider(config, options, {\n ...(ev.provider !== undefined ? { provider: ev.provider } : {}),\n ...(ev.model !== undefined ? { model: ev.model } : {}),\n origin: `eval \"${ev.name}\" in ${file}`,\n });\n // Said before the short-circuit: under `--local` an eval naming a hosted\n // provider resolves to the run's own selection, and is still replaced.\n announceSelection(selection);\n const key = keyOf(selection);\n if (key === defaultKey) return Promise.resolve(provider);\n let p = overridden.get(key);\n if (p === undefined) {\n // The eval's own choice follows the run's rules: an unknown name or a\n // model with no provider to own it is refused before anything is built.\n p = (async () => {\n assertProviderSelection(selection);\n return buildProvider(ev);\n })();\n overridden.set(key, p);\n }\n return p;\n };\n // CLI > eval > config. The flag is an explicit operator act (\"run cheap\n // right now\"), so it outranks a page asking for more agreement; the page\n // outranks the corpus default, which is the point of having it.\n const runsFor = (ev: ResolvedEval): number =>\n options.runs ?? ev.runs ?? config.judge.ensembleRuns;\n const temperature = config.judge.temperature;\n const chunkChars = options.chunkChars ?? config.judge.chunkChars;\n const cache = new VerdictCache(\n resolvePath(root, config.judge.cacheDir),\n options.noCache !== true,\n \"manni-docevals\",\n );\n const reviews = loadReviews(root);\n const maxTurns = options.maxTurns ?? config.judge.maxTurns;\n let turnsSpent = 0;\n\n const results: EvalResult[] = [];\n // `makeJudge` is a published export taking a caller-supplied config, so a\n // JS consumer can hand us one shaped for a version before `judge.concurrency`\n // existed. The type says that cannot happen; at a package boundary it can.\n // Unguarded it is `Math.min(undefined, n)` -> NaN -> `Array.from({length:\n // NaN})` -> zero workers, and every AI eval vanishes from the results —\n // not skipped, not errored, absent — with the run exiting 0.\n //\n // Tested with `Number.isFinite` rather than `??` because the value is typed\n // non-optional: `??` is dead code to the compiler and the lint rejects it,\n // while the runtime hazard is real. This says what is actually being\n // checked (ADR 01039).\n // `Number.isInteger(n) && n >= 1`, not `Number.isFinite`: the hazard is a\n // worker pool of zero, and `Number.isFinite(0)` is `true`. A caller-supplied\n // `judge.concurrency: 0` sails past a finite check into\n // `Array.from({length: 0})`, which builds no workers at all — every AI eval\n // then vanishes from the results, not skipped and not errored but absent,\n // with the run exiting 0. The config file cannot express it (`minimum: 1`),\n // but `makeJudge` is exported and takes a caller-supplied config.\n const configured = config.judge.concurrency;\n const concurrency =\n Number.isInteger(configured) && configured >= 1\n ? configured\n : config.defaults.concurrency;\n let index = 0;\n\n const judgeTarget = async (target: GraderTarget): Promise<EvalResult> => {\n const { plan, eval: ev } = target;\n const start = Date.now();\n const runsPerEval = runsFor(ev);\n // A provider the eval chose that cannot be had is that eval's error, as a\n // target it cannot serve is below: the rest of the corpus still gets its\n // verdicts, and the run exits 1 rather than stopping.\n let judgeProvider: InferenceProvider;\n try {\n judgeProvider = await providerFor(ev, plan.page.file);\n } catch (e) {\n if (!(e instanceof DocevalsError)) throw e;\n return {\n evalName: ev.name,\n type: ev.type,\n grader: ev.grader,\n file: plan.page.file,\n outcome: \"error\",\n skipReason: e.message,\n durationMs: Date.now() - start,\n };\n }\n\n // Self-preference, compared against the model that judges *this eval*,\n // not the run's default: an eval naming its own provider or model is\n // exactly the case a run-wide comparison would miss. Said per page and\n // eval rather than deduplicated by model name, so a corpus with several\n // affected pages names each one instead of only the first. Marked on the\n // result too: a verdict formed under self-preference must not look\n // identical to any other in JSON, SARIF, JUnit or the HTML report.\n const preference = selfPreferenceOf(plan, ev, judgeProvider.modelName());\n if (preference) warn(`${plan.page.file}: ${preference.message}`);\n\n // Read what the eval asked to be graded. A target that cannot be served\n // errors here rather than falling back to the page body: a verdict about\n // the wrong bytes is worse than no verdict (ADR 01022).\n const selected = readTarget(ev.target, plan);\n if (!selected.ok) {\n return {\n evalName: ev.name,\n type: ev.type,\n grader: ev.grader,\n file: plan.page.file,\n outcome: \"error\",\n skipReason: selected.reason,\n durationMs: Date.now() - start,\n };\n }\n\n // A page longer than the chunk budget is read in parts: each part\n // contributes the passages bearing on the assertion, and one judge then\n // answers the original question against the collection. Merging\n // per-part *verdicts* would be unsound — see EVIDENCE_SYSTEM_PROMPT.\n //\n // Content that fits skips this entirely and is judged exactly as before,\n // so the common path costs nothing and its cached verdicts stay valid.\n const chunks = splitBody(selected.text, chunkChars);\n let judged = selected.text;\n let judgedLabel = selected.label;\n\n // The key is built from what was *selected*, never from the evidence.\n // Evidence is model output: keying on it would change every run, so a\n // split page could never hit its cached verdict — and the committed docs\n // fixtures for long pages would be dead weight. The chunk budget rides\n // along because it decides how the page was read.\n const key = cacheKey(\n judgeProvider.provider(),\n judgeProvider.modelName(),\n runsPerEval,\n temperature,\n judgeCacheBody(chunkChars, selected.text),\n ev,\n ev.readers?.section,\n );\n const cached = cache.get(key) !== undefined;\n\n // Gathering evidence costs one call per part, so it happens only on a\n // miss. A cached ensemble must make no inference call at all (ADR 01019).\n if (chunks.length > 1 && !cached) {\n const gathered: PartEvidence[] = [];\n for (const [i, chunk] of chunks.entries()) {\n if (maxTurns != null && turnsSpent >= maxTurns) {\n return {\n evalName: ev.name,\n type: ev.type,\n grader: ev.grader,\n file: plan.page.file,\n outcome: \"skipped\",\n skipReason: `${turnBudgetSkipReason(maxTurns)} (after ${String(i)} of ${String(chunks.length)} parts)`,\n durationMs: Date.now() - start,\n };\n }\n turnsSpent += 1;\n try {\n const res = await judgeProvider.completeJSON({\n system: EVIDENCE_SYSTEM_PROMPT,\n user: buildEvidenceUser(ev, chunk, {\n index: i,\n total: chunks.length,\n }),\n schema: EVIDENCE_SCHEMA,\n temperature,\n });\n const json = res.json as Partial<PartEvidence>;\n gathered.push({\n supports: json.supports ?? [],\n contradicts: json.contradicts ?? [],\n });\n } catch (e) {\n // A part that could not be read leaves the collection incomplete,\n // and a verdict over incomplete evidence is exactly the silent\n // wrong answer this stage exists to avoid (ADR 01022).\n return {\n evalName: ev.name,\n type: ev.type,\n grader: ev.grader,\n file: plan.page.file,\n outcome: \"error\",\n skipReason: `gathering evidence from part ${String(i + 1)} of ${String(chunks.length)} failed: ${errorMessage(e)}`,\n durationMs: Date.now() - start,\n };\n }\n }\n judged = renderEvidence(gathered, chunks.length);\n judgedLabel = `${selected.label}, ${String(chunks.length)} parts`;\n }\n\n // A cached ensemble makes no inference call, so it never touches the\n // budget — the docs corpus replays committed fixtures under any cap.\n // For an uncached one the turns are claimed *before* dispatching, which\n // is the whole point of counting turns rather than dollars: the claim is\n // synchronous, so two workers cannot both clear an almost-exhausted\n // budget and then both spend. See ADR 01019.\n if (maxTurns != null && !cached) {\n if (turnsSpent + runsPerEval > maxTurns) {\n return {\n evalName: ev.name,\n type: ev.type,\n grader: ev.grader,\n file: plan.page.file,\n outcome: \"skipped\",\n skipReason: turnBudgetSkipReason(maxTurns),\n durationMs: 0,\n };\n }\n // One turn per ensemble run. A run can make a second provider call\n // when the first response fails schema validation (the inference\n // layer retries once), so this is a floor on calls, not an exact\n // count — the cap is exact in *runs*, which is the unit the ensemble\n // is configured in.\n turnsSpent += runsPerEval;\n }\n\n const runs = await runEnsemble({\n provider: judgeProvider,\n system: JUDGE_SYSTEM_PROMPT,\n // Readers enter only this final call. Evidence gathering above quotes\n // what bears on the assertion, whoever reads it (proposal 0111).\n user: buildUserContent(ev, judged, judgedLabel, ev.readers?.section),\n runs: runsPerEval,\n temperature,\n schema: verdictSchema,\n cache,\n cacheKey: key,\n label: \"manni-docevals\",\n });\n\n const consensusBase = computeConsensus(runs);\n const zone = zoneFor(consensusBase, config.judge.zones);\n const consensus = { ...consensusBase, zone };\n\n let outcome: EvalResult[\"outcome\"] =\n zone === \"auto-pass\" ? \"pass\" : zone === \"auto-fail\" ? \"fail\" : \"needs-review\";\n let via: EvalResult[\"via\"];\n if (outcome === \"needs-review\") {\n const review = findReview(reviews, plan.page.file, ev.name, plan.page.body);\n if (review) {\n outcome = review.verdict;\n via = \"human-review\";\n }\n }\n\n return {\n evalName: ev.name,\n type: ev.type,\n grader: ev.grader,\n file: plan.page.file,\n outcome,\n ...(ev.readers === undefined ? {} : { personas: ev.readers.personas }),\n consensus,\n via,\n ...(preference\n ? { selfPreference: { axis: preference.axis, model: preference.model } }\n : {}),\n durationMs: Date.now() - start,\n };\n };\n\n // Simple bounded-concurrency pool across targets; runs within one eval\n // stay sequential (independent requests, no shared context).\n const workers = Array.from(\n { length: Math.min(concurrency, targets.length) },\n async () => {\n while (index < targets.length) {\n const i = index++;\n const target = targets[i];\n if (target === undefined) break;\n results[i] = await judgeTarget(target);\n }\n },\n );\n await Promise.all(workers);\n return results;\n };\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:docevals:verdict\",\n \"title\": \"manni docevals judge verdict\",\n \"type\": \"object\",\n \"required\": [\"claim\", \"observed\", \"match\", \"confidence\", \"reasoning\"],\n \"properties\": {\n \"claim\": {\n \"type\": \"string\",\n \"description\": \"The specific documented assertion under evaluation.\"\n },\n \"observed\": {\n \"type\": \"string\",\n \"description\": \"What was actually observed in the page, quoting evidence where possible.\"\n },\n \"match\": {\n \"enum\": [\"pass\", \"fail\", \"partial\"],\n \"description\": \"pass only if the assertion is fully satisfied; partial for partial compliance.\"\n },\n \"confidence\": {\n \"type\": \"number\",\n \"minimum\": 0,\n \"maximum\": 1,\n \"description\": \"Self-reported confidence in this verdict.\"\n },\n \"reasoning\": {\n \"type\": \"string\",\n \"description\": \"Why this conclusion was reached.\"\n }\n },\n \"additionalProperties\": false\n}\n","/**\n * Persisted human reviews (Level 3 grading). `.manni/docevals/reviews.yaml` records\n * human verdicts for evals that landed in the human-review zone. A review\n * applies only while the page body it reviewed is unchanged (contentHash);\n * stale reviews silently return the eval to needs-review.\n */\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { parse as parseYaml, stringify as stringifyYaml } from \"yaml\";\nimport { sha256 } from \"../judge/cache.js\";\n\nexport interface ReviewEntry {\n file: string;\n evalName: string;\n /** sha256 of the page body at review time. */\n contentHash: string;\n verdict: \"pass\" | \"fail\";\n reviewer?: string;\n date?: string;\n note?: string;\n}\n\nexport const REVIEWS_PATH = join(\".manni/docevals\", \"reviews.yaml\");\n\nexport function loadReviews(root: string): ReviewEntry[] {\n const path = join(root, REVIEWS_PATH);\n if (!existsSync(path)) return [];\n const raw = parseYaml(readFileSync(path, \"utf8\")) as unknown;\n if (!Array.isArray(raw)) return [];\n return raw as ReviewEntry[];\n}\n\nexport function saveReviews(root: string, reviews: ReviewEntry[]): void {\n const path = join(root, REVIEWS_PATH);\n mkdirSync(dirname(path), { recursive: true });\n writeFileSync(path, stringifyYaml(reviews));\n}\n\n/** Record (or replace) a review for a (file, eval) pair. */\nexport function recordReview(root: string, entry: ReviewEntry): void {\n const reviews = loadReviews(root).filter(\n (r) => !(r.file === entry.file && r.evalName === entry.evalName),\n );\n reviews.push(entry);\n saveReviews(root, reviews);\n}\n\n/** Find the applicable (non-stale) review for a page body, if any. */\nexport function findReview(\n reviews: ReviewEntry[],\n file: string,\n evalName: string,\n body: string,\n): ReviewEntry | undefined {\n const entry = reviews.find(\n (r) => r.file === file && r.evalName === evalName,\n );\n if (!entry) return undefined;\n return entry.contentHash === sha256(body) ? entry : undefined;\n}\n\nexport { sha256 as contentHash };\n","/**\n * Choosing the provider and model, and building the shared inference\n * library's `ProviderSpec` for it.\n *\n * The providers themselves live in `@hawkeyexl/inference` (ADR 01002). The\n * names a provider may have, the two refusals, the detection call, the\n * level-bound precedence and the mapping of the family's `providers:`\n * connection settings are `src/shared/providers.ts`, the same code\n * `manni meta fill` runs. What stays here is what only manni docevals can\n * decide: which levels it reads (a flag, an eval's own `provider:`/`model:`,\n * `docevals.provider`/`model`, then the family's `providers:`), and the\n * judge-shaped options a verdict call wants.\n */\nimport {\n makeProvider as makeInferenceProvider,\n type InferenceProvider,\n type ProviderName as ConcreteProvider,\n type ProviderSelector,\n type ProviderSpec,\n} from \"@hawkeyexl/inference\";\nimport { DocevalsError } from \"../types.js\";\nimport type { DocevalsConfig } from \"../core/config.js\";\nimport {\n assertKnownProvider,\n assertLocalFlag,\n assertModelHasProvider,\n localNotice,\n providerSpecFor as sharedProviderSpecFor,\n resolveIdentity,\n selectProvider as selectFromLevels,\n type ProviderChoice,\n type ProviderFlags,\n type ProviderSelection,\n} from \"../../shared/providers.js\";\nimport { errorMessage } from \"../../shared/errors.js\";\nimport { noticeOnce } from \"../../shared/warn.js\";\n\nexport type { ProviderChoice, ProviderFlags, ProviderSelection };\n\n/** The key a docevals user writes, named by the refusal a bare model gets. */\nconst CONFIG_KEY = \"docevals.provider\";\n\nconst toDocevalsError = (message: string): Error => new DocevalsError(message);\n\n/**\n * The provider and model in force: a flag, then the eval's own choice, then\n * `docevals.provider`/`model`, then the family's `providers.provider`/`model`,\n * then `auto`. A model is carried only to the provider its own level names,\n * so an eval that names a different provider takes that provider's default\n * instead of a model it cannot run (`selectProvider` in the shared module).\n *\n * `--local` runs llama-cpp over all of them. A `--provider` it contradicts is\n * refused here, so no path selects past it. `ev.origin` names the eval in the\n * notice for a provider `--local` replaced; the caller knows its page.\n */\nexport function selectProvider(\n config: DocevalsConfig,\n flags: ProviderFlags = {},\n ev: ProviderChoice = {},\n): ProviderSelection {\n assertLocalFlag(flags, toDocevalsError);\n return selectFromLevels(flags, [\n {\n ...(ev.provider !== undefined ? { provider: ev.provider } : {}),\n ...(ev.model !== undefined ? { model: ev.model } : {}),\n ...(ev.origin !== undefined ? { origin: ev.origin } : {}),\n },\n {\n ...(config.provider !== null ? { provider: config.provider } : {}),\n ...(config.model !== null ? { model: config.model } : {}),\n origin: CONFIG_KEY,\n },\n {\n ...(config.providers.provider !== undefined ? { provider: config.providers.provider } : {}),\n ...(config.providers.model !== undefined ? { model: config.providers.model } : {}),\n origin: \"providers.provider\",\n },\n ]);\n}\n\n/**\n * Say what `--local` set aside, once per source. Called where a selection is\n * about to be used, never where it is only checked, so a run that sends\n * nothing to a model says nothing.\n */\nexport function announceSelection(selection: ProviderSelection): void {\n const message = localNotice(selection);\n if (message !== undefined) noticeOnce(message);\n}\n\n/**\n * Refuse a selection that cannot be right, with `manni meta fill`'s messages:\n * an unknown name, or a model under `auto`. Both are `DocevalsError`s.\n */\nexport function assertProviderSelection(selection: ProviderSelection): void {\n assertKnownProvider(selection.provider, toDocevalsError);\n assertModelHasProvider(selection.provider, selection.model, CONFIG_KEY, toDocevalsError);\n}\n\n/**\n * The spec for a selection, with the family's connection settings for the\n * provider it names, and under `auto` the settings detection reads.\n */\nexport function providerSpecFor(\n config: DocevalsConfig,\n selection: { provider: ProviderSelector; model: string | null },\n): ProviderSpec {\n const spec = sharedProviderSpecFor(config.providers, selection);\n switch (selection.provider) {\n case \"anthropic\":\n // A verdict-shaped tool name steers the model better than a generic\n // one, and it is free to keep.\n return { ...spec, anthropic: { toolName: \"record_verdict\" } };\n case \"openai\":\n return { ...spec, openai: { schemaName: \"verdict\" } };\n default:\n return spec;\n }\n}\n\n/**\n * The concrete provider and model, WITHOUT constructing the provider: cache\n * keys need it, and a fully cached run must not require an API key.\n *\n * Under `auto` this is where detection runs, exactly as `manni meta fill` runs\n * it, seeing the same connection settings. The model is the RESOLVED one (the\n * provider's default when none was named, a llama-cpp tier's concrete\n * weights), so a library default that changes changes every cache key built\n * from it.\n */\nexport async function resolveProviderIdentity(\n config: DocevalsConfig,\n flags: ProviderFlags = {},\n ev: ProviderChoice = {},\n): Promise<{ provider: ConcreteProvider; model: string }> {\n const selection = selectProvider(config, flags, ev);\n const { provider, model } = selection;\n assertKnownProvider(provider, toDocevalsError);\n assertModelHasProvider(provider, model, CONFIG_KEY, toDocevalsError);\n announceSelection(selection);\n return resolveIdentity(providerSpecFor(config, { provider, model: model ?? null }), toDocevalsError);\n}\n\n/** Construct a provider for an identity already resolved. */\nexport function constructProvider(\n config: DocevalsConfig,\n identity: { provider: ConcreteProvider; model: string },\n): InferenceProvider {\n try {\n return makeInferenceProvider(providerSpecFor(config, identity));\n } catch (e) {\n // The library raises its own InferenceError (missing API key). It must\n // surface as a DocevalsError: `run` degrades to deterministic-only evals on\n // a DocevalsError and rethrows anything else, and cli.ts fail() maps only\n // DocevalsError to exit 2. Letting a foreign error type through turns \"no\n // API key configured\" from a warning into an unhandled stack trace.\n throw new DocevalsError(errorMessage(e));\n }\n}\n\n/** Select, check, detect and construct: the provider a verb sends pages to. */\nexport async function makeProvider(\n config: DocevalsConfig,\n flags: ProviderFlags = {},\n ev: ProviderChoice = {},\n): Promise<InferenceProvider> {\n return constructProvider(config, await resolveProviderIdentity(config, flags, ev));\n}\n","/**\n * Script generation: turns a plain-language deterministic assertion (a\n * command-graded eval with no command) into a standalone Node .mjs check\n * script written parallel to the documentation, then persists the command\n * reference back into the frontmatter (or config) — no inline scripts.\n * Generation is single-shot: the output is code, verified by execution and\n * version-control review rather than ensemble consensus.\n */\nimport { mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { basename, dirname, extname, join, relative, resolve } from \"node:path\";\nimport type { DocevalsConfig } from \"../core/config.js\";\nimport type {\n GenerateFn,\n GenerationRefusal,\n JudgeOptions,\n} from \"../core/engine.js\";\nimport { updateConfigEval, updatePageEval } from \"../core/frontmatter-edit.js\";\nimport {\n EVALS_KEY,\n EvalWriter,\n manifestEvalList,\n updateManifestEval,\n type WriteHome,\n} from \"../core/write-location.js\";\nimport { sha256 } from \"../judge/cache.js\";\nimport type { InferenceProvider } from \"@hawkeyexl/inference\";\nimport type { GraderTarget } from \"./types.js\";\nimport { DocevalsError } from \"../types.js\";\n\nexport const SCRIPTGEN_VERSION = 2;\n\nexport const SCRIPTGEN_SYSTEM_PROMPT = [\n \"You write small, self-contained Node.js check scripts that verify a\",\n \"deterministic assertion about a documentation page.\",\n \"\",\n \"Contract for every script:\",\n \"- ES module (.mjs) using only Node.js built-in modules. No dependencies.\",\n \"- The page's absolute path arrives as process.argv[2] (also MANNI_DOCEVALS_FILE).\",\n \"- Exit 0 when the assertion holds, 1 when it fails, 2 on operational error.\",\n \"- On failure, print a short human-readable reason to stderr.\",\n \"- Deterministic: no network access, no spawning processes, no randomness.\",\n \"- The page content may start with a YAML frontmatter block fenced by ---\",\n \" lines; account for it when checking body content.\",\n \"- Prefer simple, reviewable logic (regex/string checks) over cleverness.\",\n \"Respond with JSON: { \\\"code\\\": \\\"<the full script source>\\\" }.\",\n].join(\"\\n\");\n\nconst SCRIPT_SCHEMA = {\n type: \"object\",\n required: [\"code\"],\n properties: {\n code: { type: \"string\", minLength: 1 },\n notes: { type: \"string\" },\n },\n additionalProperties: false,\n} as const;\n\nexport function buildScriptgenUser(\n assertion: string,\n evalName: string,\n file: string,\n body: string,\n): string {\n // No cap. Generation produces one script, so there is nothing to merge and\n // splitting has no meaning here — but truncating was worse than either: a\n // script generated from the first 6000 characters expresses an assertion\n // about a page whose rest the model never read, and nothing downstream could\n // tell that from a script generated with full sight of it. If the body\n // overflows the model's context the call fails, and a failed generation is\n // already an errored result (ADR 01022) rather than a half-informed script.\n return [\n `# Assertion to check`,\n assertion,\n \"\",\n `# Eval name`,\n evalName,\n \"\",\n `# Page path`,\n file,\n \"\",\n \"# Current page content (for grounding — the script must express the\",\n \"# assertion generally, not hardcode this exact content)\",\n \"\",\n body,\n ].join(\"\\n\");\n}\n\nexport interface ScriptLocation {\n /** Absolute path the script file is written to. */\n scriptAbsPath: string;\n /** Command array persisted into the eval (path relative to its cwd). */\n command: string[];\n}\n\n/** Where a generated script lives and how the eval invokes it. */\nexport function scriptLocationFor(\n target: GraderTarget,\n config: DocevalsConfig,\n root: string,\n): ScriptLocation {\n const ev = target.eval;\n const page = target.plan.page;\n if (ev.source === \"page\") {\n const pageDir = dirname(page.absPath);\n const pattern = config.scripts.dir;\n const dir = pattern.includes(\"{docDir}\")\n ? pattern.replaceAll(\"{docDir}\", pageDir)\n : resolve(root, pattern);\n const base = basename(page.absPath, extname(page.absPath));\n const scriptAbsPath = join(dir, `${base}.${ev.name}.mjs`);\n const rel = relative(pageDir, scriptAbsPath).replace(/\\\\/g, \"/\");\n return { scriptAbsPath, command: [\"node\", rel, \"{file}\"] };\n }\n const dir = resolve(config.configDir, config.scripts.configDir);\n const scriptAbsPath = join(dir, `${ev.name}.mjs`);\n const rel = relative(config.configDir, scriptAbsPath).replace(/\\\\/g, \"/\");\n return { scriptAbsPath, command: [\"node\", rel, \"{file}\"] };\n}\n\nfunction header(assertion: string, evalName: string): string {\n return [\n \"// manni docevals generated check\",\n `// Eval: ${evalName}`,\n `// Assertion: ${assertion.replace(/\\s+/g, \" \").trim()}`,\n \"// Exit 0 = pass, 1 = fail, 2 = operational error.\",\n \"\",\n ].join(\"\\n\");\n}\n\nexport interface ScriptgenDeps {\n /**\n * The provider, or how to get one. A function is called only when a target\n * actually needs a script, so a run with nothing to generate never resolves\n * (and, under `auto`, never detects) a provider.\n */\n provider: InferenceProvider | (() => Promise<InferenceProvider>);\n root: string;\n}\n\n/** Build the engine's generation stage around a concrete provider. */\nexport function makeGenerateScripts(deps: ScriptgenDeps): GenerateFn {\n return async (\n targets: GraderTarget[],\n config: DocevalsConfig,\n _options: JudgeOptions,\n ) => {\n const generatedPaths: string[] = [];\n const refusals: GenerationRefusal[] = [];\n // Config-sourced evals generate once even when used by many pages.\n const doneConfigEvals = new Set<string>();\n let provider: InferenceProvider | undefined;\n // Proposal 0047: the command reference goes where the eval lives. Built\n // once per generation pass, and only when a page-sourced eval needs it.\n let writer: EvalWriter | undefined;\n const getWriter = (): EvalWriter => (writer ??= EvalWriter.for(config, deps.root, []));\n\n for (const target of targets) {\n const ev = target.eval;\n if (!ev.assertion) continue; // Nothing to generate from.\n if (ev.source === \"config\" && doneConfigEvals.has(ev.name)) continue;\n\n // Where the reference will be persisted, decided before the model is\n // asked: a page whose manifest has no entry for it can hold no command,\n // and paying for a script that cannot be referenced helps nobody.\n const page = target.plan.page;\n let home: WriteHome | undefined;\n if (ev.source === \"page\") {\n home = await getWriter().homeFor(\n page.file,\n page.frontmatter.data,\n EVALS_KEY,\n );\n if (home.kind === \"url\") {\n throw getWriter().urlRefusal(home, EVALS_KEY);\n }\n if (home.kind === \"no-entry\") {\n refusals.push({ file: page.file, evalName: ev.name, message: home.message });\n continue;\n }\n }\n\n if (provider === undefined) {\n try {\n provider =\n typeof deps.provider === \"function\" ? await deps.provider() : deps.provider;\n } catch (e) {\n // No provider for any target: say why once, and let the engine\n // report each eval it could not generate for.\n if (!(e instanceof DocevalsError)) throw e;\n return { generatedPaths, refusals, unavailable: e.message };\n }\n }\n\n const location = scriptLocationFor(target, config, deps.root);\n let code: string;\n try {\n const response = await provider.completeJSON({\n system: SCRIPTGEN_SYSTEM_PROMPT,\n user: buildScriptgenUser(\n ev.assertion,\n ev.name,\n target.plan.page.file,\n target.plan.page.body,\n ),\n schema: SCRIPT_SCHEMA,\n temperature: 0,\n });\n const json = response.json as { code?: unknown };\n if (typeof json.code !== \"string\" || json.code.length === 0) {\n continue; // Generation failed; the engine reports the eval as errored.\n }\n code = json.code;\n } catch {\n continue;\n }\n\n mkdirSync(dirname(location.scriptAbsPath), { recursive: true });\n writeFileSync(\n location.scriptAbsPath,\n // Exactly one final newline, whatever the model sent: the script is\n // committed and reviewed, and a missing one shows in every diff.\n `${header(ev.assertion, ev.name)}${code.trim()}\\n`,\n );\n generatedPaths.push(\n relative(deps.root, location.scriptAbsPath).replace(/\\\\/g, \"/\"),\n );\n\n const updates = {\n command: location.command,\n \"generated-assertion-hash\": sha256(ev.assertion),\n };\n if (ev.source === \"page\" && home?.kind === \"manifest\") {\n // The evals live in the manifest, so the command reference does too:\n // the one entry is rewritten and no other byte of the file changes.\n const at = getWriter();\n const list = manifestEvalList(\n await at.readManifest(home, EVALS_KEY),\n home.file,\n home.entry,\n );\n const next = updateManifestEval(list, ev.name, updates);\n if (next === undefined) {\n throw new DocevalsError(\n `${home.file}: eval \"${ev.name}\" not found in the entry for ${home.entry}`,\n );\n }\n await at.writeManifest(home, EVALS_KEY, next);\n } else if (ev.source === \"page\") {\n const abs = page.absPath;\n const updated = updatePageEval(\n readFileSync(abs, \"utf8\"),\n page.file,\n ev.name,\n updates,\n );\n writeFileSync(abs, updated);\n } else {\n const updated = updateConfigEval(\n readFileSync(config.configPath, \"utf8\"),\n config.configPath,\n ev.name,\n updates,\n );\n writeFileSync(config.configPath, updated);\n doneConfigEvals.add(ev.name);\n }\n\n // Mutate the in-memory eval so this run executes the fresh script.\n if (ev.source === \"config\") {\n // A config-sourced eval appears once per page; every target shares\n // the same central definition and script.\n for (const t of targets) {\n if (t.eval.name === ev.name && t.eval.source === \"config\") {\n t.eval.command = scriptLocationFor(t, config, deps.root).command;\n t.eval.generatedAssertionHash =\n updates[\"generated-assertion-hash\"];\n }\n }\n } else {\n // Page-sourced evals are per-page: same-named inline evals on other\n // pages have their own assertions and generate independently.\n target.eval.command = location.command;\n target.eval.generatedAssertionHash = updates[\"generated-assertion-hash\"];\n }\n }\n return { generatedPaths, refusals };\n };\n}\n","/**\n * Surgical YAML edits. Only the frontmatter block (or the named config eval)\n * is re-serialized via the `yaml` Document API — the page body is carried\n * over byte-for-byte, and untouched YAML keeps its comments and ordering.\n * YAML frontmatter only; TOML/JSON frontmatter cannot be edited in place.\n */\nimport { parseDocument, Document, YAMLMap, YAMLSeq, isMap, isScalar } from \"yaml\";\nimport { DocevalsError } from \"../types.js\";\nimport { leadingFrontmatterFormat } from \"./discover.js\";\n\n/** Top-level key manni docevals owns inside the shared manni config. */\nconst NAMESPACE = \"docevals\";\n\n/** The byte-order mark a page may open with, carried through edits untouched. */\nconst BOM = \"\\uFEFF\";\n\nexport interface EvalUpdates {\n grader?: string;\n command?: string[];\n /** sha256 of the assertion at generation time; flat, per the vocabulary. */\n \"generated-assertion-hash\"?: string;\n}\n\ninterface Split {\n /** The opening fence line including its newline. */\n open: string;\n /** Raw YAML between the fences. */\n block: string;\n /** Everything from the closing fence to EOF, byte-identical. */\n suffix: string;\n /** Line ending style of the file. */\n eol: \"\\n\" | \"\\r\\n\";\n}\n\nfunction splitYamlFrontmatter(content: string, path: string): Split {\n const bom = content.startsWith(BOM) ? BOM : \"\";\n const body = bom ? content.slice(1) : content;\n const openMatch = /^---(\\r?\\n)/.exec(body);\n if (!openMatch) {\n throw new DocevalsError(\n `${path}: no YAML frontmatter block to edit (only YAML frontmatter is editable)`,\n );\n }\n const eol: \"\\n\" | \"\\r\\n\" = openMatch[1] === \"\\r\\n\" ? \"\\r\\n\" : \"\\n\";\n // Keep line endings. The match above guarantees an opening line.\n const [openLine = \"\", ...rest] = body.split(/(?<=\\n)/);\n let offset = openLine.length;\n for (const line of rest) {\n const stripped = line.replace(/\\r?\\n$/, \"\");\n if (stripped === \"---\" || stripped === \"...\") {\n const blockEnd = offset;\n return {\n open: bom + openLine,\n block: body.slice(openLine.length, blockEnd),\n suffix: body.slice(blockEnd),\n eol,\n };\n }\n offset += line.length;\n }\n throw new DocevalsError(`${path}: unterminated frontmatter block`);\n}\n\nfunction applyUpdates(\n doc: Document,\n node: YAMLMap,\n updates: EvalUpdates,\n): void {\n if (updates.grader !== undefined) node.set(\"grader\", updates.grader);\n if (updates.command !== undefined) {\n const seq = doc.createNode(updates.command) as YAMLSeq;\n seq.flow = true; // [\"node\", \"script.mjs\", \"{file}\"] on one line\n node.set(\"command\", seq);\n }\n const hash = updates[\"generated-assertion-hash\"];\n if (hash !== undefined) node.set(\"generated-assertion-hash\", hash);\n}\n\n/**\n * The eval list. `evals` is the list itself, or the single-assertion string\n * shorthand — which has no map node to edit, so it is not a sequence here.\n */\nfunction evalSeq(doc: Document): YAMLSeq | undefined {\n const node = doc.get(\"evals\", true);\n return node instanceof YAMLSeq ? node : undefined;\n}\n\nfunction findEvalNode(\n doc: Document,\n evalName: string,\n): YAMLMap | undefined {\n const evals = evalSeq(doc);\n if (!evals) return undefined;\n for (const item of evals.items) {\n if (isMap(item)) {\n const name = item.get(\"id\") ?? item.get(\"use\");\n if (name === evalName) return item;\n }\n }\n return undefined;\n}\n\n/**\n * Update an inline eval in a page's YAML frontmatter. Returns the new file\n * content; the body after the closing fence is byte-identical to the input.\n */\nexport function updatePageEval(\n content: string,\n path: string,\n evalName: string,\n updates: EvalUpdates,\n): string {\n const { open, block, suffix, eol } = splitYamlFrontmatter(content, path);\n const doc = parseDocument(block);\n if (doc.errors.length > 0) {\n throw new DocevalsError(\n `${path}: cannot edit frontmatter — ${doc.errors[0]?.message ?? \"parse error\"}`,\n );\n }\n const node = findEvalNode(doc, evalName);\n if (!node) {\n throw new DocevalsError(\n `${path}: eval \"${evalName}\" not found in frontmatter`,\n );\n }\n applyUpdates(doc, node, updates);\n let newBlock = doc.toString();\n if (eol === \"\\r\\n\") newBlock = newBlock.replace(/(?<!\\r)\\n/g, \"\\r\\n\");\n return open + newBlock + suffix;\n}\n\n/**\n * Update a named eval in manni.config.yaml text.\n *\n * The eval library lives under the tool's own namespace — `manni.config.yaml`\n * is shared across the manni family. Navigating to a root `evals:` finds\n * nothing in a real config, so generation for a config-sourced eval failed\n * with \"eval not found in config\" against every file the loader accepts.\n */\nexport function updateConfigEval(\n configText: string,\n configPath: string,\n evalName: string,\n updates: EvalUpdates,\n): string {\n const doc = parseDocument(configText);\n if (doc.errors.length > 0) {\n throw new DocevalsError(\n `${configPath}: cannot edit config — ${doc.errors[0]?.message ?? \"parse error\"}`,\n );\n }\n const node = doc.getIn([NAMESPACE, \"evals\", evalName]);\n if (!isMap(node)) {\n throw new DocevalsError(\n `${configPath}: eval \"${evalName}\" not found in config`,\n );\n }\n applyUpdates(doc, node, updates);\n return doc.toString();\n}\n\nexport interface NewEvalEntry {\n /** Kebab-case id. Required on object entries — position-derived names\n * orphan cached verdicts whenever entries move. */\n id: string;\n assertion: string;\n type?: string;\n grader?: string;\n evidence?: string;\n examples?: { pass?: string | string[]; fail?: string | string[] };\n severity?: string;\n}\n\n/**\n * Ordered plain object for a new inline eval, with undefined fields dropped.\n * Exported because an eval whose location puts it in a manifest is written as\n * this same object, spliced into the page's entry rather than appended here.\n */\nexport function entryObject(entry: NewEvalEntry): Record<string, unknown> {\n const obj: Record<string, unknown> = { id: entry.id, assertion: entry.assertion };\n if (entry.type !== undefined) obj.type = entry.type;\n if (entry.grader !== undefined) obj.grader = entry.grader;\n if (entry.evidence !== undefined) obj.evidence = entry.evidence;\n if (entry.examples !== undefined) obj.examples = entry.examples;\n if (entry.severity !== undefined) obj.severity = entry.severity;\n return obj;\n}\n\n/** The page-level key `fill` records machine-proposed evals in (proposal 0046). */\nconst META_PROVENANCE_KEY = \"meta-provenance\";\n\nfunction assertNoCollision(seq: YAMLSeq, name: string, path: string): void {\n for (const item of seq.items) {\n const existing = isMap(item)\n ? item.get(\"id\") ?? item.get(\"use\")\n : isScalar(item)\n ? item.value\n : undefined;\n if (existing === name) {\n throw new DocevalsError(\n `${path}: eval \"${name}\" already exists in frontmatter`,\n );\n }\n }\n}\n\n/**\n * Append inline evals to a page's YAML frontmatter, creating the `evals` key\n * — or the frontmatter block itself — when missing. The body stays\n * byte-identical; existing evals are never modified or reordered.\n *\n * `metaProvenance`, when given, is the page's whole `meta-provenance` list with\n * the new evals already merged in, written in the same edit. The merge is the\n * caller's, as `manni meta fill`'s is, so both tools record attribution one\n * way.\n */\nexport function appendPageEvals(\n content: string,\n path: string,\n entries: NewEvalEntry[],\n metaProvenance?: readonly unknown[],\n): string {\n const format = leadingFrontmatterFormat(content);\n if (format === \"toml\" || format === \"json\") {\n // Synthesizing a YAML block here would leave the page with two\n // frontmatter blocks. Only YAML frontmatter can be edited in place.\n throw new DocevalsError(\n `${path}: only YAML frontmatter can be edited (found ${format} frontmatter)`,\n );\n }\n\n const bom = content.startsWith(BOM) ? BOM : \"\";\n const stripped = bom ? content.slice(1) : content;\n const eol: \"\\n\" | \"\\r\\n\" = stripped.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\";\n\n if (format === undefined) {\n // No frontmatter: synthesize a block above the untouched body.\n const doc = new Document(\n entries.length === 0 ? {} : { evals: entries.map(entryObject) },\n );\n if (metaProvenance) doc.set(META_PROVENANCE_KEY, doc.createNode(metaProvenance));\n let block = doc.toString();\n if (eol === \"\\r\\n\") block = block.replace(/(?<!\\r)\\n/g, \"\\r\\n\");\n return `${bom}---${eol}${block}---${eol}${stripped}`;\n }\n\n const { open, block, suffix, eol: blockEol } = splitYamlFrontmatter(content, path);\n const doc = parseDocument(block);\n if (doc.errors.length > 0) {\n throw new DocevalsError(\n `${path}: cannot edit frontmatter — ${doc.errors[0]?.message ?? \"parse error\"}`,\n );\n }\n\n // Nothing to append: the evals of this page went to the manifest that owns\n // them, and only `meta-provenance` is left for the page. Creating an empty\n // `evals:` here would put the key in both places, which is exactly the\n // collision routing the write exists to avoid.\n if (entries.length === 0) {\n if (metaProvenance) doc.set(META_PROVENANCE_KEY, doc.createNode(metaProvenance));\n let onlyEntry = doc.toString();\n if (blockEol === \"\\r\\n\") onlyEntry = onlyEntry.replace(/(?<!\\r)\\n/g, \"\\r\\n\");\n return open + onlyEntry + suffix;\n }\n\n let seq = evalSeq(doc);\n if (!seq) {\n const node = doc.get(\"evals\", true);\n if (node !== undefined) {\n // A single-assertion string, or something else entirely. Appending would\n // have to rewrite the existing declaration, which is the caller's call to\n // make, not a silent side effect of adding one eval.\n throw new DocevalsError(\n `${path}: the evals key in frontmatter is not a list — expand the ` +\n `string shorthand into a list before appending`,\n );\n }\n seq = doc.createNode([]);\n doc.set(\"evals\", seq);\n }\n for (const entry of entries) {\n assertNoCollision(seq, entry.id, path);\n seq.add(doc.createNode(entryObject(entry)));\n }\n if (metaProvenance) doc.set(META_PROVENANCE_KEY, doc.createNode(metaProvenance));\n let newBlock = doc.toString();\n if (blockEol === \"\\r\\n\") newBlock = newBlock.replace(/(?<!\\r)\\n/g, \"\\r\\n\");\n return open + newBlock + suffix;\n}\n\n/** True when the eval exists as an editable (map) entry in the frontmatter. */\nexport function hasEditableEval(content: string, evalName: string): boolean {\n try {\n const { block } = splitYamlFrontmatter(content, \"\");\n const doc = parseDocument(block);\n return findEvalNode(doc, evalName) !== undefined;\n } catch {\n return false;\n }\n}\n\n/** Used by promote: check a string-shorthand eval entry (not editable in place). */\nexport function isScalarEvalEntry(content: string, evalName: string): boolean {\n try {\n const { block } = splitYamlFrontmatter(content, \"\");\n const doc = parseDocument(block);\n const evals = evalSeq(doc);\n if (!evals) return false;\n return evals.items.some((i) => isScalar(i) && i.value === evalName);\n } catch {\n return false;\n }\n}\n","/**\n * Where docevals writes each key it owns (proposal 0047, §3 and §4).\n *\n * Chunk 1 made reading follow a key's location: a manifest that owns `evals`\n * supplies them, and everything downstream sees them as the page's own. A\n * tool that reads that way and writes to the page anyway puts the value in\n * two places at once, which `meta validate` then reports as an\n * `external:owned` collision on every page it touched.\n *\n * So every write goes through the rule `manni meta fill` already follows:\n *\n * - a **local manifest** of one of the page's collections owns the key: the\n * value is spliced into the page's entry there, and nothing else in the\n * file changes;\n * - the manifest **joins on a field the page lacks**: there is no entry to\n * hold the value, and the write is refused for that file, in meta's own\n * sentence;\n * - a **URL manifest** owns it: nothing can be written to a fetched file,\n * and for an eval key that is the refusal chunk 1 already makes at load;\n * - **no manifest owns it**: the page keeps it, with the offer (P1) and the\n * warnings (W1, W2) meta's writers use when the schema prefers external\n * metadata.\n *\n * The rule is meta's, and so is every helper that decides it: `keyHome`,\n * `offerExternalHomes`, `externalWriteWarnings` and `spliceManifestValue`,\n * all reached through `src/meta/internal.ts`. What is docevals' own is the\n * preference, which comes from the evals vocabulary rather than a validator:\n * the vocabulary this tool implements marks its three keys, so the answer is\n * in the schema docevals already bundles.\n */\nimport { resolve } from \"node:path\";\nimport {\n LOCATION_KEYWORD,\n Validator,\n writeFileAtomic,\n} from \"../../meta/index.js\";\nimport {\n externalWriteWarnings,\n keyHome,\n offerExternalHomes,\n readManifestValue,\n spliceManifestValue,\n type ExternalWrite,\n type ProposedHome,\n type RelocateResult,\n type RelocationContext,\n} from \"../../meta/internal.js\";\nimport { readManifestOrEmpty } from \"../../shared/manifest-cas.js\";\nimport type { Confirm } from \"../../shared/prompt.js\";\nimport { errorMessage } from \"../../shared/errors.js\";\nimport { DocevalsError } from \"../types.js\";\nimport { frontmatterSchema } from \"../schema.js\";\nimport type { DocevalsConfig } from \"./config.js\";\nimport { urlManifestRefusal } from \"./external.js\";\n\n/** The page key holding the eval list, the one docevals appends to and edits. */\nexport const EVALS_KEY = \"evals\";\n\n/** The key `fill` records machine-proposed evals in (proposal 0046). */\nexport const META_PROVENANCE_KEY = \"meta-provenance\";\n\n/**\n * Whether `manni:evals:1.0.0` marks `key` as belonging in external metadata.\n *\n * Read from the bundled vocabulary rather than from a resolved schema set.\n * Every docevals page is validated against it (`core/resolve.ts`), so it is\n * the schema that governs these keys, and a preference read from it cannot\n * disagree with the one `meta validate` reads. A key it does not mark stays\n * on the page with no warning.\n */\nexport function prefersExternal(key: string): boolean {\n const properties = frontmatterSchema.properties;\n if (typeof properties !== \"object\" || properties === null) return false;\n const property = (properties as Record<string, unknown>)[key];\n if (typeof property !== \"object\" || property === null) return false;\n return (property as Record<string, unknown>)[LOCATION_KEYWORD] === \"external\";\n}\n\n/** Where one key of one page goes. */\nexport type WriteHome =\n /** The page's own frontmatter. `proposed` is the home relocation would give it. */\n | { kind: \"page\"; prefersExternal: boolean; proposed: ProposedHome }\n /** The page's entry in a local manifest. */\n | {\n kind: \"manifest\";\n /** As the run reports it. */\n file: string;\n absPath: string;\n /** `path`, or the page field the manifest joins on. */\n join: string;\n entry: string;\n /**\n * The manifest is the page's own, resolved from a `{page}` pattern\n * (proposal 0058). It may not exist yet: the first write creates it,\n * and a read of it before then holds nothing.\n */\n perPage: boolean;\n }\n /** A manifest joins on a field this page does not carry. */\n | { kind: \"no-entry\"; message: string }\n /** A URL manifest owns the key; nothing fetched can be written. */\n | { kind: \"url\"; collection: string; file: string };\n\n/** meta's sentence for a page a joined manifest has no entry for. */\nexport function noEntryMessage(\n label: string,\n join: string,\n file: string,\n key: string,\n): string {\n return `${label} carries no ${join}, which ${file} joins on, so its ${key} has no entry there.`;\n}\n\n/** What `offer` reports back while it asks. */\nexport interface OfferHooks {\n confirm: Confirm;\n onNotice?: (message: string) => void;\n onRelocated?: (result: RelocateResult) => void;\n}\n\n/**\n * The run's writer: where each key goes, and the manifest splices that put it\n * there. One per run, because the relocation context it reads is the config\n * as the run found it, and an accepted offer changes that config.\n */\nexport class EvalWriter {\n private readonly landed: ExternalWrite[] = [];\n\n private constructor(\n private readonly ctx: RelocationContext,\n private readonly configSource: string,\n ) {}\n\n /**\n * Build the writer for a run. `targets` are the positional paths as typed,\n * which is where a page in no collection gets its proposed home from; a run\n * that took its paths from the collections passes none.\n *\n * The context is built from the config docevals already loaded rather than\n * by loading it again through meta. A `manni.config.yaml` carrying only a\n * `docevals:` key is a single-tool file to the metadata tool, which refuses\n * it; docevals reads it every run, and where its own evals go cannot depend\n * on whether a sibling can read the same file. The collections are the\n * declared ones, since a page named by path is still a member of whatever\n * contains it. `config: null` leaves the page's schema set to the page,\n * which is enough: the keys this writer homes are named outright in the\n * relocation it plans.\n */\n static for(\n config: DocevalsConfig,\n cwd: string,\n targets: readonly string[],\n ): EvalWriter {\n const noConfig = config.configSource === null;\n const collections = config.collections;\n return new EvalWriter(\n {\n cwd,\n // Page labels are relative to the run's discovery root, so a manifest\n // path this writer reports is spelled against the same directory\n // `core/external.ts` reports a merged value's source against.\n base: cwd,\n noConfig,\n config: null,\n ...(noConfig ? {} : { configDir: config.configDir, configPath: config.configPath }),\n collections,\n declaredCollections: collections,\n targets,\n validator: new Validator(),\n },\n config.configSource ?? cwd,\n );\n }\n\n /** Where `key` of the page labelled `label` goes. `data` is its metadata. */\n async homeFor(\n label: string,\n data: Readonly<Record<string, unknown>>,\n key: string,\n ): Promise<WriteHome> {\n const home = await keyHome(this.ctx, label, data, key);\n if (home.kind === \"url\") {\n return { kind: \"url\", collection: home.collection, file: home.file };\n }\n if (home.kind === \"manifest\") {\n if (home.entry === undefined) {\n return {\n kind: \"no-entry\",\n message: noEntryMessage(label, home.join, home.file, key),\n };\n }\n return {\n kind: \"manifest\",\n file: home.file,\n absPath: home.absPath,\n join: home.join,\n entry: home.entry,\n perPage: home.perPage,\n };\n }\n return { kind: \"page\", prefersExternal: prefersExternal(key), proposed: home.home };\n }\n\n /**\n * The refusal for an eval key a URL manifest owns, in chunk 1's wording. A\n * run reaches it only where the load-time refusal could not: a manifest\n * declared for a collection whose pages this run never merged.\n */\n urlRefusal(home: { collection: string }, key: string): DocevalsError {\n return new DocevalsError(urlManifestRefusal(this.configSource, home.collection, key));\n }\n\n /** Record that `key` stayed on the page, for the W1 and W2 lines. */\n stayedOnPage(label: string, key: string, proposed: ProposedHome): void {\n this.landed.push({ label, key, home: proposed });\n }\n\n /** The W1 and W2 lines for everything that stayed on a page. Without the prefix. */\n warnings(dryRun: boolean): string[] {\n return this.landed.length === 0 ? [] : externalWriteWarnings(this.landed, dryRun);\n }\n\n /**\n * Ask P1 once per collection the flagged writes would be homed in. Returns\n * true when a relocation was applied, which leaves the caller's config,\n * pages and this writer stale: rebuild all three before writing.\n */\n async offer(writes: readonly ExternalWrite[], hooks: OfferHooks): Promise<boolean> {\n if (writes.length === 0) return false;\n const applied = await offerExternalHomes(this.ctx, writes, hooks);\n return applied.size > 0;\n }\n\n /** The value the manifest holds for this page's entry, or `undefined`. */\n async readManifest(\n home: { absPath: string; entry: string; join: string; perPage: boolean },\n key: string,\n ): Promise<unknown> {\n return readManifestValue(await this.text(home.absPath, home.perPage), {\n entry: home.entry,\n key,\n join: home.join,\n });\n }\n\n /** Write `value` into this page's entry, changing no other byte of the file. */\n async writeManifest(\n home: { absPath: string; entry: string; join: string; file: string; perPage: boolean },\n key: string,\n value: unknown,\n ): Promise<void> {\n const text = await this.text(home.absPath, home.perPage);\n let spliced: string;\n try {\n spliced = spliceManifestValue(text, {\n entry: home.entry,\n key,\n value,\n join: home.join,\n file: home.file,\n }).text;\n } catch (e) {\n // meta's refusal, in this tool's error class, exactly as cite reports it.\n throw new DocevalsError(errorMessage(e));\n }\n // A per-page manifest may be the first file in its directory.\n if (spliced !== text) {\n await writeFileAtomic(home.absPath, spliced, { createParents: true });\n }\n }\n\n /**\n * The manifest's bytes. A per-page manifest that is not on disk yet is a\n * page with nothing recorded, held as empty text and created by the write,\n * exactly as `manni meta fill` holds one. A missing concrete manifest is\n * refused, as it always was.\n */\n private async text(absPath: string, perPage: boolean): Promise<string> {\n try {\n return await readManifestOrEmpty(absPath, perPage);\n } catch (e) {\n throw new DocevalsError(\n `${resolve(absPath)} could not be read: ${errorMessage(e)}`,\n );\n }\n }\n}\n\n/**\n * The eval list a manifest holds, as a list. An entry whose `evals` is a\n * string shorthand, or anything else, is refused rather than rewritten: the\n * page's own shorthand is refused the same way, and expanding one is the\n * author's call rather than a silent side effect of adding an eval.\n */\nexport function manifestEvalList(value: unknown, file: string, entry: string): unknown[] {\n if (value === undefined || value === null) return [];\n if (Array.isArray(value)) return [...(value as readonly unknown[])];\n throw new DocevalsError(\n `${file}: the evals key of ${entry} is not a list — expand the string ` +\n `shorthand into a list before appending`,\n );\n}\n\n/** The updates `generate` and `promote` persist onto one eval entry. */\nexport interface ManifestEvalUpdates {\n grader?: string;\n command?: string[];\n \"generated-assertion-hash\"?: string;\n}\n\n/**\n * Apply `updates` to the entry named `name` in a manifest's eval list, and\n * return the new list. `undefined` when the list holds no such entry, which\n * is a caller's refusal rather than a silent no-op.\n */\nexport function updateManifestEval(\n list: readonly unknown[],\n name: string,\n updates: ManifestEvalUpdates,\n): unknown[] | undefined {\n const index = list.findIndex((item) => named(item) === name);\n const held = index === -1 ? undefined : list[index];\n if (held === undefined) return undefined;\n // Only the fields actually being set. An `undefined` in the value would be\n // dropped on the way to YAML and then fail the splice's read-back, which\n // compares what it wrote against what the file now holds.\n const set: Record<string, unknown> = { ...(held as Record<string, unknown>) };\n if (updates.grader !== undefined) set.grader = updates.grader;\n if (updates.command !== undefined) set.command = updates.command;\n const hash = updates[\"generated-assertion-hash\"];\n if (hash !== undefined) set[\"generated-assertion-hash\"] = hash;\n const next = [...list];\n next[index] = set;\n return next;\n}\n\n/** The id a manifest's eval entry answers to, or `undefined` for a shorthand. */\nfunction named(item: unknown): string | undefined {\n if (typeof item !== \"object\" || item === null || Array.isArray(item)) return undefined;\n const entry = item as Record<string, unknown>;\n const id = entry.id ?? entry.use;\n return typeof id === \"string\" ? id : undefined;\n}\n","/**\n * `manni docevals run` — execute the full pipeline. Deterministic graders run\n * first (cheap-first ordering); the AI judge stage runs when a provider is\n * available and not disabled.\n */\nimport { runEvals, type EngineReport, type JudgeFn, type RunOptions } from \"../core/engine.js\";\nimport { loadRunConfig, type DocevalsConfig } from \"../core/config.js\";\nimport { runConfigOptions, type DocumentInputOptions } from \"../core/discover.js\";\nimport { render, type ReportFormat } from \"../reporters/index.js\";\nimport { makeJudge } from \"../judge/judge.js\";\nimport {\n assertProviderSelection,\n makeProvider,\n selectProvider,\n} from \"../judge/provider.js\";\nimport type { InferenceProvider } from \"@hawkeyexl/inference\";\nimport { makeGenerateScripts } from \"../graders/scriptgen.js\";\nimport type { GenerateFn } from \"../core/engine.js\";\nimport { DocevalsError } from \"../types.js\";\nimport {\n isExecutionGrant,\n unknownGrantsMessage,\n type ExecutionGrant,\n} from \"../../shared/execution.js\";\nimport { warn } from \"../../shared/warn.js\";\n\nexport interface RunCommandOptions extends DocumentInputOptions {\n format?: ReportFormat;\n deterministicOnly?: boolean;\n aiOnly?: boolean;\n /**\n * Run only these execution grants, of those the config holds. Absent keeps\n * every grant `execution.allow` holds, which is every grant by default.\n */\n allowExecution?: string[];\n /** `false` clears every grant for this run. */\n execution?: boolean;\n generate?: boolean;\n cache?: boolean;\n failOnReview?: boolean;\n provider?: string;\n model?: string;\n /** Run inference on this machine, with llama-cpp, over any configured or eval-level provider. */\n local?: boolean;\n runs?: number;\n chunkChars?: number;\n maxTurns?: number;\n evalNames?: string[];\n suite?: string;\n /** Evaluate only pages that differ between this git ref and HEAD (ADR 01040). */\n since?: string;\n /**\n * Evaluate only pages whose file or eval manifest changed within this\n * duration back from now, such as `7d`. With `since`, a page must satisfy both.\n */\n newerThan?: string;\n baseline?: string | boolean;\n writeBaseline?: string | boolean;\n toolVersion?: string;\n cwd?: string;\n}\n\n/**\n * Grants, checked rather than asserted.\n *\n * The CLI validates in `collectGrant`, but this is also the entry point for\n * programmatic callers. An unknown grant that silently matched nothing would\n * narrow the run to no grant at all: every command eval skipped, exit 0, which\n * reads as a clean corpus rather than a misspelled grant.\n */\nfunction asGrants(values: string[] | undefined): ExecutionGrant[] | undefined {\n if (values === undefined) return undefined;\n const unknown = values.filter((v) => !isExecutionGrant(v));\n if (unknown.length > 0) {\n throw new DocevalsError(unknownGrantsMessage(unknown));\n }\n return values as ExecutionGrant[];\n}\n\nexport async function runRun(\n paths: string[],\n options: RunCommandOptions = {},\n engineOverrides: Partial<RunOptions> = {},\n): Promise<EngineReport> {\n const cwd = options.cwd ?? process.cwd();\n const judgeOptions = {\n provider: options.provider,\n model: options.model,\n local: options.local,\n runs: options.runs,\n chunkChars: options.chunkChars,\n noCache: options.cache === false,\n maxTurns: options.maxTurns ?? null,\n };\n\n // Loaded once and passed through to the engine — a run must not validate\n // the config twice or observe two different versions of it.\n const config: DocevalsConfig = loadRunConfig(runConfigOptions(paths, options), cwd);\n\n // A selection that cannot be right is a usage error, exit 2, whatever else\n // the run was asked to do: an unknown name or a model with no provider to\n // own it is a typo to fix, not a missing provider to degrade around.\n assertProviderSelection(selectProvider(config, judgeOptions));\n\n // Build the judge and generation stages unless deterministic-only or an\n // override supplies them. Both share one provider, resolved at most once.\n let judge: JudgeFn | undefined;\n let generateScripts: GenerateFn | undefined;\n let resolving: Promise<InferenceProvider> | undefined;\n const provider = (): Promise<InferenceProvider> =>\n (resolving ??= makeProvider(config, judgeOptions));\n // Per key, not per pair: an override supplying `judge` but not\n // `generateScripts` used to resolve a provider and build a judge that the\n // spread below then threw away.\n const wantsJudge = !(\"judge\" in engineOverrides);\n const wantsGeneration = !(\"generateScripts\" in engineOverrides);\n if (wantsJudge || wantsGeneration) {\n if (!options.deterministicOnly) {\n try {\n const resolved = await provider();\n if (wantsJudge) judge = makeJudge({ provider: resolved, root: cwd });\n if (wantsGeneration && options.generate !== false) {\n generateScripts = makeGenerateScripts({ provider: resolved, root: cwd });\n }\n } catch (e) {\n if (options.aiOnly || !(e instanceof DocevalsError)) throw e;\n // The warning is about the *judge*, and only the judge (ADR 01043).\n //\n // It used to read `|| options.generate === true`, meaning to fire when\n // generation had been explicitly requested. Commander cannot express\n // that: there is no `--generate` flag, so it defaults a `--no-generate`\n // key to `true` and the clause held on every invocation that was not\n // `--no-generate`. The only silent combination was the accidental\n // `--deterministic-only --no-generate`, and the standard no-key CI run\n // warned about the provider it had just been told to skip.\n warn(`provider unavailable — ${e.message}. Running deterministic evals only.`);\n }\n } else if (wantsGeneration && options.generate !== false) {\n // No judge, so the provider is wanted only if the corpus holds a command\n // eval with no command, which is not knowable here. It is resolved when\n // generation first needs it, so a deterministic run never detects a\n // provider — never probes the machine, never spawns the Claude CLI — to\n // generate nothing. Generation's own need for a provider it cannot have\n // is reported by the engine, where it is, as an `error` result naming\n // the eval and exiting 1.\n generateScripts = makeGenerateScripts({ provider, root: cwd });\n }\n }\n\n return runEvals({\n judge,\n generateScripts,\n config,\n configPath: options.config,\n noConfig: options.noConfig,\n paths,\n collection: options.collection,\n exclude: options.exclude,\n cwd: options.cwd,\n deterministicOnly: options.deterministicOnly,\n aiOnly: options.aiOnly,\n allowExecution: asGrants(options.allowExecution),\n execution: options.execution,\n generate: options.generate,\n failOnReview: options.failOnReview,\n evalNames: options.evalNames,\n suite: options.suite,\n since: options.since,\n newerThan: options.newerThan,\n baseline: options.baseline,\n writeBaseline: options.writeBaseline,\n toolVersion: options.toolVersion,\n judgeOptions,\n ...engineOverrides,\n });\n}\n\nexport { render };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;;;ACjBP;AAAA,EACE,SAAW;AAAA,EACX,KAAO;AAAA,EACP,OAAS;AAAA,EACT,MAAQ;AAAA,EACR,UAAY,CAAC,SAAS,YAAY,SAAS,cAAc,WAAW;AAAA,EACpE,YAAc;AAAA,IACZ,OAAS;AAAA,MACP,MAAQ;AAAA,MACR,aAAe;AAAA,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S,QAAQ;AAAA,IACjB,KAAK,QAAQ;AAAA,IACb,mBAAmB,QAAQ;AAAA,IAC3B,QAAQ,QAAQ;AAAA,IAChB,gBAAgB,SAAS,QAAQ,cAAc;AAAA,IAC/C,WAAW,QAAQ;AAAA,IACnB,UAAU,QAAQ;AAAA,IAClB,cAAc,QAAQ;AAAA,IACtB,WAAW,QAAQ;AAAA,IACnB,OAAO,QAAQ;AAAA,IACf,OAAO,QAAQ;AAAA,IACf,WAAW,QAAQ;AAAA,IACnB,UAAU,QAAQ;AAAA,IAClB,eAAe,QAAQ;AAAA,IACvB,aAAa,QAAQ;AAAA,IACrB;AAAA,IACA,GAAG;AAAA,EACL,CAAC;AACH;","names":["selectProvider","providerSpecFor","selectProvider","mkdirSync","readFileSync","writeFileSync","dirname","join","resolve","doc","block","META_PROVENANCE_KEY","join","dirname","dir","resolve","scriptAbsPath","join","rel","mkdirSync","writeFileSync","readFileSync","selectProvider"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/meta/core/page-view.ts","../src/meta/core/declared-at.ts"],"sourcesContent":["/**\n * A page as `manni meta validate` reads it, for a sibling tool that reads\n * pages without validating them (proposals 0074 and 0051: `manni graph`).\n *\n * Three answers come from one load of meta's section of the run's config:\n *\n * - the schema set meta resolves for each page, which is where\n * `x-manni-graph-output` is read from;\n * - the page's metadata with every key an external-metadata manifest of its\n * collections owns merged in (proposals 0037, 0041, 0058 and 0068), through\n * `mergeWithMarks`, the merge every meta command uses;\n * - where one key of one page is written (proposal 0047), through `keyHome`,\n * the rule `manni meta fill` follows.\n *\n * `noConfig` is meta's `--no-config`: the default schema set, no collections,\n * and so no manifest. A `{page}` manifest is declared in a collection like any\n * other, so it is not read without a config either, exactly as meta reads it.\n */\nimport type { ExtractedMetadata } from \"../types.js\";\nimport { memberOf } from \"./collections.js\";\nimport { loadMetaSection, schemaTrustRoot } from \"./config.js\";\nimport { lazyKey } from \"./encrypted.js\";\nimport {\n loadExternalMetadata,\n mergeWithMarks,\n type MarkedMerge,\n} from \"./external-metadata.js\";\nimport {\n marksValidator,\n pageMarks,\n pageSchemaSet,\n type PageMarksOptions,\n} from \"./page-marks.js\";\nimport { keyHome, type KeyHome, type RelocationContext } from \"./relocation.js\";\nimport { rebaseConfigSchemaRefs } from \"./resolve-schema.js\";\nimport type { Validator } from \"./validator.js\";\n\n/** What a sibling run reads a page through. Labels are relative to `cwd`. */\nexport interface MetaPageView {\n /** Built the way `validate` builds its own, over the same config. */\n validator: Validator;\n /**\n * The set for one page, by `$schema`, override, `schemas:`, `strict` and\n * the default set. Throws a `DocmetaError` when the page's own `$schema` is\n * refused.\n */\n refsFor(label: string, data: Readonly<Record<string, unknown>>): string[];\n /**\n * The page's metadata with every value its manifests supply, merged the\n * way `validate` merges it. A page in no collection, and every page of a\n * run with no manifest, comes back as it went in. Throws a `DocmetaError`\n * for a manifest meta refuses.\n */\n merge(label: string, extracted: ExtractedMetadata): Promise<MarkedMerge>;\n /**\n * Where `key` of the page is written: the owning manifest with the page's\n * entry, a URL manifest, or the page itself (`unowned`). `data` is the\n * page's own metadata, for a field join.\n */\n home(label: string, data: Readonly<Record<string, unknown>>, key: string): Promise<KeyHome>;\n}\n\n/**\n * A `MetaPageView` over meta's section of the config a sibling run is under.\n * `configPath` reads meta's section of that file, which a file with no family\n * key does not have. With neither it nor `noConfig`, meta's own discovery\n * finds the config, as `manni meta validate` would.\n *\n * `pages` are the run's documents as absolute paths. A `{page}` manifest\n * (proposal 0058) is read for exactly these.\n */\nexport async function metaPageView(opts: {\n cwd: string;\n configPath?: string;\n noConfig?: boolean;\n pages?: readonly string[];\n}): Promise<MetaPageView> {\n const { cwd } = opts;\n const loaded = opts.noConfig === true ? null : await loadMetaSection(opts.configPath, cwd);\n const config = loaded ? rebaseConfigSchemaRefs(loaded.config, loaded.dir, cwd) : null;\n const configDir = loaded?.dir ?? cwd;\n const collections = loaded?.collections ?? [];\n const validator = marksValidator({\n config,\n cwd,\n ...(loaded ? { configDir: loaded.dir } : {}),\n })();\n const marksOptions: PageMarksOptions = {\n validator,\n config,\n cwd,\n trustRoot: schemaTrustRoot(cwd, loaded?.dir),\n };\n const membersOf = (label: string): string[] => memberOf(collections, configDir, cwd, label);\n\n const index = await loadExternalMetadata(collections, {\n configDir,\n base: cwd,\n offline: config?.offline ?? false,\n ...(opts.pages === undefined ? {} : { pages: opts.pages }),\n });\n // Only an encrypted join field is decrypted, to match its manifest entry\n // (proposal 0045). Every other value is merged as the page holds it.\n const joinKey = lazyKey(loaded?.configFile, undefined);\n const marks = pageMarks(marksOptions);\n\n const ctx: RelocationContext = {\n cwd,\n base: cwd,\n noConfig: loaded === null,\n config,\n ...(loaded ? { configDir: loaded.dir, configPath: loaded.path } : {}),\n ...(loaded?.configFile !== undefined ? { configFile: loaded.configFile } : {}),\n collections,\n declaredCollections: collections,\n targets: [],\n validator,\n };\n\n return {\n validator,\n refsFor: (label, data) => pageSchemaSet(marksOptions, label, data, membersOf(label)),\n merge: (label, extracted) =>\n mergeWithMarks(label, extracted, index, membersOf(label), cwd, {\n encryptionKey: joinKey,\n marks,\n }),\n home: (label, data, key) => keyHome(ctx, label, data, key),\n };\n}\n","/**\n * Where one value of a document's merged metadata was written.\n *\n * A document's metadata is its own block plus whatever a collection's\n * manifest supplies (proposal 0037). The merge's `locate` answers for a value\n * a manifest supplied, and the extractor's `lineFor` for a value the document\n * carries. A sibling tool that points a result at the entry declaring it asks\n * here, so \"which file, which line\" is decided once.\n */\nimport type { ExtractedMetadata } from \"../types.js\";\nimport type { SourceLocation } from \"./external-metadata.js\";\n\n/** A file, and the 1-based line in it when one is known. */\nexport interface DeclaredAt {\n file: string;\n line?: number;\n}\n\n/** A document's metadata as the merge left it. */\nexport interface LocatedMetadata {\n extracted: Pick<ExtractedMetadata, \"lineFor\" | \"present\">;\n /** The merge's `locate`. Absent when no manifest was read for the document. */\n locate?: (pointer: string) => SourceLocation | undefined;\n}\n\n/**\n * The file and line behind `pointer`. A manifest-supplied value names the\n * manifest, with its line when the manifest recorded one. Anything else names\n * `label`, the document, with the line its own block gives. A document with no\n * block gives no line: one would be invented.\n */\nexport function declaredAt(\n label: string,\n pointer: string,\n metadata: LocatedMetadata,\n): DeclaredAt {\n const at = metadata.locate?.(pointer);\n if (at !== undefined) {\n return { file: at.file, ...(at.line === undefined ? {} : { line: at.line }) };\n }\n if (!metadata.extracted.present) return { file: label };\n const line = metadata.extracted.lineFor(pointer);\n return { file: label, ...(line === undefined ? {} : { line }) };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuEA,eAAsB,aAAa,MAKT;AACxB,QAAM,EAAE,IAAI,IAAI;AAChB,QAAM,SAAS,KAAK,aAAa,OAAO,OAAO,MAAM,gBAAgB,KAAK,YAAY,GAAG;AACzF,QAAM,SAAS,SAAS,uBAAuB,OAAO,QAAQ,OAAO,KAAK,GAAG,IAAI;AACjF,QAAM,YAAY,QAAQ,OAAO;AACjC,QAAM,cAAc,QAAQ,eAAe,CAAC;AAC5C,QAAM,YAAY,eAAe;AAAA,IAC/B;AAAA,IACA;AAAA,IACA,GAAI,SAAS,EAAE,WAAW,OAAO,IAAI,IAAI,CAAC;AAAA,EAC5C,CAAC,EAAE;AACH,QAAM,eAAiC;AAAA,IACrC;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,gBAAgB,KAAK,QAAQ,GAAG;AAAA,EAC7C;AACA,QAAM,YAAY,CAAC,UAA4B,SAAS,aAAa,WAAW,KAAK,KAAK;AAE1F,QAAM,QAAQ,MAAM,qBAAqB,aAAa;AAAA,IACpD;AAAA,IACA,MAAM;AAAA,IACN,SAAS,QAAQ,WAAW;AAAA,IAC5B,GAAI,KAAK,UAAU,SAAY,CAAC,IAAI,EAAE,OAAO,KAAK,MAAM;AAAA,EAC1D,CAAC;AAGD,QAAM,UAAU,QAAQ,QAAQ,YAAY,MAAS;AACrD,QAAM,QAAQ,UAAU,YAAY;AAEpC,QAAM,MAAyB;AAAA,IAC7B;AAAA,IACA,MAAM;AAAA,IACN,UAA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