@hawkeyexl/manni 4.20.1 → 4.22.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-J626LZ22.js → batch-C3NN2YXB.js} +20 -21
- package/dist/build-CEVEAHN7.js +36 -0
- package/dist/calibrate-CSKPY5AK.js +42 -0
- package/dist/capture-3HDBIHH6.js +37 -0
- package/dist/check-555TCJGF.js +45 -0
- package/dist/check-KGJBV42O.js +30 -0
- package/dist/{check-RCSQARQE.js → check-KXWHSCCR.js} +13 -16
- package/dist/check-MZSXCS2M.js +33 -0
- package/dist/{check-PQ7S5I3I.js → check-QNHLTYPN.js} +23 -23
- package/dist/{chunk-YIHIRMXN.js → chunk-2VLZDU4E.js} +5 -5
- package/dist/{chunk-D54BQM5P.js → chunk-37Q7WEJJ.js} +9 -9
- package/dist/{chunk-QSPH4F56.js → chunk-3ZVRGBK6.js} +5 -5
- package/dist/chunk-3ZVRGBK6.js.map +1 -0
- package/dist/{chunk-P5DWBG6T.js → chunk-46MMIJWR.js} +3 -3
- package/dist/{chunk-P6XZ44C2.js → chunk-4LYVTR2T.js} +4 -4
- package/dist/{chunk-ODSIHEIW.js → chunk-562QZKAB.js} +6599 -3508
- package/dist/chunk-562QZKAB.js.map +1 -0
- package/dist/{chunk-ACJUZFRT.js → chunk-57LZPG4V.js} +29 -4
- package/dist/chunk-57LZPG4V.js.map +1 -0
- package/dist/chunk-5LQX57BW.js +100 -0
- package/dist/chunk-5LQX57BW.js.map +1 -0
- package/dist/{chunk-MPXMQGJI.js → chunk-63EQKVNT.js} +45 -910
- package/dist/chunk-63EQKVNT.js.map +1 -0
- package/dist/{chunk-6FY573GB.js → chunk-64DULZIG.js} +4 -4
- package/dist/{chunk-TAJYMXMM.js → chunk-6SVHI2U6.js} +2 -2
- package/dist/{chunk-OVUQNM7Y.js → chunk-6UHEMPEY.js} +3 -157
- package/dist/chunk-6UHEMPEY.js.map +1 -0
- package/dist/{chunk-A633WB3N.js → chunk-A5YUK3SG.js} +37 -26
- package/dist/chunk-A5YUK3SG.js.map +1 -0
- package/dist/{chunk-C5BXSQDO.js → chunk-A67EJ3J6.js} +6 -6
- package/dist/{chunk-2GTR24SA.js → chunk-BLDL23RY.js} +8 -8
- package/dist/{chunk-JPXC62SD.js → chunk-BY3635RR.js} +82 -16
- package/dist/chunk-BY3635RR.js.map +1 -0
- package/dist/{chunk-CFMI74TP.js → chunk-BZ74YUYE.js} +2 -2
- package/dist/{chunk-NDPQ2GQ4.js → chunk-CHTSA3YR.js} +6 -6
- package/dist/{chunk-5CJ3P5O3.js → chunk-CPYQ4BJK.js} +19 -100
- package/dist/chunk-CPYQ4BJK.js.map +1 -0
- package/dist/{chunk-Z2T5U7HN.js → chunk-CQTESLC5.js} +2 -2
- package/dist/{chunk-245W2Q7C.js → chunk-D4BGNAN5.js} +2 -2
- package/dist/{chunk-XPO655IX.js → chunk-E3HYSNS6.js} +4 -4
- package/dist/{chunk-LPJ3IB26.js → chunk-EL2KNRC3.js} +17 -3
- package/dist/chunk-EL2KNRC3.js.map +1 -0
- package/dist/{chunk-ISDFYXLA.js → chunk-FTSNG6DZ.js} +48 -28
- package/dist/chunk-FTSNG6DZ.js.map +1 -0
- package/dist/{chunk-MJZK7G4B.js → chunk-FXE5K56B.js} +3 -3
- package/dist/{chunk-YM2W43DI.js → chunk-HYEKQ22B.js} +13 -9
- package/dist/chunk-HYEKQ22B.js.map +1 -0
- package/dist/{chunk-QGBNWEWS.js → chunk-IC3FJWIF.js} +2 -2
- package/dist/{chunk-OQR3VVAX.js → chunk-IDDRHB7E.js} +3 -3
- package/dist/chunk-INOVEO32.js +28 -0
- package/dist/chunk-INOVEO32.js.map +1 -0
- package/dist/chunk-IXFFVI5S.js +409 -0
- package/dist/chunk-IXFFVI5S.js.map +1 -0
- package/dist/{chunk-OXCWCEVV.js → chunk-JA7DWOVV.js} +5 -5
- package/dist/{chunk-B2242FYO.js → chunk-JF4BC7ZD.js} +38 -3
- package/dist/chunk-JF4BC7ZD.js.map +1 -0
- package/dist/{chunk-RN7IA742.js → chunk-JL5FHNQK.js} +9 -11
- package/dist/{chunk-RN7IA742.js.map → chunk-JL5FHNQK.js.map} +1 -1
- package/dist/{chunk-HGUCJ3K3.js → chunk-JVE5YQN4.js} +4 -4
- package/dist/chunk-K5LBIAOM.js +700 -0
- package/dist/chunk-K5LBIAOM.js.map +1 -0
- package/dist/{chunk-5E3ABFOQ.js → chunk-KIUFBUUZ.js} +13 -11
- package/dist/{chunk-5E3ABFOQ.js.map → chunk-KIUFBUUZ.js.map} +1 -1
- package/dist/{chunk-SUTY4VCZ.js → chunk-LCMBG4LY.js} +3635 -3409
- package/dist/chunk-LCMBG4LY.js.map +1 -0
- package/dist/{chunk-H3C3UXTA.js → chunk-LMS2RWDS.js} +15 -13
- package/dist/{chunk-H3C3UXTA.js.map → chunk-LMS2RWDS.js.map} +1 -1
- package/dist/{chunk-RA2BER5P.js → chunk-MR5JWMC2.js} +2 -2
- package/dist/{chunk-JCTHXG33.js → chunk-NHOGTAPK.js} +2 -2
- package/dist/{chunk-VM7VAFJW.js → chunk-NVYDWVXN.js} +2 -1
- package/dist/{chunk-N2VB6UUE.js → chunk-O6IDYZVW.js} +7 -5
- package/dist/{chunk-N2VB6UUE.js.map → chunk-O6IDYZVW.js.map} +1 -1
- package/dist/{chunk-MTMR65NM.js → chunk-OHMLEITS.js} +2 -2
- package/dist/{chunk-NUQF5F5J.js → chunk-PNDEKFF3.js} +2 -2
- package/dist/{chunk-S2HW3CBF.js → chunk-PX7OTUNU.js} +6 -6
- package/dist/{chunk-4F5WGZRP.js → chunk-Q7FFJMFO.js} +19 -15
- package/dist/chunk-Q7FFJMFO.js.map +1 -0
- package/dist/{chunk-D4XQX4W7.js → chunk-QJJPTS6L.js} +5 -3
- package/dist/{chunk-D4XQX4W7.js.map → chunk-QJJPTS6L.js.map} +1 -1
- package/dist/chunk-RAN3CF33.js +1875 -0
- package/dist/chunk-RAN3CF33.js.map +1 -0
- package/dist/{chunk-YYWZ2MSL.js → chunk-S7V4F7HC.js} +16 -11
- package/dist/chunk-S7V4F7HC.js.map +1 -0
- package/dist/{chunk-CXL6ES7O.js → chunk-SCKVDD4E.js} +4 -4
- package/dist/{chunk-ZB3OFSRB.js → chunk-TJYJ4BNK.js} +4 -4
- package/dist/{chunk-MJZ5HYYL.js → chunk-TR5TNPWT.js} +2 -2
- package/dist/{chunk-MJZ5HYYL.js.map → chunk-TR5TNPWT.js.map} +1 -1
- package/dist/chunk-TT5UDTDM.js +888 -0
- package/dist/chunk-TT5UDTDM.js.map +1 -0
- package/dist/{chunk-N3DYE6LJ.js → chunk-TWYJ2TVS.js} +7 -7
- package/dist/{chunk-BM43RJIS.js → chunk-UQI463L3.js} +9 -9
- package/dist/{chunk-FIR2MAGS.js → chunk-V27DOGAO.js} +2 -2
- package/dist/{chunk-O4O6JOGD.js → chunk-VSDXZAQU.js} +14 -20
- package/dist/chunk-VSDXZAQU.js.map +1 -0
- package/dist/{chunk-4DFBBU4A.js → chunk-VSHMXMBZ.js} +2 -2
- package/dist/{chunk-ROZDHPKA.js → chunk-VZSATUI7.js} +4 -4
- package/dist/{chunk-EOJEPEYY.js → chunk-W5OZMYMX.js} +2 -2
- package/dist/{chunk-KERICP5Y.js → chunk-WW4JATBJ.js} +6 -6
- package/dist/{chunk-SSQZB5SQ.js → chunk-XG6PVB5S.js} +11 -1
- package/dist/chunk-XG6PVB5S.js.map +1 -0
- package/dist/{chunk-TDG2S5UE.js → chunk-XQKRD5A3.js} +4 -4
- package/dist/{chunk-GGTCSMNX.js → chunk-XSP3TUFN.js} +5 -5
- package/dist/{chunk-UVC3BUKU.js → chunk-XTMONCQE.js} +6 -405
- package/dist/chunk-XTMONCQE.js.map +1 -0
- package/dist/{chunk-WRWW6SGG.js → chunk-YB3KD5RI.js} +3 -3
- package/dist/chunk-ZAOJYN2D.js +159 -0
- package/dist/chunk-ZAOJYN2D.js.map +1 -0
- package/dist/{chunk-FKELQCGN.js → chunk-ZKIXGFID.js} +2 -2
- package/dist/{chunk-BY4THWAQ.js → chunk-ZT3ERG4B.js} +3 -3
- package/dist/chunk-ZTRC37NH.js +38 -0
- package/dist/chunk-ZTRC37NH.js.map +1 -0
- package/dist/{chunk-LXJ4FZ7Y.js → chunk-ZW4YASUB.js} +4 -4
- package/dist/{chunk-E6JYRVR5.js → chunk-ZX4TOTZS.js} +27 -8
- package/dist/chunk-ZX4TOTZS.js.map +1 -0
- package/dist/{cli-4RTNEVVX.js → cli-4QAH3DBX.js} +9 -11
- package/dist/{cli-IIFCE6GY.js → cli-6476FRBK.js} +16 -19
- package/dist/{cli-IIFCE6GY.js.map → cli-6476FRBK.js.map} +1 -1
- package/dist/{cli-DQRFSU7U.js → cli-7XT7O5YM.js} +16 -18
- package/dist/{cli-DQRFSU7U.js.map → cli-7XT7O5YM.js.map} +1 -1
- package/dist/{cli-PCZ7XNCO.js → cli-FGCHGJYZ.js} +70 -53
- package/dist/cli-FGCHGJYZ.js.map +1 -0
- package/dist/{cli-6J4P5MLU.js → cli-JE4LG35H.js} +4 -4
- package/dist/{cli-K5635N25.js → cli-U3622DIB.js} +14 -17
- package/dist/{cli-K5635N25.js.map → cli-U3622DIB.js.map} +1 -1
- package/dist/{cli-K5QWXB7H.js → cli-ULHJTJHH.js} +74 -41
- package/dist/cli-ULHJTJHH.js.map +1 -0
- package/dist/{cli-ISKXSN3P.js → cli-W7B2PNZO.js} +18 -21
- package/dist/{cli-ISKXSN3P.js.map → cli-W7B2PNZO.js.map} +1 -1
- package/dist/{cli-FTSJQSB4.js → cli-YGMXZ46V.js} +17 -20
- package/dist/{cli-FTSJQSB4.js.map → cli-YGMXZ46V.js.map} +1 -1
- package/dist/{cli-TCHSYJLB.js → cli-YINQL2NI.js} +28 -29
- package/dist/{cli-TCHSYJLB.js.map → cli-YINQL2NI.js.map} +1 -1
- package/dist/cli-Z3ART5DN.js +152 -0
- package/dist/cli-Z3ART5DN.js.map +1 -0
- package/dist/cli.js +15 -15
- package/dist/cli.js.map +1 -1
- package/dist/{config-7I5CHHRZ.js → config-2YJPJ36T.js} +5 -5
- package/dist/docmeta.js +8 -10
- package/dist/docmeta.js.map +1 -1
- package/dist/github-64ZVAUIT.js +28 -0
- package/dist/github-ARGPMQD2.js +32 -0
- package/dist/github-YHJABBUI.js +33 -0
- package/dist/graph/runtime.js.map +1 -1
- package/dist/{host-YSTYO5DX.js → host-JT27OWTC.js} +3 -3
- package/dist/index.d.ts +334 -24
- package/dist/index.js +218 -203
- package/dist/index.js.map +1 -1
- package/dist/{json-7Z2IFGB3.js → json-CVOVXB7O.js} +12 -15
- package/dist/json-QNGJFUY2.js +40 -0
- package/dist/{labels-SE2WL7WD.js → labels-5WOKC3VR.js} +11 -14
- package/dist/{labels-SE2WL7WD.js.map → labels-5WOKC3VR.js.map} +1 -1
- package/dist/lint-OQGB4DWJ.js +32 -0
- package/dist/list-EDAB7X5Y.js +30 -0
- package/dist/list-OQ3IYV2W.js +37 -0
- package/dist/list-PN6JKYNX.js +33 -0
- package/dist/{page-A2Y4ZMV4.js → page-TPNMHL27.js} +11 -14
- package/dist/{prepare-M2COBP5O.js → prepare-3V2QYBKL.js} +20 -22
- package/dist/{prepare-M2COBP5O.js.map → prepare-3V2QYBKL.js.map} +1 -1
- package/dist/{pretty-SFFOMSG5.js → pretty-EZ2NFU3C.js} +13 -16
- package/dist/pretty-HO2LYG5N.js +41 -0
- package/dist/{pretty-D3DZFC5U.js → pretty-K3M4AW2D.js} +12 -15
- package/dist/{provider-JY2I3VLF.js → provider-YWNTTQPA.js} +3 -3
- package/dist/{release-VHHASAG7.js → release-EFLQT3FW.js} +3 -3
- package/dist/{reporters-TO7Q6JYF.js → reporters-4R2E7PRJ.js} +6 -6
- package/dist/{reporters-UTLJVSWX.js → reporters-YVLLFBO5.js} +11 -14
- package/dist/run-H4BOR2FR.js +36 -0
- package/dist/{sarif-IAGMXA6C.js → sarif-GWHWJJFP.js} +10 -13
- package/dist/sarif-SJFVSOBV.js +33 -0
- package/dist/sarif-YBFD5OUL.js +28 -0
- package/dist/{strategy-UKRA6WO4.js → strategy-T56PH2VK.js} +29 -46
- package/dist/strategy-T56PH2VK.js.map +1 -0
- package/dist/{term-AMORBEO7.js → term-33YSMISR.js} +18 -22
- package/dist/{term-AMORBEO7.js.map → term-33YSMISR.js.map} +1 -1
- package/dist/{validate-CDTKFZUV.js → validate-6R5UBDGU.js} +6 -7
- package/package.json +1 -1
- package/plugin/manni/.claude-plugin/plugin.json +11 -3
- package/plugin/manni/hooks/graph-server.mjs +3 -3
- package/plugin/manni/hooks/hooks.json +4 -4
- package/plugin/manni/hooks/manni.mjs +18 -5
- package/plugin/manni/hooks/page-metadata.mjs +81 -7
- package/plugin/manni/hooks/tracevals.mjs +7 -0
- package/plugin/manni/skills/fix/SKILL.md +8 -4
- package/shapes/graph/shapes-1.3.0.ttl +1250 -0
- package/dist/build-AYLD6V6Y.js +0 -38
- package/dist/calibrate-2HZFACIX.js +0 -43
- package/dist/capture-NMDIPC6S.js +0 -39
- package/dist/check-KNQV7GLU.js +0 -33
- package/dist/check-OH4KKXP3.js +0 -33
- package/dist/check-PRAMKQCI.js +0 -47
- package/dist/chunk-4F5WGZRP.js.map +0 -1
- package/dist/chunk-4H3IOF52.js +0 -3200
- package/dist/chunk-4H3IOF52.js.map +0 -1
- package/dist/chunk-5CJ3P5O3.js.map +0 -1
- package/dist/chunk-A633WB3N.js.map +0 -1
- package/dist/chunk-ACJUZFRT.js.map +0 -1
- package/dist/chunk-B2242FYO.js.map +0 -1
- package/dist/chunk-CT5WSUUZ.js +0 -441
- package/dist/chunk-CT5WSUUZ.js.map +0 -1
- package/dist/chunk-DNF42MK7.js +0 -326
- package/dist/chunk-DNF42MK7.js.map +0 -1
- package/dist/chunk-E6JYRVR5.js.map +0 -1
- package/dist/chunk-ISDFYXLA.js.map +0 -1
- package/dist/chunk-JPXC62SD.js.map +0 -1
- package/dist/chunk-LPJ3IB26.js.map +0 -1
- package/dist/chunk-MPXMQGJI.js.map +0 -1
- package/dist/chunk-O4O6JOGD.js.map +0 -1
- package/dist/chunk-ODSIHEIW.js.map +0 -1
- package/dist/chunk-OVUQNM7Y.js.map +0 -1
- package/dist/chunk-QSPH4F56.js.map +0 -1
- package/dist/chunk-SIREOHLW.js +0 -233
- package/dist/chunk-SIREOHLW.js.map +0 -1
- package/dist/chunk-SSQZB5SQ.js.map +0 -1
- package/dist/chunk-SUTY4VCZ.js.map +0 -1
- package/dist/chunk-UP6NBQ62.js +0 -2
- package/dist/chunk-UVC3BUKU.js.map +0 -1
- package/dist/chunk-WI3PPQQX.js +0 -164
- package/dist/chunk-WI3PPQQX.js.map +0 -1
- package/dist/chunk-YM2W43DI.js.map +0 -1
- package/dist/chunk-YYWZ2MSL.js.map +0 -1
- package/dist/chunk-ZPLVANY2.js +0 -15
- package/dist/chunk-ZPLVANY2.js.map +0 -1
- package/dist/cli-K5QWXB7H.js.map +0 -1
- package/dist/cli-PCZ7XNCO.js.map +0 -1
- package/dist/cli-TM2JCTQT.js +0 -84
- package/dist/cli-TM2JCTQT.js.map +0 -1
- package/dist/github-BUK5CVQW.js +0 -27
- package/dist/github-CMAZWS76.js +0 -31
- package/dist/github-NXR4QMMM.js +0 -35
- package/dist/json-NZSGRYOE.js +0 -34
- package/dist/lint-VUYM5PPM.js +0 -35
- package/dist/list-4JGOXLOZ.js +0 -33
- package/dist/list-LTF25DQE.js +0 -33
- package/dist/list-WD3TZS5R.js +0 -36
- package/dist/pretty-R67YU6TU.js +0 -35
- package/dist/run-BDGYRUXJ.js +0 -39
- package/dist/sarif-EHAMGCVR.js +0 -36
- package/dist/sarif-GJYLRXLS.js +0 -30
- package/dist/strategy-UKRA6WO4.js.map +0 -1
- package/dist/validate-CDTKFZUV.js.map +0 -1
- /package/dist/{batch-J626LZ22.js.map → batch-C3NN2YXB.js.map} +0 -0
- /package/dist/{build-AYLD6V6Y.js.map → build-CEVEAHN7.js.map} +0 -0
- /package/dist/{calibrate-2HZFACIX.js.map → calibrate-CSKPY5AK.js.map} +0 -0
- /package/dist/{capture-NMDIPC6S.js.map → capture-3HDBIHH6.js.map} +0 -0
- /package/dist/{check-KNQV7GLU.js.map → check-555TCJGF.js.map} +0 -0
- /package/dist/{check-OH4KKXP3.js.map → check-KGJBV42O.js.map} +0 -0
- /package/dist/{check-PRAMKQCI.js.map → check-KXWHSCCR.js.map} +0 -0
- /package/dist/{check-RCSQARQE.js.map → check-MZSXCS2M.js.map} +0 -0
- /package/dist/{check-PQ7S5I3I.js.map → check-QNHLTYPN.js.map} +0 -0
- /package/dist/{chunk-YIHIRMXN.js.map → chunk-2VLZDU4E.js.map} +0 -0
- /package/dist/{chunk-D54BQM5P.js.map → chunk-37Q7WEJJ.js.map} +0 -0
- /package/dist/{chunk-P5DWBG6T.js.map → chunk-46MMIJWR.js.map} +0 -0
- /package/dist/{chunk-P6XZ44C2.js.map → chunk-4LYVTR2T.js.map} +0 -0
- /package/dist/{chunk-6FY573GB.js.map → chunk-64DULZIG.js.map} +0 -0
- /package/dist/{chunk-TAJYMXMM.js.map → chunk-6SVHI2U6.js.map} +0 -0
- /package/dist/{chunk-C5BXSQDO.js.map → chunk-A67EJ3J6.js.map} +0 -0
- /package/dist/{chunk-2GTR24SA.js.map → chunk-BLDL23RY.js.map} +0 -0
- /package/dist/{chunk-CFMI74TP.js.map → chunk-BZ74YUYE.js.map} +0 -0
- /package/dist/{chunk-NDPQ2GQ4.js.map → chunk-CHTSA3YR.js.map} +0 -0
- /package/dist/{chunk-Z2T5U7HN.js.map → chunk-CQTESLC5.js.map} +0 -0
- /package/dist/{chunk-245W2Q7C.js.map → chunk-D4BGNAN5.js.map} +0 -0
- /package/dist/{chunk-XPO655IX.js.map → chunk-E3HYSNS6.js.map} +0 -0
- /package/dist/{chunk-MJZK7G4B.js.map → chunk-FXE5K56B.js.map} +0 -0
- /package/dist/{chunk-QGBNWEWS.js.map → chunk-IC3FJWIF.js.map} +0 -0
- /package/dist/{chunk-OQR3VVAX.js.map → chunk-IDDRHB7E.js.map} +0 -0
- /package/dist/{chunk-OXCWCEVV.js.map → chunk-JA7DWOVV.js.map} +0 -0
- /package/dist/{chunk-HGUCJ3K3.js.map → chunk-JVE5YQN4.js.map} +0 -0
- /package/dist/{chunk-RA2BER5P.js.map → chunk-MR5JWMC2.js.map} +0 -0
- /package/dist/{chunk-JCTHXG33.js.map → chunk-NHOGTAPK.js.map} +0 -0
- /package/dist/{chunk-VM7VAFJW.js.map → chunk-NVYDWVXN.js.map} +0 -0
- /package/dist/{chunk-MTMR65NM.js.map → chunk-OHMLEITS.js.map} +0 -0
- /package/dist/{chunk-NUQF5F5J.js.map → chunk-PNDEKFF3.js.map} +0 -0
- /package/dist/{chunk-S2HW3CBF.js.map → chunk-PX7OTUNU.js.map} +0 -0
- /package/dist/{chunk-CXL6ES7O.js.map → chunk-SCKVDD4E.js.map} +0 -0
- /package/dist/{chunk-ZB3OFSRB.js.map → chunk-TJYJ4BNK.js.map} +0 -0
- /package/dist/{chunk-N3DYE6LJ.js.map → chunk-TWYJ2TVS.js.map} +0 -0
- /package/dist/{chunk-BM43RJIS.js.map → chunk-UQI463L3.js.map} +0 -0
- /package/dist/{chunk-FIR2MAGS.js.map → chunk-V27DOGAO.js.map} +0 -0
- /package/dist/{chunk-4DFBBU4A.js.map → chunk-VSHMXMBZ.js.map} +0 -0
- /package/dist/{chunk-ROZDHPKA.js.map → chunk-VZSATUI7.js.map} +0 -0
- /package/dist/{chunk-EOJEPEYY.js.map → chunk-W5OZMYMX.js.map} +0 -0
- /package/dist/{chunk-KERICP5Y.js.map → chunk-WW4JATBJ.js.map} +0 -0
- /package/dist/{chunk-TDG2S5UE.js.map → chunk-XQKRD5A3.js.map} +0 -0
- /package/dist/{chunk-GGTCSMNX.js.map → chunk-XSP3TUFN.js.map} +0 -0
- /package/dist/{chunk-WRWW6SGG.js.map → chunk-YB3KD5RI.js.map} +0 -0
- /package/dist/{chunk-FKELQCGN.js.map → chunk-ZKIXGFID.js.map} +0 -0
- /package/dist/{chunk-BY4THWAQ.js.map → chunk-ZT3ERG4B.js.map} +0 -0
- /package/dist/{chunk-LXJ4FZ7Y.js.map → chunk-ZW4YASUB.js.map} +0 -0
- /package/dist/{chunk-UP6NBQ62.js.map → cli-4QAH3DBX.js.map} +0 -0
- /package/dist/{cli-6J4P5MLU.js.map → cli-JE4LG35H.js.map} +0 -0
- /package/dist/{cli-4RTNEVVX.js.map → config-2YJPJ36T.js.map} +0 -0
- /package/dist/{config-7I5CHHRZ.js.map → github-64ZVAUIT.js.map} +0 -0
- /package/dist/{github-BUK5CVQW.js.map → github-ARGPMQD2.js.map} +0 -0
- /package/dist/{github-CMAZWS76.js.map → github-YHJABBUI.js.map} +0 -0
- /package/dist/{github-NXR4QMMM.js.map → host-JT27OWTC.js.map} +0 -0
- /package/dist/{host-YSTYO5DX.js.map → json-CVOVXB7O.js.map} +0 -0
- /package/dist/{json-7Z2IFGB3.js.map → json-QNGJFUY2.js.map} +0 -0
- /package/dist/{json-NZSGRYOE.js.map → lint-OQGB4DWJ.js.map} +0 -0
- /package/dist/{lint-VUYM5PPM.js.map → list-EDAB7X5Y.js.map} +0 -0
- /package/dist/{list-4JGOXLOZ.js.map → list-OQ3IYV2W.js.map} +0 -0
- /package/dist/{list-LTF25DQE.js.map → list-PN6JKYNX.js.map} +0 -0
- /package/dist/{list-WD3TZS5R.js.map → page-TPNMHL27.js.map} +0 -0
- /package/dist/{page-A2Y4ZMV4.js.map → pretty-EZ2NFU3C.js.map} +0 -0
- /package/dist/{pretty-D3DZFC5U.js.map → pretty-HO2LYG5N.js.map} +0 -0
- /package/dist/{pretty-R67YU6TU.js.map → pretty-K3M4AW2D.js.map} +0 -0
- /package/dist/{pretty-SFFOMSG5.js.map → provider-YWNTTQPA.js.map} +0 -0
- /package/dist/{release-VHHASAG7.js.map → release-EFLQT3FW.js.map} +0 -0
- /package/dist/{provider-JY2I3VLF.js.map → reporters-4R2E7PRJ.js.map} +0 -0
- /package/dist/{reporters-TO7Q6JYF.js.map → reporters-YVLLFBO5.js.map} +0 -0
- /package/dist/{reporters-UTLJVSWX.js.map → run-H4BOR2FR.js.map} +0 -0
- /package/dist/{run-BDGYRUXJ.js.map → sarif-GWHWJJFP.js.map} +0 -0
- /package/dist/{sarif-EHAMGCVR.js.map → sarif-SJFVSOBV.js.map} +0 -0
- /package/dist/{sarif-GJYLRXLS.js.map → sarif-YBFD5OUL.js.map} +0 -0
- /package/dist/{sarif-IAGMXA6C.js.map → validate-6R5UBDGU.js.map} +0 -0
package/dist/chunk-UP6NBQ62.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tracevals/capture/manifest.ts","../src/tracevals/trace/availability.ts","../src/tracevals/artifacts/availability.ts","../src/tracevals/artifacts/fs.ts","../src/tracevals/artifacts/resolve.ts","../src/tracevals/evals/schema.ts","../src/tracevals/evals/extract.ts"],"sourcesContent":["/**\n * Reading, locating, and comparing session manifests (ADR 01024).\n *\n * The consuming half. Deliberately free of any dependency on\n * `artifacts/discover.ts`: `artifacts/resolve.ts` imports this module, and\n * discovery imports resolution, so producing and consuming a manifest have to\n * live in separate files or the two would form a cycle. Building one is\n * `capture/build.ts`.\n */\nimport { createHash } from \"node:crypto\";\nimport { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport {\n dirname,\n extname,\n isAbsolute,\n join,\n relative,\n resolve,\n sep,\n} from \"node:path\";\nimport {\n MANIFEST_VERSION,\n type ContentCheck,\n type SessionManifest,\n} from \"./types.js\";\n\nexport function sha256Hex(data: Buffer | string): string {\n return createHash(\"sha256\").update(data).digest(\"hex\");\n}\n\n/** sha256 of a file's bytes, or null when it cannot be read. */\nexport async function hashFile(path: string): Promise<string | null> {\n try {\n // The bytes, not the decoded string: the digest has to mean \"this file\",\n // and a decode-then-re-encode would quietly normalize a BOM.\n return sha256Hex(await readFile(path));\n } catch {\n return null;\n }\n}\n\n/** `path` relative to `root`, POSIX-separated, or null when it escapes. */\nexport function relPosix(root: string, path: string): string | null {\n const rel = relative(resolve(root), resolve(path));\n if (rel === \"\" || rel.startsWith(\"..\") || isAbsolute(rel)) return null;\n return rel.split(sep).join(\"/\");\n}\n\n/**\n * A session id is a filename here, so it may not carry path syntax. Claude Code\n * writes UUIDs; a hand-passed `--session-id` is the case this guards, and a\n * `../` in one would write the manifest outside the directory it was aimed at.\n */\nexport function safeSessionId(sessionId: string): string {\n const cleaned = sessionId.replace(/[^A-Za-z0-9._-]/g, \"-\").replace(/^\\.+/, \"\");\n return cleaned.length > 0 ? cleaned.slice(0, 128) : \"session\";\n}\n\nexport function manifestPathFor(dir: string, sessionId: string): string {\n return join(dir, `${safeSessionId(sessionId)}.json`);\n}\n\n/** The `<trace>.manifest.json` sibling — a manifest placed beside its trace. */\nexport function siblingManifestPath(tracePath: string): string {\n const ext = extname(tracePath);\n const stem = ext === \"\" ? tracePath : tracePath.slice(0, -ext.length);\n return `${stem}.manifest.json`;\n}\n\n// ── Persisting ───────────────────────────────────────────────────\n\nexport async function writeManifest(\n path: string,\n manifest: SessionManifest,\n): Promise<void> {\n await mkdir(dirname(resolve(path)), { recursive: true });\n await writeFile(path, `${JSON.stringify(manifest, null, 2)}\\n`, \"utf-8\");\n}\n\n/**\n * Every member `run` actually consumes, checked one by one.\n *\n * A partial read is the dangerous failure here, not a loud one. An artifact\n * entry with no `path` puts `undefined` in the comparison map's key, and one\n * whose `sha256` is not a string puts a value no real digest can equal — so a\n * half-read manifest reports **`mismatch`**, \"this artifact changed since the\n * session\", which is the most alarming thing this feature can say and would be\n * said off nothing but the file's own corruption. A manifest is optional\n * evidence, so anything malformed has to read as *no* evidence.\n */\nfunction isManifestArtifact(value: unknown): boolean {\n if (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n return false;\n }\n const entry = value as Record<string, unknown>;\n return (\n typeof entry.path === \"string\" &&\n entry.path.length > 0 &&\n typeof entry.sha256 === \"string\" &&\n entry.sha256.length > 0 &&\n typeof entry.name === \"string\" &&\n typeof entry.type === \"string\" &&\n typeof entry.bytes === \"number\"\n );\n}\n\n/**\n * Read one manifest, or null. Absent, unreadable, unparseable, the wrong shape,\n * or written by a newer format version all produce null: consuming a manifest\n * is optional evidence-gathering, so every failure has to degrade to \"no\n * evidence\" rather than to a crash or, worse, to a partial read (ADR 01003).\n */\nexport async function readManifest(\n path: string,\n): Promise<SessionManifest | null> {\n let raw: string;\n try {\n raw = await readFile(path, \"utf-8\");\n } catch {\n return null;\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch {\n return null;\n }\n if (parsed === null || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n return null;\n }\n const record = parsed as Record<string, unknown>;\n if (typeof record.version !== \"number\" || record.version > MANIFEST_VERSION) {\n return null;\n }\n if (typeof record.sessionId !== \"string\") return null;\n // `capturedAt` is printed in the report and `root` is a base the join is\n // keyed on; both are consumed, so neither may be half-there.\n if (typeof record.capturedAt !== \"string\") return null;\n if (typeof record.root !== \"string\") return null;\n if (!Array.isArray(record.artifacts)) return null;\n if (!record.artifacts.every(isManifestArtifact)) return null;\n return parsed as SessionManifest;\n}\n\nexport interface FindManifestOptions {\n tracePath: string;\n /** The trace's own session id, when it recorded one. */\n sessionId?: string;\n /** Project root; the canonical manifest lives under it. */\n projectDir: string;\n /** Directory manifests are written to, relative to the project root. */\n captureDir: string;\n /** An explicitly named manifest, which is used without searching. */\n explicit?: string;\n /**\n * Called for each candidate that was readable but refused, with why. A\n * refusal that leaves no trace is indistinguishable from never having\n * captured anything, which is the wrong thing for a reader to conclude.\n */\n onRefused?: (path: string, reason: string) => void;\n}\n\nexport interface FoundManifest {\n path: string;\n manifest: SessionManifest;\n}\n\n/**\n * Find the manifest for a trace, most-specific location first.\n *\n * 1. `<trace>.manifest.json` — someone put it there deliberately, which is a\n * stronger statement of intent than any convention.\n * 2. `<trace dir>/<captureDir>/<session-id>.json` — a trace copied out of the\n * session store together with the state directory.\n * 3. `<projectDir>/<captureDir>/<session-id>.json` — where `capture` writes.\n *\n * **A manifest that cannot be shown to belong to this trace is refused**, not\n * used. It is evidence about some other session, and letting it stand in here\n * would be the one way a manifest could produce a confidently wrong answer.\n *\n * Two ways that can happen, and the trace's own id decides which:\n *\n * - The ids **disagree** — refused outright, however the manifest was reached.\n * - The trace records **no id at all**. A Claude Code session file whose\n * records predate `sessionId`, or a `claude -p` stream-json transcript\n * captured without its `system`/`init` record, both parse fine and both\n * arrive here with nothing to check against. A manifest found *by\n * convention* beside such a trace is refused, because convention is not\n * provenance and the file could describe any session on the machine.\n *\n * An **explicitly named** `--manifest` is the exception to that second case,\n * and only that one. Naming a file is the caller's own assertion that it\n * belongs to this trace — the assertion the ADR already treats as\n * load-bearing when it makes an unusable named manifest an error rather than a\n * shrug — and it is the only assertion available for a trace format that\n * records no id. Refusing it would leave `--manifest` structurally unusable\n * there while buying no safety a discovered manifest does not already get.\n */\nexport async function findManifest(\n options: FindManifestOptions,\n): Promise<FoundManifest | null> {\n const explicit = options.explicit !== undefined;\n const candidates: string[] = [];\n if (options.explicit !== undefined) {\n candidates.push(options.explicit);\n } else {\n candidates.push(siblingManifestPath(options.tracePath));\n if (options.sessionId !== undefined) {\n candidates.push(\n manifestPathFor(\n resolve(dirname(options.tracePath), options.captureDir),\n options.sessionId,\n ),\n manifestPathFor(\n resolve(options.projectDir, options.captureDir),\n options.sessionId,\n ),\n );\n }\n }\n\n for (const path of candidates) {\n const manifest = await readManifest(path);\n if (manifest === null) continue;\n const refusal = refuse(manifest, options.sessionId, explicit);\n if (refusal !== null) {\n options.onRefused?.(path, refusal);\n continue;\n }\n return { path, manifest };\n }\n return null;\n}\n\n/** Why this manifest cannot be trusted for this trace, or null if it can. */\nfunction refuse(\n manifest: SessionManifest,\n sessionId: string | undefined,\n explicit: boolean,\n): string | null {\n if (sessionId === undefined) {\n if (explicit) return null;\n return (\n `the trace records no session id, so a manifest found by convention ` +\n `cannot be verified as belonging to it (it records \"${manifest.sessionId}\"). ` +\n `Pass --manifest to use it anyway.`\n );\n }\n if (manifest.sessionId !== sessionId) {\n return `it was recorded for a different session (\"${manifest.sessionId}\", not \"${sessionId}\")`;\n }\n return null;\n}\n\n// ── Comparing ────────────────────────────────────────────────────\n\n/**\n * Compare the files one coverage row covers against what the manifest recorded.\n *\n * `actual` maps each covered file's project-relative POSIX path to its current\n * sha256. A row usually covers one file; project rules aggregate several, which\n * is why the outcome is decided over a set:\n *\n * - **any** recorded file whose digest differs → `mismatch`. One changed file\n * makes the row's instructions different, whatever the others say.\n * - **every** covered file recorded and equal → `match`.\n * - otherwise → `skipped`, naming what the manifest could not speak to. A\n * partial answer is not a clean one.\n */\nexport function checkContent(\n manifest: SessionManifest,\n actual: ReadonlyMap<string, string>,\n): ContentCheck {\n const recorded = new Map(manifest.artifacts.map((a) => [a.path, a.sha256]));\n const missing: string[] = [];\n let matched = 0;\n /**\n * The first agreeing pair, captured where both halves are in hand. `expected`\n * means \"what the manifest claimed\" in every branch, so it has to be read off\n * the manifest in every branch — going back to `actual` afterwards would\n * report the file twice, and on a match the two are equal, so nothing would\n * ever catch it.\n */\n let agreed: { expected: string; actual: string } | undefined;\n\n for (const [path, digest] of actual) {\n const expected = recorded.get(path);\n if (expected === undefined) {\n missing.push(path);\n continue;\n }\n if (expected !== digest) {\n return { status: \"mismatch\", expected, actual: digest };\n }\n agreed ??= { expected, actual: digest };\n matched += 1;\n }\n\n if (matched === 0) {\n return {\n status: \"skipped\",\n reason:\n actual.size === 0\n ? \"no file to compare\"\n : \"not recorded in the session manifest\",\n };\n }\n if (missing.length > 0) {\n return {\n status: \"skipped\",\n reason: `not recorded in the session manifest: ${missing.join(\", \")}`,\n };\n }\n // Digests only for a row covering one file: an aggregated project-rules row\n // has no single pair to report, and picking one of several would be a claim\n // about the row that is not true of it.\n return {\n status: \"match\",\n ...(actual.size === 1 && agreed !== undefined ? agreed : {}),\n };\n}\n\nexport * from \"./types.js\";\n","/**\n * The availability roster (ADR 01016): what a session was *offered*, whether or\n * not it used any of it.\n *\n * Claude Code records the roster in the transcript as structured `attachment`\n * records rather than as the prose the model reads, so it is recoverable\n * deterministically and **retroactively, on every session already on disk**:\n *\n * | `attachment.type` | Carries |\n * |---|---|\n * | `skill_listing` | `names`, `skillCount`, `isInitial`, and `content` — one `- name: description` line per skill |\n * | `agent_listing_delta` | `addedTypes`, `addedLines` (description plus tool grants), `removedTypes`, `isInitial` |\n * | `deferred_tools_delta` | `addedNames`, `removedNames`, `readdedNames`, and the MCP server state lists |\n *\n * Two properties of the real data drive the shape of this module, both\n * confirmed across the 606 `skill_listing` records in a 281-session store:\n *\n * 1. **`content` is the description source, `names` is the identity source.**\n * A plugin skill is named `plugin:skill`, so splitting a listing line on its\n * first colon truncates the name; every line is instead matched against the\n * `names` array (longest match wins). On that corpus the rule leaves zero\n * lines unjoined. Descriptions also wrap onto continuation lines, and the\n * listing text is capped near 30,000 characters — past the cap Claude Code\n * emits bare `- name` lines, so a description is genuinely optional.\n * 2. **Deltas are not idempotent.** `isInitial: true` replaces the set;\n * `isInitial: false` adds (and, for agents and tools, removes). Replay is\n * therefore ordered by record index, and per-index history is kept so a\n * consumer can ask what was available when a window opened rather than only\n * what was available at some point.\n */\nimport type {\n AvailabilityEntry,\n AvailabilityKind,\n McpServerStatus,\n TraceAvailability,\n} from \"./types.js\";\n\nexport function newAvailability(): TraceAvailability {\n return { recorded: false, skills: [], agents: [], tools: [], mcpServers: [] };\n}\n\n/** Entries whose interval covers `index`. */\nexport function availableAt(\n entries: readonly AvailabilityEntry[],\n index: number,\n): AvailabilityEntry[] {\n return entries.filter(\n (e) => e.offeredAt <= index && (e.withdrawnAt === undefined || index < e.withdrawnAt),\n );\n}\n\n/** Every distinct name that was offered at any point. */\nexport function offeredNames(entries: readonly AvailabilityEntry[]): Set<string> {\n return new Set(entries.map((e) => e.name));\n}\n\n/**\n * Join a listing's `content` lines onto its `names`.\n *\n * A line belongs to the longest name it starts with, so `plugin:skill` survives\n * intact; a line that starts no name is a continuation of the description above\n * it. Names with no line at all keep an absent description.\n */\nexport function joinDescriptions(\n content: string,\n names: readonly string[],\n): Map<string, string | undefined> {\n const byName = new Map<string, string | undefined>(\n names.map((name) => [name, undefined]),\n );\n let current: string | undefined;\n for (const raw of content.split(\"\\n\")) {\n const line = raw.trimEnd();\n if (line.startsWith(\"- \")) {\n const body = line.slice(2);\n let best: string | undefined;\n for (const name of names) {\n if (body !== name && !body.startsWith(`${name}:`)) continue;\n if (best === undefined || name.length > best.length) best = name;\n }\n // A `- ` line that names nothing on the roster is not a skill entry, so\n // it must not become the target for the lines that follow it either.\n current = best;\n if (best === undefined) continue;\n const rest = body.slice(best.length).replace(/^:\\s*/, \"\").trim();\n byName.set(best, rest.length > 0 ? rest : undefined);\n continue;\n }\n if (current === undefined) continue;\n const continued = line.trim();\n if (continued.length === 0) continue;\n const previous = byName.get(current);\n byName.set(current, previous ? `${previous}\\n${continued}` : continued);\n }\n return byName;\n}\n\n/** `- name: description` in one string, as the agent-listing deltas ship it. */\nfunction describedLines(\n names: readonly string[],\n lines: readonly string[],\n): Map<string, string | undefined> {\n const byName = new Map<string, string | undefined>();\n names.forEach((name, i) => {\n const line = lines[i];\n if (typeof line !== \"string\") {\n byName.set(name, undefined);\n return;\n }\n const body = line.startsWith(\"- \") ? line.slice(2) : line;\n const rest = body.startsWith(`${name}:`)\n ? body.slice(name.length + 1).trim()\n : body === name\n ? \"\"\n : body.trim();\n byName.set(name, rest.length > 0 ? rest : undefined);\n });\n return byName;\n}\n\nconst asStrings = (value: unknown): string[] =>\n Array.isArray(value) ? value.filter((v): v is string => typeof v === \"string\") : [];\n\n/** Mutable replay state: the open interval per name, per kind. */\nexport interface AvailabilityReplay {\n roster: TraceAvailability;\n open: Map<AvailabilityKind, Map<string, AvailabilityEntry>>;\n}\n\nexport function newReplay(): AvailabilityReplay {\n return {\n roster: newAvailability(),\n open: new Map<AvailabilityKind, Map<string, AvailabilityEntry>>([\n [\"skill\", new Map()],\n [\"agent\", new Map()],\n [\"tool\", new Map()],\n [\"mcp-server\", new Map()],\n ]),\n };\n}\n\nfunction listFor(\n roster: TraceAvailability,\n kind: AvailabilityKind,\n): AvailabilityEntry[] {\n if (kind === \"skill\") return roster.skills;\n if (kind === \"agent\") return roster.agents;\n if (kind === \"tool\") return roster.tools;\n return roster.mcpServers;\n}\n\nfunction offer(\n replay: AvailabilityReplay,\n kind: AvailabilityKind,\n name: string,\n index: number,\n description?: string,\n status?: McpServerStatus,\n): void {\n const open = replay.open.get(kind) as Map<string, AvailabilityEntry>;\n const existing = open.get(name);\n if (existing !== undefined) {\n // Already offered: keep the one interval and let a later listing fill in a\n // description the earlier, truncated one omitted.\n if (existing.description === undefined && description !== undefined) {\n existing.description = description;\n }\n if (status !== undefined) existing.status = status;\n return;\n }\n const entry: AvailabilityEntry = { kind, name, offeredAt: index };\n if (description !== undefined) entry.description = description;\n if (status !== undefined) entry.status = status;\n open.set(name, entry);\n listFor(replay.roster, kind).push(entry);\n}\n\nfunction withdraw(\n replay: AvailabilityReplay,\n kind: AvailabilityKind,\n name: string,\n index: number,\n): void {\n const open = replay.open.get(kind) as Map<string, AvailabilityEntry>;\n const entry = open.get(name);\n if (entry === undefined) return;\n entry.withdrawnAt = index;\n open.delete(name);\n}\n\n/** Names currently offered for a kind, in offer order. */\nfunction openNames(replay: AvailabilityReplay, kind: AvailabilityKind): string[] {\n return [...(replay.open.get(kind) as Map<string, AvailabilityEntry>).keys()];\n}\n\n/**\n * Fold one `attachment` payload into the roster. Anything unrecognised, or\n * shaped unexpectedly, is ignored rather than thrown: a listing record is\n * bookkeeping, and losing one must never cost the run its trace (ADR 01003).\n *\n * Returns true when the record was a listing record — which is what makes\n * `recorded` mean \"a roster was present\", as opposed to \"the roster was empty\".\n */\nexport function applyAvailabilityRecord(\n replay: AvailabilityReplay,\n attachment: unknown,\n index: number,\n): boolean {\n if (typeof attachment !== \"object\" || attachment === null) return false;\n const record = attachment as Record<string, unknown>;\n const type = record.type;\n\n if (type === \"skill_listing\") {\n const names = asStrings(record.names);\n const content = typeof record.content === \"string\" ? record.content : \"\";\n // A skill listing carries no removal member of its own: an initial listing\n // is the set, and a delta only adds.\n if (record.isInitial === true) {\n for (const name of openNames(replay, \"skill\")) {\n if (!names.includes(name)) withdraw(replay, \"skill\", name, index);\n }\n }\n const described = joinDescriptions(content, names);\n for (const name of names) {\n offer(replay, \"skill\", name, index, described.get(name));\n }\n return true;\n }\n\n if (type === \"agent_listing_delta\") {\n const added = asStrings(record.addedTypes);\n const lines = asStrings(record.addedLines);\n if (record.isInitial === true) {\n for (const name of openNames(replay, \"agent\")) {\n if (!added.includes(name)) withdraw(replay, \"agent\", name, index);\n }\n }\n const described = describedLines(added, lines);\n for (const name of added) {\n offer(replay, \"agent\", name, index, described.get(name));\n }\n for (const name of asStrings(record.removedTypes)) {\n withdraw(replay, \"agent\", name, index);\n }\n return true;\n }\n\n if (type === \"deferred_tools_delta\") {\n // Tool deltas carry no `isInitial` at all — verified across 431 records —\n // so they are purely additive/subtractive.\n for (const name of asStrings(record.removedNames)) {\n withdraw(replay, \"tool\", name, index);\n }\n // `addedLines` is the tool's own name again rather than a description, and\n // is sometimes empty while `addedNames` is not; there is no description to\n // recover for a tool.\n // `readdedNames` is the shape a re-offer actually takes: a tool that was\n // withdrawn and is offered again arrives there, not in `addedNames`.\n // Reading only `addedNames` left it withdrawn for the rest of the\n // session, so `availableAt` answered false for a tool the session could\n // still call.\n for (const name of [\n ...asStrings(record.addedNames),\n ...asStrings(record.readdedNames),\n ]) {\n offer(replay, \"tool\", name, index);\n }\n const servers: Array<[string, McpServerStatus]> = [\n ...asStrings(record.pendingMcpServers).map(\n (n): [string, McpServerStatus] => [n, \"pending\"],\n ),\n ...asStrings(record.needsAuthMcpServers).map(\n (n): [string, McpServerStatus] => [n, \"needs-auth\"],\n ),\n ...asStrings(record.failedMcpServers).map(\n (n): [string, McpServerStatus] => [n, \"failed\"],\n ),\n ];\n for (const [name, status] of servers) {\n offer(replay, \"mcp-server\", name, index, undefined, status);\n }\n return true;\n }\n\n return false;\n}\n\n/** Shift every ordinal through a remap, for the sidecar splice (ADR 01014). */\nexport function remapAvailability(\n roster: TraceAvailability,\n at: (index: number) => number,\n): TraceAvailability {\n const shift = (entries: AvailabilityEntry[]): AvailabilityEntry[] =>\n entries.map((entry) => ({\n ...entry,\n offeredAt: at(entry.offeredAt),\n ...(entry.withdrawnAt !== undefined\n ? { withdrawnAt: at(entry.withdrawnAt) }\n : {}),\n }));\n return {\n recorded: roster.recorded,\n skills: shift(roster.skills),\n agents: shift(roster.agents),\n tools: shift(roster.tools),\n mcpServers: shift(roster.mcpServers),\n };\n}\n\n/**\n * Fold a subagent branch's own roster into the session's.\n *\n * A subagent is offered its own roster — every sidecar transcript checked\n * carries `skill_listing` and `deferred_tools_delta` records of its own — and\n * that roster is a *different* set from the parent's. Replaying it as if it\n * were the main chain's would churn the parent's intervals, since a sidecar's\n * listing is `isInitial: true` and would withdraw everything the parent had.\n *\n * So only names the session never saw at all are added, tagged with the branch\n * that saw them and never withdrawn. That keeps the main chain's intervals\n * exact while making \"was this ever on the menu?\" — the question coverage asks\n * — answer correctly for a skill only a subagent was offered.\n */\nexport function foldBranchAvailability(\n roster: TraceAvailability,\n branch: TraceAvailability,\n branchId: string,\n spawnIndex: number,\n): void {\n if (!branch.recorded) return;\n roster.recorded = true;\n const merge = (into: AvailabilityEntry[], from: AvailabilityEntry[]): void => {\n const known = offeredNames(into);\n for (const entry of from) {\n if (known.has(entry.name)) continue;\n known.add(entry.name);\n into.push({\n ...entry,\n offeredAt: spawnIndex,\n branchId,\n ...(entry.withdrawnAt !== undefined ? { withdrawnAt: undefined } : {}),\n });\n }\n };\n merge(roster.skills, branch.skills);\n merge(roster.agents, branch.agents);\n merge(roster.tools, branch.tools);\n merge(roster.mcpServers, branch.mcpServers);\n}\n","/**\n * Offered versus used (ADR 01016).\n *\n * Artifact resolution starts from what the trace *used*, so a skill that should\n * have been invoked and was not resolves to nothing and is reported nowhere.\n * The availability roster closes that blind spot without a filesystem scan:\n * the evidence travels inside the trace, so it works on any machine and on\n * every session already recorded.\n *\n * Three states, never collapsed:\n *\n * - **offered and used** — the ordinary case.\n * - **offered and not used** — a judgement call for a person to make. Counted\n * by default and listed only on request, because a real roster runs to\n * hundreds of skills and would drown the report.\n * - **not offered** — the session referenced it but it was never on the menu.\n * That is a *configuration* bug, not an adherence failure, and it is the\n * state that is invisible today.\n *\n * This is an observation. It never becomes an eval outcome and never moves the\n * exit code.\n *\n * `discoverArtifacts` is deliberately not used here: it scans the project tree\n * for authoring, and the roster makes a scan unnecessary anyway.\n */\nimport { offeredNames } from \"../trace/availability.js\";\nimport type { Trace } from \"../trace/types.js\";\nimport type {\n AvailabilityCounts,\n AvailabilityReport,\n CoverageEntry,\n} from \"./types.js\";\n\nexport interface AvailabilityOptions {\n /** Include a coverage row per offered-but-unused artifact, not just a count. */\n listUnused?: boolean;\n}\n\nexport interface AvailabilityCoverage {\n report: AvailabilityReport;\n /** The rows handed in, annotated, plus the unused ones when listed. */\n coverage: CoverageEntry[];\n}\n\n/**\n * A fresh zero row per call. One shared object assigned to both `skills` and\n * `agents` would make a mutation of either silently move the other; every\n * caller is read-only today, which is exactly why it would go unnoticed.\n */\nconst empty = (): AvailabilityCounts => ({ offered: 0, used: 0, unused: 0 });\n\n/**\n * Kinds the roster says nothing about, so no row of theirs may carry a state.\n *\n * Project rules are never *offered* — they are in force from the first turn.\n * Slash commands have no listing record of any kind, so `not-offered` would be\n * a confident accusation drawn from evidence that was never collected — which\n * is precisely what a built-in command looked like before it had its own type\n * (ADR 01016's recorded limitation, closed by ADR 01023).\n */\nconst UNROSTERED = new Set<CoverageEntry[\"kind\"]>([\n \"project-rules\",\n \"slash-command\",\n]);\n\nexport function coverAvailability(\n trace: Trace,\n coverage: CoverageEntry[],\n options: AvailabilityOptions = {},\n): AvailabilityCoverage {\n const roster = trace.availability;\n if (!roster.recorded) {\n // No listing records: unknown, not zero. Every row says so rather than\n // implying the session was offered nothing.\n return {\n report: { recorded: false, skills: empty(), agents: empty(), listed: false },\n coverage: coverage.map((entry) =>\n UNROSTERED.has(entry.kind)\n ? entry\n : { ...entry, availability: \"unknown\" as const },\n ),\n };\n }\n\n const offeredSkills = offeredNames(roster.skills);\n const offeredAgents = offeredNames(roster.agents);\n const offeredFor = (kind: CoverageEntry[\"kind\"]): Set<string> =>\n kind === \"skill\" ? offeredSkills : offeredAgents;\n\n const usedSkills = new Set<string>();\n const usedAgents = new Set<string>();\n\n const annotated = coverage.map((entry) => {\n if (UNROSTERED.has(entry.kind)) return entry;\n const offered = offeredFor(entry.kind).has(entry.ref);\n if (offered) {\n (entry.kind === \"skill\" ? usedSkills : usedAgents).add(entry.ref);\n }\n return {\n ...entry,\n availability: offered ? (\"offered-and-used\" as const) : (\"not-offered\" as const),\n };\n });\n\n const listUnused = options.listUnused === true;\n const unusedRows: CoverageEntry[] = [];\n const collect = (kind: \"skill\" | \"agent\", used: Set<string>): number => {\n let unused = 0;\n // Ordered by first offer, and deduplicated: a name withdrawn and\n // re-offered is two intervals but one artifact.\n const seen = new Set<string>();\n for (const entry of kind === \"skill\" ? roster.skills : roster.agents) {\n if (seen.has(entry.name)) continue;\n seen.add(entry.name);\n if (used.has(entry.name)) continue;\n unused += 1;\n if (!listUnused) continue;\n unusedRows.push({\n ref: entry.name,\n kind,\n resolved: false,\n tried: [],\n note:\n entry.description === undefined\n ? \"offered, never used\"\n : `offered, never used — ${firstLine(entry.description)}`,\n availability: \"offered-not-used\",\n });\n }\n return unused;\n };\n\n const skillsUnused = collect(\"skill\", usedSkills);\n const agentsUnused = collect(\"agent\", usedAgents);\n\n return {\n report: {\n recorded: true,\n skills: {\n offered: offeredSkills.size,\n used: usedSkills.size,\n unused: skillsUnused,\n },\n agents: {\n offered: offeredAgents.size,\n used: usedAgents.size,\n unused: agentsUnused,\n },\n listed: listUnused,\n },\n coverage: [...annotated, ...unusedRows],\n };\n}\n\n/** Descriptions wrap over several lines; a table cell wants the first one. */\nfunction firstLine(description: string): string {\n const line = description.split(\"\\n\")[0] ?? \"\";\n return line.length > 160 ? `${line.slice(0, 157)}...` : line;\n}\n","/**\n * Filesystem helpers shared by trace-driven artifact resolution and static\n * artifact discovery. Every function degrades to null/empty rather than\n * throwing: a missing or unreadable path is a coverage note, never a crash.\n */\nimport { access, readdir, readFile, stat } from \"node:fs/promises\";\nimport { dirname, join, resolve, sep } from \"node:path\";\n\n/**\n * Directory names never worth walking. `.git` alone can hold more entries than\n * the rest of a repo combined, and `node_modules` hides vendored skills that\n * are not the project's to edit.\n */\n/**\n * Path split into segments with separators normalised, so convention\n * matching (\"is this under `.claude/commands/`?\") agrees between\n * trace-driven resolution and static discovery. Both had their own\n * byte-identical copy; a drift between them would classify one file two\n * ways in `run` and `fill`.\n */\nexport function segments(path: string): string[] {\n return path.split(sep).join(\"/\").split(\"/\");\n}\n\nexport const PRUNED_DIRS = new Set([\n \"node_modules\",\n \".git\",\n \"dist\",\n \"build\",\n \"coverage\",\n \".manni\",\n \".tmp\",\n \".next\",\n \".venv\",\n]);\n\n/** Nearest ancestor containing `.git` (a directory *or* a worktree file). */\nexport async function findGitRoot(start: string): Promise<string | null> {\n let current = resolve(start);\n for (let depth = 0; depth < 64; depth += 1) {\n try {\n await access(join(current, \".git\"));\n return current;\n } catch {\n // keep walking\n }\n const parent = dirname(current);\n if (parent === current) return null;\n current = parent;\n }\n return null;\n}\n\nexport async function safeRead(path: string): Promise<string | null> {\n try {\n return await readFile(path, \"utf-8\");\n } catch {\n return null;\n }\n}\n\n/**\n * Last-modified time of `path` as an ISO-8601 string, or null when it cannot\n * be read. Used for the staleness heuristic (ADR 01021); like everything else\n * here it degrades rather than throwing — an artifact whose mtime is\n * unreadable is simply one the report says nothing about.\n */\nexport async function safeMtime(path: string): Promise<string | null> {\n try {\n const info = await stat(path);\n return info.mtime.toISOString();\n } catch {\n return null;\n }\n}\n\n/** First file under `root` matching `match`, or null. */\nexport async function findInTree(\n root: string,\n match: (path: string) => boolean,\n): Promise<string | null> {\n let entries;\n try {\n entries = await readdir(root, { withFileTypes: true, recursive: true });\n } catch {\n return null;\n }\n for (const entry of entries) {\n if (!entry.isFile()) continue;\n const full = join(entry.parentPath, entry.name);\n if (match(full)) return full;\n }\n return null;\n}\n\nexport interface ListOptions {\n /** Directory names to skip; defaults to PRUNED_DIRS. */\n prune?: Set<string>;\n maxDepth?: number;\n}\n\n/**\n * Every file under `root` matching `match`, sorted for stable output.\n *\n * Hand-rolled rather than `readdir({recursive:true})` because pruning has to\n * happen *during* the walk — a recursive readdir would enumerate all of\n * `node_modules` before we could filter it. Symlinked directories report\n * `isDirectory() === false`, so loops are not followed.\n */\nexport async function listInTree(\n root: string,\n match: (path: string) => boolean,\n options: ListOptions = {},\n): Promise<string[]> {\n const prune = options.prune ?? PRUNED_DIRS;\n const maxDepth = options.maxDepth ?? 24;\n const found: string[] = [];\n\n async function walk(dir: string, depth: number): Promise<void> {\n if (depth > maxDepth) return;\n let entries;\n try {\n entries = await readdir(dir, { withFileTypes: true });\n } catch {\n return; // unreadable directory is a skip, not a failure\n }\n for (const entry of entries) {\n const full = join(dir, entry.name);\n if (entry.isDirectory()) {\n if (prune.has(entry.name)) continue;\n await walk(full, depth + 1);\n } else if (entry.isFile() && match(full)) {\n found.push(full);\n }\n }\n }\n\n await walk(resolve(root), 0);\n return found.sort();\n}\n","/**\n * Deterministic artifact resolution: map every skill/agent/project-rule\n * reference in a trace to a file on disk. Trace content + filesystem lookup\n * only — no LLM guessing. Unresolved refs degrade to coverage entries and\n * warnings, never a crash (ADR 01003).\n */\nimport { basename, dirname, join, resolve } from \"node:path\";\nimport { configDir } from \"../trace/discover.js\";\nimport { coverAvailability } from \"./availability.js\";\nimport { findGitRoot, findInTree, safeMtime, safeRead, segments } from \"./fs.js\";\nimport { checkContent, hashFile, relPosix } from \"../capture/manifest.js\";\nimport type { SessionManifest } from \"../capture/types.js\";\nimport type { Trace } from \"../trace/types.js\";\nimport type {\n CoverageEntry,\n ResolvedArtifact,\n ResolvedArtifacts,\n} from \"./types.js\";\n\nexport interface ResolveOptions {\n /** Overrides the trace's recorded cwd (for deleted workspaces). */\n projectDir?: string;\n /** Ceiling for the parent-directory walk; defaults to the git root. */\n projectRoot?: string;\n env?: Record<string, string | undefined>;\n /**\n * List every offered-but-unused artifact in the coverage table rather than\n * only counting them (ADR 01016). Off by default: a real roster runs to\n * hundreds of skills.\n */\n reportUnusedArtifacts?: boolean;\n /**\n * The session manifest for this trace, when one was found (ADR 01024). It\n * makes staleness exact for the artifacts it recorded and changes nothing\n * else — no eval outcome, no exit code, no resolution decision.\n */\n manifest?: SessionManifest;\n}\n\n/**\n * Project-rules filenames, in the order they are checked. Different agent\n * tools use different names for the same artifact; all are read the same way.\n */\nexport const PROJECT_RULES_FILENAMES = [\n \"CLAUDE.md\",\n \"AGENTS.md\",\n \"GEMINI.md\",\n] as const;\n\n/** Agents that ship with Claude Code and have no definition file on disk. */\nconst BUILTIN_AGENTS = new Set([\n \"general-purpose\",\n \"claude\",\n \"Explore\",\n \"Plan\",\n \"statusline-setup\",\n \"fork\",\n]);\n\nexport async function resolveArtifacts(\n trace: Trace,\n options: ResolveOptions = {},\n): Promise<ResolvedArtifacts> {\n const projectDir = resolve(options.projectDir ?? trace.cwd);\n const userDir = configDir(options.env);\n const projectRoot = resolve(\n options.projectRoot ?? (await findGitRoot(projectDir)) ?? projectDir,\n );\n\n const artifacts: ResolvedArtifact[] = [];\n const coverage: CoverageEntry[] = [];\n const warnings: string[] = [];\n const seenPaths = new Set<string>();\n const seenRefs = new Set<string>();\n\n const add = (artifact: ResolvedArtifact): void => {\n if (seenPaths.has(artifact.path)) return;\n seenPaths.add(artifact.path);\n artifacts.push(artifact);\n };\n\n /** Record a resolved skill once, however many refs reached it. */\n const addSkill = (\n name: string,\n artifact: ResolvedArtifact,\n tried: string[],\n ): void => {\n const refKey = `skill:${name}`;\n if (seenRefs.has(refKey)) return;\n seenRefs.add(refKey);\n add(artifact);\n coverage.push({\n ref: name,\n kind: \"skill\",\n resolved: true,\n path: artifact.path,\n tried,\n });\n };\n\n for (const invocation of trace.skillInvocations) {\n // A `<command-name>` injection is the slash-command mechanism, and a slash\n // command is one of three things: a `.claude/commands/*.md` file, a skill\n // surfaced under its slash form, or a built-in with no file anywhere. Only\n // the filesystem can say which, so the shape of the reference decides\n // nothing on its own (ADR 01023).\n if (invocation.via === \"command-injection\") {\n const refKey = `command:${invocation.name}`;\n if (seenRefs.has(refKey)) continue;\n seenRefs.add(refKey);\n\n const command = await resolveSlashCommand(\n invocation.name,\n projectDir,\n userDir,\n );\n if (command.artifact) {\n add(command.artifact);\n coverage.push({\n ref: invocation.name,\n kind: \"slash-command\",\n resolved: true,\n path: command.artifact.path,\n tried: command.tried,\n });\n continue;\n }\n\n const skill = await resolveSkill(invocation.name, projectDir, userDir);\n if (skill.artifact) {\n addSkill(invocation.name, skill.artifact, skill.tried);\n // Resolved as a skill, so the slash-command lookup below must not\n // also record it — one reference yields one coverage row.\n continue;\n }\n\n // No definition file in any place a command or a skill could live. Claude\n // Code's own commands (`/model`, `/compact`) have no file by design, so\n // this is reported rather than warned about — and reported as what it is\n // rather than as a skill that went missing, which is the defect ADR 01016\n // recorded. A hard-coded list of built-in names was rejected: it would go\n // stale with every Claude Code release.\n coverage.push({\n ref: invocation.name,\n kind: \"slash-command\",\n resolved: false,\n tried: [...command.tried, ...skill.tried],\n note: \"built-in slash command, or not installed here (no definition file)\",\n });\n continue;\n }\n\n // A `Skill` tool call is unambiguous: it names a skill.\n const refKey = `skill:${invocation.name}`;\n if (seenRefs.has(refKey)) continue;\n const { artifact, tried } = await resolveSkill(\n invocation.name,\n projectDir,\n userDir,\n );\n if (artifact) {\n addSkill(invocation.name, artifact, tried);\n } else {\n seenRefs.add(refKey);\n coverage.push({ ref: invocation.name, kind: \"skill\", resolved: false, tried });\n warnings.push(\n `skill \"${invocation.name}\" was invoked but no SKILL.md was found (${tried.length} location(s) tried)`,\n );\n }\n }\n\n for (const spawn of trace.agentSpawns) {\n const refKey = `agent:${spawn.subagentType}`;\n if (seenRefs.has(refKey)) continue;\n seenRefs.add(refKey);\n if (BUILTIN_AGENTS.has(spawn.subagentType)) {\n coverage.push({\n ref: spawn.subagentType,\n kind: \"agent\",\n resolved: false,\n tried: [],\n note: \"built-in agent (no definition file)\",\n });\n continue;\n }\n const { artifact, tried } = await resolveAgent(\n spawn.subagentType,\n projectDir,\n userDir,\n );\n if (artifact) {\n add(artifact);\n coverage.push({\n ref: spawn.subagentType,\n kind: \"agent\",\n resolved: true,\n path: artifact.path,\n tried,\n });\n } else {\n coverage.push({\n ref: spawn.subagentType,\n kind: \"agent\",\n resolved: false,\n tried,\n });\n warnings.push(\n `agent \"${spawn.subagentType}\" was spawned but no definition file was found (${tried.length} location(s) tried)`,\n );\n }\n }\n\n const rules = await resolveProjectRules(projectDir, projectRoot);\n for (const rule of rules.artifacts) add(rule);\n const rulesEntry: CoverageEntry = {\n ref: \"project rules\",\n kind: \"project-rules\",\n resolved: rules.artifacts.length > 0,\n tried: rules.tried,\n ...(rules.artifacts.length === 0\n ? { note: \"no CLAUDE.md or AGENTS.md found\" }\n : {}),\n };\n coverage.push(rulesEntry);\n\n // One aggregated entry covers several files, so it has no single `path` to\n // stat; name them explicitly. Every other entry stats the file it resolved to.\n //\n // Before the roster pass, not after: staleness only has something to say\n // about rows that resolved to a file, and the roster's own offered-but-unused\n // rows never do. Annotating first also keeps these flags on the entries the\n // roster copies forward.\n await annotateStaleness(\n trace,\n coverage,\n new Map([[rulesEntry, rules.artifacts.map((a) => a.path)]]),\n warnings,\n projectRoot,\n projectDir,\n options.manifest,\n );\n\n // What the session was *offered* is the other half of coverage: resolution\n // only ever sees what it used (ADR 01016).\n const availability = coverAvailability(trace, coverage, {\n ...(options.reportUnusedArtifacts !== undefined\n ? { listUnused: options.reportUnusedArtifacts }\n : {}),\n });\n\n return {\n artifacts,\n coverage: availability.coverage,\n availability: availability.report,\n warnings,\n };\n}\n\n// ── Staleness ────────────────────────────────────────────────────\n\n/**\n * Say, for every resolved artifact, whether it is still the one the session\n * followed. Evals are read from the artifact *as it is now* while the session\n * followed it *as it was then*, so editing a SKILL.md after a session grades\n * that session against instructions it never saw.\n *\n * Two sources of evidence, and the better one wins **only on its own question**:\n *\n * - **A session manifest** (ADR 01024) recorded a sha256 per artifact when the\n * session started. A digest that differs is an exact \"this changed\"; a digest\n * that matches is an exact \"this did not\". Either one settles the row.\n * - **mtime** (ADR 01021) is the fallback, and a soft one: it is not content\n * identity, a fresh clone rewrites every mtime, and an unreadable mtime says\n * nothing.\n *\n * A manifest may therefore quiet the mtime warning for an artifact it covers —\n * that is the entire point, since a checkout otherwise flags everything in CI —\n * and it may do nothing else. It never reaches an eval outcome, never moves the\n * exit code, and it cannot silence a row it has no entry for. The observation\n * itself (`modifiedAt`) is reported either way, so nothing is hidden; only the\n * conclusion drawn from it changes.\n */\nasync function annotateStaleness(\n trace: Trace,\n coverage: CoverageEntry[],\n extraPaths: Map<CoverageEntry, string[]>,\n warnings: string[],\n projectRoot: string,\n projectDir: string,\n manifest?: SessionManifest,\n): Promise<void> {\n // No session end means no ground for the *heuristic* to stand on, and\n // guessing one would manufacture a warning out of no evidence. A manifest\n // supplies its own ground, so it still has something to say here.\n const endedAt =\n trace.endedAt !== undefined ? Date.parse(trace.endedAt) : Number.NaN;\n const haveEnd = Number.isFinite(endedAt);\n if (!haveEnd && manifest === undefined) return;\n\n const base =\n manifest === undefined\n ? projectRoot\n : joinBase(manifest, coverage, extraPaths, [\n projectDir,\n projectRoot,\n manifest.root,\n ]);\n\n /** Refs still resting on the mtime guess. */\n const guessed: string[] = [];\n /** Refs the manifest proved changed. */\n const changed: string[] = [];\n /** Whether the manifest spoke to any row at all. */\n let joined = false;\n\n for (const entry of coverage) {\n if (!entry.resolved) continue;\n const paths = extraPaths.get(entry) ?? (entry.path ? [entry.path] : []);\n if (paths.length === 0) continue;\n\n let newest: string | undefined;\n let outside = false;\n const digests = new Map<string, string>();\n for (const path of paths) {\n const mtime = await safeMtime(path);\n if (mtime !== null && (newest === undefined || mtime > newest)) {\n newest = mtime;\n }\n if (manifest === undefined) continue;\n // Keyed on the path relative to the base **both sides agree on**, so the\n // manifest still joins after the repository has been checked out\n // somewhere else. An artifact outside that base — a user-level or plugin\n // skill — has no relative path, and `capture` is project-scoped, so it\n // was never recordable in the first place. That is a different sentence\n // from \"it changed\" and gets one.\n const rel = relPosix(base, path);\n if (rel === null) {\n outside = true;\n continue;\n }\n const digest = await hashFile(path);\n if (digest !== null) digests.set(rel, digest);\n }\n if (newest !== undefined) entry.modifiedAt = newest;\n\n const check =\n manifest === undefined\n ? ({\n status: \"skipped\",\n reason: \"no session manifest for this trace\",\n } as const)\n : outside && digests.size === 0\n ? ({\n status: \"skipped\",\n reason:\n \"outside the project root, so no session manifest could record it\",\n } as const)\n : checkContent(manifest, digests);\n entry.contentCheck = check;\n if (check.status !== \"skipped\") joined = true;\n\n if (check.status === \"mismatch\") {\n entry.stale = true;\n changed.push(entry.ref);\n continue;\n }\n if (check.status === \"match\") {\n // Exact, and it answers mtime's own question — so the guess does not run.\n entry.stale = false;\n continue;\n }\n if (!haveEnd || newest === undefined) continue;\n entry.stale = Date.parse(newest) > endedAt;\n if (entry.stale) guessed.push(entry.ref);\n }\n\n if (changed.length > 0) {\n warnings.push(\n `${changed.length} artifact(s) changed since the session started ` +\n `(${changed.join(\", \")}) — the session manifest recorded a different ` +\n `sha256, so their evals are not the instructions this session followed.`,\n );\n }\n if (guessed.length > 0) {\n // One warning, not one per artifact: a fresh checkout flags everything, and\n // a wall of identical lines is how a real signal gets tuned out.\n warnings.push(\n `${guessed.length} artifact(s) were modified after the session ended ` +\n `(${guessed.join(\", \")}) — their evals may not be the instructions ` +\n `this session followed. mtime is a heuristic, not content identity.`,\n );\n }\n // A manifest that speaks to nothing is a different problem from a manifest\n // with a gap in it, and it degrades row by row into the same sentence — the\n // one an absent manifest produces. Say it once, at the top.\n //\n // Only when it recorded something: a manifest with no artifacts in it — a\n // project whose instruction files all live outside the capture scope — has\n // nothing to match, which is not a join failure.\n if (manifest !== undefined && manifest.artifacts.length > 0 && !joined) {\n warnings.push(\n `the session manifest matched no artifact in this run — it recorded ` +\n `${manifest.artifacts.length} artifact(s) relative to \"${manifest.root}\", ` +\n `and nothing resolved here lines up with them, so every hash check ` +\n `fell back to the mtime heuristic. Check that --project names the ` +\n `directory the session ran in.`,\n );\n }\n}\n\n/**\n * Pick the base to key the manifest join on.\n *\n * `capture` writes each path relative to *its* project root — the session's\n * cwd — while resolution keys on the git root when `--project` is absent. In a\n * monorepo those are different directories, so one file gets two different\n * relative paths and every hash check silently degraded to `skipped`: exactly\n * the guesswork a manifest exists to remove, and quietly, row by row.\n *\n * Rather than pick a side, ask the data. Each candidate base is scored by how\n * many resolved artifacts it turns into a path the manifest actually recorded,\n * and the best score wins — with candidate order as the tiebreak, so a tie\n * keeps today's behaviour. `manifest.root` joins the candidates because it is\n * the capturing machine's own answer; it may have been redacted, or the\n * repository may have moved since, in which case it simply scores zero.\n */\nfunction joinBase(\n manifest: SessionManifest,\n coverage: CoverageEntry[],\n extraPaths: Map<CoverageEntry, string[]>,\n candidates: string[],\n): string {\n const recorded = new Set(manifest.artifacts.map((a) => a.path));\n const paths = coverage\n .filter((entry) => entry.resolved)\n .flatMap((entry) => extraPaths.get(entry) ?? (entry.path ? [entry.path] : []));\n\n let best = candidates[0] as string;\n let bestScore = -1;\n for (const candidate of candidates) {\n if (typeof candidate !== \"string\" || candidate.length === 0) continue;\n let score = 0;\n for (const path of paths) {\n let rel: string | null;\n try {\n rel = relPosix(candidate, path);\n } catch {\n // A redacted `root` can be anything, including something `resolve`\n // refuses. A candidate that cannot be used simply does not win.\n continue;\n }\n if (rel !== null && recorded.has(rel)) score += 1;\n }\n if (score > bestScore) {\n best = candidate;\n bestScore = score;\n }\n }\n return best;\n}\n\n// ── Skills ───────────────────────────────────────────────────────\n\nasync function resolveSkill(\n name: string,\n projectDir: string,\n userDir: string,\n): Promise<{ artifact: ResolvedArtifact | null; tried: string[] }> {\n const tried: string[] = [];\n // `plugin:skill` refs look up the skill by its short name inside the\n // user plugin store; plain refs check project dirs then the user store.\n const [pluginName, shortName] = splitPluginRef(name);\n\n const candidates: Array<{ path: string; origin: ResolvedArtifact[\"origin\"] }> =\n [];\n if (pluginName === null) {\n for (const dir of [\"skills\", join(\"src\", \"skills\"), join(\".claude\", \"skills\")]) {\n candidates.push({\n path: join(projectDir, dir, shortName, \"SKILL.md\"),\n origin: \"project\",\n });\n }\n candidates.push({\n path: join(userDir, \"skills\", shortName, \"SKILL.md\"),\n origin: \"user\",\n });\n }\n\n for (const candidate of candidates) {\n tried.push(candidate.path);\n const content = await safeRead(candidate.path);\n if (content !== null) {\n return {\n artifact: {\n name,\n type: \"skill\",\n path: candidate.path,\n content,\n origin: candidate.origin,\n },\n tried,\n };\n }\n }\n\n // Plugin store: ~/.claude/plugins/**/skills/<shortName>/SKILL.md. The store\n // layout varies (marketplace caches nest deeper), so search recursively.\n const pluginRoot = join(userDir, \"plugins\");\n tried.push(join(pluginRoot, \"**\", \"skills\", shortName, \"SKILL.md\"));\n const found = await findInTree(\n pluginRoot,\n (path) =>\n basename(path) === \"SKILL.md\" &&\n basename(dirname(path)) === shortName &&\n (pluginName === null || hasPathSegment(path, pluginName)),\n );\n if (found) {\n const content = await safeRead(found);\n if (content !== null) {\n return {\n artifact: { name, type: \"skill\", path: found, content, origin: \"plugin\" },\n tried,\n };\n }\n }\n\n return { artifact: null, tried };\n}\n\n// ── Slash commands ───────────────────────────────────────────────\n\n/**\n * `.claude/commands/<name>.md`, in the three places Claude Code reads them:\n * the project, the user's config directory, and the plugin store.\n *\n * Two shapes matter and neither is guessed at. Subdirectories under\n * `commands/` **organize** rather than namespace — `commands/release/tag.md`\n * is still invoked as `/tag` — so a plain name falls back to a recursive\n * search after the direct hit misses. A `plugin:command` name is plugin\n * namespacing and is looked up in the store by its short name, exactly as\n * `resolveSkill` does for `plugin:skill`; project and user directories are not\n * checked, because a namespace is not something a local file can claim.\n */\nasync function resolveSlashCommand(\n name: string,\n projectDir: string,\n userDir: string,\n): Promise<{ artifact: ResolvedArtifact | null; tried: string[] }> {\n const tried: string[] = [];\n const [pluginName, shortName] = splitPluginRef(name);\n\n const made = (\n path: string,\n content: string,\n origin: ResolvedArtifact[\"origin\"],\n ): { artifact: ResolvedArtifact; tried: string[] } => ({\n artifact: { name, type: \"slash-command\", path, content, origin },\n tried,\n });\n\n if (pluginName === null) {\n const dirs: Array<{ dir: string; origin: ResolvedArtifact[\"origin\"] }> = [\n { dir: join(projectDir, \".claude\", \"commands\"), origin: \"project\" },\n { dir: join(userDir, \"commands\"), origin: \"user\" },\n ];\n for (const { dir, origin } of dirs) {\n const path = join(dir, `${shortName}.md`);\n tried.push(path);\n const content = await safeRead(path);\n if (content !== null) return made(path, content, origin);\n }\n for (const { dir, origin } of dirs) {\n tried.push(join(dir, \"**\", `${shortName}.md`));\n const found = await findInTree(\n dir,\n (path) => basename(path) === `${shortName}.md`,\n );\n if (found === null) continue;\n const content = await safeRead(found);\n if (content !== null) return made(found, content, origin);\n }\n return { artifact: null, tried };\n }\n\n const pluginRoot = join(userDir, \"plugins\");\n tried.push(join(pluginRoot, \"**\", \"commands\", `${shortName}.md`));\n const found = await findInTree(\n pluginRoot,\n (path) =>\n basename(path) === `${shortName}.md` &&\n segments(path).includes(\"commands\") &&\n hasPathSegment(path, pluginName),\n );\n if (found !== null) {\n const content = await safeRead(found);\n if (content !== null) return made(found, content, \"plugin\");\n }\n return { artifact: null, tried };\n}\n\n/** Path segments, separator-normalized, for convention matching. */\n/**\n * Split `plugin:name` into its two halves.\n *\n * On the **first** colon, keeping the remainder: `split(\":\", 2)` throws away\n * everything past the second field, so `myplugin:release:tag` resolved as a\n * lookup for `release` — a different artifact, reported as if it were the one\n * asked for. The namespace is the part before the first colon; everything\n * after it is the name, whatever it contains.\n */\nfunction splitPluginRef(name: string): [string | null, string] {\n const at = name.indexOf(\":\");\n if (at === -1) return [null, name];\n return [name.slice(0, at), name.slice(at + 1)];\n}\n\n/**\n * True when `pluginName` is a *segment* of `path`.\n *\n * `path.includes(pluginName)` was unanchored over the whole absolute path, so\n * a plugin named `docs` matched `~/.claude/plugins/other-plugin/commands/\n * docs-helper/x.md` — and, on Windows, matched every path under a home\n * directory of `C:\\Users\\docs\\`. A plugin is a directory, so the test is\n * whether the path passes through a directory of that name.\n */\nfunction hasPathSegment(path: string, pluginName: string): boolean {\n return segments(path).includes(pluginName);\n}\n\n// ── Agents ───────────────────────────────────────────────────────\n\nasync function resolveAgent(\n subagentType: string,\n projectDir: string,\n userDir: string,\n): Promise<{ artifact: ResolvedArtifact | null; tried: string[] }> {\n const tried: string[] = [];\n // Plugin agents are referenced as `plugin:agent`; the file is the short name.\n const shortName = splitPluginRef(subagentType)[1];\n\n const candidates: Array<{ path: string; origin: ResolvedArtifact[\"origin\"] }> = [\n { path: join(projectDir, \".claude\", \"agents\", `${shortName}.md`), origin: \"project\" },\n { path: join(projectDir, \"agents\", `${shortName}.md`), origin: \"project\" },\n { path: join(userDir, \"agents\", `${shortName}.md`), origin: \"user\" },\n ];\n\n for (const candidate of candidates) {\n tried.push(candidate.path);\n const content = await safeRead(candidate.path);\n if (content !== null) {\n return {\n artifact: {\n name: subagentType,\n type: \"agent\",\n path: candidate.path,\n content,\n origin: candidate.origin,\n },\n tried,\n };\n }\n }\n return { artifact: null, tried };\n}\n\n// ── Project rules ────────────────────────────────────────────────\n\nasync function resolveProjectRules(\n projectDir: string,\n projectRoot: string,\n): Promise<{ artifacts: ResolvedArtifact[]; tried: string[] }> {\n const artifacts: ResolvedArtifact[] = [];\n const tried: string[] = [];\n\n // Walk from the cwd up to the project root (inclusive), then check .claude/.\n const dirs: string[] = [];\n let current = projectDir;\n for (let depth = 0; depth < 32; depth += 1) {\n dirs.push(current);\n if (current === projectRoot) break;\n const parent = dirname(current);\n if (parent === current) break;\n current = parent;\n }\n dirs.push(join(projectRoot, \".claude\"));\n\n for (const dir of dirs) {\n for (const filename of PROJECT_RULES_FILENAMES) {\n const path = join(dir, filename);\n tried.push(path);\n const content = await safeRead(path);\n if (content !== null) {\n artifacts.push({\n name: filename,\n type: \"project-rules\",\n path,\n content,\n origin: \"project\",\n });\n }\n }\n }\n return { artifacts, tried };\n}\n\n// Filesystem helpers live in ./fs.js, shared with static discovery.\n","/**\n * The artifact vocabulary `manni tracevals` implements:\n * `manni:artifact-evals:1.1.0`, the built-in the metadata tool registers\n * under `src/meta/schemas/` (proposal 0076). Artifacts are validated against\n * that schema itself, imported and bundled into the build, so tracevals and\n * `manni meta validate` read the same bytes and the built CLI never reads a\n * `schemas/` directory at runtime.\n *\n * 1.1.0 rather than 1.0.0 because it names `tool-order`, a grader this tool\n * ships. The open vocabulary accepts any kebab grader name at either version.\n *\n * tracevals ships no copy of the schema. A copy is a second artifact to keep\n * in step, and the two it used to publish had drifted: they kept\n * `eval-provenance` and the `info` severity after 0046 removed both. A\n * consumer who wants to validate artifacts names `manni:artifact-evals:1.1.0`\n * to `manni meta validate`, or validates against the object below.\n *\n * The validator is this tool's own Ajv rather than meta's `Validator`, which\n * takes refs it can load rather than a schema object. Violations are converted\n * to `FieldError` here so everything downstream — the planner, the reporters —\n * sees the one finding shape the family reports.\n */\nimport { Ajv2020 } from \"ajv/dist/2020.js\";\nimport type { DefinedError, ErrorObject } from \"ajv\";\nimport type { FieldError } from \"../../meta/index.js\";\nimport schema from \"../../meta/schemas/artifact-evals/1.1.0.json\" with { type: \"json\" };\n\n/** The artifact-evals vocabulary, for validators that accept an inline schema. */\nexport const artifactEvalsSchema = schema as unknown as Record<string, unknown>;\n\n/** The vocabulary's `$id`: `manni:artifact-evals:1.1.0`. */\nexport const ARTIFACT_EVALS_SCHEMA_ID: string = schema.$id;\n\nconst ajv = new Ajv2020({ allErrors: true, allowUnionTypes: true });\n// The vocabulary marks `metadata` `x-manni-location: external` (0047). The\n// mark is an annotation for `manni meta relocate`, not a constraint, so it is\n// registered rather than validated — but it has to be registered, or Ajv's\n// strict mode refuses to compile the schema at all.\najv.addKeyword({ keyword: \"x-manni-location\" });\nconst validateArtifact = ajv.compile(artifactEvalsSchema);\n\n/**\n * The stable identifier inside a violation, when its keyword names a *thing*.\n * Keywords whose parameter is a schema-authored value (`pattern`'s regex,\n * `enum`'s list) are deliberately left without one: including those would\n * change a finding's identity every time the schema author edited the rule.\n */\nfunction subjectOf(e: DefinedError): string | undefined {\n switch (e.keyword) {\n case \"required\":\n return e.params.missingProperty;\n case \"additionalProperties\":\n return e.params.additionalProperty;\n case \"format\":\n return e.params.format;\n case \"type\":\n return e.params.type;\n default:\n return undefined;\n }\n}\n\n/**\n * Validate an artifact's whole front matter against the vocabulary. The schema is\n * document-rooted — `metadata` stays open so other tools' members pass\n * untouched — which is why it is handed the entire object rather than the\n * `evals` value alone.\n */\nexport function artifactEvalsErrors(\n data: Record<string, unknown>,\n lineFor: (pointer: string) => number | undefined,\n): FieldError[] {\n if (validateArtifact(data)) return [];\n const errors: FieldError[] = [];\n for (const raw of validateArtifact.errors ?? []) {\n errors.push(toFieldError(raw, lineFor));\n }\n return errors;\n}\n\nfunction toFieldError(\n e: ErrorObject,\n lineFor: (pointer: string) => number | undefined,\n): FieldError {\n const subject = subjectOf(e as DefinedError);\n // `required` and `additionalProperties` point `instancePath` at the *parent*\n // and name the property in the message, so the property is spelled out\n // rather than left to the reader to find.\n const message =\n subject !== undefined && (e.keyword === \"required\" || e.keyword === \"additionalProperties\")\n ? `${e.message ?? \"is invalid\"} (\"${subject}\")`\n : (e.message ?? \"is invalid\");\n const line = lineFor(e.instancePath);\n return {\n schema: ARTIFACT_EVALS_SCHEMA_ID,\n instancePath: e.instancePath,\n message,\n keyword: e.keyword,\n ...(subject !== undefined ? { subject } : {}),\n ...(line !== undefined ? { line } : {}),\n };\n}\n","/**\n * Eval extraction: read the `metadata.evals` block from an artifact via the\n * metadata library and validate the artifact's whole front matter against\n * `manni:artifact-evals:1.1.0`. Invalid blocks are reported as errors with\n * source line numbers, never silently ignored (ADR 01002).\n *\n * The vocabulary is the metadata tool's registered built-in; this tool\n * implements behavior against it (ADR 01010) and bundles it rather than\n * shipping a copy — see `schema.ts`. The schema is document-rooted, which is\n * why validation is handed the entire front matter object rather than the\n * `evals` value alone.\n */\nimport {\n extractFrontmatter,\n type ExtractedMetadata,\n type FieldError,\n} from \"../../meta/index.js\";\nimport { metaProvenanceEntries } from \"../../meta/internal.js\";\nimport type { ResolvedArtifact } from \"../artifacts/types.js\";\nimport type { TraceTarget } from \"../core/target.js\";\nimport { ARTIFACT_EVALS_SCHEMA_ID, artifactEvalsErrors } from \"./schema.js\";\n\nexport { ARTIFACT_EVALS_SCHEMA_ID };\n\n/**\n * The family scale (`src/shared/severity.ts`): `notice | warning | error`.\n * proposal.2 spelled the quietest level `info`; proposal.4 spells it the way\n * every other manni tool does, so a finding reads the same everywhere.\n */\nexport type { Severity } from \"../../shared/severity.js\";\nimport type { Severity } from \"../../shared/severity.js\";\n\n/**\n * `capability` probes a boundary and is expected to fail sometimes;\n * `regression` protects behavior that already works. Reported, not enforced.\n */\nexport type EvalType = \"capability\" | \"regression\";\n\nexport interface EvalEntry {\n /** Stable identifier. Required by the schema on object entries. */\n id: string;\n /** Absent on graders whose options say everything. */\n assertion?: string;\n type: EvalType;\n /** \"ai\", \"human\", \"command\", or a deterministic grader kind. */\n grader: string;\n /** Overrides the configured judge provider for this eval only. */\n provider?: string;\n /** Overrides the judge model for this eval only; a CLI --model still wins. */\n model?: string;\n /** Ensemble runs for this eval only; a CLI --runs still wins. */\n runs?: number;\n /** Which bytes the grader receives. Absent means the whole transcript. */\n target?: TraceTarget;\n /** Relative contribution to the run's pass rate. Never changes the outcome. */\n weight?: number;\n options?: Record<string, unknown>;\n severity: Severity;\n evidence?: string;\n examples?: { pass?: string[]; fail?: string[] };\n /** Per-entry opt-out; reported as skipped, never silently dropped. */\n skip?: boolean;\n /**\n * Maps a `tool:*` grader's own severities onto eval severities. Accepted so\n * one entry vocabulary ports across both docmeta eval schemas; ignored here,\n * because this repo implements no `tool:*` graders.\n */\n severityMap?: Record<string, Severity>;\n /** Command-graded evals: argv, with `{trace}` substituted at grade time. */\n command?: string[];\n successExitCodes?: number[];\n timeoutMs?: number;\n /** sha256 of `assertion` when the check script was generated. */\n generatedAssertionHash?: string;\n}\n\nexport interface ExtractedEvals {\n evals: EvalEntry[];\n /** Schema violations in the front matter, with line numbers when known. */\n errors: FieldError[];\n /** Whether a `metadata.evals` block was present. */\n declared: boolean;\n /** `metadata.eval-skip` — skip this artifact's evals entirely. */\n skip: boolean;\n /**\n * Which model proposed each eval, by eval id, from\n * `metadata.meta-provenance` — the family's attribution record (0046),\n * written by `fill` through the same merge `manni meta fill` uses. Reading\n * it is what lets the judge notice it is grading an assertion it wrote\n * itself, which is bias on the *criterion* rather than on the session.\n *\n * Names are bare model names, the same spelling a provider's `modelName()`\n * returns, so the two sides of that comparison can actually match.\n *\n * A list because one id may appear under several `generated-by` entries —\n * a re-fill by a second model extends the block rather than replacing it.\n */\n proposedBy: Map<string, string[]>;\n}\n\n/**\n * Members of `metadata` this vocabulary claims. The schema cannot reject the\n * rest: `metadata` is the host tool's extension bag and must stay open, so a\n * misspelled `eval-skpi` would validate and quietly do nothing. Reserving the\n * `eval-` prefix at run time restores the closed block's loud-typo property.\n */\nconst CLAIMED_KEYS = [\"evals\", \"eval-skip\", \"meta-provenance\"] as const;\n\n/**\n * The one member under the reserved prefix this vocabulary keeps. proposal.4\n * narrowed the guard to `^eval-(?!skip$)`, so `eval-provenance` — proposal.2's\n * name for the attribution trail — is now an error rather than a member\n * everything downstream would silently ignore.\n */\nconst PREFIX_EXCEPTION = \"eval-skip\";\n\n/** A YAML mapping, as opposed to a list, a scalar, or null. */\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/**\n * `metadata` and everything under it, for one artifact.\n *\n * `supplied` is the seam for the external trail (`evals/external.ts`): the\n * artifact's front matter with a manifest-supplied `metadata` block already\n * merged in, by meta's own merge. It is the whole extraction rather than the\n * block alone, because the schema is document-rooted and validates the entire\n * front matter — handing it the block would validate the wrong document.\n * Omitted, the artifact's own front matter is read, which is what every caller\n * with no collections does.\n */\nexport function extractEvals(\n artifact: ResolvedArtifact,\n supplied?: ExtractedMetadata,\n): ExtractedEvals {\n const extracted = supplied ?? extractFrontmatter(artifact.content, \"markdown\");\n const metadata = extracted.data.metadata;\n // The schema types `metadata` as an object. Anything else — a string, a\n // list, a number — is a fault the validator must report, so it is kept\n // distinct from \"absent\" rather than folded into it.\n const bag = isPlainObject(metadata) ? metadata : undefined;\n const declared = bag !== undefined && bag.evals !== undefined;\n\n // `present` describes the *page*, and the merge leaves it alone. An artifact\n // with no front matter at all whose block a manifest supplies therefore reads\n // as absent unless the merged `metadata` is consulted too — the case a\n // relocated `CLAUDE.md` is in, since project rules rarely carry front matter.\n if (!extracted.present && metadata === undefined) {\n return { evals: [], errors: [], declared: false, skip: false, proposedBy: new Map() };\n }\n\n const typoErrors = reservedPrefixErrors(bag, extracted.lineFor);\n if (typoErrors.length > 0) {\n return { evals: [], errors: typoErrors, declared, skip: false, proposedBy: new Map() };\n }\n\n // Skip the validator only for an artifact this vocabulary has nothing to say\n // about: `metadata` absent, or a well-formed object claiming none of its\n // keys. A `metadata` that is not an object still has to be validated (the\n // schema types it), and so does one carrying only `meta-provenance` — the\n // block is malformed-or-not either way, and a malformed one is never\n // silently ignored.\n const wellFormed = metadata === undefined || bag !== undefined;\n const claimsNothing =\n bag === undefined ||\n !CLAIMED_KEYS.some((key) => bag[key] !== undefined);\n if (wellFormed && claimsNothing) {\n return {\n evals: [],\n errors: [],\n declared: false,\n skip: false,\n proposedBy: new Map(),\n };\n }\n\n const errors = artifactEvalsErrors(extracted.data, extracted.lineFor);\n if (errors.length > 0) {\n return { evals: [], errors, declared, skip: false, proposedBy: new Map() };\n }\n\n // Validation passed, so `metadata` is an object if it is present at all.\n const valid = bag ?? {};\n const skip = valid[\"eval-skip\"] === true;\n return {\n evals: normalizeBlock(valid.evals),\n errors: [],\n declared,\n skip,\n proposedBy: readProvenance(valid[\"meta-provenance\"]),\n };\n}\n\n/**\n * `metadata.meta-provenance` as eval id → the models that proposed it.\n *\n * The entries come from `metaProvenanceEntries`, the family's reader (0046),\n * so the block is read exactly the way `fill` wrote it and the way docevals\n * reads its own. Tolerant by design: the block has already passed the schema,\n * and a shape it did not constrain is not worth failing a run over — the worst\n * outcome of ignoring a malformed entry is one missing bias warning, while the\n * worst outcome of throwing is a run that will not start.\n */\nfunction readProvenance(raw: unknown): Map<string, string[]> {\n const out = new Map<string, string[]>();\n for (const entry of metaProvenanceEntries(raw)) {\n const by = entry[\"generated-by\"];\n for (const id of entry.evals) {\n const list = out.get(id) ?? [];\n if (!list.includes(by)) list.push(by);\n out.set(id, list);\n }\n }\n return out;\n}\n\n/**\n * A key inside `metadata` under the reserved `eval-` prefix that is not the\n * one member this vocabulary claims there. Reported against the offending key\n * so the fix is obvious.\n *\n * proposal.4's guard is `^eval-(?!skip$)`: `eval-provenance`, which proposal.2\n * excepted, now lands here rather than being read by nothing.\n */\nfunction reservedPrefixErrors(\n bag: Record<string, unknown> | undefined,\n lineFor: (pointer: string) => number | undefined,\n): FieldError[] {\n if (bag === undefined) return [];\n const errors: FieldError[] = [];\n for (const key of Object.keys(bag)) {\n // Detection is case-insensitive while the exception is not, deliberately:\n // YAML keys are case-sensitive, so `Eval-skip` is never a valid spelling of\n // `eval-skip` and should be reported rather than accepted. Do not \"fix\" the\n // asymmetry by matching the exception case-insensitively — that would\n // silently accept exactly the misspellings this guard exists to catch.\n if (!/^eval-/i.test(key) || key === PREFIX_EXCEPTION) continue;\n const line = lineFor(`/metadata/${key}`);\n errors.push({\n schema: ARTIFACT_EVALS_SCHEMA_ID,\n instancePath: `/metadata/${key}`,\n message:\n `unrecognized \"eval-\" key; the only one this vocabulary claims under ` +\n `that prefix is ${PREFIX_EXCEPTION} (its other members are ` +\n `${CLAIMED_KEYS.filter((k) => k !== PREFIX_EXCEPTION).join(\" and \")})`,\n keyword: \"additionalProperties\",\n subject: key,\n ...(line !== undefined ? { line } : {}),\n });\n }\n return errors;\n}\n\n/**\n * The block is one assertion as a string, or a list of entries. An absent key\n * yields nothing — an artifact with no evals omits it rather than declaring an\n * empty list, which the schema also refuses.\n */\nfunction normalizeBlock(raw: unknown): EvalEntry[] {\n if (typeof raw === \"string\") return [normalizeEntry(raw, 0)];\n if (!Array.isArray(raw)) return [];\n return raw.map((entry, index) => normalizeEntry(entry, index));\n}\n\nfunction normalizeEntry(raw: unknown, index: number): EvalEntry {\n // The string shorthand is the legitimately id-less form, so its identity is\n // positional. Object entries carry a required `id` precisely because a\n // position-derived name breaks the history join whenever entries move.\n if (typeof raw === \"string\") {\n return {\n id: `eval-${index + 1}`,\n assertion: raw,\n type: \"regression\",\n grader: \"ai\",\n severity: \"error\",\n };\n }\n\n const obj = raw as Record<string, unknown>;\n const entry: EvalEntry = {\n id: obj.id as string,\n // Optional since artifact-evals proposal.2: a `tool-usage` criterion says\n // everything in `options`, and demanding a sentence no grader reads was\n // the one place this vocabulary disagreed with the page side. The schema\n // still requires it for `ai`, `human`, and a bare entry (which defaults to\n // `ai`), so anything that actually needs an assertion still has one.\n ...(typeof obj.assertion === \"string\" ? { assertion: obj.assertion } : {}),\n type: (obj.type as EvalType | undefined) ?? \"regression\",\n grader: typeof obj.grader === \"string\" ? obj.grader : \"ai\",\n severity: (obj.severity as Severity | undefined) ?? \"error\",\n };\n if (typeof obj.provider === \"string\") entry.provider = obj.provider;\n if (typeof obj.model === \"string\") entry.model = obj.model;\n if (typeof obj.runs === \"number\") entry.runs = obj.runs;\n if (typeof obj.weight === \"number\") entry.weight = obj.weight;\n if (typeof obj.target === \"string\" || (obj.target && typeof obj.target === \"object\")) {\n entry.target = obj.target as TraceTarget;\n }\n if (obj.options && typeof obj.options === \"object\") {\n entry.options = obj.options as Record<string, unknown>;\n }\n if (typeof obj.evidence === \"string\") entry.evidence = obj.evidence;\n if (obj.examples && typeof obj.examples === \"object\") {\n entry.examples = normalizeExamples(obj.examples as Record<string, unknown>);\n }\n if (obj.skip === true) entry.skip = true;\n if (obj[\"severity-map\"] && typeof obj[\"severity-map\"] === \"object\") {\n entry.severityMap = obj[\"severity-map\"] as Record<string, Severity>;\n }\n if (Array.isArray(obj.command)) entry.command = obj.command as string[];\n if (Array.isArray(obj[\"success-exit-codes\"])) {\n entry.successExitCodes = obj[\"success-exit-codes\"] as number[];\n }\n if (typeof obj[\"timeout-ms\"] === \"number\") {\n entry.timeoutMs = obj[\"timeout-ms\"];\n }\n if (typeof obj[\"generated-assertion-hash\"] === \"string\") {\n entry.generatedAssertionHash = obj[\"generated-assertion-hash\"];\n }\n return entry;\n}\n\n/** Anchors are one example or a list of them; downstream sees only the list. */\nfunction normalizeExamples(\n raw: Record<string, unknown>,\n): { pass?: string[]; fail?: string[] } {\n const out: { pass?: string[]; fail?: string[] } = {};\n const pass = anchorList(raw.pass);\n const fail = anchorList(raw.fail);\n if (pass) out.pass = pass;\n if (fail) out.fail = fail;\n return out;\n}\n\nfunction anchorList(raw: unknown): string[] | undefined {\n if (typeof raw === \"string\") return [raw];\n if (Array.isArray(raw)) return raw.filter((e): e is string => typeof e === \"string\");\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AASA,SAAS,kBAAkB;AAC3B,SAAS,OAAO,UAAU,iBAAiB;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAOA,SAAS,UAAU,MAA+B;AACvD,SAAO,WAAW,QAAQ,EAAE,OAAO,IAAI,EAAE,OAAO,KAAK;AACvD;AAGA,eAAsB,SAAS,MAAsC;AACnE,MAAI;AAGF,WAAO,UAAU,MAAM,SAAS,IAAI,CAAC;AAAA,EACvC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGO,SAAS,SAAS,MAAc,MAA6B;AAClE,QAAM,MAAM,SAAS,QAAQ,IAAI,GAAG,QAAQ,IAA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ACA,MAAI,OAAO,IAAI,0BAA0B,MAAM,UAAU;AACvD,UAAM,yBAAyB,IAAI,0BAA0B;AAAA,EAC/D;AACA,SAAO;AACT;AAGA,SAAS,kBACP,KACsC;AACtC,QAAM,MAA4C,CAAC;AACnD,QAAM,OAAO,WAAW,IAAI,IAAI;AAChC,QAAM,OAAO,WAAW,IAAI,IAAI;AAChC,MAAI,KAAM,KAAI,OAAO;AACrB,MAAI,KAAM,KAAI,OAAO;AACrB,SAAO;AACT;AAEA,SAAS,WAAW,KAAoC;AACtD,MAAI,OAAO,QAAQ,SAAU,QAAO,CAAC,GAAG;AACxC,MAAI,MAAM,QAAQ,GAAG,EAAG,QAAO,IAAI,OAAO,CAAC,MAAmB,OAAO,MAAM,QAAQ;AACnF,SAAO;AACT;","names":["readFile","dirname","join","resolve","sep","dirname","join","resolve","resolve","refKey","join","dirname","found"]}
|
package/dist/chunk-WI3PPQQX.js
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
PATH_JOIN,
|
|
4
|
-
applyRelocation,
|
|
5
|
-
offerPrompt,
|
|
6
|
-
planRelocation,
|
|
7
|
-
relocationOffers
|
|
8
|
-
} from "./chunk-ODSIHEIW.js";
|
|
9
|
-
|
|
10
|
-
// src/meta/core/location-writes.ts
|
|
11
|
-
import { LineCounter, isMap, isNode, isScalar, parseDocument } from "yaml";
|
|
12
|
-
var dedupe = (xs) => [...new Set(xs)];
|
|
13
|
-
var pages = (n) => `${String(n)} page${n === 1 ? "" : "s"}`;
|
|
14
|
-
async function offerExternalHomes(ctx, writes, hooks) {
|
|
15
|
-
const applied = /* @__PURE__ */ new Set();
|
|
16
|
-
const groups = /* @__PURE__ */ new Map();
|
|
17
|
-
for (const w of writes) {
|
|
18
|
-
if (w.home.kind !== "collection") continue;
|
|
19
|
-
const group = groups.get(w.home.collection) ?? [];
|
|
20
|
-
group.push(w);
|
|
21
|
-
groups.set(w.home.collection, group);
|
|
22
|
-
}
|
|
23
|
-
for (const [collection, group] of groups) {
|
|
24
|
-
const require2 = /* @__PURE__ */ new Map();
|
|
25
|
-
for (const w of group) {
|
|
26
|
-
const keys = require2.get(w.label) ?? [];
|
|
27
|
-
if (!keys.includes(w.key)) keys.push(w.key);
|
|
28
|
-
require2.set(w.label, keys);
|
|
29
|
-
}
|
|
30
|
-
const plan = await planRelocation(ctx, {
|
|
31
|
-
files: [...require2.keys()],
|
|
32
|
-
fields: dedupe(group.map((w) => w.key)),
|
|
33
|
-
require: require2
|
|
34
|
-
});
|
|
35
|
-
const offers = relocationOffers(plan);
|
|
36
|
-
if (offers.length === 0) continue;
|
|
37
|
-
let yes = true;
|
|
38
|
-
for (const offer of offers) {
|
|
39
|
-
const { notice, question } = offerPrompt(offer, "write");
|
|
40
|
-
hooks.onNotice?.(notice);
|
|
41
|
-
if (!await hooks.confirm(question)) {
|
|
42
|
-
yes = false;
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if (!yes) continue;
|
|
47
|
-
const result = await applyRelocation(ctx, plan);
|
|
48
|
-
hooks.onRelocated?.(result);
|
|
49
|
-
applied.add(collection);
|
|
50
|
-
}
|
|
51
|
-
return applied;
|
|
52
|
-
}
|
|
53
|
-
function externalWriteWarnings(writes, dryRun) {
|
|
54
|
-
const verb = dryRun ? "would write" : "wrote";
|
|
55
|
-
const groups = /* @__PURE__ */ new Map();
|
|
56
|
-
const groupOf = (w) => w.home.kind === "collection" ? `c:${w.home.collection}` : `n:${w.home.reason}`;
|
|
57
|
-
for (const w of writes) {
|
|
58
|
-
const id = groupOf(w);
|
|
59
|
-
groups.set(id, [...groups.get(id) ?? [], w]);
|
|
60
|
-
}
|
|
61
|
-
const out = [];
|
|
62
|
-
for (const group of groups.values()) {
|
|
63
|
-
const [first] = group;
|
|
64
|
-
if (first === void 0) continue;
|
|
65
|
-
out.push(
|
|
66
|
-
externalWriteWarning({
|
|
67
|
-
verb,
|
|
68
|
-
keys: dedupe(group.map((w) => w.key)),
|
|
69
|
-
pages: new Set(group.map((w) => w.label)).size,
|
|
70
|
-
home: first.home,
|
|
71
|
-
createsHome: group.some(
|
|
72
|
-
(w) => w.home.kind === "collection" && (w.home.createsCollection || w.home.addsPath !== void 0)
|
|
73
|
-
)
|
|
74
|
-
})
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
return out;
|
|
78
|
-
}
|
|
79
|
-
function externalWriteWarning(line) {
|
|
80
|
-
const { verb, keys, home } = line;
|
|
81
|
-
const one = keys.length === 1;
|
|
82
|
-
const head = `${verb} ${keys.join(", ")} to ${pages(line.pages)}`;
|
|
83
|
-
const prefer = one ? "the schema prefers external metadata" : "their schemas prefer external metadata";
|
|
84
|
-
const them = one ? "it" : "them";
|
|
85
|
-
if (home.kind === "collection") {
|
|
86
|
-
if (!line.createsHome) {
|
|
87
|
-
return `${head} in collection ${home.collection}; ${prefer}, and no manifest owns ${them}. Run manni meta relocate to move ${them}.`;
|
|
88
|
-
}
|
|
89
|
-
return home.createsCollection || home.createsManifest ? `${head}; ${prefer}. Run manni meta relocate to give ${them} a manifest.` : `${head}; ${prefer}. Run manni meta relocate to add ${them} to collection ${home.collection}.`;
|
|
90
|
-
}
|
|
91
|
-
return home.reason === "no-config" ? `${head}; ${prefer}, and --no-config leaves ${them} no manifest.` : `${head} that ${line.pages === 1 ? "is" : "are"} in none of the ${String(home.collections)} collections; ${prefer}, and only a collection has a manifest.`;
|
|
92
|
-
}
|
|
93
|
-
function manifestKeyLine(text, entry, key, join) {
|
|
94
|
-
const norm = (e) => join === PATH_JOIN ? e.replace(/\\/g, "/").replace(/^\.\//, "").replace(/\/+/g, "/") : e;
|
|
95
|
-
const lc = new LineCounter();
|
|
96
|
-
const doc = parseDocument(text, { lineCounter: lc, uniqueKeys: false });
|
|
97
|
-
const root = doc.contents;
|
|
98
|
-
if (!isMap(root)) return void 0;
|
|
99
|
-
for (const pair of root.items) {
|
|
100
|
-
const spelled = isScalar(pair.key) ? String(pair.key.value) : String(pair.key);
|
|
101
|
-
if (norm(spelled) !== norm(entry) || !isMap(pair.value)) continue;
|
|
102
|
-
for (const kv of pair.value.items) {
|
|
103
|
-
const name = isScalar(kv.key) ? String(kv.key.value) : String(kv.key);
|
|
104
|
-
const range = isNode(kv.key) ? kv.key.range : void 0;
|
|
105
|
-
if (name === key && range) return lc.linePos(range[0]).line;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return void 0;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// src/meta/core/meta-provenance.ts
|
|
112
|
-
function isPlainRecord(value) {
|
|
113
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
114
|
-
}
|
|
115
|
-
function mergeMetaProvenance(held, model, key, proposed) {
|
|
116
|
-
if (held !== void 0 && !Array.isArray(held)) return void 0;
|
|
117
|
-
const list = held === void 0 ? [] : [...held];
|
|
118
|
-
const at = list.findIndex((e) => isPlainRecord(e) && e["generated-by"] === model);
|
|
119
|
-
const prior = list[at];
|
|
120
|
-
const kept = isPlainRecord(prior) ? prior : {};
|
|
121
|
-
const priorNames = kept[key];
|
|
122
|
-
const names = Array.isArray(priorNames) ? priorNames.filter((p) => typeof p === "string") : [];
|
|
123
|
-
const confidence = {};
|
|
124
|
-
if (isPlainRecord(kept.confidence)) {
|
|
125
|
-
for (const [k, v] of Object.entries(kept.confidence)) {
|
|
126
|
-
if (typeof v === "number") confidence[k] = v;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
for (const p of proposed) {
|
|
130
|
-
if (!names.includes(p.name)) names.push(p.name);
|
|
131
|
-
confidence[p.name] = p.confidence;
|
|
132
|
-
}
|
|
133
|
-
const entry = {
|
|
134
|
-
...kept,
|
|
135
|
-
"generated-by": model,
|
|
136
|
-
[key]: names,
|
|
137
|
-
confidence
|
|
138
|
-
};
|
|
139
|
-
if (at === -1) list.push(entry);
|
|
140
|
-
else list[at] = entry;
|
|
141
|
-
return { list, entry, names };
|
|
142
|
-
}
|
|
143
|
-
function metaProvenanceEntries(value) {
|
|
144
|
-
if (!Array.isArray(value)) return [];
|
|
145
|
-
const strings = (list) => Array.isArray(list) ? list.filter((s) => typeof s === "string") : [];
|
|
146
|
-
const out = [];
|
|
147
|
-
for (const item of value) {
|
|
148
|
-
if (!isPlainRecord(item)) continue;
|
|
149
|
-
const machine = item["generated-by"];
|
|
150
|
-
if (typeof machine !== "string" || machine === "") continue;
|
|
151
|
-
out.push({ "generated-by": machine, fields: strings(item.fields), evals: strings(item.evals) });
|
|
152
|
-
}
|
|
153
|
-
return out;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export {
|
|
157
|
-
offerExternalHomes,
|
|
158
|
-
externalWriteWarnings,
|
|
159
|
-
externalWriteWarning,
|
|
160
|
-
manifestKeyLine,
|
|
161
|
-
mergeMetaProvenance,
|
|
162
|
-
metaProvenanceEntries
|
|
163
|
-
};
|
|
164
|
-
//# sourceMappingURL=chunk-WI3PPQQX.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/meta/core/location-writes.ts","../src/meta/core/meta-provenance.ts"],"sourcesContent":["/**\n * What a writer (`derive`, `fill`) does with a value its schema prefers in\n * external metadata when no manifest owns the key (proposal 0047).\n *\n * On a terminal, one question per collection (P1) offers the relocation that\n * gives the key a manifest, and a yes applies it before anything is written.\n * Off a terminal, declined, or under a dry run, the value is written to the\n * page as before, and one warning per collection (W1), or per set of pages\n * with no possible home (W2), says so. The planning and the prompt's wording\n * are `relocation.ts`'s; this module is the writers' shared use of them.\n */\nimport { LineCounter, isMap, isNode, isScalar, parseDocument } from \"yaml\";\nimport type { Confirm } from \"../../shared/prompt.js\";\nimport {\n applyRelocation,\n offerPrompt,\n planRelocation,\n relocationOffers,\n type ProposedHome,\n type RelocateResult,\n type RelocationContext,\n} from \"./relocation.js\";\nimport { PATH_JOIN } from \"./external-metadata.js\";\n\n/** One key a writer is about to set on one page, which prefers external metadata and has no manifest. */\nexport interface ExternalWrite {\n label: string;\n key: string;\n home: ProposedHome;\n}\n\nconst dedupe = <T>(xs: readonly T[]): T[] => [...new Set(xs)];\nconst pages = (n: number): string => `${String(n)} page${n === 1 ? \"\" : \"s\"}`;\n\n/**\n * Ask P1 once per collection the writes would be homed in, and apply each\n * relocation the user accepts. Returns the collections whose relocation was\n * applied; their keys now have a manifest, and the caller re-reads what the\n * relocation changed before writing. Writes with no possible home are never\n * offered.\n */\nexport async function offerExternalHomes(\n ctx: RelocationContext,\n writes: readonly ExternalWrite[],\n hooks: {\n confirm: Confirm;\n onNotice?: (message: string) => void;\n onRelocated?: (result: RelocateResult) => void;\n },\n): Promise<Set<string>> {\n const applied = new Set<string>();\n const groups = new Map<string, ExternalWrite[]>();\n for (const w of writes) {\n if (w.home.kind !== \"collection\") continue;\n const group = groups.get(w.home.collection) ?? [];\n group.push(w);\n groups.set(w.home.collection, group);\n }\n for (const [collection, group] of groups) {\n const require = new Map<string, string[]>();\n for (const w of group) {\n const keys = require.get(w.label) ?? [];\n if (!keys.includes(w.key)) keys.push(w.key);\n require.set(w.label, keys);\n }\n // Planned against the config as it stands now: an earlier collection's\n // accepted relocation may have created the config file.\n const plan = await planRelocation(ctx, {\n files: [...require.keys()],\n fields: dedupe(group.map((w) => w.key)),\n require,\n });\n const offers = relocationOffers(plan);\n if (offers.length === 0) continue;\n let yes = true;\n for (const offer of offers) {\n const { notice, question } = offerPrompt(offer, \"write\");\n hooks.onNotice?.(notice);\n if (!(await hooks.confirm(question))) {\n yes = false;\n break;\n }\n }\n if (!yes) continue;\n const result = await applyRelocation(ctx, plan);\n hooks.onRelocated?.(result);\n applied.add(collection);\n }\n return applied;\n}\n\n/**\n * The W1 and W2 lines for the writes that landed on a page, or would under a\n * dry run: one per collection, one for the pages in none of several\n * collections, and one under `--no-config`. Without the `manni: ` prefix,\n * which `warn()` adds.\n */\nexport function externalWriteWarnings(\n writes: readonly ExternalWrite[],\n dryRun: boolean,\n): string[] {\n const verb = dryRun ? \"would write\" : \"wrote\";\n const groups = new Map<string, ExternalWrite[]>();\n const groupOf = (w: ExternalWrite): string =>\n w.home.kind === \"collection\" ? `c:${w.home.collection}` : `n:${w.home.reason}`;\n for (const w of writes) {\n const id = groupOf(w);\n groups.set(id, [...(groups.get(id) ?? []), w]);\n }\n const out: string[] = [];\n for (const group of groups.values()) {\n const [first] = group;\n /* c8 ignore next -- a group holds at least one write. */\n if (first === undefined) continue;\n out.push(\n externalWriteWarning({\n verb,\n keys: dedupe(group.map((w) => w.key)),\n pages: new Set(group.map((w) => w.label)).size,\n home: first.home,\n createsHome: group.some(\n (w) => w.home.kind === \"collection\" && (w.home.createsCollection || w.home.addsPath !== undefined),\n ),\n }),\n );\n }\n return out;\n}\n\n/**\n * One W1 or W2 line, without the `manni: ` prefix: `keys` were written (or\n * would be) to `pages` pages whose home is `home`. `createsHome` says\n * relocate would create the collection, manifest or path that gives them a\n * manifest. Where it would only add a path to a collection whose manifest\n * already exists, the line says so rather than promising a manifest. One key\n * reads in the singular, several in the plural.\n */\nexport function externalWriteWarning(line: {\n verb: \"wrote\" | \"would write\";\n keys: readonly string[];\n pages: number;\n home: ProposedHome;\n createsHome: boolean;\n}): string {\n const { verb, keys, home } = line;\n const one = keys.length === 1;\n const head = `${verb} ${keys.join(\", \")} to ${pages(line.pages)}`;\n const prefer = one ? \"the schema prefers external metadata\" : \"their schemas prefer external metadata\";\n const them = one ? \"it\" : \"them\";\n if (home.kind === \"collection\") {\n if (!line.createsHome) {\n return `${head} in collection ${home.collection}; ${prefer}, and no manifest owns ${them}. Run manni meta relocate to move ${them}.`;\n }\n // Whether the collection has a manifest is the collection's, so any write in the group answers it.\n return home.createsCollection || home.createsManifest\n ? `${head}; ${prefer}. Run manni meta relocate to give ${them} a manifest.`\n : `${head}; ${prefer}. Run manni meta relocate to add ${them} to collection ${home.collection}.`;\n }\n return home.reason === \"no-config\"\n ? `${head}; ${prefer}, and --no-config leaves ${them} no manifest.`\n : `${head} that ${line.pages === 1 ? \"is\" : \"are\"} in none of the ${String(home.collections)} collections; ${prefer}, and only a collection has a manifest.`;\n}\n\n/**\n * The 1-based line of `key` in the entry for `entry`, in a manifest's text:\n * where a writer's report points after the write. A path entry matches\n * however the manifest spells it (`./docs/a.md` is `docs/a.md`).\n */\nexport function manifestKeyLine(\n text: string,\n entry: string,\n key: string,\n join: string,\n): number | undefined {\n const norm = (e: string): string =>\n join === PATH_JOIN ? e.replace(/\\\\/g, \"/\").replace(/^\\.\\//, \"\").replace(/\\/+/g, \"/\") : e;\n const lc = new LineCounter();\n const doc = parseDocument(text, { lineCounter: lc, uniqueKeys: false });\n const root = doc.contents;\n if (!isMap(root)) return undefined;\n for (const pair of root.items) {\n const spelled = isScalar(pair.key) ? String(pair.key.value) : String(pair.key);\n if (norm(spelled) !== norm(entry) || !isMap(pair.value)) continue;\n for (const kv of pair.value.items) {\n const name = isScalar(kv.key) ? String(kv.key.value) : String(kv.key);\n const range = isNode(kv.key) ? kv.key.range : undefined;\n if (name === key && range) return lc.linePos(range[0]).line;\n }\n }\n return undefined;\n}\n","/**\n * `meta-provenance` (proposal 0046): which model proposed which metadata, one\n * entry per model. `fields` names the values by JSON Pointer and `evals` names\n * the evals by id, and `confidence` is keyed by either, which cannot collide\n * because a pointer starts with `/` and an id cannot.\n *\n * Two tools write it: `manni meta fill` records the fields it writes, and\n * `manni docevals fill` records the evals it writes. They merge the same way,\n * so the merge lives here rather than in either command.\n */\n\n/** A name one run proposed, under `fields` or `evals`, and its confidence. */\nexport interface MetaProvenanceProposal {\n name: string;\n confidence: number;\n}\n\n/** Which list of an entry a run's proposals go under. */\nexport type MetaProvenanceKey = \"fields\" | \"evals\";\n\n/** An entry after a merge: whatever it held, with the run's names and confidences. */\nexport interface MergedMetaProvenanceEntry {\n \"generated-by\": string;\n confidence: Record<string, number>;\n [other: string]: unknown;\n}\n\nexport interface MergedMetaProvenance {\n /** The whole `meta-provenance` list, to write back. */\n list: unknown[];\n /** The entry the run merged into, as it now stands in `list`. */\n entry: MergedMetaProvenanceEntry;\n /** The entry's names under the merged key: its own first, then the run's new ones. */\n names: string[];\n}\n\nfunction isPlainRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/**\n * The page's `meta-provenance` list with one run's proposals merged in. The\n * first entry for `model` gains the new names under `key` after its own, and\n * their confidences; everything else in it, and every other entry, is kept.\n * Without one, a new entry is appended. `undefined` when the page holds\n * something other than a list, which there is no merging into.\n */\nexport function mergeMetaProvenance(\n held: unknown,\n model: string,\n key: MetaProvenanceKey,\n proposed: readonly MetaProvenanceProposal[],\n): MergedMetaProvenance | undefined {\n if (held !== undefined && !Array.isArray(held)) return undefined;\n const list: unknown[] = held === undefined ? [] : [...(held as unknown[])];\n const at = list.findIndex((e) => isPlainRecord(e) && e[\"generated-by\"] === model);\n const prior = list[at];\n const kept = isPlainRecord(prior) ? prior : {};\n const priorNames = kept[key];\n const names = Array.isArray(priorNames)\n ? (priorNames as unknown[]).filter((p): p is string => typeof p === \"string\")\n : [];\n const confidence: Record<string, number> = {};\n if (isPlainRecord(kept.confidence)) {\n for (const [k, v] of Object.entries(kept.confidence)) {\n if (typeof v === \"number\") confidence[k] = v;\n }\n }\n for (const p of proposed) {\n if (!names.includes(p.name)) names.push(p.name);\n confidence[p.name] = p.confidence;\n }\n const entry: MergedMetaProvenanceEntry = {\n ...kept,\n \"generated-by\": model,\n [key]: names,\n confidence,\n };\n if (at === -1) list.push(entry);\n else list[at] = entry;\n return { list, entry, names };\n}\n\n/** One `meta-provenance` entry as read: the model, and the names it proposed. */\nexport interface MetaProvenanceRecord {\n \"generated-by\": string;\n /** JSON Pointers, strings only; empty when the entry names none. */\n fields: string[];\n /** Eval ids, strings only; empty when the entry names none. */\n evals: string[];\n}\n\n/**\n * The readable entries of a `meta-provenance` value, in order. As with\n * `provenanceEntries`, an entry the schema would reject for its identity (not\n * a mapping, no model) is skipped rather than guessed at, and a malformed list\n * under `fields` or `evals` reads as naming nothing: the schema finding speaks\n * for it. A reader never throws on what a page holds.\n */\nexport function metaProvenanceEntries(value: unknown): MetaProvenanceRecord[] {\n if (!Array.isArray(value)) return [];\n const strings = (list: unknown): string[] =>\n Array.isArray(list)\n ? (list as unknown[]).filter((s): s is string => typeof s === \"string\")\n : [];\n const out: MetaProvenanceRecord[] = [];\n for (const item of value as unknown[]) {\n if (!isPlainRecord(item)) continue;\n const machine = item[\"generated-by\"];\n if (typeof machine !== \"string\" || machine === \"\") continue;\n out.push({ \"generated-by\": machine, fields: strings(item.fields), evals: strings(item.evals) });\n }\n return out;\n}\n"],"mappings":";;;;;;;;;;AAWA,SAAS,aAAa,OAAO,QAAQ,UAAU,qBAAqB;AAoBpE,IAAM,SAAS,CAAI,OAA0B,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC;AAC5D,IAAM,QAAQ,CAAC,MAAsB,GAAG,OAAO,CAAC,CAAC,QAAQ,MAAM,IAAI,KAAK,GAAG;AAS3E,eAAsB,mBACpB,KACA,QACA,OAKsB;AACtB,QAAM,UAAU,oBAAI,IAAY;AAChC,QAAM,SAAS,oBAAI,IAA6B;AAChD,aAAW,KAAK,QAAQ;AACtB,QAAI,EAAE,KAAK,SAAS,aAAc;AAClC,UAAM,QAAQ,OAAO,IAAI,EAAE,KAAK,UAAU,KAAK,CAAC;AAChD,UAAM,KAAK,CAAC;AACZ,WAAO,IAAI,EAAE,KAAK,YAAY,KAAK;AAAA,EACrC;AACA,aAAW,CAAC,YAAY,KAAK,KAAK,QAAQ;AACxC,UAAMA,WAAU,oBAAI,IAAsB;AAC1C,eAAW,KAAK,OAAO;AACrB,YAAM,OAAOA,SAAQ,IAAI,EAAE,KAAK,KAAK,CAAC;AACtC,UAAI,CAAC,KAAK,SAAS,EAAE,GAAG,EAAG,MAAK,KAAK,EAAE,GAAG;AAC1C,MAAAA,SAAQ,IAAI,EAAE,OAAO,IAAI;AAAA,IAC3B;AAGA,UAAM,OAAO,MAAM,eAAe,KAAK;AAAA,M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,GAAG;AACpD,UAAI,OAAO,MAAM,SAAU,YAAW,CAAC,IAAI;AAAA,IAC7C;AAAA,EACF;AACA,aAAW,KAAK,UAAU;AACxB,QAAI,CAAC,MAAM,SAAS,EAAE,IAAI,EAAG,OAAM,KAAK,EAAE,IAAI;AAC9C,eAAW,EAAE,IAAI,IAAI,EAAE;AAAA,EACzB;AACA,QAAM,QAAmC;AAAA,IACvC,GAAG;AAAA,IACH,gBAAgB;AAAA,IAChB,CAAC,GAAG,GAAG;AAAA,IACP;AAAA,EACF;AACA,MAAI,OAAO,GAAI,MAAK,KAAK,KAAK;AAAA,MACzB,MAAK,EAAE,IAAI;AAChB,SAAO,EAAE,MAAM,OAAO,MAAM;AAC9B;AAkBO,SAAS,sBAAsB,OAAwC;AAC5E,MAAI,CAAC,MAAM,QAAQ,KAAK,EAAG,QAAO,CAAC;AACnC,QAAM,UAAU,CAAC,SACf,MAAM,QAAQ,IAAI,IACb,KAAmB,OAAO,CAAC,MAAmB,OAAO,MAAM,QAAQ,IACpE,CAAC;AACP,QAAM,MAA8B,CAAC;AACrC,aAAW,QAAQ,OAAoB;AACrC,QAAI,CAAC,cAAc,IAAI,EAAG;AAC1B,UAAM,UAAU,KAAK,cAAc;AACnC,QAAI,OAAO,YAAY,YAAY,YAAY,GAAI;AACnD,QAAI,KAAK,EAAE,gBAAgB,SAAS,QAAQ,QAAQ,KAAK,MAAM,GAAG,OAAO,QAAQ,KAAK,KAAK,EAAE,CAAC;AAAA,EAChG;AACA,SAAO;AACT;","names":["require"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/strategy/commands/check.ts","../src/strategy/commands/findings.ts"],"sourcesContent":["/**\n * `manni strategy check`: the pages against the records, and the records\n * against each other, with the baseline ratchet term and cite use.\n *\n * `--baseline` records the findings when the file is not there yet, and after\n * that fails only on findings it does not hold. A configured\n * `strategy.baseline` compares without the flag.\n */\nimport { existsSync } from \"node:fs\";\nimport { resolveBaselineRequest, settleBaseline } from \"../../meta/internal.js\";\nimport { checkStrategySet } from \"../core/check.js\";\nimport { DEFAULT_STRATEGY_BASELINE_PATH } from \"../core/config.js\";\nimport { StrategyError } from \"../errors.js\";\nimport { reportedFindings, summarize, toResults, type StrategyReport } from \"./findings.js\";\nimport { loadStrategy, type StrategyCommandOptions } from \"./run.js\";\n\nexport interface CheckOptions extends StrategyCommandOptions {\n /** `--baseline`. */\n baseline?: boolean;\n}\n\nexport async function runCheck(opts: CheckOptions): Promise<StrategyReport> {\n const { cwd, run, set } = await loadStrategy(opts);\n const config = run.config;\n const findings = checkStrategySet(set, config?.severity === undefined ? {} : { severity: config.severity });\n const { results, origin } = toResults(set, findings);\n\n // Fingerprints must not depend on where the command was run from.\n const frame = { cwd, base: run.configDir ?? cwd, runBase: run.base };\n let request = resolveBaselineRequest(\n opts.baseline === true ? { baseline: true } : {},\n config?.baseline,\n run.configDir,\n cwd,\n { current: DEFAULT_STRATEGY_BASELINE_PATH },\n );\n if (request !== null && !existsSync(request.absPath)) {\n if (opts.baseline !== true) {\n throw new StrategyError(`Baseline \"${request.label}\" not found. Record one with \\`manni strategy check --baseline\\`.`);\n }\n request = { ...request, write: true };\n }\n const { results: reported, baseline } = await settleBaseline(results, request, frame);\n\n const parents = set.records.reduce((n, r) => n + r.parents.length, 0);\n return {\n findings: reportedFindings(reported, origin, findings),\n results: reported,\n origin,\n summary: summarize(reported, baseline),\n frame,\n records: set.records.length,\n // Two kinds, both resolved: every audiences:, personas: and journeys:\n // value (pages and records alike), plus each value of a record's own\n // parent field, which load-set keeps out of the references.\n references: set.references.length + parents,\n ...(baseline === undefined ? {} : { baseline }),\n found: findings.length,\n cwd,\n base: run.base,\n };\n}\n","/**\n * The report `check` returns, and the bridge from strategy findings to meta's\n * `ValidationResult`, so the SARIF and JUnit renderers and the baseline\n * ratchet work unchanged, as term's adapter does.\n *\n * FieldError: schema `manni:strategy`, keyword = the rule, instancePath\n * `/<field>` when the finding concerns one field and `\"\"` when it concerns a\n * whole record. The subject is the record, the field and what the finding\n * says before its advice, with any `file:line` taken out, so a moved line or\n * a reworded fix moves no baseline.\n */\nimport {\n isErrorSeverity,\n type BaselineSummary,\n type FieldError,\n type FingerprintContext,\n type RunSummary,\n type ValidationResult,\n} from \"../../meta/index.js\";\nimport { RULE_ID_PREFIX } from \"../core/severity.js\";\nimport type { StrategyFinding, StrategySet } from \"../types.js\";\n\nexport const FINDING_FORMATS = [\"pretty\", \"json\", \"github\", \"sarif\", \"junit\"] as const;\nexport type FindingFormat = (typeof FINDING_FORMATS)[number];\n\n/** JUnit `classname` for the strategy tool's findings. */\nexport const JUNIT_CLASSNAME = \"manni.strategy\";\n\nexport interface StrategyReport {\n /** The findings reported: a baselined one is not among them. */\n findings: StrategyFinding[];\n /** The same findings as meta's results, for SARIF and JUnit. One per file. */\n results: ValidationResult[];\n /** Each error in `results` to the finding it came from. */\n origin: ReadonlyMap<FieldError, StrategyFinding>;\n summary: RunSummary;\n frame: FingerprintContext;\n /** Records in the set. */\n records: number;\n /** Values of audiences:, personas:, journeys: and audience: the run read. */\n references: number;\n baseline?: BaselineSummary;\n /** Findings before the baseline, for the line a recording run prints. */\n found: number;\n /** Where the run stood, for the paths the reporters print. */\n cwd: string;\n /** What finding files are relative to. */\n base: string;\n}\n\nconst LINE_REFERENCE = /:\\d+\\b/g;\n\nfunction toFieldError(finding: StrategyFinding): FieldError {\n const said = finding.key ?? finding.message;\n const subject = [finding.id ?? \"\", finding.field ?? \"\", said.replace(LINE_REFERENCE, \"\")].join(\"\\u0000\");\n const error: FieldError = {\n schema: RULE_ID_PREFIX,\n instancePath: finding.field === undefined ? \"\" : `/${finding.field}`,\n message: finding.message,\n keyword: finding.rule,\n subject,\n severity: finding.severity,\n };\n if (finding.line !== undefined) error.line = finding.line;\n return error;\n}\n\n/** One result per file: every record's file, every file a reference was read from, and every file a finding sits in. */\nexport function toResults(\n set: StrategySet,\n findings: readonly StrategyFinding[],\n): { results: ValidationResult[]; origin: Map<FieldError, StrategyFinding> } {\n const origin = new Map<FieldError, StrategyFinding>();\n const byFile = new Map<string, FieldError[]>();\n for (const { file } of [...set.records, ...set.references]) if (!byFile.has(file)) byFile.set(file, []);\n for (const finding of findings) {\n const error = toFieldError(finding);\n origin.set(error, finding);\n byFile.set(finding.file, [...(byFile.get(finding.file) ?? []), error]);\n }\n const results = [...byFile.keys()].sort().map((file): ValidationResult => {\n const errors = byFile.get(file) ?? [];\n return { file, format: \"strategy\", ok: !errors.some(isErrorSeverity), schemas: [RULE_ID_PREFIX], errors };\n });\n return { results, origin };\n}\n\n/** The run summary meta's renderers read, from results a baseline may have thinned. */\nexport function summarize(results: readonly ValidationResult[], baseline?: BaselineSummary): RunSummary {\n const failed = results.filter((r) => !r.ok).length;\n const count = (keep: (e: FieldError) => boolean): number => results.reduce((n, r) => n + r.errors.filter(keep).length, 0);\n const warnings = count((e) => e.severity === \"warning\");\n const notices = count((e) => e.severity === \"notice\");\n return {\n files: results.length,\n passed: results.length - failed,\n failed,\n errors: count(isErrorSeverity),\n ...(warnings > 0 ? { warnings } : {}),\n ...(notices > 0 ? { notices } : {}),\n ...(baseline ? { baseline } : {}),\n };\n}\n\n/** The findings still reported once a baseline has thinned the results, in report order. */\nexport function reportedFindings(\n results: readonly ValidationResult[],\n origin: ReadonlyMap<FieldError, StrategyFinding>,\n order: readonly StrategyFinding[],\n): StrategyFinding[] {\n const kept = new Set<StrategyFinding>();\n for (const result of results) {\n for (const error of result.errors) {\n const finding = origin.get(error);\n if (finding !== undefined) kept.add(finding);\n }\n }\n return order.filter((finding) => kept.has(finding));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAQA,SAAS,kBAAkB;;;ACcpB,IAAM,kBAAkB,CAAC,UAAU,QAAQ,UAAU,SAAS,OAAO;AAIrE,IAAM,kBAAkB;AAwB/B,IAAM,iBAAiB;AAEvB,SAAS,aAAa,SAAsC;AAC1D,QAAM,OAAO,QAAQ,OAAO,QAAQ;AACpC,QAAM,UAAU,CAAC,QAAQ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AAS,+BAA+B;AAAA,EAC5C;AACA,MAAI,YAAY,QAAQ,CAAC,WAAW,QAAQ,OAAO,GAAG;AACpD,QAAI,KAAK,aAAa,MAAM;AAC1B,YAAM,IAAI,cAAc,aAAa,QAAQ,KAAK,mEAAmE;AAAA,IACvH;AACA,cAAU,EAAE,GAAG,SAAS,OAAO,KAAK;AAAA,EACtC;AACA,QAAM,EAAE,SAAS,UAAU,SAAS,IAAI,MAAM,eAAe,SAAS,SAAS,KAAK;AAEpF,QAAM,UAAU,IAAI,QAAQ,OAAO,CAAC,GAAG,MAAM,IAAI,EAAE,QAAQ,QAAQ,CAAC;AACpE,SAAO;AAAA,IACL,UAAU,iBAAiB,UAAU,QAAQ,QAAQ;AAAA,IACrD,SAAS;AAAA,IACT;AAAA,IACA,SAAS,UAAU,UAAU,QAAQ;AAAA,IACrC;AAAA,IACA,SAAS,IAAI,QAAQ;AAAA;AAAA;AAAA;AAAA,IAIrB,YAAY,IAAI,WAAW,SAAS;AAAA,IACpC,GAAI,aAAa,SAAY,CAAC,IAAI,EAAE,SAAS;AAAA,IAC7C,OAAO,SAAS;AAAA,IAChB;AAAA,IACA,MAAM,IAAI;AAAA,EACZ;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/strategy/commands/list.ts"],"sourcesContent":["/**\n * `manni strategy list`: the records as a tree, audience then persona then\n * journey. A record with several parents sits under each of them, and one\n * whose parents are not in the set sits at the top level.\n */\nimport { indexSet, type StrategyIndex } from \"../core/check.js\";\nimport { RECORD_TYPES, type StrategyRecord, type StrategySet } from \"../types.js\";\nimport { displayPath, loadStrategy, type StrategyCommandOptions } from \"./run.js\";\n\nexport const LIST_FORMATS = [\"pretty\", \"json\"] as const;\nexport type ListFormat = (typeof LIST_FORMATS)[number];\n\n/** One record with what the set says about it. Paths are relative to the working directory. */\nexport interface RecordEntry {\n record: StrategyRecord;\n /** The records its parent field names that the set holds. */\n parents: StrategyRecord[];\n /** The records whose parent field names this one: personas of an audience, journeys of a persona. */\n children: StrategyRecord[];\n /** The pages that name the record directly. */\n pages: string[];\n /** The record's file, relative to the working directory. */\n file: string;\n /** Its depth in the tree. */\n depth: number;\n}\n\nexport interface ListReport {\n /** In tree order. */\n entries: RecordEntry[];\n set: StrategySet;\n}\n\nconst byId = new Intl.Collator(\"en\", { numeric: true });\n\nfunction sorted(records: readonly StrategyRecord[]): StrategyRecord[] {\n return [...records].sort((a, b) => byId.compare(a.id, b.id));\n}\n\n/** Every record, each with its parents, children and pages, parents before their children. */\nexport function entriesOf(set: StrategySet, cwd: string, base: string, index: StrategyIndex = indexSet(set)): RecordEntry[] {\n const entries: RecordEntry[] = [];\n const visit = (record: StrategyRecord, depth: number): void => {\n const children = sorted(index.childrenOf(record));\n entries.push({\n record,\n parents: index.parentsOf(record),\n children,\n pages: index.pagesNaming(record).map((page) => displayPath(page, cwd, base)),\n file: displayPath(record.file, cwd, base),\n depth,\n });\n for (const child of children) visit(child, depth + 1);\n };\n for (const type of RECORD_TYPES) {\n for (const record of sorted(set.records.filter((r) => r.type === type && index.parentsOf(r).length === 0))) {\n visit(record, 0);\n }\n }\n return entries;\n}\n\nexport async function runList(opts: StrategyCommandOptions): Promise<ListReport> {\n const { cwd, run, set } = await loadStrategy(opts);\n return { entries: entriesOf(set, cwd, run.base), set };\n}\n"],"mappings":";;;;;;;;;;;;;AASO,IAAM,eAAe,CAAC,UAAU,MAAM;AAwB7C,IAAM,OAAO,IAAI,KAAK,SAAS,MAAM,EAAE,SAAS,KAAK,CAAC;AAEtD,SAAS,OAAO,SAAsD;AACpE,SAAO,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,GAAG,MAAM,KAAK,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC;AAC7D;AAGO,SAAS,UAAU,KAAkB,KAAa,MAAc,QAAuB,SAAS,GAAG,GAAkB;AAC1H,QAAM,UAAyB,CAAC;AAChC,QAAM,QAAQ,CAAC,QAAwB,UAAwB;AAC7D,UAAM,WAAW,OAAO,MAAM,WAAW,MAAM,CAAC;AAChD,YAAQ,KAAK;AAAA,MACX;AAAA,MACA,SAAS,MAAM,UAAU,MAAM;AAAA,MAC/B;AAAA,MACA,OAAO,MAAM,YAAY,MAAM,EAAE,IAAI,CAAC,SAAS,YAAY,MAAM,KAAK,IAAI,CAAC;AAAA,MAC3E,MAAM,YAAY,OAAO,MAAM,KAAK,IAAI;AAAA,MACxC;AAAA,IACF,CAAC;AACD,eAAW,SAAS,SAAU,OAAM,OAAO,QAAQ,CAAC;AAAA,EACtD;AACA,aAAW,QAAQ,cAAc;AAC/B,eAAW,UAAU,OAAO,IAAI,QAAQ,OAAO,CAAC,MAAM,EAAE,SAAS,QAAQ,MAAM,UAAU,CAAC,EAAE,WAAW,CAAC,CAAC,GAAG;AAC1G,YAAM,QAAQ,CAAC;AAAA,IACjB;AAAA,EACF;AACA,SAAO;AACT;AAEA,eAAsB,QAAQ,MAAmD;AAC/E,QAAM,EAAE,KAAK,KAAK,IAAI,IAAI,MAAM,aAAa,IAAI;AACjD,SAAO,EAAE,SAAS,UAAU,KAAK,KAAK,IAAI,IAAI,GAAG,IAAI;AACvD;","names":[]}
|
package/dist/chunk-ZPLVANY2.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/shared/exec.ts
|
|
4
|
-
import { realExec } from "@hawkeyexl/inference";
|
|
5
|
-
function outputTail(result, maxChars = 400) {
|
|
6
|
-
const text = (result.stderr.trim() || result.stdout.trim()).trim();
|
|
7
|
-
if (text.length <= maxChars) return text;
|
|
8
|
-
return `\u2026${text.slice(-maxChars)}`;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
outputTail,
|
|
13
|
-
realExec
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=chunk-ZPLVANY2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/shared/exec.ts"],"sourcesContent":["/**\n * Process execution for every grader in the family that runs a program. The\n * implementation lives in `@hawkeyexl/inference`: the judge's subprocess\n * provider and the command graders were running copies of the same\n * cross-spawn wrapper, and the Windows-specific parts (npm `.cmd` shim\n * resolution without `shell: true`, stdin piping past the ~32K command-line\n * limit, and StringDecoder-backed output so multi-byte UTF-8 survives chunk\n * boundaries) are exactly the parts worth having in one place.\n *\n * Shared rather than per domain: `manni docevals` and `manni tracevals` both\n * run `command` evals, and both reach the OS through this one wrapper.\n */\nimport type { ExecResult } from \"@hawkeyexl/inference\";\n\nexport { realExec } from \"@hawkeyexl/inference\";\n\n/** Truncate command output for finding messages. */\nexport function outputTail(result: ExecResult, maxChars = 400): string {\n const text = (result.stderr.trim() || result.stdout.trim()).trim();\n if (text.length <= maxChars) return text;\n return `…${text.slice(-maxChars)}`;\n}\n\n/**\n * How a finished process is described in a finding: \"exited 2\", or the truth\n * when there was no exit code.\n *\n * `code` is null when the process was killed by a signal rather than exiting.\n * \"exited null\" describes nothing a reader can act on, and it is the case a\n * timeout produces — so it is the one worth naming.\n */\nexport function exited(code: number | null): string {\n return code === null ? \"was killed before exiting\" : `exited ${code}`;\n}\n"],"mappings":";;;AAcA,SAAS,gBAAgB;AAGlB,SAAS,WAAW,QAAoB,WAAW,KAAa;AACrE,QAAM,QAAQ,OAAO,OAAO,KAAK,KAAK,OAAO,OAAO,KAAK,GAAG,KAAK;AACjE,MAAI,KAAK,UAAU,SAAU,QAAO;AACpC,SAAO,SAAI,KAAK,MAAM,CAAC,QAAQ,CAAC;AAClC;","names":[]}
|