@hawkeyexl/manni 4.26.1 → 4.27.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-NEN7H55G.js → batch-TFGOULLM.js} +14 -14
- package/dist/build-TOTJTK5K.js +37 -0
- package/dist/{calibrate-3ABLKPCL.js → calibrate-7O4RKGZS.js} +15 -15
- package/dist/{capture-EOC6VNIP.js → capture-K6ZKOSIK.js} +14 -14
- package/dist/check-4LK34QVH.js +34 -0
- package/dist/check-6XN46NLH.js +31 -0
- package/dist/check-JBSRU724.js +58 -0
- package/dist/check-LZQ3PW6G.js +58 -0
- package/dist/{check-5QIOVMIM.js → check-WFJMMSD7.js} +15 -15
- package/dist/{chunk-DMTREFXP.js → chunk-2E5OBVLC.js} +4 -4
- package/dist/{chunk-MM5HXSYQ.js → chunk-2LLCV66Q.js} +9 -9
- package/dist/{chunk-ERBT4WDL.js → chunk-43KMLS4Y.js} +3 -3
- package/dist/{chunk-BREAC43H.js → chunk-43VLZO4W.js} +2 -2
- package/dist/{chunk-K4ZXCV26.js → chunk-46EEHYA4.js} +65 -12
- package/dist/chunk-46EEHYA4.js.map +1 -0
- package/dist/{chunk-TVXA4IYY.js → chunk-4KK6TVFD.js} +7 -7
- package/dist/{chunk-MMYFT7FI.js → chunk-4NCNVKZS.js} +5 -5
- package/dist/{chunk-PMX67E4G.js → chunk-4QOXP5K4.js} +6 -6
- package/dist/{chunk-6I7DQ4RL.js → chunk-5QPLKYLM.js} +4 -4
- package/dist/{chunk-IJFTUE6Y.js → chunk-5XEZ7FQT.js} +2 -2
- package/dist/{chunk-QZOJ2UXP.js → chunk-7BPOYION.js} +2 -2
- package/dist/{chunk-ZACMNF3K.js → chunk-7MKAJCU2.js} +2 -2
- package/dist/{chunk-ZACMNF3K.js.map → chunk-7MKAJCU2.js.map} +1 -1
- package/dist/{chunk-CP6QSXA7.js → chunk-A4DPDPKJ.js} +2 -2
- package/dist/{chunk-QJJI6LKA.js → chunk-ACTUV3CQ.js} +52 -4
- package/dist/chunk-ACTUV3CQ.js.map +1 -0
- package/dist/{chunk-Y23L2GNH.js → chunk-AONT5QCO.js} +10 -10
- package/dist/{chunk-7EFXQOTZ.js → chunk-AXMVISW7.js} +3 -3
- package/dist/{chunk-MC7U5IH4.js → chunk-BCRMMIY5.js} +1 -1
- package/dist/chunk-BCRMMIY5.js.map +1 -0
- package/dist/{chunk-LJDIRJLG.js → chunk-BMPQLKQS.js} +10 -8
- package/dist/chunk-BMPQLKQS.js.map +1 -0
- package/dist/{chunk-K352TYME.js → chunk-BN3SQUXK.js} +14 -14
- package/dist/{chunk-3ZVRGBK6.js → chunk-BTFXOKCP.js} +2 -2
- package/dist/{chunk-JF4BC7ZD.js → chunk-CDX4QK6O.js} +29 -2
- package/dist/chunk-CDX4QK6O.js.map +1 -0
- package/dist/{chunk-R4BRS4AE.js → chunk-CJWFDJEX.js} +9 -9
- package/dist/{chunk-3YF2DCKQ.js → chunk-D3FJVKE2.js} +3 -3
- package/dist/{chunk-ZV3VLKG4.js → chunk-DRMCY64Q.js} +15 -7
- package/dist/chunk-DRMCY64Q.js.map +1 -0
- package/dist/{chunk-Q56IULOH.js → chunk-DSTEX7SK.js} +3 -3
- package/dist/{chunk-466GMD3F.js → chunk-DZC2OALR.js} +4 -4
- package/dist/{chunk-PSXEBABJ.js → chunk-FK2FAE3J.js} +4 -4
- package/dist/{chunk-XXMPPQMJ.js → chunk-FRAEUYJE.js} +56 -27
- package/dist/chunk-FRAEUYJE.js.map +1 -0
- package/dist/{chunk-BRUD25F4.js → chunk-H7SFSZ3I.js} +300 -58
- package/dist/chunk-H7SFSZ3I.js.map +1 -0
- package/dist/chunk-HMJZHUCJ.js +337 -0
- package/dist/chunk-HMJZHUCJ.js.map +1 -0
- package/dist/{chunk-3D7VBQXN.js → chunk-HQRXE6QY.js} +354 -51
- package/dist/chunk-HQRXE6QY.js.map +1 -0
- package/dist/{chunk-OQK7J4VE.js → chunk-IFAOEGSU.js} +32 -22
- package/dist/chunk-IFAOEGSU.js.map +1 -0
- package/dist/{chunk-KP44XIY4.js → chunk-IQJ4WBJZ.js} +173 -83
- package/dist/chunk-IQJ4WBJZ.js.map +1 -0
- package/dist/{chunk-WPIBGNKM.js → chunk-JWS4OKOZ.js} +4 -4
- package/dist/{chunk-MNUGG3B4.js → chunk-K5DKRGUV.js} +6 -6
- package/dist/{chunk-KDV7GPCU.js → chunk-LESYV3TT.js} +3 -3
- package/dist/{chunk-UZ7BMGDD.js → chunk-LWWO4C6P.js} +3 -3
- package/dist/{chunk-63FAVBEK.js → chunk-MABRQ46L.js} +14 -7
- package/dist/chunk-MABRQ46L.js.map +1 -0
- package/dist/{chunk-O4MKNFMM.js → chunk-MMS3I5ZH.js} +7 -7
- package/dist/{chunk-KKCOXRSU.js → chunk-NXJMRIKW.js} +5 -5
- package/dist/{chunk-MJBGGFSN.js → chunk-OBFIWPEB.js} +3 -3
- package/dist/{chunk-TI4DA6DF.js → chunk-OPF3NOKF.js} +1 -1
- package/dist/chunk-OPF3NOKF.js.map +1 -0
- package/dist/{chunk-CLH4ZYNG.js → chunk-OZH46DBT.js} +1 -1
- package/dist/{chunk-CLH4ZYNG.js.map → chunk-OZH46DBT.js.map} +1 -1
- package/dist/{chunk-IUSVWJOF.js → chunk-PBR4TVEL.js} +7 -7
- package/dist/{chunk-LZCBMMSG.js → chunk-PHZ7VWSL.js} +31 -13
- package/dist/chunk-PHZ7VWSL.js.map +1 -0
- package/dist/{chunk-JDV6UC34.js → chunk-Q34NWLGY.js} +2 -2
- package/dist/{chunk-ZFLGCCOO.js → chunk-QFVBBRHW.js} +2 -2
- package/dist/{chunk-TDQ445D5.js → chunk-QLK6LXSS.js} +3 -3
- package/dist/{chunk-XU24F36U.js → chunk-QSABWNXP.js} +4 -4
- package/dist/{chunk-T6ZSLK7G.js → chunk-R3FCSRTX.js} +6 -6
- package/dist/{chunk-JR4CHN6I.js → chunk-RA3QM7X6.js} +8 -8
- package/dist/{chunk-OCJR7ZML.js → chunk-RCGR4NKY.js} +2 -2
- package/dist/{chunk-LFA2AMF5.js → chunk-S2ZOXAFY.js} +2 -2
- package/dist/{chunk-PAKXJGQF.js → chunk-SYZ75Q5F.js} +65 -47
- package/dist/chunk-SYZ75Q5F.js.map +1 -0
- package/dist/{chunk-NMYN46MG.js → chunk-TF4VEEDJ.js} +3 -3
- package/dist/{chunk-4I3K7QHO.js → chunk-TNOML4XE.js} +3 -3
- package/dist/{chunk-GW45SXGE.js → chunk-UVI6JXRM.js} +8 -8
- package/dist/{chunk-ZTH67IDP.js → chunk-VHAQJ6KU.js} +34 -28
- package/dist/chunk-VHAQJ6KU.js.map +1 -0
- package/dist/{chunk-SMDE7RY3.js → chunk-VLPUC4MH.js} +3 -3
- package/dist/{chunk-N2AZOLIA.js → chunk-WJ7IGOBI.js} +21 -12
- package/dist/chunk-WJ7IGOBI.js.map +1 -0
- package/dist/{chunk-3MYJ6BI6.js → chunk-WLN4A2OJ.js} +4 -4
- package/dist/{chunk-RGOULVBF.js → chunk-WNL2T7LK.js} +4 -4
- package/dist/{chunk-PLUIVONN.js → chunk-WOPKA4ZB.js} +3 -3
- package/dist/{chunk-VK34UKBY.js → chunk-X3FSKK53.js} +13 -7
- package/dist/chunk-X3FSKK53.js.map +1 -0
- package/dist/{chunk-XX7GNK4F.js → chunk-XZFJAVX7.js} +3 -3
- package/dist/{chunk-WSRK3PN4.js → chunk-Y72JZVMX.js} +3 -3
- package/dist/{chunk-KBZM4HI2.js → chunk-YQ4XWJTB.js} +26 -16
- package/dist/chunk-YQ4XWJTB.js.map +1 -0
- package/dist/{chunk-K7UK72VN.js → chunk-YUTRYEDG.js} +3 -3
- package/dist/{chunk-H7UPMVBK.js → chunk-Z3YNYZR2.js} +2 -2
- package/dist/{chunk-XDARBEJA.js → chunk-Z66LHZRV.js} +2 -2
- package/dist/{chunk-G5I2JTDK.js → chunk-ZWVYT2G6.js} +2 -2
- package/dist/{chunk-D4BGNAN5.js → chunk-ZZGHTXZ2.js} +159 -23
- package/dist/chunk-ZZGHTXZ2.js.map +1 -0
- package/dist/{cli-BIRTWKQ5.js → cli-4Q22IFXX.js} +16 -15
- package/dist/{cli-BIRTWKQ5.js.map → cli-4Q22IFXX.js.map} +1 -1
- package/dist/{cli-EYDOJUG7.js → cli-6Y2V6OI6.js} +29 -28
- package/dist/{cli-EYDOJUG7.js.map → cli-6Y2V6OI6.js.map} +1 -1
- package/dist/{cli-HBVAUPIC.js → cli-A3E4KJ5U.js} +21 -21
- package/dist/{cli-XGY7JUEI.js → cli-H4SH5A6M.js} +37 -36
- package/dist/{cli-XGY7JUEI.js.map → cli-H4SH5A6M.js.map} +1 -1
- package/dist/{cli-RJTB3BWZ.js → cli-ODMYZEFY.js} +68 -58
- package/dist/{cli-RJTB3BWZ.js.map → cli-ODMYZEFY.js.map} +1 -1
- package/dist/{cli-V3UM6B6F.js → cli-PKCV3N4H.js} +8 -8
- package/dist/{cli-HRQCVZQY.js → cli-QQIIFRKE.js} +20 -19
- package/dist/{cli-HRQCVZQY.js.map → cli-QQIIFRKE.js.map} +1 -1
- package/dist/{cli-XDPMDMZU.js → cli-SN7N4WCV.js} +29 -28
- package/dist/{cli-XDPMDMZU.js.map → cli-SN7N4WCV.js.map} +1 -1
- package/dist/{cli-VI76NFWN.js → cli-WFC3CJOJ.js} +3 -3
- package/dist/{cli-KOATS2ZY.js → cli-YP5KKGZP.js} +30 -29
- package/dist/{cli-KOATS2ZY.js.map → cli-YP5KKGZP.js.map} +1 -1
- package/dist/{cli-S36TXD3Z.js → cli-Z6IVPISQ.js} +24 -42
- package/dist/cli-Z6IVPISQ.js.map +1 -0
- package/dist/cli.js +15 -15
- package/dist/{config-2YJPJ36T.js → config-Z3FYLJ6X.js} +3 -3
- package/dist/docmeta.js +7 -7
- package/dist/github-7MZOPO6F.js +49 -0
- package/dist/github-MERFCTC7.js +29 -0
- package/dist/{github-KGQPHQQJ.js → github-MQPACOAB.js} +15 -14
- package/dist/index.d.ts +169 -8
- package/dist/index.js +58 -57
- package/dist/index.js.map +1 -1
- package/dist/{json-5GDD64P6.js → json-7RZPISH3.js} +13 -12
- package/dist/{json-BO5XIJWF.js → json-GOM7GQ6C.js} +16 -15
- package/dist/{labels-N7GKDSDM.js → labels-3ZOCWOT6.js} +12 -11
- package/dist/{labels-N7GKDSDM.js.map → labels-3ZOCWOT6.js.map} +1 -1
- package/dist/lint-XQMOP6UX.js +33 -0
- package/dist/{list-ZQJOVVUU.js → list-5PR56LNP.js} +15 -14
- package/dist/list-AV4DCGP3.js +31 -0
- package/dist/list-PLVWVFAV.js +49 -0
- package/dist/{page-WXPSHZJY.js → page-7EML6WFG.js} +10 -10
- package/dist/{prepare-V76CXWW4.js → prepare-A7NZ5BPZ.js} +13 -13
- package/dist/{pretty-RTIATRSO.js → pretty-5QHFDOSO.js} +15 -14
- package/dist/{pretty-AR6FVUJO.js → pretty-E4FJRLZZ.js} +25 -24
- package/dist/{pretty-VOC2SKHD.js → pretty-Y4UZL35B.js} +13 -12
- package/dist/{reporters-LJZLZDFQ.js → reporters-A63SJIY7.js} +12 -12
- package/dist/{reporters-A4VULNIK.js → reporters-BFST46C2.js} +5 -5
- package/dist/{reporters-6CNOPRDA.js → reporters-MK62LRGW.js} +4 -4
- package/dist/run-2MWSIAGL.js +52 -0
- package/dist/{sarif-TMQEXFHP.js → sarif-BBNFOFUZ.js} +9 -9
- package/dist/sarif-MDBTPWQN.js +50 -0
- package/dist/{sarif-UHITXNLM.js → sarif-MTFYXIRJ.js} +11 -11
- package/dist/{strategy-TGJGFZHD.js → strategy-3EJODC6O.js} +22 -21
- package/dist/{term-GJURJ3FM.js → term-UYCZLVVA.js} +19 -18
- package/dist/{term-GJURJ3FM.js.map → term-UYCZLVVA.js.map} +1 -1
- package/dist/{types-VWL35P4F.js → types-GV2THIRC.js} +2 -2
- package/dist/{validate-YTMGOZAP.js → validate-3C3RWYMR.js} +5 -5
- package/package.json +1 -1
- package/plugin/manni/.claude-plugin/plugin.json +1 -1
- package/plugin/manni/hooks/page-metadata.mjs +1 -1
- package/dist/build-UYQEHJ2O.js +0 -36
- package/dist/check-34N4PI6C.js +0 -57
- package/dist/check-7SUZMJDK.js +0 -33
- package/dist/check-D7W7CUPQ.js +0 -30
- package/dist/check-RFLS3OB4.js +0 -57
- package/dist/chunk-3D7VBQXN.js.map +0 -1
- package/dist/chunk-63FAVBEK.js.map +0 -1
- package/dist/chunk-BRUD25F4.js.map +0 -1
- package/dist/chunk-D4BGNAN5.js.map +0 -1
- package/dist/chunk-JF4BC7ZD.js.map +0 -1
- package/dist/chunk-K4ZXCV26.js.map +0 -1
- package/dist/chunk-KBZM4HI2.js.map +0 -1
- package/dist/chunk-KP44XIY4.js.map +0 -1
- package/dist/chunk-LJDIRJLG.js.map +0 -1
- package/dist/chunk-LZCBMMSG.js.map +0 -1
- package/dist/chunk-MC7U5IH4.js.map +0 -1
- package/dist/chunk-N2AZOLIA.js.map +0 -1
- package/dist/chunk-OQK7J4VE.js.map +0 -1
- package/dist/chunk-PAKXJGQF.js.map +0 -1
- package/dist/chunk-QJJI6LKA.js.map +0 -1
- package/dist/chunk-TI4DA6DF.js.map +0 -1
- package/dist/chunk-VK34UKBY.js.map +0 -1
- package/dist/chunk-XXMPPQMJ.js.map +0 -1
- package/dist/chunk-ZTH67IDP.js.map +0 -1
- package/dist/chunk-ZV3VLKG4.js.map +0 -1
- package/dist/cli-S36TXD3Z.js.map +0 -1
- package/dist/github-EKVVPQPD.js +0 -48
- package/dist/github-FQ5MCP3E.js +0 -28
- package/dist/lint-U6VEL4ZA.js +0 -32
- package/dist/list-5LRPJRJJ.js +0 -48
- package/dist/list-GWP3Y2SR.js +0 -30
- package/dist/run-4B25K2SV.js +0 -51
- package/dist/sarif-Z34PKKFQ.js +0 -49
- /package/dist/{batch-NEN7H55G.js.map → batch-TFGOULLM.js.map} +0 -0
- /package/dist/{build-UYQEHJ2O.js.map → build-TOTJTK5K.js.map} +0 -0
- /package/dist/{calibrate-3ABLKPCL.js.map → calibrate-7O4RKGZS.js.map} +0 -0
- /package/dist/{capture-EOC6VNIP.js.map → capture-K6ZKOSIK.js.map} +0 -0
- /package/dist/{check-34N4PI6C.js.map → check-4LK34QVH.js.map} +0 -0
- /package/dist/{check-7SUZMJDK.js.map → check-6XN46NLH.js.map} +0 -0
- /package/dist/{check-D7W7CUPQ.js.map → check-JBSRU724.js.map} +0 -0
- /package/dist/{check-RFLS3OB4.js.map → check-LZQ3PW6G.js.map} +0 -0
- /package/dist/{check-5QIOVMIM.js.map → check-WFJMMSD7.js.map} +0 -0
- /package/dist/{chunk-DMTREFXP.js.map → chunk-2E5OBVLC.js.map} +0 -0
- /package/dist/{chunk-MM5HXSYQ.js.map → chunk-2LLCV66Q.js.map} +0 -0
- /package/dist/{chunk-ERBT4WDL.js.map → chunk-43KMLS4Y.js.map} +0 -0
- /package/dist/{chunk-BREAC43H.js.map → chunk-43VLZO4W.js.map} +0 -0
- /package/dist/{chunk-TVXA4IYY.js.map → chunk-4KK6TVFD.js.map} +0 -0
- /package/dist/{chunk-MMYFT7FI.js.map → chunk-4NCNVKZS.js.map} +0 -0
- /package/dist/{chunk-PMX67E4G.js.map → chunk-4QOXP5K4.js.map} +0 -0
- /package/dist/{chunk-6I7DQ4RL.js.map → chunk-5QPLKYLM.js.map} +0 -0
- /package/dist/{chunk-IJFTUE6Y.js.map → chunk-5XEZ7FQT.js.map} +0 -0
- /package/dist/{chunk-QZOJ2UXP.js.map → chunk-7BPOYION.js.map} +0 -0
- /package/dist/{chunk-CP6QSXA7.js.map → chunk-A4DPDPKJ.js.map} +0 -0
- /package/dist/{chunk-Y23L2GNH.js.map → chunk-AONT5QCO.js.map} +0 -0
- /package/dist/{chunk-7EFXQOTZ.js.map → chunk-AXMVISW7.js.map} +0 -0
- /package/dist/{chunk-K352TYME.js.map → chunk-BN3SQUXK.js.map} +0 -0
- /package/dist/{chunk-3ZVRGBK6.js.map → chunk-BTFXOKCP.js.map} +0 -0
- /package/dist/{chunk-R4BRS4AE.js.map → chunk-CJWFDJEX.js.map} +0 -0
- /package/dist/{chunk-3YF2DCKQ.js.map → chunk-D3FJVKE2.js.map} +0 -0
- /package/dist/{chunk-Q56IULOH.js.map → chunk-DSTEX7SK.js.map} +0 -0
- /package/dist/{chunk-466GMD3F.js.map → chunk-DZC2OALR.js.map} +0 -0
- /package/dist/{chunk-PSXEBABJ.js.map → chunk-FK2FAE3J.js.map} +0 -0
- /package/dist/{chunk-WPIBGNKM.js.map → chunk-JWS4OKOZ.js.map} +0 -0
- /package/dist/{chunk-MNUGG3B4.js.map → chunk-K5DKRGUV.js.map} +0 -0
- /package/dist/{chunk-KDV7GPCU.js.map → chunk-LESYV3TT.js.map} +0 -0
- /package/dist/{chunk-UZ7BMGDD.js.map → chunk-LWWO4C6P.js.map} +0 -0
- /package/dist/{chunk-O4MKNFMM.js.map → chunk-MMS3I5ZH.js.map} +0 -0
- /package/dist/{chunk-KKCOXRSU.js.map → chunk-NXJMRIKW.js.map} +0 -0
- /package/dist/{chunk-MJBGGFSN.js.map → chunk-OBFIWPEB.js.map} +0 -0
- /package/dist/{chunk-IUSVWJOF.js.map → chunk-PBR4TVEL.js.map} +0 -0
- /package/dist/{chunk-JDV6UC34.js.map → chunk-Q34NWLGY.js.map} +0 -0
- /package/dist/{chunk-ZFLGCCOO.js.map → chunk-QFVBBRHW.js.map} +0 -0
- /package/dist/{chunk-TDQ445D5.js.map → chunk-QLK6LXSS.js.map} +0 -0
- /package/dist/{chunk-XU24F36U.js.map → chunk-QSABWNXP.js.map} +0 -0
- /package/dist/{chunk-T6ZSLK7G.js.map → chunk-R3FCSRTX.js.map} +0 -0
- /package/dist/{chunk-JR4CHN6I.js.map → chunk-RA3QM7X6.js.map} +0 -0
- /package/dist/{chunk-OCJR7ZML.js.map → chunk-RCGR4NKY.js.map} +0 -0
- /package/dist/{chunk-LFA2AMF5.js.map → chunk-S2ZOXAFY.js.map} +0 -0
- /package/dist/{chunk-NMYN46MG.js.map → chunk-TF4VEEDJ.js.map} +0 -0
- /package/dist/{chunk-4I3K7QHO.js.map → chunk-TNOML4XE.js.map} +0 -0
- /package/dist/{chunk-GW45SXGE.js.map → chunk-UVI6JXRM.js.map} +0 -0
- /package/dist/{chunk-SMDE7RY3.js.map → chunk-VLPUC4MH.js.map} +0 -0
- /package/dist/{chunk-3MYJ6BI6.js.map → chunk-WLN4A2OJ.js.map} +0 -0
- /package/dist/{chunk-RGOULVBF.js.map → chunk-WNL2T7LK.js.map} +0 -0
- /package/dist/{chunk-PLUIVONN.js.map → chunk-WOPKA4ZB.js.map} +0 -0
- /package/dist/{chunk-XX7GNK4F.js.map → chunk-XZFJAVX7.js.map} +0 -0
- /package/dist/{chunk-WSRK3PN4.js.map → chunk-Y72JZVMX.js.map} +0 -0
- /package/dist/{chunk-K7UK72VN.js.map → chunk-YUTRYEDG.js.map} +0 -0
- /package/dist/{chunk-H7UPMVBK.js.map → chunk-Z3YNYZR2.js.map} +0 -0
- /package/dist/{chunk-XDARBEJA.js.map → chunk-Z66LHZRV.js.map} +0 -0
- /package/dist/{chunk-G5I2JTDK.js.map → chunk-ZWVYT2G6.js.map} +0 -0
- /package/dist/{cli-HBVAUPIC.js.map → cli-A3E4KJ5U.js.map} +0 -0
- /package/dist/{cli-V3UM6B6F.js.map → cli-PKCV3N4H.js.map} +0 -0
- /package/dist/{cli-VI76NFWN.js.map → cli-WFC3CJOJ.js.map} +0 -0
- /package/dist/{config-2YJPJ36T.js.map → config-Z3FYLJ6X.js.map} +0 -0
- /package/dist/{github-EKVVPQPD.js.map → github-7MZOPO6F.js.map} +0 -0
- /package/dist/{github-FQ5MCP3E.js.map → github-MERFCTC7.js.map} +0 -0
- /package/dist/{github-KGQPHQQJ.js.map → github-MQPACOAB.js.map} +0 -0
- /package/dist/{json-5GDD64P6.js.map → json-7RZPISH3.js.map} +0 -0
- /package/dist/{json-BO5XIJWF.js.map → json-GOM7GQ6C.js.map} +0 -0
- /package/dist/{lint-U6VEL4ZA.js.map → lint-XQMOP6UX.js.map} +0 -0
- /package/dist/{list-5LRPJRJJ.js.map → list-5PR56LNP.js.map} +0 -0
- /package/dist/{list-GWP3Y2SR.js.map → list-AV4DCGP3.js.map} +0 -0
- /package/dist/{list-ZQJOVVUU.js.map → list-PLVWVFAV.js.map} +0 -0
- /package/dist/{page-WXPSHZJY.js.map → page-7EML6WFG.js.map} +0 -0
- /package/dist/{prepare-V76CXWW4.js.map → prepare-A7NZ5BPZ.js.map} +0 -0
- /package/dist/{pretty-AR6FVUJO.js.map → pretty-5QHFDOSO.js.map} +0 -0
- /package/dist/{pretty-RTIATRSO.js.map → pretty-E4FJRLZZ.js.map} +0 -0
- /package/dist/{pretty-VOC2SKHD.js.map → pretty-Y4UZL35B.js.map} +0 -0
- /package/dist/{reporters-6CNOPRDA.js.map → reporters-A63SJIY7.js.map} +0 -0
- /package/dist/{reporters-A4VULNIK.js.map → reporters-BFST46C2.js.map} +0 -0
- /package/dist/{reporters-LJZLZDFQ.js.map → reporters-MK62LRGW.js.map} +0 -0
- /package/dist/{run-4B25K2SV.js.map → run-2MWSIAGL.js.map} +0 -0
- /package/dist/{sarif-TMQEXFHP.js.map → sarif-BBNFOFUZ.js.map} +0 -0
- /package/dist/{sarif-UHITXNLM.js.map → sarif-MDBTPWQN.js.map} +0 -0
- /package/dist/{sarif-Z34PKKFQ.js.map → sarif-MTFYXIRJ.js.map} +0 -0
- /package/dist/{strategy-TGJGFZHD.js.map → strategy-3EJODC6O.js.map} +0 -0
- /package/dist/{types-VWL35P4F.js.map → types-GV2THIRC.js.map} +0 -0
- /package/dist/{validate-YTMGOZAP.js.map → validate-3C3RWYMR.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
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","../src/graph/commands/serve-fit.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/** `--no-authoring` (proposal 0110), worded once for the four verbs that build from pages. */\nconst NO_AUTHORING_HELP =\n \"Leave out author-facing content: strategy records, and every field its schemas prefer in a sidecar (default: config authoring)\";\n\n/**\n * `--no-authoring` as a core takes it. Commander supplies `true` when the\n * flag is absent, so only an explicit `false` overrides `graph.authoring`.\n */\nfunction authoringOption(value: boolean | undefined): { authoring?: false } {\n return value === false ? { authoring: false } : {};\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 .option(\"--no-authoring\", NO_AUTHORING_HELP)\n .action(async (paths: string[], opts: InputFlags & {\n config?: string | boolean;\n collection?: string[];\n exclude?: string[];\n out?: string;\n authoring?: boolean;\n }) => {\n try {\n const result = await runBuild({\n paths,\n ...documentOptions(opts),\n ...(await inputOptions(paths, opts)),\n out: opts.out,\n ...authoringOption(opts.authoring),\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 const records = result.strategyRecords;\n const strategy = records > 0 ? `, ${records} strategy record${records === 1 ? \"\" : \"s\"}` : \"\";\n console.log(\n `Wrote ${result.outPath} (${result.docs} docs, ${result.quads} triples, ${total} concepts${termbase}${strategy})`,\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 .option(\n \"--publish\",\n \"Publish the graph first when its artifact is missing or older than the checkout, and again after the checkout changes\",\n )\n .option(\"--no-authoring\", NO_AUTHORING_HELP)\n .action(\n async (opts: {\n config?: string | boolean;\n graph?: string;\n index?: string;\n withhold?: WithholdReason[];\n publish?: boolean;\n authoring?: boolean;\n }) => {\n try {\n const { authoring, ...others } = rest(opts);\n process.exitCode = await runServe({ ...others, ...documentOptions(opts), ...authoringOption(authoring) });\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 .option(\"--no-authoring\", NO_AUTHORING_HELP)\n .action(\n async (\n target: string,\n opts: { config?: string | boolean; graph?: string; out?: string; evals?: string; authoring?: boolean },\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 ...authoringOption(opts.authoring),\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(\"--collection <name>\", \"Configured collection to read (repeatable)\", collect, [])\n .option(\"--no-authoring\", NO_AUTHORING_HELP)\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 out?: string;\n evals?: string;\n collection: string[];\n authoring?: boolean;\n format: GraphFormat;\n }) => {\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 ...authoringOption(opts.authoring),\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.4.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 dependency, 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 * Each answer goes out compacted and capped at `graph.serve.maxChars`\n * (`serve-fit.ts`); the CLI twins print the full result.\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 { existsSync, readFileSync, statSync } from \"node:fs\";\nimport { basename, dirname, join, relative, resolve, sep } from \"node:path\";\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, warn } from \"../../shared/warn.js\";\nimport { loadRunConfig } from \"../core/config.js\";\nimport { checkoutStatus, type CheckoutStatus } from \"../core/git.js\";\nimport { byCodeUnit } from \"../core/sort.js\";\nimport type { WithholdReason } from \"../runtime/chunks.js\";\nimport { parseChunksManifest, type LookupResult, type PassageBundle, type WhereCondition } from \"../runtime/retrieve.js\";\nimport { GraphError } from \"../types.js\";\nimport { NO_AUTHORING_NEEDS_PUBLISH } from \"../core/graph-output.js\";\nimport { CHUNKS_MANIFEST } from \"./chunks.js\";\nimport { runPublish, type PublishOptions } from \"./publish.js\";\nimport { lookupIn, openArtifact, retrieveIn, traverseIn, type Artifact, type ArtifactOptions } from \"./retrieve.js\";\nimport { fitAnswer, type ServedAnswer } from \"./serve-fit.js\";\n\nexport interface ServeOptions extends ArtifactOptions {\n /** Tightens the trust floor for every call. */\n withhold?: WithholdReason[];\n /** `--publish`: publish a stale artifact behind the handshake, and again after the checkout changes. */\n publish?: boolean;\n /**\n * `--no-authoring` passes `false` (proposal 0110): what `--publish` builds\n * leaves author-facing content out. It overrides `graph.authoring`, and\n * needs `publish`.\n */\n authoring?: boolean;\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 /** Injection seam for tests: what `--publish` runs, `runPublish` by default. */\n publish?: (opts: PublishOptions) => Promise<unknown>;\n}\n\nasync function importSdk(): Promise<McpSdk> {\n // Literal specifiers, so the Node build leaves them bare: an optional dependency.\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 = { type: \"object\", required: [\"entry\", \"withheld\", \"filtered\"] };\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: NULLABLE_TEXT,\n page: { type: \"string\" },\n depth: { type: \"integer\" },\n role: { type: \"string\", enum: [\"match\", \"context\", \"dependent\"] },\n truncated: { type: \"boolean\" },\n provenance: PROOF,\n },\n required: [\"iri\", \"text\", \"page\", \"depth\", \"role\"],\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\", ...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 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 with text has its source and proof: pin status, dates and eval verdicts. \" +\n \"When the answer runs long, the lowest-priority passages come back as references with no text. \" +\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// ---- --publish ----------------------------------------------------------------\n\nconst RUN_PUBLISH = \"; run manni graph publish.\";\n\n/** The artifact `--publish` keeps current: each call's artifact, or the failure text it answers with. */\ninterface Publisher {\n /** Settles once the start-up check, and any publish it ran, is done: with the failure text, or nothing. */\n start: () => Promise<string | undefined>;\n current: () => Promise<Artifact | string>;\n /** Every publish still running. */\n running: () => Promise<unknown>[];\n}\n\nfunction publisher(opts: ServeOptions, seams: ServeSeams): Publisher {\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 // A bad config fails here, before the handshake, as a plain serve does.\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 index = opts.index === undefined ? dirname(configured) : resolve(cwd, opts.index);\n const target: ArtifactOptions = { ...opts, graph: join(index, basename(configured)), index };\n const shown = (path: string): string => relative(cwd, path).split(\"\\\\\").join(\"/\");\n const publish = seams.publish ?? runPublish;\n\n /** HEAD and every changed file's path, size and mtime, leaving out what publish itself writes. */\n const fingerprint = (state: CheckoutStatus | null): string | null => {\n if (state === null) return null;\n const lines = changed(state).map((abs) => {\n try {\n const s = statSync(abs);\n return `${abs}\\t${String(s.size)}\\t${String(s.mtimeMs)}`;\n } catch {\n return `${abs}\\tgone`;\n }\n });\n return [state.head, ...lines].join(\"\\n\");\n };\n const changed = (state: CheckoutStatus): string[] =>\n state.paths\n .map((p) => resolve(state.root, p))\n .filter((abs) => abs !== index && !abs.startsWith(index + sep))\n .sort(byCodeUnit);\n\n let artifact: Artifact | undefined;\n let failed: string | undefined;\n let baseline: string | null = null;\n let inflight: Promise<string | undefined> | undefined;\n const publishing = (): Promise<string | undefined> | undefined => inflight;\n\n /** Why the artifact on disk cannot be served as it is, or nothing; opens it when it can. */\n const staleness = (state: CheckoutStatus | null): string | undefined => {\n try {\n artifact = openArtifact(target);\n } catch (e) {\n if (!(e instanceof GraphError)) throw e;\n if (e.message.endsWith(RUN_PUBLISH)) return e.message.slice(0, -RUN_PUBLISH.length);\n const graph = target.graph ?? \"\";\n return existsSync(graph) ? e.message.replace(/\\.$/, \"\") : `${shown(graph)} does not exist`;\n }\n const { commit } = parseChunksManifest(readFileSync(join(index, CHUNKS_MANIFEST), \"utf8\"));\n if (commit === null) return \"it records no commit\";\n if (state === null) return undefined;\n if (commit !== state.head) return `it was built at ${commit.slice(0, 7)} and HEAD is ${state.head.slice(0, 7)}`;\n if (changed(state).length > 0) return \"the working tree has changes\";\n return undefined;\n };\n\n /** One publish, from the checkout `print` names. The previous artifact stays when it fails. */\n const run = async (print: string | null): Promise<string | undefined> => {\n baseline = print;\n const began = performance.now();\n try {\n await publish({\n ...source,\n out: index,\n ...(opts.authoring === undefined ? {} : { authoring: opts.authoring }),\n say: (kind, message) => {\n if (kind === \"warning\") warn(message);\n else notice(message);\n },\n });\n artifact = openArtifact(target);\n } catch (e) {\n const said = errorMessage(e);\n notice(said);\n return `${said.replace(/\\.$/, \"\")}. Run manni graph publish to see the whole report.`;\n }\n notice(`published the graph in ${((performance.now() - began) / 1000).toFixed(1)}s.`);\n return undefined;\n };\n\n let ready: Promise<string | undefined> | undefined;\n const start = (): Promise<string | undefined> =>\n (ready ??= (async () => {\n try {\n const state = await checkoutStatus(cwd);\n const reason = staleness(state);\n if (reason === undefined) baseline = fingerprint(state);\n else {\n notice(`publishing the graph before serving it: ${reason}.`);\n failed = await run(fingerprint(state));\n }\n } catch (e) {\n failed = errorMessage(e);\n notice(failed);\n }\n if (failed === undefined) {\n notice(`serving lookup, retrieve, traverse and impact over stdio from ${shown(join(index, CHUNKS_MANIFEST))}.`);\n }\n return failed;\n })());\n\n /** Republish when the checkout moved since the last publish began. Concurrent calls share one publish. */\n const fresh = async (): Promise<string | undefined> => {\n if (inflight !== undefined) return inflight;\n if (baseline === null) return undefined;\n const now = fingerprint(await checkoutStatus(cwd));\n // Read again, through a call the compiler cannot narrow: another call may have begun a publish while git ran.\n const begun = publishing();\n if (begun !== undefined) return begun;\n if (now === baseline) return undefined;\n notice(\"republishing the graph: the checkout changed since the last publish.\");\n inflight = run(now).finally(() => (inflight = undefined));\n return inflight;\n };\n\n return {\n start,\n current: async () => {\n const startup = await start();\n if (startup !== undefined) return startup;\n const later = await fresh();\n return later ?? artifact ?? \"graph serve has no artifact to answer from.\";\n },\n running: () => [...(ready === undefined ? [] : [ready]), ...(inflight === undefined ? [] : [inflight])],\n };\n}\n\n/**\n * Serve until stdin closes. Resolves then with the exit code: 0, or 2 when\n * `--publish` could not publish at start. A missing SDK, a missing artifact\n * or one built from another graph rejects with a `GraphError`, exit 2, before\n * anything is served. With `--publish`, those three publish instead, behind\n * the handshake.\n */\nexport async function runServe(opts: ServeOptions, seams: ServeSeams = {}): Promise<number> {\n if (opts.authoring === false && opts.publish !== true) throw new GraphError(NO_AUTHORING_NEEDS_PUBLISH);\n if (opts.publish === true && opts.graph !== undefined) {\n throw new GraphError(\n \"--publish writes graph.ttl into the index directory, so it cannot be combined with --graph. Use --index to choose the directory.\",\n );\n }\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 // Plain: one artifact, opened now. `--publish`: whatever its publisher holds when a call arrives.\n const kept = opts.publish === true ? publisher(opts, seams) : undefined;\n let opened: Artifact | undefined;\n let current: () => Promise<Artifact | string>;\n if (kept === undefined) {\n const artifact = openArtifact(opts);\n opened = artifact;\n current = () => Promise.resolve(artifact);\n } else {\n current = kept.current;\n }\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 = (async (): Promise<string | ServedAnswer> => {\n const held = await current();\n if (typeof held === \"string\") return held;\n return fitAnswer(await answer(held, name as ToolName, args, opts.withhold), held.config.serve.maxChars);\n })();\n pending.add(work);\n try {\n const result = await work;\n if (typeof result === \"string\") return fault(result);\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 if (opened !== undefined) notice(`serving lookup, retrieve, traverse and impact over stdio from ${opened.label}.`);\n // Behind the handshake: a client's initialize timeout does not wait for a publish.\n const startup = kept?.start();\n await closed;\n // A publish in progress finishes, so no artifact is left half-written.\n await Promise.allSettled([...pending, ...(kept?.running() ?? [])]);\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 return (await startup) === undefined ? 0 : 2;\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 { EVALS_ARE_AUTHOR_FACING } from \"../core/graph-output.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 /** `--collection`, repeatable: the collections the build reads (default: every one). */\n collection?: string[];\n /** `--no-authoring` passes `false` (proposal 0110). Overrides `graph.authoring`. */\n authoring?: boolean;\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 authoring = opts.authoring ?? config.authoring;\n if (!authoring && opts.evals !== undefined) throw new GraphError(EVALS_ARE_AUTHOR_FACING);\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({\n ...source,\n graph,\n format,\n ...(out === undefined ? {} : { out }),\n ...(format === \"chunks\" && opts.evals !== undefined ? { evals: opts.evals } : {}),\n // The build already left author-facing content out of the graph the others reserialize.\n ...(!authoring && (format === \"chunks\" || format === \"llms\") ? { authoring } : {}),\n });\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 // Only the build reads documents; every later step reads what it built.\n const r = await runBuild({\n ...source,\n ...(opts.collection === undefined ? {} : { collection: opts.collection }),\n out: graph,\n ...(authoring ? {} : { authoring }),\n });\n const records = r.strategyRecords > 0 ? `, ${plural(r.strategyRecords, \"strategy record\")}` : \"\";\n return {\n detail: `${shown(r.outPath)}: ${plural(r.docs, \"page\")}, ${plural(r.quads, \"triple\")}${records}`,\n files: [r.outPath],\n warnings: r.warnings,\n };\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","/**\n * What `graph serve` sends for one answer: the full result its CLI twin\n * prints, made to fit an agent's context. Pure, and the result it is given is\n * left as it was, because the CLI and the runtime return it whole.\n *\n * Compact first. The trace keeps `entry`, `withheld` and `filtered`, and\n * leaves out the walk diagnostics. A passage with no text carries no proof,\n * and `pages` names only the pages of passages that carry text.\n *\n * Then the cap. While the JSON is longer than `maxChars`, passages become\n * references in reverse priority. On a lookup the walks' passages go first,\n * then the walks' edges from the end, and the matches last, so the passages\n * that answer the question keep their text longest. A refusal is small, and\n * goes out as it is.\n */\nimport type { ProvenanceRecord } from \"../runtime/chunks.js\";\nimport type { LookupEdge, LookupResult, PassageBundle, PassageRole, RetrievalTrace } from \"../runtime/retrieve.js\";\n\n/** One passage as served: its text and proof, or, reduced, a reference to read it by. */\nexport interface ServedPassage {\n iri: string;\n title?: string;\n page: string;\n lines?: string;\n text: string | null;\n truncated?: boolean;\n provenance?: ProvenanceRecord;\n sourceUrl?: string;\n rank?: number;\n score?: { lexical?: number | null; vector?: number | null; fused: number };\n depth?: number;\n role?: PassageRole;\n}\n\ninterface ServedSection {\n passages: ServedPassage[];\n truncated: boolean;\n}\n\ninterface ServedWalk extends ServedSection {\n edges: LookupEdge[];\n}\n\ntype ServedTrace = Pick<RetrievalTrace, \"entry\" | \"withheld\" | \"filtered\">;\ntype Pages = PassageBundle[\"pages\"];\n\nexport interface ServedLookup extends Omit<LookupResult, \"matches\" | \"traversal\" | \"impact\" | \"trace\"> {\n matches: ServedSection;\n traversal: ServedWalk;\n impact: ServedWalk;\n trace: ServedTrace;\n}\n\nexport interface ServedBundle extends Omit<PassageBundle, \"context\" | \"trace\"> {\n context: ServedPassage[];\n trace: ServedTrace;\n}\n\nexport type ServedAnswer = ServedLookup | ServedBundle;\n\n/** A passage with text keeps its proof; one without leaves it out. */\nfunction proofed(p: ServedPassage): ServedPassage {\n if (p.text !== null) return p;\n const { provenance, ...rest } = p;\n return rest;\n}\n\n/** A passage reduced to where it is and where it ranks. */\nfunction reference(p: ServedPassage): ServedPassage {\n return {\n iri: p.iri,\n ...(p.title === undefined ? {} : { title: p.title }),\n page: p.page,\n ...(p.lines === undefined ? {} : { lines: p.lines }),\n ...(p.rank === undefined ? {} : { rank: p.rank }),\n ...(p.score === undefined ? {} : { score: { fused: p.score.fused } }),\n ...(p.depth === undefined ? {} : { depth: p.depth }),\n ...(p.role === undefined ? {} : { role: p.role }),\n text: null,\n truncated: true,\n };\n}\n\n/** The pages of `all` that a passage with text names. */\nfunction texted(all: Pages, passages: readonly ServedPassage[]): Pages {\n const named = new Set(passages.filter((p) => p.text !== null).map((p) => p.page));\n return Object.fromEntries(Object.entries(all).filter(([page]) => named.has(page)));\n}\n\n/** One passage the cap may reduce, and the section whose `truncated` it sets. */\ninterface Slot {\n list: ServedPassage[];\n index: number;\n owner: { truncated: boolean };\n}\n\nconst slotsOf = (list: ServedPassage[], owner: { truncated: boolean }): Slot[] =>\n list.map((_, index) => ({ list, index, owner }));\n\n/** A walk's passages, deepest first, then later ones first at equal depth. */\nconst deepestFirst = (s: ServedSection): Slot[] =>\n slotsOf(s.passages, s).sort(\n (a, b) => (b.list[b.index]?.depth ?? 0) - (a.list[a.index]?.depth ?? 0) || b.index - a.index,\n );\n\n/** Matches, lowest-ranked first. */\nconst lowestRankedFirst = (s: ServedSection): Slot[] =>\n slotsOf(s.passages, s).sort((a, b) => (b.list[b.index]?.rank ?? b.index) - (a.list[a.index]?.rank ?? a.index));\n\n/**\n * Run each stage until `out` fits: a list of passages to reduce in order, or\n * a walk whose edges go from the end.\n */\nfunction cap(out: ServedAnswer, maxChars: number, stages: readonly (Slot[] | ServedWalk)[], sync: () => void): void {\n // ponytail: one stringify per step; an incremental length if answers grow to thousands of steps.\n const over = (): boolean => JSON.stringify(out).length > maxChars;\n for (const stage of stages) {\n if (!Array.isArray(stage)) {\n while (stage.edges.length > 0 && over()) {\n stage.edges.pop();\n stage.truncated = true;\n }\n continue;\n }\n for (const { list, index, owner } of stage) {\n if (!over()) return;\n const p = list[index];\n if (p === undefined) continue;\n list[index] = reference(p);\n owner.truncated = true;\n sync();\n }\n }\n}\n\n/** The answer `graph serve` sends: compact, then within `maxChars` characters of JSON where it can be. */\nexport function fitAnswer(answer: LookupResult | PassageBundle, maxChars: number): ServedAnswer {\n if (answer.refusal !== undefined) return answer;\n const trace: ServedTrace = {\n entry: answer.trace.entry,\n withheld: answer.trace.withheld,\n filtered: answer.trace.filtered,\n };\n if (\"matches\" in answer) {\n const out: ServedLookup = {\n ...answer,\n matches: { ...answer.matches, passages: answer.matches.passages.map(proofed) },\n traversal: { ...answer.traversal, passages: answer.traversal.passages.map(proofed), edges: [...answer.traversal.edges] },\n impact: { ...answer.impact, passages: answer.impact.passages.map(proofed), edges: [...answer.impact.edges] },\n trace,\n };\n const sync = (): void => {\n out.pages = texted(answer.pages, [...out.matches.passages, ...out.traversal.passages, ...out.impact.passages]);\n };\n sync();\n const stages = [\n [...deepestFirst(out.impact), ...deepestFirst(out.traversal)],\n out.impact,\n out.traversal,\n lowestRankedFirst(out.matches),\n ];\n cap(out, maxChars, stages, sync);\n return out;\n }\n const out: ServedBundle = { ...answer, context: answer.context.map(proofed), trace };\n const sync = (): void => {\n out.pages = texted(answer.pages, out.context);\n };\n sync();\n cap(out, maxChars, [slotsOf(out.context, out).reverse()], sync);\n return out;\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,SAAS;AAAA,IACb;AAAA,MACE,GAAI,KAAK,WAAW,SAAY,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO;AAAA,MAC/D,GAAI,KAAK,aAAa,SAAY,CAAC,IAAI,EAAE,UAAU,KAAK,SAAS;AAAA,IACnE;AAAA,IACA;AAAA,EACF;AACA,QAAM,QAAQ,KAAK,UAAU,KAAK,OAAO,SA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S;AAAA,UACjC,KAAK,CAAC,MAAM,YAAY;AACtB,gBAAI,SAAS,SAAU,YAAW,OAAO;AAAA,gBACpC,MAAK,OAAO;AAAA,UACnB;AAAA,QACF,CAAC;AACD,gBAAQ,IAAI,cAAc,QAAQ,KAAK,MAAM,CAAC;AAAA,MAChD,SAAS,GAAG;AACV,aAAK,CAAC;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEF,SAAO;AACP;","names":["resolve","resolve","text","existsSync","readFileSync","basename","dirname","join","relative","resolve","resolve","resolve","named","answer","out","sync","resolve","dirname","join","basename","relative","existsSync","readFileSync"]}
|
|
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","../src/graph/commands/serve-fit.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/** `--no-authoring` (proposal 0110), worded once for the four verbs that build from pages. */\nconst NO_AUTHORING_HELP =\n \"Leave out author-facing content: strategy records, and every field its schemas prefer in a sidecar (default: config authoring)\";\n\n/**\n * `--no-authoring` as a core takes it. Commander supplies `true` when the\n * flag is absent, so only an explicit `false` overrides `graph.authoring`.\n */\nfunction authoringOption(value: boolean | undefined): { authoring?: false } {\n return value === false ? { authoring: false } : {};\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 .option(\"--no-authoring\", NO_AUTHORING_HELP)\n .action(async (paths: string[], opts: InputFlags & {\n config?: string | boolean;\n collection?: string[];\n exclude?: string[];\n out?: string;\n authoring?: boolean;\n }) => {\n try {\n const result = await runBuild({\n paths,\n ...documentOptions(opts),\n ...(await inputOptions(paths, opts)),\n out: opts.out,\n ...authoringOption(opts.authoring),\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 const records = result.strategyRecords;\n const strategy = records > 0 ? `, ${records} strategy record${records === 1 ? \"\" : \"s\"}` : \"\";\n console.log(\n `Wrote ${result.outPath} (${result.docs} docs, ${result.quads} triples, ${total} concepts${termbase}${strategy})`,\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 .option(\n \"--publish\",\n \"Publish the graph first when its artifact is missing or older than the checkout, and again after the checkout changes\",\n )\n .option(\"--no-authoring\", NO_AUTHORING_HELP)\n .action(\n async (opts: {\n config?: string | boolean;\n graph?: string;\n index?: string;\n withhold?: WithholdReason[];\n publish?: boolean;\n authoring?: boolean;\n }) => {\n try {\n const { authoring, ...others } = rest(opts);\n process.exitCode = await runServe({ ...others, ...documentOptions(opts), ...authoringOption(authoring) });\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 .option(\"--no-authoring\", NO_AUTHORING_HELP)\n .action(\n async (\n target: string,\n opts: { config?: string | boolean; graph?: string; out?: string; evals?: string; authoring?: boolean },\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 ...authoringOption(opts.authoring),\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(\"--collection <name>\", \"Configured collection to read (repeatable)\", collect, [])\n .option(\"--no-authoring\", NO_AUTHORING_HELP)\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 out?: string;\n evals?: string;\n collection: string[];\n authoring?: boolean;\n format: GraphFormat;\n }) => {\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 ...authoringOption(opts.authoring),\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.4.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 dependency, 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 * Each answer goes out compacted and capped at `graph.serve.maxChars`\n * (`serve-fit.ts`); the CLI twins print the full result.\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 { existsSync, readFileSync, statSync } from \"node:fs\";\nimport { basename, dirname, join, relative, resolve, sep } from \"node:path\";\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, warn } from \"../../shared/warn.js\";\nimport { loadRunConfig } from \"../core/config.js\";\nimport { checkoutStatus, type CheckoutStatus } from \"../core/git.js\";\nimport { byCodeUnit } from \"../core/sort.js\";\nimport type { WithholdReason } from \"../runtime/chunks.js\";\nimport { parseChunksManifest, type LookupResult, type PassageBundle, type WhereCondition } from \"../runtime/retrieve.js\";\nimport { GraphError } from \"../types.js\";\nimport { NO_AUTHORING_NEEDS_PUBLISH } from \"../core/graph-output.js\";\nimport { CHUNKS_MANIFEST } from \"./chunks.js\";\nimport { runPublish, type PublishOptions } from \"./publish.js\";\nimport { lookupIn, openArtifact, retrieveIn, traverseIn, type Artifact, type ArtifactOptions } from \"./retrieve.js\";\nimport { fitAnswer, type ServedAnswer } from \"./serve-fit.js\";\n\nexport interface ServeOptions extends ArtifactOptions {\n /** Tightens the trust floor for every call. */\n withhold?: WithholdReason[];\n /** `--publish`: publish a stale artifact behind the handshake, and again after the checkout changes. */\n publish?: boolean;\n /**\n * `--no-authoring` passes `false` (proposal 0110): what `--publish` builds\n * leaves author-facing content out. It overrides `graph.authoring`, and\n * needs `publish`.\n */\n authoring?: boolean;\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 /** Injection seam for tests: what `--publish` runs, `runPublish` by default. */\n publish?: (opts: PublishOptions) => Promise<unknown>;\n}\n\nasync function importSdk(): Promise<McpSdk> {\n // Literal specifiers, so the Node build leaves them bare: an optional dependency.\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 = { type: \"object\", required: [\"entry\", \"withheld\", \"filtered\"] };\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: NULLABLE_TEXT,\n page: { type: \"string\" },\n depth: { type: \"integer\" },\n role: { type: \"string\", enum: [\"match\", \"context\", \"dependent\"] },\n truncated: { type: \"boolean\" },\n provenance: PROOF,\n },\n required: [\"iri\", \"text\", \"page\", \"depth\", \"role\"],\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\", ...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 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 with text has its source and proof: pin status, dates and eval verdicts. \" +\n \"When the answer runs long, the lowest-priority passages come back as references with no text. \" +\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// ---- --publish ----------------------------------------------------------------\n\nconst RUN_PUBLISH = \"; run manni graph publish.\";\n\n/** The artifact `--publish` keeps current: each call's artifact, or the failure text it answers with. */\ninterface Publisher {\n /** Settles once the start-up check, and any publish it ran, is done: with the failure text, or nothing. */\n start: () => Promise<string | undefined>;\n current: () => Promise<Artifact | string>;\n /** Every publish still running. */\n running: () => Promise<unknown>[];\n}\n\nfunction publisher(opts: ServeOptions, seams: ServeSeams): Publisher {\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 // A bad config fails here, before the handshake, as a plain serve does.\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 index = opts.index === undefined ? dirname(configured) : resolve(cwd, opts.index);\n const target: ArtifactOptions = { ...opts, graph: join(index, basename(configured)), index };\n const shown = (path: string): string => relative(cwd, path).split(\"\\\\\").join(\"/\");\n const publish = seams.publish ?? runPublish;\n\n /** HEAD and every changed file's path, size and mtime, leaving out what publish itself writes. */\n const fingerprint = (state: CheckoutStatus | null): string | null => {\n if (state === null) return null;\n const lines = changed(state).map((abs) => {\n try {\n const s = statSync(abs);\n return `${abs}\\t${String(s.size)}\\t${String(s.mtimeMs)}`;\n } catch {\n return `${abs}\\tgone`;\n }\n });\n return [state.head, ...lines].join(\"\\n\");\n };\n const changed = (state: CheckoutStatus): string[] =>\n state.paths\n .map((p) => resolve(state.root, p))\n .filter((abs) => abs !== index && !abs.startsWith(index + sep))\n .sort(byCodeUnit);\n\n let artifact: Artifact | undefined;\n let failed: string | undefined;\n let baseline: string | null = null;\n let inflight: Promise<string | undefined> | undefined;\n const publishing = (): Promise<string | undefined> | undefined => inflight;\n\n /** Why the artifact on disk cannot be served as it is, or nothing; opens it when it can. */\n const staleness = (state: CheckoutStatus | null): string | undefined => {\n try {\n artifact = openArtifact(target);\n } catch (e) {\n if (!(e instanceof GraphError)) throw e;\n if (e.message.endsWith(RUN_PUBLISH)) return e.message.slice(0, -RUN_PUBLISH.length);\n const graph = target.graph ?? \"\";\n return existsSync(graph) ? e.message.replace(/\\.$/, \"\") : `${shown(graph)} does not exist`;\n }\n const { commit } = parseChunksManifest(readFileSync(join(index, CHUNKS_MANIFEST), \"utf8\"));\n if (commit === null) return \"it records no commit\";\n if (state === null) return undefined;\n if (commit !== state.head) return `it was built at ${commit.slice(0, 7)} and HEAD is ${state.head.slice(0, 7)}`;\n if (changed(state).length > 0) return \"the working tree has changes\";\n return undefined;\n };\n\n /** One publish, from the checkout `print` names. The previous artifact stays when it fails. */\n const run = async (print: string | null): Promise<string | undefined> => {\n baseline = print;\n const began = performance.now();\n try {\n await publish({\n ...source,\n out: index,\n ...(opts.authoring === undefined ? {} : { authoring: opts.authoring }),\n say: (kind, message) => {\n if (kind === \"warning\") warn(message);\n else notice(message);\n },\n });\n artifact = openArtifact(target);\n } catch (e) {\n const said = errorMessage(e);\n notice(said);\n return `${said.replace(/\\.$/, \"\")}. Run manni graph publish to see the whole report.`;\n }\n notice(`published the graph in ${((performance.now() - began) / 1000).toFixed(1)}s.`);\n return undefined;\n };\n\n let ready: Promise<string | undefined> | undefined;\n const start = (): Promise<string | undefined> =>\n (ready ??= (async () => {\n try {\n const state = await checkoutStatus(cwd);\n const reason = staleness(state);\n if (reason === undefined) baseline = fingerprint(state);\n else {\n notice(`publishing the graph before serving it: ${reason}.`);\n failed = await run(fingerprint(state));\n }\n } catch (e) {\n failed = errorMessage(e);\n notice(failed);\n }\n if (failed === undefined) {\n notice(`serving lookup, retrieve, traverse and impact over stdio from ${shown(join(index, CHUNKS_MANIFEST))}.`);\n }\n return failed;\n })());\n\n /** Republish when the checkout moved since the last publish began. Concurrent calls share one publish. */\n const fresh = async (): Promise<string | undefined> => {\n if (inflight !== undefined) return inflight;\n if (baseline === null) return undefined;\n const now = fingerprint(await checkoutStatus(cwd));\n // Read again, through a call the compiler cannot narrow: another call may have begun a publish while git ran.\n const begun = publishing();\n if (begun !== undefined) return begun;\n if (now === baseline) return undefined;\n notice(\"republishing the graph: the checkout changed since the last publish.\");\n inflight = run(now).finally(() => (inflight = undefined));\n return inflight;\n };\n\n return {\n start,\n current: async () => {\n const startup = await start();\n if (startup !== undefined) return startup;\n const later = await fresh();\n return later ?? artifact ?? \"graph serve has no artifact to answer from.\";\n },\n running: () => [...(ready === undefined ? [] : [ready]), ...(inflight === undefined ? [] : [inflight])],\n };\n}\n\n/**\n * Serve until stdin closes. Resolves then with the exit code: 0, or 2 when\n * `--publish` could not publish at start. A missing SDK, a missing artifact\n * or one built from another graph rejects with a `GraphError`, exit 2, before\n * anything is served. With `--publish`, those three publish instead, behind\n * the handshake.\n */\nexport async function runServe(opts: ServeOptions, seams: ServeSeams = {}): Promise<number> {\n if (opts.authoring === false && opts.publish !== true) throw new GraphError(NO_AUTHORING_NEEDS_PUBLISH);\n if (opts.publish === true && opts.graph !== undefined) {\n throw new GraphError(\n \"--publish writes graph.ttl into the index directory, so it cannot be combined with --graph. Use --index to choose the directory.\",\n );\n }\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 // Plain: one artifact, opened now. `--publish`: whatever its publisher holds when a call arrives.\n const kept = opts.publish === true ? publisher(opts, seams) : undefined;\n let opened: Artifact | undefined;\n let current: () => Promise<Artifact | string>;\n if (kept === undefined) {\n const artifact = openArtifact(opts);\n opened = artifact;\n current = () => Promise.resolve(artifact);\n } else {\n current = kept.current;\n }\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 = (async (): Promise<string | ServedAnswer> => {\n const held = await current();\n if (typeof held === \"string\") return held;\n return fitAnswer(await answer(held, name as ToolName, args, opts.withhold), held.config.serve.maxChars);\n })();\n pending.add(work);\n try {\n const result = await work;\n if (typeof result === \"string\") return fault(result);\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 if (opened !== undefined) notice(`serving lookup, retrieve, traverse and impact over stdio from ${opened.label}.`);\n // Behind the handshake: a client's initialize timeout does not wait for a publish.\n const startup = kept?.start();\n await closed;\n // A publish in progress finishes, so no artifact is left half-written.\n await Promise.allSettled([...pending, ...(kept?.running() ?? [])]);\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 return (await startup) === undefined ? 0 : 2;\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 { EVALS_ARE_AUTHOR_FACING } from \"../core/graph-output.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 /** `--collection`, repeatable: the collections the build reads (default: every one). */\n collection?: string[];\n /** `--no-authoring` passes `false` (proposal 0110). Overrides `graph.authoring`. */\n authoring?: boolean;\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 authoring = opts.authoring ?? config.authoring;\n if (!authoring && opts.evals !== undefined) throw new GraphError(EVALS_ARE_AUTHOR_FACING);\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({\n ...source,\n graph,\n format,\n ...(out === undefined ? {} : { out }),\n ...(format === \"chunks\" && opts.evals !== undefined ? { evals: opts.evals } : {}),\n // The build already left author-facing content out of the graph the others reserialize.\n ...(!authoring && (format === \"chunks\" || format === \"llms\") ? { authoring } : {}),\n });\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 // Only the build reads documents; every later step reads what it built.\n const r = await runBuild({\n ...source,\n ...(opts.collection === undefined ? {} : { collection: opts.collection }),\n out: graph,\n ...(authoring ? {} : { authoring }),\n });\n const records = r.strategyRecords > 0 ? `, ${plural(r.strategyRecords, \"strategy record\")}` : \"\";\n return {\n detail: `${shown(r.outPath)}: ${plural(r.docs, \"page\")}, ${plural(r.quads, \"triple\")}${records}`,\n files: [r.outPath],\n warnings: r.warnings,\n };\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","/**\n * What `graph serve` sends for one answer: the full result its CLI twin\n * prints, made to fit an agent's context. Pure, and the result it is given is\n * left as it was, because the CLI and the runtime return it whole.\n *\n * Compact first. The trace keeps `entry`, `withheld` and `filtered`, and\n * leaves out the walk diagnostics. A passage with no text carries no proof,\n * and `pages` names only the pages of passages that carry text.\n *\n * Then the cap. While the JSON is longer than `maxChars`, passages become\n * references in reverse priority. On a lookup the walks' passages go first,\n * then the walks' edges from the end, and the matches last, so the passages\n * that answer the question keep their text longest. A refusal is small, and\n * goes out as it is.\n */\nimport type { ProvenanceRecord } from \"../runtime/chunks.js\";\nimport type { LookupEdge, LookupResult, PassageBundle, PassageRole, RetrievalTrace } from \"../runtime/retrieve.js\";\n\n/** One passage as served: its text and proof, or, reduced, a reference to read it by. */\nexport interface ServedPassage {\n iri: string;\n title?: string;\n page: string;\n lines?: string;\n text: string | null;\n truncated?: boolean;\n provenance?: ProvenanceRecord;\n sourceUrl?: string;\n rank?: number;\n score?: { lexical?: number | null; vector?: number | null; fused: number };\n depth?: number;\n role?: PassageRole;\n}\n\ninterface ServedSection {\n passages: ServedPassage[];\n truncated: boolean;\n}\n\ninterface ServedWalk extends ServedSection {\n edges: LookupEdge[];\n}\n\ntype ServedTrace = Pick<RetrievalTrace, \"entry\" | \"withheld\" | \"filtered\">;\ntype Pages = PassageBundle[\"pages\"];\n\nexport interface ServedLookup extends Omit<LookupResult, \"matches\" | \"traversal\" | \"impact\" | \"trace\"> {\n matches: ServedSection;\n traversal: ServedWalk;\n impact: ServedWalk;\n trace: ServedTrace;\n}\n\nexport interface ServedBundle extends Omit<PassageBundle, \"context\" | \"trace\"> {\n context: ServedPassage[];\n trace: ServedTrace;\n}\n\nexport type ServedAnswer = ServedLookup | ServedBundle;\n\n/** A passage with text keeps its proof; one without leaves it out. */\nfunction proofed(p: ServedPassage): ServedPassage {\n if (p.text !== null) return p;\n const { provenance, ...rest } = p;\n return rest;\n}\n\n/** A passage reduced to where it is and where it ranks. */\nfunction reference(p: ServedPassage): ServedPassage {\n return {\n iri: p.iri,\n ...(p.title === undefined ? {} : { title: p.title }),\n page: p.page,\n ...(p.lines === undefined ? {} : { lines: p.lines }),\n ...(p.rank === undefined ? {} : { rank: p.rank }),\n ...(p.score === undefined ? {} : { score: { fused: p.score.fused } }),\n ...(p.depth === undefined ? {} : { depth: p.depth }),\n ...(p.role === undefined ? {} : { role: p.role }),\n text: null,\n truncated: true,\n };\n}\n\n/** The pages of `all` that a passage with text names. */\nfunction texted(all: Pages, passages: readonly ServedPassage[]): Pages {\n const named = new Set(passages.filter((p) => p.text !== null).map((p) => p.page));\n return Object.fromEntries(Object.entries(all).filter(([page]) => named.has(page)));\n}\n\n/** One passage the cap may reduce, and the section whose `truncated` it sets. */\ninterface Slot {\n list: ServedPassage[];\n index: number;\n owner: { truncated: boolean };\n}\n\nconst slotsOf = (list: ServedPassage[], owner: { truncated: boolean }): Slot[] =>\n list.map((_, index) => ({ list, index, owner }));\n\n/** A walk's passages, deepest first, then later ones first at equal depth. */\nconst deepestFirst = (s: ServedSection): Slot[] =>\n slotsOf(s.passages, s).sort(\n (a, b) => (b.list[b.index]?.depth ?? 0) - (a.list[a.index]?.depth ?? 0) || b.index - a.index,\n );\n\n/** Matches, lowest-ranked first. */\nconst lowestRankedFirst = (s: ServedSection): Slot[] =>\n slotsOf(s.passages, s).sort((a, b) => (b.list[b.index]?.rank ?? b.index) - (a.list[a.index]?.rank ?? a.index));\n\n/**\n * Run each stage until `out` fits: a list of passages to reduce in order, or\n * a walk whose edges go from the end.\n */\nfunction cap(out: ServedAnswer, maxChars: number, stages: readonly (Slot[] | ServedWalk)[], sync: () => void): void {\n // ponytail: one stringify per step; an incremental length if answers grow to thousands of steps.\n const over = (): boolean => JSON.stringify(out).length > maxChars;\n for (const stage of stages) {\n if (!Array.isArray(stage)) {\n while (stage.edges.length > 0 && over()) {\n stage.edges.pop();\n stage.truncated = true;\n }\n continue;\n }\n for (const { list, index, owner } of stage) {\n if (!over()) return;\n const p = list[index];\n if (p === undefined) continue;\n list[index] = reference(p);\n owner.truncated = true;\n sync();\n }\n }\n}\n\n/** The answer `graph serve` sends: compact, then within `maxChars` characters of JSON where it can be. */\nexport function fitAnswer(answer: LookupResult | PassageBundle, maxChars: number): ServedAnswer {\n if (answer.refusal !== undefined) return answer;\n const trace: ServedTrace = {\n entry: answer.trace.entry,\n withheld: answer.trace.withheld,\n filtered: answer.trace.filtered,\n };\n if (\"matches\" in answer) {\n const out: ServedLookup = {\n ...answer,\n matches: { ...answer.matches, passages: answer.matches.passages.map(proofed) },\n traversal: { ...answer.traversal, passages: answer.traversal.passages.map(proofed), edges: [...answer.traversal.edges] },\n impact: { ...answer.impact, passages: answer.impact.passages.map(proofed), edges: [...answer.impact.edges] },\n trace,\n };\n const sync = (): void => {\n out.pages = texted(answer.pages, [...out.matches.passages, ...out.traversal.passages, ...out.impact.passages]);\n };\n sync();\n const stages = [\n [...deepestFirst(out.impact), ...deepestFirst(out.traversal)],\n out.impact,\n out.traversal,\n lowestRankedFirst(out.matches),\n ];\n cap(out, maxChars, stages, sync);\n return out;\n }\n const out: ServedBundle = { ...answer, context: answer.context.map(proofed), trace };\n const sync = (): void => {\n out.pages = texted(answer.pages, out.context);\n };\n sync();\n cap(out, maxChars, [slotsOf(out.context, out).reverse()], sync);\n return out;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,SAAS,eAAe;;;ACMjB,IAAM,gBAAgB,CAAC,UAAU,MAAM;AAIvC,IAAM,oBAA4B,cAAc,KAAK,KAAK;AAG1D,IAAM,gBA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,OAAO,uBAAuB,2BAA2B,EACzD,OAAO,eAAe,mCAAmC,EACzD,OAAO,mBAAmB,qEAAqE,EAC/F,OAAO,kBAAkB,6EAA6E,EACtG,OAAO,uBAAuB,8CAA8C,SAAS,CAAC,CAAC,EACvF,OAAO,kBAAkB,iBAAiB,EAC1C;AAAA,IACC;AAAA,IACA,WAAW,iBAAiB;AAAA,IAC5B;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC,OAAO,SAOD;AACJ,UAAI;AACF,cAAM,SAAS,MAAM,WAAW;AAAA,UAC9B,GAAG,gBAAgB,IAAI;AAAA,UACvB,GAAI,KAAK,QAAQ,SAAY,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI;AAAA,UAClD,GAAI,KAAK,UAAU,SAAY,CAAC,IAAI,EAAE,OAAO,KAAK,MAAM;AAAA,UACxD,GAAG,gBAAgB,KAAK,SAAS;AAAA,UACjC,KAAK,CAAC,MAAM,YAAY;AACtB,gBAAI,SAAS,SAAU,YAAW,OAAO;AAAA,gBACpC,MAAK,OAAO;AAAA,UACnB;AAAA,QACF,CAAC;AACD,gBAAQ,IAAI,cAAc,QAAQ,KAAK,MAAM,CAAC;AAAA,MAChD,SAAS,GAAG;AACV,aAAK,CAAC;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEF,SAAO;AACP;","names":["resolve","resolve","text","existsSync","readFileSync","basename","dirname","join","relative","resolve","resolve","resolve","named","answer","out","sync","resolve","dirname","join","basename","relative","existsSync","readFileSync"]}
|