@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
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { realpath } from 'node:fs/promises';
|
|
3
|
+
import { execFile } from 'node:child_process';
|
|
4
|
+
import { promisify } from 'node:util';
|
|
5
|
+
import { dirname, join, relative, sep } from 'node:path';
|
|
6
|
+
import { normalizeRepositoryPath, inspectRepositoryPath, } from '@plebeiantech/lat.md-core/repository-path';
|
|
7
|
+
import { walkEntries } from '@plebeiantech/lat.md-core/walk';
|
|
8
|
+
const exec = promisify(execFile);
|
|
9
|
+
const portable = (path) => path.split(sep).join('/');
|
|
10
|
+
function publicPath(path) {
|
|
11
|
+
return path
|
|
12
|
+
.split('/')
|
|
13
|
+
.every((part) => part.toLowerCase() !== 'config.local.yaml' &&
|
|
14
|
+
part.toLowerCase() !== 'node_modules' &&
|
|
15
|
+
!part.startsWith('.'));
|
|
16
|
+
}
|
|
17
|
+
/** Publication scope is deliberately narrower than interactive source browsing. */
|
|
18
|
+
export async function createPublicationPolicy(projectRoot) {
|
|
19
|
+
let files;
|
|
20
|
+
const git = (args) => exec('git', ['-c', 'core.fsmonitor=false', ...args], {
|
|
21
|
+
cwd: projectRoot,
|
|
22
|
+
maxBuffer: 50 * 1024 * 1024,
|
|
23
|
+
});
|
|
24
|
+
let tracked;
|
|
25
|
+
try {
|
|
26
|
+
tracked = (await git(['ls-files', '--stage', '-z', '--', '.'])).stdout;
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
// A directory without Git still has a useful publication policy: honor
|
|
30
|
+
// .gitignore and the ordinary walker exclusions rather than publish all files.
|
|
31
|
+
if (error.code !== 'ENOENT' &&
|
|
32
|
+
!String(error.stderr).includes('not a git repository'))
|
|
33
|
+
throw error;
|
|
34
|
+
if (error.code === 'ENOENT') {
|
|
35
|
+
for (let directory = projectRoot;; directory = dirname(directory)) {
|
|
36
|
+
if (existsSync(join(directory, '.git')))
|
|
37
|
+
throw new Error('Git is required to determine publication scope for this checkout');
|
|
38
|
+
if (dirname(directory) === directory)
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
files = await walkEntries(projectRoot);
|
|
43
|
+
return policy(new Set(files.filter(publicPath)), projectRoot);
|
|
44
|
+
}
|
|
45
|
+
const ignored = new Set((await git([
|
|
46
|
+
'ls-files',
|
|
47
|
+
'--cached',
|
|
48
|
+
'--ignored',
|
|
49
|
+
'--exclude-standard',
|
|
50
|
+
'-z',
|
|
51
|
+
'--',
|
|
52
|
+
'.',
|
|
53
|
+
])).stdout.split('\0'));
|
|
54
|
+
files = tracked.split('\0').flatMap((entry) => {
|
|
55
|
+
const tab = entry.indexOf('\t');
|
|
56
|
+
const mode = entry.slice(0, entry.indexOf(' '));
|
|
57
|
+
if (tab < 0 || !['100644', '100755'].includes(mode))
|
|
58
|
+
return [];
|
|
59
|
+
const path = entry.slice(tab + 1);
|
|
60
|
+
return publicPath(path) && !ignored.has(path) ? [path] : [];
|
|
61
|
+
});
|
|
62
|
+
return policy(new Set(files), projectRoot);
|
|
63
|
+
}
|
|
64
|
+
function policy(files, root) {
|
|
65
|
+
const realRoot = realpath(root);
|
|
66
|
+
return async (authoredPath) => {
|
|
67
|
+
const path = normalizeRepositoryPath(authoredPath);
|
|
68
|
+
if (!path || path !== authoredPath || !publicPath(path) || !files.has(path))
|
|
69
|
+
return false;
|
|
70
|
+
const inspected = await inspectRepositoryPath(root, path);
|
|
71
|
+
if (inspected.kind !== 'file')
|
|
72
|
+
return false;
|
|
73
|
+
const real = inspected.realPath;
|
|
74
|
+
// Resolving the root through a platform alias must not change membership.
|
|
75
|
+
const realRelative = portable(relative(await realRoot, real));
|
|
76
|
+
return publicPath(realRelative) && files.has(realRelative);
|
|
77
|
+
};
|
|
78
|
+
}
|
|
@@ -1,34 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type
|
|
3
|
-
import { type
|
|
1
|
+
import type { CodeRef } from '@plebeiantech/lat.md-core/code-refs';
|
|
2
|
+
import { type Section } from '@plebeiantech/lat.md-core/lattice-model';
|
|
3
|
+
import { type MarkdownFileAnalysis, type MarkdownParagraph } from '@plebeiantech/lat.md-core/markdown-analysis';
|
|
4
4
|
import { type WikiLinkResolver } from './markdown.js';
|
|
5
5
|
import type { ViewCodeBackReference, ViewSectionBackReferences, ViewSourceReference } from './protocol.js';
|
|
6
6
|
export type SourceReferenceOrigin = {
|
|
7
7
|
sectionId: string;
|
|
8
8
|
line: number;
|
|
9
9
|
};
|
|
10
|
-
type ParagraphContent =
|
|
11
|
-
|
|
12
|
-
startLine: number;
|
|
13
|
-
text: string;
|
|
14
|
-
};
|
|
15
|
-
type MarkdownLink = {
|
|
16
|
-
kind: 'image' | 'link';
|
|
17
|
-
line: number;
|
|
18
|
-
url: string;
|
|
19
|
-
};
|
|
20
|
-
export type ViewParsedMarkdownFile = {
|
|
21
|
-
absolutePath: string;
|
|
22
|
-
content: string;
|
|
23
|
-
path: string;
|
|
24
|
-
projectPath: string;
|
|
25
|
-
tree: Root;
|
|
26
|
-
sections: Section[];
|
|
27
|
-
wikiRefs: Ref[];
|
|
28
|
-
paragraphs: Map<number, ParagraphContent>;
|
|
29
|
-
markdownLinks: MarkdownLink[];
|
|
30
|
-
validationLinks: MdLink[];
|
|
31
|
-
};
|
|
10
|
+
type ParagraphContent = MarkdownParagraph;
|
|
11
|
+
export type ViewParsedMarkdownFile = MarkdownFileAnalysis;
|
|
32
12
|
export type ViewCodeReferenceFile = {
|
|
33
13
|
path: string;
|
|
34
14
|
lines: string[];
|
|
@@ -48,12 +28,17 @@ export type ViewReferenceIndex = {
|
|
|
48
28
|
incomingBySection: ReadonlyMap<string, readonly IndexedBackReference[]>;
|
|
49
29
|
sourceByTarget: ReadonlyMap<string, readonly IndexedMarkdownReference[]>;
|
|
50
30
|
sourceReferenceCounts: ReadonlyMap<string, number>;
|
|
31
|
+
externalByTarget: ReadonlyMap<string, readonly IndexedBackReference[]>;
|
|
51
32
|
};
|
|
52
33
|
/** Parse one Markdown file once into every structure needed by the view store. */
|
|
53
34
|
export declare function parseViewMarkdownFile(absolutePath: string, content: string, latDir: string, projectRoot: string): ViewParsedMarkdownFile;
|
|
54
35
|
export declare function linkedSection(url: string, sourcePath: string, sectionsByPath: ReadonlyMap<string, Section[]>): Section | null;
|
|
55
36
|
/** Resolve cached outgoing occurrences into direct section and source indexes. */
|
|
56
|
-
export declare function buildViewReferenceIndex(markdownFiles: Iterable<ViewParsedMarkdownFile>, codeFiles: Iterable<ViewCodeReferenceFile>, allSections: Section[]): ViewReferenceIndex;
|
|
37
|
+
export declare function buildViewReferenceIndex(markdownFiles: Iterable<ViewParsedMarkdownFile>, codeFiles: Iterable<ViewCodeReferenceFile>, allSections: Section[], resolveExternalTarget?: (target: string) => string | null): ViewReferenceIndex;
|
|
38
|
+
/** Render exact local Markdown and code backlinks for external targets. */
|
|
39
|
+
export declare function renderExternalSectionBackReferences(index: ViewReferenceIndex, targets: ReadonlyMap<string, string>, latDir: string, projectRoot: string, createWikiLinkResolver?: (requestedPath: string) => Promise<WikiLinkResolver>): Promise<ViewSectionBackReferences[]>;
|
|
40
|
+
/** Adapt exact external backlinks to the source context presentation. */
|
|
41
|
+
export declare function renderExternalSourceReferences(index: ViewReferenceIndex, target: string, latDir: string, projectRoot: string, createWikiLinkResolver?: (requestedPath: string) => Promise<WikiLinkResolver>): Promise<ViewSourceReference[]>;
|
|
57
42
|
/** Render direct reverse-index entries for the sections visible in one file. */
|
|
58
43
|
export declare function renderSectionBackReferences(index: ViewReferenceIndex, visibleSections: Section[], latDir: string, projectRoot: string, createWikiLinkResolver?: (requestedPath: string) => Promise<WikiLinkResolver>): Promise<ViewSectionBackReferences[]>;
|
|
59
44
|
/** Render cached Markdown occurrences that point to one source target. */
|
|
@@ -1,112 +1,21 @@
|
|
|
1
1
|
import { relative, resolve } from 'node:path';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { toPosix } from '../walk.js';
|
|
2
|
+
import { buildFileIndex, buildSectionSlugIndex, flattenSections, resolveRef, } from '@plebeiantech/lat.md-core/lattice-model';
|
|
3
|
+
import { analyzeMarkdownFile, } from '@plebeiantech/lat.md-core/markdown-analysis';
|
|
4
|
+
import { toPosix } from '@plebeiantech/lat.md-core/path';
|
|
6
5
|
import { renderMarkdown } from './markdown.js';
|
|
7
|
-
import { viewSourceTarget } from './source-target.js';
|
|
8
|
-
|
|
9
|
-
if (node.type === 'wikiLink')
|
|
10
|
-
return node.data.alias ?? node.value;
|
|
11
|
-
if ('value' in node && typeof node.value === 'string')
|
|
12
|
-
return node.value;
|
|
13
|
-
if (node.type === 'image')
|
|
14
|
-
return node.alt ?? '';
|
|
15
|
-
if (!('children' in node) || !Array.isArray(node.children))
|
|
16
|
-
return '';
|
|
17
|
-
return node.children
|
|
18
|
-
.map((child) => inlineText(child))
|
|
19
|
-
.join('');
|
|
20
|
-
}
|
|
21
|
-
function paragraphs(content, tree) {
|
|
22
|
-
const byLine = new Map();
|
|
23
|
-
visit(tree, 'paragraph', (node) => {
|
|
24
|
-
const start = node.position?.start.line;
|
|
25
|
-
const end = node.position?.end.line;
|
|
26
|
-
if (!start || !end)
|
|
27
|
-
return;
|
|
28
|
-
const text = inlineText(node).replace(/\s+/g, ' ').trim();
|
|
29
|
-
const startOffset = node.position?.start.offset;
|
|
30
|
-
const endOffset = node.position?.end.offset;
|
|
31
|
-
const paragraph = {
|
|
32
|
-
markdown: startOffset === undefined || endOffset === undefined
|
|
33
|
-
? text
|
|
34
|
-
: content.slice(startOffset, endOffset),
|
|
35
|
-
startLine: start,
|
|
36
|
-
text,
|
|
37
|
-
};
|
|
38
|
-
for (let line = start; line <= end; line++)
|
|
39
|
-
byLine.set(line, paragraph);
|
|
40
|
-
});
|
|
41
|
-
return byLine;
|
|
42
|
-
}
|
|
43
|
-
function markdownLinks(tree) {
|
|
44
|
-
const definitions = new Map();
|
|
45
|
-
visit(tree, 'definition', (node) => {
|
|
46
|
-
definitions.set(node.identifier.toLowerCase(), node.url);
|
|
47
|
-
});
|
|
48
|
-
const links = [];
|
|
49
|
-
visit(tree, (node) => {
|
|
50
|
-
if (node.type !== 'link' &&
|
|
51
|
-
node.type !== 'image' &&
|
|
52
|
-
node.type !== 'linkReference' &&
|
|
53
|
-
node.type !== 'imageReference') {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const line = node.position?.start.line;
|
|
57
|
-
if (!line)
|
|
58
|
-
return;
|
|
59
|
-
const url = node.type === 'link' || node.type === 'image'
|
|
60
|
-
? node.url
|
|
61
|
-
: definitions.get(node.identifier.toLowerCase());
|
|
62
|
-
if (url) {
|
|
63
|
-
links.push({
|
|
64
|
-
kind: node.type === 'image' || node.type === 'imageReference'
|
|
65
|
-
? 'image'
|
|
66
|
-
: 'link',
|
|
67
|
-
line,
|
|
68
|
-
url,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
return links;
|
|
73
|
-
}
|
|
6
|
+
import { viewSourceTarget, rewriteLocalFileLink } from './source-target.js';
|
|
7
|
+
import { documentUrl as routeDocumentUrl } from './document-route.js';
|
|
74
8
|
/** Parse one Markdown file once into every structure needed by the view store. */
|
|
75
9
|
export function parseViewMarkdownFile(absolutePath, content, latDir, projectRoot) {
|
|
76
|
-
|
|
77
|
-
return {
|
|
78
|
-
absolutePath,
|
|
79
|
-
content,
|
|
80
|
-
path: toPosix(relative(latDir, absolutePath)),
|
|
81
|
-
projectPath: toPosix(relative(projectRoot, absolutePath)),
|
|
82
|
-
tree,
|
|
83
|
-
sections: parseSections(absolutePath, content, projectRoot, tree),
|
|
84
|
-
wikiRefs: extractRefs(absolutePath, content, projectRoot, tree),
|
|
85
|
-
paragraphs: paragraphs(content, tree),
|
|
86
|
-
markdownLinks: markdownLinks(tree),
|
|
87
|
-
validationLinks: extractLinks(content, tree),
|
|
88
|
-
};
|
|
10
|
+
return analyzeMarkdownFile(absolutePath, content, latDir, projectRoot);
|
|
89
11
|
}
|
|
90
12
|
function contextMarkdownLink(requestedPath, url) {
|
|
91
|
-
|
|
92
|
-
url.startsWith('//') ||
|
|
93
|
-
/^[a-z][a-z\d+.-]*:/i.test(url)) {
|
|
94
|
-
return url;
|
|
95
|
-
}
|
|
96
|
-
const encodedPath = requestedPath
|
|
97
|
-
.split('/')
|
|
98
|
-
.map(encodeURIComponent)
|
|
99
|
-
.join('/');
|
|
100
|
-
const resolved = new URL(url, `http://lat.local/docs/${encodedPath}`);
|
|
101
|
-
return `${resolved.pathname}${resolved.search}${resolved.hash}`;
|
|
13
|
+
return rewriteLocalFileLink(url, requestedPath);
|
|
102
14
|
}
|
|
103
15
|
function documentUrl(latDir, projectRoot, section) {
|
|
104
16
|
const path = toPosix(relative(latDir, resolve(projectRoot, section.filePath)));
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
? `#${encodeURIComponent(section.githubSlug)}`
|
|
108
|
-
: '';
|
|
109
|
-
return `/docs/${encoded}${fragment}`;
|
|
17
|
+
const fragment = section.githubSlug ? section.githubSlug : '';
|
|
18
|
+
return routeDocumentUrl(path, fragment);
|
|
110
19
|
}
|
|
111
20
|
function breadcrumbs(latDir, projectRoot, section) {
|
|
112
21
|
const path = toPosix(relative(latDir, resolve(projectRoot, section.filePath))).replace(/\.md$/i, '');
|
|
@@ -125,20 +34,19 @@ export function linkedSection(url, sourcePath, sectionsByPath) {
|
|
|
125
34
|
.join('/');
|
|
126
35
|
let destination;
|
|
127
36
|
try {
|
|
128
|
-
destination = new URL(url, `http://lat.local
|
|
37
|
+
destination = new URL(url, `http://lat.local/${encodedSourcePath}`);
|
|
129
38
|
}
|
|
130
39
|
catch {
|
|
131
40
|
return null;
|
|
132
41
|
}
|
|
133
|
-
if (destination.origin !== 'http://lat.local'
|
|
134
|
-
!destination.pathname.startsWith('/docs/')) {
|
|
42
|
+
if (destination.origin !== 'http://lat.local') {
|
|
135
43
|
return null;
|
|
136
44
|
}
|
|
137
45
|
let path;
|
|
138
46
|
let fragment;
|
|
139
47
|
try {
|
|
140
48
|
path = destination.pathname
|
|
141
|
-
.slice(
|
|
49
|
+
.slice(1)
|
|
142
50
|
.split('/')
|
|
143
51
|
.map(decodeURIComponent)
|
|
144
52
|
.join('/');
|
|
@@ -155,14 +63,15 @@ export function linkedSection(url, sourcePath, sectionsByPath) {
|
|
|
155
63
|
return (sections.find((section) => section.githubSlug?.toLowerCase() === fragment.toLowerCase()) ?? null);
|
|
156
64
|
}
|
|
157
65
|
function paragraphFor(file, section, line) {
|
|
158
|
-
return (file.paragraphs.
|
|
66
|
+
return (file.paragraphs.find((paragraph) => line >= paragraph.startLine && line <= paragraph.endLine) ?? {
|
|
159
67
|
markdown: section.firstParagraph,
|
|
160
68
|
startLine: line,
|
|
69
|
+
endLine: line,
|
|
161
70
|
text: section.firstParagraph,
|
|
162
71
|
});
|
|
163
72
|
}
|
|
164
73
|
/** Resolve cached outgoing occurrences into direct section and source indexes. */
|
|
165
|
-
export function buildViewReferenceIndex(markdownFiles, codeFiles, allSections) {
|
|
74
|
+
export function buildViewReferenceIndex(markdownFiles, codeFiles, allSections, resolveExternalTarget) {
|
|
166
75
|
const files = [...markdownFiles].sort((a, b) => a.path.localeCompare(b.path));
|
|
167
76
|
const sections = flattenSections(allSections);
|
|
168
77
|
const sectionIds = new Set(sections.map((section) => section.id.toLowerCase()));
|
|
@@ -175,6 +84,7 @@ export function buildViewReferenceIndex(markdownFiles, codeFiles, allSections) {
|
|
|
175
84
|
}
|
|
176
85
|
const incoming = new Map();
|
|
177
86
|
const sourceByTarget = new Map();
|
|
87
|
+
const externalByTarget = new Map();
|
|
178
88
|
const addIncoming = (targetId, key, reference) => {
|
|
179
89
|
const target = targetId.toLowerCase();
|
|
180
90
|
let references = incoming.get(target);
|
|
@@ -194,6 +104,15 @@ export function buildViewReferenceIndex(markdownFiles, codeFiles, allSections) {
|
|
|
194
104
|
if (!references.has(key))
|
|
195
105
|
references.set(key, reference);
|
|
196
106
|
};
|
|
107
|
+
const addExternalReference = (target, key, reference) => {
|
|
108
|
+
let references = externalByTarget.get(target);
|
|
109
|
+
if (!references) {
|
|
110
|
+
references = new Map();
|
|
111
|
+
externalByTarget.set(target, references);
|
|
112
|
+
}
|
|
113
|
+
if (!references.has(key))
|
|
114
|
+
references.set(key, reference);
|
|
115
|
+
};
|
|
197
116
|
for (const file of files) {
|
|
198
117
|
const fileSections = flattenSections(file.sections).sort((a, b) => a.startLine - b.startLine);
|
|
199
118
|
for (const ref of file.wikiRefs) {
|
|
@@ -209,6 +128,10 @@ export function buildViewReferenceIndex(markdownFiles, codeFiles, allSections) {
|
|
|
209
128
|
activeWikiLink: ref.target,
|
|
210
129
|
};
|
|
211
130
|
const locationKey = `markdown:${section.filePath}:${reference.paragraph.startLine}`;
|
|
131
|
+
const externalTarget = resolveExternalTarget?.(ref.target);
|
|
132
|
+
if (externalTarget) {
|
|
133
|
+
addExternalReference(externalTarget, locationKey, reference);
|
|
134
|
+
}
|
|
212
135
|
const source = viewSourceTarget(ref.target);
|
|
213
136
|
if (source) {
|
|
214
137
|
addSourceReference(source.key, locationKey, reference);
|
|
@@ -247,6 +170,16 @@ export function buildViewReferenceIndex(markdownFiles, codeFiles, allSections) {
|
|
|
247
170
|
}
|
|
248
171
|
for (const file of [...codeFiles].sort((a, b) => a.path.localeCompare(b.path))) {
|
|
249
172
|
for (const ref of [...file.refs].sort((a, b) => a.line - b.line)) {
|
|
173
|
+
const externalTarget = resolveExternalTarget?.(ref.target);
|
|
174
|
+
if (externalTarget) {
|
|
175
|
+
addExternalReference(externalTarget, `code:${ref.file}:${ref.line}`, {
|
|
176
|
+
kind: 'code',
|
|
177
|
+
path: ref.file,
|
|
178
|
+
line: ref.line,
|
|
179
|
+
snippet: file.lines[ref.line - 1]?.trim() ?? '',
|
|
180
|
+
url: sourceLineUrl(ref.file, ref.line),
|
|
181
|
+
});
|
|
182
|
+
}
|
|
250
183
|
const resolved = resolveRef(ref.target, sectionIds, fileIndex, slugIndex);
|
|
251
184
|
if (resolved.ambiguous ||
|
|
252
185
|
!sectionById.has(resolved.resolved.toLowerCase())) {
|
|
@@ -274,21 +207,99 @@ export function buildViewReferenceIndex(markdownFiles, codeFiles, allSections) {
|
|
|
274
207
|
target,
|
|
275
208
|
references.size,
|
|
276
209
|
])),
|
|
210
|
+
externalByTarget: new Map([...externalByTarget].map(([target, references]) => [
|
|
211
|
+
target,
|
|
212
|
+
[...references.values()],
|
|
213
|
+
])),
|
|
277
214
|
};
|
|
278
215
|
}
|
|
216
|
+
async function renderExternalReference(reference, latDir, projectRoot, createWikiLinkResolver) {
|
|
217
|
+
if (reference.kind === 'code')
|
|
218
|
+
return reference;
|
|
219
|
+
const resolver = createWikiLinkResolver
|
|
220
|
+
? await createWikiLinkResolver(reference.sourcePath)
|
|
221
|
+
: undefined;
|
|
222
|
+
return renderIndexedMarkdownReference(reference, latDir, projectRoot, resolver);
|
|
223
|
+
}
|
|
224
|
+
/** Render exact local Markdown and code backlinks for external targets. */
|
|
225
|
+
export async function renderExternalSectionBackReferences(index, targets, latDir, projectRoot, createWikiLinkResolver) {
|
|
226
|
+
const sections = new Map();
|
|
227
|
+
for (const [target, headingId] of targets) {
|
|
228
|
+
let section = sections.get(headingId);
|
|
229
|
+
if (!section) {
|
|
230
|
+
section = { sectionId: target, references: new Map() };
|
|
231
|
+
sections.set(headingId, section);
|
|
232
|
+
}
|
|
233
|
+
const lowerTarget = target.toLowerCase();
|
|
234
|
+
const indexed = [...index.externalByTarget]
|
|
235
|
+
.filter(([candidate]) => candidate.toLowerCase() === lowerTarget)
|
|
236
|
+
.flatMap(([, references]) => references);
|
|
237
|
+
for (const reference of indexed) {
|
|
238
|
+
const key = reference.kind === 'markdown'
|
|
239
|
+
? `markdown:${reference.sourcePath}:${reference.paragraph.startLine}`
|
|
240
|
+
: `code:${reference.path}:${reference.line}`;
|
|
241
|
+
if (!section.references.has(key))
|
|
242
|
+
section.references.set(key, reference);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
const result = [];
|
|
246
|
+
for (const [headingId, section] of sections) {
|
|
247
|
+
const references = await Promise.all([...section.references.values()].map((reference) => renderExternalReference(reference, latDir, projectRoot, createWikiLinkResolver)));
|
|
248
|
+
result.push({ sectionId: section.sectionId, headingId, references });
|
|
249
|
+
}
|
|
250
|
+
return result;
|
|
251
|
+
}
|
|
252
|
+
/** Adapt exact external backlinks to the source context presentation. */
|
|
253
|
+
export async function renderExternalSourceReferences(index, target, latDir, projectRoot, createWikiLinkResolver) {
|
|
254
|
+
const indexed = index.externalByTarget.get(target) ?? [];
|
|
255
|
+
const result = [];
|
|
256
|
+
for (const reference of indexed) {
|
|
257
|
+
const rendered = await renderExternalReference(reference, latDir, projectRoot, createWikiLinkResolver);
|
|
258
|
+
if (rendered.kind === 'markdown') {
|
|
259
|
+
result.push({
|
|
260
|
+
sectionId: rendered.sectionId,
|
|
261
|
+
breadcrumbs: rendered.breadcrumbs,
|
|
262
|
+
paragraph: rendered.paragraph,
|
|
263
|
+
paragraphTree: rendered.paragraphTree,
|
|
264
|
+
url: rendered.url,
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
result.push({
|
|
269
|
+
sectionId: `code:${rendered.path}:${rendered.line}`,
|
|
270
|
+
breadcrumbs: [...rendered.path.split('/'), `line ${rendered.line}`],
|
|
271
|
+
paragraph: rendered.snippet,
|
|
272
|
+
paragraphTree: {
|
|
273
|
+
version: 1,
|
|
274
|
+
type: 'root',
|
|
275
|
+
children: [
|
|
276
|
+
{
|
|
277
|
+
type: 'element',
|
|
278
|
+
tagName: 'code',
|
|
279
|
+
properties: {},
|
|
280
|
+
children: [{ type: 'text', value: rendered.snippet }],
|
|
281
|
+
},
|
|
282
|
+
],
|
|
283
|
+
},
|
|
284
|
+
url: rendered.url,
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return result;
|
|
289
|
+
}
|
|
279
290
|
async function renderIndexedMarkdownReference(reference, latDir, projectRoot, resolveWikiLink) {
|
|
280
|
-
const
|
|
291
|
+
const paragraphTree = (await renderMarkdown(reference.paragraph.markdown, reference.sourcePath, resolveWikiLink, {
|
|
281
292
|
activeWikiLink: reference.activeWikiLink,
|
|
282
293
|
activeMarkdownLink: reference.activeMarkdownLink,
|
|
283
294
|
lineOffset: reference.paragraph.startLine - 1,
|
|
284
295
|
rewriteMarkdownLink: (url) => contextMarkdownLink(reference.sourcePath, url),
|
|
285
|
-
})).
|
|
296
|
+
})).tree;
|
|
286
297
|
return {
|
|
287
298
|
kind: 'markdown',
|
|
288
299
|
sectionId: reference.section.id,
|
|
289
300
|
breadcrumbs: breadcrumbs(latDir, projectRoot, reference.section),
|
|
290
301
|
paragraph: reference.paragraph.text,
|
|
291
|
-
|
|
302
|
+
paragraphTree,
|
|
292
303
|
url: documentUrl(latDir, projectRoot, reference.section),
|
|
293
304
|
};
|
|
294
305
|
}
|
|
@@ -308,8 +319,6 @@ export async function renderSectionBackReferences(index, visibleSections, latDir
|
|
|
308
319
|
const result = [];
|
|
309
320
|
for (const section of flattenSections(visibleSections)) {
|
|
310
321
|
const indexed = index.incomingBySection.get(section.id.toLowerCase()) ?? [];
|
|
311
|
-
if (indexed.length === 0)
|
|
312
|
-
continue;
|
|
313
322
|
const references = [];
|
|
314
323
|
for (const reference of indexed) {
|
|
315
324
|
references.push(reference.kind === 'code'
|
|
@@ -345,7 +354,7 @@ export async function renderSourceReferenceContext(index, target, origin, latDir
|
|
|
345
354
|
sectionId: rendered.sectionId,
|
|
346
355
|
breadcrumbs: rendered.breadcrumbs,
|
|
347
356
|
paragraph: rendered.paragraph,
|
|
348
|
-
|
|
357
|
+
paragraphTree: rendered.paragraphTree,
|
|
349
358
|
url: rendered.url,
|
|
350
359
|
},
|
|
351
360
|
});
|
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
import { type Section } from '
|
|
2
|
-
import type
|
|
1
|
+
import { type Section } from '@plebeiantech/lat.md-core/lattice-model';
|
|
2
|
+
import { type ExternalResolver } from '@plebeiantech/lat.md-core/external-sources';
|
|
3
|
+
import type { ExternalTarget } from '@plebeiantech/lat.md-core/external-sources';
|
|
4
|
+
import { renderExternalDocumentTree } from './external-document-tree.js';
|
|
5
|
+
import type { ViewExternalDocument, ViewSourceDocument } from './protocol.js';
|
|
3
6
|
import { type SourceReferenceOrigin, type ViewReferenceIndex } from './references.js';
|
|
4
7
|
export declare class ViewDocumentNotFoundError extends Error {
|
|
5
8
|
}
|
|
6
9
|
export declare class ViewSourceNotFoundError extends Error {
|
|
7
10
|
}
|
|
8
|
-
export declare
|
|
11
|
+
export declare class ViewExternalNotFoundError extends Error {
|
|
12
|
+
}
|
|
13
|
+
export declare function externalUrl(target: string): string;
|
|
14
|
+
/** Make repository-relative external-document links reflect pulled files. */
|
|
15
|
+
export declare function resolveExternalDocumentLinks(tree: Awaited<ReturnType<typeof renderExternalDocumentTree>>, current: ExternalTarget, external: ExternalResolver, referenceIndex: ViewReferenceIndex): typeof tree;
|
|
16
|
+
export declare function createMarkdownWikiLinkResolver(latDir: string, requestedPath: string, loadedSections: Section[], referenceIndex?: ViewReferenceIndex, externalResolver?: ExternalResolver, publishable?: (path: string) => Promise<boolean>): Promise<(target: string, context: {
|
|
9
17
|
line: number;
|
|
10
18
|
}) => Promise<{
|
|
11
19
|
href: string;
|
|
12
20
|
referenceCount: number;
|
|
13
21
|
} | null>>;
|
|
22
|
+
/** Resolve and render one configured external file through the normal view models. */
|
|
23
|
+
export declare function getViewExternal(latDir: string, projectRoot: string, targetValue: string, external: ExternalResolver, allSections: Section[], referenceIndex: ViewReferenceIndex, publishable?: (path: string) => Promise<boolean>): Promise<ViewExternalDocument>;
|
|
14
24
|
/** Read and highlight a source file after constraining it to the project root. */
|
|
15
|
-
export declare function getViewSource(latDir: string, projectRoot: string, requestedPath: string, requestedSymbol?: string, origin?: SourceReferenceOrigin, requestedLine?: number, allSections?: Section[], referenceIndex?: ViewReferenceIndex): Promise<ViewSourceDocument>;
|
|
25
|
+
export declare function getViewSource(latDir: string, projectRoot: string, requestedPath: string, requestedSymbol?: string, origin?: SourceReferenceOrigin, requestedLine?: number, allSections?: Section[], referenceIndex?: ViewReferenceIndex, publishable?: (path: string) => Promise<boolean>): Promise<ViewSourceDocument>;
|