@plebeiantech/lat.md 0.12.3-fork.9 → 0.13.4-fork.2
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 +27 -3
- package/dist/src/cli/agent-invocation.d.ts +6 -0
- package/dist/src/cli/agent-invocation.js +23 -0
- package/dist/src/cli/checklist-menu.d.ts +2 -1
- package/dist/src/cli/checklist-menu.js +3 -2
- package/dist/src/cli/fork-instructions.d.ts +1 -0
- package/dist/src/cli/fork-instructions.js +8 -32
- package/dist/src/cli/fork-scaffold.js +2 -2
- package/dist/src/cli/graph.d.ts +1 -1
- package/dist/src/cli/hook.d.ts +26 -0
- package/dist/src/cli/hook.js +115 -64
- package/dist/src/cli/index.js +178 -70
- package/dist/src/cli/init-preferences.d.ts +4 -0
- package/dist/src/cli/init-preferences.js +36 -0
- package/dist/src/cli/init.d.ts +2 -1
- package/dist/src/cli/init.js +100 -60
- package/dist/src/cli/reindex.d.ts +1 -1
- package/dist/src/cli/reindex.js +7 -10
- package/dist/src/cli/search.d.ts +14 -4
- package/dist/src/cli/search.js +115 -101
- package/dist/src/cli/ui-build-server.d.ts +12 -0
- package/dist/src/cli/ui-build-server.js +26 -0
- package/dist/src/cli/ui-build.d.ts +1 -1
- package/dist/src/cli/ui-build.js +1 -1
- package/dist/src/cli/ui.d.ts +1 -1
- package/dist/src/cli/ui.js +1 -1
- package/dist/src/cli/wiki.d.ts +12 -0
- package/dist/src/cli/wiki.js +85 -0
- package/dist/src/fork/antigravity-hook.d.ts +47 -0
- package/dist/src/fork/antigravity-hook.js +424 -0
- package/dist/src/fork/antigravity-init.d.ts +17 -0
- package/dist/src/fork/antigravity-init.js +124 -0
- package/dist/src/fork/upstream-drift.js +1 -1
- package/dist/src/fork/upstream-guard.d.ts +1 -1
- package/dist/src/fork/upstream-guard.js +8 -7
- package/dist/src/graph-export.js +7 -7
- package/dist/src/knowledge/index.js +2 -2
- package/dist/src/mcp/server.js +34 -18
- package/dist/src/search/cache.d.ts +3 -0
- package/dist/src/search/cache.js +104 -0
- package/dist/src/search/chunks.d.ts +23 -0
- package/dist/src/search/chunks.js +200 -0
- package/dist/src/search/db.d.ts +28 -16
- package/dist/src/search/db.js +100 -40
- package/dist/src/search/embedder.d.ts +2 -1
- package/dist/src/search/embedder.js +7 -6
- package/dist/src/search/index.d.ts +6 -2
- package/dist/src/search/index.js +176 -70
- package/dist/src/search/lexical.d.ts +6 -0
- package/dist/src/search/lexical.js +36 -0
- package/dist/src/search/lock.d.ts +5 -0
- package/dist/src/search/lock.js +45 -0
- package/dist/src/search/query.d.ts +26 -0
- package/dist/src/search/query.js +103 -0
- package/dist/src/search/search.d.ts +16 -7
- package/dist/src/search/search.js +165 -21
- package/dist/src/search/types.d.ts +15 -0
- package/dist/src/view/client/assets/GraphView-D_xnk0bP.js +456 -0
- package/dist/src/view/client/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/src/view/client/assets/MarkdownEditor-bjqt_FoF.js +28 -0
- package/dist/src/view/client/assets/OrbitControls-DwcpQNja.js +1 -0
- package/dist/src/view/client/assets/STLLoader-CLWTKt5i.js +1 -0
- package/dist/src/view/client/assets/_commonjsHelpers-CqkleIqs.js +1 -0
- package/dist/src/view/client/assets/abnfDiagram-VCTEODGH-kWGvtRnL.js +1 -0
- package/dist/src/view/client/assets/arc-BPAFd7cP.js +1 -0
- package/dist/src/view/client/assets/architectureDiagram-5GKGNRK7-CsY39oIR.js +36 -0
- package/dist/src/view/client/assets/blockDiagram-I7D4REHJ-DHGBG7BJ.js +129 -0
- package/dist/src/view/client/assets/c4Diagram-7LVT6UL2-vywK4eb7.js +38 -0
- package/dist/src/view/client/assets/channel-CX71L_qV.js +1 -0
- package/dist/src/view/client/assets/chunk-2Q5K7J3B-Do3Hz_ci.js +1 -0
- package/dist/src/view/client/assets/chunk-5VM5RSS4-B5R1lSeY.js +15 -0
- package/dist/src/view/client/assets/chunk-F27PBJKO-Dm55FM_W.js +1 -0
- package/dist/src/view/client/assets/chunk-IMKFNOWR-ChptrvvM.js +231 -0
- package/dist/src/view/client/assets/chunk-JWPE2WC7-BRQBjrKS.js +1 -0
- package/dist/src/view/client/assets/chunk-POPQ4Y6H-CainVZIL.js +1 -0
- package/dist/src/view/client/assets/chunk-SVP7TREG-DsKsNGmM.js +88 -0
- package/dist/src/view/client/assets/chunk-TICWLB2K-BctkMcJc.js +206 -0
- package/dist/src/view/client/assets/chunk-XXDRQBXY-BN7SgOUT.js +1 -0
- package/dist/src/view/client/assets/classDiagram-ZZMXUADV-B1VyU6zO.js +1 -0
- package/dist/src/view/client/assets/classDiagram-v2-VYDZK3BY-B1VyU6zO.js +1 -0
- package/dist/src/view/client/assets/cose-bilkent-JH36ORCC-BszzwrMe.js +1 -0
- package/dist/src/view/client/assets/cynefin-OW5HDTMX-CdRyAkPs.js +166 -0
- package/dist/src/view/client/assets/cynefinDiagram-5FMLGOSQ-BLvKPZ1u.js +62 -0
- package/dist/src/view/client/assets/cytoscape.esm-DzSz-X2X.js +321 -0
- package/dist/src/view/client/assets/dagre-GXQ25YYZ-V68w_l65.js +4 -0
- package/dist/src/view/client/assets/defaultLocale-DX6XiGOO.js +1 -0
- package/dist/src/view/client/assets/diagram-S7CK7UJ4-C2i4eEMg.js +30 -0
- package/dist/src/view/client/assets/diagram-UQ7AKVKN-BiwWh5jC.js +41 -0
- package/dist/src/view/client/assets/diagram-VSXAHHWV-hkKR_vyS.js +3 -0
- package/dist/src/view/client/assets/diagram-VX7I27RA-DzRCSMAc.js +24 -0
- package/dist/src/view/client/assets/diagram-Z3DM3KII-fhSFPxyK.js +24 -0
- package/dist/src/view/client/assets/ebnfDiagram-PWID7BFC-CCEUDKSA.js +1 -0
- package/dist/src/view/client/assets/erDiagram-RLTQ6QDP-FJ2IMyTi.js +99 -0
- package/dist/src/view/client/assets/flowDiagram-HODETNUW-BvasdLeK.js +168 -0
- package/dist/src/view/client/assets/ganttDiagram-EL5Y4UJY-CiwkBZvY.js +292 -0
- package/dist/src/view/client/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/dist/src/view/client/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/dist/src/view/client/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dist/src/view/client/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dist/src/view/client/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
- package/dist/src/view/client/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
- package/dist/src/view/client/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
- package/dist/src/view/client/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
- package/dist/src/view/client/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
- package/dist/src/view/client/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
- package/dist/src/view/client/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/dist/src/view/client/assets/gitGraphDiagram-WWUBYQGX-DYlP2_js.js +106 -0
- package/dist/src/view/client/assets/index-BnENo9bV.js +1 -0
- package/dist/src/view/client/assets/index-CQ7EOox7.css +1 -0
- package/dist/src/view/client/assets/index-CynNDkxt.js +13 -0
- package/dist/src/view/client/assets/infoDiagram-27XIBGKW-DRPB2c48.js +2 -0
- package/dist/src/view/client/assets/init-Gi6I4Gst.js +1 -0
- package/dist/src/view/client/assets/ishikawaDiagram-5VMMS53U-8VV429Cv.js +70 -0
- package/dist/src/view/client/assets/journeyDiagram-3NMN7TZE-Dzmwnf83.js +139 -0
- package/dist/src/view/client/assets/kanban-definition-UXKFOSKX-pYyZZ1i-.js +89 -0
- package/dist/src/view/client/assets/katex-HP8lGamR.js +257 -0
- package/dist/src/view/client/assets/layout-GF9k6yGo.js +1 -0
- package/dist/src/view/client/assets/linear-Yt2sSOYV.js +1 -0
- package/dist/src/view/client/assets/logo-RR_KBOAT.svg +149 -0
- package/dist/src/view/client/assets/maplibre-gl-CDX6Zuow.js +800 -0
- package/dist/src/view/client/assets/mermaid.core-ChWYCHN0.js +310 -0
- package/dist/src/view/client/assets/mindmap-definition-YA3MSWOX-Cc4fQvf1.js +96 -0
- package/dist/src/view/client/assets/ordinal-Cboi1Yqb.js +1 -0
- package/dist/src/view/client/assets/pegDiagram-XKGWAZYB-C0SsB8bZ.js +1 -0
- package/dist/src/view/client/assets/pieDiagram-E7YTZNPT-DIJpqERZ.js +39 -0
- package/dist/src/view/client/assets/quadrantDiagram-AXDQQJYC--d-gl6j-.js +7 -0
- package/dist/src/view/client/assets/railroadDiagram-O6MQD6OU-BQxwTt7z.js +1 -0
- package/dist/src/view/client/assets/requirementDiagram-BXWQKSXE-B_oTeD2A.js +84 -0
- package/dist/src/view/client/assets/sankeyDiagram-P5KCCOFB-DLukmE8X.js +40 -0
- package/dist/src/view/client/assets/sequenceDiagram-WJ2MYXX4-BNjVB2sc.js +162 -0
- package/dist/src/view/client/assets/sizeCapture-INFHLROL-BZecQTOw.js +1 -0
- package/dist/src/view/client/assets/stateDiagram-D77RDMKH-Bu1urvXC.js +1 -0
- package/dist/src/view/client/assets/stateDiagram-v2-MP3YSRHH-5pc_697G.js +1 -0
- package/dist/src/view/client/assets/swimlanes-42K2YHIH-bLAlcepB.js +1 -0
- package/dist/src/view/client/assets/swimlanesDiagram-VR7AAH4N-BbOpZjpp.js +8 -0
- package/dist/src/view/client/assets/three.module-PDSP0dbZ.js +4108 -0
- package/dist/src/view/client/assets/timeline-definition-24CTP7MA-tbwCNvcA.js +120 -0
- package/dist/src/view/client/assets/vennDiagram-4TSXK5OY-D8U8Fk0N.js +34 -0
- package/dist/src/view/client/assets/wardleyDiagram-VM6X3IG4-LHBVIeNb.js +78 -0
- package/dist/src/view/client/assets/xychartDiagram-S5SC5T6Z-CN4tfaFV.js +7 -0
- package/dist/src/view/client/index.html +2 -2
- package/dist/src/view/client-shell.d.ts +2 -0
- package/dist/src/view/client-shell.js +5 -0
- package/dist/src/view/diagnostics.d.ts +3 -2
- package/dist/src/view/diagnostics.js +49 -58
- package/dist/src/view/document-edit.d.ts +8 -0
- package/dist/src/view/document-edit.js +25 -0
- package/dist/src/view/document-route.d.ts +14 -0
- package/dist/src/view/document-route.js +137 -0
- package/dist/src/view/document-tree.d.ts +18 -0
- package/dist/src/view/document-tree.js +139 -0
- package/dist/src/view/external-document-tree.d.ts +3 -0
- package/dist/src/view/external-document-tree.js +674 -0
- package/dist/src/view/git-diff.js +202 -2
- package/dist/src/view/git.js +1 -1
- package/dist/src/view/graph.d.ts +4 -3
- package/dist/src/view/graph.js +100 -9
- package/dist/src/view/highlight.d.ts +10 -2
- package/dist/src/view/highlight.js +50648 -3166
- package/dist/src/view/markdown.d.ts +3 -2
- package/dist/src/view/markdown.js +256 -54
- package/dist/src/view/preindexed-search.d.ts +15 -0
- package/dist/src/view/preindexed-search.js +25 -0
- package/dist/src/view/protocol.d.ts +53 -7
- package/dist/src/view/publication.d.ts +2 -0
- package/dist/src/view/publication.js +78 -0
- package/dist/src/view/references.d.ts +11 -26
- package/dist/src/view/references.js +121 -112
- package/dist/src/view/repository.d.ts +14 -4
- package/dist/src/view/repository.js +260 -19
- package/dist/src/view/request-security.d.ts +5 -0
- package/dist/src/view/request-security.js +46 -0
- package/dist/src/view/search-result.d.ts +4 -0
- package/dist/src/view/search-result.js +25 -0
- package/dist/src/view/search.d.ts +7 -2
- package/dist/src/view/search.js +23 -34
- package/dist/src/view/server-build.d.ts +21 -0
- package/dist/src/view/server-build.js +145 -0
- package/dist/src/view/server-deployment.d.ts +31 -0
- package/dist/src/view/server-deployment.js +123 -0
- package/dist/src/view/server-index-worker.d.ts +6 -0
- package/dist/src/view/server-index-worker.js +14 -0
- package/dist/src/view/server.d.ts +11 -2
- package/dist/src/view/server.js +245 -73
- package/dist/src/view/source-target.d.ts +2 -0
- package/dist/src/view/source-target.js +49 -8
- package/dist/src/view/static-build.d.ts +18 -2
- package/dist/src/view/static-build.js +449 -110
- package/dist/src/view/static-protocol.d.ts +26 -2
- package/dist/src/view/static-protocol.js +5 -0
- package/dist/src/view/store.d.ts +20 -3
- package/dist/src/view/store.js +304 -48
- package/dist/src/view/table-of-contents.d.ts +2 -2
- package/dist/src/view/table-of-contents.js +2 -22
- package/dist/src/view/vercel-build.d.ts +24 -0
- package/dist/src/view/vercel-build.js +152 -0
- package/dist/src/view/vercel-server-build.d.ts +10 -0
- package/dist/src/view/vercel-server-build.js +61 -0
- package/dist/src/wiki/catalog.d.ts +21 -0
- package/dist/src/wiki/catalog.js +256 -0
- package/dist/src/wiki/publish.d.ts +27 -0
- package/dist/src/wiki/publish.js +265 -0
- package/dist/src/wiki/render.d.ts +20 -0
- package/dist/src/wiki/render.js +163 -0
- package/dist/src/wiki/transform.d.ts +7 -0
- package/dist/src/wiki/transform.js +264 -0
- package/dist/vendor/lat.md-server/cli.d.ts +2 -0
- package/dist/vendor/lat.md-server/cli.js +12 -0
- package/dist/vendor/lat.md-server/index.d.ts +38 -0
- package/dist/vendor/lat.md-server/index.js +128 -0
- package/package.json +68 -22
- package/plugins/lat-md/README.md +61 -0
- package/plugins/lat-md/hooks.json +38 -0
- package/plugins/lat-md/plugin.json +9 -0
- package/plugins/lat-md/rules/AGENTS.md +344 -0
- package/plugins/lat-md/skills/lat-md/SKILL.md +210 -0
- package/plugins/lat-md/skills/lat-md-conventions/SKILL.md +226 -0
- package/templates/AGENTS.md +26 -7
- package/templates/cursor-rules.md +23 -7
- package/templates/fork/conventions.md +133 -11
- package/templates/opencode-plugin.ts +9 -9
- package/templates/pi-extension.ts +11 -11
- package/templates/skill/SKILL.md +35 -3
- package/dist/src/cli/check-coverage.d.ts +0 -2
- package/dist/src/cli/check-coverage.js +0 -71
- package/dist/src/cli/check-frontmatter.d.ts +0 -12
- package/dist/src/cli/check-frontmatter.js +0 -44
- package/dist/src/cli/check-mode.d.ts +0 -21
- package/dist/src/cli/check-mode.js +0 -364
- package/dist/src/cli/check-status.d.ts +0 -74
- package/dist/src/cli/check-status.js +0 -217
- package/dist/src/cli/check.d.ts +0 -45
- package/dist/src/cli/check.js +0 -781
- package/dist/src/cli/context.d.ts +0 -11
- package/dist/src/cli/context.js +0 -58
- package/dist/src/cli/expand.d.ts +0 -8
- package/dist/src/cli/expand.js +0 -94
- package/dist/src/cli/gen-index.d.ts +0 -45
- package/dist/src/cli/gen-index.js +0 -235
- package/dist/src/cli/link-scheme.d.ts +0 -54
- package/dist/src/cli/link-scheme.js +0 -101
- package/dist/src/cli/locate.d.ts +0 -2
- package/dist/src/cli/locate.js +0 -17
- package/dist/src/cli/refs.d.ts +0 -22
- package/dist/src/cli/refs.js +0 -229
- package/dist/src/cli/section.d.ts +0 -43
- package/dist/src/cli/section.js +0 -252
- package/dist/src/cli/select-menu.d.ts +0 -13
- package/dist/src/cli/select-menu.js +0 -100
- package/dist/src/code-refs.d.ts +0 -17
- package/dist/src/code-refs.js +0 -298
- package/dist/src/config.d.ts +0 -29
- package/dist/src/config.js +0 -83
- package/dist/src/context.d.ts +0 -23
- package/dist/src/context.js +0 -11
- package/dist/src/extensions/wiki-link/from-markdown.d.ts +0 -5
- package/dist/src/extensions/wiki-link/from-markdown.js +0 -34
- package/dist/src/extensions/wiki-link/index.d.ts +0 -4
- package/dist/src/extensions/wiki-link/index.js +0 -3
- package/dist/src/extensions/wiki-link/syntax.d.ts +0 -14
- package/dist/src/extensions/wiki-link/syntax.js +0 -121
- package/dist/src/extensions/wiki-link/to-markdown.d.ts +0 -5
- package/dist/src/extensions/wiki-link/to-markdown.js +0 -28
- package/dist/src/extensions/wiki-link/types.d.ts +0 -34
- package/dist/src/format.d.ts +0 -8
- package/dist/src/format.js +0 -43
- package/dist/src/init-version.d.ts +0 -10
- package/dist/src/init-version.js +0 -49
- package/dist/src/lattice.d.ts +0 -109
- package/dist/src/lattice.js +0 -817
- package/dist/src/parser.d.ts +0 -3
- package/dist/src/parser.js +0 -18
- package/dist/src/source-parser.d.ts +0 -27
- package/dist/src/source-parser.js +0 -916
- package/dist/src/untrusted.d.ts +0 -18
- package/dist/src/untrusted.js +0 -93
- package/dist/src/view/client/assets/index-C3iaZyYT.css +0 -1
- package/dist/src/view/client/assets/index-KWi67IMz.js +0 -334
- package/dist/src/view/client/assets/logo-CNF8zs47.svg +0 -182
- package/dist/src/walk.d.ts +0 -18
- package/dist/src/walk.js +0 -27
- /package/dist/src/{extensions/wiki-link → search}/types.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parse } from '
|
|
1
|
+
import { parse } from '@plebeiantech/lat.md-core/parser';
|
|
2
2
|
const MAX_DIFF_CELLS = 1_000_000;
|
|
3
3
|
const MIN_INLINE_WORD_OVERLAP = 0.6;
|
|
4
4
|
const WORDS = /\s+|[\p{L}\p{N}_]+|[^\s\p{L}\p{N}_]+/gu;
|
|
@@ -168,7 +168,191 @@ function sourceForNode(markdown, node) {
|
|
|
168
168
|
? `${node.type}:${nodeText(node)}`
|
|
169
169
|
: `${node.type}:${markdown.slice(start, end)}`;
|
|
170
170
|
}
|
|
171
|
+
function tableShape(table) {
|
|
172
|
+
const columns = table.children[0]?.children.length ?? 0;
|
|
173
|
+
if (columns === 0 ||
|
|
174
|
+
table.children.some((row) => row.children.length !== columns)) {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
return {
|
|
178
|
+
columns,
|
|
179
|
+
align: Array.from({ length: columns }, (_, index) => table.align?.[index] ?? ''),
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
function tablesAreCompatible(oldTable, newTable) {
|
|
183
|
+
const oldShape = tableShape(oldTable);
|
|
184
|
+
const newShape = tableShape(newTable);
|
|
185
|
+
return (oldShape !== null &&
|
|
186
|
+
newShape !== null &&
|
|
187
|
+
oldShape.columns === newShape.columns &&
|
|
188
|
+
oldShape.align.every((align, index) => align === newShape.align[index]));
|
|
189
|
+
}
|
|
190
|
+
function tableRowSimilarity(oldRow, newRow) {
|
|
191
|
+
if (oldRow.children.length !== newRow.children.length)
|
|
192
|
+
return 0;
|
|
193
|
+
const matchingCells = oldRow.children.filter((cell, index) => nodeText(cell) === nodeText(newRow.children[index])).length;
|
|
194
|
+
return Math.max(matchingCells / oldRow.children.length, inlineWordOverlap(oldRow, newRow));
|
|
195
|
+
}
|
|
196
|
+
function alignChangedTableRows(oldRows, newRows) {
|
|
197
|
+
if (oldRows.length * newRows.length > MAX_DIFF_CELLS) {
|
|
198
|
+
const paired = Math.min(oldRows.length, newRows.length);
|
|
199
|
+
return [
|
|
200
|
+
...oldRows.slice(0, paired).map((oldValue, index) => ({
|
|
201
|
+
kind: 'same',
|
|
202
|
+
oldValue,
|
|
203
|
+
newValue: newRows[index],
|
|
204
|
+
})),
|
|
205
|
+
...oldRows
|
|
206
|
+
.slice(paired)
|
|
207
|
+
.map((value) => ({ kind: 'removed', value })),
|
|
208
|
+
...newRows
|
|
209
|
+
.slice(paired)
|
|
210
|
+
.map((value) => ({ kind: 'added', value })),
|
|
211
|
+
];
|
|
212
|
+
}
|
|
213
|
+
const costs = Array.from({ length: oldRows.length + 1 }, () => new Float64Array(newRows.length + 1));
|
|
214
|
+
for (let oldIndex = oldRows.length; oldIndex >= 0; oldIndex--) {
|
|
215
|
+
for (let newIndex = newRows.length; newIndex >= 0; newIndex--) {
|
|
216
|
+
if (oldIndex === oldRows.length) {
|
|
217
|
+
costs[oldIndex][newIndex] = newRows.length - newIndex;
|
|
218
|
+
}
|
|
219
|
+
else if (newIndex === newRows.length) {
|
|
220
|
+
costs[oldIndex][newIndex] = oldRows.length - oldIndex;
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
const pairCost = costs[oldIndex + 1][newIndex + 1] +
|
|
224
|
+
1.5 -
|
|
225
|
+
tableRowSimilarity(oldRows[oldIndex], newRows[newIndex]);
|
|
226
|
+
costs[oldIndex][newIndex] = Math.min(pairCost, costs[oldIndex + 1][newIndex] + 1, costs[oldIndex][newIndex + 1] + 1);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const changes = [];
|
|
231
|
+
let oldIndex = 0;
|
|
232
|
+
let newIndex = 0;
|
|
233
|
+
const epsilon = 1e-9;
|
|
234
|
+
while (oldIndex < oldRows.length || newIndex < newRows.length) {
|
|
235
|
+
if (oldIndex === oldRows.length) {
|
|
236
|
+
changes.push({ kind: 'added', value: newRows[newIndex++] });
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
if (newIndex === newRows.length) {
|
|
240
|
+
changes.push({ kind: 'removed', value: oldRows[oldIndex++] });
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
const currentCost = costs[oldIndex][newIndex];
|
|
244
|
+
const pairCost = costs[oldIndex + 1][newIndex + 1] +
|
|
245
|
+
1.5 -
|
|
246
|
+
tableRowSimilarity(oldRows[oldIndex], newRows[newIndex]);
|
|
247
|
+
const removeCost = costs[oldIndex + 1][newIndex] + 1;
|
|
248
|
+
const addCost = costs[oldIndex][newIndex + 1] + 1;
|
|
249
|
+
const oldRemaining = oldRows.length - oldIndex;
|
|
250
|
+
const newRemaining = newRows.length - newIndex;
|
|
251
|
+
const pairIsBest = Math.abs(pairCost - currentCost) < epsilon;
|
|
252
|
+
const pairIsStrictlyBest = pairCost < removeCost - epsilon && pairCost < addCost - epsilon;
|
|
253
|
+
if (pairIsBest && (pairIsStrictlyBest || oldRemaining === newRemaining)) {
|
|
254
|
+
changes.push({
|
|
255
|
+
kind: 'same',
|
|
256
|
+
oldValue: oldRows[oldIndex++],
|
|
257
|
+
newValue: newRows[newIndex++],
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
else if (oldRemaining > newRemaining &&
|
|
261
|
+
Math.abs(removeCost - currentCost) < epsilon) {
|
|
262
|
+
changes.push({ kind: 'removed', value: oldRows[oldIndex++] });
|
|
263
|
+
}
|
|
264
|
+
else if (Math.abs(addCost - currentCost) < epsilon) {
|
|
265
|
+
changes.push({ kind: 'added', value: newRows[newIndex++] });
|
|
266
|
+
}
|
|
267
|
+
else if (Math.abs(removeCost - currentCost) < epsilon) {
|
|
268
|
+
changes.push({ kind: 'removed', value: oldRows[oldIndex++] });
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
changes.push({
|
|
272
|
+
kind: 'same',
|
|
273
|
+
oldValue: oldRows[oldIndex++],
|
|
274
|
+
newValue: newRows[newIndex++],
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return changes;
|
|
279
|
+
}
|
|
280
|
+
function diffTableRow(oldRow, newRow) {
|
|
281
|
+
return {
|
|
282
|
+
...structuredClone(newRow),
|
|
283
|
+
children: newRow.children.map((newCell, index) => ({
|
|
284
|
+
...structuredClone(newCell),
|
|
285
|
+
children: diffInline(oldRow.children[index].children, newCell.children),
|
|
286
|
+
})),
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
function diffTableRows(oldRows, newRows, oldMarkdown, newMarkdown) {
|
|
290
|
+
const output = [diffTableRow(oldRows[0], newRows[0])];
|
|
291
|
+
const oldBody = oldRows.slice(1);
|
|
292
|
+
const newBody = newRows.slice(1);
|
|
293
|
+
const changes = sequenceDiff(oldBody, newBody, (row) => oldBody.includes(row)
|
|
294
|
+
? sourceForNode(oldMarkdown, row)
|
|
295
|
+
: sourceForNode(newMarkdown, row));
|
|
296
|
+
for (let index = 0; index < changes.length;) {
|
|
297
|
+
const change = changes[index];
|
|
298
|
+
if (change.kind === 'same') {
|
|
299
|
+
output.push(structuredClone(change.newValue));
|
|
300
|
+
index++;
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
const removed = [];
|
|
304
|
+
const added = [];
|
|
305
|
+
while (index < changes.length && changes[index].kind !== 'same') {
|
|
306
|
+
const pending = changes[index++];
|
|
307
|
+
if (pending.kind === 'removed')
|
|
308
|
+
removed.push(pending.value);
|
|
309
|
+
if (pending.kind === 'added')
|
|
310
|
+
added.push(pending.value);
|
|
311
|
+
}
|
|
312
|
+
output.push(...alignChangedTableRows(removed, added).map((rowChange) => {
|
|
313
|
+
switch (rowChange.kind) {
|
|
314
|
+
case 'same':
|
|
315
|
+
return diffTableRow(rowChange.oldValue, rowChange.newValue);
|
|
316
|
+
case 'added':
|
|
317
|
+
return addClass(rowChange.value, 'added');
|
|
318
|
+
case 'removed':
|
|
319
|
+
return addClass(rowChange.value, 'removed');
|
|
320
|
+
}
|
|
321
|
+
}));
|
|
322
|
+
}
|
|
323
|
+
return output;
|
|
324
|
+
}
|
|
325
|
+
function diffTable(oldTable, newTable, oldMarkdown, newMarkdown) {
|
|
326
|
+
if (!tablesAreCompatible(oldTable, newTable))
|
|
327
|
+
return null;
|
|
328
|
+
return {
|
|
329
|
+
...structuredClone(newTable),
|
|
330
|
+
children: diffTableRows(oldTable.children, newTable.children, oldMarkdown, newMarkdown),
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
function isDisplayMath(node) {
|
|
334
|
+
return (node.type === 'math' ||
|
|
335
|
+
(node.type === 'code' &&
|
|
336
|
+
node.lang?.split(/\s+/, 1)[0].toLowerCase() === 'math'));
|
|
337
|
+
}
|
|
338
|
+
function wrapDisplayMath(node, kind) {
|
|
339
|
+
const child = structuredClone(node);
|
|
340
|
+
if (kind === 'removed')
|
|
341
|
+
stripPositions(child);
|
|
342
|
+
return {
|
|
343
|
+
type: 'blockquote',
|
|
344
|
+
data: {
|
|
345
|
+
hName: 'div',
|
|
346
|
+
hProperties: {
|
|
347
|
+
className: ['git-math-block', `git-${kind}`],
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
children: [child],
|
|
351
|
+
};
|
|
352
|
+
}
|
|
171
353
|
function addClass(node, kind) {
|
|
354
|
+
if (isDisplayMath(node))
|
|
355
|
+
return wrapDisplayMath(node, kind);
|
|
172
356
|
const result = structuredClone(node);
|
|
173
357
|
const properties = result.data?.hProperties ?? {};
|
|
174
358
|
const current = properties.className;
|
|
@@ -200,6 +384,9 @@ function stripPositions(node) {
|
|
|
200
384
|
function pairedNode(oldNode, newNode, oldMarkdown, newMarkdown) {
|
|
201
385
|
if (oldNode.type !== newNode.type)
|
|
202
386
|
return null;
|
|
387
|
+
if (oldNode.type === 'table' && newNode.type === 'table') {
|
|
388
|
+
return diffTable(oldNode, newNode, oldMarkdown, newMarkdown);
|
|
389
|
+
}
|
|
203
390
|
if ((newNode.type === 'heading' || newNode.type === 'paragraph') &&
|
|
204
391
|
withChildren(oldNode) &&
|
|
205
392
|
withChildren(newNode)) {
|
|
@@ -216,9 +403,22 @@ function pairedNode(oldNode, newNode, oldMarkdown, newMarkdown) {
|
|
|
216
403
|
newNode.type === 'listItem') &&
|
|
217
404
|
withChildren(oldNode) &&
|
|
218
405
|
withChildren(newNode)) {
|
|
406
|
+
const children = diffBlocks(oldNode.children, newNode.children, oldMarkdown, newMarkdown);
|
|
407
|
+
// Tight lists unwrap paragraphs, discarding their block diff markers.
|
|
408
|
+
// Keep such changes on separate list items, not inside one merged item.
|
|
409
|
+
if (newNode.type === 'listItem' &&
|
|
410
|
+
children.some((child) => {
|
|
411
|
+
if (child.type !== 'paragraph')
|
|
412
|
+
return false;
|
|
413
|
+
const classes = child.data?.hProperties?.className;
|
|
414
|
+
return (Array.isArray(classes) &&
|
|
415
|
+
classes.some((name) => name === 'git-added' || name === 'git-removed'));
|
|
416
|
+
})) {
|
|
417
|
+
return null;
|
|
418
|
+
}
|
|
219
419
|
return {
|
|
220
420
|
...structuredClone(newNode),
|
|
221
|
-
children
|
|
421
|
+
children,
|
|
222
422
|
};
|
|
223
423
|
}
|
|
224
424
|
return null;
|
package/dist/src/view/git.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { execFile } from 'node:child_process';
|
|
2
2
|
import { realpath } from 'node:fs/promises';
|
|
3
3
|
import { isAbsolute, relative, sep } from 'node:path';
|
|
4
|
-
import { toPosix } from '
|
|
4
|
+
import { toPosix } from '@plebeiantech/lat.md-core/path';
|
|
5
5
|
const EMPTY_TREE = '4b825dc642cb6eb9a060e54bf8d69288fbee4904';
|
|
6
6
|
const MAX_GIT_OUTPUT = 50 * 1024 * 1024;
|
|
7
7
|
function runGit(cwd, args) {
|
package/dist/src/view/graph.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { type Section } from '
|
|
1
|
+
import { type Section } from '@plebeiantech/lat.md-core/lattice-model';
|
|
2
2
|
import type { ViewDocumentError, ViewGraph } from './protocol.js';
|
|
3
|
-
import type { ViewCodeReferenceFile, ViewParsedMarkdownFile } from './references.js';
|
|
3
|
+
import type { ViewCodeReferenceFile, ViewParsedMarkdownFile, ViewReferenceIndex } from './references.js';
|
|
4
4
|
import type { ViewGitSnapshot } from './git.js';
|
|
5
|
+
import type { ExternalResolver } from '@plebeiantech/lat.md-core/external-sources';
|
|
5
6
|
/** Project the cached view state into stable nodes and weighted relationships. */
|
|
6
|
-
export declare function buildViewGraph(markdownFiles: Iterable<ViewParsedMarkdownFile>, codeFiles: Iterable<ViewCodeReferenceFile>, allSections: Section[], diagnostics: ReadonlyMap<string, readonly ViewDocumentError[]>, git: ViewGitSnapshot, generation: number): ViewGraph;
|
|
7
|
+
export declare function buildViewGraph(markdownFiles: Iterable<ViewParsedMarkdownFile>, codeFiles: Iterable<ViewCodeReferenceFile>, allSections: Section[], diagnostics: ReadonlyMap<string, readonly ViewDocumentError[]>, git: ViewGitSnapshot, generation: number, references: ViewReferenceIndex, external?: ExternalResolver): ViewGraph;
|
package/dist/src/view/graph.js
CHANGED
|
@@ -1,26 +1,39 @@
|
|
|
1
1
|
import { posix } from 'node:path';
|
|
2
|
-
import { buildFileIndex, buildSectionSlugIndex, flattenSections, resolveRef, } from '
|
|
2
|
+
import { buildFileIndex, buildSectionSlugIndex, flattenSections, resolveRef, } from '@plebeiantech/lat.md-core/lattice-model';
|
|
3
3
|
import { linkedSection } from './references.js';
|
|
4
4
|
import { viewSourceTarget } from './source-target.js';
|
|
5
|
+
import { isDocumentPath, stripDocumentExtension, } from '@plebeiantech/lat.md-core/document-formats';
|
|
6
|
+
import { documentUrl } from './document-route.js';
|
|
5
7
|
function encodedPath(path) {
|
|
6
8
|
return path.split('/').map(encodeURIComponent).join('/');
|
|
7
9
|
}
|
|
8
|
-
function documentUrl(path, fragment = '') {
|
|
9
|
-
return `/docs/${encodedPath(path)}${fragment ? `#${encodeURIComponent(fragment)}` : ''}`;
|
|
10
|
-
}
|
|
11
10
|
function sourceUrl(path, symbol = '', line = 0) {
|
|
12
11
|
const search = line > 0 ? `?at=${line}` : '';
|
|
13
12
|
const fragment = symbol ? `#${encodeURIComponent(symbol)}` : '';
|
|
14
13
|
return `/code/${encodedPath(path)}${search}${fragment}`;
|
|
15
14
|
}
|
|
15
|
+
function externalUrl(target) {
|
|
16
|
+
const colon = target.indexOf(':');
|
|
17
|
+
const hash = target.indexOf('#', colon + 1);
|
|
18
|
+
const handle = target.slice(0, colon);
|
|
19
|
+
const path = hash === -1 ? target.slice(colon + 1) : target.slice(colon + 1, hash);
|
|
20
|
+
const fragment = hash === -1 ? '' : target.slice(hash + 1);
|
|
21
|
+
return `/external/${encodeURIComponent(handle)}/${encodedPath(path)}${fragment ? `#${encodeURIComponent(fragment)}` : ''}`;
|
|
22
|
+
}
|
|
23
|
+
function externalNodeTarget(target) {
|
|
24
|
+
if (!isDocumentPath(target.resolvedPath))
|
|
25
|
+
return target.identity;
|
|
26
|
+
const hash = target.identity.indexOf('#');
|
|
27
|
+
return hash === -1 ? target.identity : target.identity.slice(0, hash);
|
|
28
|
+
}
|
|
16
29
|
function pathBreadcrumbs(path) {
|
|
17
|
-
return path
|
|
30
|
+
return stripDocumentExtension(path).split('/');
|
|
18
31
|
}
|
|
19
32
|
function nodeLabelFromPath(path) {
|
|
20
|
-
return posix.basename(path)
|
|
33
|
+
return posix.basename(stripDocumentExtension(path));
|
|
21
34
|
}
|
|
22
35
|
/** Project the cached view state into stable nodes and weighted relationships. */
|
|
23
|
-
export function buildViewGraph(markdownFiles, codeFiles, allSections, diagnostics, git, generation) {
|
|
36
|
+
export function buildViewGraph(markdownFiles, codeFiles, allSections, diagnostics, git, generation, references, external) {
|
|
24
37
|
const files = [...markdownFiles].sort((left, right) => left.path.localeCompare(right.path));
|
|
25
38
|
const sections = flattenSections(allSections);
|
|
26
39
|
const sectionIds = new Set(sections.map((section) => section.id.toLowerCase()));
|
|
@@ -76,7 +89,9 @@ export function buildViewGraph(markdownFiles, codeFiles, allSections, diagnostic
|
|
|
76
89
|
breadcrumbs: pathBreadcrumbs(file.path),
|
|
77
90
|
documentPath: file.path,
|
|
78
91
|
sectionId: root?.id,
|
|
79
|
-
inDegree:
|
|
92
|
+
inDegree: flat.reduce((count, section) => count +
|
|
93
|
+
(references.incomingBySection.get(section.id.toLowerCase())?.length ??
|
|
94
|
+
0), 0),
|
|
80
95
|
outDegree: 0,
|
|
81
96
|
...(git.files.get(file.path)?.status
|
|
82
97
|
? { gitStatus: git.files.get(file.path)?.status }
|
|
@@ -94,6 +109,38 @@ export function buildViewGraph(markdownFiles, codeFiles, allSections, diagnostic
|
|
|
94
109
|
const from = sourceSection ? documentNodeForSection(sourceSection) : null;
|
|
95
110
|
if (!from)
|
|
96
111
|
continue;
|
|
112
|
+
let externalTarget = null;
|
|
113
|
+
try {
|
|
114
|
+
externalTarget = external?.parse(ref.target) ?? null;
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
if (externalTarget) {
|
|
120
|
+
const target = externalNodeTarget(externalTarget);
|
|
121
|
+
const document = isDocumentPath(externalTarget.resolvedPath);
|
|
122
|
+
const to = addNode({
|
|
123
|
+
id: `${document ? 'external-document' : 'external-source'}:${target}`,
|
|
124
|
+
kind: document ? 'document' : 'source',
|
|
125
|
+
label: document
|
|
126
|
+
? nodeLabelFromPath(externalTarget.resolvedPath)
|
|
127
|
+
: externalTarget.fragment ||
|
|
128
|
+
posix.basename(externalTarget.authoredPath),
|
|
129
|
+
url: externalUrl(target),
|
|
130
|
+
breadcrumbs: [
|
|
131
|
+
externalTarget.handle,
|
|
132
|
+
...externalTarget.authoredPath.split('/'),
|
|
133
|
+
...(!document && externalTarget.fragment
|
|
134
|
+
? [externalTarget.fragment]
|
|
135
|
+
: []),
|
|
136
|
+
],
|
|
137
|
+
externalTarget: target,
|
|
138
|
+
inDegree: 0,
|
|
139
|
+
outDegree: 0,
|
|
140
|
+
});
|
|
141
|
+
addEdge(from, to, document ? 'wiki' : 'source');
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
97
144
|
const source = viewSourceTarget(ref.target);
|
|
98
145
|
if (source) {
|
|
99
146
|
if (invalidWikiTargets.has(`${file.path}\0${ref.line}\0${ref.target}`)) {
|
|
@@ -137,6 +184,48 @@ export function buildViewGraph(markdownFiles, codeFiles, allSections, diagnostic
|
|
|
137
184
|
}
|
|
138
185
|
for (const file of [...codeFiles].sort((left, right) => left.path.localeCompare(right.path))) {
|
|
139
186
|
for (const ref of [...file.refs].sort((left, right) => left.line - right.line)) {
|
|
187
|
+
let externalTarget = null;
|
|
188
|
+
try {
|
|
189
|
+
externalTarget = external?.parse(ref.target) ?? null;
|
|
190
|
+
}
|
|
191
|
+
catch {
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
if (externalTarget) {
|
|
195
|
+
const target = externalNodeTarget(externalTarget);
|
|
196
|
+
const document = isDocumentPath(externalTarget.resolvedPath);
|
|
197
|
+
const to = addNode({
|
|
198
|
+
id: `${document ? 'external-document' : 'external-source'}:${target}`,
|
|
199
|
+
kind: document ? 'document' : 'source',
|
|
200
|
+
label: document
|
|
201
|
+
? nodeLabelFromPath(externalTarget.resolvedPath)
|
|
202
|
+
: externalTarget.fragment ||
|
|
203
|
+
posix.basename(externalTarget.authoredPath),
|
|
204
|
+
url: externalUrl(target),
|
|
205
|
+
breadcrumbs: [
|
|
206
|
+
externalTarget.handle,
|
|
207
|
+
...externalTarget.authoredPath.split('/'),
|
|
208
|
+
],
|
|
209
|
+
externalTarget: target,
|
|
210
|
+
inDegree: 0,
|
|
211
|
+
outDegree: 0,
|
|
212
|
+
});
|
|
213
|
+
const snippet = file.lines[ref.line - 1]?.trim() ?? '';
|
|
214
|
+
const from = addNode({
|
|
215
|
+
id: `code-ref:${file.path}:${ref.line}`,
|
|
216
|
+
kind: 'code-reference',
|
|
217
|
+
label: `${posix.basename(file.path)}:${ref.line}`,
|
|
218
|
+
url: sourceUrl(file.path, '', ref.line),
|
|
219
|
+
breadcrumbs: [...file.path.split('/'), `line ${ref.line}`],
|
|
220
|
+
sourcePath: file.path,
|
|
221
|
+
line: ref.line,
|
|
222
|
+
snippet,
|
|
223
|
+
inDegree: 0,
|
|
224
|
+
outDegree: 0,
|
|
225
|
+
});
|
|
226
|
+
addEdge(from, to, 'code-mention');
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
140
229
|
const resolved = resolveRef(ref.target, sectionIds, fileIndex, slugIndex);
|
|
141
230
|
if (resolved.ambiguous)
|
|
142
231
|
continue;
|
|
@@ -165,7 +254,9 @@ export function buildViewGraph(markdownFiles, codeFiles, allSections, diagnostic
|
|
|
165
254
|
const target = nodes.get(edge.to);
|
|
166
255
|
if (source)
|
|
167
256
|
source.outDegree += edge.weight;
|
|
168
|
-
|
|
257
|
+
// Local documents use the sum of their headings' displayed backlink counts,
|
|
258
|
+
// not visual edge weights (which omit self-links and count repeat links).
|
|
259
|
+
if (target && !target.documentPath)
|
|
169
260
|
target.inDegree += edge.weight;
|
|
170
261
|
}
|
|
171
262
|
return {
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { ElementContent } from 'hast';
|
|
2
|
+
import type { ViewDocumentTree } from './protocol.js';
|
|
3
|
+
export type HighlightedCodeTree = {
|
|
4
|
+
type: 'root';
|
|
5
|
+
children: ElementContent[];
|
|
6
|
+
};
|
|
7
|
+
/** Highlight a supported fenced-code language into a safe HAST fragment. */
|
|
8
|
+
export declare function highlightCode(language: string, content: string): HighlightedCodeTree | null;
|
|
9
|
+
/** Highlight source directly into independently renderable document trees. */
|
|
10
|
+
export declare function highlightSource(path: string, content: string): ViewDocumentTree[];
|