@hawkeyexl/manni 4.11.0 → 4.12.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 (238) hide show
  1. package/README.md +1 -1
  2. package/dist/{batch-UAULUMGH.js → batch-EFSFG6GC.js} +20 -19
  3. package/dist/build-NIO3UIWJ.js +36 -0
  4. package/dist/calibrate-6VO7URRV.js +41 -0
  5. package/dist/capture-NMBVJO3C.js +38 -0
  6. package/dist/check-SHOYX2B5.js +30 -0
  7. package/dist/check-XMJKH3KV.js +34 -0
  8. package/dist/{check-VELUQAUW.js → check-Y62BJNC4.js} +35 -34
  9. package/dist/{check-VELUQAUW.js.map → check-Y62BJNC4.js.map} +1 -1
  10. package/dist/{check-YEOYBFST.js → check-ZMO3ZLMW.js} +19 -18
  11. package/dist/{chunk-BKVHX6FU.js → chunk-24AJK2RG.js} +5 -10
  12. package/dist/chunk-24AJK2RG.js.map +1 -0
  13. package/dist/{chunk-M42DZCOU.js → chunk-2OZF2VUB.js} +2 -2
  14. package/dist/chunk-2UJZXVHR.js +1868 -0
  15. package/dist/chunk-2UJZXVHR.js.map +1 -0
  16. package/dist/{chunk-HQR2ZBHW.js → chunk-3BRJCQPY.js} +36 -7
  17. package/dist/chunk-3BRJCQPY.js.map +1 -0
  18. package/dist/{chunk-U7CTFN2J.js → chunk-42VFJOAF.js} +7 -7
  19. package/dist/{chunk-LBSCW232.js → chunk-4Q24OYI3.js} +7 -7
  20. package/dist/{chunk-OPXWPJDA.js → chunk-4WJTURRO.js} +14 -14
  21. package/dist/{chunk-GDVZ5VII.js → chunk-5SID2SVL.js} +4 -4
  22. package/dist/{chunk-FUCPZVRY.js → chunk-AANUY4BH.js} +2 -2
  23. package/dist/chunk-ANPIIYRH.js +2272 -0
  24. package/dist/chunk-ANPIIYRH.js.map +1 -0
  25. package/dist/{chunk-WDWXAYVH.js → chunk-AYVKN3PG.js} +4 -4
  26. package/dist/{chunk-FQXWVS6J.js → chunk-CH6IOGXV.js} +9 -9
  27. package/dist/{chunk-4CK6ZSOK.js → chunk-D5Z6B4M7.js} +3 -3
  28. package/dist/{chunk-HA6MQMOY.js → chunk-D6SELXQ2.js} +6 -6
  29. package/dist/{chunk-2DRHT73U.js → chunk-DDILEF5F.js} +890 -1399
  30. package/dist/chunk-DDILEF5F.js.map +1 -0
  31. package/dist/{chunk-PCS4VJBV.js → chunk-DGRLHDM4.js} +9 -9
  32. package/dist/{chunk-2MJ62AYQ.js → chunk-DHGB4JBG.js} +4 -3
  33. package/dist/chunk-DHGB4JBG.js.map +1 -0
  34. package/dist/{chunk-Y6DOMTQD.js → chunk-DLU5FCFT.js} +27 -27
  35. package/dist/chunk-DLU5FCFT.js.map +1 -0
  36. package/dist/chunk-DSWKBZWW.js +16 -0
  37. package/dist/chunk-DSWKBZWW.js.map +1 -0
  38. package/dist/{chunk-KGEQJ5CC.js → chunk-F564FHMQ.js} +8 -8
  39. package/dist/{chunk-J6IDQGJL.js → chunk-FKAZUZQU.js} +469 -85
  40. package/dist/chunk-FKAZUZQU.js.map +1 -0
  41. package/dist/{chunk-IGSHYP74.js → chunk-G3MBUL5M.js} +4 -4
  42. package/dist/{chunk-ADMEPUBT.js → chunk-GQ3KRY3B.js} +3 -3
  43. package/dist/{chunk-T7JAOYE5.js → chunk-HDPN46JP.js} +6 -6
  44. package/dist/{chunk-R4WXQIOZ.js → chunk-IQQAJROD.js} +3 -3
  45. package/dist/{chunk-2IR4T5PO.js → chunk-IZXN3WI6.js} +2 -2
  46. package/dist/{chunk-NCPWXHDO.js → chunk-JEUFYSFQ.js} +4 -4
  47. package/dist/{chunk-LKP7QDFN.js → chunk-JSSM7VVV.js} +4 -4
  48. package/dist/{chunk-2IAZEB45.js → chunk-KFGZPVFA.js} +229 -821
  49. package/dist/chunk-KFGZPVFA.js.map +1 -0
  50. package/dist/{chunk-EIFCP6CZ.js → chunk-KGFSPJLD.js} +2 -2
  51. package/dist/{chunk-RLT5SEML.js → chunk-KMORGMCW.js} +6 -6
  52. package/dist/{chunk-WQWKYAAK.js → chunk-NUQF5F5J.js} +2 -2
  53. package/dist/{chunk-54F74XR3.js → chunk-NZ6KSHFD.js} +19 -19
  54. package/dist/{chunk-4D5IZSXM.js → chunk-OHUDZRLK.js} +3 -3
  55. package/dist/{chunk-FBMZJEB3.js → chunk-OKMTUAWO.js} +4 -4
  56. package/dist/{chunk-QLWC7MKD.js → chunk-OTJOBZJ5.js} +135 -135
  57. package/dist/chunk-OTJOBZJ5.js.map +1 -0
  58. package/dist/{chunk-6HWBRZIN.js → chunk-PS257NIU.js} +252 -193
  59. package/dist/chunk-PS257NIU.js.map +1 -0
  60. package/dist/chunk-QDC7JPFG.js +685 -0
  61. package/dist/chunk-QDC7JPFG.js.map +1 -0
  62. package/dist/{chunk-PCQ7ELJH.js → chunk-QEAGL4V5.js} +109 -5
  63. package/dist/chunk-QEAGL4V5.js.map +1 -0
  64. package/dist/{chunk-BBT6AVUG.js → chunk-QMY57PVW.js} +2 -2
  65. package/dist/{chunk-LPIF5LIE.js → chunk-QNDDPXFR.js} +2 -2
  66. package/dist/{chunk-PWBH7DCQ.js → chunk-QSIXNTRV.js} +4 -4
  67. package/dist/{chunk-VSEBFHAY.js → chunk-RGLFV4KO.js} +11369 -10218
  68. package/dist/chunk-RGLFV4KO.js.map +1 -0
  69. package/dist/{chunk-D4N2V43Z.js → chunk-SGR7ZAVE.js} +13 -7
  70. package/dist/chunk-SGR7ZAVE.js.map +1 -0
  71. package/dist/{chunk-GV56WGL2.js → chunk-SMHAYK6I.js} +1036 -883
  72. package/dist/chunk-SMHAYK6I.js.map +1 -0
  73. package/dist/{chunk-JPQDNYXH.js → chunk-STPGIKPY.js} +8 -2
  74. package/dist/chunk-STPGIKPY.js.map +1 -0
  75. package/dist/{chunk-NSBXVPZL.js → chunk-U22TOL5Y.js} +17 -17
  76. package/dist/{chunk-NGTVREIH.js → chunk-U6IHLEWT.js} +2 -2
  77. package/dist/{chunk-ODRPL3WB.js → chunk-UUCCV3SI.js} +2 -2
  78. package/dist/{chunk-MSRU4D4P.js → chunk-UXMCHBOJ.js} +2 -2
  79. package/dist/{chunk-B7XYNRJQ.js → chunk-VFAKGIDG.js} +2 -2
  80. package/dist/{chunk-QCHVR4ZM.js → chunk-VM7VAFJW.js} +33 -7
  81. package/dist/chunk-VM7VAFJW.js.map +1 -0
  82. package/dist/{chunk-VQK4VHLF.js → chunk-YQV75FIL.js} +2 -2
  83. package/dist/chunk-YUTVAMWW.js +2 -0
  84. package/dist/{cli-4MF37HAQ.js → cli-4CR7QIOK.js} +26 -25
  85. package/dist/{cli-4MF37HAQ.js.map → cli-4CR7QIOK.js.map} +1 -1
  86. package/dist/{cli-6KZTHWGP.js → cli-6R4W3HAH.js} +37 -36
  87. package/dist/{cli-6KZTHWGP.js.map → cli-6R4W3HAH.js.map} +1 -1
  88. package/dist/{cli-I62SRH3R.js → cli-BOMA2FMP.js} +14 -13
  89. package/dist/{cli-DRMZBZLB.js → cli-EDQPQOCE.js} +43 -42
  90. package/dist/{cli-DRMZBZLB.js.map → cli-EDQPQOCE.js.map} +1 -1
  91. package/dist/{cli-VID7PJS3.js → cli-GBF76EXT.js} +23 -22
  92. package/dist/{cli-VID7PJS3.js.map → cli-GBF76EXT.js.map} +1 -1
  93. package/dist/{cli-3BTCK4AB.js → cli-MQYCF3SR.js} +27 -26
  94. package/dist/{cli-3BTCK4AB.js.map → cli-MQYCF3SR.js.map} +1 -1
  95. package/dist/{cli-ONTC5PKT.js → cli-OJKFXQOM.js} +9 -9
  96. package/dist/{cli-VUKMWSSF.js → cli-PHZAO4LZ.js} +4 -4
  97. package/dist/{cli-RORDPAPE.js → cli-PTKFFNOW.js} +59 -38
  98. package/dist/cli-PTKFFNOW.js.map +1 -0
  99. package/dist/{cli-O4ABTN4Z.js → cli-UW2K5Z5J.js} +31 -30
  100. package/dist/{cli-O4ABTN4Z.js.map → cli-UW2K5Z5J.js.map} +1 -1
  101. package/dist/{cli-JJMOVIKS.js → cli-XXTNPPKB.js} +14 -14
  102. package/dist/cli.js +19 -13
  103. package/dist/cli.js.map +1 -1
  104. package/dist/{config-XDA42RJL.js → config-JJW75SBX.js} +5 -5
  105. package/dist/docmeta.js +13 -12
  106. package/dist/docmeta.js.map +1 -1
  107. package/dist/github-6VQKSB67.js +35 -0
  108. package/dist/github-RBSEM7ZK.js +30 -0
  109. package/dist/graph/runtime.d.ts +4 -1
  110. package/dist/graph/runtime.js +20 -9
  111. package/dist/graph/runtime.js.map +1 -1
  112. package/dist/{host-6GURH5HE.js → host-YSTYO5DX.js} +3 -3
  113. package/dist/index.d.ts +192 -26
  114. package/dist/index.js +129 -124
  115. package/dist/index.js.map +1 -1
  116. package/dist/{json-BXY44ED7.js → json-PU2HLHDQ.js} +18 -17
  117. package/dist/labels-SJNSOPBI.js +73 -0
  118. package/dist/labels-SJNSOPBI.js.map +1 -0
  119. package/dist/lint-KIVTHLGU.js +34 -0
  120. package/dist/list-RDEJDDJF.js +32 -0
  121. package/dist/list-SUTDWL2J.js +35 -0
  122. package/dist/{page-EV7OUBAU.js → page-UMAA3NCM.js} +18 -16
  123. package/dist/{prepare-JHJDJB6I.js → prepare-3I3LOXXD.js} +22 -21
  124. package/dist/{prepare-JHJDJB6I.js.map → prepare-3I3LOXXD.js.map} +1 -1
  125. package/dist/{pretty-SCRK66M5.js → pretty-ANLRHU4O.js} +18 -17
  126. package/dist/{pretty-Q5Y2PA64.js → pretty-Q3ZFKOR7.js} +18 -17
  127. package/dist/{provider-527CO4DM.js → provider-LBX4IXGX.js} +3 -3
  128. package/dist/{release-3D5PK6M7.js → release-VV3UTKE5.js} +3 -3
  129. package/dist/{reporters-M6LJ2IYU.js → reporters-26H3N2KW.js} +3 -3
  130. package/dist/{reporters-RBYTASMI.js → reporters-ILT36CIH.js} +7 -7
  131. package/dist/{reporters-A5ADKDYR.js → reporters-PNDLWT6K.js} +16 -15
  132. package/dist/run-QXCK33Z4.js +37 -0
  133. package/dist/{term-CQAGNG3Q.js → term-D2N7UN4P.js} +981 -141
  134. package/dist/term-D2N7UN4P.js.map +1 -0
  135. package/dist/validate-BRUCOT2O.js +19 -0
  136. package/package.json +3 -2
  137. package/plugin/manni/.claude-plugin/plugin.json +1 -1
  138. package/shapes/graph/shapes-1.1.0.ttl +785 -0
  139. package/dist/build-QSPNK5AL.js +0 -35
  140. package/dist/calibrate-KXN4URPM.js +0 -40
  141. package/dist/capture-JHTSUPUC.js +0 -37
  142. package/dist/check-MDGXEUWL.js +0 -20
  143. package/dist/check-WOQRKNZK.js +0 -29
  144. package/dist/chunk-2DRHT73U.js.map +0 -1
  145. package/dist/chunk-2IAZEB45.js.map +0 -1
  146. package/dist/chunk-2MJ62AYQ.js.map +0 -1
  147. package/dist/chunk-4VBSTXN6.js +0 -392
  148. package/dist/chunk-4VBSTXN6.js.map +0 -1
  149. package/dist/chunk-6HWBRZIN.js.map +0 -1
  150. package/dist/chunk-BKVHX6FU.js.map +0 -1
  151. package/dist/chunk-D4N2V43Z.js.map +0 -1
  152. package/dist/chunk-EFW7CAG4.js +0 -387
  153. package/dist/chunk-EFW7CAG4.js.map +0 -1
  154. package/dist/chunk-GV56WGL2.js.map +0 -1
  155. package/dist/chunk-HQR2ZBHW.js.map +0 -1
  156. package/dist/chunk-J6IDQGJL.js.map +0 -1
  157. package/dist/chunk-JPQDNYXH.js.map +0 -1
  158. package/dist/chunk-JROBZ7JA.js +0 -818
  159. package/dist/chunk-JROBZ7JA.js.map +0 -1
  160. package/dist/chunk-PCQ7ELJH.js.map +0 -1
  161. package/dist/chunk-QCHVR4ZM.js.map +0 -1
  162. package/dist/chunk-QLWC7MKD.js.map +0 -1
  163. package/dist/chunk-TU2WUBVZ.js +0 -2
  164. package/dist/chunk-VSEBFHAY.js.map +0 -1
  165. package/dist/chunk-Y6DOMTQD.js.map +0 -1
  166. package/dist/cli-RORDPAPE.js.map +0 -1
  167. package/dist/github-RY3FRA6P.js +0 -29
  168. package/dist/github-YKQSH7FS.js +0 -34
  169. package/dist/lint-YJ2L22BW.js +0 -33
  170. package/dist/list-NSG24VVX.js +0 -31
  171. package/dist/list-V6EGCSHX.js +0 -34
  172. package/dist/run-BUE2DDXN.js +0 -36
  173. package/dist/term-CQAGNG3Q.js.map +0 -1
  174. package/dist/validate-ZBW44RHT.js +0 -18
  175. /package/dist/{batch-UAULUMGH.js.map → batch-EFSFG6GC.js.map} +0 -0
  176. /package/dist/{build-QSPNK5AL.js.map → build-NIO3UIWJ.js.map} +0 -0
  177. /package/dist/{calibrate-KXN4URPM.js.map → calibrate-6VO7URRV.js.map} +0 -0
  178. /package/dist/{capture-JHTSUPUC.js.map → capture-NMBVJO3C.js.map} +0 -0
  179. /package/dist/{check-MDGXEUWL.js.map → check-SHOYX2B5.js.map} +0 -0
  180. /package/dist/{check-WOQRKNZK.js.map → check-XMJKH3KV.js.map} +0 -0
  181. /package/dist/{check-YEOYBFST.js.map → check-ZMO3ZLMW.js.map} +0 -0
  182. /package/dist/{chunk-M42DZCOU.js.map → chunk-2OZF2VUB.js.map} +0 -0
  183. /package/dist/{chunk-U7CTFN2J.js.map → chunk-42VFJOAF.js.map} +0 -0
  184. /package/dist/{chunk-LBSCW232.js.map → chunk-4Q24OYI3.js.map} +0 -0
  185. /package/dist/{chunk-OPXWPJDA.js.map → chunk-4WJTURRO.js.map} +0 -0
  186. /package/dist/{chunk-GDVZ5VII.js.map → chunk-5SID2SVL.js.map} +0 -0
  187. /package/dist/{chunk-FUCPZVRY.js.map → chunk-AANUY4BH.js.map} +0 -0
  188. /package/dist/{chunk-WDWXAYVH.js.map → chunk-AYVKN3PG.js.map} +0 -0
  189. /package/dist/{chunk-FQXWVS6J.js.map → chunk-CH6IOGXV.js.map} +0 -0
  190. /package/dist/{chunk-4CK6ZSOK.js.map → chunk-D5Z6B4M7.js.map} +0 -0
  191. /package/dist/{chunk-HA6MQMOY.js.map → chunk-D6SELXQ2.js.map} +0 -0
  192. /package/dist/{chunk-PCS4VJBV.js.map → chunk-DGRLHDM4.js.map} +0 -0
  193. /package/dist/{chunk-KGEQJ5CC.js.map → chunk-F564FHMQ.js.map} +0 -0
  194. /package/dist/{chunk-IGSHYP74.js.map → chunk-G3MBUL5M.js.map} +0 -0
  195. /package/dist/{chunk-ADMEPUBT.js.map → chunk-GQ3KRY3B.js.map} +0 -0
  196. /package/dist/{chunk-T7JAOYE5.js.map → chunk-HDPN46JP.js.map} +0 -0
  197. /package/dist/{chunk-R4WXQIOZ.js.map → chunk-IQQAJROD.js.map} +0 -0
  198. /package/dist/{chunk-2IR4T5PO.js.map → chunk-IZXN3WI6.js.map} +0 -0
  199. /package/dist/{chunk-NCPWXHDO.js.map → chunk-JEUFYSFQ.js.map} +0 -0
  200. /package/dist/{chunk-LKP7QDFN.js.map → chunk-JSSM7VVV.js.map} +0 -0
  201. /package/dist/{chunk-EIFCP6CZ.js.map → chunk-KGFSPJLD.js.map} +0 -0
  202. /package/dist/{chunk-RLT5SEML.js.map → chunk-KMORGMCW.js.map} +0 -0
  203. /package/dist/{chunk-WQWKYAAK.js.map → chunk-NUQF5F5J.js.map} +0 -0
  204. /package/dist/{chunk-54F74XR3.js.map → chunk-NZ6KSHFD.js.map} +0 -0
  205. /package/dist/{chunk-4D5IZSXM.js.map → chunk-OHUDZRLK.js.map} +0 -0
  206. /package/dist/{chunk-FBMZJEB3.js.map → chunk-OKMTUAWO.js.map} +0 -0
  207. /package/dist/{chunk-BBT6AVUG.js.map → chunk-QMY57PVW.js.map} +0 -0
  208. /package/dist/{chunk-LPIF5LIE.js.map → chunk-QNDDPXFR.js.map} +0 -0
  209. /package/dist/{chunk-PWBH7DCQ.js.map → chunk-QSIXNTRV.js.map} +0 -0
  210. /package/dist/{chunk-NSBXVPZL.js.map → chunk-U22TOL5Y.js.map} +0 -0
  211. /package/dist/{chunk-NGTVREIH.js.map → chunk-U6IHLEWT.js.map} +0 -0
  212. /package/dist/{chunk-ODRPL3WB.js.map → chunk-UUCCV3SI.js.map} +0 -0
  213. /package/dist/{chunk-MSRU4D4P.js.map → chunk-UXMCHBOJ.js.map} +0 -0
  214. /package/dist/{chunk-B7XYNRJQ.js.map → chunk-VFAKGIDG.js.map} +0 -0
  215. /package/dist/{chunk-VQK4VHLF.js.map → chunk-YQV75FIL.js.map} +0 -0
  216. /package/dist/{chunk-TU2WUBVZ.js.map → chunk-YUTVAMWW.js.map} +0 -0
  217. /package/dist/{cli-I62SRH3R.js.map → cli-BOMA2FMP.js.map} +0 -0
  218. /package/dist/{cli-ONTC5PKT.js.map → cli-OJKFXQOM.js.map} +0 -0
  219. /package/dist/{cli-VUKMWSSF.js.map → cli-PHZAO4LZ.js.map} +0 -0
  220. /package/dist/{cli-JJMOVIKS.js.map → cli-XXTNPPKB.js.map} +0 -0
  221. /package/dist/{config-XDA42RJL.js.map → config-JJW75SBX.js.map} +0 -0
  222. /package/dist/{github-RY3FRA6P.js.map → github-6VQKSB67.js.map} +0 -0
  223. /package/dist/{github-YKQSH7FS.js.map → github-RBSEM7ZK.js.map} +0 -0
  224. /package/dist/{host-6GURH5HE.js.map → host-YSTYO5DX.js.map} +0 -0
  225. /package/dist/{json-BXY44ED7.js.map → json-PU2HLHDQ.js.map} +0 -0
  226. /package/dist/{lint-YJ2L22BW.js.map → lint-KIVTHLGU.js.map} +0 -0
  227. /package/dist/{list-NSG24VVX.js.map → list-RDEJDDJF.js.map} +0 -0
  228. /package/dist/{list-V6EGCSHX.js.map → list-SUTDWL2J.js.map} +0 -0
  229. /package/dist/{page-EV7OUBAU.js.map → page-UMAA3NCM.js.map} +0 -0
  230. /package/dist/{pretty-Q5Y2PA64.js.map → pretty-ANLRHU4O.js.map} +0 -0
  231. /package/dist/{pretty-SCRK66M5.js.map → pretty-Q3ZFKOR7.js.map} +0 -0
  232. /package/dist/{provider-527CO4DM.js.map → provider-LBX4IXGX.js.map} +0 -0
  233. /package/dist/{release-3D5PK6M7.js.map → release-VV3UTKE5.js.map} +0 -0
  234. /package/dist/{reporters-A5ADKDYR.js.map → reporters-26H3N2KW.js.map} +0 -0
  235. /package/dist/{reporters-M6LJ2IYU.js.map → reporters-ILT36CIH.js.map} +0 -0
  236. /package/dist/{reporters-RBYTASMI.js.map → reporters-PNDLWT6K.js.map} +0 -0
  237. /package/dist/{run-BUE2DDXN.js.map → run-QXCK33Z4.js.map} +0 -0
  238. /package/dist/{validate-ZBW44RHT.js.map → validate-BRUCOT2O.js.map} +0 -0
@@ -0,0 +1,685 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ DEFAULT_ABSTRACT_MAX_LENGTH,
4
+ DEFAULT_CRAWL_MIN_PAGES,
5
+ DEFAULT_TERM_BASELINE_PATH,
6
+ TERM_MATCH_FIELDS,
7
+ TERM_RULES,
8
+ TermError,
9
+ languageKey,
10
+ loadTerms
11
+ } from "./chunk-FKAZUZQU.js";
12
+ import {
13
+ TERM_RELATION_FIELDS
14
+ } from "./chunk-PS257NIU.js";
15
+ import {
16
+ isErrorSeverity,
17
+ resolveBaselineRequest,
18
+ settleBaseline
19
+ } from "./chunk-RGLFV4KO.js";
20
+
21
+ // src/term/commands/check.ts
22
+ import { existsSync } from "node:fs";
23
+
24
+ // src/term/core/severity.ts
25
+ var RULE_ID_PREFIX = "manni:term";
26
+ var DEFAULT_SEVERITY = {
27
+ "undefined-term": "error",
28
+ "duplicate-id": "error",
29
+ "label-collision": "error",
30
+ "alt-label-collision": "error",
31
+ "label-overlap": "error",
32
+ "dangling-reference": "error",
33
+ "broader-cycle": "error",
34
+ "see-not-empty": "error",
35
+ "missing-definition": "error",
36
+ "conflicting-matches": "error",
37
+ "asymmetric-hierarchy": "warning",
38
+ "asymmetric-related": "warning",
39
+ "related-in-hierarchy": "warning",
40
+ "alt-label-reference": "warning",
41
+ "ambiguous-alt-label": "warning",
42
+ "deprecated-label": "warning",
43
+ "abstract-too-long": "notice",
44
+ "unused-term": "notice",
45
+ "hierarchy-outside-termbase": "notice",
46
+ "related-siblings": "notice",
47
+ "orphan-term": "notice",
48
+ "keyword-candidate": "notice"
49
+ };
50
+ function ruleId(rule) {
51
+ return `${RULE_ID_PREFIX}/${rule}`;
52
+ }
53
+ function proseRuleId(check) {
54
+ return `${RULE_ID_PREFIX}/prose/${check}`;
55
+ }
56
+ function isTermRule(value) {
57
+ return TERM_RULES.includes(value);
58
+ }
59
+ function resolveSeverity(overrides) {
60
+ return { ...DEFAULT_SEVERITY, ...overrides };
61
+ }
62
+ function foldValeSeverity(severity) {
63
+ return severity === "suggestion" ? "notice" : severity;
64
+ }
65
+
66
+ // src/term/core/check.ts
67
+ var RETIRED_STATUSES = /* @__PURE__ */ new Set(["deprecated", "superseded"]);
68
+ var REFERENCE_FIELDS = TERM_RELATION_FIELDS;
69
+ function checkTermSet(set, opts = {}) {
70
+ const levels = resolveSeverity(opts.severity);
71
+ const maxLength = opts.abstractMaxLength ?? DEFAULT_ABSTRACT_MAX_LENGTH;
72
+ const { terms } = set;
73
+ const drafts = [];
74
+ const fold = (value) => value.toLowerCase();
75
+ const where = (t) => `${t.location.file}:${String(t.location.line)}`;
76
+ const onEntry = (t, rule, message, field) => ({
77
+ rule,
78
+ message,
79
+ file: t.location.file,
80
+ line: (field === void 0 ? void 0 : t.location.fieldLines[field]) ?? t.location.line,
81
+ id: t.id,
82
+ ...field === void 0 ? {} : { field }
83
+ });
84
+ const byLabel = /* @__PURE__ */ new Map();
85
+ const byId = /* @__PURE__ */ new Map();
86
+ const inLanguage = /* @__PURE__ */ new Map();
87
+ const byAlt = /* @__PURE__ */ new Map();
88
+ const labelled = /* @__PURE__ */ new Map();
89
+ const altHeld = /* @__PURE__ */ new Map();
90
+ const claim = (map, key, index) => {
91
+ if (!map.has(key)) map.set(key, index);
92
+ };
93
+ terms.forEach((t, index) => {
94
+ claim(byLabel, fold(t.record.label), index);
95
+ const group = labelled.get(fold(t.record.label));
96
+ if (group === void 0) labelled.set(fold(t.record.label), [index]);
97
+ else group.push(index);
98
+ claim(byId, fold(t.id), index);
99
+ claim(inLanguage, `${languageKey(t)} label ${fold(t.record.label)}`, index);
100
+ claim(inLanguage, `${languageKey(t)} id ${fold(t.id)}`, index);
101
+ for (const alt of t.record["alt-labels"] ?? []) {
102
+ claim(byAlt, fold(alt), index);
103
+ claim(inLanguage, `${languageKey(t)} alt ${fold(alt)}`, index);
104
+ const holders = altHeld.get(fold(alt));
105
+ if (holders === void 0) altHeld.set(fold(alt), /* @__PURE__ */ new Set([index]));
106
+ else holders.add(index);
107
+ }
108
+ });
109
+ const clash = (t, a, other, b) => fold(a) === fold(b) && (languageKey(t) === languageKey(other) || a !== b);
110
+ const collider = (t, index, value, before) => {
111
+ for (const otherIndex of labelled.get(fold(value)) ?? []) {
112
+ if (otherIndex === index || before && otherIndex > index) continue;
113
+ const other = terms[otherIndex];
114
+ if (other !== void 0 && clash(t, value, other, other.record.label)) return other;
115
+ }
116
+ return void 0;
117
+ };
118
+ const altCollider = (t, index, value, before) => {
119
+ for (const otherIndex of altHeld.get(fold(value)) ?? []) {
120
+ if (otherIndex === index || before && otherIndex > index) continue;
121
+ const other = terms[otherIndex];
122
+ const alt = other?.record["alt-labels"]?.find((a) => fold(a) === fold(value));
123
+ if (other !== void 0 && alt !== void 0 && clash(t, value, other, alt)) return other;
124
+ }
125
+ return void 0;
126
+ };
127
+ const resolveReference = (from, value) => inLanguage.get(`${languageKey(from)} label ${fold(value)}`) ?? inLanguage.get(`${languageKey(from)} id ${fold(value)}`) ?? byLabel.get(fold(value)) ?? byId.get(fold(value));
128
+ const tagOf = (tag) => tag === void 0 || tag === "" ? void 0 : fold(tag);
129
+ const primaryOf = (tag) => tag.split("-")[0] ?? "";
130
+ const ids = /* @__PURE__ */ new Map();
131
+ const alts = /* @__PURE__ */ new Map();
132
+ const list = (map, key, index) => {
133
+ const held = map.get(key);
134
+ if (held === void 0) map.set(key, [index]);
135
+ else held.push(index);
136
+ };
137
+ terms.forEach((t, index) => {
138
+ list(ids, fold(t.id), index);
139
+ for (const alt of t.record["alt-labels"] ?? []) list(alts, fold(alt), index);
140
+ });
141
+ const tiers = [
142
+ [labelled, false],
143
+ [ids, false],
144
+ [alts, true]
145
+ ];
146
+ const resolvePageName = (value, lang) => {
147
+ const wanted = tagOf(lang);
148
+ const passes = wanted === void 0 ? [() => true] : [
149
+ (t) => tagOf(t.language) === wanted,
150
+ (t) => {
151
+ const own = tagOf(t.language);
152
+ return own !== void 0 && primaryOf(own) === primaryOf(wanted);
153
+ },
154
+ () => true
155
+ ];
156
+ for (const pass of passes) {
157
+ for (const [map, alt] of tiers) {
158
+ const index = map.get(fold(value))?.find((i) => {
159
+ const t = terms[i];
160
+ return t !== void 0 && pass(t);
161
+ });
162
+ if (index !== void 0) return { index, alt };
163
+ }
164
+ }
165
+ return void 0;
166
+ };
167
+ const resolveName = (value, lang) => resolvePageName(value, lang)?.index;
168
+ const usedIds = /* @__PURE__ */ new Set();
169
+ for (const reference of set.references) {
170
+ const field = reference.field ?? "concepts";
171
+ const at = { file: reference.file, ...reference.line === void 0 ? {} : { line: reference.line } };
172
+ const hit = resolvePageName(reference.label, reference.language);
173
+ const target = terms[hit?.index ?? -1];
174
+ if (target !== void 0) usedIds.add(fold(target.id));
175
+ if (hit !== void 0 && !hit.alt) continue;
176
+ drafts.push(
177
+ target === void 0 ? { rule: "undefined-term", message: `${field}: "${reference.label}" names no entry.`, ...at } : {
178
+ rule: "alt-label-reference",
179
+ message: `${field}: "${reference.label}" is an alt-label of "${target.record.label}", so name the label.`,
180
+ ...at
181
+ }
182
+ );
183
+ }
184
+ const sharing = /* @__PURE__ */ new Map();
185
+ for (const t of terms) {
186
+ const id = `${languageKey(t)} ${fold(t.id)}`;
187
+ const group = sharing.get(id);
188
+ if (group === void 0) sharing.set(id, [t]);
189
+ else group.push(t);
190
+ }
191
+ for (const group of sharing.values()) {
192
+ if (group.length < 2) continue;
193
+ for (const t of group) {
194
+ const others = group.filter((other) => other !== t).map(where);
195
+ drafts.push(onEntry(t, "duplicate-id", `id: "${t.id}" is also used by ${others.join(", ")}`));
196
+ }
197
+ }
198
+ terms.forEach((t, index) => {
199
+ const firstTerm = collider(t, index, t.record.label, true);
200
+ if (firstTerm !== void 0) {
201
+ drafts.push(
202
+ onEntry(
203
+ t,
204
+ "label-collision",
205
+ `"${t.record.label}" is claimed by ${where(firstTerm)} as "${firstTerm.record.label}"`,
206
+ "label"
207
+ )
208
+ );
209
+ }
210
+ for (const alt of t.record["alt-labels"] ?? []) {
211
+ const owner = collider(t, index, alt, false);
212
+ if (owner !== void 0) {
213
+ drafts.push(
214
+ onEntry(t, "alt-label-collision", `alt-labels: "${alt}" is the label of ${where(owner)}`, "alt-labels")
215
+ );
216
+ }
217
+ if (fold(alt) === fold(t.record.label)) {
218
+ drafts.push(onEntry(t, "label-overlap", `alt-labels: "${alt}" repeats this entry's label.`, "alt-labels"));
219
+ }
220
+ const sharer = altCollider(t, index, alt, true);
221
+ if (sharer !== void 0) {
222
+ drafts.push(
223
+ onEntry(
224
+ t,
225
+ "ambiguous-alt-label",
226
+ `alt-labels: "${alt}" is also an alt-label of ${where(sharer)}, so a reader can't tell which term it means.`,
227
+ "alt-labels"
228
+ )
229
+ );
230
+ }
231
+ }
232
+ const ownAlts = new Set((t.record["alt-labels"] ?? []).map(fold));
233
+ for (const hidden of t.record["hidden-labels"] ?? []) {
234
+ const labelOf = collider(t, index, hidden, false);
235
+ const altOf = labelOf === void 0 ? altCollider(t, index, hidden, false) : void 0;
236
+ const overlap = fold(hidden) === fold(t.record.label) ? "repeats this entry's label." : ownAlts.has(fold(hidden)) ? "repeats this entry's alt-label." : labelOf !== void 0 ? `is the label of ${where(labelOf)}.` : altOf !== void 0 ? `is an alt-label of ${where(altOf)}.` : void 0;
237
+ if (overlap !== void 0) {
238
+ drafts.push(onEntry(t, "label-overlap", `hidden-labels: "${hidden}" ${overlap}`, "hidden-labels"));
239
+ }
240
+ }
241
+ const status = t.record.designations?.find((d) => fold(d.term) === fold(t.record.label))?.["administrative-status"];
242
+ if (t.record.see === void 0 && status !== void 0 && RETIRED_STATUSES.has(fold(status))) {
243
+ drafts.push(
244
+ onEntry(
245
+ t,
246
+ "deprecated-label",
247
+ `label: "${t.record.label}" is deprecated in designations, so promote another label or redirect with see:.`,
248
+ "label"
249
+ )
250
+ );
251
+ }
252
+ for (const field of REFERENCE_FIELDS) {
253
+ for (const value of referenceValues(t, field)) {
254
+ if (resolveReference(t, value) === void 0) {
255
+ drafts.push(onEntry(t, "dangling-reference", `${field}: "${value}" names no entry`, field));
256
+ }
257
+ }
258
+ }
259
+ if (t.record.see !== void 0 && t.record.definition !== void 0) {
260
+ drafts.push(
261
+ onEntry(t, "see-not-empty", `see: "${t.record.see}" redirects this entry, so remove its definition`, "see")
262
+ );
263
+ }
264
+ if (t.record.see === void 0 && t.record.definition === void 0) {
265
+ drafts.push(
266
+ onEntry(t, "missing-definition", "definition: missing, so write one or run manni term fill.", "definition")
267
+ );
268
+ }
269
+ const kindOf = /* @__PURE__ */ new Map();
270
+ const conflicting = /* @__PURE__ */ new Set();
271
+ for (const field of TERM_MATCH_FIELDS) {
272
+ for (const iri of t.record[field] ?? []) {
273
+ const first = kindOf.get(iri);
274
+ if (first === void 0) kindOf.set(iri, field);
275
+ else if (first !== field && !conflicting.has(iri)) {
276
+ conflicting.add(iri);
277
+ drafts.push(
278
+ onEntry(t, "conflicting-matches", `${first}: "${iri}" is also in ${field}, and a mapping has one kind.`, first)
279
+ );
280
+ }
281
+ }
282
+ }
283
+ const abstract = t.record.abstract;
284
+ if (abstract !== void 0 && abstract.length > maxLength) {
285
+ drafts.push(
286
+ onEntry(
287
+ t,
288
+ "abstract-too-long",
289
+ `abstract: ${String(abstract.length)} characters is over the limit of ${String(maxLength)}, so shorten it`,
290
+ "abstract"
291
+ )
292
+ );
293
+ }
294
+ if (!usedIds.has(fold(t.id))) {
295
+ drafts.push(onEntry(t, "unused-term", "no page's concepts: names this term"));
296
+ }
297
+ });
298
+ const edges = (field) => terms.map((t) => {
299
+ const targets = /* @__PURE__ */ new Set();
300
+ for (const value of referenceValues(t, field)) {
301
+ const target = resolveReference(t, value);
302
+ if (target !== void 0) targets.add(target);
303
+ }
304
+ return targets;
305
+ });
306
+ const broader = edges("broader");
307
+ const narrower = edges("narrower");
308
+ const related = edges("related-terms");
309
+ terms.forEach((t, index) => {
310
+ for (const other of related[index] ?? []) {
311
+ const otherTerm = terms[other];
312
+ if (otherTerm !== void 0 && !(related[other]?.has(index) ?? false)) {
313
+ drafts.push(
314
+ onEntry(
315
+ otherTerm,
316
+ "asymmetric-related",
317
+ `related-terms: omits "${t.record.label}", which lists this entry as related.`,
318
+ "related-terms"
319
+ )
320
+ );
321
+ }
322
+ }
323
+ });
324
+ terms.forEach((t, index) => {
325
+ for (const parent of broader[index] ?? []) {
326
+ const parentTerm = terms[parent];
327
+ if (parentTerm !== void 0 && !(narrower[parent]?.has(index) ?? false)) {
328
+ drafts.push(
329
+ onEntry(
330
+ parentTerm,
331
+ "asymmetric-hierarchy",
332
+ `narrower: omits "${t.record.label}", which lists this entry as broader`,
333
+ "narrower"
334
+ )
335
+ );
336
+ }
337
+ }
338
+ for (const child of narrower[index] ?? []) {
339
+ const childTerm = terms[child];
340
+ if (childTerm !== void 0 && !(broader[child]?.has(index) ?? false)) {
341
+ drafts.push(
342
+ onEntry(
343
+ childTerm,
344
+ "asymmetric-hierarchy",
345
+ `broader: omits "${t.record.label}", which lists this entry as narrower`,
346
+ "broader"
347
+ )
348
+ );
349
+ }
350
+ }
351
+ });
352
+ const names = terms.map((t) => t.record.label);
353
+ const freeform = /* @__PURE__ */ new Map();
354
+ const node = (value, lang) => {
355
+ const index = resolveName(value, lang) ?? freeform.get(fold(value));
356
+ if (index !== void 0) return index;
357
+ freeform.set(fold(value), names.length);
358
+ names.push(value);
359
+ return names.length - 1;
360
+ };
361
+ const up = [];
362
+ const termEdges = /* @__PURE__ */ new Set();
363
+ const blockEdges = /* @__PURE__ */ new Map();
364
+ const link = (child, parent) => {
365
+ (up[child] ??= /* @__PURE__ */ new Set()).add(parent);
366
+ return `${String(child)}>${String(parent)}`;
367
+ };
368
+ broader.forEach((parents, child) => {
369
+ for (const parent of parents) termEdges.add(link(child, parent));
370
+ });
371
+ narrower.forEach((children, parent) => {
372
+ for (const child of children) termEdges.add(link(child, parent));
373
+ });
374
+ for (const block of set.blocks) {
375
+ const subject = node(block.label, block.language);
376
+ for (const edge of block.edges) {
377
+ if (edge.field === "related-concepts") continue;
378
+ const other = node(edge.value, block.language);
379
+ const key = edge.field === "broader" ? link(subject, other) : link(other, subject);
380
+ const line = edge.line ?? block.line;
381
+ if (!blockEdges.has(key)) blockEdges.set(key, { file: block.file, ...line === void 0 ? {} : { line } });
382
+ }
383
+ }
384
+ for (const [start, path] of broaderCycles(up)) {
385
+ const chain = [...path, start];
386
+ const message = `broader: ${chain.map((index) => names[index] ?? "").join(" > ")}`;
387
+ const hops = path.map((from, i) => `${String(from)}>${String(chain[i + 1])}`);
388
+ const viaBlock = hops.find((hop) => !termEdges.has(hop));
389
+ const startTerm = terms[start];
390
+ if (viaBlock === void 0 && startTerm !== void 0) {
391
+ drafts.push(onEntry(startTerm, "broader-cycle", message, "broader"));
392
+ } else {
393
+ const at = blockEdges.get(viaBlock ?? "");
394
+ if (at !== void 0) drafts.push({ rule: "broader-cycle", message, ...at });
395
+ }
396
+ }
397
+ const concept = (index, value) => {
398
+ const t = index === void 0 ? void 0 : terms[index];
399
+ return t === void 0 ? `name ${fold(value)}` : `id ${fold(t.id)}`;
400
+ };
401
+ for (const block of set.blocks) {
402
+ const t = terms[resolveName(block.label, block.language) ?? -1];
403
+ if (t === void 0) continue;
404
+ for (const edge of block.edges) {
405
+ const field = edge.field === "related-concepts" ? "related-terms" : edge.field;
406
+ const listed = referenceValues(t, field).map((value) => concept(resolveReference(t, value), value));
407
+ if (listed.includes(concept(resolveName(edge.value, block.language), edge.value))) continue;
408
+ const kind = t.location.construct === "page" ? "page" : "entry";
409
+ const line = edge.line ?? block.line;
410
+ drafts.push({
411
+ rule: "hierarchy-outside-termbase",
412
+ message: `graph: ${edge.field} "${edge.value}" on "${t.record.label}" is not on its term ${kind} (${t.location.file}), so add it there.`,
413
+ file: block.file,
414
+ ...line === void 0 ? {} : { line }
415
+ });
416
+ }
417
+ }
418
+ const ancestors = (start) => {
419
+ const seen = /* @__PURE__ */ new Set();
420
+ const stack = [...up[start] ?? []];
421
+ for (let next = stack.pop(); next !== void 0; next = stack.pop()) {
422
+ if (seen.has(next)) continue;
423
+ seen.add(next);
424
+ stack.push(...up[next] ?? []);
425
+ }
426
+ return seen;
427
+ };
428
+ const siblingPairs = /* @__PURE__ */ new Set();
429
+ terms.forEach((t, index) => {
430
+ const above = ancestors(index);
431
+ const seen = /* @__PURE__ */ new Set();
432
+ for (const value of referenceValues(t, "related-terms")) {
433
+ const other = resolveReference(t, value);
434
+ if (other === void 0 || other === index || seen.has(other)) continue;
435
+ seen.add(other);
436
+ const direction = above.has(other) ? "broader" : ancestors(other).has(index) ? "narrower" : void 0;
437
+ if (direction !== void 0) {
438
+ drafts.push(
439
+ onEntry(
440
+ t,
441
+ "related-in-hierarchy",
442
+ `related-terms: "${value}" is also ${direction} than this entry, so keep one of the two.`,
443
+ "related-terms"
444
+ )
445
+ );
446
+ continue;
447
+ }
448
+ const parent = [...up[index] ?? []].find((p) => up[other]?.has(p) ?? false);
449
+ const pair = `${String(Math.min(index, other))}~${String(Math.max(index, other))}`;
450
+ if (parent === void 0 || siblingPairs.has(pair)) continue;
451
+ siblingPairs.add(pair);
452
+ drafts.push(
453
+ onEntry(
454
+ t,
455
+ "related-siblings",
456
+ `related-terms: "${value}" shares the broader term "${names[parent] ?? ""}", which already relates them.`,
457
+ "related-terms"
458
+ )
459
+ );
460
+ }
461
+ });
462
+ const isTerm = (index) => index < terms.length;
463
+ if (up.some((parents, child) => isTerm(child) || [...parents].some(isTerm))) {
464
+ const placed = /* @__PURE__ */ new Set();
465
+ const place = (index) => {
466
+ if (index === void 0) return;
467
+ const t = terms[index];
468
+ if (t !== void 0) placed.add(fold(t.id));
469
+ };
470
+ up.forEach((parents, child) => {
471
+ place(child);
472
+ for (const parent of parents) place(parent);
473
+ });
474
+ related.forEach((others, index) => {
475
+ if (others.size > 0) place(index);
476
+ for (const other of others) place(other);
477
+ });
478
+ for (const block of set.blocks) {
479
+ for (const edge of block.edges) {
480
+ if (edge.field !== "related-concepts") continue;
481
+ place(resolveName(block.label, block.language));
482
+ place(resolveName(edge.value, block.language));
483
+ }
484
+ }
485
+ for (const t of terms) {
486
+ if (t.record.see === void 0 && !placed.has(fold(t.id))) {
487
+ drafts.push(onEntry(t, "orphan-term", "no broader, narrower or related term, so place it in the hierarchy."));
488
+ }
489
+ }
490
+ }
491
+ const minPages = opts.minPages ?? DEFAULT_CRAWL_MIN_PAGES;
492
+ const byKeyword = /* @__PURE__ */ new Map();
493
+ for (const keyword of set.keywords ?? []) {
494
+ const uses = byKeyword.get(fold(keyword.label));
495
+ if (uses === void 0) byKeyword.set(fold(keyword.label), [keyword]);
496
+ else uses.push(keyword);
497
+ }
498
+ for (const [key, uses] of byKeyword) {
499
+ if (byLabel.has(key) || byId.has(key) || byAlt.has(key)) continue;
500
+ const pages = new Set(uses.map((use) => use.file)).size;
501
+ const first = [...uses].sort((a, b) => compareText(a.file, b.file) || (a.line ?? 0) - (b.line ?? 0))[0];
502
+ if (pages < minPages || first === void 0) continue;
503
+ drafts.push({
504
+ rule: "keyword-candidate",
505
+ message: `keywords: "${first.label}" is on ${String(pages)} pages and names no term, so add it to concepts: or run manni term fill --crawl.`,
506
+ file: first.file,
507
+ ...first.line === void 0 ? {} : { line: first.line }
508
+ });
509
+ }
510
+ const findings = [];
511
+ for (const draft of drafts) {
512
+ const level = levels[draft.rule];
513
+ if (level === "off") continue;
514
+ findings.push({
515
+ rule: draft.rule,
516
+ ruleId: ruleId(draft.rule),
517
+ severity: level,
518
+ message: draft.message,
519
+ file: draft.file,
520
+ ...draft.line === void 0 ? {} : { line: draft.line },
521
+ ...draft.id === void 0 ? {} : { id: draft.id },
522
+ ...draft.field === void 0 ? {} : { field: draft.field }
523
+ });
524
+ }
525
+ return findings.sort(compareFindings);
526
+ }
527
+ function referenceValues(t, field) {
528
+ const value = t.record[field];
529
+ if (value === void 0) return [];
530
+ return typeof value === "string" ? [value] : value;
531
+ }
532
+ function broaderCycles(broader) {
533
+ const cycles = [];
534
+ for (let start = 0; start < broader.length; start++) {
535
+ const path = [start];
536
+ const onPath = /* @__PURE__ */ new Set([start]);
537
+ const walk = (node) => {
538
+ for (const next of broader[node] ?? []) {
539
+ if (next === start) {
540
+ cycles.push([start, [...path]]);
541
+ } else if (next > start && !onPath.has(next)) {
542
+ path.push(next);
543
+ onPath.add(next);
544
+ walk(next);
545
+ path.pop();
546
+ onPath.delete(next);
547
+ }
548
+ }
549
+ };
550
+ walk(start);
551
+ }
552
+ return cycles;
553
+ }
554
+ function compareText(a, b) {
555
+ return a < b ? -1 : a > b ? 1 : 0;
556
+ }
557
+ function compareFindings(a, b) {
558
+ return compareText(a.file, b.file) || (a.line ?? 0) - (b.line ?? 0) || compareText(a.ruleId, b.ruleId) || compareText(a.message, b.message);
559
+ }
560
+
561
+ // src/term/commands/findings.ts
562
+ var FINDING_FORMATS = ["pretty", "json", "github", "sarif", "junit"];
563
+ var JUNIT_CLASSNAME = "manni.term";
564
+ var LINE_REFERENCE = /:\d+\b/g;
565
+ function toFieldError(finding) {
566
+ const keyword = finding.ruleId.startsWith(`${RULE_ID_PREFIX}/`) ? finding.ruleId.slice(RULE_ID_PREFIX.length + 1) : finding.ruleId;
567
+ const { field } = finding;
568
+ const subject = [finding.id ?? "", field ?? "", finding.message.replace(LINE_REFERENCE, "")].join("\0");
569
+ const error = {
570
+ schema: RULE_ID_PREFIX,
571
+ instancePath: field === void 0 ? "" : `/${field}`,
572
+ message: finding.message,
573
+ keyword,
574
+ subject,
575
+ severity: finding.severity
576
+ };
577
+ if (finding.line !== void 0) error.line = finding.line;
578
+ return error;
579
+ }
580
+ function toResults(set, findings) {
581
+ const origin = /* @__PURE__ */ new Map();
582
+ const byFile = /* @__PURE__ */ new Map();
583
+ for (const term of set.terms) {
584
+ if (!byFile.has(term.location.file)) byFile.set(term.location.file, []);
585
+ }
586
+ for (const finding of findings) {
587
+ const error = toFieldError(finding);
588
+ origin.set(error, finding);
589
+ const list = byFile.get(finding.file) ?? [];
590
+ list.push(error);
591
+ byFile.set(finding.file, list);
592
+ }
593
+ const results = [...byFile.keys()].sort().map((file) => {
594
+ const errors = byFile.get(file) ?? [];
595
+ return { file, format: "term", ok: !errors.some(isErrorSeverity), schemas: [RULE_ID_PREFIX], errors };
596
+ });
597
+ return { results, origin };
598
+ }
599
+ function summarize(results, baseline) {
600
+ const failed = results.filter((r) => !r.ok).length;
601
+ const count = (keep) => results.reduce((n, r) => n + r.errors.filter(keep).length, 0);
602
+ const warnings = count((e) => e.severity === "warning");
603
+ const notices = count((e) => e.severity === "notice");
604
+ return {
605
+ files: results.length,
606
+ passed: results.length - failed,
607
+ failed,
608
+ errors: count(isErrorSeverity),
609
+ ...warnings > 0 ? { warnings } : {},
610
+ ...notices > 0 ? { notices } : {},
611
+ ...baseline ? { baseline } : {}
612
+ };
613
+ }
614
+ function reportedFindings(results, origin) {
615
+ const kept = [];
616
+ for (const result of results) {
617
+ for (const error of result.errors) {
618
+ const finding = origin.get(error);
619
+ if (finding !== void 0) kept.push(finding);
620
+ }
621
+ }
622
+ return kept.sort(compareFindings2);
623
+ }
624
+ function compareFindings2(a, b) {
625
+ if (a.file !== b.file) return a.file < b.file ? -1 : 1;
626
+ const lineA = a.line ?? 0;
627
+ const lineB = b.line ?? 0;
628
+ if (lineA !== lineB) return lineA - lineB;
629
+ if (a.ruleId !== b.ruleId) return a.ruleId < b.ruleId ? -1 : 1;
630
+ return a.message < b.message ? -1 : a.message > b.message ? 1 : 0;
631
+ }
632
+
633
+ // src/term/commands/check.ts
634
+ async function runCheck(opts) {
635
+ const { cwd, run, set } = await loadTerms(opts);
636
+ const config = run.config;
637
+ const findings = checkTermSet(set, {
638
+ ...config?.severity === void 0 ? {} : { severity: config.severity },
639
+ ...config?.abstractMaxLength === void 0 ? {} : { abstractMaxLength: config.abstractMaxLength },
640
+ ...config?.fill?.crawl?.minPages === void 0 ? {} : { minPages: config.fill.crawl.minPages }
641
+ });
642
+ const { results, origin } = toResults(set, findings);
643
+ const frame = { cwd, base: run.configDir ?? cwd, runBase: run.base };
644
+ let request = resolveBaselineRequest(
645
+ opts.baseline === true ? { baseline: true } : {},
646
+ config?.baseline,
647
+ run.configDir,
648
+ cwd,
649
+ { current: DEFAULT_TERM_BASELINE_PATH }
650
+ );
651
+ if (request !== null && !existsSync(request.absPath)) {
652
+ if (opts.baseline !== true) {
653
+ throw new TermError(
654
+ `Baseline "${request.label}" not found. Record one with \`manni term check --baseline\`.`
655
+ );
656
+ }
657
+ request = { ...request, write: true };
658
+ }
659
+ const { results: reported, baseline } = await settleBaseline(results, request, frame);
660
+ return {
661
+ findings: reportedFindings(reported, origin),
662
+ results: reported,
663
+ summary: summarize(reported, baseline),
664
+ frame,
665
+ terms: set.terms.length,
666
+ references: set.references.length,
667
+ ...baseline === void 0 ? {} : { baseline },
668
+ found: findings.length,
669
+ cwd
670
+ };
671
+ }
672
+
673
+ export {
674
+ RULE_ID_PREFIX,
675
+ proseRuleId,
676
+ isTermRule,
677
+ foldValeSeverity,
678
+ FINDING_FORMATS,
679
+ JUNIT_CLASSNAME,
680
+ toResults,
681
+ summarize,
682
+ reportedFindings,
683
+ runCheck
684
+ };
685
+ //# sourceMappingURL=chunk-QDC7JPFG.js.map