@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/strategy/core/steps.ts","../src/strategy/core/check.ts","../src/strategy/errors.ts","../src/strategy/core/config.ts","../src/strategy/commands/run.ts","../src/strategy/core/load-set.ts"],"sourcesContent":["/**\n * A journey's `steps:` resolved to the run's pages (proposal 0106). Pure,\n * given the routes: the command core loads `graph.routes`, and only when a\n * step names a `/` route.\n *\n * A `doc` is a repo path, resolved from the config file's directory and named\n * exactly, or a `/` route, resolved by graph's own `resolveRoute`. A scheme\n * URL and a route no mapping covers are not checked. Anything after `#` or\n * `?` is dropped first.\n */\nimport { relative, resolve } from \"node:path\";\nimport { PathIndex, hasScheme, resolveRoute } from \"../../graph/core/analyze.js\";\nimport type { RouteMapping } from \"../../graph/core/config.js\";\nimport type { ResolvedStep, StepState, StrategyRecord, StrategySet, StrategyStep } from \"../types.js\";\nimport { indexSet, type StrategyIndex } from \"./check.js\";\n\nexport interface StepContext {\n /** `graph.routes`, rebased onto the run's base. None leaves every route unchecked. */\n routes?: RouteMapping[];\n /** The directory a repo-path `doc` resolves from: the config file's, else the working directory. */\n from?: string;\n /** The directory the run's labels are relative to. */\n base?: string;\n}\n\n/** Each journey with steps to its steps, resolved, in order. */\nexport type StepMap = ReadonlyMap<StrategyRecord, ResolvedStep[]>;\n\nconst posix = (path: string): string => path.replaceAll(\"\\\\\", \"/\");\n\n/** `doc` without its anchor or query. */\nfunction target(doc: string): string {\n return doc.split(/[?#]/, 1)[0] ?? \"\";\n}\n\n/** Whether a step's doc is a site route, which needs `graph.routes`. */\nfunction isRoute(doc: string): boolean {\n return target(doc).startsWith(\"/\");\n}\n\nexport function stepsNeedRoutes(set: StrategySet): boolean {\n return set.records.some((r) => r.steps?.some((s) => s.doc !== undefined && isRoute(s.doc)) === true);\n}\n\n/** What a `doc` names: a page of the run, no page, or nothing this run can check. */\ntype Located = { page: string } | \"none\" | \"unchecked\";\n\nfunction locate(doc: string, pages: ReadonlySet<string>, index: PathIndex, ctx: StepContext): Located {\n if (hasScheme(doc)) return \"unchecked\";\n const path = target(doc);\n if (path.startsWith(\"/\")) {\n const found = resolveRoute(path, ctx.routes ?? [], index);\n if (found === null) return \"unchecked\";\n return found === \"broken\" ? \"none\" : { page: found };\n }\n const label = ctx.from === undefined || ctx.base === undefined ? path : relative(ctx.base, resolve(ctx.from, path));\n const wanted = posix(label);\n return pages.has(wanted) ? { page: wanted } : \"none\";\n}\n\n/** The state table of proposal 0106. `found` is undefined when the step has no `doc`. */\nfunction stateOf(step: StrategyStep, found: Located | undefined, served: boolean): StepState {\n if (found === undefined) return step.exists === true || step.exists === \"partial\" ? \"broken\" : \"unwritten\";\n if (found === \"unchecked\") return step.exists === false ? \"unwritten\" : \"unchecked\";\n if (found === \"none\") return step.exists === false ? \"unwritten\" : \"broken\";\n if (step.exists === \"partial\") return \"partial\";\n return served ? \"served\" : \"unclaimed\";\n}\n\nexport function resolveSteps(set: StrategySet, ctx: StepContext = {}, index: StrategyIndex = indexSet(set)): Map<StrategyRecord, ResolvedStep[]> {\n const pages = new Set((set.pages ?? []).map(posix));\n // `PathIndex` is graph's tiered lookup; a repo path must name its file exactly, so it uses `pages`.\n const routeIndex = new PathIndex(pages);\n const out = new Map<StrategyRecord, ResolvedStep[]>();\n for (const record of set.records) {\n if (record.type !== \"journey\" || record.steps === undefined) continue;\n const naming = new Set(index.pagesNaming(record).map(posix));\n out.set(\n record,\n record.steps.map((step): ResolvedStep => {\n const found = step.doc === undefined ? undefined : locate(step.doc, pages, routeIndex, ctx);\n const page = typeof found === \"object\" ? found.page : undefined;\n const state = stateOf(step, found, page !== undefined && naming.has(page));\n return { ...step, state, ...(page === undefined ? {} : { page }) };\n }),\n );\n }\n return out;\n}\n\n/** Served steps over steps. */\nexport function coverageOf(steps: readonly ResolvedStep[]): { served: number; steps: number } {\n return { served: steps.filter((s) => s.state === \"served\").length, steps: steps.length };\n}\n","/**\n * `strategy check`'s rules (proposal 0102). Pure: it reads records and\n * references and returns findings, so the command core owns every file and\n * the rules are tested on sets built inline.\n *\n * Ids compare case-folded. A reference field is checked only when the set\n * holds a record of that field's type, so a repo that keeps no audience\n * records keeps free-form `audiences:`. `missing-parent` and the use counts\n * read pages that are not records: a record's own `journeys:` serves nobody.\n *\n * The four step rules (proposal 0106) read each live journey's resolved\n * `steps:`. A draft or archived journey's steps draw nothing.\n */\nimport { closestName } from \"../../shared/closest-name.js\";\nimport { RECORD_FIELDS } from \"../../shared/reference-fields.js\";\nimport {\n PAGE_FIELDS,\n PARENTS,\n type At,\n type ChildType,\n type RecordType,\n type ReferenceField,\n type ResolvedStep,\n type StrategyFinding,\n type StrategyRecord,\n type StrategyRule,\n type StrategySet,\n type StrategySeverity,\n} from \"../types.js\";\nimport { guidanceFor, resolveSeverity, ruleId } from \"./severity.js\";\nimport { resolveSteps, type StepMap } from \"./steps.js\";\n\nconst fold = (value: string): string => value.toLowerCase();\n\n/** The type each page field names. */\nconst FIELD_TYPES: Readonly<Record<ReferenceField, RecordType>> = RECORD_FIELDS;\n\n/** The type of a child's parents: an audience for a persona, a persona for a journey. */\nconst parentTypeOf = (type: ChildType): RecordType => FIELD_TYPES[PARENTS[type]];\n\n/** What a set's records and pages say about each other, resolved once for `check`, `list` and `get`. */\nexport interface StrategyIndex {\n /** Whether the set holds a record of this type. */\n has(type: RecordType): boolean;\n /** The record of `type` a value names, case-folded. The first one read wins. */\n resolve(type: RecordType, value: string): StrategyRecord | undefined;\n /** The first record of any type with this id, case-folded. */\n anyWithId(value: string): StrategyRecord | undefined;\n /** The records of the parent type the record's parent field names, each once, in the field's order. */\n parentsOf(record: StrategyRecord): StrategyRecord[];\n /** The records whose parent field names this record, in set order. */\n childrenOf(record: StrategyRecord): StrategyRecord[];\n /** The pages that name this record directly, sorted. Records do not count. */\n pagesNaming(record: StrategyRecord): string[];\n}\n\nexport function indexSet(set: StrategySet): StrategyIndex {\n const byType = new Map<RecordType, Map<string, StrategyRecord>>();\n const byId = new Map<string, StrategyRecord>();\n for (const record of set.records) {\n const ids = byType.get(record.type) ?? new Map<string, StrategyRecord>();\n if (!ids.has(fold(record.id))) ids.set(fold(record.id), record);\n byType.set(record.type, ids);\n if (!byId.has(fold(record.id))) byId.set(fold(record.id), record);\n }\n const resolveIn = (type: RecordType, value: string): StrategyRecord | undefined => byType.get(type)?.get(fold(value));\n const parentsOf = (record: StrategyRecord): StrategyRecord[] => {\n if (record.type === \"audience\") return [];\n const type = parentTypeOf(record.type);\n const found = record.parents.map((p) => resolveIn(type, p.value)).filter((r) => r !== undefined);\n return [...new Set(found)];\n };\n\n const children = new Map<StrategyRecord, StrategyRecord[]>();\n for (const record of set.records) {\n for (const parent of parentsOf(record)) children.set(parent, [...(children.get(parent) ?? []), record]);\n }\n const pages = new Map<StrategyRecord, Set<string>>();\n for (const reference of set.references) {\n if (reference.record) continue;\n const target = resolveIn(FIELD_TYPES[reference.field], reference.value);\n if (target === undefined) continue;\n const named = pages.get(target) ?? new Set<string>();\n named.add(reference.page);\n pages.set(target, named);\n }\n\n return {\n has: (type) => (byType.get(type)?.size ?? 0) > 0,\n resolve: resolveIn,\n anyWithId: (value) => byId.get(fold(value)),\n parentsOf,\n childrenOf: (record) => children.get(record) ?? [],\n pagesNaming: (record) => [...(pages.get(record) ?? [])].sort(),\n };\n}\n\n/** A finding before its level is known: `message` is its identity, `fix` the advice after it. */\ninterface Draft {\n rule: StrategyRule;\n message: string;\n fix?: string;\n file: string;\n line?: number;\n id?: string;\n field?: ReferenceField | \"steps\";\n}\n\n/** `a journey`, `an audience`. */\nfunction article(type: RecordType): string {\n return `${type === \"audience\" ? \"an\" : \"a\"} ${type}`;\n}\n\n/** Where a finding about a whole record sits: its `id:` line, else its first line. */\nfunction onRecord(record: StrategyRecord): At {\n return record.idAt ?? { file: record.file, line: record.line };\n}\n\nfunction located(at: At): At {\n return { file: at.file, ...(at.line === undefined ? {} : { line: at.line }) };\n}\n\n/** The ancestor of `record` of type `type`, walking up each record's first parent. */\nfunction ancestorOf(index: StrategyIndex, record: StrategyRecord, type: RecordType): StrategyRecord | undefined {\n let current = index.parentsOf(record)[0];\n while (current !== undefined && current.type !== type) current = index.parentsOf(current)[0];\n return current;\n}\n\nexport interface CheckStrategySetOptions {\n severity?: Partial<Record<StrategyRule, StrategySeverity>>;\n /** The journeys' steps, resolved. Default: resolved with no routes, each repo path read as a label. */\n steps?: StepMap;\n /** A step's page as a message names it. Default: its label. */\n pagePath?: (page: string) => string;\n}\n\n/** The step rules' drafts for one live journey. `naming` holds the pages that name it, posix. */\nfunction stepDrafts(\n record: StrategyRecord,\n steps: readonly ResolvedStep[],\n naming: ReadonlySet<string>,\n pagePath: (page: string) => string,\n): Draft[] {\n const drafts: Draft[] = [];\n for (const step of steps) {\n const on = (at: At | undefined): At => located(at ?? { file: step.file, ...(step.line === undefined ? {} : { line: step.line }) });\n const about = { ...on(undefined), id: record.id, field: \"steps\" as const };\n const n = `step ${String(step.n)}`;\n if (step.state === \"broken\") {\n drafts.push(\n step.doc === undefined\n ? {\n rule: \"broken-step\",\n message: `${n}: exists: ${String(step.exists)}, but the step has no doc.`,\n fix: \"Name its page in doc:, or set exists: false.\",\n ...about,\n ...on(step.existsAt),\n }\n : {\n rule: \"broken-step\",\n message: `${n}: doc \"${step.doc}\" names no page.`,\n fix: \"Correct doc, or set exists: false if the page does not exist.\",\n ...about,\n ...on(step.docAt),\n },\n );\n }\n if (step.state === \"unwritten\") {\n drafts.push({\n rule: \"unwritten-step\",\n message: step.doc === undefined ? `${n}: no page carries this stage.` : `${n}: doc \"${step.doc}\" names a page that does not exist.`,\n ...about,\n });\n }\n if (step.page === undefined) continue;\n if (step.exists === false && step.doc !== undefined) {\n drafts.push({\n rule: \"stale-step\",\n message: `${n}: exists: false, but doc \"${step.doc}\" names a page.`,\n fix: \"Set exists: true or partial, or drop exists:.\",\n ...about,\n ...on(step.existsAt),\n });\n }\n if (!naming.has(step.page)) {\n drafts.push({\n rule: \"missing-journey\",\n message: `${n}: ${pagePath(step.page)} does not name \"${record.id}\" in journeys:.`,\n fix: \"Add it to that page's journeys:, or point the step at a page that does.\",\n ...about,\n ...on(step.docAt),\n });\n }\n }\n return drafts;\n}\n\nexport function checkStrategySet(set: StrategySet, opts: CheckStrategySetOptions = {}): StrategyFinding[] {\n const levels = resolveSeverity(opts.severity);\n const index = indexSet(set);\n const drafts: Draft[] = [];\n\n // The step rules, on each live journey's steps.\n const steps = opts.steps ?? resolveSteps(set, {}, index);\n for (const [record, resolved] of steps) {\n if (record.lifecycle === \"draft\" || record.lifecycle === \"archived\") continue;\n const naming = new Set(index.pagesNaming(record).map((page) => page.replaceAll(\"\\\\\", \"/\")));\n drafts.push(...stepDrafts(record, resolved, naming, opts.pagePath ?? ((page) => page)));\n }\n\n /** The finding for a value that names no record of `type`, or the wrong type of record. */\n const unresolved = (field: ReferenceField, value: string, onRecordField: boolean): Pick<Draft, \"message\" | \"fix\"> => {\n const type = FIELD_TYPES[field];\n const other = index.anyWithId(value);\n if (other !== undefined) {\n const ancestor = ancestorOf(index, other, type);\n const fix =\n ancestor !== undefined\n ? `Did you mean its ${type}, \"${ancestor.id}\"?`\n : onRecordField\n ? \"Correct the value.\"\n : `Move it to ${PAGE_FIELDS[other.type]}:.`;\n return { message: `${field}: \"${value}\" is ${article(other.type)}, not ${article(type)}.`, fix };\n }\n const ids = set.records.filter((r) => r.type === type).map((r) => r.id);\n const nearest = closestName(fold(value), ids.map(fold));\n const suggestion = nearest === undefined ? undefined : ids.find((id) => fold(id) === nearest);\n const add = `Correct the value, or add a record with type: ${type} and id: ${value}.`;\n const fix =\n suggestion === undefined ? add : onRecordField ? `Did you mean \"${suggestion}\"?` : `Did you mean \"${suggestion}\"? ${add}`;\n return { message: `${field}: \"${value}\" names no ${type}.`, fix };\n };\n\n // undefined-reference, on every page's fields, records included.\n for (const reference of set.references) {\n const type = FIELD_TYPES[reference.field];\n if (!index.has(type) || index.resolve(type, reference.value) !== undefined) continue;\n drafts.push({\n rule: \"undefined-reference\",\n ...unresolved(reference.field, reference.value, false),\n ...located(reference),\n field: reference.field,\n });\n }\n // ...and on each value of a record's parent field.\n for (const record of set.records) {\n if (record.type === \"audience\") continue;\n const field = PARENTS[record.type];\n const type = parentTypeOf(record.type);\n if (!index.has(type)) continue;\n for (const parent of record.parents) {\n if (index.resolve(type, parent.value) !== undefined) continue;\n drafts.push({\n rule: \"undefined-reference\",\n ...unresolved(field, parent.value, true),\n ...located(parent),\n id: record.id,\n field,\n });\n }\n }\n\n // duplicate-id: on every record sharing the id, each naming the others.\n const sharing = new Map<string, StrategyRecord[]>();\n for (const record of set.records) sharing.set(fold(record.id), [...(sharing.get(fold(record.id)) ?? []), record]);\n for (const group of sharing.values()) {\n if (group.length < 2) continue;\n for (const record of group) {\n const others = group\n .filter((other) => other !== record)\n .map((other) => {\n const at = onRecord(other);\n return at.line === undefined ? at.file : `${at.file}:${String(at.line)}`;\n });\n drafts.push({\n rule: \"duplicate-id\",\n message: `id: \"${record.id}\" is also the id of ${others.join(\", \")}.`,\n fix: \"Give each record its own id.\",\n ...located(onRecord(record)),\n id: record.id,\n });\n }\n }\n\n // missing-parent: per page, one finding per set of parents the page names none of.\n const byPage = new Map<string, typeof set.references>();\n for (const reference of set.references) {\n if (reference.record) continue;\n byPage.set(reference.page, [...(byPage.get(reference.page) ?? []), reference]);\n }\n for (const references of byPage.values()) {\n const named = (field: ReferenceField): Set<string> =>\n new Set(references.filter((r) => r.field === field).map((r) => fold(r.value)));\n const reported = new Set<string>();\n for (const childType of [\"journey\", \"persona\"] as const satisfies readonly ChildType[]) {\n const parentType = parentTypeOf(childType);\n const parentField = PAGE_FIELDS[parentType];\n const has = named(parentField);\n for (const reference of references) {\n if (reference.field !== PAGE_FIELDS[childType]) continue;\n const child = index.resolve(childType, reference.value);\n if (child === undefined) continue;\n const parents = index.parentsOf(child);\n const ids = parents.map((p) => `\"${p.id}\"`).join(\", \");\n const key = `${parentType} ${ids}`;\n if (parents.length === 0 || parents.some((p) => has.has(fold(p.id))) || reported.has(key)) continue;\n reported.add(key);\n const one = parents.length === 1;\n drafts.push({\n rule: \"missing-parent\",\n message: one\n ? `${parentField}: does not name ${ids}, the ${parentType} of ${childType} \"${child.id}\".`\n : `${parentField}: names none of ${ids}, the ${parentField} of ${childType} \"${child.id}\".`,\n fix: `Add ${one ? \"it\" : \"one\"}, or drop \"${child.id}\" from ${PAGE_FIELDS[childType]}:.`,\n ...located(reference),\n field: parentField,\n });\n }\n }\n }\n\n // orphan-record, unserved-journey and unused-record: about whole records.\n for (const record of set.records) {\n const at = located(onRecord(record));\n if (record.type !== \"audience\" && record.parents.length === 0 && index.has(parentTypeOf(record.type))) {\n const field = PARENTS[record.type];\n drafts.push({\n rule: \"orphan-record\",\n message: `${field}: missing, so this ${record.type} belongs to no ${parentTypeOf(record.type)}.`,\n fix: `Name one with ${field}:.`,\n ...at,\n id: record.id,\n field,\n });\n }\n // Only the first record with an id is the one references resolve to.\n if (index.resolve(record.type, record.id) !== record) continue;\n const pages = index.pagesNaming(record);\n // A draft journey is not live yet, and an archived one no longer is, so neither owes a page.\n const live = record.lifecycle !== \"draft\" && record.lifecycle !== \"archived\";\n if (record.type === \"journey\" && live && pages.length === 0) {\n drafts.push({\n rule: \"unserved-journey\",\n message: \"no page names this journey in journeys:.\",\n fix: \"Name it on the pages that serve it.\",\n ...at,\n id: record.id,\n });\n }\n if (record.type !== \"journey\" && pages.length === 0 && index.childrenOf(record).length === 0) {\n drafts.push({\n rule: \"unused-record\",\n message: `no page and no record names this ${record.type}.`,\n ...at,\n id: record.id,\n });\n }\n }\n\n const findings: StrategyFinding[] = [];\n for (const draft of drafts) {\n const level = levels[draft.rule];\n if (level === \"off\") continue;\n findings.push({\n rule: draft.rule,\n ruleId: ruleId(draft.rule),\n severity: level,\n message: draft.fix === undefined ? draft.message : `${draft.message} ${draft.fix}`,\n ...(draft.fix === undefined ? {} : { key: draft.message }),\n guidance: guidanceFor(draft.rule),\n file: draft.file,\n ...(draft.line === undefined ? {} : { line: draft.line }),\n ...(draft.id === undefined ? {} : { id: draft.id }),\n ...(draft.field === undefined ? {} : { field: draft.field }),\n });\n }\n return findings.sort(compareFindings);\n}\n\nfunction compareText(a: string, b: string): number {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\nexport function compareFindings(a: StrategyFinding, b: StrategyFinding): number {\n return (\n compareText(a.file, b.file) ||\n (a.line ?? 0) - (b.line ?? 0) ||\n compareText(a.ruleId, b.ruleId) ||\n compareText(a.message, b.message)\n );\n}\n","import { ToolError } from \"../shared/errors.js\";\n\n/** An operational or usage error in the strategy tool: exit 2. */\nexport class StrategyError extends ToolError {\n constructor(message: string) {\n super(message);\n this.name = \"StrategyError\";\n }\n}\n","/**\n * The `strategy:` section of manni.config.yaml, and the run resolution every\n * command shares (proposal 0102). Its keys mirror `term:`'s, and so do its\n * refusals: unknown keys, rules or levels are errors that name what is\n * supported and never echo a value. The document set is the family\n * `collections:`, so `paths` and `exclude` are refused by name.\n */\nimport { resolve } from \"node:path\";\nimport { selectCollections } from \"../../shared/collections.js\";\nimport { findConfigFile, readConfigFile, type ConfigFile, type ConfigFileOptions } from \"../../shared/config-file.js\";\nimport { SEVERITIES } from \"../../shared/severity.js\";\nimport { StrategyError } from \"../errors.js\";\nimport {\n STRATEGY_RULES,\n type StrategyConfig,\n type StrategyRule,\n type StrategyRun,\n type StrategySeverity,\n} from \"../types.js\";\nimport { isStrategyRule } from \"./severity.js\";\n\nexport const STRATEGY_SECTION = \"strategy\";\n\nexport const DEFAULT_STRATEGY_BASELINE_PATH = \".manni-strategy-baseline.json\";\n\n/** The keys `strategy:` accepts, in the order the reference lists them. */\nconst CONFIG_KEYS: readonly (keyof StrategyConfig)[] = [\"severity\", \"baseline\", \"allowEmpty\", \"respectGitignore\"];\n\n/** Keys that belong to the family, refused by name with where they live. */\nconst COLLECTION_KEYS: readonly string[] = [\"paths\", \"exclude\"];\n\n/** The family scale, least severe first, then `off`. */\nconst SEVERITY_LEVELS: readonly StrategySeverity[] = [...SEVERITIES, \"off\"];\n\nconst CONFIG_FILE: ConfigFileOptions = {\n section: STRATEGY_SECTION,\n legacyNames: [],\n toError: (message) => new StrategyError(message),\n};\n\nfunction isMapping(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isLevel(value: unknown): value is StrategySeverity {\n return typeof value === \"string\" && (SEVERITY_LEVELS as readonly string[]).includes(value);\n}\n\nfunction rejectUnknownKeys(obj: Record<string, unknown>, allowed: readonly string[], where: string, source: string): void {\n for (const key of Object.keys(obj)) {\n if (!allowed.includes(key)) {\n throw new StrategyError(`Unknown key \"${key}\" under ${where}: in ${source}. Supported keys: ${allowed.join(\", \")}.`);\n }\n }\n}\n\n/** A type error names the key and the type it wanted, never the value, which could be a pasted secret. */\nfunction wrongType(key: string, expected: string, source: string): StrategyError {\n return new StrategyError(`strategy.${key} in ${source} must be ${expected}.`);\n}\n\nfunction asBoolean(value: unknown, key: string, source: string): boolean {\n if (typeof value !== \"boolean\") throw wrongType(key, \"a boolean\", source);\n return value;\n}\n\nfunction parseSeverity(value: unknown, source: string): Partial<Record<StrategyRule, StrategySeverity>> {\n if (!isMapping(value)) throw wrongType(\"severity\", \"a mapping\", source);\n rejectUnknownKeys(value, STRATEGY_RULES, \"strategy.severity\", source);\n const severity: Partial<Record<StrategyRule, StrategySeverity>> = {};\n for (const [rule, level] of Object.entries(value)) {\n if (!isStrategyRule(rule)) continue;\n if (!isLevel(level)) {\n // A level is not a secret, so a string one is quoted back.\n const quoted = typeof level === \"string\" ? ` \"${level}\"` : \"\";\n throw new StrategyError(\n `${source}: strategy.severity.${rule}${quoted} is not a level. Expected ${SEVERITY_LEVELS.join(\" | \")}.`,\n );\n }\n severity[rule] = level;\n }\n return severity;\n}\n\n/** Validate the `strategy:` slice of a family file. `null` is an empty section. */\nexport function parseStrategyConfig(raw: unknown, source: string): StrategyConfig {\n if (raw == null) return {};\n if (!isMapping(raw)) throw new StrategyError(`strategy: in ${source} must be a mapping.`);\n // Before the unknown-key check, which would call a family setting a typo.\n for (const key of COLLECTION_KEYS) {\n if (Object.hasOwn(raw, key)) {\n throw new StrategyError(`${source}: strategy does not carry \"${key}\". Name a collection under collections:.`);\n }\n }\n rejectUnknownKeys(raw, CONFIG_KEYS, \"strategy\", source);\n\n const config: StrategyConfig = {};\n if (raw.severity !== undefined) config.severity = parseSeverity(raw.severity, source);\n if (raw.baseline !== undefined) {\n if (typeof raw.baseline !== \"string\") throw wrongType(\"baseline\", \"a string\", source);\n config.baseline = raw.baseline;\n }\n if (raw.allowEmpty !== undefined) config.allowEmpty = asBoolean(raw.allowEmpty, \"allowEmpty\", source);\n if (raw.respectGitignore !== undefined) {\n config.respectGitignore = asBoolean(raw.respectGitignore, \"respectGitignore\", source);\n }\n return config;\n}\n\nexport interface StrategyRunOptions {\n cwd: string;\n /** `-c/--config`. */\n configPath?: string;\n /** Positional inputs; empty means fall back to the selected collections' `paths:`. */\n inputs: string[];\n /** `--collection <name>`, repeatable. Empty means every declared collection. */\n collection?: string[];\n}\n\nconst STDIN = \"-\";\n\n/** Which config governs the run, and what to resolve from where. */\nexport async function resolveStrategyRun(opts: StrategyRunOptions): Promise<StrategyRun> {\n const cwd = resolve(opts.cwd);\n const wanted = opts.collection ?? [];\n if (wanted.length > 0 && opts.inputs.some((input) => input !== STDIN)) {\n throw new StrategyError(\"--collection selects a configured collection; it cannot be combined with paths.\");\n }\n\n const file: ConfigFile | null = opts.configPath\n ? await readConfigFile(opts.configPath, cwd, CONFIG_FILE)\n : await findConfigFile(cwd, CONFIG_FILE);\n if (wanted.length > 0 && file === null) {\n throw new StrategyError(\"--collection needs a config file to select from.\");\n }\n const config = file === null ? null : parseStrategyConfig(file.value, file.source);\n\n const collections = file\n ? selectCollections(file.collections, wanted, file.source, (message) => new StrategyError(message))\n : [];\n const fromCollections = opts.inputs.length === 0;\n const inputs = fromCollections ? collections.flatMap((c) => c.paths) : opts.inputs;\n const base = fromCollections && inputs.length > 0 && file ? file.dir : cwd;\n\n return {\n config,\n inputs,\n base,\n collections,\n fromCollections,\n ...(file ? { configDir: file.dir, configPath: file.path, configSource: file.source, configFile: file } : {}),\n };\n}\n","/**\n * What every `manni strategy` command core shares: resolve the run and load\n * the set. Kept free of commander and of stdout, so a core is called directly\n * by its tests; the CLI reads stdin once and hands it in.\n */\nimport { isAbsolute, relative, resolve } from \"node:path\";\nimport { loadConfig } from \"../../graph/core/config.js\";\nimport { routesFrom } from \"../../graph/core/discover.js\";\nimport { resolveStrategyRun } from \"../core/config.js\";\nimport { loadStrategySet } from \"../core/load-set.js\";\nimport { resolveSteps, stepsNeedRoutes, type StepMap } from \"../core/steps.js\";\nimport { StrategyError } from \"../errors.js\";\nimport type { StrategyRun, StrategySet } from \"../types.js\";\n\n/** The inputs and flags `list`, `get` and `check` share. */\nexport interface StrategyCommandOptions {\n /** Default `process.cwd()`. */\n cwd?: string;\n /** Positional `[paths...]`; `-` is stdin. Empty falls back to the collections. */\n inputs: string[];\n /** Stdin's content, read once by the CLI when `-` is among the inputs. */\n stdin?: string;\n /** `--as <format>`. */\n as?: string;\n /** `--exclude <glob>`, repeatable. */\n exclude?: string[];\n /** `--ext <list>`, already split. */\n exts?: string[];\n /** `--allow-empty`. */\n allowEmpty?: boolean;\n /** `--no-gitignore`. */\n noGitignore?: boolean;\n /** `--collection <name>`, repeatable. */\n collection?: string[];\n /** `-c, --config <path>`. */\n configPath?: string;\n onNotice?: (message: string) => void;\n}\n\nexport interface LoadedStrategy {\n cwd: string;\n run: StrategyRun;\n set: StrategySet;\n /** Each journey's steps, resolved against the run's pages. */\n steps: StepMap;\n}\n\nexport async function loadStrategy(opts: StrategyCommandOptions): Promise<LoadedStrategy> {\n const cwd = resolve(opts.cwd ?? process.cwd());\n const run = await resolveStrategyRun({\n cwd,\n inputs: opts.inputs,\n ...(opts.configPath === undefined ? {} : { configPath: opts.configPath }),\n ...(opts.collection === undefined ? {} : { collection: opts.collection }),\n });\n // A collection's `exclude:` shapes the collection, so it applies when the\n // inputs came from the collections and never to a path the operator typed.\n const exclude = [\n ...new Set([...(opts.exclude ?? []), ...(run.fromCollections ? run.collections.flatMap((c) => c.exclude) : [])]),\n ];\n const set = await loadStrategySet({\n run,\n exclude,\n ...(opts.exts === undefined ? {} : { exts: opts.exts }),\n ...(opts.allowEmpty === true ? { allowEmpty: true } : {}),\n ...(opts.noGitignore === true ? { noGitignore: true } : {}),\n ...(opts.stdin === undefined ? {} : { stdin: opts.stdin }),\n ...(opts.as === undefined ? {} : { as: opts.as }),\n ...(opts.onNotice === undefined ? {} : { onNotice: opts.onNotice }),\n });\n // `graph:` is read only when a step names a `/` route, and through graph's own loader.\n const routes = stepsNeedRoutes(set) && run.configPath !== undefined ? routesFrom(loadConfig(run.configPath, cwd), run.base) : [];\n const steps = resolveSteps(set, { routes, from: run.configDir ?? cwd, base: run.base });\n return { cwd, run, set, steps };\n}\n\n/** `value` when it is one of `allowed`, else the family's unknown-format refusal. */\nexport function formatChoice<T extends string>(value: string, allowed: readonly T[]): T {\n const found = allowed.find((candidate) => candidate === value);\n if (found === undefined) throw new StrategyError(`unknown format \"${value}\". Expected ${allowed.join(\" | \")}.`);\n return found;\n}\n\n/**\n * A path as a person standing in `cwd` would type it: relative, posix. A\n * label is relative to the run's base, which is the config directory for a\n * collection run, so it is resolved from there first.\n */\nexport function displayPath(path: string, cwd: string, base = cwd): string {\n if (path.startsWith(\"<\")) return path;\n const rel = relative(cwd, isAbsolute(path) ? path : resolve(base, path));\n return (rel === \"\" ? \".\" : rel).replaceAll(\"\\\\\", \"/\");\n}\n\n/** `1 record`, `2 records`. */\nexport function plural(n: number, one: string, many = `${one}s`): string {\n return `${String(n)} ${n === 1 ? one : many}`;\n}\n","/**\n * Load a strategy set: resolve the run's files, extract each one's metadata\n * with meta's extractor, merge in what its `{page}.meta.yaml` manifests\n * supply through `metaPageView`, and read the records and references out of\n * the merged view. Every value's file and line come from `declaredAt`, so a\n * value a sidecar holds is filed at the sidecar's line.\n *\n * A file that cannot be read or parsed is an error, not a skip: a set that\n * quietly lost a record would report the pages naming it as broken.\n */\nimport { readFile } from \"node:fs/promises\";\nimport { extname, resolve } from \"node:path\";\nimport {\n STDIN_LABEL,\n STDIN_TOKEN,\n assertNonEmpty,\n declaredAt,\n extractorByName,\n extractorForExtension,\n gitignoreOptions,\n metaPageView,\n resolveTargetSet,\n supportedExtensions,\n} from \"../../meta/internal.js\";\nimport type { ExtractedMetadata } from \"../../meta/index.js\";\nimport { STDIN_REQUIRES_AS } from \"../../shared/cli-options.js\";\nimport { errorMessage } from \"../../shared/errors.js\";\nimport { readRecord } from \"../../shared/reference-fields.js\";\nimport { StrategyError } from \"../errors.js\";\nimport {\n PAGE_FIELDS,\n PARENTS,\n type At,\n type StrategyRecord,\n type StrategyReference,\n type StrategyRun,\n type StrategySet,\n type StrategyStep,\n} from \"../types.js\";\n\nexport interface LoadStrategySetOptions {\n run: StrategyRun;\n /** Stdin's content, when `-` is among the run's inputs. */\n stdin?: string;\n /** `--as <format>`, which stdin needs. */\n as?: string;\n /** `--exclude <glob>`, repeatable. */\n exclude?: string[];\n /** `--ext <list>`: the extensions a directory or glob walk keeps. */\n exts?: string[];\n /** `--allow-empty`: wins over `strategy.allowEmpty`. */\n allowEmpty?: boolean;\n /** `--no-gitignore`. */\n noGitignore?: boolean;\n onNotice?: (message: string) => void;\n}\n\ninterface Extracted {\n label: string;\n extracted: ExtractedMetadata;\n}\n\nfunction text(value: unknown): string | undefined {\n return typeof value === \"string\" && value.trim() !== \"\" ? value : undefined;\n}\n\nfunction extract(content: string, label: string, path: string | undefined, format: string): Extracted {\n const extractor = extractorByName(format);\n if (extractor === undefined) throw new StrategyError(`${label}: no reader for format \"${format}\".`);\n try {\n return { label, extracted: extractor.extract(content, path ?? label) };\n } catch (error) {\n throw new StrategyError(`${label}: could not be read as ${format}: ${errorMessage(error)}`);\n }\n}\n\nasync function readInput(path: string, label: string): Promise<string> {\n try {\n return await readFile(path, \"utf8\");\n } catch (error) {\n throw new StrategyError(`${label}: could not be read: ${errorMessage(error)}`);\n }\n}\n\n/** The files the run names, extracted. Stdin comes last, as one more input. */\nasync function extractAll(opts: LoadStrategySetOptions, allowEmpty: boolean): Promise<Extracted[]> {\n const { run } = opts;\n const exclude = opts.exclude ?? [];\n const usingStdin = run.inputs.includes(STDIN_TOKEN);\n const inputs = run.inputs.filter((input) => input !== STDIN_TOKEN);\n if (usingStdin && (opts.as === undefined || opts.as === \"\")) throw new StrategyError(STDIN_REQUIRES_AS);\n if (inputs.length === 0 && !usingStdin) {\n throw new StrategyError(\n \"No files to read. Pass paths/globs, or declare a collection under `collections:` in manni.config.yaml.\",\n );\n }\n\n const out: Extracted[] = [];\n if (inputs.length > 0) {\n const { files, gitignoreSkipped } = await resolveTargetSet({\n inputs,\n cwd: run.base,\n exclude,\n exts: opts.exts ?? supportedExtensions(),\n allowEmpty,\n ...gitignoreOptions({\n ...(opts.noGitignore === true ? { flag: false } : {}),\n ...(run.config?.respectGitignore === undefined ? {} : { configured: run.config.respectGitignore }),\n ...(opts.onNotice ? { onNotice: opts.onNotice } : {}),\n }),\n });\n assertNonEmpty({\n files,\n inputs,\n usingStdin,\n allowEmpty,\n exclude,\n ...(opts.exts === undefined ? {} : { exts: opts.exts }),\n gitignoreSkipped,\n action: \"read\",\n });\n for (const file of files) {\n const extractor = extractorForExtension(extname(file));\n if (extractor === undefined) {\n throw new StrategyError(`${file}: no reader for its extension. Pass --as <format> through stdin to read it.`);\n }\n const path = resolve(run.base, file);\n out.push(extract(await readInput(path, file), file, path, extractor.name));\n }\n }\n if (usingStdin && opts.as !== undefined) out.push(extract(opts.stdin ?? \"\", STDIN_LABEL, undefined, opts.as));\n return out;\n}\n\n/** One value or a list of them, with the pointer each sits at. Anything else contributes nothing. */\nfunction valuesOf(data: Record<string, unknown>, field: string): { value: string; pointer: string }[] {\n const raw = data[field];\n if (typeof raw === \"string\") return raw.trim() === \"\" ? [] : [{ value: raw, pointer: `/${field}` }];\n if (!Array.isArray(raw)) return [];\n return raw.flatMap((item: unknown, i) =>\n typeof item === \"string\" && item.trim() !== \"\" ? [{ value: item, pointer: `/${field}/${String(i)}` }] : [],\n );\n}\n\n/**\n * A journey's `steps:`, each mapping item with the fields of their type and\n * the lines they sit on. A step is numbered by its position in the list.\n */\nfunction stepsOf(data: Record<string, unknown>, at: (pointer: string) => At): StrategyStep[] {\n const raw = data[\"steps\"];\n if (!Array.isArray(raw)) return [];\n return raw.flatMap((item: unknown, i): StrategyStep[] => {\n if (typeof item !== \"object\" || item === null || Array.isArray(item)) return [];\n const fields = item as Record<string, unknown>;\n const pointer = `/steps/${String(i)}`;\n const stage = text(fields[\"stage\"]);\n const doc = text(fields[\"doc\"]);\n const note = text(fields[\"note\"]);\n const exists = fields[\"exists\"];\n const known = exists === true || exists === false || exists === \"partial\" ? exists : undefined;\n return [\n {\n n: i + 1,\n ...(stage === undefined ? {} : { stage }),\n ...(doc === undefined ? {} : { doc }),\n ...(known === undefined ? {} : { exists: known }),\n ...(note === undefined ? {} : { note }),\n ...at(pointer),\n ...(doc === undefined ? {} : { docAt: at(`${pointer}/doc`) }),\n ...(known === undefined ? {} : { existsAt: at(`${pointer}/exists`) }),\n },\n ];\n });\n}\n\nexport async function loadStrategySet(opts: LoadStrategySetOptions): Promise<StrategySet> {\n const { run } = opts;\n const allowEmpty = opts.allowEmpty ?? run.config?.allowEmpty === true;\n const inputs = await extractAll(opts, allowEmpty);\n\n // Meta's view over the same config file, so a sidecar counts exactly as\n // `manni meta validate` merges it. Labels are relative to the run's base.\n const view = await metaPageView({\n cwd: run.base,\n ...(run.configPath === undefined ? { noConfig: true } : { configPath: run.configPath }),\n pages: inputs.filter((i) => i.label !== STDIN_LABEL).map((i) => resolve(run.base, i.label)),\n });\n\n const pages: string[] = [];\n const set: StrategySet = { records: [], references: [], pages };\n for (const { label, extracted } of inputs) {\n const merged = await view.merge(label, extracted);\n const data = merged.extracted.data;\n const at = (pointer: string): At => declaredAt(label, pointer, { extracted: merged.extracted, locate: merged.locate });\n const declares = readRecord(data, label);\n const type = declares?.type;\n const isRecord = declares !== undefined;\n\n if (declares !== undefined) {\n const declaredId = text(data[\"id\"]);\n const title = text(data[\"title\"]);\n const description = text(data[\"description\"]);\n const lifecycle = text(data[\"lifecycle\"]);\n const steps = type === \"journey\" ? stepsOf(data, at) : [];\n const record: StrategyRecord = {\n id: declares.id,\n type: declares.type,\n ...(title === undefined ? {} : { title }),\n ...(description === undefined ? {} : { description }),\n ...(lifecycle === undefined ? {} : { lifecycle }),\n file: label,\n line: 1,\n ...(declaredId === undefined ? {} : { idAt: at(\"/id\") }),\n parents:\n declares.type === \"audience\"\n ? []\n : valuesOf(data, PARENTS[declares.type]).map(({ value, pointer }) => ({ value, ...at(pointer) })),\n ...(steps.length === 0 ? {} : { steps }),\n };\n set.records.push(record);\n } else {\n pages.push(label);\n }\n\n // A journey's `personas:` is its parent field, read above, so it is not a reference too.\n const parentField = type !== undefined && type !== \"audience\" ? PARENTS[type] : undefined;\n for (const field of Object.values(PAGE_FIELDS)) {\n if (field === parentField) continue;\n for (const { value, pointer } of valuesOf(data, field)) {\n const reference: StrategyReference = { field, value, page: label, record: isRecord, ...at(pointer) };\n set.references.push(reference);\n }\n }\n }\n\n if (set.records.length === 0 && !allowEmpty) {\n throw new StrategyError(\n \"no strategy records found. A record is a page declaring type: audience, type: persona or type: journey.\",\n );\n }\n return set;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;","names":["target","fix","resolve","resolve","relative","resolve","resolve","resolve","resolve","relative"]}
|
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
findGitRoot,
|
|
4
|
+
listInTree,
|
|
5
|
+
resolveArtifacts,
|
|
6
|
+
safeRead
|
|
7
|
+
} from "./chunk-XTMONCQE.js";
|
|
8
|
+
import {
|
|
9
|
+
configDir
|
|
10
|
+
} from "./chunk-4TSWU2SU.js";
|
|
2
11
|
import {
|
|
3
12
|
emptyWindow,
|
|
4
13
|
materialize,
|
|
5
14
|
windowOf
|
|
6
15
|
} from "./chunk-VHJ72YCD.js";
|
|
7
16
|
import {
|
|
8
|
-
extractEvals
|
|
9
|
-
|
|
10
|
-
listInTree,
|
|
11
|
-
resolveArtifacts,
|
|
12
|
-
safeRead
|
|
13
|
-
} from "./chunk-UVC3BUKU.js";
|
|
17
|
+
extractEvals
|
|
18
|
+
} from "./chunk-IXFFVI5S.js";
|
|
14
19
|
import {
|
|
15
20
|
makeRedactor
|
|
16
21
|
} from "./chunk-6WJUZQQX.js";
|
|
17
|
-
import {
|
|
18
|
-
configDir
|
|
19
|
-
} from "./chunk-4TSWU2SU.js";
|
|
20
22
|
import {
|
|
21
23
|
extractFrontmatter
|
|
22
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-YB3KD5RI.js";
|
|
23
25
|
|
|
24
26
|
// src/tracevals/rules/turn.ts
|
|
25
27
|
var INJECTED = /<(system-reminder|task-notification|ci-monitor-event|local-command-stdout|local-command-stderr|local-command-caveat)>[\s\S]*?<\/\1>/g;
|
|
@@ -671,4 +673,4 @@ export {
|
|
|
671
673
|
resolveTurnSources,
|
|
672
674
|
pathKey
|
|
673
675
|
};
|
|
674
|
-
//# sourceMappingURL=chunk-
|
|
676
|
+
//# sourceMappingURL=chunk-KIUFBUUZ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tracevals/rules/turn.ts","../src/tracevals/rules/sources.ts"],"sourcesContent":["/**\n * The turn a Stop or SubagentStop judges (proposal 0079). A turn starts at the\n * last prompt the user typed; tool results and hook feedback do not start one.\n * Under SubagentStop the turn is the subagent's whole run.\n *\n * Which user records are typed prompts is read from the record shape Claude\n * Code writes, not guessed from wording alone:\n *\n * - `isMeta: true` marks harness injections: a skill's \"Base directory\" body,\n * `<local-command-caveat>`, peer and scheduled messages, hook feedback.\n * - `isCompactSummary: true` is the \"session is being continued\" summary.\n * - `origin.kind` is `human` for a typed prompt and `task-notification` or\n * `peer` otherwise. Older records carry only `turnOrigin`, whose non-typed\n * values are `task_notification`, `scheduled` and `peer`.\n * - A record whose text is nothing but `<system-reminder>`,\n * `<task-notification>`, `<ci-monitor-event>` or `<local-command-*>` blocks\n * is an injection. A typed prompt Claude Code prefixed with a reminder keeps\n * the text after it, so it still counts.\n * - `Stop hook feedback:` and `[Request interrupted by user…]` are markers,\n * never prompts.\n *\n * A `<command-name>` record is a slash command someone typed, so it counts.\n */\nimport {\n emptyWindow,\n materialize,\n type TraceWindow,\n} from \"../graders/util.js\";\nimport type { Trace, TraceEvent } from \"../trace/types.js\";\n\nexport interface TurnSlice {\n window: TraceWindow;\n /** Ordinal in `trace.events` of the turn's first event. */\n from: number;\n /** Ordinal of its last event, inclusive. Less than `from` when there is no turn. */\n to: number;\n /** Typed prompts in the whole session, which `turn-count-above` reads. */\n sessionTurnCount: number;\n}\n\nconst INJECTED =\n /<(system-reminder|task-notification|ci-monitor-event|local-command-stdout|local-command-stderr|local-command-caveat)>[\\s\\S]*?<\\/\\1>/g;\nconst MARKER =\n /^(?:Stop hook feedback:|SubagentStop hook feedback:|\\[Request interrupted by user)/;\n/**\n * Origins of a prompt a person sent: typed in the CLI, or sent through the SDK.\n * Both record formats name it, as `origin.kind` or the older `turnOrigin`,\n * and both are read against this one set.\n */\nconst TYPED_TURN_ORIGINS = new Set([\"human\", \"sdk\"]);\nconst WORK = new Set<TraceEvent[\"kind\"]>([\"assistant\", \"tool_call\", \"tool_result\"]);\n\nexport function isTypedPrompt(event: TraceEvent): boolean {\n if (event.kind !== \"user\" || event.text === undefined) return false;\n const { raw } = event;\n if (raw.isMeta === true || raw.isCompactSummary === true) return false;\n const origin = raw.origin;\n if (\n typeof origin === \"object\" &&\n origin !== null &&\n \"kind\" in origin &&\n typeof origin.kind === \"string\"\n ) {\n if (!TYPED_TURN_ORIGINS.has(origin.kind)) return false;\n } else if (\n typeof raw.turnOrigin === \"string\" &&\n !TYPED_TURN_ORIGINS.has(raw.turnOrigin)\n ) {\n return false;\n }\n const rest = event.text.replace(INJECTED, \"\").trim();\n return rest !== \"\" && !MARKER.test(rest);\n}\n\n/** The last turn of a session: its last typed prompt to the end of the trace. */\nexport function lastTurn(trace: Trace): TurnSlice {\n const prompts = trace.events.filter((e) => e.sidechain !== true && isTypedPrompt(e));\n const sessionTurnCount = prompts.length;\n const to = trace.events.length - 1;\n const last = prompts.at(-1);\n if (last === undefined) {\n return {\n window: emptyWindow(\"turn\", \"last turn\", \"the trace holds no prompt the user typed\"),\n from: to + 1,\n to,\n sessionTurnCount,\n };\n }\n return slice(trace, last.index, [last], new Set([undefined]), sessionTurnCount, {\n label: \"last turn\",\n reason: \"nothing happened after the last prompt the user typed\",\n });\n}\n\n/**\n * A subagent's sidecar transcript parsed alone. Every record is a sidechain,\n * so the parser keeps no prompts; the turn is the whole run, and its prompts\n * are the task the subagent was given.\n */\nexport function subagentTurn(trace: Trace): TurnSlice {\n const prompts = trace.events.filter(isTypedPrompt);\n return slice(\n trace,\n 0,\n prompts,\n new Set(trace.events.map((e) => e.branchId)),\n prompts.length,\n { label: \"subagent run\", reason: \"the subagent recorded no work\" },\n );\n}\n\nfunction slice(\n trace: Trace,\n from: number,\n prompts: TraceEvent[],\n own: Set<string | undefined>,\n sessionTurnCount: number,\n words: { label: string; reason: string },\n): TurnSlice {\n const to = trace.events.length - 1;\n const worked = trace.events.some((e) => e.index > from && WORK.has(e.kind));\n if (!worked) {\n return {\n window: emptyWindow(\"turn\", words.label, words.reason),\n from,\n to,\n sessionTurnCount,\n };\n }\n const window = materialize(\n trace,\n \"turn\",\n words.label,\n [{ start: from, end: Number.POSITIVE_INFINITY }],\n undefined,\n own,\n );\n // Only typed prompts are prompts here, and `turnCount` is the session's,\n // because the one condition that reads it counts session turns.\n window.userMessages = prompts.map((p) => p.text ?? \"\");\n window.turnCount = sessionTurnCount;\n return { window, from, to, sessionTurnCount };\n}\n","/**\n * Which files govern the agent in a turn (proposal 0079, \"Rule sources and\n * their triggers\"). Resolution is deterministic, from the filesystem and the\n * trace; no model decides which files count.\n *\n * The list of formats is closed. Reading a file never makes it a source: a\n * README or a product docs page describes other systems, so only the known\n * formats, files named by `include`, and what a skill or an `@path` import\n * pulls in are ever returned. `exclude` removes a file from every row.\n *\n * To touch a file is to Read, Write or Edit it, anywhere in the session up to\n * the turn's end, which is Claude Code's own trigger for path-scoped rules.\n *\n * Six more formats say what the session was asked (proposal 0080): the typed\n * prompts, the approved plan, a touched Spec Kit feature, Kiro spec or live\n * OpenSpec change, and a touched file `runtime.plans` names. None is known\n * at session start, so only a turn resolves them, and none declares evals.\n *\n * Two are read from the transcript itself (proposal 0081): the system prompt\n * of the last prompt snapshot, and a user output style. Claude Code's own\n * prompt is reported and never blocks; a prompt the user wrote blocks.\n */\nimport { createHash } from \"node:crypto\";\nimport { homedir } from \"node:os\";\nimport { basename, dirname, isAbsolute, join, relative, resolve, sep } from \"node:path\";\nimport picomatch from \"picomatch\";\nimport { extractFrontmatter } from \"../../meta/extractors/frontmatter.js\";\nimport type { ExtractedMetadata } from \"../../meta/types.js\";\nimport { resolveArtifacts } from \"../artifacts/resolve.js\";\nimport { findGitRoot, listInTree, safeRead } from \"../artifacts/fs.js\";\nimport { extractEvals } from \"../evals/extract.js\";\nimport { windowOf } from \"../graders/util.js\";\nimport { makeRedactor } from \"../judge/redact.js\";\nimport { configDir } from \"../trace/discover.js\";\nimport type { Trace } from \"../trace/types.js\";\nimport { isTypedPrompt } from \"./turn.js\";\n\nexport type RuleFormat =\n | \"claude-md\"\n | \"claude-rule\"\n | \"agents-md\"\n | \"gemini-md\"\n | \"cursor-rule\"\n | \"kiro-steering\"\n | \"speckit-constitution\"\n | \"openspec-project\"\n | \"import\"\n | \"skill\"\n | \"slash-command\"\n | \"agent\"\n | \"designated\"\n | \"prompt\"\n | \"plan\"\n | \"speckit-spec\"\n | \"kiro-spec\"\n | \"openspec-change\"\n | \"plans\"\n | \"system-prompt\"\n | \"output-style\";\n\n/** An `ai` eval a source declares; its assertion is the rule (proposal 0079). */\nexport interface DeclaredRule {\n id: string;\n text: string;\n when?: Record<string, unknown>;\n}\n\nexport interface RuleSource {\n /** Absolute path on disk, or `\"\"` for the typed prompts, an inline plan and the system prompt. */\n path: string;\n /** Relative to the project root with forward slashes, or `~/…` under home. */\n displayPath: string;\n format: RuleFormat;\n /** Why the file is in scope, in words: `always`, `read`, `touched src/a.ts`. */\n trigger: string;\n content: string;\n /** sha256 of `content`, hex. */\n sha256: string;\n /** The skill a `skill` source belongs to. */\n skill?: string;\n /** Present when the file declares `ai` evals; they replace extraction. */\n declaredRules?: DeclaredRule[];\n /** False for Claude Code's default system prompt, whose rules are reported and never block. */\n blocks: boolean;\n}\n\nexport interface SourceOptions {\n /** The session's working directory, where the ancestor walk starts. */\n projectDir: string;\n /** Ceiling for the ancestor walk and base of `displayPath`; default the git root. */\n projectRoot?: string;\n /** `CLAUDE_CONFIG_DIR` finds `~/.claude`; `HOME` / `USERPROFILE` find `~/.gemini` and `~/.kiro`. */\n env?: Record<string, string | undefined>;\n /** `runtime.include`: globs, relative to the project root, in scope once read. */\n include?: string[];\n /** `runtime.exclude`: globs never treated as sources, in any row, and source names. */\n exclude?: string[];\n /** `judge.redact`: patterns scrubbed from what the transcript records of the system prompt. */\n redact?: string[];\n /** `runtime.plans`: globs, relative to the project root, in scope once touched. */\n plans?: string[];\n /** Set under SubagentStop: the subagent type whose definition governs the run. */\n agentType?: string;\n}\n\nexport interface ResolvedSources {\n sources: RuleSource[];\n warnings: string[];\n}\n\n/** The turn's ordinal bounds in `trace.events`, inclusive. `lastTurn` returns them. */\nexport interface TurnBounds {\n from: number;\n to: number;\n}\n\n/** Imports followed from a `claude-md` or `gemini-md` file, as Claude Code does. */\nconst MAX_IMPORT_HOPS = 4;\n\ntype Trigger =\n | { kind: \"always\" }\n | { kind: \"read\" }\n | { kind: \"globs\"; key: string; patterns: string[] };\n\ninterface Candidate {\n path: string;\n format: RuleFormat;\n trigger: Trigger;\n}\n\ninterface Touch {\n abs: string;\n rel: string | null;\n read: boolean;\n}\n\nclass Collector {\n readonly sources: RuleSource[] = [];\n readonly warnings: string[] = [];\n private readonly seen = new Set<string>();\n private readonly parsed = new Map<string, ExtractedMetadata | null>();\n private readonly excluded: (path: string) => boolean;\n /** Whether `exclude` lists, as it is, the name of a source with no file, such as `prompt`. */\n readonly excludedName: (name: string) => boolean;\n\n constructor(\n readonly cwd: string,\n readonly root: string,\n readonly home: string,\n exclude: string[],\n ) {\n const match = exclude.length > 0 ? picomatch(exclude, { dot: true }) : null;\n this.excluded = (path) => match !== null && match(this.display(path));\n // The whole name, never a glob: `**` names files, and keeps the prompt.\n this.excludedName = (name) => exclude.includes(name);\n }\n\n display(path: string): string {\n const inRoot = relPosix(this.root, path);\n if (inRoot !== null) return inRoot;\n const inHome = relPosix(this.home, path);\n if (inHome !== null) return `~/${inHome}`;\n return path.split(sep).join(\"/\");\n }\n\n has(path: string): boolean {\n return this.seen.has(key(path));\n }\n\n /** The file's front matter, or null when it has none or it does not parse. */\n front(path: string, content: string): ExtractedMetadata | null {\n const k = key(path);\n if (this.parsed.has(k)) return this.parsed.get(k) ?? null;\n let parsed: ExtractedMetadata | null = null;\n try {\n const fm = extractFrontmatter(content, \"markdown\");\n parsed = fm.present ? fm : null;\n } catch (err) {\n const loose = isCursorRule(path) ? cursorFront(content) : null;\n if (loose !== null) {\n this.parsed.set(k, loose);\n return loose;\n }\n const first = (err instanceof Error ? err.message : String(err)).split(\"\\n\")[0] ?? \"\";\n this.warnings.push(\n `${this.display(path)}: front matter does not parse (${first}), so it is read as having none`,\n );\n }\n this.parsed.set(k, parsed);\n return parsed;\n }\n\n /** Adds a source once. Returns it, or null when excluded or already listed. */\n add(\n path: string,\n content: string,\n format: RuleFormat,\n trigger: string,\n skill?: string,\n ): RuleSource | null {\n if (this.has(path) || this.excluded(path)) return null;\n this.seen.add(key(path));\n const source: RuleSource = {\n path,\n displayPath: this.display(path),\n format,\n trigger,\n content,\n sha256: createHash(\"sha256\").update(content).digest(\"hex\"),\n blocks: true,\n };\n if (skill !== undefined) source.skill = skill;\n const declared = this.declared(path, content);\n if (declared !== undefined) source.declaredRules = declared;\n this.sources.push(source);\n return source;\n }\n\n /**\n * Adds a source that says what the session was asked, or one the transcript\n * recorded. These never declare evals. With no file, its display path is its\n * format, and `exclude` matches that name.\n */\n addRequest(\n file: string | null,\n content: string,\n format: RuleFormat,\n trigger: string,\n blocks = true,\n ): void {\n // A named source goes by its name whether or not a file holds it, so\n // `exclude: [plan]` drops a plan file as it drops an inline plan.\n if (EXCLUDABLE_BY_NAME.has(format) && this.excludedName(format)) return;\n if (file !== null) {\n if (this.has(file) || this.excluded(file)) return;\n this.seen.add(key(file));\n }\n this.sources.push({\n path: file ?? \"\",\n displayPath: file === null ? format : this.display(file),\n format,\n trigger,\n content,\n sha256: createHash(\"sha256\").update(content).digest(\"hex\"),\n blocks,\n });\n }\n\n private declared(path: string, content: string): DeclaredRule[] | undefined {\n const fm = this.front(path, content);\n if (fm === null) return undefined;\n const extracted = extractEvals(\n { name: basename(path), type: \"project-rules\", path, content, origin: \"project\" },\n fm,\n );\n if (extracted.errors.length > 0) {\n this.warnings.push(\n `${this.display(path)}: metadata.evals does not validate (${extracted.errors[0]?.message ?? \"invalid\"}), so it declares no rules`,\n );\n return undefined;\n }\n const rules: DeclaredRule[] = [];\n for (const entry of extracted.evals) {\n if (entry.grader !== \"ai\" || entry.assertion === undefined) continue;\n const rule: DeclaredRule = { id: entry.id, text: entry.assertion };\n const when = entry.options?.when;\n if (isRecord(when)) rule.when = when;\n rules.push(rule);\n }\n return rules.length > 0 ? rules : undefined;\n }\n}\n\n/** Every source whose trigger is \"always\", without a trace (for `prepare`). */\nexport async function resolveAlwaysSources(opts: SourceOptions): Promise<ResolvedSources> {\n const c = await collector(opts);\n for (const candidate of await catalog(c, opts)) {\n if (candidate.trigger.kind === \"always\") await addWithImports(c, candidate, \"always\");\n }\n await addDesignated(c, opts);\n return { sources: c.sources, warnings: c.warnings };\n}\n\n/** Every source in scope for one turn of `trace`. */\nexport async function resolveTurnSources(\n trace: Trace,\n turn: TurnBounds,\n opts: SourceOptions,\n): Promise<ResolvedSources> {\n const c = await collector(opts);\n const touches: Touch[] = trace.fileAccesses\n .filter((a) => a.index <= turn.to)\n .map((a) => {\n const abs = resolve(c.cwd, a.path);\n return { abs, rel: relPosix(c.root, abs), read: a.op === \"read\" };\n });\n const wasRead = new Set(touches.filter((t) => t.read).map((t) => key(t.abs)));\n\n for (const candidate of await catalog(c, opts)) {\n const { trigger } = candidate;\n if (trigger.kind === \"always\") {\n await addWithImports(c, candidate, \"always\");\n } else if (trigger.kind === \"read\") {\n if (wasRead.has(key(candidate.path))) await addWithImports(c, candidate, \"read\");\n } else {\n const match = picomatch(trigger.patterns, { dot: true });\n const hit = touches.find((t) => t.rel !== null && match(t.rel));\n if (hit !== undefined && hit.rel !== null) {\n await addWithImports(c, candidate, `${trigger.key} matched ${hit.rel}`);\n }\n }\n }\n\n // A subdirectory's memory file applies once a file under it is touched.\n // Farther directories come first, so the nearest file reads last.\n const nested = new Map<string, string>();\n for (const touch of touches) {\n if (touch.rel === null) continue;\n for (const dir of dirsBelowCwd(c, dirname(touch.abs))) {\n if (!nested.has(dir)) nested.set(dir, touch.rel);\n }\n }\n const dirs = [...nested.keys()].sort((a, b) => a.length - b.length);\n for (const dir of dirs) {\n const touched = nested.get(dir) ?? \"\";\n for (const [name, format] of NESTED_FILES) {\n const path = join(dir, name);\n const content = await safeRead(path);\n if (content !== null) {\n await addWithImports(c, { path, format, trigger: { kind: \"always\" } }, `touched ${touched}`, content);\n }\n }\n }\n\n await addWindowed(c, trace, turn, touches, opts);\n\n await addDesignated(c, opts);\n\n addPrompts(c, trace, turn);\n await addPlan(c, trace, turn, opts);\n await addSpecs(c, touches, opts.plans ?? []);\n await addSystemPrompt(c, trace, turn, opts);\n return { sources: c.sources, warnings: c.warnings };\n}\n\n// ── What the transcript recorded of the prompt ───────────────────\n\n/** The sources `runtime.exclude` matches by name (proposals 0080 and 0081). */\nconst EXCLUDABLE_BY_NAME: ReadonlySet<RuleFormat> = new Set<RuleFormat>([\"prompt\", \"plan\", \"system-prompt\"]);\n\n/** Claude Code's own block in its default prompt; a replaced prompt has none. */\nconst BOUNDARY_MARKER = \"__SYSTEM_PROMPT_DYNAMIC_BOUNDARY__\";\n\ninterface Recorded {\n index: number;\n record: Record<string, unknown>;\n attachment: Record<string, unknown>;\n}\n\n/** The last attachment of `type` at or before the turn's end, with its record. */\nfunction lastAttachment(trace: Trace, turn: TurnBounds, type: string): Recorded | undefined {\n for (let i = trace.events.length - 1; i >= 0; i -= 1) {\n const event = trace.events[i];\n if (event === undefined || event.kind !== \"meta\" || event.index > turn.to) continue;\n const attachment = event.raw.attachment;\n if (event.raw.type === \"attachment\" && isRecord(attachment) && attachment.type === type) {\n return { index: event.index, record: event.raw, attachment };\n }\n }\n return undefined;\n}\n\n/**\n * The system prompt of the last `prompt_snapshot`, and the last output style.\n * A style a user file defines is its own source, holding the text the agent\n * saw; a built-in style's text joins the system prompt. The prompt is custom,\n * and blocks, when Claude Code's boundary marker is missing.\n */\nasync function addSystemPrompt(c: Collector, trace: Trace, turn: TurnBounds, opts: SourceOptions): Promise<void> {\n const scrub = makeRedactor(opts.redact ?? []);\n const style = lastAttachment(trace, turn, \"output_style_instructions\")?.attachment.style;\n const styleName = isRecord(style) && typeof style.name === \"string\" ? style.name : undefined;\n const stylePrompt = isRecord(style) && typeof style.prompt === \"string\" ? style.prompt : undefined;\n let builtIn: string | undefined;\n if (styleName !== undefined && stylePrompt !== undefined) {\n const file = await userStyleFile(c, opts, styleName);\n if (file === undefined) builtIn = stylePrompt;\n else c.addRequest(file, scrub(stylePrompt), \"output-style\", `style ${styleName}`);\n }\n\n const snapshot = lastAttachment(trace, turn, \"prompt_snapshot\");\n const recorded: unknown = snapshot?.attachment.systemPrompt;\n if (snapshot === undefined || !Array.isArray(recorded)) return;\n const blocks = recorded.filter((b): b is string => typeof b === \"string\");\n const custom = !blocks.includes(BOUNDARY_MARKER);\n const content = scrub([...blocks, ...(builtIn !== undefined ? [builtIn] : [])].join(\"\\n\\n\"));\n const { version } = snapshot.record;\n const by = typeof version === \"string\" ? `, Claude Code ${version}` : \"\";\n const trigger = `recorded at turn ${String(snapshot.index)}${by}${custom ? \", custom\" : \"\"}`;\n // A prompt the user replaced blocks; Claude Code's own default only reports.\n c.addRequest(null, content, \"system-prompt\", trigger, /* blocks= */ custom);\n}\n\n/**\n * The user file that defines output style `name`: under the project's\n * `.claude/output-styles/`, then the user's. Its front matter `name`, or\n * its base name, matches.\n */\nasync function userStyleFile(c: Collector, opts: SourceOptions, name: string): Promise<string | undefined> {\n // Where Claude Code reads styles: the project (cwd first, then the git root)\n // and the user. No ancestor walk, since Claude Code does none for styles.\n const dirs = [...new Set([c.cwd, c.root])].map((b) => join(b, \".claude\", \"output-styles\"));\n dirs.push(join(configDir(opts.env), \"output-styles\"));\n for (const dir of dirs) {\n for (const path of await listInTree(dir, (p) => p.endsWith(\".md\"), { maxDepth: 0 })) {\n const declared = (await frontOf(c, path))?.name;\n if ((typeof declared === \"string\" ? declared : basename(path, \".md\")) === name) return path;\n }\n }\n return undefined;\n}\n\n// ── What the session was asked ───────────────────────────────────\n\n/**\n * Every prompt typed up to the turn's end, as one numbered sequence. A\n * subagent's own run has only sidechain prompts, and its task is its request.\n */\nfunction addPrompts(c: Collector, trace: Trace, turn: TurnBounds): void {\n const typed = trace.events.filter((e) => e.index <= turn.to && isTypedPrompt(e));\n const main = typed.filter((e) => e.sidechain !== true);\n const prompts = main.length > 0 ? main : typed;\n if (prompts.length === 0) return;\n const content = prompts\n .map((p, i) => `${String(i + 1)}. ${(p.text ?? \"\").trim()}`)\n .join(\"\\n\\n\");\n c.addRequest(null, content, \"prompt\", `typed prompts 1-${String(prompts.length)}`);\n}\n\n/**\n * The plan of the last approved `ExitPlanMode` at or before the turn's end.\n * A call is approved when its result is not an error. The plan is the call's\n * `plan` input, or else the file the session last wrote under the user's\n * `plans/` directory before the call.\n */\nasync function addPlan(c: Collector, trace: Trace, turn: TurnBounds, opts: SourceOptions): Promise<void> {\n const approved = trace.toolCalls\n .filter((call) => call.name === \"ExitPlanMode\" && call.index <= turn.to)\n .filter((call) => isApproved(trace, call.index, turn.to))\n .at(-1);\n if (approved === undefined) return;\n const trigger = `approved at turn ${String(approved.index)}`;\n const plan = approved.input.plan;\n if (typeof plan === \"string\" && plan.trim() !== \"\") {\n c.addRequest(null, plan, \"plan\", trigger);\n return;\n }\n const plansDir = join(configDir(opts.env), \"plans\");\n const file = trace.fileAccesses\n .filter((a) => a.op !== \"read\" && a.index < approved.index)\n .map((a) => resolve(c.cwd, a.path))\n .filter((abs) => relPosix(plansDir, abs) !== null)\n .at(-1);\n if (file === undefined) return;\n const content = await safeRead(file);\n if (content !== null) c.addRequest(file, content, \"plan\", trigger);\n}\n\n/**\n * Whether the tool call at `index` has a result by `to` that is not an error.\n * A plan approved only after the turn ends is not yet a source; the next turn,\n * whose bounds include the result, picks it up.\n */\nfunction isApproved(trace: Trace, index: number, to: number): boolean {\n const id = trace.events.find((e) => e.index === index)?.raw.id;\n if (typeof id !== \"string\") return false;\n for (const event of trace.events) {\n if (event.kind !== \"tool_result\" || event.index <= index || event.index > to) continue;\n const message = event.raw.message;\n const blocks: unknown = isRecord(message) ? message.content : undefined;\n if (!Array.isArray(blocks)) continue;\n for (const block of blocks as unknown[]) {\n if (isRecord(block) && block.type === \"tool_result\" && block.tool_use_id === id) {\n return block.is_error !== true;\n }\n }\n }\n return false;\n}\n\n/** The files each spec format reads from a touched directory. */\nconst SPEC_FILES: Record<\"speckit-spec\" | \"kiro-spec\", string[]> = {\n \"speckit-spec\": [\"spec.md\", \"plan.md\", \"tasks.md\"],\n \"kiro-spec\": [\"requirements.md\", \"design.md\", \"tasks.md\"],\n};\n\n/** The spec directory a project-relative path lies under, and its format. */\nfunction specDirOf(rel: string): { dir: string; format: \"speckit-spec\" | \"kiro-spec\" | \"openspec-change\" } | null {\n const parts = rel.split(\"/\");\n const [first, second, third] = parts;\n if (first === \"specs\" && second !== undefined && parts.length > 2) {\n return { dir: `specs/${second}`, format: \"speckit-spec\" };\n }\n if (first === \".kiro\" && second === \"specs\" && third !== undefined && parts.length > 3) {\n return { dir: `.kiro/specs/${third}`, format: \"kiro-spec\" };\n }\n // An archived change is done, so it never counts.\n if (first === \"openspec\" && second === \"changes\" && third !== undefined && third !== \"archive\" && parts.length > 3) {\n return { dir: `openspec/changes/${third}`, format: \"openspec-change\" };\n }\n return null;\n}\n\n/** A touched spec brings in its directory's files; a touched `plans` file brings in itself. */\nasync function addSpecs(c: Collector, touches: Touch[], plans: string[]): Promise<void> {\n const isPlan = plans.length > 0 ? picomatch(plans, { dot: true }) : null;\n const done = new Set<string>();\n for (const touch of touches) {\n const { rel } = touch;\n if (rel === null) continue;\n const trigger = `touched ${rel}`;\n const spec = specDirOf(rel);\n if (spec !== null && !done.has(spec.dir)) {\n done.add(spec.dir);\n const dir = join(c.root, ...spec.dir.split(\"/\"));\n const files =\n spec.format === \"openspec-change\"\n ? await listInTree(dir, (p) => p.endsWith(\".md\"))\n : SPEC_FILES[spec.format].map((name) => join(dir, name));\n for (const file of files) {\n const content = await safeRead(file);\n if (content !== null) c.addRequest(file, content, spec.format, trigger);\n }\n }\n if (isPlan?.(rel) === true) {\n const content = await safeRead(touch.abs);\n if (content !== null) c.addRequest(touch.abs, content, \"plans\", trigger);\n }\n }\n}\n\n/**\n * Files named in `runtime.include`. A person chose each one to govern the\n * agent, so it applies to every turn, as a `CLAUDE.md` does. Waiting for the\n * agent to read one would let a turn that skipped it escape its rules.\n */\nasync function addDesignated(c: Collector, opts: SourceOptions): Promise<void> {\n const include = opts.include ?? [];\n if (include.length === 0) return;\n const match = picomatch(include, { dot: true });\n const found = await listInTree(c.root, (abs) => {\n const rel = relPosix(c.root, abs);\n return rel !== null && match(rel);\n });\n for (const abs of found) {\n if (c.has(abs)) continue;\n const content = await safeRead(abs);\n if (content === null) {\n c.warnings.push(`${c.display(abs)}: matched runtime.include but could not be read`);\n continue;\n }\n c.add(abs, content, \"designated\", \"always\");\n }\n}\n\n// ── Skills, slash commands and the agent ─────────────────────────\n\nasync function addWindowed(\n c: Collector,\n trace: Trace,\n turn: TurnBounds,\n touches: Touch[],\n opts: SourceOptions,\n): Promise<void> {\n // The existing resolver settles which file a skill, command or agent names.\n // Agents spawned in a main session govern their own runs, not this turn, so\n // only the agent this run is (under SubagentStop) is asked for.\n const { artifacts } = await resolveArtifacts(\n {\n ...trace,\n agentSpawns:\n opts.agentType === undefined ? [] : [{ subagentType: opts.agentType, index: 0 }],\n },\n { projectDir: c.cwd, projectRoot: c.root, ...(opts.env ? { env: opts.env } : {}) },\n );\n for (const artifact of artifacts) {\n if (artifact.type === \"agent\") {\n c.add(artifact.path, artifact.content, \"agent\", \"subagent run\");\n continue;\n }\n if (artifact.type !== \"skill\" && artifact.type !== \"slash-command\") continue;\n // In scope from the first invocation to the end of the session (proposal\n // 0080): a skill's procedure spans the turns after it, and the skills it\n // calls partway through do not end it. Batch `run` keeps ADR 01015's window.\n const window = windowOf(trace, artifact);\n if (!window.events.some((e) => e.index <= turn.to)) continue;\n if (artifact.type === \"slash-command\") {\n c.add(artifact.path, artifact.content, \"slash-command\", \"slash command window\");\n continue;\n }\n c.add(artifact.path, artifact.content, \"skill\", \"skill window\", artifact.name);\n const skillDir = dirname(artifact.path);\n for (const touch of touches) {\n if (!touch.read || relPosix(skillDir, touch.abs) === null || c.has(touch.abs)) continue;\n const content = await safeRead(touch.abs);\n if (content !== null) {\n c.add(touch.abs, content, \"skill\", `read under skill ${artifact.name}`, artifact.name);\n }\n }\n }\n}\n\n// ── The catalog of known formats ─────────────────────────────────\n\n/** Memory files read at cwd, each ancestor up to the root, and in their `.claude/`. */\nconst ANCESTOR_FILES: [string, RuleFormat][] = [\n [\"CLAUDE.md\", \"claude-md\"],\n [\"CLAUDE.local.md\", \"claude-md\"],\n [join(\".claude\", \"CLAUDE.md\"), \"claude-md\"],\n [\"AGENTS.md\", \"agents-md\"],\n [join(\".claude\", \"AGENTS.md\"), \"agents-md\"],\n [\"GEMINI.md\", \"gemini-md\"],\n];\n\n/** Memory files a touch under a subdirectory brings in. */\nconst NESTED_FILES: [string, RuleFormat][] = [\n [\"CLAUDE.md\", \"claude-md\"],\n [\"AGENTS.md\", \"agents-md\"],\n [\"GEMINI.md\", \"gemini-md\"],\n];\n\nasync function catalog(c: Collector, opts: SourceOptions): Promise<Candidate[]> {\n const out: Candidate[] = [];\n const userClaude = configDir(opts.env);\n const always: Trigger = { kind: \"always\" };\n\n out.push({ path: join(userClaude, \"CLAUDE.md\"), format: \"claude-md\", trigger: always });\n out.push({ path: join(c.home, \".gemini\", \"GEMINI.md\"), format: \"gemini-md\", trigger: always });\n for (const dir of ancestors(c.cwd, c.root).reverse()) {\n for (const [name, format] of ANCESTOR_FILES) {\n out.push({ path: join(dir, name), format, trigger: always });\n }\n }\n\n // Project-level directories live at the root; a cwd below it is checked too.\n const bases = c.cwd === c.root ? [c.root] : [c.root, c.cwd];\n\n for (const dir of [join(userClaude, \"rules\"), ...bases.map((b) => join(b, \".claude\", \"rules\"))]) {\n for (const path of await listInTree(dir, (p) => p.endsWith(\".md\"))) {\n out.push({ path, format: \"claude-rule\", trigger: await claudeRuleTrigger(c, path) });\n }\n }\n\n for (const base of bases) {\n const dir = join(base, \".cursor\", \"rules\");\n for (const path of await listInTree(dir, (p) => p.endsWith(\".mdc\") || p.endsWith(\".md\"))) {\n const trigger = await cursorTrigger(c, path);\n if (trigger !== null) out.push({ path, format: \"cursor-rule\", trigger });\n }\n }\n\n for (const dir of [join(c.home, \".kiro\", \"steering\"), ...bases.map((b) => join(b, \".kiro\", \"steering\"))]) {\n for (const path of await listInTree(dir, (p) => p.endsWith(\".md\"), { maxDepth: 0 })) {\n out.push({ path, format: \"kiro-steering\", trigger: await kiroTrigger(c, path) });\n }\n }\n\n for (const base of bases) {\n out.push({\n path: join(base, \".specify\", \"memory\", \"constitution.md\"),\n format: \"speckit-constitution\",\n trigger: always,\n });\n out.push({ path: join(base, \"openspec\", \"project.md\"), format: \"openspec-project\", trigger: { kind: \"read\" } });\n }\n return out;\n}\n\nasync function frontOf(c: Collector, path: string): Promise<Record<string, unknown> | null> {\n const content = await safeRead(path);\n if (content === null) return null;\n return c.front(path, content)?.data ?? null;\n}\n\nasync function claudeRuleTrigger(c: Collector, path: string): Promise<Trigger> {\n const patterns = globList((await frontOf(c, path))?.paths);\n return patterns.length > 0 ? { kind: \"globs\", key: \"paths\", patterns } : { kind: \"always\" };\n}\n\n/** Null for a `.md` file with no front matter, which Cursor does not read as a rule. */\nasync function cursorTrigger(c: Collector, path: string): Promise<Trigger | null> {\n const fm = await frontOf(c, path);\n if (fm === null && !path.endsWith(\".mdc\")) return null;\n if (fm?.alwaysApply === true) return { kind: \"always\" };\n const patterns = globList(fm?.globs);\n return patterns.length > 0 ? { kind: \"globs\", key: \"globs\", patterns } : { kind: \"read\" };\n}\n\nasync function kiroTrigger(c: Collector, path: string): Promise<Trigger> {\n const fm = await frontOf(c, path);\n const inclusion = fm?.inclusion;\n if (inclusion === undefined || inclusion === \"always\") return { kind: \"always\" };\n if (inclusion === \"fileMatch\") {\n const patterns = globList(fm?.fileMatchPattern);\n if (patterns.length > 0) return { kind: \"globs\", key: \"fileMatchPattern\", patterns };\n }\n return { kind: \"read\" };\n}\n\n// ── Imports ──────────────────────────────────────────────────────\n\n/** Adds a candidate and, for a memory file, what its `@path` lines import. */\nasync function addWithImports(\n c: Collector,\n candidate: Candidate,\n trigger: string,\n known?: string,\n): Promise<void> {\n if (c.has(candidate.path)) return;\n const content = known ?? (await safeRead(candidate.path));\n if (content === null) return;\n const added = c.add(candidate.path, content, candidate.format, trigger);\n if (added === null || (candidate.format !== \"claude-md\" && candidate.format !== \"gemini-md\")) {\n return;\n }\n let frontier = [added];\n for (let hop = 1; hop <= MAX_IMPORT_HOPS && frontier.length > 0; hop += 1) {\n const next: RuleSource[] = [];\n for (const importer of frontier) {\n for (const ref of importsOf(importer.content)) {\n const path = ref.startsWith(\"~/\")\n ? join(c.home, ref.slice(2))\n : resolve(dirname(importer.path), ref);\n if (c.has(path)) continue;\n const body = await safeRead(path);\n if (body === null) continue;\n const source = c.add(path, body, \"import\", `imported by ${importer.displayPath}`);\n if (source !== null) next.push(source);\n }\n }\n frontier = next;\n }\n}\n\n/** `@path` references outside code fences and code spans. */\nfunction importsOf(content: string): string[] {\n const refs: string[] = [];\n // The open fence's character and length: CommonMark closes a fence only\n // with the same character, at least as long, so a backtick line inside a\n // tilde fence is text.\n let fence: { char: string; length: number } | null = null;\n for (const line of content.split(/\\r?\\n/)) {\n const marker = /^\\s*(`{3,}|~{3,})/.exec(line)?.[1];\n if (marker !== undefined) {\n const char = marker.charAt(0);\n if (fence === null) {\n fence = { char, length: marker.length };\n continue;\n }\n if (char === fence.char && marker.length >= fence.length && line.trim() === marker) {\n fence = null;\n continue;\n }\n }\n if (fence !== null) continue;\n const prose = line.replace(/`[^`]*`/g, \"\");\n for (const m of prose.matchAll(/(?:^|\\s)@([^\\s`]+)/g)) {\n const ref = m[1]?.replace(/[.,;:!?)\\]]+$/, \"\");\n if (ref) refs.push(ref);\n }\n }\n return refs;\n}\n\n// ── Helpers ──────────────────────────────────────────────────────\n\nasync function collector(opts: SourceOptions): Promise<Collector> {\n const cwd = resolve(opts.projectDir);\n const root = resolve(opts.projectRoot ?? (await findGitRoot(cwd)) ?? cwd);\n return new Collector(cwd, root, homeDir(opts.env), opts.exclude ?? []);\n}\n\nfunction homeDir(env: Record<string, string | undefined> = process.env): string {\n const set = process.platform === \"win32\" ? (env.USERPROFILE ?? env.HOME) : env.HOME;\n return resolve(set ?? homedir());\n}\n\n/** cwd and each ancestor up to the root, nearest first. */\nfunction ancestors(cwd: string, root: string): string[] {\n const dirs: string[] = [];\n let current = cwd;\n for (let depth = 0; depth < 32; depth += 1) {\n dirs.push(current);\n if (current === root) break;\n const parent = dirname(current);\n if (parent === current) break;\n current = parent;\n }\n return dirs;\n}\n\n/** `dir` and its ancestors inside the root that are not cwd or above it. */\nfunction dirsBelowCwd(c: Collector, dir: string): string[] {\n const dirs: string[] = [];\n let current = dir;\n for (let depth = 0; depth < 64; depth += 1) {\n if (relPosix(c.root, current) === null || relPosix(current, c.cwd) !== null) break;\n dirs.push(current);\n const parent = dirname(current);\n if (parent === current) break;\n current = parent;\n }\n return dirs;\n}\n\n/** One glob, a comma-separated string, or a list. Commas inside braces stay. */\nfunction isCursorRule(path: string): boolean {\n return path.split(sep).join(\"/\").includes(\"/.cursor/rules/\");\n}\n\n/**\n * Cursor reads its front matter line by line, so `globs: **\\/*.ts` is a rule\n * there and invalid YAML (an alias) here. This reads the three keys Cursor\n * defines the way Cursor does, as `key: rest of line`.\n */\nfunction cursorFront(content: string): ExtractedMetadata | null {\n const block = /^---\\r?\\n([\\s\\S]*?)\\r?\\n---(?:\\r?\\n|$)/.exec(content)?.[1];\n if (block === undefined) return null;\n const data: Record<string, unknown> = {};\n for (const line of block.split(/\\r?\\n/)) {\n const m = /^(description|globs|alwaysApply):\\s*(.*)$/.exec(line);\n const name = m?.[1];\n const value = m?.[2]?.trim();\n if (name === undefined || value === undefined) continue;\n data[name] = name === \"alwaysApply\" ? value === \"true\" : value;\n }\n if (Object.keys(data).length === 0) return null;\n return { data, present: true, format: \"markdown\", lineFor: () => undefined };\n}\n\nfunction globList(value: unknown): string[] {\n if (Array.isArray(value)) {\n return value.filter((v): v is string => typeof v === \"string\" && v.trim() !== \"\").map((v) => v.trim());\n }\n if (typeof value !== \"string\") return [];\n const out: string[] = [];\n let depth = 0;\n let current = \"\";\n for (const ch of value) {\n if (ch === \"{\") depth += 1;\n if (ch === \"}\") depth = Math.max(0, depth - 1);\n if (ch === \",\" && depth === 0) {\n out.push(current);\n current = \"\";\n } else {\n current += ch;\n }\n }\n out.push(current);\n return out.map((p) => p.trim()).filter((p) => p !== \"\");\n}\n\n/** `path` relative to `base` with forward slashes, or null when outside it. */\nfunction relPosix(base: string, path: string): string | null {\n const rel = relative(base, path);\n if (rel === \"\") return \"\";\n if (rel.startsWith(\"..\") || isAbsolute(rel)) return null;\n return rel.split(sep).join(\"/\");\n}\n\nfunction key(path: string): string {\n const abs = resolve(path);\n return process.platform === \"win32\" ? abs.toLowerCase() : abs;\n}\n\n/** A path as sources compare it: absolute, and case-folded on Windows. */\nexport const pathKey = key;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwCA,IAAM,WACJ;AACF,IAAM,SACJ;AAMF,IAAM,qBAAqB,oBAAI,IAAI,CAAC,SAAS,KAAK,CAAC;AACnD,IAAM,OAAO,oBAAI,IAAwB,CAAC,aAAa,aAAa,aAAa,CAAC;AAE3E,SAAS,cAAc,OAA4B;AACxD,MAAI,MAAM,SAAS,UAAU,MAAM,SAAS,OAAW,QAAO;AAC9D,QAAM,EAAE,IAAI,IAAI;AAChB,MAAI,IAAI,WAAW,QAAQ,IAAI,qBAAqB,KAAM,QAAO;AACjE,QAAM,SAAS,IAAI;AACnB,MACE,OAAO,WAAW,YAClB,WAAW,QACX,UAAU,UACV,OAAO,OAAO,SAAS,UACvB;AACA,QAAI,CAAC,mBAAmB,IAAI,OAAO,IAAI,EAAG,QAAO;AAAA,EACnD,WACE,OAAO,IAAI,eAAe,YAC1B,CAAC,mBAAmB,IAAI,IAAI,UA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U,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/tracevals/rules/turn.ts","../src/tracevals/rules/sources.ts"],"sourcesContent":["/**\n * The turn a Stop or SubagentStop judges (proposal 0079). A turn starts at the\n * last prompt the user typed; tool results and hook feedback do not start one.\n * Under SubagentStop the turn is the subagent's whole run.\n *\n * Which user records are typed prompts is read from the record shape Claude\n * Code writes, not guessed from wording alone:\n *\n * - `isMeta: true` marks harness injections: a skill's \"Base directory\" body,\n * `<local-command-caveat>`, peer and scheduled messages, hook feedback.\n * - `isCompactSummary: true` is the \"session is being continued\" summary.\n * - `origin.kind` is `human` for a typed prompt and `task-notification` or\n * `peer` otherwise. Older records carry only `turnOrigin`, whose non-typed\n * values are `task_notification`, `scheduled` and `peer`.\n * - A record whose text is nothing but `<system-reminder>`,\n * `<task-notification>`, `<ci-monitor-event>` or `<local-command-*>` blocks\n * is an injection. A typed prompt Claude Code prefixed with a reminder keeps\n * the text after it, so it still counts.\n * - `Stop hook feedback:` and `[Request interrupted by user…]` are markers,\n * never prompts.\n *\n * A `<command-name>` record is a slash command someone typed, so it counts.\n */\nimport {\n emptyWindow,\n materialize,\n type TraceWindow,\n} from \"../graders/util.js\";\nimport type { Trace, TraceEvent } from \"../trace/types.js\";\n\nexport interface TurnSlice {\n window: TraceWindow;\n /** Ordinal in `trace.events` of the turn's first event. */\n from: number;\n /** Ordinal of its last event, inclusive. Less than `from` when there is no turn. */\n to: number;\n /** Typed prompts in the whole session, which `turn-count-above` reads. */\n sessionTurnCount: number;\n}\n\nconst INJECTED =\n /<(system-reminder|task-notification|ci-monitor-event|local-command-stdout|local-command-stderr|local-command-caveat)>[\\s\\S]*?<\\/\\1>/g;\nconst MARKER =\n /^(?:Stop hook feedback:|SubagentStop hook feedback:|\\[Request interrupted by user)/;\n/**\n * Origins of a prompt a person sent: typed in the CLI, or sent through the SDK.\n * Both record formats name it, as `origin.kind` or the older `turnOrigin`,\n * and both are read against this one set.\n */\nconst TYPED_TURN_ORIGINS = new Set([\"human\", \"sdk\"]);\nconst WORK = new Set<TraceEvent[\"kind\"]>([\"assistant\", \"tool_call\", \"tool_result\"]);\n\nexport function isTypedPrompt(event: TraceEvent): boolean {\n if (event.kind !== \"user\" || event.text === undefined) return false;\n const { raw } = event;\n if (raw.isMeta === true || raw.isCompactSummary === true) return false;\n const origin = raw.origin;\n if (\n typeof origin === \"object\" &&\n origin !== null &&\n \"kind\" in origin &&\n typeof origin.kind === \"string\"\n ) {\n if (!TYPED_TURN_ORIGINS.has(origin.kind)) return false;\n } else if (\n typeof raw.turnOrigin === \"string\" &&\n !TYPED_TURN_ORIGINS.has(raw.turnOrigin)\n ) {\n return false;\n }\n const rest = event.text.replace(INJECTED, \"\").trim();\n return rest !== \"\" && !MARKER.test(rest);\n}\n\n/** The last turn of a session: its last typed prompt to the end of the trace. */\nexport function lastTurn(trace: Trace): TurnSlice {\n const prompts = trace.events.filter((e) => e.sidechain !== true && isTypedPrompt(e));\n const sessionTurnCount = prompts.length;\n const to = trace.events.length - 1;\n const last = prompts.at(-1);\n if (last === undefined) {\n return {\n window: emptyWindow(\"turn\", \"last turn\", \"the trace holds no prompt the user typed\"),\n from: to + 1,\n to,\n sessionTurnCount,\n };\n }\n return slice(trace, last.index, [last], new Set([undefined]), sessionTurnCount, {\n label: \"last turn\",\n reason: \"nothing happened after the last prompt the user typed\",\n });\n}\n\n/**\n * A subagent's sidecar transcript parsed alone. Every record is a sidechain,\n * so the parser keeps no prompts; the turn is the whole run, and its prompts\n * are the task the subagent was given.\n */\nexport function subagentTurn(trace: Trace): TurnSlice {\n const prompts = trace.events.filter(isTypedPrompt);\n return slice(\n trace,\n 0,\n prompts,\n new Set(trace.events.map((e) => e.branchId)),\n prompts.length,\n { label: \"subagent run\", reason: \"the subagent recorded no work\" },\n );\n}\n\nfunction slice(\n trace: Trace,\n from: number,\n prompts: TraceEvent[],\n own: Set<string | undefined>,\n sessionTurnCount: number,\n words: { label: string; reason: string },\n): TurnSlice {\n const to = trace.events.length - 1;\n const worked = trace.events.some((e) => e.index > from && WORK.has(e.kind));\n if (!worked) {\n return {\n window: emptyWindow(\"turn\", words.label, words.reason),\n from,\n to,\n sessionTurnCount,\n };\n }\n const window = materialize(\n trace,\n \"turn\",\n words.label,\n [{ start: from, end: Number.POSITIVE_INFINITY }],\n undefined,\n own,\n );\n // Only typed prompts are prompts here, and `turnCount` is the session's,\n // because the one condition that reads it counts session turns.\n window.userMessages = prompts.map((p) => p.text ?? \"\");\n window.turnCount = sessionTurnCount;\n return { window, from, to, sessionTurnCount };\n}\n","/**\n * Which files govern the agent in a turn (proposal 0079, \"Rule sources and\n * their triggers\"). Resolution is deterministic, from the filesystem and the\n * trace; no model decides which files count.\n *\n * The list of formats is closed. Reading a file never makes it a source: a\n * README or a product docs page describes other systems, so only the known\n * formats, files named by `include`, and what a skill or an `@path` import\n * pulls in are ever returned. `exclude` removes a file from every row.\n *\n * To touch a file is to Read, Write or Edit it, anywhere in the session up to\n * the turn's end, which is Claude Code's own trigger for path-scoped rules.\n *\n * Six more formats say what the session was asked (proposal 0080): the typed\n * prompts, the approved plan, a touched Spec Kit feature, Kiro spec or live\n * OpenSpec change, and a touched file `runtime.plans` names. None is known\n * at session start, so only a turn resolves them, and none declares evals.\n *\n * Two are read from the transcript itself (proposal 0081): the system prompt\n * of the last prompt snapshot, and a user output style. Claude Code's own\n * prompt is reported and never blocks; a prompt the user wrote blocks.\n */\nimport { createHash } from \"node:crypto\";\nimport { homedir } from \"node:os\";\nimport { basename, dirname, isAbsolute, join, relative, resolve, sep } from \"node:path\";\nimport picomatch from \"picomatch\";\nimport { extractFrontmatter } from \"../../meta/extractors/frontmatter.js\";\nimport type { ExtractedMetadata } from \"../../meta/types.js\";\nimport { resolveArtifacts } from \"../artifacts/resolve.js\";\nimport { findGitRoot, listInTree, safeRead } from \"../artifacts/fs.js\";\nimport { extractEvals } from \"../evals/extract.js\";\nimport { windowOf } from \"../graders/util.js\";\nimport { makeRedactor } from \"../judge/redact.js\";\nimport { configDir } from \"../trace/discover.js\";\nimport type { Trace } from \"../trace/types.js\";\nimport { isTypedPrompt } from \"./turn.js\";\n\nexport type RuleFormat =\n | \"claude-md\"\n | \"claude-rule\"\n | \"agents-md\"\n | \"gemini-md\"\n | \"cursor-rule\"\n | \"kiro-steering\"\n | \"speckit-constitution\"\n | \"openspec-project\"\n | \"import\"\n | \"skill\"\n | \"slash-command\"\n | \"agent\"\n | \"designated\"\n | \"prompt\"\n | \"plan\"\n | \"speckit-spec\"\n | \"kiro-spec\"\n | \"openspec-change\"\n | \"plans\"\n | \"system-prompt\"\n | \"output-style\";\n\n/** An `ai` eval a source declares; its assertion is the rule (proposal 0079). */\nexport interface DeclaredRule {\n id: string;\n text: string;\n when?: Record<string, unknown>;\n}\n\nexport interface RuleSource {\n /** Absolute path on disk, or `\"\"` for the typed prompts, an inline plan and the system prompt. */\n path: string;\n /** Relative to the project root with forward slashes, or `~/…` under home. */\n displayPath: string;\n format: RuleFormat;\n /** Why the file is in scope, in words: `always`, `read`, `touched src/a.ts`. */\n trigger: string;\n content: string;\n /** sha256 of `content`, hex. */\n sha256: string;\n /** The skill a `skill` source belongs to. */\n skill?: string;\n /** Present when the file declares `ai` evals; they replace extraction. */\n declaredRules?: DeclaredRule[];\n /** False for Claude Code's default system prompt, whose rules are reported and never block. */\n blocks: boolean;\n}\n\nexport interface SourceOptions {\n /** The session's working directory, where the ancestor walk starts. */\n projectDir: string;\n /** Ceiling for the ancestor walk and base of `displayPath`; default the git root. */\n projectRoot?: string;\n /** `CLAUDE_CONFIG_DIR` finds `~/.claude`; `HOME` / `USERPROFILE` find `~/.gemini` and `~/.kiro`. */\n env?: Record<string, string | undefined>;\n /** `runtime.include`: globs, relative to the project root, in scope once read. */\n include?: string[];\n /** `runtime.exclude`: globs never treated as sources, in any row, and source names. */\n exclude?: string[];\n /** `judge.redact`: patterns scrubbed from what the transcript records of the system prompt. */\n redact?: string[];\n /** `runtime.plans`: globs, relative to the project root, in scope once touched. */\n plans?: string[];\n /** Set under SubagentStop: the subagent type whose definition governs the run. */\n agentType?: string;\n}\n\nexport interface ResolvedSources {\n sources: RuleSource[];\n warnings: string[];\n}\n\n/** The turn's ordinal bounds in `trace.events`, inclusive. `lastTurn` returns them. */\nexport interface TurnBounds {\n from: number;\n to: number;\n}\n\n/** Imports followed from a `claude-md` or `gemini-md` file, as Claude Code does. */\nconst MAX_IMPORT_HOPS = 4;\n\ntype Trigger =\n | { kind: \"always\" }\n | { kind: \"read\" }\n | { kind: \"globs\"; key: string; patterns: string[] };\n\ninterface Candidate {\n path: string;\n format: RuleFormat;\n trigger: Trigger;\n}\n\ninterface Touch {\n abs: string;\n rel: string | null;\n read: boolean;\n}\n\nclass Collector {\n readonly sources: RuleSource[] = [];\n readonly warnings: string[] = [];\n private readonly seen = new Set<string>();\n private readonly parsed = new Map<string, ExtractedMetadata | null>();\n private readonly excluded: (path: string) => boolean;\n /** Whether `exclude` lists, as it is, the name of a source with no file, such as `prompt`. */\n readonly excludedName: (name: string) => boolean;\n\n constructor(\n readonly cwd: string,\n readonly root: string,\n readonly home: string,\n exclude: string[],\n ) {\n const match = exclude.length > 0 ? picomatch(exclude, { dot: true }) : null;\n this.excluded = (path) => match !== null && match(this.display(path));\n // The whole name, never a glob: `**` names files, and keeps the prompt.\n this.excludedName = (name) => exclude.includes(name);\n }\n\n display(path: string): string {\n const inRoot = relPosix(this.root, path);\n if (inRoot !== null) return inRoot;\n const inHome = relPosix(this.home, path);\n if (inHome !== null) return `~/${inHome}`;\n return path.split(sep).join(\"/\");\n }\n\n has(path: string): boolean {\n return this.seen.has(key(path));\n }\n\n /** The file's front matter, or null when it has none or it does not parse. */\n front(path: string, content: string): ExtractedMetadata | null {\n const k = key(path);\n if (this.parsed.has(k)) return this.parsed.get(k) ?? null;\n let parsed: ExtractedMetadata | null = null;\n try {\n const fm = extractFrontmatter(content, \"markdown\");\n parsed = fm.present ? fm : null;\n } catch (err) {\n const loose = isCursorRule(path) ? cursorFront(content) : null;\n if (loose !== null) {\n this.parsed.set(k, loose);\n return loose;\n }\n const first = (err instanceof Error ? err.message : String(err)).split(\"\\n\")[0] ?? \"\";\n this.warnings.push(\n `${this.display(path)}: front matter does not parse (${first}), so it is read as having none`,\n );\n }\n this.parsed.set(k, parsed);\n return parsed;\n }\n\n /** Adds a source once. Returns it, or null when excluded or already listed. */\n add(\n path: string,\n content: string,\n format: RuleFormat,\n trigger: string,\n skill?: string,\n ): RuleSource | null {\n if (this.has(path) || this.excluded(path)) return null;\n this.seen.add(key(path));\n const source: RuleSource = {\n path,\n displayPath: this.display(path),\n format,\n trigger,\n content,\n sha256: createHash(\"sha256\").update(content).digest(\"hex\"),\n blocks: true,\n };\n if (skill !== undefined) source.skill = skill;\n const declared = this.declared(path, content);\n if (declared !== undefined) source.declaredRules = declared;\n this.sources.push(source);\n return source;\n }\n\n /**\n * Adds a source that says what the session was asked, or one the transcript\n * recorded. These never declare evals. With no file, its display path is its\n * format, and `exclude` matches that name.\n */\n addRequest(\n file: string | null,\n content: string,\n format: RuleFormat,\n trigger: string,\n blocks = true,\n ): void {\n // A named source goes by its name whether or not a file holds it, so\n // `exclude: [plan]` drops a plan file as it drops an inline plan.\n if (EXCLUDABLE_BY_NAME.has(format) && this.excludedName(format)) return;\n if (file !== null) {\n if (this.has(file) || this.excluded(file)) return;\n this.seen.add(key(file));\n }\n this.sources.push({\n path: file ?? \"\",\n displayPath: file === null ? format : this.display(file),\n format,\n trigger,\n content,\n sha256: createHash(\"sha256\").update(content).digest(\"hex\"),\n blocks,\n });\n }\n\n private declared(path: string, content: string): DeclaredRule[] | undefined {\n const fm = this.front(path, content);\n if (fm === null) return undefined;\n const extracted = extractEvals(\n { name: basename(path), type: \"project-rules\", path, content, origin: \"project\" },\n fm,\n );\n if (extracted.errors.length > 0) {\n this.warnings.push(\n `${this.display(path)}: metadata.evals does not validate (${extracted.errors[0]?.message ?? \"invalid\"}), so it declares no rules`,\n );\n return undefined;\n }\n const rules: DeclaredRule[] = [];\n for (const entry of extracted.evals) {\n if (entry.grader !== \"ai\" || entry.assertion === undefined) continue;\n const rule: DeclaredRule = { id: entry.id, text: entry.assertion };\n const when = entry.options?.when;\n if (isRecord(when)) rule.when = when;\n rules.push(rule);\n }\n return rules.length > 0 ? rules : undefined;\n }\n}\n\n/** Every source whose trigger is \"always\", without a trace (for `prepare`). */\nexport async function resolveAlwaysSources(opts: SourceOptions): Promise<ResolvedSources> {\n const c = await collector(opts);\n for (const candidate of await catalog(c, opts)) {\n if (candidate.trigger.kind === \"always\") await addWithImports(c, candidate, \"always\");\n }\n await addDesignated(c, opts);\n return { sources: c.sources, warnings: c.warnings };\n}\n\n/** Every source in scope for one turn of `trace`. */\nexport async function resolveTurnSources(\n trace: Trace,\n turn: TurnBounds,\n opts: SourceOptions,\n): Promise<ResolvedSources> {\n const c = await collector(opts);\n const touches: Touch[] = trace.fileAccesses\n .filter((a) => a.index <= turn.to)\n .map((a) => {\n const abs = resolve(c.cwd, a.path);\n return { abs, rel: relPosix(c.root, abs), read: a.op === \"read\" };\n });\n const wasRead = new Set(touches.filter((t) => t.read).map((t) => key(t.abs)));\n\n for (const candidate of await catalog(c, opts)) {\n const { trigger } = candidate;\n if (trigger.kind === \"always\") {\n await addWithImports(c, candidate, \"always\");\n } else if (trigger.kind === \"read\") {\n if (wasRead.has(key(candidate.path))) await addWithImports(c, candidate, \"read\");\n } else {\n const match = picomatch(trigger.patterns, { dot: true });\n const hit = touches.find((t) => t.rel !== null && match(t.rel));\n if (hit !== undefined && hit.rel !== null) {\n await addWithImports(c, candidate, `${trigger.key} matched ${hit.rel}`);\n }\n }\n }\n\n // A subdirectory's memory file applies once a file under it is touched.\n // Farther directories come first, so the nearest file reads last.\n const nested = new Map<string, string>();\n for (const touch of touches) {\n if (touch.rel === null) continue;\n for (const dir of dirsBelowCwd(c, dirname(touch.abs))) {\n if (!nested.has(dir)) nested.set(dir, touch.rel);\n }\n }\n const dirs = [...nested.keys()].sort((a, b) => a.length - b.length);\n for (const dir of dirs) {\n const touched = nested.get(dir) ?? \"\";\n for (const [name, format] of NESTED_FILES) {\n const path = join(dir, name);\n const content = await safeRead(path);\n if (content !== null) {\n await addWithImports(c, { path, format, trigger: { kind: \"always\" } }, `touched ${touched}`, content);\n }\n }\n }\n\n await addWindowed(c, trace, turn, touches, opts);\n\n await addDesignated(c, opts);\n\n addPrompts(c, trace, turn);\n await addPlan(c, trace, turn, opts);\n await addSpecs(c, touches, opts.plans ?? []);\n await addSystemPrompt(c, trace, turn, opts);\n return { sources: c.sources, warnings: c.warnings };\n}\n\n// ── What the transcript recorded of the prompt ───────────────────\n\n/** The sources `runtime.exclude` matches by name (proposals 0080 and 0081). */\nconst EXCLUDABLE_BY_NAME: ReadonlySet<RuleFormat> = new Set<RuleFormat>([\"prompt\", \"plan\", \"system-prompt\"]);\n\n/** Claude Code's own block in its default prompt; a replaced prompt has none. */\nconst BOUNDARY_MARKER = \"__SYSTEM_PROMPT_DYNAMIC_BOUNDARY__\";\n\ninterface Recorded {\n index: number;\n record: Record<string, unknown>;\n attachment: Record<string, unknown>;\n}\n\n/** The last attachment of `type` at or before the turn's end, with its record. */\nfunction lastAttachment(trace: Trace, turn: TurnBounds, type: string): Recorded | undefined {\n for (let i = trace.events.length - 1; i >= 0; i -= 1) {\n const event = trace.events[i];\n if (event === undefined || event.kind !== \"meta\" || event.index > turn.to) continue;\n const attachment = event.raw.attachment;\n if (event.raw.type === \"attachment\" && isRecord(attachment) && attachment.type === type) {\n return { index: event.index, record: event.raw, attachment };\n }\n }\n return undefined;\n}\n\n/**\n * The system prompt of the last `prompt_snapshot`, and the last output style.\n * A style a user file defines is its own source, holding the text the agent\n * saw; a built-in style's text joins the system prompt. The prompt is custom,\n * and blocks, when Claude Code's boundary marker is missing.\n */\nasync function addSystemPrompt(c: Collector, trace: Trace, turn: TurnBounds, opts: SourceOptions): Promise<void> {\n const scrub = makeRedactor(opts.redact ?? []);\n const style = lastAttachment(trace, turn, \"output_style_instructions\")?.attachment.style;\n const styleName = isRecord(style) && typeof style.name === \"string\" ? style.name : undefined;\n const stylePrompt = isRecord(style) && typeof style.prompt === \"string\" ? style.prompt : undefined;\n let builtIn: string | undefined;\n if (styleName !== undefined && stylePrompt !== undefined) {\n const file = await userStyleFile(c, opts, styleName);\n if (file === undefined) builtIn = stylePrompt;\n else c.addRequest(file, scrub(stylePrompt), \"output-style\", `style ${styleName}`);\n }\n\n const snapshot = lastAttachment(trace, turn, \"prompt_snapshot\");\n const recorded: unknown = snapshot?.attachment.systemPrompt;\n if (snapshot === undefined || !Array.isArray(recorded)) return;\n const blocks = recorded.filter((b): b is string => typeof b === \"string\");\n const custom = !blocks.includes(BOUNDARY_MARKER);\n const content = scrub([...blocks, ...(builtIn !== undefined ? [builtIn] : [])].join(\"\\n\\n\"));\n const { version } = snapshot.record;\n const by = typeof version === \"string\" ? `, Claude Code ${version}` : \"\";\n const trigger = `recorded at turn ${String(snapshot.index)}${by}${custom ? \", custom\" : \"\"}`;\n // A prompt the user replaced blocks; Claude Code's own default only reports.\n c.addRequest(null, content, \"system-prompt\", trigger, /* blocks= */ custom);\n}\n\n/**\n * The user file that defines output style `name`: under the project's\n * `.claude/output-styles/`, then the user's. Its front matter `name`, or\n * its base name, matches.\n */\nasync function userStyleFile(c: Collector, opts: SourceOptions, name: string): Promise<string | undefined> {\n // Where Claude Code reads styles: the project (cwd first, then the git root)\n // and the user. No ancestor walk, since Claude Code does none for styles.\n const dirs = [...new Set([c.cwd, c.root])].map((b) => join(b, \".claude\", \"output-styles\"));\n dirs.push(join(configDir(opts.env), \"output-styles\"));\n for (const dir of dirs) {\n for (const path of await listInTree(dir, (p) => p.endsWith(\".md\"), { maxDepth: 0 })) {\n const declared = (await frontOf(c, path))?.name;\n if ((typeof declared === \"string\" ? declared : basename(path, \".md\")) === name) return path;\n }\n }\n return undefined;\n}\n\n// ── What the session was asked ───────────────────────────────────\n\n/**\n * Every prompt typed up to the turn's end, as one numbered sequence. A\n * subagent's own run has only sidechain prompts, and its task is its request.\n */\nfunction addPrompts(c: Collector, trace: Trace, turn: TurnBounds): void {\n const typed = trace.events.filter((e) => e.index <= turn.to && isTypedPrompt(e));\n const main = typed.filter((e) => e.sidechain !== true);\n const prompts = main.length > 0 ? main : typed;\n if (prompts.length === 0) return;\n const content = prompts\n .map((p, i) => `${String(i + 1)}. ${(p.text ?? \"\").trim()}`)\n .join(\"\\n\\n\");\n c.addRequest(null, content, \"prompt\", `typed prompts 1-${String(prompts.length)}`);\n}\n\n/**\n * The plan of the last approved `ExitPlanMode` at or before the turn's end.\n * A call is approved when its result is not an error. The plan is the call's\n * `plan` input, or else the file the session last wrote under the user's\n * `plans/` directory before the call.\n */\nasync function addPlan(c: Collector, trace: Trace, turn: TurnBounds, opts: SourceOptions): Promise<void> {\n const approved = trace.toolCalls\n .filter((call) => call.name === \"ExitPlanMode\" && call.index <= turn.to)\n .filter((call) => isApproved(trace, call.index, turn.to))\n .at(-1);\n if (approved === undefined) return;\n const trigger = `approved at turn ${String(approved.index)}`;\n const plan = approved.input.plan;\n if (typeof plan === \"string\" && plan.trim() !== \"\") {\n c.addRequest(null, plan, \"plan\", trigger);\n return;\n }\n const plansDir = join(configDir(opts.env), \"plans\");\n const file = trace.fileAccesses\n .filter((a) => a.op !== \"read\" && a.index < approved.index)\n .map((a) => resolve(c.cwd, a.path))\n .filter((abs) => relPosix(plansDir, abs) !== null)\n .at(-1);\n if (file === undefined) return;\n const content = await safeRead(file);\n if (content !== null) c.addRequest(file, content, \"plan\", trigger);\n}\n\n/**\n * Whether the tool call at `index` has a result by `to` that is not an error.\n * A plan approved only after the turn ends is not yet a source; the next turn,\n * whose bounds include the result, picks it up.\n */\nfunction isApproved(trace: Trace, index: number, to: number): boolean {\n const id = trace.events.find((e) => e.index === index)?.raw.id;\n if (typeof id !== \"string\") return false;\n for (const event of trace.events) {\n if (event.kind !== \"tool_result\" || event.index <= index || event.index > to) continue;\n const message = event.raw.message;\n const blocks: unknown = isRecord(message) ? message.content : undefined;\n if (!Array.isArray(blocks)) continue;\n for (const block of blocks as unknown[]) {\n if (isRecord(block) && block.type === \"tool_result\" && block.tool_use_id === id) {\n return block.is_error !== true;\n }\n }\n }\n return false;\n}\n\n/** The files each spec format reads from a touched directory. */\nconst SPEC_FILES: Record<\"speckit-spec\" | \"kiro-spec\", string[]> = {\n \"speckit-spec\": [\"spec.md\", \"plan.md\", \"tasks.md\"],\n \"kiro-spec\": [\"requirements.md\", \"design.md\", \"tasks.md\"],\n};\n\n/** The spec directory a project-relative path lies under, and its format. */\nfunction specDirOf(rel: string): { dir: string; format: \"speckit-spec\" | \"kiro-spec\" | \"openspec-change\" } | null {\n const parts = rel.split(\"/\");\n const [first, second, third] = parts;\n if (first === \"specs\" && second !== undefined && parts.length > 2) {\n return { dir: `specs/${second}`, format: \"speckit-spec\" };\n }\n if (first === \".kiro\" && second === \"specs\" && third !== undefined && parts.length > 3) {\n return { dir: `.kiro/specs/${third}`, format: \"kiro-spec\" };\n }\n // An archived change is done, so it never counts.\n if (first === \"openspec\" && second === \"changes\" && third !== undefined && third !== \"archive\" && parts.length > 3) {\n return { dir: `openspec/changes/${third}`, format: \"openspec-change\" };\n }\n return null;\n}\n\n/** A touched spec brings in its directory's files; a touched `plans` file brings in itself. */\nasync function addSpecs(c: Collector, touches: Touch[], plans: string[]): Promise<void> {\n const isPlan = plans.length > 0 ? picomatch(plans, { dot: true }) : null;\n const done = new Set<string>();\n for (const touch of touches) {\n const { rel } = touch;\n if (rel === null) continue;\n const trigger = `touched ${rel}`;\n const spec = specDirOf(rel);\n if (spec !== null && !done.has(spec.dir)) {\n done.add(spec.dir);\n const dir = join(c.root, ...spec.dir.split(\"/\"));\n const files =\n spec.format === \"openspec-change\"\n ? await listInTree(dir, (p) => p.endsWith(\".md\"))\n : SPEC_FILES[spec.format].map((name) => join(dir, name));\n for (const file of files) {\n const content = await safeRead(file);\n if (content !== null) c.addRequest(file, content, spec.format, trigger);\n }\n }\n if (isPlan?.(rel) === true) {\n const content = await safeRead(touch.abs);\n if (content !== null) c.addRequest(touch.abs, content, \"plans\", trigger);\n }\n }\n}\n\n/**\n * Files named in `runtime.include`. A person chose each one to govern the\n * agent, so it applies to every turn, as a `CLAUDE.md` does. Waiting for the\n * agent to read one would let a turn that skipped it escape its rules.\n */\nasync function addDesignated(c: Collector, opts: SourceOptions): Promise<void> {\n const include = opts.include ?? [];\n if (include.length === 0) return;\n const match = picomatch(include, { dot: true });\n const found = await listInTree(c.root, (abs) => {\n const rel = relPosix(c.root, abs);\n return rel !== null && match(rel);\n });\n for (const abs of found) {\n if (c.has(abs)) continue;\n const content = await safeRead(abs);\n if (content === null) {\n c.warnings.push(`${c.display(abs)}: matched runtime.include but could not be read`);\n continue;\n }\n c.add(abs, content, \"designated\", \"always\");\n }\n}\n\n// ── Skills, slash commands and the agent ─────────────────────────\n\nasync function addWindowed(\n c: Collector,\n trace: Trace,\n turn: TurnBounds,\n touches: Touch[],\n opts: SourceOptions,\n): Promise<void> {\n // The existing resolver settles which file a skill, command or agent names.\n // Agents spawned in a main session govern their own runs, not this turn, so\n // only the agent this run is (under SubagentStop) is asked for.\n const { artifacts } = await resolveArtifacts(\n {\n ...trace,\n agentSpawns:\n opts.agentType === undefined ? [] : [{ subagentType: opts.agentType, index: 0 }],\n },\n { projectDir: c.cwd, projectRoot: c.root, ...(opts.env ? { env: opts.env } : {}) },\n );\n for (const artifact of artifacts) {\n if (artifact.type === \"agent\") {\n c.add(artifact.path, artifact.content, \"agent\", \"subagent run\");\n continue;\n }\n if (artifact.type !== \"skill\" && artifact.type !== \"slash-command\") continue;\n // In scope from the first invocation to the end of the session (proposal\n // 0080): a skill's procedure spans the turns after it, and the skills it\n // calls partway through do not end it. Batch `run` keeps ADR 01015's window.\n const window = windowOf(trace, artifact);\n if (!window.events.some((e) => e.index <= turn.to)) continue;\n if (artifact.type === \"slash-command\") {\n c.add(artifact.path, artifact.content, \"slash-command\", \"slash command window\");\n continue;\n }\n c.add(artifact.path, artifact.content, \"skill\", \"skill window\", artifact.name);\n const skillDir = dirname(artifact.path);\n for (const touch of touches) {\n if (!touch.read || relPosix(skillDir, touch.abs) === null || c.has(touch.abs)) continue;\n const content = await safeRead(touch.abs);\n if (content !== null) {\n c.add(touch.abs, content, \"skill\", `read under skill ${artifact.name}`, artifact.name);\n }\n }\n }\n}\n\n// ── The catalog of known formats ─────────────────────────────────\n\n/** Memory files read at cwd, each ancestor up to the root, and in their `.claude/`. */\nconst ANCESTOR_FILES: [string, RuleFormat][] = [\n [\"CLAUDE.md\", \"claude-md\"],\n [\"CLAUDE.local.md\", \"claude-md\"],\n [join(\".claude\", \"CLAUDE.md\"), \"claude-md\"],\n [\"AGENTS.md\", \"agents-md\"],\n [join(\".claude\", \"AGENTS.md\"), \"agents-md\"],\n [\"GEMINI.md\", \"gemini-md\"],\n];\n\n/** Memory files a touch under a subdirectory brings in. */\nconst NESTED_FILES: [string, RuleFormat][] = [\n [\"CLAUDE.md\", \"claude-md\"],\n [\"AGENTS.md\", \"agents-md\"],\n [\"GEMINI.md\", \"gemini-md\"],\n];\n\nasync function catalog(c: Collector, opts: SourceOptions): Promise<Candidate[]> {\n const out: Candidate[] = [];\n const userClaude = configDir(opts.env);\n const always: Trigger = { kind: \"always\" };\n\n out.push({ path: join(userClaude, \"CLAUDE.md\"), format: \"claude-md\", trigger: always });\n out.push({ path: join(c.home, \".gemini\", \"GEMINI.md\"), format: \"gemini-md\", trigger: always });\n for (const dir of ancestors(c.cwd, c.root).reverse()) {\n for (const [name, format] of ANCESTOR_FILES) {\n out.push({ path: join(dir, name), format, trigger: always });\n }\n }\n\n // Project-level directories live at the root; a cwd below it is checked too.\n const bases = c.cwd === c.root ? [c.root] : [c.root, c.cwd];\n\n for (const dir of [join(userClaude, \"rules\"), ...bases.map((b) => join(b, \".claude\", \"rules\"))]) {\n for (const path of await listInTree(dir, (p) => p.endsWith(\".md\"))) {\n out.push({ path, format: \"claude-rule\", trigger: await claudeRuleTrigger(c, path) });\n }\n }\n\n for (const base of bases) {\n const dir = join(base, \".cursor\", \"rules\");\n for (const path of await listInTree(dir, (p) => p.endsWith(\".mdc\") || p.endsWith(\".md\"))) {\n const trigger = await cursorTrigger(c, path);\n if (trigger !== null) out.push({ path, format: \"cursor-rule\", trigger });\n }\n }\n\n for (const dir of [join(c.home, \".kiro\", \"steering\"), ...bases.map((b) => join(b, \".kiro\", \"steering\"))]) {\n for (const path of await listInTree(dir, (p) => p.endsWith(\".md\"), { maxDepth: 0 })) {\n out.push({ path, format: \"kiro-steering\", trigger: await kiroTrigger(c, path) });\n }\n }\n\n for (const base of bases) {\n out.push({\n path: join(base, \".specify\", \"memory\", \"constitution.md\"),\n format: \"speckit-constitution\",\n trigger: always,\n });\n out.push({ path: join(base, \"openspec\", \"project.md\"), format: \"openspec-project\", trigger: { kind: \"read\" } });\n }\n return out;\n}\n\nasync function frontOf(c: Collector, path: string): Promise<Record<string, unknown> | null> {\n const content = await safeRead(path);\n if (content === null) return null;\n return c.front(path, content)?.data ?? null;\n}\n\nasync function claudeRuleTrigger(c: Collector, path: string): Promise<Trigger> {\n const patterns = globList((await frontOf(c, path))?.paths);\n return patterns.length > 0 ? { kind: \"globs\", key: \"paths\", patterns } : { kind: \"always\" };\n}\n\n/** Null for a `.md` file with no front matter, which Cursor does not read as a rule. */\nasync function cursorTrigger(c: Collector, path: string): Promise<Trigger | null> {\n const fm = await frontOf(c, path);\n if (fm === null && !path.endsWith(\".mdc\")) return null;\n if (fm?.alwaysApply === true) return { kind: \"always\" };\n const patterns = globList(fm?.globs);\n return patterns.length > 0 ? { kind: \"globs\", key: \"globs\", patterns } : { kind: \"read\" };\n}\n\nasync function kiroTrigger(c: Collector, path: string): Promise<Trigger> {\n const fm = await frontOf(c, path);\n const inclusion = fm?.inclusion;\n if (inclusion === undefined || inclusion === \"always\") return { kind: \"always\" };\n if (inclusion === \"fileMatch\") {\n const patterns = globList(fm?.fileMatchPattern);\n if (patterns.length > 0) return { kind: \"globs\", key: \"fileMatchPattern\", patterns };\n }\n return { kind: \"read\" };\n}\n\n// ── Imports ──────────────────────────────────────────────────────\n\n/** Adds a candidate and, for a memory file, what its `@path` lines import. */\nasync function addWithImports(\n c: Collector,\n candidate: Candidate,\n trigger: string,\n known?: string,\n): Promise<void> {\n if (c.has(candidate.path)) return;\n const content = known ?? (await safeRead(candidate.path));\n if (content === null) return;\n const added = c.add(candidate.path, content, candidate.format, trigger);\n if (added === null || (candidate.format !== \"claude-md\" && candidate.format !== \"gemini-md\")) {\n return;\n }\n let frontier = [added];\n for (let hop = 1; hop <= MAX_IMPORT_HOPS && frontier.length > 0; hop += 1) {\n const next: RuleSource[] = [];\n for (const importer of frontier) {\n for (const ref of importsOf(importer.content)) {\n const path = ref.startsWith(\"~/\")\n ? join(c.home, ref.slice(2))\n : resolve(dirname(importer.path), ref);\n if (c.has(path)) continue;\n const body = await safeRead(path);\n if (body === null) continue;\n const source = c.add(path, body, \"import\", `imported by ${importer.displayPath}`);\n if (source !== null) next.push(source);\n }\n }\n frontier = next;\n }\n}\n\n/** `@path` references outside code fences and code spans. */\nfunction importsOf(content: string): string[] {\n const refs: string[] = [];\n // The open fence's character and length: CommonMark closes a fence only\n // with the same character, at least as long, so a backtick line inside a\n // tilde fence is text.\n let fence: { char: string; length: number } | null = null;\n for (const line of content.split(/\\r?\\n/)) {\n const marker = /^\\s*(`{3,}|~{3,})/.exec(line)?.[1];\n if (marker !== undefined) {\n const char = marker.charAt(0);\n if (fence === null) {\n fence = { char, length: marker.length };\n continue;\n }\n if (char === fence.char && marker.length >= fence.length && line.trim() === marker) {\n fence = null;\n continue;\n }\n }\n if (fence !== null) continue;\n const prose = line.replace(/`[^`]*`/g, \"\");\n for (const m of prose.matchAll(/(?:^|\\s)@([^\\s`]+)/g)) {\n const ref = m[1]?.replace(/[.,;:!?)\\]]+$/, \"\");\n if (ref) refs.push(ref);\n }\n }\n return refs;\n}\n\n// ── Helpers ──────────────────────────────────────────────────────\n\nasync function collector(opts: SourceOptions): Promise<Collector> {\n const cwd = resolve(opts.projectDir);\n const root = resolve(opts.projectRoot ?? (await findGitRoot(cwd)) ?? cwd);\n return new Collector(cwd, root, homeDir(opts.env), opts.exclude ?? []);\n}\n\nfunction homeDir(env: Record<string, string | undefined> = process.env): string {\n const set = process.platform === \"win32\" ? (env.USERPROFILE ?? env.HOME) : env.HOME;\n return resolve(set ?? homedir());\n}\n\n/** cwd and each ancestor up to the root, nearest first. */\nfunction ancestors(cwd: string, root: string): string[] {\n const dirs: string[] = [];\n let current = cwd;\n for (let depth = 0; depth < 32; depth += 1) {\n dirs.push(current);\n if (current === root) break;\n const parent = dirname(current);\n if (parent === current) break;\n current = parent;\n }\n return dirs;\n}\n\n/** `dir` and its ancestors inside the root that are not cwd or above it. */\nfunction dirsBelowCwd(c: Collector, dir: string): string[] {\n const dirs: string[] = [];\n let current = dir;\n for (let depth = 0; depth < 64; depth += 1) {\n if (relPosix(c.root, current) === null || relPosix(current, c.cwd) !== null) break;\n dirs.push(current);\n const parent = dirname(current);\n if (parent === current) break;\n current = parent;\n }\n return dirs;\n}\n\n/** One glob, a comma-separated string, or a list. Commas inside braces stay. */\nfunction isCursorRule(path: string): boolean {\n return path.split(sep).join(\"/\").includes(\"/.cursor/rules/\");\n}\n\n/**\n * Cursor reads its front matter line by line, so `globs: **\\/*.ts` is a rule\n * there and invalid YAML (an alias) here. This reads the three keys Cursor\n * defines the way Cursor does, as `key: rest of line`.\n */\nfunction cursorFront(content: string): ExtractedMetadata | null {\n const block = /^---\\r?\\n([\\s\\S]*?)\\r?\\n---(?:\\r?\\n|$)/.exec(content)?.[1];\n if (block === undefined) return null;\n const data: Record<string, unknown> = {};\n for (const line of block.split(/\\r?\\n/)) {\n const m = /^(description|globs|alwaysApply):\\s*(.*)$/.exec(line);\n const name = m?.[1];\n const value = m?.[2]?.trim();\n if (name === undefined || value === undefined) continue;\n data[name] = name === \"alwaysApply\" ? value === \"true\" : value;\n }\n if (Object.keys(data).length === 0) return null;\n return { data, present: true, format: \"markdown\", lineFor: () => undefined };\n}\n\nfunction globList(value: unknown): string[] {\n if (Array.isArray(value)) {\n return value.filter((v): v is string => typeof v === \"string\" && v.trim() !== \"\").map((v) => v.trim());\n }\n if (typeof value !== \"string\") return [];\n const out: string[] = [];\n let depth = 0;\n let current = \"\";\n for (const ch of value) {\n if (ch === \"{\") depth += 1;\n if (ch === \"}\") depth = Math.max(0, depth - 1);\n if (ch === \",\" && depth === 0) {\n out.push(current);\n current = \"\";\n } else {\n current += ch;\n }\n }\n out.push(current);\n return out.map((p) => p.trim()).filter((p) => p !== \"\");\n}\n\n/** `path` relative to `base` with forward slashes, or null when outside it. */\nfunction relPosix(base: string, path: string): string | null {\n const rel = relative(base, path);\n if (rel === \"\") return \"\";\n if (rel.startsWith(\"..\") || isAbsolute(rel)) return null;\n return rel.split(sep).join(\"/\");\n}\n\nfunction key(path: string): string {\n const abs = resolve(path);\n return process.platform === \"win32\" ? abs.toLowerCase() : abs;\n}\n\n/** A path as sources compare it: absolute, and case-folded on Windows. */\nexport const pathKey = key;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,IAAM,WACJ;AACF,IAAM,SACJ;AAMF,IAAM,qBAAqB,oBAAI,IAAI,CAAC,SAAS,KAAK,CAAC;AACnD,IAAM,OAAO,oBAAI,IAAwB,CAAC,aAAa,aAAa,aAAa,CAAC;AAE3E,SAAS,cAAc,OAA4B;AACxD,MAAI,MAAM,SAAS,UAAU,MAAM,SAAS,OAAW,QAAO;AAC9D,QAAM,EAAE,IAAI,IAAI;AAChB,MAAI,IAAI,WAAW,QAAQ,IAAI,qBAAqB,KAAM,QAAO;AACjE,QAAM,SAAS,IAAI;AACnB,MACE,OAAO,WAAW,YAClB,WAAW,QACX,UAAU,UACV,OAAO,OAAO,SAAS,UACvB;AACA,QAAI,CAA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