@hawkeyexl/manni 4.16.0 → 4.18.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 (239) hide show
  1. package/README.md +1 -1
  2. package/dist/{batch-L5W4JS7A.js → batch-5TPNK5BQ.js} +14 -14
  3. package/dist/{build-GNZUVDZX.js → build-GGKCRWKH.js} +15 -14
  4. package/dist/{calibrate-2LYIDN6U.js → calibrate-OGOLLGXY.js} +15 -15
  5. package/dist/{capture-OEDMFU5Z.js → capture-CNHRHTA7.js} +14 -14
  6. package/dist/{check-NLLFHNWG.js → check-BAMOJMOJ.js} +16 -15
  7. package/dist/{check-Z5VGDSDT.js → check-XLIS5A7G.js} +13 -14
  8. package/dist/check-XYGABPXI.js +47 -0
  9. package/dist/{check-JR2TYL2Y.js → check-ZFI7H7LS.js} +15 -15
  10. package/dist/{cli-THEU2QG2.js → chunk-245W2Q7C.js} +133 -365
  11. package/dist/chunk-245W2Q7C.js.map +1 -0
  12. package/dist/{chunk-OJ7FEM2G.js → chunk-27FP4KKD.js} +47 -10
  13. package/dist/chunk-27FP4KKD.js.map +1 -0
  14. package/dist/{chunk-GQQ2AX63.js → chunk-2QZCPPVE.js} +38 -432
  15. package/dist/chunk-2QZCPPVE.js.map +1 -0
  16. package/dist/{chunk-BMYCLTFK.js → chunk-327CWO33.js} +3 -3
  17. package/dist/{chunk-WT3AATHC.js → chunk-33FIOHJ4.js} +252 -425
  18. package/dist/chunk-33FIOHJ4.js.map +1 -0
  19. package/dist/{chunk-ZJZQPOJO.js → chunk-3COYAAR7.js} +2 -2
  20. package/dist/{chunk-6ANTGYNT.js → chunk-3LZ6AYB4.js} +2 -2
  21. package/dist/{chunk-2AUULNIJ.js → chunk-4A445ALG.js} +3 -3
  22. package/dist/{chunk-L3YGGYBG.js → chunk-4KY2RUXQ.js} +3 -3
  23. package/dist/{chunk-NDBISART.js → chunk-5VA3ZOB7.js} +3 -3
  24. package/dist/{chunk-4LLYPDNG.js → chunk-6E6Z6UQL.js} +7 -7
  25. package/dist/{chunk-CSLJMML4.js → chunk-6ZYXK3JT.js} +4 -4
  26. package/dist/chunk-7RZQAMA2.js +314 -0
  27. package/dist/chunk-7RZQAMA2.js.map +1 -0
  28. package/dist/{chunk-NH6B6DDI.js → chunk-CWVL7XZR.js} +4 -4
  29. package/dist/{chunk-DTG6S2UG.js → chunk-E3YXGLEU.js} +2 -2
  30. package/dist/{chunk-5PO2BWZF.js → chunk-E76WPNYO.js} +2 -2
  31. package/dist/{chunk-F4GXZMEO.js → chunk-EITEHOSX.js} +12 -7
  32. package/dist/{chunk-F4GXZMEO.js.map → chunk-EITEHOSX.js.map} +1 -1
  33. package/dist/{chunk-DSTRT6YD.js → chunk-EU5QLSNN.js} +3 -3
  34. package/dist/{chunk-F6B2TNXU.js → chunk-F7GYY373.js} +6 -6
  35. package/dist/{chunk-6NTNLKNQ.js → chunk-FE3US7FR.js} +6 -5
  36. package/dist/{chunk-6NTNLKNQ.js.map → chunk-FE3US7FR.js.map} +1 -1
  37. package/dist/{chunk-IL62WATF.js → chunk-FNQE3RAW.js} +2 -2
  38. package/dist/chunk-FO6MNXOF.js +580 -0
  39. package/dist/chunk-FO6MNXOF.js.map +1 -0
  40. package/dist/{chunk-5D24C6WM.js → chunk-GMOAW2EG.js} +6 -2
  41. package/dist/chunk-GMOAW2EG.js.map +1 -0
  42. package/dist/chunk-GNZKLUZW.js +459 -0
  43. package/dist/chunk-GNZKLUZW.js.map +1 -0
  44. package/dist/{chunk-LEOQO3S6.js → chunk-ICRYIYMJ.js} +7 -7
  45. package/dist/{chunk-GR6QQ7GM.js → chunk-IIBVQCCR.js} +4 -4
  46. package/dist/{chunk-O6YTTBSN.js → chunk-JFB45L7D.js} +2 -2
  47. package/dist/chunk-JFPCDIES.js +1338 -0
  48. package/dist/chunk-JFPCDIES.js.map +1 -0
  49. package/dist/{chunk-2XRET3ZG.js → chunk-JHUEACRT.js} +31 -47
  50. package/dist/chunk-JHUEACRT.js.map +1 -0
  51. package/dist/{chunk-7UC55CAU.js → chunk-JS5NCZYC.js} +187 -159
  52. package/dist/chunk-JS5NCZYC.js.map +1 -0
  53. package/dist/{chunk-63GILHR5.js → chunk-KRQTN5KE.js} +4 -4
  54. package/dist/{chunk-WDENIUC7.js → chunk-MDZXRHIJ.js} +1 -1
  55. package/dist/chunk-MDZXRHIJ.js.map +1 -0
  56. package/dist/{chunk-3GLDB7MZ.js → chunk-MH5MX4B3.js} +1311 -18
  57. package/dist/chunk-MH5MX4B3.js.map +1 -0
  58. package/dist/{chunk-IGRXQC3H.js → chunk-N25KDXOV.js} +2 -2
  59. package/dist/{chunk-DW22KCLN.js → chunk-NPZWOPOH.js} +3 -3
  60. package/dist/{chunk-4L3JBAW4.js → chunk-NUAVQQMC.js} +2 -2
  61. package/dist/{chunk-PBZZUNDV.js → chunk-O2TE5X25.js} +7 -7
  62. package/dist/{chunk-EOSQENQF.js → chunk-OVQDZOMU.js} +2 -2
  63. package/dist/{chunk-WD33LE5A.js → chunk-OZWV27SE.js} +1313 -127
  64. package/dist/chunk-OZWV27SE.js.map +1 -0
  65. package/dist/{chunk-5OOQ3HQ3.js → chunk-PCTJ7P6U.js} +11 -2
  66. package/dist/chunk-PCTJ7P6U.js.map +1 -0
  67. package/dist/{chunk-EZCJPF72.js → chunk-PLN2LJDM.js} +3 -3
  68. package/dist/{chunk-D4ANAOY7.js → chunk-QGJA43DX.js} +20 -6
  69. package/dist/chunk-QGJA43DX.js.map +1 -0
  70. package/dist/{chunk-6YFEV7CM.js → chunk-QWYE3S3U.js} +5 -5
  71. package/dist/{chunk-GC47NBGO.js → chunk-QXTL5MGT.js} +4 -4
  72. package/dist/{chunk-AWAXAJ6R.js → chunk-RCWP63XT.js} +2 -2
  73. package/dist/{chunk-IM67NRUW.js → chunk-RMKMJ43W.js} +2 -2
  74. package/dist/{chunk-EA5KKIFG.js → chunk-RVSUMNCR.js} +3 -3
  75. package/dist/{chunk-NFJGIBES.js → chunk-SVB45M54.js} +82 -238
  76. package/dist/chunk-SVB45M54.js.map +1 -0
  77. package/dist/{chunk-4HEEXPVX.js → chunk-T3VFO2LO.js} +6 -6
  78. package/dist/{chunk-FU3OCYYH.js → chunk-TFTGMYDR.js} +2 -2
  79. package/dist/chunk-UP6NBQ62.js +2 -0
  80. package/dist/{chunk-LPBVWUKS.js → chunk-V2IP2ZMD.js} +2 -2
  81. package/dist/{chunk-PHNAQ4QX.js → chunk-V5QTIP2M.js} +182 -94
  82. package/dist/chunk-V5QTIP2M.js.map +1 -0
  83. package/dist/{chunk-B3XXCDYW.js → chunk-VV4YM6VM.js} +2385 -2061
  84. package/dist/chunk-VV4YM6VM.js.map +1 -0
  85. package/dist/{chunk-7GB3KEEM.js → chunk-XKZZRG3Z.js} +24 -460
  86. package/dist/chunk-XKZZRG3Z.js.map +1 -0
  87. package/dist/{chunk-ZT5NUSZA.js → chunk-XTQTA262.js} +146 -27
  88. package/dist/chunk-XTQTA262.js.map +1 -0
  89. package/dist/chunk-YLU4H2H3.js +545 -0
  90. package/dist/chunk-YLU4H2H3.js.map +1 -0
  91. package/dist/{chunk-YF6IZXAC.js → chunk-ZLOLC6WD.js} +7 -7
  92. package/dist/{cli-RWRYV5FB.js → cli-6UQ3QV2G.js} +9 -9
  93. package/dist/{cli-LZW6Z33F.js → cli-GH42HLFK.js} +42 -24
  94. package/dist/cli-GH42HLFK.js.map +1 -0
  95. package/dist/{cli-5QTSTGTX.js → cli-GND6TVRG.js} +18 -18
  96. package/dist/{cli-4Y2XY52B.js → cli-JHULEOH2.js} +2 -2
  97. package/dist/cli-LVHZCC2O.js +379 -0
  98. package/dist/cli-LVHZCC2O.js.map +1 -0
  99. package/dist/{cli-2EKRURBU.js → cli-NWU77YRZ.js} +15 -15
  100. package/dist/{cli-2SDBEUER.js → cli-PUO75R3L.js} +21 -21
  101. package/dist/{cli-TZ2OHF3H.js → cli-Q2RJMCVE.js} +28 -20
  102. package/dist/cli-Q2RJMCVE.js.map +1 -0
  103. package/dist/{cli-DBMPGGOV.js → cli-RUNYBUIV.js} +38 -38
  104. package/dist/{cli-BXUZ3KEQ.js → cli-T7UJF3BF.js} +634 -36
  105. package/dist/cli-T7UJF3BF.js.map +1 -0
  106. package/dist/{cli-KAUXC7EZ.js → cli-WUFQGIUG.js} +9 -9
  107. package/dist/cli.js +14 -14
  108. package/dist/docmeta.js +8 -8
  109. package/dist/{github-UR6LMUMW.js → github-BV42LSW2.js} +13 -14
  110. package/dist/github-XZ7OLATY.js +35 -0
  111. package/dist/graph/runtime.d.ts +633 -217
  112. package/dist/graph/runtime.js +1001 -370
  113. package/dist/graph/runtime.js.map +1 -1
  114. package/dist/index.d.ts +2734 -1977
  115. package/dist/index.js +109 -65
  116. package/dist/index.js.map +1 -1
  117. package/dist/{json-QTYN2JQB.js → json-LEEXKSGP.js} +13 -14
  118. package/dist/{json-5EQCGVCV.js → json-YTKUFNO3.js} +2 -2
  119. package/dist/{labels-UM2AFR5S.js → labels-E256WRAI.js} +12 -13
  120. package/dist/{labels-UM2AFR5S.js.map → labels-E256WRAI.js.map} +1 -1
  121. package/dist/{lint-LOFNZZPR.js → lint-W4CM3EIO.js} +13 -13
  122. package/dist/{list-GU7S6KEX.js → list-TB4R6AP4.js} +13 -14
  123. package/dist/{list-EPMHOU7T.js → list-UDDGL2OI.js} +15 -15
  124. package/dist/{page-25CN3AFY.js → page-L64NO57W.js} +13 -14
  125. package/dist/{prepare-5GYMBF4P.js → prepare-GFTAYDTP.js} +13 -13
  126. package/dist/{pretty-52Z74O6F.js → pretty-HYCYKYHB.js} +14 -15
  127. package/dist/{pretty-QW6OSYRS.js → pretty-Q43TCD6D.js} +13 -14
  128. package/dist/{reporters-WT53GD4P.js → reporters-4HRBSMUF.js} +4 -4
  129. package/dist/{reporters-FSXJ42EB.js → reporters-6TEJDXXO.js} +4 -4
  130. package/dist/{reporters-3FXX2W4X.js → reporters-E3FUVBQ6.js} +12 -12
  131. package/dist/{run-H7XJMUWK.js → run-UDX2C54M.js} +16 -16
  132. package/dist/{sarif-C427U3NA.js → sarif-WL353VTA.js} +11 -11
  133. package/dist/sarif-XZFJ5VIJ.js +36 -0
  134. package/dist/site/rehype.d.ts +33 -0
  135. package/dist/site/rehype.js +49 -0
  136. package/dist/site/rehype.js.map +1 -0
  137. package/dist/{term-VG65JRNR.js → term-OZ7ZR5KB.js} +18 -19
  138. package/dist/{term-VG65JRNR.js.map → term-OZ7ZR5KB.js.map} +1 -1
  139. package/dist/{types-VMOT7RAL.js → types-7N7ETP3W.js} +2 -2
  140. package/dist/{validate-K36F54UB.js → validate-CR3TI7GP.js} +5 -5
  141. package/package.json +10 -1
  142. package/plugin/manni/.claude-plugin/plugin.json +1 -1
  143. package/shapes/graph/shapes-1.2.0.ttl +1161 -0
  144. package/dist/check-LVO4HZ3F.js +0 -36
  145. package/dist/chunk-2XRET3ZG.js.map +0 -1
  146. package/dist/chunk-3GLDB7MZ.js.map +0 -1
  147. package/dist/chunk-3WZQ2FR3.js +0 -236
  148. package/dist/chunk-3WZQ2FR3.js.map +0 -1
  149. package/dist/chunk-5D24C6WM.js.map +0 -1
  150. package/dist/chunk-5OOQ3HQ3.js.map +0 -1
  151. package/dist/chunk-7GB3KEEM.js.map +0 -1
  152. package/dist/chunk-7UC55CAU.js.map +0 -1
  153. package/dist/chunk-B3XXCDYW.js.map +0 -1
  154. package/dist/chunk-D4ANAOY7.js.map +0 -1
  155. package/dist/chunk-GQQ2AX63.js.map +0 -1
  156. package/dist/chunk-IKEWBMCN.js +0 -98
  157. package/dist/chunk-IKEWBMCN.js.map +0 -1
  158. package/dist/chunk-NFJGIBES.js.map +0 -1
  159. package/dist/chunk-OJ7FEM2G.js.map +0 -1
  160. package/dist/chunk-PHNAQ4QX.js.map +0 -1
  161. package/dist/chunk-WD33LE5A.js.map +0 -1
  162. package/dist/chunk-WDENIUC7.js.map +0 -1
  163. package/dist/chunk-WT3AATHC.js.map +0 -1
  164. package/dist/chunk-YUTVAMWW.js +0 -2
  165. package/dist/chunk-ZT5NUSZA.js.map +0 -1
  166. package/dist/cli-BXUZ3KEQ.js.map +0 -1
  167. package/dist/cli-LZW6Z33F.js.map +0 -1
  168. package/dist/cli-THEU2QG2.js.map +0 -1
  169. package/dist/cli-TZ2OHF3H.js.map +0 -1
  170. package/dist/github-ICZ5UDGX.js +0 -36
  171. package/dist/sarif-UVAFWZKS.js +0 -37
  172. /package/dist/{batch-L5W4JS7A.js.map → batch-5TPNK5BQ.js.map} +0 -0
  173. /package/dist/{build-GNZUVDZX.js.map → build-GGKCRWKH.js.map} +0 -0
  174. /package/dist/{calibrate-2LYIDN6U.js.map → calibrate-OGOLLGXY.js.map} +0 -0
  175. /package/dist/{capture-OEDMFU5Z.js.map → capture-CNHRHTA7.js.map} +0 -0
  176. /package/dist/{check-LVO4HZ3F.js.map → check-BAMOJMOJ.js.map} +0 -0
  177. /package/dist/{check-NLLFHNWG.js.map → check-XLIS5A7G.js.map} +0 -0
  178. /package/dist/{check-Z5VGDSDT.js.map → check-XYGABPXI.js.map} +0 -0
  179. /package/dist/{check-JR2TYL2Y.js.map → check-ZFI7H7LS.js.map} +0 -0
  180. /package/dist/{chunk-BMYCLTFK.js.map → chunk-327CWO33.js.map} +0 -0
  181. /package/dist/{chunk-ZJZQPOJO.js.map → chunk-3COYAAR7.js.map} +0 -0
  182. /package/dist/{chunk-6ANTGYNT.js.map → chunk-3LZ6AYB4.js.map} +0 -0
  183. /package/dist/{chunk-2AUULNIJ.js.map → chunk-4A445ALG.js.map} +0 -0
  184. /package/dist/{chunk-L3YGGYBG.js.map → chunk-4KY2RUXQ.js.map} +0 -0
  185. /package/dist/{chunk-NDBISART.js.map → chunk-5VA3ZOB7.js.map} +0 -0
  186. /package/dist/{chunk-4LLYPDNG.js.map → chunk-6E6Z6UQL.js.map} +0 -0
  187. /package/dist/{chunk-CSLJMML4.js.map → chunk-6ZYXK3JT.js.map} +0 -0
  188. /package/dist/{chunk-NH6B6DDI.js.map → chunk-CWVL7XZR.js.map} +0 -0
  189. /package/dist/{chunk-DTG6S2UG.js.map → chunk-E3YXGLEU.js.map} +0 -0
  190. /package/dist/{chunk-5PO2BWZF.js.map → chunk-E76WPNYO.js.map} +0 -0
  191. /package/dist/{chunk-DSTRT6YD.js.map → chunk-EU5QLSNN.js.map} +0 -0
  192. /package/dist/{chunk-F6B2TNXU.js.map → chunk-F7GYY373.js.map} +0 -0
  193. /package/dist/{chunk-IL62WATF.js.map → chunk-FNQE3RAW.js.map} +0 -0
  194. /package/dist/{chunk-LEOQO3S6.js.map → chunk-ICRYIYMJ.js.map} +0 -0
  195. /package/dist/{chunk-GR6QQ7GM.js.map → chunk-IIBVQCCR.js.map} +0 -0
  196. /package/dist/{chunk-O6YTTBSN.js.map → chunk-JFB45L7D.js.map} +0 -0
  197. /package/dist/{chunk-63GILHR5.js.map → chunk-KRQTN5KE.js.map} +0 -0
  198. /package/dist/{chunk-IGRXQC3H.js.map → chunk-N25KDXOV.js.map} +0 -0
  199. /package/dist/{chunk-DW22KCLN.js.map → chunk-NPZWOPOH.js.map} +0 -0
  200. /package/dist/{chunk-4L3JBAW4.js.map → chunk-NUAVQQMC.js.map} +0 -0
  201. /package/dist/{chunk-PBZZUNDV.js.map → chunk-O2TE5X25.js.map} +0 -0
  202. /package/dist/{chunk-EOSQENQF.js.map → chunk-OVQDZOMU.js.map} +0 -0
  203. /package/dist/{chunk-EZCJPF72.js.map → chunk-PLN2LJDM.js.map} +0 -0
  204. /package/dist/{chunk-6YFEV7CM.js.map → chunk-QWYE3S3U.js.map} +0 -0
  205. /package/dist/{chunk-GC47NBGO.js.map → chunk-QXTL5MGT.js.map} +0 -0
  206. /package/dist/{chunk-AWAXAJ6R.js.map → chunk-RCWP63XT.js.map} +0 -0
  207. /package/dist/{chunk-IM67NRUW.js.map → chunk-RMKMJ43W.js.map} +0 -0
  208. /package/dist/{chunk-EA5KKIFG.js.map → chunk-RVSUMNCR.js.map} +0 -0
  209. /package/dist/{chunk-4HEEXPVX.js.map → chunk-T3VFO2LO.js.map} +0 -0
  210. /package/dist/{chunk-FU3OCYYH.js.map → chunk-TFTGMYDR.js.map} +0 -0
  211. /package/dist/{chunk-YUTVAMWW.js.map → chunk-UP6NBQ62.js.map} +0 -0
  212. /package/dist/{chunk-LPBVWUKS.js.map → chunk-V2IP2ZMD.js.map} +0 -0
  213. /package/dist/{chunk-YF6IZXAC.js.map → chunk-ZLOLC6WD.js.map} +0 -0
  214. /package/dist/{cli-RWRYV5FB.js.map → cli-6UQ3QV2G.js.map} +0 -0
  215. /package/dist/{cli-5QTSTGTX.js.map → cli-GND6TVRG.js.map} +0 -0
  216. /package/dist/{cli-4Y2XY52B.js.map → cli-JHULEOH2.js.map} +0 -0
  217. /package/dist/{cli-2EKRURBU.js.map → cli-NWU77YRZ.js.map} +0 -0
  218. /package/dist/{cli-2SDBEUER.js.map → cli-PUO75R3L.js.map} +0 -0
  219. /package/dist/{cli-DBMPGGOV.js.map → cli-RUNYBUIV.js.map} +0 -0
  220. /package/dist/{cli-KAUXC7EZ.js.map → cli-WUFQGIUG.js.map} +0 -0
  221. /package/dist/{github-ICZ5UDGX.js.map → github-BV42LSW2.js.map} +0 -0
  222. /package/dist/{github-UR6LMUMW.js.map → github-XZ7OLATY.js.map} +0 -0
  223. /package/dist/{json-5EQCGVCV.js.map → json-LEEXKSGP.js.map} +0 -0
  224. /package/dist/{json-QTYN2JQB.js.map → json-YTKUFNO3.js.map} +0 -0
  225. /package/dist/{lint-LOFNZZPR.js.map → lint-W4CM3EIO.js.map} +0 -0
  226. /package/dist/{list-EPMHOU7T.js.map → list-TB4R6AP4.js.map} +0 -0
  227. /package/dist/{list-GU7S6KEX.js.map → list-UDDGL2OI.js.map} +0 -0
  228. /package/dist/{page-25CN3AFY.js.map → page-L64NO57W.js.map} +0 -0
  229. /package/dist/{prepare-5GYMBF4P.js.map → prepare-GFTAYDTP.js.map} +0 -0
  230. /package/dist/{pretty-52Z74O6F.js.map → pretty-HYCYKYHB.js.map} +0 -0
  231. /package/dist/{pretty-QW6OSYRS.js.map → pretty-Q43TCD6D.js.map} +0 -0
  232. /package/dist/{reporters-3FXX2W4X.js.map → reporters-4HRBSMUF.js.map} +0 -0
  233. /package/dist/{reporters-FSXJ42EB.js.map → reporters-6TEJDXXO.js.map} +0 -0
  234. /package/dist/{reporters-WT53GD4P.js.map → reporters-E3FUVBQ6.js.map} +0 -0
  235. /package/dist/{run-H7XJMUWK.js.map → run-UDX2C54M.js.map} +0 -0
  236. /package/dist/{sarif-C427U3NA.js.map → sarif-WL353VTA.js.map} +0 -0
  237. /package/dist/{sarif-UVAFWZKS.js.map → sarif-XZFJ5VIJ.js.map} +0 -0
  238. /package/dist/{types-VMOT7RAL.js.map → types-7N7ETP3W.js.map} +0 -0
  239. /package/dist/{validate-K36F54UB.js.map → validate-CR3TI7GP.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/site/commands/annotate.ts","../src/site/core/annotate.ts"],"sourcesContent":["/**\n * `manni site annotate` (proposal 0095): join the chunk artifact\n * `manni graph publish` writes to the built site, and write the result into\n * each page as data. Each placed block gains `data-manni-*` attributes, and\n * each page gains one `#manni-provenance` JSON island. No mark, stylesheet or\n * script is written: a theme decides the look.\n *\n * Not a gate: the report is `0` whatever the pins say, and a run that cannot\n * read its inputs throws `SiteError` (exit 2).\n */\nimport { existsSync, readdirSync, readFileSync, statSync, writeFileSync } from \"node:fs\";\nimport { basename, dirname, extname, join, relative, resolve } from \"node:path\";\nimport { formatOf } from \"../../graph/core/analyze.js\";\nimport { loadRunConfig } from \"../../graph/core/config.js\";\nimport { documentBase } from \"../../graph/core/discover.js\";\nimport type { ChunkRow, ChunksManifest } from \"../../graph/runtime/chunks.js\";\nimport { parseChunkRows, parseChunksManifest } from \"../../graph/runtime/retrieve.js\";\nimport { integrityOf, locateFrontmatter } from \"../../meta/index.js\";\nimport { errorMessage } from \"../../shared/errors.js\";\nimport { bodyLineOf } from \"../../shared/pin.js\";\nimport { notice, warn } from \"../../shared/warn.js\";\nimport { joinPage, renderedText, stampedFiles, stripStamps, type UnplacedReason } from \"../core/annotate.js\";\nimport { resolveAnnotateSite, type Layout } from \"../core/detect.js\";\nimport { SiteError } from \"../errors.js\";\n\nexport interface AnnotateOptions {\n cwd: string;\n /** The positional `[dir]`, relative to `cwd`. */\n dir?: string;\n configPath?: string;\n /** `--out`, relative to `cwd`. */\n out?: string;\n /** `--chunks`, relative to `cwd`. */\n chunks?: string;\n}\n\nexport type AnnotateFormat = \"pretty\" | \"json\";\nexport const ANNOTATE_FORMATS: readonly AnnotateFormat[] = [\"pretty\", \"json\"];\n\n/** One line under the success line, in page order. */\nexport type AnnotateNote =\n | { kind: \"pin\" | \"statement\"; page: string; ids: string[]; reason: UnplacedReason | \"no-page\"; expected?: string }\n | { kind: \"drifted\"; page: string; ids: string[]; blocks: number };\n\nexport interface AnnotateReport {\n /** The built site, relative to the working directory. */\n out: string;\n /** Pages that gained an island. */\n pages: number;\n pins: { total: number; placed: number };\n statements: { total: number; placed: number };\n /** Blocks and headings carrying a statement's verification. */\n verified: number;\n notes: AnnotateNote[];\n}\n\nconst slash = (path: string): string => path.split(\"\\\\\").join(\"/\");\n\nfunction isDirectory(path: string): boolean {\n try {\n return statSync(path).isDirectory();\n } catch {\n return false;\n }\n}\n\nfunction htmlFiles(dir: string): string[] {\n return readdirSync(dir, { recursive: true, withFileTypes: true })\n .filter((e) => e.isFile() && e.name.endsWith(\".html\"))\n .map((e) => join(e.parentPath, e.name))\n .sort();\n}\n\n/** Where a page's built HTML is by the framework's convention, or `undefined` outside its content. */\nfunction routeOf(layout: Layout, siteDir: string, page: string): string | undefined {\n const rel = slash(relative(resolve(siteDir, layout.content), page));\n if (rel.startsWith(\"../\") || rel === \"..\") return undefined;\n const parts = rel.slice(0, rel.length - extname(rel).length).split(\"/\");\n const index = parts.at(-1) === \"index\";\n if (index) parts.pop();\n const path = parts.join(\"/\");\n const file = path === \"\" ? \"index.html\" : layout.route === \"dir\" || index ? `${path}/index.html` : `${path}.html`;\n return `${layout.prefix ?? \"\"}${file}`;\n}\n\n/** The chunk artifact, held to the graph it was built from. */\nfunction readArtifact(path: string, label: string, shown: (p: string) => string): { manifest: ChunksManifest; rows: ChunkRow[] } {\n if (!existsSync(path)) throw new SiteError(`${label} does not exist; run manni graph publish.`);\n let manifest: ChunksManifest;\n try {\n manifest = parseChunksManifest(readFileSync(path, \"utf8\"));\n } catch {\n throw new SiteError(`${label} is not a chunk manifest; run manni graph publish.`);\n }\n const stale = new SiteError(`${label} was built from another graph; run manni graph publish.`);\n const graphFile = resolve(dirname(path), manifest.graphFile);\n // No graph file to compare against: trust the rows' own hashes, checked below.\n if (existsSync(graphFile) && integrityOf(readFileSync(graphFile)) !== manifest.graph) throw stale;\n const rows: ChunkRow[] = [];\n for (const language of Object.values(manifest.languages)) {\n const file = resolve(dirname(path), language.file);\n if (!existsSync(file)) throw new SiteError(`${shown(file)} does not exist; run manni graph publish.`);\n try {\n rows.push(...parseChunkRows(readFileSync(file, \"utf8\")));\n } catch (e) {\n throw new SiteError(`${shown(file)}: ${errorMessage(e)} Run manni graph publish.`);\n }\n }\n if (rows.some((r) => r.graph !== manifest.graph)) throw stale;\n return { manifest, rows };\n}\n\n/** The body lines of a page source, rendered, for the text step. */\nexport function claimTexts(page: string, label: string): { bodyLine: number; text: (start: number, end: number) => string } {\n let content: string;\n try {\n content = readFileSync(page, \"utf8\");\n } catch (e) {\n warn(`${label} could not be read, so its pins are placed by line alone: ${errorMessage(e)}.`);\n return { bodyLine: 1, text: () => \"\" };\n }\n const format = formatOf(page);\n const bodyLine = format === \"html\" || format === \"xml\" ? 1 : bodyLineOf(content, locateFrontmatter(content)?.closeEnd ?? 0);\n const lines = content.split(/\\r?\\n/);\n return {\n bodyLine,\n text: (start, end) => {\n // A malformed range reads as no text, not as a slice from the end of the file.\n const from = Math.max(0, start + bodyLine - 2);\n const to = Math.min(lines.length, end + bodyLine - 1);\n return to <= from ? \"\" : renderedText(lines.slice(from, to));\n },\n };\n}\n\nexport function runAnnotate(opts: AnnotateOptions): AnnotateReport {\n const { cwd } = opts;\n const shown = (path: string): string => slash(relative(cwd, path)) || \".\";\n const site = resolveAnnotateSite(opts);\n const configured = site.config.out;\n const out =\n opts.out !== undefined\n ? resolve(cwd, opts.out)\n : resolve(site.dir, configured ?? site.layout?.out ?? \".\");\n const outLabel = shown(out);\n if (!isDirectory(out)) {\n const server = site.framework === \"Nextra\" || site.framework === \"Fumadocs\";\n if (server && opts.out === undefined && configured === undefined) {\n throw new SiteError(\n `${outLabel} does not exist. ${site.framework ?? \"\"} writes static pages only with output: \"export\" in next.config.`,\n );\n }\n throw new SiteError(`no built site at ${outLabel}. Run manni site build first, or pass --out.`);\n }\n\n let graph;\n try {\n graph = loadRunConfig(opts.configPath === undefined ? {} : { configPath: opts.configPath }, cwd);\n } catch (e) {\n throw new SiteError(errorMessage(e));\n }\n const chunks = opts.chunks !== undefined ? resolve(cwd, opts.chunks) : join(dirname(resolve(cwd, graph.out)), \"chunks.json\");\n const label = shown(chunks);\n const { manifest, rows } = readArtifact(chunks, label, shown);\n\n notice(`${site.framework === null ? \"\" : `${site.framework} in ${site.where}. `}Annotating ${outLabel} from ${label}.`);\n if (manifest.commit === null) notice(`${basename(chunks)} carries no commit, so pages get no data-manni-commit.`);\n\n // Each built page, and the source files its stamps name.\n const files = htmlFiles(out);\n const stampedBy = new Map<string, string[]>();\n for (const file of files) {\n for (const source of stampedFiles(readFileSync(file, \"utf8\"))) {\n const abs = resolve(site.dir, source);\n stampedBy.set(abs, [...(stampedBy.get(abs) ?? []), file]);\n }\n }\n if (stampedBy.size === 0 && site.layout?.unified === true) {\n warn(\n `${outLabel} carries no line stamps, so blocks are placed by text alone. Add @hawkeyexl/manni/site/rehype to the framework's rehype plugins.`,\n );\n }\n\n const byPage = new Map<string, ChunkRow[]>();\n for (const row of rows) byPage.set(row.page, [...(byPage.get(row.page) ?? []), row]);\n const base = documentBase(graph, {}, cwd);\n const report: AnnotateReport = {\n out: outLabel,\n pages: 0,\n pins: { total: 0, placed: 0 },\n statements: { total: 0, placed: 0 },\n verified: 0,\n notes: [],\n };\n const joined = new Set<string>();\n\n for (const page of [...byPage.keys()].sort()) {\n const pageRows = byPage.get(page) ?? [];\n const source = resolve(base, page);\n const route = site.layout === null ? undefined : routeOf(site.layout, site.dir, source);\n const routed = route === undefined ? undefined : join(out, route);\n const stamped = stampedBy.get(source) ?? [];\n const html =\n stamped.length === 1\n ? stamped[0]\n : stamped.length > 1\n ? (stamped.find((f) => f === routed) ?? stamped[0])\n : routed !== undefined && existsSync(routed)\n ? routed\n : undefined;\n const texts = claimTexts(source, shown(source));\n const result = joinPage({\n html: html === undefined ? \"\" : readFileSync(html, \"utf8\"),\n file: source,\n stampBase: site.dir,\n bodyLine: texts.bodyLine,\n claimText: texts.text,\n rows: pageRows,\n commit: manifest.commit,\n });\n report.pins.total += result.pins.total;\n report.statements.total += result.statements.total;\n if (html === undefined) {\n const expected = routed === undefined ? undefined : shown(routed);\n const all = result.unplaced;\n const ids = (kind: \"pin\" | \"statement\"): string[] => all.filter((u) => u.kind === kind).flatMap((u) => u.ids);\n for (const kind of [\"pin\", \"statement\"] as const) {\n if (ids(kind).length > 0) report.notes.push({ kind, page, ids: ids(kind), reason: \"no-page\", ...(expected === undefined ? {} : { expected }) });\n }\n continue;\n }\n // Two source pages can build to one HTML file. The first writes it, so the second's\n // pins and statements count in the totals but not in the placed counts.\n if (joined.has(html)) continue;\n joined.add(html);\n writeFileSync(html, result.html, \"utf8\");\n const at = slash(relative(out, html));\n report.pages += 1;\n report.pins.placed += result.pins.placed;\n report.statements.placed += result.statements.placed;\n report.verified += result.verified;\n if (result.drifted.blocks > 0) report.notes.push({ kind: \"drifted\", page: at, ids: result.drifted.ids, blocks: result.drifted.blocks });\n for (const u of result.unplaced) report.notes.push({ kind: u.kind, page: at, ids: u.ids, reason: u.reason });\n }\n\n // A page no record names still loses its stamps.\n for (const file of files) {\n if (joined.has(file)) continue;\n const text = readFileSync(file, \"utf8\");\n const clean = stripStamps(text);\n if (clean !== text) writeFileSync(file, clean, \"utf8\");\n }\n return report;\n}\n\nconst plural = (n: number, one: string, many: string): string => `${String(n)} ${n === 1 ? one : many}`;\n\nexport function renderAnnotate(report: AnnotateReport, format: AnnotateFormat): string {\n if (format === \"json\") {\n const unplaced = report.notes.flatMap((n) =>\n n.kind === \"drifted\" ? [] : [{ page: n.page, kind: n.kind, ids: n.ids, reason: n.reason }],\n );\n const drifted = report.notes.flatMap((n) => (n.kind === \"drifted\" ? [{ page: n.page, ids: n.ids }] : []));\n return JSON.stringify(\n { out: report.out, pages: report.pages, pins: report.pins, statements: report.statements, unplaced, drifted },\n null,\n 2,\n );\n }\n const { pins } = report;\n const lines = [\n `${report.out}: ${plural(report.pages, \"page\", \"pages\")} annotated. ` +\n `${String(pins.placed)} of ${String(pins.total)} pins placed, ${String(pins.total - pins.placed)} listed on their page only. ` +\n `${plural(report.verified, \"block carries\", \"blocks carry\")} a verification.`,\n ];\n let lastMissing = \"\";\n for (const n of report.notes) {\n const ids = n.ids.join(\", \");\n const its = n.ids.length === 1 ? \"its\" : \"their\";\n if (n.kind === \"drifted\") {\n lines.push(` ${n.page}: ${plural(n.blocks, \"block\", \"blocks\")} drifted, because a source changed: ${ids}.`);\n } else if (n.reason === \"no-page\") {\n // One line per page, though its pins and its statements are two entries.\n if (n.page === lastMissing) continue;\n lastMissing = n.page;\n lines.push(` ${n.page}: no built page ${n.expected === undefined ? `in ${report.out}` : `at ${n.expected}`}.`);\n } else if (n.kind === \"statement\") {\n lines.push(` ${n.page}: ${plural(n.ids.length, \"statement\", \"statements\")} not placed, because no block holds lines ${ids}.`);\n } else {\n const why = n.reason === \"repeated-text\" ? `${its} text appears twice` : `no block holds ${its} text`;\n lines.push(` ${n.page}: ${plural(n.ids.length, \"pin\", \"pins\")} not placed, because ${why}: ${ids}.`);\n }\n }\n return lines.join(\"\\n\");\n}\n","/**\n * The join behind `manni site annotate` (proposal 0095): one built page, its\n * chunk rows, and what each pin and statement is joined to.\n *\n * Lines first: a block stamped by `@hawkeyexl/manni/site/rehype` whose lines\n * overlap the claim. Then text: the claim's rendered text in exactly one run\n * of adjacent blocks. A tie is never broken. Statements join by lines alone.\n *\n * The page is never re-serialized. Each change is an edit at a source offset\n * parse5 reports, so every byte annotate does not touch stays as the\n * framework wrote it.\n */\nimport { resolve } from \"node:path\";\nimport { parse, type DefaultTreeAdapterTypes } from \"parse5\";\nimport remarkGfm from \"remark-gfm\";\nimport remarkParse from \"remark-parse\";\nimport { toString as mdastToString } from \"mdast-util-to-string\";\nimport { unified } from \"unified\";\nimport { range, type ChunkRow, type PassageStatement, type PinItem, type ProvenanceRecord } from \"../../graph/runtime/chunks.js\";\n\ntype Node = DefaultTreeAdapterTypes.Node;\ntype Element = DefaultTreeAdapterTypes.Element;\n\nexport const STAMP = \"data-manni-src\";\nexport const ISLAND_ID = \"manni-provenance\";\n\n/**\n * The elements the text step compares; a table row is one, not its cells. Not the\n * same set as `BLOCKS` in `rehype.ts`: that one also stamps the containers (`ul`,\n * `ol`, `table`, `dl`) so `byLines` can find the innermost stamped child, and\n * leaves out `figcaption`, which only this step reads.\n */\nconst TEXT_BLOCKS = new Set([\"p\", \"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\", \"li\", \"pre\", \"blockquote\", \"tr\", \"dt\", \"dd\", \"figcaption\"]);\nconst NO_TEXT = new Set([\"script\", \"style\", \"template\", \"head\"]);\n/**\n * Shorter than this, a block inside a longer claim is too common to count. Such a\n * block inside a claim's run splits the run, so the claim is reported as\n * `repeated-text` and stays unplaced. That is conservative.\n */\nconst MIN_PART = 12;\n\nexport interface PageJoinInput {\n html: string;\n /** The page source, absolute: stamps naming it join. */\n file: string;\n /** The directory stamps resolve from: where the framework built. */\n stampBase: string;\n /** The file line of body line 1. */\n bodyLine: number;\n /** The rendered, normalized text of body lines `start`-`end`. */\n claimText: (start: number, end: number) => string;\n /** The page's chunk rows. */\n rows: readonly ChunkRow[];\n /** The docs commit, or `null` outside git. */\n commit: string | null;\n}\n\nexport type UnplacedReason = \"repeated-text\" | \"no-block\";\n\nexport interface PageJoin {\n html: string;\n pins: { total: number; placed: number };\n statements: { total: number; placed: number };\n unplaced: { kind: \"pin\" | \"statement\"; ids: string[]; reason: UnplacedReason }[];\n /** Blocks whose state is `drifted`, and the error pins on them. */\n drifted: { blocks: number; ids: string[] };\n /** Blocks and headings that carry a statement's verification. */\n verified: number;\n}\n\ninterface Stamp {\n file: string;\n start: number;\n end: number;\n}\n\n/** What a placed element gains, in the order its attributes are written. */\ninterface Marks {\n node?: string;\n pins: string[];\n drifted: boolean;\n verified?: string;\n verifiedBy?: string;\n statement?: PassageStatement[\"status\"];\n appliesTo?: string;\n}\n\ninterface Edit {\n start: number;\n end: number;\n text: string;\n}\n\n// ---- reading the page -----------------------------------------------------------\n\nfunction children(node: Node): Node[] {\n return \"childNodes\" in node ? node.childNodes : [];\n}\n\nfunction isElement(node: Node): node is Element {\n return \"tagName\" in node;\n}\n\nfunction attr(el: Element, name: string): string | undefined {\n return el.attrs.find((a) => a.name === name)?.value;\n}\n\nfunction textOf(node: Node): string {\n if (node.nodeName === \"#text\") return \"value\" in node ? node.value : \"\";\n if (isElement(node) && NO_TEXT.has(node.tagName)) return \"\";\n return children(node).map(textOf).join(\"\");\n}\n\nfunction parseStamp(value: string, base: string): Stamp | undefined {\n const m = /^(.*):(\\d+)-(\\d+)$/.exec(value);\n if (m?.[1] === undefined || m[2] === undefined || m[3] === undefined) return undefined;\n return { file: resolve(base, m[1]), start: Number(m[2]), end: Number(m[3]) };\n}\n\n/** Every element in document order, with its parent. */\nfunction walk(root: Node): { all: Element[]; parent: Map<Element, Element> } {\n const all: Element[] = [];\n const parent = new Map<Element, Element>();\n const visit = (node: Node, up: Element | undefined): void => {\n let next = up;\n if (isElement(node)) {\n all.push(node);\n if (up !== undefined) parent.set(node, up);\n next = node;\n }\n if (isElement(node) && node.tagName === \"template\") return;\n for (const c of children(node)) visit(c, next);\n };\n visit(root, undefined);\n return { all, parent };\n}\n\n/**\n * Text compared without whitespace, and with the typography a renderer adds\n * (smart quotes, dashes, an ellipsis) undone on both sides.\n */\nexport function comparable(text: string): string {\n return text\n .replace(/[‘’]/g, \"'\")\n .replace(/[“”]/g, '\"')\n .replace(/—/g, \"---\")\n .replace(/–/g, \"--\")\n .replace(/…/g, \"...\")\n .replace(/\\s+/g, \"\");\n}\n\nconst processor = unified().use(remarkParse).use(remarkGfm);\nconst TABLE_ROW = /^\\s*\\|.*\\|\\s*$/;\nconst TABLE_DELIMITER = /^\\s*\\|?\\s*:?-+:?\\s*(\\|\\s*:?-+:?\\s*)*\\|?\\s*$/;\n\n/**\n * Markdown lines as the reader sees them: rendered to text, with no HTML or\n * JSX. A table row alone is no table to a parser, so its pipes go first.\n */\nexport function renderedText(lines: readonly string[]): string {\n const source = lines\n .filter((l) => !(TABLE_DELIMITER.test(l) && l.includes(\"-\") && l.includes(\"|\")))\n .map((l) => (TABLE_ROW.test(l) ? l.replace(/\\|/g, \" \") : l))\n .join(\"\\n\");\n return comparable(mdastToString(processor.parse(source), { includeHtml: false }));\n}\n\n// ---- the records ------------------------------------------------------------------\n\ninterface Row {\n id: string;\n start: number;\n end: number;\n section: boolean;\n metadata: Record<string, unknown>;\n}\n\nconst strings = (value: unknown): string[] =>\n Array.isArray(value) ? value.filter((v): v is string => typeof v === \"string\") : typeof value === \"string\" ? [value] : [];\n\nfunction tools(value: unknown): string[] {\n if (!Array.isArray(value)) return [];\n const out: string[] = [];\n for (const entry of value) {\n const tool = typeof entry === \"object\" && entry !== null ? (entry as Record<string, unknown>)[\"tool\"] : undefined;\n if (typeof tool === \"string\" && !out.includes(tool)) out.push(tool);\n }\n return out;\n}\n\n/** The records of one page, in `lines` order: the outer passage first. */\nexport function pageRecords(rows: readonly ChunkRow[]): ProvenanceRecord[] {\n return [...rows]\n .map((r) => ({ r, span: range(r.lines) ?? { start: 0, end: 0 } }))\n .sort((a, b) => a.span.start - b.span.start || b.span.end - a.span.end || (a.r.id < b.r.id ? -1 : a.r.id > b.r.id ? 1 : 0))\n .map((x) => x.r.provenance);\n}\n\n/** Each pin on the page once, in the page's order: the whole-page passage holds every one. */\nfunction pinsOf(rows: readonly ChunkRow[]): PinItem[] {\n const seen = new Set<string>();\n const out: PinItem[] = [];\n for (const record of pageRecords(rows)) {\n for (const item of record.pins.items) {\n const key = JSON.stringify(item);\n if (seen.has(key)) continue;\n seen.add(key);\n out.push(item);\n }\n }\n return out;\n}\n\nfunction statementsOf(rows: readonly ChunkRow[]): PassageStatement[] {\n const seen = new Set<string>();\n const out: PassageStatement[] = [];\n for (const record of pageRecords(rows)) {\n for (const s of record.statements) {\n const key = JSON.stringify(s);\n if (seen.has(key)) continue;\n seen.add(key);\n out.push(s);\n }\n }\n return out.sort((a, b) => (range(a.lines)?.start ?? 0) - (range(b.lines)?.start ?? 0));\n}\n\n// ---- the join ---------------------------------------------------------------------\n\nexport function joinPage(input: PageJoinInput): PageJoin {\n const { html } = input;\n const doc = parse(html, { sourceCodeLocationInfo: true });\n const { all, parent } = walk(doc);\n\n const stamps = new Map<Element, Stamp>();\n for (const el of all) {\n const value = attr(el, STAMP);\n const stamp = value === undefined ? undefined : parseStamp(value, input.stampBase);\n if (stamp !== undefined && stamp.file === input.file) stamps.set(el, stamp);\n }\n\n const main = all.find((e) => e.tagName === \"main\");\n const body = all.find((e) => e.tagName === \"body\");\n const scope = main ?? body;\n const inScope = (el: Element): boolean => {\n for (let at: Element | undefined = el; at !== undefined; at = parent.get(at)) if (at === scope) return true;\n return scope === undefined;\n };\n const textual = all.filter((e) => TEXT_BLOCKS.has(e.tagName) && inScope(e));\n const nested = new Set<Element>();\n for (const el of textual) for (let up = parent.get(el); up !== undefined; up = parent.get(up)) nested.add(up);\n const blocks = textual.filter((e) => !nested.has(e)).map((el) => ({ el, text: comparable(textOf(el)) }));\n\n /** The innermost stamped elements whose lines overlap `start`-`end` (file lines). */\n const byLines = (start: number, end: number): Element[] => {\n const hit = [...stamps].filter(([, s]) => s.start <= end && s.end >= start).map(([el]) => el);\n const outer = new Set<Element>();\n for (const el of hit) for (let up = parent.get(el); up !== undefined; up = parent.get(up)) outer.add(up);\n return hit.filter((el) => !outer.has(el));\n };\n\n /** The single run of blocks holding `text`, or why there is none. */\n const byText = (text: string): Element[] | UnplacedReason => {\n if (text === \"\") return \"no-block\";\n const holding = blocks.filter((b) => b.text.includes(text));\n if (holding.length === 1) return holding.map((b) => b.el);\n if (holding.length > 1) return \"repeated-text\";\n const runs: Element[][] = [];\n let run: Element[] = [];\n for (const b of blocks) {\n if (b.text.length >= MIN_PART && text.includes(b.text)) run.push(b.el);\n else if (run.length > 0) {\n runs.push(run);\n run = [];\n }\n }\n if (run.length > 0) runs.push(run);\n if (runs.length === 1) return runs[0] ?? \"no-block\";\n return runs.length === 0 ? \"no-block\" : \"repeated-text\";\n };\n\n const rows: Row[] = input.rows.flatMap((r) => {\n const span = range(r.lines);\n return span === undefined ? [] : [{ id: r.id, ...span, section: r.id.includes(\"#\"), metadata: r.metadata }];\n });\n const docId = rows.find((r) => !r.section)?.id ?? input.rows[0]?.id.split(\"#\")[0] ?? \"\";\n const toFile = (line: number): number => line + input.bodyLine - 1;\n /** The innermost passage holding body line `line`. */\n const nodeAt = (line: number): string => {\n const holding = rows.filter((r) => r.start <= line && r.end >= line);\n holding.sort((a, b) => b.start - a.start || a.end - b.end);\n return holding[0]?.id ?? docId;\n };\n\n const marks = new Map<Element, Marks>();\n const marksOf = (el: Element): Marks => {\n let m = marks.get(el);\n if (m === undefined) {\n m = { pins: [], drifted: false };\n marks.set(el, m);\n }\n return m;\n };\n\n const result: PageJoin = {\n html,\n pins: { total: 0, placed: 0 },\n statements: { total: 0, placed: 0 },\n unplaced: [],\n drifted: { blocks: 0, ids: [] },\n verified: 0,\n };\n const unplaced = (kind: \"pin\" | \"statement\", reason: UnplacedReason, id: string): void => {\n const entry = result.unplaced.find((u) => u.kind === kind && u.reason === reason);\n if (entry === undefined) result.unplaced.push({ kind, ids: [id], reason });\n else entry.ids.push(id);\n };\n\n // Pins.\n const errorIds = new Map<Element, string[]>();\n for (const [i, pin] of pinsOf(input.rows).entries()) {\n result.pins.total += 1;\n const claim = range(pin.claim);\n const id = pin.id ?? `#${String(i + 1)}`;\n if (claim === undefined) {\n unplaced(\"pin\", \"no-block\", id);\n continue;\n }\n let placed = byLines(toFile(claim.start), toFile(claim.end));\n if (placed.length === 0) {\n const found = byText(input.claimText(claim.start, claim.end));\n if (typeof found === \"string\") {\n unplaced(\"pin\", found, id);\n continue;\n }\n placed = found;\n }\n result.pins.placed += 1;\n const error = pin.findings.some((f) => f.severity === \"error\");\n for (const el of placed) {\n const m = marksOf(el);\n m.node ??= nodeAt(claim.start);\n if (!m.pins.includes(id)) m.pins.push(id);\n if (error) {\n m.drifted = true;\n const ids = errorIds.get(el) ?? [];\n ids.push(id);\n errorIds.set(el, ids);\n }\n }\n }\n\n // Statements: a heading's describes its section, any other is a graph:Block.\n const blocksIn = new Map<string, number>();\n for (const statement of statementsOf(input.rows)) {\n result.statements.total += 1;\n const span = range(statement.lines);\n const heading = span && rows.find((r) => r.section && r.start >= span.start && r.start <= span.end);\n let node: string;\n if (heading) node = heading.id;\n else {\n const owner = rows\n .filter((r) => r.section && span !== undefined && r.start <= span.start)\n .sort((a, b) => b.start - a.start)[0];\n const key = owner?.id ?? `${docId}#`;\n const n = (blocksIn.get(key) ?? 0) + 1;\n blocksIn.set(key, n);\n node = `${key}.${String(n)}`;\n }\n const placed = span === undefined ? [] : byLines(toFile(span.start), toFile(span.end));\n if (placed.length === 0) {\n unplaced(\"statement\", \"no-block\", statement.lines);\n continue;\n }\n result.statements.placed += 1;\n const lastVerified = statement.data[\"last-verified\"];\n const by = tools(statement.data[\"verified-by\"]);\n const appliesTo = heading ? strings(heading.metadata[\"applies-to\"]) : [];\n for (const el of placed) {\n const m = marksOf(el);\n // A pin's passage node wins: the island's records are keyed by it.\n m.node ??= node;\n if (typeof lastVerified === \"string\") m.verified = lastVerified;\n if (by.length > 0) m.verifiedBy = by.join(\" \");\n m.statement = statement.status;\n if (appliesTo.length > 0) m.appliesTo = appliesTo.join(\" \");\n }\n }\n\n const edits: Edit[] = [];\n // Every manni attribute the page carries goes, stamps and an earlier run's marks alike.\n for (const el of all) {\n const at = el.sourceCodeLocation?.attrs;\n if (at === undefined) continue;\n for (const a of el.attrs) {\n const loc = at[a.name];\n if (!a.name.startsWith(\"data-manni-\") || loc === undefined) continue;\n let start = loc.startOffset;\n while (start > 0 && /\\s/.test(html[start - 1] ?? \"\")) start -= 1;\n edits.push({ start, end: loc.endOffset, text: \"\" });\n }\n if (el.tagName === \"script\" && attr(el, \"id\") === ISLAND_ID) {\n const loc = el.sourceCodeLocation;\n if (loc?.startTag !== undefined && loc.endTag !== undefined) {\n const end = html[loc.endTag.endOffset] === \"\\n\" ? loc.endTag.endOffset + 1 : loc.endTag.endOffset;\n edits.push({ start: loc.startTag.startOffset, end, text: \"\" });\n }\n }\n }\n\n for (const [el, m] of marks) {\n const pairs: [string, string | undefined][] = [\n [\"node\", m.node],\n [\"pins\", m.pins.length > 0 ? m.pins.join(\" \") : undefined],\n [\"state\", m.pins.length > 0 ? (m.drifted ? \"drifted\" : \"current\") : undefined],\n [\"verified\", m.verified],\n [\"verified-by\", m.verifiedBy],\n [\"statement\", m.statement],\n [\"applies-to\", m.appliesTo],\n ];\n insertAttrs(el, pairs, html, edits);\n if (m.drifted) {\n result.drifted.blocks += 1;\n for (const id of errorIds.get(el) ?? []) if (!result.drifted.ids.includes(id)) result.drifted.ids.push(id);\n }\n if (m.statement !== undefined && (m.verified !== undefined || m.verifiedBy !== undefined)) result.verified += 1;\n }\n\n const records = pageRecords(input.rows);\n const first = records[0];\n const page = scope ?? body;\n if (page !== undefined) {\n insertAttrs(\n page,\n [\n [\"commit\", input.commit ?? undefined],\n [\"last-verified\", first?.dates.lastVerified ?? undefined],\n ],\n html,\n edits,\n );\n }\n\n const island = {\n page: first?.page ?? \"\",\n commit: input.commit,\n worktree: first?.worktree ?? null,\n dates: first?.dates ?? null,\n records,\n };\n const json = JSON.stringify(island).replace(/</g, \"\\\\u003c\");\n const closeBody = body?.sourceCodeLocation?.endTag?.startOffset;\n const at = closeBody ?? html.length;\n edits.push({ start: at, end: at, text: `<script type=\"application/json\" id=\"${ISLAND_ID}\">${json}</script>\\n` });\n\n result.html = applyEdits(html, edits);\n return result;\n}\n\nconst escapeAttr = (value: string): string => value.replace(/&/g, \"&amp;\").replace(/\"/g, \"&quot;\").replace(/</g, \"&lt;\");\n\nfunction insertAttrs(el: Element, pairs: [string, string | undefined][], html: string, edits: Edit[]): void {\n const tag = el.sourceCodeLocation?.startTag;\n if (tag === undefined) return;\n const text = pairs\n .filter((p): p is [string, string] => p[1] !== undefined)\n .map(([name, value]) => ` data-manni-${name}=\"${escapeAttr(value)}\"`)\n .join(\"\");\n if (text === \"\") return;\n const at = html[tag.endOffset - 2] === \"/\" ? tag.endOffset - 2 : tag.endOffset - 1;\n edits.push({ start: at, end: at, text });\n}\n\nfunction applyEdits(html: string, edits: Edit[]): string {\n // From the end, so each edit's offsets still hold when it is applied.\n const sorted = [...edits].sort((a, b) => b.start - a.start || b.end - a.end);\n let out = html;\n for (const e of sorted) out = out.slice(0, e.start) + e.text + out.slice(e.end);\n return out;\n}\n\n/** Remove every stamp from a page no record names, so none reaches the deployed site. */\nexport function stripStamps(html: string): string {\n if (!html.includes(STAMP)) return html;\n const doc = parse(html, { sourceCodeLocationInfo: true });\n const edits: Edit[] = [];\n for (const el of walk(doc).all) {\n const loc = el.sourceCodeLocation?.attrs?.[STAMP];\n if (loc === undefined) continue;\n let start = loc.startOffset;\n while (start > 0 && /\\s/.test(html[start - 1] ?? \"\")) start -= 1;\n edits.push({ start, end: loc.endOffset, text: \"\" });\n }\n return applyEdits(html, edits);\n}\n\n/** The source files a page's stamps name, as written. */\nexport function stampedFiles(html: string): Set<string> {\n const out = new Set<string>();\n for (const m of html.matchAll(/data-manni-src=\"([^\"]*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AAA,IACtG;AAAA,EACF;AACA,SAAO,MAAM,KAAK,IAAI;AACxB;","names":["resolve","at","resolve"]}
@@ -7,7 +7,11 @@ function publicCitation(result) {
7
7
  file: result.origin.file
8
8
  };
9
9
  if (result.origin.line !== void 0) origin.line = result.origin.line;
10
- const source = { src: result.source.src, status: result.source.status };
10
+ const source = {
11
+ src: result.source.src,
12
+ ...result.source.repo === void 0 ? {} : { repo: result.source.repo },
13
+ status: result.source.status
14
+ };
11
15
  if (result.source.newLines !== void 0) source.newLines = result.source.newLines;
12
16
  if (result.source.newSrc !== void 0) source.newSrc = result.source.newSrc;
13
17
  if (result.source.candidates !== void 0) source.candidates = result.source.candidates;
@@ -70,4 +74,4 @@ export {
70
74
  renderHistoryJson,
71
75
  renderUpdateJson
72
76
  };
73
- //# sourceMappingURL=chunk-5D24C6WM.js.map
77
+ //# sourceMappingURL=chunk-GMOAW2EG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cite/reporters/json.ts"],"sourcesContent":["/**\n * JSON output. `{ summary, pages }` for check; the run itself for update,\n * remove and history.\n *\n * A citation prints its two ends and how they are anchored. `resolvedPath`,\n * `diff`, `commitsSince` and a changed claim's current lines are left out of\n * every citation: output never says more than the page did. It is an\n * allowlist rather than a strip, so a field added to the result stays private\n * until someone decides here that it is safe to print.\n */\nimport type {\n CheckRun,\n CitationAnchor,\n CitationResult,\n HistoryRun,\n MarkerEnd,\n OriginKind,\n PageCitationReport,\n RemoveRun,\n UpdateRewrite,\n UpdateRun,\n} from \"../types.js\";\n\nexport interface PublicClaimEnd {\n lines?: string;\n fileLines?: string;\n status: string;\n newLines?: string;\n candidates?: string[];\n /** The baseline the claim was read against: the page's own history says it. */\n commitSha?: string;\n historyAvailable?: boolean;\n}\n\nexport interface PublicSourceEnd {\n src: string;\n /** The checkout the source is in, by its `cite.repos` name; present only for a repo entry. */\n repo?: string;\n status: string;\n newLines?: string;\n newSrc?: string;\n candidates?: string[];\n /** The entry's recorded `commit-sha`, as it is written. */\n commitSha?: string;\n /** The full hash the verdict was read against, when history found one (0097). */\n baselineSha?: string;\n historyAvailable?: boolean;\n truncatedSearch?: boolean;\n}\n\nexport interface PublicCitationResult {\n id?: string;\n origin: { kind: OriginKind; file: string; line?: number };\n anchor: CitationAnchor;\n /** The marker that names the entry: its line, and its misplacement when it has one. */\n marker?: MarkerEnd;\n claim: PublicClaimEnd | null;\n source: PublicSourceEnd;\n}\n\nexport function publicCitation(result: CitationResult): PublicCitationResult {\n const origin: PublicCitationResult[\"origin\"] = {\n kind: result.origin.kind,\n file: result.origin.file,\n };\n if (result.origin.line !== undefined) origin.line = result.origin.line;\n\n const source: PublicSourceEnd = {\n src: result.source.src,\n ...(result.source.repo === undefined ? {} : { repo: result.source.repo }),\n status: result.source.status,\n };\n if (result.source.newLines !== undefined) source.newLines = result.source.newLines;\n if (result.source.newSrc !== undefined) source.newSrc = result.source.newSrc;\n if (result.source.candidates !== undefined) source.candidates = result.source.candidates;\n if (result.source.commitSha !== undefined) source.commitSha = result.source.commitSha;\n if (result.source.baselineSha !== undefined) source.baselineSha = result.source.baselineSha;\n if (result.source.historyAvailable !== undefined) {\n source.historyAvailable = result.source.historyAvailable;\n }\n if (result.source.truncatedSearch !== undefined) {\n source.truncatedSearch = result.source.truncatedSearch;\n }\n\n let claim: PublicClaimEnd | null = null;\n if (result.claim !== null) {\n claim = { status: result.claim.status };\n if (result.claim.lines !== undefined) claim.lines = result.claim.lines;\n if (result.claim.fileLines !== undefined) claim.fileLines = result.claim.fileLines;\n if (result.claim.newLines !== undefined) claim.newLines = result.claim.newLines;\n if (result.claim.candidates !== undefined) claim.candidates = result.claim.candidates;\n if (result.claim.commitSha !== undefined) claim.commitSha = result.claim.commitSha;\n if (result.claim.historyAvailable !== undefined) {\n claim.historyAvailable = result.claim.historyAvailable;\n }\n }\n\n // Key order is the order the plan spells a citation in: what it is called,\n // where it is kept, what anchors it, then its two ends.\n return {\n ...(result.citation.id === undefined ? {} : { id: result.citation.id }),\n origin,\n anchor: result.anchor,\n ...(result.marker === undefined ? {} : { marker: result.marker }),\n claim,\n source,\n };\n}\n\nexport interface PublicPageReport extends Omit<PageCitationReport, \"citations\"> {\n citations: PublicCitationResult[];\n}\n\nexport function publicPage(page: PageCitationReport): PublicPageReport {\n return { ...page, citations: page.citations.map(publicCitation) };\n}\n\nexport function renderCheckJson(run: CheckRun): string {\n return JSON.stringify({ summary: run.summary, pages: run.pages.map(publicPage) }, null, 2);\n}\n\nexport function renderRemoveJson(run: RemoveRun): string {\n // The whole run, with nothing stripped: `RemoveRun` carries no\n // pretty-only field, as `UpdateRewrite.markerLine` is below. A field added\n // to it for the terminal alone is stripped here, as that one is.\n return JSON.stringify(run, null, 2);\n}\n\n/** `{ summary, pages }` for `history`: the run itself, which carries nothing pretty-only. */\nexport function renderHistoryJson(run: HistoryRun): string {\n return JSON.stringify(run, null, 2);\n}\n\nexport function renderUpdateJson(run: UpdateRun): string {\n // `markerLine` is the pretty report's line for a marker-anchored claim.\n // `at` is the claim's own first file line, which is what data says.\n const strip = (rows: readonly UpdateRewrite[]): Omit<UpdateRewrite, \"markerLine\">[] =>\n rows.map(({ markerLine: _pretty, ...rewrite }) => rewrite);\n const pages = run.pages.map((page) => ({\n ...page,\n rewritten: strip(page.rewritten),\n refused: strip(page.refused),\n }));\n return JSON.stringify({ ...run, pages }, null, 2);\n}\n"],"mappings":";;;AA4DO,SAAS,eAAe,QAA8C;AAC3E,QAAM,SAAyC;AAAA,IAC7C,MAAM,OAAO,OAAO;AAAA,IACpB,MAAM,OAAO,OAAO;AAAA,EACtB;AACA,MAAI,OAAO,OAAO,SAAS,OAAW,QAAO,OAAO,OAAO,OAAO;AAElE,QAAM,SAA0B;AAAA,IAC9B,KAAK,OAAO,OAAO;AAAA,IACnB,GAAI,OAAO,OAAO,SAAS,SAAY,CAAC,IAAI,EAAE,MAAM,OAAO,OAAO,KAAK;AAAA,IACvE,QAAQ,OAAO,OAAO;AAAA,EACxB;AACA,MAAI,OAA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AAE,GAAG,MAAM,WAAW,KAAK,UAAU,IAAI,cAAc,EAAE;AAClE;AAEO,SAAS,gBAAgB,KAAuB;AACrD,SAAO,KAAK,UAAU,EAAE,SAAS,IAAI,SAAS,OAAO,IAAI,MAAM,IAAI,UAAU,EAAE,GAAG,MAAM,CAAC;AAC3F;AAEO,SAAS,iBAAiB,KAAwB;AAIvD,SAAO,KAAK,UAAU,KAAK,MAAM,CAAC;AACpC;AAGO,SAAS,kBAAkB,KAAyB;AACzD,SAAO,KAAK,UAAU,KAAK,MAAM,CAAC;AACpC;AAEO,SAAS,iBAAiB,KAAwB;AAGvD,QAAM,QAAQ,CAAC,SACb,KAAK,IAAI,CAAC,EAAE,YAAY,SAAS,GAAG,QAAQ,MAAM,OAAO;AAC3D,QAAM,QAAQ,IAAI,MAAM,IAAI,CAAC,UAAU;AAAA,IACrC,GAAG;AAAA,IACH,WAAW,MAAM,KAAK,SAAS;AAAA,IAC/B,SAAS,MAAM,KAAK,OAAO;AAAA,EAC7B,EAAE;AACF,SAAO,KAAK,UAAU,EAAE,GAAG,KAAK,MAAM,GAAG,MAAM,CAAC;AAClD;","names":[]}
@@ -0,0 +1,459 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ ManifestSet,
4
+ appendFrontmatterCitation,
5
+ entryObject,
6
+ insertStatementBefore,
7
+ itemLine,
8
+ mintCitation,
9
+ removeFrontmatterCitations,
10
+ removeLine,
11
+ runAdd,
12
+ runHistory,
13
+ runRemove,
14
+ runUpdate,
15
+ shiftedEntries,
16
+ splice,
17
+ spliceEntryField,
18
+ unifiedDiff,
19
+ withClaimLines
20
+ } from "./chunk-V5QTIP2M.js";
21
+ import {
22
+ CITATIONS_KEY,
23
+ CITE_SECTION,
24
+ DEFAULT_CITE_BASELINE_PATH,
25
+ GIT_UNAVAILABLE_COMMIT,
26
+ GIT_UNAVAILABLE_HISTORY,
27
+ MAX_PAGE_COMMITS,
28
+ PAGE_HISTORY_UNAVAILABLE,
29
+ SOURCE_HISTORY_UNAVAILABLE,
30
+ buildSourceIndex,
31
+ checkCitations,
32
+ checkoutResolver,
33
+ claimDiff,
34
+ claimHistory,
35
+ claimWords,
36
+ classifyCitation,
37
+ decryptSourcePath,
38
+ duplicateJoinRefusal,
39
+ encryptSourcePath,
40
+ gitClient,
41
+ historyOf,
42
+ holdsWords,
43
+ loadCitationSidecars,
44
+ loadCiteConfig,
45
+ noGit,
46
+ orphanRefusal,
47
+ parseCiteConfig,
48
+ parseRepoFlags,
49
+ readCiteConfigFile,
50
+ readSource,
51
+ refineClaim,
52
+ resolveCiteRun,
53
+ runCheck,
54
+ runsHolding,
55
+ sentencesOf,
56
+ sharesSentence,
57
+ sidecarsFor,
58
+ sourceBaseline,
59
+ stripMarkers,
60
+ twoManifestsRefusal,
61
+ urlManifestRefusal
62
+ } from "./chunk-XTQTA262.js";
63
+ import {
64
+ renderCheckJson,
65
+ renderHistoryJson,
66
+ renderRemoveJson,
67
+ renderUpdateJson
68
+ } from "./chunk-GMOAW2EG.js";
69
+ import {
70
+ renderCheckGithub
71
+ } from "./chunk-327CWO33.js";
72
+ import {
73
+ refusalLine,
74
+ removalLine,
75
+ renderCheckPretty,
76
+ renderHistoryPretty,
77
+ renderRemovePretty,
78
+ renderUpdatePretty,
79
+ rewriteLine
80
+ } from "./chunk-5VA3ZOB7.js";
81
+ import {
82
+ blockMatches,
83
+ claimEnd,
84
+ claimLine,
85
+ claimMessageFor,
86
+ errorSite,
87
+ findingsFor,
88
+ markerClaimEnd,
89
+ markerUnit,
90
+ messageFor,
91
+ misplacedMarkerAt,
92
+ misplacedMarkers,
93
+ misplacedMessageFor,
94
+ movedUnit,
95
+ noUnitAt,
96
+ normalizeWhitespace,
97
+ pre43Span,
98
+ shortCommit,
99
+ shortLine,
100
+ shortPin,
101
+ shortSrc,
102
+ spellAt,
103
+ toValidationResult,
104
+ unitAt,
105
+ unitText
106
+ } from "./chunk-JHUEACRT.js";
107
+ import {
108
+ CITE_RULES,
109
+ CiteError,
110
+ DEFAULT_SEVERITY,
111
+ FILE_PATTERN,
112
+ MARKER_JSON,
113
+ MAX_MARKERS_PER_PAGE,
114
+ RULE_ID_PREFIX,
115
+ SRC_PATTERN,
116
+ citationInputs,
117
+ formatSrc,
118
+ formatStatement,
119
+ hashRange,
120
+ isCiteRule,
121
+ ownedMessage,
122
+ parseSrc,
123
+ pickExtractor,
124
+ rangeLines,
125
+ readPage,
126
+ resolveSeverity,
127
+ ruleId,
128
+ sliceLines,
129
+ sourceRange,
130
+ spellSource,
131
+ validateEntry
132
+ } from "./chunk-XKZZRG3Z.js";
133
+ import {
134
+ MAX_RANGE_LINES,
135
+ MOVE_BUDGET_BYTES,
136
+ MOVE_WINDOW_LINES,
137
+ anchoredLines,
138
+ bodyLineOf,
139
+ detectEol,
140
+ fenceSpanAt,
141
+ fencedBlockAfter,
142
+ fencedBlockAt,
143
+ fencedBlocks,
144
+ findWindows,
145
+ hashLines,
146
+ insideFence,
147
+ isBoundLine,
148
+ isKeyedPin,
149
+ isTableRow,
150
+ isUnitText,
151
+ lineAt,
152
+ lineSpec,
153
+ markerRunAt,
154
+ normalizeText,
155
+ offsetOfLine,
156
+ paragraphAfter,
157
+ parseLines,
158
+ parseStatements,
159
+ pinOfLines,
160
+ spellLines,
161
+ splitLines,
162
+ splitUnit,
163
+ statementForms,
164
+ toBodyLines,
165
+ toFileLines
166
+ } from "./chunk-MH5MX4B3.js";
167
+ import {
168
+ __export
169
+ } from "./chunk-2H7UOFLK.js";
170
+
171
+ // src/cite/index.ts
172
+ var cite_exports = {};
173
+ __export(cite_exports, {
174
+ CITATIONS_KEY: () => CITATIONS_KEY,
175
+ CITE_RULES: () => CITE_RULES,
176
+ CITE_SECTION: () => CITE_SECTION,
177
+ CiteError: () => CiteError,
178
+ DEFAULT_CITE_BASELINE_PATH: () => DEFAULT_CITE_BASELINE_PATH,
179
+ DEFAULT_SEVERITY: () => DEFAULT_SEVERITY,
180
+ FILE_PATTERN: () => FILE_PATTERN,
181
+ GIT_UNAVAILABLE_COMMIT: () => GIT_UNAVAILABLE_COMMIT,
182
+ GIT_UNAVAILABLE_HISTORY: () => GIT_UNAVAILABLE_HISTORY,
183
+ MARKER_JSON: () => MARKER_JSON,
184
+ MAX_MARKERS_PER_PAGE: () => MAX_MARKERS_PER_PAGE,
185
+ MAX_PAGE_COMMITS: () => MAX_PAGE_COMMITS,
186
+ MAX_RANGE_LINES: () => MAX_RANGE_LINES,
187
+ MOVE_BUDGET_BYTES: () => MOVE_BUDGET_BYTES,
188
+ MOVE_WINDOW_LINES: () => MOVE_WINDOW_LINES,
189
+ ManifestSet: () => ManifestSet,
190
+ PAGE_HISTORY_UNAVAILABLE: () => PAGE_HISTORY_UNAVAILABLE,
191
+ RULE_ID_PREFIX: () => RULE_ID_PREFIX,
192
+ SOURCE_HISTORY_UNAVAILABLE: () => SOURCE_HISTORY_UNAVAILABLE,
193
+ SRC_PATTERN: () => SRC_PATTERN,
194
+ anchoredLines: () => anchoredLines,
195
+ appendFrontmatterCitation: () => appendFrontmatterCitation,
196
+ blockMatches: () => blockMatches,
197
+ bodyLineOf: () => bodyLineOf,
198
+ buildSourceIndex: () => buildSourceIndex,
199
+ checkCitations: () => checkCitations,
200
+ checkoutResolver: () => checkoutResolver,
201
+ citationInputs: () => citationInputs,
202
+ claimDiff: () => claimDiff,
203
+ claimEnd: () => claimEnd,
204
+ claimHistory: () => claimHistory,
205
+ claimLine: () => claimLine,
206
+ claimMessageFor: () => claimMessageFor,
207
+ claimWords: () => claimWords,
208
+ classifyCitation: () => classifyCitation,
209
+ detectEol: () => detectEol,
210
+ duplicateJoinRefusal: () => duplicateJoinRefusal,
211
+ entryObject: () => entryObject,
212
+ errorSite: () => errorSite,
213
+ fenceSpanAt: () => fenceSpanAt,
214
+ fencedBlockAfter: () => fencedBlockAfter,
215
+ fencedBlockAt: () => fencedBlockAt,
216
+ fencedBlocks: () => fencedBlocks,
217
+ findWindows: () => findWindows,
218
+ findingsFor: () => findingsFor,
219
+ formatSrc: () => formatSrc,
220
+ formatStatement: () => formatStatement,
221
+ gitClient: () => gitClient,
222
+ hashLines: () => hashLines,
223
+ hashRange: () => hashRange,
224
+ historyOf: () => historyOf,
225
+ holdsWords: () => holdsWords,
226
+ insertStatementBefore: () => insertStatementBefore,
227
+ insideFence: () => insideFence,
228
+ isBoundLine: () => isBoundLine,
229
+ isCiteRule: () => isCiteRule,
230
+ isKeyedPin: () => isKeyedPin,
231
+ isTableRow: () => isTableRow,
232
+ isUnitText: () => isUnitText,
233
+ itemLine: () => itemLine,
234
+ lineAt: () => lineAt,
235
+ lineSpec: () => lineSpec,
236
+ loadCitationSidecars: () => loadCitationSidecars,
237
+ loadCiteConfig: () => loadCiteConfig,
238
+ markerClaimEnd: () => markerClaimEnd,
239
+ markerRunAt: () => markerRunAt,
240
+ markerUnit: () => markerUnit,
241
+ messageFor: () => messageFor,
242
+ mintCitation: () => mintCitation,
243
+ misplacedMarkerAt: () => misplacedMarkerAt,
244
+ misplacedMarkers: () => misplacedMarkers,
245
+ misplacedMessageFor: () => misplacedMessageFor,
246
+ movedUnit: () => movedUnit,
247
+ noGit: () => noGit,
248
+ noUnitAt: () => noUnitAt,
249
+ normalizeText: () => normalizeText,
250
+ normalizeWhitespace: () => normalizeWhitespace,
251
+ offsetOfLine: () => offsetOfLine,
252
+ orphanRefusal: () => orphanRefusal,
253
+ ownedMessage: () => ownedMessage,
254
+ paragraphAfter: () => paragraphAfter,
255
+ parseCiteConfig: () => parseCiteConfig,
256
+ parseLines: () => parseLines,
257
+ parseRepoFlags: () => parseRepoFlags,
258
+ parseSrc: () => parseSrc,
259
+ parseStatements: () => parseStatements,
260
+ pickExtractor: () => pickExtractor,
261
+ pinOfLines: () => pinOfLines,
262
+ pre43Span: () => pre43Span,
263
+ rangeLines: () => rangeLines,
264
+ readCiteConfigFile: () => readCiteConfigFile,
265
+ readPage: () => readPage,
266
+ readSource: () => readSource,
267
+ reencryptCitationEntries: () => reencryptCitationEntries,
268
+ reencryptCitations: () => reencryptCitations,
269
+ refineClaim: () => refineClaim,
270
+ refusalLine: () => refusalLine,
271
+ removalLine: () => removalLine,
272
+ removeFrontmatterCitations: () => removeFrontmatterCitations,
273
+ removeLine: () => removeLine,
274
+ renderCheckGithub: () => renderCheckGithub,
275
+ renderCheckJson: () => renderCheckJson,
276
+ renderCheckPretty: () => renderCheckPretty,
277
+ renderHistoryJson: () => renderHistoryJson,
278
+ renderHistoryPretty: () => renderHistoryPretty,
279
+ renderRemoveJson: () => renderRemoveJson,
280
+ renderRemovePretty: () => renderRemovePretty,
281
+ renderUpdateJson: () => renderUpdateJson,
282
+ renderUpdatePretty: () => renderUpdatePretty,
283
+ resolveCiteRun: () => resolveCiteRun,
284
+ resolveSeverity: () => resolveSeverity,
285
+ rewriteLine: () => rewriteLine,
286
+ ruleId: () => ruleId,
287
+ runAdd: () => runAdd,
288
+ runCheck: () => runCheck,
289
+ runHistory: () => runHistory,
290
+ runRemove: () => runRemove,
291
+ runUpdate: () => runUpdate,
292
+ runsHolding: () => runsHolding,
293
+ sentencesOf: () => sentencesOf,
294
+ sharesSentence: () => sharesSentence,
295
+ shiftedEntries: () => shiftedEntries,
296
+ shortCommit: () => shortCommit,
297
+ shortLine: () => shortLine,
298
+ shortPin: () => shortPin,
299
+ shortSrc: () => shortSrc,
300
+ sidecarsFor: () => sidecarsFor,
301
+ sliceLines: () => sliceLines,
302
+ sourceRange: () => sourceRange,
303
+ spellAt: () => spellAt,
304
+ spellLines: () => spellLines,
305
+ spellSource: () => spellSource,
306
+ splice: () => splice,
307
+ spliceEntryField: () => spliceEntryField,
308
+ splitLines: () => splitLines,
309
+ splitUnit: () => splitUnit,
310
+ statementForms: () => statementForms,
311
+ stripMarkers: () => stripMarkers,
312
+ toBodyLines: () => toBodyLines,
313
+ toFileLines: () => toFileLines,
314
+ toValidationResult: () => toValidationResult,
315
+ twoManifestsRefusal: () => twoManifestsRefusal,
316
+ unifiedDiff: () => unifiedDiff,
317
+ unitAt: () => unitAt,
318
+ unitText: () => unitText,
319
+ urlManifestRefusal: () => urlManifestRefusal,
320
+ validateEntry: () => validateEntry,
321
+ withClaimLines: () => withClaimLines
322
+ });
323
+
324
+ // src/cite/core/reencrypt.ts
325
+ var UNDECRYPTABLE = "does not decrypt under the current key";
326
+ var MISSING = "missing (no tracked file matches)";
327
+ var CHANGED = "changed; run `manni cite update --accept` before rotating";
328
+ var undeclared = (repo) => `missing (no repo named ${repo} is declared)`;
329
+ function whereOf(citation, origin) {
330
+ const where = { index: origin.index };
331
+ if (citation.id !== void 0) where.id = citation.id;
332
+ if (origin.line !== void 0) where.line = origin.line;
333
+ return where;
334
+ }
335
+ async function pinnedLines(ctx, citation, range, path, key) {
336
+ const source = await readSource(ctx.root, ctx.index, { ...range, path, encrypted: false });
337
+ if (source.kind === "missing") return { skip: MISSING };
338
+ const pin = citation.source.integrity;
339
+ let joined;
340
+ try {
341
+ joined = sliceLines(splitLines(source.text), range);
342
+ } catch {
343
+ joined = void 0;
344
+ }
345
+ if (joined !== void 0 && hashLines(joined, key) === pin) return { joined };
346
+ if (await ctx.git.available()) {
347
+ const recorded = citation.source["commit-sha"];
348
+ const { history } = await sourceBaseline(ctx.git, recorded, path, range, pin, key, void 0);
349
+ if (history.kind === "original") return { joined: history.lines.join("\n") };
350
+ }
351
+ return { skip: CHANGED };
352
+ }
353
+ async function verdictFor(ctx, citation, opts) {
354
+ const range = sourceRange(citation.source);
355
+ const underNew = decryptSourcePath(range.path, opts.toKey);
356
+ if (underNew !== void 0) {
357
+ const held = await pinnedLines(ctx, citation, range, underNew, opts.toKey);
358
+ if ("joined" in held) return { kind: "done" };
359
+ }
360
+ const path = underNew ?? decryptSourcePath(range.path, opts.fromKey);
361
+ if (path === void 0) return { kind: "skip", message: UNDECRYPTABLE };
362
+ const lines = await pinnedLines(ctx, citation, range, path, opts.fromKey);
363
+ if ("skip" in lines) return { kind: "skip", message: lines.skip };
364
+ const file = underNew === void 0 ? encryptSourcePath(path, opts.toKey) : range.path;
365
+ return {
366
+ kind: "write",
367
+ file,
368
+ integrity: hashLines(lines.joined, opts.toKey),
369
+ to: formatSrc({ ...range, path: file })
370
+ };
371
+ }
372
+ async function contextFor(opts) {
373
+ const git = opts.gitClient ?? gitClient(opts.root);
374
+ const index = opts.sourceIndex ?? await buildSourceIndex(opts.root, { gitClient: git });
375
+ return { root: opts.root, index, git };
376
+ }
377
+ function contextsFor(opts) {
378
+ if (opts.checkouts !== void 0) return opts.checkouts;
379
+ let root;
380
+ return (repo) => repo === void 0 ? root ??= contextFor(opts) : Promise.resolve(void 0);
381
+ }
382
+ async function verdictIn(contexts, citation, opts) {
383
+ const repo = citation.source.repo;
384
+ const ctx = await contexts(repo);
385
+ if (ctx === void 0) return { kind: "skip", message: undeclared(repo ?? "") };
386
+ return verdictFor(ctx, citation, opts);
387
+ }
388
+ async function reencryptCitations(page, opts) {
389
+ const read = readPage(page.file, page.content, page.format === void 0 ? void 0 : { format: page.format });
390
+ const result = { content: page.content, rewritten: [], skipped: [] };
391
+ const encrypted = read.citations.filter(({ citation }) => sourceRange(citation.source).encrypted);
392
+ if (encrypted.length === 0) return result;
393
+ const contexts = contextsFor(opts);
394
+ let after = page.content;
395
+ for (const { citation, origin } of encrypted) {
396
+ const range = sourceRange(citation.source);
397
+ const where = whereOf(citation, origin);
398
+ const verdict = await verdictIn(contexts, citation, opts);
399
+ if (verdict.kind === "done") continue;
400
+ if (verdict.kind === "skip") {
401
+ result.skipped.push({ ...where, message: verdict.message });
402
+ continue;
403
+ }
404
+ if (verdict.file !== range.path) {
405
+ after = spliceEntryField(after, read.format, origin.index, ["source", "file"], verdict.file);
406
+ }
407
+ after = spliceEntryField(
408
+ after,
409
+ read.format,
410
+ origin.index,
411
+ ["source", "integrity"],
412
+ verdict.integrity
413
+ );
414
+ result.rewritten.push({ ...where, from: spellSource(citation.source), to: verdict.to });
415
+ }
416
+ result.content = after;
417
+ return result;
418
+ }
419
+ async function reencryptCitationEntries(page, opts) {
420
+ const entries = JSON.parse(
421
+ JSON.stringify(page.citations.map((input) => input.entry))
422
+ );
423
+ const out = { entries, changed: false, rewritten: [], skipped: [] };
424
+ const read = readPage(page.file, page.content, {
425
+ ...page.format === void 0 ? {} : { format: page.format },
426
+ citations: page.citations
427
+ });
428
+ const encrypted = read.citations.filter(({ citation }) => sourceRange(citation.source).encrypted);
429
+ if (encrypted.length === 0) return out;
430
+ const contexts = contextsFor(opts);
431
+ for (const { citation, origin } of encrypted) {
432
+ const where = whereOf(citation, origin);
433
+ const verdict = await verdictIn(contexts, citation, opts);
434
+ if (verdict.kind === "done") continue;
435
+ if (verdict.kind === "skip") {
436
+ out.skipped.push({ ...where, message: verdict.message });
437
+ continue;
438
+ }
439
+ const entry = entries[origin.index];
440
+ const source = typeof entry === "object" && entry !== null && !Array.isArray(entry) ? entry.source : void 0;
441
+ if (typeof source !== "object" || source === null || Array.isArray(source)) {
442
+ out.skipped.push({ ...where, message: UNDECRYPTABLE });
443
+ continue;
444
+ }
445
+ const fields = source;
446
+ fields.file = verdict.file;
447
+ fields.integrity = verdict.integrity;
448
+ out.changed = true;
449
+ out.rewritten.push({ ...where, from: spellSource(citation.source), to: verdict.to });
450
+ }
451
+ return out;
452
+ }
453
+
454
+ export {
455
+ reencryptCitations,
456
+ reencryptCitationEntries,
457
+ cite_exports
458
+ };
459
+ //# sourceMappingURL=chunk-GNZKLUZW.js.map