@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.
- package/README.md +1 -1
- package/dist/batch-OMDKRGUE.js +48 -0
- package/dist/build-YCY5MUHA.js +37 -0
- package/dist/calibrate-RN2NJ4FS.js +43 -0
- package/dist/capture-2WYROZKA.js +39 -0
- package/dist/check-KRVWHF7E.js +33 -0
- package/dist/{check-NBN2YK2J.js → check-LVUTWAGR.js} +33 -32
- package/dist/{check-NBN2YK2J.js.map → check-LVUTWAGR.js.map} +1 -1
- package/dist/check-MR7IG7IP.js +36 -0
- package/dist/{check-LU5YC3L4.js → check-OIRJ6OBW.js} +15 -14
- package/dist/{chunk-J5NOWIJ3.js → chunk-3CSEHHKB.js} +14 -8
- package/dist/{chunk-J5NOWIJ3.js.map → chunk-3CSEHHKB.js.map} +1 -1
- package/dist/{chunk-7RNONVHI.js → chunk-3EJVJDMX.js} +9 -9
- package/dist/{chunk-LSFXNAHU.js → chunk-3WQMMLIO.js} +129 -59
- package/dist/chunk-3WQMMLIO.js.map +1 -0
- package/dist/{chunk-OREHJQNN.js → chunk-46OWIAAX.js} +5 -4
- package/dist/{chunk-OREHJQNN.js.map → chunk-46OWIAAX.js.map} +1 -1
- package/dist/{chunk-LNGSE7V2.js → chunk-476DMDJ5.js} +132 -27
- package/dist/chunk-476DMDJ5.js.map +1 -0
- package/dist/{chunk-EQ7E6HMG.js → chunk-4MYW2D2U.js} +14 -16
- package/dist/chunk-4MYW2D2U.js.map +1 -0
- package/dist/{chunk-NTEYYYKL.js → chunk-525KMBZS.js} +16 -22
- package/dist/chunk-525KMBZS.js.map +1 -0
- package/dist/{chunk-HIEGOW7X.js → chunk-57DHX65T.js} +5 -79
- package/dist/chunk-57DHX65T.js.map +1 -0
- package/dist/{chunk-PCE7QHXJ.js → chunk-5D24C6WM.js} +6 -1
- package/dist/chunk-5D24C6WM.js.map +1 -0
- package/dist/{chunk-DQOM3DEU.js → chunk-6DYFWAZA.js} +563 -359
- package/dist/chunk-6DYFWAZA.js.map +1 -0
- package/dist/{chunk-CU57HT2E.js → chunk-6WJUZQQX.js} +2 -2
- package/dist/chunk-7EKXSSEO.js +81 -0
- package/dist/chunk-7EKXSSEO.js.map +1 -0
- package/dist/{chunk-ULDV2LUI.js → chunk-7SVFBJBE.js} +10 -4
- package/dist/chunk-7SVFBJBE.js.map +1 -0
- package/dist/{chunk-QKT67PFE.js → chunk-7XHW5DZA.js} +9 -9
- package/dist/{chunk-TDCOKKMI.js → chunk-AL4HRKSZ.js} +3 -3
- package/dist/{chunk-OTJOBZJ5.js → chunk-B2242FYO.js} +2 -1
- package/dist/chunk-B2242FYO.js.map +1 -0
- package/dist/chunk-BREAC43H.js +85 -0
- package/dist/chunk-BREAC43H.js.map +1 -0
- package/dist/{chunk-HKTGHLBA.js → chunk-C37OVJ35.js} +2 -2
- package/dist/{chunk-HKTGHLBA.js.map → chunk-C37OVJ35.js.map} +1 -1
- package/dist/{chunk-YQV75FIL.js → chunk-CFMI74TP.js} +3 -3
- package/dist/{chunk-BMBAAPGN.js → chunk-CWGBRWP7.js} +33 -18
- package/dist/chunk-CWGBRWP7.js.map +1 -0
- package/dist/chunk-DN4LCWSA.js +83 -0
- package/dist/chunk-DN4LCWSA.js.map +1 -0
- package/dist/{chunk-JEUFYSFQ.js → chunk-DW22KCLN.js} +118 -75
- package/dist/chunk-DW22KCLN.js.map +1 -0
- package/dist/{chunk-PCGBXHSE.js → chunk-FEEO7ET6.js} +5 -5
- package/dist/{chunk-CODWRUAD.js → chunk-FYWQS35G.js} +7 -5
- package/dist/chunk-FYWQS35G.js.map +1 -0
- package/dist/{chunk-3O6U4ICM.js → chunk-GLQCSDFS.js} +3 -3
- package/dist/{chunk-BQXY76JB.js → chunk-GUTAKJIF.js} +148 -92
- package/dist/chunk-GUTAKJIF.js.map +1 -0
- package/dist/{chunk-WVXCN5DS.js → chunk-GZHBMMDC.js} +78 -14
- package/dist/chunk-GZHBMMDC.js.map +1 -0
- package/dist/{chunk-52WO7ESI.js → chunk-IE5PXI6M.js} +6 -5
- package/dist/chunk-IE5PXI6M.js.map +1 -0
- package/dist/{chunk-ZXRAE55H.js → chunk-IGRXQC3H.js} +2 -2
- package/dist/{chunk-U6IHLEWT.js → chunk-JCTHXG33.js} +2 -2
- package/dist/{chunk-NSAW7U42.js → chunk-JHE3CYWS.js} +58 -10
- package/dist/chunk-JHE3CYWS.js.map +1 -0
- package/dist/{chunk-6ZFJWUUH.js → chunk-JNMY7KZG.js} +2 -2
- package/dist/chunk-JQPZKWIP.js +76 -0
- package/dist/chunk-JQPZKWIP.js.map +1 -0
- package/dist/{chunk-OBXCJZ6R.js → chunk-JTATFPWB.js} +28 -17
- package/dist/chunk-JTATFPWB.js.map +1 -0
- package/dist/{chunk-3HUCB4Z3.js → chunk-JULE3EU3.js} +10 -7
- package/dist/chunk-JULE3EU3.js.map +1 -0
- package/dist/{chunk-TQ3W6RKG.js → chunk-KCXQXKOL.js} +3 -3
- package/dist/{chunk-VYBYUQIP.js → chunk-KN37BXVY.js} +88 -7
- package/dist/chunk-KN37BXVY.js.map +1 -0
- package/dist/{chunk-OUAH7XF2.js → chunk-MAOX3524.js} +2 -2
- package/dist/chunk-MC7U5IH4.js +126 -0
- package/dist/chunk-MC7U5IH4.js.map +1 -0
- package/dist/{chunk-OYIWF3B2.js → chunk-NIQ2JSZO.js} +29 -20
- package/dist/chunk-NIQ2JSZO.js.map +1 -0
- package/dist/{chunk-HY6ROJTH.js → chunk-OFOIBV5J.js} +86 -10
- package/dist/chunk-OFOIBV5J.js.map +1 -0
- package/dist/{chunk-TZOYZK2E.js → chunk-OZUPJB4J.js} +2 -2
- package/dist/{chunk-N6A6DJUO.js → chunk-Q2VOXKAQ.js} +6 -7
- package/dist/chunk-Q2VOXKAQ.js.map +1 -0
- package/dist/{chunk-GWI6JPTT.js → chunk-Q62Q7CDI.js} +88 -8
- package/dist/chunk-Q62Q7CDI.js.map +1 -0
- package/dist/{chunk-PA7CMQGD.js → chunk-QDO5JFFV.js} +11 -5
- package/dist/chunk-QDO5JFFV.js.map +1 -0
- package/dist/{chunk-VNYXK7TM.js → chunk-QEJ4GH25.js} +8 -8
- package/dist/chunk-QEJ4GH25.js.map +1 -0
- package/dist/chunk-QK6VYJHV.js +26 -0
- package/dist/chunk-QK6VYJHV.js.map +1 -0
- package/dist/chunk-QS2Z3SWL.js +21 -0
- package/dist/chunk-QS2Z3SWL.js.map +1 -0
- package/dist/{chunk-NWUXRV6N.js → chunk-QS3K57OJ.js} +10 -8
- package/dist/chunk-QS3K57OJ.js.map +1 -0
- package/dist/{chunk-OKMTUAWO.js → chunk-QSPH4F56.js} +5 -5
- package/dist/{chunk-3XGTNN3M.js → chunk-RGRNAQG5.js} +12 -124
- package/dist/chunk-RGRNAQG5.js.map +1 -0
- package/dist/{chunk-E6BVUDGY.js → chunk-SLGCRXHM.js} +4 -4
- package/dist/{chunk-KE2F7QES.js → chunk-SVF3WCC7.js} +6 -6
- package/dist/{chunk-IGQMBHFY.js → chunk-T62SFCQY.js} +88 -12
- package/dist/chunk-T62SFCQY.js.map +1 -0
- package/dist/{chunk-SCLXVTFZ.js → chunk-TKINOTVS.js} +1 -1
- package/dist/chunk-TKINOTVS.js.map +1 -0
- package/dist/{chunk-VOXOBUTX.js → chunk-TXZJESES.js} +5 -5
- package/dist/chunk-UPUJJOKB.js +236 -0
- package/dist/chunk-UPUJJOKB.js.map +1 -0
- package/dist/{chunk-7JPL3CUC.js → chunk-URGALOZY.js} +2 -2
- package/dist/{chunk-X4MPUD4B.js → chunk-UVLQRP6O.js} +53 -13
- package/dist/chunk-UVLQRP6O.js.map +1 -0
- package/dist/{chunk-CWXZ2MRT.js → chunk-VHJ72YCD.js} +4 -3
- package/dist/chunk-VHJ72YCD.js.map +1 -0
- package/dist/{chunk-PAU352SV.js → chunk-W4GTMOJW.js} +2 -2
- package/dist/{chunk-SE4JN5XN.js → chunk-WDENIUC7.js} +3 -1
- package/dist/chunk-WDENIUC7.js.map +1 -0
- package/dist/{chunk-3BVDFQ6Y.js → chunk-Y3GWQBJP.js} +5 -5
- package/dist/{chunk-YZ4TJLZQ.js → chunk-YT5HKJWV.js} +497 -18
- package/dist/chunk-YT5HKJWV.js.map +1 -0
- package/dist/{chunk-UQMLCIRX.js → chunk-Z6PZKXSP.js} +6 -6
- package/dist/{chunk-JUL2PRQN.js → chunk-ZC2MZZR5.js} +207 -79
- package/dist/chunk-ZC2MZZR5.js.map +1 -0
- package/dist/{chunk-UKZNLVJW.js → chunk-ZINZTHWO.js} +4 -2
- package/dist/chunk-ZINZTHWO.js.map +1 -0
- package/dist/{cli-4JHQCPHU.js → cli-33E3B2FK.js} +3 -3
- package/dist/{cli-G66X7YMP.js → cli-7JV4RM66.js} +23 -22
- package/dist/{cli-G66X7YMP.js.map → cli-7JV4RM66.js.map} +1 -1
- package/dist/{cli-L5B2RVV2.js → cli-B4DTJ2KC.js} +31 -29
- package/dist/{cli-L5B2RVV2.js.map → cli-B4DTJ2KC.js.map} +1 -1
- package/dist/{cli-ECVT4YXR.js → cli-D4WXCDTS.js} +20 -19
- package/dist/{cli-ECVT4YXR.js.map → cli-D4WXCDTS.js.map} +1 -1
- package/dist/{cli-7DETHSNW.js → cli-DDLLZHZW.js} +90 -84
- package/dist/cli-DDLLZHZW.js.map +1 -0
- package/dist/{cli-KYTCJYXK.js → cli-EVACAD7K.js} +317 -28
- package/dist/cli-EVACAD7K.js.map +1 -0
- package/dist/{cli-H5LVGOVT.js → cli-LIKI7WPR.js} +384 -248
- package/dist/cli-LIKI7WPR.js.map +1 -0
- package/dist/{cli-AZKWTCFV.js → cli-MWUFAS2X.js} +11 -11
- package/dist/{cli-DGFLJ2DD.js → cli-OKPRTVG6.js} +69 -26
- package/dist/cli-OKPRTVG6.js.map +1 -0
- package/dist/{cli-RP5E7XHC.js → cli-QEPVGLQ3.js} +20 -18
- package/dist/{cli-RP5E7XHC.js.map → cli-QEPVGLQ3.js.map} +1 -1
- package/dist/{cli-BW5VOFOZ.js → cli-VP6JTPFS.js} +11 -10
- package/dist/{cli-BW5VOFOZ.js.map → cli-VP6JTPFS.js.map} +1 -1
- package/dist/cli.js +14 -14
- package/dist/{config-JJW75SBX.js → config-7I5CHHRZ.js} +6 -6
- package/dist/docmeta.js +10 -10
- package/dist/github-DV57TW5L.js +32 -0
- package/dist/github-SGX2EARO.js +36 -0
- package/dist/graph/runtime.js.map +1 -1
- package/dist/index.d.ts +222 -45
- package/dist/index.js +138 -132
- package/dist/index.js.map +1 -1
- package/dist/{json-7WV7KL6H.js → json-5EQCGVCV.js} +4 -2
- package/dist/{json-LCVPMEAM.js → json-SHPUCD64.js} +15 -13
- package/dist/{labels-OQXBVM4A.js → labels-3GCGYYV3.js} +14 -12
- package/dist/{labels-OQXBVM4A.js.map → labels-3GCGYYV3.js.map} +1 -1
- package/dist/lint-RE4DMI6E.js +35 -0
- package/dist/list-F56MEJXR.js +36 -0
- package/dist/list-ZR3KY556.js +34 -0
- package/dist/{page-XPX5XJZE.js → page-G7XSO4FD.js} +13 -12
- package/dist/{picker-3XF36MJF.js → picker-FPUC5UGM.js} +3 -3
- package/dist/{prepare-VMBIQYAM.js → prepare-WHMWP7BG.js} +21 -20
- package/dist/{prepare-VMBIQYAM.js.map → prepare-WHMWP7BG.js.map} +1 -1
- package/dist/{pretty-KSTZMBUF.js → pretty-VTJVXWRK.js} +15 -13
- package/dist/{pretty-KG6TMOEI.js → pretty-YVRRWBWN.js} +23 -16
- package/dist/{provider-LBX4IXGX.js → provider-JY2I3VLF.js} +3 -3
- package/dist/{release-VV3UTKE5.js → release-Z3ASYZ3S.js} +3 -3
- package/dist/{reporters-26H3N2KW.js → reporters-FSXJ42EB.js} +6 -5
- package/dist/{reporters-AQU4W3KY.js → reporters-G5R4SURQ.js} +6 -6
- package/dist/{reporters-FBYLPKD4.js → reporters-MHPY4HRA.js} +15 -14
- package/dist/run-FSYOYEPR.js +39 -0
- package/dist/sarif-HBQIDY7T.js +31 -0
- package/dist/sarif-RRUFJZUL.js +37 -0
- package/dist/{term-SI3VM6EM.js → term-ABHGACYE.js} +58 -109
- package/dist/term-ABHGACYE.js.map +1 -0
- package/dist/types-VMOT7RAL.js +12 -0
- package/dist/types-VMOT7RAL.js.map +1 -0
- package/dist/{validate-NQO7TFSN.js → validate-DXYUUGUD.js} +6 -6
- package/dist/validate-DXYUUGUD.js.map +1 -0
- package/package.json +1 -1
- package/plugin/manni/.claude-plugin/plugin.json +1 -1
- package/plugin/manni/skills/check/SKILL.md +2 -2
- package/plugin/manni/skills/evals/SKILL.md +1 -1
- package/plugin/manni/skills/fix/SKILL.md +95 -16
- package/plugin/manni/skills/setup/SKILL.md +1 -1
- package/shapes/graph/shapes-1.1.1.ttl +953 -0
- package/dist/batch-OB2FXT47.js +0 -46
- package/dist/build-4BL24BG3.js +0 -36
- package/dist/calibrate-AEDJ7N7G.js +0 -41
- package/dist/capture-TP3P4YNL.js +0 -38
- package/dist/check-5IYH42KS.js +0 -34
- package/dist/check-S55MH66H.js +0 -30
- package/dist/chunk-3HUCB4Z3.js.map +0 -1
- package/dist/chunk-3XGTNN3M.js.map +0 -1
- package/dist/chunk-52WO7ESI.js.map +0 -1
- package/dist/chunk-BMBAAPGN.js.map +0 -1
- package/dist/chunk-BQXY76JB.js.map +0 -1
- package/dist/chunk-CODWRUAD.js.map +0 -1
- package/dist/chunk-CWXZ2MRT.js.map +0 -1
- package/dist/chunk-DQOM3DEU.js.map +0 -1
- package/dist/chunk-EQ7E6HMG.js.map +0 -1
- package/dist/chunk-GWI6JPTT.js.map +0 -1
- package/dist/chunk-HIEGOW7X.js.map +0 -1
- package/dist/chunk-HY6ROJTH.js.map +0 -1
- package/dist/chunk-IGQMBHFY.js.map +0 -1
- package/dist/chunk-JEUFYSFQ.js.map +0 -1
- package/dist/chunk-JUL2PRQN.js.map +0 -1
- package/dist/chunk-LNGSE7V2.js.map +0 -1
- package/dist/chunk-LSFXNAHU.js.map +0 -1
- package/dist/chunk-MNH7QO4Z.js +0 -15
- package/dist/chunk-MNH7QO4Z.js.map +0 -1
- package/dist/chunk-N6A6DJUO.js.map +0 -1
- package/dist/chunk-NSAW7U42.js.map +0 -1
- package/dist/chunk-NTEYYYKL.js.map +0 -1
- package/dist/chunk-NWUXRV6N.js.map +0 -1
- package/dist/chunk-OBXCJZ6R.js.map +0 -1
- package/dist/chunk-OTJOBZJ5.js.map +0 -1
- package/dist/chunk-OYIWF3B2.js.map +0 -1
- package/dist/chunk-PA7CMQGD.js.map +0 -1
- package/dist/chunk-PCE7QHXJ.js.map +0 -1
- package/dist/chunk-SCLXVTFZ.js.map +0 -1
- package/dist/chunk-SE4JN5XN.js.map +0 -1
- package/dist/chunk-UKZNLVJW.js.map +0 -1
- package/dist/chunk-ULDV2LUI.js.map +0 -1
- package/dist/chunk-VNYXK7TM.js.map +0 -1
- package/dist/chunk-VYBYUQIP.js.map +0 -1
- package/dist/chunk-WVXCN5DS.js.map +0 -1
- package/dist/chunk-X4MPUD4B.js.map +0 -1
- package/dist/chunk-Y6M4JFKG.js +0 -117
- package/dist/chunk-Y6M4JFKG.js.map +0 -1
- package/dist/chunk-YZ4TJLZQ.js.map +0 -1
- package/dist/cli-7DETHSNW.js.map +0 -1
- package/dist/cli-DGFLJ2DD.js.map +0 -1
- package/dist/cli-H5LVGOVT.js.map +0 -1
- package/dist/cli-KYTCJYXK.js.map +0 -1
- package/dist/github-DJQ4MWNZ.js +0 -35
- package/dist/github-UWTDM2J2.js +0 -30
- package/dist/lint-O7XRHKFP.js +0 -34
- package/dist/list-OOOCLOAL.js +0 -35
- package/dist/list-OYQ5XPN2.js +0 -32
- package/dist/run-KUGTU3TT.js +0 -37
- package/dist/term-SI3VM6EM.js.map +0 -1
- package/dist/types-Y6TXHM7M.js +0 -10
- /package/dist/{batch-OB2FXT47.js.map → batch-OMDKRGUE.js.map} +0 -0
- /package/dist/{build-4BL24BG3.js.map → build-YCY5MUHA.js.map} +0 -0
- /package/dist/{calibrate-AEDJ7N7G.js.map → calibrate-RN2NJ4FS.js.map} +0 -0
- /package/dist/{capture-TP3P4YNL.js.map → capture-2WYROZKA.js.map} +0 -0
- /package/dist/{check-5IYH42KS.js.map → check-KRVWHF7E.js.map} +0 -0
- /package/dist/{check-LU5YC3L4.js.map → check-MR7IG7IP.js.map} +0 -0
- /package/dist/{check-S55MH66H.js.map → check-OIRJ6OBW.js.map} +0 -0
- /package/dist/{chunk-7RNONVHI.js.map → chunk-3EJVJDMX.js.map} +0 -0
- /package/dist/{chunk-CU57HT2E.js.map → chunk-6WJUZQQX.js.map} +0 -0
- /package/dist/{chunk-QKT67PFE.js.map → chunk-7XHW5DZA.js.map} +0 -0
- /package/dist/{chunk-TDCOKKMI.js.map → chunk-AL4HRKSZ.js.map} +0 -0
- /package/dist/{chunk-YQV75FIL.js.map → chunk-CFMI74TP.js.map} +0 -0
- /package/dist/{chunk-PCGBXHSE.js.map → chunk-FEEO7ET6.js.map} +0 -0
- /package/dist/{chunk-3O6U4ICM.js.map → chunk-GLQCSDFS.js.map} +0 -0
- /package/dist/{chunk-ZXRAE55H.js.map → chunk-IGRXQC3H.js.map} +0 -0
- /package/dist/{chunk-U6IHLEWT.js.map → chunk-JCTHXG33.js.map} +0 -0
- /package/dist/{chunk-6ZFJWUUH.js.map → chunk-JNMY7KZG.js.map} +0 -0
- /package/dist/{chunk-TQ3W6RKG.js.map → chunk-KCXQXKOL.js.map} +0 -0
- /package/dist/{chunk-OUAH7XF2.js.map → chunk-MAOX3524.js.map} +0 -0
- /package/dist/{chunk-TZOYZK2E.js.map → chunk-OZUPJB4J.js.map} +0 -0
- /package/dist/{chunk-OKMTUAWO.js.map → chunk-QSPH4F56.js.map} +0 -0
- /package/dist/{chunk-E6BVUDGY.js.map → chunk-SLGCRXHM.js.map} +0 -0
- /package/dist/{chunk-KE2F7QES.js.map → chunk-SVF3WCC7.js.map} +0 -0
- /package/dist/{chunk-VOXOBUTX.js.map → chunk-TXZJESES.js.map} +0 -0
- /package/dist/{chunk-7JPL3CUC.js.map → chunk-URGALOZY.js.map} +0 -0
- /package/dist/{chunk-PAU352SV.js.map → chunk-W4GTMOJW.js.map} +0 -0
- /package/dist/{chunk-3BVDFQ6Y.js.map → chunk-Y3GWQBJP.js.map} +0 -0
- /package/dist/{chunk-UQMLCIRX.js.map → chunk-Z6PZKXSP.js.map} +0 -0
- /package/dist/{cli-4JHQCPHU.js.map → cli-33E3B2FK.js.map} +0 -0
- /package/dist/{cli-AZKWTCFV.js.map → cli-MWUFAS2X.js.map} +0 -0
- /package/dist/{config-JJW75SBX.js.map → config-7I5CHHRZ.js.map} +0 -0
- /package/dist/{github-DJQ4MWNZ.js.map → github-DV57TW5L.js.map} +0 -0
- /package/dist/{github-UWTDM2J2.js.map → github-SGX2EARO.js.map} +0 -0
- /package/dist/{json-7WV7KL6H.js.map → json-5EQCGVCV.js.map} +0 -0
- /package/dist/{json-LCVPMEAM.js.map → json-SHPUCD64.js.map} +0 -0
- /package/dist/{lint-O7XRHKFP.js.map → lint-RE4DMI6E.js.map} +0 -0
- /package/dist/{list-OOOCLOAL.js.map → list-F56MEJXR.js.map} +0 -0
- /package/dist/{list-OYQ5XPN2.js.map → list-ZR3KY556.js.map} +0 -0
- /package/dist/{page-XPX5XJZE.js.map → page-G7XSO4FD.js.map} +0 -0
- /package/dist/{picker-3XF36MJF.js.map → picker-FPUC5UGM.js.map} +0 -0
- /package/dist/{pretty-KG6TMOEI.js.map → pretty-VTJVXWRK.js.map} +0 -0
- /package/dist/{pretty-KSTZMBUF.js.map → pretty-YVRRWBWN.js.map} +0 -0
- /package/dist/{provider-LBX4IXGX.js.map → provider-JY2I3VLF.js.map} +0 -0
- /package/dist/{release-VV3UTKE5.js.map → release-Z3ASYZ3S.js.map} +0 -0
- /package/dist/{reporters-26H3N2KW.js.map → reporters-FSXJ42EB.js.map} +0 -0
- /package/dist/{reporters-AQU4W3KY.js.map → reporters-G5R4SURQ.js.map} +0 -0
- /package/dist/{reporters-FBYLPKD4.js.map → reporters-MHPY4HRA.js.map} +0 -0
- /package/dist/{run-KUGTU3TT.js.map → run-FSYOYEPR.js.map} +0 -0
- /package/dist/{types-Y6TXHM7M.js.map → sarif-HBQIDY7T.js.map} +0 -0
- /package/dist/{validate-NQO7TFSN.js.map → sarif-RRUFJZUL.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/meta/reporters/rule-id.ts","../src/meta/reporters/sarif.ts","../src/shared/xml.ts","../src/meta/reporters/junit.ts","../src/meta/reporters/index.ts"],"sourcesContent":["/**\n * A violation's **rule identity**, shared by the SARIF `ruleId` and the JUnit\n * `<failure type>`.\n *\n * Built from `schema` + `keyword` and nothing else. `message` is Ajv-generated\n * prose, so a rule id derived from it would rename itself on any Ajv upgrade\n * and every historical alert in the consumer would close and reopen as new.\n * That is the same reasoning `src/core/baseline.ts` applies to fingerprints,\n * and for the same reason: these are the durable half of a violation.\n */\nimport type { FieldError } from \"../types.js\";\nimport { canonicalSchemaRef, type FingerprintContext } from \"../core/baseline.js\";\n\n/** The `schema` label the command layer stamps on its own failures. */\nconst SYNTHETIC_SCHEMA = \"(parse)\";\n\n/** A document whose metadata block could not be parsed. */\nexport const PARSE_ERROR_RULE = \"manni/parse-error\";\n\n/** A document no schema set could be resolved for. */\nexport const SCHEMA_ERROR_RULE = \"manni/schema-error\";\n\n/**\n * A document carrying a key a manifest owns (proposal 0037). Not a\n * synthetic-schema special case: `external:owned` is a builtin-shaped ref\n * like `check:<name>`, so the ordinary join produces this id.\n */\nexport const EXTERNAL_OWNED_RULE = \"external:owned/external\";\n\n/**\n * Two documents carry the same value of a manifest's join field (proposal\n * 0039), so one manifest entry matched both.\n */\nexport const EXTERNAL_DUPLICATE_RULE = \"external:duplicate/external\";\n\n/**\n * A property its schema marks `x-manni-encrypt` holds a plain value\n * (proposal 0045). Builtin-shaped like `external:owned`.\n */\nexport const ENCRYPTED_PLAIN_RULE = \"encrypted:plain/encrypted\";\n\n/**\n * A marked property holds a ciphertext that does not decrypt under the\n * current key (proposal 0045).\n */\nexport const ENCRYPTED_UNREADABLE_RULE = \"encrypted:unreadable/encrypted\";\n\n/**\n * A managed field whose asserted value differs from the derived one, or is\n * missing while a source has one. `derived:stale` is builtin-shaped like the\n * external refs, so the ordinary join produces this id too.\n */\nexport const DERIVED_STALE_RULE = \"derived:stale/derived\";\n\n/**\n * A key the page holds that its schemas mark `x-manni-location: external`\n * (proposal 0047). A warning, builtin-shaped like `external:owned`.\n */\nexport const LOCATION_EXTERNAL_RULE = \"location:external/location\";\n\n/**\n * A key a manifest supplies that its schemas mark `x-manni-location: page`\n * (proposal 0047). A warning, filed at the manifest line.\n */\nexport const LOCATION_PAGE_RULE = \"location:page/location\";\n\n/**\n * A value of a field its schema marks `x-manni-term` that names no term\n * (proposal 0086). Builtin-shaped like `location:external`.\n */\nexport const TERM_UNDEFINED_RULE = \"term:undefined/term\";\n\n/** A marked value that names a term outside the mark's `under` branch. */\nexport const TERM_OUTSIDE_BRANCH_RULE = \"term:outside-branch/term\";\n\n/** A marked value that names a term by an alt-label. A warning. */\nexport const TERM_ALT_LABEL_RULE = \"term:alt-label/term\";\n\n/** What each reserved rule means, for the consumer's rule listing. */\nexport const RESERVED_RULES: Record<string, string> = {\n [LOCATION_EXTERNAL_RULE]:\n \"The page stores a key its schema prefers external metadata for; run `manni meta relocate` to move it to the collection's manifest.\",\n [LOCATION_PAGE_RULE]:\n \"A manifest stores a key its schema prefers the page for; run `manni meta relocate` to move it into the page.\",\n [ENCRYPTED_PLAIN_RULE]:\n \"A property the schema marks x-manni-encrypt holds a plain value; the page must hold it encrypted.\",\n [ENCRYPTED_UNREADABLE_RULE]:\n \"A property the schema marks x-manni-encrypt holds a value that does not decrypt under the current key.\",\n [TERM_UNDEFINED_RULE]:\n \"A value of a field the schema marks x-manni-term names no term in the termbase.\",\n [TERM_OUTSIDE_BRANCH_RULE]:\n \"A value of a field the schema marks x-manni-term names a term outside the branch its under names.\",\n [TERM_ALT_LABEL_RULE]:\n \"A value of a field the schema marks x-manni-term names a term by an alt-label; use the label.\",\n [PARSE_ERROR_RULE]: \"The document's metadata block could not be parsed.\",\n [SCHEMA_ERROR_RULE]: \"No schema set could be resolved for the document.\",\n [EXTERNAL_OWNED_RULE]:\n \"The document carries a key a manifest owns; the manifest is the only place that key may be set.\",\n [EXTERNAL_DUPLICATE_RULE]:\n \"Two documents carry the same value of a manifest's join field, so one manifest entry matched both.\",\n [DERIVED_STALE_RULE]:\n \"A managed field whose value differs from what git, CODEOWNERS or the GitHub or GitLab review record says; run `manni meta derive` to refresh it.\",\n};\n\n/**\n * The rule id for one violation.\n *\n * docmeta's own failures carry `schema: \"(parse)\"` and no real keyword, so the\n * naive join yields `(parse)/parse` — a rule id that names an implementation\n * detail and reads as garbage in a security tab. They get reserved ids instead.\n *\n * With a `frame`, the schema reference is canonicalized exactly as a\n * fingerprint's is, so a local-file schema does not produce one rule id from\n * the repository root and a different, machine-specific one from `docs/`.\n */\nexport function ruleIdFor(e: FieldError, frame?: FingerprintContext): string {\n if (e.schema === SYNTHETIC_SCHEMA) {\n if (e.keyword === \"parse\") return PARSE_ERROR_RULE;\n if (e.keyword === \"schema\") return SCHEMA_ERROR_RULE;\n }\n return `${canonicalSchemaRef(e.schema, frame)}/${e.keyword}`;\n}\n\n/** `\"\"` is the whole document; every reporter spells that the same way. */\nexport function fieldLabel(instancePath: string): string {\n return instancePath === \"\" ? \"(root)\" : instancePath;\n}\n","/**\n * SARIF 2.1.0 — the interchange format GitHub code scanning, GitLab, and Azure\n * DevOps ingest directly.\n *\n * What `--format github` cannot do is persist: `::error` workflow commands\n * render on the pull request and then vanish with the job log. SARIF findings\n * become tracked alerts with state across commits, which is what makes \"when\n * did this regress\" and \"is metadata debt trending down\" answerable at all.\n *\n * Three properties carry that tracking, and each has a trap:\n *\n * - **`artifactLocation.uri` must be repository-root-relative.** GitHub\n * resolves it against the repository root and *silently drops* results that\n * do not resolve — the upload succeeds, with zero alerts. `ValidationResult`\n * labels are relative to whatever the run resolved against, which is only\n * coincidentally the repository root, so they are rebased here.\n * - **`ruleId` must not be built from prose.** See `./rule-id.ts`.\n * - **`partialFingerprints` must match the baseline's fingerprint.** One\n * identity function, two consumers.\n */\nimport { isAbsolute } from \"node:path\";\nimport pkg from \"../../../package.json\" with { type: \"json\" };\nimport {\n isErrorSeverity,\n type FieldError,\n type ValidationResult,\n} from \"../types.js\";\nimport {\n canonicalFilePath,\n canonicalSchemaRef,\n fingerprint,\n type FingerprintContext,\n} from \"../core/baseline.js\";\nimport { findGitRoot } from \"../core/config.js\";\n// One definition, in core: commands set this label and reporters test for it,\n// so two copies would drift and a `<stdin>` result would acquire an\n// `artifactLocation.uri` naming a file that does not exist.\nimport { STDIN_LABEL } from \"../core/load-files.js\";\nimport { RESERVED_RULES, fieldLabel, ruleIdFor } from \"./rule-id.js\";\n\n/** Where a consumer is sent to read about docmeta itself. */\nconst INFORMATION_URI = \"https://hawkeyexl.github.io/manni/meta/\";\n\n/** Where a consumer is sent to read about one finding. */\nconst HELP_URI = \"https://hawkeyexl.github.io/manni/meta/fix/\";\n\n/**\n * The property-bag key GitHub keys alert identity on. Versioned deliberately,\n * and **not renamed with the tool**: the value is what lets an alert opened by\n * a docmeta run stay the same alert under manni. A new key would re-open every\n * finding once; that is what `/v2` is for, should the fingerprint ever change.\n */\nconst FINGERPRINT_KEY = \"docmetaViolation/v1\";\n\n/** Not a path anyone can resolve, so it can never be an artifact location. */\n// Imported rather than redeclared: two independent copies of this literal\n// would drift silently, and the failure mode is a `<stdin>` result acquiring an\n// `artifactLocation.uri` that names no file.\n\n/**\n * Said once, on stderr, when SARIF paths could not be made\n * repository-root-relative — the `GITIGNORE_UNAVAILABLE` precedent. Degrading\n * in silence is the wrong failure here: a uri that does not resolve produces a\n * *successful* upload with no alerts, so nothing downstream ever complains.\n */\nexport const SARIF_NO_GIT_ROOT =\n \"SARIF paths could not be made repository-root-relative: no git repository was found here. GitHub code scanning resolves artifactLocation.uri against the repository root and drops results that do not resolve, so an upload may report no findings at all.\";\n\nexport interface SarifOptions {\n /** The run's path frame. Without one, `file` labels are emitted as they are. */\n frame?: FingerprintContext;\n /** Diagnostics for the user; the CLI writes these to stderr. */\n onNotice?: (message: string) => void;\n}\n\ntype SarifLevel = \"error\" | \"warning\" | \"note\";\n\n/**\n * SARIF's word for a finding's weight. The family's `error` and `warning`\n * are SARIF's own; its `notice` is SARIF's `note`. An absent severity is\n * `error`, as everywhere (`isErrorSeverity`).\n */\nfunction sarifLevel(e: Parameters<typeof isErrorSeverity>[0]): SarifLevel {\n if (isErrorSeverity(e)) return \"error\";\n return e.severity === \"notice\" ? \"note\" : \"warning\";\n}\n\ninterface SarifRule {\n id: string;\n shortDescription: { text: string };\n helpUri: string;\n}\n\ninterface SarifResult {\n ruleId: string;\n level: SarifLevel;\n message: { text: string };\n locations: {\n physicalLocation: {\n artifactLocation: { uri: string };\n region?: { startLine: number };\n };\n }[];\n partialFingerprints: Record<string, string>;\n}\n\n/**\n * What a rule *is*, in one line.\n *\n * Only the reserved rules get bespoke prose; everything else is named by the\n * schema and keyword that produced it, which is all docmeta actually knows. A\n * per-keyword phrasebook would be prose docmeta would then have to keep in step\n * with Ajv's own vocabulary for no consumer benefit.\n */\nfunction describeRule(id: string, e: FieldError, schemaRef: string): string {\n return (\n RESERVED_RULES[id] ??\n `Schema \"${schemaRef}\" rejected the document on its \"${e.keyword}\" keyword.`\n );\n}\n\n/**\n * Said when a result had to be dropped because its path lies outside the\n * repository.\n *\n * Dropping is the only truthful option — GitHub would drop it anyway, having\n * failed to resolve it — but doing so in silence reproduces the exact failure\n * this reporter exists to prevent: an upload that succeeds while reporting\n * fewer findings than the run actually made.\n */\nexport const sarifDroppedNotice = (n: number): string =>\n `${n} SARIF ${n === 1 ? \"finding lies\" : \"findings lie\"} outside the repository and ${n === 1 ? \"was\" : \"were\"} omitted: an artifactLocation.uri that leaves the repository root cannot be resolved by a code-scanning consumer.`;\n\n/**\n * The frame `artifactLocation.uri` is measured against.\n *\n * Same rebase `canonicalFilePath` already performs for baseline keys, with\n * `base` swapped for the repository root. Returns null when there is nothing to\n * rebase against, which the caller reports rather than papers over.\n */\nfunction uriFrame(frame: FingerprintContext): FingerprintContext | null {\n const root = findGitRoot(frame.cwd);\n return root === null ? null : { ...frame, base: root };\n}\n\n/**\n * A uri SARIF accepts: relative, posix, and never climbing out of the\n * repository.\n *\n * A file above the repository root rebases to `../…`, which SARIF permits but\n * GitHub cannot resolve. There is nothing truthful to emit for it, so the\n * result is dropped rather than pointed at a path that does not exist — the\n * same reasoning that skips `<stdin>`.\n */\nfunction artifactUri(\n file: string,\n frame: FingerprintContext | undefined,\n): string | null {\n const uri = canonicalFilePath(file, frame);\n // An absolute path is not a repository-relative uri either. `relative()`\n // returns one when the two paths share no root, which on Windows is any\n // checkout and temp directory on different drives.\n if (uri === \"\" || uri.startsWith(\"../\") || isAbsolute(uri)) return null;\n return uri;\n}\n\nexport function renderSarif(\n results: ValidationResult[],\n opts: SarifOptions = {},\n): string {\n const { frame, onNotice } = opts;\n\n // Two frames, deliberately: fingerprints stay measured against the config's\n // directory (so a baseline recorded from anywhere matches), while uris are\n // measured against the repository root (so GitHub can resolve them).\n const rebased = frame ? uriFrame(frame) : undefined;\n if (frame && rebased === null) onNotice?.(SARIF_NO_GIT_ROOT);\n // With no repository there is no root to measure from, and falling back to\n // `frame` would measure against the *config's* directory — which for a config\n // outside the tree being validated yields `../…` for every file, and\n // `artifactUri` drops those. That turns \"no git repo\" into \"no findings at\n // all\". Measure from where the run actually resolved its inputs instead: the\n // paths are no longer repository-relative, which the notice above already\n // says, but they are at least the paths the user typed.\n const pathFrame =\n rebased ?? (frame ? { ...frame, base: frame.runBase ?? frame.cwd } : undefined);\n\n const rules = new Map<string, SarifRule>();\n const sarifResults: SarifResult[] = [];\n let dropped = 0;\n\n for (const r of results) {\n if (r.errors.length === 0) continue;\n // `<stdin>` is not a path; nothing is lost by leaving it out, so it is not\n // counted as a drop.\n if (r.file === STDIN_LABEL) continue;\n const docUri = artifactUri(r.file, pathFrame);\n\n for (const e of r.errors) {\n // A value a manifest supplied is located in the manifest (proposal\n // 0037), which may be the one file of the run that *is* inside the\n // repository when the documents are not, or the reverse — so each\n // finding resolves its own uri, and is dropped on its own.\n const uri = e.file != null ? artifactUri(e.file, pathFrame) : docUri;\n if (uri === null) {\n dropped += 1;\n continue;\n }\n const ruleId = ruleIdFor(e, frame);\n if (!rules.has(ruleId)) {\n rules.set(ruleId, {\n id: ruleId,\n shortDescription: {\n text: describeRule(ruleId, e, canonicalSchemaRef(e.schema, frame)),\n },\n helpUri: HELP_URI,\n });\n }\n sarifResults.push({\n ruleId,\n // `FieldError.severity` maps onto SARIF's triage axis directly. Meta's\n // own validation never sets it, so its findings are all `error`; the\n // `warning` and `note` levels are for a sibling tool's advisory\n // findings (#78).\n level: sarifLevel(e),\n message: { text: `${fieldLabel(e.instancePath)} ${e.message}` },\n locations: [\n {\n physicalLocation: {\n artifactLocation: { uri },\n // SARIF requires `startLine >= 1`. `0` is schema-invalid and `1`\n // silently mislocates the finding at the top of the file, so an\n // unknown line omits the region and renders file-level, which is\n // true. `startColumn` is deliberately still absent: html and xml\n // now populate `col`, but the rest of the region work (endLine,\n // endColumn, snippet) belongs to 0003, and a lone startColumn\n // would be the half of it that misleads.\n ...(e.line != null ? { region: { startLine: e.line } } : {}),\n },\n },\n ],\n partialFingerprints: { [FINGERPRINT_KEY]: fingerprint(e, frame) },\n });\n }\n }\n\n if (dropped > 0) onNotice?.(sarifDroppedNotice(dropped));\n\n return `${JSON.stringify(\n {\n $schema: \"https://json.schemastore.org/sarif-2.1.0.json\",\n version: \"2.1.0\",\n runs: [\n {\n tool: {\n driver: {\n name: \"manni\",\n version: pkg.version,\n informationUri: INFORMATION_URI,\n // Only rules this run actually hit. Enumerating every keyword of\n // every schema would mean compiling and walking each one, for no\n // consumer benefit.\n rules: [...rules.values()],\n },\n },\n results: sarifResults,\n },\n ],\n },\n null,\n 2,\n )}`;\n}\n","/**\n * XML text escaping, shared by every reporter that writes XML.\n *\n * Moved here from meta's JUnit writer when tracevals needed it too, so the\n * family keeps one escaping rule rather than one per tool.\n */\n\nconst XML_ENTITIES: Record<string, string> = {\n \"&\": \"&\",\n \"<\": \"<\",\n \">\": \">\",\n '\"': \""\",\n \"'\": \"'\",\n};\n\n/**\n * Escape every XML metacharacter, and drop the control characters XML 1.0\n * forbids outright.\n *\n * `>` and `'` do not strictly need escaping in every position, but escaping all\n * five unconditionally means no caller has to know which position it is in —\n * which is precisely the reasoning a partial escaper gets wrong. The control\n * character strip is separate: those cannot be represented in XML 1.0 at all,\n * escaped or not, so a stray one makes the whole document unparseable rather\n * than merely mis-rendered. Tab, newline, and carriage return are legal, and\n * kept.\n */\n/**\n * XML 1.0's `Char` production, in full:\n *\n * #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]\n *\n * C0 controls are the familiar exclusion, but they are not the only one: a lone\n * surrogate half and the noncharacters U+FFFE/U+FFFF are equally illegal, and\n * both sit in a JavaScript string quite happily — a schema-authored `pattern`\n * or a filename can carry either. Iterating with `for…of` yields whole code\n * points, so a *well-formed* surrogate pair arrives as one astral character\n * (>= U+10000) and is kept; only an unpaired half falls in the D800-DFFF gap\n * and is dropped.\n */\nfunction isXmlChar(code: number): boolean {\n return (\n code === 0x9 ||\n code === 0xa ||\n code === 0xd ||\n (code >= 0x20 && code <= 0xd7ff) ||\n (code >= 0xe000 && code <= 0xfffd) ||\n (code >= 0x10000 && code <= 0x10ffff)\n );\n}\n\nexport function xmlEscape(value: string): string {\n let out = \"\";\n for (const ch of value) {\n const code = ch.codePointAt(0) ?? 0;\n if (!isXmlChar(code)) continue;\n out += XML_ENTITIES[ch] ?? ch;\n }\n return out;\n}\n","/**\n * JUnit XML — what CI systems parse for the \"Tests\" tab.\n *\n * There is no authoritative JUnit schema; Jenkins, GitLab, CircleCI, and Azure\n * each accept a different superset. This writer sticks to the attributes all of\n * them honor (`name`, `tests`, `failures`, `errors`, `classname`, `type`,\n * `message`) and avoids the contested ones — `time`, which would be meaningless\n * here, `system-out`, and nested suites. That is a compatibility judgement, not\n * a specification.\n *\n * **One `<testcase>` per file, one `<failure>` per violation.** So the tab reads\n * \"2 tests, 1 failed\" and matches `2 files checked, 1 failed`.\n * Violation-as-testcase would make the test count rise and fall with document\n * quality, which reads as a suite someone broke.\n *\n * **A warning is not a `<failure>`.** JUnit has no level below failure, and a\n * `<failure>` that did not fail the run would make the tab disagree with the\n * exit code. A warning-only file is a passing testcase; the warning is still\n * in the JSON and SARIF output, which have somewhere to put it.\n *\n * Escaping is the one thing a hand-rolled writer gets wrong. Messages carry\n * schema-authored text — a `pattern` regex may hold `<`, `&`, and quotes — and\n * paths can hold `&`. Every attribute value goes through `xmlEscape`; nothing\n * is interpolated raw.\n */\nimport type { FingerprintContext } from \"../core/baseline.js\";\nimport { isErrorSeverity, type ValidationResult } from \"../types.js\";\nimport { fieldLabel, ruleIdFor } from \"./rule-id.js\";\nimport { xmlEscape } from \"../../shared/xml.js\";\n\nexport { xmlEscape };\n\n/** Suite and classname. One suite per run; nested suites are not portable. */\nconst SUITE_NAME = \"manni\";\nconst CLASS_NAME = \"manni.validate\";\n\nconst attr = (name: string, value: string): string =>\n ` ${name}=\"${xmlEscape(value)}\"`;\n\nexport interface JunitOptions {\n /**\n * The `classname` each `<testcase>` carries: which docmeta command produced\n * these findings. Defaults to `docmeta.validate`, the only producer before\n * proposal 0026 made `query --check` a second one — whose findings must not\n * ship under validate's name.\n */\n classname?: string;\n /**\n * The run's path frame, used only to canonicalize a local-file schema ref in\n * `<failure type>`.\n *\n * Without it the attribute carries the ref exactly as the run received it —\n * `./my.schema.json` from the repo root, `../my.schema.json` from a\n * subdirectory, or a machine-absolute path once config discovery has rebased\n * it. SARIF's `ruleId` is already canonical, so a consumer correlating the two\n * for one run would find them disagreeing on the same violation.\n */\n frame?: FingerprintContext;\n}\n\nexport function renderJunit(\n results: ValidationResult[],\n opts: JunitOptions = {},\n): string {\n const tests = results.length;\n const failures = results.filter((r) => r.errors.some(isErrorSeverity)).length;\n\n const counts =\n attr(\"name\", SUITE_NAME) +\n attr(\"tests\", String(tests)) +\n attr(\"failures\", String(failures)) +\n // Every violation is a `<failure>`; `errors` is reserved for a test that\n // could not run, which has no analogue here. Emitted as 0 rather than\n // omitted, because consumers read the attribute and show a blank column\n // without it.\n attr(\"errors\", \"0\");\n\n const lines: string[] = [\n '<?xml version=\"1.0\" encoding=\"UTF-8\"?>',\n `<testsuites${counts}>`,\n ` <testsuite${counts}>`,\n ];\n\n const classname = opts.classname ?? CLASS_NAME;\n for (const r of results) {\n const open = ` <testcase${attr(\"name\", r.file)}${attr(\"classname\", classname)}`;\n const failing = r.errors.filter(isErrorSeverity);\n if (failing.length === 0) {\n // Self-closing: a passing test has nothing to carry.\n lines.push(`${open}/>`);\n continue;\n }\n lines.push(`${open}>`);\n for (const e of failing) {\n const where =\n e.file != null\n ? ` (${e.file}${e.line != null ? `:${e.line}` : \"\"})`\n : e.line != null\n ? ` (line ${e.line})`\n : \"\";\n lines.push(\n ` <failure${attr(\"type\", ruleIdFor(e, opts.frame))}${attr(\n \"message\",\n `${fieldLabel(e.instancePath)} ${e.message}${where}`,\n )}/>`,\n );\n }\n lines.push(\" </testcase>\");\n }\n\n lines.push(\" </testsuite>\", \"</testsuites>\");\n return lines.join(\"\\n\");\n}\n","/**\n * Reporters render validation results to a string. The command layer writes\n * the result to stdout; diagnostics go to stderr separately.\n */\nimport {\n DocmetaError,\n isErrorSeverity,\n type BaselineSummary,\n type RunSummary,\n type ValidationResult,\n} from \"../types.js\";\nimport type { FingerprintContext } from \"../core/baseline.js\";\nimport { palette } from \"../../shared/color.js\";\nimport { fieldLabel } from \"./rule-id.js\";\nimport { renderSarif, type SarifOptions } from \"./sarif.js\";\nimport { renderJunit, type JunitOptions } from \"./junit.js\";\nimport {\n escapeWorkflowCommandMessage,\n escapeWorkflowCommandProperty,\n} from \"./github.js\";\n\nexport { renderSarif, SARIF_NO_GIT_ROOT } from \"./sarif.js\";\nexport type { SarifOptions } from \"./sarif.js\";\nexport { renderJunit, xmlEscape } from \"./junit.js\";\nexport type { JunitOptions } from \"./junit.js\";\nexport {\n escapeWorkflowCommandMessage,\n escapeWorkflowCommandProperty,\n} from \"./github.js\";\nexport {\n PARSE_ERROR_RULE,\n SCHEMA_ERROR_RULE,\n ruleIdFor,\n} from \"./rule-id.js\";\n\n/**\n * Every value `--format` accepts, in the order help and error messages list\n * them.\n *\n * The list is stated **once**. It used to live in five unlinked places — this\n * union, a separate `Set<string>` in the CLI, the error message, the option\n * description, and the docs — and the `Set` was not tied to the union at all,\n * so widening the union alone type-checked and still rejected the new value at\n * runtime. Deriving the union from the array makes that drift impossible.\n */\nexport const REPORT_FORMATS = [\n \"pretty\",\n \"json\",\n \"github\",\n \"sarif\",\n \"junit\",\n] as const;\n\nexport type ReportFormat = (typeof REPORT_FORMATS)[number];\n\n/**\n * A format list as a sentence fragment: `\"pretty or json\"`,\n * `\"pretty, json, or github\"`.\n *\n * The two-value case is why this is a function rather than one `join`. A pair\n * takes no comma before \"or\", and `get` and `schemas` have said \"Use pretty or\n * json.\" since long before the list was shared — a mechanical\n * `map(...).join(\", \")` would have quietly reworded every one of those messages\n * to \"pretty, or json\".\n */\nexport function formatList(formats: readonly string[]): string {\n // Destructured and guarded rather than indexed. `noUncheckedIndexedAccess`\n // types `formats[0]` as `string | undefined` however the length was checked,\n // so the interpolation below would happily print \"undefined\" — these two\n // guards say what `length < 2` said, in a form the compiler can carry.\n const [first, second] = formats;\n if (first === undefined) return \"\";\n if (second === undefined) return first;\n // Still needed, and not redundant however it reads: a defined `second` proves\n // there are *at least* two, not exactly two. Three or more falls through to\n // the comma-joined form below.\n if (formats.length === 2) return `${first} or ${second}`;\n return formats\n .map((format, i) => (i === formats.length - 1 ? `or ${format}` : format))\n .join(\", \");\n}\n\n/** `\"pretty, json, github, sarif, or junit\"`, for messages and help text. */\nexport const REPORT_FORMAT_LIST = formatList(REPORT_FORMATS);\n\nexport function isReportFormat(value: string): value is ReportFormat {\n return (REPORT_FORMATS as readonly string[]).includes(value);\n}\n\n/**\n * The formats **every** command produces.\n *\n * `get` and `schemas` accept exactly these two, and each used to spell the pair\n * out inline in `src/cli.ts` as `format !== \"pretty\" && format !== \"json\"` with\n * a hand-written \"Use pretty or json.\" beside it — the same stringly-typed\n * drift this module's `REPORT_FORMATS` comment describes, reproduced three more\n * times. Stated once, the guard and the message cannot disagree.\n */\nexport const COMMON_FORMATS = [\"pretty\", \"json\"] as const;\n\nexport type CommonFormat = (typeof COMMON_FORMATS)[number];\n\n/** `\"pretty or json\"`, for messages and help text. */\nexport const COMMON_FORMAT_LIST = formatList(COMMON_FORMATS);\n\nexport function isCommonFormat(value: string): value is CommonFormat {\n return (COMMON_FORMATS as readonly string[]).includes(value);\n}\n\n/**\n * The formats `query` accepts, one six-value list with per-value gates:\n * `pretty | json | csv` render result rows unconditionally (csv is proposal\n * 0029), and the findings three — `github | sarif | junit` — are legal only\n * under `--check` (proposal 0026).\n *\n * A list of its own rather than `REPORT_FORMATS`: `validate`'s list and\n * `query`'s grow independently — `csv` lives here and not there — and one\n * shared const would make every addition to either a change to both.\n */\nexport const QUERY_FORMATS = [\n \"pretty\",\n \"json\",\n \"csv\",\n \"github\",\n \"sarif\",\n \"junit\",\n] as const;\n\nexport type QueryFormat = (typeof QUERY_FORMATS)[number];\n\n/** `\"pretty, json, csv, github, sarif, or junit\"`, for messages and help. */\nexport const QUERY_FORMAT_LIST = formatList(QUERY_FORMATS);\n\nexport function isQueryFormat(value: string): value is QueryFormat {\n return (QUERY_FORMATS as readonly string[]).includes(value);\n}\n\n/**\n * The `query` formats that render **findings** rather than rows — legal only\n * with `--check`, and only when the result carries the `path` column the\n * finding convention is built from. Typed as its own union (not just a set\n * membership test) so the CLI's dispatch can hand a narrowed format straight\n * to `render`, which takes `ReportFormat` and has no `csv` case.\n */\nexport const QUERY_FINDINGS_FORMATS = [\n \"github\",\n \"sarif\",\n \"junit\",\n] as const satisfies readonly QueryFormat[];\n\nexport type QueryFindingsFormat = (typeof QUERY_FINDINGS_FORMATS)[number];\n\n/**\n * A *narrowing* guard on purpose: the CLI's query switch handles the findings\n * formats in an early return, and this is what lets its remaining cases stay\n * compile-time exhaustive over `pretty | json | csv` — a bare `Set.has` would\n * leave the union unnarrowed and force the `never` guard out.\n */\nexport function isQueryFindingsFormat(\n value: QueryFormat,\n): value is QueryFindingsFormat {\n return (QUERY_FINDINGS_FORMATS as readonly string[]).includes(value);\n}\n\n/**\n * Formats something other than a person reads.\n *\n * These own stdout completely: a diagnostic printed alongside them (which\n * config governed the run, say) would corrupt the parse. Colored escape codes\n * would too, which is why the same predicate answers both questions.\n */\nexport const MACHINE_FORMATS: ReadonlySet<ReportFormat> = new Set<ReportFormat>(\n [\"json\", \"github\", \"sarif\", \"junit\"],\n);\n\nexport const isMachineFormat = (format: ReportFormat): boolean =>\n MACHINE_FORMATS.has(format);\n\n/**\n * Formats whose output may legitimately be empty.\n *\n * `github` prints one annotation per finding, so a clean run has nothing to\n * say. Every other format has an **envelope** that must arrive even when it\n * holds nothing: a zero-byte SARIF file makes `upload-sarif` fail outright, and\n * a zero-byte JUnit file reads as a lost report rather than a passing one. So\n * emptiness is a property of the format, not of the text — which is what the\n * CLI's old bare `if (text.length > 0)` guard got wrong.\n */\nexport const OMITTED_WHEN_CLEAN: ReadonlySet<ReportFormat> =\n new Set<ReportFormat>([\"github\"]);\n\nexport interface ReportOptions extends SarifOptions, JunitOptions {\n color?: boolean;\n /** In pretty output, omit passing files. */\n quiet?: boolean;\n}\n\nexport type { FingerprintContext };\n\nconst plural = (n: number, one: string, many: string): string =>\n `${n} ${n === 1 ? one : many}`;\n\n/**\n * The baseline's line in the summary.\n *\n * A baseline is amnesty, and amnesty that goes quiet becomes permanent — so the\n * count is printed on **every** run, including the one where nothing was\n * forgiven, rather than only when something changes. The stale clause is what\n * makes a rename diagnosable: without it the user sees a wall of \"new\" findings\n * with no hint that the fix is a re-record.\n */\nfunction baselineLines(b: BaselineSummary): string[] {\n if (b.written) {\n const added = b.added ?? 0;\n const removed = b.removed ?? 0;\n return [\n `Baseline written to ${b.path}`,\n ` ${plural(b.recorded, \"finding\", \"findings\")} recorded (+${added} new, -${removed} ${\n removed === 1 ? \"no longer occurs\" : \"no longer occur\"\n })`,\n ];\n }\n const head = plural(b.recorded, \"baselined finding\", \"baselined findings\");\n if (b.stale === 0) return [head];\n const stale = b.stale === 1 ? \"1 no longer occurs\" : `${b.stale} no longer occur`;\n return [`${head}, ${stale} — run --write-baseline to prune`];\n}\n\nexport function renderPretty(\n results: ValidationResult[],\n summary: RunSummary,\n opts: ReportOptions = {},\n): string {\n const c = palette(opts.color ?? false);\n const lines: string[] = [];\n\n for (const r of results) {\n // What the baseline forgave here, so a passing file still shows its debt.\n const forgiven =\n r.baselined != null && r.baselined > 0\n ? c.dim(` (${r.baselined} baselined)`)\n : \"\";\n if (r.ok && r.errors.length === 0) {\n if (!opts.quiet) lines.push(`${c.green(\"✓\")} ${r.file}${forgiven}`);\n continue;\n }\n // A file that is `ok` with findings holds only warnings: something to\n // say, so `--quiet` keeps it, but not a failure, so it is not a `✗`.\n const mark = r.ok ? c.yellow(\"⚠\") : c.red(\"✗\");\n lines.push(`${mark} ${r.file}${forgiven}`);\n for (const e of r.errors) {\n // A value a manifest supplied is located in the manifest, not the\n // document, and the location says so (proposal 0037).\n const loc =\n e.file != null\n ? c.dim(` (${e.file}${e.line != null ? `:${e.line}` : \"\"})`)\n : e.line != null\n ? c.dim(` (line ${e.line})`)\n : \"\";\n const level = isErrorSeverity(e)\n ? \"\"\n : `${e.severity === \"notice\" ? c.dim(\"notice\") : c.yellow(\"warning\")} `;\n lines.push(\n ` ${c.cyan(fieldLabel(e.instancePath))} ${level}${e.message}${loc} ${c.dim(\n `[${e.schema}]`,\n )}`,\n );\n }\n }\n\n // Files `.gitignore` took away are named on the summary line, not left to be\n // inferred from a count that quietly shrank. A gate getting quieter without\n // being asked is the dangerous direction of change; this is what makes it\n // auditable. Omitted at zero, which is every run in a clean repo.\n const skipped =\n summary.gitignoreSkipped != null && summary.gitignoreSkipped > 0\n ? `, ${summary.gitignoreSkipped} skipped by .gitignore`\n : \"\";\n // Warnings are named only when there are any, for the same reason as the\n // skip count: every run of meta's own validation has none.\n const warnings =\n summary.warnings != null && summary.warnings > 0\n ? `, ${plural(summary.warnings, \"warning\", \"warnings\")}`\n : \"\";\n const notices =\n summary.notices != null && summary.notices > 0\n ? `, ${plural(summary.notices, \"notice\", \"notices\")}`\n : \"\";\n const summaryText = `${summary.files} file${summary.files === 1 ? \"\" : \"s\"} checked, ${summary.passed} passed, ${summary.failed} failed, ${summary.errors} error${summary.errors === 1 ? \"\" : \"s\"}${warnings}${notices}${skipped}`;\n if (lines.length > 0) lines.push(\"\");\n lines.push(summary.failed > 0 ? c.red(summaryText) : c.green(summaryText));\n if (summary.baseline) {\n for (const l of baselineLines(summary.baseline)) lines.push(c.dim(l));\n }\n return lines.join(\"\\n\");\n}\n\nexport function renderJson(\n results: ValidationResult[],\n summary: RunSummary,\n): string {\n return JSON.stringify({ summary, results }, null, 2);\n}\n\nexport function renderGithub(results: ValidationResult[]): string {\n const lines: string[] = [];\n for (const r of results) {\n for (const e of r.errors) {\n const params = [`file=${escapeWorkflowCommandProperty(e.file ?? r.file)}`];\n if (e.line != null) params.push(`line=${e.line}`);\n if (e.col != null) params.push(`col=${e.col}`);\n // Escaped as one string, after assembly: the schema id and the field\n // label are as capable of carrying a `%` as the message is.\n const msg = escapeWorkflowCommandMessage(\n `[${e.schema}] ${fieldLabel(e.instancePath)} ${e.message}`,\n );\n // The family scale was chosen to be GitHub's, so the level is the\n // severity, and an absent one is `error` (`isErrorSeverity`).\n // `::warning` and `::notice` render inline like `::error` but do not\n // fail the check, which is the severity invariant in GitHub's terms.\n const level = e.severity ?? \"error\";\n lines.push(`::${level} ${params.join(\",\")}::${msg}`);\n }\n }\n return lines.join(\"\\n\");\n}\n\nexport function render(\n format: ReportFormat,\n results: ValidationResult[],\n summary: RunSummary,\n opts: ReportOptions = {},\n): string {\n switch (format) {\n case \"json\":\n return renderJson(results, summary);\n case \"github\":\n return renderGithub(results);\n case \"sarif\":\n return renderSarif(results, opts);\n case \"junit\":\n return renderJunit(results, opts);\n case \"pretty\":\n return renderPretty(results, summary, opts);\n default: {\n // Exhaustive: adding a format to `REPORT_FORMATS` without a case here is\n // a compile error. The throw is for the runtime half — `render` is public\n // API, and before this existed a caller passing \"sarif\" fell through to\n // `pretty` and got a human report where it asked for a machine one.\n const unreachable: never = format;\n throw new DocmetaError(\n `Unknown report format ${JSON.stringify(unreachable)}. Use ${REPORT_FORMAT_LIST}.`,\n );\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAcA,IAAM,mBAAmB;AAGlB,IAAM,mBAAmB;AAGzB,IAAM,oBAAoB;AAO1B,IAAM,sBAAsB;AAM5B,IAAM,0BAA0B;AAMhC,IAAM,uBAAuB;AAM7B,IAAM,4BAA4B;AAOlC,IAAM,qBAAqB;AAM3B,IAAM,yBAAyB;AAM/B,IAAM,qBAAqB;AAM3B,IAAM,sBAAsB;AAG5B,IAAM,2BAA2B;AAGjC,IAAM,sBAAsB;AAG5B,IAAM,iBAAyC;AAAA,EACpD,CAAC,sBAAsB,GACrB;AAAA,EACF,CAAC,kBAAkB,GACjB;AAAA,EACF,CAAC,oBAAoB,GACnB;AAAA,EACF,CAAC,yBAAyB,GACxB;AAAA,EACF,CAAC,mBAAmB,GAClB;AAAA,EACF,CAAC,wBAAwB,GACvB;AAAA,EACF,CAAC,mBAAmB,GAClB;AAAA,EACF,CAAC,gBAAgB,GAAG;AAAA,EACpB,CAAC,iBAAiB,GAAG;AAAA,EACrB,CAAC,mBAAmB,GAClB;AAAA,EACF,CAAC,uBAAuB,GACtB;AAAA,EACF,CAAC,kBAAkB,GACjB;AACJ;AAaO,SAAS,UAAU,GAAe,OAAoC;AAC3E,M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EAAE,GAAG,EAAE;AAG7C,YAAM,MAAM;AAAA,QACV,IAAI,EAAE,MAAM,KAAK,WAAW,EAAE,YAAY,CAAC,IAAI,EAAE,OAAO;AAAA,MAC1D;AAKA,YAAM,QAAQ,EAAE,YAAY;AAC5B,YAAM,KAAK,KAAK,KAAK,IAAI,OAAO,KAAK,GAAG,CAAC,KAAK,GAAG,EAAE;AAAA,IACrD;AAAA,EACF;AACA,SAAO,MAAM,KAAK,IAAI;AACxB;AAEO,SAAS,OACd,QACA,SACA,SACA,OAAsB,CAAC,GACf;AACR,UAAQ,QAAQ;AAAA,IACd,KAAK;AACH,aAAO,WAAW,SAAS,OAAO;AAAA,IACpC,KAAK;AACH,aAAO,aAAa,OAAO;AAAA,IAC7B,KAAK;AACH,aAAO,YAAY,SAAS,IAAI;AAAA,IAClC,KAAK;AACH,aAAO,YAAY,SAAS,IAAI;AAAA,IAClC,KAAK;AACH,aAAO,aAAa,SAAS,SAAS,IAAI;AAAA,IAC5C,SAAS;AAKP,YAAM,cAAqB;AAC3B,YAAM,IAAI;AAAA,QACR,yBAAyB,KAAK,UAAU,WAAW,CAAC,SAAS,kBAAkB;AAAA,MACjF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/term/commands/check.ts","../src/term/core/severity.ts","../src/term/core/check.ts","../src/term/commands/findings.ts"],"sourcesContent":["/**\n * `manni term check`: the referential integrity of the set (proposal 0052 § 7),\n * with the baseline ratchet meta and cite use.\n *\n * `--baseline` is one flag for both halves of the ratchet. When the baseline\n * file is not there yet, the run records one and exits 0: that is how a docset\n * whose terms were never checked ramps in. When it is there, the run fails only\n * on findings it does not hold. A configured `term.baseline` compares without\n * the flag, as `cite.baseline` does.\n */\nimport { existsSync } from \"node:fs\";\nimport { resolveBaselineRequest, settleBaseline } from \"../../meta/internal.js\";\nimport { checkTermSet } from \"../core/check.js\";\nimport { DEFAULT_TERM_BASELINE_PATH } from \"../core/config.js\";\nimport { TermError } from \"../errors.js\";\nimport { reportedFindings, summarize, toResults, type TermReport } from \"./findings.js\";\nimport { loadTerms, type TermCommandOptions } from \"./run.js\";\n\nexport interface CheckOptions extends TermCommandOptions {\n /** `--baseline`. */\n baseline?: boolean;\n}\n\nexport async function runCheck(opts: CheckOptions): Promise<TermReport> {\n const { cwd, run, set } = await loadTerms(opts);\n const config = run.config;\n const findings = checkTermSet(set, {\n ...(config?.severity === undefined ? {} : { severity: config.severity }),\n ...(config?.abstractMaxLength === undefined ? {} : { abstractMaxLength: config.abstractMaxLength }),\n ...(config?.fill?.crawl?.minPages === undefined ? {} : { minPages: config.fill.crawl.minPages }),\n });\n const { results, origin } = toResults(set, findings);\n\n // Fingerprints must not depend on where the command was run from.\n const frame = { cwd, base: run.configDir ?? cwd, runBase: run.base };\n let request = resolveBaselineRequest(\n opts.baseline === true ? { baseline: true } : {},\n config?.baseline,\n run.configDir,\n cwd,\n { current: DEFAULT_TERM_BASELINE_PATH },\n );\n if (request !== null && !existsSync(request.absPath)) {\n if (opts.baseline !== true) {\n throw new TermError(\n `Baseline \"${request.label}\" not found. Record one with \\`manni term check --baseline\\`.`,\n );\n }\n request = { ...request, write: true };\n }\n const { results: reported, baseline } = await settleBaseline(results, request, frame);\n\n return {\n findings: reportedFindings(reported, origin),\n results: reported,\n summary: summarize(reported, baseline),\n frame,\n terms: set.terms.length,\n references: set.references.length,\n ...(baseline === undefined ? {} : { baseline }),\n found: findings.length,\n cwd,\n };\n}\n","/**\n * Rule ids and levels for the term tool (proposal 0052). `check` findings are\n * `manni:term/<rule>`. A `lint` finding keeps Vale's own rule name,\n * `manni:term/prose/<Style.Rule>`, in the shape lint's proposal 0050 set for\n * its prose job, because that is the name Vale's documentation uses.\n */\nimport type { Severity } from \"../../shared/severity.js\";\nimport { TERM_RULES, type TermRule, type TermSeverity, type ValeSeverity } from \"../types.js\";\n\nexport const RULE_ID_PREFIX = \"manni:term\";\n\nexport const DEFAULT_SEVERITY: Readonly<Record<TermRule, TermSeverity>> = {\n \"undefined-term\": \"error\",\n \"duplicate-id\": \"error\",\n \"label-collision\": \"error\",\n \"alt-label-collision\": \"error\",\n \"label-overlap\": \"error\",\n \"dangling-reference\": \"error\",\n \"broader-cycle\": \"error\",\n \"see-not-empty\": \"error\",\n \"missing-definition\": \"error\",\n \"conflicting-matches\": \"error\",\n \"asymmetric-hierarchy\": \"warning\",\n \"asymmetric-related\": \"warning\",\n \"related-in-hierarchy\": \"warning\",\n \"alt-label-reference\": \"warning\",\n \"ambiguous-alt-label\": \"warning\",\n \"deprecated-label\": \"warning\",\n \"abstract-too-long\": \"notice\",\n \"unused-term\": \"notice\",\n \"hierarchy-outside-termbase\": \"notice\",\n \"related-siblings\": \"notice\",\n \"orphan-term\": \"notice\",\n \"keyword-candidate\": \"notice\",\n};\n\nexport function ruleId(rule: TermRule): string {\n return `${RULE_ID_PREFIX}/${rule}`;\n}\n\nexport function proseRuleId(check: string): string {\n return `${RULE_ID_PREFIX}/prose/${check}`;\n}\n\nexport function isTermRule(value: string): value is TermRule {\n return (TERM_RULES as readonly string[]).includes(value);\n}\n\n/** The defaults with config's overrides laid over them. */\nexport function resolveSeverity(\n overrides?: Partial<Record<TermRule, TermSeverity>>,\n): Record<TermRule, TermSeverity> {\n return { ...DEFAULT_SEVERITY, ...overrides };\n}\n\n/**\n * Vale's scale onto the family's. A finding keeps Vale's own value beside the\n * folded one, as an a11y violation keeps axe's `impact`.\n */\nexport function foldValeSeverity(severity: ValeSeverity): Severity {\n return severity === \"suggestion\" ? \"notice\" : severity;\n}\n","/**\n * `term check`'s rules (proposal 0052 § 7): the referential integrity of a term\n * set. Pure: it reads records and references and returns findings, so the\n * command core owns every file and the rules are tested on sets built inline.\n *\n * Every label comparison ignores case, because the Vale style `write -f vale`\n * renders is a `swap` map keyed on the lowercased term. Two labels that differ\n * only in case collide there silently, so they collide here out loud. Ids\n * compare ignoring case too, because references resolve them that way.\n *\n * A set may hold one term per language, joined on `id` (proposal 0084). A term\n * with no language counts as `en`, and languages compare ignoring case. Across\n * languages, two labels collide only when they differ in spelling but not in\n * case: `API` in en and de is one word, `Kubernetes`/`kubernetes` is a clash.\n *\n * The hierarchy is the concept scheme's (proposal 0086): every term's\n * `broader` and `narrower`, plus every page's `graph:` block. A name on a page\n * resolves as the graph resolves it, by label, then id, then alt-label. The\n * thesaurus rules (proposal 0086 § 4) read that union too, and\n * `keyword-candidate` reads the free `keywords:` of every page loaded.\n */\nimport { TERM_RELATION_FIELDS } from \"../../shared/reference-fields.js\";\nimport { DEFAULT_ABSTRACT_MAX_LENGTH, DEFAULT_CRAWL_MIN_PAGES } from \"./config.js\";\nimport { languageKey as language } from \"./writers/render-util.js\";\nimport { resolveSeverity, ruleId } from \"./severity.js\";\nimport {\n TERM_MATCH_FIELDS,\n type Term,\n type TermField,\n type TermFinding,\n type TermReference,\n type TermRule,\n type TermSet,\n type TermSeverity,\n} from \"../types.js\";\n\nexport interface CheckTermSetOptions {\n severity?: Partial<Record<TermRule, TermSeverity>>;\n /** Default `DEFAULT_ABSTRACT_MAX_LENGTH`. */\n abstractMaxLength?: number;\n /** The pages a keyword needs to be a `keyword-candidate`: `term.fill.crawl.minPages`. Default `DEFAULT_CRAWL_MIN_PAGES`. */\n minPages?: number;\n}\n\n/** The `administrative-status` values that retire a designation, as 0084 reads them from TBX. */\nconst RETIRED_STATUSES: ReadonlySet<string> = new Set([\"deprecated\", \"superseded\"]);\n\n/** The fields whose values name other entries. */\nconst REFERENCE_FIELDS = TERM_RELATION_FIELDS;\ntype ReferenceField = (typeof REFERENCE_FIELDS)[number];\n\ninterface Draft {\n rule: TermRule;\n message: string;\n file: string;\n line?: number;\n id?: string;\n field?: TermField;\n}\n\nexport function checkTermSet(set: TermSet, opts: CheckTermSetOptions = {}): TermFinding[] {\n const levels = resolveSeverity(opts.severity);\n const maxLength = opts.abstractMaxLength ?? DEFAULT_ABSTRACT_MAX_LENGTH;\n const { terms } = set;\n const drafts: Draft[] = [];\n\n const fold = (value: string): string => value.toLowerCase();\n const where = (t: Term): string => `${t.location.file}:${String(t.location.line)}`;\n const onEntry = (t: Term, rule: TermRule, message: string, field?: TermField): Draft => ({\n rule,\n message,\n file: t.location.file,\n line: (field === undefined ? undefined : t.location.fieldLines[field]) ?? t.location.line,\n id: t.id,\n ...(field === undefined ? {} : { field }),\n });\n\n // The first entry claiming each folded label, id and alt-label, overall\n // and per language.\n const byLabel = new Map<string, number>();\n const byId = new Map<string, number>();\n const inLanguage = new Map<string, number>();\n const byAlt = new Map<string, number>();\n // Every entry per folded label, and per folded alt-label, in set order, for\n // the collision rules.\n const labelled = new Map<string, number[]>();\n const altHeld = new Map<string, Set<number>>();\n const claim = (map: Map<string, number>, key: string, index: number): void => {\n if (!map.has(key)) map.set(key, index);\n };\n terms.forEach((t, index) => {\n claim(byLabel, fold(t.record.label), index);\n const group = labelled.get(fold(t.record.label));\n if (group === undefined) labelled.set(fold(t.record.label), [index]);\n else group.push(index);\n claim(byId, fold(t.id), index);\n claim(inLanguage, `${language(t)} label ${fold(t.record.label)}`, index);\n claim(inLanguage, `${language(t)} id ${fold(t.id)}`, index);\n for (const alt of t.record[\"alt-labels\"] ?? []) {\n claim(byAlt, fold(alt), index);\n claim(inLanguage, `${language(t)} alt ${fold(alt)}`, index);\n const holders = altHeld.get(fold(alt));\n if (holders === undefined) altHeld.set(fold(alt), new Set([index]));\n else holders.add(index);\n }\n });\n /** Whether `t`'s label `a` collides with `other`'s label `b`: within a language when they fold alike, across languages only when their spelling differs too. */\n const clash = (t: Term, a: string, other: Term, b: string): boolean =>\n fold(a) === fold(b) && (language(t) === language(other) || a !== b);\n /** The first entry other than `index` whose label collides with `value` on `t`, among those `before` allows. */\n const collider = (t: Term, index: number, value: string, before: boolean): Term | undefined => {\n for (const otherIndex of labelled.get(fold(value)) ?? []) {\n if (otherIndex === index || (before && otherIndex > index)) continue;\n const other = terms[otherIndex];\n if (other !== undefined && clash(t, value, other, other.record.label)) return other;\n }\n return undefined;\n };\n /** As `collider`, against other entries' alt-labels. */\n const altCollider = (t: Term, index: number, value: string, before: boolean): Term | undefined => {\n for (const otherIndex of altHeld.get(fold(value)) ?? []) {\n if (otherIndex === index || (before && otherIndex > index)) continue;\n const other = terms[otherIndex];\n const alt = other?.record[\"alt-labels\"]?.find((a) => fold(a) === fold(value));\n if (other !== undefined && alt !== undefined && clash(t, value, other, alt)) return other;\n }\n return undefined;\n };\n\n // A same-language label, then a same-language id, then any language.\n const resolveReference = (from: Term, value: string): number | undefined =>\n inLanguage.get(`${language(from)} label ${fold(value)}`) ??\n inLanguage.get(`${language(from)} id ${fold(value)}`) ??\n byLabel.get(fold(value)) ??\n byId.get(fold(value));\n\n // A name on a page, in the graph's order (`termIndex` in\n // src/graph/core/concepts.ts): the page's language, then its primary\n // language, then any, and within each a label, an id, then an alt-label. The\n // two must change together, or term check and the graph judge different\n // hierarchies. So here, unlike the other rules, a page or term with no\n // language takes part only in the last pass, as in the graph.\n const tagOf = (tag: string | undefined): string | undefined =>\n tag === undefined || tag === \"\" ? undefined : fold(tag);\n // `split` always yields one element; the `?? \"\"` only satisfies the index type.\n const primaryOf = (tag: string): string => tag.split(\"-\")[0] ?? \"\";\n const ids = new Map<string, number[]>();\n const alts = new Map<string, number[]>();\n const list = (map: Map<string, number[]>, key: string, index: number): void => {\n const held = map.get(key);\n if (held === undefined) map.set(key, [index]);\n else held.push(index);\n };\n terms.forEach((t, index) => {\n list(ids, fold(t.id), index);\n for (const alt of t.record[\"alt-labels\"] ?? []) list(alts, fold(alt), index);\n });\n const tiers: [Map<string, number[]>, boolean][] = [\n [labelled, false],\n [ids, false],\n [alts, true],\n ];\n const resolvePageName = (value: string, lang: string | undefined): { index: number; alt: boolean } | undefined => {\n const wanted = tagOf(lang);\n const passes: ((t: Term) => boolean)[] =\n wanted === undefined\n ? [() => true]\n : [\n (t) => tagOf(t.language) === wanted,\n (t) => {\n const own = tagOf(t.language);\n return own !== undefined && primaryOf(own) === primaryOf(wanted);\n },\n () => true,\n ];\n for (const pass of passes) {\n for (const [map, alt] of tiers) {\n const index = map.get(fold(value))?.find((i) => {\n const t = terms[i];\n return t !== undefined && pass(t);\n });\n if (index !== undefined) return { index, alt };\n }\n }\n return undefined;\n };\n const resolveName = (value: string, lang: string | undefined): number | undefined =>\n resolvePageName(value, lang)?.index;\n\n // undefined-term and alt-label-reference, and the ids some page names, for unused-term.\n const usedIds = new Set<string>();\n for (const reference of set.references) {\n const field = reference.field ?? \"concepts\";\n const at = { file: reference.file, ...(reference.line === undefined ? {} : { line: reference.line }) };\n const hit = resolvePageName(reference.label, reference.language);\n const target = terms[hit?.index ?? -1];\n if (target !== undefined) usedIds.add(fold(target.id));\n if (hit !== undefined && !hit.alt) continue;\n drafts.push(\n target === undefined\n ? { rule: \"undefined-term\", message: `${field}: \"${reference.label}\" names no entry.`, ...at }\n : {\n rule: \"alt-label-reference\",\n message: `${field}: \"${reference.label}\" is an alt-label of \"${target.record.label}\", so name the label.`,\n ...at,\n },\n );\n }\n\n // duplicate-id: ignoring case, as references resolve ids, on every entry\n // sharing the id in one language.\n const sharing = new Map<string, Term[]>();\n for (const t of terms) {\n const id = `${language(t)} ${fold(t.id)}`;\n const group = sharing.get(id);\n if (group === undefined) sharing.set(id, [t]);\n else group.push(t);\n }\n for (const group of sharing.values()) {\n if (group.length < 2) continue;\n for (const t of group) {\n const others = group.filter((other) => other !== t).map(where);\n drafts.push(onEntry(t, \"duplicate-id\", `id: \"${t.id}\" is also used by ${others.join(\", \")}`));\n }\n }\n\n terms.forEach((t, index) => {\n // label-collision: on each later entry, naming the first.\n const firstTerm = collider(t, index, t.record.label, true);\n if (firstTerm !== undefined) {\n drafts.push(\n onEntry(\n t,\n \"label-collision\",\n `\"${t.record.label}\" is claimed by ${where(firstTerm)} as \"${firstTerm.record.label}\"`,\n \"label\",\n ),\n );\n }\n\n // alt-label-collision: an alt-label that is another entry's label.\n for (const alt of t.record[\"alt-labels\"] ?? []) {\n const owner = collider(t, index, alt, false);\n if (owner !== undefined) {\n drafts.push(\n onEntry(t, \"alt-label-collision\", `alt-labels: \"${alt}\" is the label of ${where(owner)}`, \"alt-labels\"),\n );\n }\n // label-overlap: an alt-label that repeats the entry's own label.\n if (fold(alt) === fold(t.record.label)) {\n drafts.push(onEntry(t, \"label-overlap\", `alt-labels: \"${alt}\" repeats this entry's label.`, \"alt-labels\"));\n }\n // ambiguous-alt-label: on each later entry, naming the first.\n const sharer = altCollider(t, index, alt, true);\n if (sharer !== undefined) {\n drafts.push(\n onEntry(\n t,\n \"ambiguous-alt-label\",\n `alt-labels: \"${alt}\" is also an alt-label of ${where(sharer)}, so a reader can't tell which term it means.`,\n \"alt-labels\",\n ),\n );\n }\n }\n\n // label-overlap: a hidden-label is a name the entry or another one goes by.\n const ownAlts = new Set((t.record[\"alt-labels\"] ?? []).map(fold));\n for (const hidden of t.record[\"hidden-labels\"] ?? []) {\n const labelOf = collider(t, index, hidden, false);\n const altOf = labelOf === undefined ? altCollider(t, index, hidden, false) : undefined;\n const overlap =\n fold(hidden) === fold(t.record.label)\n ? \"repeats this entry's label.\"\n : ownAlts.has(fold(hidden))\n ? \"repeats this entry's alt-label.\"\n : labelOf !== undefined\n ? `is the label of ${where(labelOf)}.`\n : altOf !== undefined\n ? `is an alt-label of ${where(altOf)}.`\n : undefined;\n if (overlap !== undefined) {\n drafts.push(onEntry(t, \"label-overlap\", `hidden-labels: \"${hidden}\" ${overlap}`, \"hidden-labels\"));\n }\n }\n\n // deprecated-label: the designation of the label itself is retired.\n const status = t.record.designations?.find((d) => fold(d.term) === fold(t.record.label))?.[\"administrative-status\"];\n if (t.record.see === undefined && status !== undefined && RETIRED_STATUSES.has(fold(status))) {\n drafts.push(\n onEntry(\n t,\n \"deprecated-label\",\n `label: \"${t.record.label}\" is deprecated in designations, so promote another label or redirect with see:.`,\n \"label\",\n ),\n );\n }\n\n // dangling-reference: one finding per value that resolves to nothing.\n for (const field of REFERENCE_FIELDS) {\n for (const value of referenceValues(t, field)) {\n if (resolveReference(t, value) === undefined) {\n drafts.push(onEntry(t, \"dangling-reference\", `${field}: \"${value}\" names no entry`, field));\n }\n }\n }\n\n // see-not-empty: a redirect carries no definition.\n if (t.record.see !== undefined && t.record.definition !== undefined) {\n drafts.push(\n onEntry(t, \"see-not-empty\", `see: \"${t.record.see}\" redirects this entry, so remove its definition`, \"see\"),\n );\n }\n\n // missing-definition: an entry that neither defines its term nor redirects.\n if (t.record.see === undefined && t.record.definition === undefined) {\n drafts.push(\n onEntry(t, \"missing-definition\", \"definition: missing, so write one or run manni term fill.\", \"definition\"),\n );\n }\n\n // conflicting-matches: once per IRI, naming the first kind it is under and the next.\n const kindOf = new Map<string, TermField>();\n const conflicting = new Set<string>();\n for (const field of TERM_MATCH_FIELDS) {\n for (const iri of t.record[field] ?? []) {\n const first = kindOf.get(iri);\n if (first === undefined) kindOf.set(iri, field);\n else if (first !== field && !conflicting.has(iri)) {\n conflicting.add(iri);\n drafts.push(\n onEntry(t, \"conflicting-matches\", `${first}: \"${iri}\" is also in ${field}, and a mapping has one kind.`, first),\n );\n }\n }\n }\n\n // abstract-too-long.\n const abstract = t.record.abstract;\n if (abstract !== undefined && abstract.length > maxLength) {\n drafts.push(\n onEntry(\n t,\n \"abstract-too-long\",\n `abstract: ${String(abstract.length)} characters is over the limit of ${String(maxLength)}, so shorten it`,\n \"abstract\",\n ),\n );\n }\n\n // unused-term: no reference resolves to any term sharing the id.\n if (!usedIds.has(fold(t.id))) {\n drafts.push(onEntry(t, \"unused-term\", \"no page's concepts: names this term\"));\n }\n });\n\n // The resolved hierarchy, one edge per pair.\n const edges = (field: \"broader\" | \"narrower\" | \"related-terms\"): Set<number>[] =>\n terms.map((t) => {\n const targets = new Set<number>();\n for (const value of referenceValues(t, field)) {\n const target = resolveReference(t, value);\n if (target !== undefined) targets.add(target);\n }\n return targets;\n });\n const broader = edges(\"broader\");\n const narrower = edges(\"narrower\");\n const related = edges(\"related-terms\");\n\n // asymmetric-related: on the entry that omits the other half.\n terms.forEach((t, index) => {\n for (const other of related[index] ?? []) {\n const otherTerm = terms[other];\n if (otherTerm !== undefined && !(related[other]?.has(index) ?? false)) {\n drafts.push(\n onEntry(\n otherTerm,\n \"asymmetric-related\",\n `related-terms: omits \"${t.record.label}\", which lists this entry as related.`,\n \"related-terms\",\n ),\n );\n }\n }\n });\n\n // asymmetric-hierarchy: each missing half, on the entry that should carry it.\n terms.forEach((t, index) => {\n for (const parent of broader[index] ?? []) {\n const parentTerm = terms[parent];\n if (parentTerm !== undefined && !(narrower[parent]?.has(index) ?? false)) {\n drafts.push(\n onEntry(\n parentTerm,\n \"asymmetric-hierarchy\",\n `narrower: omits \"${t.record.label}\", which lists this entry as broader`,\n \"narrower\",\n ),\n );\n }\n }\n for (const child of narrower[index] ?? []) {\n const childTerm = terms[child];\n if (childTerm !== undefined && !(broader[child]?.has(index) ?? false)) {\n drafts.push(\n onEntry(\n childTerm,\n \"asymmetric-hierarchy\",\n `broader: omits \"${t.record.label}\", which lists this entry as narrower`,\n \"broader\",\n ),\n );\n }\n }\n });\n\n // The concept scheme's hierarchy, child to parent: every term's broader and\n // narrower, then every graph block's. A name no term claims is a freeform\n // node of its own, after the terms.\n const names = terms.map((t) => t.record.label);\n const freeform = new Map<string, number>();\n const node = (value: string, lang: string | undefined): number => {\n const index = resolveName(value, lang) ?? freeform.get(fold(value));\n if (index !== undefined) return index;\n freeform.set(fold(value), names.length);\n names.push(value);\n return names.length - 1;\n };\n const up: Set<number>[] = [];\n const termEdges = new Set<string>();\n const blockEdges = new Map<string, { file: string; line?: number }>();\n const link = (child: number, parent: number): string => {\n (up[child] ??= new Set()).add(parent);\n return `${String(child)}>${String(parent)}`;\n };\n broader.forEach((parents, child) => {\n for (const parent of parents) termEdges.add(link(child, parent));\n });\n narrower.forEach((children, parent) => {\n for (const child of children) termEdges.add(link(child, parent));\n });\n for (const block of set.blocks) {\n const subject = node(block.label, block.language);\n for (const edge of block.edges) {\n if (edge.field === \"related-concepts\") continue;\n const other = node(edge.value, block.language);\n const key = edge.field === \"broader\" ? link(subject, other) : link(other, subject);\n const line = edge.line ?? block.line;\n if (!blockEdges.has(key)) blockEdges.set(key, { file: block.file, ...(line === undefined ? {} : { line }) });\n }\n }\n\n // broader-cycle: every elementary cycle once, found from its earliest node.\n // A cycle the terms close alone sits on that entry; one a block edge closes\n // sits on the first such edge's page.\n for (const [start, path] of broaderCycles(up)) {\n const chain = [...path, start];\n const message = `broader: ${chain.map((index) => names[index] ?? \"\").join(\" > \")}`;\n const hops = path.map((from, i) => `${String(from)}>${String(chain[i + 1])}`);\n const viaBlock = hops.find((hop) => !termEdges.has(hop));\n const startTerm = terms[start];\n if (viaBlock === undefined && startTerm !== undefined) {\n drafts.push(onEntry(startTerm, \"broader-cycle\", message, \"broader\"));\n } else {\n const at = blockEdges.get(viaBlock ?? \"\");\n if (at !== undefined) drafts.push({ rule: \"broader-cycle\", message, ...at });\n }\n }\n\n // hierarchy-outside-termbase: a block whose label is a term gives it an edge\n // the term's own field does not list. Values compare as concepts, by id.\n const concept = (index: number | undefined, value: string): string => {\n const t = index === undefined ? undefined : terms[index];\n return t === undefined ? `name ${fold(value)}` : `id ${fold(t.id)}`;\n };\n for (const block of set.blocks) {\n const t = terms[resolveName(block.label, block.language) ?? -1];\n if (t === undefined) continue;\n for (const edge of block.edges) {\n const field = edge.field === \"related-concepts\" ? \"related-terms\" : edge.field;\n const listed = referenceValues(t, field).map((value) => concept(resolveReference(t, value), value));\n if (listed.includes(concept(resolveName(edge.value, block.language), edge.value))) continue;\n const kind = t.location.construct === \"page\" ? \"page\" : \"entry\";\n const line = edge.line ?? block.line;\n drafts.push({\n rule: \"hierarchy-outside-termbase\",\n message: `graph: ${edge.field} \"${edge.value}\" on \"${t.record.label}\" is not on its term ${kind} (${t.location.file}), so add it there.`,\n file: block.file,\n ...(line === undefined ? {} : { line }),\n });\n }\n }\n\n // Every concept above a node, at any depth, over the whole union.\n const ancestors = (start: number): Set<number> => {\n const seen = new Set<number>();\n const stack = [...(up[start] ?? [])];\n for (let next = stack.pop(); next !== undefined; next = stack.pop()) {\n if (seen.has(next)) continue;\n seen.add(next);\n stack.push(...(up[next] ?? []));\n }\n return seen;\n };\n\n // related-in-hierarchy on the entry that lists the link; related-siblings\n // once per pair, on the first entry that lists the other.\n const siblingPairs = new Set<string>();\n terms.forEach((t, index) => {\n const above = ancestors(index);\n const seen = new Set<number>();\n for (const value of referenceValues(t, \"related-terms\")) {\n const other = resolveReference(t, value);\n if (other === undefined || other === index || seen.has(other)) continue;\n seen.add(other);\n const direction = above.has(other) ? \"broader\" : ancestors(other).has(index) ? \"narrower\" : undefined;\n if (direction !== undefined) {\n drafts.push(\n onEntry(\n t,\n \"related-in-hierarchy\",\n `related-terms: \"${value}\" is also ${direction} than this entry, so keep one of the two.`,\n \"related-terms\",\n ),\n );\n continue;\n }\n // Z39.19 siblings share an immediate broader term, not just an ancestor.\n const parent = [...(up[index] ?? [])].find((p) => up[other]?.has(p) ?? false);\n const pair = `${String(Math.min(index, other))}~${String(Math.max(index, other))}`;\n if (parent === undefined || siblingPairs.has(pair)) continue;\n siblingPairs.add(pair);\n drafts.push(\n onEntry(\n t,\n \"related-siblings\",\n `related-terms: \"${value}\" shares the broader term \"${names[parent] ?? \"\"}\", which already relates them.`,\n \"related-terms\",\n ),\n );\n }\n });\n\n // orphan-term: only once a term sits in the hierarchy at all, so a flat\n // glossary never hears of it, nor one whose only edges join names no term\n // defines (those sit past the terms in `names`). A concept is placed in\n // every language.\n const isTerm = (index: number): boolean => index < terms.length;\n if (up.some((parents, child) => isTerm(child) || [...parents].some(isTerm))) {\n const placed = new Set<string>();\n const place = (index: number | undefined): void => {\n if (index === undefined) return;\n const t = terms[index];\n if (t !== undefined) placed.add(fold(t.id));\n };\n up.forEach((parents, child) => {\n place(child);\n for (const parent of parents) place(parent);\n });\n related.forEach((others, index) => {\n if (others.size > 0) place(index);\n for (const other of others) place(other);\n });\n for (const block of set.blocks) {\n for (const edge of block.edges) {\n if (edge.field !== \"related-concepts\") continue;\n place(resolveName(block.label, block.language));\n place(resolveName(edge.value, block.language));\n }\n }\n for (const t of terms) {\n if (t.record.see === undefined && !placed.has(fold(t.id))) {\n drafts.push(onEntry(t, \"orphan-term\", \"no broader, narrower or related term, so place it in the hierarchy.\"));\n }\n }\n }\n\n // keyword-candidate: once per keyword, at its first page in sort order.\n const minPages = opts.minPages ?? DEFAULT_CRAWL_MIN_PAGES;\n const byKeyword = new Map<string, TermReference[]>();\n for (const keyword of set.keywords ?? []) {\n const uses = byKeyword.get(fold(keyword.label));\n if (uses === undefined) byKeyword.set(fold(keyword.label), [keyword]);\n else uses.push(keyword);\n }\n for (const [key, uses] of byKeyword) {\n if (byLabel.has(key) || byId.has(key) || byAlt.has(key)) continue;\n const pages = new Set(uses.map((use) => use.file)).size;\n const first = [...uses].sort((a, b) => compareText(a.file, b.file) || (a.line ?? 0) - (b.line ?? 0))[0];\n if (pages < minPages || first === undefined) continue;\n drafts.push({\n rule: \"keyword-candidate\",\n message: `keywords: \"${first.label}\" is on ${String(pages)} pages and names no term, so add it to concepts: or run manni term fill --crawl.`,\n file: first.file,\n ...(first.line === undefined ? {} : { line: first.line }),\n });\n }\n\n const findings: TermFinding[] = [];\n for (const draft of drafts) {\n const level = levels[draft.rule];\n if (level === \"off\") continue;\n findings.push({\n rule: draft.rule,\n ruleId: ruleId(draft.rule),\n severity: level,\n message: draft.message,\n file: draft.file,\n ...(draft.line === undefined ? {} : { line: draft.line }),\n ...(draft.id === undefined ? {} : { id: draft.id }),\n ...(draft.field === undefined ? {} : { field: draft.field }),\n });\n }\n return findings.sort(compareFindings);\n}\n\nfunction referenceValues(t: Term, field: ReferenceField): string[] {\n const value = t.record[field];\n if (value === undefined) return [];\n return typeof value === \"string\" ? [value] : value;\n}\n\n/**\n * Each elementary cycle of the `broader` graph, as its start and the path from\n * it. A search from `start` only visits later entries, so a cycle is found\n * exactly once, from the entry of it that comes first in set order.\n */\nfunction broaderCycles(broader: readonly Set<number>[]): [number, number[]][] {\n const cycles: [number, number[]][] = [];\n for (let start = 0; start < broader.length; start++) {\n const path: number[] = [start];\n const onPath = new Set<number>([start]);\n const walk = (node: number): void => {\n for (const next of broader[node] ?? []) {\n if (next === start) {\n cycles.push([start, [...path]]);\n } else if (next > start && !onPath.has(next)) {\n path.push(next);\n onPath.add(next);\n walk(next);\n path.pop();\n onPath.delete(next);\n }\n }\n };\n walk(start);\n }\n return cycles;\n}\n\nfunction compareText(a: string, b: string): number {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\nfunction compareFindings(a: TermFinding, b: TermFinding): number {\n return (\n compareText(a.file, b.file) ||\n (a.line ?? 0) - (b.line ?? 0) ||\n compareText(a.ruleId, b.ruleId) ||\n compareText(a.message, b.message)\n );\n}\n","/**\n * The report `check` and `lint` share, and the bridge from term findings to\n * meta's `ValidationResult`, so the SARIF and JUnit renderers and the baseline\n * ratchet work unchanged, as cite's adapter does for citations.\n *\n * FieldError: schema `manni:term` (a builtin-shaped ref, so fingerprints and\n * rule ids never depend on where the command ran), keyword = the rule id after\n * `manni:term/`, instancePath `/<field>` when the finding concerns one field\n * and `\"\"` when it concerns none (`undefined-term`, `duplicate-id`,\n * `unused-term`). A check finding and a lint finding carry the field the same\n * way. The subject is the entry, the field, and what the finding says, with any\n * `file:line` taken out: a line moves when a page is edited above the entry,\n * and a moved finding is not a new one.\n */\nimport {\n isErrorSeverity,\n type BaselineSummary,\n type FieldError,\n type FingerprintContext,\n type RunSummary,\n type ValidationResult,\n} from \"../../meta/index.js\";\nimport { RULE_ID_PREFIX } from \"../core/severity.js\";\nimport type { TermFinding, TermSet } from \"../types.js\";\n\nexport const FINDING_FORMATS = [\"pretty\", \"json\", \"github\", \"sarif\", \"junit\"] as const;\nexport type FindingFormat = (typeof FINDING_FORMATS)[number];\n\n/** JUnit `classname` for the term tool's findings. */\nexport const JUNIT_CLASSNAME = \"manni.term\";\n\n/** What `check` and `lint` return. */\nexport interface TermReport {\n /** The findings reported: a baselined one is not among them. */\n findings: TermFinding[];\n /** The same findings as meta's results, for SARIF and JUnit. One per file. */\n results: ValidationResult[];\n summary: RunSummary;\n frame: FingerprintContext;\n /** Entries in the set. */\n terms: number;\n /** `concepts:` values the run read. */\n references: number;\n /** How a baseline shaped the run, when one did. */\n baseline?: BaselineSummary;\n /** Findings before the baseline, for the line a recording run prints. */\n found: number;\n /** Where the run stood, for the paths the reporters print. */\n cwd: string;\n}\n\nconst LINE_REFERENCE = /:\\d+\\b/g;\n\nfunction toFieldError(finding: TermFinding): FieldError {\n const keyword = finding.ruleId.startsWith(`${RULE_ID_PREFIX}/`)\n ? finding.ruleId.slice(RULE_ID_PREFIX.length + 1)\n : finding.ruleId;\n const { field } = finding;\n const subject = [finding.id ?? \"\", field ?? \"\", finding.message.replace(LINE_REFERENCE, \"\")].join(\"\\u0000\");\n const error: FieldError = {\n schema: RULE_ID_PREFIX,\n instancePath: field === undefined ? \"\" : `/${field}`,\n message: finding.message,\n keyword,\n subject,\n severity: finding.severity,\n };\n if (finding.line !== undefined) error.line = finding.line;\n return error;\n}\n\n/**\n * One result per file: every file a term was read from, clean or not, and\n * every file a finding sits in. `origin` maps each error back to its finding.\n */\nexport function toResults(\n set: TermSet,\n findings: readonly TermFinding[],\n): { results: ValidationResult[]; origin: Map<FieldError, TermFinding> } {\n const origin = new Map<FieldError, TermFinding>();\n const byFile = new Map<string, FieldError[]>();\n for (const term of set.terms) {\n if (!byFile.has(term.location.file)) byFile.set(term.location.file, []);\n }\n for (const finding of findings) {\n const error = toFieldError(finding);\n origin.set(error, finding);\n const list = byFile.get(finding.file) ?? [];\n list.push(error);\n byFile.set(finding.file, list);\n }\n const results = [...byFile.keys()].sort().map((file): ValidationResult => {\n const errors = byFile.get(file) ?? [];\n return { file, format: \"term\", ok: !errors.some(isErrorSeverity), schemas: [RULE_ID_PREFIX], errors };\n });\n return { results, origin };\n}\n\n/** The run summary meta's renderers read, from results a baseline may have thinned. */\nexport function summarize(results: readonly ValidationResult[], baseline?: BaselineSummary): RunSummary {\n const failed = results.filter((r) => !r.ok).length;\n const count = (keep: (e: FieldError) => boolean): number =>\n results.reduce((n, r) => n + r.errors.filter(keep).length, 0);\n const warnings = count((e) => e.severity === \"warning\");\n const notices = count((e) => e.severity === \"notice\");\n return {\n files: results.length,\n passed: results.length - failed,\n failed,\n errors: count(isErrorSeverity),\n ...(warnings > 0 ? { warnings } : {}),\n ...(notices > 0 ? { notices } : {}),\n ...(baseline ? { baseline } : {}),\n };\n}\n\n/** The findings still reported once a baseline has thinned the results. */\nexport function reportedFindings(\n results: readonly ValidationResult[],\n origin: ReadonlyMap<FieldError, TermFinding>,\n): TermFinding[] {\n const kept: TermFinding[] = [];\n for (const result of results) {\n for (const error of result.errors) {\n const finding = origin.get(error);\n if (finding !== undefined) kept.push(finding);\n }\n }\n return kept.sort(compareFindings);\n}\n\nfunction compareFindings(a: TermFinding, b: TermFinding): number {\n if (a.file !== b.file) return a.file < b.file ? -1 : 1;\n const lineA = a.line ?? 0;\n const lineB = b.line ?? 0;\n if (lineA !== lineB) return lineA - lineB;\n if (a.ruleId !== b.ruleId) return a.ruleId < b.ruleId ? -1 : 1;\n return a.message < b.message ? -1 : a.message > b.message ? 1 : 0;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAUA,SAAS,kBAAkB;;;ACDpB,IAAM,iBAAiB;AAEvB,IAAM,mBAA6D;AAAA,EACxE,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,mBAAmB;AAAA,EACnB,uBAAuB;AAAA,EACvB,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,uBAAuB;AAAA,EACvB,wBAAwB;AAAA,EACxB,sBAAsB;AAAA,EACtB,wBAAwB;AAAA,EACxB,uBAAuB;AAAA,EACvB,uBAAuB;AAAA,EACvB,oBAAoB;AAAA,EACpB,qBAAqB;AAAA,EACrB,eAAe;AAAA,EACf,8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,aAAa,SAAY,CAAC,IAAI,EAAE,SAAS;AAAA,IAC7C,OAAO,SAAS;AAAA,IAChB;AAAA,EACF;AACF;","names":["compareFindings"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/term/reporters/github.ts"],"sourcesContent":["/**\n * GitHub workflow commands, one per reported finding:\n * `::error file=<file>,line=<n>,title=<ruleId>::<message>`, with `::warning`\n * and `::notice` for the lower levels. Uses meta's escapes. A clean run is the\n * empty string, which the CLI prints nothing for.\n */\nimport { escapeWorkflowCommandMessage, escapeWorkflowCommandProperty } from \"../../meta/internal.js\";\nimport type { TermReport } from \"../commands/findings.js\";\nimport { displayPath } from \"../commands/run.js\";\n\nexport function renderFindingsGithub(report: TermReport): string {\n return report.findings\n .map((finding) => {\n const params = [`file=${escapeWorkflowCommandProperty(displayPath(finding.file, report.cwd))}`];\n if (finding.line !== undefined) params.push(`line=${String(finding.line)}`);\n params.push(`title=${escapeWorkflowCommandProperty(finding.ruleId)}`);\n return `::${finding.severity} ${params.join(\",\")}::${escapeWorkflowCommandMessage(finding.message)}`;\n })\n .join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;AAUO,SAAS,qBAAqB,QAA4B;AAC/D,SAAO,OAAO,SACX,IAAI,CAAC,YAAY;AAChB,UAAM,SAAS,CAAC,QAAQ,8BAA8B,YAAY,QAAQ,MAAM,OAAO,GAAG,CAAC,CAAC,EAAE;AAC9F,QAAI,QAAQ,SAAS,OAAW,QAAO,KAAK,QAAQ,OAAO,QAAQ,IAAI,CAAC,EAAE;AAC1E,WAAO,KAAK,SAAS,8BAA8B,QAAQ,MAAM,CAAC,EAAE;AACpE,WAAO,KAAK,QAAQ,QAAQ,IAAI,OAAO,KAAK,GAAG,CAAC,KAAK,6BAA6B,QAAQ,OAAO,CAAC;AAAA,EACpG,CAAC,EACA,KAAK,IAAI;AACd;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tracevals/graders/util.ts"],"sourcesContent":["/** Shared helpers for deterministic graders. */\nimport type { EvalPlan } from \"../core/plan.js\";\nimport type {\n FileAccess,\n SkillInvocation,\n ToolCall,\n Trace,\n TraceEvent,\n} from \"../trace/types.js\";\nimport type { Finding, GradeResult } from \"./types.js\";\n\nexport function finding(plan: EvalPlan, message: string): Finding {\n return {\n evalName: plan.evalName,\n artifact: plan.artifact.path,\n message,\n severity: plan.severity,\n };\n}\n\nexport function fail(plan: EvalPlan, message: string): GradeResult {\n return { findings: [finding(plan, message)] };\n}\n\nexport const pass: GradeResult = { findings: [] };\n\nexport function optionsError(kind: string, message: string): GradeResult {\n return { findings: [], error: `${kind}: ${message}` };\n}\n\n/** An option-validation outcome: a message when invalid, undefined when fine. */\nexport type OptionCheck = string | undefined;\n\nexport type Options = Record<string, unknown>;\n\n/** First failing check, so callers read as a flat list of constraints. */\nexport function firstError(...checks: OptionCheck[]): OptionCheck {\n return checks.find((check) => check !== undefined);\n}\n\nexport function requiredString(options: Options, key: string): OptionCheck {\n const value = options[key];\n if (typeof value !== \"string\" || value.length === 0) {\n return `options.${key} is required`;\n }\n return undefined;\n}\n\nexport function optionalString(options: Options, key: string): OptionCheck {\n const value = options[key];\n if (value === undefined) return undefined;\n if (typeof value !== \"string\" || value.length === 0) {\n return `options.${key} must be a non-empty string`;\n }\n return undefined;\n}\n\nexport function optionalEnum(\n options: Options,\n key: string,\n allowed: readonly string[],\n): OptionCheck {\n const value = options[key];\n if (value === undefined) return undefined;\n if (typeof value !== \"string\" || !allowed.includes(value)) {\n return `options.${key} must be one of: ${allowed.join(\", \")}`;\n }\n return undefined;\n}\n\nexport function optionalNumber(\n options: Options,\n key: string,\n bounds: { min?: number; integer?: boolean } = {},\n): OptionCheck {\n const value = options[key];\n if (value === undefined) return undefined;\n // Number.isFinite also rejects NaN and both infinities.\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n return `options.${key} must be a finite number`;\n }\n if (bounds.integer === true && !Number.isInteger(value)) {\n return `options.${key} must be a whole number`;\n }\n if (bounds.min !== undefined && value < bounds.min) {\n return `options.${key} must be at least ${bounds.min}`;\n }\n return undefined;\n}\n\nexport function optionalBoolean(options: Options, key: string): OptionCheck {\n if (options[key] !== undefined && typeof options[key] !== \"boolean\") {\n return `options.${key} must be a boolean`;\n }\n return undefined;\n}\n\n/** Rejects min > max once both are present and already known to be numbers. */\nexport function orderedBounds(\n options: Options,\n minKey: string,\n maxKey: string,\n): OptionCheck {\n const min = options[minKey];\n const max = options[maxKey];\n if (typeof min === \"number\" && typeof max === \"number\" && min > max) {\n return `options.${maxKey} must be greater than or equal to options.${minKey}`;\n }\n return undefined;\n}\n\n/**\n * Rejects a criterion that configures no bound at all. Such a criterion can\n * never fail, so it reads as coverage while asserting nothing.\n */\nexport function requireOneOf(options: Options, keys: string[]): OptionCheck {\n if (keys.some((key) => options[key] !== undefined)) return undefined;\n return `at least one of ${keys.map((k) => `options.${k}`).join(\" or \")} is required`;\n}\n\n// ── Scoped grading ───────────────────────────────────────────────\n\n/**\n * The slice of a trace an artifact was actually governing (ADR 01015). The\n * window is derived from the artifact's *type*, never declared: a skill governs\n * from its invocation until the next skill takes over, an agent governs its own\n * branch, and project rules govern the whole session.\n */\nexport interface TraceWindow {\n /**\n * Which rule produced this window. `turn` is the last turn of a session or\n * a subagent's whole run, cut by `rules/turn.ts` (proposal 0079).\n */\n scope: \"session\" | \"skill\" | \"agent\" | \"slash-command\" | \"turn\";\n /** Names the window in reasons and in the judge digest. */\n label: string;\n /**\n * True when the artifact governed no turn at all. Graders must report\n * `skipped` on an empty window — never a pass, which would be a verdict\n * about turns the artifact had no part in.\n */\n empty: boolean;\n /** Why the window is empty; set only when `empty`. */\n reason?: string;\n events: TraceEvent[];\n toolCalls: ToolCall[];\n fileAccesses: FileAccess[];\n skillInvocations: SkillInvocation[];\n /** Prompts on the window's own chain; nested subagent turns are excluded. */\n userMessages: string[];\n assistantTexts: string[];\n turnCount: number;\n}\n\n/** Half-open ordinal range over `trace.events`; `end` may be Infinity. */\nexport interface Span {\n start: number;\n end: number;\n}\n\nexport function windowFor(trace: Trace, plan: EvalPlan): TraceWindow {\n return windowOf(trace, plan.artifact);\n}\n\n/** `windowFor` keyed on the artifact alone, for callers with no eval plan. */\nexport function windowOf(\n trace: Trace,\n artifact: Pick<EvalPlan[\"artifact\"], \"name\" | \"type\">,\n): TraceWindow {\n const { name, type } = artifact;\n if (type === \"skill\") return skillWindow(trace, name);\n if (type === \"agent\") return agentWindow(trace, name);\n if (type === \"slash-command\") return slashCommandWindow(trace, name);\n // Project rules govern everything, so the window is the trace itself —\n // handed back by reference, so a session-scoped eval grades exactly what it\n // graded before scoping existed.\n return {\n scope: \"session\",\n label: \"whole session\",\n empty: false,\n events: trace.events,\n toolCalls: trace.toolCalls,\n fileAccesses: trace.fileAccesses,\n skillInvocations: trace.skillInvocations,\n userMessages: trace.userMessages,\n assistantTexts: trace.assistantTexts,\n turnCount: trace.turnCount,\n };\n}\n\n/** A grader's response to an empty window: a stated skip, never a verdict. */\nexport function skippedWindow(window: TraceWindow): GradeResult {\n return { findings: [], skipped: window.reason ?? \"the artifact governed no turns\" };\n}\n\nfunction skillWindow(trace: Trace, name: string): TraceWindow {\n // A skill loads either way: through the `Skill` tool, or by someone typing\n // its slash form.\n return injectionWindow(trace, \"skill\", `skill \"${name}\"`, (s) => s.name === name);\n}\n\n/**\n * A slash command's window is a skill's window, because the mechanism is the\n * same one: an instruction set injected at a point in the session, in force\n * until the next injection takes over (ADR 01023). Only the opening differs —\n * a `Skill` tool call is not the slash-command mechanism, so it can close a\n * command's window but never open it.\n */\nfunction slashCommandWindow(trace: Trace, name: string): TraceWindow {\n return injectionWindow(\n trace,\n \"slash-command\",\n `slash command \"/${name}\"`,\n (s) => s.name === name && s.via === \"command-injection\",\n );\n}\n\n/**\n * The window an injected instruction set governed: from each of its own\n * injections until the next injection of any kind — including another of its\n * own, which simply reopens the window — or to the end of the session.\n */\nfunction injectionWindow(\n trace: Trace,\n scope: \"skill\" | \"slash-command\",\n label: string,\n opensHere: (invocation: SkillInvocation) => boolean,\n): TraceWindow {\n const opens = trace.skillInvocations.filter(opensHere).map((s) => s.index);\n if (opens.length === 0) {\n return emptyWindow(\n scope,\n label,\n `${label} was never invoked in this trace, so it governed no turns`,\n );\n }\n // An instruction set injected inside a subagent branch governs that branch's\n // chain; one injected on the main chain governs the main chain.\n const chainOf = (index: number): string | undefined =>\n trace.events[index]?.branchId;\n const own = new Set<string | undefined>(opens.map(chainOf));\n // **Boundaries are drawn from the opening chain only** (ADR 01015: the next\n // invocation *on the same chain*). Drawn from every invocation, a subagent\n // that loaded a skill of its own closed the parent's window at the spawn —\n // so a `not-used` eval passed on turns it never saw, and the judge digest\n // stopped where the subagent started.\n const boundaries = trace.skillInvocations\n .filter((s) => own.has(chainOf(s.index)))\n .map((s) => s.index)\n .sort((a, b) => a - b);\n const spans = opens.map((start) => ({\n start,\n end: boundaries.find((b) => b > start) ?? Number.POSITIVE_INFINITY,\n }));\n return materialize(trace, scope, label, spans, undefined, own);\n}\n\nfunction agentWindow(trace: Trace, name: string): TraceWindow {\n const label = `agent \"${name}\"`;\n const mine = trace.subagentBranches.filter((b) => b.agentType === name);\n if (mine.length === 0) {\n const spawned = trace.agentSpawns.some((a) => a.subagentType === name);\n return emptyWindow(\n \"agent\",\n label,\n spawned\n ? `${label} was spawned but recorded no subagent turns (no inline ` +\n `sidechain records and no sidecar transcript), so it governed no turns`\n : `${label} was never spawned in this trace, so it governed no turns`,\n );\n }\n // A branch's span already covers everything nested under it (ADR 01014), so\n // one containment pass reaches subagents at any depth.\n const branchIds = new Set(mine.map((b) => b.branchId));\n for (const branch of trace.subagentBranches) {\n if (branchIds.has(branch.branchId)) continue;\n const nested = mine.some(\n (m) => m.startIndex <= branch.startIndex && branch.endIndex <= m.endIndex,\n );\n if (nested) branchIds.add(branch.branchId);\n }\n const spans = mine.map((b) => ({ start: b.startIndex, end: b.endIndex }));\n return materialize(\n trace,\n \"agent\",\n label,\n spans,\n branchIds,\n new Set<string | undefined>(mine.map((b) => b.branchId)),\n );\n}\n\nexport function emptyWindow(\n scope: TraceWindow[\"scope\"],\n label: string,\n reason: string,\n): TraceWindow {\n return {\n scope,\n label,\n empty: true,\n reason,\n events: [],\n toolCalls: [],\n fileAccesses: [],\n skillInvocations: [],\n userMessages: [],\n assistantTexts: [],\n turnCount: 0,\n };\n}\n\n/**\n * Cut every derived list to the spans. `branchIds`, when given, additionally\n * drops events that fall inside an *inline* branch's bounding range without\n * belonging to it — a sidecar branch is contiguous and loses nothing here, but\n * an inline one can enclose interleaved main-chain turns (ADR 01014).\n *\n * `own` names the chain the window is anchored to. Prompts and assistant text\n * are taken from that chain alone, so a subagent spawned inside the window\n * contributes tool calls and file accesses but not turns.\n */\nexport function materialize(\n trace: Trace,\n scope: TraceWindow[\"scope\"],\n label: string,\n spans: Span[],\n branchIds: Set<string> | undefined,\n own: Set<string | undefined>,\n): TraceWindow {\n const inSpan = (index: number): boolean =>\n spans.some((s) => index >= s.start && index < s.end);\n const excluded = new Set<number>();\n if (branchIds !== undefined) {\n for (const event of trace.events) {\n if (!inSpan(event.index)) continue;\n if (event.branchId === undefined || !branchIds.has(event.branchId)) {\n excluded.add(event.index);\n }\n }\n }\n const inWindow = (index: number): boolean =>\n inSpan(index) && !excluded.has(index);\n\n const events = trace.events.filter((e) => inWindow(e.index));\n const textOf = (kind: TraceEvent[\"kind\"]): string[] =>\n events\n .filter((e) => e.kind === kind && own.has(e.branchId) && e.text)\n .map((e) => e.text as string);\n const userMessages = textOf(\"user\");\n\n return {\n scope,\n label,\n empty: false,\n events,\n toolCalls: trace.toolCalls.filter((c) => inWindow(c.index)),\n fileAccesses: trace.fileAccesses.filter((a) => inWindow(a.index)),\n skillInvocations: trace.skillInvocations.filter((s) => inWindow(s.index)),\n userMessages,\n assistantTexts: textOf(\"assistant\"),\n turnCount: userMessages.length,\n };\n}\n"],"mappings":";;;AAWO,SAAS,QAAQ,MAAgB,SAA0B;AAChE,SAAO;AAA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