@hawkeyexl/manni 4.13.0 → 4.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/README.md +1 -1
  2. package/dist/batch-TKNIUBLK.js +48 -0
  3. package/dist/build-6G7PEAG4.js +37 -0
  4. package/dist/calibrate-BDCXDZV5.js +43 -0
  5. package/dist/capture-NQJLZD66.js +39 -0
  6. package/dist/check-552X5I2J.js +36 -0
  7. package/dist/{check-LU5YC3L4.js → check-5HMDJOFP.js} +15 -14
  8. package/dist/check-BSB4FF4L.js +33 -0
  9. package/dist/{check-NBN2YK2J.js → check-QIZCTAIR.js} +33 -32
  10. package/dist/{check-NBN2YK2J.js.map → check-QIZCTAIR.js.map} +1 -1
  11. package/dist/{chunk-NSAW7U42.js → chunk-2A6XYSXO.js} +58 -10
  12. package/dist/chunk-2A6XYSXO.js.map +1 -0
  13. package/dist/{chunk-PA7CMQGD.js → chunk-2HQSMZ4N.js} +11 -5
  14. package/dist/chunk-2HQSMZ4N.js.map +1 -0
  15. package/dist/{chunk-LNGSE7V2.js → chunk-36FJWJSK.js} +132 -27
  16. package/dist/chunk-36FJWJSK.js.map +1 -0
  17. package/dist/{chunk-BMBAAPGN.js → chunk-3BMTCS4H.js} +33 -18
  18. package/dist/chunk-3BMTCS4H.js.map +1 -0
  19. package/dist/{chunk-NWUXRV6N.js → chunk-3CCY7M3R.js} +10 -8
  20. package/dist/chunk-3CCY7M3R.js.map +1 -0
  21. package/dist/{chunk-TDCOKKMI.js → chunk-3MTZZJKH.js} +3 -3
  22. package/dist/chunk-4U3X7LYV.js +236 -0
  23. package/dist/chunk-4U3X7LYV.js.map +1 -0
  24. package/dist/{chunk-OYIWF3B2.js → chunk-56URKBXQ.js} +17 -17
  25. package/dist/chunk-56URKBXQ.js.map +1 -0
  26. package/dist/{chunk-IGQMBHFY.js → chunk-66MKBRTA.js} +88 -12
  27. package/dist/chunk-66MKBRTA.js.map +1 -0
  28. package/dist/{chunk-GWI6JPTT.js → chunk-6VT3Z352.js} +24 -7
  29. package/dist/chunk-6VT3Z352.js.map +1 -0
  30. package/dist/{chunk-CU57HT2E.js → chunk-6WJUZQQX.js} +2 -2
  31. package/dist/{chunk-NTEYYYKL.js → chunk-6XFSZCLT.js} +16 -22
  32. package/dist/chunk-6XFSZCLT.js.map +1 -0
  33. package/dist/{chunk-OREHJQNN.js → chunk-742G2QCV.js} +4 -3
  34. package/dist/{chunk-OREHJQNN.js.map → chunk-742G2QCV.js.map} +1 -1
  35. package/dist/chunk-7AXJY4FX.js +83 -0
  36. package/dist/chunk-7AXJY4FX.js.map +1 -0
  37. package/dist/{chunk-EQ7E6HMG.js → chunk-7KOWE4F4.js} +14 -16
  38. package/dist/chunk-7KOWE4F4.js.map +1 -0
  39. package/dist/{chunk-J5NOWIJ3.js → chunk-7PENJOI6.js} +14 -8
  40. package/dist/{chunk-J5NOWIJ3.js.map → chunk-7PENJOI6.js.map} +1 -1
  41. package/dist/chunk-7WVWGULD.js +81 -0
  42. package/dist/chunk-7WVWGULD.js.map +1 -0
  43. package/dist/{chunk-VYBYUQIP.js → chunk-A7MNH4YI.js} +88 -7
  44. package/dist/chunk-A7MNH4YI.js.map +1 -0
  45. package/dist/{chunk-WVXCN5DS.js → chunk-AJYUJ37M.js} +65 -8
  46. package/dist/chunk-AJYUJ37M.js.map +1 -0
  47. package/dist/{chunk-OTJOBZJ5.js → chunk-B2242FYO.js} +2 -1
  48. package/dist/chunk-B2242FYO.js.map +1 -0
  49. package/dist/{chunk-YZ4TJLZQ.js → chunk-B6GUSA53.js} +15 -10
  50. package/dist/chunk-B6GUSA53.js.map +1 -0
  51. package/dist/{chunk-PCGBXHSE.js → chunk-BA4TCCOO.js} +5 -5
  52. package/dist/{chunk-TQ3W6RKG.js → chunk-BAWKNF6U.js} +3 -3
  53. package/dist/{chunk-HY6ROJTH.js → chunk-BIRGZEWO.js} +86 -10
  54. package/dist/chunk-BIRGZEWO.js.map +1 -0
  55. package/dist/chunk-BREAC43H.js +85 -0
  56. package/dist/chunk-BREAC43H.js.map +1 -0
  57. package/dist/{chunk-YQV75FIL.js → chunk-CFMI74TP.js} +3 -3
  58. package/dist/{chunk-OUAH7XF2.js → chunk-CZJNYHK7.js} +2 -2
  59. package/dist/{chunk-52WO7ESI.js → chunk-D2TIZOMN.js} +6 -5
  60. package/dist/chunk-D2TIZOMN.js.map +1 -0
  61. package/dist/{chunk-VOXOBUTX.js → chunk-EXAZ7K25.js} +5 -5
  62. package/dist/{chunk-BQXY76JB.js → chunk-GHZAOPGK.js} +148 -92
  63. package/dist/chunk-GHZAOPGK.js.map +1 -0
  64. package/dist/{chunk-UQMLCIRX.js → chunk-HGU4FDRY.js} +6 -6
  65. package/dist/{chunk-ZXRAE55H.js → chunk-IGRXQC3H.js} +2 -2
  66. package/dist/{chunk-3BVDFQ6Y.js → chunk-IOYEPB27.js} +5 -5
  67. package/dist/{chunk-U6IHLEWT.js → chunk-JCTHXG33.js} +2 -2
  68. package/dist/{chunk-6ZFJWUUH.js → chunk-JNMY7KZG.js} +2 -2
  69. package/dist/{chunk-OBXCJZ6R.js → chunk-JTEWU4C6.js} +26 -16
  70. package/dist/chunk-JTEWU4C6.js.map +1 -0
  71. package/dist/{chunk-VNYXK7TM.js → chunk-JWBS7YDI.js} +8 -8
  72. package/dist/chunk-JWBS7YDI.js.map +1 -0
  73. package/dist/{chunk-ULDV2LUI.js → chunk-LCRBR7KW.js} +10 -4
  74. package/dist/chunk-LCRBR7KW.js.map +1 -0
  75. package/dist/{chunk-3HUCB4Z3.js → chunk-M43NTWVH.js} +10 -7
  76. package/dist/chunk-M43NTWVH.js.map +1 -0
  77. package/dist/chunk-M534DYAJ.js +76 -0
  78. package/dist/chunk-M534DYAJ.js.map +1 -0
  79. package/dist/chunk-MC7U5IH4.js +126 -0
  80. package/dist/chunk-MC7U5IH4.js.map +1 -0
  81. package/dist/{chunk-7JPL3CUC.js → chunk-MIGFQP5N.js} +2 -2
  82. package/dist/{chunk-TZOYZK2E.js → chunk-OZUPJB4J.js} +2 -2
  83. package/dist/{chunk-X4MPUD4B.js → chunk-QEZQ7MGH.js} +53 -13
  84. package/dist/chunk-QEZQ7MGH.js.map +1 -0
  85. package/dist/{chunk-DQOM3DEU.js → chunk-QF7EIRMU.js} +29 -23
  86. package/dist/chunk-QF7EIRMU.js.map +1 -0
  87. package/dist/chunk-QK6VYJHV.js +26 -0
  88. package/dist/chunk-QK6VYJHV.js.map +1 -0
  89. package/dist/chunk-QS2Z3SWL.js +21 -0
  90. package/dist/chunk-QS2Z3SWL.js.map +1 -0
  91. package/dist/{chunk-OKMTUAWO.js → chunk-QSPH4F56.js} +5 -5
  92. package/dist/{chunk-JUL2PRQN.js → chunk-STM3G7WJ.js} +207 -79
  93. package/dist/chunk-STM3G7WJ.js.map +1 -0
  94. package/dist/{chunk-HKTGHLBA.js → chunk-T3BBNLAT.js} +2 -2
  95. package/dist/{chunk-HKTGHLBA.js.map → chunk-T3BBNLAT.js.map} +1 -1
  96. package/dist/{chunk-SCLXVTFZ.js → chunk-TKINOTVS.js} +1 -1
  97. package/dist/chunk-TKINOTVS.js.map +1 -0
  98. package/dist/{chunk-E6BVUDGY.js → chunk-USKTLEPZ.js} +4 -4
  99. package/dist/{chunk-LSFXNAHU.js → chunk-V6OCE4ND.js} +129 -59
  100. package/dist/chunk-V6OCE4ND.js.map +1 -0
  101. package/dist/{chunk-N6A6DJUO.js → chunk-VBBJGFME.js} +6 -7
  102. package/dist/chunk-VBBJGFME.js.map +1 -0
  103. package/dist/{chunk-CWXZ2MRT.js → chunk-VHJ72YCD.js} +4 -3
  104. package/dist/chunk-VHJ72YCD.js.map +1 -0
  105. package/dist/{chunk-PAU352SV.js → chunk-W4GTMOJW.js} +2 -2
  106. package/dist/{chunk-JEUFYSFQ.js → chunk-W5DO426O.js} +114 -70
  107. package/dist/chunk-W5DO426O.js.map +1 -0
  108. package/dist/{chunk-3O6U4ICM.js → chunk-W6B24IMO.js} +3 -3
  109. package/dist/{chunk-SE4JN5XN.js → chunk-WDENIUC7.js} +3 -1
  110. package/dist/chunk-WDENIUC7.js.map +1 -0
  111. package/dist/{chunk-KE2F7QES.js → chunk-WIPTWZVH.js} +6 -6
  112. package/dist/{chunk-7RNONVHI.js → chunk-Y36PNW6J.js} +9 -9
  113. package/dist/{chunk-QKT67PFE.js → chunk-Y37VJFX2.js} +9 -9
  114. package/dist/{chunk-3XGTNN3M.js → chunk-YJ3EG2D5.js} +12 -124
  115. package/dist/chunk-YJ3EG2D5.js.map +1 -0
  116. package/dist/{chunk-UKZNLVJW.js → chunk-ZINZTHWO.js} +4 -2
  117. package/dist/chunk-ZINZTHWO.js.map +1 -0
  118. package/dist/{chunk-CODWRUAD.js → chunk-ZPLIXZZ6.js} +7 -5
  119. package/dist/chunk-ZPLIXZZ6.js.map +1 -0
  120. package/dist/{chunk-HIEGOW7X.js → chunk-ZRQUQS7P.js} +5 -79
  121. package/dist/chunk-ZRQUQS7P.js.map +1 -0
  122. package/dist/{cli-KYTCJYXK.js → cli-5XKHMRZ5.js} +317 -28
  123. package/dist/cli-5XKHMRZ5.js.map +1 -0
  124. package/dist/{cli-DGFLJ2DD.js → cli-7QHJW5GH.js} +69 -26
  125. package/dist/cli-7QHJW5GH.js.map +1 -0
  126. package/dist/{cli-7DETHSNW.js → cli-BUV3DRUH.js} +29 -83
  127. package/dist/cli-BUV3DRUH.js.map +1 -0
  128. package/dist/{cli-RP5E7XHC.js → cli-IKDX2I5X.js} +20 -18
  129. package/dist/{cli-RP5E7XHC.js.map → cli-IKDX2I5X.js.map} +1 -1
  130. package/dist/{cli-H5LVGOVT.js → cli-LOND37OA.js} +383 -247
  131. package/dist/cli-LOND37OA.js.map +1 -0
  132. package/dist/{cli-AZKWTCFV.js → cli-O6Y2KVWD.js} +11 -11
  133. package/dist/{cli-BW5VOFOZ.js → cli-QTLOAVOY.js} +11 -10
  134. package/dist/{cli-BW5VOFOZ.js.map → cli-QTLOAVOY.js.map} +1 -1
  135. package/dist/{cli-G66X7YMP.js → cli-SOA2E26G.js} +23 -22
  136. package/dist/{cli-G66X7YMP.js.map → cli-SOA2E26G.js.map} +1 -1
  137. package/dist/{cli-ECVT4YXR.js → cli-VQYB3663.js} +19 -18
  138. package/dist/{cli-ECVT4YXR.js.map → cli-VQYB3663.js.map} +1 -1
  139. package/dist/{cli-L5B2RVV2.js → cli-X6IWTDFK.js} +31 -29
  140. package/dist/{cli-L5B2RVV2.js.map → cli-X6IWTDFK.js.map} +1 -1
  141. package/dist/{cli-4JHQCPHU.js → cli-XAT673VB.js} +3 -3
  142. package/dist/cli.js +14 -14
  143. package/dist/{config-JJW75SBX.js → config-7I5CHHRZ.js} +6 -6
  144. package/dist/docmeta.js +10 -10
  145. package/dist/github-IPBOTQBN.js +36 -0
  146. package/dist/github-XM36D7ZH.js +32 -0
  147. package/dist/graph/runtime.js.map +1 -1
  148. package/dist/index.d.ts +92 -20
  149. package/dist/index.js +137 -131
  150. package/dist/index.js.map +1 -1
  151. package/dist/{json-LCVPMEAM.js → json-225TND7K.js} +15 -13
  152. package/dist/{labels-OQXBVM4A.js → labels-CTLHIRC4.js} +14 -12
  153. package/dist/{labels-OQXBVM4A.js.map → labels-CTLHIRC4.js.map} +1 -1
  154. package/dist/lint-NP3PC3SO.js +35 -0
  155. package/dist/list-JJGNKO6S.js +36 -0
  156. package/dist/list-Q457TIMA.js +34 -0
  157. package/dist/{page-XPX5XJZE.js → page-FJW7J2EU.js} +13 -12
  158. package/dist/{picker-3XF36MJF.js → picker-FPUC5UGM.js} +3 -3
  159. package/dist/{prepare-VMBIQYAM.js → prepare-RKJEKHAG.js} +21 -20
  160. package/dist/{prepare-VMBIQYAM.js.map → prepare-RKJEKHAG.js.map} +1 -1
  161. package/dist/{pretty-KG6TMOEI.js → pretty-ECBO3EVT.js} +15 -14
  162. package/dist/{pretty-KSTZMBUF.js → pretty-QFEN2SIA.js} +15 -13
  163. package/dist/{provider-LBX4IXGX.js → provider-JY2I3VLF.js} +3 -3
  164. package/dist/{release-VV3UTKE5.js → release-Z3ASYZ3S.js} +3 -3
  165. package/dist/{reporters-FBYLPKD4.js → reporters-IKKL5RHS.js} +15 -14
  166. package/dist/{reporters-26H3N2KW.js → reporters-TDQDQHKE.js} +6 -5
  167. package/dist/{reporters-AQU4W3KY.js → reporters-WGLQKW2Y.js} +6 -6
  168. package/dist/run-BTETGGLW.js +39 -0
  169. package/dist/sarif-K4SMB563.js +31 -0
  170. package/dist/sarif-ZHFK6PZY.js +37 -0
  171. package/dist/{term-SI3VM6EM.js → term-2M7APX2A.js} +58 -109
  172. package/dist/term-2M7APX2A.js.map +1 -0
  173. package/dist/types-VMOT7RAL.js +12 -0
  174. package/dist/types-VMOT7RAL.js.map +1 -0
  175. package/dist/{validate-NQO7TFSN.js → validate-GBM5STKS.js} +6 -6
  176. package/dist/validate-GBM5STKS.js.map +1 -0
  177. package/package.json +1 -1
  178. package/plugin/manni/.claude-plugin/plugin.json +1 -1
  179. package/plugin/manni/skills/check/SKILL.md +2 -2
  180. package/plugin/manni/skills/evals/SKILL.md +1 -1
  181. package/plugin/manni/skills/fix/SKILL.md +95 -16
  182. package/plugin/manni/skills/setup/SKILL.md +1 -1
  183. package/shapes/graph/shapes-1.1.1.ttl +953 -0
  184. package/dist/batch-OB2FXT47.js +0 -46
  185. package/dist/build-4BL24BG3.js +0 -36
  186. package/dist/calibrate-AEDJ7N7G.js +0 -41
  187. package/dist/capture-TP3P4YNL.js +0 -38
  188. package/dist/check-5IYH42KS.js +0 -34
  189. package/dist/check-S55MH66H.js +0 -30
  190. package/dist/chunk-3HUCB4Z3.js.map +0 -1
  191. package/dist/chunk-3XGTNN3M.js.map +0 -1
  192. package/dist/chunk-52WO7ESI.js.map +0 -1
  193. package/dist/chunk-BMBAAPGN.js.map +0 -1
  194. package/dist/chunk-BQXY76JB.js.map +0 -1
  195. package/dist/chunk-CODWRUAD.js.map +0 -1
  196. package/dist/chunk-CWXZ2MRT.js.map +0 -1
  197. package/dist/chunk-DQOM3DEU.js.map +0 -1
  198. package/dist/chunk-EQ7E6HMG.js.map +0 -1
  199. package/dist/chunk-GWI6JPTT.js.map +0 -1
  200. package/dist/chunk-HIEGOW7X.js.map +0 -1
  201. package/dist/chunk-HY6ROJTH.js.map +0 -1
  202. package/dist/chunk-IGQMBHFY.js.map +0 -1
  203. package/dist/chunk-JEUFYSFQ.js.map +0 -1
  204. package/dist/chunk-JUL2PRQN.js.map +0 -1
  205. package/dist/chunk-LNGSE7V2.js.map +0 -1
  206. package/dist/chunk-LSFXNAHU.js.map +0 -1
  207. package/dist/chunk-MNH7QO4Z.js +0 -15
  208. package/dist/chunk-MNH7QO4Z.js.map +0 -1
  209. package/dist/chunk-N6A6DJUO.js.map +0 -1
  210. package/dist/chunk-NSAW7U42.js.map +0 -1
  211. package/dist/chunk-NTEYYYKL.js.map +0 -1
  212. package/dist/chunk-NWUXRV6N.js.map +0 -1
  213. package/dist/chunk-OBXCJZ6R.js.map +0 -1
  214. package/dist/chunk-OTJOBZJ5.js.map +0 -1
  215. package/dist/chunk-OYIWF3B2.js.map +0 -1
  216. package/dist/chunk-PA7CMQGD.js.map +0 -1
  217. package/dist/chunk-SCLXVTFZ.js.map +0 -1
  218. package/dist/chunk-SE4JN5XN.js.map +0 -1
  219. package/dist/chunk-UKZNLVJW.js.map +0 -1
  220. package/dist/chunk-ULDV2LUI.js.map +0 -1
  221. package/dist/chunk-VNYXK7TM.js.map +0 -1
  222. package/dist/chunk-VYBYUQIP.js.map +0 -1
  223. package/dist/chunk-WVXCN5DS.js.map +0 -1
  224. package/dist/chunk-X4MPUD4B.js.map +0 -1
  225. package/dist/chunk-Y6M4JFKG.js +0 -117
  226. package/dist/chunk-Y6M4JFKG.js.map +0 -1
  227. package/dist/chunk-YZ4TJLZQ.js.map +0 -1
  228. package/dist/cli-7DETHSNW.js.map +0 -1
  229. package/dist/cli-DGFLJ2DD.js.map +0 -1
  230. package/dist/cli-H5LVGOVT.js.map +0 -1
  231. package/dist/cli-KYTCJYXK.js.map +0 -1
  232. package/dist/github-DJQ4MWNZ.js +0 -35
  233. package/dist/github-UWTDM2J2.js +0 -30
  234. package/dist/lint-O7XRHKFP.js +0 -34
  235. package/dist/list-OOOCLOAL.js +0 -35
  236. package/dist/list-OYQ5XPN2.js +0 -32
  237. package/dist/run-KUGTU3TT.js +0 -37
  238. package/dist/term-SI3VM6EM.js.map +0 -1
  239. package/dist/types-Y6TXHM7M.js +0 -10
  240. /package/dist/{batch-OB2FXT47.js.map → batch-TKNIUBLK.js.map} +0 -0
  241. /package/dist/{build-4BL24BG3.js.map → build-6G7PEAG4.js.map} +0 -0
  242. /package/dist/{calibrate-AEDJ7N7G.js.map → calibrate-BDCXDZV5.js.map} +0 -0
  243. /package/dist/{capture-TP3P4YNL.js.map → capture-NQJLZD66.js.map} +0 -0
  244. /package/dist/{check-5IYH42KS.js.map → check-552X5I2J.js.map} +0 -0
  245. /package/dist/{check-LU5YC3L4.js.map → check-5HMDJOFP.js.map} +0 -0
  246. /package/dist/{check-S55MH66H.js.map → check-BSB4FF4L.js.map} +0 -0
  247. /package/dist/{chunk-TDCOKKMI.js.map → chunk-3MTZZJKH.js.map} +0 -0
  248. /package/dist/{chunk-CU57HT2E.js.map → chunk-6WJUZQQX.js.map} +0 -0
  249. /package/dist/{chunk-PCGBXHSE.js.map → chunk-BA4TCCOO.js.map} +0 -0
  250. /package/dist/{chunk-TQ3W6RKG.js.map → chunk-BAWKNF6U.js.map} +0 -0
  251. /package/dist/{chunk-YQV75FIL.js.map → chunk-CFMI74TP.js.map} +0 -0
  252. /package/dist/{chunk-OUAH7XF2.js.map → chunk-CZJNYHK7.js.map} +0 -0
  253. /package/dist/{chunk-VOXOBUTX.js.map → chunk-EXAZ7K25.js.map} +0 -0
  254. /package/dist/{chunk-UQMLCIRX.js.map → chunk-HGU4FDRY.js.map} +0 -0
  255. /package/dist/{chunk-ZXRAE55H.js.map → chunk-IGRXQC3H.js.map} +0 -0
  256. /package/dist/{chunk-3BVDFQ6Y.js.map → chunk-IOYEPB27.js.map} +0 -0
  257. /package/dist/{chunk-U6IHLEWT.js.map → chunk-JCTHXG33.js.map} +0 -0
  258. /package/dist/{chunk-6ZFJWUUH.js.map → chunk-JNMY7KZG.js.map} +0 -0
  259. /package/dist/{chunk-7JPL3CUC.js.map → chunk-MIGFQP5N.js.map} +0 -0
  260. /package/dist/{chunk-TZOYZK2E.js.map → chunk-OZUPJB4J.js.map} +0 -0
  261. /package/dist/{chunk-OKMTUAWO.js.map → chunk-QSPH4F56.js.map} +0 -0
  262. /package/dist/{chunk-E6BVUDGY.js.map → chunk-USKTLEPZ.js.map} +0 -0
  263. /package/dist/{chunk-PAU352SV.js.map → chunk-W4GTMOJW.js.map} +0 -0
  264. /package/dist/{chunk-3O6U4ICM.js.map → chunk-W6B24IMO.js.map} +0 -0
  265. /package/dist/{chunk-KE2F7QES.js.map → chunk-WIPTWZVH.js.map} +0 -0
  266. /package/dist/{chunk-7RNONVHI.js.map → chunk-Y36PNW6J.js.map} +0 -0
  267. /package/dist/{chunk-QKT67PFE.js.map → chunk-Y37VJFX2.js.map} +0 -0
  268. /package/dist/{cli-AZKWTCFV.js.map → cli-O6Y2KVWD.js.map} +0 -0
  269. /package/dist/{cli-4JHQCPHU.js.map → cli-XAT673VB.js.map} +0 -0
  270. /package/dist/{config-JJW75SBX.js.map → config-7I5CHHRZ.js.map} +0 -0
  271. /package/dist/{github-DJQ4MWNZ.js.map → github-IPBOTQBN.js.map} +0 -0
  272. /package/dist/{github-UWTDM2J2.js.map → github-XM36D7ZH.js.map} +0 -0
  273. /package/dist/{json-LCVPMEAM.js.map → json-225TND7K.js.map} +0 -0
  274. /package/dist/{lint-O7XRHKFP.js.map → lint-NP3PC3SO.js.map} +0 -0
  275. /package/dist/{list-OOOCLOAL.js.map → list-JJGNKO6S.js.map} +0 -0
  276. /package/dist/{list-OYQ5XPN2.js.map → list-Q457TIMA.js.map} +0 -0
  277. /package/dist/{page-XPX5XJZE.js.map → page-FJW7J2EU.js.map} +0 -0
  278. /package/dist/{picker-3XF36MJF.js.map → picker-FPUC5UGM.js.map} +0 -0
  279. /package/dist/{pretty-KG6TMOEI.js.map → pretty-ECBO3EVT.js.map} +0 -0
  280. /package/dist/{pretty-KSTZMBUF.js.map → pretty-QFEN2SIA.js.map} +0 -0
  281. /package/dist/{provider-LBX4IXGX.js.map → provider-JY2I3VLF.js.map} +0 -0
  282. /package/dist/{release-VV3UTKE5.js.map → release-Z3ASYZ3S.js.map} +0 -0
  283. /package/dist/{reporters-26H3N2KW.js.map → reporters-IKKL5RHS.js.map} +0 -0
  284. /package/dist/{reporters-AQU4W3KY.js.map → reporters-TDQDQHKE.js.map} +0 -0
  285. /package/dist/{reporters-FBYLPKD4.js.map → reporters-WGLQKW2Y.js.map} +0 -0
  286. /package/dist/{run-KUGTU3TT.js.map → run-BTETGGLW.js.map} +0 -0
  287. /package/dist/{types-Y6TXHM7M.js.map → sarif-K4SMB563.js.map} +0 -0
  288. /package/dist/{validate-NQO7TFSN.js.map → sarif-ZHFK6PZY.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/shared/collections.ts","../src/shared/globs.ts","../src/shared/page-manifest.ts","../src/shared/encryption.ts","../src/shared/tools.ts","../src/shared/config-file.ts","../src/shared/git-root.ts"],"sourcesContent":["/**\n * `collections:`, the family-level home for document sets (proposal 0041).\n *\n * A collection names a set of documents once, at the top level of\n * `manni.config.yaml`, and every tool reads the same declaration: the metadata\n * tool validates its members, `query` exposes it as a view, and `a11y check`\n * seeds from its `url`. Only the *declaration* is shared. Loading a manifest\n * and merging it into `ExtractedMetadata` stays with the metadata tool,\n * because that type is the metadata tool's.\n *\n * Every refusal in this parser is a shape that would otherwise read as\n * configured and do nothing, or do something nobody can see. The manifest\n * rules are 0037's, moved here unchanged in substance: an entry with an empty\n * `keys` list owns nothing, one key under two manifests of a collection would need a\n * tiebreak (0020 refuses tiebreaks), and `$schema` from external metadata\n * would let a private file pick the schema a public document is judged by\n * (0015) with the provenance lost at the merge.\n */\nimport picomatch from \"picomatch\";\nimport { matchesFileGlob } from \"./globs.js\";\nimport { posix, win32 } from \"node:path\";\nimport {\n PAGE_PLACEHOLDER,\n hasPagePlaceholder,\n normalizeManifestPattern,\n} from \"./page-manifest.js\";\n\n/** One external-metadata manifest (proposals 0037, 0038, 0039) joined to a collection. */\nexport interface ExternalMetadataConfig {\n file: string;\n /**\n * The top-level keys the manifest owns. Absent (proposal 0068), it owns\n * what each page's schemas mark `x-manni-location: external`, as `ownsKey`\n * decides.\n */\n keys?: string[];\n tokenEnv?: string;\n join?: string;\n}\n\n/** One named document set, as declared under the top-level `collections:` key. */\nexport interface CollectionConfig {\n name: string;\n paths: string[];\n exclude: string[];\n externalMetadata: ExternalMetadataConfig[];\n /** Where the collection is published; `manni a11y check` seeds from it. */\n url?: string;\n}\n\nconst COLLECTION_KEYS = [\n \"name\",\n \"paths\",\n \"exclude\",\n \"url\",\n \"externalMetadata\",\n] as const;\n\nconst EXTERNAL_METADATA_KEYS = [\"file\", \"keys\", \"tokenEnv\", \"join\"] as const;\n\n/**\n * The join that names documents by path, and the default. The metadata tool\n * spells it `PATH_JOIN` in `src/meta/core/external-metadata.ts`; the literal\n * is repeated here for the same reason as `SCHEMA_KEY` below.\n */\nconst PATH_JOIN = \"path\";\n\n/**\n * The document-level schema key. The metadata tool spells it\n * `FILE_SCHEMA_KEY` in `src/meta/core/resolve-schema.ts`; the literal is\n * repeated here so the shared layer does not import a tool's module. Keep the\n * two in step.\n */\nconst SCHEMA_KEY = \"$schema\";\n\n/**\n * The label `load-files.ts` gives stdin (`STDIN_LABEL`). Repeated as a literal\n * for the same reason as `SCHEMA_KEY`: the shared layer does not depend on the\n * metadata tool. Stdin has no path, so it is a member of nothing.\n */\nconst STDIN = \"<stdin>\";\n\n/** Is this manifest reference a URL? The `url` branch of `classifyRef`. */\nfunction isUrlRef(ref: string): boolean {\n return /^https?:\\/\\//i.test(ref);\n}\n\n/**\n * Whether a URL may name an external-metadata manifest: `https://` anywhere,\n * or `http://` on a loopback host only, where plaintext leaks nothing.\n * Userinfo is refused because the URL is printed in every diagnostic and a\n * secret in it would print too. Returns the reason it may not, or `null`.\n */\nexport function externalMetadataUrlProblem(url: string): string | null {\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n return \"is not a valid URL\";\n }\n if (parsed.username !== \"\" || parsed.password !== \"\") {\n return 'carries a credential in the URL; put the token in an environment variable and name it with \"tokenEnv\"';\n }\n if (parsed.protocol === \"https:\") return null;\n if (parsed.protocol === \"http:\" && isLoopback(parsed.hostname)) return null;\n if (parsed.protocol === \"http:\") {\n return \"is plain http://; a bearer token over plaintext is a leak, and a public manifest is served over https too\";\n }\n return `has the unsupported scheme \"${parsed.protocol}\"`;\n}\n\nfunction isLoopback(host: string): boolean {\n return (\n host === \"localhost\" ||\n host === \"127.0.0.1\" ||\n host === \"[::1]\" ||\n host === \"::1\" ||\n host.startsWith(\"127.\")\n );\n}\n\nfunction rejectUnknownKeys(\n raw: Record<string, unknown>,\n allowed: readonly string[],\n where: string,\n source: string,\n toError: (message: string) => Error,\n): void {\n for (const key of Object.keys(raw)) {\n if (!allowed.includes(key)) {\n throw toError(\n `${source}: ${where} has unknown key \"${key}\". Supported keys: ${allowed.join(\", \")}.`,\n );\n }\n }\n}\n\nfunction isMapping(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isNonEmptyString(value: unknown): value is string {\n return typeof value === \"string\" && value.trim() !== \"\";\n}\n\n/**\n * Parse the top-level `collections:` value. Errors are built with `toError`,\n * so each tool reports a bad family file in its own error class.\n */\nexport function parseCollections(\n raw: unknown,\n source: string,\n toError: (message: string) => Error,\n): CollectionConfig[] {\n if (!Array.isArray(raw)) {\n throw toError(`${source}: \"collections\" must be a list.`);\n }\n if (raw.length === 0) {\n throw toError(\n `${source}: \"collections\" must name at least one collection; remove the key if there are none.`,\n );\n }\n // Names become SQL view names, and SQLite compares identifiers without\n // regard to case, so two names that differ only in case are one view.\n const taken = new Map<string, number>();\n return raw.map((entry, i) => {\n const where = `collections[${i}]`;\n if (!isMapping(entry)) {\n throw toError(`${source}: ${where} must be a mapping.`);\n }\n rejectUnknownKeys(entry, COLLECTION_KEYS, where, source, toError);\n\n if (!isNonEmptyString(entry.name)) {\n throw toError(`${source}: ${where}.name must be a non-empty string.`);\n }\n const name = entry.name;\n const folded = name.toLowerCase();\n if (folded === \"docs\") {\n throw toError(\n `${source}: ${where}.name \"${name}\" collides with the docs table every query reads. Pick another name, such as \"site\" or \"pages\".`,\n );\n }\n // The derived table (proposal 0040) is a view named `derived` over a\n // backing table named `_derived_rows`, built beside `docs` when a\n // statement asks for it, and `resolved` (proposal 0043) is the view over\n // `docs` and those rows. Any of the three would shadow it the same way.\n if (folded === \"derived\" || folded === \"_derived_rows\" || folded === \"resolved\") {\n throw toError(\n `${source}: ${where}.name \"${name}\" collides with the derived table a query builds beside docs (the derived view, its _derived_rows table, and the resolved view over both). Pick another name.`,\n );\n }\n if (folded.startsWith(\"sqlite_\")) {\n throw toError(\n `${source}: ${where}.name \"${name}\" starts with \"sqlite_\", which SQLite reserves for its own objects. Pick another name.`,\n );\n }\n const owner = taken.get(folded);\n if (owner !== undefined) {\n throw toError(\n `${source}: ${where}.name \"${name}\" is already taken by collections[${owner}]; names are compared case-insensitively because they become SQL views.`,\n );\n }\n taken.set(folded, i);\n\n if (\n !Array.isArray(entry.paths) ||\n entry.paths.length === 0 ||\n entry.paths.some((p) => !isNonEmptyString(p))\n ) {\n throw toError(\n `${source}: ${where}.paths must be a non-empty list of files, directories or globs.`,\n );\n }\n const paths = entry.paths as string[];\n\n let exclude: string[] = [];\n if (entry.exclude !== undefined) {\n if (\n !Array.isArray(entry.exclude) ||\n entry.exclude.some((g) => !isNonEmptyString(g))\n ) {\n throw toError(`${source}: ${where}.exclude must be a list of globs.`);\n }\n exclude = entry.exclude as string[];\n }\n\n let url: string | undefined;\n if (entry.url !== undefined) {\n if (typeof entry.url !== \"string\" || !isHttpUrl(entry.url)) {\n throw toError(`${source}: ${where}.url must be an http(s) URL.`);\n }\n url = entry.url;\n }\n\n let externalMetadata: ExternalMetadataConfig[] = [];\n if (entry.externalMetadata !== undefined) {\n if (!Array.isArray(entry.externalMetadata)) {\n throw toError(`${source}: ${where}.externalMetadata must be a list.`);\n }\n externalMetadata = parseExternalMetadata(\n entry.externalMetadata,\n where,\n source,\n toError,\n );\n }\n\n return {\n name,\n paths,\n exclude,\n externalMetadata,\n ...(url === undefined ? {} : { url }),\n };\n });\n}\n\nfunction isHttpUrl(value: string): boolean {\n let parsed: URL;\n try {\n parsed = new URL(value);\n } catch {\n return false;\n }\n return parsed.protocol === \"http:\" || parsed.protocol === \"https:\";\n}\n\n/**\n * Parse one collection's `externalMetadata:`. 0037's rules, with the error\n * path rewritten and the noun changed: ownership is now disjoint within a\n * collection rather than across the whole config, because two collections may\n * each own the same key.\n */\nfunction parseExternalMetadata(\n raw: readonly unknown[],\n collectionWhere: string,\n source: string,\n toError: (message: string) => Error,\n): ExternalMetadataConfig[] {\n const owners = new Map<string, number>();\n const patterns = new Map<string, number>();\n /** The one entry that omits `keys` (proposal 0068), once one does. */\n let keyless: number | undefined;\n const parsedEntries = raw.map((entry, i): ExternalMetadataConfig => {\n const where = `${collectionWhere}.externalMetadata[${i}]`;\n if (!isMapping(entry)) {\n throw toError(`${source}: ${where} must be a mapping.`);\n }\n rejectUnknownKeys(entry, EXTERNAL_METADATA_KEYS, where, source, toError);\n if (!isNonEmptyString(entry.file)) {\n throw toError(\n `${source}: ${where}.file must be a non-empty string naming the manifest, relative to the config file.`,\n );\n }\n const placeholderProblem = pagePlaceholderProblem(entry.file);\n if (placeholderProblem !== null) {\n throw toError(`${source}: ${where}.file ${placeholderProblem}`);\n }\n const perPage = hasPagePlaceholder(entry.file);\n if (perPage && (posix.isAbsolute(entry.file) || win32.isAbsolute(entry.file))) {\n throw toError(\n `${source}: ${where}.file uses ${PAGE_PLACEHOLDER} in an absolute path, so every manifest would sit outside the repository. Make it relative to the config file.`,\n );\n }\n // Absent keys (proposal 0068) is an ownership rule, not an empty list:\n // the manifest owns what each page's schemas mark external. Written, the\n // list still has to name something.\n if (\n entry.keys !== undefined &&\n (!Array.isArray(entry.keys) ||\n entry.keys.length === 0 ||\n entry.keys.some((k) => !isNonEmptyString(k)))\n ) {\n throw toError(\n `${source}: ${where}.keys must be a non-empty list of key names.`,\n );\n }\n if (entry.keys === undefined) {\n if (keyless !== undefined) {\n throw toError(\n `${source}: ${collectionWhere}.externalMetadata: entries ${String(keyless)} and ${String(i)} both omit keys; at most one manifest may own the external-marked fields`,\n );\n }\n keyless = i;\n }\n const isUrl = isUrlRef(entry.file);\n if (isUrl) {\n const problem = externalMetadataUrlProblem(entry.file);\n if (problem !== null) {\n throw toError(`${source}: ${where}.file ${problem}.`);\n }\n if (perPage) {\n throw toError(\n `${source}: ${where}.file uses ${PAGE_PLACEHOLDER} in a URL. A placeholder names a file this run can write, and a URL is not one.`,\n );\n }\n }\n if (entry.tokenEnv !== undefined) {\n if (!isNonEmptyString(entry.tokenEnv)) {\n throw toError(\n `${source}: ${where}.tokenEnv must be the name of an environment variable.`,\n );\n }\n if (!isUrl) {\n throw toError(\n `${source}: ${where}.tokenEnv is set, but \"file\" is a path, so no request is made and the token would go nowhere. Remove it, or make \"file\" a URL.`,\n );\n }\n }\n const keys = entry.keys === undefined ? undefined : (entry.keys as string[]);\n if (entry.join !== undefined) {\n if (!isNonEmptyString(entry.join)) {\n throw toError(\n `${source}: ${where}.join must be \"path\" or the name of a top-level frontmatter field.`,\n );\n }\n if (entry.join === SCHEMA_KEY) {\n throw toError(`${source}: ${where}.join may not be \"${SCHEMA_KEY}\".`);\n }\n if (keys?.includes(entry.join) === true) {\n throw toError(\n `${source}: ${where}.join names \"${entry.join}\", which the same entry owns — the value that selects an entry cannot come from the entry.`,\n );\n }\n }\n // An explicit `join: path` is the default spelled out, and a per-page\n // manifest is found by that path. A field would name the file by one\n // thing and key its entry by another (0058 § 6).\n if (perPage && typeof entry.join === \"string\" && entry.join !== PATH_JOIN) {\n throw toError(\n `${source}: ${where}.file uses ${PAGE_PLACEHOLDER}, and join is \"${entry.join}\". A per-page manifest is found by path, so it cannot be keyed by a field. Remove ${PAGE_PLACEHOLDER}, or remove join.`,\n );\n }\n const seen = new Set<string>();\n for (const key of keys ?? []) {\n if (key === SCHEMA_KEY) {\n throw toError(\n `${source}: ${where}.keys may not include \"${SCHEMA_KEY}\" — a manifest never chooses the schema a document is judged by; use \"overrides\".`,\n );\n }\n if (seen.has(key)) {\n throw toError(`${source}: ${where}.keys lists \"${key}\" twice.`);\n }\n seen.add(key);\n const owner = owners.get(key);\n if (owner !== undefined) {\n throw toError(\n `${source}: ${where}.keys claims \"${key}\", which externalMetadata[${owner}] already owns — a key has exactly one manifest in a collection.`,\n );\n }\n owners.set(key, i);\n }\n // Two spellings of one pattern are one manifest for every page (0058\n // stress test 10), compared once, with no page known yet. Two concrete\n // entries naming one file stay legal, as they were before placeholders.\n if (perPage) {\n const pattern = normalizeManifestPattern(entry.file);\n const first = patterns.get(pattern);\n if (first !== undefined) {\n throw toError(\n `${source}: ${where}.file resolves to the same manifest as externalMetadata[${String(first)}].file for every page. Give each entry its own file name.`,\n );\n }\n patterns.set(pattern, i);\n }\n const parsed: ExternalMetadataConfig = {\n file: entry.file,\n ...(keys === undefined ? {} : { keys }),\n ...(typeof entry.tokenEnv === \"string\" ? { tokenEnv: entry.tokenEnv } : {}),\n ...(typeof entry.join === \"string\" ? { join: entry.join } : {}),\n };\n origins.set(parsed, { source, where });\n return parsed;\n });\n // What each keyless manifest can never own, fixed here against the whole\n // declaration. A caller that narrows a collection to some of its manifests\n // still gets the answer the full collection gives.\n for (const manifest of parsedEntries) {\n if (manifest.keys === undefined) declaredNever.set(manifest, neverOwnedIn(parsedEntries, manifest));\n }\n return parsedEntries;\n}\n\n/**\n * The problem with `file`'s `{page}` placeholder grammar (0058 § 1), as the\n * tail of a sentence that starts with the entry's path, or `null` when there\n * is none. One token, spelled exactly, at most once; every other brace is\n * refused rather than read as a literal.\n */\nfunction pagePlaceholderProblem(file: string): string | null {\n for (const match of file.matchAll(/\\{[^{}]*\\}/g)) {\n if (match[0] !== PAGE_PLACEHOLDER) {\n return `uses \"${match[0]}\", which is not a placeholder. The only placeholder is ${PAGE_PLACEHOLDER}.`;\n }\n }\n const tokens = file.split(PAGE_PLACEHOLDER);\n const stray = /[{}]/.exec(tokens.join(\"\"));\n if (stray !== null) {\n return `contains \"${stray[0]}\" outside a ${PAGE_PLACEHOLDER} placeholder. Remove it, or write ${PAGE_PLACEHOLDER}.`;\n }\n if (tokens.length > 2) {\n return `uses ${PAGE_PLACEHOLDER} twice. One manifest names one page.`;\n }\n return null;\n}\n\n/**\n * Where a parsed `externalMetadata:` entry was declared: the config file as\n * the parse was told to name it, and the entry's\n * `collections[c].externalMetadata[i]` path. Kept beside the entry rather\n * than on it, so the entry's shape, its equality, and anything that\n * serializes it stay what they were. A copy made with a spread has no origin.\n */\nconst origins = new WeakMap<ExternalMetadataConfig, { source: string; where: string }>();\n\n/**\n * The config file and path an entry was parsed from, for a refusal that is\n * known only once a page is: a `{page}` manifest resolving above the config\n * directory. `undefined` for an entry `parseCollections` did not build.\n */\nexport function externalMetadataOrigin(\n entry: ExternalMetadataConfig,\n): { source: string; where: string } | undefined {\n return origins.get(entry);\n}\n\n/**\n * Does `manifest`, one of `collection`'s, own `key` for one page? The one\n * answer every reader and writer asks for (proposal 0068).\n *\n * A manifest with `keys` owns exactly those, for every page. One without owns\n * what `marked` holds: the top-level keys the page's resolved schema set marks\n * `x-manni-location: external`. It never owns a key another manifest of the\n * collection names in its own `keys`, because written keys win. Nor its own\n * join field, which the page carries to name its entry, nor `$schema`. With\n * `marked` undefined, because the page's schemas are not known, a keyless\n * manifest owns nothing.\n */\nexport function ownsKey(\n collection: Pick<CollectionConfig, \"externalMetadata\">,\n manifest: ExternalMetadataConfig,\n key: string,\n marked: ReadonlySet<string> | undefined,\n): boolean {\n if (manifest.keys !== undefined) return manifest.keys.includes(key);\n if (marked === undefined || !marked.has(key)) return false;\n return !neverOwned(collection, manifest).has(key);\n}\n\n/**\n * The keys a keyless manifest never owns, whatever a page marks: the keys\n * the collection's other manifests name, its join field, and `$schema`. An\n * entry setting one of them is refused when the manifest is read.\n */\nexport function neverOwned(\n collection: Pick<CollectionConfig, \"externalMetadata\">,\n manifest: ExternalMetadataConfig,\n): ReadonlySet<string> {\n return declaredNever.get(manifest) ?? neverOwnedIn(collection.externalMetadata, manifest);\n}\n\nfunction neverOwnedIn(\n manifests: readonly ExternalMetadataConfig[],\n manifest: ExternalMetadataConfig,\n): Set<string> {\n const out = new Set<string>([SCHEMA_KEY]);\n if (manifest.join !== undefined && manifest.join !== PATH_JOIN) out.add(manifest.join);\n for (const other of manifests) {\n if (other === manifest) continue;\n for (const key of other.keys ?? []) out.add(key);\n }\n return out;\n}\n\n/**\n * `neverOwned` for each keyless manifest `parseCollections` built, computed\n * over its whole collection. Kept beside the entry, as `origins` is, so a\n * copy of the collection filtered to some of its manifests does not forget a\n * key a manifest it left out names.\n */\nconst declaredNever = new WeakMap<ExternalMetadataConfig, ReadonlySet<string>>();\n\n/**\n * The collections a run covers: every one when `names` is undefined, else the\n * named ones in **declaration** order, however they were named on the command\n * line. Repeats collapse; an unknown name is an error, because a typo that\n * silently narrowed the run to nothing would read as a clean pass.\n */\nexport function selectCollections(\n collections: readonly CollectionConfig[],\n names: readonly string[] | undefined,\n source: string,\n toError: (message: string) => Error,\n): CollectionConfig[] {\n // An empty list means the same as no list: every collection. Commander's\n // repeatable-option collector defaults to `[]`, so \"the user passed no\n // --collection\" reaches this function as an empty array at least as often as\n // it reaches it as `undefined`. Were `[]` to select nothing, a plain\n // `manni meta validate` would validate zero files and exit 0 the moment a\n // caller forwarded the raw commander value — the false green proposal 0014\n // exists to end, and invisible in the exit code. Nothing needs to express\n // \"select no collections\", so the ambiguity is resolved in the safe\n // direction. Do not tighten this back.\n if (names === undefined || names.length === 0) return [...collections];\n const wanted = new Set(names);\n for (const name of wanted) {\n if (!collections.some((c) => c.name === name)) {\n const configured =\n collections.length === 0\n ? \"(none)\"\n : collections.map((c) => c.name).join(\", \");\n // Names are unique case-insensitively (they become SQL views) but are\n // selected by their one spelling. When the miss is only a casing miss,\n // say so — \"Configured: guides\" beside \"Guides\" reads as a contradiction\n // to anyone who does not already know the rule.\n const nearMiss = collections.find(\n (c) => c.name.toLowerCase() === name.toLowerCase(),\n );\n const hint =\n nearMiss === undefined\n ? \"\"\n : ` Names are case-sensitive; did you mean \"${nearMiss.name}\"?`;\n throw toError(\n `no collection named \"${name}\" in ${source}. Configured: ${configured}.${hint}`,\n );\n }\n }\n return collections.filter((c) => wanted.has(c.name));\n}\n\n/**\n * Is this file a member of the collection? `relPath` is posix and already\n * relative to the config file's directory, so this is arithmetic on a string:\n * no `stat`, nothing that can fail, and nothing that costs per file. A path\n * that climbed out of the config directory, and stdin, are members of nothing.\n */\nexport function isMember(\n collection: CollectionConfig,\n relPath: string,\n): boolean {\n if (relPath === STDIN) return false;\n if (relPath.startsWith(\"../\")) return false;\n return matchesCollectionPaths(collection, relPath);\n}\n\n/**\n * Do the collection's `paths:` and `exclude:` claim this path, before the two\n * guards `isMember` adds? Only a caller that has to *say* why a claimed path\n * is not a member needs this: a page above the config directory that a\n * `{page}` manifest would resolve outside the tree (proposal 0058). Everyone\n * else wants `isMember`.\n */\nexport function matchesCollectionPaths(\n collection: CollectionConfig,\n relPath: string,\n): boolean {\n const matched = collection.paths.some((entry) => {\n const normalized = normalizeEntry(entry);\n if (normalized === \"\") return false;\n if (isGlob(normalized)) return matchesFileGlob(relPath, normalized);\n return relPath === normalized || relPath.startsWith(`${normalized}/`);\n });\n if (!matched) return false;\n // `exclude` is globs only, whatever `paths` was written as.\n return !collection.exclude.some((glob) => matchesFileGlob(relPath, glob));\n}\n\n/** A `paths` entry as a posix path with no `./` prefix and no trailing `/`. */\nfunction normalizeEntry(entry: string): string {\n const posix = entry.replace(/\\\\/g, \"/\").replace(/^\\.\\//, \"\");\n return posix.endsWith(\"/\") ? posix.slice(0, -1) : posix;\n}\n\n/**\n * Is this `paths` entry a glob, by picomatch's own definition, rather than a\n * bare file or directory to match by prefix?\n *\n * picomatch decides, not a character class of our own: an extended glob such\n * as `docs/!(drafts)/**` or `@(a|b)` has no `*`, `?`, `[` or `{` of its own\n * and a hand-rolled test read it as a literal path — matching nothing and\n * excluding nothing, silently. The one cost is that a literal directory whose\n * name carries parentheses, `docs/notes (old)`, is also read as a glob and so\n * matches itself only, not everything beneath it. Spell such a path as\n * `docs/notes (old)/**` to get the prefix behaviour back.\n */\nfunction isGlob(entry: string): boolean {\n return picomatch.scan(entry).isGlob;\n}\n","/**\n * Glob matching, shared by every tool.\n *\n * One matcher, so that the two questions that look alike really are alike: is\n * this file in a collection (proposal 0041), and does it match a schema\n * override's `files:` (0015). It lived in the metadata tool's schema resolver\n * until membership needed it too; a second copy is how the two would start\n * disagreeing about a dot file or a `\\`.\n */\nimport picomatch from \"picomatch\";\n\n/**\n * One compiled matcher per distinct glob, kept for the life of the process.\n * Never evicted, on purpose: the set of globs a run sees is the config's plus\n * a handful of flags, which is dozens at most, and a compile is the expensive\n * step. This module is shared across the family, so if it ever sits inside a\n * long-lived host that feeds it unbounded user globs, this is the line to\n * revisit — bound it, or key it per run. Until then an eviction policy would\n * be machinery for a case that does not exist.\n */\nconst matcherCache = new Map<string, (p: string) => boolean>();\n\n/**\n * Does this file path match the glob — or, for the list form, any of them — by\n * the shared rules (picomatch, dot files included, `\\` normalized to `/`)?\n */\nexport function matchesFileGlob(\n relPath: string,\n glob: string | readonly string[],\n): boolean {\n // picomatch takes a pattern array natively, so the list form needs no loop\n // here — but the cache does need a *string* key. Keyed on the array itself\n // this Map would compare by identity: a hit only for the very same object,\n // and an entry retained for every config ever parsed. JSON.stringify is the\n // key because it separates the two shapes on its own — a lone \"a/**\" and\n // [\"a/**\"] serialize differently — with no separator char to collide with\n // one inside a glob.\n const key = JSON.stringify(glob);\n let m = matcherCache.get(key);\n if (!m) {\n m = picomatch(glob as string | string[], { dot: true });\n matcherCache.set(key, m);\n }\n // Normalize Windows separators so globs written with `/` still match.\n return m(relPath.replace(/\\\\/g, \"/\"));\n}\n","/**\n * The `{page}` placeholder in `externalMetadata[].file` (proposal 0058).\n *\n * A `file` holding `{page}` is a rule rather than a file: each page gets its\n * own manifest, named by substituting the page's path, relative to the config\n * file's directory and without its extension. `\"{page}.citations.yaml\"` puts\n * `docs/x/index.mdx`'s manifest at `docs/x/index.citations.yaml`.\n *\n * One normalization is used wherever a pattern or a page path is compared or\n * substituted (0058 § 1): strip one leading `./`, and write every separator as\n * a forward slash. It is deliberately that small. It is not `path.resolve`, so\n * `./a/../{page}.yaml` stays its own pattern, and it does not fold case.\n *\n * The grammar itself (one token, spelled exactly, never in a URL or an\n * absolute path) is enforced by the config parser in `collections.ts`, so\n * everything here may assume a `file` that passed it.\n *\n * Shared, so it imports nothing from a tool.\n */\nimport { readFileSync, realpathSync } from \"node:fs\";\nimport { isAbsolute, posix, relative, resolve, sep } from \"node:path\";\nimport fg from \"fast-glob\";\nimport { LineCounter, isMap, isNode, isScalar, parseDocument } from \"yaml\";\n\n/** The one placeholder `externalMetadata[].file` accepts. */\nexport const PAGE_PLACEHOLDER = \"{page}\";\n\n/** True when `file` contains the {page} token (assumes it already passed parse validation). */\nexport function hasPagePlaceholder(file: string): boolean {\n return file.includes(PAGE_PLACEHOLDER);\n}\n\n/** Every separator written as a forward slash. */\nfunction slashes(path: string): string {\n return path.split(sep).join(\"/\").replace(/\\\\/g, \"/\");\n}\n\n/**\n * 0058 § 1 normalization: strip one leading \"./\", backslashes to \"/\". No case\n * folding, no path.resolve, no \"..\" collapsing.\n */\nexport function normalizeManifestPattern(file: string): string {\n const forward = file.replace(/\\\\/g, \"/\");\n return forward.startsWith(\"./\") ? forward.slice(2) : forward;\n}\n\n/**\n * The manifest a page resolves to. `configDir` absolute; `pageAbs` absolute.\n *\n * `{page}` is `relative(configDir, pageAbs)` with its extension removed,\n * normalized as above, substituted into the normalized pattern. Returns the\n * manifest's absolute path and its posix path relative to `configDir`, or\n * `{ outside: true, pageRel }` when the page is not under the config\n * directory: its relative path climbs with `../`, or, across Windows drives,\n * there is no relative path at all.\n */\nexport function pageManifestPath(\n file: string,\n configDir: string,\n pageAbs: string,\n): { abs: string; rel: string } | { outside: true; pageRel: string } {\n const between = relative(configDir, pageAbs);\n const pageRel = slashes(between);\n if (isAbsolute(between) || pageRel === \"..\" || pageRel.startsWith(\"../\")) {\n return { outside: true, pageRel };\n }\n const ext = posix.extname(pageRel);\n const page = ext === \"\" ? pageRel : pageRel.slice(0, -ext.length);\n const named = normalizeManifestPattern(file).replace(PAGE_PLACEHOLDER, () => page);\n const abs = resolve(configDir, named);\n return { abs, rel: slashes(relative(configDir, abs)) };\n}\n\n/**\n * 0058 § 5: the glob every manifest of a pattern matches. The normalized\n * pattern is split at `{page}` and `**` + `/*` inserted, keeping the prefix\n * and the suffix. No page path reaches it, but the prefix and suffix are the\n * config author's own literal text, and a directory name may hold glob\n * syntax: read raw, `meta (v2)/` is an extglob group that matches nothing. So\n * both are escaped, and only the inserted `**` + `/*` is live.\n * `\"{page}.citations.yaml\"` gives `**` + `/*.citations.yaml`, and\n * `\"./meta/{page}.citations.yaml\"` gives `meta/**` + `/*.citations.yaml`.\n */\nexport function strayManifestGlob(file: string): string {\n const normalized = normalizeManifestPattern(file);\n const at = normalized.indexOf(PAGE_PLACEHOLDER);\n if (at < 0) return literal(normalized);\n const prefix = literal(normalized.slice(0, at));\n const suffix = literal(normalized.slice(at + PAGE_PLACEHOLDER.length));\n return `${prefix}**/*${suffix}`;\n}\n\n/** Text a glob matches exactly. fast-glob refuses to escape an empty string. */\nfunction literal(text: string): string {\n return text === \"\" ? \"\" : fg.escapePath(text);\n}\n\n/** One entry of a per-page manifest found on disk, naming the page it is for. */\nexport interface FoundPageEntry {\n /** The key exactly as the manifest spells it. */\n spelled: string;\n /** The page it names, absolute. */\n pageAbs: string;\n /** 1-based line of the key in the manifest, when known. */\n line?: number;\n}\n\n/** A manifest file a `{page}` pattern names, and the entries it holds for its own page. */\nexport interface FoundPageManifest {\n /** The manifest, absolute. */\n abs: string;\n entries: FoundPageEntry[];\n}\n\n/**\n * The manifests on disk that `file`, a `{page}` pattern, names (0058 § 5):\n * every file the pattern's `strayManifestGlob` matches under `configDir`,\n * kept when it holds an entry the pattern resolves back to that very file,\n * for a page `isMember` claims. `isMember` takes the page's posix path\n * relative to `configDir`. A file with no such entry is not this pattern's\n * manifest, whatever its name: a copy of the tree elsewhere, a fixture, or a\n * file that only looks like one.\n *\n * The walk does not consult `.gitignore`, because a manifest is config named\n * input rather than a discovered document. It skips `node_modules`, `.git`\n * and dot directories, as the document walk does, so a checkout nested under\n * a dot directory is never read as this one's. A file that cannot be read or\n * parsed is not recognizably a manifest, and is skipped.\n *\n * Synchronous, so a synchronous orphan check can call it. It runs once per\n * whole-corpus run, never for a run given paths. A match in `skip` (absolute\n * paths) is neither read nor returned: the orphan check passes the manifests\n * the run already loaded, which would otherwise be parsed a second time.\n */\nexport function findPageManifests(\n file: string,\n configDir: string,\n isMember: (relPath: string) => boolean,\n skip: ReadonlySet<string> = new Set(),\n): FoundPageManifest[] {\n const matched = fg\n .sync(strayManifestGlob(file), {\n cwd: configDir,\n absolute: true,\n onlyFiles: true,\n dot: false,\n ignore: [\"**/node_modules/**\", \"**/.git/**\"],\n })\n .map((path) => resolve(path))\n .sort();\n const found: FoundPageManifest[] = [];\n for (const abs of matched) {\n if (skip.has(abs)) continue;\n const entries = ownEntries(abs, file, configDir, isMember);\n if (entries.length > 0) found.push({ abs, entries });\n }\n return found;\n}\n\n/** The entries of the manifest at `abs` that `file` resolves back to `abs`. */\nfunction ownEntries(\n abs: string,\n file: string,\n configDir: string,\n isMember: (relPath: string) => boolean,\n): FoundPageEntry[] {\n let text: string;\n try {\n text = readFileSync(abs, \"utf8\");\n } catch {\n return [];\n }\n const lc = new LineCounter();\n const doc = parseDocument(text, { lineCounter: lc, uniqueKeys: false });\n const root = doc.contents;\n if (doc.errors.length > 0 || !isMap(root)) return [];\n const entries: FoundPageEntry[] = [];\n for (const pair of root.items) {\n const spelled = isScalar(pair.key) ? String(pair.key.value) : String(pair.key);\n const pageAbs = resolve(configDir, spelled);\n if (!isMember(slashes(relative(configDir, pageAbs)))) continue;\n const resolved = pageManifestPath(file, configDir, pageAbs);\n if (\"outside\" in resolved || !sameFile(resolved.abs, abs)) continue;\n const range = isNode(pair.key) ? pair.key.range : undefined;\n entries.push({\n spelled,\n pageAbs,\n ...(range ? { line: lc.linePos(range[0]).line } : {}),\n });\n }\n return entries;\n}\n\n/**\n * Are these one file, as the filesystem resolves them? Compared as files and\n * not as text (0058 stress test 8), so a case-only difference is one file on\n * a case-insensitive filesystem and two elsewhere.\n */\nexport function sameFile(a: string, b: string): boolean {\n if (a === b) return true;\n try {\n return realpathSync(a) === realpathSync(b);\n } catch {\n return false;\n }\n}\n","/**\n * The family's value encryption (proposal 0045).\n *\n * One ciphertext format for every tool: meta frontmatter values and cite\n * source paths encrypt the same way, under different contexts, so rotation\n * has one rule. Pure, and `node:crypto` only.\n *\n * The construction is SIV-style on AES-256-GCM, because Node has no SIV mode\n * (`aes-256-gcm-siv` and `aes-*-siv` are unknown ciphers in Node 24):\n *\n * - Three 32-byte subkeys come from the configured key with HKDF-SHA256 and an\n * empty salt, labelled `manni/v1/encrypt`, `manni/v1/nonce` and\n * `manni/v1/pin`. The key is expanded, not stretched: a hand-picked value is\n * only as strong as it is random, which is why `manni key set` generates 256\n * bits.\n * - The plaintext is the value's JSON, padded ISO/IEC 7816-4 style (`0x80`,\n * then `0x00` up to the next multiple of 32, always at least one pad byte),\n * so a token's length reveals a size class, not the value.\n * - The nonce is the first 12 bytes of `HMAC(nonceKey, context ‖ 0x00 ‖\n * padded)`. Equal plaintexts give equal tokens, which is what a join needs;\n * decryption checks the nonce is that HMAC, so every valid token is\n * canonical.\n * - The associated data is `0x01 ‖ context`, so the same text in two contexts\n * never reuses a nonce under different tags. The property name is not\n * bound: a value moved between fields stays readable.\n *\n * A token is `~` then unpadded base64url of `0x01 ‖ nonce ‖ ciphertext ‖\n * tag`: 61 bytes at the smallest, so 82 characters after the `~`.\n */\nimport {\n createCipheriv,\n createDecipheriv,\n createHmac,\n hkdfSync,\n randomBytes,\n timingSafeEqual,\n} from \"node:crypto\";\nimport { TextDecoder } from \"node:util\";\n\n/** Which kind of value a token holds. Bound as associated data. */\nexport type EncryptionContext = \"meta\" | \"cite-src\";\n\n/** An encrypted value: `~` and at least 82 base64url characters. */\nexport const ENCRYPTED_VALUE = /^~[A-Za-z0-9_-]{82,}$/;\n\n/** Whether `value` is shaped like a token. Says nothing about which key. */\nexport function isEncryptedValue(value: unknown): value is string {\n return typeof value === \"string\" && ENCRYPTED_VALUE.test(value);\n}\n\n/** A configured key: hex or base64url, at least 32 characters. */\nexport const ENCRYPTION_KEY_SHAPE = /^[A-Za-z0-9_-]{32,}$/;\n\nexport function isValidEncryptionKey(value: unknown): value is string {\n return typeof value === \"string\" && ENCRYPTION_KEY_SHAPE.test(value);\n}\n\n/** 256 random bits as 64 lowercase hex characters. */\nexport function generateEncryptionKey(): string {\n return randomBytes(32).toString(\"hex\");\n}\n\nconst VERSION = 0x01;\nconst NONCE_BYTES = 12;\nconst TAG_BYTES = 16;\nconst BLOCK = 32;\n/** Version byte, nonce, one padded block, tag. */\nconst MIN_BYTES = 1 + NONCE_BYTES + BLOCK + TAG_BYTES;\n\ninterface Subkeys {\n encrypt: Buffer;\n nonce: Buffer;\n pin: Buffer;\n}\n\n/**\n * Subkeys per configured key. A run sees one key, or two while rotating, so\n * the cache stays tiny; it saves three HKDF calls per value on a large tree.\n */\nconst subkeyCache = new Map<string, Subkeys>();\n\nfunction subkeys(key: string): Subkeys {\n const cached = subkeyCache.get(key);\n if (cached !== undefined) return cached;\n const ikm = Buffer.from(key, \"utf8\");\n const derive = (info: string): Buffer =>\n Buffer.from(hkdfSync(\"sha256\", ikm, Buffer.alloc(0), info, 32));\n const made: Subkeys = {\n encrypt: derive(\"manni/v1/encrypt\"),\n nonce: derive(\"manni/v1/nonce\"),\n pin: derive(\"manni/v1/pin\"),\n };\n subkeyCache.set(key, made);\n return made;\n}\n\nfunction requireKey(key: string, caller: string): void {\n if (!isValidEncryptionKey(key)) {\n // Never echo the value: it is key material.\n throw new Error(\n `${caller}: the key must be at least 32 hex or base64url characters.`,\n );\n }\n}\n\nfunction pad(data: Buffer): Buffer {\n const out = Buffer.alloc((Math.floor(data.length / BLOCK) + 1) * BLOCK);\n data.copy(out);\n out[data.length] = 0x80;\n return out;\n}\n\n/** The data before the padding, or `null` when the padding is not canonical. */\nfunction unpad(padded: Buffer): Buffer | null {\n let i = padded.length - 1;\n while (i >= 0 && padded[i] === 0) i--;\n if (i < 0 || padded[i] !== 0x80) return null;\n // Exactly the padding `pad` would have added: never a spare block.\n if (padded.length !== (Math.floor(i / BLOCK) + 1) * BLOCK) return null;\n return padded.subarray(0, i);\n}\n\nfunction nonceFor(keys: Subkeys, context: Buffer, padded: Buffer): Buffer {\n return createHmac(\"sha256\", keys.nonce)\n .update(context)\n .update(Buffer.from([0x00]))\n .update(padded)\n .digest()\n .subarray(0, NONCE_BYTES);\n}\n\nfunction aad(context: Buffer): Buffer {\n return Buffer.concat([Buffer.from([VERSION]), context]);\n}\n\n/**\n * Encrypt any JSON value. Throws for a value that is not JSON (`undefined`, a\n * function) and for a key that is not key-shaped: both are programming\n * errors, since keys arrive through `resolveEncryptionKey`.\n */\nexport function encryptValue(\n value: unknown,\n key: string,\n context: EncryptionContext,\n): string {\n requireKey(key, \"encryptValue\");\n // lib.d.ts types the result as `string`, but `undefined`, a function or a\n // symbol stringify to `undefined` at run time.\n const json = JSON.stringify(value) as string | undefined;\n if (json === undefined) {\n throw new TypeError(\"encryptValue: the value is not JSON.\");\n }\n const keys = subkeys(key);\n const ctx = Buffer.from(context, \"utf8\");\n const padded = pad(Buffer.from(json, \"utf8\"));\n const nonce = nonceFor(keys, ctx, padded);\n const cipher = createCipheriv(\"aes-256-gcm\", keys.encrypt, nonce, {\n authTagLength: TAG_BYTES,\n });\n cipher.setAAD(aad(ctx));\n const sealed = Buffer.concat([cipher.update(padded), cipher.final()]);\n const tag = cipher.getAuthTag();\n const bytes = Buffer.concat([Buffer.from([VERSION]), nonce, sealed, tag]);\n return `~${bytes.toString(\"base64url\")}`;\n}\n\nconst FAILED = { ok: false } as const;\n\n/**\n * Decrypt a token. `{ ok: false }` for anything that is not a canonical token\n * under this key and context; never throws.\n */\nexport function decryptValue(\n token: string,\n key: string,\n context: EncryptionContext,\n): { ok: true; value: unknown } | { ok: false } {\n try {\n return open(token, key, context);\n } catch {\n return FAILED;\n }\n}\n\nfunction open(\n token: string,\n key: string,\n context: EncryptionContext,\n): { ok: true; value: unknown } | { ok: false } {\n if (!isEncryptedValue(token) || !isValidEncryptionKey(key)) return FAILED;\n const body = token.slice(1);\n const bytes = Buffer.from(body, \"base64url\");\n // Buffer's decoder ignores stray trailing bits; a token is canonical only\n // if it is exactly what the encoder writes for these bytes.\n if (bytes.toString(\"base64url\") !== body) return FAILED;\n if (bytes.length < MIN_BYTES) return FAILED;\n if ((bytes.length - 1 - NONCE_BYTES - TAG_BYTES) % BLOCK !== 0) return FAILED;\n if (bytes[0] !== VERSION) return FAILED;\n\n const nonce = bytes.subarray(1, 1 + NONCE_BYTES);\n const sealed = bytes.subarray(1 + NONCE_BYTES, bytes.length - TAG_BYTES);\n const tag = bytes.subarray(bytes.length - TAG_BYTES);\n const keys = subkeys(key);\n const ctx = Buffer.from(context, \"utf8\");\n const decipher = createDecipheriv(\"aes-256-gcm\", keys.encrypt, nonce, {\n authTagLength: TAG_BYTES,\n });\n decipher.setAAD(aad(ctx));\n decipher.setAuthTag(tag);\n // `final` throws on a bad tag; the caller turns that into `{ ok: false }`.\n const padded = Buffer.concat([decipher.update(sealed), decipher.final()]);\n\n if (!timingSafeEqual(nonceFor(keys, ctx, padded), nonce)) return FAILED;\n const data = unpad(padded);\n if (data === null) return FAILED;\n const json = new TextDecoder(\"utf-8\", { fatal: true }).decode(data);\n const value: unknown = JSON.parse(json);\n return { ok: true, value };\n}\n\n/** The prefix a keyed pin carries, so it never reads as a plain hash of the text. */\nexport const KEYED_PIN_PREFIX = \"hmac-sha256-\";\n\n/**\n * A keyed fingerprint of `text`: `hmac-sha256-` and the hex HMAC-SHA256 under\n * the pin subkey. Stable per key, so it can be compared without being\n * reversible. The prefix says it is an HMAC: hashing the text by hand gives\n * a different value, and the prefix is why.\n */\nexport function keyedPin(text: string, key: string): string {\n requireKey(key, \"keyedPin\");\n const mac = createHmac(\"sha256\", subkeys(key).pin)\n .update(text, \"utf8\")\n .digest(\"hex\");\n return `${KEYED_PIN_PREFIX}${mac}`;\n}\n","/**\n * `tools:`, the family-level home for an outside tool's settings (proposal\n * 0052, in the shape lint's proposal 0050 recorded).\n *\n * An outside tool is not any one domain's, so its settings do not sit under a\n * domain's key. Vale is the case in point: `manni term lint` runs it, and so\n * does a docevals grader. Each should read one description of where Vale's\n * config lives, not two that can disagree.\n *\n * Each tool gets a namespace of its own keys rather than a shared\n * `{tool, config}` shape, because tools do not have the same settings. A\n * lowest-common-denominator shape would either lie or grow a passthrough blob.\n *\n * Only the declaration is shared. Running a tool stays with the domain that\n * runs it. Paths are kept as the user spelled them and resolved on use,\n * against the config file's directory, the way `collections:` keeps its globs;\n * whether the file exists is a question for the run that needs it.\n */\nimport { isAbsolute, resolve } from \"node:path\";\n\n/** Vale's settings under `tools.vale`. */\nexport interface ValeToolConfig {\n /** Vale's config file, as written, relative to `manni.config.yaml`. */\n config?: string;\n}\n\n/** DITA Open Toolkit's settings under `tools.dita-ot`. */\nexport interface DitaOtToolConfig {\n /**\n * DITA-OT's installation directory, as written, relative to\n * `manni.config.yaml`. Unset means the `dita` on PATH.\n *\n * A directory rather than a path to the launcher, because that is the unit\n * DITA-OT is distributed and documented as: the download unpacks to one\n * directory, and `bin/dita` inside it will not run from anywhere else.\n */\n home?: string;\n}\n\n/** Doc Detective's settings under `tools.doc-detective`. */\nexport interface DocDetectiveToolConfig {\n /**\n * Doc Detective's config file, as written, relative to `manni.config.yaml`.\n * Unset means Doc Detective finds its own in the working directory.\n */\n config?: string;\n}\n\n/** The document's top-level `tools:`, one namespace per outside tool. */\nexport interface ToolsConfig {\n vale?: ValeToolConfig;\n \"dita-ot\"?: DitaOtToolConfig;\n \"doc-detective\"?: DocDetectiveToolConfig;\n}\n\nconst TOOL_KEYS = [\"vale\", \"dita-ot\", \"doc-detective\"] as const;\n\nfunction isMapping(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction rejectUnknownKeys(\n raw: Record<string, unknown>,\n allowed: readonly string[],\n where: string,\n source: string,\n toError: (message: string) => Error,\n): void {\n for (const key of Object.keys(raw)) {\n if (!allowed.includes(key)) {\n throw toError(\n `${source}: ${where} has unknown key \"${key}\". Supported keys: ${allowed.join(\", \")}.`,\n );\n }\n }\n}\n\n/**\n * Parse the value under the top-level `tools:` key. A bare `tools:` (YAML\n * null) is no tools. Every refusal is a shape that would otherwise read as\n * configured and do nothing: a misspelled tool, or a key a tool never reads.\n */\nexport function parseTools(\n raw: unknown,\n source: string,\n toError: (message: string) => Error,\n): ToolsConfig {\n if (raw === null || raw === undefined) return {};\n if (!isMapping(raw)) {\n throw toError(`${source}: \"tools\" must be a mapping.`);\n }\n rejectUnknownKeys(raw, TOOL_KEYS, \"tools\", source, toError);\n\n const tools: ToolsConfig = {};\n if (Object.hasOwn(raw, \"vale\")) {\n tools.vale = parseStringKey(raw[\"vale\"], \"vale\", \"config\", source, toError);\n }\n if (Object.hasOwn(raw, \"dita-ot\")) {\n tools[\"dita-ot\"] = parseStringKey(raw[\"dita-ot\"], \"dita-ot\", \"home\", source, toError);\n }\n if (Object.hasOwn(raw, \"doc-detective\")) {\n tools[\"doc-detective\"] = parseStringKey(\n raw[\"doc-detective\"],\n \"doc-detective\",\n \"config\",\n source,\n toError,\n );\n }\n return tools;\n}\n\n/**\n * One tool's namespace, whose single key is a non-empty string. Every tool\n * read today has that shape; a tool with a second key or another type gets a\n * parser of its own.\n */\nfunction parseStringKey<K extends string>(\n raw: unknown,\n tool: string,\n key: K,\n source: string,\n toError: (message: string) => Error,\n): Partial<Record<K, string>> {\n if (!isMapping(raw)) {\n throw toError(`${source}: tools.${tool} must be a mapping.`);\n }\n rejectUnknownKeys(raw, [key], `tools.${tool}`, source, toError);\n\n const out: Partial<Record<K, string>> = {};\n if (Object.hasOwn(raw, key)) {\n const value = raw[key];\n if (typeof value !== \"string\" || value.trim() === \"\") {\n throw toError(`${source}: tools.${tool}.${key} must be a non-empty string.`);\n }\n out[key] = value;\n }\n return out;\n}\n\n/** A path as written in the config, made absolute against the config file's directory. */\nfunction fromConfigDir(path: string, configDir: string): string {\n return isAbsolute(path) ? path : resolve(configDir, path);\n}\n\n/**\n * The absolute path of Vale's config file, resolved against the directory of\n * the config file that declared it. `undefined` when none is set, which means\n * Vale finds its own config, as it does when a person runs it.\n */\nexport function valeConfigPath(tools: ToolsConfig, configDir: string): string | undefined {\n const config = tools.vale?.config;\n if (config === undefined) return undefined;\n return fromConfigDir(config, configDir);\n}\n\n/**\n * The absolute path of DITA-OT's installation directory, resolved against the\n * directory of the config file that declared it. `undefined` when none is set,\n * which means the `dita` on PATH, as when a person runs it.\n */\nexport function ditaOtHome(tools: ToolsConfig, configDir: string): string | undefined {\n const home = tools[\"dita-ot\"]?.home;\n if (home === undefined) return undefined;\n return fromConfigDir(home, configDir);\n}\n\n/**\n * The absolute path of Doc Detective's config file, resolved against the\n * directory of the config file that declared it. `undefined` when none is set,\n * which means Doc Detective finds its own in the working directory.\n */\nexport function docDetectiveConfigPath(\n tools: ToolsConfig,\n configDir: string,\n): string | undefined {\n const config = tools[\"doc-detective\"]?.config;\n if (config === undefined) return undefined;\n return fromConfigDir(config, configDir);\n}\n","/**\n * The family config file.\n *\n * One file per repository, `manni.config.yaml`, with one top-level key per\n * tool: `meta:` for the metadata tool, `docevals:`, `tracevals:`, `lint:`,\n * `graph:` as each lands. A tool reads its own key and leaves its siblings alone,\n * so adding a tool never invalidates a config that predates it.\n *\n * This module only finds the file and hands a tool its slice. What the slice\n * may contain is the tool's business; it validates the value with its own\n * parser and its own error class, which is why `toError` is an option rather\n * than an import. Four top-level keys belong to the family rather than to a\n * tool, and are parsed here once for every tool. They are `collections:`\n * (proposal 0041), `tools:` (proposal 0052) and `encryptionKey:` (proposal\n * 0045). The fourth is `providers:`, the inference provider settings every\n * tool that sends content to a model reads.\n *\n * One older spelling is still read, with a warning on discovery: each tool's\n * pre-family file (`docmeta.config.yaml` for the metadata tool), whose whole\n * document is the tool's section with no wrapper key.\n *\n * Within one directory the order is manni, then the legacy names, and\n * `.yaml` before `.yml`. A family file that exists but has neither a key for\n * this tool nor a family key is not this tool's config: discovery keeps\n * looking, first at the legacy names beside it (a repository mid-migration,\n * where a sibling tool moved to the family file first) and then up the tree.\n * The walk stops at the nearest `.git` boundary, nearest directory first, and\n * the first hit wins; ancestor files are never merged.\n *\n * An explicit path is read the same way minus the warning: the section key is\n * unwrapped when present, a document carrying a family key is a family file\n * with an empty section, and the whole document is taken otherwise, so a\n * `-c ./anything.yaml` needs no filename sniffing and no flag.\n *\n * The core is synchronous: some tools load config from synchronous library\n * entry points, and one small file read is not worth an `await` through their\n * public API. `findConfigFileSync` and `readConfigFileSync` expose it; the\n * async spellings are wrappers over the same core for callers that await.\n */\nimport { readFileSync } from \"node:fs\";\nimport { basename, dirname, join, relative, resolve } from \"node:path\";\nimport { parse as parseYaml } from \"yaml\";\nimport { parseCollections, type CollectionConfig } from \"./collections.js\";\nimport { isValidEncryptionKey } from \"./encryption.js\";\nimport { PROVIDERS_KEY, parseProviders, type ProvidersConfig } from \"./providers.js\";\nimport { searchPath } from \"./git-root.js\";\nimport { parseTools, type ToolsConfig } from \"./tools.js\";\nimport { warn } from \"./warn.js\";\nimport { errorMessage } from \"./errors.js\";\n\n/** The canonical family filenames, in discovery order. */\nexport const FAMILY_CONFIG_NAMES: readonly string[] = [\n \"manni.config.yaml\",\n \"manni.config.yml\",\n];\n\n/** The top-level key holding the family encryption key (proposal 0045). */\nexport const ENCRYPTION_KEY_FIELD = \"encryptionKey\";\n\n/**\n * The top-level key holding the key a rotation is replacing (proposal 0045).\n * Present only while a rotation is unfinished: `manni key rotate` writes it\n * beside the new key before it touches a page, and removes it once every page\n * is written. Read only by `manni key rotate`, which finishes the rotation.\n */\nexport const ENCRYPTION_KEY_PREVIOUS_FIELD = \"encryptionKeyPrevious\";\n\nexport interface ConfigFileOptions {\n /** The tool's key in a family file, e.g. `\"meta\"`. */\n section: string;\n /**\n * The tool's own filenames from before the family file, in discovery order.\n * Their whole document is the tool's section.\n */\n legacyNames: readonly string[];\n /** Build the error for an unreadable document, in the tool's own class. */\n toError: (message: string) => Error;\n}\n\nexport interface ConfigFile {\n /** Absolute path to the file. */\n path: string;\n /** Directory holding it; relative paths in the config resolve from here. */\n dir: string;\n /**\n * The file as the user would name it: relative to `cwd`, posix separators,\n * or the spelling they typed for an explicit path. For error messages.\n */\n source: string;\n /** The file's text, for a tool that rewrites the file in place. */\n text: string;\n /**\n * The tool's slice: the value under `section:` when `wrapped`, otherwise\n * the whole document. `null` for an empty file or an empty section; the\n * tool decides what empty means.\n */\n value: unknown;\n /** Whether `value` came from under `section:`. */\n wrapped: boolean;\n /** How the file was found. Explicit paths are never warned about. */\n kind: \"manni\" | \"legacy\" | \"explicit\";\n /**\n * The document's top-level `collections:` (proposal 0041), parsed once here\n * because every tool reads the same declaration. `[]` when the key is\n * absent, and always `[]` for a `legacy` file: a per-tool file's whole\n * document *is* the tool's section, so it carries no family-wide keys.\n */\n collections: CollectionConfig[];\n /**\n * The document's top-level `tools:` (proposal 0052), an outside tool's\n * settings, parsed once here for the same reason as `collections`. `{}` when\n * the key is absent, and always `{}` for a `legacy` file.\n */\n tools: ToolsConfig;\n /**\n * The document's top-level `encryptionKey:` (proposal 0045), validated\n * here. Absent when the key is, and always absent for a `legacy` file, for\n * the same reason as `collections`. `MANNI_ENCRYPTION_KEY` wins over it;\n * read it through `resolveEncryptionKey`, not directly.\n */\n encryptionKey?: string;\n /**\n * The document's top-level `encryptionKeyPrevious:`, validated here as\n * `encryptionKey` is. Present only while a rotation is unfinished, and read\n * only by `manni key rotate`, which finishes it.\n */\n encryptionKeyPrevious?: string;\n /**\n * The document's top-level `providers:`, parsed here with a relative\n * `llama-cpp.modelsDir` resolved against `dir`. Absent when the key is, and\n * always absent for a `legacy` file, for the same reason as `collections`.\n */\n providers?: ProvidersConfig;\n}\n\ntype ToError = (message: string) => Error;\n\ninterface Document {\n text: string;\n /** Parsed YAML: a mapping, or `null` for an empty file. */\n doc: Record<string, unknown> | null;\n}\n\nfunction readDocument(\n path: string,\n source: string,\n toError: ToError,\n): Document | null {\n let text: string;\n try {\n text = readFileSync(path, \"utf8\");\n } catch {\n return null;\n }\n return { text, doc: parseMapping(text, source, toError) };\n}\n\n/**\n * Parse outside any \"not found\" handling. A discovered file with a typo must\n * be reported, not skipped: falling through to the next candidate, or to no\n * config at all, would run the tool on defaults and read as a clean pass.\n */\nfunction parseMapping(\n text: string,\n source: string,\n toError: ToError,\n): Record<string, unknown> | null {\n let raw: unknown;\n try {\n raw = parseYaml(text);\n } catch (err) {\n throw toError(`${source}: invalid YAML: ${errorMessage(err)}`);\n }\n if (raw == null) return null;\n if (typeof raw !== \"object\" || Array.isArray(raw)) {\n throw toError(`${source}: top level must be a mapping.`);\n }\n return raw as Record<string, unknown>;\n}\n\n/** The top-level key holding the family's document sets. */\nconst COLLECTIONS_KEY = \"collections\";\n\n/** The top-level key holding outside tools' settings (proposal 0052). */\nconst TOOLS_KEY = \"tools\";\n\n/** The keys that belong to the family, not to any one tool. */\nconst FAMILY_KEYS: readonly string[] = [\n COLLECTIONS_KEY,\n TOOLS_KEY,\n ENCRYPTION_KEY_FIELD,\n PROVIDERS_KEY,\n];\n\nfunction slice(\n document: Document,\n opts: ConfigFileOptions,\n): { value: unknown; wrapped: boolean } | null {\n const { doc } = document;\n if (doc !== null && Object.hasOwn(doc, opts.section)) {\n return { value: doc[opts.section] ?? null, wrapped: true };\n }\n // A family file carrying a family key and no section is still this tool's\n // config: the documents are declared (0041), or the key is (0045), or the\n // provider settings are, and the tool just has no options of its own.\n // Handing back an empty section is what stops discovery walking past it.\n // For the key that matters twice: a\n // file the key prompt created holds nothing else, and the next run must\n // find it.\n if (doc !== null && FAMILY_KEYS.some((key) => Object.hasOwn(doc, key))) {\n return { value: null, wrapped: true };\n }\n return null;\n}\n\n/**\n * The document's collections. Parsed with the tool's own `toError`, so a bad\n * `collections:` is reported in the class the tool already catches.\n */\nfunction collectionsOf(\n document: Document,\n source: string,\n toError: ToError,\n): CollectionConfig[] {\n const { doc } = document;\n if (doc === null || !Object.hasOwn(doc, COLLECTIONS_KEY)) return [];\n return parseCollections(doc[COLLECTIONS_KEY], source, toError);\n}\n\n/**\n * The document's outside-tool settings. Parsed with the tool's own `toError`,\n * as `collections:` is.\n */\nfunction toolsOf(document: Document, source: string, toError: ToError): ToolsConfig {\n const { doc } = document;\n if (doc === null || !Object.hasOwn(doc, TOOLS_KEY)) return {};\n return parseTools(doc[TOOLS_KEY], source, toError);\n}\n\n/**\n * The document's encryption key, as a spreadable field. A malformed one is an\n * error in the tool's class, and the message never repeats the value: it is\n * key material, and a CI log is not the place for it.\n */\nfunction encryptionKeyOf(\n document: Document,\n source: string,\n toError: ToError,\n): { encryptionKey?: string; encryptionKeyPrevious?: string } {\n const { doc } = document;\n if (doc === null) return {};\n const keys: { encryptionKey?: string; encryptionKeyPrevious?: string } = {};\n if (Object.hasOwn(doc, ENCRYPTION_KEY_FIELD)) {\n const value = doc[ENCRYPTION_KEY_FIELD];\n if (!isValidEncryptionKey(value)) {\n throw toError(\n `${source}: \"${ENCRYPTION_KEY_FIELD}\" must be at least 32 hex or base64url characters. Run \\`manni key set\\` to generate one.`,\n );\n }\n keys.encryptionKey = value;\n }\n // The key an unfinished rotation is replacing. Key material too, so the\n // same shape rule and the same silence about the value. There is no advice\n // to generate one: `manni key rotate` writes it, and nothing else should.\n if (Object.hasOwn(doc, ENCRYPTION_KEY_PREVIOUS_FIELD)) {\n const value = doc[ENCRYPTION_KEY_PREVIOUS_FIELD];\n if (!isValidEncryptionKey(value)) {\n throw toError(\n `${source}: \"${ENCRYPTION_KEY_PREVIOUS_FIELD}\" must be at least 32 hex or base64url characters.`,\n );\n }\n keys.encryptionKeyPrevious = value;\n }\n return keys;\n}\n\n/**\n * The document's provider settings, as a spreadable field. Parsed with the\n * tool's own `toError`, and a relative path in them resolves from `dir`.\n */\nfunction providersOf(\n document: Document,\n source: string,\n dir: string,\n toError: ToError,\n): { providers?: ProvidersConfig } {\n const { doc } = document;\n if (doc === null || !Object.hasOwn(doc, PROVIDERS_KEY)) return {};\n return { providers: parseProviders(doc[PROVIDERS_KEY], source, dir, toError) };\n}\n\n/**\n * The family keys as `manni key` reads them: only valid ones, and a malformed\n * one is no error, because replacing it is what the caller is for.\n */\nfunction tolerantKeysOf(document: Document): {\n encryptionKey?: string;\n encryptionKeyPrevious?: string;\n} {\n const key = document.doc?.[ENCRYPTION_KEY_FIELD];\n const previous = document.doc?.[ENCRYPTION_KEY_PREVIOUS_FIELD];\n return {\n ...(isValidEncryptionKey(key) ? { encryptionKey: key } : {}),\n ...(isValidEncryptionKey(previous) ? { encryptionKeyPrevious: previous } : {}),\n };\n}\n\nfunction relativeSource(cwd: string, path: string): string {\n return relative(cwd, path).replace(/\\\\/g, \"/\");\n}\n\n/**\n * Discover the tool's config from `cwd` upward. `null` when nothing exists.\n */\nexport function findConfigFileSync(\n cwd: string,\n opts: ConfigFileOptions,\n): ConfigFile | null {\n const start = resolve(cwd);\n for (const dir of searchPath(start)) {\n for (const name of FAMILY_CONFIG_NAMES) {\n const path = join(dir, name);\n const source = relativeSource(start, path);\n const document = readDocument(path, source, opts.toError);\n if (document === null) continue;\n const found = slice(document, opts);\n // A family file without this tool's key belongs to a sibling. Keep\n // looking, rather than treating the file as an empty config.\n if (found === null) continue;\n return {\n path,\n dir,\n source,\n text: document.text,\n kind: \"manni\",\n collections: collectionsOf(document, source, opts.toError),\n tools: toolsOf(document, source, opts.toError),\n ...encryptionKeyOf(document, source, opts.toError),\n ...providersOf(document, source, dir, opts.toError),\n ...found,\n };\n }\n for (const name of opts.legacyNames) {\n const path = join(dir, name);\n const source = relativeSource(start, path);\n const document = readDocument(path, source, opts.toError);\n if (document === null) continue;\n warn(\n `\"${name}\" is a deprecated config file name. Move its keys under \\`${opts.section}:\\` in \"${FAMILY_CONFIG_NAMES[0] ?? \"manni.config.yaml\"}\", and its paths, exclude and sidecars keys to a top-level collections: list, where sidecars becomes externalMetadata.`,\n );\n return {\n path,\n dir,\n source,\n text: document.text,\n value: document.doc,\n wrapped: false,\n kind: \"legacy\",\n collections: [],\n tools: {},\n };\n }\n }\n return null;\n}\n\n/**\n * Read the config at an explicit path. Missing is an error: a `-c` pointing\n * at a file that is not there is a mistake worth failing on, not a reason to\n * quietly run against something else.\n */\nexport function readConfigFileSync(\n explicitPath: string,\n cwd: string,\n opts: ConfigFileOptions,\n): ConfigFile {\n const path = resolve(cwd, explicitPath);\n // Report the spelling the user typed, not the resolved absolute path.\n const document = readDocument(path, explicitPath, opts.toError);\n if (document === null) {\n throw opts.toError(`Config file not found: \"${explicitPath}\".`);\n }\n const found = slice(document, opts) ?? {\n value: document.doc,\n wrapped: false,\n };\n return {\n path,\n dir: dirname(path),\n source: explicitPath,\n text: document.text,\n kind: \"explicit\",\n collections: collectionsOf(document, explicitPath, opts.toError),\n tools: toolsOf(document, explicitPath, opts.toError),\n // An unwrapped document carries no family key (else it would be wrapped),\n // so this only ever reads a family file's key.\n ...encryptionKeyOf(document, explicitPath, opts.toError),\n ...providersOf(document, explicitPath, dirname(path), opts.toError),\n ...found,\n };\n}\n\n/** `findConfigFileSync`, for callers that await. */\nexport function findConfigFile(\n cwd: string,\n opts: ConfigFileOptions,\n): Promise<ConfigFile | null> {\n return Promise.resolve().then(() => findConfigFileSync(cwd, opts));\n}\n\n/** `readConfigFileSync`, for callers that await. */\nexport function readConfigFile(\n explicitPath: string,\n cwd: string,\n opts: ConfigFileOptions,\n): Promise<ConfigFile> {\n return Promise.resolve().then(() =>\n readConfigFileSync(explicitPath, cwd, opts),\n );\n}\n\n/**\n * The nearest family file from `cwd` upward, whatever it carries: any tool's\n * section, a family key, or nothing at all. For `manni key`, which writes the\n * family's key and so belongs to no one tool's section. Never a legacy\n * per-tool file, whose whole document is one tool's section.\n *\n * `value` is `null` and `wrapped` is `true`: no tool's section is handed\n * over. `encryptionKey` is set only when the file holds a valid one. A\n * malformed key is not an error here, unlike in `findConfigFile`, because\n * replacing it is what the caller is for.\n */\nexport function findFamilyConfigFile(\n cwd: string,\n toError: ToError,\n): Promise<ConfigFile | null> {\n return Promise.resolve().then(() => findFamilyConfigFileSync(cwd, toError));\n}\n\nfunction findFamilyConfigFileSync(\n cwd: string,\n toError: ToError,\n): ConfigFile | null {\n const start = resolve(cwd);\n for (const dir of searchPath(start)) {\n for (const name of FAMILY_CONFIG_NAMES) {\n const path = join(dir, name);\n const source = relativeSource(start, path);\n const document = readDocument(path, source, toError);\n if (document === null) continue;\n return {\n path,\n dir,\n source,\n text: document.text,\n value: null,\n wrapped: true,\n kind: \"manni\",\n collections: collectionsOf(document, source, toError),\n tools: toolsOf(document, source, toError),\n ...tolerantKeysOf(document),\n };\n }\n }\n return null;\n}\n\n/**\n * Read an explicit path as a family file, for `manni key set -c`, which writes\n * the family's key and so belongs to no one tool's section.\n *\n * The file is a family file when it is empty, carries a family key, or is\n * named as one (`manni.config.yaml`, `manni.config.yml`): its top-level keys\n * are then sections, whatever they are, and `value` is `null`. Anything else\n * is read whole as one tool's section (`wrapped: false`), which the key writer\n * refuses rather than turn into a family file under that tool's feet. Missing\n * is an error, as it is for `readConfigFile`. Keys are carried as\n * `findFamilyConfigFile` carries them.\n */\nexport function readFamilyConfigFile(\n explicitPath: string,\n cwd: string,\n toError: ToError,\n): Promise<ConfigFile> {\n return Promise.resolve().then(() =>\n readFamilyConfigFileSync(explicitPath, cwd, toError),\n );\n}\n\nfunction readFamilyConfigFileSync(\n explicitPath: string,\n cwd: string,\n toError: ToError,\n): ConfigFile {\n const path = resolve(cwd, explicitPath);\n const document = readDocument(path, explicitPath, toError);\n if (document === null) {\n throw toError(`Config file not found: \"${explicitPath}\".`);\n }\n const { doc } = document;\n const named = FAMILY_CONFIG_NAMES.includes(basename(path));\n const family =\n doc === null || named || FAMILY_KEYS.some((key) => Object.hasOwn(doc, key));\n return {\n path,\n dir: dirname(path),\n source: explicitPath,\n text: document.text,\n value: family ? null : doc,\n wrapped: family,\n kind: \"explicit\",\n collections: collectionsOf(document, explicitPath, toError),\n tools: toolsOf(document, explicitPath, toError),\n ...tolerantKeysOf(document),\n };\n}\n","/**\n * The project boundary: the nearest directory at or above `cwd` holding a\n * `.git` entry. A file or a directory, since a worktree's `.git` is a file.\n *\n * Two callers need it for opposite reasons and only one of them wants a\n * chain. Config discovery walks the chain and stops here. The SARIF reporter\n * needs the root itself, and needs \"there is no repository\" to be\n * distinguishable from \"the repository root is where you are standing\" — a\n * one-element chain conflates the two, and getting that wrong means emitting\n * paths GitHub silently drops.\n */\nimport { existsSync } from \"node:fs\";\nimport { dirname, join, resolve } from \"node:path\";\n\nexport function findGitRoot(cwd: string): string | null {\n let dir = resolve(cwd);\n for (;;) {\n if (existsSync(join(dir, \".git\"))) return dir;\n const parent = dirname(dir);\n if (parent === dir) return null;\n dir = parent;\n }\n}\n\n/**\n * The directories a discovery walk may look in, nearest first.\n *\n * The walk stops at the project boundary `findGitRoot` reports, which is\n * included in the search. Only that one call touches the filesystem; the chain\n * itself is then assembled from path strings.\n *\n * With **no** boundary anywhere above cwd, only cwd is considered. A\n * project-scoped config has no meaning without a project, and walking on would\n * let a stray config file in a home or temp directory silently govern\n * unrelated runs — including this repo's own tests, which work in OS temp\n * directories under the user's home.\n */\nexport function searchPath(cwd: string): string[] {\n const start = resolve(cwd);\n const root = findGitRoot(start);\n if (root === null) return [start];\n const chain: string[] = [];\n let dir = start;\n for (;;) {\n chain.push(dir);\n if (dir === root) return chain;\n const parent = dirname(dir);\n // `root` is an ancestor of `start` by construction, so this is unreachable\n // — but a filesystem race (the boundary removed mid-walk) must not loop.\n if (parent === dir) return chain;\n dir = parent;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAkBA,OAAOA,gBAAe;;;ACTtB,OAAO,eAAe;AAWtB,IAAM,eAAe,oBAAI,IAAoC;AAMtD,SAAS,gBACd,SACA,MACS;AAQT,QAAM,MAAM,KAAK,UAAU,IAAI;AAC/B,MAAI,IAAI,aAAa,IAAI,GAAG;AAC5B,MAAI,CAAC,GAAG;AACN,QAAI,UAAU,MAA2B,EAAE,KAAK,KAAK,CAAC;AACtD,iBAAa,IAAI,KAAK,CAAC;AAAA,EACzB;AAEA,SAAO,EAAE,QAAQ,QAAQ,OAAO,GAAG,CAAC;AACtC;;;ADzBA,SAAS,SAAAC,QAAO,aAAa;;;AED7B,SAAS,cAAc,oBAAoB;AAC3C,SAAS,YAAY,OAAO,UAAU,SAAS,WAAW;AAC1D,OAAO,QAAQ;AACf,SAAS,aAAa,OAAO,QAAQ,UAAU,qBAAqB;AAG7D,IAAM,mBAAmB;AAGzB,SAAS,mBAAmB,MAAuB;AACxD,SAAO,KAAK,SAAS,gBAAgB;AACvC;AAGA,SAAS,QAAQ,MAAsB;AACrC,SAAO,KAAK,MAAM,GAAG,EAAE,KAAK,GAAG,EAAE,QAAQ,OAAO,GAAG;AACrD;AAMO,SAAS,yBAAyB,MAAsB;AAC7D,QAAM,UAAU,KAAK,QAAQ,OAAO,GAAG;AACvC,SAAO,QAAQ,WAAW,IAAI,IAAI,QAAQ,MAAM,CAAC,IAAI;AACvD;AAYO,SAAS,iBACd,MACA,WACA,SACmE;AACnE,QAAM,UAAU,SAAS,WAAW,OAAO;A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AA,QACpD,OAAO,QAAQ,UAAU,QAAQ,OAAO;AAAA,QACxC,GAAG,eAAe,QAAQ;AAAA,MAC5B;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAcO,SAAS,qBACd,cACA,KACA,SACqB;AACrB,SAAO,QAAQ,QAAQ,EAAE;AAAA,IAAK,MAC5B,yBAAyB,cAAc,KAAK,OAAO;AAAA,EACrD;AACF;AAEA,SAAS,yBACP,cACA,KACA,SACY;AACZ,QAAM,OAAOD,SAAQ,KAAK,YAAY;AACtC,QAAM,WAAW,aAAa,MAAM,cAAc,OAAO;AACzD,MAAI,aAAa,MAAM;AACrB,UAAM,QAAQ,2BAA2B,YAAY,IAAI;AAAA,EAC3D;AACA,QAAM,EAAE,IAAI,IAAI;AAChB,QAAM,QAAQ,oBAAoB,SAAS,SAAS,IAAI,CAAC;AACzD,QAAM,SACJ,QAAQ,QAAQ,SAAS,YAAY,KAAK,CAAC,QAAQ,OAAO,OAAO,KAAK,GAAG,CAAC;AAC5E,SAAO;AAAA,IACL;AAAA,IACA,KAAKE,SAAQ,IAAI;AAAA,IACjB,QAAQ;AAAA,IACR,MAAM,SAAS;AAAA,IACf,OAAO,SAAS,OAAO;AAAA,IACvB,SAAS;AAAA,IACT,MAAM;AAAA,IACN,aAAa,cAAc,UAAU,cAAc,OAAO;AAAA,IAC1D,OAAO,QAAQ,UAAU,cAAc,OAAO;AAAA,IAC9C,GAAG,eAAe,QAAQ;AAAA,EAC5B;AACF;","names":["picomatch","posix","isMember","posix","picomatch","isAbsolute","resolve","isMapping","rejectUnknownKeys","readFileSync","dirname","join","relative","resolve","resolve","readFileSync","relative","resolve","join","dirname"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/cite/index.ts","../src/cite/core/reencrypt.ts","../src/key/errors.ts","../src/key/commands/rotate.ts","../src/key/core/config.ts","../src/key/commands/set.ts"],"sourcesContent":["/**\n * The citation tool's programmatic API, exported from the package as the\n * `cite` namespace: `import { cite } from \"@hawkeyexl/manni\"`.\n */\nexport * from \"./types.js\";\nexport { CiteError } from \"./errors.js\";\nexport { DEFAULT_SEVERITY, RULE_ID_PREFIX, isCiteRule, resolveSeverity, ruleId } from \"./core/severity.js\";\nexport {\n FILE_PATTERN,\n SRC_PATTERN,\n formatSrc,\n lineSpec,\n parseLines,\n parseSrc,\n rangeLines,\n sourceRange,\n spellLines,\n spellSource,\n} from \"./core/range.js\";\nexport { hashLines, hashRange, isKeyedPin, normalizeText, sliceLines, splitLines } from \"./core/hash.js\";\nexport { shortCommit, shortLine, shortPin, shortSrc, spellAt } from \"./core/spell.js\";\nexport { buildSourceIndex, readSource } from \"./core/sources.js\";\nexport type { BuildIndexOptions, ReadSourceResult } from \"./core/sources.js\";\nexport {\n isUnitText,\n markerClaimEnd,\n markerRunAt,\n misplacedMarkerAt,\n misplacedMarkers,\n movedUnit,\n pre43Span,\n splitUnit,\n unitText,\n} from \"./core/reanchor.js\";\nexport type { MisplacedMarker } from \"./core/reanchor.js\";\nexport {\n anchoredLines,\n detectEol,\n fenceSpanAt,\n fencedBlockAfter,\n fencedBlockAt,\n fencedBlocks,\n formatStatement,\n insideFence,\n isBoundLine,\n isTableRow,\n lineAt,\n offsetOfLine,\n paragraphAfter,\n parseStatements,\n statementForms,\n} from \"./core/statements.js\";\nexport type { StatementForm } from \"./core/statements.js\";\nexport {\n blockMatches,\n claimEnd,\n claimLine,\n markerUnit,\n noUnitAt,\n normalizeWhitespace,\n pinOfLines,\n toBodyLines,\n toFileLines,\n unitAt,\n} from \"./core/claims.js\";\nexport type { ClaimUnit, NoUnit } from \"./core/claims.js\";\nexport {\n GIT_UNAVAILABLE_COMMIT,\n GIT_UNAVAILABLE_HISTORY,\n PAGE_HISTORY_UNAVAILABLE,\n gitClient,\n noGit,\n} from \"./core/git.js\";\nexport {\n MAX_PAGE_COMMITS,\n claimDiff,\n claimHistory,\n claimWords,\n holdsWords,\n refineClaim,\n runsHolding,\n sentencesOf,\n sharesSentence,\n stripMarkers,\n} from \"./core/history.js\";\nexport type { ClaimHistory, ClaimHistoryInput, RefineClaimInput } from \"./core/history.js\";\nexport { MAX_RANGE_LINES, MOVE_BUDGET_BYTES, MOVE_WINDOW_LINES, classifyCitation, findWindows, historyOf } from \"./core/classify.js\";\nexport type { ClassifyOptions, FindWindowsOptions, History } from \"./core/classify.js\";\nexport {\n MARKER_JSON,\n MAX_MARKERS_PER_PAGE,\n bodyLineOf,\n citationInputs,\n ownedMessage,\n pickExtractor,\n readPage,\n validateEntry,\n} from \"./core/page.js\";\nexport { shiftedEntries, withClaimLines } from \"./core/shift.js\";\nexport type { ShiftOptions, Shifted } from \"./core/shift.js\";\nexport {\n CITATIONS_KEY,\n duplicateJoinRefusal,\n loadCitationSidecars,\n orphanRefusal,\n sidecarsFor,\n twoManifestsRefusal,\n urlManifestRefusal,\n} from \"./core/sidecar.js\";\nexport type {\n CitationManifest,\n CitationSidecars,\n LoadSidecarOptions,\n PageSidecar,\n} from \"./core/sidecar.js\";\nexport { ManifestSet, itemLine, splice } from \"./core/manifest.js\";\nexport type { HeldManifest } from \"./core/manifest.js\";\nexport type { ReadPageOptions } from \"./core/page.js\";\nexport { checkCitations } from \"./core/check-page.js\";\nexport {\n claimMessageFor,\n errorSite,\n findingsFor,\n messageFor,\n misplacedMessageFor,\n toValidationResult,\n} from \"./core/adapt.js\";\nexport {\n appendFrontmatterCitation,\n entryObject,\n insertStatementBefore,\n removeFrontmatterCitations,\n removeLine,\n spliceEntryField,\n unifiedDiff,\n} from \"./core/write.js\";\nexport type { EntryPath } from \"./core/write.js\";\nexport { mintCitation } from \"./core/mint.js\";\nexport { CITE_SECTION, DEFAULT_CITE_BASELINE_PATH, loadCiteConfig, parseCiteConfig, readCiteConfigFile, resolveCiteRun } from \"./core/config.js\";\nexport type { CiteRunOptions } from \"./core/config.js\";\n\nexport { runCheck } from \"./commands/check.js\";\nexport { runAdd } from \"./commands/add.js\";\nexport { runRemove } from \"./commands/remove.js\";\nexport { runUpdate } from \"./commands/update.js\";\nexport { reencryptCitationEntries, reencryptCitations } from \"./core/reencrypt.js\";\nexport type { ReencryptEntriesResult, ReencryptOptions } from \"./core/reencrypt.js\";\nexport {\n refusalLine,\n removalLine,\n renderCheckPretty,\n renderRemovePretty,\n renderUpdatePretty,\n rewriteLine,\n} from \"./reporters/pretty.js\";\nexport type { PrettyOptions } from \"./reporters/pretty.js\";\nexport { renderCheckJson, renderRemoveJson, renderUpdateJson } from \"./reporters/json.js\";\nexport { renderCheckGithub } from \"./reporters/github.js\";\n","/**\n * `reencryptCitations`: re-encrypt one page's encrypted citations under a new\n * key, for `manni key rotate` (proposal 0045). It reads sources and never\n * writes: the caller gets the rewritten page back, and writes it only once\n * every page in the run could be re-encrypted.\n *\n * A citation counts as done only when its `source.file` decrypts under the\n * new key *and* its pin holds under the new key. Either alone is a half\n * rotation, and a rerun has to finish it rather than declare it done. Meta's\n * walker cannot leave one today, because it skips the whole `citations` key\n * and cite encrypts in its own `cite-src` context; an interrupted run, a hand\n * edit, or a second writer of the same manifest can.\n *\n * The path must be tracked, and the pin must hold under the old key, over the\n * lines as they are today or, with git, as they were at the entry's\n * `commit-sha` (the classifier's history search). Then `file` becomes the\n * path's ciphertext under the new key, its lines kept, and `integrity` the\n * keyed pin under it, so a `changed` citation stays exactly as changed. A pin\n * that holds nowhere is skipped, with `update --accept` named as the repair.\n * No message names a path.\n */\nimport type {\n Citation,\n CitationInput,\n CitationOrigin,\n GitClient,\n ReencryptCitationsResult,\n ReencryptedCitation,\n SourceIndex,\n SourceRange,\n} from \"../types.js\";\nimport { historyOf } from \"./classify.js\";\nimport { gitClient } from \"./git.js\";\nimport { hashLines, sliceLines, splitLines } from \"./hash.js\";\nimport { readPage } from \"./page.js\";\nimport { formatSrc, sourceRange, spellSource } from \"./range.js\";\nimport { buildSourceIndex, decryptSourcePath, encryptSourcePath, readSource } from \"./sources.js\";\nimport { spliceEntryField } from \"./write.js\";\n\nconst UNDECRYPTABLE = \"does not decrypt under the current key\";\nconst MISSING = \"missing (no tracked file matches)\";\nconst CHANGED = \"changed; run `manni cite update --accept` before rotating\";\n\ntype Where = Pick<ReencryptedCitation, \"id\" | \"index\" | \"line\">;\n\n/** The fields a report row carries to name the entry: its id, or where it sits. */\nfunction whereOf(citation: Citation, origin: CitationOrigin): Where {\n const where: Where = { index: origin.index };\n if (citation.id !== undefined) where.id = citation.id;\n if (origin.line !== undefined) where.line = origin.line;\n return where;\n}\n\ninterface Context {\n root: string;\n index: SourceIndex;\n git: GitClient;\n}\n\n/**\n * The lines the pin was taken over, joined: today's when the pin holds there\n * under `key`, else the lines at the entry's commit when git can show them;\n * else why neither.\n */\nasync function pinnedLines(\n ctx: Context,\n citation: Citation,\n range: SourceRange,\n path: string,\n key: string,\n): Promise<{ joined: string } | { skip: string }> {\n const source = await readSource(ctx.root, ctx.index, { ...range, path, encrypted: false });\n if (source.kind === \"missing\") return { skip: MISSING };\n const pin = citation.source.integrity;\n let joined: string | undefined;\n try {\n joined = sliceLines(splitLines(source.text), range);\n } catch {\n // The range runs past the end of the file as it is now.\n joined = undefined;\n }\n if (joined !== undefined && hashLines(joined, key) === pin) return { joined };\n\n const commit = citation.source[\"commit-sha\"];\n if (commit !== undefined && (await ctx.git.available())) {\n const history = await historyOf(ctx.git, commit, path, range, pin, key, undefined);\n if (history.kind === \"original\") return { joined: history.lines.join(\"\\n\") };\n }\n return { skip: CHANGED };\n}\n\n/** What one citation needs: nothing, a new pair of values, or a reason it cannot be done. */\ntype Verdict =\n | { kind: \"done\" }\n | { kind: \"skip\"; message: string }\n | { kind: \"write\"; file: string; integrity: string; to: string };\n\n/** Options every re-encryption takes, whichever channel the entry lives in. */\nexport interface ReencryptOptions {\n root: string;\n fromKey: string;\n toKey: string;\n /** History and the source index are read through it; defaults to one over the root. */\n gitClient?: GitClient;\n sourceIndex?: SourceIndex;\n}\n\n/**\n * One citation's verdict: whether it is already under the new key, what its\n * `source.file` and `source.integrity` become, or why neither. The rule is\n * the same wherever the entry is kept, so the page splicer and the manifest\n * writer both go through here.\n */\nasync function verdictFor(\n ctx: Context,\n citation: Citation,\n opts: Pick<ReencryptOptions, \"fromKey\" | \"toKey\">,\n): Promise<Verdict> {\n const range = sourceRange(citation.source);\n const underNew = decryptSourcePath(range.path, opts.toKey);\n // Done only when both halves are under the new key; a file that is and a\n // pin that is not is the half rotation this finishes.\n if (underNew !== undefined) {\n const held = await pinnedLines(ctx, citation, range, underNew, opts.toKey);\n if (\"joined\" in held) return { kind: \"done\" };\n }\n const path = underNew ?? decryptSourcePath(range.path, opts.fromKey);\n if (path === undefined) return { kind: \"skip\", message: UNDECRYPTABLE };\n const lines = await pinnedLines(ctx, citation, range, path, opts.fromKey);\n if (\"skip\" in lines) return { kind: \"skip\", message: lines.skip };\n const file = underNew === undefined ? encryptSourcePath(path, opts.toKey) : range.path;\n return {\n kind: \"write\",\n file,\n integrity: hashLines(lines.joined, opts.toKey),\n to: formatSrc({ ...range, path: file }),\n };\n}\n\n/** The git client and source index a run shares, built once per page at most. */\nasync function contextFor(opts: ReencryptOptions): Promise<Context> {\n const git = opts.gitClient ?? gitClient(opts.root);\n const index = opts.sourceIndex ?? (await buildSourceIndex(opts.root, { gitClient: git }));\n return { root: opts.root, index, git };\n}\n\nexport async function reencryptCitations(\n page: { file: string; content: string; format?: string },\n opts: ReencryptOptions,\n): Promise<ReencryptCitationsResult> {\n const read = readPage(page.file, page.content, page.format === undefined ? undefined : { format: page.format });\n const result: ReencryptCitationsResult = { content: page.content, rewritten: [], skipped: [] };\n const encrypted = read.citations.filter(({ citation }) => sourceRange(citation.source).encrypted);\n // A page with nothing encrypted costs no index and no git.\n if (encrypted.length === 0) return result;\n\n const ctx = await contextFor(opts);\n let after = page.content;\n for (const { citation, origin } of encrypted) {\n const range = sourceRange(citation.source);\n const where = whereOf(citation, origin);\n const verdict = await verdictFor(ctx, citation, opts);\n if (verdict.kind === \"done\") continue;\n if (verdict.kind === \"skip\") {\n result.skipped.push({ ...where, message: verdict.message });\n continue;\n }\n if (verdict.file !== range.path) {\n after = spliceEntryField(after, read.format, origin.index, [\"source\", \"file\"], verdict.file);\n }\n after = spliceEntryField(\n after,\n read.format,\n origin.index,\n [\"source\", \"integrity\"],\n verdict.integrity,\n );\n result.rewritten.push({ ...where, from: spellSource(citation.source), to: verdict.to });\n }\n result.content = after;\n return result;\n}\n\n/** What `reencryptCitationEntries` did to one page's manifest entries. */\nexport interface ReencryptEntriesResult {\n /** The entries as they should now be written, a copy of what came in. */\n entries: unknown[];\n /** Whether any of them changed. */\n changed: boolean;\n rewritten: ReencryptedCitation[];\n skipped: { id?: string; index?: number; line?: number; message: string }[];\n}\n\n/**\n * The same rotation, for a page whose citations live in a manifest.\n *\n * The entries come from meta's merge, so they are plain values; each one is\n * validated as `readPage` validates a frontmatter entry, and an encrypted\n * source's `file` and `integrity` are rewritten in place. The caller writes\n * the whole list back with one splice, once every page of the run could be\n * re-encrypted.\n */\nexport async function reencryptCitationEntries(\n page: { file: string; content: string; format?: string; citations: readonly CitationInput[] },\n opts: ReencryptOptions,\n): Promise<ReencryptEntriesResult> {\n const entries: unknown[] = JSON.parse(\n JSON.stringify(page.citations.map((input) => input.entry)),\n ) as unknown[];\n const out: ReencryptEntriesResult = { entries, changed: false, rewritten: [], skipped: [] };\n\n const read = readPage(page.file, page.content, {\n ...(page.format === undefined ? {} : { format: page.format }),\n citations: page.citations,\n });\n const encrypted = read.citations.filter(({ citation }) => sourceRange(citation.source).encrypted);\n if (encrypted.length === 0) return out;\n\n const ctx = await contextFor(opts);\n for (const { citation, origin } of encrypted) {\n const where = whereOf(citation, origin);\n const verdict = await verdictFor(ctx, citation, opts);\n if (verdict.kind === \"done\") continue;\n if (verdict.kind === \"skip\") {\n out.skipped.push({ ...where, message: verdict.message });\n continue;\n }\n const entry: unknown = entries[origin.index];\n const source =\n typeof entry === \"object\" && entry !== null && !Array.isArray(entry)\n ? (entry as Record<string, unknown>).source\n : undefined;\n if (typeof source !== \"object\" || source === null || Array.isArray(source)) {\n out.skipped.push({ ...where, message: UNDECRYPTABLE });\n continue;\n }\n const fields = source as Record<string, unknown>;\n fields.file = verdict.file;\n fields.integrity = verdict.integrity;\n out.changed = true;\n out.rewritten.push({ ...where, from: spellSource(citation.source), to: verdict.to });\n }\n return out;\n}\n","import { ToolError } from \"../shared/errors.js\";\n\n/** An operational or usage error in the key domain: exit 2. */\nexport class KeyError extends ToolError {\n constructor(message: string) {\n super(message);\n this.name = \"KeyError\";\n }\n}\n","/**\n * `manni key rotate [paths...]`: re-encrypt every encrypted value under a new\n * key, then write the key (proposal 0045).\n *\n * Values are found by their ciphertext, never through schema marks: meta's\n * `reencryptMetadata` takes every string of the ciphertext shape in a page's\n * metadata, and cite's `reencryptCitations` every encrypted `source.file` with its\n * keyed pin. A value already under the new key counts as done, so a run can\n * always be repeated.\n *\n * A value does not have to sit in a page. An external-metadata manifest\n * (proposal 0037) holds the private half of the same documents, which is\n * where an encrypted value most often lives, so the local manifests of the\n * collections a run covers are re-encrypted with the pages. See\n * `planManifests`.\n *\n * Input resolution is `cite check`'s: positional paths from `cwd`, else the\n * selected collections' `paths:` from the config's directory, `--exclude`\n * added to a collection's own `exclude:`, and zero files an error unless\n * `--allow-empty`.\n *\n * Every page and manifest is re-encrypted in memory first. One skip and\n * nothing is written (exit 1). Otherwise a whole run whose key comes from the\n * config writes in three steps, so that an interruption at any point leaves\n * every value readable by the next run:\n *\n * 1. the config: `encryptionKey:` the new key, `encryptionKeyPrevious:` the\n * old one, in one atomic write;\n * 2. the pages, then the manifests;\n * 3. the config again, without `encryptionKeyPrevious:`.\n *\n * A run that finds `encryptionKeyPrevious:` finishes that rotation: from the\n * previous key to the current one. A narrowed run (paths or `--collection`)\n * and a run whose key comes from `MANNI_ENCRYPTION_KEY` write pages and\n * manifests and never the config. `--dry-run` writes nothing at all.\n */\nimport { existsSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport { isAbsolute, join, relative, resolve, sep } from \"node:path\";\nimport { parse as parseYaml } from \"yaml\";\nimport {\n DEFAULT_CITE_BASELINE_PATH,\n GIT_UNAVAILABLE_HISTORY,\n ManifestSet,\n buildSourceIndex,\n gitClient,\n loadCitationSidecars,\n parseCiteConfig,\n readPage,\n sourceRange,\n reencryptCitationEntries,\n reencryptCitations,\n type CiteConfig,\n type CitationSidecars,\n type GitClient,\n type ReencryptCitationsResult,\n type SourceIndex,\n} from \"../../cite/index.js\";\nimport {\n PATH_JOIN,\n classifyRef,\n externalMetadataJoin,\n loadExternalMetadata,\n reencryptMetadata,\n supportedExtensions,\n writeFileAtomic,\n type ExternalMetadataEntry,\n type ExternalMetadataIndex,\n type ExternalMetadataValue,\n} from \"../../meta/index.js\";\nimport {\n STDIN_TOKEN,\n assertNonEmpty,\n configMarks,\n extractorByName,\n gitignoreOptions,\n reencryptData,\n resolveTargetSet,\n spliceManifestValue,\n} from \"../../meta/internal.js\";\nimport { isMember, selectCollections, type CollectionConfig } from \"../../shared/collections.js\";\nimport type { ConfigFile } from \"../../shared/config-file.js\";\nimport { resolveEncryptionKey, writeEncryptionKey } from \"../../shared/encryption-key.js\";\nimport { generateEncryptionKey, isValidEncryptionKey } from \"../../shared/encryption.js\";\nimport { findGitRoot } from \"../../shared/git-root.js\";\nimport {\n findPageManifests,\n hasPagePlaceholder,\n pageManifestPath,\n} from \"../../shared/page-manifest.js\";\nimport { readRotateConfig, toKeyError, unfinishedRotation } from \"../core/config.js\";\nimport { KeyError } from \"../errors.js\";\nimport type {\n KeyRotateOptions,\n KeyRotateResult,\n RotateManifest,\n RotateOutcome,\n RotatePage,\n RotatedValue,\n SkippedValue,\n} from \"../types.js\";\n\nconst BAD_TO = \"--to must be at least 32 hex or base64url characters.\";\nconst NO_STDIN =\n \"key rotate reads and writes files, so it takes no stdin (`-`). Name the files instead.\";\nconst WITH_PATHS =\n \"--collection selects a configured collection; it cannot be combined with paths.\";\nconst NEEDS_CONFIG = \"--collection needs a config file to select from.\";\nconst NO_KEY =\n \"No encryption key is available, so nothing can be re-encrypted. Run `manni key set` first.\";\nconst ENV_NEEDS_TO =\n \"The key comes from MANNI_ENCRYPTION_KEY; pass --to <value>, re-encrypt with it, then update the secret. Nothing is written to config.\";\nconst NARROWED_NEEDS_TO = \"A run over part of the family needs --to, and never writes the key.\";\nconst NO_FILES =\n \"No files to re-encrypt. Pass paths/globs, or declare a collection under `collections:` in manni.config.yaml.\";\n\n/**\n * Any ciphertext at all. A page without one has nothing to rotate, so it costs\n * no parse; with one, the page is parsed and the tag decides.\n */\nconst ANY_CIPHERTEXT = /~[A-Za-z0-9_-]{82,}/;\n\n/** The `cite:` section of the file, for `root:` and `baseline:`; `{}` without one. */\nfunction citeSection(file: ConfigFile | null): CiteConfig {\n if (file === null) return {};\n const doc: unknown = parseYaml(file.text);\n if (typeof doc !== \"object\" || doc === null || !(\"cite\" in doc)) return {};\n return parseCiteConfig(doc.cite, file.source);\n}\n\n/**\n * Where cited sources resolve from, as `cite` resolves it: `--root` (cwd\n * relative) > `cite.root` (config relative) > the git root > `cwd`.\n */\nfunction rootFor(\n flag: string | undefined,\n cite: CiteConfig,\n file: ConfigFile | null,\n cwd: string,\n): { root: string; fellBack: boolean } {\n if (flag !== undefined) return { root: resolve(cwd, flag), fellBack: false };\n if (file !== null && cite.root !== undefined) {\n return { root: resolve(file.dir, cite.root), fellBack: false };\n }\n const gitRoot = findGitRoot(cwd);\n return gitRoot === null ? { root: cwd, fellBack: true } : { root: gitRoot, fellBack: false };\n}\n\nfunction isEnoent(error: unknown): boolean {\n return typeof error === \"object\" && error !== null && \"code\" in error && error.code === \"ENOENT\";\n}\n\nasync function indexFor(root: string, client: GitClient): Promise<SourceIndex> {\n try {\n return await buildSourceIndex(root, { gitClient: client });\n } catch (error) {\n if (isEnoent(error)) throw new KeyError(`Root directory not found: ${root}.`);\n throw error;\n }\n}\n\n/**\n * The page's encrypted citations, the only ones a rotation reads sources\n * for: whether it has any, and whether one carries a commit (its own or the\n * page's), which is when history would be read.\n */\nfunction encryptedCitations(\n file: string,\n content: string,\n format: string | undefined,\n): { any: boolean; withCommit: boolean } {\n const read = readPage(file, content, format === undefined ? undefined : { format });\n const encrypted = read.citations.filter(({ citation }) => sourceRange(citation.source).encrypted);\n return {\n any: encrypted.length > 0,\n withCommit: encrypted.some(({ citation }) => citation.source[\"commit-sha\"] !== undefined),\n };\n}\n\ninterface Planned {\n page: RotatePage;\n path: string;\n content: string;\n changed: boolean;\n}\n\n/**\n * The citations of one page that a manifest owns (proposal 0044). They are\n * re-encrypted exactly as a page's own are — a citation counts as done only\n * when its `source.file` decrypts under the new key *and* its pin holds —\n * and written back as one value per page, each manifest written once.\n *\n * Kept in its own function, and reached from one place in the loop below, so\n * nothing about how *meta* values are rotated changes.\n */\nasync function rotateManifestCitations(\n sidecars: CitationSidecars | null,\n manifests: ManifestSet,\n page: { file: string; content: string; format?: string },\n opts: {\n root: string;\n fromKey: string;\n toKey: string;\n gitClient: GitClient;\n sourceIndex: () => Promise<SourceIndex>;\n },\n): Promise<{ rewritten: RotatedValue[]; skipped: SkippedValue[]; wantsHistory: boolean }> {\n const none = { rewritten: [], skipped: [], wantsHistory: false };\n if (sidecars === null) return none;\n const sidecar = await sidecars.forPage(page.file, page.content, page.format);\n const owner = sidecar.owner;\n if (owner === undefined || sidecar.citations === undefined) return none;\n // Only a manifest entry that actually holds a ciphertext costs an index.\n if (!sidecar.citations.some((input) => ANY_CIPHERTEXT.test(JSON.stringify(input.entry)))) {\n return none;\n }\n const result = await reencryptCitationEntries(\n { ...page, citations: sidecar.citations },\n {\n root: opts.root,\n fromKey: opts.fromKey,\n toKey: opts.toKey,\n gitClient: opts.gitClient,\n sourceIndex: await opts.sourceIndex(),\n },\n );\n if (result.changed && sidecar.entry !== undefined) {\n await manifests.write(owner, sidecar.entry, result.entries, 0);\n }\n return {\n rewritten: result.rewritten.map((r) => ({ kind: \"citation\" as const, ...r })),\n skipped: result.skipped.map((s) => ({ kind: \"citation\" as const, ...s })),\n // A pin that no longer holds is re-keyed from the lines at its commit.\n wantsHistory: sidecar.citations.some((input) =>\n /\"commit-sha\"\\s*:/.test(JSON.stringify(input.entry)),\n ),\n };\n}\n\ninterface PlannedManifest {\n manifest: RotateManifest;\n path: string;\n /** The manifest's text, with every rewritten value spliced into it. */\n text: string;\n changed: boolean;\n}\n\n/** How a run spells a manifest: relative to its base, like every file label. */\nfunction reportedPath(abs: string, base: string): string {\n const rel = relative(base, abs);\n return rel === \"\" ? \".\" : rel.split(sep).join(\"/\");\n}\n\n/**\n * The collections whose manifests this run covers. A run over every\n * collection, and one narrowed by `--collection`, covers the collections it\n * selected. A run over positional paths covers the collections those files\n * belong to, so the private half of a page a run re-encrypts moves with it.\n */\nfunction manifestCollections(\n collections: readonly CollectionConfig[],\n opts: {\n fromCollections: boolean;\n files: readonly string[];\n base: string;\n configDir: string;\n },\n): CollectionConfig[] {\n if (opts.fromCollections) return [...collections];\n const rels = opts.files.map((rel) =>\n reportedPath(resolve(opts.base, rel), opts.configDir),\n );\n return collections.filter((c) => rels.some((rel) => isMember(c, rel)));\n}\n\n/** The owned values one manifest entry supplies, or an empty map. */\nfunction valuesOf(\n index: ExternalMetadataIndex,\n entry: ExternalMetadataEntry,\n): ReadonlyMap<string, ExternalMetadataValue> {\n const empty = new Map<string, ExternalMetadataValue>();\n if (entry.join === PATH_JOIN) {\n return entry.abs === undefined ? empty : (index.byPath.get(entry.abs) ?? empty);\n }\n return index.byField.get(entry.join)?.get(entry.spelled) ?? empty;\n}\n\n/**\n * Re-encrypt the metadata values that live in the selected collections' local\n * manifests (proposals 0037, 0039 and 0041).\n *\n * A manifest is private by construction, so it is where an encrypted value is\n * most likely to sit. Rotation would otherwise leave it under the old key and\n * `meta validate` would report `encrypted:unreadable` on every page the\n * manifest feeds.\n *\n * Two things are left alone. A URL manifest is somebody else's file and\n * read-only (0038), so it is never loaded, and a rotation reaches no network.\n * The `citations` key is cite's: it re-keys a citation's source together with\n * its pin, under its own context, and re-encrypting the source alone would\n * break the pin. `reencryptData` skips it for the same reason\n * `reencryptMetadata` does on a page.\n *\n * Text in, text out. Each value is spliced into the manifest by\n * `spliceManifestValue`, which replaces that value's range and keeps every\n * other byte: the comments, the key order, the quoting and the line endings.\n * Nothing is written here; the caller writes when every value could be\n * re-encrypted.\n */\nasync function planManifests(opts: {\n collections: readonly CollectionConfig[];\n configDir: string;\n base: string;\n fromKey: string;\n toKey: string;\n /** The run's pages, as absolute paths, which a `{page}` manifest (0058) is read for. */\n pages: readonly string[];\n /** A run over the whole family: no paths and no `--collection`. */\n whole: boolean;\n}): Promise<PlannedManifest[]> {\n const local = opts.collections\n .map((c) => ({\n ...c,\n externalMetadata: c.externalMetadata.filter(\n (m) => classifyRef(m.file).kind !== \"url\",\n ),\n }))\n .filter((c) => c.externalMetadata.length > 0);\n if (local.length === 0) return [];\n\n // A `{page}` entry (proposal 0058) is one manifest per page, so its files\n // are enumerated rather than named: each page of the run resolves its own,\n // and a whole run adds every file the pattern's glob finds, so a manifest\n // whose page is gone is re-encrypted too (0058 stress test 12). The pages\n // those files name are handed to the loader like the run's own.\n const pages = new Set(opts.pages);\n if (opts.whole) {\n for (const c of local) {\n for (const m of c.externalMetadata) {\n if (!hasPagePlaceholder(m.file)) continue;\n for (const found of findPageManifests(m.file, opts.configDir, (rel) => isMember(c, rel))) {\n for (const entry of found.entries) pages.add(entry.pageAbs);\n }\n }\n }\n }\n\n const index = await loadExternalMetadata(local, {\n configDir: opts.configDir,\n base: opts.base,\n pages: [...pages],\n });\n if (index === null) return [];\n\n // One plan per manifest file, so a manifest two collections declare is read\n // once and spliced once. Its reported path and collection identify it the\n // way `index.entries` does. A plan is made when an entry first names its\n // file, and only a plan with a value to report is kept.\n const plans = new Map<string, PlannedManifest>();\n const located = new Map<string, { abs: string; collection: string }>();\n const locate = (collection: string, abs: string, join: string): void => {\n located.set(`${collection}\\u0000${reportedPath(abs, opts.base)}\\u0000${join}`, { abs, collection });\n };\n for (const c of local) {\n for (const m of c.externalMetadata) {\n const join = externalMetadataJoin(m);\n if (!hasPagePlaceholder(m.file)) {\n locate(c.name, isAbsolute(m.file) ? m.file : resolve(opts.configDir, m.file), join);\n continue;\n }\n for (const page of pages) {\n const resolved = pageManifestPath(m.file, opts.configDir, page);\n if (!(\"outside\" in resolved)) locate(c.name, resolved.abs, join);\n }\n }\n }\n const planFor = async (key: string): Promise<PlannedManifest | undefined> => {\n const where = located.get(key);\n if (where === undefined) return undefined;\n const known = plans.get(where.abs);\n if (known !== undefined) return known;\n const plan: PlannedManifest = {\n manifest: {\n file: reportedPath(where.abs, opts.base),\n collection: where.collection,\n rewritten: [],\n skipped: [],\n written: false,\n },\n path: where.abs,\n text: await readFile(where.abs, \"utf8\"),\n changed: false,\n };\n plans.set(where.abs, plan);\n return plan;\n };\n\n for (const entry of index.entries) {\n const plan = await planFor(`${entry.collection}\\u0000${entry.file}\\u0000${entry.join}`);\n if (plan === undefined) continue;\n const data: Record<string, unknown> = {};\n for (const [key, supplied] of valuesOf(index, entry)) {\n if (supplied.file === entry.file && supplied.collection === entry.collection) {\n data[key] = supplied.value;\n }\n }\n const done = reencryptData(data, { fromKey: opts.fromKey, toKey: opts.toKey });\n for (const r of done.rewritten) {\n plan.manifest.rewritten.push({ entry: entry.spelled, ...r });\n }\n for (const s of done.skipped) {\n plan.manifest.skipped.push({ entry: entry.spelled, ...s });\n }\n for (const key of done.keys) {\n plan.text = spliceManifestValue(plan.text, {\n entry: entry.spelled,\n key,\n value: done.data[key],\n join: entry.join,\n file: plan.manifest.file,\n }).text;\n plan.changed = true;\n }\n }\n\n return [...plans.values()].filter(\n (p) => p.manifest.rewritten.length > 0 || p.manifest.skipped.length > 0,\n );\n}\n\nexport async function runKeyRotate(opts: KeyRotateOptions): Promise<KeyRotateResult> {\n const cwd = resolve(opts.cwd ?? process.cwd());\n const env = opts.env ?? process.env;\n if (opts.to !== undefined && !isValidEncryptionKey(opts.to)) throw new KeyError(BAD_TO);\n if (opts.inputs.includes(STDIN_TOKEN)) throw new KeyError(NO_STDIN);\n const wanted = opts.collection ?? [];\n if (wanted.length > 0 && opts.inputs.length > 0) throw new KeyError(WITH_PATHS);\n\n const file = await readRotateConfig(opts.configPath, cwd);\n if (wanted.length > 0 && file === null) throw new KeyError(NEEDS_CONFIG);\n const { key: current, source: keySource } = resolveEncryptionKey({\n env,\n file,\n toError: toKeyError,\n });\n if (current === undefined) throw new KeyError(NO_KEY);\n const narrowed = opts.inputs.length > 0 || wanted.length > 0;\n\n // Only a key from the config has a config a rotation can be finished in.\n const keyFile = keySource === \"config\" ? file : null;\n const previous = keyFile?.encryptionKeyPrevious;\n if (\n keyFile !== null &&\n previous !== undefined &&\n (narrowed || (opts.to !== undefined && opts.to !== current))\n ) {\n throw new KeyError(unfinishedRotation(keyFile.source));\n }\n if (keySource === \"env\" && opts.to === undefined) throw new KeyError(ENV_NEEDS_TO);\n if (narrowed && opts.to === undefined) throw new KeyError(NARROWED_NEEDS_TO);\n\n // Finishing an interrupted rotation goes from the key it replaced to the one\n // the config already holds; otherwise from the current key to the new one.\n const fromKey = previous ?? current;\n const toKey = previous === undefined ? (opts.to ?? generateEncryptionKey()) : current;\n\n const collections =\n file === null ? [] : selectCollections(file.collections, wanted, file.source, toKeyError);\n const fromCollections = opts.inputs.length === 0;\n const inputs = fromCollections ? collections.flatMap((c) => c.paths) : opts.inputs;\n if (inputs.length === 0) throw new KeyError(NO_FILES);\n // One base per run, as in cite and meta: typed paths from cwd, a\n // collection's `paths:` from the config's directory.\n const base = fromCollections && file !== null ? file.dir : cwd;\n\n const forced = opts.as === undefined ? undefined : extractorByName(opts.as);\n if (opts.as !== undefined && forced === undefined) {\n throw new KeyError(\n `Unknown format \"${opts.as}\". Supported extensions: ${supportedExtensions().join(\", \")}.`,\n );\n }\n const format = forced?.name;\n const exts = opts.exts ?? forced?.extensions;\n const exclude = [\n ...new Set([\n ...(opts.exclude ?? []),\n ...(fromCollections ? collections.flatMap((c) => c.exclude) : []),\n ]),\n ];\n const { files, gitignoreSkipped } = await resolveTargetSet({\n inputs,\n exts,\n exclude,\n cwd: base,\n allowEmpty: opts.allowEmpty,\n ...gitignoreOptions({ flag: opts.respectGitignore, onNotice: opts.onNotice }),\n });\n assertNonEmpty({\n files,\n inputs,\n usingStdin: false,\n allowEmpty: opts.allowEmpty,\n exclude,\n exts,\n gitignoreSkipped,\n action: \"re-encrypted\",\n });\n\n const cite = citeSection(file);\n const { root, fellBack } = rootFor(opts.root, cite, file, cwd);\n const client = opts.gitClient ?? gitClient(root);\n // Built once, and only when a page cites an encrypted source.\n let index: Promise<SourceIndex> | undefined;\n const sourceIndex = (): Promise<SourceIndex> => {\n if (index === undefined) {\n if (fellBack) opts.onNotice?.(`No git root found; resolving src: paths from ${cwd}`);\n index = indexFor(root, client);\n }\n return index;\n };\n\n // The manifests that own `citations` (proposal 0044): a page whose entries\n // live in one carries no ciphertext of its own, so they are read for every\n // page of the run, not only the ones the shortcut below lets through.\n const sidecars =\n file === null\n ? null\n : await loadCitationSidecars({\n collections: file.collections,\n configDir: file.dir,\n base,\n configSource: file.source,\n key: current,\n toError: toKeyError,\n // A keyless manifest (proposal 0068) keeps what a page's schemas mark.\n marks: () => configMarks(file.path, file.dir),\n // A `{page}` manifest (0058) is read for exactly the pages rotated.\n pages: files.map((rel) => resolve(base, rel)),\n });\n const manifests = new ManifestSet();\n\n const planned: Planned[] = [];\n let wantsHistory = false;\n for (const rel of files) {\n const path = resolve(base, rel);\n const before = await readFile(path, \"utf8\");\n const page = { file: rel, content: before, ...(format === undefined ? {} : { format }) };\n // A page's own values first, then the entries its manifest holds.\n const sidecarWork = await rotateManifestCitations(sidecars, manifests, page, {\n root,\n fromKey,\n toKey,\n gitClient: client,\n sourceIndex,\n });\n if (sidecarWork.wantsHistory) wantsHistory = true;\n if (!ANY_CIPHERTEXT.test(before)) {\n if (sidecarWork.rewritten.length === 0 && sidecarWork.skipped.length === 0) continue;\n planned.push({\n page: { file: rel, rewritten: sidecarWork.rewritten, skipped: sidecarWork.skipped, written: false },\n path,\n content: before,\n changed: false,\n });\n continue;\n }\n const meta = reencryptMetadata(page, { fromKey, toKey });\n const encrypted = encryptedCitations(rel, meta.content, format);\n if (encrypted.withCommit) wantsHistory = true;\n const cited: ReencryptCitationsResult = encrypted.any\n ? await reencryptCitations(\n { ...page, content: meta.content },\n { root, fromKey, toKey, gitClient: client, sourceIndex: await sourceIndex() },\n )\n : { content: meta.content, rewritten: [], skipped: [] };\n const rewritten: RotatedValue[] = [\n ...meta.rewritten.map((r) => ({ kind: \"metadata\" as const, ...r })),\n ...cited.rewritten.map((r) => ({ kind: \"citation\" as const, ...r })),\n ...sidecarWork.rewritten,\n ];\n const skipped: SkippedValue[] = [\n ...meta.skipped.map((s) => ({ kind: \"metadata\" as const, ...s })),\n ...cited.skipped.map((s) => ({ kind: \"citation\" as const, ...s })),\n ...sidecarWork.skipped,\n ];\n if (rewritten.length === 0 && skipped.length === 0) continue;\n planned.push({\n page: { file: rel, rewritten, skipped, written: false },\n path,\n content: cited.content,\n changed: cited.content !== before,\n });\n }\n\n // A pin that no longer holds is re-keyed from the lines at its commit, so a\n // citation with one wants git. Where git is not there, said once.\n if (wantsHistory && !(await client.available())) opts.onNotice?.(GIT_UNAVAILABLE_HISTORY);\n\n // The private half of the same documents: every local manifest of the\n // collections this run covers. Planned in memory like the pages, and\n // counted with them, so one unreadable value anywhere stops the whole run.\n const valueManifests =\n file === null\n ? []\n : await planManifests({\n collections: manifestCollections(collections, {\n fromCollections,\n files,\n base,\n configDir: file.dir,\n }),\n configDir: file.dir,\n base,\n fromKey,\n toKey,\n pages: files.map((rel) => resolve(base, rel)),\n whole: !narrowed,\n });\n\n const reencrypted =\n planned.reduce((n, p) => n + p.page.rewritten.length, 0) +\n valueManifests.reduce((n, m) => n + m.manifest.rewritten.length, 0);\n const skipped =\n planned.reduce((n, p) => n + p.page.skipped.length, 0) +\n valueManifests.reduce((n, m) => n + m.manifest.skipped.length, 0);\n const writePage = opts.writePage ?? ((path: string, content: string) => writeFileAtomic(path, content));\n\n let outcome: RotateOutcome;\n if (skipped > 0) {\n // The new key is never written beside a value it cannot decrypt, and no\n // page is written without the key: nothing at all.\n outcome = \"skipped\";\n } else if (opts.dryRun === true) {\n outcome = \"dry-run\";\n } else {\n const writesKey = !narrowed && keyFile !== null;\n // (1) The new key, with the old one beside it. A rotation being finished\n // already has both.\n if (!narrowed && keyFile !== null && previous === undefined) {\n await writeEncryptionKey({ file: keyFile, key: toKey, previous: fromKey, cwd, toError: toKeyError });\n }\n // (2) The pages, then the manifests: the citations one owns, and the\n // encrypted values another holds. Each manifest is written once,\n // however many pages it keeps entries for.\n for (const p of planned) {\n if (!p.changed) continue;\n await writePage(p.path, p.content);\n p.page.written = true;\n }\n for (const changed of manifests.changed()) await writePage(changed.path, changed.text);\n for (const m of valueManifests) {\n if (!m.changed) continue;\n await writePage(m.path, m.text);\n m.manifest.written = true;\n }\n // (3) The old key goes, now that nothing is under it.\n if (!narrowed && keyFile !== null) {\n await writeEncryptionKey({ file: keyFile, key: toKey, previous: null, cwd, toError: toKeyError });\n }\n if (narrowed) outcome = \"narrowed\";\n else if (!writesKey) outcome = \"env\";\n else outcome = previous === undefined ? \"written\" : \"finished\";\n }\n\n const wrote = outcome !== \"skipped\" && outcome !== \"dry-run\";\n const baseline =\n file !== null && cite.baseline !== undefined\n ? resolve(file.dir, cite.baseline)\n : join(file?.dir ?? cwd, DEFAULT_CITE_BASELINE_PATH);\n\n return {\n pages: planned.map((p) => p.page),\n manifests: valueManifests.map((m) => m.manifest),\n reencrypted,\n skipped,\n keyWritten: outcome === \"written\" || outcome === \"finished\",\n outcome,\n ...(keyFile === null ? {} : { configSource: keyFile.source }),\n baselineStale: wrote && existsSync(baseline),\n exitCode: skipped > 0 ? 1 : 0,\n };\n}\n","/**\n * Which config file `manni key` reads and writes. `key` has no section of its\n * own (proposal 0045): the key it manages sits at the top of the family file,\n * beside `collections:`.\n *\n * - `set` writes the nearest family file whatever it carries, or the one `-c`\n * names, read as a family file (`findFamilyConfigFile`,\n * `readFamilyConfigFile`).\n * - `rotate` reads its key and collections from the file every sibling\n * without a section there would read them from: the nearest family file\n * carrying `collections:` or `encryptionKey:`. That is discovery with a\n * section name nothing uses.\n */\nimport {\n findConfigFile,\n findFamilyConfigFile,\n readConfigFile,\n readFamilyConfigFile,\n type ConfigFile,\n type ConfigFileOptions,\n} from \"../../shared/config-file.js\";\nimport { KeyError } from \"../errors.js\";\n\nexport const toKeyError = (message: string): KeyError => new KeyError(message);\n\nconst KEY_CONFIG: ConfigFileOptions = {\n section: \"key\",\n // The key never had a file of its own.\n legacyNames: [],\n toError: toKeyError,\n};\n\n/** The config `rotate` reads the current key and the collections from. */\nexport function readRotateConfig(\n configPath: string | undefined,\n cwd: string,\n): Promise<ConfigFile | null> {\n return configPath === undefined\n ? findConfigFile(cwd, KEY_CONFIG)\n : readConfigFile(configPath, cwd, KEY_CONFIG);\n}\n\n/** The config `set` writes to; `null` when discovery finds no family file. */\nexport function readSetConfig(\n configPath: string | undefined,\n cwd: string,\n): Promise<ConfigFile | null> {\n return configPath === undefined\n ? findFamilyConfigFile(cwd, toKeyError)\n : readFamilyConfigFile(configPath, cwd, toKeyError);\n}\n\n/** The refusal while `encryptionKeyPrevious:` says a rotation is unfinished. */\nexport const unfinishedRotation = (source: string): string =>\n `A rotation is unfinished in ${source}. Run \\`manni key rotate\\` with no --to to finish it.`;\n","/**\n * `manni key set [value]`: write the family encryption key (proposal 0045).\n *\n * Refusals, each exit 2 and none echoing a value: a value of the wrong shape;\n * `MANNI_ENCRYPTION_KEY` set, because it wins and the written key would never\n * be read; a rotation left unfinished; a key already configured, because\n * replacing one in place strands every value encrypted under it (`rotate` is\n * what replaces a key); and a new `manni.config.yaml` beside a legacy\n * `docmeta.config.yaml`, which the new file would hide from `manni meta`.\n *\n * It warns, and still writes, when git would publish the file.\n */\nimport { existsSync } from \"node:fs\";\nimport { basename, dirname, join, relative, resolve } from \"node:path\";\nimport { LEGACY_CONFIG_NAMES } from \"../../meta/internal.js\";\nimport {\n ENCRYPTION_KEY_ENV,\n committedKeyWarning,\n isIgnoredByGit,\n writeEncryptionKey,\n} from \"../../shared/encryption-key.js\";\nimport { generateEncryptionKey, isValidEncryptionKey } from \"../../shared/encryption.js\";\nimport { readSetConfig, toKeyError, unfinishedRotation } from \"../core/config.js\";\nimport { KeyError } from \"../errors.js\";\nimport type { KeySetOptions, KeySetResult } from \"../types.js\";\n\nconst BAD_VALUE =\n \"The key must be at least 32 hex or base64url characters. Run `manni key set` with no value to generate one.\";\nconst ENV_SET = `${ENCRYPTION_KEY_ENV} is set, so a key written to config would never be read. Unset it, or keep the key in the secret.`;\n\nconst alreadyConfigured = (source: string): string =>\n `An encryption key is already configured in ${source}. Run \\`manni key rotate\\` to replace it and re-encrypt every value.`;\n\n/**\n * A new family file beside a legacy per-tool file hides it: discovery reads\n * the family file first in a directory, and one holding only a key is every\n * tool's config, so `manni meta` would stop reading the options it had.\n */\nfunction refuseBesideLegacy(path: string, cwd: string): void {\n const dir = dirname(path);\n const name = basename(path);\n for (const legacy of LEGACY_CONFIG_NAMES) {\n const found = join(dir, legacy);\n if (!existsSync(found)) continue;\n const source = relative(cwd, found).replace(/\\\\/g, \"/\");\n throw new KeyError(\n `${source} is a single-tool config; a ${name} beside it would hide it. Move its keys under meta: in ${name} first.`,\n );\n }\n}\n\nexport async function runKeySet(opts: KeySetOptions): Promise<KeySetResult> {\n const cwd = resolve(opts.cwd ?? process.cwd());\n const env = opts.env ?? process.env;\n if (opts.value !== undefined && !isValidEncryptionKey(opts.value)) {\n throw new KeyError(BAD_VALUE);\n }\n // Empty counts as unset, as `resolveEncryptionKey` has it.\n const fromEnv = env[ENCRYPTION_KEY_ENV];\n if (fromEnv !== undefined && fromEnv !== \"\") throw new KeyError(ENV_SET);\n\n const file = await readSetConfig(opts.configPath, cwd);\n if (file?.encryptionKeyPrevious !== undefined) {\n throw new KeyError(unfinishedRotation(file.source));\n }\n if (file?.encryptionKey !== undefined) {\n throw new KeyError(alreadyConfigured(file.source));\n }\n\n const generated = opts.value === undefined;\n const key = opts.value ?? generateEncryptionKey();\n const dryRun = opts.dryRun === true;\n // Name the target before writing to it: the legacy check and the git\n // warning are both about the file the key is about to land in.\n const target = await writeEncryptionKey({ file, key, cwd, toError: toKeyError, dryRun: true });\n if (target.created) refuseBesideLegacy(target.path, cwd);\n if (isIgnoredByGit(target.path) === false) {\n opts.onNotice?.(committedKeyWarning(target.source));\n }\n if (!dryRun) await writeEncryptionKey({ file, key, cwd, toError: toKeyError });\n return { path: target.path, source: target.source, created: target.created, generated, dryRun };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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MAAM,mBAAmB,EAAE,MAAM,KAAK,KAAK,SAAS,YAAY,QAAQ,KAAK,CAAC;AAC7F,MAAI,OAAO,QAAS,oBAAmB,OAAO,MAAM,GAAG;AACvD,MAAI,eAAe,OAAO,IAAI,MAAM,OAAO;AACzC,SAAK,WAAW,oBAAoB,OAAO,MAAM,CAAC;AAAA,EACpD;AACA,MAAI,CAAC,OAAQ,OAAM,mBAAmB,EAAE,MAAM,KAAK,KAAK,SAAS,WAAW,CAAC;AAC7E,SAAO,EAAE,MAAM,OAAO,MAAM,QAAQ,OAAO,QAAQ,SAAS,OAAO,SAAS,WAAW,OAAO;AAChG;","names":["join","skipped","existsSync","join","relative","resolve","join","existsSync","relative","resolve"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/term/reporters/pretty.ts"],"sourcesContent":["/**\n * Human output for every `manni term` command, in the shapes the ladder of\n * proposal 0052 prints. Columns are padded to their widest value; prose wraps\n * to 80 columns under its own column, so a long definition or message never\n * runs back to the left edge.\n */\nimport { palette, type Colors } from \"../../shared/color.js\";\nimport type { TermReport } from \"../commands/findings.js\";\nimport type { FormatRow } from \"../commands/formats.js\";\nimport { displayPath, plural } from \"../commands/run.js\";\nimport type { ValeWiring, WriteReport } from \"../commands/write.js\";\nimport type { Severity } from \"../../shared/severity.js\";\nimport { isMultilingual, languageOf } from \"../core/writers/render-util.js\";\nimport {\n TERM_AUX_FIELDS,\n TERM_DESIGNATION_FIELDS,\n TERM_FIELDS,\n type Term,\n type TermDesignation,\n type TermField,\n type TermFinding,\n type TermLink,\n type TermRecord,\n type TermTransaction,\n} from \"../types.js\";\n\nconst WIDTH = 80;\n\n/** Words packed into lines of at most `width` characters; a longer word stands alone. */\nfunction wrapWords(text: string, width: number): string[] {\n const lines: string[] = [];\n let line = \"\";\n for (const word of text.split(/\\s+/).filter((w) => w !== \"\")) {\n if (line === \"\") line = word;\n else if (line.length + 1 + word.length <= width) line = `${line} ${word}`;\n else {\n lines.push(line);\n line = word;\n }\n }\n if (line !== \"\") lines.push(line);\n return lines.length === 0 ? [\"\"] : lines;\n}\n\n/** Sentences packed into lines of at most `width`; a message that fits stays whole. */\nfunction wrapSentences(text: string, width: number): string[] {\n if (text.length <= width) return [text];\n const lines: string[] = [];\n let line = \"\";\n for (const sentence of text.split(/(?<=\\.)\\s+(?=\\S)/)) {\n if (line === \"\") line = sentence;\n else if (line.length + 1 + sentence.length <= width) line = `${line} ${sentence}`;\n else {\n lines.push(line);\n line = sentence;\n }\n }\n if (line !== \"\") lines.push(line);\n return lines;\n}\n\nfunction hanging(first: string, lines: readonly string[]): string[] {\n const indent = \" \".repeat(first.length);\n return lines.map((line, i) => `${i === 0 ? first : indent}${line}`.trimEnd());\n}\n\n// ---------------------------------------------------------------------------\n// list\n\nexport function renderListPretty(terms: readonly Term[]): string {\n const idWidth = Math.max(0, ...terms.map((t) => t.id.length)) + 3;\n const labelWidth = Math.max(0, ...terms.map((t) => t.record.label.length)) + 3;\n // The language column appears only when it tells the rows apart.\n const multilingual = isMultilingual(terms);\n const languageWidth = Math.max(0, ...terms.map((t) => languageOf(t).length)) + 3;\n const rows = terms.map((t) => {\n const language = multilingual ? languageOf(t).padEnd(languageWidth) : \"\";\n const alts = (t.record[\"alt-labels\"] ?? []).join(\", \");\n return `${t.id.padEnd(idWidth)}${language}${t.record.label.padEnd(labelWidth)}${alts}`.trimEnd();\n });\n return [...rows, plural(terms.length, \"term\")].join(\"\\n\");\n}\n\n// ---------------------------------------------------------------------------\n// get\n\n/** A root field `get` shows as one row of text. */\ntype RowField = Exclude<TermField, \"label\" | \"concept-entry\" | \"designations\" | \"tbx-markup\" | \"tbx-elements\">;\n\n/** The order `get` shows root fields in: names first, then what they mean, the definition last. */\nconst GET_FIELDS: readonly RowField[] = [\n \"alt-labels\",\n \"hidden-labels\",\n \"broader\",\n \"narrower\",\n \"related-terms\",\n \"see\",\n \"abstract\",\n \"scope-note\",\n \"notation\",\n \"exact-matches\",\n \"close-matches\",\n \"broad-matches\",\n \"narrow-matches\",\n \"related-matches\",\n \"subject-field\",\n \"contexts\",\n \"notes\",\n \"sources\",\n \"customer-subsets\",\n \"project-subsets\",\n \"cross-references\",\n \"external-cross-references\",\n \"graphics\",\n \"transactions\",\n \"definition\",\n];\n\n/** The aux fields a block's line shows; its `tbx-elements` are counted on a row of their own. */\nconst SHOWN_AUX = TERM_AUX_FIELDS.filter((field) => field !== \"tbx-elements\");\n\n/** The key column's narrowest width: the widest 1.0.0 field, `related-terms`, plus two. */\nconst MIN_KEY_WIDTH = 15;\n\nfunction linkText(link: TermLink): string {\n return link.text === undefined ? link.target : `${link.text} (${link.target})`;\n}\n\nfunction transactionText(transaction: TermTransaction): string {\n return [transaction.type, transaction.date, transaction.responsibility].filter((part) => part !== undefined).join(\" \");\n}\n\n/** One value as `get` prints it: a list joined with commas, a link as its text and target, a transaction as its parts. */\nfunction valueText(value: string | readonly (string | TermLink | TermTransaction)[]): string {\n if (typeof value === \"string\") return value;\n return value\n .map((item) => (typeof item === \"string\" ? item : \"target\" in item ? linkText(item) : transactionText(item)))\n .join(\", \");\n}\n\n/** `progressive lens: part-of-speech noun, term-type fullForm`, or `undefined` when it says nothing but its term. */\nfunction designationLine(designation: TermDesignation): string | undefined {\n const parts: string[] = [];\n for (const key of TERM_DESIGNATION_FIELDS) {\n const value = designation[key];\n if (value !== undefined) parts.push(`${key} ${value}`);\n }\n const comments = designation[\"transfer-comments\"];\n if (comments !== undefined) parts.push(`transfer-comments ${valueText(comments)}`);\n for (const key of SHOWN_AUX) {\n const value = designation[key];\n if (value !== undefined) parts.push(`${key} ${valueText(value)}`);\n }\n return parts.length === 0 ? undefined : `${designation.term}: ${parts.join(\", \")}`;\n}\n\n/** `1 at the root, 1 on PAL, 1 in concept-entry`: where the record keeps elements no named field maps. */\nfunction passThroughText(record: TermRecord): string | undefined {\n const parts: string[] = [];\n const count = (items: readonly string[] | undefined, where: string): void => {\n if (items !== undefined) parts.push(`${String(items.length)} ${where}`);\n };\n count(record[\"tbx-elements\"], \"at the root\");\n for (const designation of record.designations ?? []) count(designation[\"tbx-elements\"], `on ${designation.term}`);\n count(record[\"concept-entry\"]?.[\"tbx-elements\"], \"in concept-entry\");\n return parts.length === 0 ? undefined : parts.join(\", \");\n}\n\nexport interface GetPrettyOptions {\n color: boolean;\n cwd?: string;\n /** The entry in its other languages: the set's other terms with the same id. */\n others?: readonly Term[];\n}\n\nexport function renderGetPretty(term: Term, opts: GetPrettyOptions): string {\n const c = palette(opts.color);\n const { record } = term;\n const where = `${displayPath(term.location.file, opts.cwd ?? process.cwd())}:${String(term.location.line)}`;\n\n // Each row is a key and its lines, collected first so the key column fits the widest key shown.\n const rows: [string, string[]][] = [[\"id\", [term.id]]];\n if (term.language !== undefined) rows.push([\"language\", [term.language]]);\n for (const field of GET_FIELDS) {\n const value = record[field];\n if (value !== undefined) rows.push([field, [valueText(value)]]);\n }\n const concept = record[\"concept-entry\"];\n if (concept !== undefined) {\n const lines = SHOWN_AUX.flatMap((key) => {\n const value = concept[key];\n return value === undefined ? [] : [`${key}: ${valueText(value)}`];\n });\n if (lines.length > 0) rows.push([\"concept-entry\", lines]);\n }\n const designations = (record.designations ?? []).map(designationLine).filter((line) => line !== undefined);\n if (designations.length > 0) rows.push([\"designations\", designations]);\n if (record[\"tbx-markup\"] !== undefined) rows.push([\"tbx-markup\", record[\"tbx-markup\"]]);\n const passThrough = passThroughText(record);\n if (passThrough !== undefined) rows.push([\"tbx-elements\", [passThrough]]);\n const others = opts.others ?? [];\n if (others.length > 0) {\n rows.push([\"other languages\", [others.map((t) => `${languageOf(t)} (${t.record.label})`).join(\", \")]]);\n }\n\n const keyWidth = Math.max(MIN_KEY_WIDTH, ...rows.map(([key]) => key.length + 2));\n const lines = [`${c.bold(record.label.padEnd(40))}${c.dim(where)}`];\n for (const [key, values] of rows) {\n values.forEach((value, i) => {\n const prefix = ` ${(i === 0 ? key : \"\").padEnd(keyWidth)}`;\n lines.push(...hanging(prefix, wrapWords(value, WIDTH - prefix.length)));\n });\n }\n return lines.join(\"\\n\");\n}\n\n// ---------------------------------------------------------------------------\n// check and lint\n\nconst RULE_WIDTH = 32;\n\nfunction severityText(c: Colors, severity: Severity): string {\n const padded = severity.padEnd(6);\n if (severity === \"error\") return c.red(padded);\n if (severity === \"warning\") return c.yellow(padded);\n return c.cyan(padded);\n}\n\nfunction counts(findings: readonly TermFinding[]): string {\n const parts: string[] = [];\n const n = (severity: Severity): number => findings.filter((f) => f.severity === severity).length;\n if (n(\"error\") > 0) parts.push(plural(n(\"error\"), \"error\"));\n if (n(\"warning\") > 0) parts.push(plural(n(\"warning\"), \"warning\"));\n if (n(\"notice\") > 0) parts.push(plural(n(\"notice\"), \"notice\"));\n return parts.join(\", \");\n}\n\nexport interface FindingsPrettyOptions {\n color: boolean;\n /** Whether the clean line counts references: `check` reads them, `lint` does not. */\n references?: boolean;\n}\n\nexport function renderFindingsPretty(report: TermReport, opts: FindingsPrettyOptions): string {\n const c = palette(opts.color);\n const { baseline } = report;\n if (baseline?.written === true) {\n return `${c.green(\"✓\")} ${plural(report.found, \"finding\")} recorded in ${baseline.path}`;\n }\n const baselined = baseline !== undefined && baseline.suppressed > 0 ? `, ${String(baseline.suppressed)} baselined` : \"\";\n const terms = plural(report.terms, \"term\");\n\n if (report.findings.length === 0) {\n const references = opts.references === false ? \"\" : `, ${plural(report.references, \"reference\")}`;\n return `${c.green(\"✓\")} ${terms}${references}, no findings${baselined}`;\n }\n\n const ruleWidth = Math.max(RULE_WIDTH, ...report.findings.map((f) => f.ruleId.length + 2));\n const lines: string[] = [];\n let group: string | undefined;\n for (const finding of report.findings) {\n const file = displayPath(finding.file, report.cwd);\n const header = finding.line === undefined ? file : `${file}:${String(finding.line)}`;\n if (header !== group) {\n lines.push(c.bold(header));\n group = header;\n }\n const prefixWidth = 2 + 6 + 1 + ruleWidth;\n const message = wrapSentences(finding.message, WIDTH - prefixWidth);\n const indent = \" \".repeat(prefixWidth);\n message.forEach((text, i) => {\n lines.push(\n i === 0 ? ` ${severityText(c, finding.severity)} ${finding.ruleId.padEnd(ruleWidth)}${text}` : `${indent}${text}`,\n );\n });\n }\n lines.push(\"\", `${counts(report.findings)} in ${terms}${baselined}`);\n return lines.join(\"\\n\");\n}\n\n// ---------------------------------------------------------------------------\n// write\n\nfunction changeLine(change: WriteReport[\"changes\"][number]): string {\n switch (change.action) {\n case \"create\":\n return `${change.path} would be created`;\n case \"change\":\n return `${change.path} would change`;\n case \"remove\":\n return `${change.path} would be removed`;\n }\n}\n\n/** A generated Vale rule file's `swap:` entries. */\nfunction swapCount(content: string): number {\n const lines = content.split(/\\r?\\n/);\n const start = lines.indexOf(\"swap:\");\n if (start === -1) return 0;\n return lines.slice(start + 1).filter((line) => line.startsWith(\" \")).length;\n}\n\nfunction baseName(path: string): string {\n return path.split(/[\\\\/]/).pop() ?? path;\n}\n\nconst CASING_RULES = new Set([\"Casing.yml\", \"Lowercase.yml\", \"SentenceStart.yml\"]);\n\n/** What each file of a Vale style holds: rule files by name, the acronym files together. */\nfunction valeLines(report: WriteReport): string[] {\n const rows: [string, string][] = [];\n const acronyms: string[] = [];\n for (const file of report.files) {\n const name = baseName(file.path);\n // A casing rule swaps each label and alt-label, so what it counts is labels.\n if (CASING_RULES.has(name)) rows.push([name, plural(swapCount(file.content), \"label\")]);\n else if (name === \"Deprecated.yml\") rows.push([name, plural(swapCount(file.content), \"swap\")]);\n else acronyms.push(name);\n }\n if (acronyms.length > 0) rows.push([acronyms.join(\", \"), plural(acronyms.length, \"acronym\")]);\n const width = Math.max(0, ...rows.map(([name]) => name.length)) + 2;\n return rows.map(([name, what]) => ` ${name.padEnd(width)}${what}`);\n}\n\n/** ` dropped from a definition list: scope-note on 3 terms, hidden-labels on 12`. */\nfunction droppedLine(report: WriteReport): string | undefined {\n if (report.dropped.length === 0) return undefined;\n // One entry per term per field, so counting entries counts terms: an id in two languages is two terms.\n const counts = new Map<TermField, number>();\n for (const { field } of report.dropped) counts.set(field, (counts.get(field) ?? 0) + 1);\n const fields = [...counts.entries()]\n .map(([field, n]) => ({ field, n }))\n .sort((a, b) => a.n - b.n || TERM_FIELDS.indexOf(a.field) - TERM_FIELDS.indexOf(b.field));\n const parts = fields.map(({ field, n }, i) => `${field} on ${i === 0 ? plural(n, \"term\") : String(n)}`);\n return ` dropped from ${report.droppedFrom ?? report.format ?? \"the render\"}: ${parts.join(\", \")}`;\n}\n\n/** ` dropped from tbx3: the headers of glossary.tbx, <stdin>`. */\nfunction droppedHeadersLine(report: WriteReport): string | undefined {\n const files = report.droppedHeaders ?? [];\n if (files.length === 0) return undefined;\n const what = files.length === 1 ? \"the header of\" : \"the headers of\";\n return ` dropped from ${report.droppedFrom ?? report.format ?? \"the render\"}: ${what} ${files.join(\", \")}`;\n}\n\n/** ` skipped 2 terms a definition list cannot read without a definition: varifocal, bifocal`. */\nfunction skippedLine(report: WriteReport): string | undefined {\n if (report.skipped.length === 0) return undefined;\n const construct = report.droppedFrom ?? report.format ?? \"the render\";\n const count = plural(report.skipped.length, \"term\");\n return ` skipped ${count} ${construct} cannot read without a definition: ${report.skipped.join(\", \")}`;\n}\n\n/** ` skipped 2 terms in another language than en: spectacle-lens (de), progressive-lens (de)`. */\nfunction otherLanguagesLine(report: WriteReport): string | undefined {\n const other = report.otherLanguages;\n if (other === undefined || other.terms.length === 0) return undefined;\n const terms = other.terms.map(({ id, language }) => `${id} (${language})`).join(\", \");\n return ` skipped ${plural(other.terms.length, \"term\")} in another language than ${other.written}: ${terms}`;\n}\n\n/**\n * ` kept the first language's value where languages differ: concept-entry.subject-field on 1 concept`.\n * Fields are counted in concepts, fewest first, as the dropped line counts terms.\n */\nfunction conflictsLine(report: WriteReport): string | undefined {\n const conflicts = report.conflicts ?? [];\n if (conflicts.length === 0) return undefined;\n const ids = new Map<string, Set<string>>();\n for (const { id, field } of conflicts) {\n const set = ids.get(field) ?? new Set<string>();\n set.add(id);\n ids.set(field, set);\n }\n // A stable sort keeps fields of one count in the order they were first reported.\n const fields = [...ids.entries()].map(([field, set]) => ({ field, n: set.size })).sort((a, b) => a.n - b.n);\n const parts = fields.map(({ field, n }, i) => `${field} on ${i === 0 ? plural(n, \"concept\") : String(n)}`);\n return ` kept the first language's value where languages differ: ${parts.join(\", \")}`;\n}\n\n/** The dropped, dropped-header, skipped and conflict lines, which a write and a dry run print alike. */\nfunction renderNotes(report: WriteReport): string[] {\n return [\n droppedLine(report),\n droppedHeadersLine(report),\n skippedLine(report),\n otherLanguagesLine(report),\n conflictsLine(report),\n ].filter(\n (line) => line !== undefined,\n );\n}\n\nfunction unchangedLine(report: WriteReport): string {\n return report.mode === \"in-place\" ? \"Nothing to write\" : `${report.target ?? \"\"} is up to date`;\n}\n\nexport function renderWritePretty(report: WriteReport): string {\n if (report.check) {\n return report.changes.length > 0 ? report.changes.map(changeLine).join(\"\\n\") : unchangedLine(report);\n }\n if (report.dryRun) {\n const changes = report.changes.length > 0 ? report.changes.map(changeLine) : [unchangedLine(report)];\n return [...changes, ...renderNotes(report)].join(\"\\n\");\n }\n if (report.mode === \"in-place\") {\n const wrote = report.changes.length === 0 ? \"Nothing to write\" : `Wrote ${plural(report.changes.length, \"file\")}`;\n return [wrote, ...renderNotes(report)].join(\"\\n\");\n }\n const each = report.shape === \"directory\" && report.format !== \"vale\" ? \", one file each\" : \"\";\n const written = report.terms - report.skipped.length - (report.otherLanguages?.terms.length ?? 0);\n const lines = [`Wrote ${plural(written, \"term\")} to ${report.target ?? \"\"}${each}`];\n if (report.format === \"vale\") lines.push(...valeLines(report));\n lines.push(...renderNotes(report));\n return lines.join(\"\\n\");\n}\n\n/** The notice `write -f vale` prints when no section of Vale's config uses the style, or there is no section. */\nexport function renderValeWiring(wiring: ValeWiring): string {\n return [\n wiring.addSection\n ? `notice: ${wiring.rootIni} has no section with BasedOnStyles. Add one that uses the Terms style:`\n : `notice: no section of ${wiring.rootIni} uses the Terms style. Add it to BasedOnStyles:`,\n ` [${wiring.section}]`,\n ` BasedOnStyles = ${wiring.styles.join(\", \")}`,\n ].join(\"\\n\");\n}\n\n// ---------------------------------------------------------------------------\n// formats\n\nexport function renderFormatsPretty(rows: readonly FormatRow[]): string {\n const formatWidth = Math.max(0, ...rows.map((r) => r.format.length)) + 3;\n const labelWidth = Math.max(0, ...rows.map((r) => r.label.length)) + 3;\n return rows\n .map((r) =>\n `${r.format.padEnd(formatWidth)}${r.label.padEnd(labelWidth)}${r.read ? \"read \" : \" \"}${r.write ? \"write\" : \"\"}`.trimEnd(),\n )\n .join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;AA0BA,IAAM,QAAQ;AAGd,SAAS,UAAU,MAAc,OAAyB;AACxD,QAAM,QAAkB,CAAC;AACzB,MAAI,OAAO;AACX,aAAW,QAAQ,KAAK,MAAM,KAAK,EAAE,OAAO,CAAC,MAAM,MAAM,EAAE,GAAG;AAC5D,QAAI,SAAS,GAAI,QAAO;AAAA,aACf,KAAK,SAAS,IAAI,KAAK,UAAU,MAAO,QAAO,GAAG,IAAI,IAAI,IAAI;AAAA,SAClE;AACH,YAAM,KAAK,IAAI;AACf,aAAO;AAAA,IACT;AAAA,EACF;AACA,MAAI,SAAS,GAAI,OAAM,KAAK,IAAI;AAChC,SAAO,MAAM,WAAW,IAAI,CAAC,EAAE,IAAI;AACrC;AAGA,SAAS,cAAc,MAAc,OAAyB;AAC5D,MAAI,KAAK,UAAU,MAAO,QAAO,CAAC,IAAI;AACtC,QAAM,QAAkB,CAAC;AACzB,MAAI,OAAO;AACX,aAAW,YAAY,KAAK,MAAM,kBAAkB,GAAG;AACrD,QAAI,SAAS,GAAI,QAAO;AAAA,aACf,KAAK,SAAS,IAAI,SAAS,UAAU,MAAO,QAAO,GAAG,IAAI,IAAI,QAAQ;AAAA,SAC1E;AACH,YAAM,KAAK,IAAI;AACf,aAAO;AAAA,IACT;AAAA,EACF;AACA,MAAI,SAAS,GAAI,OAAM,KAAK,IAAI;AAChC,SAAO;AACT;AAEA,SAAS,QAAQ,OAAe,OAAoC;AAClE,QAAM,SAAS,IAAI,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AI;AAAA,EAClD;AACA,QAAM,OAAO,OAAO,UAAU,eAAe,OAAO,WAAW,SAAS,oBAAoB;AAC5F,QAAM,UAAU,OAAO,QAAQ,OAAO,QAAQ,UAAU,OAAO,gBAAgB,MAAM,UAAU;AAC/F,QAAM,QAAQ,CAAC,SAAS,OAAO,SAAS,MAAM,CAAC,OAAO,OAAO,UAAU,EAAE,GAAG,IAAI,EAAE;AAClF,MAAI,OAAO,WAAW,OAAQ,OAAM,KAAK,GAAG,UAAU,MAAM,CAAC;AAC7D,QAAM,KAAK,GAAG,YAAY,MAAM,CAAC;AACjC,SAAO,MAAM,KAAK,IAAI;AACxB;AAGO,SAAS,iBAAiB,QAA4B;AAC3D,SAAO;AAAA,IACL,OAAO,aACH,WAAW,OAAO,OAAO,2EACzB,yBAAyB,OAAO,OAAO;AAAA,IAC3C,MAAM,OAAO,OAAO;AAAA,IACpB,qBAAqB,OAAO,OAAO,KAAK,IAAI,CAAC;AAAA,EAC/C,EAAE,KAAK,IAAI;AACb;AAKO,SAAS,oBAAoB,MAAoC;AACtE,QAAM,cAAc,KAAK,IAAI,GAAG,GAAG,KAAK,IAAI,CAAC,MAAM,EAAE,OAAO,MAAM,CAAC,IAAI;AACvE,QAAM,aAAa,KAAK,IAAI,GAAG,GAAG,KAAK,IAAI,CAAC,MAAM,EAAE,MAAM,MAAM,CAAC,IAAI;AACrE,SAAO,KACJ;AAAA,IAAI,CAAC,MACJ,GAAG,EAAE,OAAO,OAAO,WAAW,CAAC,GAAG,EAAE,MAAM,OAAO,UAAU,CAAC,GAAG,EAAE,OAAO,WAAW,QAAQ,GAAG,EAAE,QAAQ,UAAU,EAAE,GAAG,QAAQ;AAAA,EACjI,EACC,KAAK,IAAI;AACd;","names":["lines","counts"]}
@@ -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\";\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 /** Parse raw file content into the generic tree. */\n parse(content: string, filePath: string): 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/** What a template asks for, as a finding carries it. */\nexport interface FindingTemplate {\n /** The template's ref, as `manni lint templates` lists it and `--template` takes it. */\n id: string;\n /** The rule's `id`. `null` for a rule without one, the template itself, or no rule at all. */\n rule: string | null;\n /** The rule's `description`, or `null` when it has none. */\n description: string | null;\n /** The template's `guide`, after `extends`, or `null`. */\n guide: string | null;\n}\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":";;;;;;AAsBO,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/types.ts"],"sourcesContent":["/**\n * Shared result model for manni docevals.\n *\n * Vocabulary follows the \"Docs as Evals\" methodology (Docs as Tests with AI):\n * every check is an *eval*; what differs is its *grader* (code-based, LLM-as-\n * judge, or human). Verdicts are binary pass/fail — aggregate rates emerge from\n * binary judgments, they are never assigned per item.\n */\nimport { ToolError } from \"../shared/errors.js\";\nimport type { Severity } from \"../shared/severity.js\";\n\n// The judge vocabulary is shared with the inference layer and is re-exported\n// here so manni docevals code and its consumers keep one import site. A second local\n// definition would be a second thing to keep in sync.\n//\n// Match — a single run's verdict; `partial` counts as fail\n// Zone — confidence-zone routing for AI-judged evals\n// JudgeVerdict — the structured verdict of one run (the book's shape)\n// JudgeRun — one run within an ensemble\n// ConsensusResult — the aggregated outcome for one (page, eval) pair\nimport type { ConsensusResult } from \"@hawkeyexl/inference\";\n\nexport type {\n ConsensusResult,\n JudgeRun,\n JudgeVerdict,\n Match,\n Zone,\n} from \"@hawkeyexl/inference\";\n\n/**\n * Regression evals guard behavior that must keep working (~100% target pass\n * rate). Capability evals probe what the docs/system can do (~70% target).\n */\nexport type EvalType = \"capability\" | \"regression\";\n\n/**\n * Finding severity for deterministically graded evals: the family scale,\n * `notice | warning | error`, from `src/shared/severity.ts`. Only `error`\n * affects exit codes.\n */\nexport type { Severity };\n\n/** How an eval is graded. `tool:regex` is the built-in `tool:*` kind; `registerGrader` adds others. */\nexport type GraderKind = \"ai\" | \"command\" | \"human\" | `tool:${string}`;\n\n/** A normalized finding from a deterministically graded eval (command or tool). */\nexport interface Finding {\n /** Name of the eval that produced this finding. */\n evalName: string;\n /** Repo-relative path of the page the finding applies to. */\n file: string;\n /** Grader-specific rule id (e.g. \"regex/found\"), when available. */\n ruleId?: string;\n message: string;\n severity: Severity;\n /**\n * This finding is about the *grader*, not the page: the tool could not be\n * run, or its output could not be read. It fails the eval whatever severity\n * the eval is configured at, because an eval configured `severity: warning`\n * would otherwise pass while its check never executed (ADR 01022).\n *\n * A finding about the page carries the eval's severity as usual.\n */\n diagnostic?: boolean;\n line?: number;\n col?: number;\n}\n\n/** Result of one eval applied to one page. */\nexport interface EvalResult {\n evalName: string;\n /**\n * Suite this result reports under. Stamped centrally by the engine, which\n * already computes the mapping for the suite summaries — the alternative is\n * threading it through every one of the ~30 places a result is constructed.\n */\n suite?: string;\n type: EvalType;\n grader: GraderKind;\n file: string;\n /**\n * Where the page declares the eval: the item of its `evals` key that names\n * it, in the page or in the manifest that supplied the key (proposal 0037).\n * A suite eval the page never names points at its `eval-suite` key, or at\n * the page alone when the suite is the config's default. `file` is spelled\n * like `file`, and `line` is 1-based and absent when nothing records one.\n *\n * Stamped centrally by the engine, like `suite`, on every result it\n * reports.\n */\n location?: { file: string; line?: number };\n outcome: \"pass\" | \"fail\" | \"needs-review\" | \"skipped\" | \"error\";\n /** Present for ai-graded evals. */\n consensus?: ConsensusResult;\n /** Present for command/tool-graded evals that produced findings. */\n findings?: Finding[];\n /** True when this run generated the eval's check script. */\n generated?: boolean;\n /** Set when a persisted human review resolved a needs-review outcome. */\n via?: \"human-review\";\n /**\n * Findings the baseline already recorded and this run therefore suppressed\n * (ADR 01017). Present only on a run with a baseline in effect, so its\n * absence means \"no baseline\", not \"nothing was forgiven\".\n */\n baselined?: number;\n skipReason?: string;\n /**\n * The eval's weight in its suite's pass rate. Stamped centrally by the\n * engine alongside `suite`, and for the same reason: threading it through\n * the ~30 sites that construct a result would be thirty chances to forget.\n */\n weight?: number;\n /**\n * Set when the model that judged this eval also produced what it graded.\n *\n * `content` — the machines attributed for what the eval's `target` reads\n * name this model (`provenance` for the body, the `fields` of\n * `meta-provenance` for the frontmatter, both for `raw`): the judge wrote\n * what it grades. `criterion` — a `meta-provenance` entry for this model\n * lists this eval under `evals`: the judge wrote the question. Both bias a\n * verdict without invalidating it, so this rides along with a real outcome\n * rather than replacing it, and reaches every reporter instead of stderr.\n */\n selfPreference?: { axis: \"content\" | \"criterion\"; model: string };\n durationMs: number;\n}\n\n/** Per-suite aggregate. Pass rates emerge from binary outcomes. */\nexport interface SuiteSummary {\n suite: string;\n total: number;\n passed: number;\n failed: number;\n needsReview: number;\n skipped: number;\n errored: number;\n /**\n * Weighted share of the graded set that passed, 1 when nothing ran.\n *\n * The graded set is pass + fail + error, as it has always been —\n * `needs-review` and `skipped` are in neither half, so a page awaiting review\n * neither helps nor hurts. Each eval contributes its `weight` (1 unless it\n * says otherwise), and an eval that belongs to a criterion contributes\n * nothing on its own: the criterion contributes once, for the group.\n */\n passRate: number;\n /** From config: ~1.0 for regression suites, ~0.7 for capability suites. */\n targetPassRate: number;\n meetsTarget: boolean;\n /**\n * Set when a selection filter (`--eval` / `--suite`) was active, meaning the\n * run measured part of this suite. `meetsTarget` is then always false and the\n * suite cannot fail the run either: it has numbers, but no verdict.\n */\n partial?: boolean;\n /**\n * Criteria scored in this suite. Present only when the suite declares any,\n * so its absence means \"none\", never \"none passed\".\n *\n * `suspended` counts criteria whose members were not all graded in this run.\n * They are out of the rate entirely rather than counted as failures — the\n * same reasoning as `partial` one level down (ADR 01018): a group measured\n * in part has numbers but no verdict.\n */\n criteria?: {\n total: number;\n passed: number;\n failed: number;\n suspended: number;\n };\n}\n\n/** Full run output consumed by reporters. */\nexport interface RunReport {\n pages: number;\n evalResults: EvalResult[];\n suites: SuiteSummary[];\n /**\n * Judge telemetry. Counts, not money: the dollar figure this block used to\n * carry was only as good as a price table this repo does not own, and was\n * absent entirely for `claude-cli` and self-hosted endpoints (ADR 01019).\n */\n usage: {\n totalTokens: number;\n cachedEvals: number;\n judgedEvals: number;\n };\n /** Script generations performed during this run (paths written). */\n generated: string[];\n exitCode: 0 | 1;\n}\n\n/** Operational/usage error → exit code 2. */\nexport class DocevalsError extends ToolError {\n constructor(\n message: string,\n /**\n * Set where a caller acts on the kind of error rather than reporting it.\n * `nothing-resolved`: no page this run would check resolves an eval.\n */\n readonly code?: \"nothing-resolved\",\n ) {\n super(message);\n this.name = \"DocevalsError\";\n }\n}\n"],"mappings":";;;;;;AAmMO,IAAM,gBAAN,cAA4B,UAAU;AAAA,EAC3C,YACE,SAKS,MACT;AACA,UAAM,OAAO;AAFJ;AAGT,SAAK,OAAO;AAAA,EACd;AAAA,EAJW;AAKb;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/tracevals/types.ts"],"sourcesContent":["/** Shared result model and errors for manni tracevals. */\nimport type { ConsensusResult } from \"@hawkeyexl/inference\";\nimport type {\n AvailabilityReport,\n CoverageEntry,\n} from \"./artifacts/types.js\";\nimport type { ArtifactType } from \"./artifacts/types.js\";\nimport type { ManifestReport } from \"./capture/types.js\";\nimport type { Finding } from \"./graders/types.js\";\nimport { ToolError } from \"../shared/errors.js\";\n\n/**\n * Operational error: bad usage, unreadable input, unknown format. Exits 2.\n * A `ToolError`, so the shared bin runner prints it as one line.\n */\nexport class TracevalsError extends ToolError {\n constructor(message: string) {\n super(message);\n this.name = \"TracevalsError\";\n }\n}\n\nexport type Outcome = \"pass\" | \"fail\" | \"error\" | \"needs-review\" | \"skipped\";\n\nexport interface EvalResult {\n evalName: string;\n /** Path of the artifact the eval came from. */\n artifact: string;\n artifactName: string;\n artifactType: ArtifactType;\n grader: string;\n implicit: boolean;\n /**\n * Where the eval is declared: the item of `metadata.evals` that names it, in\n * the artifact or in the manifest that supplied the block (proposal 0037).\n * `file` is relative to the working directory and forward-slashed when it is\n * inside it, absolute when it is not, and a URL for a hosted manifest.\n * `line` is 1-based, and absent when nothing records one, as for the\n * implicit eval, which no entry declares.\n */\n location: { file: string; line?: number };\n outcome: Outcome;\n /** Present for deterministic evals that produced findings. */\n findings?: Finding[];\n /** Present for judged evals. */\n consensus?: ConsensusResult;\n error?: string;\n skipReason?: string;\n /**\n * Judged evals only: uncached ensemble runs this eval spent. `0` when the\n * ensemble came from cache, or when the turn budget stopped it.\n */\n turns?: number;\n /**\n * Set when the model that judged this eval also produced what it graded.\n *\n * `session` — the judge model is the model that ran the session. This is the\n * sharpest form of the bias in either manni tool: the judge is not being\n * asked about a document it happened to draft, it is being asked whether its\n * own behavior followed the rules. `criterion` — `meta-provenance` records\n * this model proposing this assertion, so the judge wrote the question.\n *\n * Reported, never fatal: bias skews a verdict, it does not stop one forming,\n * and erroring would punish a single-model setup with no second provider to\n * reach for.\n */\n selfPreference?: { axis: \"session\" | \"criterion\"; model: string };\n /**\n * The eval's weight in the run's pass rate. Never changes its own outcome —\n * the binary verdict is what the reporters and exit code consume.\n */\n weight?: number;\n durationMs: number;\n}\n\nexport interface RunSummary {\n total: number;\n pass: number;\n fail: number;\n error: number;\n needsReview: number;\n skipped: number;\n /**\n * Weighted share of the graded set that passed, 1 when nothing was graded.\n *\n * The graded set is pass + fail + error; `needs-review` and `skipped` are in\n * neither half, so a session awaiting review neither helps nor hurts. Each\n * eval contributes its `weight` (1 unless it says otherwise), which is what\n * lets a secondary check report without dominating.\n *\n * Reported, never gated: manni tracevals has no suite targets to compare it\n * against, and inventing an exit-code rule around a number nobody configured\n * would be a gate no one asked for.\n */\n passRate: number;\n}\n\nexport interface RunReport {\n trace: {\n file: string;\n source: string;\n sessionId?: string;\n cwd: string;\n model?: string;\n turnCount: number;\n };\n /** Trace + resolution warnings, surfaced in every format. */\n warnings: string[];\n coverage: CoverageEntry[];\n /**\n * Offered versus used (ADR 01016). An observation about the session's\n * configuration; it never contributes to `summary` or `exitCode`.\n */\n availability: AvailabilityReport;\n /**\n * The session manifest this run consulted (ADR 01024), when one was found.\n * Absent means no manifest existed, which is the ordinary case — every hash\n * check then reports `skipped` and staleness stays the mtime heuristic.\n * Like `availability`, an observation: never in `summary`, never in\n * `exitCode`.\n */\n manifest?: ManifestReport;\n evalResults: EvalResult[];\n summary: RunSummary;\n /** 0 pass, 1 any fail/error (and needs-review when failOnReview). */\n exitCode: 0 | 1;\n /** Uncached ensemble runs this run spent. See `judge.maxTurns`. */\n turns: number;\n durationMs: number;\n}\n\n/* -------------------------------------------------------------------------- *\n * Batch runs (ADR 01018)\n *\n * Adherence is a rate across sessions, not a single verdict. `BatchReport`\n * sits alongside `RunReport` rather than replacing it: naming one trace still\n * yields exactly the `RunReport` above, byte for byte.\n * -------------------------------------------------------------------------- */\n\n/** Outcome tallies for one aggregate row. */\nexport interface AggregateCounts {\n pass: number;\n fail: number;\n error: number;\n needsReview: number;\n skipped: number;\n}\n\n/**\n * One artifact, or one eval within it, summed over every trace in the batch.\n *\n * Keyed by type and *name* rather than by path, so the same skill evaluated\n * across several projects is one rate — which is the fleet question this\n * report exists to answer. The paths it resolved from are kept in `artifacts`\n * so a reader can see when a row spans more than one.\n */\nexport interface AggregateRow {\n /** `<type>:<name>` for an artifact row, plus `::<evalName>` for an eval row. */\n key: string;\n artifactName: string;\n artifactType: ArtifactType;\n /** Distinct resolved paths this row was aggregated from, sorted. */\n artifacts: string[];\n /** Absent on artifact rows. */\n evalName?: string;\n /** The grader kinds seen for this row, sorted. Usually exactly one. */\n graders?: string[];\n /** Traces that produced at least one result for this row. */\n traces: number;\n /** Eval results contributing to this row. */\n total: number;\n counts: AggregateCounts;\n /** `total` minus `skipped` — the pass-rate denominator. */\n graded: number;\n /**\n * `pass / graded`, or `null` when nothing was graded. Skipped results are\n * excluded deliberately: a check that never armed is not evidence either\n * way, and folding it in would let an artifact nobody invoked report a\n * perfect score.\n */\n passRate: number | null;\n /** Traces where this row produced a `fail` or an `error`, in batch order. */\n failingTraces: string[];\n /** Traces where it produced a `needs-review`, in batch order. */\n reviewTraces: string[];\n /** Distinct skip reasons, sorted — an exhausted budget surfaces here. */\n skipReasons: string[];\n}\n\n/** One trace's place in the batch. */\nexport interface BatchTraceEntry {\n file: string;\n sessionId?: string;\n /**\n * Set when the trace could not be evaluated at all — unreadable, or not a\n * recognized format. One bad file in a corpus of fifty must not cost the\n * other forty-nine, so this is an entry rather than an aborted run.\n */\n error?: string;\n /** Absent when `error` is set. */\n summary?: RunSummary;\n warnings: string[];\n exitCode: 0 | 1;\n /** Judge turns spent on that trace. */\n turns: number;\n durationMs: number;\n}\n\nexport interface BatchSummary extends RunSummary {\n /** Traces selected, including any that errored. */\n traces: number;\n tracesPassed: number;\n /** Traces that produced a report with exit code 1. */\n tracesFailed: number;\n /** Traces that could not be evaluated at all. */\n tracesErrored: number;\n}\n\nexport interface BatchReport {\n traces: BatchTraceEntry[];\n /** Per-artifact rates, sorted by `key`. */\n artifacts: AggregateRow[];\n /** Per-eval rates, sorted by `key`. */\n evals: AggregateRow[];\n /** Eval counts summed over every trace, plus the per-trace tallies. */\n summary: BatchSummary;\n /** Batch-level warnings: plugin loading and trace selection. */\n warnings: string[];\n /** `1` when any trace failed or errored. */\n exitCode: 0 | 1;\n /** Judge turns spent across the batch. The budget spans it, not each trace. */\n turns: number;\n durationMs: number;\n}\n"],"mappings":";;;;;;AAeO,IAAM,iBAAN,cAA6B,UAAU;AAAA,EAC5C,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/term/reporters/json.ts"],"sourcesContent":["/**\n * JSON output for every `manni term` command. A term is the object\n * `write -f json` writes: its id, its language when it has one, and every field\n * in the vocabulary's order, so what `list -f json` prints can be read back as\n * a render.\n */\nimport { displayPath } from \"../commands/run.js\";\nimport type { FormatRow } from \"../commands/formats.js\";\nimport type { TermReport } from \"../commands/findings.js\";\nimport { TERM_FIELDS, type Term } from \"../types.js\";\n\nexport function termEntry(term: Term): Record<string, unknown> {\n const entry: Record<string, unknown> = { id: term.id };\n if (term.language !== undefined) entry[\"language\"] = term.language;\n for (const field of TERM_FIELDS) {\n const value = term.record[field];\n if (value !== undefined) entry[field] = value;\n }\n return entry;\n}\n\nexport function renderListJson(terms: readonly Term[]): string {\n return JSON.stringify({ terms: terms.map(termEntry) }, null, 2);\n}\n\nexport function renderGetJson(term: Term): string {\n return JSON.stringify(termEntry(term), null, 2);\n}\n\nexport function renderFindingsJson(report: TermReport): string {\n const count = (severity: string): number => report.findings.filter((f) => f.severity === severity).length;\n return JSON.stringify(\n {\n findings: report.findings.map((finding) => ({ ...finding, file: displayPath(finding.file, report.cwd) })),\n summary: {\n terms: report.terms,\n references: report.references,\n errors: count(\"error\"),\n warnings: count(\"warning\"),\n notices: count(\"notice\"),\n ...(report.baseline === undefined ? {} : { baseline: report.baseline }),\n },\n },\n null,\n 2,\n );\n}\n\nexport function renderFormatsJson(rows: readonly FormatRow[]): string {\n return JSON.stringify({ formats: rows }, null, 2);\n}\n"],"mappings":";;;;;;;AAWO,SAAS,UAAU,MAAqC;AAC7D,QAAM,QAAiC,EAAE,IAAI,KAAK,GAAG;AACrD,MAAI,KAAK,aAAa,OAAW,OAAM,UAAU,IAAI,KAAK;AAC1D,aAAW,SAAS,aAAa;AAC/B,UAAM,QAAQ,KAAK,OAAO,KAAK;AAC/B,QAAI,UAAU,OAAW,OAAM,KAAK,IAAI;AAAA,EAC1C;AACA,SAAO;AACT;AAEO,SAAS,eAAe,OAAgC;AAC7D,SAAO,KAAK,UAAU,EAAE,OAAO,MAAM,IAAI,SAAS,EAAE,GAAG,MAAM,CAAC;AAChE;AAEO,SAAS,cAAc,MAAoB;AAChD,SAAO,KAAK,UAAU,UAAU,IAAI,GAAG,MAAM,CAAC;AAChD;AAEO,SAAS,mBAAmB,QAA4B;AAC7D,QAAM,QAAQ,CAAC,aAA6B,OAAO,SAAS,OAAO,CAAC,MAAM,EAAE,aAAa,QAAQ,EAAE;AACnG,SAAO,KAAK;AAAA,IACV;AAAA,MACE,UAAU,OAAO,SAAS,IAAI,CAAC,aAAa,EAAE,GAAG,SAAS,MAAM,YAAY,QAAQ,MAAM,OAAO,GAAG,EAAE,EAAE;AAAA,MACxG,SAAS;AAAA,QACP,OAAO,OAAO;AAAA,QACd,YAAY,OAAO;AAAA,QACnB,QAAQ,MAAM,OAAO;AAAA,QACrB,UAAU,MAAM,SAAS;AAAA,QACzB,SAAS,MAAM,QAAQ;AAAA,QACvB,GAAI,OAAO,aAAa,SAAY,CAAC,IAAI,EAAE,UAAU,OAAO,SAAS;AAAA,MACvE;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,kBAAkB,MAAoC;AACpE,SAAO,KAAK,UAAU,EAAE,SAAS,KAAK,GAAG,MAAM,CAAC;AAClD;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/cite/reporters/github.ts"],"sourcesContent":["/**\n * GitHub workflow commands, one per finding:\n * `::error file=<file>,line=<n>,title=<ruleId>::<id or src> (<src>): <message>`\n * with `::warning` and `::notice` for the lower levels: the family scale is\n * GitHub's, so the level is the severity. Uses meta's escapes. A baselined\n * finding is not an annotation; a clean run is the empty string.\n */\nimport {\n escapeWorkflowCommandMessage,\n escapeWorkflowCommandProperty,\n} from \"../../meta/internal.js\";\nimport { errorSite } from \"../core/adapt.js\";\nimport type { CheckRun, CitationFinding, CiteRule } from \"../types.js\";\nimport { resultFor, splitBaselined } from \"./pretty.js\";\n\n/**\n * The rules whose message already names what it is about: every claim,\n * marker and anchor message is written as a sentence about the entry, so\n * prefixing it with the subject again would say the name twice. Exported so\n * a test asserting the composed messages reads this set rather than a copy.\n */\nexport const NAMES_ITS_SUBJECT = new Set<CiteRule>([\n \"claim-moved\",\n \"claim-moved-ambiguous\",\n \"claim-changed\",\n \"marker-orphan\",\n \"marker-invalid\",\n \"marker-repeated\",\n \"anchor-invalid\",\n]);\n\n/**\n * `<id> (<src>): <message>`, or `<src>: <message>` when the entry has no id.\n * A message that names its own subject, by its rule or by opening with the\n * id (an `entry-invalid` about a pin prefix does), is left to say it once.\n * SARIF and JUnit carry the same message.\n */\nexport function findingMessage(finding: CitationFinding): string {\n const subject = finding.id ?? finding.src;\n if (subject === undefined) return finding.message;\n if (NAMES_ITS_SUBJECT.has(finding.rule)) return finding.message;\n if (finding.id !== undefined && finding.message.startsWith(finding.id)) return finding.message;\n const where = finding.id !== undefined && finding.src !== undefined ? ` (${finding.src})` : \"\";\n return `${subject}${where}: ${finding.message}`;\n}\n\nexport function renderCheckGithub(run: CheckRun): string {\n const lines: string[] = [];\n run.pages.forEach((page, index) => {\n const { reported } = splitBaselined(page, resultFor(run, index));\n for (const finding of reported) {\n // A finding about an entry a manifest owns is annotated on the\n // manifest, unless that manifest is outside the tree, where an\n // annotation would land nowhere: then the page carries it.\n const site = errorSite(finding);\n const params = [`file=${escapeWorkflowCommandProperty(site.file ?? page.file)}`];\n if (site.line !== undefined) params.push(`line=${String(site.line)}`);\n params.push(`title=${escapeWorkflowCommandProperty(finding.ruleId)}`);\n lines.push(\n `::${finding.severity} ${params.join(\",\")}::${escapeWorkflowCommandMessage(findingMessage(finding))}`,\n );\n }\n });\n return lines.join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;AAqBO,IAAM,oBAAoB,oBAAI,IAAc;AAAA,EACjD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,eAAe,SAAkC;AAC/D,QAAM,UAAU,QAAQ,MAAM,QAAQ;AACtC,MAAI,YAAY,OAAW,QAAO,QAAQ;AAC1C,MAAI,kBAAkB,IAAI,QAAQ,IAAI,EAAG,QAAO,QAAQ;AACxD,MAAI,QAAQ,OAAO,UAAa,QAAQ,QAAQ,WAAW,QAAQ,EAAE,EAAG,QAAO,QAAQ;AACvF,QAAM,QAAQ,QAAQ,OAAO,UAAa,QAAQ,QAAQ,SAAY,KAAK,QAAQ,GAAG,MAAM;AAC5F,SAAO,GAAG,OAAO,GAAG,KAAK,KAAK,QAAQ,OAAO;AAC/C;AAEO,SAAS,kBAAkB,KAAuB;AACvD,QAAM,QAAkB,CAAC;AACzB,MAAI,MAAM,QAAQ,CAAC,MAAM,UAAU;AACjC,UAAM,EAAE,SAAS,IAAI,eAAe,MAAM,UAAU,KAAK,KAAK,CAAC;AAC/D,eAAW,WAAW,UAAU;AAI9B,YAAM,OAAO,UAAU,OAAO;AAC9B,YAAM,SAAS,CAAC,QAAQ,8BAA8B,KAAK,QAAQ,KAAK,IAAI,CAAC,EAAE;AAC/E,UAAI,KAAK,SAAS,OAAW,QAAO,KAAK,QAAQ,OAAO,KAAK,IAAI,CAAC,EAAE;AACpE,aAAO,KAAK,SAAS,8BAA8B,QAAQ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