@hawkeyexl/manni 4.18.1 → 4.20.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-XVUPHNWT.js → batch-TBQBH6XQ.js} +13 -13
- package/dist/{build-GU7M5EC6.js → build-S3JQMDFX.js} +14 -14
- package/dist/{calibrate-YODCJAEA.js → calibrate-KLN22IGS.js} +14 -14
- package/dist/{capture-TZ42LHNK.js → capture-JS3ICXE7.js} +13 -13
- package/dist/{check-KBDIV35E.js → check-2EAR4ZW3.js} +31 -31
- package/dist/check-6D2JCIMD.js +47 -0
- package/dist/{check-I72HPJNA.js → check-PDXYA6XH.js} +13 -12
- package/dist/check-RNAB7X74.js +33 -0
- package/dist/{check-AOGJBQR4.js → check-WS2USSUD.js} +13 -13
- package/dist/{chunk-HUCZKEDF.js → chunk-2G4XYGTN.js} +4 -4
- package/dist/{chunk-O7OJWMP5.js → chunk-2XRSQXGZ.js} +2 -2
- package/dist/{chunk-W5STNXKP.js → chunk-3OXBZSDN.js} +2 -2
- package/dist/chunk-4KM23E53.js +50 -0
- package/dist/chunk-4KM23E53.js.map +1 -0
- package/dist/chunk-5HB4YKZW.js +64 -0
- package/dist/chunk-5HB4YKZW.js.map +1 -0
- package/dist/{chunk-N4KY3WLM.js → chunk-5MJE5KMY.js} +7 -7
- package/dist/{chunk-C4MNHJXP.js → chunk-5UJQLZXY.js} +2 -2
- package/dist/{chunk-34PGSNS5.js → chunk-6D7FCU4E.js} +3 -3
- package/dist/{chunk-ES7PJMHM.js → chunk-6VGWLCYT.js} +2 -2
- package/dist/chunk-BEQZI3V5.js +137 -0
- package/dist/chunk-BEQZI3V5.js.map +1 -0
- package/dist/{chunk-7MU47MZM.js → chunk-BV7FJ4V2.js} +7 -7
- package/dist/{chunk-2G42VA4H.js → chunk-DQO44Y5G.js} +5 -5
- package/dist/{chunk-7JDWLMOT.js → chunk-DTSWP5FC.js} +5 -5
- package/dist/{chunk-MHLCZBW2.js → chunk-EBYLQE7P.js} +2 -2
- package/dist/{chunk-LFKYNDG4.js → chunk-FERFWKZM.js} +2 -2
- package/dist/{chunk-PZAHBJ56.js → chunk-FRM62BEN.js} +3 -3
- package/dist/{chunk-RBNZI6YG.js → chunk-GCF7STEA.js} +7 -32
- package/dist/chunk-GCF7STEA.js.map +1 -0
- package/dist/{chunk-YMDASDGR.js → chunk-GL2HXZVX.js} +3 -3
- package/dist/chunk-GVOI7SCF.js +50 -0
- package/dist/chunk-GVOI7SCF.js.map +1 -0
- package/dist/{chunk-O3PRYQCW.js → chunk-GXDVERLV.js} +5 -5
- package/dist/{chunk-UXEICZKX.js → chunk-HIZNNOVW.js} +17 -5
- package/dist/chunk-HIZNNOVW.js.map +1 -0
- package/dist/{chunk-4VR2UFEO.js → chunk-HSC5G3FW.js} +8 -8
- package/dist/{chunk-72OTCIYQ.js → chunk-HZWLHSZG.js} +2 -2
- package/dist/{chunk-SJLEHQKY.js → chunk-I62V2ZAJ.js} +8 -8
- package/dist/{chunk-EEJFXYFO.js → chunk-IGAZWY2W.js} +2 -2
- package/dist/{chunk-GSLXJSGT.js → chunk-ITA7V5Y2.js} +4 -4
- package/dist/{chunk-AL46P5H6.js → chunk-IYRGV2BC.js} +6 -6
- package/dist/{chunk-HH327OEQ.js → chunk-JKH2LV5D.js} +5 -5
- package/dist/{chunk-2EAUZVO2.js → chunk-JOZVVIVD.js} +3 -3
- package/dist/{chunk-GRRSOAAS.js → chunk-KZ7534CD.js} +3 -3
- package/dist/{chunk-UVUMFFZ6.js → chunk-MLY65CQE.js} +24 -12
- package/dist/chunk-MLY65CQE.js.map +1 -0
- package/dist/{chunk-T363DMEJ.js → chunk-MNK732BZ.js} +37 -14
- package/dist/chunk-MNK732BZ.js.map +1 -0
- package/dist/{chunk-N74QH6XJ.js → chunk-NDQA4VYK.js} +3 -3
- package/dist/chunk-NEO2HN2N.js +326 -0
- package/dist/chunk-NEO2HN2N.js.map +1 -0
- package/dist/{chunk-MQG4ONTU.js → chunk-O26NQ7KT.js} +2 -2
- package/dist/chunk-O4O6JOGD.js +59 -0
- package/dist/chunk-O4O6JOGD.js.map +1 -0
- package/dist/{chunk-QRQVOEAH.js → chunk-PGDUVYTF.js} +2 -2
- package/dist/{chunk-CYMA4O2F.js → chunk-PHOWMWFJ.js} +6 -2
- package/dist/{chunk-CYMA4O2F.js.map → chunk-PHOWMWFJ.js.map} +1 -1
- package/dist/{chunk-WIHQJSO3.js → chunk-PTXHJLAS.js} +4 -4
- package/dist/{chunk-J33NBVBX.js → chunk-Q5EKERQS.js} +2 -2
- package/dist/{chunk-GWCITMHN.js → chunk-QA7AXRGH.js} +2 -2
- package/dist/{chunk-J7MZRF3J.js → chunk-QSY5YPM4.js} +5 -5
- package/dist/{chunk-S5JFWUNK.js → chunk-QWCP7UMG.js} +4 -4
- package/dist/chunk-RGZBROMW.js +25 -0
- package/dist/chunk-RGZBROMW.js.map +1 -0
- package/dist/{chunk-WMOQXWHB.js → chunk-RXCDT55X.js} +14 -14
- package/dist/{chunk-JBB22HPK.js → chunk-SFSALDIR.js} +6 -6
- package/dist/{chunk-ZI5JHYPT.js → chunk-SFTWEGUD.js} +2 -2
- package/dist/{chunk-SGV5U4NE.js → chunk-SGI3WPYK.js} +4 -4
- package/dist/chunk-SIREOHLW.js +233 -0
- package/dist/chunk-SIREOHLW.js.map +1 -0
- package/dist/{chunk-PRF44AAC.js → chunk-SOW6SVAM.js} +4 -4
- package/dist/{chunk-3H7M5MXE.js → chunk-SRTBHEUM.js} +3 -3
- package/dist/{chunk-YBWU4JGX.js → chunk-SX626JUF.js} +3 -3
- package/dist/{chunk-UT6SVXUQ.js → chunk-U2CE55YV.js} +5 -5
- package/dist/{chunk-4VQVJOIK.js → chunk-UKSXQHSE.js} +44 -23
- package/dist/chunk-UKSXQHSE.js.map +1 -0
- package/dist/chunk-VCU7OMXV.js +126 -0
- package/dist/chunk-VCU7OMXV.js.map +1 -0
- package/dist/chunk-XTKJNRJ6.js +33 -0
- package/dist/chunk-XTKJNRJ6.js.map +1 -0
- package/dist/{chunk-UE6IYEKA.js → chunk-Z6FATXBE.js} +2 -2
- package/dist/{chunk-PJILKN4Z.js → chunk-ZBE735BH.js} +5 -5
- package/dist/{chunk-FGGDLZUU.js → chunk-ZEKQRBXO.js} +2 -2
- package/dist/{chunk-Z2LHEYK5.js → chunk-ZODSGFAP.js} +5 -7
- package/dist/{chunk-Z2LHEYK5.js.map → chunk-ZODSGFAP.js.map} +1 -1
- package/dist/{chunk-WRWPOXVG.js → chunk-ZRMA5U53.js} +3 -3
- package/dist/{chunk-4CMNCP5O.js → chunk-ZVEDBFTM.js} +8 -8
- package/dist/{cli-OD7SXNLX.js → cli-4HH6IY2L.js} +14 -14
- package/dist/{cli-4P4FWT6C.js → cli-4IE6CRAT.js} +355 -123
- package/dist/cli-4IE6CRAT.js.map +1 -0
- package/dist/{cli-NCJZTOWR.js → cli-5BFVL3DH.js} +2 -2
- package/dist/{cli-HGZ7XTDU.js → cli-AR43H5BW.js} +9 -9
- package/dist/{cli-WQNWAMDL.js → cli-EQG4KETY.js} +89 -38
- package/dist/cli-EQG4KETY.js.map +1 -0
- package/dist/{cli-2JZEYVTI.js → cli-GVHXRQAD.js} +18 -18
- package/dist/{cli-NUP7KAW3.js → cli-HTAR3PWY.js} +21 -21
- package/dist/{cli-4YURODFH.js → cli-L7H4C442.js} +14 -14
- package/dist/{cli-DK55ACQR.js → cli-T4NY2EGM.js} +17 -17
- package/dist/{cli-TDCMZ7HV.js → cli-UIY57JPM.js} +14 -14
- package/dist/{cli-MRH5QXW5.js → cli-ZPW5VIRA.js} +9 -9
- package/dist/cli.js +20 -14
- package/dist/cli.js.map +1 -1
- package/dist/docmeta.js +8 -8
- package/dist/{github-FX4WWY7N.js → github-CMWG4QMI.js} +14 -14
- package/dist/github-NIRLMJ65.js +27 -0
- package/dist/{github-TOQ4AJIU.js → github-RIU47U73.js} +12 -12
- package/dist/index.d.ts +25 -1
- package/dist/index.js +99 -99
- package/dist/json-EJTB7XYG.js +34 -0
- package/dist/{json-SIPVIBNW.js → json-KSBVGZUX.js} +12 -12
- package/dist/{labels-UXKTDM5A.js → labels-VNKACCAG.js} +11 -11
- package/dist/{lint-UUVMFRPB.js → lint-75BD6L5T.js} +12 -12
- package/dist/list-6XVIW3RW.js +33 -0
- package/dist/{list-FLNHGIML.js → list-MH54XU7E.js} +12 -12
- package/dist/{list-6Q7VGKIG.js → list-PHNZAYIM.js} +12 -12
- package/dist/{page-FPLKY53Q.js → page-5AJS7AEM.js} +11 -11
- package/dist/{prepare-VUHZQTJ4.js → prepare-R63RJI6O.js} +16 -16
- package/dist/{pretty-JDZSGZCR.js → pretty-DE4WXJFA.js} +13 -13
- package/dist/{pretty-WKPQD3UU.js → pretty-E3DS32NZ.js} +12 -12
- package/dist/pretty-SUKMF6AB.js +35 -0
- package/dist/{release-Z3ASYZ3S.js → release-VHHASAG7.js} +4 -4
- package/dist/{reporters-E53V7UXY.js → reporters-DLMLFLKS.js} +4 -4
- package/dist/{reporters-RAWZONQ3.js → reporters-V2PSDBVW.js} +11 -11
- package/dist/reporters-V2PSDBVW.js.map +1 -0
- package/dist/{run-2BDAM2LA.js → run-QT2LVHRU.js} +12 -12
- package/dist/run-QT2LVHRU.js.map +1 -0
- package/dist/{sarif-7F6EJA3K.js → sarif-2ZKPRT42.js} +15 -15
- package/dist/sarif-2ZKPRT42.js.map +1 -0
- package/dist/{sarif-Q3FX4ODM.js → sarif-GKMUHCZB.js} +10 -10
- package/dist/sarif-GKMUHCZB.js.map +1 -0
- package/dist/sarif-HUIRTPSL.js +30 -0
- package/dist/sarif-HUIRTPSL.js.map +1 -0
- package/dist/strategy-TBFM7NZU.js +222 -0
- package/dist/strategy-TBFM7NZU.js.map +1 -0
- package/dist/{term-5CCU7VDU.js → term-ZZWAVUW5.js} +30 -28
- package/dist/term-ZZWAVUW5.js.map +1 -0
- package/dist/{validate-A2R6KXAH.js → validate-ZEUFF3BG.js} +5 -5
- package/dist/validate-ZEUFF3BG.js.map +1 -0
- package/package.json +4 -6
- package/plugin/manni/.claude-plugin/plugin.json +2 -2
- package/plugin/manni/.mcp.json +12 -0
- package/plugin/manni/hooks/graph-server.mjs +95 -0
- package/plugin/manni/hooks/hooks.json +26 -0
- package/plugin/manni/hooks/manni.mjs +51 -25
- package/plugin/manni/hooks/page-metadata.mjs +144 -0
- package/plugin/manni/skills/fix/SKILL.md +18 -1
- package/plugin/manni/skills/setup/SKILL.md +1 -1
- package/dist/check-OIL3CZ4N.js +0 -47
- package/dist/chunk-4VQVJOIK.js.map +0 -1
- package/dist/chunk-RBNZI6YG.js.map +0 -1
- package/dist/chunk-T363DMEJ.js.map +0 -1
- package/dist/chunk-UVUMFFZ6.js.map +0 -1
- package/dist/chunk-UXEICZKX.js.map +0 -1
- package/dist/cli-4P4FWT6C.js.map +0 -1
- package/dist/cli-WQNWAMDL.js.map +0 -1
- package/dist/term-5CCU7VDU.js.map +0 -1
- /package/dist/{batch-XVUPHNWT.js.map → batch-TBQBH6XQ.js.map} +0 -0
- /package/dist/{build-GU7M5EC6.js.map → build-S3JQMDFX.js.map} +0 -0
- /package/dist/{calibrate-YODCJAEA.js.map → calibrate-KLN22IGS.js.map} +0 -0
- /package/dist/{capture-TZ42LHNK.js.map → capture-JS3ICXE7.js.map} +0 -0
- /package/dist/{check-KBDIV35E.js.map → check-2EAR4ZW3.js.map} +0 -0
- /package/dist/{check-AOGJBQR4.js.map → check-6D2JCIMD.js.map} +0 -0
- /package/dist/{check-I72HPJNA.js.map → check-PDXYA6XH.js.map} +0 -0
- /package/dist/{check-OIL3CZ4N.js.map → check-RNAB7X74.js.map} +0 -0
- /package/dist/{cli-HGZ7XTDU.js.map → check-WS2USSUD.js.map} +0 -0
- /package/dist/{chunk-HUCZKEDF.js.map → chunk-2G4XYGTN.js.map} +0 -0
- /package/dist/{chunk-O7OJWMP5.js.map → chunk-2XRSQXGZ.js.map} +0 -0
- /package/dist/{chunk-W5STNXKP.js.map → chunk-3OXBZSDN.js.map} +0 -0
- /package/dist/{chunk-N4KY3WLM.js.map → chunk-5MJE5KMY.js.map} +0 -0
- /package/dist/{chunk-C4MNHJXP.js.map → chunk-5UJQLZXY.js.map} +0 -0
- /package/dist/{chunk-34PGSNS5.js.map → chunk-6D7FCU4E.js.map} +0 -0
- /package/dist/{chunk-ES7PJMHM.js.map → chunk-6VGWLCYT.js.map} +0 -0
- /package/dist/{chunk-7MU47MZM.js.map → chunk-BV7FJ4V2.js.map} +0 -0
- /package/dist/{chunk-2G42VA4H.js.map → chunk-DQO44Y5G.js.map} +0 -0
- /package/dist/{chunk-7JDWLMOT.js.map → chunk-DTSWP5FC.js.map} +0 -0
- /package/dist/{chunk-MHLCZBW2.js.map → chunk-EBYLQE7P.js.map} +0 -0
- /package/dist/{chunk-LFKYNDG4.js.map → chunk-FERFWKZM.js.map} +0 -0
- /package/dist/{chunk-PZAHBJ56.js.map → chunk-FRM62BEN.js.map} +0 -0
- /package/dist/{chunk-YMDASDGR.js.map → chunk-GL2HXZVX.js.map} +0 -0
- /package/dist/{chunk-O3PRYQCW.js.map → chunk-GXDVERLV.js.map} +0 -0
- /package/dist/{chunk-4VR2UFEO.js.map → chunk-HSC5G3FW.js.map} +0 -0
- /package/dist/{chunk-72OTCIYQ.js.map → chunk-HZWLHSZG.js.map} +0 -0
- /package/dist/{chunk-SJLEHQKY.js.map → chunk-I62V2ZAJ.js.map} +0 -0
- /package/dist/{chunk-EEJFXYFO.js.map → chunk-IGAZWY2W.js.map} +0 -0
- /package/dist/{chunk-GSLXJSGT.js.map → chunk-ITA7V5Y2.js.map} +0 -0
- /package/dist/{chunk-AL46P5H6.js.map → chunk-IYRGV2BC.js.map} +0 -0
- /package/dist/{chunk-HH327OEQ.js.map → chunk-JKH2LV5D.js.map} +0 -0
- /package/dist/{chunk-2EAUZVO2.js.map → chunk-JOZVVIVD.js.map} +0 -0
- /package/dist/{chunk-GRRSOAAS.js.map → chunk-KZ7534CD.js.map} +0 -0
- /package/dist/{chunk-N74QH6XJ.js.map → chunk-NDQA4VYK.js.map} +0 -0
- /package/dist/{chunk-MQG4ONTU.js.map → chunk-O26NQ7KT.js.map} +0 -0
- /package/dist/{chunk-QRQVOEAH.js.map → chunk-PGDUVYTF.js.map} +0 -0
- /package/dist/{chunk-WIHQJSO3.js.map → chunk-PTXHJLAS.js.map} +0 -0
- /package/dist/{chunk-J33NBVBX.js.map → chunk-Q5EKERQS.js.map} +0 -0
- /package/dist/{chunk-GWCITMHN.js.map → chunk-QA7AXRGH.js.map} +0 -0
- /package/dist/{chunk-J7MZRF3J.js.map → chunk-QSY5YPM4.js.map} +0 -0
- /package/dist/{chunk-S5JFWUNK.js.map → chunk-QWCP7UMG.js.map} +0 -0
- /package/dist/{chunk-WMOQXWHB.js.map → chunk-RXCDT55X.js.map} +0 -0
- /package/dist/{chunk-JBB22HPK.js.map → chunk-SFSALDIR.js.map} +0 -0
- /package/dist/{chunk-ZI5JHYPT.js.map → chunk-SFTWEGUD.js.map} +0 -0
- /package/dist/{chunk-SGV5U4NE.js.map → chunk-SGI3WPYK.js.map} +0 -0
- /package/dist/{chunk-PRF44AAC.js.map → chunk-SOW6SVAM.js.map} +0 -0
- /package/dist/{chunk-3H7M5MXE.js.map → chunk-SRTBHEUM.js.map} +0 -0
- /package/dist/{chunk-YBWU4JGX.js.map → chunk-SX626JUF.js.map} +0 -0
- /package/dist/{chunk-UT6SVXUQ.js.map → chunk-U2CE55YV.js.map} +0 -0
- /package/dist/{chunk-UE6IYEKA.js.map → chunk-Z6FATXBE.js.map} +0 -0
- /package/dist/{chunk-PJILKN4Z.js.map → chunk-ZBE735BH.js.map} +0 -0
- /package/dist/{chunk-FGGDLZUU.js.map → chunk-ZEKQRBXO.js.map} +0 -0
- /package/dist/{chunk-WRWPOXVG.js.map → chunk-ZRMA5U53.js.map} +0 -0
- /package/dist/{chunk-4CMNCP5O.js.map → chunk-ZVEDBFTM.js.map} +0 -0
- /package/dist/{cli-OD7SXNLX.js.map → cli-4HH6IY2L.js.map} +0 -0
- /package/dist/{cli-NCJZTOWR.js.map → cli-5BFVL3DH.js.map} +0 -0
- /package/dist/{github-FX4WWY7N.js.map → cli-AR43H5BW.js.map} +0 -0
- /package/dist/{cli-2JZEYVTI.js.map → cli-GVHXRQAD.js.map} +0 -0
- /package/dist/{cli-NUP7KAW3.js.map → cli-HTAR3PWY.js.map} +0 -0
- /package/dist/{cli-4YURODFH.js.map → cli-L7H4C442.js.map} +0 -0
- /package/dist/{cli-DK55ACQR.js.map → cli-T4NY2EGM.js.map} +0 -0
- /package/dist/{cli-TDCMZ7HV.js.map → cli-UIY57JPM.js.map} +0 -0
- /package/dist/{cli-MRH5QXW5.js.map → cli-ZPW5VIRA.js.map} +0 -0
- /package/dist/{github-TOQ4AJIU.js.map → github-CMWG4QMI.js.map} +0 -0
- /package/dist/{json-SIPVIBNW.js.map → github-NIRLMJ65.js.map} +0 -0
- /package/dist/{lint-UUVMFRPB.js.map → github-RIU47U73.js.map} +0 -0
- /package/dist/{list-6Q7VGKIG.js.map → json-EJTB7XYG.js.map} +0 -0
- /package/dist/{list-FLNHGIML.js.map → json-KSBVGZUX.js.map} +0 -0
- /package/dist/{labels-UXKTDM5A.js.map → labels-VNKACCAG.js.map} +0 -0
- /package/dist/{page-FPLKY53Q.js.map → lint-75BD6L5T.js.map} +0 -0
- /package/dist/{pretty-JDZSGZCR.js.map → list-6XVIW3RW.js.map} +0 -0
- /package/dist/{pretty-WKPQD3UU.js.map → list-MH54XU7E.js.map} +0 -0
- /package/dist/{reporters-E53V7UXY.js.map → list-PHNZAYIM.js.map} +0 -0
- /package/dist/{reporters-RAWZONQ3.js.map → page-5AJS7AEM.js.map} +0 -0
- /package/dist/{prepare-VUHZQTJ4.js.map → prepare-R63RJI6O.js.map} +0 -0
- /package/dist/{run-2BDAM2LA.js.map → pretty-DE4WXJFA.js.map} +0 -0
- /package/dist/{sarif-7F6EJA3K.js.map → pretty-E3DS32NZ.js.map} +0 -0
- /package/dist/{sarif-Q3FX4ODM.js.map → pretty-SUKMF6AB.js.map} +0 -0
- /package/dist/{release-Z3ASYZ3S.js.map → release-VHHASAG7.js.map} +0 -0
- /package/dist/{validate-A2R6KXAH.js.map → reporters-DLMLFLKS.js.map} +0 -0
package/dist/cli-4P4FWT6C.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/cli.ts","../src/graph/reporters/index.ts","../src/graph/commands/shapes.ts","../src/graph/commands/init.ts","../src/graph/commands/serve.ts","../src/graph/commands/publish.ts"],"sourcesContent":["/**\n * The graph program. Named `graph` because that is where it is mounted\n * (`manni graph …`); `src/cli.ts` adds it to the umbrella and runs it.\n *\n * Grammar per proposals 0034 and 0051 §2: the domain owns verbs and has no\n * default subcommand, `-f` means the output format everywhere and is checked\n * against the verb's list, and a list reaches a flag by exactly one\n * separator. The plumbing is the family's: `fail()` from `src/shared/run.ts`,\n * `warn()` from `src/shared/warn.ts`, and `--no-color` from\n * `src/shared/color.ts`.\n */\nimport { Command } from \"commander\";\nimport pkg from \"../../package.json\" with { type: \"json\" };\nimport {\n collect,\n configOption,\n readStdin,\n splitList,\n} from \"../shared/cli-options.js\";\nimport { shouldColor } from \"../shared/color.js\";\nimport { fail } from \"../shared/run.js\";\nimport { noticeOnce, warn } from \"../shared/warn.js\";\nimport { GraphError } from \"./types.js\";\nimport { LOCAL_FLAG_HELP } from \"../shared/providers.js\";\nimport { ALL_FILL_FIELDS, type FillField } from \"./core/config.js\";\nimport {\n assertInputFormat,\n DEFAULT_EXTENSIONS,\n STDIN,\n} from \"./core/discover.js\";\nimport {\n CHECK_FORMATS,\n CHECK_FORMAT_LIST,\n GRAPH_FORMATS,\n GRAPH_FORMAT_LIST,\n SHAPES_SHOW_FORMATS,\n SHAPES_SHOW_FORMAT_LIST,\n type CheckFormat,\n type GraphFormat,\n} from \"./reporters/index.js\";\nimport { runBuild } from \"./commands/build.js\";\nimport { renderCheck, runCheck } from \"./commands/check.js\";\nimport {\n renderShapes,\n renderShapesShow,\n runShapes,\n runShapesShow,\n type ShapesOptions,\n} from \"./commands/shapes.js\";\nimport {\n EXPORT_TARGETS,\n runExport,\n type ExportFormat,\n} from \"./commands/export.js\";\nimport { renderQuery, runQuery } from \"./commands/query.js\";\nimport { renderFill, runFill } from \"./commands/fill.js\";\nimport { runInit } from \"./commands/init.js\";\nimport { renderEmbed, runEmbed } from \"./commands/embed.js\";\nimport {\n renderSearch,\n runSearch,\n SEARCH_MODES,\n type SearchMode,\n} from \"./commands/search.js\";\nimport { renderStats, runStats } from \"./commands/stats.js\";\nimport { renderTraverse, runTraverse } from \"./commands/traverse.js\";\nimport {\n renderBundle,\n renderLookup,\n runLookup,\n runRetrieve,\n runTraverseContext,\n} from \"./commands/retrieve.js\";\nimport { runServe } from \"./commands/serve.js\";\nimport { renderPublish, runPublish } from \"./commands/publish.js\";\nimport type { WithholdReason } from \"./runtime/chunks.js\";\nimport type { RetrieveMode, WhereCondition } from \"./runtime/retrieve.js\";\n\n/**\n * Whether `command`'s output gets colour: this domain's `--no-color` and\n * `NO_COLOR` turn it off, and otherwise only a TTY turns it on\n * (`shouldColor`). `isTTY` is passed uncoerced: Node leaves it undefined off\n * a terminal, never false, and `shouldColor` reads a missing one as \"not a\n * terminal\".\n *\n * Exported because this is where the decision is testable — a spawned bin is\n * never a TTY. `check`'s pretty output dims the lines under each finding, and\n * takes the boolean from here rather than consulting the environment itself.\n */\nexport function colorFor(\n command: Command,\n isTTY: boolean | undefined,\n env?: NodeJS.ProcessEnv,\n): boolean {\n // commander maps --no-color to opts.color === false, on the command that\n // declares it.\n const noColor = colorOwner(command).opts().color === false;\n return shouldColor({ noColor, isTTY, env });\n}\n\n/**\n * The nearest command, this one or an ancestor, that declares `--no-color`:\n * the `graph` program, wherever it is mounted. Not the root: under the umbrella\n * that is `manni`, which has no `--no-color` of its own.\n */\nfunction colorOwner(command: Command): Command {\n for (let c: Command | null = command; c !== null; c = c.parent) {\n if (c.options.some((o) => o.long === \"--no-color\")) return c;\n }\n return command;\n}\n\nexport function buildProgram(): Command {\nconst program = new Command();\n\nprogram\n .name(\"graph\")\n .description(\n \"Deterministic knowledge graphs derived from documentation frontmatter and formatting.\",\n )\n .version(pkg.version)\n .option(\"--no-color\", \"disable colored output\")\n // A pointer, not the whole help screen: the message that precedes it\n // already names the offending flag.\n .showHelpAfterError(\"(add --help for usage)\")\n // MUST come before the `.command()` calls below. `copyInheritedSettings`\n // copies `_exitCallback` by value at subcommand-creation time, so an\n // `exitOverride()` installed afterwards leaves every subcommand still\n // calling `process.exit(1)` — which reports a usage error as a finding.\n .exitOverride();\n\n/**\n * Parse a numeric CLI option, refusing what the config schema refuses.\n *\n * `Number.parseFloat`/`parseInt` return NaN for `abc` and silently accept\n * out-of-range values, and NaN then disables whatever gate it feeds — a cost\n * cap that never fires, a confidence gate that writes everything, a `--top`\n * that asks for a negative number of rows. The documented precedence is\n * config → Ajv → CLI override, so the override has to be held to the same range.\n */\nfunction numericOption(\n flag: string,\n { min, max, integer }: { min: number; max?: number; integer?: boolean },\n) {\n return (raw: string): number => {\n const value = Number.parseFloat(raw);\n if (!Number.isFinite(value)) {\n throw new GraphError(`${flag} expects a number, got \"${raw}\".`);\n }\n if (integer && !Number.isInteger(value)) {\n throw new GraphError(`${flag} expects a whole number, got ${value}.`);\n }\n if (value < min || (max !== undefined && value > max)) {\n const range = max === undefined ? `>= ${min}` : `${min}..${max}`;\n throw new GraphError(`${flag} must be ${range}, got ${value}.`);\n }\n return value;\n };\n}\n\n/** A count: a whole number, at least `min` (1 unless the flag allows zero). */\nfunction countOption(flag: string, min = 1) {\n return numericOption(flag, { min, integer: true });\n}\n\n/**\n * Hold a CLI override to the same list its config key is held to.\n *\n * `fill.provider` is Ajv-validated against the schema enum; the `--provider`\n * override was an arbitrary string cast straight to `ProviderName`, so the\n * documented config → Ajv → CLI precedence had a hole at the last step.\n */\nfunction enumOption<T extends string>(flag: string, allowed: readonly T[]) {\n return (raw: string): T => {\n if (!(allowed as readonly string[]).includes(raw)) {\n throw new GraphError(\n `${flag} must be one of ${allowed.join(\" | \")}, got \"${raw}\".`,\n );\n }\n return raw as T;\n };\n}\n\n/**\n * A flag whose value is one of a named set, refused in the family's words:\n * `Unknown --format \"xml\". Use pretty | json.` The check runs while the\n * options are parsed, so a typo costs a message rather than a graph load.\n */\nfunction choiceOption<T extends string>(flag: string, allowed: readonly T[]) {\n return (raw: string): T => {\n if (!(allowed as readonly string[]).includes(raw)) {\n throw new GraphError(`Unknown ${flag} \"${raw}\". Use ${allowed.join(\" | \")}.`);\n }\n return raw as T;\n };\n}\n\n/** `-f, --format`: every verb's list is `pretty | json` (0051 §2). */\nconst formatOption = choiceOption(\"--format\", GRAPH_FORMATS);\n\n/** `check`'s own, which adds the two CI formats, `github` and `sarif`. */\nconst checkFormatOption = choiceOption(\"--format\", CHECK_FORMATS);\n\n/** `shapes show`'s own, which adds the frontmatter skeleton. */\nconst showFormatOption = choiceOption(\"--format\", SHAPES_SHOW_FORMATS);\n\n/**\n * `--fields <list>`: comma-separated and given once, never repeatable — one\n * separator per list (proposal 0034), and the spelling `meta fill --fields`\n * already uses. Each value is held to the same list `fill.fields` is.\n */\nconst fieldsOption = (raw: string): FillField[] =>\n splitList(raw).map((value) => enumOption(\"--fields\", ALL_FILL_FIELDS)(value));\n\n/**\n * `--withhold <list>`: comma-separated and given once, each value one of the\n * reasons `graph.retrieve.withhold` takes. It only ever tightens the floor.\n */\nconst withholdOption = (raw: string): WithholdReason[] =>\n splitList(raw).map((value) => {\n if (value !== \"drifted\" && value !== \"failing\") {\n throw new GraphError(`--withhold takes drifted or failing, and got ${value}.`);\n }\n return value;\n });\n\n/**\n * `--where <field=value>`: one condition per occurrence, never split on\n * commas, since a value may hold one. Conditions combine with AND.\n */\nconst whereOption = (raw: string, prev: WhereCondition[]): WhereCondition[] => {\n const eq = raw.indexOf(\"=\");\n const field = eq < 0 ? \"\" : raw.slice(0, eq);\n const value = eq < 0 ? \"\" : raw.slice(eq + 1);\n if (field === \"\" || value === \"\") {\n throw new GraphError(`--where takes field=value, and got ${raw}.`);\n }\n return [...prev, { field, value }];\n};\n\n/** The plumbing a served verb takes, and nothing else: where the artifact is. */\nfunction artifactInputs(command: Command): Command {\n return command\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\")\n .option(\"-g, --graph <path>\", \"Graph .ttl path (default: config out)\")\n .option(\n \"-i, --index <dir>\",\n \"Directory holding chunks.json, its rows and the search index (default: beside the graph)\",\n )\n .option(\n \"-f, --format <format>\",\n `Output: ${GRAPH_FORMAT_LIST}`,\n formatOption,\n \"pretty\",\n );\n}\n\n/**\n * The document-set surface the verbs that read documents share (proposals\n * 0041 and 0051 §1): positional `[paths...]` with `-` for stdin,\n * `--collection` and `--exclude` (each one value per occurrence), `--as`,\n * `--ext` (comma-separated, given once), `--allow-empty`, and\n * `-c`/`--no-config`. Declared once so the verbs cannot drift apart on a name\n * or a description, and worded as `meta` and `lint` word them.\n */\nfunction documentInputs(command: Command, verb: string): Command {\n return command\n .argument(\n \"[paths...]\",\n `files, directories, or globs to ${verb} (use - for stdin)`,\n )\n .option(\n \"--collection <name>\",\n \"Configured collection to read (repeatable)\",\n collect,\n [],\n )\n .option(\"--exclude <glob>\", \"Glob to exclude (repeatable)\", collect, [])\n .option(\n \"--as <format>\",\n \"Parse every input as asciidoc, html, markdown, mdx, rst or xml, whatever its extension. Required with -.\",\n )\n .option(\n \"--ext <list>\",\n \"comma-separated extensions for directory walks\",\n DEFAULT_EXTENSIONS.join(\",\"),\n )\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\");\n}\n\n/** The input flags as commander hands them over. */\ninterface InputFlags {\n as?: string;\n ext: string;\n allowEmpty?: boolean;\n}\n\n/**\n * The input flags for a core, and stdin when `paths` holds `-`. `--as` is\n * checked first, so `-` without it is refused before anything waits on stdin.\n */\nasync function inputOptions(\n paths: string[],\n opts: InputFlags,\n): Promise<{\n as?: string;\n ext: string[];\n allowEmpty?: boolean;\n stdinContent?: string;\n}> {\n assertInputFormat(paths, opts.as);\n return {\n ...(opts.as === undefined ? {} : { as: opts.as }),\n ext: splitList(opts.ext),\n ...(opts.allowEmpty === true ? { allowEmpty: true } : {}),\n ...(paths.includes(STDIN) ? { stdinContent: await readStdin() } : {}),\n };\n}\n\n/**\n * `-c`/`--no-config` for a verb that reads a built graph rather than a\n * document set. They share one commander attribute, which `configOption`\n * splits.\n */\nfunction configInputs(command: Command): Command {\n return command\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\");\n}\n\n/**\n * `opts` minus the one attribute `-c` and `--no-config` share. `documentOptions`\n * restates it as the two fields a core reads, and spreading the raw value over\n * them would put commander's `false` back where a path belongs.\n */\nfunction rest<T extends { config?: string | boolean }>(\n opts: T,\n): Omit<T, \"config\"> {\n const { config, ...others } = opts;\n return others;\n}\n\n/** The shared options as the command cores take them. */\nfunction documentOptions(opts: {\n collection?: string[];\n exclude?: string[];\n config?: string | boolean;\n}): {\n config?: string;\n noConfig?: boolean;\n collection?: string[];\n exclude?: string[];\n} {\n const { configPath, noConfig } = configOption(opts.config);\n return {\n ...(configPath === undefined ? {} : { config: configPath }),\n ...(noConfig === true ? { noConfig } : {}),\n ...(opts.collection === undefined ? {} : { collection: opts.collection }),\n ...(opts.exclude === undefined ? {} : { exclude: opts.exclude }),\n };\n}\n\nprogram\n .command(\"init\")\n .description(\"Add a starter `graph:` section to manni.config.yaml in the current directory\")\n .action(async () => {\n try {\n console.log(`Created ${await runInit()}`);\n } catch (e) {\n fail(e);\n }\n });\n\ndocumentInputs(\n program\n .command(\"build\")\n .description(\"Derive the knowledge graph and write deterministic Turtle\"),\n \"build\",\n)\n .option(\"-o, --out <path>\", \"Output .ttl path (default: config out)\")\n .action(async (paths: string[], opts: InputFlags & {\n config?: string | boolean;\n collection?: string[];\n exclude?: string[];\n out?: string;\n }) => {\n try {\n const result = await runBuild({\n paths,\n ...documentOptions(opts),\n ...(await inputOptions(paths, opts)),\n out: opts.out,\n });\n // Warnings go to stderr so stdout stays the machine-readable summary;\n // a degraded build is still a successful one, so the exit code is 0.\n for (const warning of result.warnings) warn(warning);\n const { total, fromTermbase } = result.concepts;\n const termbase = fromTermbase > 0 ? ` (${fromTermbase} from the termbase)` : \"\";\n console.log(\n `Wrote ${result.outPath} (${result.docs} docs, ${result.quads} triples, ${total} concepts${termbase})`,\n );\n } catch (e) {\n fail(e);\n }\n });\n\nconfigInputs(\n program\n .command(\"check\")\n .description(\n \"Validate the built graph against the bundled SHACL shapes (errors exit 1)\",\n ),\n)\n .option(\"-g, --graph <path>\", \"Graph .ttl path (default: config out)\")\n // One path per occurrence, never split on commas: a path may hold one.\n .option(\n \"--shapes <path>\",\n \"Shapes .ttl file; repeatable (default: config check.shapes, then bundled)\",\n collect,\n [],\n )\n .option(\n \"-f, --format <format>\",\n `Output: ${CHECK_FORMAT_LIST}`,\n checkFormatOption,\n \"pretty\",\n )\n .action(\n async (\n opts: {\n config?: string | boolean;\n graph?: string;\n shapes: string[];\n format: CheckFormat;\n },\n command: Command,\n ) => {\n try {\n const report = await runCheck({ ...rest(opts), ...documentOptions(opts) });\n console.log(\n renderCheck(report, opts.format, {\n color: colorFor(command, process.stdout.isTTY),\n }),\n );\n process.exitCode = report.exitCode;\n } catch (e) {\n fail(e);\n }\n },\n );\n\n/**\n * The value of a flag `shapes` and `shapes show` both declare. Commander keeps\n * parsing a parent's options past a subcommand name, so `shapes show X -f\n * markdown` sets `format` on `shapes`. The nearest command given the flag\n * wins, and the subcommand's own default is the fallback, as lint reads its\n * `templates` flags. So neither declaration checks its value as it parses,\n * and the action checks the one that applies.\n */\nfunction optionValue(command: Command, key: string): unknown {\n for (let cmd: Command | null = command; cmd !== null; cmd = cmd.parent) {\n if (cmd.getOptionValueSource(key) === \"cli\") return cmd.getOptionValue(key);\n }\n return command.getOptionValue(key);\n}\n\n/** The options `shapes` and `shapes show` share, as the cores take them. */\nfunction shapesOptions(command: Command): ShapesOptions {\n const { configPath, noConfig } = configOption(optionValue(command, \"config\"));\n const shapes = optionValue(command, \"shapes\");\n return {\n ...(configPath === undefined ? {} : { config: configPath }),\n ...(noConfig === true ? { noConfig } : {}),\n ...(Array.isArray(shapes) ? { shapes: shapes.map(String) } : {}),\n };\n}\n\n/** `--shapes`, worded as `check` words it. */\nfunction shapesInput(command: Command): Command {\n return command.option(\n \"--shapes <path>\",\n \"Shapes .ttl file; repeatable (default: config check.shapes, then bundled)\",\n collect,\n [],\n );\n}\n\nconst shapesCommand = shapesInput(\n configInputs(\n program\n .command(\"shapes\")\n .description(\"List the SHACL node shapes `graph check` runs, and what each one targets\"),\n ),\n)\n .option(\"-f, --format <format>\", `Output: ${GRAPH_FORMAT_LIST}`, \"pretty\")\n .action((_opts: unknown, command: Command) => {\n try {\n const format = formatOption(String(optionValue(command, \"format\")));\n console.log(renderShapes(runShapes(shapesOptions(command)), format));\n } catch (e) {\n fail(e);\n }\n });\n\nshapesInput(\n configInputs(\n shapesCommand\n .command(\"show\")\n .description(\n \"Print every property a shape checks and the frontmatter key that feeds it\",\n )\n .argument(\"<shape>\", \"Node shape to show, by local name, such as DocumentShape\"),\n ),\n)\n .option(\"-f, --format <format>\", `Output: ${SHAPES_SHOW_FORMAT_LIST}`, \"pretty\")\n .action((shape: string, _opts: unknown, command: Command) => {\n try {\n const format = showFormatOption(String(optionValue(command, \"format\")));\n console.log(renderShapesShow(runShapesShow(shape, shapesOptions(command)), format));\n } catch (e) {\n fail(e);\n }\n });\n\ndocumentInputs(\n program\n .command(\"fill\")\n .description(\n \"Propose `graph:` fields and sample questions with an LLM, gated by confidence, and write them back\",\n ),\n \"fill\",\n)\n .option(\n \"-f, --format <format>\",\n `Output: ${GRAPH_FORMAT_LIST}`,\n formatOption,\n \"pretty\",\n )\n .option(\"--dry-run\", \"Report proposals without writing files\")\n .option(\"--force\", \"Overwrite human-set graph fields\")\n .option(\"--no-cache\", \"Bypass the proposal cache\")\n .option(\"--no-validate-graph\", \"Skip the SHACL graph guardrail on proposals\")\n .option(\"--sections\", \"Also propose per-section metadata\")\n .option(\n \"--max-turns <n>\",\n \"Stop after this many inference calls (a cached page costs none)\",\n countOption(\"--max-turns\"),\n )\n .option(\n \"--confidence <n>\",\n \"Minimum model confidence (0..1) to write a field (default: config, 0.7)\",\n numericOption(\"--confidence\", { min: 0, max: 1 }),\n )\n .option(\n // Comma-separated and given once: one separator per list (proposal 0034).\n \"--fields <list>\",\n `Fields to propose (comma-separated; default: config, then every field)`,\n fieldsOption,\n )\n // The nameable providers, and `auto`. `mock` is the library's test double:\n // accepted when asked for by name, never offered.\n .option(\n \"--provider <name>\",\n \"Provider: auto (default) | anthropic | openai | claude-cli | llama-cpp\",\n )\n .option(\"--model <model>\", \"Model override; needs a named provider, from here or config\")\n .option(\"--local\", LOCAL_FLAG_HELP)\n .option(\n \"--offline\",\n \"no network egress: only a model already downloaded, never a remote provider\",\n )\n .option(\n \"--chunk-chars <n>\",\n \"characters of page per question request (default: config, then 12000)\",\n countOption(\"--chunk-chars\"),\n )\n // Typed inline, as every other action in this file is. The option parsers\n // above (`numericOption`, `choiceOption`, `fieldsOption`) have already thrown\n // on anything malformed by the time this runs, so a cast per field would be\n // safe — but it would also be the one command with the most options and the\n // least help from the compiler.\n .action(async (paths: string[], opts: InputFlags & {\n config?: string | boolean;\n collection?: string[];\n exclude?: string[];\n dryRun?: boolean;\n force?: boolean;\n cache?: boolean;\n validateGraph?: boolean;\n sections?: boolean;\n maxTurns?: number;\n confidence?: number;\n fields?: FillField[];\n provider?: string;\n model?: string;\n local?: boolean;\n offline?: boolean;\n chunkChars?: number;\n format: GraphFormat;\n }) => {\n try {\n const report = await runFill({\n paths,\n ...documentOptions(opts),\n ...(await inputOptions(paths, opts)),\n dryRun: opts.dryRun,\n force: opts.force,\n noCache: opts.cache === false,\n noValidateGraph: opts.validateGraph === false,\n sections: opts.sections,\n maxTurns: opts.maxTurns,\n confidence: opts.confidence,\n fields: opts.fields,\n provider: opts.provider,\n model: opts.model,\n local: opts.local,\n offline: opts.offline,\n chunkChars: opts.chunkChars,\n });\n // Same channel discipline as build: warnings on stderr, so stdout stays\n // the report, and a warning never changes the exit code.\n for (const warning of report.warnings) warn(warning);\n const rendered = renderFill(report, opts.format);\n if (paths.includes(STDIN)) {\n // With `-` the filled document owns stdout, as under `meta fill -`,\n // and the report in either format is a diagnostic on stderr.\n if (report.stdinDocument !== undefined) {\n process.stdout.write(report.stdinDocument);\n }\n if (rendered.length > 0) process.stderr.write(`${rendered}\\n`);\n } else {\n console.log(rendered);\n }\n process.exitCode = report.exitCode;\n } catch (e) {\n fail(e);\n }\n });\n\nprogram\n .command(\"query\")\n .description(\n \"Match triple patterns against the built graph (omit a term for wildcard)\",\n )\n // Long-only, and named for the triple position each one fills. `-o` is\n // `--out` on every other graph verb and `-s` is meta's schema flag; a\n // one-letter spelling that means two things in one family costs more than\n // the letters it saves.\n .option(\"--subject <term>\", \"Subject IRI or prefixed name\")\n .option(\"--predicate <term>\", \"Predicate IRI or prefixed name\")\n .option(\"--object <term>\", \"Object IRI, prefixed name, or literal value\")\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\")\n .option(\"-g, --graph <path>\", \"Graph .ttl path (default: config out)\")\n .option(\n \"-f, --format <format>\",\n `Output: ${GRAPH_FORMAT_LIST}`,\n formatOption,\n \"pretty\",\n )\n .action(\n (opts: {\n subject?: string;\n predicate?: string;\n object?: string;\n config?: string | boolean;\n graph?: string;\n format: GraphFormat;\n }) => {\n try {\n const { subject, predicate, object, ...others } = rest(opts);\n const result = runQuery({\n ...others,\n ...documentOptions(opts),\n ...(subject === undefined ? {} : { s: subject }),\n ...(predicate === undefined ? {} : { p: predicate }),\n ...(object === undefined ? {} : { o: object }),\n });\n console.log(renderQuery(result, opts.format));\n } catch (e) {\n fail(e);\n }\n },\n );\n\nprogram\n .command(\"stats\")\n .description(\n \"Summarize the built graph: counts, orphans, broken links, hubs, metadata coverage\",\n )\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\")\n .option(\"-g, --graph <path>\", \"Graph .ttl path (default: config out)\")\n .option(\n \"-f, --format <format>\",\n `Output: ${GRAPH_FORMAT_LIST}`,\n formatOption,\n \"pretty\",\n )\n .option(\n \"--check\",\n \"Exit 1 when broken internal links exist or coverage is below threshold\",\n )\n .option(\n \"--top <n>\",\n \"How many most-connected docs to list\",\n countOption(\"--top\"),\n )\n .option(\n \"--coverage-threshold <pct>\",\n \"Minimum metadata coverage % (all fields); overrides config for this run\",\n // A percentage, so 0..100 rather than the 0..1 of a confidence. NaN here is\n // worse than a wrong number: `pct < NaN` is false for every field, so the\n // gate this flag exists to tighten would silently pass instead.\n numericOption(\"--coverage-threshold\", { min: 0, max: 100 }),\n )\n .action(\n (opts: {\n config?: string | boolean;\n graph?: string;\n format: GraphFormat;\n check?: boolean;\n top?: number;\n coverageThreshold?: number;\n }) => {\n try {\n const report = runStats({ ...rest(opts), ...documentOptions(opts) });\n console.log(renderStats(report, opts.format));\n process.exitCode = report.exitCode;\n } catch (e) {\n fail(e);\n }\n },\n );\n\nprogram\n .command(\"search\")\n .description(\"Rank graph nodes for a text query (needs `export search`)\")\n .argument(\"<query>\", \"Text query\")\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\")\n .option(\"-g, --graph <path>\", \"Graph .ttl path (default: config out)\")\n .option(\n \"-i, --index <dir>\",\n \"Directory holding the indexes and manifest (default: beside the graph)\",\n )\n .option(\n \"--lang <tag>\",\n \"Which localization to search (required when the corpus has more than one)\",\n )\n .option(\"--limit <n>\", \"Maximum results (default 10)\", countOption(\"--limit\"))\n .option(\n \"--vectors <path>\",\n \"Vector sidecar path (default: from the manifest)\",\n )\n .option(\n \"--mode <mode>\",\n `Which legs to run: ${SEARCH_MODES.join(\" | \")} (default: hybrid when vectors exist)`,\n choiceOption(\"--mode\", SEARCH_MODES),\n )\n .option(\n \"-f, --format <format>\",\n `Output: ${GRAPH_FORMAT_LIST}`,\n formatOption,\n \"pretty\",\n )\n .action(\n async (\n query: string,\n opts: {\n config?: string | boolean;\n graph?: string;\n index?: string;\n lang?: string;\n limit?: number;\n vectors?: string;\n mode?: SearchMode;\n format: GraphFormat;\n },\n ) => {\n try {\n const report = await runSearch({\n ...rest(opts),\n ...documentOptions(opts),\n query,\n });\n console.log(renderSearch(report, opts.format));\n } catch (e) {\n fail(e);\n }\n },\n );\n\nprogram\n .command(\"traverse\")\n .description(\n \"Walk the graph from a node, honoring scope rules, with the full trace\",\n )\n .argument(\"<node>\", \"Starting node: a full IRI or a prefix:local CURIE\")\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\")\n .option(\"-g, --graph <path>\", \"Graph .ttl path (default: config out)\")\n .option(\n \"-d, --depth <n>\",\n \"Maximum hops from the node (default 1; 3 under --impact)\",\n // Zero is allowed: it means the node itself, which is a real answer.\n countOption(\"--depth\", 0),\n )\n // Comma-separated and given once: a CURIE holds no comma, so one separator\n // is enough, and a second spelling would be a second thing to document.\n .option(\n \"--predicates <list>\",\n \"Only follow these predicates (comma-separated)\",\n )\n .option(\"--reverse\", \"Follow inbound edges (who points at this node)\")\n .option(\"--impact\", \"Transitive inbound reach: what a change here affects\")\n .option(\n \"--variant <variant>\",\n \"Scope filter: product variant IRI, title, or slug\",\n )\n // Not `--subject`: on `query` that is a triple's subject, and one flag name\n // means one thing across the domain.\n .option(\"--software-subject <subject>\", \"Scope filter: software subject\")\n .option(\"--lang <tag>\", \"Scope filter: BCP-47 language tag, matched in any case\")\n .option(\"--limit <n>\", \"Stop after this many nodes\", countOption(\"--limit\"))\n .option(\n \"--context\",\n \"Return the passages the walk reaches, with their text and proof, from the chunk artifact beside the graph\",\n )\n .option(\n \"--max-chars <n>\",\n \"Character budget for the passages (with --context; default: config retrieve.maxChars)\",\n countOption(\"--max-chars\"),\n )\n .option(\n \"--withhold <list>\",\n \"Also leave out passages that are drifted or failing, comma-separated (with --context)\",\n withholdOption,\n )\n .option(\n \"--where <field=value>\",\n \"Only passages whose metadata field holds the value, or a list field containing it (repeatable; all must hold; with --context)\",\n whereOption,\n [],\n )\n .option(\n \"-f, --format <format>\",\n `Output: ${GRAPH_FORMAT_LIST}`,\n formatOption,\n \"pretty\",\n )\n .action(\n async (\n node: string,\n opts: {\n config?: string | boolean;\n graph?: string;\n depth?: number;\n predicates?: string;\n reverse?: boolean;\n impact?: boolean;\n variant?: string;\n softwareSubject?: string;\n lang?: string;\n limit?: number;\n context?: boolean;\n maxChars?: number;\n withhold?: WithholdReason[];\n where: WhereCondition[];\n format: GraphFormat;\n },\n ) => {\n try {\n const { softwareSubject, context, maxChars, withhold, where, ...others } = rest(opts);\n const inputs = {\n ...others,\n ...documentOptions(opts),\n ...(softwareSubject === undefined ? {} : { subject: softwareSubject }),\n node,\n predicates:\n opts.predicates === undefined\n ? undefined\n : splitList(opts.predicates),\n };\n if (context !== true) {\n if (maxChars !== undefined) throw new GraphError(\"--max-chars needs --context.\");\n if (withhold !== undefined) throw new GraphError(\"--withhold needs --context.\");\n if (where.length > 0) throw new GraphError(\"--where needs --context.\");\n console.log(renderTraverse(runTraverse(inputs), opts.format));\n return;\n }\n const bundle = await runTraverseContext({\n ...inputs,\n ...(maxChars === undefined ? {} : { maxChars }),\n ...(withhold === undefined ? {} : { withhold }),\n ...(where.length === 0 ? {} : { where }),\n });\n console.log(renderBundle(bundle, opts.format));\n } catch (e) {\n fail(e);\n }\n },\n );\n\nartifactInputs(\n program\n .command(\"lookup\")\n .description(\n \"Answer a question from the chunk artifact: every ranked match, everything reached outward, and everything that depends on them\",\n )\n .argument(\"<question>\", \"The question, in quotes\"),\n).action(\n async (\n question: string,\n opts: { config?: string | boolean; graph?: string; index?: string; format: GraphFormat },\n ) => {\n try {\n const { format, ...others } = rest(opts);\n const { result, settings } = await runLookup({ ...others, ...documentOptions(opts), question });\n console.log(renderLookup(result, format, settings));\n } catch (e) {\n fail(e);\n }\n },\n);\n\nartifactInputs(\n program\n .command(\"retrieve\")\n .description(\"Retrieve passages for a question, with control over language, scope, depth and budget\")\n .argument(\"<question>\", \"The question, in quotes\"),\n)\n .option(\"--lang <tag>\", \"The localization (required when the corpus has more than one)\")\n .option(\"--variant <variant>\", \"Scope filter: product variant IRI, title, or slug\")\n .option(\"--software-subject <subject>\", \"Scope filter: software subject\")\n .option(\n \"--mode <mode>\",\n `Which legs to run: ${SEARCH_MODES.join(\" | \")} (default: hybrid when the rows carry vectors)`,\n choiceOption(\"--mode\", SEARCH_MODES),\n )\n .option(\"--seeds <n>\", \"Ranked matches the walk starts from (default: config retrieve.seeds)\", countOption(\"--seeds\"))\n .option(\n \"-d, --depth <n>\",\n \"Hops out from each match (default: config retrieve.depth)\",\n countOption(\"--depth\", 0),\n )\n .option(\n \"--max-chars <n>\",\n \"Character budget for the passages (default: config retrieve.maxChars)\",\n countOption(\"--max-chars\"),\n )\n .option(\n \"--withhold <list>\",\n \"Also leave out passages that are drifted or failing, comma-separated\",\n withholdOption,\n )\n .option(\n \"--where <field=value>\",\n \"Only passages whose metadata field holds the value, or a list field containing it (repeatable; all must hold)\",\n whereOption,\n [],\n )\n .action(\n async (\n question: string,\n opts: {\n config?: string | boolean;\n graph?: string;\n index?: string;\n lang?: string;\n variant?: string;\n softwareSubject?: string;\n mode?: RetrieveMode;\n seeds?: number;\n depth?: number;\n maxChars?: number;\n withhold?: WithholdReason[];\n where: WhereCondition[];\n format: GraphFormat;\n },\n ) => {\n try {\n const { softwareSubject, format, where, ...others } = rest(opts);\n const bundle = await runRetrieve({\n ...others,\n ...documentOptions(opts),\n ...(softwareSubject === undefined ? {} : { subject: softwareSubject }),\n ...(where.length === 0 ? {} : { where }),\n question,\n });\n console.log(renderBundle(bundle, format));\n } catch (e) {\n fail(e);\n }\n },\n );\n\nprogram\n .command(\"serve\")\n .description(\n \"Serve lookup, retrieve, traverse and impact to an agent over MCP on stdio, from the chunk artifact, until stdin closes\",\n )\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\")\n .option(\"-g, --graph <path>\", \"Graph .ttl path (default: config out)\")\n .option(\n \"-i, --index <dir>\",\n \"Directory holding chunks.json, its rows and the search index (default: beside the graph)\",\n )\n .option(\n \"--withhold <list>\",\n \"Also leave out passages that are drifted or failing, comma-separated, on every call\",\n withholdOption,\n )\n .action(\n async (opts: { config?: string | boolean; graph?: string; index?: string; withhold?: WithholdReason[] }) => {\n try {\n await runServe({ ...rest(opts), ...documentOptions(opts) });\n } catch (e) {\n fail(e);\n }\n },\n );\n\nprogram\n .command(\"embed\")\n .description(\n \"Compute local embeddings for the search index (needs @huggingface/transformers)\",\n )\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\")\n .option(\"-g, --graph <path>\", \"Graph .ttl path (default: config out)\")\n .option(\n \"-i, --index <dir>\",\n \"Directory holding the indexes and manifest (default: beside the graph)\",\n )\n .option(\n \"-o, --out <dir>\",\n \"Directory for the sidecars (default: the index directory)\",\n )\n // Not `--model`: on `fill` that is the inference model, a different thing.\n .option(\n \"--embedding-model <id>\",\n \"Embedding model id (any id; `mock` for offline runs)\",\n )\n .option(\"--dtype <dtype>\", \"Weight quantization (default q8)\")\n .option(\"--no-cache\", \"Ignore the vector cache\")\n .option(\n \"-f, --format <format>\",\n `Output: ${GRAPH_FORMAT_LIST}`,\n formatOption,\n \"pretty\",\n )\n .action(\n async (opts: {\n config?: string | boolean;\n graph?: string;\n index?: string;\n out?: string;\n embeddingModel?: string;\n dtype?: string;\n cache?: boolean;\n format: GraphFormat;\n }) => {\n try {\n const { embeddingModel, ...others } = rest(opts);\n const report = await runEmbed({\n ...others,\n ...documentOptions(opts),\n ...(embeddingModel === undefined ? {} : { model: embeddingModel }),\n noCache: opts.cache === false,\n });\n console.log(renderEmbed(report, opts.format));\n } catch (e) {\n fail(e);\n }\n },\n );\n\nprogram\n .command(\"export\")\n .description(\n \"Reserialize the built graph into a consumer format (jsonld file, iirds package, search index, question set, chunks with their provenance, or llms.txt)\",\n )\n // The target is a positional, not `-f`: `-f` is the output format in every\n // other verb of the family (0051 §2), and one flag cannot mean two things.\n .argument(\"<target>\", `What to write: ${EXPORT_TARGETS.join(\" | \")}`)\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\")\n .option(\"-g, --graph <path>\", \"Graph .ttl path (default: config out)\")\n .option(\n \"-o, --out <path>\",\n \"Output path (default: the graph path with the target's extension); a directory for search and chunks\",\n )\n .option(\"--evals <path>\", \"A docevals JSON report for chunks (default: config export.chunks.evals)\")\n .action(\n async (\n target: string,\n opts: { config?: string | boolean; graph?: string; out?: string; evals?: string },\n ) => {\n try {\n if (!(EXPORT_TARGETS as readonly string[]).includes(target)) {\n throw new GraphError(\n `Unknown export target \"${target}\". Use ${EXPORT_TARGETS.join(\" | \")}.`,\n );\n }\n const result = await runExport({\n ...documentOptions(opts),\n graph: opts.graph,\n format: target as ExportFormat,\n out: opts.out,\n ...(opts.evals === undefined ? {} : { evals: opts.evals }),\n });\n for (const warning of result.warnings) warn(warning);\n for (const said of result.notices ?? []) noticeOnce(said);\n const noun =\n result.format === \"questions\"\n ? \"question\"\n : result.format === \"chunks\"\n ? \"chunk\"\n : result.format === \"llms\"\n ? \"page\"\n : \"node\";\n console.log(\n `Wrote ${result.nodes} ${noun}${result.nodes === 1 ? \"\" : \"s\"} to ${result.outPath}`,\n );\n } catch (e) {\n fail(e);\n }\n },\n );\n\nprogram\n .command(\"publish\")\n .description(\n \"Build, embed when configured, and export everything serving needs into one directory\",\n )\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\")\n .option(\"-o, --out <dir>\", \"Directory for every artifact (default: the directory of config out)\")\n .option(\"--evals <path>\", \"A docevals JSON report for the chunks (default: config export.chunks.evals)\")\n .option(\n \"-f, --format <format>\",\n `Output: ${GRAPH_FORMAT_LIST}`,\n formatOption,\n \"pretty\",\n )\n .action(\n async (opts: { config?: string | boolean; out?: string; evals?: string; format: GraphFormat }) => {\n try {\n const report = await runPublish({\n ...documentOptions(opts),\n ...(opts.out === undefined ? {} : { out: opts.out }),\n ...(opts.evals === undefined ? {} : { evals: opts.evals }),\n say: (kind, message) => {\n if (kind === \"notice\") noticeOnce(message);\n else warn(message);\n },\n });\n console.log(renderPublish(report, opts.format));\n } catch (e) {\n fail(e);\n }\n },\n );\n\nreturn program;\n}\n","/**\n * What `-f` accepts, per verb.\n *\n * Each verb's renderer lives beside its command core (`renderCheck`,\n * `renderStats`, …); what belongs here is the *list*, stated once so the\n * union, the guard, the help text and the refusal sentence cannot drift\n * apart. It is the same shape a11y and cite keep (`A11Y_FORMATS`,\n * `REPORT_FORMATS`), which is why the sentence a user reads is the family's.\n *\n * Every verb takes `pretty | json`. `check` also takes `github` and `sarif`,\n * because it is the CI gate: it is the one graph verb whose output changes what\n * a reviewer sees on a pull request (proposal 0051 §2), and code scanning reads\n * SARIF (proposal 0089). It names its own list here rather than widening the\n * shared one, so no other verb advertises a format it cannot render.\n */\n\n/** The list every graph verb's `-f` accepts, in the order messages list them. */\nexport const GRAPH_FORMATS = [\"pretty\", \"json\"] as const;\nexport type GraphFormat = (typeof GRAPH_FORMATS)[number];\n\n/** `\"pretty | json\"`, for help text and the refusal sentence. */\nexport const GRAPH_FORMAT_LIST: string = GRAPH_FORMATS.join(\" | \");\n\n/** `check`'s list: the shared two plus the two CI formats. */\nexport const CHECK_FORMATS = [...GRAPH_FORMATS, \"github\", \"sarif\"] as const;\nexport type CheckFormat = (typeof CHECK_FORMATS)[number];\n\n/** `shapes show`'s list: the shared two plus a frontmatter skeleton. */\nexport const SHAPES_SHOW_FORMATS = [...GRAPH_FORMATS, \"markdown\"] as const;\n\n/** `\"pretty | json | markdown\"`, for help text and the refusal sentence. */\nexport const SHAPES_SHOW_FORMAT_LIST: string = SHAPES_SHOW_FORMATS.join(\" | \");\n\n/** `\"pretty | json | github | sarif\"`, for help text and the refusal sentence. */\nexport const CHECK_FORMAT_LIST: string = CHECK_FORMATS.join(\" | \");\n","/**\n * `manni graph shapes` and `manni graph shapes show <shape>`: what the shapes\n * in effect ask for, before a page is written (proposal 0089). The listing\n * names each node shape and what it targets. `show` prints every property a\n * shape checks and the frontmatter key that feeds it, from `sh:name`, and\n * `-f markdown` turns those keys into a frontmatter skeleton.\n *\n * The shapes are the ones `check` would run: `--shapes`, else\n * `graph.check.shapes`, else the bundled file.\n */\nimport { resolve } from \"node:path\";\nimport { DataFactory, type Store } from \"n3\";\nimport type { Severity } from \"../../shared/severity.js\";\nimport { GraphError } from \"../types.js\";\nimport { loadRunConfig } from \"../core/config.js\";\nimport { compactIri } from \"../core/load.js\";\nimport { bundledShapesPath } from \"../core/pkg.js\";\nimport {\n loadShapes,\n localName,\n shapeText,\n type LoadedShapes,\n type ShapesFile,\n} from \"../core/shacl.js\";\nimport { byCodeUnit } from \"../core/sort.js\";\nimport { NS } from \"../core/vocab.js\";\n\nconst SH = \"http://www.w3.org/ns/shacl#\";\n\nexport interface ShapesOptions {\n config?: string;\n /** `--no-config`: skip discovery and use the bundled shapes. */\n noConfig?: boolean;\n /** Shapes .ttl paths (default: config `check.shapes`, then bundled). */\n shapes?: string[];\n cwd?: string;\n}\n\n/** One node shape, as `graph shapes` lists it. */\nexport interface NodeShapeRow {\n /** The shape's local name, such as `DocumentShape`. */\n name: string;\n /** The shapes file's id. */\n id: string;\n /** `\"bundled\"`, or the path as given. */\n source: string;\n /** What the shape targets: a class IRI, or `objects of <predicate>`. */\n target: string | null;\n closed: boolean;\n description: string | null;\n guide: string | null;\n}\n\n/** One property a node shape checks. */\nexport interface PropertyRow {\n /** The property shape's local name, or `null` for a blank node. */\n rule: string | null;\n /** The predicate IRI. */\n path: string;\n /** The frontmatter key that feeds it (`sh:name`), or `null` when manni writes it. */\n key: string | null;\n min: number;\n max: number | null;\n severity: Severity;\n description: string | null;\n}\n\nexport interface ShapeDetail extends NodeShapeRow {\n properties: PropertyRow[];\n}\n\n/** The listing `graph shapes` prints. */\nexport interface ShapesList {\n shapes: NodeShapeRow[];\n}\n\n/** What `graph shapes show` prints: one block per file that defines the shape. */\nexport interface ShapesShow {\n shapes: ShapeDetail[];\n}\n\ninterface Resolved {\n loaded: LoadedShapes;\n sourceOf: Map<ShapesFile, string>;\n}\n\n/** The shapes `check` would run, each with the name the listing gives it. */\nfunction resolveShapes(opts: ShapesOptions): Resolved {\n const cwd = opts.cwd ?? process.cwd();\n const config = loadRunConfig(\n {\n ...(opts.config === undefined ? {} : { configPath: opts.config }),\n ...(opts.noConfig === undefined ? {} : { noConfig: opts.noConfig }),\n },\n cwd,\n );\n const given = opts.shapes && opts.shapes.length > 0 ? opts.shapes : config.check.shapes;\n const sources =\n given.length > 0\n ? given.map((p) => ({ path: resolve(cwd, p), label: p }))\n : [bundledShapesPath(import.meta.url)];\n const loaded = loadShapes(sources);\n const sourceOf = new Map<ShapesFile, string>(\n loaded.files.map((file) => [file, given.length > 0 ? file.label : \"bundled\"]),\n );\n return { loaded, sourceOf };\n}\n\n/** Where a shape's file sits in the order the files were given. */\nfunction fileIndex(resolved: Resolved, iri: string): number {\n const file = resolved.loaded.fileOf.get(iri);\n return file === undefined ? 0 : resolved.loaded.files.indexOf(file);\n}\n\nconst named = (iri: string) => DataFactory.namedNode(iri);\n\nfunction firstObject(store: Store, subject: string, predicate: string): string | undefined {\n return store\n .getObjects(named(subject), named(predicate), null)\n .map((o) => o.value)\n .sort(byCodeUnit)[0];\n}\n\nfunction nodeShapeRow(resolved: Resolved, iri: string): NodeShapeRow {\n const { loaded, sourceOf } = resolved;\n // Every node shape listed here is the subject of its own `a sh:NodeShape`\n // triple, and every triple came from a file, so the lookup always finds one.\n // No fallback to another file, which would misattribute the row.\n const file = loaded.fileOf.get(iri);\n const store = loaded.store;\n const targetClass = firstObject(store, iri, `${SH}targetClass`);\n const objectsOf = firstObject(store, iri, `${SH}targetObjectsOf`);\n return {\n name: localName(iri),\n id: file?.id ?? \"\",\n source: file === undefined ? \"\" : (sourceOf.get(file) ?? file.label),\n target:\n targetClass ?? (objectsOf === undefined ? null : `objects of ${objectsOf}`),\n closed: firstObject(store, iri, `${SH}closed`) === \"true\",\n description: shapeText(store, named(iri), `${SH}description`),\n guide: file?.guide ?? null,\n };\n}\n\n/** Every named node shape in the store, sorted by name. */\nfunction nodeShapes(store: Store): string[] {\n return store\n .getSubjects(named(`${NS.rdf}type`), named(`${SH}NodeShape`), null)\n .filter((s) => s.termType === \"NamedNode\")\n .map((s) => s.value)\n .sort((a, b) => byCodeUnit(localName(a), localName(b)) || byCodeUnit(a, b));\n}\n\nconst SEVERITIES: Record<string, Severity> = {\n [`${SH}Violation`]: \"error\",\n [`${SH}Warning`]: \"warning\",\n [`${SH}Info`]: \"notice\",\n};\n\nfunction propertyRows(store: Store, shape: string): PropertyRow[] {\n const rows: PropertyRow[] = [];\n for (const property of store.getObjects(named(shape), named(`${SH}property`), null)) {\n const term =\n property.termType === \"BlankNode\"\n ? DataFactory.blankNode(property.value)\n : named(property.value);\n const read = (predicate: string): string | undefined =>\n store\n .getObjects(term, named(predicate), null)\n .map((o) => o.value)\n .sort(byCodeUnit)[0];\n const path = read(`${SH}path`);\n if (path === undefined) continue;\n const min = read(`${SH}minCount`);\n const max = read(`${SH}maxCount`);\n rows.push({\n rule: property.termType === \"NamedNode\" ? localName(property.value) : null,\n path,\n key: shapeText(store, term, `${SH}name`),\n min: min === undefined ? 0 : Number(min),\n max: max === undefined ? null : Number(max),\n severity: SEVERITIES[read(`${SH}severity`) ?? \"\"] ?? \"error\",\n description: shapeText(store, term, `${SH}description`),\n });\n }\n return rows.sort(\n (a, b) => byCodeUnit(a.rule ?? \"\", b.rule ?? \"\") || byCodeUnit(a.path, b.path),\n );\n}\n\nexport function runShapes(opts: ShapesOptions = {}): ShapesList {\n const resolved = resolveShapes(opts);\n // Grouped by file, in the order the files were given, then by name.\n const shapes = nodeShapes(resolved.loaded.store).sort(\n (a, b) => fileIndex(resolved, a) - fileIndex(resolved, b),\n );\n return { shapes: shapes.map((iri) => nodeShapeRow(resolved, iri)) };\n}\n\nexport function runShapesShow(name: string, opts: ShapesOptions = {}): ShapesShow {\n const resolved = resolveShapes(opts);\n const all = nodeShapes(resolved.loaded.store);\n const matching = all.filter((iri) => localName(iri) === name);\n if (matching.length === 0) {\n if (all.length === 0) {\n throw new GraphError(`Unknown shape \"${name}\". The shapes in effect define no node shapes.`);\n }\n const available = [...new Set(all.map(localName))].join(\", \");\n throw new GraphError(`Unknown shape \"${name}\". Available: ${available}.`);\n }\n return {\n shapes: matching.map((iri) => ({\n ...nodeShapeRow(resolved, iri),\n properties: propertyRows(resolved.loaded.store, iri),\n })),\n };\n}\n\n/** How often a property may occur, in lint's words. */\nfunction occurrence(min: number, max: number | null): string {\n if (max === 0) return \"forbidden\";\n if (max === null) {\n if (min === 0) return \"optional, repeats\";\n if (min === 1) return \"required, repeats\";\n return `at least ${String(min)}`;\n }\n if (min === 1 && max === 1) return \"required\";\n if (min === 0 && max === 1) return \"optional\";\n return `${String(min)} to ${String(max)}`;\n}\n\n/** Rows of cells, each column padded to its widest cell. */\nfunction columns(rows: string[][]): string[] {\n const widths: number[] = [];\n for (const row of rows) {\n row.forEach((cell, i) => (widths[i] = Math.max(widths[i] ?? 0, cell.length)));\n }\n return rows.map((row) =>\n row\n .map((cell, i) => (i === row.length - 1 ? cell : cell.padEnd(widths[i] ?? 0)))\n .join(\" \")\n .trimEnd(),\n );\n}\n\nconst compactTarget = (target: string | null): string =>\n target === null\n ? \"(no target)\"\n : target.startsWith(\"objects of \")\n ? `objects of ${compactIri(target.slice(\"objects of \".length))}`\n : compactIri(target);\n\nexport function renderShapes(list: ShapesList, format: \"pretty\" | \"json\"): string {\n if (format === \"json\") return JSON.stringify(list, null, 2);\n // One block per file: `runShapes` lists them grouped, in the order given.\n const groups: NodeShapeRow[][] = [];\n for (const shape of list.shapes) {\n const last = groups.at(-1);\n const head = last?.[0];\n if (last !== undefined && head?.id === shape.id && head.source === shape.source) {\n last.push(shape);\n } else {\n groups.push([shape]);\n }\n }\n const blocks: string[] = [];\n for (const rows of groups) {\n const first = rows[0];\n if (first === undefined) continue;\n const lines = [first.source === first.id ? first.id : `${first.id} (${first.source})`];\n if (first.guide !== null) lines.push(` Guide: ${first.guide}`);\n lines.push(\n ...columns(\n rows.map((s) => [s.name, compactTarget(s.target), s.description ?? \"\"]),\n ).map((l) => ` ${l}`),\n );\n blocks.push(lines.join(\"\\n\"));\n }\n return blocks.join(\"\\n\\n\");\n}\n\nexport function renderShapesShow(\n show: ShapesShow,\n format: \"pretty\" | \"json\" | \"markdown\",\n): string {\n if (format === \"json\") return JSON.stringify(show, null, 2);\n if (format === \"markdown\") return skeleton(show);\n return show.shapes\n .map((shape) => {\n const head = [compactTarget(shape.target), ...(shape.closed ? [\"closed\"] : [])].join(\", \");\n const lines = [`${shape.name} ${shape.id} ${head}`];\n if (shape.description !== null) lines.push(` ${shape.description}`);\n if (shape.guide !== null) lines.push(` Guide: ${shape.guide}`);\n lines.push(\"\");\n const rows = columns(\n shape.properties.map((p) => {\n const words = [\n occurrence(p.min, p.max),\n ...(p.severity === \"error\" ? [] : [p.severity]),\n ].join(\", \");\n return [p.rule ?? \"(unnamed)\", compactIri(p.path), p.key === null ? words : `${p.key} · ${words}`];\n }),\n );\n shape.properties.forEach((p, i) => {\n lines.push(` ${rows[i] ?? \"\"}`);\n if (p.description !== null) lines.push(` ${p.description}`);\n });\n return lines.join(\"\\n\");\n })\n .join(\"\\n\\n\");\n}\n\n/** A nested key of the skeleton: its comment, its value, or its children. */\ninterface SkeletonNode {\n comment: string | null;\n required: boolean;\n repeats: boolean;\n children: Map<string, SkeletonNode>;\n}\n\n/**\n * A frontmatter skeleton from every `sh:name` the shape carries. A required\n * key is written out and an optional one is commented, each under its\n * description. A dotted key nests, and a parent is commented when every key\n * under it is.\n */\nfunction skeleton(show: ShapesShow): string {\n const root = new Map<string, SkeletonNode>();\n for (const shape of show.shapes) {\n for (const p of shape.properties) {\n if (p.key === null) continue;\n let level = root;\n let node: SkeletonNode | undefined;\n for (const part of p.key.split(\".\")) {\n node = level.get(part);\n if (node === undefined) {\n node = { comment: null, required: false, repeats: false, children: new Map() };\n level.set(part, node);\n }\n level = node.children;\n }\n if (node === undefined) continue;\n node.comment ??= p.description;\n node.required ||= p.min > 0;\n node.repeats ||= p.max !== 1;\n }\n }\n const first = show.shapes[0];\n if (first === undefined || root.size === 0) {\n throw new GraphError(\n `${first?.name ?? \"This shape\"} has no frontmatter keys. manni writes every value it checks.`,\n );\n }\n const required = (node: SkeletonNode): boolean =>\n node.children.size === 0 ? node.required : [...node.children.values()].some(required);\n const lines = [\"---\", `# ${first.name}, ${first.id}`];\n for (const g of [...new Set(show.shapes.map((s) => s.guide))]) {\n if (g !== null) lines.push(`# Guide: ${g}`);\n }\n const write = (level: Map<string, SkeletonNode>, indent: string): void => {\n for (const [key, node] of [...level].sort(([a], [b]) => byCodeUnit(a, b))) {\n const mark = required(node) ? \"\" : \"# \";\n if (node.children.size > 0) {\n lines.push(`${indent}${mark}${key}:`);\n write(node.children, `${indent} `);\n continue;\n }\n if (node.comment !== null) lines.push(`${indent}# ${node.comment}`);\n lines.push(`${indent}${mark}${key}:${node.repeats ? \" []\" : \"\"}`);\n }\n };\n write(root, \"\");\n lines.push(\"---\");\n return lines.join(\"\\n\");\n}\n","/**\n * `manni graph init` — scaffold a starter `graph:` section in manni.config.yaml.\n *\n * The family file is shared with the other tools, so a file that already\n * exists is not overwritten: the section is appended to it, leaving the\n * siblings' keys and comments exactly as they were. A file that already has a\n * `graph:` key is refused.\n */\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { parse as parseYaml } from \"yaml\";\nimport { errorMessage } from \"../../shared/errors.js\";\nimport { writeTextAtomic } from \"../../shared/write-file.js\";\nimport { GraphError } from \"../types.js\";\nimport { CONFIG_SECTION, DEFAULT_CONFIG_FILENAME } from \"../core/config.js\";\n\nconst HEADER = `# manni.config.yaml — shared configuration for the manni family of tools.\n# Each tool reads its own top-level key; manni graph reads \"graph:\".\n`;\n\nconst STARTER = `# Base IRI for every minted node. Set this to a namespace you control;\n# without it, IRIs fall back to the urn:manni:graph: placeholder.\n# baseIri: https://example.com/graph/\n\n# There is no document set here. \\`manni graph build\\` and \\`manni graph fill\\` read the\n# paths you name, or the collections declared once for every tool at the TOP\n# level of this file, beside \\`graph:\\` rather than inside it:\n#\n# collections:\n# - name: site\n# paths: [\"docs/**/*.md\"]\n#\n# Output of \\`manni graph build\\`.\nout: graph/graph.ttl\n\n# Map published-site routes back to source files so route-style links\n# (/docs/actions/find) become graph edges. A route may also carry the BCP-47\n# \\`language\\` labelling every document under its root; a page's own \\`lang\\`\n# frontmatter wins. Uncomment and adjust:\n# routes:\n# - basePath: /docs\n# root: docs\n# extensions: [.md, .mdx, .markdown]\n# indexFiles: [index, README]\n# - basePath: /docs/de\n# root: docs/de\n# language: de\n\n# What to derive triples from. Remove entries to opt out.\nbuild:\n derive: [frontmatter, sections, links, tags, images, code, provenance, terms]\n\n# PROV-O settings. Git history is detected, not switched: per-file dates and\n# author agents, rename -> prov:wasRevisionOf, and the build activity's HEAD\n# committer date are derived wherever git can run over a repository, and a run\n# that cannot says so once and builds the rest. Deterministic per commit;\n# wall-clock time never enters the graph.\n# qualified: emit prov:qualifiedAttribution/qualifiedAssociation nodes\n# with roles alongside the direct properties.\nprovenance:\n qualified: true\n\n# Which fields a published graph may carry is read from x-manni-graph-output in\n# the schema set \\`manni meta validate\\` resolves for each page. Set that under\n# meta: (schemas, strict, register), not here. The default set keeps the\n# stewardship people fields (owner, stakeholders, reviewed-by) out.\n\n# SHACL shapes \\`manni graph check\\` validates the built graph against. Default:\n# the shapes contract bundled with manni (shapes/graph/shapes-1.2.0.ttl).\n# check:\n# shapes: [\"./my-shapes.ttl\"]\n\n# Metadata coverage gate for \\`manni graph stats --check\\`. A number applies to\n# every measured field; a map gates named fields only. Unset gates nothing.\n# stats:\n# coverageThreshold:\n# title: 100\n# description: 50\n\n# Which provider \\`manni graph fill\\` sends pages to. Unset, the family's\n# top-level providers: map decides, and then \\`auto\\`, which detects one: an\n# Anthropic key, then an OpenAI key, then the Claude CLI, then a local model.\n# Connection settings (apiKeyEnv, baseUrl, command) live in that map, declared\n# once for every manni tool. \\`--provider\\` wins over this, \\`--local\\` over both.\n# provider: anthropic # auto | anthropic | openai | claude-cli | llama-cpp\n# model: claude-sonnet-4-5 # the provider's default when omitted\n\n# LLM settings for \\`manni graph fill\\` (SKOS frontmatter proposals and sample questions).\nfill:\n temperature: 0\n # Stop after this many inference calls. One page is one turn, and a cached\n # page spends none. Unset is unbounded.\n # maxTurns: 50\n cacheDir: .manni/graph/cache\n # fill proposes every field; confidence (0..1 per field) gates what is\n # written. Fields scored below the threshold are reported, not written.\n confidenceThreshold: 0.7\n # fields: defaults to every fillable field — uncomment to restrict.\n # Record meta-provenance (model + /graph/ pointers + confidence) on filled docs.\n writeProvenance: true\n # Reject proposals that would violate the SHACL shapes contract\n # (broader/narrower cycles, conflicting labels).\n validateGraph: true\n # Also propose per-section metadata. Off by default: it costs more output per\n # call, and section metadata is explicit-only, so review it as carefully.\n sections: false\n # Sample questions: draft until a page has perPage, each pinned to the lines\n # that answer it. A question request sends at most chunkChars of a page.\n questions:\n perPage: 3\n chunkChars: 12000\n # Send nothing off this machine: only a local model already downloaded.\n offline: false\n\n# Local embeddings for semantic search (\\`manni graph embed\\`). Needs the optional\n# peer: npm install @huggingface/transformers\n# embed:\n# model: onnx-community/granite-embedding-small-english-r2-ONNX\n# dtype: q8 # q8 keeps embedding reproducible across platforms\n# out: graph # directory for the per-language vector sidecars\n# cacheDir: .manni/graph/embed-cache\n\n# Optional enrichment for \\`manni graph export iirds\\` (the iiRDS package).\n# Absent, a minimal valid package is still produced.\n# export:\n# iirds:\n# title: My Docs # package title (default: \"manni graph export\")\n# creator: Acme Corp # Creator iirds:Party + vcard:Organization\n# version: \"1.3\" # iiRDS version literal: \"1.2\" | \"1.3\"\n`;\n\n/** The starter as a `graph:` section: every line nested one level. */\nfunction starterSection(): string {\n const body = STARTER.split(\"\\n\")\n .map((line) => (line === \"\" ? \"\" : ` ${line}`))\n .join(\"\\n\");\n return `${CONFIG_SECTION}:\\n${body}`;\n}\n\nexport async function runInit(cwd = process.cwd()): Promise<string> {\n const path = resolve(cwd, DEFAULT_CONFIG_FILENAME);\n if (!existsSync(path)) {\n await writeTextAtomic(path, `${HEADER}${starterSection()}`);\n return path;\n }\n\n // A family file is already here. Parse it to make sure a `graph:` key can be\n // appended: the document must be a mapping (or empty) without one.\n const text = readFileSync(path, \"utf8\");\n let doc: unknown;\n try {\n doc = parseYaml(text);\n } catch (e) {\n throw new GraphError(\n `Invalid YAML in ${DEFAULT_CONFIG_FILENAME}: ${errorMessage(e)}`,\n );\n }\n if (doc != null && (typeof doc !== \"object\" || Array.isArray(doc))) {\n throw new GraphError(\n `${DEFAULT_CONFIG_FILENAME}: top level must be a mapping — not adding a \\`${CONFIG_SECTION}:\\` section to it.`,\n );\n }\n if (doc != null && Object.hasOwn(doc, CONFIG_SECTION)) {\n throw new GraphError(\n `${DEFAULT_CONFIG_FILENAME} already has a \\`${CONFIG_SECTION}:\\` section — not overwriting.`,\n );\n }\n // Append as text rather than re-serialising the document, so the siblings'\n // keys and comments come out byte-for-byte as they went in.\n const separator = text === \"\" || text.endsWith(\"\\n\") ? \"\" : \"\\n\";\n const blank = text === \"\" ? \"\" : \"\\n\";\n await writeTextAtomic(\n path,\n `${text}${separator}${blank}${starterSection()}`,\n );\n return path;\n}\n","/**\n * `manni graph serve` (proposal 0090): the chunk artifact over MCP, on stdio.\n *\n * Four tools, `lookup`, `retrieve`, `traverse` and `impact`, each answered by\n * the command core its CLI twin runs (`lookupIn`, `retrieveIn`, `traverseIn`)\n * over one artifact opened at start. Nothing here retrieves.\n *\n * The SDK is an optional peer, imported only when this command runs. Its\n * high-level `registerTool` takes zod shapes, so the tools are served through\n * the underlying protocol server with plain JSON Schemas, validated here.\n *\n * A CLI usage error comes back as a refusal carrying the CLI's text, never as\n * `isError`. `--withhold` tightens every call's floor, and no tool argument\n * can loosen it: no input schema names `withhold`.\n */\nimport type { Readable, Writable } from \"node:stream\";\nimport { Ajv2020 } from \"ajv/dist/2020.js\";\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport type { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport type { CallToolRequestSchema, ListToolsRequestSchema } from \"@modelcontextprotocol/sdk/types.js\";\nimport pkg from \"../../../package.json\" with { type: \"json\" };\nimport { errorMessage } from \"../../shared/errors.js\";\nimport { notice } from \"../../shared/warn.js\";\nimport type { WithholdReason } from \"../runtime/chunks.js\";\nimport type { LookupResult, PassageBundle, WhereCondition } from \"../runtime/retrieve.js\";\nimport { GraphError } from \"../types.js\";\nimport { lookupIn, openArtifact, retrieveIn, traverseIn, type Artifact, type ArtifactOptions } from \"./retrieve.js\";\n\nexport interface ServeOptions extends ArtifactOptions {\n /** Tightens the trust floor for every call. */\n withhold?: WithholdReason[];\n}\n\n/** The SDK pieces serve uses, as one injectable seam. */\nexport interface McpSdk {\n McpServer: typeof McpServer;\n StdioServerTransport: typeof StdioServerTransport;\n ListToolsRequestSchema: typeof ListToolsRequestSchema;\n CallToolRequestSchema: typeof CallToolRequestSchema;\n}\n\nexport interface ServeSeams {\n /** Injection seam for tests: load the SDK, or fail as a missing package does. */\n loadSdk?: () => Promise<McpSdk>;\n /** Injection seams for tests: the streams served over, `process.stdin` and `process.stdout` by default. */\n stdin?: Readable;\n stdout?: Writable;\n}\n\nasync function importSdk(): Promise<McpSdk> {\n // Literal specifiers, so the Node build leaves them bare: an optional peer.\n const [mcp, stdio, types] = await Promise.all([\n import(\"@modelcontextprotocol/sdk/server/mcp.js\"),\n import(\"@modelcontextprotocol/sdk/server/stdio.js\"),\n import(\"@modelcontextprotocol/sdk/types.js\"),\n ]);\n return {\n McpServer: mcp.McpServer,\n StdioServerTransport: stdio.StdioServerTransport,\n ListToolsRequestSchema: types.ListToolsRequestSchema,\n CallToolRequestSchema: types.CallToolRequestSchema,\n };\n}\n\n// ---- schemas ----------------------------------------------------------------\n\ntype Schema = Record<string, unknown>;\n\nconst text = (description: string): Schema => ({ type: \"string\", minLength: 1, description });\nconst count = (minimum: number, description: string): Schema => ({ type: \"integer\", minimum, description });\n\nconst QUESTION = text(\"The reader's question, in their words.\");\nconst NODE = text(\"The IRI of the node to start from, as a passage's iri gives it.\");\nconst LANG = text(\"The localization, as a BCP-47 tag. Required when the docs have more than one.\");\nconst VARIANT = text(\"Only passages for this product variant: its IRI, title or slug.\");\nconst SUBJECT = text(\"Only passages about this software subject.\");\nconst MAX_CHARS = count(1, \"The character budget for passage text. Defaults to graph.retrieve.maxChars.\");\nconst LIMIT = count(1, \"Stop after this many nodes.\");\nconst WHERE: Schema = {\n type: \"object\",\n description:\n \"Only passages whose metadata holds each field's value. A list asks for every value, and a list field matches when it contains the value.\",\n additionalProperties: {\n oneOf: [\n { type: \"string\", minLength: 1 },\n { type: \"array\", items: { type: \"string\", minLength: 1 }, minItems: 1 },\n ],\n },\n};\n\nconst input = (properties: Record<string, Schema>, requiredField: string): Schema => ({\n type: \"object\",\n properties,\n required: [requiredField],\n additionalProperties: false,\n});\n\nconst REFUSAL: Schema = {\n type: \"object\",\n properties: {\n reason: {\n type: \"string\",\n enum: [\"no-route\", \"no-content\", \"withheld\", \"lang-required\", \"unknown-node\", \"unknown-scope\"],\n },\n detail: { type: \"string\" },\n },\n required: [\"reason\", \"detail\"],\n};\nconst PROOF: Schema = { type: \"object\", description: \"The provenance record: pins, dates and eval verdicts.\" };\nconst TRACE: Schema = {\n type: \"object\",\n required: [\"entry\", \"hops\", \"exclusions\", \"resolutions\", \"withheld\", \"filtered\"],\n};\nconst CITATIONS: Schema = {\n type: \"array\",\n items: { type: \"object\", properties: { iri: { type: \"string\" }, sourceUrl: { type: \"string\" } }, required: [\"iri\", \"sourceUrl\"] },\n};\nconst PAGES: Schema = { type: \"object\", additionalProperties: { type: \"object\", required: [\"metadata\"] } };\nconst NULLABLE_TEXT: Schema = { type: [\"string\", \"null\"] };\n\nconst BUNDLE: Schema = {\n type: \"object\",\n properties: {\n question: { type: \"string\" },\n node: { type: \"string\" },\n language: NULLABLE_TEXT,\n context: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n iri: { type: \"string\" },\n title: { type: \"string\" },\n text: { type: \"string\" },\n page: { type: \"string\" },\n depth: { type: \"integer\" },\n role: { type: \"string\", enum: [\"match\", \"context\", \"dependent\"] },\n provenance: PROOF,\n },\n required: [\"iri\", \"text\", \"page\", \"depth\", \"role\", \"provenance\"],\n },\n },\n citations: CITATIONS,\n pages: PAGES,\n trace: TRACE,\n refusal: REFUSAL,\n truncated: { type: \"boolean\" },\n },\n required: [\"language\", \"context\", \"citations\", \"pages\", \"trace\", \"truncated\"],\n additionalProperties: false,\n};\n\nconst PASSAGE = (extra: Record<string, Schema>, required: string[]): Schema => ({\n type: \"object\",\n properties: {\n iri: { type: \"string\" },\n title: { type: \"string\" },\n page: { type: \"string\" },\n lines: { type: \"string\" },\n text: NULLABLE_TEXT,\n truncated: { type: \"boolean\" },\n provenance: PROOF,\n ...extra,\n },\n required: [\"iri\", \"page\", \"text\", \"truncated\", \"provenance\", ...required],\n});\nconst EDGES: Schema = {\n type: \"array\",\n items: {\n type: \"object\",\n properties: { from: { type: \"string\" }, predicate: { type: \"string\" }, to: { type: \"string\" } },\n required: [\"from\", \"predicate\", \"to\"],\n },\n};\nconst WALK: Schema = {\n type: \"object\",\n properties: {\n passages: { type: \"array\", items: PASSAGE({ depth: { type: \"integer\" } }, [\"depth\"]) },\n edges: EDGES,\n truncated: { type: \"boolean\" },\n },\n required: [\"passages\", \"edges\", \"truncated\"],\n};\n\nconst LOOKUP_RESULT: Schema = {\n type: \"object\",\n properties: {\n question: { type: \"string\" },\n language: NULLABLE_TEXT,\n matches: {\n type: \"object\",\n properties: {\n passages: {\n type: \"array\",\n items: PASSAGE({ rank: { type: \"integer\" }, score: { type: \"object\", required: [\"fused\"] } }, [\"rank\", \"score\"]),\n },\n truncated: { type: \"boolean\" },\n },\n required: [\"passages\", \"truncated\"],\n },\n traversal: WALK,\n impact: WALK,\n pages: PAGES,\n citations: CITATIONS,\n trace: TRACE,\n refusal: REFUSAL,\n },\n required: [\"question\", \"language\", \"matches\", \"traversal\", \"impact\", \"pages\", \"citations\", \"trace\"],\n additionalProperties: false,\n};\n\nconst READ_ONLY = { readOnlyHint: true, openWorldHint: false };\n\n/** The four tools, in the order `tools/list` gives them. */\nconst TOOLS = [\n {\n name: \"lookup\",\n description:\n \"Start here. Pass the reader's question. You get three full result sets. Every match is ranked with its scores. \" +\n \"Every passage reached by following links outward from the matches comes back, and so does every passage that depends on the matches. \" +\n \"Each set has its edges, and each passage has its source and proof: pin status, dates and eval verdicts. \" +\n \"A refusal means nothing in the docs answers it.\",\n inputSchema: input({ question: QUESTION }, \"question\"),\n outputSchema: LOOKUP_RESULT,\n annotations: READ_ONLY,\n },\n {\n name: \"retrieve\",\n description: \"Like lookup, with control over language, scope, depth and budget.\",\n inputSchema: input(\n {\n question: QUESTION,\n lang: LANG,\n variant: VARIANT,\n softwareSubject: SUBJECT,\n depth: count(0, \"Hops out from each match. Defaults to graph.retrieve.depth.\"),\n maxChars: MAX_CHARS,\n where: WHERE,\n },\n \"question\",\n ),\n outputSchema: BUNDLE,\n annotations: READ_ONLY,\n },\n {\n name: \"traverse\",\n description: \"Walk the graph from one node and return the passages it reaches.\",\n inputSchema: input(\n {\n node: NODE,\n depth: count(0, \"Hops out from the node.\"),\n predicates: {\n type: \"array\",\n items: { type: \"string\", minLength: 1 },\n description: \"Follow only these predicates, as prefixed names or IRIs.\",\n },\n reverse: { type: \"boolean\", description: \"Follow edges into the node rather than out of it.\" },\n lang: LANG,\n variant: VARIANT,\n softwareSubject: SUBJECT,\n limit: LIMIT,\n maxChars: MAX_CHARS,\n where: WHERE,\n },\n \"node\",\n ),\n outputSchema: BUNDLE,\n annotations: READ_ONLY,\n },\n {\n name: \"impact\",\n description: \"List the passages that depend on a node. Use it before changing a page.\",\n inputSchema: input(\n {\n node: NODE,\n depth: { ...count(0, \"Hops in from the node.\"), default: 3 },\n lang: LANG,\n variant: VARIANT,\n softwareSubject: SUBJECT,\n limit: LIMIT,\n maxChars: MAX_CHARS,\n where: WHERE,\n },\n \"node\",\n ),\n outputSchema: BUNDLE,\n annotations: READ_ONLY,\n },\n] as const;\n\ntype ToolName = (typeof TOOLS)[number][\"name\"];\n\n// ---- calls ------------------------------------------------------------------\n\ninterface Args {\n question?: string;\n node?: string;\n lang?: string;\n variant?: string;\n softwareSubject?: string;\n depth?: number;\n maxChars?: number;\n limit?: number;\n predicates?: string[];\n reverse?: boolean;\n where?: Record<string, string | string[]>;\n}\n\n/** The object form an agent writes, as the CLI's repeated `--where`: one condition per value, all ANDed. */\nfunction whereOf(where: Args[\"where\"]): WhereCondition[] | undefined {\n if (where === undefined) return undefined;\n return Object.entries(where).flatMap(([field, value]) =>\n (Array.isArray(value) ? value : [value]).map((v) => ({ field, value: v })),\n );\n}\n\nconst defined = <T extends object>(o: T): Partial<T> =>\n Object.fromEntries(Object.entries(o).filter(([, v]) => v !== undefined)) as Partial<T>;\n\nasync function answer(\n artifact: Artifact,\n name: ToolName,\n args: Args,\n withhold: WithholdReason[] | undefined,\n): Promise<LookupResult | PassageBundle> {\n const scope = defined({ lang: args.lang, variant: args.variant, subject: args.softwareSubject, withhold });\n const head = name === \"retrieve\" || name === \"lookup\" ? { question: args.question ?? \"\" } : { node: args.node ?? \"\" };\n try {\n switch (name) {\n case \"lookup\":\n return await lookupIn(artifact, { question: args.question ?? \"\", ...defined({ withhold }) });\n case \"retrieve\":\n return await retrieveIn(artifact, {\n question: args.question ?? \"\",\n ...scope,\n ...defined({ depth: args.depth, maxChars: args.maxChars, where: whereOf(args.where) }),\n });\n case \"traverse\":\n case \"impact\":\n return await traverseIn(artifact, {\n node: args.node ?? \"\",\n ...scope,\n ...(name === \"impact\" ? { impact: true } : {}),\n ...defined({\n depth: args.depth,\n predicates: args.predicates,\n reverse: args.reverse,\n limit: args.limit,\n maxChars: args.maxChars,\n where: whereOf(args.where),\n }),\n });\n }\n } catch (e) {\n if (!(e instanceof GraphError) || e.refusal === undefined) throw e;\n // A CLI usage error is an answer here: a refusal with the CLI's own text.\n const refused: PassageBundle = {\n ...head,\n language: null,\n context: [],\n citations: [],\n pages: {},\n trace: { entry: { candidates: [] }, hops: [], exclusions: [], resolutions: [], withheld: [], filtered: [] },\n refusal: { reason: e.refusal, detail: e.message },\n truncated: false,\n };\n return refused;\n }\n}\n\n/**\n * Serve until stdin closes. Resolves then, so the bin exits 0. A missing SDK,\n * a missing artifact or one built from another graph rejects with a\n * `GraphError`, exit 2, before anything is served.\n */\nexport async function runServe(opts: ServeOptions, seams: ServeSeams = {}): Promise<void> {\n let sdk: McpSdk;\n try {\n sdk = await (seams.loadSdk ?? importSdk)();\n } catch {\n throw new GraphError(\n \"graph serve needs the optional @modelcontextprotocol/sdk package; run npm install @modelcontextprotocol/sdk.\",\n );\n }\n const artifact = openArtifact(opts);\n\n const ajv = new Ajv2020({ allErrors: false, strict: false });\n const validators = new Map(TOOLS.map((t) => [t.name as string, ajv.compile(t.inputSchema)]));\n const server = new sdk.McpServer(\n { name: \"manni-graph\", version: pkg.version },\n { capabilities: { tools: {} } },\n );\n const pending = new Set<Promise<unknown>>();\n\n server.server.setRequestHandler(sdk.ListToolsRequestSchema, () => ({\n tools: TOOLS.map((t) => ({ ...t })),\n }));\n server.server.setRequestHandler(sdk.CallToolRequestSchema, async (request) => {\n const { name } = request.params;\n const args = request.params.arguments ?? {};\n const validate = validators.get(name);\n const fault = (message: string): { isError: true; content: { type: \"text\"; text: string }[] } => ({\n isError: true,\n content: [{ type: \"text\", text: message }],\n });\n if (validate === undefined) return fault(`Unknown tool ${name}; this server has lookup, retrieve, traverse and impact.`);\n if (!validate(args)) {\n const first = validate.errors?.[0];\n const where = first?.instancePath === \"\" || first === undefined ? \"arguments\" : first.instancePath.slice(1);\n const why = first?.keyword === \"additionalProperties\"\n ? `${String((first.params as { additionalProperty?: string }).additionalProperty)} is not an argument`\n : `${where} ${first?.message ?? \"is invalid\"}`;\n return fault(`Invalid arguments for ${name}: ${why}.`);\n }\n const work = answer(artifact, name as ToolName, args, opts.withhold);\n pending.add(work);\n try {\n const result = await work;\n return {\n structuredContent: { ...result },\n content: [{ type: \"text\" as const, text: JSON.stringify(result) }],\n };\n } catch (e) {\n // A stale row or a model mismatch mid-session: the CLI's words, and the session goes on.\n return fault(errorMessage(e));\n } finally {\n pending.delete(work);\n }\n });\n\n const stdin = seams.stdin ?? process.stdin;\n const transport = new sdk.StdioServerTransport(stdin, seams.stdout ?? process.stdout);\n const closed = new Promise<void>((done) => {\n stdin.once(\"end\", done);\n stdin.once(\"close\", done);\n });\n await server.connect(transport);\n notice(`serving lookup, retrieve, traverse and impact over stdio from ${artifact.label}.`);\n await closed;\n await Promise.allSettled([...pending]);\n // The SDK writes each reply a few microtasks after its handler returns, and\n // closing aborts any reply not yet written. One macrotask lets them all out.\n await new Promise((done) => setImmediate(done));\n await server.close();\n}\n","/**\n * `manni graph publish` (proposal 0090): everything serving needs, in one\n * directory, by running each step's own core in-process. Nothing here builds,\n * embeds or exports on its own.\n *\n * The steps run in the order each one's input exists: `build`, the search\n * index, `embed` (which reads the index), `graph.jsonld`, the chunks (which\n * read the vectors), then `llms.txt` and the iiRDS package. `embed`, `llms`\n * and `iirds` run only when their config section exists, and are otherwise\n * reported as skipped. The first step that fails stops the run with its own\n * message. It does not gate: `graph check` gates.\n */\nimport { basename, dirname, join, relative, resolve } from \"node:path\";\nimport { errorMessage } from \"../../shared/errors.js\";\nimport { loadRunConfig } from \"../core/config.js\";\nimport { GraphError } from \"../types.js\";\nimport { runBuild } from \"./build.js\";\nimport { runEmbed } from \"./embed.js\";\nimport { runExport, type ExportFormat, type ExportResult } from \"./export.js\";\nimport { LLMS_FILENAME } from \"./llms.js\";\n\nexport interface PublishOptions {\n config?: string;\n /** `--no-config`: skip discovery and run on the built-in defaults. */\n noConfig?: boolean;\n /** `--out`: the directory for every artifact (default: the directory of config `out`). */\n out?: string;\n /** `--evals`: overrides `graph.export.chunks.evals`. */\n evals?: string;\n cwd?: string;\n /** Each step's warnings and notices, as they are said. */\n say?: (kind: \"warning\" | \"notice\", message: string) => void;\n}\n\nexport type PublishStepName = \"build\" | \"embed\" | `export:${ExportFormat}`;\n\nexport interface PublishStep {\n step: PublishStepName;\n status: \"ran\" | \"skipped\";\n detail: string;\n /** What the step wrote, relative to `out`. */\n files: string[];\n}\n\nexport interface PublishReport {\n /** The directory, as the run names it from its working directory. */\n out: string;\n steps: PublishStep[];\n}\n\nconst plural = (n: number, word: string): string => `${String(n)} ${word}${n === 1 ? \"\" : \"s\"}`;\n\nexport async function runPublish(opts: PublishOptions = {}): Promise<PublishReport> {\n const cwd = opts.cwd ?? process.cwd();\n const source = {\n ...(opts.config === undefined ? {} : { config: opts.config }),\n ...(opts.noConfig === undefined ? {} : { noConfig: opts.noConfig }),\n cwd,\n };\n const config = loadRunConfig(\n {\n ...(opts.config === undefined ? {} : { configPath: opts.config }),\n ...(opts.noConfig === undefined ? {} : { noConfig: opts.noConfig }),\n },\n cwd,\n );\n const configured = resolve(cwd, config.out);\n const outDir = opts.out === undefined ? dirname(configured) : resolve(cwd, opts.out);\n const graph = join(outDir, basename(configured));\n const shown = (path: string): string => relative(outDir, path).split(\"\\\\\").join(\"/\");\n const say = opts.say ?? (() => undefined);\n const steps: PublishStep[] = [];\n\n const run = async (\n step: PublishStepName,\n work: () => Promise<{ detail: string; files: string[]; warnings: string[]; notices?: string[] }>,\n ): Promise<void> => {\n let done: Awaited<ReturnType<typeof work>>;\n try {\n done = await work();\n } catch (e) {\n throw new GraphError(`graph publish stopped at ${step}: ${errorMessage(e)}`);\n }\n for (const w of done.warnings) say(\"warning\", w);\n for (const n of done.notices ?? []) say(\"notice\", n);\n steps.push({ step, status: \"ran\", detail: done.detail, files: done.files.map(shown) });\n };\n const skip = (step: PublishStepName, section: string): void => {\n steps.push({ step, status: \"skipped\", detail: `no ${section} section`, files: [] });\n };\n const exported = (format: ExportFormat, detail: (r: ExportResult) => string, out?: string) =>\n run(`export:${format}`, async () => {\n const r = await runExport({ ...source, graph, format, ...(out === undefined ? {} : { out }), ...(format === \"chunks\" && opts.evals !== undefined ? { evals: opts.evals } : {}) });\n return { detail: detail(r), files: r.files, warnings: r.warnings, ...(r.notices === undefined ? {} : { notices: r.notices }) };\n });\n const names = (r: ExportResult): string => r.files.map(shown).join(\", \");\n\n await run(\"build\", async () => {\n const r = await runBuild({ ...source, out: graph });\n return { detail: `${shown(r.outPath)}: ${plural(r.docs, \"page\")}, ${plural(r.quads, \"triple\")}`, files: [r.outPath], warnings: r.warnings };\n });\n await exported(\"search\", (r) => `${names(r)}: ${String(r.nodes)} ${r.nodes === 1 ? \"entry\" : \"entries\"}`, outDir);\n if (config.declared.embed) {\n await run(\"embed\", async () => {\n const r = await runEmbed({ ...source, graph, index: outDir, out: outDir });\n const models = [...new Set(r.languages.map((l) => l.model))].join(\", \");\n const files = r.languages.map((l) => l.outPath);\n return { detail: `${files.map(shown).join(\", \")}: ${plural(r.total, \"vector\")}, ${models}`, files, warnings: [] };\n });\n } else {\n skip(\"embed\", \"graph.embed\");\n }\n await exported(\"jsonld\", (r) => `${names(r)}: ${plural(r.nodes, \"node\")}`);\n await exported(\"chunks\", (r) => `${names(r)}: ${plural(r.nodes, \"chunk\")}, ${String(r.withheld ?? 0)} withheld`, outDir);\n if (config.export.llms !== null) {\n await exported(\"llms\", (r) => `${names(r)}: ${plural(r.nodes, \"page\")}`, join(outDir, LLMS_FILENAME));\n } else {\n skip(\"export:llms\", \"graph.export.llms\");\n }\n if (config.declared.iirds) {\n await exported(\"iirds\", (r) => `${names(r)}: ${plural(r.nodes, \"node\")}`);\n } else {\n skip(\"export:iirds\", \"graph.export.iirds\");\n }\n\n const label = relative(cwd, outDir).split(\"\\\\\").join(\"/\");\n return { out: label === \"\" ? \".\" : label, steps };\n}\n\n/** The step lines and the file count, or the report as JSON. */\nexport function renderPublish(report: PublishReport, format: \"pretty\" | \"json\"): string {\n if (format === \"json\") return JSON.stringify(report, null, 2);\n // The asymmetry is deliberate. A step that ran prints its verb (`export:llms` as `export`) and the\n // detail names the files. A skipped step names its target, since the verb alone would not say what was skipped.\n const lines = report.steps.map((s) => {\n if (s.status === \"skipped\") return `skipped ${s.step.replace(/^export:/, \"\")}: ${s.detail}`;\n return `${s.step.replace(/:.*$/, \"\").padEnd(9)} ${s.detail}`;\n });\n const files = new Set(report.steps.flatMap((s) => s.files)).size;\n lines.push(`Published ${plural(files, \"file\")} to ${report.out}/.`);\n return lines.join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,SAAS,eAAe;;;ACMjB,IAAM,gBAAgB,CAAC,UAAU,MAAM;AAIvC,IAAM,oBAA4B,cAAc,KAAK,KAAK;AAG1D,IAAM,gBAAgB,CAAC,GAAG,eAAe,UAAU,OAAO;AAI1D,IAAM,sBAAsB,CAAC,GAAG,eAAe,UAAU;AAGzD,IAAM,0BAAkC,oBAAoB,KAAK,KAAK;AAGtE,IAAM,oBAA4B,cAAc,KAAK,KAAK;;;ACxBjE,SAAS,eAAe;AACxB,SAAS,mBAA+B;AAgBxC,IAAM,KAAK;AA4DX,SAAS,cAAc,MAA+B;AACpD,QAAM,MAAM,KAAK,OAAO,QAAQ,IAAI;AACpC,QAAM,S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text","resolve","resolve"]}
|
package/dist/cli-WQNWAMDL.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/family/cli.ts","../src/family/core/envelope.ts","../src/family/core/in-play.ts","../src/family/commands/check.ts","../src/family/core/changed.ts","../src/family/core/said-once.ts","../src/family/commands/status.ts"],"sourcesContent":["/**\n * The two family verbs, `manni check` and `manni status`, mounted on the\n * umbrella with `addCommand`. They are the only verbs it carries: each\n * orchestrates other domains' command cores and owns no checks of its own.\n *\n * Run by hand or in CI they follow the family contract: 0 clean, 1 errors, 2\n * operational, the report on stdout and notices on stderr. Under a Claude\n * Code hook envelope on stdin they speak the hook protocol instead, which\n * changes where output goes and what the exit code means, never what is\n * checked beyond the scope.\n */\nimport { resolve } from \"node:path\";\nimport { Command, Option } from \"commander\";\nimport { shouldColor } from \"../shared/color.js\";\nimport { errorMessage } from \"../shared/errors.js\";\nimport { programName } from \"../shared/program-name.js\";\nimport { fail } from \"../shared/run.js\";\nimport { notice } from \"../shared/warn.js\";\nimport { readEnvelope, type Envelope } from \"./core/envelope.js\";\nimport { FamilyError, labelFrom } from \"./core/in-play.js\";\nimport {\n CHECK_FORMATS,\n EDIT_TOOLS,\n exitCodeFor,\n hookFailure,\n hookReply,\n render,\n runFamilyCheck,\n runTurnCheck,\n turnReply,\n type CheckFormat,\n type FamilyCheckRun,\n type HookReply,\n type Scope,\n} from \"./commands/check.js\";\nimport {\n STATUS_FORMATS,\n agentLines,\n exportGeneratedBy,\n renderStatus,\n runStatus,\n type StatusFormat,\n} from \"./commands/status.js\";\n\ninterface CheckCliOptions {\n config?: string;\n format: CheckFormat;\n /** `--no-color`: `false` when given. */\n color: boolean;\n}\n\ninterface StatusCliOptions {\n config?: string;\n format: StatusFormat;\n}\n\nfunction send(reply: HookReply): void {\n if (reply.stdout !== undefined) process.stdout.write(reply.stdout);\n if (reply.stderr !== undefined) process.stderr.write(reply.stderr);\n process.exitCode = reply.exitCode;\n}\n\n/**\n * The file checks a hook asks for, or `undefined` when this event runs none.\n * A SubagentStop runs none: its subagent's turn is judged alone.\n */\nexport function hookScope(envelope: Envelope, cwd: string): { scope: Scope; file?: string } | undefined {\n if (envelope.event === \"Stop\") return { scope: { kind: \"changed\" } };\n if (envelope.event !== \"PostToolUse\") return undefined;\n if (envelope.toolName === undefined || !EDIT_TOOLS.includes(envelope.toolName)) return undefined;\n if (envelope.filePath === undefined) return undefined;\n const file = labelFrom(cwd, resolve(cwd, envelope.filePath));\n return { scope: { kind: \"paths\", paths: [file] }, file };\n}\n\n/** The events that end a turn, which tracevals judges (proposal 0079). */\nconst TURN_EVENTS: readonly string[] = [\"Stop\", \"SubagentStop\"];\n\nasync function checkUnderHook(paths: string[], options: CheckCliOptions, envelope: Envelope): Promise<void> {\n const cwd = resolve(envelope.cwd ?? process.cwd());\n // Positional paths win over the envelope's own scope.\n const asked: { scope: Scope; file?: string } | undefined =\n paths.length > 0 ? { scope: { kind: \"paths\", paths }, file: paths.join(\", \") } : hookScope(envelope, cwd);\n const turnEvent = TURN_EVENTS.includes(envelope.event);\n if (asked === undefined && !turnEvent) return;\n let run: FamilyCheckRun | undefined;\n if (asked !== undefined) {\n try {\n run = await runFamilyCheck({\n cwd,\n scope: asked.scope,\n allowMissing: true,\n ...(options.config === undefined ? {} : { configPath: options.config }),\n // stdout and stderr are the hook's channels; a notice is not for the agent.\n onNotice: () => undefined,\n });\n } catch (err) {\n // Nothing set up for the file checks is not the end of a turn's judgement.\n if (!(err instanceof FamilyError && err.quiet) && !turnEvent) {\n send(hookFailure(errorMessage(err), envelope, asked.file));\n return;\n }\n }\n }\n if (!turnEvent) {\n if (run !== undefined) send(hookReply(run, envelope));\n return;\n }\n send(turnReply(run, await runTurnCheck(envelope, cwd), envelope));\n}\n\nexport function buildCheck(): Command {\n return new Command(\"check\")\n .description(\"Run every check this repository has set up, and nothing else\")\n .argument(\"[paths...]\", \"files, directories, or globs; the per-file checks run on the collection members among them\")\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .addOption(\n new Option(\"-f, --format <format>\", \"output (not read under a hook)\")\n .choices(CHECK_FORMATS)\n .default(\"pretty\"),\n )\n .option(\"--no-color\", \"disable colored output\")\n .showHelpAfterError(\"(add --help for usage)\")\n .exitOverride()\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni check # every in-play check, the CI gate\",\n \" manni check docs/limits.md # per-file checks on one page\",\n \" manni check -f github # in a GitHub workflow\",\n \" manni check -f sarif > manni.sarif # one SARIF log for code scanning\",\n \" manni check docs/ -f json # scripting form\",\n ].join(\"\\n\"),\n )\n .action(async (paths: string[], options: CheckCliOptions) => {\n const envelope = await readEnvelope();\n if (envelope !== undefined) {\n await checkUnderHook(paths, options, envelope);\n return;\n }\n try {\n const run = await runFamilyCheck({\n scope: paths.length > 0 ? { kind: \"paths\", paths } : { kind: \"all\" },\n ...(options.config === undefined ? {} : { configPath: options.config }),\n onNotice: notice,\n });\n for (const check of run.checks) {\n if (check.status === \"error\") {\n process.stderr.write(`${programName()} ${check.command} could not run: ${check.message}\\n`);\n }\n }\n const color = shouldColor({ noColor: !options.color, isTTY: process.stdout.isTTY });\n const text = render(run, options.format, color);\n if (text.length > 0) process.stdout.write(`${text}\\n`);\n process.exitCode = exitCodeFor(run);\n } catch (err) {\n fail(err);\n }\n });\n}\n\nexport function buildStatus(): Command {\n return new Command(\"status\")\n .description(\"Say what is set up here, and so what manni check runs\")\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .addOption(\n new Option(\"-f, --format <format>\", \"output\").choices(STATUS_FORMATS).default(\"pretty\"),\n )\n .showHelpAfterError(\"(add --help for usage)\")\n .exitOverride()\n .action(async (options: StatusCliOptions) => {\n const envelope = await readEnvelope();\n const configOption = options.config === undefined ? {} : { configPath: options.config };\n if (envelope?.event === \"SessionStart\") {\n try {\n const report = await runStatus({ cwd: resolve(envelope.cwd ?? process.cwd()), ...configOption });\n // The agent lines promise checks, so they need a domain in play to be true.\n const lines = report.domains.some((d) => d.status === \"in-play\") ? `\\n\\n${agentLines(report)}` : \"\";\n // The next steps are advice for whoever owns the config, not the agent.\n process.stdout.write(`${renderStatus(report, \"pretty\", { next: false })}${lines}\\n`);\n exportGeneratedBy(envelope);\n } catch {\n // No config, or one that cannot be read: the session starts without a word.\n }\n return;\n }\n try {\n const report = await runStatus(configOption);\n process.stdout.write(`${renderStatus(report, options.format)}\\n`);\n } catch (err) {\n fail(err);\n }\n });\n}\n","/**\n * The Claude Code hook envelope, detected rather than switched.\n *\n * A hook command gets one JSON object on stdin, and Claude Code closes the\n * stream after it. When stdin is not a terminal and parses as an object with a\n * string `hook_event_name`, `manni check` and `manni status` speak the hook\n * protocol. Anything else is a run by hand, and stdin is left unread beyond\n * that one look. The look never hangs: `readStdin` gives up on a stream that\n * stays silent, which is what an inherited pipe nobody writes to looks like.\n */\nimport { readStdin } from \"../../tracevals/capture/hook.js\";\n\nexport interface Envelope {\n /** `hook_event_name`: `PostToolUse`, `Stop`, `SessionStart`, … */\n event: string;\n /** The directory the hook fired in; relative paths resolve from it. */\n cwd?: string;\n /** `tool_name`, on a tool event. */\n toolName?: string;\n /** `tool_input.file_path`, or `tool_input.notebook_path` for a notebook. */\n filePath?: string;\n /** `stop_hook_active`: this stop already follows one repair pass. */\n stopHookActive: boolean;\n /** `model`, on `SessionStart`: a string, or an object carrying `id`. */\n model?: string;\n /** `session_id`. */\n sessionId?: string;\n /** `transcript_path`: the session's own transcript. */\n transcriptPath?: string;\n /** `agent_transcript_path`, on `SubagentStop`: the subagent's own transcript. */\n agentTranscriptPath?: string;\n /** `agent_id`, on `SubagentStop`. */\n agentId?: string;\n /** `agent_type`, on `SubagentStop`. */\n agentType?: string;\n /** `last_assistant_message`, on `Stop` and `SubagentStop`. */\n lastAssistantMessage?: string;\n}\n\nfunction str(value: unknown): string | undefined {\n return typeof value === \"string\" && value.length > 0 ? value : undefined;\n}\n\nfunction record(value: unknown): Record<string, unknown> | undefined {\n return value !== null && typeof value === \"object\" && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : undefined;\n}\n\n/** The envelope in `text`, or `undefined` when `text` is not one. */\nexport function parseEnvelope(text: string): Envelope | undefined {\n let parsed: unknown;\n try {\n parsed = JSON.parse(text);\n } catch {\n return undefined;\n }\n const doc = record(parsed);\n const event = str(doc?.hook_event_name);\n if (doc === undefined || event === undefined) return undefined;\n const input = record(doc.tool_input);\n const filePath = str(input?.file_path) ?? str(input?.notebook_path);\n const cwd = str(doc.cwd);\n const toolName = str(doc.tool_name);\n const model = str(doc.model) ?? str(record(doc.model)?.id);\n const strings = {\n sessionId: str(doc.session_id),\n transcriptPath: str(doc.transcript_path),\n agentTranscriptPath: str(doc.agent_transcript_path),\n agentId: str(doc.agent_id),\n agentType: str(doc.agent_type),\n lastAssistantMessage: str(doc.last_assistant_message),\n };\n const given = Object.fromEntries(Object.entries(strings).filter(([, v]) => v !== undefined)) as Partial<\n Record<keyof typeof strings, string>\n >;\n return {\n event,\n stopHookActive: doc.stop_hook_active === true,\n ...(cwd === undefined ? {} : { cwd }),\n ...(toolName === undefined ? {} : { toolName }),\n ...(filePath === undefined ? {} : { filePath }),\n ...(model === undefined ? {} : { model }),\n ...given,\n };\n}\n\n/** The envelope on stdin, or `undefined` for a run by hand. */\nexport async function readEnvelope(\n stream: NodeJS.ReadStream = process.stdin,\n): Promise<Envelope | undefined> {\n if (stream.isTTY) return undefined;\n try {\n return parseEnvelope(await readStdin(stream));\n } catch {\n // Too large to be an envelope: a run by hand with something piped in.\n return undefined;\n }\n}\n","/**\n * What is set up, and so what `manni check` runs.\n *\n * There are no keys of the family's own. A domain is in play when its own\n * section of `manni.config.yaml` exists, or when the content carries its\n * declarations. Nothing manni would apply by default counts as set up:\n *\n * | Domain | In play when |\n * |---|---|\n * | meta | a file's schema set is more than the built-in defaults: `meta:` covers it, or it names its own `$schema` |\n * | cite | a page carries citations |\n * | lint | `lint:` exists |\n * | docevals | a page resolves evals, from `docevals:` or its own declarations |\n * | term | the collections hold a term |\n * | graph | `graph:` exists |\n * | tracevals | `tracevals.runtime` exists; it judges the turn a Stop or SubagentStop hook ends |\n * | a11y | never run by `check`: it needs a running site |\n * | test | never run by `check`: Doc Detective runs the pages' shell steps |\n *\n * Only members of a declared collection are file-checked. tracevals judges a\n * turn, not files, so it needs no collection.\n */\nimport { relative, resolve, sep } from \"node:path\";\nimport { parse as parseYaml } from \"yaml\";\nimport type { CollectionConfig } from \"../../shared/collections.js\";\nimport {\n findFamilyConfigFile,\n readFamilyConfigFile,\n type ConfigFile,\n} from \"../../shared/config-file.js\";\nimport { ToolError } from \"../../shared/errors.js\";\nimport { memberOf, retainMembers } from \"../../meta/core/collections.js\";\nimport { resolveTargetSet } from \"../../meta/internal.js\";\n\n/** An operational error of `manni check` or `manni status`: exit 2. */\nexport class FamilyError extends ToolError {\n constructor(\n message: string,\n /** Set for the two conditions a hook answers with silence. */\n readonly quiet = false,\n ) {\n super(message);\n this.name = \"FamilyError\";\n }\n}\n\nexport function noConfigError(cwd: string): FamilyError {\n return new FamilyError(\n `No manni.config.yaml found from ${cwd} up to the repository root. Create one there with a collections: entry for your docs.`,\n true,\n );\n}\n\nexport function nothingSetUpError(): FamilyError {\n return new FamilyError(\n \"Nothing is set up to check in manni.config.yaml. Run manni status to see what each domain needs.\",\n true,\n );\n}\n\n/** The domains `check` can run, in the order it runs and reports them. */\nexport const DOMAINS = [\"meta\", \"cite\", \"lint\", \"docevals\", \"term\", \"graph\"] as const;\nexport type Domain = (typeof DOMAINS)[number];\n\n/** Each domain's check, as `check` names it. */\nexport const COMMANDS: Readonly<Record<Domain, string>> = {\n meta: \"meta validate\",\n cite: \"cite check\",\n lint: \"lint check\",\n docevals: \"docevals run\",\n term: \"term check\",\n graph: \"graph check\",\n};\n\n/** Why a domain is not in play, as both `check` and `status` say it. */\nexport const NOT_SET_UP: Readonly<Record<Domain, string>> = {\n meta: \"no meta: section\",\n cite: \"no page carries citations\",\n lint: \"no lint: section\",\n docevals: \"no page resolves any evals\",\n term: \"no terms in any collection\",\n graph: \"no graph: section\",\n};\n\n/**\n * What would put each domain in play, as `status` says it. It is advice for\n * whoever owns the config, so the SessionStart briefing leaves it out.\n */\nexport const NEXT: Readonly<Record<Domain, string>> = {\n meta: \"Add a meta: section that names your schemas. manni meta schemas lists the built-in ones.\",\n cite: \"Pin a sentence to its source with manni cite add.\",\n lint: \"Add a lint: section. manni lint templates lists the templates it can apply.\",\n docevals: \"Add a docevals: section, or declare evals in a page's frontmatter.\",\n term: \"Add a page with type: term to a collection.\",\n graph: \"Run manni graph init to add a starter graph: section.\",\n};\n\n/** Why every domain is not set up when the config declares no collections, and what to do. */\nexport const NO_COLLECTIONS = \"no collections: in manni.config.yaml\";\nexport const NO_COLLECTIONS_NEXT = \"Add a collections: entry that names your docs.\";\n\n/** Why `meta` skips files when `meta:` exists but covers none of them. */\nexport const META_DEFAULTS_ONLY = \"only the built-in default schemas cover these files\";\n\n/**\n * The domains `check` does not run here: why, and what to run instead.\n * tracevals leaves this list when `tracevals.runtime` exists (`Family.runtime`).\n */\nexport const NOT_CHECKED: ReadonlyArray<readonly [name: string, reason: string, next: string]> = [\n [\"a11y\", \"needs a running site and a browser\", \"Run manni site preview, then manni a11y check.\"],\n // Doc Detective runs the shell steps pages carry, so a hook never starts it.\n [\"test\", \"runs the shell steps the pages carry\", \"Run manni test run with Doc Detective installed.\"],\n [\n \"tracevals\",\n \"judges recorded sessions with a model\",\n \"Run manni tracevals run over sessions, or add tracevals.runtime to judge each turn.\",\n ],\n];\n\n/** `1 page`, `2 pages`. */\nexport function plural(n: number, one: string, many = `${one}s`): string {\n return `${String(n)} ${n === 1 ? one : many}`;\n}\n\nexport interface Family {\n file: ConfigFile;\n /**\n * The config each domain core is handed, so every one reads this file\n * rather than discovering its own: as typed, or as discovery found it,\n * relative to `cwd`.\n */\n configPath: string;\n /** The top-level keys of the file: `meta`, `lint`, `graph`, … */\n sections: ReadonlySet<string>;\n /** `tracevals.runtime` exists: tracevals judges each turn under the hooks. */\n runtime: boolean;\n collections: readonly CollectionConfig[];\n}\n\nfunction toError(message: string): FamilyError {\n return new FamilyError(message);\n}\n\nexport async function loadFamily(cwd: string, configPath?: string): Promise<Family> {\n const file =\n configPath === undefined\n ? await findFamilyConfigFile(cwd, toError)\n : await readFamilyConfigFile(configPath, cwd, toError);\n if (file === null) throw noConfigError(cwd);\n // Already parsed once by the loader, which would have thrown on bad YAML.\n const doc = parseYaml(file.text) as unknown;\n const top = record(doc);\n const sections = new Set(top === undefined ? [] : Object.keys(top));\n const tracevals = record(top?.tracevals);\n // The old `conformance` key counts too. tracevals' loader refuses it and\n // names `runtime`, and only a tracevals in play loads that config, so a\n // config not yet migrated reaches `status` as an error, not as a silent skip.\n const runtime = tracevals?.runtime !== undefined || tracevals?.conformance !== undefined;\n return { file, configPath: configPath ?? file.source, sections, runtime, collections: file.collections };\n}\n\nfunction record(value: unknown): Record<string, unknown> | undefined {\n return value !== null && typeof value === \"object\" && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : undefined;\n}\n\n/** A path as a label relative to `cwd`, posix, the way the domains print one. */\nexport function labelFrom(cwd: string, path: string): string {\n return relative(cwd, path).split(sep).join(\"/\");\n}\n\n/** The collections a file at `label` (relative to `cwd`) belongs to. */\nexport function collectionsOf(family: Family, cwd: string, label: string): string[] {\n return memberOf(family.collections, family.file.dir, cwd, label);\n}\n\n/** Every member of every collection, labelled from `cwd`. */\nexport async function listMembers(family: Family, cwd: string): Promise<string[]> {\n const dir = family.file.dir;\n const { files } = await resolveTargetSet({\n inputs: family.collections.flatMap((c) => c.paths),\n cwd: dir,\n allowEmpty: true,\n });\n return retainMembers(files, (label) => memberOf(family.collections, dir, dir, label)).map(\n (label) => labelFrom(cwd, resolve(dir, label)),\n );\n}\n","/**\n * `manni check`: every check the repository has set up, and nothing else.\n *\n * It owns no checks. Each one is a domain's own command core, run in process\n * with the family config handed to it, and each report is that domain's own\n * reporter's output. What this adds is the choice of what runs (`in-play.ts`),\n * the scope, and one verdict over all of it.\n *\n * Scope:\n *\n * - `all`: every in-play check over every collection, per-file and set-wide.\n * Each domain runs bare, exactly as its own CI step would.\n * - `paths`: the per-file checks on the collection members among the paths.\n * - `changed`: the per-file checks on the git working tree's changes, plus\n * `cite` set-wide. `term` runs set-wide too when a collection document\n * changed or was removed. `graph` never runs here; only `all` checks it.\n * A clean tree runs nothing.\n *\n * `cite` is per-file on paths and set-wide otherwise: a source edit can drift\n * any page's citation, so after a session the whole set is what is checked.\n */\nimport { basename, extname, resolve } from \"node:path\";\nimport pkg from \"../../../package.json\" with { type: \"json\" };\nimport { ToolError, errorMessage } from \"../../shared/errors.js\";\nimport { warn } from \"../../shared/warn.js\";\nimport { resolveTargetSet } from \"../../meta/internal.js\";\nimport { supportedExtensions } from \"../../meta/extractors/index.js\";\nimport type { TurnCheckInput, TurnCheckResult } from \"../../tracevals/commands/check.js\";\nimport { changedFiles } from \"../core/changed.js\";\nimport { sayOnce } from \"../core/said-once.js\";\nimport type { Envelope } from \"../core/envelope.js\";\nimport {\n COMMANDS,\n DOMAINS,\n META_DEFAULTS_ONLY,\n NOT_SET_UP,\n collectionsOf,\n labelFrom,\n listMembers,\n loadFamily,\n nothingSetUpError,\n plural,\n type Domain,\n type Family,\n} from \"../core/in-play.js\";\nimport { withSharedWalks } from \"../../meta/core/load-files.js\";\nimport { FIX_SENTENCE } from \"./status.js\";\n\nexport const CHECK_FORMATS = [\"pretty\", \"json\", \"github\", \"sarif\"] as const;\nexport type CheckFormat = (typeof CHECK_FORMATS)[number];\n\nexport type Scope =\n | { kind: \"all\" }\n | { kind: \"paths\"; paths: string[] }\n | { kind: \"changed\" };\n\nexport interface FamilyCheckOptions {\n /** Where paths resolve and the domains run. Default `process.cwd()`. */\n cwd?: string;\n /** `-c, --config`. */\n configPath?: string;\n scope: Scope;\n /**\n * Leave out a named path that does not exist, rather than failing on it. A\n * hook names a file the edit may have just removed.\n */\n allowMissing?: boolean;\n /** Diagnostics: the outside-every-collection notice, and the domains' own. */\n onNotice?: (message: string) => void;\n}\n\n/** A check that ran. `render` is the domain's own reporter. */\nexport interface RanCheck {\n command: string;\n status: \"pass\" | \"fail\";\n render: (format: CheckFormat, color: boolean) => string;\n}\n\n/** A check that did not run: not in play, or it could not. */\nexport interface NotRunCheck {\n command: string;\n status: \"skipped\" | \"error\";\n message: string;\n}\n\nexport type CheckOutcome = RanCheck | NotRunCheck;\n\nexport interface FamilyCheckRun {\n status: \"pass\" | \"fail\";\n /** The collection members the per-file checks covered, labelled from `cwd`. */\n files: string[];\n checks: CheckOutcome[];\n}\n\ntype Outcome =\n | { skipped: string }\n | { failed: boolean; render: (format: CheckFormat, color: boolean) => string };\n\ninterface Context {\n family: Family;\n cwd: string;\n /** The per-file inputs, or `[]` for a bare run over the collections. */\n inputs: string[];\n onNotice: (message: string) => void;\n}\n\n/**\n * Each domain's command core and reporter are imported where it runs: a hook\n * checks one page with four domains, and the other two (the RDF stack among\n * them) are worth not loading.\n */\nasync function runDomain(domain: Domain, ctx: Context): Promise<Outcome> {\n const { family, cwd, inputs, onNotice } = ctx;\n const configPath = family.configPath;\n switch (domain) {\n case \"meta\": {\n const [{ runValidate }, { render: renderMeta }] = await Promise.all([\n import(\"../../meta/commands/validate.js\"),\n import(\"../../meta/reporters/index.js\"),\n ]);\n const run = await runValidate({ inputs, configPath, cwd, skipDefaultOnly: true, onNotice });\n if (run.results.length === 0) {\n return { skipped: family.sections.has(\"meta\") ? META_DEFAULTS_ONLY : NOT_SET_UP.meta };\n }\n return {\n failed: run.summary.failed > 0,\n render: (format, color) =>\n renderMeta(format, run.results, run.summary, { color, quiet: true, frame: run.frame, onNotice }),\n };\n }\n case \"cite\": {\n const [\n { runCheck: runCite },\n { renderCheckPretty: citePretty },\n { renderCheckJson: citeJson },\n { renderCheckGithub: citeGithub },\n { renderCheckSarif: citeSarif },\n ] = await Promise.all([\n import(\"../../cite/commands/check.js\"),\n import(\"../../cite/reporters/pretty.js\"),\n import(\"../../cite/reporters/json.js\"),\n import(\"../../cite/reporters/github.js\"),\n import(\"../../cite/reporters/sarif.js\"),\n ]);\n const run = await runCite({ inputs, configPath, cwd, onNotice });\n if (!run.pages.some((p) => p.citations.length > 0 || p.findings.length > 0)) {\n return { skipped: NOT_SET_UP.cite };\n }\n return {\n failed: run.summary.failed > 0,\n render: (format, color) => {\n switch (format) {\n case \"pretty\":\n return citePretty(run, { color, quiet: true });\n case \"json\":\n return citeJson(run);\n case \"github\":\n return citeGithub(run);\n case \"sarif\":\n return citeSarif(run, { onNotice });\n }\n },\n };\n }\n case \"lint\": {\n if (!family.sections.has(\"lint\")) return { skipped: NOT_SET_UP.lint };\n const [{ runLint }, { render: renderLint }] = await Promise.all([\n import(\"../../lint/commands/lint.js\"),\n import(\"../../lint/reporters/index.js\"),\n ]);\n const run = await runLint({ inputs, configPath, cwd, onNotice });\n return {\n failed: run.summary.failed > 0,\n // SARIF locations resolve from `root`, which is where the run's labels\n // start: the config's directory for a bare run, else the working one.\n render: (format, color) =>\n renderLint(run, format, { color, root: inputs.length === 0 ? resolve(cwd, family.file.dir) : cwd }),\n };\n }\n case \"docevals\": {\n const [{ runRun: runDocevals }, { render: renderDocevals }, { DocevalsError }] = await Promise.all([\n import(\"../../docevals/commands/run.js\"),\n import(\"../../docevals/reporters/index.js\"),\n import(\"../../docevals/types.js\"),\n ]);\n let report;\n try {\n report = await runDocevals(inputs, {\n config: configPath,\n cwd,\n deterministicOnly: true,\n generate: false,\n execution: false,\n toolVersion: pkg.version,\n });\n } catch (err) {\n if (err instanceof DocevalsError && err.code === \"nothing-resolved\") {\n return { skipped: NOT_SET_UP.docevals };\n }\n throw err;\n }\n return {\n failed: report.exitCode !== 0,\n render: (format, color) => renderDocevals(report, format, { color }),\n };\n }\n case \"term\": {\n const [\n { runCheck: runTerm },\n { renderFindingsPretty: termPretty },\n { renderFindingsJson: termJson },\n { renderFindingsGithub: termGithub },\n { renderFindingsSarif: termSarif },\n ] = await Promise.all([\n import(\"../../term/commands/check.js\"),\n import(\"../../term/reporters/pretty.js\"),\n import(\"../../term/reporters/json.js\"),\n import(\"../../term/reporters/github.js\"),\n import(\"../../term/reporters/sarif.js\"),\n ]);\n const report = await runTerm({ inputs, configPath, cwd, allowEmpty: true, onNotice });\n if (report.terms === 0) return { skipped: NOT_SET_UP.term };\n return {\n failed: report.summary.failed > 0,\n render: (format, color) => {\n switch (format) {\n case \"pretty\":\n return termPretty(report, { color, references: true });\n case \"json\":\n return termJson(report);\n case \"github\":\n return termGithub(report);\n case \"sarif\":\n return termSarif(report, { onNotice });\n }\n },\n };\n }\n case \"graph\": {\n if (!family.sections.has(\"graph\")) return { skipped: NOT_SET_UP.graph };\n const [{ buildGraph }, { runCheck: runGraph, renderCheck: renderGraph }] = await Promise.all([\n import(\"../../graph/commands/build.js\"),\n import(\"../../graph/commands/check.js\"),\n ]);\n const built = await buildGraph({ config: configPath, cwd });\n for (const warning of built.warnings) onNotice(warning);\n const report = await runGraph({ config: configPath, cwd, turtle: built.turtle });\n return {\n failed: report.exitCode !== 0,\n render: (format) => renderGraph(report, format),\n };\n }\n }\n}\n\nasync function outcome(domain: Domain, ctx: Context): Promise<CheckOutcome> {\n const command = COMMANDS[domain];\n try {\n const result = await runDomain(domain, ctx);\n if (\"skipped\" in result) return { command, status: \"skipped\", message: result.skipped };\n return { command, status: result.failed ? \"fail\" : \"pass\", render: result.render };\n } catch (err) {\n return { command, status: \"error\", message: errorMessage(err) };\n }\n}\n\n/** A hook or a git status names files by any extension; a walk keeps the documents. */\nfunction isDocument(label: string): boolean {\n return supportedExtensions().includes(extname(label).toLowerCase());\n}\n\n/** Every domain walks the same collections, so the run shares one walk per target set. */\nexport function runFamilyCheck(opts: FamilyCheckOptions): Promise<FamilyCheckRun> {\n return withSharedWalks(() => checkUnshared(opts));\n}\n\nasync function checkUnshared(opts: FamilyCheckOptions): Promise<FamilyCheckRun> {\n const cwd = resolve(opts.cwd ?? process.cwd());\n const onNotice = opts.onNotice ?? ((): void => undefined);\n const family = await loadFamily(cwd, opts.configPath);\n if (family.collections.length === 0) throw nothingSetUpError();\n const isMember = (label: string): boolean => collectionsOf(family, cwd, label).length > 0;\n\n let files: string[];\n let domains: Domain[];\n let inputs: string[];\n switch (opts.scope.kind) {\n case \"all\":\n files = await listMembers(family, cwd);\n inputs = [];\n domains = [...DOMAINS];\n break;\n case \"paths\": {\n const { files: named } = await resolveTargetSet({\n inputs: opts.scope.paths,\n cwd,\n ...(opts.allowMissing === true ? { allowEmpty: true } : {}),\n });\n const outside = named.filter((label) => !isMember(label));\n if (outside.length > 0) {\n onNotice(`Skipped ${plural(outside.length, \"file\")} outside every collection: ${outside.join(\", \")}`);\n }\n // A collection globbed wide holds assets too; only documents are checked.\n files = named.filter((label) => isMember(label) && isDocument(label));\n inputs = files;\n domains = files.length > 0 ? [\"meta\", \"cite\", \"lint\", \"docevals\"] : [];\n break;\n }\n case \"changed\": {\n const changed = await changedFiles(cwd);\n if (!changed.dirty) return { status: \"pass\", files: [], checks: [] };\n const memberDocuments = (paths: string[]): string[] =>\n paths.map((path) => labelFrom(cwd, path)).filter((l) => isDocument(l) && isMember(l));\n files = memberDocuments(changed.files);\n inputs = files;\n // term reads only collection documents, so a session that changed or\n // removed none of them leaves the glossary as it was. graph never runs\n // here: it is the slowest set-wide check, and its findings span pages\n // rather than the one an agent just wrote, so a bare run (CI) owns it.\n const pageChanged = files.length > 0 || memberDocuments(changed.removed).length > 0;\n domains = [\n ...(files.length > 0 ? ([\"meta\", \"lint\", \"docevals\"] as const) : []),\n \"cite\",\n ...(pageChanged ? ([\"term\"] as const) : []),\n ];\n break;\n }\n }\n\n const checks: CheckOutcome[] = [];\n for (const domain of domains) {\n // The set-wide checks run bare, over every collection, whatever the scope.\n const setWide = domain === \"term\" || domain === \"graph\" || (domain === \"cite\" && opts.scope.kind !== \"paths\");\n checks.push(await outcome(domain, { family, cwd, inputs: setWide ? [] : inputs, onNotice }));\n }\n if (opts.scope.kind === \"all\" && checks.every((c) => c.status === \"skipped\")) {\n throw nothingSetUpError();\n }\n return { status: checks.some((c) => c.status === \"fail\") ? \"fail\" : \"pass\", files, checks };\n}\n\n/** The exit code a run by hand ends with: 2 when a check could not run. */\nexport function exitCodeFor(run: FamilyCheckRun): 0 | 1 | 2 {\n if (run.checks.some((c) => c.status === \"error\")) return 2;\n return run.status === \"fail\" ? 1 : 0;\n}\n\nfunction isRan(check: CheckOutcome): check is RanCheck {\n return check.status === \"pass\" || check.status === \"fail\";\n}\n\n/** The first line of a message, for a one-line context. */\nfunction firstLine(message: string): string {\n return message.split(\"\\n\", 1)[0] ?? \"\";\n}\n\n/**\n * What an agent is told when a check could not run. The cause is the\n * config owner's to fix, so the agent reports it rather than editing config.\n */\nfunction couldNotCheck(command: string, files: string, message: string): string {\n return (\n `manni ${command} could not check ${files}. The cause is in manni's setup, not in the file. ` +\n `Tell the user what it says, and leave manni.config.yaml as it is.\\n${message}`\n );\n}\n\n/** What an agent is handed when a hook blocks: the failing checks' reports, nothing else. */\nfunction renderFailures(run: FamilyCheckRun): string {\n return run.checks\n .filter((c): c is RanCheck => c.status === \"fail\")\n .map((c) => `${c.command}\\n${c.render(\"pretty\", false)}`)\n .join(\"\\n\\n\");\n}\n\nexport function renderPretty(run: FamilyCheckRun, color: boolean): string {\n const blocks: string[] = [];\n for (const check of run.checks) {\n if (isRan(check)) blocks.push(`${check.command}\\n${check.render(\"pretty\", color)}`);\n }\n const notRun = run.checks.filter((c): c is NotRunCheck => !isRan(c));\n if (notRun.length > 0) {\n const width = Math.max(...notRun.map((c) => c.command.length)) + 3;\n blocks.push(\n notRun\n .map((c) => `${c.status.padEnd(9)}${c.command.padEnd(width)}${firstLine(c.message)}`)\n .join(\"\\n\"),\n );\n }\n const count = (status: CheckOutcome[\"status\"]): number =>\n run.checks.filter((c) => c.status === status).length;\n const errors = count(\"error\");\n blocks.push(\n `${plural(run.checks.length, \"check\")} over ${plural(run.files.length, \"file\")}: ` +\n `${String(count(\"fail\"))} failed, ${String(count(\"skipped\"))} skipped` +\n (errors > 0 ? `, ${String(errors)} could not run` : \"\"),\n );\n return blocks.join(\"\\n\\n\");\n}\n\n/** A check's JSON entry: its own report, or why there is none. */\nfunction jsonEntry(c: CheckOutcome): object {\n if (!isRan(c)) return { command: c.command, status: c.status, message: c.message };\n try {\n return { command: c.command, status: c.status, report: JSON.parse(c.render(\"json\", false)) as unknown };\n } catch {\n // One reporter's bad output must not take the other checks' reports with it.\n // `error` on purpose, whatever the run's own status: with no report to\n // embed, a `pass` or `fail` here would be a verdict nobody can inspect.\n // The reference documents `error` for this case too.\n return { command: c.command, status: \"error\", message: `${c.command} -f json printed output that is not JSON` };\n }\n}\n\nexport function renderJson(run: FamilyCheckRun): string {\n return JSON.stringify(\n {\n status: run.status,\n files: run.files,\n checks: run.checks.map(jsonEntry),\n },\n null,\n 2,\n );\n}\n\nexport function renderGithub(run: FamilyCheckRun): string {\n return run.checks\n .filter(isRan)\n .map((c) => c.render(\"github\", false))\n .filter((text) => text.length > 0)\n .join(\"\\n\");\n}\n\ninterface SarifRun {\n automationDetails?: { id: string };\n invocations?: unknown[];\n [key: string]: unknown;\n}\n\ninterface SarifNotification {\n level: \"note\" | \"error\";\n message: { text: string };\n}\n\n/**\n * One SARIF 2.1.0 log for the whole run. Each check that ran contributes its\n * domain's own runs, each under the category `manni/<domain>/`: meta, cite\n * and term share the driver `manni`, so the category is what tells them apart.\n * A last `manni-check` run, with no results, names the checks that were\n * skipped or could not run. A check that could not run gets no run of its\n * own: an empty run would tell code scanning every open alert in its\n * category is fixed.\n */\nexport function renderSarif(run: FamilyCheckRun): string {\n const runs: SarifRun[] = [];\n const notifications: SarifNotification[] = [];\n const say = (level: SarifNotification[\"level\"], text: string): void => {\n notifications.push({ level, message: { text } });\n };\n for (const c of run.checks) {\n if (!isRan(c)) {\n if (c.status === \"skipped\") say(\"note\", `${c.command} skipped: ${c.message}.`);\n else say(\"error\", `${c.command} could not run: ${c.message}`);\n continue;\n }\n const domain = c.command.split(\" \", 1)[0] ?? c.command;\n let own: SarifRun[];\n try {\n // Parsed output is untrusted: `runs` may be missing or not an array. An\n // empty `runs` would drop the domain from the log without a word, so it\n // counts as bad output too.\n const runs = (JSON.parse(c.render(\"sarif\", false)) as { runs?: unknown }).runs;\n if (!Array.isArray(runs) || runs.length === 0) throw new TypeError(\"no runs\");\n own = runs as SarifRun[];\n } catch {\n // As in JSON: one reporter's bad output must not take the others with it.\n say(\"error\", `${c.command} -f sarif printed output that is not SARIF.`);\n continue;\n }\n for (const r of own) {\n runs.push({\n ...r,\n automationDetails: { id: `manni/${domain}/` },\n invocations: r.invocations ?? [{ executionSuccessful: true }],\n });\n }\n }\n runs.push({\n tool: {\n driver: {\n name: \"manni-check\",\n version: pkg.version,\n informationUri: \"https://hawkeyexl.github.io/manni/family/reference/cli/\",\n },\n },\n automationDetails: { id: \"manni/check/\" },\n invocations: [\n {\n executionSuccessful: !notifications.some((n) => n.level === \"error\"),\n ...(notifications.length > 0 ? { toolExecutionNotifications: notifications } : {}),\n },\n ],\n results: [],\n });\n return JSON.stringify(\n { $schema: \"https://json.schemastore.org/sarif-2.1.0.json\", version: \"2.1.0\", runs },\n null,\n 2,\n );\n}\n\nexport function render(run: FamilyCheckRun, format: CheckFormat, color: boolean): string {\n switch (format) {\n case \"pretty\":\n return renderPretty(run, color);\n case \"json\":\n return renderJson(run);\n case \"github\":\n return renderGithub(run);\n case \"sarif\":\n return renderSarif(run);\n }\n}\n\n/** What a hook command ends with: its exit code, and what it prints where. */\nexport interface HookReply {\n exitCode: 0 | 2;\n stdout?: string;\n stderr?: string;\n}\n\n/** The PostToolUse tools whose edit `check` answers. */\nexport const EDIT_TOOLS: readonly string[] = [\"Edit\", \"Write\", \"MultiEdit\", \"NotebookEdit\"];\n\n/**\n * The hook protocol's answer to a run. Never exit 2 for a check that could\n * not run: 2 means \"block\" to Claude Code, and an operational error is not\n * the agent's to fix.\n */\nexport function hookReply(run: FamilyCheckRun, envelope: Envelope): HookReply {\n const failed = run.status === \"fail\";\n if (envelope.event === \"PostToolUse\") {\n const files = run.files.join(\", \");\n if (failed) {\n return {\n exitCode: 2,\n stderr: `manni found errors in ${files}. Fix them before you continue. ${FIX_SENTENCE}\\n\\n${renderFailures(run)}\\n`,\n };\n }\n const errors = run.checks.filter((c): c is NotRunCheck => c.status === \"error\");\n if (errors.length === 0) return { exitCode: 0 };\n const additionalContext = errors.map((c) => couldNotCheck(c.command, files, c.message)).join(\"\\n\");\n return {\n exitCode: 0,\n stdout: `${JSON.stringify({ hookSpecificOutput: { hookEventName: \"PostToolUse\", additionalContext } })}\\n`,\n };\n }\n if (envelope.event === \"Stop\") return turnReply(run, undefined, envelope);\n return { exitCode: 0 };\n}\n\n/** What tracevals found in the turn a Stop or SubagentStop ended, for the reply. */\nexport interface TurnVerdict {\n /** Rules broken with a confident verdict: how many, the report, the trace judged. */\n broken?: { rules: number; report: string; trace: string };\n /** A skip not yet said this session. */\n skipMessage?: string;\n}\n\n/**\n * The reply to a Stop or a SubagentStop: 0078's file checks first, then the\n * turn. One block carries both reasons; after the repair pass, one message\n * carries both sentences. Always exit 0, as 0078's Stop is.\n */\nexport function turnReply(\n run: FamilyCheckRun | undefined,\n turn: TurnVerdict | undefined,\n envelope: Envelope,\n): HookReply {\n const reasons: string[] = [];\n const messages: string[] = [];\n if (run?.status === \"fail\") {\n if (envelope.stopHookActive) {\n messages.push(\"manni still reports errors after one repair pass. Run manni check to see them.\");\n } else {\n reasons.push(\n `manni found errors in the files you changed. Fix them, then finish. ${FIX_SENTENCE}\\n\\n${renderFailures(run)}`,\n );\n }\n }\n if (turn?.broken !== undefined) {\n const { rules, report, trace } = turn.broken;\n if (envelope.stopHookActive) {\n messages.push(\n `tracevals still finds broken rules after one repair pass. Run manni tracevals check ${trace} to see them.`,\n );\n } else {\n reasons.push(\n `This turn broke ${plural(rules, \"rule\")} from the files and requests that governed it. ` +\n `Fix the work, or say why the rule does not apply here, then finish.\\n\\n${report}`,\n );\n }\n }\n if (turn?.skipMessage !== undefined) messages.push(turn.skipMessage);\n if (reasons.length === 0 && messages.length === 0) return { exitCode: 0 };\n const reply = {\n ...(reasons.length > 0 ? { decision: \"block\", reason: reasons.join(\"\\n\\n\") } : {}),\n ...(messages.length > 0 ? { systemMessage: messages.join(\" \") } : {}),\n };\n return { exitCode: 0, stdout: `${JSON.stringify(reply)}\\n` };\n}\n\n/** Test seams `checkTurn` takes; production builds each from config. */\nexport type TurnSeams = Partial<Pick<TurnCheckInput, \"judge\" | \"extractor\" | \"localModels\" | \"env\">>;\n\n/**\n * Judge the turn a Stop or SubagentStop ended, with every gate of proposal\n * 0079. Silent (`undefined`) when tracevals is not in play, the turn is clean\n * or only needs review, a skip was already said this session, or the run\n * could not happen: an operational failure is not the agent's to fix.\n */\nexport async function runTurnCheck(\n envelope: Envelope,\n cwd: string,\n seams: TurnSeams = {},\n): Promise<TurnVerdict | undefined> {\n const subagent = envelope.event === \"SubagentStop\";\n const judged = subagent ? envelope.agentTranscriptPath : envelope.transcriptPath;\n if (judged === undefined) return undefined;\n const trace = resolve(cwd, judged);\n const sessionId = envelope.sessionId ?? basename(trace, \".jsonl\");\n let result: TurnCheckResult;\n let renderTurn: (typeof import(\"../../tracevals/reporters/runtime.js\"))[\"renderCheck\"];\n try {\n // Loaded here, as every domain is, so a run that never judges a turn never\n // loads tracevals.\n const [{ checkTurn }, reporters] = await Promise.all([\n import(\"../../tracevals/commands/check.js\"),\n import(\"../../tracevals/reporters/runtime.js\"),\n ]);\n renderTurn = reporters.renderCheck;\n result = await checkTurn({\n transcriptPath: resolve(cwd, envelope.transcriptPath ?? judged),\n ...(subagent ? { agentTranscriptPath: trace } : {}),\n ...(subagent && envelope.agentId !== undefined ? { agentId: envelope.agentId } : {}),\n ...(subagent && envelope.agentType !== undefined ? { agentType: envelope.agentType } : {}),\n ...(envelope.lastAssistantMessage !== undefined\n ? { lastAssistantMessage: envelope.lastAssistantMessage }\n : {}),\n sessionId,\n cwd,\n inLoop: true,\n ...seams,\n });\n } catch (err) {\n // An operational failure is not the agent's to fix, so it stays silent, as\n // 0078's Stop failures do. Anything else is a bug: say so on stderr, which\n // a hook that exits 0 sends to the debug log, and still never block.\n if (!(err instanceof ToolError)) warn(`the turn check failed unexpectedly: ${errorMessage(err)}`);\n return undefined;\n }\n const { skipped } = result;\n if (skipped?.message !== undefined) {\n return sayOnce(cwd, sessionId, skipped.gate) ? { skipMessage: skipped.message } : undefined;\n }\n if (result.exitCode !== 1 || result.report === undefined) return undefined;\n return {\n broken: {\n rules: result.report.summary.fail,\n report: renderTurn(result.report, { color: false }),\n trace: judged,\n },\n };\n}\n\n/** The reply when the run itself could not happen, under a hook. */\nexport function hookFailure(message: string, envelope: Envelope, file: string | undefined): HookReply {\n if (envelope.event !== \"PostToolUse\" || file === undefined) return { exitCode: 0 };\n const additionalContext = couldNotCheck(\"check\", file, message);\n return {\n exitCode: 0,\n stdout: `${JSON.stringify({ hookSpecificOutput: { hookEventName: \"PostToolUse\", additionalContext } })}\\n`,\n };\n}\n","/**\n * The files a session changed: the git working tree against `HEAD`.\n *\n * Modified, added, renamed (by the new name) and untracked files, staged or\n * not. A deleted file, or a renamed one's old name, is named apart, since\n * there is nothing left to check. Paths come back absolute, resolved from\n * `cwd`: porcelain status names them from the repository root whatever\n * directory git ran in.\n */\nimport { execFile } from \"node:child_process\";\nimport { posix, resolve } from \"node:path\";\nimport { promisify } from \"node:util\";\n\nconst run = promisify(execFile);\n\nasync function git(args: string[], cwd: string): Promise<string> {\n // shell:false: nothing here is ever parsed as shell syntax.\n const { stdout } = await run(\"git\", args, {\n cwd,\n shell: false,\n windowsHide: true,\n maxBuffer: 64 * 1024 * 1024,\n });\n return stdout;\n}\n\n/** Parse `git status --porcelain=v1 -z` into repository-relative paths. */\nexport function parsePorcelain(output: string): { files: string[]; removed: string[] } {\n const fields = output.split(\"\\0\");\n const files: string[] = [];\n const removed: string[] = [];\n for (let i = 0; i < fields.length; i++) {\n const entry = fields[i] ?? \"\";\n if (entry.length < 4) continue;\n const xy = entry.slice(0, 2);\n const path = entry.slice(3);\n // A rename or copy is followed by its old name, which is not a change to\n // check. A rename's old name is gone; a copy's is still there.\n if (xy.includes(\"R\") || xy.includes(\"C\")) {\n i++;\n if (xy.includes(\"R\")) removed.push(fields[i] ?? \"\");\n }\n // `RD`, a staged rename then deleted in the tree, removes both names:\n // the old one above and the new one here. Two files, not one twice.\n if (xy.includes(\"D\")) removed.push(path);\n else files.push(path);\n }\n return { files, removed };\n}\n\nexport interface ChangedTree {\n /** The changed files left to check, absolute. */\n files: string[];\n /** The files the tree no longer has: deleted, or renamed away. Absolute. */\n removed: string[];\n /**\n * Whether the tree differs from `HEAD` at all. A deletion alone leaves no\n * file to check, but it can still break a citation to what it removed.\n */\n dirty: boolean;\n}\n\nexport async function changedFiles(cwd: string): Promise<ChangedTree> {\n // Rebased through `cwd`'s own prefix rather than resolved from the\n // top-level git prints: on Windows that is the long spelling of a path the\n // caller may hold in its 8.3 short form, and the two would never compare.\n const prefix = (await git([\"rev-parse\", \"--show-prefix\"], cwd)).trim();\n const status = await git(\n [\"status\", \"--porcelain=v1\", \"-z\", \"--untracked-files=all\"],\n cwd,\n );\n const { files, removed } = parsePorcelain(status);\n const absolute = (path: string): string => resolve(cwd, posix.relative(prefix, path));\n return { files: files.map(absolute), removed: removed.map(absolute), dirty: status.length > 0 };\n}\n","/**\n * What a hook has already told the user this session (proposal 0079: \"A skip\n * message is said once per session\").\n *\n * Each hook is a process of its own, and parallel subagents end in parallel\n * SubagentStop hooks, so the memory is one marker file per message, created\n * exclusively. The process whose create succeeds is the one that says it, so\n * no two hooks can both read \"not said yet\".\n */\nimport { mkdirSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { DEFAULT_CAPTURE_DIR } from \"../../tracevals/capture/types.js\";\nimport { idHash } from \"../../tracevals/rules/ledger.js\";\n\n/**\n * `<project>/.manni/tracevals/sessions/<session hash>.<key>.said`. The session\n * id is hashed, so nothing in it can climb out of the directory and two ids\n * never share a marker. The key is a gate name, which is already safe.\n */\nexport function saidPath(projectDir: string, sessionId: string, key: string): string {\n return join(projectDir, DEFAULT_CAPTURE_DIR, `${idHash(sessionId)}.${key}.said`);\n}\n\n/**\n * True the first time `key` comes up in a session, and records it. A marker\n * that cannot be written says the message rather than lose it.\n */\nexport function sayOnce(projectDir: string, sessionId: string, key: string): boolean {\n const path = saidPath(projectDir, sessionId, key);\n try {\n mkdirSync(dirname(path), { recursive: true });\n writeFileSync(path, \"\", { flag: \"wx\" });\n return true;\n } catch (err) {\n // EEXIST: another hook said it first. Anything else is an unwritable\n // project, which repeats the message each stop rather than lose it.\n return (err as NodeJS.ErrnoException).code !== \"EEXIST\";\n }\n}\n","/**\n * `manni status`: what is set up here, and so what `manni check` runs.\n *\n * It reads the same table `check` does (`in-play.ts`), counting what the\n * content declares where a domain is in play by declaration: the pages that\n * name their own `$schema`, carry citations or resolve evals, and the terms.\n * It checks nothing, so it exits 0 whatever it finds.\n */\nimport { appendFileSync, existsSync, readFileSync } from \"node:fs\";\nimport { extname, resolve } from \"node:path\";\nimport pkg from \"../../../package.json\" with { type: \"json\" };\nimport { errorMessage } from \"../../shared/errors.js\";\nimport { extractorForExtension } from \"../../meta/extractors/index.js\";\nimport type { HostStatus } from \"../../tracevals/rules/host.js\";\nimport type { Envelope } from \"../core/envelope.js\";\nimport {\n COMMANDS,\n DOMAINS,\n NEXT,\n NOT_CHECKED,\n NOT_SET_UP,\n NO_COLLECTIONS,\n NO_COLLECTIONS_NEXT,\n collectionsOf,\n listMembers,\n loadFamily,\n plural,\n type Domain,\n type Family,\n} from \"../core/in-play.js\";\nimport { withSharedWalks } from \"../../meta/core/load-files.js\";\n\nexport const STATUS_FORMATS = [\"pretty\", \"json\"] as const;\nexport type StatusFormat = (typeof STATUS_FORMATS)[number];\n\nexport type DomainState = \"in-play\" | \"not-set-up\" | \"not-checked\" | \"unknown\";\n\nexport interface ModelRole {\n provider: string;\n model: string;\n}\n\nexport interface DomainRow {\n name: string;\n status: DomainState;\n reason: string;\n /** What to do about it. Absent on an `in-play` row. */\n next?: string;\n /** tracevals in play: the model judging inside a hook, and the one extracting rules. */\n models?: { hook: ModelRole; extraction: ModelRole };\n /** tracevals in play with a model host running: each model it holds. */\n host?: HostStatus[\"models\"];\n}\n\nexport interface StatusReport {\n version: string;\n /** The config file, as discovery found it or as it was typed. */\n config: string;\n collections: { name: string; files: number }[];\n domains: DomainRow[];\n}\n\nexport interface StatusOptions {\n cwd?: string;\n configPath?: string;\n /** Test seam: the running model host. Default: ask the inference library. */\n hostStatus?: () => Promise<HostStatus | null>;\n}\n\n/**\n * tracevals' row when `tracevals.runtime` exists: both models, resolved\n * the way `check` and `prepare` resolve them, and the host when one runs.\n */\nasync function tracevalsRow(cwd: string, opts: StatusOptions): Promise<DomainRow> {\n try {\n const [\n { discoverConfig },\n { assertProviderSelection, resolveSelectionIdentity, selectHookProvider, selectProvider },\n { hostStatus },\n ] = await Promise.all([\n import(\"../../tracevals/core/config.js\"),\n import(\"../../tracevals/judge/provider.js\"),\n import(\"../../tracevals/rules/host.js\"),\n ]);\n const { config } = await discoverConfig(cwd, opts.configPath === undefined ? {} : { configPath: opts.configPath });\n const hook = await resolveSelectionIdentity(config, selectHookProvider(config));\n const selection = selectProvider(config);\n assertProviderSelection(selection);\n const extraction = await resolveSelectionIdentity(config, selection);\n const host = await (opts.hostStatus ?? hostStatus)().catch(() => null);\n return {\n name: \"tracevals\",\n status: \"in-play\",\n reason: `hook: ${hook.provider} ${hook.model} · extraction: ${extraction.provider} ${extraction.model}`,\n models: {\n hook: { provider: hook.provider, model: hook.model },\n extraction: { provider: extraction.provider, model: extraction.model },\n },\n ...(host === null || host.models.length === 0 ? {} : { host: host.models }),\n };\n } catch (err) {\n const message = errorMessage(err).split(\"\\n\", 1)[0] ?? \"\";\n // `tracevals check` needs a trace, so running it again is no way to see more.\n return {\n name: \"tracevals\",\n status: \"unknown\",\n reason: `manni tracevals check could not run: ${message}`,\n next: \"Fix what the reason names, then run manni status again.\",\n };\n }\n}\n\n/** `1 page names`, `3 pages name`: a count and the verb that agrees with it. */\nfunction pages(n: number, one: string, many: string): string {\n return n === 1 ? `1 page ${one}` : `${String(n)} pages ${many}`;\n}\n\n/** The pages naming their own `$schema`, read the way `meta validate` extracts them. */\nfunction ownSchemaCount(cwd: string, members: readonly string[]): number {\n let n = 0;\n for (const label of members) {\n const extractor = extractorForExtension(extname(label));\n if (extractor === undefined) continue;\n try {\n const { data } = extractor.extract(readFileSync(resolve(cwd, label), \"utf8\"), label);\n if (data.$schema !== undefined) n++;\n } catch {\n // A page that does not parse names nothing; `meta validate` reports it.\n }\n }\n return n;\n}\n\n/**\n * The pages carrying citations, read the way `cite check` reads them: its\n * targets, its manifests, its entry rules. Nothing is classified, so no claim\n * or source is looked at and no git history is read.\n */\nasync function citedPages(cwd: string, configPath: string): Promise<number> {\n // Imported where they run, so `manni check` never loads them.\n const { prepareRun, readTarget } = await import(\"../../cite/commands/check.js\");\n const { readPage } = await import(\"../../cite/core/page.js\");\n const prepared = await prepareRun({ inputs: [], configPath, cwd, checkSources: false }, \"checked\", \"check\");\n let n = 0;\n for (const file of prepared.files) {\n const content = await readTarget(prepared.run, file);\n const { citations } = (await prepared.setupFor(file, content)).options;\n const read = readPage(file, content, { markers: false, ...(citations === undefined ? {} : { citations }) });\n if (read.citations.length > 0) n++;\n }\n return n;\n}\n\nasync function row(domain: Domain, family: Family, cwd: string, members: readonly string[]): Promise<DomainRow> {\n const configPath = family.configPath;\n const inPlay = (reason: string): DomainRow => ({ name: domain, status: \"in-play\", reason });\n const notSetUp: DomainRow = { name: domain, status: \"not-set-up\", reason: NOT_SET_UP[domain], next: NEXT[domain] };\n const section = family.sections.has(domain);\n switch (domain) {\n case \"meta\": {\n if (section) return inPlay(\"meta: section\");\n const n = ownSchemaCount(cwd, members);\n return n > 0 ? inPlay(pages(n, \"names its own $schema\", \"name their own $schema\")) : notSetUp;\n }\n case \"cite\": {\n const n = await citedPages(cwd, configPath);\n return n > 0 ? inPlay(pages(n, \"carries citations\", \"carry citations\")) : notSetUp;\n }\n case \"docevals\": {\n const { runList: listEvals } = await import(\"../../docevals/commands/list.js\");\n const { plans } = await listEvals([], { config: configPath, cwd });\n const n = plans.filter((p) => !p.skip && p.evals.length > 0).length;\n if (n === 0) return notSetUp;\n return inPlay(section ? \"docevals: section\" : pages(n, \"declares evals\", \"declare evals\"));\n }\n case \"term\": {\n const { runList: listTerms } = await import(\"../../term/commands/list.js\");\n const { terms } = await listTerms({ inputs: [], configPath, cwd, allowEmpty: true });\n return terms.length > 0 ? inPlay(plural(terms.length, \"term\")) : notSetUp;\n }\n case \"lint\":\n case \"graph\":\n return section ? inPlay(`${domain}: section`) : notSetUp;\n }\n}\n\n/** Every domain walks the same collections, so the run shares one walk per target set. */\nexport function runStatus(opts: StatusOptions = {}): Promise<StatusReport> {\n return withSharedWalks(() => statusUnshared(opts));\n}\n\nasync function statusUnshared(opts: StatusOptions): Promise<StatusReport> {\n const cwd = resolve(opts.cwd ?? process.cwd());\n const family = await loadFamily(cwd, opts.configPath);\n const members = family.collections.length === 0 ? [] : await listMembers(family, cwd);\n const domains: DomainRow[] = [];\n for (const domain of DOMAINS) {\n // `check` only reads collection members, so with no collections every\n // domain has nothing to check, whatever sections the config carries.\n if (family.collections.length === 0) {\n domains.push({ name: domain, status: \"not-set-up\", reason: NO_COLLECTIONS, next: NO_COLLECTIONS_NEXT });\n continue;\n }\n try {\n domains.push(await row(domain, family, cwd, members));\n } catch (err) {\n // Status checks nothing, so a domain that cannot read its own setup is\n // reported in its row rather than ending the run, as unknown: whether it is\n // set up is the thing it could not read.\n const message = errorMessage(err).split(\"\\n\", 1)[0] ?? \"\";\n domains.push({\n name: domain,\n status: \"unknown\",\n reason: `manni ${COMMANDS[domain]} could not run: ${message}`,\n next: `Run manni ${COMMANDS[domain]} to see the whole error.`,\n });\n }\n }\n for (const [name, reason, next] of NOT_CHECKED) {\n domains.push(\n name === \"tracevals\" && family.runtime\n ? await tracevalsRow(cwd, opts)\n : { name, status: \"not-checked\", reason, next },\n );\n }\n return {\n version: pkg.version,\n config: family.file.source,\n collections: family.collections.map((c) => ({\n name: c.name,\n files: members.filter((label) => collectionsOf(family, cwd, label).includes(c.name)).length,\n })),\n domains,\n };\n}\n\nconst STATE_LABEL: Readonly<Record<DomainState, string>> = {\n \"in-play\": \"in play\",\n \"not-set-up\": \"not set up\",\n \"not-checked\": \"not checked\",\n unknown: \"unknown\",\n};\n\nexport interface RenderStatusOptions {\n /** Print each row's next step. Default true; the SessionStart briefing turns it off. */\n next?: boolean;\n}\n\nexport function renderStatus(report: StatusReport, format: StatusFormat, opts: RenderStatusOptions = {}): string {\n if (format === \"json\") return JSON.stringify(report, null, 2);\n const head = [\n `manni ${report.version}`,\n `config ${report.config}`,\n ...report.collections.map((c) => `collection ${c.name} (${plural(c.files, \"file\")})`),\n ].join(\" \");\n // tracevals in play judges each turn, which is what its row says.\n const label = (d: DomainRow): string => (d.models !== undefined ? \"judges each turn\" : STATE_LABEL[d.status]);\n const width = Math.max(14, ...report.domains.map((d) => label(d).length + 3));\n const indent = \"\".padEnd(11 + width);\n const rows = report.domains.flatMap((d, i) => [\n `${d.name.padEnd(11)}${label(d).padEnd(width)}${d.reason}`,\n ...(d.host ?? []).map(\n (m) =>\n `${\"\".padEnd(11)}${\"model host\".padEnd(width)}${m.model} loaded, ${plural(m.sessions, \"session\")}, ` +\n `idle ${String(Math.floor(m.idleMs / 60_000))}m`,\n ),\n // A next step a run of rows shares is said once, under the last of them.\n ...(opts.next !== false && d.next !== undefined && report.domains[i + 1]?.next !== d.next\n ? [`${indent}${d.next}`]\n : []),\n ]);\n return [head, \"\", ...rows].join(\"\\n\");\n}\n\n/**\n * The plugin skill the briefing points an agent at, as `<plugin>:<skill>`.\n * `test/plugin.test.ts` checks both halves against `plugin/manni`.\n */\nexport const FIX_SKILL = \"manni:fix\";\n\n/** The sentence the briefing and every hook block end on. */\nexport const FIX_SENTENCE = `The ${FIX_SKILL} skill says how to repair each finding.`;\n\n/** The set-wide checks a stop runs when a collection document changed, as the briefing names them. */\nconst PAGE_WIDE: ReadonlyArray<readonly [Domain, string]> = [[\"term\", \"the glossary\"]];\n\n/** `a`, `a or b`, `a, b or c`: a list in prose, joined by `conjunction`. */\nfunction prose(items: readonly string[], conjunction: string): string {\n return items.length <= 1\n ? (items[0] ?? \"\")\n : `${items.slice(0, -1).join(\", \")} ${conjunction} ${items.at(-1) ?? \"\"}`;\n}\n\n/** What an agent is told at the start of a session, after the table. */\nexport function agentLines(report: StatusReport): string {\n const names = prose(report.collections.map((c) => c.name), \"or\");\n const inPlay = new Set(report.domains.filter((d) => d.status === \"in-play\").map((d) => d.name));\n // A stop checks every citation whenever the tree changed: a source edit can drift any of them.\n const plus = inPlay.has(\"cite\") ? \", plus every citation\" : \"\";\n const pageWide = PAGE_WIDE.filter(([domain]) => inPlay.has(domain)).map(([, what]) => what);\n const also = pageWide.length === 0 ? \"\" : ` It checks ${prose(pageWide, \"and\")} too when you changed a page.`;\n return [\n `After you edit a file in ${names}, manni check runs on it, and errors come back to you at once.`,\n `Before you finish, manni check runs on every file you changed${plus}.${also} You get one repair pass.`,\n FIX_SENTENCE,\n ].join(\"\\n\");\n}\n\n/** A model id as Claude Code spells one, and nothing a shell would read as more. */\nconst MODEL_ID = /^[A-Za-z0-9._:/@-]+$/;\n\n/**\n * Append `export MANNI_GENERATED_BY=<model>` to `$CLAUDE_ENV_FILE`, so every\n * command the session runs records which model wrote what. Only when the\n * envelope names the model, the file is offered, and nobody set the variable.\n */\nexport function exportGeneratedBy(envelope: Envelope, env: NodeJS.ProcessEnv = process.env): boolean {\n const file = env.CLAUDE_ENV_FILE;\n // A context-window suffix such as `[1m]` is a session setting, not the model.\n const model = envelope.model?.replace(/\\[[^\\]]*\\]$/, \"\");\n if (model === undefined || !MODEL_ID.test(model)) return false;\n if (file === undefined || file === \"\" || env.MANNI_GENERATED_BY !== undefined) return false;\n const existing = existsSync(file) ? readFileSync(file, \"utf8\") : \"\";\n const lead = existing === \"\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