@hawkeyexl/manni 4.16.0 → 4.18.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-L5W4JS7A.js → batch-5TPNK5BQ.js} +14 -14
- package/dist/{build-GNZUVDZX.js → build-GGKCRWKH.js} +15 -14
- package/dist/{calibrate-2LYIDN6U.js → calibrate-OGOLLGXY.js} +15 -15
- package/dist/{capture-OEDMFU5Z.js → capture-CNHRHTA7.js} +14 -14
- package/dist/{check-NLLFHNWG.js → check-BAMOJMOJ.js} +16 -15
- package/dist/{check-Z5VGDSDT.js → check-XLIS5A7G.js} +13 -14
- package/dist/check-XYGABPXI.js +47 -0
- package/dist/{check-JR2TYL2Y.js → check-ZFI7H7LS.js} +15 -15
- package/dist/{cli-THEU2QG2.js → chunk-245W2Q7C.js} +133 -365
- package/dist/chunk-245W2Q7C.js.map +1 -0
- package/dist/{chunk-OJ7FEM2G.js → chunk-27FP4KKD.js} +47 -10
- package/dist/chunk-27FP4KKD.js.map +1 -0
- package/dist/{chunk-GQQ2AX63.js → chunk-2QZCPPVE.js} +38 -432
- package/dist/chunk-2QZCPPVE.js.map +1 -0
- package/dist/{chunk-BMYCLTFK.js → chunk-327CWO33.js} +3 -3
- package/dist/{chunk-WT3AATHC.js → chunk-33FIOHJ4.js} +252 -425
- package/dist/chunk-33FIOHJ4.js.map +1 -0
- package/dist/{chunk-ZJZQPOJO.js → chunk-3COYAAR7.js} +2 -2
- package/dist/{chunk-6ANTGYNT.js → chunk-3LZ6AYB4.js} +2 -2
- package/dist/{chunk-2AUULNIJ.js → chunk-4A445ALG.js} +3 -3
- package/dist/{chunk-L3YGGYBG.js → chunk-4KY2RUXQ.js} +3 -3
- package/dist/{chunk-NDBISART.js → chunk-5VA3ZOB7.js} +3 -3
- package/dist/{chunk-4LLYPDNG.js → chunk-6E6Z6UQL.js} +7 -7
- package/dist/{chunk-CSLJMML4.js → chunk-6ZYXK3JT.js} +4 -4
- package/dist/chunk-7RZQAMA2.js +314 -0
- package/dist/chunk-7RZQAMA2.js.map +1 -0
- package/dist/{chunk-NH6B6DDI.js → chunk-CWVL7XZR.js} +4 -4
- package/dist/{chunk-DTG6S2UG.js → chunk-E3YXGLEU.js} +2 -2
- package/dist/{chunk-5PO2BWZF.js → chunk-E76WPNYO.js} +2 -2
- package/dist/{chunk-F4GXZMEO.js → chunk-EITEHOSX.js} +12 -7
- package/dist/{chunk-F4GXZMEO.js.map → chunk-EITEHOSX.js.map} +1 -1
- package/dist/{chunk-DSTRT6YD.js → chunk-EU5QLSNN.js} +3 -3
- package/dist/{chunk-F6B2TNXU.js → chunk-F7GYY373.js} +6 -6
- package/dist/{chunk-6NTNLKNQ.js → chunk-FE3US7FR.js} +6 -5
- package/dist/{chunk-6NTNLKNQ.js.map → chunk-FE3US7FR.js.map} +1 -1
- package/dist/{chunk-IL62WATF.js → chunk-FNQE3RAW.js} +2 -2
- package/dist/chunk-FO6MNXOF.js +580 -0
- package/dist/chunk-FO6MNXOF.js.map +1 -0
- package/dist/{chunk-5D24C6WM.js → chunk-GMOAW2EG.js} +6 -2
- package/dist/chunk-GMOAW2EG.js.map +1 -0
- package/dist/chunk-GNZKLUZW.js +459 -0
- package/dist/chunk-GNZKLUZW.js.map +1 -0
- package/dist/{chunk-LEOQO3S6.js → chunk-ICRYIYMJ.js} +7 -7
- package/dist/{chunk-GR6QQ7GM.js → chunk-IIBVQCCR.js} +4 -4
- package/dist/{chunk-O6YTTBSN.js → chunk-JFB45L7D.js} +2 -2
- package/dist/chunk-JFPCDIES.js +1338 -0
- package/dist/chunk-JFPCDIES.js.map +1 -0
- package/dist/{chunk-2XRET3ZG.js → chunk-JHUEACRT.js} +31 -47
- package/dist/chunk-JHUEACRT.js.map +1 -0
- package/dist/{chunk-7UC55CAU.js → chunk-JS5NCZYC.js} +187 -159
- package/dist/chunk-JS5NCZYC.js.map +1 -0
- package/dist/{chunk-63GILHR5.js → chunk-KRQTN5KE.js} +4 -4
- package/dist/{chunk-WDENIUC7.js → chunk-MDZXRHIJ.js} +1 -1
- package/dist/chunk-MDZXRHIJ.js.map +1 -0
- package/dist/{chunk-3GLDB7MZ.js → chunk-MH5MX4B3.js} +1311 -18
- package/dist/chunk-MH5MX4B3.js.map +1 -0
- package/dist/{chunk-IGRXQC3H.js → chunk-N25KDXOV.js} +2 -2
- package/dist/{chunk-DW22KCLN.js → chunk-NPZWOPOH.js} +3 -3
- package/dist/{chunk-4L3JBAW4.js → chunk-NUAVQQMC.js} +2 -2
- package/dist/{chunk-PBZZUNDV.js → chunk-O2TE5X25.js} +7 -7
- package/dist/{chunk-EOSQENQF.js → chunk-OVQDZOMU.js} +2 -2
- package/dist/{chunk-WD33LE5A.js → chunk-OZWV27SE.js} +1313 -127
- package/dist/chunk-OZWV27SE.js.map +1 -0
- package/dist/{chunk-5OOQ3HQ3.js → chunk-PCTJ7P6U.js} +11 -2
- package/dist/chunk-PCTJ7P6U.js.map +1 -0
- package/dist/{chunk-EZCJPF72.js → chunk-PLN2LJDM.js} +3 -3
- package/dist/{chunk-D4ANAOY7.js → chunk-QGJA43DX.js} +20 -6
- package/dist/chunk-QGJA43DX.js.map +1 -0
- package/dist/{chunk-6YFEV7CM.js → chunk-QWYE3S3U.js} +5 -5
- package/dist/{chunk-GC47NBGO.js → chunk-QXTL5MGT.js} +4 -4
- package/dist/{chunk-AWAXAJ6R.js → chunk-RCWP63XT.js} +2 -2
- package/dist/{chunk-IM67NRUW.js → chunk-RMKMJ43W.js} +2 -2
- package/dist/{chunk-EA5KKIFG.js → chunk-RVSUMNCR.js} +3 -3
- package/dist/{chunk-NFJGIBES.js → chunk-SVB45M54.js} +82 -238
- package/dist/chunk-SVB45M54.js.map +1 -0
- package/dist/{chunk-4HEEXPVX.js → chunk-T3VFO2LO.js} +6 -6
- package/dist/{chunk-FU3OCYYH.js → chunk-TFTGMYDR.js} +2 -2
- package/dist/chunk-UP6NBQ62.js +2 -0
- package/dist/{chunk-LPBVWUKS.js → chunk-V2IP2ZMD.js} +2 -2
- package/dist/{chunk-PHNAQ4QX.js → chunk-V5QTIP2M.js} +182 -94
- package/dist/chunk-V5QTIP2M.js.map +1 -0
- package/dist/{chunk-B3XXCDYW.js → chunk-VV4YM6VM.js} +2385 -2061
- package/dist/chunk-VV4YM6VM.js.map +1 -0
- package/dist/{chunk-7GB3KEEM.js → chunk-XKZZRG3Z.js} +24 -460
- package/dist/chunk-XKZZRG3Z.js.map +1 -0
- package/dist/{chunk-ZT5NUSZA.js → chunk-XTQTA262.js} +146 -27
- package/dist/chunk-XTQTA262.js.map +1 -0
- package/dist/chunk-YLU4H2H3.js +545 -0
- package/dist/chunk-YLU4H2H3.js.map +1 -0
- package/dist/{chunk-YF6IZXAC.js → chunk-ZLOLC6WD.js} +7 -7
- package/dist/{cli-RWRYV5FB.js → cli-6UQ3QV2G.js} +9 -9
- package/dist/{cli-LZW6Z33F.js → cli-GH42HLFK.js} +42 -24
- package/dist/cli-GH42HLFK.js.map +1 -0
- package/dist/{cli-5QTSTGTX.js → cli-GND6TVRG.js} +18 -18
- package/dist/{cli-4Y2XY52B.js → cli-JHULEOH2.js} +2 -2
- package/dist/cli-LVHZCC2O.js +379 -0
- package/dist/cli-LVHZCC2O.js.map +1 -0
- package/dist/{cli-2EKRURBU.js → cli-NWU77YRZ.js} +15 -15
- package/dist/{cli-2SDBEUER.js → cli-PUO75R3L.js} +21 -21
- package/dist/{cli-TZ2OHF3H.js → cli-Q2RJMCVE.js} +28 -20
- package/dist/cli-Q2RJMCVE.js.map +1 -0
- package/dist/{cli-DBMPGGOV.js → cli-RUNYBUIV.js} +38 -38
- package/dist/{cli-BXUZ3KEQ.js → cli-T7UJF3BF.js} +634 -36
- package/dist/cli-T7UJF3BF.js.map +1 -0
- package/dist/{cli-KAUXC7EZ.js → cli-WUFQGIUG.js} +9 -9
- package/dist/cli.js +14 -14
- package/dist/docmeta.js +8 -8
- package/dist/{github-UR6LMUMW.js → github-BV42LSW2.js} +13 -14
- package/dist/github-XZ7OLATY.js +35 -0
- package/dist/graph/runtime.d.ts +633 -217
- package/dist/graph/runtime.js +1001 -370
- package/dist/graph/runtime.js.map +1 -1
- package/dist/index.d.ts +2734 -1977
- package/dist/index.js +109 -65
- package/dist/index.js.map +1 -1
- package/dist/{json-QTYN2JQB.js → json-LEEXKSGP.js} +13 -14
- package/dist/{json-5EQCGVCV.js → json-YTKUFNO3.js} +2 -2
- package/dist/{labels-UM2AFR5S.js → labels-E256WRAI.js} +12 -13
- package/dist/{labels-UM2AFR5S.js.map → labels-E256WRAI.js.map} +1 -1
- package/dist/{lint-LOFNZZPR.js → lint-W4CM3EIO.js} +13 -13
- package/dist/{list-GU7S6KEX.js → list-TB4R6AP4.js} +13 -14
- package/dist/{list-EPMHOU7T.js → list-UDDGL2OI.js} +15 -15
- package/dist/{page-25CN3AFY.js → page-L64NO57W.js} +13 -14
- package/dist/{prepare-5GYMBF4P.js → prepare-GFTAYDTP.js} +13 -13
- package/dist/{pretty-52Z74O6F.js → pretty-HYCYKYHB.js} +14 -15
- package/dist/{pretty-QW6OSYRS.js → pretty-Q43TCD6D.js} +13 -14
- package/dist/{reporters-WT53GD4P.js → reporters-4HRBSMUF.js} +4 -4
- package/dist/{reporters-FSXJ42EB.js → reporters-6TEJDXXO.js} +4 -4
- package/dist/{reporters-3FXX2W4X.js → reporters-E3FUVBQ6.js} +12 -12
- package/dist/{run-H7XJMUWK.js → run-UDX2C54M.js} +16 -16
- package/dist/{sarif-C427U3NA.js → sarif-WL353VTA.js} +11 -11
- package/dist/sarif-XZFJ5VIJ.js +36 -0
- package/dist/site/rehype.d.ts +33 -0
- package/dist/site/rehype.js +49 -0
- package/dist/site/rehype.js.map +1 -0
- package/dist/{term-VG65JRNR.js → term-OZ7ZR5KB.js} +18 -19
- package/dist/{term-VG65JRNR.js.map → term-OZ7ZR5KB.js.map} +1 -1
- package/dist/{types-VMOT7RAL.js → types-7N7ETP3W.js} +2 -2
- package/dist/{validate-K36F54UB.js → validate-CR3TI7GP.js} +5 -5
- package/package.json +10 -1
- package/plugin/manni/.claude-plugin/plugin.json +1 -1
- package/shapes/graph/shapes-1.2.0.ttl +1161 -0
- package/dist/check-LVO4HZ3F.js +0 -36
- package/dist/chunk-2XRET3ZG.js.map +0 -1
- package/dist/chunk-3GLDB7MZ.js.map +0 -1
- package/dist/chunk-3WZQ2FR3.js +0 -236
- package/dist/chunk-3WZQ2FR3.js.map +0 -1
- package/dist/chunk-5D24C6WM.js.map +0 -1
- package/dist/chunk-5OOQ3HQ3.js.map +0 -1
- package/dist/chunk-7GB3KEEM.js.map +0 -1
- package/dist/chunk-7UC55CAU.js.map +0 -1
- package/dist/chunk-B3XXCDYW.js.map +0 -1
- package/dist/chunk-D4ANAOY7.js.map +0 -1
- package/dist/chunk-GQQ2AX63.js.map +0 -1
- package/dist/chunk-IKEWBMCN.js +0 -98
- package/dist/chunk-IKEWBMCN.js.map +0 -1
- package/dist/chunk-NFJGIBES.js.map +0 -1
- package/dist/chunk-OJ7FEM2G.js.map +0 -1
- package/dist/chunk-PHNAQ4QX.js.map +0 -1
- package/dist/chunk-WD33LE5A.js.map +0 -1
- package/dist/chunk-WDENIUC7.js.map +0 -1
- package/dist/chunk-WT3AATHC.js.map +0 -1
- package/dist/chunk-YUTVAMWW.js +0 -2
- package/dist/chunk-ZT5NUSZA.js.map +0 -1
- package/dist/cli-BXUZ3KEQ.js.map +0 -1
- package/dist/cli-LZW6Z33F.js.map +0 -1
- package/dist/cli-THEU2QG2.js.map +0 -1
- package/dist/cli-TZ2OHF3H.js.map +0 -1
- package/dist/github-ICZ5UDGX.js +0 -36
- package/dist/sarif-UVAFWZKS.js +0 -37
- /package/dist/{batch-L5W4JS7A.js.map → batch-5TPNK5BQ.js.map} +0 -0
- /package/dist/{build-GNZUVDZX.js.map → build-GGKCRWKH.js.map} +0 -0
- /package/dist/{calibrate-2LYIDN6U.js.map → calibrate-OGOLLGXY.js.map} +0 -0
- /package/dist/{capture-OEDMFU5Z.js.map → capture-CNHRHTA7.js.map} +0 -0
- /package/dist/{check-LVO4HZ3F.js.map → check-BAMOJMOJ.js.map} +0 -0
- /package/dist/{check-NLLFHNWG.js.map → check-XLIS5A7G.js.map} +0 -0
- /package/dist/{check-Z5VGDSDT.js.map → check-XYGABPXI.js.map} +0 -0
- /package/dist/{check-JR2TYL2Y.js.map → check-ZFI7H7LS.js.map} +0 -0
- /package/dist/{chunk-BMYCLTFK.js.map → chunk-327CWO33.js.map} +0 -0
- /package/dist/{chunk-ZJZQPOJO.js.map → chunk-3COYAAR7.js.map} +0 -0
- /package/dist/{chunk-6ANTGYNT.js.map → chunk-3LZ6AYB4.js.map} +0 -0
- /package/dist/{chunk-2AUULNIJ.js.map → chunk-4A445ALG.js.map} +0 -0
- /package/dist/{chunk-L3YGGYBG.js.map → chunk-4KY2RUXQ.js.map} +0 -0
- /package/dist/{chunk-NDBISART.js.map → chunk-5VA3ZOB7.js.map} +0 -0
- /package/dist/{chunk-4LLYPDNG.js.map → chunk-6E6Z6UQL.js.map} +0 -0
- /package/dist/{chunk-CSLJMML4.js.map → chunk-6ZYXK3JT.js.map} +0 -0
- /package/dist/{chunk-NH6B6DDI.js.map → chunk-CWVL7XZR.js.map} +0 -0
- /package/dist/{chunk-DTG6S2UG.js.map → chunk-E3YXGLEU.js.map} +0 -0
- /package/dist/{chunk-5PO2BWZF.js.map → chunk-E76WPNYO.js.map} +0 -0
- /package/dist/{chunk-DSTRT6YD.js.map → chunk-EU5QLSNN.js.map} +0 -0
- /package/dist/{chunk-F6B2TNXU.js.map → chunk-F7GYY373.js.map} +0 -0
- /package/dist/{chunk-IL62WATF.js.map → chunk-FNQE3RAW.js.map} +0 -0
- /package/dist/{chunk-LEOQO3S6.js.map → chunk-ICRYIYMJ.js.map} +0 -0
- /package/dist/{chunk-GR6QQ7GM.js.map → chunk-IIBVQCCR.js.map} +0 -0
- /package/dist/{chunk-O6YTTBSN.js.map → chunk-JFB45L7D.js.map} +0 -0
- /package/dist/{chunk-63GILHR5.js.map → chunk-KRQTN5KE.js.map} +0 -0
- /package/dist/{chunk-IGRXQC3H.js.map → chunk-N25KDXOV.js.map} +0 -0
- /package/dist/{chunk-DW22KCLN.js.map → chunk-NPZWOPOH.js.map} +0 -0
- /package/dist/{chunk-4L3JBAW4.js.map → chunk-NUAVQQMC.js.map} +0 -0
- /package/dist/{chunk-PBZZUNDV.js.map → chunk-O2TE5X25.js.map} +0 -0
- /package/dist/{chunk-EOSQENQF.js.map → chunk-OVQDZOMU.js.map} +0 -0
- /package/dist/{chunk-EZCJPF72.js.map → chunk-PLN2LJDM.js.map} +0 -0
- /package/dist/{chunk-6YFEV7CM.js.map → chunk-QWYE3S3U.js.map} +0 -0
- /package/dist/{chunk-GC47NBGO.js.map → chunk-QXTL5MGT.js.map} +0 -0
- /package/dist/{chunk-AWAXAJ6R.js.map → chunk-RCWP63XT.js.map} +0 -0
- /package/dist/{chunk-IM67NRUW.js.map → chunk-RMKMJ43W.js.map} +0 -0
- /package/dist/{chunk-EA5KKIFG.js.map → chunk-RVSUMNCR.js.map} +0 -0
- /package/dist/{chunk-4HEEXPVX.js.map → chunk-T3VFO2LO.js.map} +0 -0
- /package/dist/{chunk-FU3OCYYH.js.map → chunk-TFTGMYDR.js.map} +0 -0
- /package/dist/{chunk-YUTVAMWW.js.map → chunk-UP6NBQ62.js.map} +0 -0
- /package/dist/{chunk-LPBVWUKS.js.map → chunk-V2IP2ZMD.js.map} +0 -0
- /package/dist/{chunk-YF6IZXAC.js.map → chunk-ZLOLC6WD.js.map} +0 -0
- /package/dist/{cli-RWRYV5FB.js.map → cli-6UQ3QV2G.js.map} +0 -0
- /package/dist/{cli-5QTSTGTX.js.map → cli-GND6TVRG.js.map} +0 -0
- /package/dist/{cli-4Y2XY52B.js.map → cli-JHULEOH2.js.map} +0 -0
- /package/dist/{cli-2EKRURBU.js.map → cli-NWU77YRZ.js.map} +0 -0
- /package/dist/{cli-2SDBEUER.js.map → cli-PUO75R3L.js.map} +0 -0
- /package/dist/{cli-DBMPGGOV.js.map → cli-RUNYBUIV.js.map} +0 -0
- /package/dist/{cli-KAUXC7EZ.js.map → cli-WUFQGIUG.js.map} +0 -0
- /package/dist/{github-ICZ5UDGX.js.map → github-BV42LSW2.js.map} +0 -0
- /package/dist/{github-UR6LMUMW.js.map → github-XZ7OLATY.js.map} +0 -0
- /package/dist/{json-5EQCGVCV.js.map → json-LEEXKSGP.js.map} +0 -0
- /package/dist/{json-QTYN2JQB.js.map → json-YTKUFNO3.js.map} +0 -0
- /package/dist/{lint-LOFNZZPR.js.map → lint-W4CM3EIO.js.map} +0 -0
- /package/dist/{list-EPMHOU7T.js.map → list-TB4R6AP4.js.map} +0 -0
- /package/dist/{list-GU7S6KEX.js.map → list-UDDGL2OI.js.map} +0 -0
- /package/dist/{page-25CN3AFY.js.map → page-L64NO57W.js.map} +0 -0
- /package/dist/{prepare-5GYMBF4P.js.map → prepare-GFTAYDTP.js.map} +0 -0
- /package/dist/{pretty-52Z74O6F.js.map → pretty-HYCYKYHB.js.map} +0 -0
- /package/dist/{pretty-QW6OSYRS.js.map → pretty-Q43TCD6D.js.map} +0 -0
- /package/dist/{reporters-3FXX2W4X.js.map → reporters-4HRBSMUF.js.map} +0 -0
- /package/dist/{reporters-FSXJ42EB.js.map → reporters-6TEJDXXO.js.map} +0 -0
- /package/dist/{reporters-WT53GD4P.js.map → reporters-E3FUVBQ6.js.map} +0 -0
- /package/dist/{run-H7XJMUWK.js.map → run-UDX2C54M.js.map} +0 -0
- /package/dist/{sarif-C427U3NA.js.map → sarif-WL353VTA.js.map} +0 -0
- /package/dist/{sarif-UVAFWZKS.js.map → sarif-XZFJ5VIJ.js.map} +0 -0
- /package/dist/{types-VMOT7RAL.js.map → types-7N7ETP3W.js.map} +0 -0
- /package/dist/{validate-K36F54UB.js.map → validate-CR3TI7GP.js.map} +0 -0
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
detectFramework,
|
|
4
|
+
loadSiteConfig
|
|
5
|
+
} from "./chunk-245W2Q7C.js";
|
|
2
6
|
import {
|
|
3
7
|
EmbedderUnavailableError,
|
|
4
|
-
GraphIndex,
|
|
5
8
|
bodyOf,
|
|
6
9
|
buildSearchIndex,
|
|
7
10
|
bundledShapesPath,
|
|
8
11
|
compactIri,
|
|
9
12
|
createLocalEmbedder,
|
|
10
13
|
createMockEmbedder,
|
|
11
|
-
createTrace,
|
|
12
14
|
documentsByLanguage,
|
|
15
|
+
emitJsonLd,
|
|
13
16
|
emitSearchIndex,
|
|
14
|
-
encodeVectorIndex,
|
|
15
17
|
expandTerm,
|
|
18
|
+
exportChunks,
|
|
16
19
|
exportSampleQuestions,
|
|
17
20
|
freshness,
|
|
18
21
|
loadGraph,
|
|
@@ -20,14 +23,27 @@ import {
|
|
|
20
23
|
partitionByLanguage,
|
|
21
24
|
storeToQuads,
|
|
22
25
|
validateGraph
|
|
23
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-VV4YM6VM.js";
|
|
27
|
+
import {
|
|
28
|
+
GraphIndex,
|
|
29
|
+
encodeVectorIndex
|
|
30
|
+
} from "./chunk-JFPCDIES.js";
|
|
24
31
|
import {
|
|
25
32
|
canonicalLanguage,
|
|
26
33
|
deriveGraph,
|
|
27
34
|
termIndex
|
|
28
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-JS5NCZYC.js";
|
|
29
36
|
import {
|
|
30
37
|
COPIED_SHARE,
|
|
38
|
+
copiedPairs,
|
|
39
|
+
deliveredFields,
|
|
40
|
+
mergePage,
|
|
41
|
+
openMetaView,
|
|
42
|
+
questionKey,
|
|
43
|
+
readQuestionFile,
|
|
44
|
+
withExternalMetadata
|
|
45
|
+
} from "./chunk-7RZQAMA2.js";
|
|
46
|
+
import {
|
|
31
47
|
COVERAGE_FIELDS,
|
|
32
48
|
GRAPH_NOT_APPLICABLE_TO_VARIANT,
|
|
33
49
|
GRAPH_NOT_SOFTWARE_SUBJECT,
|
|
@@ -57,9 +73,9 @@ import {
|
|
|
57
73
|
PREFIXES,
|
|
58
74
|
RDF_TYPE,
|
|
59
75
|
SECTION_COVERAGE_FIELDS,
|
|
60
|
-
SOFTWARE_SUBJECT_IRIS,
|
|
61
76
|
STDIN,
|
|
62
77
|
STDIN_PATH,
|
|
78
|
+
UNDETERMINED,
|
|
63
79
|
UNIFORM_COVERAGE_FIELD_NAMES,
|
|
64
80
|
VCARD_NS,
|
|
65
81
|
VCARD_ORGANIZATION,
|
|
@@ -68,7 +84,6 @@ import {
|
|
|
68
84
|
assertInputFormat,
|
|
69
85
|
byCodeUnit,
|
|
70
86
|
canonicalLanguageTag,
|
|
71
|
-
copiedPairs,
|
|
72
87
|
documentBase,
|
|
73
88
|
documentSetPatterns,
|
|
74
89
|
emitLocalizations,
|
|
@@ -77,24 +92,20 @@ import {
|
|
|
77
92
|
isLanguageTag,
|
|
78
93
|
isSafeRelativePath,
|
|
79
94
|
loadRunConfig,
|
|
80
|
-
mergePage,
|
|
81
95
|
metadataOf,
|
|
82
96
|
noInputMessage,
|
|
83
|
-
openMetaView,
|
|
84
97
|
parseLocalizations,
|
|
85
|
-
questionKey,
|
|
86
|
-
readQuestionFile,
|
|
87
98
|
resolveDocumentSet,
|
|
88
99
|
routesFrom,
|
|
89
100
|
searchIndexFilename,
|
|
90
101
|
vectorIndexFilename
|
|
91
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-SVB45M54.js";
|
|
92
103
|
import {
|
|
93
104
|
splitBody
|
|
94
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-27FP4KKD.js";
|
|
95
106
|
import {
|
|
96
107
|
mergeMetaProvenance
|
|
97
|
-
} from "./chunk-
|
|
108
|
+
} from "./chunk-JFB45L7D.js";
|
|
98
109
|
import {
|
|
99
110
|
findWindows,
|
|
100
111
|
isMissing,
|
|
@@ -103,7 +114,7 @@ import {
|
|
|
103
114
|
pinOfLines,
|
|
104
115
|
spellLines,
|
|
105
116
|
spliceManifestValue
|
|
106
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-MH5MX4B3.js";
|
|
107
118
|
import {
|
|
108
119
|
termLabelSource
|
|
109
120
|
} from "./chunk-DSWKBZWW.js";
|
|
@@ -111,7 +122,7 @@ import {
|
|
|
111
122
|
DocmetaError,
|
|
112
123
|
urlManifestMessage,
|
|
113
124
|
writeFileAtomic
|
|
114
|
-
} from "./chunk-
|
|
125
|
+
} from "./chunk-OZWV27SE.js";
|
|
115
126
|
import {
|
|
116
127
|
noticeOnce,
|
|
117
128
|
warn
|
|
@@ -133,87 +144,11 @@ import {
|
|
|
133
144
|
|
|
134
145
|
// src/graph/commands/export.ts
|
|
135
146
|
import { createHash } from "node:crypto";
|
|
136
|
-
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
137
|
-
import { dirname, join, resolve as
|
|
138
|
-
|
|
139
|
-
// src/graph/core/emit-jsonld.ts
|
|
140
|
-
var XSD_STRING = `${NS.xsd}string`;
|
|
141
|
-
function renderValue(term) {
|
|
142
|
-
if (term.kind === "iri") {
|
|
143
|
-
return {
|
|
144
|
-
value: { "@id": term.value },
|
|
145
|
-
kind: 0,
|
|
146
|
-
primary: term.value,
|
|
147
|
-
datatype: "",
|
|
148
|
-
language: ""
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
if (term.language) {
|
|
152
|
-
return {
|
|
153
|
-
value: { "@value": term.value, "@language": term.language },
|
|
154
|
-
kind: 1,
|
|
155
|
-
primary: term.value,
|
|
156
|
-
datatype: "",
|
|
157
|
-
language: term.language
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
if (term.datatype && term.datatype !== XSD_STRING) {
|
|
161
|
-
return {
|
|
162
|
-
value: { "@value": term.value, "@type": compactIri(term.datatype) },
|
|
163
|
-
kind: 1,
|
|
164
|
-
primary: term.value,
|
|
165
|
-
datatype: term.datatype,
|
|
166
|
-
language: ""
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
return { value: term.value, kind: 1, primary: term.value, datatype: "", language: "" };
|
|
170
|
-
}
|
|
171
|
-
function compareRendered(a, b) {
|
|
172
|
-
if (a.kind !== b.kind) return a.kind - b.kind;
|
|
173
|
-
const p = byCodeUnit(a.primary, b.primary);
|
|
174
|
-
if (p !== 0) return p;
|
|
175
|
-
return byCodeUnit(a.datatype, b.datatype) || byCodeUnit(a.language, b.language);
|
|
176
|
-
}
|
|
177
|
-
function collapse(values) {
|
|
178
|
-
const rendered = [...values].sort(compareRendered).map((v) => v.value);
|
|
179
|
-
return rendered.length === 1 ? rendered[0] : rendered;
|
|
180
|
-
}
|
|
181
|
-
function emitJsonLd(quads) {
|
|
182
|
-
const context = {};
|
|
183
|
-
for (const [prefix, ns] of PREFIXES) context[prefix] = ns;
|
|
184
|
-
const subjects = /* @__PURE__ */ new Map();
|
|
185
|
-
for (const quad of quads) {
|
|
186
|
-
let preds = subjects.get(quad.s);
|
|
187
|
-
if (!preds) {
|
|
188
|
-
preds = /* @__PURE__ */ new Map();
|
|
189
|
-
subjects.set(quad.s, preds);
|
|
190
|
-
}
|
|
191
|
-
let terms = preds.get(quad.p);
|
|
192
|
-
if (!terms) {
|
|
193
|
-
terms = [];
|
|
194
|
-
preds.set(quad.p, terms);
|
|
195
|
-
}
|
|
196
|
-
terms.push(quad.o);
|
|
197
|
-
}
|
|
198
|
-
const graph = [...subjects.entries()].sort(([a], [b]) => byCodeUnit(a, b)).map(([subject, preds]) => {
|
|
199
|
-
const node = { "@id": subject };
|
|
200
|
-
const types = preds.get(RDF_TYPE);
|
|
201
|
-
if (types) {
|
|
202
|
-
const compacted = types.map((t) => compactIri(t.value)).sort(byCodeUnit);
|
|
203
|
-
node["@type"] = compacted.length === 1 ? compacted[0] : compacted;
|
|
204
|
-
}
|
|
205
|
-
const predEntries = [...preds.entries()].filter(([p]) => p !== RDF_TYPE).sort(([a], [b]) => byCodeUnit(a, b));
|
|
206
|
-
for (const [p, terms] of predEntries) {
|
|
207
|
-
node[compactIri(p)] = collapse(terms.map(renderValue));
|
|
208
|
-
}
|
|
209
|
-
return node;
|
|
210
|
-
});
|
|
211
|
-
return `${JSON.stringify({ "@context": context, "@graph": graph }, null, 2)}
|
|
212
|
-
`;
|
|
213
|
-
}
|
|
147
|
+
import { mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
148
|
+
import { dirname as dirname2, join as join2, resolve as resolve3 } from "node:path";
|
|
214
149
|
|
|
215
150
|
// src/graph/core/emit-rdfxml.ts
|
|
216
|
-
var
|
|
151
|
+
var XSD_STRING = `${NS.xsd}string`;
|
|
217
152
|
function escapeText(value) {
|
|
218
153
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
219
154
|
}
|
|
@@ -287,7 +222,7 @@ function emitRdfXml(quads, prefixes) {
|
|
|
287
222
|
lines.push(
|
|
288
223
|
` <${qname} xml:lang="${escapeAttr(term.language)}">${escapeText(term.value)}</${qname}>`
|
|
289
224
|
);
|
|
290
|
-
} else if (term.datatype && term.datatype !==
|
|
225
|
+
} else if (term.datatype && term.datatype !== XSD_STRING) {
|
|
291
226
|
lines.push(
|
|
292
227
|
` <${qname} rdf:datatype="${escapeAttr(term.datatype)}">${escapeText(term.value)}</${qname}>`
|
|
293
228
|
);
|
|
@@ -381,7 +316,7 @@ function writeZip(entries) {
|
|
|
381
316
|
|
|
382
317
|
// src/graph/core/iirds-package.ts
|
|
383
318
|
var GRAPH_DOCUMENT = `${NS.graph}Document`;
|
|
384
|
-
var
|
|
319
|
+
var XSD_STRING2 = `${NS.xsd}string`;
|
|
385
320
|
var MEDIA_TYPES = {
|
|
386
321
|
".html": "text/html",
|
|
387
322
|
".htm": "text/html",
|
|
@@ -474,7 +409,7 @@ function projectPackage(store, opts, cwd) {
|
|
|
474
409
|
add(doc, pred, { kind: "literal", value: o.value, language: o.language });
|
|
475
410
|
} else if (o.termType === "Literal") {
|
|
476
411
|
const dt = o.datatype.value;
|
|
477
|
-
add(doc, pred, lit(o.value, dt !==
|
|
412
|
+
add(doc, pred, lit(o.value, dt !== XSD_STRING2 ? dt : void 0));
|
|
478
413
|
} else {
|
|
479
414
|
add(doc, pred, iri(o.value));
|
|
480
415
|
if (pred === IIRDS_RELATES_TO_PRODUCT_VARIANT) variants.add(o.value);
|
|
@@ -497,8 +432,115 @@ function projectPackage(store, opts, cwd) {
|
|
|
497
432
|
return { quads, prefixes, contentFiles, warnings };
|
|
498
433
|
}
|
|
499
434
|
|
|
435
|
+
// src/graph/commands/llms.ts
|
|
436
|
+
import { existsSync as existsSync2, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
437
|
+
import { dirname, join, resolve as resolve2 } from "node:path";
|
|
438
|
+
var LLMS_FILENAME = "llms.txt";
|
|
439
|
+
var BARE = /* @__PURE__ */ new Set(["Docusaurus", "Nextra", "Fumadocs", "Mintlify", "Fern"]);
|
|
440
|
+
var HTML = /* @__PURE__ */ new Set(["VitePress", "Rspress", "Sphinx", "Jekyll"]);
|
|
441
|
+
function urlStyle(framework) {
|
|
442
|
+
if (framework !== null && BARE.has(framework)) return "bare";
|
|
443
|
+
if (framework !== null && HTML.has(framework)) return "html";
|
|
444
|
+
return "slash";
|
|
445
|
+
}
|
|
446
|
+
function routeOf(path2, routes, style) {
|
|
447
|
+
const holders = routes.filter((r) => r.root === "" || path2.startsWith(`${r.root}/`));
|
|
448
|
+
const route = holders.sort((a, b) => b.root.length - a.root.length)[0];
|
|
449
|
+
if (route === void 0) return void 0;
|
|
450
|
+
const rest = (route.root === "" ? path2 : path2.slice(route.root.length + 1)).replace(/\.[^./]+$/, "");
|
|
451
|
+
const segments = rest.split("/");
|
|
452
|
+
const last = segments[segments.length - 1] ?? "";
|
|
453
|
+
const index = route.indexFiles.includes(last);
|
|
454
|
+
const parts = [...route.basePath.split("/"), ...index ? segments.slice(0, -1) : segments].filter((s) => s !== "");
|
|
455
|
+
const joined = `/${parts.join("/")}`;
|
|
456
|
+
if (index || parts.length === 0) return style === "bare" ? joined : `${joined === "/" ? "" : joined}/`;
|
|
457
|
+
if (style === "slash") return `${joined}/`;
|
|
458
|
+
return style === "html" ? `${joined}.html` : joined;
|
|
459
|
+
}
|
|
460
|
+
var oneLine = (text) => text.replace(/\s+/g, " ").trim();
|
|
461
|
+
function renderLlms(head, entries) {
|
|
462
|
+
const lines = [`# ${oneLine(head.title)}`, ""];
|
|
463
|
+
if (head.summary !== void 0) lines.push(`> ${oneLine(head.summary)}`, "");
|
|
464
|
+
const languages = [...new Set(entries.map((e) => e.language))].sort(byCodeUnit);
|
|
465
|
+
for (const language of languages) {
|
|
466
|
+
lines.push(`## ${languages.length > 1 ? language : "Docs"}`, "");
|
|
467
|
+
for (const e of entries.filter((x) => x.language === language)) {
|
|
468
|
+
const text = `[${oneLine(e.title).replace(/([[\]])/g, "\\$1")}](${e.link})`;
|
|
469
|
+
lines.push(`- ${text}${e.description === void 0 ? "" : `: ${oneLine(e.description)}`}`);
|
|
470
|
+
}
|
|
471
|
+
lines.push("");
|
|
472
|
+
}
|
|
473
|
+
return lines.join("\n");
|
|
474
|
+
}
|
|
475
|
+
async function exportLlms(opts) {
|
|
476
|
+
const { cwd, config } = opts;
|
|
477
|
+
const settings = config.export.llms;
|
|
478
|
+
const title = settings?.title;
|
|
479
|
+
const origin = settings?.origin;
|
|
480
|
+
if (title === void 0) throw new GraphError("graph export llms needs graph.export.llms.title.");
|
|
481
|
+
if (origin === void 0) {
|
|
482
|
+
throw new GraphError("graph export llms needs graph.export.llms.origin, the site's scheme and host.");
|
|
483
|
+
}
|
|
484
|
+
const graph = GraphIndex.fromQuads(storeToQuads(loadGraph(opts.graphPath)), Object.fromEntries(PREFIXES));
|
|
485
|
+
const sources = documentBase(config, {}, cwd);
|
|
486
|
+
const pages = [];
|
|
487
|
+
let missing = 0;
|
|
488
|
+
for (const doc of graph.instancesOf(`${NS.graph}Document`)) {
|
|
489
|
+
const path2 = graph.literal(doc, `${NS.graph}path`);
|
|
490
|
+
if (path2 === void 0 || path2 === STDIN_PATH) continue;
|
|
491
|
+
const abs = resolve2(sources, path2);
|
|
492
|
+
if (existsSync2(abs)) pages.push({ doc, path: path2, content: readFileSync(abs, "utf8") });
|
|
493
|
+
else missing += 1;
|
|
494
|
+
}
|
|
495
|
+
pages.sort((a, b) => byCodeUnit(a.path, b.path));
|
|
496
|
+
const routes = routesFrom(config, sources);
|
|
497
|
+
const style = urlStyle(detectFramework(loadSiteConfig(config.configDir).dir ?? config.configDir));
|
|
498
|
+
const paths = pages.map((p) => p.path);
|
|
499
|
+
const view = await openMetaView(opts.source, cwd, paths, sources);
|
|
500
|
+
const models = await withExternalMetadata(
|
|
501
|
+
pages.map((p) => analyzeDoc(p.content, p.path, new Set(paths), { routes })),
|
|
502
|
+
view
|
|
503
|
+
);
|
|
504
|
+
const entries = [];
|
|
505
|
+
let unrouted = 0;
|
|
506
|
+
for (const [n, page] of pages.entries()) {
|
|
507
|
+
const route = routeOf(page.path, routes, style);
|
|
508
|
+
const model = models[n];
|
|
509
|
+
if (route === void 0 || model === void 0) {
|
|
510
|
+
unrouted += 1;
|
|
511
|
+
continue;
|
|
512
|
+
}
|
|
513
|
+
const metadata = await deliveredFields(model.frontmatter, view.refsFor(page.path, model.frontmatter), view.validator);
|
|
514
|
+
const tag = graph.literal(page.doc, `${NS.dcterms}language`);
|
|
515
|
+
const description = metadata.description;
|
|
516
|
+
entries.push({
|
|
517
|
+
language: tag === void 0 ? UNDETERMINED : canonicalLanguageTag(tag),
|
|
518
|
+
title: typeof metadata.title === "string" ? metadata.title : graph.literal(page.doc, `${NS.dcterms}title`) ?? page.path,
|
|
519
|
+
link: `${origin}${route}`,
|
|
520
|
+
...typeof description === "string" ? { description } : {}
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
mkdirSync(dirname(opts.outPath), { recursive: true });
|
|
524
|
+
writeFileSync(opts.outPath, renderLlms({ title, ...settings?.summary === void 0 ? {} : { summary: settings.summary } }, entries), "utf8");
|
|
525
|
+
const warnings = [];
|
|
526
|
+
if (missing > 0) {
|
|
527
|
+
warnings.push(
|
|
528
|
+
missing === 1 ? "1 page in the graph is not on disk, so llms.txt leaves it out; run manni graph build." : `${String(missing)} pages in the graph are not on disk, so llms.txt leaves them out; run manni graph build.`
|
|
529
|
+
);
|
|
530
|
+
}
|
|
531
|
+
if (unrouted > 0) {
|
|
532
|
+
warnings.push(
|
|
533
|
+
unrouted === 1 ? "1 page is under no route, so llms.txt leaves it out." : `${String(unrouted)} pages are under no route, so llms.txt leaves them out.`
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
return { pages: entries.length, warnings };
|
|
537
|
+
}
|
|
538
|
+
function defaultLlmsPath(graphPath) {
|
|
539
|
+
return join(dirname(graphPath), LLMS_FILENAME);
|
|
540
|
+
}
|
|
541
|
+
|
|
500
542
|
// src/graph/commands/export.ts
|
|
501
|
-
var EXPORT_TARGETS = ["jsonld", "iirds", "search", "questions"];
|
|
543
|
+
var EXPORT_TARGETS = ["jsonld", "iirds", "search", "questions", "chunks", "llms"];
|
|
502
544
|
var EXTENSION = {
|
|
503
545
|
jsonld: ".jsonld",
|
|
504
546
|
iirds: ".iirds"
|
|
@@ -511,10 +553,10 @@ function runJsonLd(cwd, graphPath, out) {
|
|
|
511
553
|
const quads = storeToQuads(store);
|
|
512
554
|
const serialized = emitJsonLd(quads);
|
|
513
555
|
const nodes = new Set(quads.map((q) => q.s)).size;
|
|
514
|
-
const outPath = out ?
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
return { outPath, format: "jsonld", nodes, warnings: [] };
|
|
556
|
+
const outPath = out ? resolve3(cwd, out) : withExtension(graphPath, EXTENSION.jsonld);
|
|
557
|
+
mkdirSync2(dirname2(outPath), { recursive: true });
|
|
558
|
+
writeFileSync2(outPath, serialized, "utf8");
|
|
559
|
+
return { outPath, format: "jsonld", nodes, warnings: [], files: [outPath] };
|
|
518
560
|
}
|
|
519
561
|
function runIirds(cwd, sources, graphPath, iirds, baseIri, out) {
|
|
520
562
|
const store = loadGraph(graphPath);
|
|
@@ -529,7 +571,7 @@ function runIirds(cwd, sources, graphPath, iirds, baseIri, out) {
|
|
|
529
571
|
sources
|
|
530
572
|
);
|
|
531
573
|
const metadata = emitRdfXml(projection.quads, projection.prefixes);
|
|
532
|
-
const content = [...projection.contentFiles].sort((a, b) => byCodeUnit(a.zipPath, b.zipPath)).map((f) => ({ name: f.zipPath, data:
|
|
574
|
+
const content = [...projection.contentFiles].sort((a, b) => byCodeUnit(a.zipPath, b.zipPath)).map((f) => ({ name: f.zipPath, data: readFileSync2(f.absPath) }));
|
|
533
575
|
const entries = [
|
|
534
576
|
{
|
|
535
577
|
name: "mimetype",
|
|
@@ -539,11 +581,11 @@ function runIirds(cwd, sources, graphPath, iirds, baseIri, out) {
|
|
|
539
581
|
{ name: "META-INF/metadata.rdf", data: Buffer.from(metadata, "utf8") },
|
|
540
582
|
...content
|
|
541
583
|
];
|
|
542
|
-
const outPath = out ?
|
|
543
|
-
|
|
544
|
-
|
|
584
|
+
const outPath = out ? resolve3(cwd, out) : withExtension(graphPath, EXTENSION.iirds);
|
|
585
|
+
mkdirSync2(dirname2(outPath), { recursive: true });
|
|
586
|
+
writeFileSync2(outPath, writeZip(entries));
|
|
545
587
|
const nodes = new Set(projection.quads.map((q) => q.s)).size;
|
|
546
|
-
return { outPath, format: "iirds", nodes, warnings: projection.warnings };
|
|
588
|
+
return { outPath, format: "iirds", nodes, warnings: projection.warnings, files: [outPath] };
|
|
547
589
|
}
|
|
548
590
|
function searchIndexDigest(raw) {
|
|
549
591
|
return `sha256:${createHash("sha256").update(raw, "utf8").digest("hex")}`;
|
|
@@ -558,8 +600,8 @@ function runSearchIndex(cwd, sources, graphPath, out) {
|
|
|
558
600
|
const index = buildSearchIndex(graph, sources, { warnings });
|
|
559
601
|
const byLanguage = partitionByLanguage(graph, index);
|
|
560
602
|
const docCounts = documentsByLanguage(graph);
|
|
561
|
-
const outDir = out ?
|
|
562
|
-
|
|
603
|
+
const outDir = out ? resolve3(cwd, out) : dirname2(graphPath);
|
|
604
|
+
mkdirSync2(outDir, { recursive: true });
|
|
563
605
|
const languages = [];
|
|
564
606
|
for (const [language, doc] of byLanguage) {
|
|
565
607
|
if (!isLanguageTag(language)) {
|
|
@@ -569,7 +611,7 @@ function runSearchIndex(cwd, sources, graphPath, out) {
|
|
|
569
611
|
}
|
|
570
612
|
const filename = searchIndexFilename(language);
|
|
571
613
|
const serialized = emitSearchIndex(doc);
|
|
572
|
-
|
|
614
|
+
writeFileSync2(join2(outDir, filename), serialized, "utf8");
|
|
573
615
|
languages.push({
|
|
574
616
|
language,
|
|
575
617
|
documents: docCounts.get(language) ?? 0,
|
|
@@ -580,8 +622,8 @@ function runSearchIndex(cwd, sources, graphPath, out) {
|
|
|
580
622
|
}
|
|
581
623
|
});
|
|
582
624
|
}
|
|
583
|
-
const manifestPath =
|
|
584
|
-
|
|
625
|
+
const manifestPath = join2(outDir, LOCALIZATIONS_FILENAME);
|
|
626
|
+
writeFileSync2(
|
|
585
627
|
manifestPath,
|
|
586
628
|
emitLocalizations({ version: 1, languages }),
|
|
587
629
|
"utf8"
|
|
@@ -590,7 +632,8 @@ function runSearchIndex(cwd, sources, graphPath, out) {
|
|
|
590
632
|
outPath: manifestPath,
|
|
591
633
|
format: "search",
|
|
592
634
|
nodes: index.entries.length,
|
|
593
|
-
warnings
|
|
635
|
+
warnings,
|
|
636
|
+
files: [...languages.map((l) => join2(outDir, l.search.path)), manifestPath]
|
|
594
637
|
};
|
|
595
638
|
}
|
|
596
639
|
async function runQuestions(cwd, sources, graphPath, config, source, out) {
|
|
@@ -601,14 +644,14 @@ async function runQuestions(cwd, sources, graphPath, config, source, out) {
|
|
|
601
644
|
config.questionFiles,
|
|
602
645
|
config.configDir
|
|
603
646
|
);
|
|
604
|
-
const outPath = out ?
|
|
605
|
-
|
|
606
|
-
|
|
647
|
+
const outPath = out ? resolve3(cwd, out) : join2(dirname2(graphPath), "questions.jsonl");
|
|
648
|
+
mkdirSync2(dirname2(outPath), { recursive: true });
|
|
649
|
+
writeFileSync2(outPath, lines.map((l) => `${l}
|
|
607
650
|
`).join(""), "utf8");
|
|
608
651
|
const warnings = stale === 0 ? [] : [
|
|
609
652
|
stale === 1 ? "1 answer changed since it was pinned, so it is exported as it reads now, marked stale." : `${String(stale)} answers changed since they were pinned, so they are exported as they read now, marked stale.`
|
|
610
653
|
];
|
|
611
|
-
return { outPath, format: "questions", nodes: lines.length, warnings };
|
|
654
|
+
return { outPath, format: "questions", nodes: lines.length, warnings, files: [outPath] };
|
|
612
655
|
}
|
|
613
656
|
async function runExport(opts) {
|
|
614
657
|
const cwd = opts.cwd ?? process.cwd();
|
|
@@ -617,6 +660,9 @@ async function runExport(opts) {
|
|
|
617
660
|
`Unknown export target "${opts.format}". Use ${EXPORT_TARGETS.join(" | ")}.`
|
|
618
661
|
);
|
|
619
662
|
}
|
|
663
|
+
if (opts.evals !== void 0 && opts.format !== "chunks") {
|
|
664
|
+
throw new GraphError("--evals applies only to graph export chunks.");
|
|
665
|
+
}
|
|
620
666
|
const config = loadRunConfig(
|
|
621
667
|
{
|
|
622
668
|
...opts.config === void 0 ? {} : { configPath: opts.config },
|
|
@@ -624,9 +670,48 @@ async function runExport(opts) {
|
|
|
624
670
|
},
|
|
625
671
|
cwd
|
|
626
672
|
);
|
|
627
|
-
const graphPath =
|
|
673
|
+
const graphPath = resolve3(cwd, opts.graph ?? config.out);
|
|
628
674
|
const sources = documentBase(config, {}, cwd);
|
|
629
675
|
if (opts.format === "jsonld") return runJsonLd(cwd, graphPath, opts.out);
|
|
676
|
+
if (opts.format === "chunks") {
|
|
677
|
+
const configured = config.export.chunks.evals;
|
|
678
|
+
const evals = opts.evals !== void 0 ? { label: opts.evals, path: resolve3(cwd, opts.evals) } : configured === null ? void 0 : { label: configured, path: resolve3(config.configDir, configured) };
|
|
679
|
+
const result = await exportChunks({
|
|
680
|
+
cwd,
|
|
681
|
+
config,
|
|
682
|
+
source: {
|
|
683
|
+
...opts.config === void 0 ? {} : { configPath: opts.config },
|
|
684
|
+
...opts.noConfig === void 0 ? {} : { noConfig: opts.noConfig }
|
|
685
|
+
},
|
|
686
|
+
graphPath,
|
|
687
|
+
// `--out` names the directory, as for `search`: there is more than one file.
|
|
688
|
+
outDir: opts.out ? resolve3(cwd, opts.out) : dirname2(graphPath),
|
|
689
|
+
...evals === void 0 ? {} : { evals }
|
|
690
|
+
});
|
|
691
|
+
return {
|
|
692
|
+
outPath: result.manifestPath,
|
|
693
|
+
format: "chunks",
|
|
694
|
+
nodes: result.rows,
|
|
695
|
+
warnings: result.warnings,
|
|
696
|
+
notices: result.notices,
|
|
697
|
+
files: result.files,
|
|
698
|
+
withheld: result.withheld
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
if (opts.format === "llms") {
|
|
702
|
+
const outPath = opts.out ? resolve3(cwd, opts.out) : defaultLlmsPath(graphPath);
|
|
703
|
+
const { pages, warnings } = await exportLlms({
|
|
704
|
+
cwd,
|
|
705
|
+
config,
|
|
706
|
+
source: {
|
|
707
|
+
...opts.config === void 0 ? {} : { configPath: opts.config },
|
|
708
|
+
...opts.noConfig === void 0 ? {} : { noConfig: opts.noConfig }
|
|
709
|
+
},
|
|
710
|
+
graphPath,
|
|
711
|
+
outPath
|
|
712
|
+
});
|
|
713
|
+
return { outPath, format: "llms", nodes: pages, warnings, files: [outPath] };
|
|
714
|
+
}
|
|
630
715
|
if (opts.format === "search") {
|
|
631
716
|
return runSearchIndex(cwd, sources, graphPath, opts.out);
|
|
632
717
|
}
|
|
@@ -654,7 +739,7 @@ async function runExport(opts) {
|
|
|
654
739
|
}
|
|
655
740
|
|
|
656
741
|
// src/graph/commands/query.ts
|
|
657
|
-
import { resolve as
|
|
742
|
+
import { resolve as resolve4 } from "node:path";
|
|
658
743
|
import { DataFactory as DataFactory2 } from "n3";
|
|
659
744
|
function runQuery(opts = {}) {
|
|
660
745
|
const cwd = opts.cwd ?? process.cwd();
|
|
@@ -665,7 +750,7 @@ function runQuery(opts = {}) {
|
|
|
665
750
|
},
|
|
666
751
|
cwd
|
|
667
752
|
);
|
|
668
|
-
const store = loadGraph(
|
|
753
|
+
const store = loadGraph(resolve4(cwd, opts.graph ?? config.out));
|
|
669
754
|
const s = opts.s ? DataFactory2.namedNode(expandTerm(opts.s)) : null;
|
|
670
755
|
const p = opts.p ? DataFactory2.namedNode(expandTerm(opts.p)) : null;
|
|
671
756
|
const oValue = opts.o ? expandTerm(opts.o) : null;
|
|
@@ -702,9 +787,9 @@ ${result.matches.length} match(es)`);
|
|
|
702
787
|
}
|
|
703
788
|
|
|
704
789
|
// src/graph/commands/fill.ts
|
|
705
|
-
import { readFileSync as
|
|
790
|
+
import { readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "node:fs";
|
|
706
791
|
import { readFile } from "node:fs/promises";
|
|
707
|
-
import { resolve as
|
|
792
|
+
import { resolve as resolve7 } from "node:path";
|
|
708
793
|
|
|
709
794
|
// src/graph/core/frontmatter-edit.ts
|
|
710
795
|
import {
|
|
@@ -934,8 +1019,8 @@ function existingGraphFields(content) {
|
|
|
934
1019
|
}
|
|
935
1020
|
|
|
936
1021
|
// src/graph/core/fill-guard.ts
|
|
937
|
-
import { readFileSync as
|
|
938
|
-
import { resolve as
|
|
1022
|
+
import { readFileSync as readFileSync3 } from "node:fs";
|
|
1023
|
+
import { resolve as resolve5 } from "node:path";
|
|
939
1024
|
import { DataFactory as DataFactory3, Store } from "n3";
|
|
940
1025
|
var GUARDED_FIELDS = [
|
|
941
1026
|
"label",
|
|
@@ -1024,7 +1109,7 @@ var FillGuard = class _FillGuard {
|
|
|
1024
1109
|
guard.models.set(
|
|
1025
1110
|
path2,
|
|
1026
1111
|
analyzeDoc(
|
|
1027
|
-
inline.get(path2) ??
|
|
1112
|
+
inline.get(path2) ?? readFileSync3(resolve5(cwd, path2), "utf8"),
|
|
1028
1113
|
path2,
|
|
1029
1114
|
guard.allPaths,
|
|
1030
1115
|
inputs.has(path2) ? guard.analyzeOptions : byExtension
|
|
@@ -1530,8 +1615,8 @@ async function makeProvider(config, flags = {}) {
|
|
|
1530
1615
|
}
|
|
1531
1616
|
|
|
1532
1617
|
// src/graph/commands/fill-questions.ts
|
|
1533
|
-
import { existsSync as
|
|
1534
|
-
import { resolve as
|
|
1618
|
+
import { existsSync as existsSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
1619
|
+
import { resolve as resolve6 } from "node:path";
|
|
1535
1620
|
import { isMap as isMap2, isSeq, parseDocument as parseDocument2 } from "yaml";
|
|
1536
1621
|
var QUESTIONS_KEY = "sample-questions";
|
|
1537
1622
|
function isRecord(value) {
|
|
@@ -1845,7 +1930,7 @@ function questionsInFile(abs, label) {
|
|
|
1845
1930
|
return readQuestionFile(abs, label).map((q) => q.question);
|
|
1846
1931
|
}
|
|
1847
1932
|
function repinQuestionFile(abs, label, configDir, dryRun) {
|
|
1848
|
-
const text =
|
|
1933
|
+
const text = existsSync3(abs) ? readFileSync4(abs, "utf8") : void 0;
|
|
1849
1934
|
readQuestionFile(abs, label, text);
|
|
1850
1935
|
const doc = parseDocument2(text ?? "");
|
|
1851
1936
|
const outcomes = [];
|
|
@@ -1853,10 +1938,10 @@ function repinQuestionFile(abs, label, configDir, dryRun) {
|
|
|
1853
1938
|
const bodies = /* @__PURE__ */ new Map();
|
|
1854
1939
|
const bodyAt = (file) => {
|
|
1855
1940
|
if (!bodies.has(file)) {
|
|
1856
|
-
const page =
|
|
1941
|
+
const page = resolve6(configDir, file);
|
|
1857
1942
|
bodies.set(
|
|
1858
1943
|
file,
|
|
1859
|
-
|
|
1944
|
+
existsSync3(page) ? bodyOf(readFileSync4(page, "utf8"), formatOf(file)).body : void 0
|
|
1860
1945
|
);
|
|
1861
1946
|
}
|
|
1862
1947
|
return bodies.get(file);
|
|
@@ -1899,7 +1984,7 @@ function repinQuestionFile(abs, label, configDir, dryRun) {
|
|
|
1899
1984
|
}
|
|
1900
1985
|
}
|
|
1901
1986
|
}
|
|
1902
|
-
if (changed && !dryRun)
|
|
1987
|
+
if (changed && !dryRun) writeFileSync3(abs, doc.toString(), "utf8");
|
|
1903
1988
|
return { changed, outcomes, warnings };
|
|
1904
1989
|
}
|
|
1905
1990
|
|
|
@@ -2015,7 +2100,7 @@ async function runFill(opts = {}) {
|
|
|
2015
2100
|
proposalSchema(fields, { sections: sectionFields, lenient: true })
|
|
2016
2101
|
);
|
|
2017
2102
|
const cache = new FillCache(
|
|
2018
|
-
|
|
2103
|
+
resolve7(cwd, config.fill.cacheDir),
|
|
2019
2104
|
!opts.noCache
|
|
2020
2105
|
);
|
|
2021
2106
|
const confidenceThreshold = opts.confidence ?? config.fill.confidenceThreshold;
|
|
@@ -2027,7 +2112,7 @@ async function runFill(opts = {}) {
|
|
|
2027
2112
|
);
|
|
2028
2113
|
const results = [];
|
|
2029
2114
|
let turnsUsed = 0;
|
|
2030
|
-
const shapesPaths = config.check.shapes.length > 0 ? config.check.shapes.map((p) =>
|
|
2115
|
+
const shapesPaths = config.check.shapes.length > 0 ? config.check.shapes.map((p) => resolve7(cwd, p)) : [bundledShapesPath(import.meta.url)];
|
|
2031
2116
|
const guardFiles = [
|
|
2032
2117
|
.../* @__PURE__ */ new Set([
|
|
2033
2118
|
...config.collections.length > 0 ? resolveDocumentSet(config, {}, "fill", cwd, base2) : [],
|
|
@@ -2053,7 +2138,7 @@ async function runFill(opts = {}) {
|
|
|
2053
2138
|
if (mergeErrors.has(path2)) continue;
|
|
2054
2139
|
let text;
|
|
2055
2140
|
try {
|
|
2056
|
-
text =
|
|
2141
|
+
text = readFileSync5(resolve7(base2, path2), "utf8");
|
|
2057
2142
|
} catch (e) {
|
|
2058
2143
|
mergeErrors.set(path2, e);
|
|
2059
2144
|
continue;
|
|
@@ -2116,7 +2201,7 @@ async function runFill(opts = {}) {
|
|
|
2116
2201
|
}
|
|
2117
2202
|
}
|
|
2118
2203
|
for (const label of config.questionFiles) {
|
|
2119
|
-
for (const q of questionsInFile(
|
|
2204
|
+
for (const q of questionsInFile(resolve7(config.configDir, label), label)) {
|
|
2120
2205
|
const key = questionKey(q);
|
|
2121
2206
|
if (key !== "" && !known.has(key)) known.set(key, label);
|
|
2122
2207
|
}
|
|
@@ -2185,10 +2270,10 @@ async function runFill(opts = {}) {
|
|
|
2185
2270
|
return [...out].map(([label, altLabels]) => ({ label, altLabels }));
|
|
2186
2271
|
}
|
|
2187
2272
|
for (const path2 of files) {
|
|
2188
|
-
const absPath =
|
|
2273
|
+
const absPath = resolve7(base2, path2);
|
|
2189
2274
|
let content;
|
|
2190
2275
|
try {
|
|
2191
|
-
content =
|
|
2276
|
+
content = readFileSync5(absPath, "utf8");
|
|
2192
2277
|
} catch (e) {
|
|
2193
2278
|
throw new GraphError(
|
|
2194
2279
|
`cannot read ${path2}: ${errorMessage(e)}`
|
|
@@ -2228,7 +2313,7 @@ async function runFill(opts = {}) {
|
|
|
2228
2313
|
if (withQuestions) {
|
|
2229
2314
|
for (const label of config.questionFiles) {
|
|
2230
2315
|
const repinned = repinQuestionFile(
|
|
2231
|
-
|
|
2316
|
+
resolve7(config.configDir, label),
|
|
2232
2317
|
label,
|
|
2233
2318
|
config.configDir,
|
|
2234
2319
|
opts.dryRun ?? false
|
|
@@ -2285,7 +2370,7 @@ async function runFill(opts = {}) {
|
|
|
2285
2370
|
if (pass.state === "changed") {
|
|
2286
2371
|
if (!opts.dryRun) {
|
|
2287
2372
|
if (absPath === void 0) result.filledContent = pass.content;
|
|
2288
|
-
else
|
|
2373
|
+
else writeFileSync4(absPath, pass.content, "utf8");
|
|
2289
2374
|
}
|
|
2290
2375
|
return {
|
|
2291
2376
|
...result,
|
|
@@ -2555,7 +2640,7 @@ async function runFill(opts = {}) {
|
|
|
2555
2640
|
}
|
|
2556
2641
|
const manifests = await spliceAll(manifestWrites);
|
|
2557
2642
|
if (!opts.dryRun && absPath !== void 0) {
|
|
2558
|
-
if (pageContent !== content)
|
|
2643
|
+
if (pageContent !== content) writeFileSync4(absPath, pageContent, "utf8");
|
|
2559
2644
|
for (const m of manifests) {
|
|
2560
2645
|
if (m.text !== m.before) {
|
|
2561
2646
|
await writeFileAtomic(m.absPath, m.text, { createParents: true });
|
|
@@ -2715,8 +2800,8 @@ function renderFill(report, format) {
|
|
|
2715
2800
|
|
|
2716
2801
|
// src/graph/commands/embed.ts
|
|
2717
2802
|
import { createHash as createHash2 } from "node:crypto";
|
|
2718
|
-
import { existsSync as
|
|
2719
|
-
import path, { dirname as
|
|
2803
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "node:fs";
|
|
2804
|
+
import path, { dirname as dirname3, join as join3, resolve as resolve8 } from "node:path";
|
|
2720
2805
|
function embedText(entry) {
|
|
2721
2806
|
return [entry.title, entry.labels, entry.description, entry.text].filter((part) => part !== void 0 && part !== "").join("\n\n");
|
|
2722
2807
|
}
|
|
@@ -2731,14 +2816,14 @@ var VectorCache = class {
|
|
|
2731
2816
|
dir;
|
|
2732
2817
|
enabled;
|
|
2733
2818
|
path(key) {
|
|
2734
|
-
return
|
|
2819
|
+
return join3(this.dir, `${key}.json`);
|
|
2735
2820
|
}
|
|
2736
2821
|
get(key) {
|
|
2737
2822
|
if (!this.enabled) return void 0;
|
|
2738
2823
|
const file = this.path(key);
|
|
2739
|
-
if (!
|
|
2824
|
+
if (!existsSync4(file)) return void 0;
|
|
2740
2825
|
try {
|
|
2741
|
-
const parsed = JSON.parse(
|
|
2826
|
+
const parsed = JSON.parse(readFileSync6(file, "utf8"));
|
|
2742
2827
|
return Array.isArray(parsed) ? Float32Array.from(parsed) : void 0;
|
|
2743
2828
|
} catch {
|
|
2744
2829
|
return void 0;
|
|
@@ -2746,8 +2831,8 @@ var VectorCache = class {
|
|
|
2746
2831
|
}
|
|
2747
2832
|
set(key, vector) {
|
|
2748
2833
|
if (!this.enabled) return;
|
|
2749
|
-
|
|
2750
|
-
|
|
2834
|
+
mkdirSync3(this.dir, { recursive: true });
|
|
2835
|
+
writeFileSync5(this.path(key), JSON.stringify([...vector]), "utf8");
|
|
2751
2836
|
}
|
|
2752
2837
|
};
|
|
2753
2838
|
async function makeEmbedder(opts, model, dtype) {
|
|
@@ -2783,25 +2868,25 @@ async function runEmbed(opts = {}) {
|
|
|
2783
2868
|
},
|
|
2784
2869
|
cwd
|
|
2785
2870
|
);
|
|
2786
|
-
const graphPath =
|
|
2787
|
-
const indexDir = opts.index ?
|
|
2788
|
-
const manifestPath =
|
|
2789
|
-
if (!
|
|
2871
|
+
const graphPath = resolve8(cwd, opts.graph ?? config.out);
|
|
2872
|
+
const indexDir = opts.index ? resolve8(cwd, opts.index) : dirname3(graphPath);
|
|
2873
|
+
const manifestPath = join3(indexDir, LOCALIZATIONS_FILENAME);
|
|
2874
|
+
if (!existsSync4(manifestPath)) {
|
|
2790
2875
|
throw new GraphError(
|
|
2791
2876
|
`Localization manifest not found: ${manifestPath} \u2014 run \`manni graph export search\` first.`
|
|
2792
2877
|
);
|
|
2793
2878
|
}
|
|
2794
|
-
const manifest = parseLocalizations(
|
|
2879
|
+
const manifest = parseLocalizations(readFileSync6(manifestPath, "utf8"));
|
|
2795
2880
|
if (!manifest) {
|
|
2796
2881
|
throw new GraphError(
|
|
2797
2882
|
`Not a manni graph localization manifest: ${manifestPath} \u2014 re-run \`manni graph export search\`.`
|
|
2798
2883
|
);
|
|
2799
2884
|
}
|
|
2800
2885
|
const outSetting = opts.out ?? config.embed.out;
|
|
2801
|
-
const outDir = outSetting ?
|
|
2802
|
-
|
|
2886
|
+
const outDir = outSetting ? resolve8(cwd, outSetting) : indexDir;
|
|
2887
|
+
mkdirSync3(outDir, { recursive: true });
|
|
2803
2888
|
const cache = new VectorCache(
|
|
2804
|
-
|
|
2889
|
+
resolve8(cwd, config.embed.cacheDir),
|
|
2805
2890
|
!opts.noCache
|
|
2806
2891
|
);
|
|
2807
2892
|
const embedders = /* @__PURE__ */ new Map();
|
|
@@ -2816,13 +2901,13 @@ async function runEmbed(opts = {}) {
|
|
|
2816
2901
|
const languages = [];
|
|
2817
2902
|
const updated = [];
|
|
2818
2903
|
for (const entry of manifest.languages) {
|
|
2819
|
-
const indexPath =
|
|
2820
|
-
if (!
|
|
2904
|
+
const indexPath = join3(indexDir, entry.search.path);
|
|
2905
|
+
if (!existsSync4(indexPath)) {
|
|
2821
2906
|
throw new GraphError(
|
|
2822
2907
|
`Search index not found: ${indexPath} \u2014 the manifest names it; re-run \`manni graph export search\`.`
|
|
2823
2908
|
);
|
|
2824
2909
|
}
|
|
2825
|
-
const raw =
|
|
2910
|
+
const raw = readFileSync6(indexPath, "utf8");
|
|
2826
2911
|
const source = `sha256:${sha2562(raw)}`;
|
|
2827
2912
|
if (entry.search.digest !== source) {
|
|
2828
2913
|
throw new GraphError(
|
|
@@ -2870,9 +2955,9 @@ async function runEmbed(opts = {}) {
|
|
|
2870
2955
|
vectors.push({ id: item.id, vector });
|
|
2871
2956
|
}
|
|
2872
2957
|
const filename = vectorIndexFilename(entry.language);
|
|
2873
|
-
const outPath =
|
|
2958
|
+
const outPath = join3(outDir, filename);
|
|
2874
2959
|
const manifestRelative = manifestRelativePath(indexDir, outPath);
|
|
2875
|
-
|
|
2960
|
+
writeFileSync5(
|
|
2876
2961
|
outPath,
|
|
2877
2962
|
encodeVectorIndex(vectors, {
|
|
2878
2963
|
model: identity.model,
|
|
@@ -2902,7 +2987,7 @@ async function runEmbed(opts = {}) {
|
|
|
2902
2987
|
}
|
|
2903
2988
|
});
|
|
2904
2989
|
}
|
|
2905
|
-
|
|
2990
|
+
writeFileSync5(
|
|
2906
2991
|
manifestPath,
|
|
2907
2992
|
emitLocalizations({ version: 1, languages: updated }),
|
|
2908
2993
|
"utf8"
|
|
@@ -2932,7 +3017,7 @@ function renderEmbed(report, format) {
|
|
|
2932
3017
|
}
|
|
2933
3018
|
|
|
2934
3019
|
// src/graph/commands/stats.ts
|
|
2935
|
-
import { resolve as
|
|
3020
|
+
import { resolve as resolve9 } from "node:path";
|
|
2936
3021
|
import { DataFactory as DataFactory4 } from "n3";
|
|
2937
3022
|
function subjectsOfType(store, typeIri) {
|
|
2938
3023
|
return store.getQuads(null, DataFactory4.namedNode(RDF_TYPE), DataFactory4.namedNode(typeIri), null).map((q) => q.subject.value).sort();
|
|
@@ -2953,7 +3038,7 @@ function runStats(opts = {}) {
|
|
|
2953
3038
|
},
|
|
2954
3039
|
cwd
|
|
2955
3040
|
);
|
|
2956
|
-
const store = loadGraph(
|
|
3041
|
+
const store = loadGraph(resolve9(cwd, opts.graph ?? config.out));
|
|
2957
3042
|
const top = opts.top ?? 5;
|
|
2958
3043
|
const docIris = subjectsOfType(store, `${NS.graph}Document`);
|
|
2959
3044
|
const docSet = new Set(docIris);
|
|
@@ -3186,261 +3271,11 @@ function renderStats(report, format) {
|
|
|
3186
3271
|
return lines.join("\n");
|
|
3187
3272
|
}
|
|
3188
3273
|
|
|
3189
|
-
// src/graph/commands/traverse.ts
|
|
3190
|
-
import { resolve as resolve9 } from "node:path";
|
|
3191
|
-
|
|
3192
|
-
// src/graph/runtime/traverse.ts
|
|
3193
|
-
var DCTERMS_TITLE = `${NS.dcterms}title`;
|
|
3194
|
-
var DCTERMS_REFERENCES = `${NS.dcterms}references`;
|
|
3195
|
-
var DCTERMS_LANGUAGE = `${NS.dcterms}language`;
|
|
3196
|
-
function documentOf(iri2) {
|
|
3197
|
-
const hash = iri2.indexOf("#");
|
|
3198
|
-
return hash === -1 ? iri2 : iri2.slice(0, hash);
|
|
3199
|
-
}
|
|
3200
|
-
function resolveVariant(graph, input) {
|
|
3201
|
-
if (graph.has(input)) return input;
|
|
3202
|
-
const wanted = input.toLowerCase();
|
|
3203
|
-
const variants = graph.instancesOf(`${NS.iirds}ProductVariant`);
|
|
3204
|
-
for (const v of variants) {
|
|
3205
|
-
if (graph.literal(v, DCTERMS_TITLE)?.toLowerCase() === wanted) return v;
|
|
3206
|
-
}
|
|
3207
|
-
for (const v of variants) {
|
|
3208
|
-
if (v.slice(v.lastIndexOf("/") + 1).toLowerCase() === wanted) return v;
|
|
3209
|
-
}
|
|
3210
|
-
return void 0;
|
|
3211
|
-
}
|
|
3212
|
-
function resolveSubject(graph, input) {
|
|
3213
|
-
const mapped = SOFTWARE_SUBJECT_IRIS[input.toLowerCase()];
|
|
3214
|
-
if (mapped) return mapped;
|
|
3215
|
-
const expanded = graph.expand(input);
|
|
3216
|
-
return expanded.startsWith("http") ? expanded : void 0;
|
|
3217
|
-
}
|
|
3218
|
-
function scopeExclusion(graph, iri2, scope) {
|
|
3219
|
-
const checks = [
|
|
3220
|
-
[
|
|
3221
|
-
scope.variantIri,
|
|
3222
|
-
IIRDS_RELATES_TO_PRODUCT_VARIANT,
|
|
3223
|
-
GRAPH_NOT_APPLICABLE_TO_VARIANT,
|
|
3224
|
-
"iri"
|
|
3225
|
-
],
|
|
3226
|
-
[scope.subjectIri, IIRDS_HAS_SUBJECT, GRAPH_NOT_SOFTWARE_SUBJECT, "iri"],
|
|
3227
|
-
[scope.language, DCTERMS_LANGUAGE, void 0, "literal"]
|
|
3228
|
-
];
|
|
3229
|
-
for (const [target, positive, negative, kind] of checks) {
|
|
3230
|
-
if (!target) continue;
|
|
3231
|
-
if (negative !== void 0) {
|
|
3232
|
-
const denied = graph.values(iri2, negative).some((v) => v.kind === kind && v.value === target);
|
|
3233
|
-
if (denied) return { node: iri2, rule: negative, value: target };
|
|
3234
|
-
}
|
|
3235
|
-
const subject = positive === DCTERMS_LANGUAGE ? documentOf(iri2) : iri2;
|
|
3236
|
-
const claimed = graph.values(subject, positive);
|
|
3237
|
-
if (claimed.length > 0) {
|
|
3238
|
-
const matches = claimed.some(
|
|
3239
|
-
(v) => v.kind === kind && v.value === target
|
|
3240
|
-
);
|
|
3241
|
-
if (!matches) return { node: iri2, rule: positive, value: target };
|
|
3242
|
-
}
|
|
3243
|
-
}
|
|
3244
|
-
return void 0;
|
|
3245
|
-
}
|
|
3246
|
-
function traverse(graph, options) {
|
|
3247
|
-
const trace = options.trace ?? createTrace();
|
|
3248
|
-
const maxDepth = options.depth ?? 1;
|
|
3249
|
-
const direction = options.direction ?? "out";
|
|
3250
|
-
const allowed = options.predicates && options.predicates.length > 0 ? new Set(options.predicates.map((p) => graph.expand(p))) : void 0;
|
|
3251
|
-
const variantIri = options.variant ? resolveVariant(graph, options.variant) : void 0;
|
|
3252
|
-
const subjectIri = options.subject ? resolveSubject(graph, options.subject) : void 0;
|
|
3253
|
-
const language = options.language === void 0 ? void 0 : canonicalLanguageTag(options.language);
|
|
3254
|
-
const scope = { variantIri, subjectIri, language };
|
|
3255
|
-
const followTypes = options.includeTypeEdges === true || allowed?.has(RDF_TYPE) === true;
|
|
3256
|
-
const excluded = /* @__PURE__ */ new Set();
|
|
3257
|
-
const keep = (iri2) => {
|
|
3258
|
-
if (excluded.has(iri2)) return false;
|
|
3259
|
-
const exclusion = scopeExclusion(graph, iri2, scope);
|
|
3260
|
-
if (exclusion) {
|
|
3261
|
-
excluded.add(iri2);
|
|
3262
|
-
trace.exclusions.push(exclusion);
|
|
3263
|
-
return false;
|
|
3264
|
-
}
|
|
3265
|
-
return true;
|
|
3266
|
-
};
|
|
3267
|
-
const nodes = [];
|
|
3268
|
-
const seen = /* @__PURE__ */ new Set();
|
|
3269
|
-
let frontier = [];
|
|
3270
|
-
const alreadySeeded = new Set(trace.entry.map((e) => e.iri));
|
|
3271
|
-
for (const seed of [...options.seeds].sort(byCodeUnit)) {
|
|
3272
|
-
if (!graph.has(seed) || seen.has(seed)) continue;
|
|
3273
|
-
seen.add(seed);
|
|
3274
|
-
if (!alreadySeeded.has(seed)) {
|
|
3275
|
-
trace.entry.push({ iri: seed, score: 1, via: "explicit" });
|
|
3276
|
-
}
|
|
3277
|
-
if (keep(seed)) nodes.push({ iri: seed, depth: 0 });
|
|
3278
|
-
frontier.push(seed);
|
|
3279
|
-
}
|
|
3280
|
-
const limit = options.limit ?? Infinity;
|
|
3281
|
-
for (let depth = 1; depth <= maxDepth && frontier.length > 0; depth++) {
|
|
3282
|
-
const next = [];
|
|
3283
|
-
for (const from of frontier) {
|
|
3284
|
-
if (nodes.length >= limit) break;
|
|
3285
|
-
for (const { predicate, target, dir } of neighbors(
|
|
3286
|
-
graph,
|
|
3287
|
-
from,
|
|
3288
|
-
direction
|
|
3289
|
-
)) {
|
|
3290
|
-
if (allowed && !allowed.has(predicate)) continue;
|
|
3291
|
-
if (!followTypes && predicate === RDF_TYPE) continue;
|
|
3292
|
-
trace.hops.push({ from, predicate, to: target, depth, direction: dir });
|
|
3293
|
-
if (seen.has(target)) continue;
|
|
3294
|
-
seen.add(target);
|
|
3295
|
-
if (!keep(target)) continue;
|
|
3296
|
-
if (nodes.length >= limit) break;
|
|
3297
|
-
nodes.push({ iri: target, depth });
|
|
3298
|
-
next.push(target);
|
|
3299
|
-
}
|
|
3300
|
-
}
|
|
3301
|
-
frontier = next;
|
|
3302
|
-
}
|
|
3303
|
-
return { nodes, trace };
|
|
3304
|
-
}
|
|
3305
|
-
function neighbors(graph, iri2, direction) {
|
|
3306
|
-
const out = [];
|
|
3307
|
-
if (direction === "out" || direction === "both") {
|
|
3308
|
-
for (const e of graph.out(iri2)) out.push({ ...e, dir: "out" });
|
|
3309
|
-
}
|
|
3310
|
-
if (direction === "in" || direction === "both") {
|
|
3311
|
-
for (const e of graph.in(iri2)) out.push({ ...e, dir: "in" });
|
|
3312
|
-
}
|
|
3313
|
-
return out;
|
|
3314
|
-
}
|
|
3315
|
-
function reverseReferences(graph, iri2, options = {}) {
|
|
3316
|
-
return traverse(graph, {
|
|
3317
|
-
...options,
|
|
3318
|
-
seeds: [iri2],
|
|
3319
|
-
direction: "in",
|
|
3320
|
-
predicates: [DCTERMS_REFERENCES],
|
|
3321
|
-
depth: options.depth ?? 1
|
|
3322
|
-
});
|
|
3323
|
-
}
|
|
3324
|
-
function impact(graph, iri2, options = {}) {
|
|
3325
|
-
const result = traverse(graph, {
|
|
3326
|
-
...options,
|
|
3327
|
-
seeds: [iri2],
|
|
3328
|
-
direction: "in",
|
|
3329
|
-
depth: options.depth ?? 3,
|
|
3330
|
-
// The seed *may* occupy a slot in the walker's limit, so ask for one more:
|
|
3331
|
-
// `limit` means "this many *affected* nodes". Whether it actually takes
|
|
3332
|
-
// one depends on the scope filter — a seed the filter excludes still
|
|
3333
|
-
// expands but is not in `nodes` — so the slack is trimmed below rather
|
|
3334
|
-
// than assumed spent.
|
|
3335
|
-
limit: options.limit === void 0 ? void 0 : options.limit + 1
|
|
3336
|
-
});
|
|
3337
|
-
const affected = result.nodes.filter((n) => n.iri !== iri2);
|
|
3338
|
-
return {
|
|
3339
|
-
nodes: options.limit === void 0 ? affected : affected.slice(0, options.limit),
|
|
3340
|
-
trace: result.trace
|
|
3341
|
-
};
|
|
3342
|
-
}
|
|
3343
|
-
|
|
3344
|
-
// src/graph/commands/traverse.ts
|
|
3345
|
-
function runTraverse(opts) {
|
|
3346
|
-
const cwd = opts.cwd ?? process.cwd();
|
|
3347
|
-
const config = loadRunConfig(
|
|
3348
|
-
{
|
|
3349
|
-
...opts.config === void 0 ? {} : { configPath: opts.config },
|
|
3350
|
-
...opts.noConfig === void 0 ? {} : { noConfig: opts.noConfig }
|
|
3351
|
-
},
|
|
3352
|
-
cwd
|
|
3353
|
-
);
|
|
3354
|
-
const store = loadGraph(resolve9(cwd, opts.graph ?? config.out));
|
|
3355
|
-
const quads = storeToQuads(store);
|
|
3356
|
-
const graph = GraphIndex.fromQuads(quads, Object.fromEntries(PREFIXES));
|
|
3357
|
-
const node = expandTerm(opts.node);
|
|
3358
|
-
if (!graph.has(node)) {
|
|
3359
|
-
throw new GraphError(
|
|
3360
|
-
`Node not found in the graph: ${opts.node} \u2014 check the IRI, or run \`manni graph build\` first.`
|
|
3361
|
-
);
|
|
3362
|
-
}
|
|
3363
|
-
if (opts.variant && !resolveVariant(graph, opts.variant)) {
|
|
3364
|
-
throw new GraphError(
|
|
3365
|
-
`Unknown product variant: ${opts.variant} \u2014 no iirds:ProductVariant matches that IRI, title, or slug.`
|
|
3366
|
-
);
|
|
3367
|
-
}
|
|
3368
|
-
if (opts.subject && !resolveSubject(graph, opts.subject)) {
|
|
3369
|
-
throw new GraphError(
|
|
3370
|
-
`Unknown software subject: ${opts.subject} \u2014 expected one of ${Object.keys(SOFTWARE_SUBJECT_IRIS).sort().join(", ")}, or a full IRI.`
|
|
3371
|
-
);
|
|
3372
|
-
}
|
|
3373
|
-
const predicates = opts.predicates?.map(expandTerm);
|
|
3374
|
-
if (predicates && predicates.length > 0) {
|
|
3375
|
-
const used = /* @__PURE__ */ new Set();
|
|
3376
|
-
for (const quad of quads) {
|
|
3377
|
-
if (quad.o.kind === "iri") used.add(quad.p);
|
|
3378
|
-
}
|
|
3379
|
-
predicates.forEach((predicate, i) => {
|
|
3380
|
-
if (!used.has(predicate)) {
|
|
3381
|
-
throw new GraphError(
|
|
3382
|
-
`Unknown predicate: ${opts.predicates?.[i] ?? predicate}. No edge in the graph uses it.`
|
|
3383
|
-
);
|
|
3384
|
-
}
|
|
3385
|
-
});
|
|
3386
|
-
}
|
|
3387
|
-
const direction = opts.reverse ? "in" : "out";
|
|
3388
|
-
const result = opts.impact ? impact(graph, node, {
|
|
3389
|
-
depth: opts.depth,
|
|
3390
|
-
predicates,
|
|
3391
|
-
variant: opts.variant,
|
|
3392
|
-
subject: opts.subject,
|
|
3393
|
-
language: opts.lang,
|
|
3394
|
-
limit: opts.limit
|
|
3395
|
-
}) : traverse(graph, {
|
|
3396
|
-
seeds: [node],
|
|
3397
|
-
depth: opts.depth,
|
|
3398
|
-
predicates,
|
|
3399
|
-
direction,
|
|
3400
|
-
variant: opts.variant,
|
|
3401
|
-
subject: opts.subject,
|
|
3402
|
-
language: opts.lang,
|
|
3403
|
-
limit: opts.limit
|
|
3404
|
-
});
|
|
3405
|
-
return {
|
|
3406
|
-
node,
|
|
3407
|
-
nodes: result.nodes.map((n) => {
|
|
3408
|
-
const title = graph.literal(n.iri, `${NS.dcterms}title`);
|
|
3409
|
-
return title === void 0 ? { iri: n.iri, depth: n.depth } : { iri: n.iri, depth: n.depth, title };
|
|
3410
|
-
}),
|
|
3411
|
-
trace: result.trace
|
|
3412
|
-
};
|
|
3413
|
-
}
|
|
3414
|
-
function renderTraverse(report, format) {
|
|
3415
|
-
if (format === "json") return JSON.stringify(report, null, 2);
|
|
3416
|
-
const lines = [];
|
|
3417
|
-
for (const n of report.nodes) {
|
|
3418
|
-
const indent = " ".repeat(n.depth);
|
|
3419
|
-
const title = n.title ? ` \u2014 ${n.title}` : "";
|
|
3420
|
-
lines.push(`${indent}${compactIri(n.iri)}${title}`);
|
|
3421
|
-
}
|
|
3422
|
-
if (report.nodes.length === 0) lines.push("(no nodes)");
|
|
3423
|
-
if (report.trace.exclusions.length > 0) {
|
|
3424
|
-
lines.push("");
|
|
3425
|
-
lines.push("excluded by scope:");
|
|
3426
|
-
for (const e of report.trace.exclusions) {
|
|
3427
|
-
lines.push(
|
|
3428
|
-
` ${compactIri(e.node)} \u2014 ${compactIri(e.rule)} ${compactIri(e.value)}`
|
|
3429
|
-
);
|
|
3430
|
-
}
|
|
3431
|
-
}
|
|
3432
|
-
lines.push("");
|
|
3433
|
-
lines.push(
|
|
3434
|
-
`${report.nodes.length} node${report.nodes.length === 1 ? "" : "s"}, ${report.trace.hops.length} hop${report.trace.hops.length === 1 ? "" : "s"}, ${report.trace.exclusions.length} excluded`
|
|
3435
|
-
);
|
|
3436
|
-
return lines.join("\n");
|
|
3437
|
-
}
|
|
3438
|
-
|
|
3439
3274
|
export {
|
|
3440
|
-
emitJsonLd,
|
|
3441
3275
|
emitRdfXml,
|
|
3442
3276
|
writeZip,
|
|
3443
3277
|
projectPackage,
|
|
3278
|
+
LLMS_FILENAME,
|
|
3444
3279
|
EXPORT_TARGETS,
|
|
3445
3280
|
runExport,
|
|
3446
3281
|
runQuery,
|
|
@@ -3461,14 +3296,6 @@ export {
|
|
|
3461
3296
|
runEmbed,
|
|
3462
3297
|
renderEmbed,
|
|
3463
3298
|
runStats,
|
|
3464
|
-
renderStats
|
|
3465
|
-
resolveVariant,
|
|
3466
|
-
resolveSubject,
|
|
3467
|
-
scopeExclusion,
|
|
3468
|
-
traverse,
|
|
3469
|
-
reverseReferences,
|
|
3470
|
-
impact,
|
|
3471
|
-
runTraverse,
|
|
3472
|
-
renderTraverse
|
|
3299
|
+
renderStats
|
|
3473
3300
|
};
|
|
3474
|
-
//# sourceMappingURL=chunk-
|
|
3301
|
+
//# sourceMappingURL=chunk-33FIOHJ4.js.map
|