@hawkeyexl/manni 4.13.0 → 4.15.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 (293) hide show
  1. package/README.md +1 -1
  2. package/dist/batch-OMDKRGUE.js +48 -0
  3. package/dist/build-YCY5MUHA.js +37 -0
  4. package/dist/calibrate-RN2NJ4FS.js +43 -0
  5. package/dist/capture-2WYROZKA.js +39 -0
  6. package/dist/check-KRVWHF7E.js +33 -0
  7. package/dist/{check-NBN2YK2J.js → check-LVUTWAGR.js} +33 -32
  8. package/dist/{check-NBN2YK2J.js.map → check-LVUTWAGR.js.map} +1 -1
  9. package/dist/check-MR7IG7IP.js +36 -0
  10. package/dist/{check-LU5YC3L4.js → check-OIRJ6OBW.js} +15 -14
  11. package/dist/{chunk-J5NOWIJ3.js → chunk-3CSEHHKB.js} +14 -8
  12. package/dist/{chunk-J5NOWIJ3.js.map → chunk-3CSEHHKB.js.map} +1 -1
  13. package/dist/{chunk-7RNONVHI.js → chunk-3EJVJDMX.js} +9 -9
  14. package/dist/{chunk-LSFXNAHU.js → chunk-3WQMMLIO.js} +129 -59
  15. package/dist/chunk-3WQMMLIO.js.map +1 -0
  16. package/dist/{chunk-OREHJQNN.js → chunk-46OWIAAX.js} +5 -4
  17. package/dist/{chunk-OREHJQNN.js.map → chunk-46OWIAAX.js.map} +1 -1
  18. package/dist/{chunk-LNGSE7V2.js → chunk-476DMDJ5.js} +132 -27
  19. package/dist/chunk-476DMDJ5.js.map +1 -0
  20. package/dist/{chunk-EQ7E6HMG.js → chunk-4MYW2D2U.js} +14 -16
  21. package/dist/chunk-4MYW2D2U.js.map +1 -0
  22. package/dist/{chunk-NTEYYYKL.js → chunk-525KMBZS.js} +16 -22
  23. package/dist/chunk-525KMBZS.js.map +1 -0
  24. package/dist/{chunk-HIEGOW7X.js → chunk-57DHX65T.js} +5 -79
  25. package/dist/chunk-57DHX65T.js.map +1 -0
  26. package/dist/{chunk-PCE7QHXJ.js → chunk-5D24C6WM.js} +6 -1
  27. package/dist/chunk-5D24C6WM.js.map +1 -0
  28. package/dist/{chunk-DQOM3DEU.js → chunk-6DYFWAZA.js} +563 -359
  29. package/dist/chunk-6DYFWAZA.js.map +1 -0
  30. package/dist/{chunk-CU57HT2E.js → chunk-6WJUZQQX.js} +2 -2
  31. package/dist/chunk-7EKXSSEO.js +81 -0
  32. package/dist/chunk-7EKXSSEO.js.map +1 -0
  33. package/dist/{chunk-ULDV2LUI.js → chunk-7SVFBJBE.js} +10 -4
  34. package/dist/chunk-7SVFBJBE.js.map +1 -0
  35. package/dist/{chunk-QKT67PFE.js → chunk-7XHW5DZA.js} +9 -9
  36. package/dist/{chunk-TDCOKKMI.js → chunk-AL4HRKSZ.js} +3 -3
  37. package/dist/{chunk-OTJOBZJ5.js → chunk-B2242FYO.js} +2 -1
  38. package/dist/chunk-B2242FYO.js.map +1 -0
  39. package/dist/chunk-BREAC43H.js +85 -0
  40. package/dist/chunk-BREAC43H.js.map +1 -0
  41. package/dist/{chunk-HKTGHLBA.js → chunk-C37OVJ35.js} +2 -2
  42. package/dist/{chunk-HKTGHLBA.js.map → chunk-C37OVJ35.js.map} +1 -1
  43. package/dist/{chunk-YQV75FIL.js → chunk-CFMI74TP.js} +3 -3
  44. package/dist/{chunk-BMBAAPGN.js → chunk-CWGBRWP7.js} +33 -18
  45. package/dist/chunk-CWGBRWP7.js.map +1 -0
  46. package/dist/chunk-DN4LCWSA.js +83 -0
  47. package/dist/chunk-DN4LCWSA.js.map +1 -0
  48. package/dist/{chunk-JEUFYSFQ.js → chunk-DW22KCLN.js} +118 -75
  49. package/dist/chunk-DW22KCLN.js.map +1 -0
  50. package/dist/{chunk-PCGBXHSE.js → chunk-FEEO7ET6.js} +5 -5
  51. package/dist/{chunk-CODWRUAD.js → chunk-FYWQS35G.js} +7 -5
  52. package/dist/chunk-FYWQS35G.js.map +1 -0
  53. package/dist/{chunk-3O6U4ICM.js → chunk-GLQCSDFS.js} +3 -3
  54. package/dist/{chunk-BQXY76JB.js → chunk-GUTAKJIF.js} +148 -92
  55. package/dist/chunk-GUTAKJIF.js.map +1 -0
  56. package/dist/{chunk-WVXCN5DS.js → chunk-GZHBMMDC.js} +78 -14
  57. package/dist/chunk-GZHBMMDC.js.map +1 -0
  58. package/dist/{chunk-52WO7ESI.js → chunk-IE5PXI6M.js} +6 -5
  59. package/dist/chunk-IE5PXI6M.js.map +1 -0
  60. package/dist/{chunk-ZXRAE55H.js → chunk-IGRXQC3H.js} +2 -2
  61. package/dist/{chunk-U6IHLEWT.js → chunk-JCTHXG33.js} +2 -2
  62. package/dist/{chunk-NSAW7U42.js → chunk-JHE3CYWS.js} +58 -10
  63. package/dist/chunk-JHE3CYWS.js.map +1 -0
  64. package/dist/{chunk-6ZFJWUUH.js → chunk-JNMY7KZG.js} +2 -2
  65. package/dist/chunk-JQPZKWIP.js +76 -0
  66. package/dist/chunk-JQPZKWIP.js.map +1 -0
  67. package/dist/{chunk-OBXCJZ6R.js → chunk-JTATFPWB.js} +28 -17
  68. package/dist/chunk-JTATFPWB.js.map +1 -0
  69. package/dist/{chunk-3HUCB4Z3.js → chunk-JULE3EU3.js} +10 -7
  70. package/dist/chunk-JULE3EU3.js.map +1 -0
  71. package/dist/{chunk-TQ3W6RKG.js → chunk-KCXQXKOL.js} +3 -3
  72. package/dist/{chunk-VYBYUQIP.js → chunk-KN37BXVY.js} +88 -7
  73. package/dist/chunk-KN37BXVY.js.map +1 -0
  74. package/dist/{chunk-OUAH7XF2.js → chunk-MAOX3524.js} +2 -2
  75. package/dist/chunk-MC7U5IH4.js +126 -0
  76. package/dist/chunk-MC7U5IH4.js.map +1 -0
  77. package/dist/{chunk-OYIWF3B2.js → chunk-NIQ2JSZO.js} +29 -20
  78. package/dist/chunk-NIQ2JSZO.js.map +1 -0
  79. package/dist/{chunk-HY6ROJTH.js → chunk-OFOIBV5J.js} +86 -10
  80. package/dist/chunk-OFOIBV5J.js.map +1 -0
  81. package/dist/{chunk-TZOYZK2E.js → chunk-OZUPJB4J.js} +2 -2
  82. package/dist/{chunk-N6A6DJUO.js → chunk-Q2VOXKAQ.js} +6 -7
  83. package/dist/chunk-Q2VOXKAQ.js.map +1 -0
  84. package/dist/{chunk-GWI6JPTT.js → chunk-Q62Q7CDI.js} +88 -8
  85. package/dist/chunk-Q62Q7CDI.js.map +1 -0
  86. package/dist/{chunk-PA7CMQGD.js → chunk-QDO5JFFV.js} +11 -5
  87. package/dist/chunk-QDO5JFFV.js.map +1 -0
  88. package/dist/{chunk-VNYXK7TM.js → chunk-QEJ4GH25.js} +8 -8
  89. package/dist/chunk-QEJ4GH25.js.map +1 -0
  90. package/dist/chunk-QK6VYJHV.js +26 -0
  91. package/dist/chunk-QK6VYJHV.js.map +1 -0
  92. package/dist/chunk-QS2Z3SWL.js +21 -0
  93. package/dist/chunk-QS2Z3SWL.js.map +1 -0
  94. package/dist/{chunk-NWUXRV6N.js → chunk-QS3K57OJ.js} +10 -8
  95. package/dist/chunk-QS3K57OJ.js.map +1 -0
  96. package/dist/{chunk-OKMTUAWO.js → chunk-QSPH4F56.js} +5 -5
  97. package/dist/{chunk-3XGTNN3M.js → chunk-RGRNAQG5.js} +12 -124
  98. package/dist/chunk-RGRNAQG5.js.map +1 -0
  99. package/dist/{chunk-E6BVUDGY.js → chunk-SLGCRXHM.js} +4 -4
  100. package/dist/{chunk-KE2F7QES.js → chunk-SVF3WCC7.js} +6 -6
  101. package/dist/{chunk-IGQMBHFY.js → chunk-T62SFCQY.js} +88 -12
  102. package/dist/chunk-T62SFCQY.js.map +1 -0
  103. package/dist/{chunk-SCLXVTFZ.js → chunk-TKINOTVS.js} +1 -1
  104. package/dist/chunk-TKINOTVS.js.map +1 -0
  105. package/dist/{chunk-VOXOBUTX.js → chunk-TXZJESES.js} +5 -5
  106. package/dist/chunk-UPUJJOKB.js +236 -0
  107. package/dist/chunk-UPUJJOKB.js.map +1 -0
  108. package/dist/{chunk-7JPL3CUC.js → chunk-URGALOZY.js} +2 -2
  109. package/dist/{chunk-X4MPUD4B.js → chunk-UVLQRP6O.js} +53 -13
  110. package/dist/chunk-UVLQRP6O.js.map +1 -0
  111. package/dist/{chunk-CWXZ2MRT.js → chunk-VHJ72YCD.js} +4 -3
  112. package/dist/chunk-VHJ72YCD.js.map +1 -0
  113. package/dist/{chunk-PAU352SV.js → chunk-W4GTMOJW.js} +2 -2
  114. package/dist/{chunk-SE4JN5XN.js → chunk-WDENIUC7.js} +3 -1
  115. package/dist/chunk-WDENIUC7.js.map +1 -0
  116. package/dist/{chunk-3BVDFQ6Y.js → chunk-Y3GWQBJP.js} +5 -5
  117. package/dist/{chunk-YZ4TJLZQ.js → chunk-YT5HKJWV.js} +497 -18
  118. package/dist/chunk-YT5HKJWV.js.map +1 -0
  119. package/dist/{chunk-UQMLCIRX.js → chunk-Z6PZKXSP.js} +6 -6
  120. package/dist/{chunk-JUL2PRQN.js → chunk-ZC2MZZR5.js} +207 -79
  121. package/dist/chunk-ZC2MZZR5.js.map +1 -0
  122. package/dist/{chunk-UKZNLVJW.js → chunk-ZINZTHWO.js} +4 -2
  123. package/dist/chunk-ZINZTHWO.js.map +1 -0
  124. package/dist/{cli-4JHQCPHU.js → cli-33E3B2FK.js} +3 -3
  125. package/dist/{cli-G66X7YMP.js → cli-7JV4RM66.js} +23 -22
  126. package/dist/{cli-G66X7YMP.js.map → cli-7JV4RM66.js.map} +1 -1
  127. package/dist/{cli-L5B2RVV2.js → cli-B4DTJ2KC.js} +31 -29
  128. package/dist/{cli-L5B2RVV2.js.map → cli-B4DTJ2KC.js.map} +1 -1
  129. package/dist/{cli-ECVT4YXR.js → cli-D4WXCDTS.js} +20 -19
  130. package/dist/{cli-ECVT4YXR.js.map → cli-D4WXCDTS.js.map} +1 -1
  131. package/dist/{cli-7DETHSNW.js → cli-DDLLZHZW.js} +90 -84
  132. package/dist/cli-DDLLZHZW.js.map +1 -0
  133. package/dist/{cli-KYTCJYXK.js → cli-EVACAD7K.js} +317 -28
  134. package/dist/cli-EVACAD7K.js.map +1 -0
  135. package/dist/{cli-H5LVGOVT.js → cli-LIKI7WPR.js} +384 -248
  136. package/dist/cli-LIKI7WPR.js.map +1 -0
  137. package/dist/{cli-AZKWTCFV.js → cli-MWUFAS2X.js} +11 -11
  138. package/dist/{cli-DGFLJ2DD.js → cli-OKPRTVG6.js} +69 -26
  139. package/dist/cli-OKPRTVG6.js.map +1 -0
  140. package/dist/{cli-RP5E7XHC.js → cli-QEPVGLQ3.js} +20 -18
  141. package/dist/{cli-RP5E7XHC.js.map → cli-QEPVGLQ3.js.map} +1 -1
  142. package/dist/{cli-BW5VOFOZ.js → cli-VP6JTPFS.js} +11 -10
  143. package/dist/{cli-BW5VOFOZ.js.map → cli-VP6JTPFS.js.map} +1 -1
  144. package/dist/cli.js +14 -14
  145. package/dist/{config-JJW75SBX.js → config-7I5CHHRZ.js} +6 -6
  146. package/dist/docmeta.js +10 -10
  147. package/dist/github-DV57TW5L.js +32 -0
  148. package/dist/github-SGX2EARO.js +36 -0
  149. package/dist/graph/runtime.js.map +1 -1
  150. package/dist/index.d.ts +222 -45
  151. package/dist/index.js +138 -132
  152. package/dist/index.js.map +1 -1
  153. package/dist/{json-7WV7KL6H.js → json-5EQCGVCV.js} +4 -2
  154. package/dist/{json-LCVPMEAM.js → json-SHPUCD64.js} +15 -13
  155. package/dist/{labels-OQXBVM4A.js → labels-3GCGYYV3.js} +14 -12
  156. package/dist/{labels-OQXBVM4A.js.map → labels-3GCGYYV3.js.map} +1 -1
  157. package/dist/lint-RE4DMI6E.js +35 -0
  158. package/dist/list-F56MEJXR.js +36 -0
  159. package/dist/list-ZR3KY556.js +34 -0
  160. package/dist/{page-XPX5XJZE.js → page-G7XSO4FD.js} +13 -12
  161. package/dist/{picker-3XF36MJF.js → picker-FPUC5UGM.js} +3 -3
  162. package/dist/{prepare-VMBIQYAM.js → prepare-WHMWP7BG.js} +21 -20
  163. package/dist/{prepare-VMBIQYAM.js.map → prepare-WHMWP7BG.js.map} +1 -1
  164. package/dist/{pretty-KSTZMBUF.js → pretty-VTJVXWRK.js} +15 -13
  165. package/dist/{pretty-KG6TMOEI.js → pretty-YVRRWBWN.js} +23 -16
  166. package/dist/{provider-LBX4IXGX.js → provider-JY2I3VLF.js} +3 -3
  167. package/dist/{release-VV3UTKE5.js → release-Z3ASYZ3S.js} +3 -3
  168. package/dist/{reporters-26H3N2KW.js → reporters-FSXJ42EB.js} +6 -5
  169. package/dist/{reporters-AQU4W3KY.js → reporters-G5R4SURQ.js} +6 -6
  170. package/dist/{reporters-FBYLPKD4.js → reporters-MHPY4HRA.js} +15 -14
  171. package/dist/run-FSYOYEPR.js +39 -0
  172. package/dist/sarif-HBQIDY7T.js +31 -0
  173. package/dist/sarif-RRUFJZUL.js +37 -0
  174. package/dist/{term-SI3VM6EM.js → term-ABHGACYE.js} +58 -109
  175. package/dist/term-ABHGACYE.js.map +1 -0
  176. package/dist/types-VMOT7RAL.js +12 -0
  177. package/dist/types-VMOT7RAL.js.map +1 -0
  178. package/dist/{validate-NQO7TFSN.js → validate-DXYUUGUD.js} +6 -6
  179. package/dist/validate-DXYUUGUD.js.map +1 -0
  180. package/package.json +1 -1
  181. package/plugin/manni/.claude-plugin/plugin.json +1 -1
  182. package/plugin/manni/skills/check/SKILL.md +2 -2
  183. package/plugin/manni/skills/evals/SKILL.md +1 -1
  184. package/plugin/manni/skills/fix/SKILL.md +95 -16
  185. package/plugin/manni/skills/setup/SKILL.md +1 -1
  186. package/shapes/graph/shapes-1.1.1.ttl +953 -0
  187. package/dist/batch-OB2FXT47.js +0 -46
  188. package/dist/build-4BL24BG3.js +0 -36
  189. package/dist/calibrate-AEDJ7N7G.js +0 -41
  190. package/dist/capture-TP3P4YNL.js +0 -38
  191. package/dist/check-5IYH42KS.js +0 -34
  192. package/dist/check-S55MH66H.js +0 -30
  193. package/dist/chunk-3HUCB4Z3.js.map +0 -1
  194. package/dist/chunk-3XGTNN3M.js.map +0 -1
  195. package/dist/chunk-52WO7ESI.js.map +0 -1
  196. package/dist/chunk-BMBAAPGN.js.map +0 -1
  197. package/dist/chunk-BQXY76JB.js.map +0 -1
  198. package/dist/chunk-CODWRUAD.js.map +0 -1
  199. package/dist/chunk-CWXZ2MRT.js.map +0 -1
  200. package/dist/chunk-DQOM3DEU.js.map +0 -1
  201. package/dist/chunk-EQ7E6HMG.js.map +0 -1
  202. package/dist/chunk-GWI6JPTT.js.map +0 -1
  203. package/dist/chunk-HIEGOW7X.js.map +0 -1
  204. package/dist/chunk-HY6ROJTH.js.map +0 -1
  205. package/dist/chunk-IGQMBHFY.js.map +0 -1
  206. package/dist/chunk-JEUFYSFQ.js.map +0 -1
  207. package/dist/chunk-JUL2PRQN.js.map +0 -1
  208. package/dist/chunk-LNGSE7V2.js.map +0 -1
  209. package/dist/chunk-LSFXNAHU.js.map +0 -1
  210. package/dist/chunk-MNH7QO4Z.js +0 -15
  211. package/dist/chunk-MNH7QO4Z.js.map +0 -1
  212. package/dist/chunk-N6A6DJUO.js.map +0 -1
  213. package/dist/chunk-NSAW7U42.js.map +0 -1
  214. package/dist/chunk-NTEYYYKL.js.map +0 -1
  215. package/dist/chunk-NWUXRV6N.js.map +0 -1
  216. package/dist/chunk-OBXCJZ6R.js.map +0 -1
  217. package/dist/chunk-OTJOBZJ5.js.map +0 -1
  218. package/dist/chunk-OYIWF3B2.js.map +0 -1
  219. package/dist/chunk-PA7CMQGD.js.map +0 -1
  220. package/dist/chunk-PCE7QHXJ.js.map +0 -1
  221. package/dist/chunk-SCLXVTFZ.js.map +0 -1
  222. package/dist/chunk-SE4JN5XN.js.map +0 -1
  223. package/dist/chunk-UKZNLVJW.js.map +0 -1
  224. package/dist/chunk-ULDV2LUI.js.map +0 -1
  225. package/dist/chunk-VNYXK7TM.js.map +0 -1
  226. package/dist/chunk-VYBYUQIP.js.map +0 -1
  227. package/dist/chunk-WVXCN5DS.js.map +0 -1
  228. package/dist/chunk-X4MPUD4B.js.map +0 -1
  229. package/dist/chunk-Y6M4JFKG.js +0 -117
  230. package/dist/chunk-Y6M4JFKG.js.map +0 -1
  231. package/dist/chunk-YZ4TJLZQ.js.map +0 -1
  232. package/dist/cli-7DETHSNW.js.map +0 -1
  233. package/dist/cli-DGFLJ2DD.js.map +0 -1
  234. package/dist/cli-H5LVGOVT.js.map +0 -1
  235. package/dist/cli-KYTCJYXK.js.map +0 -1
  236. package/dist/github-DJQ4MWNZ.js +0 -35
  237. package/dist/github-UWTDM2J2.js +0 -30
  238. package/dist/lint-O7XRHKFP.js +0 -34
  239. package/dist/list-OOOCLOAL.js +0 -35
  240. package/dist/list-OYQ5XPN2.js +0 -32
  241. package/dist/run-KUGTU3TT.js +0 -37
  242. package/dist/term-SI3VM6EM.js.map +0 -1
  243. package/dist/types-Y6TXHM7M.js +0 -10
  244. /package/dist/{batch-OB2FXT47.js.map → batch-OMDKRGUE.js.map} +0 -0
  245. /package/dist/{build-4BL24BG3.js.map → build-YCY5MUHA.js.map} +0 -0
  246. /package/dist/{calibrate-AEDJ7N7G.js.map → calibrate-RN2NJ4FS.js.map} +0 -0
  247. /package/dist/{capture-TP3P4YNL.js.map → capture-2WYROZKA.js.map} +0 -0
  248. /package/dist/{check-5IYH42KS.js.map → check-KRVWHF7E.js.map} +0 -0
  249. /package/dist/{check-LU5YC3L4.js.map → check-MR7IG7IP.js.map} +0 -0
  250. /package/dist/{check-S55MH66H.js.map → check-OIRJ6OBW.js.map} +0 -0
  251. /package/dist/{chunk-7RNONVHI.js.map → chunk-3EJVJDMX.js.map} +0 -0
  252. /package/dist/{chunk-CU57HT2E.js.map → chunk-6WJUZQQX.js.map} +0 -0
  253. /package/dist/{chunk-QKT67PFE.js.map → chunk-7XHW5DZA.js.map} +0 -0
  254. /package/dist/{chunk-TDCOKKMI.js.map → chunk-AL4HRKSZ.js.map} +0 -0
  255. /package/dist/{chunk-YQV75FIL.js.map → chunk-CFMI74TP.js.map} +0 -0
  256. /package/dist/{chunk-PCGBXHSE.js.map → chunk-FEEO7ET6.js.map} +0 -0
  257. /package/dist/{chunk-3O6U4ICM.js.map → chunk-GLQCSDFS.js.map} +0 -0
  258. /package/dist/{chunk-ZXRAE55H.js.map → chunk-IGRXQC3H.js.map} +0 -0
  259. /package/dist/{chunk-U6IHLEWT.js.map → chunk-JCTHXG33.js.map} +0 -0
  260. /package/dist/{chunk-6ZFJWUUH.js.map → chunk-JNMY7KZG.js.map} +0 -0
  261. /package/dist/{chunk-TQ3W6RKG.js.map → chunk-KCXQXKOL.js.map} +0 -0
  262. /package/dist/{chunk-OUAH7XF2.js.map → chunk-MAOX3524.js.map} +0 -0
  263. /package/dist/{chunk-TZOYZK2E.js.map → chunk-OZUPJB4J.js.map} +0 -0
  264. /package/dist/{chunk-OKMTUAWO.js.map → chunk-QSPH4F56.js.map} +0 -0
  265. /package/dist/{chunk-E6BVUDGY.js.map → chunk-SLGCRXHM.js.map} +0 -0
  266. /package/dist/{chunk-KE2F7QES.js.map → chunk-SVF3WCC7.js.map} +0 -0
  267. /package/dist/{chunk-VOXOBUTX.js.map → chunk-TXZJESES.js.map} +0 -0
  268. /package/dist/{chunk-7JPL3CUC.js.map → chunk-URGALOZY.js.map} +0 -0
  269. /package/dist/{chunk-PAU352SV.js.map → chunk-W4GTMOJW.js.map} +0 -0
  270. /package/dist/{chunk-3BVDFQ6Y.js.map → chunk-Y3GWQBJP.js.map} +0 -0
  271. /package/dist/{chunk-UQMLCIRX.js.map → chunk-Z6PZKXSP.js.map} +0 -0
  272. /package/dist/{cli-4JHQCPHU.js.map → cli-33E3B2FK.js.map} +0 -0
  273. /package/dist/{cli-AZKWTCFV.js.map → cli-MWUFAS2X.js.map} +0 -0
  274. /package/dist/{config-JJW75SBX.js.map → config-7I5CHHRZ.js.map} +0 -0
  275. /package/dist/{github-DJQ4MWNZ.js.map → github-DV57TW5L.js.map} +0 -0
  276. /package/dist/{github-UWTDM2J2.js.map → github-SGX2EARO.js.map} +0 -0
  277. /package/dist/{json-7WV7KL6H.js.map → json-5EQCGVCV.js.map} +0 -0
  278. /package/dist/{json-LCVPMEAM.js.map → json-SHPUCD64.js.map} +0 -0
  279. /package/dist/{lint-O7XRHKFP.js.map → lint-RE4DMI6E.js.map} +0 -0
  280. /package/dist/{list-OOOCLOAL.js.map → list-F56MEJXR.js.map} +0 -0
  281. /package/dist/{list-OYQ5XPN2.js.map → list-ZR3KY556.js.map} +0 -0
  282. /package/dist/{page-XPX5XJZE.js.map → page-G7XSO4FD.js.map} +0 -0
  283. /package/dist/{picker-3XF36MJF.js.map → picker-FPUC5UGM.js.map} +0 -0
  284. /package/dist/{pretty-KG6TMOEI.js.map → pretty-VTJVXWRK.js.map} +0 -0
  285. /package/dist/{pretty-KSTZMBUF.js.map → pretty-YVRRWBWN.js.map} +0 -0
  286. /package/dist/{provider-LBX4IXGX.js.map → provider-JY2I3VLF.js.map} +0 -0
  287. /package/dist/{release-VV3UTKE5.js.map → release-Z3ASYZ3S.js.map} +0 -0
  288. /package/dist/{reporters-26H3N2KW.js.map → reporters-FSXJ42EB.js.map} +0 -0
  289. /package/dist/{reporters-AQU4W3KY.js.map → reporters-G5R4SURQ.js.map} +0 -0
  290. /package/dist/{reporters-FBYLPKD4.js.map → reporters-MHPY4HRA.js.map} +0 -0
  291. /package/dist/{run-KUGTU3TT.js.map → run-FSYOYEPR.js.map} +0 -0
  292. /package/dist/{types-Y6TXHM7M.js.map → sarif-HBQIDY7T.js.map} +0 -0
  293. /package/dist/{validate-NQO7TFSN.js.map → sarif-RRUFJZUL.js.map} +0 -0
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/shared/github.ts
4
- function escapeWorkflowCommandMessage(message) {
5
- return message.replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A");
6
- }
7
- function escapeWorkflowCommandProperty(value) {
8
- return value.replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/:/g, "%3A").replace(/,/g, "%2C");
9
- }
10
-
11
- export {
12
- escapeWorkflowCommandMessage,
13
- escapeWorkflowCommandProperty
14
- };
15
- //# sourceMappingURL=chunk-MNH7QO4Z.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/shared/github.ts"],"sourcesContent":["/**\n * GitHub Actions workflow-command primitives, shared by every renderer in\n * every tool that emits `::error ...::<message>`.\n *\n * Its own module rather than a local function so a second renderer cannot\n * re-derive the rule and get the ordering wrong — the ordering is the part that\n * is easy to miss. Under `src/shared/` because the a11y reporter needs the\n * same two functions, and one tool must not reach into another's internals.\n */\n\n/**\n * Escape a workflow command's **message**.\n *\n * `::error ...::<message>` is a line-oriented protocol: a literal newline ends\n * the command, so an unescaped multi-line message truncates the annotation and\n * spills the rest into the log as plain text. `%` is the escape introducer, so\n * an unescaped one corrupts the message the runner decodes. Ajv quotes a\n * schema's `pattern` regex verbatim, which is where a stray `%` comes from in\n * practice.\n *\n * `%` **must** be replaced first. Doing the newlines first would turn a literal\n * LF into `%0A` and then the `%` pass would rewrite that to `%250A`, so the\n * annotation would display the escape sequence as text instead of a line break.\n *\n * Only these three. GitHub also treats `,` and `:` specially, but in the\n * command's *property* values (`file=`, `line=`), not in the message — encoding\n * them here would show up as `%3A` in the rendered annotation. That is what\n * {@link escapeWorkflowCommandProperty} is for.\n *\n * @see https://docs.github.com/actions/reference/workflow-commands-for-github-actions\n */\nexport function escapeWorkflowCommandMessage(message: string): string {\n return message\n .replace(/%/g, \"%25\")\n .replace(/\\r/g, \"%0D\")\n .replace(/\\n/g, \"%0A\");\n}\n\n/**\n * Escape a workflow command's **property value** — the right-hand side of\n * `file=`, `line=`, `col=`.\n *\n * Everything the message needs, plus `,` and `:`. Properties are comma-\n * separated and each is `name:value`-adjacent in the grammar, so an unescaped\n * separator inside a value silently re-partitions the command: a real path like\n * `docs/report,final.md` yields `file=docs/report` and a stray property named\n * `final.md`, and the annotation lands on the wrong file — or nowhere — with no\n * error anywhere.\n *\n * `%` first, for the same reason as the message escaper.\n */\nexport function escapeWorkflowCommandProperty(value: string): string {\n return value\n .replace(/%/g, \"%25\")\n .replace(/\\r/g, \"%0D\")\n .replace(/\\n/g, \"%0A\")\n .replace(/:/g, \"%3A\")\n .replace(/,/g, \"%2C\");\n}\n"],"mappings":";;;AA+BO,SAAS,6BAA6B,SAAyB;AACpE,SAAO,QACJ,QAAQ,MAAM,KAAK,EACnB,QAAQ,OAAO,KAAK,EACpB,QAAQ,OAAO,KAAK;AACzB;AAeO,SAAS,8BAA8B,OAAuB;AACnE,SAAO,MACJ,QAAQ,MAAM,KAAK,EACnB,QAAQ,OAAO,KAAK,EACpB,QAAQ,OAAO,KAAK,EACpB,QAAQ,MAAM,KAAK,EACnB,QAAQ,MAAM,KAAK;AACxB;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/graph/commands/build.ts","../src/graph/core/analyze-cache.ts","../src/graph/core/concepts.ts","../src/graph/core/derive.ts","../src/graph/core/emit.ts","../src/graph/core/harvest.ts","../src/graph/core/git.ts","../src/graph/core/graph-output.ts"],"sourcesContent":["/**\n * `manni graph build` — derive the knowledge graph from discovered docs and write\n * deterministic Turtle. Running twice over unchanged inputs produces\n * byte-identical output.\n */\nimport { mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport { GraphError } from \"../types.js\";\nimport { analyzeDoc } from \"../core/analyze.js\";\nimport { ANALYZE_CACHE_DIR, AnalyzeCache } from \"../core/analyze-cache.js\";\nimport { loadRunConfig } from \"../core/config.js\";\nimport { deriveGraph, termConceptCount } from \"../core/derive.js\";\nimport {\n assertInputFormat,\n documentBase,\n documentSetPatterns,\n resolveDocumentSet,\n routesFrom,\n STDIN,\n type DocumentInputOptions,\n} from \"../core/discover.js\";\nimport { STDIN_PATH } from \"../core/iri.js\";\nimport { emitTurtle } from \"../core/emit.js\";\nimport { harvestWarnings } from \"../core/harvest.js\";\nimport { collectGitHistory } from \"../core/git.js\";\nimport { suppressGraphOutput } from \"../core/graph-output.js\";\nimport { openMetaView, withExternalMetadata } from \"../core/external.js\";\nimport { errorMessage } from \"../../shared/errors.js\";\nimport { termLabelSource, type TermLabel } from \"../../shared/term-labels.js\";\nimport { NS, RDF_TYPE } from \"../core/vocab.js\";\nimport pkg from \"../../../package.json\" with { type: \"json\" };\n\nexport interface BuildOptions extends DocumentInputOptions {\n /** Output path override (default: config `out`). */\n out?: string;\n cwd?: string;\n /**\n * What `-` reads: the document from stdin, read by the caller. Required\n * when `paths` holds `-`. Its display path is `<stdin>`, its node is\n * `{baseIri}stdin`, and its links resolve from `cwd`.\n */\n stdinContent?: string;\n /** `--allow-empty`: zero matched files writes an empty graph, not an error. */\n allowEmpty?: boolean;\n}\n\n/**\n * What a run that wanted git history and could not have it is told. Said once,\n * through `warn()` at the CLI edge: git is detected now rather than switched\n * (proposal 0051 §6), so the degradation graph ADR 01010 built the warnings\n * channel for is all that is left of the tri-state.\n *\n * The reason travels with the sentence. Detection removed the user's way of\n * saying \"I require this\", so the warning is the only thing standing between a\n * CI runner that lost git and a quietly thinner graph — and \"not a repository\"\n * wants a different fix from \"git is not on PATH\" or \"`git log` timed out\".\n */\nexport const GIT_ABSENT_WARNING =\n \"the graph has no revision history or commit agents\";\n\nexport function gitAbsentWarning(reason: string): string {\n return `${GIT_ABSENT_WARNING}: ${reason}`;\n}\n\nexport interface BuildResult {\n outPath: string;\n docs: number;\n quads: number;\n /**\n * The concepts the graph holds, and how many of them the termbase defines\n * (proposal 0086 §1). `fromTermbase` is 0 when the `terms` derive source\n * is off or no termbase is set up.\n */\n concepts: { total: number; fromTermbase: number };\n /**\n * Non-fatal diagnostics: the build succeeded, but something it would have\n * done by default could not run (see ADR 01010). Rendered to stderr by the\n * CLI; never affects the exit code.\n */\n warnings: string[];\n}\n\n/** The build with its Turtle in hand, before anything is written. */\nexport interface BuiltGraph extends BuildResult {\n turtle: string;\n}\n\nexport async function runBuild(opts: BuildOptions = {}): Promise<BuildResult> {\n const { turtle, ...result } = await buildGraph(opts);\n mkdirSync(dirname(result.outPath), { recursive: true });\n writeFileSync(result.outPath, turtle, \"utf8\");\n return result;\n}\n\n/**\n * `runBuild` without the write: the graph as Turtle, in memory. `manni check`\n * builds the graph this way and checks it, writing no file.\n */\nexport async function buildGraph(opts: BuildOptions = {}): Promise<BuiltGraph> {\n const cwd = opts.cwd ?? process.cwd();\n const config = loadRunConfig(\n {\n ...(opts.config === undefined ? {} : { configPath: opts.config }),\n ...(opts.noConfig === undefined ? {} : { noConfig: opts.noConfig }),\n ...(opts.paths === undefined ? {} : { paths: opts.paths }),\n ...(opts.collection === undefined ? {} : { collection: opts.collection }),\n },\n cwd,\n );\n\n const format = assertInputFormat(opts.paths ?? [], opts.as);\n // Collection pages are labelled from the config's directory and typed paths\n // from cwd, as meta labels them. Every read below resolves from `base`.\n const base = documentBase(config, opts, cwd);\n const files = resolveDocumentSet(config, opts, \"build\", cwd, base);\n const usingStdin = (opts.paths ?? []).includes(STDIN);\n const outPath = resolve(cwd, opts.out ?? config.out);\n if (files.length === 0 && !usingStdin) {\n if (opts.allowEmpty) {\n // Zero documents is an empty graph, written where the graph goes, so a\n // later step that reads it finds a file rather than a stale one.\n return {\n outPath,\n docs: 0,\n quads: 0,\n concepts: { total: 0, fromTermbase: 0 },\n warnings: [],\n turtle: emitTurtle([]),\n };\n }\n throw new GraphError(\n `No input files matched: ${documentSetPatterns(config, opts).join(\", \")} (cwd: ${cwd})`,\n );\n }\n if (usingStdin && opts.stdinContent === undefined) {\n throw new GraphError(\"graph build was given `-` but no stdin content.\");\n }\n\n const allPaths = new Set(usingStdin ? [...files, STDIN_PATH] : files);\n // Each page's body parse is cached across runs (`analyze-cache.ts`). Link\n // resolution against `allPaths` and `routes` still runs on every build.\n const cache = new AnalyzeCache(resolve(cwd, ANALYZE_CACHE_DIR));\n const analyzeOptions = {\n routes: routesFrom(config, base),\n ...(format === undefined ? {} : { format }),\n parse: cache.parse,\n };\n const read = files.map((path) =>\n analyzeDoc(readFileSync(resolve(base, path), \"utf8\"), path, allPaths, analyzeOptions),\n );\n if (usingStdin && opts.stdinContent !== undefined) {\n read.push(analyzeDoc(opts.stdinContent, STDIN_PATH, allPaths, analyzeOptions));\n }\n\n // A page's metadata is what `manni meta validate` reads: its frontmatter\n // plus every key a manifest of its collections owns (proposal 0047), merged\n // through meta's own merge. Read from meta's section of the same config the\n // output marks come from, so one file answers both.\n const view = await openMetaView(\n {\n ...(opts.config === undefined ? {} : { configPath: opts.config }),\n ...(opts.noConfig === undefined ? {} : { noConfig: opts.noConfig }),\n },\n cwd,\n files,\n base,\n );\n const merged = await withExternalMetadata(read, view);\n\n // What the graph carries is the schema's call (proposal 0051 §5): a top-level\n // field marked `x-manni-graph-output: false` is dropped here, before derivation,\n // and the schemas are the set `manni meta validate` resolves (proposal 0074),\n // so it reaches none of Turtle, JSON-LD, iiRDS or the search index. All four\n // read what `deriveGraph` produces, so one filter at the fan-in is the whole\n // mechanism; suppressing a field downstream would be triple surgery in four\n // places. It runs after the merge, so a field kept in a manifest is filtered\n // by the same mark as one kept on the page.\n const docs = await suppressGraphOutput(merged, view);\n\n // Page-level keys that look like harvest inputs but are not. The graph block\n // is schema-strict, so a typo there is a hard error; at the page level\n // nothing validates, and a near miss derives silently nothing (ADR 01028).\n const warnings: string[] = harvestWarnings(docs);\n // The git pass only feeds the provenance derive source, so the subprocess is\n // skipped entirely when that source is off. Otherwise git is *detected*\n // (proposal 0051 §6): history is used wherever git can run over a\n // repository, and a run that would have used it and cannot says so once and\n // builds the rest — graph ADR 01010's degradation, without its switch.\n let gitHistory: Awaited<ReturnType<typeof collectGitHistory>> | undefined;\n if (config.build.derive.includes(\"provenance\")) {\n try {\n gitHistory = await collectGitHistory(base);\n } catch (e) {\n warnings.push(gitAbsentWarning(errorMessage(e)));\n }\n }\n\n // The termbase `manni term check` reads, from the same config, under the\n // `terms` derive source (proposal 0086 §1). Nothing registers a source\n // under a library call, and then the graph builds as it always did. A\n // termbase that cannot be read is `term check`'s failure to report, so the\n // graph warns once and builds the rest, as it does without git.\n const source = termLabelSource();\n let termbase: readonly TermLabel[] = [];\n if (config.build.derive.includes(\"terms\") && source !== undefined) {\n try {\n termbase = await source({\n cwd,\n ...(opts.config === undefined ? {} : { configPath: opts.config }),\n ...(opts.noConfig === true ? { noConfig: true } : {}),\n });\n } catch (e) {\n warnings.push(\n `the graph holds no termbase concepts: the termbase could not be read — ${errorMessage(e)}`,\n );\n }\n }\n\n const quads = deriveGraph(docs, {\n baseIri: config.baseIri,\n derive: config.build.derive,\n // The package version, stamped on the build agent (graph:version). One\n // package, one version: the tool no longer has one of its own.\n toolVersion: pkg.version,\n gitHistory,\n qualified: config.provenance.qualified,\n termbase,\n });\n const concept = `${NS.skos}Concept`;\n const concepts = {\n total: quads.filter((q) => q.p === RDF_TYPE && q.o.value === concept).length,\n fromTermbase: termConceptCount(termbase),\n };\n const turtle = emitTurtle(quads);\n await cache.flush();\n\n return { outPath, docs: docs.length, quads: quads.length, concepts, warnings, turtle };\n}\n","/**\n * The cross-run cache for page parses.\n *\n * Parsing the body is most of what `graph build` spends on a page, and most\n * pages do not change between runs. `manni check` builds the graph on every\n * agent stop, so the parse is cached: one JSON file per page label under\n * `.manni/graph/analyze-cache/`, overwritten when the page changes. The\n * cache therefore holds about one entry per page ever built here.\n *\n * Only `parseBody`'s output is stored, which is a pure function of the bytes\n * and the format. Frontmatter, link resolution against the corpus, routes,\n * the meta view and git history all run on every build, so nothing a cache\n * entry holds depends on another page or on the clock.\n *\n * A cache is an optimization: an unreadable, unparseable or malformed entry\n * is a miss, and a write that fails is dropped. Neither can fail a run.\n * Node-only: the runtime and embed bundles never import it.\n */\nimport { createHash } from \"node:crypto\";\nimport { mkdir } from \"node:fs/promises\";\nimport { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { writeTextAtomic } from \"../../shared/write-file.js\";\nimport pkg from \"../../../package.json\" with { type: \"json\" };\nimport { parseBody, type DocBody, type DocFormat } from \"./analyze.js\";\n\n/**\n * Where the cache lives, relative to the working directory, beside the\n * `fill` proposal cache (`.manni/graph/cache`) and the `embed` vector cache.\n */\nexport const ANALYZE_CACHE_DIR = \".manni/graph/analyze-cache\";\n\n/**\n * The entry format. Bump it when `parseBody` changes what it returns, so a\n * development build does not read entries an older parse wrote under the\n * same package version.\n */\nconst ENTRY_VERSION = 1;\n\nfunction sha256(text: string): string {\n return createHash(\"sha256\").update(text, \"utf8\").digest(\"hex\");\n}\n\nconst isStrings = (value: unknown): value is string[] =>\n Array.isArray(value) && value.every((v) => typeof v === \"string\");\n\nfunction isSection(value: unknown): boolean {\n if (typeof value !== \"object\" || value === null) return false;\n const s = value as Record<string, unknown>;\n return (\n typeof s.slug === \"string\" &&\n typeof s.title === \"string\" &&\n typeof s.level === \"number\" &&\n typeof s.order === \"number\" &&\n (s.parentSlug === null || typeof s.parentSlug === \"string\")\n );\n}\n\nfunction isDocBody(value: unknown): value is DocBody {\n if (typeof value !== \"object\" || value === null) return false;\n const b = value as Record<string, unknown>;\n return (\n (b.firstH1 === undefined || typeof b.firstH1 === \"string\") &&\n Array.isArray(b.sections) &&\n b.sections.every(isSection) &&\n isStrings(b.linkTargets) &&\n isStrings(b.imageTargets) &&\n isStrings(b.codeLanguages)\n );\n}\n\nexport class AnalyzeCache {\n /** Pages this run served from the cache. */\n hits = 0;\n /** Pages this run parsed. */\n misses = 0;\n private readonly writes: Promise<void>[] = [];\n\n constructor(\n private readonly dir: string,\n private readonly version: string = pkg.version,\n ) {}\n\n /** `parseBody`, served from the entry for `path` when its key matches. */\n readonly parse = (content: string, path: string, format: DocFormat): DocBody => {\n const key = sha256(JSON.stringify([ENTRY_VERSION, this.version, format, path, content]));\n // Named by a digest, so a label's `..` or `:` cannot choose where it lands.\n const file = join(this.dir, `${sha256(path)}.json`);\n const cached = readEntry(file, key);\n if (cached !== undefined) {\n this.hits++;\n return cached;\n }\n const body = parseBody(content, path, format);\n this.misses++;\n this.writes.push(this.write(file, JSON.stringify({ key, body })));\n return body;\n };\n\n /** Wait for this run's writes. Never rejects. */\n async flush(): Promise<void> {\n await Promise.all(this.writes);\n }\n\n private async write(file: string, text: string): Promise<void> {\n try {\n await mkdir(this.dir, { recursive: true });\n await writeTextAtomic(file, text);\n } catch {\n // Best-effort: the next run parses this page again.\n }\n }\n}\n\nfunction readEntry(file: string, key: string): DocBody | undefined {\n try {\n const entry = JSON.parse(readFileSync(file, \"utf8\")) as unknown;\n if (typeof entry !== \"object\" || entry === null) return undefined;\n const { key: stored, body } = entry as Record<string, unknown>;\n return stored === key && isDocBody(body) ? body : undefined;\n } catch {\n return undefined;\n }\n}\n","/**\n * The termbase as the graph reads it (proposal 0086 §1): one concept per term\n * id, and one resolver every concept label in derivation goes through.\n *\n * A label resolves to a term by its label, then its id, then an alt-label,\n * ignoring case. The page's own language is tried first, then the same\n * primary language (`en` for `en-US`), then any. A `see:` entry is a\n * redirect, not a concept: it resolves to its target.\n */\nimport type { TermLabel } from \"../../shared/term-labels.js\";\nimport { canonicalLanguageTag } from \"./localizations.js\";\nimport { byCodeUnit } from \"./sort.js\";\n\n/** What a key names: a term id, or a redirect to resolve in turn. */\ntype Target = { id: string } | { see: string; language: string | undefined };\n\ninterface Key {\n language: string | undefined;\n target: Target;\n}\n\nexport interface TermIndex {\n /** Each concept's entries, one per language, keyed by id in code-unit order. */\n groups: ReadonlyMap<string, readonly TermLabel[]>;\n /** The `see:` entries, in a stable order. */\n redirects: readonly TermLabel[];\n /** The term id a label names, or `undefined` for a freeform label. */\n resolve(label: string, language?: string): string | undefined;\n}\n\n/** A term's or a page's language, canonical, or `undefined` when it has none. */\nexport function canonicalLanguage(tag: string | undefined): string | undefined {\n return tag === undefined || tag === \"\" ? undefined : canonicalLanguageTag(tag);\n}\n\n// `split` always yields at least one element; the `?? \"\"` only satisfies the\n// index type.\nconst primary = (tag: string): string => (tag.split(\"-\")[0] ?? \"\").toLowerCase();\n\n/** A redirect chain longer than this is a loop, and names nothing. */\nconst MAX_REDIRECTS = 8;\n\n/**\n * Each termbase's index, by the array it was built from: one `graph build`\n * asks for it twice (the concept count and the derivation), and builds it once.\n */\nconst built = new WeakMap<readonly TermLabel[], TermIndex>();\n\nexport function termIndex(terms: readonly TermLabel[]): TermIndex {\n const cached = built.get(terms);\n if (cached !== undefined) return cached;\n const index = buildTermIndex(terms);\n built.set(terms, index);\n return index;\n}\n\nfunction buildTermIndex(terms: readonly TermLabel[]): TermIndex {\n const sorted = [...terms]\n .map((t) => ({ term: t, language: canonicalLanguage(t.language) }))\n .sort(\n (a, b) =>\n byCodeUnit(a.term.id, b.term.id) ||\n byCodeUnit(a.language ?? \"\", b.language ?? \"\") ||\n byCodeUnit(a.term.label, b.term.label),\n );\n\n const groups = new Map<string, TermLabel[]>();\n const redirects: TermLabel[] = [];\n const byLabel = new Map<string, Key[]>();\n const byId = new Map<string, Key[]>();\n const byAlt = new Map<string, Key[]>();\n const put = (map: Map<string, Key[]>, value: string, key: Key) => {\n const k = value.toLowerCase();\n const list = map.get(k);\n if (list) list.push(key);\n else map.set(k, [key]);\n };\n\n for (const { term, language } of sorted) {\n const target: Target =\n term.see === undefined ? { id: term.id } : { see: term.see, language };\n if (term.see === undefined) {\n const group = groups.get(term.id);\n if (group) group.push(term);\n else groups.set(term.id, [term]);\n } else {\n redirects.push(term);\n }\n put(byLabel, term.label, { language, target });\n put(byId, term.id, { language, target });\n for (const alt of term.altLabels ?? []) put(byAlt, alt, { language, target });\n }\n\n const tiers = [byLabel, byId, byAlt];\n\n const resolve = (label: string, language: string | undefined, depth: number): string | undefined => {\n const wanted = canonicalLanguage(language);\n const passes: Array<(k: Key) => boolean> =\n wanted === undefined\n ? [() => true]\n : [\n (k) => k.language === wanted,\n (k) => k.language !== undefined && primary(k.language) === primary(wanted),\n () => true,\n ];\n const needle = label.toLowerCase();\n for (const pass of passes) {\n for (const tier of tiers) {\n const hit = tier.get(needle)?.find(pass);\n if (hit === undefined) continue;\n if (\"id\" in hit.target) return hit.target.id;\n if (depth >= MAX_REDIRECTS) return undefined;\n return resolve(hit.target.see, hit.target.language ?? wanted, depth + 1);\n }\n }\n return undefined;\n };\n\n return {\n groups,\n redirects,\n resolve: (label, language) => (groups.size === 0 ? undefined : resolve(label, language, 0)),\n };\n}\n","/**\n * Graph derivation: DocModel[] → deduplicated Quad[]. This file is the\n * vocabulary mapping — the deterministic rules for what documentation\n * structure becomes which triples.\n */\nimport type { DocModel } from \"../types.js\";\nimport type { TermLabel } from \"../../shared/term-labels.js\";\nimport { canonicalLanguage, termIndex } from \"./concepts.js\";\nimport type { DeriveSource } from \"./config.js\";\nimport type { GitHistory } from \"./git.js\";\nimport { hasScheme, resolveRelative } from \"./analyze.js\";\nimport type { AgentKind } from \"./iri.js\";\nimport {\n conceptSlug,\n encodeSegment,\n mintAgentIri,\n mintBuildActivityIri,\n mintConceptIri,\n mintDocIri,\n mintGraphIri,\n mintProductIri,\n mintSchemeIri,\n mintSectionIri,\n mintTermConceptIri,\n normalizeDocPath,\n} from \"./iri.js\";\nimport { readSampleQuestions } from \"./questions.js\";\nimport { byCodeUnit } from \"./sort.js\";\nimport { NS, RDF_TYPE, ROLE } from \"./vocab.js\";\nimport {\n GRAPH_NOT_APPLICABLE_TO_VARIANT,\n GRAPH_NOT_SOFTWARE_SUBJECT,\n IIRDS_HAS_SUBJECT,\n IIRDS_HAS_TOPIC_TYPE,\n IIRDS_PRODUCT_VARIANT,\n IIRDS_RELATES_TO_LIFECYCLE_PHASE,\n IIRDS_RELATES_TO_PRODUCT_VARIANT,\n PAGE_TYPE_TO_TOPIC_TYPE,\n SOFTWARE_LIFECYCLE_IRIS,\n SOFTWARE_SUBJECT_IRIS,\n TOPIC_TYPE_IRIS,\n} from \"./iirds.js\";\n\n/**\n * Resolve a provenance target (a `graph.derived-from` / `graph.revision-of`\n * entry) to a corpus doc path: doc-relative first, then repo-relative; null\n * when neither names a discovered doc.\n */\nfunction resolveProvDocPath(\n docPath: string,\n raw: string,\n docByPath: ReadonlyMap<string, DocModel>,\n): string | null {\n const docRelative = resolveRelative(docPath, raw);\n if (docRelative !== null && docByPath.has(docRelative)) return docRelative;\n const repoRelative = normalizeDocPath(raw);\n return docByPath.has(repoRelative) ? repoRelative : null;\n}\n\nexport type Term =\n | { kind: \"iri\"; value: string }\n | {\n kind: \"literal\";\n value: string;\n datatype?: string;\n /** A language tag, for a literal that carries one. Never set with `datatype`. */\n language?: string;\n };\n\nexport interface Quad {\n s: string;\n p: string;\n o: Term;\n}\n\nexport interface DeriveOptions {\n baseIri: string;\n derive: DeriveSource[];\n /** dockg's own version, stamped on the build agent (provenance source). */\n toolVersion?: string;\n /** Per-file git history; set only under `provenance.git`. */\n gitHistory?: GitHistory;\n /** Emit qualified attribution/association nodes (`provenance.qualified`). */\n qualified?: boolean;\n /**\n * The termbase, as the family term source reads it (proposal 0086 §1).\n * Read only under the `terms` derive source.\n */\n termbase?: readonly TermLabel[];\n}\n\n/**\n * How many concepts the termbase contributes: one per term id. A `see:`\n * entry is a redirect, not a concept.\n */\nexport function termConceptCount(termbase: readonly TermLabel[]): number {\n return termIndex(termbase).groups.size;\n}\n\n/** A SKOS hierarchy predicate and the one emitted back from its object. */\nconst INVERSE = {\n broader: \"narrower\",\n narrower: \"broader\",\n related: \"related\",\n} as const;\n\n/** The one concept scheme's title (proposal 0086). */\nexport const CONCEPT_SCHEME_TITLE = \"manni graph concepts\";\n\nconst iri = (value: string): Term => ({ kind: \"iri\", value });\nconst lit = (value: string): Term => ({ kind: \"literal\", value });\nconst typedLit = (value: string, datatype: string): Term => ({\n kind: \"literal\",\n value,\n datatype,\n});\n\nconst DATE_RE = /^\\d{4}-\\d{2}-\\d{2}$/;\nconst DATETIME_RE = /^\\d{4}-\\d{2}-\\d{2}[T ]\\d{2}:\\d{2}/;\n\n/** Type a frontmatter date value; plain literal when unrecognized. */\nfunction dateTerm(value: string): Term {\n if (DATE_RE.test(value)) return typedLit(value, `${NS.xsd}date`);\n if (DATETIME_RE.test(value)) return typedLit(value, `${NS.xsd}dateTime`);\n return lit(value);\n}\n\nfunction asString(v: unknown): string | undefined {\n if (typeof v === \"string\" && v.length > 0) return v;\n if (typeof v === \"number\") return String(v);\n // TOML frontmatter yields Date instances (smol-toml TomlDate). String(date)\n // is locale/timezone-dependent and would break byte-identical output;\n // ISO 8601 is stable everywhere.\n if (v instanceof Date) {\n return Number.isNaN(v.getTime()) ? undefined : v.toISOString();\n }\n return undefined;\n}\n\nfunction asStringArray(v: unknown): string[] {\n if (typeof v === \"string\") return v.length > 0 ? [v] : [];\n if (Array.isArray(v)) {\n return v.flatMap((item) => {\n const s = asString(item);\n return s === undefined ? [] : [s];\n });\n }\n return [];\n}\n\n/**\n * The names in an `author`/`authors` value. Stewardship allows a name, a\n * person object with a `name` (the MyST and Docusaurus shape), or a list of\n * either. A person object with no name names no one.\n */\nfunction asPersonNames(v: unknown): string[] {\n const one = (item: unknown): string[] => {\n const name =\n item != null && typeof item === \"object\" && !Array.isArray(item)\n ? asString(asRecord(item).name)\n : asString(item);\n return name === undefined ? [] : [name];\n };\n return Array.isArray(v) ? v.flatMap(one) : one(v);\n}\n\n/** A plain object as a string-keyed record; anything else becomes `{}`. */\nfunction asRecord(v: unknown): Record<string, unknown> {\n return v != null && typeof v === \"object\" && !Array.isArray(v)\n ? (v as Record<string, unknown>)\n : {};\n}\n\n/** First defined frontmatter value among aliases. */\nfunction fmValue(fm: Record<string, unknown>, keys: string[]): unknown {\n for (const key of keys) {\n if (fm[key] !== undefined && fm[key] !== null) return fm[key];\n }\n return undefined;\n}\n\n/** PROV-O's three prov:Agent subclasses, and their IRI path segments. */\ntype ProvAgentClass = \"Person\" | \"Organization\" | \"SoftwareAgent\";\n\nconst AGENT_KIND: Record<ProvAgentClass, AgentKind> = {\n Person: \"person\",\n Organization: \"org\",\n SoftwareAgent: \"software\",\n};\n\n/** The `graph` block of frontmatter, or undefined. */\nfunction graphBlock(\n fm: Record<string, unknown>,\n): Record<string, unknown> | undefined {\n const block = fm[\"graph\"];\n return block && typeof block === \"object\" && !Array.isArray(block)\n ? (block as Record<string, unknown>)\n : undefined;\n}\n\n/**\n * The harvest rule (ADR 01024): **deeper wins; the page level is the fallback**\n * — per fact, not per page. A `graph` block that speaks to a fact owns it\n * outright; where the block is silent, the page-level twin feeds the graph.\n *\n * Only the facts the `graph` block has a twin for are resolved here. Page-level\n * `prerequisites` / `next-steps` / `related-pages` belong to `docmeta:structure`\n * and are deliberately not harvested — that is a separate vocabulary, not this\n * one's fallback.\n *\n * Returns a graph-shaped object even when the page carries no `graph` block at\n * all, so a page typed only at the top level still derives its iiRDS typing.\n */\nfunction resolveGraph(\n block: Record<string, unknown> | undefined,\n fm: Record<string, unknown>,\n): Record<string, unknown> {\n const k: Record<string, unknown> = { ...(block ?? {}) };\n\n const fallback = (key: string, pageKeys: string[]) => {\n if (k[key] !== undefined && k[key] !== null) return;\n const pageValue = fmValue(fm, pageKeys);\n if (pageValue !== undefined) k[key] = pageValue;\n };\n\n fallback(\"concepts\", [\"concepts\"]);\n fallback(\"applies-to\", [\"applies-to\"]);\n fallback(\"not-applicable-to\", [\"not-applicable-to\"]);\n fallback(\"revision-of\", [\"supersedes\"]);\n\n // `type` is the one fact whose two altitudes speak different vocabularies:\n // the page's is open (docmeta:core), `graph.type` is the closed iiRDS enum. A\n // page type with no iiRDS counterpart derives nothing rather than inventing\n // one.\n if (k[\"type\"] === undefined || k[\"type\"] === null) {\n const pageType = asString(fmValue(fm, [\"type\"]));\n // hasOwn guards the prototype chain: `type: constructor` would otherwise\n // resolve to Object and pass the truthiness check below, writing a\n // function into graph.type.\n const derived =\n pageType && Object.hasOwn(PAGE_TYPE_TO_TOPIC_TYPE, pageType)\n ? PAGE_TYPE_TO_TOPIC_TYPE[pageType]\n : undefined;\n if (derived) k[\"type\"] = derived;\n }\n\n return k;\n}\n\n/**\n * The mapping entries of a `provenance` / `meta-provenance` list. Both are\n * lists of entries keyed by `generated-by` (proposal 0046), and a list is all\n * either of them may be — anything else names no machine, so it derives\n * nothing rather than being guessed at.\n *\n * Not `metaProvenanceEntries` from meta's barrel: that reader narrows an entry\n * to its model, `fields` and `evals`, and the harvest also needs `confidence`,\n * which it drops.\n */\nfunction recordEntries(value: unknown): Array<Record<string, unknown>> {\n if (!Array.isArray(value)) return [];\n return value.filter(\n (e): e is Record<string, unknown> =>\n !!e && typeof e === \"object\" && !Array.isArray(e),\n );\n}\n\n/** A JSON Pointer's reference tokens, each unescaped per RFC 6901. */\nfunction pointerSegments(pointer: string): string[] {\n return pointer\n .split(\"/\")\n .slice(1)\n .map((s) => s.replace(/~1/g, \"/\").replace(/~0/g, \"~\"));\n}\n\nexport function deriveGraph(docs: DocModel[], options: DeriveOptions): Quad[] {\n const { baseIri } = options;\n const sources = new Set(options.derive);\n const quads: Quad[] = [];\n const add = (s: string, p: string, o: Term) => quads.push({ s, p, o });\n /**\n * Concept IRIs minted while deriving. A set rather than a flag because\n * `concept()` is a closure: a captured `let` assigned only inside one stays\n * narrowed to its initializer at the read below, which would make the\n * scheme node unreachable as far as the compiler is concerned.\n */\n const mintedConcepts = new Set<string>();\n const terms = termIndex(sources.has(\"terms\") ? (options.termbase ?? []) : []);\n\n /**\n * The concept a label names (proposal 0086 §1). A label the termbase\n * defines names that term's concept, which the termbase pass below emits,\n * so the reference adds no label of its own. Any other label is a freeform\n * concept, minted from its slug with the label as its prefLabel.\n */\n const concept = (label: string, language?: string): string => {\n const id = terms.resolve(label, language);\n if (id !== undefined) return mintTermConceptIri(baseIri, id);\n const c = mintConceptIri(baseIri, label);\n add(c, RDF_TYPE, iri(`${NS.skos}Concept`));\n add(c, `${NS.skos}prefLabel`, lit(label));\n add(c, `${NS.skos}inScheme`, iri(mintSchemeIri(baseIri)));\n mintedConcepts.add(c);\n return c;\n };\n\n /** One hierarchy edge, emitted both ways round. */\n const hierarchy = (s: string, relation: keyof typeof INVERSE, o: string) => {\n add(s, `${NS.skos}${relation}`, iri(o));\n add(o, `${NS.skos}${INVERSE[relation]}`, iri(s));\n };\n\n /** ProductVariant node (type + label); returns its IRI. Positive and\n * negative applicability converge on one node per label. */\n const variantNode = (label: string): string => {\n const variant = mintProductIri(baseIri, label);\n add(variant, RDF_TYPE, iri(IIRDS_PRODUCT_VARIANT));\n add(variant, `${NS.dcterms}title`, lit(label));\n return variant;\n };\n\n /**\n * Emit the iiRDS typing fields (type, applies-to, about-product-lifecycle,\n * about-product-aspect) plus the negative-scope fields (not-applicable-to,\n * not-about-product-aspect) for `subjectIri` from a graph-like object. Shared\n * by the document `graph` block and the per-section `graph.sections` block so\n * the mapping cannot drift between them (ADR 01012/01013/01014).\n */\n const emitIirdsTyping = (subjectIri: string, k: Record<string, unknown>) => {\n const topicType = asString(k[\"type\"]);\n const topicTypeIri = topicType && TOPIC_TYPE_IRIS[topicType];\n if (topicTypeIri) add(subjectIri, IIRDS_HAS_TOPIC_TYPE, iri(topicTypeIri));\n\n for (const label of asStringArray(k[\"applies-to\"])) {\n add(\n subjectIri,\n IIRDS_RELATES_TO_PRODUCT_VARIANT,\n iri(variantNode(label)),\n );\n }\n for (const label of asStringArray(k[\"not-applicable-to\"])) {\n add(subjectIri, GRAPH_NOT_APPLICABLE_TO_VARIANT, iri(variantNode(label)));\n }\n\n for (const value of asStringArray(k[\"about-product-lifecycle\"])) {\n const phase = SOFTWARE_LIFECYCLE_IRIS[value];\n if (phase) add(subjectIri, IIRDS_RELATES_TO_LIFECYCLE_PHASE, iri(phase));\n }\n for (const value of asStringArray(k[\"about-product-aspect\"])) {\n const subject = SOFTWARE_SUBJECT_IRIS[value];\n if (subject) add(subjectIri, IIRDS_HAS_SUBJECT, iri(subject));\n }\n for (const value of asStringArray(k[\"not-about-product-aspect\"])) {\n const subject = SOFTWARE_SUBJECT_IRIS[value];\n if (subject) add(subjectIri, GRAPH_NOT_SOFTWARE_SUBJECT, iri(subject));\n }\n };\n\n const docByPath = new Map(docs.map((d) => [normalizeDocPath(d.path), d]));\n const prov = sources.has(\"provenance\");\n\n /**\n * Agent node; dedupe converges repeats of the same name AND kind. The IRI\n * is segmented by kind (`agent/person/…`, `agent/software/…`) so a human\n * and a model whose names slug alike stay distinct nodes.\n */\n const agentNode = (name: string, type: ProvAgentClass): string => {\n const a = mintAgentIri(baseIri, AGENT_KIND[type], name);\n add(a, RDF_TYPE, iri(`${NS.prov}${type}`));\n add(a, `${NS.foaf}name`, lit(name));\n return a;\n };\n\n const qualified = options.qualified === true;\n\n // Qualification node IRIs use \".\" separators (github-slugger can never emit\n // a dot, so heading slugs cannot collide) and carry the agent slug, so two\n // agents on one activity/doc never merge into a single node.\n\n /** doc ↔ author qualification: {docIri}#prov.attribution.{agentSlug}. */\n const qualifyAttribution = (\n docIri: string,\n agentIri: string,\n name: string,\n ): void => {\n if (!qualified) return;\n const node = `${docIri}#prov.attribution.${conceptSlug(name)}`;\n add(docIri, `${NS.prov}qualifiedAttribution`, iri(node));\n add(node, RDF_TYPE, iri(`${NS.prov}Attribution`));\n add(node, `${NS.prov}agent`, iri(agentIri));\n add(node, `${NS.prov}hadRole`, iri(ROLE.author));\n };\n\n /** activity ↔ agent qualification: {activityIri}.assoc.{agentSlug}. */\n const qualifyAssociation = (\n activityIri: string,\n agentIri: string,\n role: string,\n ): void => {\n if (!qualified) return;\n const agentSlug = agentIri.slice(agentIri.lastIndexOf(\"/\") + 1);\n const node = `${activityIri}.assoc.${agentSlug}`;\n add(activityIri, `${NS.prov}qualifiedAssociation`, iri(node));\n add(node, RDF_TYPE, iri(`${NS.prov}Association`));\n add(node, `${NS.prov}agent`, iri(agentIri));\n add(node, `${NS.prov}hadRole`, iri(role));\n };\n\n /** Author agent + creator/attribution edges (+ qualification when on). */\n const attributeAuthor = (docIri: string, name: string): void => {\n const a = agentNode(name, \"Person\");\n add(docIri, `${NS.dcterms}creator`, iri(a));\n add(docIri, `${NS.prov}wasAttributedTo`, iri(a));\n qualifyAttribution(docIri, a, name);\n };\n\n /**\n * Shared mapping for graph.derived-from / graph.revision-of / page\n * `translation-of` entries.\n *\n * `inverse`, when given, is also emitted back from the resolved target — but\n * only for a target inside the corpus. A URL names a resource dockg has not\n * analyzed and does not speak for, so it gains an inbound edge and never an\n * outbound claim (ADR 01037).\n */\n const provTargetEdge = (\n doc: DocModel,\n docIri: string,\n raw: string,\n predicate: string,\n inverse?: string,\n ): void => {\n if (hasScheme(raw)) {\n add(docIri, predicate, iri(raw));\n return;\n }\n const target = resolveProvDocPath(\n normalizeDocPath(doc.path),\n raw,\n docByPath,\n );\n if (target) {\n const targetIri = mintDocIri(baseIri, target);\n add(docIri, predicate, iri(targetIri));\n if (inverse) add(targetIri, inverse, iri(docIri));\n } else {\n add(docIri, `${NS.graph}brokenLink`, lit(raw));\n }\n };\n\n for (const doc of docs) {\n const docIri = mintDocIri(baseIri, doc.path);\n const fm = doc.frontmatter;\n const block = graphBlock(fm);\n // `block` is the `graph` block as written (block-only facts: sections,\n // provenance, the SKOS hierarchy); `harvested` folds in the page-level\n // fallbacks.\n const harvested = resolveGraph(block, fm);\n // The page's own key outranks the route it sits under (ADR 01037): a\n // single English page inside a translated tree can correct its label,\n // and a corpus that declares nothing keeps deriving nothing.\n const pageLanguage = canonicalLanguage(\n asString(fmValue(fm, [\"lang\", \"language\"])) ?? doc.routeLanguage,\n );\n let createdEmitted = false;\n let modifiedEmitted = false;\n\n add(docIri, RDF_TYPE, iri(`${NS.graph}Document`));\n if (prov) add(docIri, RDF_TYPE, iri(`${NS.prov}Entity`));\n add(docIri, `${NS.graph}path`, lit(normalizeDocPath(doc.path)));\n // Intrinsic like path, not gated behind a derive source (ADR 01036): a hash\n // present only sometimes cannot tell \"unchanged\" from \"not stamped\", which\n // is the whole question it exists to answer.\n add(docIri, `${NS.graph}contentHash`, lit(doc.contentHash));\n\n if (sources.has(\"frontmatter\")) {\n const title = asString(fmValue(fm, [\"title\"])) ?? doc.firstH1;\n if (title) add(docIri, `${NS.dcterms}title`, lit(title));\n\n const description = asString(fmValue(fm, [\"description\"]));\n if (description)\n add(docIri, `${NS.dcterms}description`, lit(description));\n\n for (const author of asPersonNames(fmValue(fm, [\"author\", \"authors\"]))) {\n if (prov) {\n attributeAuthor(docIri, author);\n } else {\n add(docIri, `${NS.dcterms}creator`, lit(author));\n }\n }\n\n // Stewardship's spelling first (`created`, `last-updated`), then the\n // aliases other generators write. One value per predicate: the first\n // key present wins and the rest are ignored.\n const created = asString(fmValue(fm, [\"created\", \"date\"]));\n if (created) {\n add(docIri, `${NS.dcterms}created`, dateTerm(created));\n if (prov) add(docIri, `${NS.prov}generatedAtTime`, dateTerm(created));\n createdEmitted = true;\n }\n\n const modified = asString(\n fmValue(fm, [\"last-updated\", \"updated\", \"lastmod\", \"modified\"]),\n );\n if (modified) {\n add(docIri, `${NS.dcterms}modified`, dateTerm(modified));\n modifiedEmitted = true;\n }\n\n // Written in its canonical spelling: tags are case-insensitive, and\n // `en-us` beside `en-US` would otherwise split one locale into two\n // indexes and miss a `--lang` filter typed the other way.\n if (pageLanguage) add(docIri, `${NS.dcterms}language`, lit(pageLanguage));\n\n // ai-context's questions this page should be found for (proposal 0086\n // §7), in the page's language. Only the text: an item's answer pins and\n // review state are test data `check` reads from the source (0087).\n for (const { question } of readSampleQuestions(fmValue(fm, [\"sample-questions\"]))) {\n add(\n docIri,\n `${NS.graph}sampleQuestion`,\n pageLanguage\n ? { kind: \"literal\", value: question, language: pageLanguage }\n : lit(question),\n );\n }\n\n // Page-level only: the `graph` block is closed and carries no\n // translation key, so this fact lives at the altitude `lang` already\n // does (ADR 01023, ADR 01037). Both directions are materialized, so\n // \"every localization of this page\" is one lookup for a consumer with no\n // inbound index of its own.\n for (const raw of asStringArray(fmValue(fm, [\"translation-of\"]))) {\n provTargetEdge(\n doc,\n docIri,\n raw,\n `${NS.schema}translationOfWork`,\n `${NS.schema}workTranslation`,\n );\n }\n\n // The graph block: the SKOS hierarchy has no page-level twin, so it reads\n // the block as written (frontmatter key `graph`, RDF prefix `graph:`).\n const blockLabel = block ? asString(block[\"label\"]) : undefined;\n if (block) {\n if (blockLabel) {\n const topic = concept(blockLabel, pageLanguage);\n add(docIri, `${NS.foaf}primaryTopic`, iri(topic));\n for (const alt of asStringArray(block[\"alt-labels\"])) {\n add(topic, `${NS.skos}altLabel`, lit(alt));\n }\n // Frontmatter key → SKOS predicate. `related-concepts` is spelled for\n // what it points at (in step with the page-level `related-pages`);\n // the predicate it emits is still plain skos:related.\n for (const [key, predicate] of [\n [\"broader\", \"broader\"],\n [\"narrower\", \"narrower\"],\n [\"related-concepts\", \"related\"],\n ] as const) {\n for (const value of asStringArray(block[key])) {\n hierarchy(topic, predicate, concept(value, pageLanguage));\n }\n }\n }\n }\n\n // A term page is about its term (proposal 0086 §1), unless its `graph`\n // block names a topic of its own. Its id names the term, and its label\n // does when the id is absent or names no term.\n if (!blockLabel && asString(fm[\"type\"]) === \"term\") {\n const id = asString(fm[\"id\"]);\n const label = asString(fm[\"label\"]);\n const termId =\n (id !== undefined && terms.groups.has(id) ? id : undefined) ??\n (label === undefined ? undefined : terms.resolve(label, pageLanguage));\n if (termId !== undefined) {\n add(docIri, `${NS.foaf}primaryTopic`, iri(mintTermConceptIri(baseIri, termId)));\n }\n }\n\n // iiRDS Core + Software typing (ADR 01012), over the harvested block so a\n // page typed only at the top level still types its document (ADR 01024).\n emitIirdsTyping(docIri, harvested);\n }\n\n if (sources.has(\"tags\")) {\n // Two distinct facts, both landing on dcterms:subject: dockg's own\n // tag harvest (`tags`/`keywords`), and the concepts fact — where\n // `graph.concepts` beats the page-level `concepts` outright rather than\n // adding to it (ADR 01024).\n const labels = [\n ...asStringArray(fmValue(fm, [\"tags\", \"keywords\"])),\n ...asStringArray(harvested[\"concepts\"]),\n ];\n for (const label of labels) {\n add(docIri, `${NS.dcterms}subject`, iri(concept(label, pageLanguage)));\n }\n }\n\n if (sources.has(\"sections\")) {\n // graph.sections: slug-keyed iiRDS typing attached to section nodes\n // (ADR 01013). Explicit-only — a section gets nothing from the doc.\n const sectionMeta = asRecord(block?.[\"sections\"]);\n const sectionSlugs = new Set(doc.sections.map((s) => s.slug));\n\n for (const section of doc.sections) {\n const secIri = mintSectionIri(docIri, section.slug);\n const parentIri = section.parentSlug\n ? mintSectionIri(docIri, section.parentSlug)\n : docIri;\n add(secIri, RDF_TYPE, iri(`${NS.graph}Section`));\n add(secIri, `${NS.dcterms}title`, lit(section.title));\n add(\n secIri,\n `${NS.graph}level`,\n typedLit(String(section.level), `${NS.xsd}integer`),\n );\n add(\n secIri,\n `${NS.graph}order`,\n typedLit(String(section.order), `${NS.xsd}integer`),\n );\n add(parentIri, `${NS.dcterms}hasPart`, iri(secIri));\n\n const meta = asRecord(sectionMeta[section.slug]);\n emitIirdsTyping(secIri, meta);\n for (const label of asStringArray(meta[\"concepts\"])) {\n add(secIri, `${NS.dcterms}subject`, iri(concept(label, pageLanguage)));\n }\n }\n\n // A graph.sections key naming no heading is a broken reference (surfaced\n // by stats, gated by stats --check) — never a silent drop.\n for (const slug of Object.keys(sectionMeta)) {\n if (!sectionSlugs.has(slug)) {\n add(docIri, `${NS.graph}brokenSectionRef`, lit(slug));\n }\n }\n }\n\n if (sources.has(\"links\")) {\n for (const link of doc.links) {\n if (link.kind === \"external\" && link.url) {\n add(docIri, `${NS.dcterms}references`, iri(link.url));\n } else if (link.kind === \"internal\" && link.resolvedPath) {\n const targetIri = mintDocIri(baseIri, link.resolvedPath);\n const target = docByPath.get(link.resolvedPath);\n // Bound first, so the anchor the test found is the anchor the IRI is\n // minted from rather than a second read the type cannot connect to\n // the first.\n const anchor = link.anchor;\n const anchorResolves =\n anchor !== undefined &&\n target !== undefined &&\n target.sections.some((s) => s.slug === anchor);\n add(\n docIri,\n `${NS.dcterms}references`,\n iri(\n anchorResolves ? mintSectionIri(targetIri, anchor) : targetIri,\n ),\n );\n } else if (link.kind === \"broken\") {\n add(docIri, `${NS.graph}brokenLink`, lit(link.raw));\n }\n }\n }\n\n if (sources.has(\"images\")) {\n for (const image of doc.images) {\n const target = image.external\n ? image.target\n : `${baseIri}file/${normalizeDocPath(image.target)\n .split(\"/\")\n .map(encodeSegment)\n .join(\"/\")}`;\n add(docIri, `${NS.schema}image`, iri(target));\n }\n }\n\n if (sources.has(\"code\")) {\n for (const language of doc.codeLanguages) {\n add(docIri, `${NS.graph}codeLanguage`, lit(language));\n }\n }\n\n if (prov) {\n // graph.derived-from / graph.revision-of: doc-relative path,\n // repo-relative path, or URL — one shared resolution. `derived-from` is block-only\n // (document lineage is curated by hand); `revision-of` harvests the\n // page-level `supersedes` when the block is silent (ADR 01024).\n for (const raw of block ? asStringArray(block[\"derived-from\"]) : []) {\n provTargetEdge(doc, docIri, raw, `${NS.prov}wasDerivedFrom`);\n }\n for (const raw of asStringArray(harvested[\"revision-of\"])) {\n provTargetEdge(doc, docIri, raw, `${NS.prov}wasRevisionOf`);\n }\n\n // Per-file git history (provenance.git): frontmatter always wins on\n // dates; authors merge; renames become revision edges to the\n // historical-path entities.\n const gitFile = options.gitHistory?.files.get(normalizeDocPath(doc.path));\n if (gitFile) {\n if (!createdEmitted && gitFile.created) {\n add(docIri, `${NS.dcterms}created`, dateTerm(gitFile.created));\n add(docIri, `${NS.prov}generatedAtTime`, dateTerm(gitFile.created));\n }\n if (!modifiedEmitted && gitFile.modified) {\n add(docIri, `${NS.dcterms}modified`, dateTerm(gitFile.modified));\n }\n for (const author of gitFile.authors) {\n attributeAuthor(docIri, author);\n }\n for (const oldPath of gitFile.renamedFrom) {\n const oldIri = mintDocIri(baseIri, oldPath);\n add(docIri, `${NS.prov}wasRevisionOf`, iri(oldIri));\n add(oldIri, RDF_TYPE, iri(`${NS.prov}Entity`));\n }\n }\n\n // Whole-page generation. There is no page-level `generated-by` any more\n // (proposal 0046): the machines that wrote a page are the DISTINCT\n // `generated-by` values across its page-level `provenance` entries, each\n // of which pins a line range. The activity stays one per page, so a\n // single-model page emits exactly what it always did. Its fragment uses\n // a \".\" separator, which github-slugger can never produce — heading\n // slugs cannot collide with provenance fragments.\n const machines = [\n ...new Set(\n recordEntries(fmValue(fm, [\"provenance\"])).flatMap((e) => {\n const m = asString(e[\"generated-by\"]);\n return m === undefined ? [] : [m];\n }),\n ),\n ].sort(byCodeUnit);\n if (machines.length > 0) {\n const activity = `${docIri}#prov.generation`;\n add(docIri, `${NS.prov}wasGeneratedBy`, iri(activity));\n add(activity, RDF_TYPE, iri(`${NS.prov}Activity`));\n for (const machine of machines) {\n const model = agentNode(machine, \"SoftwareAgent\");\n add(activity, `${NS.prov}wasAssociatedWith`, iri(model));\n qualifyAssociation(activity, model, ROLE.generator);\n }\n }\n\n // Page-level `meta-provenance` (written by `manni graph fill`): one\n // activity PER MODEL so multiple fills by different models keep truthful\n // attribution. Only the doc's own topic concept is prov:generated —\n // shared subject/tag concepts are never attributed, or one doc's LLM\n // would taint every doc using the same tag.\n for (const entry of recordEntries(fmValue(fm, [\"meta-provenance\"]))) {\n const model = asString(entry[\"generated-by\"]);\n if (!model) continue;\n // A pointer names a value anywhere on the page, so only the ones under\n // `/graph/` are graph's business. The filled field is the first segment\n // after it: `/graph/sections/install/type` attributes `sections`, the\n // field a reviewer would look at. First pointer wins on confidence,\n // which 0046 keys by the whole pointer rather than by the field.\n const pointers = asStringArray(entry[\"fields\"]);\n const confidence = asRecord(entry[\"confidence\"]);\n const filled = new Map<string, string>();\n for (const pointer of pointers) {\n if (!pointer.startsWith(\"/graph/\")) continue;\n const field = pointerSegments(pointer)[1];\n if (field === undefined || field === \"\") continue;\n if (!filled.has(field)) filled.set(field, pointer);\n }\n if (filled.size === 0) continue;\n const activity = `${docIri}#prov.graph-fill.${conceptSlug(model)}`;\n const modelAgent = agentNode(model, \"SoftwareAgent\");\n add(activity, RDF_TYPE, iri(`${NS.prov}Activity`));\n add(activity, `${NS.prov}wasAssociatedWith`, iri(modelAgent));\n qualifyAssociation(activity, modelAgent, ROLE.generator);\n // Each filled field is reified as an entry node carrying its name and\n // (when fill recorded one) the model's confidence — a plain,\n // blank-node-free per-field audit edge (ADR 01015).\n for (const [field, pointer] of filled) {\n const fieldNode = `${activity}.field.${field}`;\n add(activity, `${NS.graph}filledFieldEntry`, iri(fieldNode));\n add(fieldNode, `${NS.graph}filledField`, lit(field));\n const c = confidence[pointer];\n if (typeof c === \"number\") {\n add(\n fieldNode,\n `${NS.graph}confidence`,\n typedLit(String(Math.round(c * 100) / 100), `${NS.xsd}decimal`),\n );\n }\n }\n const label = block ? asString(block[\"label\"]) : undefined;\n if (label && filled.has(\"label\")) {\n const id = terms.resolve(label, pageLanguage);\n add(\n activity,\n `${NS.prov}generated`,\n iri(\n id === undefined\n ? mintConceptIri(baseIri, label)\n : mintTermConceptIri(baseIri, id),\n ),\n );\n }\n }\n }\n }\n\n if (prov) {\n const graphIri = mintGraphIri(baseIri);\n const activity = mintBuildActivityIri(baseIri);\n const tool = agentNode(\"manni\", \"SoftwareAgent\");\n add(graphIri, RDF_TYPE, iri(`${NS.prov}Entity`));\n add(graphIri, `${NS.prov}wasGeneratedBy`, iri(activity));\n add(activity, RDF_TYPE, iri(`${NS.prov}Activity`));\n add(activity, `${NS.prov}wasAssociatedWith`, iri(tool));\n qualifyAssociation(activity, tool, ROLE.tool);\n if (options.toolVersion) {\n add(tool, `${NS.graph}version`, lit(options.toolVersion));\n }\n for (const doc of docs) {\n add(activity, `${NS.prov}used`, iri(mintDocIri(baseIri, doc.path)));\n }\n const headTime = options.gitHistory?.headTime;\n if (headTime) {\n add(\n activity,\n `${NS.prov}endedAtTime`,\n typedLit(headTime, `${NS.xsd}dateTime`),\n );\n }\n }\n\n // The termbase's concepts (proposal 0086 §1): one per id, each language of a\n // term joining it, and every label tagged with the term's language.\n const tagged = (value: string, language: string | undefined): Term =>\n language === undefined ? lit(value) : { kind: \"literal\", value, language };\n for (const [id, entries] of terms.groups) {\n const c = mintTermConceptIri(baseIri, id);\n add(c, RDF_TYPE, iri(`${NS.skos}Concept`));\n add(c, `${NS.skos}inScheme`, iri(mintSchemeIri(baseIri)));\n mintedConcepts.add(c);\n for (const entry of entries) {\n const language = canonicalLanguage(entry.language);\n add(c, `${NS.skos}prefLabel`, tagged(entry.label, language));\n for (const [values, predicate] of [\n [entry.altLabels, \"altLabel\"],\n [entry.hiddenLabels, \"hiddenLabel\"],\n [entry.definition, \"definition\"],\n [entry.scopeNote, \"scopeNote\"],\n ] as const) {\n for (const value of asStringArray(values)) {\n add(c, `${NS.skos}${predicate}`, tagged(value, language));\n }\n }\n for (const relation of [\"broader\", \"narrower\", \"related\"] as const) {\n for (const value of entry[relation] ?? []) {\n hierarchy(c, relation, concept(value, language));\n }\n }\n // A code and the mappings out of the scheme belong to no language.\n if (entry.notation !== undefined) add(c, `${NS.skos}notation`, lit(entry.notation));\n for (const [values, predicate] of [\n [entry.exactMatches, \"exactMatch\"],\n [entry.closeMatches, \"closeMatch\"],\n [entry.broadMatches, \"broadMatch\"],\n [entry.narrowMatches, \"narrowMatch\"],\n [entry.relatedMatches, \"relatedMatch\"],\n ] as const) {\n for (const value of values ?? []) add(c, `${NS.skos}${predicate}`, iri(value));\n }\n }\n }\n // A `see:` entry is no concept of its own. Its label is another way to say\n // its target, so it becomes an altLabel there.\n for (const entry of terms.redirects) {\n const language = canonicalLanguage(entry.language);\n const target =\n entry.see === undefined ? undefined : terms.resolve(entry.see, language);\n if (target === undefined) continue;\n add(\n mintTermConceptIri(baseIri, target),\n `${NS.skos}altLabel`,\n tagged(entry.label, language),\n );\n }\n\n if (mintedConcepts.size > 0) {\n const scheme = mintSchemeIri(baseIri);\n add(scheme, RDF_TYPE, iri(`${NS.skos}ConceptScheme`));\n add(scheme, `${NS.dcterms}title`, lit(CONCEPT_SCHEME_TITLE));\n // A concept with no broader concept is a top concept of the scheme, both\n // ways round. Read off the quads, so every source of hierarchy counts.\n const broader = `${NS.skos}broader`;\n const hasBroader = new Set(\n quads.filter((q) => q.p === broader).map((q) => q.s),\n );\n for (const c of mintedConcepts) {\n if (hasBroader.has(c)) continue;\n add(c, `${NS.skos}topConceptOf`, iri(scheme));\n add(scheme, `${NS.skos}hasTopConcept`, iri(c));\n }\n }\n\n return dedupe(quads);\n}\n\nfunction quadKey(q: Quad): string {\n const o =\n q.o.kind === \"iri\"\n ? `i:${q.o.value}`\n : `l:${q.o.value}|${q.o.datatype ?? \"\"}|${q.o.language ?? \"\"}`;\n return `${q.s}|${q.p}|${o}`;\n}\n\nfunction dedupe(quads: Quad[]): Quad[] {\n const seen = new Set<string>();\n const out: Quad[] = [];\n for (const q of quads) {\n const key = quadKey(q);\n if (seen.has(key)) continue;\n seen.add(key);\n out.push(q);\n }\n return out;\n}\n","/**\n * Deterministic Turtle serialization — the git-diff contract. Canonical form:\n * fixed sorted prefix header; subjects sorted by full IRI; within a subject,\n * rdf:type first (as `a`), then predicates sorted by full IRI; objects sorted\n * (IRIs before literals, each lexicographic); LF line endings, UTF-8, exactly\n * one trailing newline. Byte-identical output for any input quad order.\n *\n * Deliberately not N3.Writer: its formatting is incidental library behavior.\n * Correctness of escaping is guarded by a round-trip test through n3's parser.\n */\nimport type { Quad, Term } from \"./derive.js\";\nimport { byCodeUnit } from \"./sort.js\";\nimport { NS, PREFIXES, RDF_TYPE } from \"./vocab.js\";\n\n/** Conservative PN_LOCAL: shorten only when the local name is trivially safe. */\nconst SAFE_LOCAL = /^[A-Za-z_][A-Za-z0-9_-]*$/;\n\n/**\n * Percent-encode characters the Turtle IRIREF production forbids\n * (controls, space, <>\"{}|^` and backslash) so output always parses,\n * whatever made it into a node value.\n */\n// Forbidden by IRIREF: <>\"{}|^ plus backtick and backslash.\nconst ILLEGAL_IRI_CHARS = '<>\"{}|^\\x60\\x5c';\n\nfunction sanitizeIri(iriValue: string): string {\n let out = \"\";\n for (const ch of iriValue) {\n const code = ch.codePointAt(0) as number;\n const illegal = code <= 0x20 || ILLEGAL_IRI_CHARS.includes(ch);\n out += illegal\n ? \"%\" + code.toString(16).toUpperCase().padStart(2, \"0\")\n : ch;\n }\n return out;\n}\n\n/**\n * Memo: the same predicates/objects recur once per quad; shorten each once.\n * Cleared at the start of every emit so long-lived embedders don't accumulate\n * every IRI ever serialized.\n */\nconst shortenMemo = new Map<string, string>();\n\nfunction shorten(iriValue: string): string {\n const memoized = shortenMemo.get(iriValue);\n if (memoized !== undefined) return memoized;\n let result: string | undefined;\n for (const [prefix, ns] of PREFIXES) {\n if (iriValue.startsWith(ns)) {\n const local = iriValue.slice(ns.length);\n if (SAFE_LOCAL.test(local)) {\n result = `${prefix}:${local}`;\n break;\n }\n }\n }\n result ??= `<${sanitizeIri(iriValue)}>`;\n shortenMemo.set(iriValue, result);\n return result;\n}\n\nfunction escapeLiteral(value: string): string {\n return value\n .replace(/\\\\/g, \"\\\\\\\\\")\n .replace(/\"/g, '\\\\\"')\n .replace(/\\n/g, \"\\\\n\")\n .replace(/\\r/g, \"\\\\r\")\n .replace(/\\t/g, \"\\\\t\");\n}\n\nconst INTEGER = `${NS.xsd}integer`;\nconst INTEGER_RE = /^-?\\d+$/;\n\nfunction renderTerm(term: Term): string {\n if (term.kind === \"iri\") return shorten(term.value);\n if (term.datatype === INTEGER && INTEGER_RE.test(term.value))\n return term.value;\n const quoted = `\"${escapeLiteral(term.value)}\"`;\n if (term.language) return `${quoted}@${term.language}`;\n return term.datatype ? `${quoted}^^${shorten(term.datatype)}` : quoted;\n}\n\n/** Sort objects: IRIs before literals, each lexicographically. */\nfunction compareTerms(a: Term, b: Term): number {\n if (a.kind !== b.kind) return a.kind === \"iri\" ? -1 : 1;\n const byValue = byCodeUnit(a.value, b.value);\n if (byValue !== 0) return byValue;\n const da = a.kind === \"literal\" ? (a.datatype ?? \"\") : \"\";\n const db = b.kind === \"literal\" ? (b.datatype ?? \"\") : \"\";\n const la = a.kind === \"literal\" ? (a.language ?? \"\") : \"\";\n const lb = b.kind === \"literal\" ? (b.language ?? \"\") : \"\";\n return byCodeUnit(da, db) || byCodeUnit(la, lb);\n}\n\nexport function emitTurtle(quads: Quad[]): string {\n shortenMemo.clear();\n const lines: string[] = [];\n for (const [prefix, ns] of PREFIXES) {\n lines.push(`@prefix ${prefix}: <${ns}> .`);\n }\n\n // subject → predicate → terms\n const subjects = new Map<string, Map<string, Term[]>>();\n for (const quad of quads) {\n let preds = subjects.get(quad.s);\n if (!preds) {\n preds = new Map();\n subjects.set(quad.s, preds);\n }\n let terms = preds.get(quad.p);\n if (!terms) {\n terms = [];\n preds.set(quad.p, terms);\n }\n terms.push(quad.o);\n }\n\n // Sorting the *entries* rather than the keys: each predicate map comes out\n // of the map with the subject it belongs to, and each term list with its\n // predicate, so nothing is looked up again and nothing has to be asserted.\n const sortedSubjects = [...subjects.entries()].sort(([a], [b]) =>\n byCodeUnit(a, b),\n );\n for (const [subject, preds] of sortedSubjects) {\n const sortedPreds = [...preds.entries()].sort(([a], [b]) => {\n if (a === RDF_TYPE) return b === RDF_TYPE ? 0 : -1;\n if (b === RDF_TYPE) return 1;\n return byCodeUnit(a, b);\n });\n\n const entries = sortedPreds.map(([p, terms], i) => {\n const objects = [...terms].sort(compareTerms).map(renderTerm).join(\", \");\n const pred = p === RDF_TYPE ? \"a\" : shorten(p);\n const terminator = i === sortedPreds.length - 1 ? \" .\" : \" ;\";\n return { pred, objects, terminator };\n });\n\n // A subject is in the map only because a quad put a predicate under it, so\n // `entries` is never empty; the destructuring says so and leaves the rest\n // of the block unreachable if it ever were.\n const [first, ...rest] = entries;\n if (first === undefined) continue;\n lines.push(\"\");\n lines.push(\n `${shorten(subject)} ${first.pred} ${first.objects}${first.terminator}`,\n );\n for (const entry of rest) {\n lines.push(` ${entry.pred} ${entry.objects}${entry.terminator}`);\n }\n }\n\n return `${lines.join(\"\\n\")}\\n`;\n}\n","/**\n * Near-miss detection for the page-level keys the harvest rule reads\n * (ADR 01024, ADR 01028).\n *\n * Five page-level keys are graph inputs — `type`, `concepts`, `applies-to`,\n * `not-applicable-to`, `supersedes` — and unlike the `graph` block, nothing\n * validates them. The `graph` block is `additionalProperties: false`, so a typo\n * inside it is a hard schema error; the same typo at the page level derives\n * silently nothing, because a page may legitimately carry any other key it\n * likes (a site generator's, a linter's, an author's).\n *\n * A schema is therefore the wrong instrument: rejecting unknown page keys would\n * reject every page. What is wrong with `applies_to` is not that dockg does not\n * know it — it is that it is one character from a key dockg *does* know, on a\n * page that declares nothing else of the kind. That is what this detects, and\n * it is the whole scope: dockg does not implement the vocabularies these keys\n * belong to and must not start claiming their facts (ADR 01024).\n *\n * Warnings only. A near miss is a suspicion, not a finding, and a suspicion\n * must never fail a build.\n */\nimport { PAGE_TYPE_TO_TOPIC_TYPE } from \"./iirds.js\";\nimport { byCodeUnit } from \"./sort.js\";\nimport type { DocModel } from \"../types.js\";\n\n/**\n * The page-level keys dockg reads, in the spelling it expects.\n *\n * Five are `resolveGraph`'s harvest inputs (ADR 01024). The localization three\n * are read straight by the emitter — `lang`/`language` into `dcterms:language`,\n * `translation-of` into the schema.org translation pair (ADR 01037) — and are\n * listed here for the same reason: a typo in any of them derives nothing while\n * looking exactly like a declared fact.\n */\nexport const HARVESTED_KEYS: readonly string[] = [\n \"applies-to\",\n \"concepts\",\n \"lang\",\n \"language\",\n \"not-applicable-to\",\n \"supersedes\",\n \"translation-of\",\n \"type\",\n];\n\n/**\n * Levenshtein distance, capped: anything past `max` returns `max + 1`, since\n * the caller only cares whether a candidate is *close*.\n */\nfunction distance(a: string, b: string, max: number): number {\n if (a === b) return 0;\n if (Math.abs(a.length - b.length) > max) return max + 1;\n let prev = Array.from({ length: b.length + 1 }, (_, i) => i);\n for (let i = 1; i <= a.length; i++) {\n const row = [i];\n for (let j = 1; j <= b.length; j++) {\n row[j] = Math.min(\n (prev[j] ?? 0) + 1,\n (row[j - 1] ?? 0) + 1,\n (prev[j - 1] ?? 0) + (a[i - 1] === b[j - 1] ? 0 : 1),\n );\n }\n prev = row;\n }\n return prev[b.length] ?? max + 1;\n}\n\n/**\n * The known name a candidate was probably meant to be, or undefined.\n *\n * Distance 1 for short names, 2 for longer ones: `type` and `types` differ by\n * one and mean different things, while `not-applicable-to` can absorb two typos\n * and still be unmistakable. Separator-only differences (`applies_to`,\n * `appliesTo`) normalize to an exact match and are always caught.\n */\nfunction nearestKnown(\n candidate: string,\n known: readonly string[],\n): string | undefined {\n // Split camelCase BEFORE lowercasing — doing it after is a no-op, because\n // there is no uppercase left to match. `appliesTo` then reaches `applies-to`\n // exactly, instead of relying on the distance fallback to rescue it, and\n // `notApplicabelTo` (two typos plus a case boundary) becomes reachable at\n // all.\n const normalize = (s: string): string =>\n s\n .replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n .toLowerCase()\n .replace(/[_\\s]+/g, \"-\");\n const c = normalize(candidate);\n for (const k of known) {\n if (c === normalize(k) && candidate !== k) return k;\n }\n let best: { key: string; d: number } | undefined;\n for (const k of known) {\n const max = k.length > 8 ? 2 : 1;\n const d = distance(c, normalize(k), max);\n if (d > max) continue;\n if (!best || d < best.d) best = { key: k, d };\n }\n return best?.key;\n}\n\n/**\n * Warnings for page-level keys and page `type` values that look like harvest\n * inputs but are not. Sorted, so the output is deterministic like everything\n * else dockg emits.\n */\nexport function harvestWarnings(docs: readonly DocModel[]): string[] {\n const out: string[] = [];\n const mappedTypes = Object.keys(PAGE_TYPE_TO_TOPIC_TYPE);\n\n for (const doc of docs) {\n const fm = doc.frontmatter;\n const present = new Set(Object.keys(fm));\n\n for (const key of present) {\n if (HARVESTED_KEYS.includes(key)) continue;\n const meant = nearestKnown(key, HARVESTED_KEYS);\n // Only suspicious if the page does not already declare the real key: a\n // page carrying both `applies-to` and `applies_to` has made its choice.\n if (meant === undefined || present.has(meant)) continue;\n out.push(\n `${doc.path}: page key \"${key}\" is not read by manni graph and looks like \"${meant}\" — nothing was derived from it`,\n );\n }\n\n // A page `type` outside the map derives nothing, by design: dockg\n // references iiRDS terms and never mints them. That is correct for\n // `blog-post`, and almost never what the author meant for `how to`.\n const type = fm[\"type\"];\n // Object.hasOwn, not `in`: `type: constructor` and `type: toString` walk\n // the prototype chain and would be read as mapped types, silently skipping\n // the check.\n if (\n typeof type === \"string\" &&\n !Object.hasOwn(PAGE_TYPE_TO_TOPIC_TYPE, type)\n ) {\n const meant = nearestKnown(type, mappedTypes);\n if (meant !== undefined) {\n out.push(\n `${doc.path}: page type \"${type}\" maps to no iiRDS topic type and looks like \"${meant}\" — no graph.type was derived`,\n );\n }\n }\n }\n\n return out.sort(byCodeUnit);\n}\n","/**\n * One-pass git history collection for provenance derivation. A single\n * `git log` subprocess covers the whole corpus: per-file creation and\n * last-modification committer dates, author names, and rename chains\n * (followed backward so history accrues to the file's current path).\n * Deterministic per commit — the wall clock never enters the result.\n *\n * Author emails are deliberately not collected into the result (privacy):\n * names only, matching frontmatter author handling.\n */\nimport { GraphError } from \"../types.js\";\nimport { realExec, type ExecFn } from \"@hawkeyexl/inference\";\nimport { posix } from \"node:path\";\nimport { normalizeDocPath } from \"./iri.js\";\n\nexport interface GitFileHistory {\n /** Committer ISO date of the oldest commit touching the file (or its earlier names). */\n created?: string;\n /** Committer ISO date of the newest commit touching it. */\n modified?: string;\n /** Unique author names, newest contribution first. */\n authors: string[];\n /** Earlier paths of this file, nearest rename first (git -M heuristic; best-effort). */\n renamedFrom: string[];\n}\n\nexport interface GitHistory {\n /** HEAD committer ISO date — stamps the build activity's prov:endedAtTime. */\n headTime?: string;\n files: Map<string, GitFileHistory>;\n}\n\n/**\n * Git versions print a UTC committer date from `%cI` as either `+00:00` or\n * `Z`. Both name the same instant, so one spelling keeps the graph identical\n * whichever git wrote it. Other offsets pass through unchanged.\n */\nexport function canonicalGitTime(time: string): string {\n return time.replace(/[+-]00:00$/, \"Z\");\n}\n\n/** Record line marker: %x01 keeps commit headers unambiguous in the stream. */\nconst RECORD = \"\\u0001\";\nconst STATUS_LINE = /^([AMDRC])\\d*\\t(.+)$/;\n\n/**\n * Undo git's C-style path quoting. Even with core.quotepath=off, paths\n * containing double quotes, backslashes, or control characters arrive as\n * `\"docs/a\\\"b.md\"` — quotepath only disables quoting of non-ASCII bytes.\n * Octal escapes are raw UTF-8 bytes, decoded together at the end.\n */\nexport function unquoteGitPath(path: string): string {\n if (path.length < 2 || !path.startsWith('\"') || !path.endsWith('\"')) {\n return path;\n }\n const inner = path.slice(1, -1);\n const bytes: number[] = [];\n for (let i = 0; i < inner.length; i++) {\n // `?? \"\"` cannot fire under the loop's own bound; it is how that is said\n // without an assertion, and an empty chunk contributes no bytes anyway.\n const ch = inner[i] ?? \"\";\n if (ch !== \"\\\\\") {\n for (const byte of Buffer.from(ch, \"utf8\")) bytes.push(byte);\n continue;\n }\n const next = inner[++i];\n if (next === undefined) break;\n if (next >= \"0\" && next <= \"7\") {\n let octal = next;\n while (octal.length < 3) {\n const digit = inner[i + 1];\n if (digit === undefined || digit < \"0\" || digit > \"7\") break;\n octal += digit;\n i++;\n }\n bytes.push(Number.parseInt(octal, 8));\n } else {\n const map: Record<string, string> = { n: \"\\n\", t: \"\\t\", r: \"\\r\" };\n for (const byte of Buffer.from(map[next] ?? next, \"utf8\"))\n bytes.push(byte);\n }\n }\n return Buffer.from(bytes).toString(\"utf8\");\n}\n\n/**\n * Unset every inherited `GIT_*` variable for the child process.\n *\n * git exports GIT_DIR, GIT_INDEX_FILE, GIT_WORK_TREE and friends to the\n * subprocesses it runs — every hook, and anything spawned from one. Inheriting\n * them makes `git log` read *that* repository instead of `cwd`, so the same\n * inputs would yield a different graph depending on who invoked dockg, and a\n * build outside a repo would silently succeed against an unrelated one. Both\n * break the determinism contract, so the ambient state is dropped wholesale\n * rather than enumerated: git keeps adding variables to this namespace.\n */\nfunction clearedGitEnv(): Record<string, string | undefined> {\n const cleared: Record<string, string | undefined> = {};\n for (const key of Object.keys(process.env)) {\n if (key.startsWith(\"GIT_\")) cleared[key] = undefined;\n }\n return cleared;\n}\n\nexport async function collectGitHistory(\n cwd: string,\n exec: ExecFn = realExec,\n): Promise<GitHistory> {\n const git = async (args: string[]): Promise<string> => {\n const result = await exec([\"git\", ...args], {\n cwd,\n timeoutMs: 60000,\n env: clearedGitEnv(),\n });\n // Messages stay neutral about *why* git provenance was requested; the\n // caller frames the failure as an error or a warning.\n if (result.spawnError) {\n throw new GraphError(\n `git could not be run: ${result.spawnError} (is git installed and on PATH?)`,\n );\n }\n if (result.timedOut) {\n throw new GraphError(\n \"`git log` timed out after 60s — the repo history may be too large for whole-history provenance\",\n );\n }\n if (result.code !== 0) {\n const detail = result.stderr.trim().slice(-300);\n throw new GraphError(\n `git history could not be read (is ${cwd} a git repo with at least one commit?)${detail ? ` — git said: ${detail}` : \"\"}`,\n );\n }\n return result.stdout;\n };\n // Keys are relative to `cwd`, the directory the caller's labels count from\n // (`documentBase`). git reports paths from the repository root, so each is\n // rebased by `cwd`'s own place in the repository. `--relative` would do that\n // too, but it drops every path outside `cwd`: a page labelled `../x.md`, and\n // a rename from outside, whose fold into the current name is the point.\n const prefix = `/${(await git([\"rev-parse\", \"--show-prefix\"])).trim()}`;\n const label = (raw: string): string =>\n posix.relative(prefix, `/${normalizeDocPath(unquoteGitPath(raw))}`);\n const stdout = await git([\n \"-c\",\n \"core.quotepath=off\",\n \"log\",\n `--format=${RECORD}%H%x09%an%x09%cI`,\n \"--name-status\",\n \"-M\",\n ]);\n if (stdout.trim() === \"\") {\n throw new GraphError(\n `git history could not be read (is ${cwd} a git repo with at least one commit?)`,\n );\n }\n\n const files = new Map<string, GitFileHistory>();\n /** Maps a historical path to the file's current (newest) path. */\n const currentName = new Map<string, string>();\n let headTime: string | undefined;\n let commitAuthor = \"\";\n let commitTime = \"\";\n\n const entry = (path: string): GitFileHistory => {\n let file = files.get(path);\n if (!file) {\n file = { authors: [], renamedFrom: [] };\n files.set(path, file);\n }\n return file;\n };\n\n /** Register that the commit being parsed touched `path` (as known at that time). */\n const touch = (pathThen: string): GitFileHistory => {\n const path = label(pathThen);\n const current = currentName.get(path) ?? path;\n const file = entry(current);\n // Walking newest→oldest: first touch wins `modified`, every touch pushes\n // `created` older, authors keep first-appearance (newest) order.\n file.modified ??= commitTime;\n file.created = commitTime;\n if (!file.authors.includes(commitAuthor)) file.authors.push(commitAuthor);\n return file;\n };\n\n for (const line of stdout.split(\"\\n\")) {\n if (line.startsWith(RECORD)) {\n const [, author = \"\", rawTime = \"\"] = line.slice(1).split(\"\\t\");\n const time = canonicalGitTime(rawTime);\n commitAuthor = author;\n commitTime = time;\n headTime ??= time;\n continue;\n }\n const match = STATUS_LINE.exec(line);\n // Both groups are mandatory in the pattern, so a match carries both;\n // requiring them subsumes the bare `if (!match) continue` this replaces.\n const status = match?.[1];\n const rest = match?.[2];\n if (status === undefined || rest === undefined) continue;\n if (status === \"R\" || status === \"C\") {\n const [oldPath, newPath] = rest.split(\"\\t\");\n if (!oldPath || !newPath) continue;\n if (status === \"C\") {\n // Copies create a new file from an old one; the old file's own history\n // is separate. Record the touch on the copy only.\n touch(newPath);\n continue;\n }\n const file = touch(newPath);\n const normalizedOld = label(oldPath);\n file.renamedFrom.push(normalizedOld);\n // Older commits refer to the pre-rename path; fold them into this file.\n const normalizedNew = label(newPath);\n currentName.set(\n normalizedOld,\n currentName.get(normalizedNew) ?? normalizedNew,\n );\n } else {\n touch(rest);\n }\n }\n\n return { headTime, files };\n}\n","/**\n * `x-manni-graph-output` (proposal 0051 §5), on graph's side of the seam.\n *\n * Which fields belong in a published graph is a property of the field, not of\n * this tool, so it is recorded where the field is defined. The keyword is a\n * boolean beside a top-level property, registered on every Ajv `manni meta`\n * builds and read back through `Validator.graphOutputPreferences`. Absent means\n * `true`: every field is harvested. A mark nested inside `graph` is ignored, as\n * 0047 rule 2 ignores an `x-manni-location` there — the mark governs a\n * top-level key, and `graph` is the top-level key.\n *\n * The filter runs once, before `deriveGraph`, because all four published\n * outputs descend from what derivation produces: `emitTurtle` writes the graph,\n * and JSON-LD, the iiRDS package and the search index are all built by reading\n * that graph back. Dropping the field here keeps it out of every one of them.\n *\n * Encrypted values (proposal 0045) are harvested like any other value. graph\n * never decrypts, so what lands in the graph is the `~…` token, which says a\n * value exists and nothing about what it is. A field that should not reach a\n * published graph at all is marked `false` — one mechanism for \"keep this out\n * of the output\", rather than one rule for encryption and another for\n * everything else (0051 stress test 4).\n */\nimport type { MetaPageView } from \"../../meta/internal.js\";\nimport { errorMessage } from \"../../shared/errors.js\";\nimport { GraphError } from \"../types.js\";\nimport type { DocModel } from \"../types.js\";\n\n/**\n * `docs`, with every top-level frontmatter key its schemas mark\n * `x-manni-graph-output: false` removed.\n *\n * A page's schemas are the set `manni meta validate` resolves for it (proposal\n * 0074): its own `$schema`, then meta's overrides, `schemas:`, `strict` and\n * the default set, read from meta's section of the same config. graph keeps\n * no schema set of its own, so one config answers both what a page is checked\n * against and what its published graph may carry.\n *\n * The docs arrive with their manifests' values already merged\n * (`withExternalMetadata`), so a field kept beside the page is filtered by\n * the same mark as one kept on it.\n *\n * A document whose schemas mark nothing is returned as it came in, so the\n * common case allocates nothing.\n */\nexport async function suppressGraphOutput(\n docs: readonly DocModel[],\n sets: Pick<MetaPageView, \"validator\" | \"refsFor\">,\n): Promise<DocModel[]> {\n const out: DocModel[] = [];\n for (const doc of docs) {\n let preferences: Map<string, boolean>;\n try {\n const refs = sets.refsFor(doc.path, doc.frontmatter);\n preferences = await sets.validator.graphOutputPreferences(doc.frontmatter, refs);\n } catch (e) {\n // Loudly, and for the whole run. The schema is what decides which fields\n // a published graph may carry; a graph built while it could not be read\n // is a graph nobody checked, and quietly building one is the failure\n // this keyword exists to prevent.\n throw new GraphError(\n `${doc.path}: cannot read which fields the graph may carry: ${errorMessage(e)}`,\n );\n }\n\n const suppressed = [...preferences]\n .filter(([, allowed]) => !allowed)\n .map(([key]) => key);\n if (suppressed.length === 0) {\n out.push(doc);\n continue;\n }\n\n const frontmatter: Record<string, unknown> = { ...doc.frontmatter };\n for (const key of suppressed) Reflect.deleteProperty(frontmatter, key);\n out.push({ ...doc, frontmatter });\n }\n return out;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,SAAS,WAAW,gBAAAA,eAAc,qBAAqB;AACvD,SAAS,SAAS,eAAe;;;ACYjC,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AACtB,SAAS,oBAAoB;AAC7B,SAAS,YAAY;AASd,IAAM,oBAAoB;AAOjC,IAAM,gBAAgB;AAEtB,SAAS,O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A,QACA,GAAI,KAAK,WAAW,SAAY,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO;AAAA,QAC/D,GAAI,KAAK,aAAa,OAAO,EAAE,UAAU,KAAK,IAAI,CAAC;AAAA,MACrD,CAAC;AAAA,IACH,SAAS,GAAG;AACV,eAAS;AAAA,QACP,+EAA0E,aAAa,CAAC,CAAC;AAAA,MAC3F;AAAA,IACF;AAAA,EACF;AAEA,QAAM,QAAQ,YAAY,MAAM;AAAA,IAC9B,SAAS,OAAO;AAAA,IAChB,QAAQ,OAAO,MAAM;AAAA;AAAA;AAAA,IAGrB,aAAa,gBAAI;AAAA,IACjB;AAAA,IACA,WAAW,OAAO,WAAW;AAAA,IAC7B;AAAA,EACF,CAAC;AACD,QAAM,UAAU,GAAG,GAAG,IAAI;AAC1B,QAAM,WAAW;AAAA,IACf,OAAO,MAAM,OAAO,CAAC,MAAM,EAAE,MAAM,YAAY,EAAE,EAAE,UAAU,OAAO,EAAE;AAAA,IACtE,cAAc,iBAAiB,QAAQ;AAAA,EACzC;AACA,QAAM,SAAS,WAAW,KAAK;AAC/B,QAAM,MAAM,MAAM;AAElB,SAAO,EAAE,SAAS,MAAM,KAAK,QAAQ,OAAO,MAAM,QAAQ,UAAU,UAAU,OAAO;AACvF;","names":["readFileSync","resolve","readFileSync"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/test/errors.ts","../src/test/commands/run.ts","../src/test/core/doc-detective.ts","../src/test/core/results.ts","../src/test/reporters/summary.ts","../src/test/reporters/github.ts","../src/test/reporters/json.ts","../src/test/reporters/pretty.ts"],"sourcesContent":["import { ToolError } from \"../shared/errors.js\";\n\n/** An operational or usage error in the test domain: exit 2. */\nexport class TestError extends ToolError {\n constructor(message: string) {\n super(message);\n this.name = \"TestError\";\n }\n}\n","/**\n * `manni test run`: run Doc Detective and read its verdict from its results.\n *\n * Input precedence is positional paths, then `--collection`, then Doc\n * Detective's own config `input`. Without `--collection`, manni's collections\n * are not read: Doc Detective's config is this tool's default input.\n *\n * Doc Detective exits 0 when tests fail, so the exit code only says whether it\n * ran. The verdict is the results file it writes under `-o`, which is a temp\n * directory removed afterwards.\n */\nimport { existsSync } from \"node:fs\";\nimport { mkdtemp, readdir, readFile, rm } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { join, relative, resolve } from \"node:path\";\nimport fg from \"fast-glob\";\nimport picomatch from \"picomatch\";\nimport { selectCollections } from \"../../shared/collections.js\";\nimport { findConfigFile, readConfigFile, type ConfigFile } from \"../../shared/config-file.js\";\nimport { ToolError } from \"../../shared/errors.js\";\nimport { outputTail } from \"../../shared/exec.js\";\nimport { docDetectiveConfigPath } from \"../../shared/tools.js\";\nimport { DEFAULT_IGNORE, notFoundMessage, resolveTargetSet, STDIN_TOKEN } from \"../../meta/internal.js\";\nimport { NOT_ON_PATH, realSpawn, type DocDetectiveSpawn } from \"../core/doc-detective.js\";\nimport {\n anyFailed,\n collectFindings,\n parseResults,\n testCounts,\n type DocDetectiveResults,\n type ResultCounts,\n type TestFinding,\n} from \"../core/results.js\";\nimport { TestError } from \"../errors.js\";\n\nexport interface RunTestOptions {\n /** Positional files, directories and globs. */\n paths?: string[];\n /** `--collection <name>`, repeatable. */\n collection?: string[];\n /** `-c, --config`: a manni config file. */\n configPath?: string;\n cwd?: string;\n /** Finding no tests, or no inputs, is a pass. */\n allowEmpty?: boolean;\n /** Stream Doc Detective's output to stderr as it runs. */\n progress?: boolean;\n /** Test seam: how Doc Detective is started. */\n spawn?: DocDetectiveSpawn;\n}\n\nexport interface TestRunResult {\n /** Doc Detective's results object as it wrote it; `null` when it found no tests. */\n results: DocDetectiveResults | null;\n /** Every FAIL and WARNING step. */\n findings: TestFinding[];\n /** The test-level counts. */\n tests: ResultCounts;\n /** 1 when anything failed. */\n exitCode: 0 | 1;\n}\n\n/** What Doc Detective finds on its own in the working directory. */\nconst DOC_DETECTIVE_CONFIG_NAMES = [\".doc-detective.json\", \".doc-detective.yaml\", \".doc-detective.yml\"];\n\nconst NO_RESULTS = \"Doc Detective wrote no results to read. Run doc-detective directly to see why.\";\n\n/** A run with nothing to report; a fresh object each time, so no caller shares one. */\nfunction empty(results: DocDetectiveResults | null = null): TestRunResult {\n return { results, findings: [], tests: { pass: 0, fail: 0, warning: 0, skipped: 0 }, exitCode: 0 };\n}\n\nconst toError = (message: string): Error => new TestError(message);\n\n/** A sibling's `ToolError` (meta's walk, say) reported as this domain's. */\nasync function asTestError<T>(work: () => Promise<T>): Promise<T> {\n try {\n return await work();\n } catch (err) {\n if (err instanceof ToolError && !(err instanceof TestError)) throw new TestError(err.message);\n throw err;\n }\n}\n\nasync function loadConfig(cwd: string, configPath: string | undefined): Promise<ConfigFile | null> {\n const opts = { section: \"test\", legacyNames: [], toError };\n const file =\n configPath === undefined ? await findConfigFile(cwd, opts) : await readConfigFile(configPath, cwd, opts);\n // The domain has no keys of its own, so a `test:` section is a setting that\n // would otherwise read as configured and do nothing.\n if (file !== null && file.wrapped && file.value !== null) {\n throw new TestError(\n `${file.source}: test has no keys. Doc Detective's settings live under tools.doc-detective.`,\n );\n }\n return file;\n}\n\n/**\n * Positional inputs as Doc Detective takes them. Files and directories go as\n * typed, and Doc Detective walks a directory itself. A glob is expanded here.\n * A name that does not exist is refused, because Doc Detective skips one in\n * silence.\n */\nasync function positionalInputs(paths: string[], cwd: string, allowEmpty: boolean): Promise<string[]> {\n const inputs: string[] = [];\n const missing: string[] = [];\n for (const path of paths) {\n const posix = path.replace(/\\\\/g, \"/\");\n if (existsSync(resolve(cwd, posix))) {\n inputs.push(path);\n } else if (picomatch.scan(posix).isGlob) {\n const found = await fg(posix, { cwd, ignore: DEFAULT_IGNORE, onlyFiles: true, dot: false });\n inputs.push(...found.sort());\n } else {\n missing.push(posix);\n }\n }\n if (missing.length > 0 && !allowEmpty) throw new TestError(notFoundMessage(missing));\n return inputs;\n}\n\n/** The selected collections' files, minus their excludes, relative to `cwd`. */\nasync function collectionInputs(\n file: ConfigFile,\n names: string[],\n cwd: string,\n allowEmpty: boolean,\n): Promise<string[]> {\n const collections = selectCollections(file.collections, names, file.source, toError);\n const { files } = await asTestError(() =>\n resolveTargetSet({\n inputs: collections.flatMap((c) => c.paths),\n exclude: collections.flatMap((c) => c.exclude),\n cwd: file.dir,\n allowEmpty,\n }),\n );\n return files.map((f) => relative(cwd, resolve(file.dir, f)).replace(/\\\\/g, \"/\"));\n}\n\nasync function readResults(outDir: string): Promise<DocDetectiveResults | null> {\n const names = (await readdir(outDir)).filter((n) => /^testResults-.*\\.json$/.test(n)).sort();\n const last = names.at(-1);\n if (last === undefined) throw new TestError(NO_RESULTS);\n const results = parseResults(await readFile(join(outDir, last), \"utf8\"));\n if (results === undefined) throw new TestError(NO_RESULTS);\n return results;\n}\n\nexport async function runTest(opts: RunTestOptions = {}): Promise<TestRunResult> {\n const cwd = resolve(opts.cwd ?? process.cwd());\n const paths = opts.paths ?? [];\n const wanted = opts.collection ?? [];\n const allowEmpty = opts.allowEmpty ?? false;\n\n if (paths.includes(STDIN_TOKEN)) {\n throw new TestError(\"test run reads files; Doc Detective has no stdin. Pass a path.\");\n }\n // lint's two sentences: a collection is a set the operator did not type, so\n // it composes with no typed path, and only a config can define one.\n if (wanted.length > 0 && paths.length > 0) {\n throw new TestError(\n \"--collection selects a configured collection; it cannot be combined with paths.\",\n );\n }\n const file = await loadConfig(cwd, opts.configPath);\n if (wanted.length > 0 && file === null) {\n throw new TestError(\"--collection needs a config file to select from.\");\n }\n\n // The path as written names the file in the refusal; the resolved one is\n // what Doc Detective is given.\n const written = file?.tools[\"doc-detective\"]?.config;\n let ddConfig: string | undefined;\n if (file !== null && written !== undefined) {\n ddConfig = docDetectiveConfigPath(file.tools, file.dir);\n if (ddConfig !== undefined && !existsSync(ddConfig)) {\n throw new TestError(`${file.source}: tools.doc-detective.config \"${written}\" does not exist.`);\n }\n }\n\n let inputs: string[] | undefined;\n if (paths.length > 0) {\n inputs = await positionalInputs(paths, cwd, allowEmpty);\n if (inputs.length === 0) {\n if (allowEmpty) return empty();\n const tried = paths.map((p) => `\"${p}\"`).join(\", \");\n throw new TestError(\n `No files matched. Patterns tried: ${tried}. Pass --allow-empty if that is expected.`,\n );\n }\n } else if (file !== null && wanted.length > 0) {\n inputs = await collectionInputs(file, wanted, cwd, allowEmpty);\n if (inputs.length === 0) {\n if (allowEmpty) return empty();\n throw new TestError(\"--collection matched no files. Pass --allow-empty if that is expected.\");\n }\n } else if (\n ddConfig === undefined &&\n !DOC_DETECTIVE_CONFIG_NAMES.some((name) => existsSync(join(cwd, name)))\n ) {\n throw new TestError(\n \"test run needs paths or a Doc Detective config. Pass paths, or add .doc-detective.json.\",\n );\n }\n\n const outDir = await mkdtemp(join(tmpdir(), \"manni-test-\"));\n try {\n const args = [\n // ponytail: Doc Detective splits -i on commas, so a path holding a comma\n // is two inputs. Upgrade path: a generated config whose input is a list.\n ...(inputs === undefined ? [] : [\"-i\", inputs.join(\",\")]),\n ...(ddConfig === undefined ? [] : [\"-c\", ddConfig]),\n \"-r\",\n \"json\",\n \"-o\",\n outDir,\n ];\n const run = await (opts.spawn ?? realSpawn)(args, { cwd, progress: opts.progress ?? false });\n if (run.spawnError !== undefined) throw new TestError(NOT_ON_PATH);\n if (run.code !== 0) {\n const how = run.code === null ? \"killed before exiting\" : `exit ${String(run.code)}`;\n throw new TestError(`Doc Detective failed (${how}):\\n${outputTail(run)}`);\n }\n\n const results = await readResults(outDir);\n const tests = testCounts(results);\n const total = tests.pass + tests.fail + tests.warning + tests.skipped;\n // A `null` results file counts as zero tests, so `total` covers it.\n if (total === 0) {\n if (allowEmpty) return empty(results);\n throw new TestError(\n \"Doc Detective found no tests in the inputs. Pass --allow-empty if that is expected.\",\n );\n }\n return {\n results,\n findings: collectFindings(results, cwd),\n tests,\n exitCode: anyFailed(results) ? 1 : 0,\n };\n } finally {\n await rm(outDir, { recursive: true, force: true });\n }\n}\n","/**\n * The Doc Detective process seam: the only module that starts `doc-detective`.\n * Unit tests inject a `DocDetectiveSpawn`; the real one is `realSpawn`.\n *\n * On Windows an npm global install puts a `.cmd` shim on PATH, and `cmd.exe`\n * caps the command line it runs at 8191 characters, which a collection of a\n * few hundred pages passes. So the bin script the shim points at is run with\n * node directly. Only when no script sits beside the shim does the shim run,\n * through `realExec`, which knows how to start one without a shell.\n */\nimport { spawn } from \"node:child_process\";\nimport { statSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { ExecResult } from \"@hawkeyexl/inference\";\nimport { realExec } from \"../../shared/exec.js\";\nimport { TestError } from \"../errors.js\";\n\n/**\n * Start Doc Detective with `args` (its own flags, no program name) and wait\n * for it. `progress` streams its output to stderr as it runs; the output is\n * captured either way.\n */\nexport type DocDetectiveSpawn = (\n args: string[],\n opts: { cwd: string; progress: boolean },\n) => Promise<ExecResult>;\n\n/** How Doc Detective is started on this host. */\nexport interface Launch {\n command: string;\n args: string[];\n /** Started through a Windows `.cmd` shim, so `cmd.exe`'s cap applies. */\n viaShim: boolean;\n}\n\nexport const NOT_ON_PATH =\n \"doc-detective is not on PATH. Install Doc Detective (npm install -g doc-detective) to run doc tests.\";\n\nconst COMMAND_LINE_LIMIT =\n \"the selected inputs exceed the command-line limit. Narrow the collection, or set input in the Doc Detective config.\";\n\n/** No timeout: a docs suite runs as long as its tests do. */\nconst NO_TIMEOUT = 2 ** 31 - 1;\n\nexport function launchFor(\n args: string[],\n host: { platform: NodeJS.Platform; path: string; isFile: (path: string) => boolean },\n): Launch {\n if (host.platform !== \"win32\") return { command: \"doc-detective\", args, viaShim: false };\n // Windows lets a PATH entry be quoted, as in \"C:\\Program Files\\nodejs\".\n for (const entry of host.path.split(\";\")) {\n const dir = entry.replace(/^\"(.*)\"$/, \"$1\");\n if (dir === \"\" || !host.isFile(join(dir, \"doc-detective.cmd\"))) continue;\n const script = join(dir, \"node_modules\", \"doc-detective\", \"bin\", \"doc-detective.js\");\n if (host.isFile(script)) {\n return { command: process.execPath, args: [script, ...args], viaShim: false };\n }\n break;\n }\n return { command: \"doc-detective\", args, viaShim: true };\n}\n\n/**\n * Refuse a command line Windows would truncate or reject.\n *\n * ponytail: Windows caps a command line at 32,767 characters, and at 8,191\n * through a `.cmd` shim. Past the cap the run is refused. The upgrade path is\n * running the inputs in batches and merging the results files.\n */\nexport function assertFitsCommandLine(launch: Launch, platform: NodeJS.Platform): void {\n if (platform !== \"win32\") return;\n // Each argument costs its quotes and the space before it.\n const length = [launch.command, ...launch.args].reduce((n, arg) => n + arg.length + 3, 0);\n if (length > (launch.viaShim ? 8_191 : 32_767)) throw new TestError(COMMAND_LINE_LIMIT);\n}\n\nfunction isFile(path: string): boolean {\n try {\n return statSync(path).isFile();\n } catch {\n return false;\n }\n}\n\nfunction streamed(launch: Launch, opts: { cwd: string; progress: boolean }): Promise<ExecResult> {\n return new Promise((settle) => {\n let stdout = \"\";\n let stderr = \"\";\n const child = spawn(launch.command, launch.args, {\n cwd: opts.cwd,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n windowsHide: true,\n });\n child.stdout.setEncoding(\"utf8\");\n child.stderr.setEncoding(\"utf8\");\n child.stdout.on(\"data\", (chunk: string) => {\n stdout += chunk;\n if (opts.progress) process.stderr.write(chunk);\n });\n child.stderr.on(\"data\", (chunk: string) => {\n stderr += chunk;\n if (opts.progress) process.stderr.write(chunk);\n });\n child.on(\"error\", (err) => {\n settle({ code: null, stdout, stderr, timedOut: false, spawnError: err.message });\n });\n child.on(\"close\", (code) => {\n settle({ code, stdout, stderr, timedOut: false });\n });\n });\n}\n\nexport const realSpawn: DocDetectiveSpawn = async (args, opts) => {\n const launch = launchFor(args, {\n platform: process.platform,\n path: process.env[\"PATH\"] ?? \"\",\n isFile,\n });\n assertFitsCommandLine(launch, process.platform);\n if (!launch.viaShim) return streamed(launch, opts);\n // ponytail: the shim path captures and replays rather than streaming live.\n // It runs only when a shim has no bin script beside it.\n const result = await realExec([launch.command, ...launch.args], {\n cwd: opts.cwd,\n timeoutMs: NO_TIMEOUT,\n });\n if (opts.progress) process.stderr.write(result.stdout + result.stderr);\n return result;\n};\n","/**\n * Doc Detective's results file, read across a process boundary.\n *\n * The object is kept as Doc Detective wrote it, because `-f json` prints it\n * verbatim. Only the parts the verdict and the reports need are checked: the\n * test-level counts, and each step's result, description and line.\n */\nimport { relative } from \"node:path\";\n\n/** One level's counts in Doc Detective's `summary`. */\nexport interface ResultCounts {\n pass: number;\n fail: number;\n warning: number;\n skipped: number;\n}\n\n/** Doc Detective's results object, as it wrote it. */\nexport type DocDetectiveResults = Record<string, unknown>;\n\n/** A step that FAILed or WARNed, named by the page it came from. */\nexport interface TestFinding {\n /** The page, posix and relative to the run's working directory. */\n file: string;\n /** The step's line in the page, when Doc Detective located it. */\n line?: number;\n result: \"FAIL\" | \"WARNING\";\n description: string;\n}\n\nexport const ZERO_COUNTS: ResultCounts = { pass: 0, fail: 0, warning: 0, skipped: 0 };\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction records(value: unknown): Record<string, unknown>[] {\n return Array.isArray(value) ? value.filter(isRecord) : [];\n}\n\nfunction counts(value: unknown): ResultCounts | undefined {\n if (!isRecord(value)) return undefined;\n const out = { ...ZERO_COUNTS };\n for (const key of Object.keys(out) as (keyof ResultCounts)[]) {\n const n = value[key];\n if (typeof n !== \"number\") return undefined;\n out[key] = n;\n }\n return out;\n}\n\n/**\n * Parse a results file. `null` is what Doc Detective writes when it found no\n * tests. `undefined` is a file that is not a results object at all.\n */\nexport function parseResults(text: string): DocDetectiveResults | null | undefined {\n let parsed: unknown;\n try {\n parsed = JSON.parse(text);\n } catch {\n return undefined;\n }\n if (parsed === null) return null;\n if (!isRecord(parsed) || !isRecord(parsed[\"summary\"])) return undefined;\n if (counts(parsed[\"summary\"][\"tests\"]) === undefined) return undefined;\n if (!Array.isArray(parsed[\"specs\"])) return undefined;\n return parsed;\n}\n\n/** The test-level counts, which the summary line reports. */\nexport function testCounts(results: DocDetectiveResults | null): ResultCounts {\n if (results === null || !isRecord(results[\"summary\"])) return { ...ZERO_COUNTS };\n return counts(results[\"summary\"][\"tests\"]) ?? { ...ZERO_COUNTS };\n}\n\n/** Whether anything failed, at any level Doc Detective counts. */\nexport function anyFailed(results: DocDetectiveResults | null): boolean {\n if (results === null) return false;\n const summary = results[\"summary\"];\n if (!isRecord(summary)) return false;\n return Object.values(summary).some((level) => (counts(level)?.fail ?? 0) > 0);\n}\n\n/** Every FAIL and WARNING step, in the order Doc Detective ran them. */\nexport function collectFindings(results: DocDetectiveResults | null, cwd: string): TestFinding[] {\n if (results === null) return [];\n const out: TestFinding[] = [];\n for (const spec of records(results[\"specs\"])) {\n for (const test of records(spec[\"tests\"])) {\n const contentPath = test[\"contentPath\"] ?? spec[\"contentPath\"];\n // Without a contentPath the file is unknown, and `\"\"` says so: the\n // github reporter then leaves `file=` off the annotation. A URL input\n // is reported as Doc Detective names it; only a file path is relative.\n const file =\n typeof contentPath !== \"string\"\n ? \"\"\n : /^[a-z][a-z0-9+.-]*:\\/\\//i.test(contentPath)\n ? contentPath\n : relative(cwd, contentPath).replace(/\\\\/g, \"/\");\n for (const context of records(test[\"contexts\"])) {\n for (const step of records(context[\"steps\"])) {\n const result = step[\"result\"];\n if (result !== \"FAIL\" && result !== \"WARNING\") continue;\n const location = step[\"location\"];\n const line = isRecord(location) ? location[\"line\"] : undefined;\n const description = step[\"resultDescription\"];\n out.push({\n file,\n ...(typeof line === \"number\" ? { line } : {}),\n result,\n description: typeof description === \"string\" ? description : \"\",\n });\n }\n }\n }\n }\n return out;\n}\n","import type { ResultCounts } from \"../core/results.js\";\n\n/** `2 tests: 1 passed, 1 failed, 0 warnings, 0 skipped`, test-level counts. */\nexport function summaryLine(tests: ResultCounts): string {\n const total = tests.pass + tests.fail + tests.warning + tests.skipped;\n const plural = (n: number, word: string): string => `${String(n)} ${word}${n === 1 ? \"\" : \"s\"}`;\n return `${plural(total, \"test\")}: ${String(tests.pass)} passed, ${String(tests.fail)} failed, ${plural(tests.warning, \"warning\")}, ${String(tests.skipped)} skipped`;\n}\n","import {\n escapeWorkflowCommandMessage,\n escapeWorkflowCommandProperty,\n} from \"../../shared/github.js\";\nimport type { TestRunResult } from \"../commands/run.js\";\nimport { summaryLine } from \"./summary.js\";\n\n/** One workflow command per FAIL or WARNING step, then the summary line. */\nexport function renderGithub(result: TestRunResult): string {\n const commands = result.findings.map((f) => {\n const level = f.result === \"FAIL\" ? \"error\" : \"warning\";\n const props = [\n ...(f.file === \"\" ? [] : [`file=${escapeWorkflowCommandProperty(f.file)}`]),\n ...(f.line === undefined ? [] : [`line=${String(f.line)}`]),\n \"title=Doc Detective\",\n ].join(\",\");\n return `::${level} ${props}::${escapeWorkflowCommandMessage(f.description)}`;\n });\n return [...commands, summaryLine(result.tests)].join(\"\\n\");\n}\n","import type { TestRunResult } from \"../commands/run.js\";\n\n/**\n * Doc Detective's results object, verbatim, so a script written against its\n * schema reads manni's output unchanged. `null` when it found no tests.\n */\nexport function renderJson(result: TestRunResult): string {\n return JSON.stringify(result.results, null, 2);\n}\n","import { palette } from \"../../shared/color.js\";\nimport type { TestRunResult } from \"../commands/run.js\";\nimport type { TestFinding } from \"../core/results.js\";\nimport { summaryLine } from \"./summary.js\";\n\n/**\n * Each FAIL and WARNING step under its page, with its line, then the\n * test-level summary. A run with neither prints the summary alone.\n */\nexport function renderPretty(result: TestRunResult, opts: { color: boolean }): string {\n const c = palette(opts.color);\n const byFile = new Map<string, TestFinding[]>();\n for (const finding of result.findings) {\n const list = byFile.get(finding.file);\n if (list === undefined) byFile.set(finding.file, [finding]);\n else list.push(finding);\n }\n const width = Math.max(0, ...result.findings.map((f) => String(f.line ?? \"\").length));\n const blocks = [...byFile].map(([file, findings]) =>\n [\n c.bold(file),\n ...findings.map((f) => {\n const label = f.result.padEnd(7);\n const tag = f.result === \"FAIL\" ? c.red(label) : c.yellow(label);\n return ` ${String(f.line ?? \"\").padStart(width)} ${tag} ${f.description}`;\n }),\n ].join(\"\\n\"),\n );\n return [...blocks, summaryLine(result.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AAM,SAAS,CAAC,GAAG,MAAM,EAAE;AAAA,IAAI,CAAC,CAAC,MAAM,QAAQ,MAC7C;AAAA,MACE,EAAE,KAAK,IAAI;AAAA,MACX,GAAG,SAAS,IAAI,CAAC,MAAM;AACrB,cAAM,QAAQ,EAAE,OAAO,OAAO,CAAC;AAC/B,cAAM,MAAM,EAAE,WAAW,SAAS,EAAE,IAAI,KAAK,IAAI,EAAE,OAAO,KAAK;AAC/D,eAAO,KAAK,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,KAAK,CAAC,KAAK,GAAG,KAAK,EAAE,WAAW;AAAA,MAC5E,CAAC;AAAA,IACH,EAAE,KAAK,IAAI;AAAA,EACb;AACA,SAAO,CAAC,GAAG,QAAQ,YAAY,OAAO,KAAK,CAAC,EAAE,KAAK,MAAM;AAC3D;","names":["join","relative","relative","join"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lint/core/rule-id.ts","../src/lint/reporters/junit.ts","../src/lint/reporters/template-context.ts","../src/lint/reporters/sarif.ts","../src/lint/reporters/alignment.ts","../src/lint/reporters/index.ts"],"sourcesContent":["/**\n * A finding's **rule identity**: `manni:lint/<job>/<rule>`.\n *\n * One id, in one place, for every consumer that files or correlates findings -\n * the SARIF `ruleId`, the JUnit `<failure type>`, the GitHub annotation's\n * `title`, and the `ruleId` the JSON reporter carries beside `type`. A rule id\n * is durable by contract: rename one and every historical alert in a\n * dashboard closes, then reopens as new.\n *\n * Three segments rather than cite's two. The job is what makes a second lint\n * tool possible without collisions: a prose job will report\n * `manni:lint/prose/Google.Passive`, keeping Vale's own rule name because that\n * is the name Vale's documentation uses, and nothing about it can be confused\n * with a structure rule. Proposal 0050 records the shape, and warns that\n * anything parsing family rule ids must not assume two segments.\n *\n * The rule half is derived from the finding's `type` rather than authored\n * beside it. `type` is already the machine-readable name the JSON reporter\n * publishes - manni docevals' grader reads it - so a hand-maintained second\n * table would be one more thing to keep in step, and the derivation cannot\n * drift. `_error` is dropped because it says only that a finding is a finding;\n * `heading_pattern_error` is the rule \"heading-pattern\".\n */\nimport type { LintJob } from \"./config.js\";\n\n/** Every lint rule id starts here. */\nexport const RULE_ID_PREFIX = \"manni:lint\";\n\n/** The tool that performs the structure job, reported beside every finding. */\nexport const TOOL_NAME = \"manni\";\n\n/** The job every finding in this pipeline reports under. */\nexport const STRUCTURE_JOB: LintJob = \"structure\";\n\n/**\n * `heading_pattern_error` -> `heading-pattern`; `parse_error` -> `parse`.\n *\n * Only a trailing `_error` is dropped, so a rule that is genuinely *about*\n * errors keeps the word.\n */\nexport function ruleName(type: string): string {\n return type.replace(/_error$/, \"\").replace(/_/g, \"-\");\n}\n\n/** `manni:lint/<job>/<rule>` for one finding `type`. */\nexport function ruleId(type: string, job: LintJob = STRUCTURE_JOB): string {\n return `${RULE_ID_PREFIX}/${job}/${ruleName(type)}`;\n}\n","/**\n * JUnit XML, rendered through **meta's** writer rather than a second one.\n *\n * There is no authoritative JUnit schema, and the escaping is the part a\n * hand-rolled writer gets wrong - XML 1.0 forbids characters that sit quite\n * happily in a JavaScript string, and one of them makes the whole document\n * unparseable rather than merely mis-rendered. That work is done once, in\n * `src/meta/reporters/junit.ts`, and cite already rides it. So does lint:\n * adapt the run onto meta's `ValidationResult`, hand it to that writer, and\n * the family ships one XML writer, one escaping rule, and one\n * testcase-per-file convention.\n *\n * What is lint's is the two strings that identify the findings as lint's:\n * the `classname` on every `<testcase>`, and the `<failure type>`, which is\n * the namespaced rule id.\n */\nimport {\n isErrorSeverity,\n renderJunit as renderJunitXml,\n type FieldError,\n type ValidationResult,\n} from \"../../meta/index.js\";\nimport { RULE_ID_PREFIX, ruleName, STRUCTURE_JOB } from \"../core/rule-id.js\";\nimport type { LintRun } from \"../commands/lint.js\";\n\n/** JUnit `classname` for this tool's findings, as cite's is `manni.cite`. */\nconst JUNIT_CLASSNAME = \"manni.lint\";\n\n/**\n * One finding as a `FieldError`.\n *\n * `schema` and `keyword` are split where they are because meta's `ruleIdFor`\n * joins them with a `/`, and the id it has to produce is\n * `manni:lint/<job>/<rule>`. The prefix is the schema half and stays one\n * segment, which is what keeps it a built-in-shaped ref: a ref containing a\n * slash classifies as a local file, and a caller that passed a path frame\n * would see it rewritten into a relative path. The job and the rule travel\n * together as the keyword.\n *\n * `instancePath` is `\"\"`, the whole document. A structural finding is about a\n * document's shape and not about a pointer into its metadata, so there is no\n * honest pointer to give; meta spells that `(root)`, as it does for its own\n * parse failures. The section the finding is anchored to is already in the\n * message.\n */\nfunction toFieldError(\n finding: LintRun[\"results\"][number][\"findings\"][number],\n): FieldError {\n return {\n schema: RULE_ID_PREFIX,\n instancePath: \"\",\n message:\n finding.heading != null\n ? `${finding.heading}: ${finding.message}`\n : finding.message,\n keyword: `${STRUCTURE_JOB}/${ruleName(finding.type)}`,\n severity: finding.severity,\n line: finding.position.start.line,\n col: finding.position.start.column,\n };\n}\n\n/**\n * The files this run actually checked, as meta's results.\n *\n * The skipped ones are **not** here, and that is the one place this reporter\n * parts company with the others. A skip has to be reported, or a file nothing\n * looked at is indistinguishable from a file that passed - so pretty says so\n * in words and SARIF files a `toolExecutionNotification`. JUnit has neither:\n * meta's writer emits a testcase or a testcase with a failure, so a skipped\n * file can only arrive as a green test. That is worse than absent. It claims a\n * pass on evidence nobody gathered, and it puts the suite's `tests` count three\n * above the `2 files checked, 3 skipped` the same run prints.\n *\n * So the count here is the run's `checked`, by construction: one testcase per\n * file that was linted.\n */\nexport function toValidationResults(run: LintRun): ValidationResult[] {\n return run.results\n .filter((result) => result.skipped == null)\n .map((result) => ({\n file: result.file,\n // meta's `format` is the extractor that read the file. A lint result does\n // not carry the parser that produced its tree, and no reporter reached\n // through here reads the field, so it names the domain rather than\n // inventing a format the run never recorded.\n format: \"lint\",\n // meta's invariant, not a count: `ok` is \"no error-severity finding\".\n // Read as \"no findings at all\", a file whose only finding is a warning\n // renders as a `✗` through meta's own pretty reporter - which is a\n // legitimate consumer, since this function is exported - while lint's\n // exit code says the run passed.\n ok: !result.findings.some(isErrorSeverity),\n schemas: [RULE_ID_PREFIX],\n errors: result.findings.map(toFieldError),\n }));\n}\n\n/**\n * Straight to meta's JUnit writer rather than through its `render`, which\n * takes a `RunSummary` its junit branch does not forward. Building one here\n * only to have it dropped read as though the suite's counts came from the run,\n * and they do not: they are the length of the list above and how much of it\n * carries an error-severity finding.\n */\nexport function renderJunit(run: LintRun): string {\n return renderJunitXml(toValidationResults(run), {\n classname: JUNIT_CLASSNAME,\n });\n}\n","/**\n * The lines printed under a finding to say what its template asks for. The\n * pretty, GitHub and SARIF reports share them, so all three say it the same\n * way.\n */\nimport type { Finding } from \"../types.js\";\n\n/**\n * The template, the rule and its description, then the template's guide.\n * Empty when no template stands behind the finding.\n */\nexport function templateLines(finding: Finding): string[] {\n const t = finding.template;\n if (t == null) return [];\n const rule = t.rule === null ? \"\" : ` ${t.rule}`;\n const description = t.description === null ? \"\" : `: ${t.description}`;\n const head = `${t.id}${rule}${description}`;\n return t.guide === null ? [head] : [head, `Guide: ${t.guide}`];\n}\n","/**\n * SARIF 2.1.0, the format GitHub code scanning ingests.\n *\n * `github` annotations live and die with one check run: no history, nothing to\n * query, and nothing outside GitHub Actions reads them at all. SARIF is the\n * same findings as a durable artifact - uploaded once, tracked across commits,\n * and understood by every dashboard that speaks the standard.\n *\n * The format's failure mode is silence. A SARIF file with a malformed URI, or\n * with results whose `ruleId` names no declared rule, uploads successfully and\n * then annotates nothing: a green check and an empty dashboard. So the two\n * things most likely to be wrong are the two things this module is most\n * careful about - rule descriptors, and URIs.\n */\nimport type {\n Finding,\n FindingTemplate,\n Position,\n Severity,\n SkipReason,\n} from \"../types.js\";\nimport type { LintFileResult, LintRun } from \"../commands/lint.js\";\nimport { ruleId, ruleName } from \"../core/rule-id.js\";\nimport { templateLines } from \"./template-context.js\";\nimport pkg from \"../../../package.json\" with { type: \"json\" };\nimport {\n artifactLocation,\n fileUri,\n normalizeRoot,\n URI_BASE_ID,\n type ArtifactLocation,\n} from \"../../shared/sarif-location.js\";\n\nconst SARIF_VERSION = \"2.1.0\";\nconst SARIF_SCHEMA =\n \"https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/schemas/sarif-schema-2.1.0.json\";\n/**\n * Where code scanning sends someone who clicks \"more information\" on an alert.\n *\n * Deliberately the post-rename URL, which 404s until `doc-structure-lint` is\n * renamed on GitHub - a manual step outside this repo. Pointing it at the\n * current name instead would mean every SARIF report published from the day of\n * the rename onward links somewhere that has moved, and reports outlive the\n * rename; a link that is briefly wrong beats one that is permanently wrong.\n * `package.json`'s `repository` and `bugs` URLs are forward-looking for the\n * same reason, so all three flip together or not at all.\n */\nconst INFORMATION_URI = \"https://github.com/hawkeyexl/manni\";\n\ntype SarifLevel = \"error\" | \"warning\" | \"note\" | \"none\";\n\ninterface SarifMessage {\n text: string;\n}\n\ninterface ReportingDescriptor {\n id: string;\n name: string;\n shortDescription: SarifMessage;\n defaultConfiguration?: { level: SarifLevel };\n}\n\ninterface Region {\n startLine: number;\n startColumn: number;\n endLine: number;\n endColumn: number;\n}\n\ninterface SarifLocation {\n physicalLocation: { artifactLocation: ArtifactLocation; region?: Region };\n}\n\ninterface SarifResult {\n ruleId: string;\n ruleIndex?: number;\n level: SarifLevel;\n message: SarifMessage;\n locations: SarifLocation[];\n properties?: { heading?: string; template?: FindingTemplate };\n}\n\ninterface SarifNotification {\n descriptor: { id: string; index: number };\n level: SarifLevel;\n message: SarifMessage;\n locations: SarifLocation[];\n}\n\ninterface SarifInvocation {\n executionSuccessful: boolean;\n toolExecutionNotifications?: SarifNotification[];\n}\n\ninterface SarifDriver {\n name: string;\n informationUri: string;\n version: string;\n rules: ReportingDescriptor[];\n notifications?: ReportingDescriptor[];\n}\n\ninterface SarifLog {\n $schema: string;\n version: string;\n runs: {\n tool: { driver: SarifDriver };\n originalUriBaseIds: Record<string, { uri: string }>;\n invocations: SarifInvocation[];\n results: SarifResult[];\n }[];\n}\n\nexport interface SarifOptions {\n /**\n * Directory the relative paths in `LintRun` are relative to - the lint run's\n * `cwd`. Defaults to the process cwd, which is what `runLint` itself\n * defaults to. It is a parameter rather than a bare read of `process.cwd()`\n * so the URI mapping, the part most likely to be silently wrong, is testable\n * without moving the whole process into a fixture directory.\n */\n root?: string;\n}\n\n/**\n * The family scale -> SARIF `level`. A total map rather than a ternary, so a\n * fourth severity fails to compile here instead of quietly becoming `error`.\n *\n * The family's three values were chosen to be GitHub's, and SARIF agrees on\n * two of them; it spells the lowest one `note`. meta's reporter folds\n * `notice` onto `note` the same way, so a repository uploading both tools'\n * reports sees one scale. SARIF's `none` has no `Severity` that means it.\n */\nconst LEVELS: Record<Severity, SarifLevel> = {\n notice: \"note\",\n warning: \"warning\",\n error: \"error\",\n};\n\n/**\n * Why a file went unlinted, in words. `Record<SkipReason, ...>` on purpose: a\n * new skip reason should fail to compile until someone has decided what the\n * report says about it.\n */\nconst SKIP_DESCRIPTIONS: Record<SkipReason, string> = {\n \"no-template\": \"File was not linted: no template resolved for it.\",\n \"unsupported-format\": \"File was not linted: no parser handles its format.\",\n unreadable: \"File was not linted: it could not be read.\",\n};\n\n/**\n * Positions map straight across, with no arithmetic.\n *\n * Both sides are 1-based in line and column. Both also treat the end column as\n * exclusive: SARIF defines `endColumn` as \"the column number of the character\n * following the end of the region\", and `Position` in types.ts is documented\n * as a half-open span with `end` exclusive. Checked against what the parser\n * actually emits rather than taken on trust - remark gives `# Hi`, four\n * characters on line 1, an `end.column` of 5, one past the last character,\n * which is precisely SARIF's convention. So no +1 and no -1 in either\n * direction. A zero-width span (`origin()`, used by findings with nowhere\n * better to point) becomes a zero-length region, which SARIF allows.\n */\nfunction region(position: Position): Region {\n return {\n startLine: position.start.line,\n startColumn: position.start.column,\n endLine: position.end.line,\n endColumn: position.end.column,\n };\n}\n\nfunction location(\n file: string,\n root: string,\n position?: Position,\n): SarifLocation {\n return {\n physicalLocation: {\n artifactLocation: artifactLocation(file, root),\n region: position ? region(position) : undefined,\n },\n };\n}\n\n/**\n * The heading goes in the message *and* in `properties`.\n *\n * In the message because most SARIF viewers show the message and nothing else\n * beside the line: \"Expected at least 2 paragraphs, found 1\" is a different\n * sentence depending on which section it is about, and dropping the heading\n * would make the SARIF annotation less informative than the `github` one for\n * the very same finding. In `properties.heading` because a message is prose\n * and nothing can group or filter on it - a consumer asking for \"every finding\n * under Prerequisites\" should not have to parse English back out.\n *\n * Unlike `renderGithub`, newlines are left intact. A workflow command is one\n * line by definition; a SARIF message is a JSON string with no such limit.\n */\nfunction messageText(finding: Finding): string {\n const text =\n finding.heading != null ? `${finding.heading}: ${finding.message}` : finding.message;\n return [text, ...templateLines(finding)].join(\"\\n\");\n}\n\nfunction words(id: string): string[] {\n return id.split(/[^A-Za-z0-9]+/).filter(Boolean);\n}\n\n/**\n * `missing_section` -> `MissingSection`. SARIF asks a descriptor `name` to be\n * a single Pascal-case identifier, and GitHub shows it in the rule list.\n */\nfunction pascalCase(id: string): string {\n return words(id)\n .map((w) => w.charAt(0).toUpperCase() + w.slice(1))\n .join(\"\");\n}\n\n/**\n * `missing_section` -> `Missing section`. Derived from the id, not authored:\n * there is no rule catalog to draw a real description from, and the first\n * finding's message describes one occurrence rather than the rule. Restating\n * the id in prose says nothing new, but it beats an empty column in GitHub's\n * rule list and it can never drift out of step with the rule it describes.\n */\nfunction humanize(id: string): string {\n const text = words(id).join(\" \");\n return text.charAt(0).toUpperCase() + text.slice(1);\n}\n\ninterface RuleIndex {\n descriptors: ReportingDescriptor[];\n indexOf: Map<string, number>;\n}\n\n/**\n * One `reportingDescriptor` per distinct finding type, in order of first\n * appearance.\n *\n * This is not optional decoration. A result carrying a `ruleId` that matches\n * no descriptor is accepted by GitHub code scanning and then rendered without\n * a rule name, a description, or a working filter - the alert arrives stripped\n * of everything that makes a dashboard usable, and with no error to explain\n * why.\n */\nfunction buildRules(run: LintRun): RuleIndex {\n const indexOf = new Map<string, number>();\n const order: string[] = [];\n const severities = new Map<string, Set<Severity>>();\n\n for (const result of run.results) {\n for (const finding of result.findings) {\n let seen = severities.get(finding.type);\n if (!seen) {\n seen = new Set<Severity>();\n severities.set(finding.type, seen);\n indexOf.set(finding.type, order.length);\n order.push(finding.type);\n }\n seen.add(finding.severity);\n }\n }\n\n const descriptors = order.map((type) => {\n // The descriptor id is the **family** rule id, not the internal `type`:\n // it is what an alert is filed and de-duplicated under, and it has to be\n // the string every other reporter uses for the same finding. `name` and\n // `shortDescription` are derived from the rule half alone, so GitHub's\n // rule list reads \"MissingSection\", not \"ManniLintStructureMissingSection\".\n const rule = ruleName(type);\n const descriptor: ReportingDescriptor = {\n id: ruleId(type),\n name: pascalCase(rule),\n shortDescription: { text: humanize(rule) },\n };\n // Only when every finding of this type agreed on a severity. Severity is\n // per finding, not per rule, so a type that appeared as both an error and\n // a warning has no honest default - and every result states its own\n // `level` regardless, which is what a consumer actually reads.\n const [only, ...rest] = [...(severities.get(type) ?? [])];\n if (only !== undefined && rest.length === 0) {\n descriptor.defaultConfiguration = { level: LEVELS[only] };\n }\n return descriptor;\n });\n\n return { descriptors, indexOf };\n}\n\nfunction propertiesOf(finding: Finding): SarifResult[\"properties\"] {\n const properties: NonNullable<SarifResult[\"properties\"]> = {};\n if (finding.heading != null) properties.heading = finding.heading;\n if (finding.template != null) properties.template = finding.template;\n return Object.keys(properties).length > 0 ? properties : undefined;\n}\n\nfunction toResult(\n finding: Finding,\n file: string,\n rules: RuleIndex,\n root: string,\n): SarifResult {\n return {\n ruleId: ruleId(finding.type),\n // Always populated in practice, since the index is built from these same\n // findings. Omitted rather than faked if it ever is not: a wrong index\n // points the alert at somebody else's rule, which is worse than none.\n ruleIndex: rules.indexOf.get(finding.type),\n level: LEVELS[finding.severity],\n message: { text: messageText(finding) },\n locations: [location(file, root, finding.position)],\n properties: propertiesOf(finding),\n };\n}\n\ninterface SkipReport {\n descriptors: ReportingDescriptor[];\n notifications: SarifNotification[];\n}\n\n/**\n * Skipped files become `toolExecutionNotifications`, not results.\n *\n * They cannot simply be dropped - the pretty reporter's rule applies here too:\n * a file that leaves no trace in the report is indistinguishable from a file\n * that passed, and a docset mid-onboarding is mostly unrouted pages. Reading\n * that as a clean bill of health is the exact failure this format exists to\n * prevent.\n *\n * They are not results either. A result is a statement about the content of a\n * document; a skip is a statement about the tool, which declined to look. As\n * results they would open code-scanning alerts against files nothing has\n * examined, and each of those would then have to be triaged and dismissed by\n * hand. `toolExecutionNotifications` is the slot SARIF defines for \"the tool\n * has something to say about its own execution\", which is what a skip is.\n *\n * Level `note` rather than SARIF's default of `warning`: on a repository that\n * has not adopted doctypes yet nearly every page is skipped, and a warning\n * stream that long is one nobody reads.\n */\nfunction buildSkips(run: LintRun, root: string): SkipReport {\n const indexOf = new Map<string, number>();\n const descriptors: ReportingDescriptor[] = [];\n const notifications: SarifNotification[] = [];\n\n for (const result of run.results) {\n const reason = result.skipped;\n if (reason == null) continue;\n\n let index = indexOf.get(reason);\n if (index === undefined) {\n index = descriptors.length;\n indexOf.set(reason, index);\n descriptors.push({\n id: reason,\n name: pascalCase(reason),\n shortDescription: { text: SKIP_DESCRIPTIONS[reason] },\n });\n }\n\n notifications.push({\n // Declared in `tool.driver.notifications` and referenced by id *and*\n // index, for the same reason results reference their rules both ways.\n descriptor: { id: reason, index },\n level: \"note\",\n message: { text: skipMessage(result, reason) },\n locations: [location(result.file, root)],\n });\n }\n\n return { descriptors, notifications };\n}\n\n/** The specific reason when the run recorded one, the generic one otherwise. */\nfunction skipMessage(result: LintFileResult, reason: SkipReason): string {\n return result.reason ?? SKIP_DESCRIPTIONS[reason];\n}\n\nexport function renderSarif(run: LintRun, opts: SarifOptions = {}): string {\n const root = normalizeRoot(opts.root ?? process.cwd());\n const rules = buildRules(run);\n const skips = buildSkips(run, root);\n\n const results = run.results.flatMap((result) =>\n result.findings.map((finding) =>\n toResult(finding, result.file, rules, root),\n ),\n );\n\n const driver: SarifDriver = {\n name: \"manni-lint\",\n informationUri: INFORMATION_URI,\n version: pkg.version,\n // Emitted even when empty: results point into this array, so a consumer\n // always looks here, and a stable shape is cheaper than a special case.\n rules: rules.descriptors,\n notifications: skips.descriptors.length > 0 ? skips.descriptors : undefined,\n };\n\n const invocation: SarifInvocation = {\n // Findings are the tool doing its job, not failing at it. This would only\n // be false if manni lint itself could not run, and that path exits 2\n // before any report is rendered.\n executionSuccessful: true,\n toolExecutionNotifications:\n skips.notifications.length > 0 ? skips.notifications : undefined,\n };\n\n const log: SarifLog = {\n $schema: SARIF_SCHEMA,\n version: SARIF_VERSION,\n runs: [\n {\n tool: { driver },\n // Declared unconditionally: it is what makes every relative `uri` in\n // this report mean anything, and a reader should not have to infer the\n // base from whether some result happened to use it.\n originalUriBaseIds: { [URI_BASE_ID]: { uri: fileUri(root) } },\n invocations: [invocation],\n results,\n },\n ],\n };\n\n return JSON.stringify(log, null, 2);\n}\n","/**\n * The alignment block `--explain` prints under each routed file: which rule\n * claimed which section, and why. It is lint's answer to \"why did it say\n * that\" for the matcher in `core/match.ts` - proposal 0061's stress test 3\n * names this as the cost of an alignment matcher over a left-to-right one: a\n * tie is invisible unless something prints the pairing it chose.\n *\n * This module recomputes the alignment itself by calling the matcher's own,\n * already-exported `matchSections` - it does not reach into `align()`'s\n * internal step sequence, which is module-private. That has one visible\n * consequence: this file has no way to know the *document position* a missing\n * rule or an unexpected section falls at relative to the other, so a missing\n * rule is placed among the sections that did match using rule order alone\n * (`insertMissing` below), which is exact whenever - as in every template this\n * repository ships - the missing rule is not sandwiched between two unexpected\n * sections with nothing matched between them. `core/match.ts` is read-only\n * from here; exporting the step sequence, if this ever needs to be exact, is a\n * change to that file rather than to this one.\n *\n * The other thing this module cannot get from an export: which key in a\n * page's frontmatter is its title. It assumes `title`, the same key\n * `manni meta`'s own schemas require, and re-reads `tree.frontmatter`\n * directly rather than asking a caller to resolve it, so the assumption lives\n * in exactly one place.\n *\n * **The seam this depends on.** `commands/lint.ts` parses every file and\n * loads its template before `--explain` returns - both already exist at that\n * point in `lintOne` - but neither is currently attached to the\n * `LintFileResult` it returns. `render()` (`reporters/index.ts`) reads them\n * off a result through `ExplainSource`, structurally: a result carrying\n * `tree` and `template` gets an alignment block, and one that does not is\n * printed exactly as before. Wiring `commands/lint.ts` to attach them is\n * outside this chunk's files (`src/lint/commands/lint.ts` is not among them).\n */\nimport { LintError, type DocumentTree, type SectionNode } from \"../types.js\";\nimport { matchSections, type Match } from \"../core/match.js\";\nimport { occurrenceRange, type Rule, type Template } from \"../core/template.js\";\n\n/** What a caller must attach to a `LintFileResult` for the block to render. */\nexport interface ExplainSource {\n tree: DocumentTree;\n template: Template;\n}\n\n/** One line of the block, before indentation is joined on. */\nexport interface AlignmentRow {\n depth: number;\n text: string;\n}\n\nconst LABEL_WIDTH = 22;\nconst ARROW = \"←\"; // ←\nconst ELLIPSIS = \"…\"; // …\nconst TIMES = \"×\"; // ×\n\nfunction pad(label: string): string {\n return label.length >= LABEL_WIDTH ? `${label} ` : label.padEnd(LABEL_WIDTH + 1);\n}\n\n/** A section's title, quoted, or `(no heading)` for one that has none. */\nfunction titleText(title: string | null): string {\n return title === null ? \"(no heading)\" : `\"${title}\"`;\n}\n\n/**\n * A rule's display name: its `id` where it has one, else a literal string\n * `heading`, else `(any)` for anything else - an array, a `{ pattern }`,\n * `heading: false`, or a bare wildcard. Mirrors the priority `--explain`'s\n * spec states, which is not the same order `missingMessage` in `match.ts`\n * uses for its prose: that picks the heading first because it is read as a\n * sentence, and this picks the id first because it is a column header.\n */\nfunction ruleLabel(rule: Rule): string {\n if (rule.id !== undefined) return rule.id;\n if (typeof rule.heading === \"string\") return rule.heading;\n return \"(any)\";\n}\n\n/**\n * The page's own heading, and the note explaining where it came from.\n *\n * Mirrors `validator.ts`'s private `pageSection`: a lone top-level heading\n * *is* the page. Most of the time that heading is not literal, though - every\n * parser with both frontmatter and headings (`parsers/metadata.ts`'s\n * `withMetadataTitle`) already synthesizes an H1 from `frontmatter.title` when\n * the body has none, positioned on the frontmatter block itself, precisely so\n * a template written against \"the page's title is its outermost rule\" does\n * not have to know the difference. By the time a tree reaches here that\n * difference is gone from the section's own fields - so it is recovered the\n * same way `titlePosition` was set: a synthesized heading's position is\n * `tree.frontmatterPosition`, verbatim.\n *\n * `frontmatter.title` is read directly only as a fallback, for a tree a\n * caller built by some other means - the programmatic API accepts one from\n * anywhere - where no such synthesis ran at all.\n */\nfunction pageHeading(tree: DocumentTree): { text: string | null; note: string | null } {\n const [only] = tree.sections;\n if (tree.sections.length === 1 && only && only.level <= 1) {\n const text = only.title || null;\n if (text === null) return { text: null, note: \"no heading\" };\n const synthesized =\n only.titlePosition !== null &&\n tree.frontmatterPosition !== null &&\n only.titlePosition.start.offset === tree.frontmatterPosition.start.offset &&\n only.titlePosition.end.offset === tree.frontmatterPosition.end.offset;\n return { text, note: synthesized ? \"synthesized from frontmatter\" : null };\n }\n const raw = tree.frontmatter?.[\"title\"];\n const text = typeof raw === \"string\" && raw !== \"\" ? raw : null;\n return { text, note: text === null ? \"no heading\" : \"synthesized from frontmatter\" };\n}\n\n/** The sections a template's `sections:` rules describe - `pageSection`'s subject. */\nfunction pageSections(tree: DocumentTree): SectionNode[] {\n const [only] = tree.sections;\n if (tree.sections.length === 1 && only && only.level <= 1) return only.sections;\n return tree.sections;\n}\n\n/**\n * One matched or collapsed run of matches, rendered as a single row.\n *\n * Both call sites build `run` by pushing one already-known `Match` before\n * ever calling this, so it is never empty; the guard below exists to let the\n * checker see that rather than to handle a real empty-run case.\n */\nfunction matchedRow(depth: number, run: Match[]): AlignmentRow {\n const head = run[0];\n if (!head) return { depth, text: `${pad(\"(empty run)\")}${ARROW} (missing)` };\n const rule = head.rule;\n const first = head.section;\n const last = (run[run.length - 1] ?? head).section;\n const label = run.length === 1 ? ruleLabel(rule) : `${ruleLabel(rule)} ${TIMES}${run.length}`;\n // Coercion can only ever land on a run of length 1: `ALIGNMENT_COSTS.coerce`\n // is open only to a required occurrence whose `max` is 1 (`match.ts`'s\n // header explains why), and a rule with `max: 1` can never contribute a\n // second match to a run.\n const coerced = run.length === 1 && head.coerced ? \" (coerced)\" : \"\";\n const arrow =\n run.length === 1\n ? `${titleText(first.title || null)}${coerced}`\n : `${titleText(first.title || null)} ${ELLIPSIS} ${titleText(last.title || null)}`;\n return { depth, text: `${pad(label)}${ARROW} ${arrow}` };\n}\n\n/**\n * What an absent rule is called.\n *\n * `(missing)` means exactly what produces a `missing_section` finding, so it\n * is reserved for a rule that had to appear. An optional rule that took\n * nothing is `(none)`: absent, and fine. Sharing one word made a page that\n * lints clean print a row saying something was missing from it, which is the\n * opposite of what `--explain` is for.\n */\nfunction absentLabel(rule: Rule): string {\n return occurrenceRange(rule).min > 0 ? \"(missing)\" : \"(none)\";\n}\n\n/** A rule with nothing to show, or a `repeat` group with nothing at all. */\nfunction missingRows(depth: number, rule: Rule): AlignmentRow[] {\n if (!rule.repeat) {\n return [{ depth, text: `${pad(ruleLabel(rule))}${ARROW} ${absentLabel(rule)}` }];\n }\n // A group's members inherit the group's own occurrence: a member of an\n // optional group is not missing when the whole group never ran.\n const label = absentLabel(rule);\n const rows: AlignmentRow[] = [{ depth, text: pad(rule.id ?? \"(repeat)\").trimEnd() }];\n for (const member of rule.repeat) {\n rows.push({ depth: depth + 1, text: `${pad(ruleLabel(member))}${ARROW} ${label}` });\n }\n return rows;\n}\n\n/**\n * Insert `missing`, each tagged with the index of the rule it is about, among\n * `matched` entries tagged the same way (`null` for one that has no rule -\n * an unexpected section). A missing rule never displaces an unexpected\n * section: only a matched entry's index gates it, so an unexpected section is\n * carried along in whichever position document order already put it in.\n */\nfunction insertMissing(\n matched: { index: number | null; rows: AlignmentRow[] }[],\n missing: { index: number; rows: AlignmentRow[] }[],\n): AlignmentRow[] {\n const out: AlignmentRow[] = [];\n let mi = 0;\n for (const entry of matched) {\n while (mi < missing.length) {\n // `mi < missing.length` just guarded this, so `next` is always here;\n // the check only lets the type checker see the invariant the loop\n // bound already established.\n const next = missing[mi];\n if (!next || (entry.index !== null && next.index >= entry.index)) break;\n out.push(...next.rows);\n mi++;\n }\n out.push(...entry.rows);\n }\n while (mi < missing.length) {\n const next = missing[mi];\n if (!next) break;\n out.push(...next.rows);\n mi++;\n }\n return out;\n}\n\n/**\n * One level: `rules` against `sections`, and every matched pair's own\n * subsections.\n *\n * A `repeat` member's `Match.rule` is the member itself, never the group\n * (`match.ts`'s `compile` only ever assigns an occurrence to a leaf rule), so\n * a group is never a key in `matches`. `rootOf` recovers \"which top-level\n * rule is this a member of\" - itself, for a rule with no group - which is\n * what lets a group be judged matched or missing as one thing while still\n * naming which of its members carried the section.\n */\nfunction alignLevel(\n rules: Rule[] | undefined,\n sections: SectionNode[],\n parent: SectionNode | null,\n depth: number,\n): AlignmentRow[] {\n // `undefined` is the template saying nothing about this level - silence,\n // not \"no sections allowed\" - so there is nothing to align and nothing to\n // print. `matchSections` draws the same line; this mirrors it rather than\n // passing `[]` through, which would turn silence into every section here\n // reading as unexpected.\n if (rules === undefined) return [];\n\n const { matches } = matchSections(sections, rules, { parent });\n const ruleIndex = new Map<Rule, number>(rules.map((r, i) => [r, i]));\n const rootOf = new Map<Rule, Rule>();\n for (const rule of rules) {\n if (rule.repeat) for (const member of rule.repeat) rootOf.set(member, rule);\n else rootOf.set(rule, rule);\n }\n const rootOfRule = (rule: Rule): Rule => rootOf.get(rule) ?? rule;\n const matchedRoots = new Set(matches.map((m) => rootOfRule(m.rule)));\n const bySection = new Map<SectionNode, Match>(matches.map((m) => [m.section, m]));\n\n const matched: { index: number | null; rows: AlignmentRow[] }[] = [];\n let i = 0;\n while (i < sections.length) {\n // `i < sections.length` just guarded this; `section` always exists.\n const section = sections[i];\n if (!section) break;\n const match = bySection.get(section);\n if (!match) {\n matched.push({\n index: null,\n rows: [{ depth, text: `(unexpected) ${titleText(section.title || null)}` }],\n });\n i++;\n continue;\n }\n\n const root = rootOfRule(match.rule);\n if (root.repeat) {\n // Every section, in this run, that belongs to this same group - by\n // whichever member took it, not necessarily the same one twice.\n const taken: Match[] = [];\n while (i < sections.length) {\n const here = sections[i];\n if (!here) break;\n const next = bySection.get(here);\n if (!next || rootOfRule(next.rule) !== root) break;\n taken.push(next);\n i++;\n }\n const rows: AlignmentRow[] = [{ depth, text: pad(root.id ?? \"(repeat)\").trimEnd() }];\n let run: Match[] = [];\n const flushMember = (): void => {\n if (run.length === 0) return;\n rows.push(matchedRow(depth + 1, run));\n for (const m of run) {\n rows.push(...alignLevel(m.rule.sections, m.section.sections, m.section, depth + 2));\n }\n run = [];\n };\n for (const m of taken) {\n const first = run[0];\n if (first && first.rule !== m.rule) flushMember();\n run.push(m);\n }\n flushMember();\n // A member this occurrence never reached prints missing beside the\n // members it did, the same information `missingRows` gives a group with\n // nothing at all.\n const takenMembers = new Set(taken.map((m) => m.rule));\n for (const member of root.repeat) {\n if (takenMembers.has(member)) continue;\n rows.push({ depth: depth + 1, text: `${pad(ruleLabel(member))}${ARROW} (missing)` });\n }\n matched.push({ index: ruleIndex.get(root) ?? null, rows });\n continue;\n }\n\n // A plain rule: gather the run of consecutive sections it claimed.\n const run: Match[] = [match];\n i++;\n while (i < sections.length) {\n const here = sections[i];\n if (!here) break;\n const next = bySection.get(here);\n if (!next || next.rule !== match.rule) break;\n run.push(next);\n i++;\n }\n const rows = [matchedRow(depth, run)];\n for (const m of run) {\n rows.push(...alignLevel(m.rule.sections, m.section.sections, m.section, depth + 1));\n }\n matched.push({ index: ruleIndex.get(match.rule) ?? null, rows });\n }\n\n const missing = rules\n .filter((rule) => !matchedRoots.has(rule))\n .map((rule) => {\n const index = ruleIndex.get(rule);\n if (index === undefined) {\n // `ruleIndex` is built from this exact `rules` array above, so every\n // rule reached here (it came from filtering `rules` itself) has an\n // entry; this is unreachable.\n //\n // `LintError` rather than `Error` even so. Everything this tool throws\n // is caught by the bin runner and exits 2, an operational error; a bare\n // `Error` would escape that and exit 1, which means \"the documents have\n // findings\". An internal fault must never be reported as a lint result.\n throw new LintError(\"alignLevel: rule missing from its own index\");\n }\n return { index, rows: missingRows(depth, rule) };\n });\n\n return insertMissing(matched, missing);\n}\n\n/** The full alignment block for one file: the page row, then its sections. */\nexport function explainAlignment(tree: DocumentTree, template: Template): AlignmentRow[] {\n const heading = pageHeading(tree);\n const arrow =\n heading.text !== null\n ? `${titleText(heading.text)}${heading.note ? ` (${heading.note})` : \"\"}`\n : `(${heading.note ?? \"no heading\"})`;\n const rows: AlignmentRow[] = [{ depth: 0, text: `${pad(\"(page)\")}${ARROW} ${arrow}` }];\n rows.push(...alignLevel(template.sections, pageSections(tree), null, 1));\n return rows;\n}\n\n/** `AlignmentRow[]` as the indented text `renderExplain` prints, two spaces per depth. */\nexport function formatAlignment(rows: AlignmentRow[]): string[] {\n return rows.map((row) => `${\" \".repeat(row.depth)}${row.text}`);\n}\n","/**\n * Reporters render a run to a string. The CLI writes the result to stdout;\n * diagnostics go to stderr separately, so a report is never interleaved with\n * anything a consumer has to parse around.\n */\nimport { LintError, type Finding } from \"../types.js\";\nimport type { LintFileResult, LintRun } from \"../commands/lint.js\";\nimport type { FormatInfo, ToolInfo } from \"../commands/tools.js\";\nimport type { TemplateInfo, TemplatesInfo } from \"../commands/templates.js\";\nimport { palette, type Colors } from \"../../shared/color.js\";\nimport {\n escapeWorkflowCommandMessage,\n escapeWorkflowCommandProperty,\n} from \"../../shared/github.js\";\nimport type { ReportFormat as FamilyFormat } from \"../../meta/index.js\";\nimport { REPORT_FORMAT_LIST } from \"../../meta/internal.js\";\nimport { ruleId, TOOL_NAME } from \"../core/rule-id.js\";\nimport { renderJunit } from \"./junit.js\";\nimport { renderSarif } from \"./sarif.js\";\nimport { templateLines } from \"./template-context.js\";\nimport { explainAlignment, formatAlignment, type ExplainSource } from \"./alignment.js\";\n\nexport { renderJunit, toValidationResults } from \"./junit.js\";\n\n/**\n * Every `-f` value, plus `--explain`.\n *\n * The findings formats are the family's, taken from meta rather than restated,\n * so a format added there is available here the moment lint's `render` grows a\n * case for it - and a value lint does not handle is a compile error instead of\n * a silent fall-through to pretty. `explain` is lint's own: it is reachable\n * through `--explain` and never through `-f`, because it reports on\n * configuration rather than on documents.\n */\nexport type ReportFormat = FamilyFormat | \"explain\";\n\n/** Listing commands have nothing to annotate, so they offer no `github`. */\nexport type ListFormat = \"pretty\" | \"json\";\n\nexport interface ReportOptions {\n color?: boolean;\n /**\n * Directory the run's relative paths are relative to, forwarded to the SARIF\n * reporter and ignored by the others. Defaults to the process cwd, which is\n * right for the CLI because `runLint` defaults its `cwd` the same way.\n *\n * It is here rather than only on `renderSarif` because `render` is the entry\n * point a library caller reaches for, and without it that caller was pinned\n * to the process cwd with no way out short of bypassing `render` entirely -\n * for the one reporter whose whole output is paths.\n */\n root?: string;\n}\n\nfunction plural(n: number, word: string): string {\n return `${n} ${word}${n === 1 ? \"\" : \"s\"}`;\n}\n\n/** `line:column` of a finding, the anchor an editor can jump to. */\nfunction locate(finding: Finding): string {\n return `${finding.position.start.line}:${finding.position.start.column}`;\n}\n\n/** A finding as prose: the heading it is about, then what is wrong with it. */\nfunction describeFinding(finding: Finding): string {\n return finding.heading != null\n ? `${finding.heading}: ${finding.message}`\n : finding.message;\n}\n\n/**\n * A finding's level prefix, meta's shape: nothing for an error, since the\n * `✗`/`✓` mark already says that; the word itself, coloured, for anything\n * milder. Keeps a passing file's warning from reading as just another\n * anonymous line once it is printed beside real errors on a failing one.\n */\nfunction levelPrefix(c: Colors, severity: Finding[\"severity\"]): string {\n if (severity === \"error\") return \"\";\n return `${severity === \"notice\" ? c.dim(\"notice\") : c.yellow(\"warning\")} `;\n}\n\nexport function renderPretty(run: LintRun, opts: ReportOptions = {}): string {\n const c = palette(opts.color ?? false);\n const lines: string[] = [];\n let warnings = 0;\n let notices = 0;\n\n for (const result of run.results) {\n // A skip is reported, never silently dropped: an unreadable format that\n // leaves no trace is indistinguishable from a file that passed.\n if (result.skipped != null) {\n const why = result.reason ?? result.skipped;\n lines.push(`${c.yellow(\"-\")} ${result.file} ${c.dim(`skipped: ${why}`)}`);\n continue;\n }\n if (result.success && result.findings.length === 0) {\n lines.push(`${c.green(\"✓\")} ${result.file}`);\n continue;\n }\n // `success` means \"no error-severity finding\", not \"no findings\" - a\n // passing file can still hold a warning, such as\n // `unsupported_content_kind`. Reusing `✓` for it would hide the warning\n // behind the same glyph a clean file gets; reusing `✗` would fail a file\n // nothing actually failed. `⚠` (meta's and cite's mark for the same case)\n // says \"passing, but read this\" without claiming either extreme.\n const mark = result.success ? c.yellow(\"⚠\") : c.red(\"✗\");\n lines.push(`${mark} ${result.file}`);\n for (const finding of result.findings) {\n // Counted apart, because they are not the same thing to a reader. Every\n // structure finding used to be an `error` or the occasional `warning`,\n // so \"not an error\" and \"a warning\" were the same set. DITA-OT reports an\n // undefined key reference at `notice`, and calling that a warning on the\n // summary line overstates it.\n if (finding.severity === \"warning\") warnings++;\n else if (finding.severity === \"notice\") notices++;\n // The namespaced id rather than the bare `type`: it is what SARIF,\n // JUnit and the GitHub annotation file the finding under, so the string\n // a reader copies out of the terminal is the one they can search for.\n lines.push(\n ` ${c.dim(locate(finding))} ${c.cyan(ruleId(finding.type))} ` +\n `${levelPrefix(c, finding.severity)}${describeFinding(finding)}`,\n );\n // What the template asks for, under the rule id it explains.\n const indent = \" \".repeat(6 + locate(finding).length);\n for (const line of templateLines(finding)) lines.push(`${indent}${c.dim(line)}`);\n }\n }\n\n const { checked, passed, failed, skipped } = run.summary;\n // Named only when there are any, as meta and cite do: every run against a\n // format that reports every content kind has none.\n const warningsText = warnings > 0 ? `, ${plural(warnings, \"warning\")}` : \"\";\n const noticesText = notices > 0 ? `, ${plural(notices, \"notice\")}` : \"\";\n const summary = `${plural(checked, \"file\")} checked, ${passed} passed, ${failed} failed, ${skipped} skipped${warningsText}${noticesText}`;\n if (lines.length > 0) lines.push(\"\");\n lines.push(failed > 0 ? c.red(summary) : c.green(summary));\n return lines.join(\"\\n\");\n}\n\n/**\n * The published JSON shape, and the reason this builds objects by hand rather\n * than stringifying `run.results` directly.\n *\n * manni docevals reads `[{ file, success, errors: [{ type, heading, message,\n * position: { start: { line, column } } }] }]` off stdout, and it parses\n * rather than validates - a renamed key produces zero findings, not an error.\n * So: a bare array at the top level, and `errors`, even though the internal\n * field is `findings`. Adding keys is safe; renaming or nesting is not.\n */\nexport function renderJson(run: LintRun): string {\n const results = run.results.map((result) => ({\n file: result.file,\n success: result.success,\n errors: result.findings.map((finding) => ({\n type: finding.type,\n // Additive, and deliberately beside `type` rather than instead of it.\n // `ruleId` is the family id every other reporter files this finding\n // under; `tool` names which tool produced it, the question a second\n // lint job makes worth asking.\n ruleId: ruleId(finding.type),\n tool: TOOL_NAME,\n heading: finding.heading,\n message: finding.message,\n position: finding.position,\n // Additive too, and the reason it has to be: `success: true` beside a\n // non-empty `errors` array is exactly what a warning-only file looks\n // like now that `success` means \"no error-severity finding\" rather than\n // \"no findings\". Without this key a consumer has no way to tell that\n // apart from an error the JSON shape simply forgot to fail on.\n severity: finding.severity,\n // Additive: the template that judged the page and the rule this finding\n // is about, or null when no template stands behind it.\n template: finding.template ?? null,\n })),\n // Additive, and the one thing this shape could not say. A skipped file is\n // `{success: false, errors: []}`, which is also what a failure whose\n // finding vanished looks like - so a consumer counting failures counted a\n // file nothing read as a file that was read and found wanting. Null rather\n // than absent, because a key that comes and goes makes \"not skipped\" and\n // \"an older manni\" the same observation. The prose `reason` stays off the\n // wire; it is a diagnostic for the pretty and SARIF reports.\n skipped: result.skipped ?? null,\n }));\n return JSON.stringify(results, null, 2);\n}\n\n/**\n * GitHub workflow commands: one annotation per finding, shaped as cite's are -\n * `::<severity> file=…,line=…,col=…,title=<ruleId>::<message>`.\n *\n * The rule id is a `title=` property rather than a `[type]` prefix inside the\n * message. GitHub renders the title as the alert's own heading, so the prefix\n * spelled the rule's name a second time; and `title` is the field a reader can\n * group and filter on, which prose can never be.\n *\n * The level is the severity, not a constant `error`. The family scale was\n * chosen to be GitHub's for exactly this: `::warning` and `::notice` render\n * inline like `::error` but do not fail the check, which is the severity\n * invariant in GitHub's terms, and it is load-bearing rather than theoretical:\n * `unsupported_content_kind` is a `warning`, so it annotates the file without\n * failing the job.\n *\n * Line breaks are escaped rather than collapsed to spaces, as this once did.\n * `%0A` is the format's own answer and GitHub renders it as a multi-line\n * annotation, so the message arrives whole; collapsing threw away the author's\n * line breaks to solve a problem the escape already solves, and its `\\r?\\n`\n * pattern let a bare carriage return through into the command untouched.\n *\n * The escaping itself is the family's, from `src/shared/github.ts`. It lives\n * there precisely so a second renderer cannot re-derive it: the replacements\n * are order-dependent (`%` first, or the escape sequences get escaped again),\n * and a local copy that got the order wrong would look identical in review and\n * only show itself on a message carrying a literal `%`.\n */\nexport function renderGithub(run: LintRun): string {\n const lines: string[] = [];\n for (const result of run.results) {\n for (const finding of result.findings) {\n const params = [\n `file=${escapeWorkflowCommandProperty(result.file)}`,\n `line=${finding.position.start.line}`,\n `col=${finding.position.start.column}`,\n `title=${escapeWorkflowCommandProperty(ruleId(finding.type))}`,\n ];\n const message = escapeWorkflowCommandMessage(\n [describeFinding(finding), ...templateLines(finding)].join(\"\\n\"),\n );\n lines.push(`::${finding.severity} ${params.join(\",\")}::${message}`);\n }\n }\n return lines.join(\"\\n\");\n}\n\n/**\n * `--explain`: the resolution chain per file, rather than findings.\n *\n * Printing every stage, including the ones that had nothing to say, is the\n * point. \"Which template linted this page?\" is usually asked because the answer\n * was surprising, and the surprising part is almost always a stage the reader\n * forgot applies - a stray `$template`, an override glob matching more than\n * intended. A report that showed only the winning stage would hide exactly the\n * thing being looked for.\n */\n/**\n * The alignment block riding on a result. `commands/lint.ts` attaches the tree\n * and the loaded template under `alignment` when `--explain` asked for them,\n * and only for a file that routed; a result without it prints as it always did.\n *\n * It is a nested key rather than two flat ones because `template` at the top\n * level is already the template's *ref*, the string the routing line shows.\n */\nfunction alignmentFor(result: LintFileResult): string[] | null {\n const source: ExplainSource | undefined = result.alignment;\n if (!source) return null;\n return formatAlignment(explainAlignment(source.tree, source.template));\n}\n\nexport function renderExplain(run: LintRun, opts: ReportOptions = {}): string {\n const c = palette(opts.color ?? false);\n const lines: string[] = [];\n\n for (const result of run.results) {\n // Not the pass/fail glyphs: `--explain` reports whether a page was routed,\n // and a routed page may still be full of findings. Reusing the tick would\n // read as a clean bill of health for a document nothing has looked at yet.\n const chosen = result.template;\n lines.push(`${chosen ? c.cyan(\"▸\") : c.dim(\"-\")} ${c.bold(result.file)}`);\n\n const steps = result.resolution?.steps ?? [];\n if (steps.length === 0) {\n lines.push(` ${c.dim(\"(no resolution recorded)\")}`);\n }\n for (const step of steps) {\n const mark = step.ref ? c.green(\"→\") : c.dim(\"·\");\n const label = step.ref ? c.bold(step.ref) : c.dim(step.detail);\n const suffix = step.ref ? ` ${c.dim(step.detail)}` : \"\";\n lines.push(` ${mark} ${step.stage.padEnd(20)} ${label}${suffix}`);\n }\n\n const alignment = chosen ? alignmentFor(result) : null;\n if (alignment && alignment.length > 0) {\n lines.push(` ${c.dim(\"alignment\")}`);\n for (const row of alignment) lines.push(` ${row}`);\n }\n\n const cause = result.resolution?.cause;\n if (cause === \"unknown-type\") {\n const type = result.resolution?.unknownType ?? \"(none recorded)\";\n const near = result.resolution?.suggestions ?? [];\n const known = result.resolution?.knownTypes ?? [];\n // The same fallback the pretty reporter gives. Without it a typo with no\n // near miss - which is most of them, since a near miss needs the typo to\n // be close - printed the failure and nothing to act on, while the plain\n // lint output for that page listed every doctype available.\n const hint = near.length\n ? `; did you mean ${near.join(\", \")}?`\n : known.length\n ? `; known doctypes: ${known.join(\", \")}`\n : \"\";\n lines.push(` ${c.red(\"✗\")} no template serves type \"${type}\"${hint}`);\n } else if (cause === \"no-type\") {\n lines.push(` ${c.dim(\"skipped: the page declares no type\")}`);\n }\n lines.push(\"\");\n }\n\n const routed = run.results.filter((r) => r.template != null).length;\n lines.push(\n `${run.results.length} file${run.results.length === 1 ? \"\" : \"s\"}, ` +\n `${routed} routed, ${run.results.length - routed} unrouted`,\n );\n return lines.join(\"\\n\");\n}\n\nexport function render(\n run: LintRun,\n format: ReportFormat,\n opts: ReportOptions = {},\n): string {\n switch (format) {\n case \"json\":\n return renderJson(run);\n case \"github\":\n return renderGithub(run);\n case \"sarif\":\n return renderSarif(run, opts.root === undefined ? {} : { root: opts.root });\n case \"junit\":\n return renderJunit(run);\n case \"explain\":\n return renderExplain(run, opts);\n case \"pretty\":\n return renderPretty(run, opts);\n default: {\n // Exhaustive, and the guard is what makes the claim true: sharing an arm\n // with `pretty` narrowed nothing, so a format added to meta's\n // `REPORT_FORMATS` - which is what the CLI validates `-f` against - was\n // accepted here and silently rendered as a human report. Now it is a\n // compile error, and this is its runtime half for library callers.\n const unreachable: never = format;\n throw new LintError(\n `Unknown report format ${JSON.stringify(unreachable)}. Use ${REPORT_FORMAT_LIST}.`,\n );\n }\n }\n}\n\n/** One template per line: the ref to pass, its title, and the types it serves. */\nfunction templateLine(c: Colors, entry: TemplateInfo): string {\n const title = entry.title !== \"\" ? ` ${c.dim(\"—\")} ${entry.title}` : \"\";\n const types =\n entry.types.length > 0 ? entry.types.join(\", \") : \"(no types declared)\";\n return ` ${c.cyan(entry.id)}${title} ${c.dim(`types: ${types}`)} ${c.dim(`[${entry.source}]`)}`;\n}\n\nexport function renderTemplates(\n info: TemplatesInfo,\n format: ListFormat,\n opts: ReportOptions = {},\n): string {\n if (format === \"json\") return JSON.stringify(info, null, 2);\n\n const c = palette(opts.color ?? false);\n const lines: string[] = [c.bold(\"Templates:\")];\n if (info.templates.length === 0) {\n lines.push(c.dim(\" (none)\"));\n } else {\n for (const entry of info.templates) lines.push(templateLine(c, entry));\n }\n return lines.join(\"\\n\");\n}\n\n/**\n * One input format as `markdown Markdown (.md, .markdown) kinds: paragraph,\n * codeBlock, list`.\n *\n * The kinds are left out entirely when there are none, rather than printed as\n * an empty list. A tool outside the package answers the job without parsing\n * into the content model, so it has no kinds to report, and a bare `kinds:`\n * label reads as a rendering fault rather than as the answer.\n */\nfunction formatLine(c: Colors, entry: FormatInfo): string {\n const head = ` ${c.cyan(entry.name)} ${entry.label} (${entry.extensions.join(\", \")})`;\n if (entry.kinds.length === 0) return head;\n return `${head} ${c.dim(`kinds: ${entry.kinds.join(\", \")}`)}`;\n}\n\n/**\n * `manni lint tools`: one block per job. Every column is printed for every\n * job, the negatives included - \"not configured\" beside a job that still runs\n * on defaults is the answer someone ran this command to get.\n */\nexport function renderTools(\n tools: ToolInfo[],\n format: ListFormat,\n opts: ReportOptions = {},\n): string {\n if (format === \"json\") return JSON.stringify(tools, null, 2);\n\n const c = palette(opts.color ?? false);\n const lines: string[] = [c.bold(\"Jobs:\")];\n for (const entry of tools) {\n const state = [\n entry.configured ? \"configured\" : \"not configured\",\n entry.available ? \"available\" : \"unavailable\",\n ].join(\", \");\n // A tool that is not here has no version to report, and the row still\n // prints: \"unavailable\" beside a blank cell reads as a rendering fault\n // rather than as the answer. The dash is a cell standing in for a missing\n // value, which is why it is an em dash in a house style that bans them in\n // prose.\n const version = entry.version ?? \"—\";\n lines.push(\n ` ${c.cyan(entry.job)} tool: ${c.bold(entry.tool)} ${version} [${state}]`,\n );\n lines.push(` config: ${c.dim(entry.config)}`);\n lines.push(` ${c.dim(\"formats:\")}`);\n for (const info of entry.formats) lines.push(formatLine(c, info));\n }\n return lines.join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BO,IAAM,iBAAiB;AAGvB,IAAM,YAAY;AAGlB,IAAM,gBAAyB;AAQ/B,SAAS,SAAS,MAAsB;AAC7C,SAAO,KAAK,QAAQ,WAAW,EAAE,EAAE,QAAQ,MAAM,GAAG;AACtD;AAGO,SAAS,OAAO,MAAc,MAAe,eAAuB;AACzE,SAAO,GAAG,cAAc,IAAI,GAAG,IAAI,SAAS,IAAI,CAAC;AACnD;;;ACrBA,IAAM,kBAAkB;AAmBxB,SAAS,aACP,SACY;AACZ,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,SACE,QAAQ,WAAW,OACf,GAAG,QAAQ,OAAO,KAAK,QAAQ,OAAO,KACtC,QAAQ;AAAA,IACd,SAAS,GAAG,aAAa,IAAI,SAAS,QAAQ,IAAI,CAAC;AAAA,IACnD,UAAU,QAAQ;A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