@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/cite/reporters/github.ts"],"sourcesContent":["/**\n * GitHub workflow commands, one per finding:\n * `::error file=<file>,line=<n>,title=<ruleId>::<id or src> (<src>): <message>`\n * with `::warning` and `::notice` for the lower levels: the family scale is\n * GitHub's, so the level is the severity. Uses meta's escapes. A baselined\n * finding is not an annotation; a clean run is the empty string.\n */\nimport {\n escapeWorkflowCommandMessage,\n escapeWorkflowCommandProperty,\n} from \"../../meta/internal.js\";\nimport { errorSite } from \"../core/adapt.js\";\nimport type { CheckRun, CitationFinding, CiteRule } from \"../types.js\";\nimport { resultFor, splitBaselined } from \"./pretty.js\";\n\n/**\n * The rules whose message already names what it is about: every claim,\n * marker and anchor message is written as a sentence about the entry, so\n * prefixing it with the subject again would say the name twice. Exported so\n * a test asserting the composed messages reads this set rather than a copy.\n */\nexport const NAMES_ITS_SUBJECT = new Set<CiteRule>([\n \"claim-moved\",\n \"claim-moved-ambiguous\",\n \"claim-changed\",\n \"marker-orphan\",\n \"marker-invalid\",\n \"marker-repeated\",\n \"anchor-invalid\",\n]);\n\n/**\n * `<id> (<src>): <message>`, or `<src>: <message>` when the entry has no id.\n * A message that names its own subject, by its rule or by opening with the\n * id (an `entry-invalid` about a pin prefix does), is left to say it once.\n * SARIF and JUnit carry the same message.\n */\nexport function findingMessage(finding: CitationFinding): string {\n const subject = finding.id ?? finding.src;\n if (subject === undefined) return finding.message;\n if (NAMES_ITS_SUBJECT.has(finding.rule)) return finding.message;\n if (finding.id !== undefined && finding.message.startsWith(finding.id)) return finding.message;\n const where = finding.id !== undefined && finding.src !== undefined ? ` (${finding.src})` : \"\";\n return `${subject}${where}: ${finding.message}`;\n}\n\nexport function renderCheckGithub(run: CheckRun): string {\n const lines: string[] = [];\n run.pages.forEach((page, index) => {\n const { reported } = splitBaselined(page, resultFor(run, index));\n for (const finding of reported) {\n // A finding about an entry a manifest owns is annotated on the\n // manifest, unless that manifest is outside the tree, where an\n // annotation would land nowhere: then the page carries it.\n const site = errorSite(finding);\n const params = [`file=${escapeWorkflowCommandProperty(site.file ?? page.file)}`];\n if (site.line !== undefined) params.push(`line=${String(site.line)}`);\n params.push(`title=${escapeWorkflowCommandProperty(finding.ruleId)}`);\n lines.push(\n `::${finding.severity} ${params.join(\",\")}::${escapeWorkflowCommandMessage(findingMessage(finding))}`,\n );\n }\n });\n return lines.join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;AAqBO,IAAM,oBAAoB,oBAAI,IAAc;AAAA,EACjD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,eAAe,SAAkC;AAC/D,QAAM,UAAU,QAAQ,MAAM,QAAQ;AACtC,MAAI,YAAY,OAAW,QAAO,QAAQ;AAC1C,MAAI,kBAAkB,IAAI,QAAQ,IAAI,EAAG,QAAO,QAAQ;AACxD,MAAI,QAAQ,OAAO,UAAa,QAAQ,QAAQ,WAAW,QAAQ,EAAE,EAAG,QAAO,QAAQ;AACvF,QAAM,QAAQ,QAAQ,OAAO,UAAa,QAAQ,QAAQ,SAAY,KAAK,QAAQ,GAAG,MAAM;AAC5F,SAAO,GAAG,OAAO,GAAG,KAAK,KAAK,QAAQ,OAAO;AAC/C;AAEO,SAAS,kBAAkB,KAAuB;AACvD,QAAM,QAAkB,CAAC;AACzB,MAAI,MAAM,QAAQ,CAAC,MAAM,UAAU;AACjC,UAAM,EAAE,SAAS,IAAI,eAAe,MAAM,UAAU,KAAK,KAAK,CAAC;AAC/D,eAAW,WAAW,UAAU;AAI9B,YAAM,OAAO,UAAU,OAAO;AAC9B,YAAM,SAAS,CAAC,QAAQ,8BAA8B,KAAK,QAAQ,KAAK,IAAI,CAAC,EAAE;AAC/E,UAAI,KAAK,SAAS,OAAW,QAAO,KAAK,QAAQ,OAAO,KAAK,IAAI,CAAC,EAAE;AACpE,aAAO,KAAK,SAAS,8BAA8B,QAAQ,MAAM,CAAC,EAAE;AACpE,YAAM;AAAA,QACJ,KAAK,QAAQ,QAAQ,IAAI,OAAO,KAAK,GAAG,CAAC,KAAK,6BAA6B,eAAe,OAAO,CAAC,CAAC;AAAA,MACrG;AAAA,IACF;AAAA,EACF,CAAC;AACD,SAAO,MAAM,KAAK,IAAI;AACxB;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/meta/cli.ts","../src/meta/reporters/relocate.ts","../src/meta/commands/validate-offer.ts","../src/meta/reporters/infer.ts"],"sourcesContent":["/**\n * docmeta CLI. Thin commander wrapper over the command cores. Follows clig.dev:\n * primary output to stdout, diagnostics to stderr, color only on a TTY (and\n * never when NO_COLOR/--no-color), meaningful exit codes (0 ok, 1 validation\n * failures, 2 operational/usage errors).\n */\nimport { existsSync } from \"node:fs\";\nimport { extname, resolve as resolvePath } from \"node:path\";\nimport { Command, Option } from \"commander\";\nimport picomatch from \"picomatch\";\nimport pkg from \"../../package.json\" with { type: \"json\" };\nimport {\n collect,\n configOption,\n explicitFalse,\n readStdin,\n reportConfig,\n splitList,\n} from \"../shared/cli-options.js\";\nimport { fail } from \"../shared/run.js\";\nimport { notice, warn } from \"../shared/warn.js\";\nimport { LOCAL_FLAG_HELP } from \"../shared/providers.js\";\nimport { terminalConfirm } from \"../shared/prompt.js\";\nimport {\n DocmetaError,\n type RunSummary,\n type ValidationResult,\n} from \"./types.js\";\nimport { runValidate } from \"./commands/validate.js\";\nimport { offerRelocation } from \"./commands/validate-offer.js\";\nimport { runGet } from \"./commands/get.js\";\nimport { runQuery } from \"./commands/query.js\";\nimport {\n DEFAULT_VENDOR_DIR,\n getSchemasInfo,\n runInferSchema,\n runVendorSchema,\n} from \"./commands/schemas.js\";\nimport { runFill } from \"./commands/fill.js\";\nimport { deriveFailed, runDerive } from \"./commands/derive.js\";\nimport { supportedExtensions } from \"./extractors/index.js\";\nimport {\n COMMON_FORMATS,\n COMMON_FORMAT_LIST,\n OMITTED_WHEN_CLEAN,\n QUERY_FORMATS,\n QUERY_FORMAT_LIST,\n REPORT_FORMATS,\n REPORT_FORMAT_LIST,\n isCommonFormat,\n isMachineFormat,\n isQueryFindingsFormat,\n isQueryFormat,\n isReportFormat,\n render,\n type CommonFormat,\n type QueryFindingsFormat,\n} from \"./reporters/index.js\";\nimport { rowsToFindings } from \"./core/checks.js\";\nimport { loadConfig } from \"./core/config.js\";\nimport type { RegisteredSchemas } from \"./core/schema-registry.js\";\nimport { isParamName } from \"./core/projection.js\";\nimport type { QueryRun } from \"./commands/query.js\";\nimport {\n FILL_FORMATS,\n FILL_FORMAT_LIST,\n isFillFormat,\n renderFill,\n} from \"./reporters/fill.js\";\nimport {\n DERIVE_FORMATS,\n DERIVE_FORMAT_LIST,\n isDeriveFormat,\n renderDerive,\n} from \"./reporters/derive.js\";\nimport { relocateFailed, runRelocate } from \"./commands/relocate.js\";\nimport {\n RELOCATE_FORMATS,\n isRelocateFormat,\n renderRelocate,\n} from \"./reporters/relocate.js\";\nimport { renderGet } from \"./reporters/get.js\";\nimport { renderQuery, renderQueryCsv } from \"./reporters/query.js\";\nimport { renderInfer } from \"./reporters/infer.js\";\nimport { shouldColor, palette } from \"../shared/color.js\";\n\nfunction resolveColor(program: Command): boolean {\n // commander maps --no-color to opts.color === false.\n const noColor = program.opts().color === false;\n // Passed through uncoerced. `@types/node` declares `isTTY` as `boolean`, but\n // Node leaves it **undefined** on a stream that is not a terminal — it is\n // never `false` — and `shouldColor` already takes `isTTY?` and treats a\n // missing one as \"not a terminal\". A `Boolean()` here only restated that,\n // where the declared type says it restates nothing.\n return shouldColor({ noColor, isTTY: process.stdout.isTTY });\n}\n\n/**\n * The `--format` a subcommand was actually given, when its **parent** also\n * declares one.\n *\n * commander lets an option declared on a parent be written anywhere in the\n * argv, so `manni meta schemas infer -f json` binds `json` to the `schemas`\n * command — `infer`'s own `--format` keeps its default and the run answers in\n * `pretty`. Silently. That is the same false green `schemas -f github` was\n * fixed for: a request docmeta could honor, answered in a format nobody asked\n * for, with exit 0.\n *\n * `getOptionValueSource` is the public way to tell a typed value from a\n * default, so this reads both commands and prefers whichever was actually\n * typed, rather than depending on which one commander happens to bind to.\n */\nfunction formatFor(command: Command, own: unknown): unknown {\n if (command.getOptionValueSource(\"format\") === \"cli\") return own;\n const parent = command.parent;\n if (parent && parent.getOptionValueSource(\"format\") === \"cli\") {\n return parent.opts().format;\n }\n return own;\n}\n\n/** A `--format` value one of the two-format commands (`get`, `schemas`) rejects. */\nfunction assertCommonFormat(value: unknown): CommonFormat {\n const format = String(value);\n if (!isCommonFormat(format)) {\n throw new DocmetaError(\n `Unknown --format \"${format}\". Use ${COMMON_FORMAT_LIST}.`,\n );\n }\n return format;\n}\n\n/** The one input token that is neither a path nor a field: stdin. */\nconst STDIN = \"-\";\n\n/**\n * Does this token name a path rather than a field list?\n *\n * `get`'s field list is positional, so a user who forgets it has their *path*\n * bound to `[fields]`. Since the argument became optional the CLI can say so\n * outright instead of reporting the paths that are left as missing.\n *\n * The four positive tests mirror `suggestCommand`'s, `existsSync` included —\n * that leg is the one that catches a bare directory name (`manni meta get docs`),\n * which has neither a dot, a separator, nor a glob character.\n *\n * `existsSync` alone is too eager for a token with **no path shape at all**,\n * though, because field names collide with directory names constantly: `tags`,\n * `docs`, `type`, `content`. In a site repo holding a `tags/` directory,\n * `manni meta get tags docs/a.md` was refused as a path, and the remedy it\n * suggested (`manni meta get title tags`) was nonsense. So a shapeless token is\n * only read as a path when it is **alone** — nothing else was offered as one,\n * which is the shape of someone who forgot the field list. Give a path *and* a\n * bare name and the bare name is the field list: the only reading that makes\n * sense of both.\n *\n * Two negative tests matter more than any of the shape tests, because a false\n * positive rejects a legal field list:\n *\n * - a **comma** makes it a list, and a path holding one is vanishingly rare;\n * - a **leading `/`** is a JSON Pointer, the documented way to address a nested\n * or dotted key — `manni meta get /author/email page.md` is exactly the usage\n * the separator test would otherwise refuse.\n *\n * They do not run *first*, though, and the distinction is worth stating because\n * the obvious reading of the list above is that they do: a token that names a\n * file which really exists is taken as a path before either is consulted. So a\n * JSON Pointer that happens to match a real absolute path — `/author/email`, on\n * a machine where that file exists — is read as a path. `--fields` is the\n * escape, and is why the guard can afford to be wrong here.\n */\nfunction looksLikePath(token: string, cwd: string, alone: boolean): boolean {\n if (token === STDIN) return false;\n // One scan, used twice: `shaped` needs it, and so does the positive test\n // below when `existsSync` did not settle the question.\n const scan = picomatch.scan(token);\n const shaped = /[\\\\/]/.test(token) || extname(token) !== \"\" || scan.isGlob;\n // A file that really is there settles it — but only when the token looks\n // like a path, or nothing else was offered as one.\n if ((shaped || alone) && existsSync(resolvePath(cwd, token))) return true;\n if (token.includes(\",\") || token.startsWith(\"/\")) return false;\n if (scan.isGlob) return true;\n const ext = extname(token).toLowerCase();\n if (ext !== \"\" && supportedExtensions().includes(ext)) return true;\n return /[\\\\/]/.test(token);\n}\n\n/**\n * `get`'s one input rule: **if `--fields` is present, every positional is a\n * path.** Otherwise the first positional is the field list, exactly as before.\n *\n * The missing-field-list case is handled *here* rather than left to `runGet`.\n * `options.fields ?? fieldsArg` is `undefined` when neither was given, and\n * `String(undefined).split(\",\")` is `[\"undefined\"]` — a field list of length\n * one, so `runGet`'s `fields.length === 0` guard never fires and a bare\n * `manni meta get` in a repo with config `paths:` prints `undefined=(unset)` per\n * file and exits 0. A successful-looking report for a field nobody named is\n * worse than the error it replaced.\n *\n * The positional is folded in on `fieldsArg !== undefined`, not with\n * `.filter(Boolean)`: an empty-string path is a mistake worth reporting, and\n * filtering it would silently drop it instead.\n */\nexport function resolveGetInputs(\n fieldsArg: string | undefined,\n pathsArg: string[],\n fieldsOption: unknown,\n cwd: string,\n): { fields: string[]; paths: string[] } {\n const flag = typeof fieldsOption === \"string\" ? fieldsOption : undefined;\n\n if (\n flag === undefined &&\n fieldsArg !== undefined &&\n looksLikePath(fieldsArg, cwd, pathsArg.length === 0)\n ) {\n throw new DocmetaError(\n `\"${fieldsArg}\" looks like a path, not a field list. Pass fields first (manni meta get title ${fieldsArg}) or use --fields.`,\n );\n }\n\n // `-` is stdin, never a field name. Letting it become one made\n // `manni meta get - --as markdown` print `-=(unset)` for every file in the\n // config's `paths:` and exit 0 — the piped document never read, the run\n // looking entirely successful. Dropping it here leaves `fields` empty, so\n // the missing-field-list error below fires instead.\n const source = flag ?? (fieldsArg === STDIN ? undefined : fieldsArg);\n const fields = source === undefined ? [] : splitList(source);\n if (fields.length === 0) {\n throw new DocmetaError(\n \"Specify at least one field to get. Pass fields first (manni meta get title docs/a.md) or use --fields.\",\n );\n }\n\n const paths =\n fieldsArg !== undefined && (flag !== undefined || fieldsArg === STDIN)\n ? [fieldsArg, ...pathsArg]\n : pathsArg;\n return { fields, paths };\n}\n\n/**\n * `query`'s input rule is `get`'s with SQL in the fields slot: **if `--query`\n * is present, every positional is a path**; otherwise the first positional is\n * the SQL. The same three guards apply and for the same reasons — a token\n * shaped like a path in the SQL slot is a forgotten statement, `-` is stdin\n * and never SQL, and an absent statement is an error rather than a\n * plausible-looking run. Real SQL never trips `looksLikePath`: a statement\n * with a column list contains a comma, and anything else with a space cannot\n * name a file that exists.\n *\n * `--db` relaxes exactly one of those guards: exporting needs no SQL, so with\n * `sqlOptional` a path-shaped first positional is a path and an absent\n * statement means \"just write the database\".\n */\nexport function resolveQueryInputs(\n sqlArg: string | undefined,\n pathsArg: string[],\n queryOption: unknown,\n cwd: string,\n sqlOptional = false,\n): { sql: string; paths: string[] } {\n const flag = typeof queryOption === \"string\" ? queryOption : undefined;\n\n if (\n flag === undefined &&\n sqlArg !== undefined &&\n // A token with whitespace is never a path: every real statement has\n // spaces, and without this test `SELECT count(*) FROM docs` reads as a\n // *glob* — picomatch parses `(*)` as an extglob — the one SQL shape the\n // comma test inside looksLikePath does not catch.\n !/\\s/.test(sqlArg) &&\n // With SQL optional there is no \"forgot the statement\" reading to\n // protect, so a shapeless token that really exists on disk is a path\n // even when other paths follow — hence `alone` is forced on.\n looksLikePath(sqlArg, cwd, sqlOptional || pathsArg.length === 0)\n ) {\n if (sqlOptional) return { sql: \"\", paths: [sqlArg, ...pathsArg] };\n throw new DocmetaError(\n `\"${sqlArg}\" looks like a path, not SQL. Pass the SQL first (manni meta query \"SELECT _path FROM docs\" ${sqlArg}) or use --query.`,\n );\n }\n\n const source = flag ?? (sqlArg === STDIN ? undefined : sqlArg);\n const sql = source?.trim() ?? \"\";\n if (sql === \"\" && !sqlOptional) {\n throw new DocmetaError(\n 'Specify SQL to run. Pass it first (manni meta query \"SELECT _path FROM docs\" docs/) or use --query.',\n );\n }\n\n const paths =\n sqlArg !== undefined && (flag !== undefined || sqlArg === STDIN)\n ? [sqlArg, ...pathsArg]\n : pathsArg;\n return { sql, paths };\n}\n\n/**\n * `--param` values into `QueryOptions.params` (proposal 0029).\n *\n * `name=value` binds the value as a **string** — metadata is mostly strings,\n * and a projection column has no type affinity, so a bound number would\n * silently never equal a stored string. `name:=value` parses the value as\n * JSON for the deliberate typed bind (numbers, booleans, arrays, null) — the\n * httpie/jq convention. `:=` is checked before `=`, the split happens at the\n * first separator, and everything after it is the value verbatim, so values\n * containing `=` need no escaping.\n */\nexport function parseQueryParams(\n raw: readonly string[],\n): Record<string, unknown> {\n // Null prototype: `__proto__` passes the name grammar, so it must land as\n // an ordinary own key rather than silently mutating the prototype.\n const params: Record<string, unknown> = Object.create(null) as Record<\n string,\n unknown\n >;\n for (const item of raw) {\n const typed = item.indexOf(\":=\");\n const plain = item.indexOf(\"=\");\n const useTyped = typed !== -1 && (plain === -1 || typed < plain);\n const at = useTyped ? typed : plain;\n if (at <= 0) {\n throw new DocmetaError(\n `--param \"${item}\" is not name=value. Use name=value to bind a string, or name:=json for a typed value.`,\n );\n }\n const name = item.slice(0, at);\n // Exactly the token grammar `collectNamedParameters` recognizes (an\n // optional $/:/@ prefix tolerated, as the API's key handling does) —\n // `isParamName` is the scan's own predicate, so the two cannot drift.\n // Anything else — a space, a leading digit, an empty name — could never\n // be referenced from the SQL, so the engine would ignore the bind and\n // the unbound-reference guard would never fire: the false-green path\n // this flag's design closes would reopen through a typo.\n const bare = /^[$:@]/.test(name) ? name.slice(1) : name;\n if (!isParamName(bare)) {\n throw new DocmetaError(\n `--param name \"${name}\" cannot be bound: a SQL named parameter is letters, digits, and underscores, starting with a letter or underscore.`,\n );\n }\n const value = item.slice(at + (useTyped ? 2 : 1));\n if (!useTyped) {\n params[name] = value;\n continue;\n }\n try {\n params[name] = JSON.parse(value) as unknown;\n } catch {\n throw new DocmetaError(\n `--param ${name}:=${value} is not valid JSON. Quote a string — --param '${name}:=\"${value}\"' — or drop the colon (--param ${name}=${value}) to bind it as a string.`,\n );\n }\n }\n return params;\n}\n\n/**\n * Render a `query --check` run through a findings format (proposal 0026).\n *\n * The row→finding mapping is the same module `validate`'s named checks use;\n * here the check has no configured name, so its findings carry `check:query`.\n * The `RunSummary` `render()` takes is synthesized from the mapped results —\n * every file present has findings, so passed is zero by construction — and\n * JUnit ships under its own classname rather than validate's.\n *\n * Exit semantics stay `--check`'s own: rows mean findings mean exit 1.\n */\nfunction renderQueryFindings(run: QueryRun, format: QueryFindingsFormat): void {\n if (run.changes) {\n throw new DocmetaError(\n `--format ${format} renders result rows with a \\`path\\` column; this statement produced pending changes, not rows. Use pretty or json for the change preview.`,\n );\n }\n const results: ValidationResult[] = [...rowsToFindings(\n \"query\",\n run.columns,\n run.rows,\n )].map(([file, errors]) => ({\n file,\n format: \"query\",\n ok: false,\n schemas: [],\n errors,\n }));\n const summary: RunSummary = {\n files: results.length,\n passed: 0,\n failed: results.length,\n errors: results.reduce((n, r) => n + r.errors.length, 0),\n };\n const text = render(format, results, summary, {\n frame: run.frame,\n classname: \"manni.query\",\n onNotice: notice,\n });\n if (text.length > 0 || !OMITTED_WHEN_CLEAN.has(format)) {\n process.stdout.write(`${text}\\n`);\n }\n process.exitCode = run.rows.length > 0 ? 1 : 0;\n}\n\nconst COMMAND_NAMES = [\"validate\", \"get\", \"query\", \"fill\", \"schemas\"];\n\n/** Levenshtein distance. Only used to offer a \"did you mean\" hint. */\nfunction editDistance(a: string, b: string): number {\n let prev = Array.from({ length: b.length + 1 }, (_, i) => i);\n for (let i = 1; i <= a.length; i++) {\n const row = [i];\n for (let j = 1; j <= b.length; j++) {\n const cost = a[i - 1] === b[j - 1] ? 0 : 1;\n row.push(\n Math.min(\n (row[j - 1] ?? 0) + 1,\n (prev[j] ?? 0) + 1,\n (prev[j - 1] ?? 0) + cost,\n ),\n );\n }\n prev = row;\n }\n return prev[b.length] ?? 0;\n}\n\n/**\n * `validate` is the default command, so an unrecognized first token is parsed as\n * a *path* rather than rejected. Since a named path that does not exist is now\n * an error, `docmeta valdiate docs/` already fails with the right exit code —\n * but it fails as `File not found: \"valdiate\"`, which does not say what went\n * wrong. Upgrade the message when the token is plainly a misspelled command.\n *\n * The guard is deliberately narrow: anything holding a separator or a dot, any\n * glob, and — crucially — anything that actually exists on disk is a path, not a\n * typo. That last check is what makes a false positive impossible.\n */\nfunction suggestCommand(token: string | undefined, cwd: string): void {\n if (token === undefined || token === \"-\") return;\n if (/[\\\\/.]/.test(token)) return;\n if (picomatch.scan(token).isGlob) return;\n if (existsSync(resolvePath(cwd, token))) return;\n\n const near = COMMAND_NAMES.map(\n (name) => [name, editDistance(token.toLowerCase(), name)] as const,\n )\n .filter(([, d]) => d > 0 && d <= 2)\n .sort((x, y) => x[1] - y[1]);\n\n const best = near[0];\n if (!best) return;\n throw new DocmetaError(\n `Unknown command \"${token}\". Did you mean \"${best[0]}\"?`,\n );\n}\n\n/**\n * Range-check a numeric flag. `parseFloat(\"abc\")` is NaN and every comparison\n * against NaN is false, so the finite check has to be explicit or garbage\n * passes silently.\n */\nfunction numeric(\n name: string,\n value: number | undefined,\n min: number,\n max: number,\n): void {\n if (value === undefined) return;\n if (!Number.isFinite(value) || value < min || value > max) {\n throw new DocmetaError(\n `${name} must be a number between ${min} and ${max}, got ${value}.`,\n );\n }\n}\n\n/**\n * Commander hands an `.action()` callback an untyped bag of option values, so\n * each subcommand declares the shape it actually reads.\n *\n * The three-state flags are the reason this is worth writing down rather than\n * coercing at each use site. `-c`/`--no-config`, `--baseline`/`--no-baseline`,\n * `--no-gitignore` and `--no-cache` are only correct while *absent*, *a value*\n * and *an explicit `false`* stay distinguishable — absence leaves config in\n * charge, `false` overrides it. A union that names all three states is the one\n * place a reader finds that out; `String(options.format)` never said anything.\n */\n\n/** The flags the parity rule keeps identical across every input-taking command. */\ninterface InputCliOptions {\n /** `--ext <list>`; the command splits it. */\n ext?: string;\n /** `--exclude <glob>`, repeatable — commander's default value is `[]`. */\n exclude: string[];\n /** `--as <format>`: force an extractor. */\n as?: string;\n /** `-f, --format <format>`. Always a string: every declaration has a default. */\n format: string;\n /**\n * `--collection <name>`, repeatable — commander's default value is `[]`, and\n * that empty array travels to the core unchanged. `selectCollections` reads\n * it as \"every declared collection\", the same as absence, so there is no\n * `undefined` dance here and must not be one: `[]` meaning \"no collections\"\n * would make a plain run validate nothing and exit 0.\n */\n collection: string[];\n /**\n * `-c, --config <path>` and `--no-config` share one commander attribute:\n * `undefined` with neither flag, the path with `-c`, `false` with\n * `--no-config`. Split by `configOption`.\n */\n config?: string | boolean;\n}\n\n/** The rest of what `validate`, `get`, and `fill` share. */\ninterface RunCliOptions extends InputCliOptions {\n quiet?: boolean;\n allowEmpty?: boolean;\n /**\n * `--no-gitignore`. Commander supplies `true` when the flag is absent, so\n * this is `boolean` and never `undefined` — which is exactly why\n * `explicitFalse` exists to turn that default back into \"no opinion\".\n */\n gitignore: boolean;\n offline?: boolean;\n}\n\ninterface ValidateCliOptions extends RunCliOptions {\n /** `-s, --schema <ref>`, repeatable — commander's default value is `[]`. */\n schema: string[];\n /**\n * `--baseline [path]` / `--no-baseline`, the same three-state split as\n * `config`: absent leaves the config in charge, a string names a file, `true`\n * is a bare `--baseline` (the default path), `false` is `--no-baseline`.\n */\n baseline?: string | boolean;\n /** `--write-baseline [path]`; `true` for the bare flag. See `baseline`. */\n writeBaseline?: string | boolean;\n /**\n * `--no-checks`. Commander supplies `true` when the flag is absent — its\n * default, not a choice — so only the explicit `false` travels to the core,\n * the same shape as `gitignore`.\n */\n checks: boolean;\n /**\n * `--no-derive`. The same shape as `checks`: commander's `true` default is\n * not a choice, so only the explicit `false` travels to the core.\n */\n derive: boolean;\n /**\n * `--no-cache`. Commander's `true` default travels straight through: the\n * review cache answers the comparison unless the user said otherwise.\n */\n cache: boolean;\n}\n\ninterface GetCliOptions extends RunCliOptions {\n /** `--fields <list>`; when present, every positional is a path. */\n fields?: string;\n /**\n * `--no-derived` / `--derived`. Both spellings are registered, which is\n * why this is `boolean | undefined` rather than commander's usual `true`\n * default for a `--no-` flag: registering the positive form alongside it\n * removes that default, so the key is absent when neither was given.\n * Only the explicit `false` means anything — derivation is on otherwise,\n * and `--derived` is the no-op kept for scripts written before 0043.\n */\n derived?: boolean;\n /**\n * `--no-cache`. Commander supplies `true` when the flag is absent, so\n * this travels straight through: the review cache answers unless the\n * user said otherwise.\n */\n cache: boolean;\n}\n\n/**\n * Not `RunCliOptions`: `query` declares no `-q/--quiet`. `get` uses it to hide\n * files and `validate` to hide passes; a query result has no analogous noise,\n * and a flag that means nothing is what 0016 says not to declare.\n */\ninterface QueryCliOptions extends InputCliOptions {\n /** `--query <sql>`; when present, every positional is a path. */\n query?: string;\n /** `-s, --schema <ref>`, repeatable — commander's default value is `[]`. */\n schema: string[];\n /** `--check`: any row returned is a finding, so exit 1. */\n check?: boolean;\n /** `--param <name=value>`, repeatable — commander's default value is `[]`. */\n param: string[];\n /** `--db <path>`: also write the built database; SQL becomes optional. */\n db?: string;\n /** `--dry-run`: preview a mutating statement's diff; default applies. */\n dryRun?: boolean;\n allowEmpty?: boolean;\n /** `--no-gitignore`; commander's `true` default, see `explicitFalse`. */\n gitignore: boolean;\n offline?: boolean;\n /**\n * `--no-cache`. Commander's `true` default, like `gitignore`: the review\n * cache answers a `derived` build unless the user said otherwise.\n */\n cache: boolean;\n}\n\ninterface FillCliOptions extends RunCliOptions {\n /** `-s, --schema <ref>`, repeatable — commander's default value is `[]`. */\n schema: string[];\n fields?: string;\n /** Parsed by `parseFloat`, so possibly NaN — `numeric` is the range check. */\n confidence?: number;\n dryRun?: boolean;\n provider?: string;\n model?: string;\n /**\n * `--no-cache`. Commander supplies `true` when the flag is absent; unlike\n * `gitignore` that default is passed straight through, because the core's\n * `cache` has no config counterpart for it to override.\n */\n cache: boolean;\n local?: boolean;\n maxTurns?: number;\n chunkChars?: number;\n concurrency?: number;\n}\n\n/**\n * Not `RunCliOptions`: `derive` declares no `-q/--quiet` and no `--offline`.\n * It loads no schema, so there is nothing to fetch, and its report already\n * says `current` in one line per untouched file.\n */\ninterface DeriveCliOptions extends InputCliOptions {\n fields?: string;\n sources?: string;\n dryRun?: boolean;\n /** `--check`: implies `--dry-run`; a stale or unset field is a finding. */\n check?: boolean;\n /** `--no-cache`; commander's `true` default is passed through, as `fill` does. */\n cache: boolean;\n allowEmpty?: boolean;\n /** `--no-gitignore`; commander's `true` default, see `explicitFalse`. */\n gitignore: boolean;\n /**\n * `--generated-by <name>` (proposal 0046). No commander default: the core\n * reads `MANNI_GENERATED_BY` when it is absent, so help and the CLI\n * reference stay the same whatever the environment holds.\n */\n generatedBy?: string;\n}\n\n/**\n * Not `RunCliOptions`: `relocate` declares no `-q/--quiet` and no `--offline`.\n * It reads every page it moves, so there is nothing quiet to hide, and it\n * takes `-s` for the marks alone.\n */\ninterface RelocateCliOptions extends InputCliOptions {\n /** `--fields <list>`; the command splits it. */\n fields?: string;\n /** `-s, --schema <ref>`, repeatable — commander's default value is `[]`. */\n schema: string[];\n dryRun?: boolean;\n allowEmpty?: boolean;\n /** `--no-gitignore`; commander's `true` default, see `explicitFalse`. */\n gitignore: boolean;\n}\n\ninterface SchemasCliOptions {\n format: string;\n}\n\ninterface InferCliOptions extends InputCliOptions {\n out?: string;\n /** `--min-coverage <pct>`; commander's default value is `0`. */\n minCoverage: number;\n allowEmpty?: boolean;\n /** `--no-gitignore`; commander's `true` default, see `explicitFalse`. */\n gitignore: boolean;\n /** `--offline`; a no-op here by construction, see `InferOptions.offline`. */\n offline?: boolean;\n}\n\ninterface VendorCliOptions {\n /** `--dir <path>`; commander's default value is `DEFAULT_VENDOR_DIR`. */\n dir: string;\n /** `-c, --config <path>`. `vendor` declares no `--no-config`, so no `false`. */\n config?: string;\n}\n\n/**\n * The metadata tool's program. Named `meta` because that is where it is\n * mounted (`manni meta …`); the `docmeta` bin renames it before running it.\n */\nexport function buildProgram(): Command {\n const program = new Command();\n program\n .name(\"meta\")\n .description(\n \"Validate the presence and format of document metadata against JSON Schema.\",\n )\n .version(pkg.version, \"-V, --version\")\n .option(\"--no-color\", \"disable colored output\")\n // A pointer, not the whole help screen. Commander appends this after every\n // usage error, and ~40 lines of options per typo is noise in a CI log — the\n // message that precedes it already names the offending flag.\n .showHelpAfterError(\"(add --help for usage)\")\n // MUST come before the `.command()` calls below. `copyInheritedSettings`\n // copies `_exitCallback` **by value** at subcommand-creation time, so an\n // `exitOverride()` installed afterwards (including\n // `buildProgram().exitOverride()` from main) leaves every subcommand still\n // calling `process.exit(1)` while the program-level case looks fixed.\n .exitOverride();\n\n program\n .command(\"validate\", { isDefault: true })\n .description(\"Validate metadata in the given files/dirs/globs\")\n .argument(\n \"[paths...]\",\n \"files, directories, or globs to validate (use - for stdin)\",\n )\n .option(\n \"-s, --schema <ref>\",\n \"schema to validate against; repeatable; overrides $schema/config\",\n collect,\n [],\n )\n .option(\"--ext <list>\", \"comma-separated extensions for directory walks\")\n .option(\"--exclude <glob>\", \"glob to exclude; repeatable\", collect, [])\n .option(\"--as <format>\", \"force an input format (e.g. markdown, mdx)\")\n .option(\n \"-f, --format <format>\",\n `output: ${REPORT_FORMATS.join(\" | \")}`,\n \"pretty\",\n )\n .option(\n \"--collection <name>\",\n \"configured collection to run over; repeatable\",\n collect,\n [],\n )\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--no-config\", \"ignore any discovered config file\")\n .option(\"-q, --quiet\", \"in pretty output, hide passing files\")\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"--no-gitignore\", \"check files .gitignore covers\")\n .option(\n \"--offline\",\n \"never fetch a remote schema; resolve URL refs from the schema cache\",\n )\n // Neither flag carries `.preset()`, and neither carries a `defaultValue`.\n //\n // No `defaultValue`, because that would make the baseline active on runs\n // where the flag was never typed — semantically wrong, and it would oblige\n // the docs to carry a matching Default cell.\n //\n // No `.preset()` either, which is subtler. A preset hands the core the\n // default path as a *string*, making a bare `--baseline` indistinguishable\n // from an explicitly typed `--baseline .docmeta-baseline.json`. A typed path\n // is rightly relative to where the user is standing; an omitted one has to\n // mean \"the file this project's baseline lives in\" — `baseline:` from config\n // when there is one, resolved against the config's directory. Collapsing the\n // two made `--baseline` from a subdirectory look for the file beside the\n // user instead of beside the config, so the ratchet broke the moment anyone\n // ran from `docs/`, and a bare `--write-baseline` in a repo with a custom\n // `baseline:` recorded into a second file nothing reads.\n //\n // Commander hands the core `true` for an omitted value, which is exactly the\n // signal needed to tell the two cases apart.\n .addOption(\n new Option(\n \"--baseline [path]\",\n \"compare against a baseline; fail only on new findings\",\n ),\n )\n .addOption(\n new Option(\n \"--write-baseline [path]\",\n \"record current findings as the baseline, then exit 0 (stdin findings are not recorded and still fail)\",\n ),\n )\n .option(\"--no-baseline\", \"ignore a baseline configured by `baseline:`\")\n .option(\n \"--no-checks\",\n \"skip the corpus checks configured by `checks:` for this run\",\n )\n .option(\"--no-cache\", \"bypass the GitHub or GitLab review cache\")\n .option(\n \"--no-derive\",\n \"skip the derived-value comparison configured by derive:\",\n )\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni meta validate docs/ # walk a directory\",\n ' manni meta validate \"**/*.md\" -f github # CI annotations',\n ' manni meta validate \"**/*.md\" -f sarif > o.sarif # code scanning',\n \" manni meta validate page.md -s google:okf:0.1 -s ./my.schema.json\",\n \" cat page.md | manni meta validate - --as markdown\",\n \" manni meta validate --write-baseline # record today's backlog\",\n \" manni meta validate --baseline # fail only on new findings\",\n ].join(\"\\n\"),\n )\n .action(\n async (paths: string[], options: ValidateCliOptions, command: Command) => {\n try {\n // `validate` is the default command, so a misspelled subcommand lands\n // here as a path. Upgrade the message before it becomes \"not found\".\n suggestCommand(paths[0], process.cwd());\n const format = options.format;\n if (!isReportFormat(format)) {\n throw new DocmetaError(\n `Unknown --format \"${format}\". Use ${REPORT_FORMAT_LIST}.`,\n );\n }\n const exts: string[] | undefined = options.ext\n ? splitList(options.ext)\n : undefined;\n const stdinContent = paths.includes(\"-\")\n ? await readStdin()\n : undefined;\n\n const { results, summary, frame } = await runValidate({\n inputs: paths,\n cliSchemas: options.schema,\n exts,\n exclude: options.exclude,\n as: options.as,\n // Straight through: commander gives `[]` when the flag was never\n // typed, and the core reads an empty list as every declared\n // collection. Refusing paths beside it, and refusing it with no\n // config, is `resolveRunConfig`'s job, before the walk.\n collections: options.collection,\n ...configOption(options.config),\n onConfigLoaded: reportConfig(\n !isMachineFormat(format),\n process.cwd(),\n ),\n stdinContent,\n // `undefined` rather than `false` when the flag is absent, so config\n // `allowEmpty:` still wins (the cores do `opts ?? config`).\n allowEmpty: options.allowEmpty ? true : undefined,\n respectGitignore: explicitFalse(options.gitignore),\n // `undefined` rather than `false` when absent, so config `offline:`\n // still decides.\n offline: options.offline ? true : undefined,\n onNotice: notice,\n // `--baseline` and `--no-baseline` share one commander attribute, the\n // same three-state `undefined | string | false` split as `-c` /\n // `--no-config`: absent leaves the config in charge, a string names a\n // file, `false` suppresses a configured one for this run.\n baseline: options.baseline,\n writeBaseline: options.writeBaseline,\n // Like `gitignore`: only the explicit `--no-checks` travels, so\n // absence stays \"run them when the corpus rule allows\".\n checks: options.checks ? undefined : false,\n // And `--no-derive`, for the managed-field comparison.\n derive: options.derive ? undefined : false,\n // And `--no-cache`, so a wrong cached review answer can be re-asked.\n cache: options.cache,\n });\n\n const color = resolveColor(command.parent ?? command);\n const text = render(format, results, summary, {\n color,\n quiet: Boolean(options.quiet),\n // Non-presentational: SARIF needs to know where the run stood before\n // it can name a file the way the repository does.\n frame,\n onNotice: notice,\n });\n // Only `github` may say nothing on a clean run. Every other format owes\n // its envelope even when it is empty — see `OMITTED_WHEN_CLEAN`.\n if (text.length > 0 || !OMITTED_WHEN_CLEAN.has(format)) {\n process.stdout.write(`${text}\\n`);\n }\n process.exitCode = summary.failed > 0 ? 1 : 0;\n // P2 (proposal 0047): on a terminal, after the report, offer to move\n // what the location findings named. On stderr, so the report stays\n // machine-readable, and the exit code stays the report's. Never with\n // stdin among the inputs: it is not a terminal to ask on.\n await offerRelocation({\n results,\n inputs: paths,\n cliSchemas: options.schema,\n as: options.as,\n collections: options.collection,\n ...configOption(options.config),\n respectGitignore: explicitFalse(options.gitignore),\n offline: options.offline ? true : undefined,\n confirm: paths.includes(STDIN) ? undefined : terminalConfirm(),\n output: process.stderr,\n color: shouldColor({\n noColor: (command.parent ?? command).opts().color === false,\n isTTY: process.stderr.isTTY,\n }),\n });\n } catch (err) {\n fail(err);\n }\n },\n );\n\n program\n .command(\"get\")\n .description(\"Print metadata field values from the given files/dirs/globs\")\n // Optional, and the flag below is the unambiguous spelling. A required\n // positional ate the user's *path* when the field list was forgotten, and\n // reported the paths — which were never the problem — as missing.\n .argument(\n \"[fields]\",\n \"comma-separated metadata fields to print, unless --fields is given\",\n )\n .argument(\n \"[paths...]\",\n \"files, directories, or globs to read (use - for stdin)\",\n )\n .option(\n \"--fields <list>\",\n \"comma-separated metadata fields to print; every positional is then a path\",\n )\n .option(\n \"--no-derived\",\n \"print only what the document stores, consulting no source\",\n )\n // Registered beside `--no-derived` on purpose. Commander gives a lone\n // `--no-x` the default `true`; declaring `--x` as well removes that\n // default, so \"neither flag\" is `undefined` and stays distinguishable —\n // and the spelling that used to turn derivation on still parses.\n .option(\"--derived\", \"accepted and inert: derivation is already on\")\n .option(\"--no-cache\", \"bypass the GitHub or GitLab review cache\")\n .option(\"--ext <list>\", \"comma-separated extensions for directory walks\")\n .option(\"--exclude <glob>\", \"glob to exclude; repeatable\", collect, [])\n .option(\"--as <format>\", \"force an input format (e.g. markdown, mdx)\")\n .option(\n \"-f, --format <format>\",\n `output: ${COMMON_FORMATS.join(\" | \")}`,\n \"pretty\",\n )\n .option(\n \"--collection <name>\",\n \"configured collection to run over; repeatable\",\n collect,\n [],\n )\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--no-config\", \"ignore any discovered config file\")\n .option(\n \"-q, --quiet\",\n \"in pretty output, hide files where every requested field is unset\",\n )\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"--no-gitignore\", \"read files .gitignore covers\")\n .option(\n \"--offline\",\n \"accepted and ignored: get loads no schema, so there is nothing to fetch\",\n )\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni meta get title,type docs/intro.md\",\n \" manni meta get --fields title,type docs/intro.md\",\n \" manni meta get author.name,/author/email docs/intro.md\",\n ' manni meta get type \"**/*.md\" -f json',\n \" manni meta get owner docs/intro.md --no-derived\",\n \" cat page.md | manni meta get title - --as markdown\",\n ].join(\"\\n\"),\n )\n .action(\n async (\n fieldsArg: string | undefined,\n pathsArg: string[],\n options: GetCliOptions,\n command: Command,\n ) => {\n try {\n const format = assertCommonFormat(options.format);\n const { fields, paths } = resolveGetInputs(\n fieldsArg,\n pathsArg,\n options.fields,\n process.cwd(),\n );\n const exts: string[] | undefined = options.ext\n ? splitList(options.ext)\n : undefined;\n const stdinContent = paths.includes(\"-\")\n ? await readStdin()\n : undefined;\n\n const results = await runGet({\n fields,\n derived: options.derived !== false,\n cache: options.cache,\n inputs: paths,\n as: options.as,\n exclude: options.exclude,\n exts,\n collections: options.collection,\n ...configOption(options.config),\n onConfigLoaded: reportConfig(format === \"pretty\", process.cwd()),\n stdinContent,\n allowEmpty: options.allowEmpty ? true : undefined,\n respectGitignore: explicitFalse(options.gitignore),\n offline: options.offline ? true : undefined,\n onNotice: notice,\n });\n switch (format) {\n case \"json\":\n // `--quiet` is a pretty-output affordance; a filtered array would\n // be indistinguishable from an empty run to whatever parses this.\n process.stdout.write(`${JSON.stringify(results, null, 2)}\\n`);\n break;\n case \"pretty\": {\n const text = renderGet(results, fields, {\n color: resolveColor(command.parent ?? command),\n quiet: Boolean(options.quiet),\n });\n if (text.length > 0) process.stdout.write(`${text}\\n`);\n break;\n }\n default: {\n const unreachable: never = format;\n throw new DocmetaError(\n `Unknown --format ${JSON.stringify(unreachable)}. Use ${COMMON_FORMAT_LIST}.`,\n );\n }\n }\n // A document that would not parse is a finding, not an operational\n // failure: the run completed and reported on every file it was given.\n // Set after the report is written, so the values that did resolve are\n // on stdout either way.\n process.exitCode = results.some((r) => r.error !== undefined) ? 1 : 0;\n } catch (err) {\n fail(err);\n }\n },\n );\n\n program\n .command(\"query\")\n .description(\"Run SQL over the metadata of the given files/dirs/globs\")\n // Optional for the same reason `get`'s `[fields]` is: a required\n // positional would eat the user's *path* when the SQL was forgotten.\n .argument(\"[sql]\", \"SQL to run against the `docs` table, unless --query is given\")\n .argument(\n \"[paths...]\",\n \"files, directories, or globs to load (use - for stdin)\",\n )\n .option(\n \"--query <sql>\",\n \"SQL to run against the `docs` table; every positional is then a path\",\n )\n .option(\n \"-s, --schema <ref>\",\n \"schema set a DDL statement evolves; repeatable; replaces the per-file resolution for the DDL planner only\",\n collect,\n [],\n )\n .option(\n \"--check\",\n \"treat returned rows as findings: exit 1 if the query returns any\",\n )\n .option(\n \"--param <name=value>\",\n \"bind a named SQL parameter ($name/:name/@name) as a string; name:=value parses the value as JSON; repeatable\",\n collect,\n [],\n )\n // The findings formats (github, sarif, junit) are declared in the shared\n // `-f, --format` option below; they are legal only with --check and a\n // `path` result column — see the action's gates.\n .option(\n \"--db <path>\",\n \"also write the built database to this file; SQL is then optional\",\n )\n .option(\n \"--dry-run\",\n \"preview a mutating statement's diff without applying it (--check implies this)\",\n )\n .option(\"--ext <list>\", \"comma-separated extensions for directory walks\")\n .option(\"--exclude <glob>\", \"glob to exclude; repeatable\", collect, [])\n .option(\"--as <format>\", \"force an input format (e.g. markdown, mdx)\")\n .option(\n \"-f, --format <format>\",\n `output: ${QUERY_FORMATS.join(\" | \")} (github, sarif, junit need --check)`,\n \"pretty\",\n )\n .option(\n \"--collection <name>\",\n \"configured collection to run over; repeatable\",\n collect,\n [],\n )\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--no-config\", \"ignore any discovered config file\")\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"--no-gitignore\", \"load files .gitignore covers\")\n .option(\"--no-cache\", \"bypass the GitHub or GitLab review cache\")\n .option(\n \"--offline\",\n \"accepted and ignored: query resolves schemas from disk and built-ins, never the network\",\n )\n .addHelpText(\n \"after\",\n [\n \"\",\n \"One row per file in a table named `docs`: your top-level metadata keys\",\n \"as columns, plus _path, _format, _present, and _data (all metadata as\",\n \"JSON, for json_each/->> reach into nested values).\",\n \"\",\n \"Examples:\",\n ' manni meta query \"SELECT _path, title FROM docs WHERE draft = 1\" docs/',\n ' manni meta query \"SELECT t.value tag, count(*) n FROM docs, json_each(docs.tags) t GROUP BY tag\" docs/',\n ' manni meta query --check \"SELECT slug, count(*) n FROM docs GROUP BY slug HAVING n > 1\" docs/',\n ' manni meta query -f csv \"SELECT _path, title, last_reviewed FROM docs\" docs/ > stale.csv',\n \" manni meta query --param author=\\\"O'Brien\\\" \\\"SELECT _path FROM docs WHERE author = \\\\$author\\\" docs/\",\n ' cat page.md | manni meta query \"SELECT title FROM docs\" - --as markdown',\n \" manni meta query --db docs.db docs/ # export only; open with any SQLite UI\",\n ].join(\"\\n\"),\n )\n .action(\n async (\n sqlArg: string | undefined,\n pathsArg: string[],\n options: QueryCliOptions,\n command: Command,\n ) => {\n try {\n const format = options.format;\n if (!isQueryFormat(format)) {\n throw new DocmetaError(\n `Unknown --format \"${format}\". Use ${QUERY_FORMAT_LIST}.`,\n );\n }\n // The findings formats render findings, and only `--check` produces\n // them. Gated before the run so the refusal costs nothing.\n if (isQueryFindingsFormat(format) && !options.check) {\n throw new DocmetaError(\n `--format ${format} renders findings, which only --check produces. Add --check, or use pretty, json, or csv.`,\n );\n }\n const { sql, paths } = resolveQueryInputs(\n sqlArg,\n pathsArg,\n options.query,\n process.cwd(),\n typeof options.db === \"string\",\n );\n // A `--db`-only export has no result rows to shape into CSV; its\n // summary stays with pretty/json. Refused before the run, like the\n // findings gate above.\n if (format === \"csv\" && sql === \"\") {\n throw new DocmetaError(\n \"--format csv renders result rows, and a --db export without SQL produces none. Use pretty or json for the export summary.\",\n );\n }\n // The findings formats have the same no-rows problem on an\n // export-only run — and silently printing the export summary would\n // be a --check gate that checked nothing.\n if (isQueryFindingsFormat(format) && sql === \"\") {\n throw new DocmetaError(\n `--format ${format} renders findings, which need a statement to produce rows — a --db export without SQL has none. Pass the SQL, or drop --check -f ${format}.`,\n );\n }\n // Ditto --param: with no statement there is nothing to bind into,\n // and silently ignoring the flag would hide a misspelled command.\n if (options.param.length > 0 && sql === \"\") {\n throw new DocmetaError(\n \"--param needs a statement to bind into; a --db export without SQL references no parameters. Pass the SQL, or drop --param.\",\n );\n }\n // And -s (0030): it names the schema set DDL evolves, and with no\n // SQL nothing can evolve it — the same flag-means-nothing seam,\n // refused at the same gate. Worded without naming --db: the gate\n // guards every empty-SQL arrival, not just the export spelling.\n if (options.schema.length > 0 && sql === \"\") {\n throw new DocmetaError(\n \"-s names the schema set DDL evolves; without SQL there is no statement to evolve it. Pass the SQL, or drop -s.\",\n );\n }\n const params = parseQueryParams(options.param);\n const exts: string[] | undefined = options.ext\n ? splitList(options.ext)\n : undefined;\n const stdinContent = paths.includes(STDIN)\n ? await readStdin()\n : undefined;\n\n // `--check` implies a dry run: a check judges and exits, it never\n // mutates — which keeps every CI drift gate a read-only step. So\n // does `-f csv`: csv refuses a changes-producing statement below,\n // and that refusal must land before anything is applied, not after.\n const dryRun =\n Boolean(options.dryRun) || Boolean(options.check) ||\n format === \"csv\";\n const run = await runQuery({\n sql,\n db: options.db,\n dryRun,\n cache: options.cache,\n ...(Object.keys(params).length > 0 ? { params } : {}),\n ...(options.schema.length > 0 ? { schemas: options.schema } : {}),\n inputs: paths,\n as: options.as,\n exclude: options.exclude,\n exts,\n collections: options.collection,\n ...configOption(options.config),\n onConfigLoaded: reportConfig(format === \"pretty\", process.cwd()),\n stdinContent,\n allowEmpty: options.allowEmpty ? true : undefined,\n respectGitignore: explicitFalse(options.gitignore),\n offline: options.offline ? true : undefined,\n onNotice: notice,\n // A write to a column marked x-manni-encrypt with no key asks\n // for one on a terminal, and refuses off one (proposal 0045).\n // The same Confirm asks P1 (proposal 0047).\n confirm: terminalConfirm(),\n // An accepted P1 offer prints relocate's report: on stdout\n // beside a pretty report, on stderr when stdout must parse.\n onRelocated: (result) => {\n const text = renderRelocate(result, \"pretty\", {\n color: format === \"pretty\" && resolveColor(command.parent ?? command),\n });\n (format === \"pretty\" ? process.stdout : process.stderr).write(`${text}\\n`);\n },\n });\n // With SQL, the rows own stdout and the export is a diagnostic;\n // export-only, the export summary IS the report.\n if (run.db && sql === \"\") {\n process.stdout.write(\n format === \"json\"\n ? `${JSON.stringify(run.db, null, 2)}\\n`\n : `Wrote ${run.db.path} (${run.db.files} files, ${run.db.columns} columns)\\n`,\n );\n process.exitCode = 0;\n return;\n }\n if (run.db) {\n notice(`wrote ${run.db.path} (${run.db.files} files)`);\n }\n // Narrowing guard: past this return, `format` is\n // `pretty | json | csv`, which is what keeps the switch below\n // compile-time exhaustive.\n if (isQueryFindingsFormat(format)) {\n renderQueryFindings(run, format);\n return;\n }\n switch (format) {\n case \"csv\":\n // CSV describes result rows. Changes are heterogeneous per-file\n // diffs (eight kinds since 0024), not a table — the refusal\n // lives here in the dispatch, where the format is known and the\n // reporter stays presentation-only (proposal 0029). The run was\n // forced dry above, so the refusal is truthful: nothing landed.\n if (run.changes) {\n throw new DocmetaError(\n \"--format csv renders result rows; this statement produced changes, which have no tabular shape — nothing was applied. Use pretty or json to preview them, and run without -f csv to apply.\",\n );\n }\n process.stdout.write(`${renderQueryCsv(run)}\\n`);\n break;\n case \"json\":\n // The bare array, mirroring `get`'s bare result array: changes\n // for a metadata edit, rows for a read. The `--check` verdict\n // travels in the exit code, not the envelope.\n process.stdout.write(\n `${JSON.stringify(run.changes ?? run.rows, null, 2)}\\n`,\n );\n break;\n case \"pretty\": {\n const text = renderQuery(run, {\n color: resolveColor(command.parent ?? command),\n check: Boolean(options.check),\n dryRun,\n });\n if (text.length > 0) process.stdout.write(`${text}\\n`);\n break;\n }\n default: {\n // Exhaustive: the findings formats returned above and narrowed\n // the union, so adding a value to QUERY_FORMATS without a case\n // here (or a findings-format branch) is a compile error. The\n // throw is the runtime half, as in `render`.\n const unreachable: never = format;\n throw new DocmetaError(\n `Unknown --format ${JSON.stringify(unreachable)}. Use ${QUERY_FORMAT_LIST}.`,\n );\n }\n }\n // Rows from a `--check` run are findings, and so are its pending\n // changes — the drift gate (`--check` never applies). An applied\n // statement is the work done, so it succeeds or fails outright.\n const findings = run.changes ? run.changes.length : run.rows.length;\n process.exitCode = options.check && findings > 0 ? 1 : 0;\n } catch (err) {\n fail(err);\n }\n },\n );\n\n program\n .command(\"fill\")\n .description(\n \"Infer missing or invalid metadata and write values above the confidence threshold\",\n )\n .argument(\n \"[paths...]\",\n \"files, directories, or globs to fill (use - for stdin)\",\n )\n .option(\n \"-s, --schema <ref>\",\n \"schema to fill against; repeatable; overrides $schema/config\",\n collect,\n [],\n )\n .option(\"--ext <list>\", \"comma-separated extensions for directory walks\")\n .option(\"--exclude <glob>\", \"glob to exclude; repeatable\", collect, [])\n .option(\"--as <format>\", \"force an input format (e.g. markdown, mdx)\")\n .option(\"--fields <list>\", \"comma-separated fields to fill\")\n .option(\"--confidence <n>\", \"minimum confidence to write (0-1)\", parseFloat)\n .option(\"--dry-run\", \"report proposals without writing them\")\n .option(\n \"--provider <name>\",\n \"provider: auto (default), anthropic, openai, claude-cli, llama-cpp\",\n )\n .option(\n \"--model <model>\",\n \"model override; needs a named provider, from here or config\",\n )\n .option(\"--no-cache\", \"bypass the proposal cache\")\n .option(\"--local\", LOCAL_FLAG_HELP)\n .option(\"--max-turns <n>\", \"stop after this many inference calls\", parseFloat)\n .option(\n \"--chunk-chars <n>\",\n \"characters of document per call (default 12000)\",\n parseFloat,\n )\n // parseFloat, not parseInt: parseInt(\"3.5\") silently yields 3, which would\n // defeat runFill's integer check and hide the mistake from the user.\n .option(\"--concurrency <n>\", \"files inferred in parallel\", parseFloat)\n .option(\n \"-f, --format <format>\",\n `output: ${FILL_FORMATS.join(\" | \")}`,\n \"pretty\",\n )\n .option(\n \"--collection <name>\",\n \"configured collection to run over; repeatable\",\n collect,\n [],\n )\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--no-config\", \"ignore any discovered config file\")\n .option(\n \"-q, --quiet\",\n \"in pretty output, hide files with nothing written and nothing required left undone\",\n )\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"--no-gitignore\", \"fill files .gitignore covers\")\n .option(\n \"--offline\",\n \"no network egress: no remote schema or provider, and only a model already downloaded\",\n )\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni meta fill docs/ --dry-run # preview proposals\",\n \" manni meta fill docs/ --confidence 0.9 # only near-certain values\",\n \" manni meta fill page.md --fields description\",\n \" manni meta fill docs/ -f github # CI annotations\",\n \" cat page.md | manni meta fill - --as markdown # filled doc to stdout\",\n ].join(\"\\n\"),\n )\n .action(async (paths: string[], options: FillCliOptions, command: Command) => {\n try {\n const format = options.format;\n if (!isFillFormat(format)) {\n throw new DocmetaError(\n `Unknown --format \"${format}\". Use ${FILL_FORMAT_LIST}.`,\n );\n }\n // parseFloat(\"abc\") is NaN, and every comparison against NaN is false,\n // so a bare range check would silently accept garbage.\n numeric(\"--confidence\", options.confidence, 0, 1);\n numeric(\"--max-turns\", options.maxTurns, 1, Number.MAX_SAFE_INTEGER);\n numeric(\n \"--chunk-chars\",\n options.chunkChars,\n 1,\n Number.MAX_SAFE_INTEGER,\n );\n numeric(\"--concurrency\", options.concurrency, 1, 64);\n\n const exts: string[] | undefined = options.ext\n ? splitList(options.ext)\n : undefined;\n const usingStdin = paths.includes(STDIN);\n // With `-` the filled document owns stdout and the report is a\n // diagnostic on stderr — where GitHub never reads `::error`. The\n // annotations would be produced, and nothing would ever render them.\n // Refuse the combination rather than degrade to a silent no-op, which\n // is the exact false green this parity work exists to remove.\n if (usingStdin && format === \"github\") {\n throw new DocmetaError(\n 'Cannot use --format github with stdin (\"-\"): the filled document owns stdout, so the annotations would go to stderr, where GitHub ignores them. Pass file paths instead.',\n );\n }\n const stdinContent = usingStdin ? await readStdin() : undefined;\n\n const run = await runFill({\n inputs: paths,\n cliSchemas: options.schema,\n exts,\n exclude: options.exclude,\n as: options.as,\n collections: options.collection,\n ...configOption(options.config),\n // With `-` the filled document owns stdout, so the notice is a\n // diagnostic there just as the report is.\n onConfigLoaded: reportConfig(\n format === \"pretty\" && !usingStdin,\n process.cwd(),\n ),\n stdinContent,\n allowEmpty: options.allowEmpty ? true : undefined,\n respectGitignore: explicitFalse(options.gitignore),\n offline: options.offline ? true : undefined,\n onNotice: notice,\n fields: options.fields ? splitList(options.fields) : undefined,\n confidence: options.confidence,\n dryRun: Boolean(options.dryRun),\n provider: options.provider,\n model: options.model,\n cache: options.cache,\n local: Boolean(options.local),\n maxTurns: options.maxTurns,\n chunkChars: options.chunkChars,\n concurrency: options.concurrency,\n includeContent: usingStdin,\n // A field marked x-manni-encrypt with no key asks for one on a\n // terminal, and refuses off one (proposal 0045). Reading the page\n // from stdin leaves no terminal to ask on. The same Confirm asks\n // P1 (proposal 0047).\n confirm: usingStdin ? undefined : terminalConfirm(),\n // An accepted P1 offer prints relocate's report: on stdout beside a\n // pretty report, on stderr when stdout must parse.\n onRelocated: (result) => {\n const text = renderRelocate(result, \"pretty\", {\n color: format === \"pretty\" && resolveColor(command.parent ?? command),\n });\n (format === \"pretty\" ? process.stdout : process.stderr).write(`${text}\\n`);\n },\n });\n\n const color = resolveColor(command.parent ?? command);\n const report = renderFill(format, run, {\n color,\n quiet: Boolean(options.quiet),\n });\n if (usingStdin) {\n // The filled document owns stdout here; the report is a diagnostic.\n const filled = run.results[0]?.content;\n if (filled != null) process.stdout.write(filled);\n if (report.length > 0) process.stderr.write(`${report}\\n`);\n } else if (report.length > 0) {\n process.stdout.write(`${report}\\n`);\n }\n\n // A field the schema requires that could not be filled confidently is\n // work left undone, so CI should see it. Optional fields are not.\n process.exitCode =\n run.summary.requiredSkipped > 0 || run.summary.errors > 0 ? 1 : 0;\n } catch (err) {\n fail(err);\n }\n });\n\n program\n .command(\"derive\")\n .description(\n \"Stamp the managed stewardship fields from git history, CODEOWNERS and GitHub or GitLab reviews\",\n )\n .argument(\n \"[paths...]\",\n \"files, directories, or globs to stamp; <path>:L1-L2 names lines for --generated-by\",\n )\n .option(\n \"--fields <list>\",\n \"comma-separated managed fields to stamp; config derive.fields otherwise, else the merge-safe fields each page's schemas claim\",\n )\n .option(\n \"--generated-by <name>\",\n \"attribute uncommitted body lines, or a <path>:L1-L2 range, to this machine in provenance; MANNI_GENERATED_BY otherwise\",\n )\n .option(\n \"--sources <list>\",\n \"comma-separated sources to consult: git, codeowners, github, gitlab, command (default all)\",\n )\n .option(\"--dry-run\", \"report what would change and write nothing\")\n .option(\n \"--check\",\n \"implies --dry-run: a stale or unset managed field is a finding, exit 1 if any\",\n )\n .option(\n \"-f, --format <format>\",\n `output: ${DERIVE_FORMATS.join(\" | \")} (github, sarif, junit need --check)`,\n \"pretty\",\n )\n .option(\"--no-cache\", \"bypass the GitHub or GitLab review cache\")\n .option(\"--ext <list>\", \"comma-separated extensions for directory walks\")\n .option(\"--exclude <glob>\", \"glob to exclude; repeatable\", collect, [])\n .option(\"--as <format>\", \"force an input format (e.g. markdown, mdx)\")\n .option(\n \"--collection <name>\",\n \"configured collection to run over; repeatable\",\n collect,\n [],\n )\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--no-config\", \"ignore any discovered config file\")\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"--no-gitignore\", \"stamp files .gitignore covers\")\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni meta derive # stamp the managed fields over every collection\",\n \" manni meta derive --collection guides # stamp one configured collection\",\n \" manni meta derive --dry-run docs/install.md # what would change, nothing written\",\n \" manni meta derive --check -f github # CI: a stale stamp is an annotation, exit 1\",\n \" manni meta derive --fields reviewed-by,last-reviewed\",\n \" manni meta derive --sources git,codeowners # no gh on this machine\",\n \" MANNI_GENERATED_BY=claude-fable-5 manni meta derive --fields provenance\",\n \" manni meta derive docs/limits.md:12-31 --generated-by claude-fable-5\",\n ].join(\"\\n\"),\n )\n .action(async (paths: string[], options: DeriveCliOptions, command: Command) => {\n try {\n const format = options.format;\n if (!isDeriveFormat(format)) {\n throw new DocmetaError(\n `Unknown --format \"${format}\". Use ${DERIVE_FORMAT_LIST}.`,\n );\n }\n // The findings formats render findings, and only `--check` produces\n // them. Gated before the run so the refusal costs nothing — and so\n // nothing is written on a run whose report was never going to render.\n if (\n (format === \"github\" || format === \"sarif\" || format === \"junit\") &&\n !options.check\n ) {\n throw new DocmetaError(\n `${format} is a findings format, which only --check produces`,\n );\n }\n const exts: string[] | undefined = options.ext\n ? splitList(options.ext)\n : undefined;\n\n const run = await runDerive({\n inputs: paths,\n fields: options.fields ? splitList(options.fields) : undefined,\n sources: options.sources ? splitList(options.sources) : undefined,\n ...(options.generatedBy !== undefined ? { generatedBy: options.generatedBy } : {}),\n dryRun: Boolean(options.dryRun),\n check: Boolean(options.check),\n cache: options.cache,\n exts,\n exclude: options.exclude,\n as: options.as,\n collections: options.collection,\n ...configOption(options.config),\n onConfigLoaded: reportConfig(!isMachineFormat(format), process.cwd()),\n allowEmpty: options.allowEmpty ? true : undefined,\n respectGitignore: explicitFalse(options.gitignore),\n onNotice: notice,\n // A field its schema marks x-manni-encrypt (proposal 0045) with no\n // key yet: asked on a terminal, refused off one. The same Confirm\n // asks P1 (proposal 0047).\n confirm: terminalConfirm(),\n // An accepted P1 offer prints relocate's report: on stdout beside a\n // pretty report, on stderr when stdout must parse.\n onRelocated: (result) => {\n const text = renderRelocate(result, \"pretty\", {\n color: format === \"pretty\" && resolveColor(command.parent ?? command),\n });\n (format === \"pretty\" ? process.stdout : process.stderr).write(`${text}\\n`);\n },\n });\n\n const text = renderDerive(run, format, {\n color: resolveColor(command.parent ?? command),\n frame: run.frame,\n onNotice: notice,\n });\n // Only `github` may say nothing on a clean run — see `OMITTED_WHEN_CLEAN`.\n if (text.length > 0 || !OMITTED_WHEN_CLEAN.has(format)) {\n process.stdout.write(`${text}\\n`);\n }\n // A file error fails any run; a finding fails `--check`. See `deriveFailed`.\n process.exitCode = deriveFailed(run) ? 1 : 0;\n } catch (err) {\n fail(err);\n }\n });\n\n program\n .command(\"relocate\")\n .description(\n \"Move each value to where its schema's x-manni-location and the config's manifests say it belongs\",\n )\n .argument(\n \"[paths...]\",\n \"files, directories, or globs to relocate (stdin is refused)\",\n )\n .option(\n \"--fields <list>\",\n \"comma-separated fields to move; each must be marked x-manni-location or manifest-owned\",\n )\n .option(\n \"--collection <name>\",\n \"configured collection to run over; repeatable\",\n collect,\n [],\n )\n .option(\n \"-s, --schema <ref>\",\n \"schema to judge preferences against; repeatable; overrides $schema/config\",\n collect,\n [],\n )\n .option(\"--dry-run\", \"report what would move and be created, and write nothing\")\n .option(\n \"-f, --format <format>\",\n `output: ${RELOCATE_FORMATS.join(\" | \")}`,\n \"pretty\",\n )\n .option(\"--ext <list>\", \"comma-separated extensions for directory walks\")\n .option(\"--exclude <glob>\", \"glob to exclude; repeatable\", collect, [])\n .option(\"--as <format>\", \"force an input format (e.g. markdown, mdx)\")\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--no-config\", \"ignore any discovered config file (refused: relocate writes the config)\")\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"--no-gitignore\", \"relocate files .gitignore covers\")\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni meta relocate # every collection, as config declares it\",\n \" manni meta relocate --dry-run # what would move and be created\",\n \" manni meta relocate docs/install.md --fields owner\",\n \" manni meta relocate docs/ guides/intro.md # no collections yet: creates collection default\",\n \" manni meta relocate -f json --dry-run # the scripting form\",\n ].join(\"\\n\"),\n )\n .action(async (paths: string[], options: RelocateCliOptions, command: Command) => {\n try {\n const format = options.format;\n if (!isRelocateFormat(format)) {\n throw new DocmetaError(\n `relocate --format must be pretty or json; got \"${format}\".`,\n );\n }\n const result = await runRelocate({\n inputs: paths,\n fields: options.fields ? splitList(options.fields) : undefined,\n collections: options.collection,\n cliSchemas: options.schema,\n dryRun: Boolean(options.dryRun),\n exts: options.ext ? splitList(options.ext) : undefined,\n exclude: options.exclude,\n as: options.as,\n ...configOption(options.config),\n onConfigLoaded: reportConfig(format === \"pretty\", process.cwd()),\n allowEmpty: options.allowEmpty ? true : undefined,\n respectGitignore: explicitFalse(options.gitignore),\n onNotice: notice,\n });\n const text = renderRelocate(result, format, {\n color: resolveColor(command.parent ?? command),\n });\n process.stdout.write(`${text}\\n`);\n // A value left on the wrong side is work undone. See `relocateFailed`.\n process.exitCode = relocateFailed(result) ? 1 : 0;\n } catch (err) {\n fail(err);\n }\n });\n\n // `-f, --format` stays on the parent rather than moving to a `list`\n // subcommand: bare `manni meta schemas` is a *default action*, not group help,\n // and both are part of the documented surface.\n const schemas = program\n .command(\"schemas\")\n .description(\"List built-in schemas and supported input formats\")\n .option(\n \"-f, --format <format>\",\n `output: ${COMMON_FORMATS.join(\" | \")}`,\n \"pretty\",\n )\n .action(async (options: SchemasCliOptions, command: Command) => {\n try {\n // A closed set, checked like every other command's --format. This used\n // to be a bare `=== \"json\" ? json : pretty`, so `schemas -f github`\n // printed a pretty listing and exited 0 — a request docmeta cannot\n // honor, answered with success in a different format. `github` is the\n // case that matters: it is a real docmeta format, just not one this\n // command produces, so nothing about the invocation looked wrong.\n const format = assertCommonFormat(options.format);\n // The registered schemas come from the config discovery finds. A\n // broken config does not stop the listing of the built-ins, which\n // never depended on it; it is named on stderr instead.\n let registered: RegisteredSchemas | undefined;\n try {\n registered = (await loadConfig(undefined, process.cwd()))?.config.registered;\n } catch (err) {\n if (!(err instanceof DocmetaError)) throw err;\n warn(`${err.message} Registered schemas are not listed.`);\n }\n const info = getSchemasInfo(registered);\n if (format === \"json\") {\n process.stdout.write(`${JSON.stringify(info, null, 2)}\\n`);\n return;\n }\n const c = palette(resolveColor(command.parent ?? command));\n const lines: string[] = [c.bold(\"Built-in schemas:\")];\n for (const b of info.builtins) {\n lines.push(` ${c.cyan(b.id)} ${c.dim(\"—\")} ${b.title}`);\n }\n if (info.registered.length > 0) {\n lines.push(\"\", c.bold(\"Registered schemas:\"));\n for (const r of info.registered) {\n lines.push(` ${c.cyan(r.id)} ${c.dim(\"—\")} ${r.file}`);\n }\n }\n lines.push(\"\", c.bold(\"Input formats:\"));\n for (const f of info.formats) {\n const tag = f.writable ? c.green(\"writable\") : c.dim(\"read-only\");\n lines.push(` ${f.name} (${f.extensions.join(\", \")}) [${tag}]`);\n }\n process.stdout.write(`${lines.join(\"\\n\")}\\n`);\n } catch (err) {\n fail(err);\n }\n });\n\n schemas\n .command(\"infer\")\n .description(\n \"Report metadata coverage across a docset, and draft a schema from what is there\",\n )\n .argument(\n \"[paths...]\",\n \"files, directories, or globs to scan (use - for stdin)\",\n )\n .option(\"--out <path>\", \"write the draft schema here\")\n // Default 0, and it must stay 0. A default that hid the long tail would\n // hide exactly the \"3% is one team's convention, not a standard\" signal the\n // report exists to surface.\n .option(\n \"--min-coverage <pct>\",\n \"hide keys below this coverage percentage\",\n parseFloat,\n 0,\n )\n .option(\"--ext <list>\", \"comma-separated extensions for directory walks\")\n .option(\"--exclude <glob>\", \"glob to exclude; repeatable\", collect, [])\n .option(\"--as <format>\", \"force an input format (e.g. markdown, mdx)\")\n .option(\n \"-f, --format <format>\",\n `output: ${COMMON_FORMATS.join(\" | \")}`,\n \"pretty\",\n )\n .option(\n \"--collection <name>\",\n \"configured collection to run over; repeatable\",\n collect,\n [],\n )\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--no-config\", \"ignore any discovered config file\")\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"--no-gitignore\", \"scan files .gitignore covers\")\n .option(\n \"--offline\",\n \"accepted and ignored: infer loads no schema and no provider\",\n )\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni meta schemas infer docs/ # what does this repo have?\",\n \" manni meta schemas infer docs/ --min-coverage 5 # drop the long tail\",\n \" manni meta schemas infer docs/ --out ./schemas/permissive.json\",\n \" manni meta schemas infer docs/ -f json\",\n \"\",\n \"Purely statistical and offline: no provider, no network, no model. The\",\n \"draft never marks anything `required` — coverage is your decision to\",\n \"make, not the tool's.\",\n ].join(\"\\n\"),\n )\n .action(async (paths: string[], options: InferCliOptions, command: Command) => {\n try {\n const format = assertCommonFormat(formatFor(command, options.format));\n numeric(\"--min-coverage\", options.minCoverage, 0, 100);\n const exts: string[] | undefined = options.ext\n ? splitList(options.ext)\n : undefined;\n const stdinContent = paths.includes(STDIN)\n ? await readStdin()\n : undefined;\n\n const result = await runInferSchema({\n inputs: paths,\n exts,\n exclude: options.exclude,\n as: options.as,\n collections: options.collection,\n ...configOption(options.config),\n onConfigLoaded: reportConfig(format === \"pretty\", process.cwd()),\n stdinContent,\n out: options.out,\n minCoverage: options.minCoverage,\n // Same shape as the other four input-taking commands: only an\n // explicit `--allow-empty` / `--no-gitignore` travels, so config\n // `allowEmpty:` and `respectGitignore:` still decide otherwise.\n allowEmpty: options.allowEmpty ? true : undefined,\n respectGitignore: explicitFalse(options.gitignore),\n // Accepted and ignored — `infer` never fetches. `undefined` rather\n // than `false` all the same, so this stays the same shape as the\n // other four if it ever does gain a meaning.\n offline: options.offline ? true : undefined,\n onNotice: notice,\n });\n\n if (format === \"json\") {\n process.stdout.write(`${JSON.stringify(result, null, 2)}\\n`);\n return;\n }\n const text = renderInfer(result, {\n color: resolveColor(command.parent?.parent ?? command),\n });\n process.stdout.write(`${text}\\n`);\n } catch (err) {\n fail(err);\n }\n });\n\n schemas\n .command(\"vendor\")\n .description(\n \"Download a remote schema into this repository and pin it in config\",\n )\n .argument(\"<url>\", \"http(s) URL of the schema to vendor\")\n .option(\n \"--dir <path>\",\n \"directory for the committed copy\",\n DEFAULT_VENDOR_DIR,\n )\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni meta schemas vendor https://schemas.example.com/house/2.1.json\",\n \" manni meta schemas vendor https://schemas.example.com/house/2.1.json --dir ./contracts\",\n \"\",\n \"Commit both the downloaded file and the config change: the point of\",\n \"vendoring is that CI validates against a copy in your own history.\",\n ].join(\"\\n\"),\n )\n .action(async (url: string, options: VendorCliOptions) => {\n try {\n const result = await runVendorSchema({\n url,\n dir: options.dir,\n // `typeof === \"string\"`, not `!== undefined`. `vendor` is the one\n // config-taking command with no `--no-config`, and the parity rule in\n // CLAUDE.md points straight at adding one — at which point commander\n // starts passing `false` here. The annotation on `VendorCliOptions`\n // says that cannot happen, so it would not be caught at the point the\n // flag is declared; this test is what keeps a `false` out of a field\n // that must be a path.\n ...(typeof options.config === \"string\"\n ? { configPath: options.config }\n : {}),\n onNotice: notice,\n });\n // Three states, and the operator needs to be able to tell them apart in\n // a diff: a config was created, an existing reference was replaced (the\n // re-vendor and the bare-URL migration both land here), or an entry was\n // added beside what was already there.\n const configNote = result.configCreated\n ? \"created\"\n : result.replaced\n ? \"reference updated\"\n : \"reference added\";\n process.stdout.write(\n [\n `Vendored ${result.url}`,\n ` file ${result.file} (${result.bytes} bytes${result.unchanged ? \", unchanged\" : \"\"})`,\n ` integrity ${result.integrity}`,\n ` config ${result.config} (${configNote})`,\n \"\",\n `Commit ${result.file} and ${result.config} so CI validates against this copy.`,\n ].join(\"\\n\") + \"\\n\",\n );\n } catch (err) {\n fail(err);\n }\n });\n\n return program;\n}\n\n// No entry point here. `src/cli.ts` mounts this program as `manni meta` and\n// `src/docmeta.ts` runs it under its old name; both go through `runProgram`\n// in src/shared/run.ts, which owns the exit-code contract.\n","/**\n * Reporter for `relocate` (proposal 0047).\n *\n * `pretty` leads with what the config gains or loses (a created collection or\n * manifest, an appended path, a `keys:` change and the pages it reaches), then\n * each page with a value that moved or stayed, then one summary line. A page\n * reached only through a `keys:` change, outside the paths the run named, is\n * counted rather than listed unless a value on it stayed. `json` is the\n * scripting form: the run's shape minus what only the pretty lines need.\n */\nimport { DocmetaError } from \"../types.js\";\nimport type { RelocateResult } from \"../core/relocation.js\";\nimport { palette } from \"../../shared/color.js\";\nimport { formatList } from \"./index.js\";\n\nexport const RELOCATE_FORMATS = [\"pretty\", \"json\"] as const;\n\nexport type RelocateReportFormat = (typeof RELOCATE_FORMATS)[number];\n\n/** `\"pretty or json\"`, for messages and help text. */\nexport const RELOCATE_FORMAT_LIST = formatList(RELOCATE_FORMATS);\n\nexport function isRelocateFormat(value: string): value is RelocateReportFormat {\n return (RELOCATE_FORMATS as readonly string[]).includes(value);\n}\n\nexport interface RelocateReportOptions {\n color?: boolean;\n}\n\nexport function renderRelocate(\n result: RelocateResult,\n format: RelocateReportFormat,\n opts: RelocateReportOptions = {},\n): string {\n switch (format) {\n case \"json\":\n return JSON.stringify(relocateJson(result), null, 2);\n case \"pretty\":\n return renderRelocatePretty(result, opts);\n default: {\n const unreachable: never = format;\n throw new DocmetaError(\n `relocate --format must be pretty or json; got ${JSON.stringify(unreachable)}.`,\n );\n }\n }\n}\n\n/** The JSON shape: what a script reads, without the pretty reporter's own fields. */\nexport function relocateJson(result: RelocateResult): unknown {\n return {\n dryRun: result.dryRun,\n config: {\n file: result.config.file,\n created: result.config.created,\n collectionsCreated: result.config.collectionsCreated,\n pathsAdded: result.config.pathsAdded,\n },\n manifests: result.manifests.map((m) => ({\n file: m.file,\n collection: m.collection,\n created: m.created,\n keysAdded: m.keysAdded,\n keysRemoved: m.keysRemoved,\n undeclared: m.undeclared,\n })),\n files: result.files.map((f) => ({\n file: f.file,\n moved: f.moved,\n stayed: f.stayed.map((s) => ({ key: s.key, reason: s.reason })),\n })),\n summary: result.summary,\n };\n}\n\nconst plural = (n: number, noun: string): string => `${n} ${noun}${n === 1 ? \"\" : \"s\"}`;\nconst list = (xs: readonly string[]): string => xs.join(\", \");\n\nexport function renderRelocatePretty(result: RelocateResult, opts: RelocateReportOptions = {}): string {\n const c = palette(opts.color ?? false);\n const dry = result.dryRun;\n const lines: string[] = [];\n\n // ---- The config ------------------------------------------------------------\n if (result.config.created && result.config.file !== null) {\n lines.push(dry ? `Would create ${result.config.file}.` : `Created ${result.config.file}.`);\n }\n const pathsOf = (collection: string): string[] =>\n result.config.pathsAdded.filter((p) => p.collection === collection).map((p) => p.path);\n const said = new Set<string>();\n for (const created of result.config.collectionsCreated) {\n said.add(created.name);\n const made = result.manifests.filter((m) => m.collection === created.name && m.created);\n const head = `${dry ? \"Would create\" : \"Created\"} collection ${created.name} (paths: ${list(created.paths)})`;\n if (made.length === 0) {\n lines.push(`${head}.`);\n continue;\n }\n const owns = list(made.flatMap((m) => m.keys));\n lines.push(`${head} and ${list(made.map((m) => m.file))}; it ${dry ? \"would own\" : \"owns\"} ${owns}.`);\n }\n for (const m of result.manifests) {\n if (said.has(m.collection) && m.created) continue;\n const added = said.has(m.collection) ? [] : pathsOf(m.collection);\n if (added.length > 0) said.add(m.collection);\n const keys = list(m.keys);\n if (m.created) {\n if (added.length > 0) {\n lines.push(\n dry\n ? `Would add ${list(added)} to collection ${m.collection}'s paths and create ${m.file}; it would own ${keys}.`\n : `Added ${list(added)} to collection ${m.collection}'s paths and created ${m.file}; it owns ${keys}.`,\n );\n } else {\n lines.push(\n dry\n ? `Would create ${m.file}; collections[${m.collection}].externalMetadata[${m.index}] would own ${keys}.`\n : `Created ${m.file}; collections[${m.collection}].externalMetadata[${m.index}] owns ${keys}.`,\n );\n }\n continue;\n }\n const beyond = m.beyond > 0 ? `, ${m.beyond} beyond the paths you named` : \"\";\n const pronoun = (n: number): string => (n === 1 ? \"it\" : \"them\");\n if (m.keysRemoved.length > 0) {\n const what = `${list(m.keysRemoved)} from ${m.file}'s keys`;\n const it = pronoun(m.keysRemoved.length);\n const where = `into every page in collection ${m.collection}${beyond}`;\n lines.push(dry ? `Would remove ${what}, moving ${it} ${where}.` : `Removing ${what} moves ${it} ${where}.`);\n }\n if (added.length > 0) {\n lines.push(\n dry\n ? `Would add ${list(added)} to collection ${m.collection}'s paths; ${m.file} would own ${keys}.`\n : `Added ${list(added)} to collection ${m.collection}'s paths; ${m.file} now owns ${keys}.`,\n );\n } else if (m.keysAdded.length > 0) {\n const what = `${list(m.keysAdded)} to ${m.file}'s keys`;\n const it = pronoun(m.keysAdded.length);\n const where = `out of every page in collection ${m.collection}${beyond}`;\n lines.push(dry ? `Would add ${what}, moving ${it} ${where}.` : `Adding ${what} moves ${it} ${where}.`);\n }\n if (m.undeclared) {\n lines.push(\n dry\n ? `${m.file} would no longer own any keys and would no longer be declared; delete it when you are ready.`\n : `${m.file} no longer owns any keys and is no longer declared; delete it when you are ready.`,\n );\n }\n }\n for (const p of result.config.pathsAdded) {\n if (said.has(p.collection)) continue;\n said.add(p.collection);\n lines.push(`${dry ? \"Would add\" : \"Added\"} ${list(pathsOf(p.collection))} to collection ${p.collection}'s paths.`);\n }\n\n // ---- The pages ---------------------------------------------------------------\n const width = Math.max(\n 7,\n ...result.files.flatMap((f) => [...f.moved, ...f.stayed].map((v) => v.key.length)),\n );\n const shown = result.files.filter((f) => !f.beyond || f.stayed.length > 0);\n for (const f of shown) {\n lines.push(f.file);\n for (const mv of f.moved) {\n const name = c.cyan(mv.key.padEnd(width));\n if (mv.to === \"page\") {\n lines.push(` ${name} ← ${mv.from}`);\n } else {\n lines.push(` ${name} → ${mv.manifest}${mv.line !== undefined ? `:${mv.line}` : \"\"}`);\n }\n }\n for (const st of f.stayed) {\n lines.push(` ${c.cyan(st.key.padEnd(width))} ${c.yellow(`stays: ${st.detail ?? st.reason}`)}`);\n }\n }\n const hidden = result.files.length - shown.length;\n if (hidden > 0) lines.push(`… (${plural(hidden, \"more file\")})`);\n\n // ---- The summary ---------------------------------------------------------------\n const s = result.summary;\n if (s.files === 0) {\n lines.push(\"0 files, nothing to move\");\n return lines.join(\"\\n\");\n }\n const moves = result.files.flatMap((f) => f.moved);\n const toPage = moves.filter((m) => m.to === \"page\").length;\n const toManifest = moves.flatMap((m) => (m.to === \"manifest\" ? [m.manifest] : []));\n const manifests = plural(new Set(toManifest).size, \"manifest\");\n let footer = `${plural(s.files, \"file\")}, ${plural(s.moved, \"value\")} ${dry ? \"would move\" : \"moved\"}`;\n if (toPage > 0 && toManifest.length > 0) {\n footer += `: ${toPage} into pages, ${toManifest.length} into ${manifests}`;\n } else if (toManifest.length > 0) {\n footer += ` to ${manifests}`;\n } else if (toPage > 0) {\n footer += \" into pages\";\n }\n if (s.stayed > 0) footer += `, ${s.stayed} stayed`;\n lines.push(s.stayed > 0 ? c.yellow(footer) : footer);\n return lines.join(\"\\n\");\n}\n","/**\n * validate's offer to move misplaced values (proposal 0047, prompt P2).\n *\n * After the report is printed, on a terminal, each collection with an\n * unsuppressed `location:external` or `location:page` finding gets one\n * question. A yes runs relocate for the files and keys of those findings (a\n * `keys:` change still reaches every member page, as relocate's does) and\n * prints relocate's pretty output. A no does nothing: the findings already\n * said it.\n *\n * Everything the user reads goes to `output`, which the CLI makes stderr so\n * the report on stdout stays machine-readable. The exit code is never this\n * module's to change: it is the report's.\n *\n * No question is put without a `Confirm` (off a terminal, or a run reading\n * stdin), under `--no-config`, for stdin's own findings, or for a page with no\n * possible home. A baselined finding never reaches here, so a baseline is how\n * someone stops being asked.\n */\nimport type { Confirm } from \"../../shared/prompt.js\";\nimport { programName } from \"../../shared/program-name.js\";\nimport { resolveRunConfig } from \"../core/config.js\";\nimport { STDIN_LABEL } from \"../core/load-files.js\";\nimport { LOCATION_EXTERNAL_SCHEMA, LOCATION_PAGE_SCHEMA } from \"../core/location.js\";\nimport {\n applyRelocation,\n keyHome,\n offerPrompt,\n planRelocation,\n relocationContext,\n type RelocateResult,\n type RelocationContext,\n} from \"../core/relocation.js\";\nimport { collectSchemaPins } from \"../core/resolve-schema.js\";\nimport { schemaLoadOptions } from \"../core/schema-registry.js\";\nimport { Validator } from \"../core/validator.js\";\nimport { renderRelocatePretty } from \"../reporters/relocate.js\";\nimport { DocmetaError, type ValidationResult } from \"../types.js\";\n\nexport interface ValidateOfferOptions {\n /** The results as reported: after the baseline, so a suppressed finding is not offered. */\n results: readonly ValidationResult[];\n /** The run's inputs as validate got them, for the config and a created collection's `paths:`. */\n inputs: string[];\n cwd?: string;\n configPath?: string;\n noConfig?: boolean;\n collections?: string[];\n cliSchemas?: string[];\n as?: string;\n respectGitignore?: boolean;\n offline?: boolean;\n env?: NodeJS.ProcessEnv;\n /** The terminal's `Confirm`; absent means no question is put. */\n confirm?: Confirm;\n /** Where the notice and relocate's output go: stderr, from the CLI. */\n output: { write: (chunk: string) => unknown };\n color?: boolean;\n}\n\n/** The files and keys of one collection's findings. */\ninterface Group {\n files: Set<string>;\n keys: Set<string>;\n}\n\n/**\n * Put P2 once per collection with a location finding, and run relocate for\n * each yes. Returns the applied results, in the order they ran.\n */\nexport async function offerRelocation(opts: ValidateOfferOptions): Promise<RelocateResult[]> {\n const { confirm, output } = opts;\n if (confirm === undefined || opts.noConfig === true) return [];\n const findings = opts.results.flatMap((r) =>\n r.file === STDIN_LABEL\n ? []\n : r.errors\n .filter((e) => e.schema === LOCATION_EXTERNAL_SCHEMA || e.schema === LOCATION_PAGE_SCHEMA)\n .flatMap((e) => (e.subject === undefined ? [] : [{ file: r.file, key: e.subject, schema: e.schema }])),\n );\n if (findings.length === 0) return [];\n\n const cwd = opts.cwd ?? process.cwd();\n const run = await resolveRunConfig({\n cwd,\n ...(opts.configPath !== undefined ? { configPath: opts.configPath } : {}),\n inputs: opts.inputs,\n ...(opts.collections !== undefined ? { collections: opts.collections } : {}),\n });\n const validator = new Validator(\n schemaLoadOptions({\n root: run.configDir ?? cwd,\n fileBase: cwd,\n ttlHours: run.config?.schemaCache?.ttlHours,\n offline: opts.offline ?? run.config?.offline,\n pins: collectSchemaPins(run.config),\n registered: run.config?.registered,\n }),\n );\n const ctx: RelocationContext = relocationContext(run, {\n cwd,\n targets: run.fromCollections ? [] : opts.inputs,\n validator,\n ...(opts.cliSchemas !== undefined && opts.cliSchemas.length > 0 ? { cliSchemas: opts.cliSchemas } : {}),\n ...(opts.as !== undefined ? { as: opts.as } : {}),\n ...(opts.respectGitignore !== undefined ? { respectGitignore: opts.respectGitignore } : {}),\n ...(opts.env !== undefined ? { env: opts.env } : {}),\n });\n\n // The collection each finding's value would move within: the one whose\n // manifest holds a `location:page` value, or the home §3 picks for a\n // `location:external` one. A page with no possible home is not offered.\n const groups = new Map<string, Group>();\n for (const f of findings) {\n const home = await keyHome(ctx, f.file, {}, f.key);\n let collection: string | undefined;\n if (f.schema === LOCATION_PAGE_SCHEMA) {\n if (home.kind === \"manifest\") collection = home.collection;\n } else if (home.kind === \"unowned\" && home.home.kind === \"collection\") {\n collection = home.home.collection;\n }\n if (collection === undefined) continue;\n const group = groups.get(collection) ?? { files: new Set<string>(), keys: new Set<string>() };\n group.files.add(f.file);\n group.keys.add(f.key);\n groups.set(collection, group);\n }\n\n const applied: RelocateResult[] = [];\n const say = (message: string): void => {\n output.write(`${programName()}: ${message}\\n`);\n };\n for (const [collection, group] of groups) {\n let plan;\n try {\n plan = await planRelocation(ctx, { files: [...group.files], fields: [...group.keys] });\n } catch (err) {\n // A plan that cannot be made (a manifest path that exists undeclared, a\n // single-tool config) is reported and not offered. The report already\n // stands, and its exit code is not this offer's to change.\n if (!(err instanceof DocmetaError)) throw err;\n say(err.message);\n continue;\n }\n if (plan.writes.length === 0) continue;\n // Only this collection's offer: another's would word changes this question does not cover.\n const offer = plan.offers.find((o) => o.collection === collection);\n if (offer === undefined) continue;\n const { notice, question } = offerPrompt(offer, \"validate\");\n say(notice);\n if (!(await confirm(question))) continue;\n const result = await applyRelocation(ctx, plan);\n output.write(`${renderRelocatePretty(result, { color: opts.color ?? false })}\\n`);\n applied.push(result);\n }\n return applied;\n}\n","/**\n * Reporter for `schemas infer`.\n *\n * The report **is** the product of this command, so the columns are chosen to\n * answer exactly one question each (0010 stress test 1):\n *\n * - **coverage** — require it now (~100%), require it behind a\n * `--write-baseline` ratchet (middling), or do not require it at all (low\n * single digits: one team's convention, not a standard).\n * - **types** — a distribution with counts, so a `string ×900, number ×4` split\n * reads as four data errors rather than as a union worth encoding.\n * - **sample** — what the values actually look like, which is what tells you\n * whether the key means what its name suggests.\n *\n * Files with no metadata block are on their own line rather than folded into a\n * denominator: they pass a require-nothing schema and fail the moment any key\n * becomes required, which is the surprise the report exists to prevent.\n */\nimport type { InferKeyReport, InferResult } from \"../commands/schemas.js\";\nimport { toJsonText } from \"../core/json-text.js\";\nimport { palette } from \"../../shared/color.js\";\n\nexport interface InferReportOptions {\n color?: boolean;\n}\n\n/** Outliers listed inline before the report defers to the count. */\nconst OUTLIERS_SHOWN = 5;\n\n/** Enum values listed in the sample column before it elides the rest. */\nconst ENUM_SHOWN = 3;\n\nconst SAMPLE_WIDTH = 46;\n\n/** Thousands separators, pinned to one locale so output is machine-stable. */\nfunction count(n: number): string {\n return n.toLocaleString(\"en-US\");\n}\n\nfunction percent(n: number): string {\n return `${n.toFixed(1)}%`;\n}\n\nfunction truncate(text: string, width: number): string {\n return text.length <= width ? text : `${text.slice(0, width - 1)}…`;\n}\n\n/** `\"Getting started\"` — JSON spelling, so a string is visibly a string. */\nexport function sampleCell(key: InferKeyReport): string {\n if (key.enumValues) {\n const shown = key.enumValues\n .slice(0, ENUM_SHOWN)\n .map((v) => (typeof v === \"string\" ? v : JSON.stringify(v)));\n if (key.enumValues.length > ENUM_SHOWN) shown.push(\"…\");\n return truncate(shown.join(\" | \"), SAMPLE_WIDTH);\n }\n if (key.sample === undefined) return \"\";\n // `toJsonText`, not `JSON.stringify`, so the `?? \"\"` stays visibly\n // reachable — see there.\n return truncate(toJsonText(key.sample) ?? \"\", SAMPLE_WIDTH);\n}\n\n/** `string`, `string (date)`, `string (7 enum)`, or `string ×900, number ×4`. */\nexport function typesCell(key: InferKeyReport): string {\n if (key.types.length > 1) {\n return key.types.map((t) => `${t.type} ×${count(t.count)}`).join(\", \");\n }\n if (key.enumValues) return `${key.dominantType} (${key.enumValues.length} enum)`;\n if (key.format) return `${key.dominantType} (${key.format})`;\n return key.dominantType;\n}\n\nexport function renderInfer(\n result: InferResult,\n opts: InferReportOptions = {},\n): string {\n const c = palette(opts.color ?? false);\n const lines: string[] = [];\n\n const headline = [\n `${count(result.filesScanned)} file${result.filesScanned === 1 ? \"\" : \"s\"} scanned`,\n ];\n headline.push(\n `${count(result.filesWithoutMetadata)} with no metadata block`,\n );\n if (result.unreadable.length > 0) {\n headline.push(`${count(result.unreadable.length)} unreadable`);\n }\n // Same reason `validate` names it on its summary line: every coverage\n // percentage below is computed over `filesScanned`, so a denominator that\n // quietly shrank moves every number in the report. A key at 100% across the\n // eight files `.gitignore` left is not the same finding as one at 100%\n // across all forty, and the headline is the only place that is visible.\n // Omitted at zero, which is every run in a clean repo.\n if (result.gitignoreSkipped > 0) {\n headline.push(`${count(result.gitignoreSkipped)} skipped by .gitignore`);\n }\n lines.push(headline.join(c.dim(\" · \")));\n\n if (result.keys.length === 0) {\n lines.push(\"\", c.dim(\"No metadata keys found.\"));\n return lines.join(\"\\n\");\n }\n\n const rows = result.keys.map((k) => ({\n key: k.key,\n coverage: percent(k.coverage),\n types: typesCell(k),\n sample: sampleCell(k),\n }));\n const width = (pick: (r: (typeof rows)[number]) => string, head: string) =>\n Math.max(head.length, ...rows.map((r) => pick(r).length));\n const wKey = width((r) => r.key, \"key\");\n const wCov = width((r) => r.coverage, \"coverage\");\n const wTypes = width((r) => r.types, \"types\");\n\n lines.push(\n \"\",\n c.dim(\n `${\"key\".padEnd(wKey)} ${\"coverage\".padStart(wCov)} ${\"types\".padEnd(wTypes)} sample`,\n ),\n );\n for (const r of rows) {\n lines.push(\n `${c.cyan(r.key.padEnd(wKey))} ${r.coverage.padStart(wCov)} ${r.types.padEnd(wTypes)} ${c.dim(r.sample)}`,\n );\n }\n\n if (result.hiddenByMinCoverage > 0) {\n lines.push(\n \"\",\n c.dim(\n `${count(result.hiddenByMinCoverage)} key(s) below --min-coverage are not shown.`,\n ),\n );\n }\n\n const withOutliers = result.keys.filter((k) => k.outlierCount > 0);\n if (withOutliers.length > 0) {\n lines.push(\n \"\",\n c.bold(\"Type outliers — these are data errors, not a union:\"),\n );\n for (const k of withOutliers) {\n for (const o of k.outliers.slice(0, OUTLIERS_SHOWN)) {\n const at = o.line === undefined ? o.file : `${o.file}:${o.line}`;\n lines.push(` ${k.key} ${at} ${o.type} (expected ${k.dominantType})`);\n }\n const rest = k.outlierCount - Math.min(k.outliers.length, OUTLIERS_SHOWN);\n if (rest > 0) lines.push(c.dim(` ${k.key} …and ${count(rest)} more`));\n }\n }\n\n for (const u of result.unreadable) {\n lines.push(\"\", `${c.yellow(\"!\")} ${u.file}: ${u.message}`);\n }\n\n if (result.out !== undefined) {\n const properties = Object.keys(result.draft.properties ?? {}).length;\n lines.push(\n \"\",\n `Wrote a draft schema to ${c.cyan(result.out)} — ${count(properties)} propert${properties === 1 ? \"y\" : \"ies\"}, nothing required.`,\n c.dim(\n \"Nothing is required on purpose: what your docset contains is not the same as what your standard should demand. Promote a key with `validate --write-baseline` behind it.\",\n ),\n );\n }\n\n return lines.join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;AAAA,IACV;AAAA,EACF,CAAC;AAEH,UACG,QAAQ,QAAQ,EAChB;AAAA,IACC;AAAA,EACF,EACC,SAAS,SAAS,qCAAqC,EACvD;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACF,EACC,OAAO,uBAAuB,6BAA6B,EAC3D;AAAA,IACC;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,EAAE,KAAK,IAAI;AAAA,EACb,EACC,OAAO,OAAO,KAAa,YAA8B;AACxD,QAAI;AACF,YAAM,SAAS,MAAM,gBAAgB;AAAA,QACnC;AAAA,QACA,KAAK,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAQb,GAAI,OAAO,QAAQ,WAAW,WAC1B,EAAE,YAAY,QAAQ,OAAO,IAC7B,CAAC;AAAA,QACL,UAAU;AAAA,MACZ,CAAC;AAKD,YAAM,aAAa,OAAO,gBACtB,YACA,OAAO,WACL,sBACA;AACN,cAAQ,OAAO;AAAA,QACb;AAAA,UACE,YAAY,OAAO,GAAG;AAAA,UACtB,gBAAgB,OAAO,IAAI,KAAK,OAAO,KAAK,SAAS,OAAO,YAAY,gBAAgB,EAAE;AAAA,UAC1F,gBAAgB,OAAO,SAAS;AAAA,UAChC,gBAAgB,OAAO,MAAM,KAAK,UAAU;AAAA,UAC5C;AAAA,UACA,UAAU,OAAO,IAAI,QAAQ,OAAO,MAAM;AAAA,QAC5C,EAAE,KAAK,IAAI,IAAI;AAAA,MACjB;AAAA,IACF,SAAS,KAAK;AACZ,WAAK,GAAG;AAAA,IACV;AAAA,EACF,CAAC;AAEH,SAAO;AACT;","names":["notice","text"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cite/core/spell.ts","../src/cite/core/adapt.ts","../src/cite/core/reanchor.ts","../src/cite/core/claims.ts"],"sourcesContent":["/**\n * How a citation reads on a terminal. A pin is sixty-four hex digits and a\n * ciphertext is longer still, so both are abbreviated for a person, and every\n * report and every `add` line abbreviates them the same way.\n */\nimport type { PageLines } from \"../types.js\";\n\n/** `sha256-78af1d33…`, `hmac-sha256-5e0c1a2b…`: the prefix and eight hex digits. */\nexport function shortPin(integrity: string): string {\n const m = /^((?:hmac-)?sha256-)([0-9a-f]{8})/i.exec(integrity);\n const prefix = m?.[1];\n const digits = m?.[2];\n if (prefix === undefined || digits === undefined) return integrity;\n return `${prefix}${digits}…`;\n}\n\n/** The seven characters a person reads a commit by. */\nexport function shortCommit(commit: string): string {\n return commit.slice(0, 7);\n}\n\n/**\n * `~AQx7…:2`: an encrypted source, abbreviated, with its line suffix kept. A\n * plain path is spelled in full, because that is what a reader has to find.\n */\nexport function shortSrc(src: string): string {\n if (!src.startsWith(\"~\")) return src;\n const colon = src.indexOf(\":\");\n const token = colon === -1 ? src : src.slice(0, colon);\n const lines = colon === -1 ? \"\" : src.slice(colon);\n return token.length <= 5 ? src : `${token.slice(0, 5)}…${lines}`;\n}\n\n/** The widest a quoted line of a file is printed at. */\nconst LINE_WIDTH = 60;\n\n/**\n * A line of a file as a report quotes it: whitespace collapsed to single\n * spaces, then sixty characters and an ellipsis. The report is one line, so\n * neither an indented source line nor a long one decides how it reads.\n */\nexport function shortLine(text: string): string {\n const one = text.replace(/\\s+/g, \" \").trim();\n return one.length <= LINE_WIDTH ? one : `${one.slice(0, LINE_WIDTH)}…`;\n}\n\n/**\n * `line 9`, or `lines 9-12`: where on a page a span sits. Every refusal,\n * report and message that names one reads it this way, so `add`, `update`\n * and the reporters spell it once.\n */\nexport function spellAt(lines: PageLines): string {\n return lines.start === lines.end\n ? `line ${String(lines.start)}`\n : `lines ${String(lines.start)}-${String(lines.end)}`;\n}\n\n/** `a`, `a and b`, `a, b and c`: a list as a sentence reads it. */\nexport function listOf(values: readonly string[]): string {\n if (values.length <= 1) return values.join(\"\");\n return `${values.slice(0, -1).join(\", \")} and ${values[values.length - 1] ?? \"\"}`;\n}\n","/**\n * Findings, their messages, and the bridge to meta's `ValidationResult`, so\n * the github/sarif/junit reporters and the baseline ratchet work unchanged.\n *\n * A claim or marker finding sits on the page line a reviewer reads. A finding\n * about the entry itself, `entry-invalid` or a bare pin whose source changed,\n * sits on the entry's own line, in the manifest when one owns it.\n *\n * FieldError: schema \"manni:cite\" (matches BUILTIN_ID, so canonicalSchemaRef\n * leaves it alone), keyword = rule, instancePath \"/citations/N\", subject =\n * id ?? source.integrity, never the claim's pin, so accepting a claim does\n * not reopen baselined findings. `ok` is true iff no error-severity finding.\n *\n * Every message spells the source as the entry spelled it. `resolvedPath`,\n * `commitsSince` and `diff` never enter a message: they are pretty-only\n * fields, shown under `--reveal` and `--show-diff`.\n */\nimport { isAbsolute } from \"node:path\";\nimport { isErrorSeverity, type FieldError, type ValidationResult } from \"../../meta/index.js\";\nimport type {\n CitationFinding,\n CitationResult,\n CiteRule,\n CiteSeverity,\n ClaimEnd,\n PageCitationReport,\n SourceEnd,\n SourceStatus,\n} from \"../types.js\";\nimport { claimLine } from \"./claims.js\";\nimport { parseSrc } from \"./range.js\";\nimport { RULE_ID_PREFIX, ruleId } from \"./severity.js\";\nimport { listOf, shortSrc } from \"./spell.js\";\n\n/** The seven characters a person reads a commit by. */\nfunction short(commit: string): string {\n return commit.slice(0, 7);\n}\n\nfunction plural(n: number, noun: string): string {\n return `${String(n)} ${noun}${n === 1 ? \"\" : \"s\"}`;\n}\n\n/** Whether the entry spelled this source encrypted. */\nfunction citesEncrypted(src: string): boolean {\n try {\n return parseSrc(src).encrypted;\n } catch {\n return false;\n }\n}\n\n/**\n * Why an encrypted source is missing, in words that never name the path. A\n * plain path names its own file, so the bare status says the rest.\n */\nfunction missingMessage(source: SourceEnd): string {\n if (!citesEncrypted(source.src)) return \"missing\";\n switch (source.missingReason) {\n case \"no-key\":\n return \"missing (no encryption key is available to decrypt it)\";\n case \"undecryptable\":\n return \"missing (does not decrypt under the current key)\";\n case \"untracked\":\n return \"missing (no tracked file matches; wrong --root?)\";\n case \"unreadable\":\n case undefined:\n return \"missing\";\n }\n}\n\n/** The one place a source end's message is composed, per status. */\nexport function messageFor(source: SourceEnd): string {\n switch (source.status) {\n case \"current\":\n return \"current\";\n case \"skipped\":\n return \"skipped\";\n case \"moved\":\n // An encrypted source's new path is a ciphertext, abbreviated as the\n // entry's own is: `--reveal` stays the only way to read either.\n return `moved -> ${shortSrc(source.newSrc ?? \"?\")}`;\n case \"moved-ambiguous\": {\n const candidates = source.candidates ?? [];\n return `moved, ${plural(candidates.length, \"candidate\")} (${candidates.map(shortSrc).join(\", \")}); widen the range`;\n }\n case \"changed\": {\n // Where the old first and last line sit now, when the in-range search\n // found each exactly once: the span `update --accept` re-mints at.\n const span = source.newLines === undefined ? \"\" : `; now at lines ${source.newLines}`;\n if (source.commitSha === undefined) return `changed${span}`;\n const at = short(source.commitSha);\n if (source.historyAvailable === false) {\n return `changed (history unavailable: commit ${at} not found; fetch-depth: 0)`;\n }\n if (source.commitsSince === undefined) return `changed since ${at}${span}`;\n return `changed since ${at}, ${plural(source.commitsSince.length, \"commit\")}${span}`;\n }\n case \"never-true\":\n return source.commitSha === undefined\n ? \"never true: the pin does not match at the recorded commit\"\n : `never true: the pin does not match at ${short(source.commitSha)}`;\n case \"missing\":\n return missingMessage(source);\n }\n}\n\n/** `<id>: <text>`, or the text alone for an entry with no id. */\nfunction named(id: string | undefined, text: string): string {\n return id === undefined ? text : `${id}: ${text}`;\n}\n\n/** `line 9`, or `lines 9-10` when the claim covers several. */\nfunction at(spec: string): string {\n return spec.includes(\"-\") ? `lines ${spec}` : `line ${spec}`;\n}\n\n/** The one place a claim end's message is composed, per status. */\nexport function claimMessageFor(result: CitationResult): string {\n const claim = result.claim;\n const id = result.citation.id;\n if (claim === null) return \"\";\n // A marker-anchored claim has no lines of its own; it is judged where the\n // marker's text sits, and that is what the message names.\n const where =\n claim.fileLines ??\n (result.markerLine === undefined ? undefined : String(result.markerLine));\n switch (claim.status) {\n case \"moved\":\n return named(\n id,\n `the claim moved from ${at(where ?? \"?\")} to ${at(claim.newFileLines ?? \"?\")}.`,\n );\n case \"moved-ambiguous\":\n return named(\n id,\n `the claim at ${at(where ?? \"?\")} now appears at lines ${listOf(claim.candidateFileLines ?? [])}.`,\n );\n case \"reanchored\": {\n const since = claim.commitSha === undefined ? \"\" : ` since ${short(claim.commitSha)}`;\n // A claim-lines entry moved onto its new run; a marker-anchored one\n // never moves, because the marker travels with its own text.\n const to =\n claim.newFileLines === undefined ? \"\" : `, to ${at(claim.newFileLines)}`;\n return named(\n id,\n `the claim at ${at(where ?? \"?\")} was reanchored${since}${to}. Its words are unchanged.`,\n );\n }\n case \"changed\":\n if (where === undefined) {\n return named(\n id,\n \"the claim has no lines and no marker names the entry, so its pin anchors nothing.\",\n );\n }\n return named(id, `the claim at ${at(where)} has ${claimChange(claim)}`);\n case \"current\":\n case \"skipped\":\n return \"\";\n }\n}\n\n/** How a changed claim says since when, which is what its history could say. */\nfunction claimChange(claim: ClaimEnd): string {\n if (claim.historyAvailable === false) {\n return \"changed since it was pinned (history unavailable; fetch-depth: 0).\";\n }\n if (claim.commitSha === undefined) return \"changed since it was pinned.\";\n const at = short(claim.commitSha);\n // Zero commits since would read as \"just now\". The working tree holding the\n // change is what it actually means, so it says that.\n const since = claim.commitsSince ?? [];\n const count = since.length === 0 ? \"uncommitted\" : plural(since.length, \"commit\");\n return `changed since ${at}, ${count}.`;\n}\n\n/**\n * The one place a `marker-misplaced` message is composed. A quote marker's\n * place is above the block it anchors; every other marker's is the first line\n * of the paragraph its run splits.\n */\nexport function misplacedMessageFor(\n id: string | undefined,\n marker: { line: number; unit: string; place: number; block: boolean },\n): string {\n const place = marker.block\n ? `above the block at line ${String(marker.place)}`\n : `above line ${String(marker.place)}`;\n return named(\n id,\n `the marker at line ${String(marker.line)} splits the paragraph at ${at(marker.unit)}. Its place is ${place}.`,\n );\n}\n\n/** The rule a source status reports under, or undefined for one that is not a finding. */\nfunction sourceRuleOf(status: SourceStatus): CiteRule | undefined {\n if (status === \"skipped\" || status === \"current\") return undefined;\n return `source-${status}`;\n}\n\n/** The rule a claim status reports under, or undefined. */\nfunction claimRuleOf(claim: ClaimEnd): CiteRule | undefined {\n const status = claim.status;\n if (status === \"skipped\" || status === \"current\") return undefined;\n return `claim-${status}`;\n}\n\n/** Where a finding about a whole entry sits: its own line, in its own file. */\nfunction entrySite(result: CitationResult): Pick<CitationFinding, \"line\" | \"file\"> {\n const site: Pick<CitationFinding, \"line\" | \"file\"> = {};\n if (result.origin.line !== undefined) site.line = result.origin.line;\n if (result.origin.kind === \"manifest\") site.file = result.origin.file;\n return site;\n}\n\n/** Where a finding about an anchored citation sits: the page line it anchors to. */\nfunction anchorSite(result: CitationResult): Pick<CitationFinding, \"line\" | \"file\"> {\n if (result.anchorLine !== undefined) return { line: result.anchorLine };\n return entrySite(result);\n}\n\n/** Findings for classified citations under a severity table; `off` rules produce none. */\nexport function findingsFor(\n results: readonly CitationResult[],\n severity: Readonly<Record<CiteRule, CiteSeverity>>,\n): CitationFinding[] {\n const out: CitationFinding[] = [];\n const push = (\n result: CitationResult,\n rule: CiteRule,\n message: string,\n site: Pick<CitationFinding, \"line\" | \"file\">,\n extra?: Pick<CitationFinding, \"newSrc\">,\n ): void => {\n const level = severity[rule];\n if (level === \"off\") return;\n const finding: CitationFinding = {\n rule,\n ruleId: ruleId(rule),\n severity: level,\n message,\n src: result.source.src,\n index: result.origin.index,\n };\n if (site.line !== undefined) finding.line = site.line;\n if (site.file !== undefined) finding.file = site.file;\n if (result.citation.id !== undefined) finding.id = result.citation.id;\n if (extra?.newSrc !== undefined) finding.newSrc = extra.newSrc;\n out.push(finding);\n };\n\n for (const result of results) {\n const claim = result.claim;\n if (claim !== null) {\n const rule = claimRuleOf(claim);\n // A claim pin that anchors nothing has no page line to sit on.\n if (rule !== undefined) {\n const site =\n claimLine(claim) === undefined && result.markerLine === undefined\n ? entrySite(result)\n : { line: claimLine(claim) ?? result.markerLine };\n push(result, rule, claimMessageFor(result), site);\n }\n }\n const rule = sourceRuleOf(result.source.status);\n if (rule === undefined) continue;\n const extra =\n result.source.newSrc === undefined ? undefined : { newSrc: result.source.newSrc };\n push(result, rule, messageFor(result.source), anchorSite(result), extra);\n }\n return out;\n}\n\n/**\n * The pin of the citation a finding is about, for the fingerprint subject of\n * an entry with no id. Always the source's: accepting a changed claim must\n * not reopen a baselined finding.\n */\nfunction integrityFor(\n finding: CitationFinding,\n results: readonly CitationResult[],\n): string | undefined {\n if (finding.index === undefined) return undefined;\n return results.find((r) => r.origin.index === finding.index)?.citation.source.integrity;\n}\n\n/**\n * Where a finding is located once it becomes a `FieldError`: the page, or\n * the manifest the entry sits in.\n *\n * A manifest outside the repository has no location any reporter can use —\n * SARIF drops a uri that rebases to `../…`, and a GitHub annotation on one\n * lands nowhere — so the finding falls back to the page, and its line goes\n * with the file it belonged to. Inside the tree, both travel, and `file`\n * is what every reporter reads to annotate the manifest instead.\n */\nexport function errorSite(\n finding: CitationFinding,\n): Pick<CitationFinding, \"line\" | \"file\"> {\n if (finding.file === undefined) {\n return finding.line === undefined ? {} : { line: finding.line };\n }\n if (finding.file.startsWith(\"../\") || isAbsolute(finding.file)) return {};\n return {\n file: finding.file,\n ...(finding.line === undefined ? {} : { line: finding.line }),\n };\n}\n\nexport function toValidationResult(report: PageCitationReport): ValidationResult {\n const errors: FieldError[] = report.findings.map((finding) => {\n const error: FieldError = {\n schema: RULE_ID_PREFIX,\n instancePath: finding.index === undefined ? \"\" : `/citations/${String(finding.index)}`,\n message: finding.message,\n keyword: finding.rule,\n severity: finding.severity,\n };\n const subject = finding.id ?? integrityFor(finding, report.citations);\n if (subject !== undefined) error.subject = subject;\n const site = errorSite(finding);\n if (site.file !== undefined) error.file = site.file;\n if (site.line !== undefined) error.line = site.line;\n return error;\n });\n return {\n file: report.file,\n format: report.format,\n ok: !errors.some(isErrorSeverity),\n schemas: [RULE_ID_PREFIX],\n errors,\n };\n}\n","/**\n * Misplaced markers, and what to do about them. Proposal 0054 is the record.\n *\n * A **marker run** is one or more consecutive lines that each hold one marker\n * and nothing else. A run is **misplaced** when the line directly above it and\n * the line directly below it are both unit text: deleting the run would join\n * them into one paragraph. Such a marker splits the paragraph for the renderer\n * and for the tool, and the lines above it are anchored by nothing.\n *\n * A misplaced marker belongs where `add --marker` writes one: above the first\n * line of the unit, or, for a `quote: true` entry, above the block it anchors.\n * A run moves in its own order, so two markers that were stacked stay stacked.\n *\n * The claim of a marker-anchored entry is read against three spans, in order:\n * the unit the marker belongs to, the span it anchors now, and the span it was\n * pinned over before PR #43 (marker lines included, down to the next blank\n * line or fence). The second or third holding means the pinned text is on the\n * page and the marker anchors a different span: `claim-moved`.\n */\nimport type { ClaimEnd, PageCitation, PageCitations, PageLines } from \"../types.js\";\nimport { hashLines } from \"./hash.js\";\nimport { MAX_MARKERS_PER_PAGE } from \"./page.js\";\nimport { spellLines } from \"../../shared/pin.js\";\nimport { ANY_FENCE, anchoredLines, isBoundLine, isMarkerLine } from \"./statements.js\";\n\n/** Whether a line is text a paragraph is made of. */\nexport function isUnitText(line: string | undefined, format: string): boolean {\n if (line === undefined) return false;\n if (line.trim() === \"\") return false;\n if (ANY_FENCE.test(line)) return false;\n if (isMarkerLine(line, format)) return false;\n return !isBoundLine(line, format);\n}\n\n/** Whether the file line `n` holds one marker and nothing else. */\nfunction markerAt(lines: readonly string[], n: number, format: string): boolean {\n const line = lines[n - 1];\n return line !== undefined && isMarkerLine(line, format);\n}\n\n/** The run of marker-only lines that holds `line`. */\nexport function markerRunAt(\n lines: readonly string[],\n line: number,\n format: string,\n bodyLine: number,\n): PageLines {\n let start = line;\n while (start - 1 >= bodyLine && markerAt(lines, start - 1, format)) start--;\n let end = line;\n while (end + 1 <= lines.length && markerAt(lines, end + 1, format)) end++;\n return { start, end };\n}\n\n/**\n * The paragraph a run splits, in file lines, marker lines included.\n * `undefined` when the run sits where `add` writes markers: after a blank\n * line, a fence, a bound line, or the body's first line.\n */\nexport function splitUnit(\n lines: readonly string[],\n run: PageLines,\n format: string,\n bodyLine: number,\n): PageLines | undefined {\n if (run.start - 1 < bodyLine) return undefined;\n if (!isUnitText(lines[run.start - 2], format)) return undefined;\n if (!isUnitText(lines[run.end], format)) return undefined;\n let start = run.start - 1;\n while (start - 1 >= bodyLine && isUnitText(lines[start - 2], format)) start--;\n let end = run.end + 1;\n while (end + 1 <= lines.length && isUnitText(lines[end], format)) end++;\n return { start, end };\n}\n\n/**\n * The span a marker was pinned over before PR #43: from the line below it\n * through the next blank line or fence, marker lines included. `undefined`\n * when the line below is blank or a fence, so the old reading covered nothing.\n */\nexport function pre43Span(\n lines: readonly string[],\n markerLine: number,\n): PageLines | undefined {\n const start = markerLine + 1;\n const first = lines[start - 1];\n if (first === undefined || first.trim() === \"\" || ANY_FENCE.test(first)) return undefined;\n let end = start;\n while (end + 1 <= lines.length) {\n const next = lines[end];\n if (next === undefined || next.trim() === \"\" || ANY_FENCE.test(next)) break;\n end++;\n }\n return { start, end };\n}\n\n/** One marker line that splits a paragraph. */\nexport interface MisplacedMarker {\n /** File line of the marker. */\n line: number;\n /** The whole run of marker-only lines it belongs to. */\n run: PageLines;\n /** Its position in that run, counted from zero, so stacked markers keep their order. */\n order: number;\n /** The paragraph the run splits, in file lines as the page reads now. */\n unit: PageLines;\n /** The file line the marker belongs above. */\n place: number;\n /** Whether `place` is a fenced block the entry quotes rather than the unit's first line. */\n block: boolean;\n /** The file line the marker takes once the whole run has moved. */\n to: number;\n /** The entry the marker names, when one is anchored by it. */\n entry?: PageCitation;\n}\n\n/** The lines of a run, which is `end - start + 1` markers. */\nfunction runLength(run: PageLines): number {\n return run.end - run.start + 1;\n}\n\n/** Whether a misplaced marker at `line` splits a paragraph, and where it belongs. */\nexport function misplacedMarkerAt(\n page: PageCitations,\n lines: readonly string[],\n line: number,\n entry?: PageCitation,\n): MisplacedMarker | undefined {\n if (!markerAt(lines, line, page.format)) return undefined;\n const run = markerRunAt(lines, line, page.format, page.bodyLine);\n const unit = splitUnit(lines, run, page.format, page.bodyLine);\n if (unit === undefined) return undefined;\n const order = line - run.start;\n const quote = entry?.citation.quote === true;\n const marker = entry?.marker;\n const blockAt =\n quote && marker !== undefined\n ? anchoredLines(page.content, marker.end, page.format, true)?.start\n : undefined;\n const out: MisplacedMarker = blockAt === undefined\n ? { line, run, order, unit, place: unit.start, block: false, to: unit.start + order }\n : {\n line,\n run,\n order,\n unit,\n place: blockAt,\n block: true,\n to: blockAt - runLength(run) + order,\n };\n if (entry !== undefined) out.entry = entry;\n return out;\n}\n\n/**\n * Every misplaced marker on a page, in the order the page reads. An orphan,\n * repeated or invalid marker is reported like any other: it splits the\n * paragraph whether or not it names an entry.\n */\nexport function misplacedMarkers(\n page: PageCitations,\n lines: readonly string[],\n): MisplacedMarker[] {\n const out: MisplacedMarker[] = [];\n for (const statement of page.statements.slice(0, MAX_MARKERS_PER_PAGE)) {\n const entry = page.citations.find((c) => c.marker?.line === statement.line);\n const found = misplacedMarkerAt(page, lines, statement.line, entry);\n if (found !== undefined) out.push(found);\n }\n return out;\n}\n\n/**\n * The span the pin covers once a misplaced run has moved: the joined unit,\n * pushed down by the markers now above it. A quote marker's pin covers its\n * block, which no move touches, so this is never asked of one.\n */\nexport function movedUnit(misplaced: MisplacedMarker): PageLines {\n return { start: misplaced.unit.start + runLength(misplaced.run), end: misplaced.unit.end };\n}\n\n/** The unit's text, the run's marker lines left out: what the pin covers after the move. */\nexport function unitText(lines: readonly string[], misplaced: MisplacedMarker): string[] {\n const { unit, run } = misplaced;\n const out: string[] = [];\n for (let n = unit.start; n <= unit.end; n++) {\n if (n >= run.start && n <= run.end) continue;\n const line = lines[n - 1];\n if (line !== undefined) out.push(line);\n }\n return out;\n}\n\n/** One marker line a rewrite moves, and the file line it goes above. */\nexport interface MarkerMove {\n from: number;\n place: number;\n}\n\n/** A page with its markers moved, and where its lines went. */\nexport interface MovedPage {\n content: string;\n /** The new file line of an old one. */\n line(old: number): number;\n}\n\n/** A page split into line texts and the terminator each position carries. */\nfunction splitKeepingEol(content: string): { texts: string[]; eols: string[] } {\n const parts = content.match(/[^\\n]*\\n|[^\\n]+$/g) ?? [];\n const texts: string[] = [];\n const eols: string[] = [];\n for (const part of parts) {\n const eol = /\\r?\\n$/.exec(part)?.[0] ?? \"\";\n texts.push(part.slice(0, part.length - eol.length));\n eols.push(eol);\n }\n return { texts, eols };\n}\n\n/**\n * The page with each named marker line lifted out and written above its place,\n * in the order the moves are given, so a run that was stacked stays stacked.\n * A moved marker takes the indentation `add` would write it at, and the file's\n * terminators stay where they are: the lines are permuted, never re-joined.\n *\n * Read the join carefully. A line's text comes from where it was, and its\n * terminator from where it now sits. That asymmetry is deliberate: the last\n * position of a page with no final newline carries no terminator, and it has\n * to stay the last position. Were terminators to travel with their lines, a\n * move that lifted that last line would carry the missing terminator into the\n * middle of the page and glue two lines together.\n *\n * The cost is that a page mixing `\\r\\n` and `\\n` has the endings of the two\n * swapped positions trade places. No byte is gained or lost, and the file\n * still ends as it began. A uniform page, which is what a checkout gives,\n * cannot tell the difference.\n */\nexport function applyMarkerMoves(\n content: string,\n moves: readonly MarkerMove[],\n indentAt: (line: number) => string,\n): MovedPage {\n const { texts, eols } = splitKeepingEol(content);\n const moving = new Set(moves.map((move) => move.from));\n const inserts = new Map<number, number[]>();\n for (const move of moves) {\n const list = inserts.get(move.place) ?? [];\n list.push(move.from);\n inserts.set(move.place, list);\n }\n const order: number[] = [];\n for (let n = 1; n <= texts.length; n++) {\n for (const from of inserts.get(n) ?? []) order.push(from);\n if (!moving.has(n)) order.push(n);\n }\n const moved = new Map<number, string>();\n for (const move of moves) {\n moved.set(move.from, indentAt(move.place) + (texts[move.from - 1] ?? \"\").trim());\n }\n const at = new Map<number, number>();\n order.forEach((old, index) => at.set(old, index + 1));\n const out = order\n .map((old, index) => (moved.get(old) ?? texts[old - 1] ?? \"\") + (eols[index] ?? \"\"))\n .join(\"\");\n return { content: out, line: (old) => at.get(old) ?? old };\n}\n\n/** The plain pin of a span of lines, or of an explicit list of them. */\nfunction pinOf(lines: readonly string[], span: PageLines): string | undefined {\n if (span.start < 1 || span.end > lines.length || span.end < span.start) return undefined;\n return hashLines(lines.slice(span.start - 1, span.end).join(\"\\n\"));\n}\n\n/**\n * The claim end of a marker-anchored entry, read against proposal 0054's\n * three spans. `misplaced` is the marker's misplacement, when it has one.\n *\n * For a misplaced marker at `moved`, `fileLines` is the span that held and\n * `newLines` the span the pin will cover once the marker moves. Both are file\n * lines: a marker-anchored claim has no body lines of its own.\n */\nexport function markerClaimEnd(\n page: PageCitations,\n entry: PageCitation,\n lines: readonly string[],\n misplaced: MisplacedMarker | undefined,\n): ClaimEnd {\n const { citation, marker } = entry;\n const pin = citation.claim?.integrity;\n const quote = citation.quote === true;\n if (marker === undefined || pin === undefined) return { status: \"changed\" };\n const current = anchoredLines(page.content, marker.end, page.format, quote);\n if (current === undefined) return { status: \"changed\" };\n\n /** The claim end this span reads as, and where the move will take it. */\n const claimAt = (span: PageLines, status: ClaimEnd[\"status\"], to?: PageLines): ClaimEnd => {\n const end: ClaimEnd = { fileLines: spellLines(span), status };\n if (to !== undefined) {\n end.newLines = spellLines(to);\n end.newFileLines = end.newLines;\n }\n if (status === \"changed\") end.text = lines.slice(span.start - 1, Math.min(span.end, lines.length));\n return end;\n };\n\n // A quote marker's pin covers its block, which no move touches, and the\n // block reading never changed, so there is one span to read it against.\n if (quote) {\n return claimAt(current, pinOf(lines, current) === pin ? \"current\" : \"changed\");\n }\n\n if (misplaced !== undefined) {\n const to = movedUnit(misplaced);\n if (hashLines(unitText(lines, misplaced).join(\"\\n\")) === pin) return claimAt(to, \"current\");\n if (pinOf(lines, current) === pin) return claimAt(current, \"moved\", to);\n const pre43 = pre43Span(lines, marker.line);\n if (pre43 !== undefined && pinOf(lines, pre43) === pin) return claimAt(pre43, \"moved\", to);\n return claimAt(current, \"changed\");\n }\n\n if (pinOf(lines, current) === pin) return claimAt(current, \"current\");\n // Stacked markers written before PR #43 were pinned over a sibling marker\n // line and the paragraph. That renders fine, so only the pin is repaired.\n const pre43 = pre43Span(lines, marker.line);\n if (pre43 !== undefined && pinOf(lines, pre43) === pin) return claimAt(pre43, \"moved\", current);\n return claimAt(current, \"changed\");\n}\n","/**\n * The claim end: the page text a citation supports, classified by the same\n * machinery as the source end and against the page as it is now.\n *\n * The claim's lines are body-relative, so editing the frontmatter never moves\n * them; every line a person reads is a file line, translated here. The pin\n * holds at the recorded lines: `current`. The same text is found verbatim\n * elsewhere in the body: `moved`, once, or `moved-ambiguous`. Nowhere:\n * `changed`, the sentence was edited. A marker-anchored claim pins what the\n * marker anchors, so its text never moves on the page; it is `current`,\n * `changed`, or, when the pin holds over a span the marker no longer anchors,\n * `moved`. `src/cite/core/reanchor.ts` reads those spans.\n */\nimport type {\n ClaimEnd,\n PageCitation,\n PageCitations,\n PageLines,\n} from \"../types.js\";\nimport {\n findWindows,\n parseLines,\n pinOfLines,\n spellLines,\n toBodyLines,\n toFileLines,\n} from \"../../shared/pin.js\";\nimport {\n markerClaimEnd,\n misplacedMarkerAt,\n type MisplacedMarker,\n} from \"./reanchor.js\";\nimport {\n anchoredLines,\n fenceAround,\n fenceSpanAt,\n isMarkerLine,\n isTableRow,\n isTableSeparator,\n lineAt,\n offsetOfLine,\n paragraphAfter,\n} from \"./statements.js\";\n\n// The line translation and the claim pin are the shared pin engine's; this path keeps cite's imports working.\nexport { pinOfLines, toBodyLines, toFileLines } from \"../../shared/pin.js\";\n\nexport function normalizeWhitespace(text: string): string {\n return text.replace(/\\s+/g, \" \").trim();\n}\n\n/**\n * The hashing rule's normalization for a whole quoted block: one BOM, CRLF →\n * LF, and one trailing LF dropped. It differs from the shared `normalizeText`\n * only in that last step, because a quote is compared as one joined block\n * rather than split into lines first.\n */\nfunction normalizeBlock(text: string): string {\n let out = text.charCodeAt(0) === 0xfeff ? text.slice(1) : text;\n out = out.replace(/\\r\\n/g, \"\\n\");\n return out.endsWith(\"\\n\") ? out.slice(0, -1) : out;\n}\n\n/** `true` when the block's normalized text equals the cited lines under the hashing rule. */\nexport function blockMatches(blockText: string, citedJoined: string): boolean {\n return normalizeBlock(blockText) === normalizeBlock(citedJoined);\n}\n\n/** The page lines a range covers, as far as the page reaches. */\nfunction textAt(lines: readonly string[], range: PageLines): string[] {\n return lines.slice(range.start - 1, Math.min(range.end, lines.length));\n}\n\n/** The first file line of a classified claim: where its findings sit. */\nexport function claimLine(claim: ClaimEnd): number | undefined {\n const at = claim.fileLines === undefined ? undefined : parseLines(claim.fileLines);\n return at?.start;\n}\n\n/** Where the claim is now: the moved-to lines when it moved, else the recorded ones. */\nexport function claimLineNow(claim: ClaimEnd): number | undefined {\n const spec = claim.newFileLines ?? claim.candidateFileLines?.[0] ?? claim.fileLines;\n const at = spec === undefined ? undefined : parseLines(spec);\n return at?.start;\n}\n\n/** The file lines the claim occupies now, for the quote check. */\nexport function claimLinesNow(claim: ClaimEnd): PageLines | undefined {\n const spec = claim.newFileLines ?? claim.candidateFileLines?.[0] ?? claim.fileLines;\n return spec === undefined ? undefined : parseLines(spec);\n}\n\n/**\n * Classify one entry's claim end against the page. `lines` is the page under\n * the hashing rule (`splitLines`). `null` for an entry with no `claim`: a\n * bare pin, or a marker with no drift check on its sentence.\n */\nexport function claimEnd(\n page: PageCitations,\n entry: PageCitation,\n lines: readonly string[],\n misplaced?: MisplacedMarker,\n): ClaimEnd | null {\n const { citation, marker } = entry;\n const claim = citation.claim;\n if (claim === undefined) return null;\n const body = page.bodyLine;\n\n if (claim.lines !== undefined) {\n const recorded = parseLines(claim.lines);\n // An unreadable range is `entry-invalid`, and that entry is never classified.\n if (recorded === undefined) return { status: \"skipped\" };\n const file = toFileLines(recorded, body);\n const end: ClaimEnd = {\n lines: spellLines(recorded),\n fileLines: spellLines(file),\n status: \"changed\",\n };\n // Lines and a marker both: `anchor-invalid`, and neither anchor is judged.\n if (marker !== undefined) return { ...end, status: \"skipped\" };\n if (pinOfLines(lines, file) === claim.integrity) return { ...end, status: \"current\" };\n\n const width = recorded.end - recorded.start + 1;\n const found = findWindows(lines.slice(body - 1), width, claim.integrity, undefined, {\n around: recorded.start,\n });\n const spans = found.starts.map((start) => ({ start, end: start + width - 1 }));\n const [only] = spans;\n if (spans.length === 1 && only !== undefined) {\n return {\n ...end,\n status: \"moved\",\n newLines: spellLines(only),\n newFileLines: spellLines(toFileLines(only, body)),\n };\n }\n if (spans.length > 1) {\n return {\n ...end,\n status: \"moved-ambiguous\",\n candidates: spans.map(spellLines),\n candidateFileLines: spans.map((span) => spellLines(toFileLines(span, body))),\n };\n }\n return { ...end, text: textAt(lines, file) };\n }\n\n if (marker !== undefined) {\n // The marker travels with its text, so what moves is the span the marker\n // anchors, not the text. `reanchor.ts` reads the three spans.\n return markerClaimEnd(\n page,\n entry,\n lines,\n misplaced ?? misplacedMarkerAt(page, lines, marker.line, entry),\n );\n }\n\n // A claim pin with neither lines nor a marker anchors nothing at all.\n return { status: \"changed\" };\n}\n\n/**\n * Where else in the body the claim's text sits, as file lines. A claim whose\n * text repeats is `moved-ambiguous` the moment it moves, so `add` says so\n * while the pin is still being written, and `update --accept` says so before\n * it mints a pin that cannot tell two copies apart. The search is the\n * classifier's own.\n */\nexport function otherClaimSpans(\n lines: readonly string[],\n pageLines: PageLines,\n pin: string,\n bodyLine: number,\n): PageLines[] {\n const width = pageLines.end - pageLines.start + 1;\n const found = findWindows(lines.slice(bodyLine - 1), width, pin, undefined, {\n around: toBodyLines(pageLines, bodyLine).start,\n });\n return found.starts\n .map((start) => toFileLines({ start, end: start + width - 1 }, bodyLine))\n .filter((span) => span.start !== pageLines.start);\n}\n\n/** How many other locations a notice names before it starts counting them. */\nconst NAMED_SPANS = 3;\n\n/** `line 17`, `lines 16 and 18`, `lines 16, 18, 20 and 2 more`. */\nexport function spellElsewhere(spans: readonly PageLines[]): string {\n const first = spans[0];\n const noun = spans.length === 1 && first !== undefined && first.start === first.end ? \"line\" : \"lines\";\n const named = spans.slice(0, NAMED_SPANS).map((span) => spellLines(span));\n const rest = spans.length - named.length;\n if (rest > 0) return `${noun} ${named.join(\", \")} and ${String(rest)} more`;\n const last = named.pop() ?? \"\";\n return named.length === 0 ? `${noun} ${last}` : `${noun} ${named.join(\", \")} and ${last}`;\n}\n\n/**\n * What `update --accept` re-pins over: the paragraph, whole fenced block, or\n * lines inside a fenced block at a line.\n *\n * The three kinds are not interchangeable. `\"block\"` covers a fence, its\n * content and its closing fence, which is the only shape a `quote: true`\n * entry may hold. `\"fenced-lines\"` covers content lines inside a block and\n * neither fence, which is what a claim minted over part of a code sample\n * holds. `\"paragraph\"` covers prose, and table rows too, since `ClaimUnit`\n * draws no line between them.\n */\nexport interface ClaimUnit {\n lines: PageLines;\n kind: \"paragraph\" | \"block\" | \"fenced-lines\";\n text: string[];\n}\n\n/**\n * Why no unit sits at a file line. Each one is a different problem with a\n * different repair, so `update --accept` names which it hit rather than\n * leaving the entry skipped with no reason.\n */\nexport type NoUnit =\n | \"outside\"\n | \"blank\"\n | \"fence-crossed\"\n | \"marker\"\n | \"not-a-paragraph\"\n | \"table-short\"\n | \"table-rule\";\n\n/**\n * The span a claim of the recorded width holds at a line. A unit whose extent\n * is the author's, rather than the page's, keeps the number of lines it was\n * minted over: table rows and lines inside a fenced block both. One recorded\n * line gives one line, and five give five.\n */\nfunction spanOf(line: number, recorded: PageLines | undefined): PageLines {\n const width = recorded === undefined ? 1 : Math.max(1, recorded.end - recorded.start + 1);\n return { start: line, end: line + width - 1 };\n}\n\n/**\n * The rows a claim on a table re-pins over, or why there are none.\n *\n * A row is a statement, so a claim over N rows is a claim over N statements.\n * The extent is the author's, and re-pinning re-mints the hash over it rather\n * than redesigning it: one recorded line gives one row, and five give five.\n * Rows below a one-line claim are other statements, and a table that no longer\n * reaches the recorded end is a question only the author can answer.\n *\n * The unit comes back as `kind: \"paragraph\"`, since `ClaimUnit` names how a\n * unit is bounded and not what it holds. A caller wanting to know whether it\n * holds rows has to ask `isTableRow` about the text, not read `kind`.\n *\n * A span of nothing but `|---|---|` rules is refused. Those lines carry no\n * words, so a pin over them says nothing about what the page claims, and a\n * claim that shifted onto one is a claim the page lost. A header, its rule and\n * a body row is three rows and keeps all three.\n */\nfunction rowsAt(\n line: number,\n lines: readonly string[],\n recorded: PageLines | undefined,\n named: boolean,\n): ClaimUnit | NoUnit {\n const end = spanOf(line, recorded).end;\n if (end > lines.length) return \"table-short\";\n for (let n = line; n <= end; n++) {\n if (!isTableRow(lines[n - 1] ?? \"\")) return \"table-short\";\n }\n const text = lines.slice(line - 1, end);\n if (!named && text.every((row) => isTableSeparator(row))) return \"table-rule\";\n return { lines: { start: line, end }, kind: \"paragraph\", text };\n}\n\n/**\n * The unit at a file line, or why there is none. `unitAt` and `noUnitAt` are\n * the two halves a caller reads, so the guards are written once. `recorded` is\n * the span the claim holds now, which only a table reads. `named` is the\n * operator having named the entry with `--only`: the structural refusals a\n * blanket accept would hit are the ones they have looked at, so they stand\n * down and the line is read as the text it is.\n */\nfunction unitOrWhy(\n page: PageCitations,\n line: number,\n lines: readonly string[],\n recorded?: PageLines,\n named = false,\n): ClaimUnit | NoUnit {\n if (line < page.bodyLine || line > lines.length) return \"outside\";\n const own = lines[line - 1] ?? \"\";\n if (own.trim() === \"\") return \"blank\";\n // A line that is one marker and nothing else is another entry's anchor, not\n // claim text. Reading it as text is how a shifted claim gets a confident pin\n // over a comment.\n const marker = isMarkerLine(own, page.format);\n if (marker && !named) return \"marker\";\n const block = fenceSpanAt(page.content, line, page.format);\n if (block !== undefined) {\n return { lines: block, kind: \"block\", text: lines.slice(block.start - 1, block.end) };\n }\n const around = fenceAround(page.content, page.bodyOffset, line, page.format);\n if (around !== undefined) {\n // The claim was minted over lines inside this block, so it is re-pinned\n // over as many lines as it recorded, at the line it starts on. Re-pinning\n // the block around them would widen what the pin covers, which is the one\n // thing an accept may never do. A span reaching the closing fence, or past\n // it, is not lines inside a block at all, and stays refused.\n const span = spanOf(line, recorded);\n return span.end < around.end\n ? { lines: span, kind: \"fenced-lines\", text: lines.slice(span.start - 1, span.end) }\n : \"fence-crossed\";\n }\n // A table row is a statement of its own, and nothing between two rows ends a\n // paragraph, so the walk below would read the rest of the table as one.\n if (isTableRow(own)) return rowsAt(line, lines, recorded, named);\n // The format ends the paragraph at a marker under it, so a re-pin never\n // swallows another entry's anchor. A named entry sitting on a marker is read\n // without it, because there the marker is the line being accepted.\n const paragraph = paragraphAfter(\n page.content,\n offsetOfLine(page.content, line),\n marker ? undefined : page.format,\n );\n if (paragraph === undefined || paragraph.line !== line) return \"not-a-paragraph\";\n const span: PageLines = { start: line, end: lineAt(page.content, paragraph.end) };\n return { lines: span, kind: \"paragraph\", text: lines.slice(span.start - 1, span.end) };\n}\n\n/**\n * The paragraph, fenced block, fenced lines or table rows at a file line.\n * Undefined when the line holds no claim at all: it is blank, outside the\n * body, another entry's marker, a table rule, or a line whose claim runs out\n * of the fenced block it starts in. Those are the claims `update --accept`\n * skips, and `noUnitAt` says which of them it is.\n *\n * A paragraph runs from this line to its end, not from the paragraph's own\n * first line. The line asked about is the claim's first line, and re-pinning\n * has to leave that where it is, so a claim that started mid-paragraph keeps\n * starting there. A paragraph that gained a sentence gained it as part of the\n * same statement, which is why a claim grows with it.\n *\n * A table does not work that way. Each row is a statement, so a claim keeps\n * the number of rows `recorded` gives it, and refuses when the table no longer\n * reaches that far. Callers that know the claim's current span pass it.\n */\nexport function unitAt(\n page: PageCitations,\n line: number,\n lines: readonly string[],\n recorded?: PageLines,\n named = false,\n): ClaimUnit | undefined {\n const found = unitOrWhy(page, line, lines, recorded, named);\n return typeof found === \"string\" ? undefined : found;\n}\n\n/** Why `unitAt` found nothing at a file line, or undefined when it found a unit. */\nexport function noUnitAt(\n page: PageCitations,\n line: number,\n lines: readonly string[],\n recorded?: PageLines,\n named = false,\n): NoUnit | undefined {\n const found = unitOrWhy(page, line, lines, recorded, named);\n return typeof found === \"string\" ? found : undefined;\n}\n\n/** The lines a marker anchors now, for `update --accept` on a marker-anchored claim. */\nexport function markerUnit(\n page: PageCitations,\n entry: PageCitation,\n lines: readonly string[],\n): ClaimUnit | undefined {\n const { marker, citation } = entry;\n if (marker === undefined) return undefined;\n const span = anchoredLines(page.content, marker.end, page.format, citation.quote === true);\n if (span === undefined || span.end > lines.length) return undefined;\n return {\n lines: span,\n kind: citation.quote === true ? \"block\" : \"paragraph\",\n text: lines.slice(span.start - 1, span.end),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQO,SAAS,SAAS,WAA2B;AAClD,QAAM,IAAI,qCAAqC,KAAK,SAAS;AAC7D,QAAM,SAAS,IAAI,CAAC;AACpB,QAAM,SAAS,IAAI,CAAC;AACpB,MAAI,WAAW,UAAa,WAAW,OAAW,QAAO;AACzD,SAAO,GAAG,MAAM,GAAG,MAAM;AAC3B;AAGO,SAAS,YAAY,QAAwB;AAClD,SAAO,OAAO,MAAM,GAAG,CAAC;AAC1B;AAMO,SAAS,SAAS,KAAqB;AAC5C,MAAI,CAAC,IAAI,WAAW,GAAG,EAAG,QAAO;AACjC,QAAM,QAAQ,IAAI,QAAQ,GAAG;AAC7B,QAAM,QAAQ,UAAU,KAAK,MAAM,IAAI,MAAM,GAAG,KAAK;AACrD,QAAM,QAAQ,UAAU,KAAK,KAAK,IAAI,MAAM,KAAK;AACjD,SAAO,MAAM,UAAU,IAAI,MAAM,GAAG,MAAM,MAAM,GAAG,CAAC,CAAC,SAAI,KAAK;AAChE;AAGA,IAAM,aAAa;AAOZ,SAAS,UAAU,MAAsB;AAC9C,QAAM,MAAM,KAAK,QAAQ,QAAQ,GAAG,EAAE,KAAK;AAC3C,SAAO,IAAI,UAAU,aAAa,MAAM,GAAG,IAAI,MAAM,GAAG,UAAU,CAAC;AACrE;AAOO,SAAS,QAAQ,OAA0B;AAChD,SAAO,MAAM,UAAU,MAAM,MACzB,QAAQ,OAAO,MAAM,KAAK,CAAC,KAC3B,SAAS,OAAO,MAAM,KAAK,CAAC,IAAI,OAAO,MAAM,GAAG,CAAC;AACvD;AAGO,SAAS,OAAO,Q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