@plebeiantech/lat.md 0.12.3-fork.2 → 0.12.3-fork.20
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 +31 -2
- 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/comment-guard.d.ts +14 -0
- package/dist/src/cli/comment-guard.js +10 -33
- package/dist/src/cli/comment-reminder.d.ts +65 -6
- package/dist/src/cli/comment-reminder.js +164 -28
- package/dist/src/cli/fork-instructions.d.ts +20 -0
- package/dist/src/cli/fork-instructions.js +184 -0
- package/dist/src/cli/fork-scaffold.d.ts +106 -0
- package/dist/src/cli/fork-scaffold.js +490 -0
- package/dist/src/cli/graph.d.ts +1 -1
- package/dist/src/cli/hook.d.ts +26 -0
- package/dist/src/cli/hook.js +118 -46
- package/dist/src/cli/index.js +166 -64
- 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 +107 -50
- 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 +116 -100
- 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 +4 -0
- package/dist/src/cli/ui-build.js +13 -0
- package/dist/src/cli/ui.d.ts +1 -1
- package/dist/src/cli/ui.js +18 -2
- 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-cli.js +2 -0
- package/dist/src/fork/upstream-drift.d.ts +26 -0
- package/dist/src/fork/upstream-drift.js +185 -0
- package/dist/src/fork/upstream-guard-cli.d.ts +1 -0
- package/dist/src/fork/upstream-guard-cli.js +2 -0
- package/dist/src/fork/upstream-guard.d.ts +72 -0
- package/dist/src/fork/upstream-guard.js +445 -0
- package/dist/src/graph-export.d.ts +2 -0
- package/dist/src/graph-export.js +38 -19
- package/dist/src/knowledge/claude-memory.d.ts +1 -0
- package/dist/src/knowledge/claude-memory.js +33 -4
- 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 +197 -0
- package/dist/src/search/db.d.ts +28 -16
- package/dist/src/search/db.js +106 -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 -53
- 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 +17 -7
- package/dist/src/search/search.js +164 -14
- package/dist/src/search/types.d.ts +15 -0
- package/dist/src/search/types.js +1 -0
- package/dist/src/view/client/assets/GraphView-Dij8mAA_.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-88Wbt0M1.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-y0DlYa8E.js +1 -0
- package/dist/src/view/client/assets/arc-FlMu8dnO.js +1 -0
- package/dist/src/view/client/assets/architectureDiagram-5GKGNRK7-DA_uWZW1.js +36 -0
- package/dist/src/view/client/assets/blockDiagram-I7D4REHJ-BHQ5LU85.js +129 -0
- package/dist/src/view/client/assets/c4Diagram-7LVT6UL2-BRucKCt2.js +38 -0
- package/dist/src/view/client/assets/channel-BgDNA_Ay.js +1 -0
- package/dist/src/view/client/assets/chunk-2Q5K7J3B-BJPcFivt.js +1 -0
- package/dist/src/view/client/assets/chunk-5VM5RSS4-v2q99bGz.js +15 -0
- package/dist/src/view/client/assets/chunk-F27PBJKO-CcHOuJCs.js +1 -0
- package/dist/src/view/client/assets/chunk-IMKFNOWR-DNxYuJNq.js +231 -0
- package/dist/src/view/client/assets/chunk-JWPE2WC7-C0eHKvLW.js +1 -0
- package/dist/src/view/client/assets/chunk-POPQ4Y6H-57CWp2Ve.js +1 -0
- package/dist/src/view/client/assets/chunk-SVP7TREG-BqcoxIJw.js +88 -0
- package/dist/src/view/client/assets/chunk-TICWLB2K-DRUJR5zH.js +206 -0
- package/dist/src/view/client/assets/chunk-XXDRQBXY-Dez0oRoM.js +1 -0
- package/dist/src/view/client/assets/classDiagram-ZZMXUADV-CFZ_Sgh5.js +1 -0
- package/dist/src/view/client/assets/classDiagram-v2-VYDZK3BY-CFZ_Sgh5.js +1 -0
- package/dist/src/view/client/assets/cose-bilkent-JH36ORCC-BHtud6Hg.js +1 -0
- package/dist/src/view/client/assets/cynefin-OW5HDTMX-BjBW8VGk.js +166 -0
- package/dist/src/view/client/assets/cynefinDiagram-5FMLGOSQ-DwGuD7oF.js +62 -0
- package/dist/src/view/client/assets/cytoscape.esm-DzSz-X2X.js +321 -0
- package/dist/src/view/client/assets/dagre-GXQ25YYZ-C5zSlGK9.js +4 -0
- package/dist/src/view/client/assets/defaultLocale-DX6XiGOO.js +1 -0
- package/dist/src/view/client/assets/diagram-S7CK7UJ4-C_NhA3bj.js +30 -0
- package/dist/src/view/client/assets/diagram-UQ7AKVKN-az7QPYNb.js +41 -0
- package/dist/src/view/client/assets/diagram-VSXAHHWV-BRvDuM8_.js +3 -0
- package/dist/src/view/client/assets/diagram-VX7I27RA-BWLgF6S-.js +24 -0
- package/dist/src/view/client/assets/diagram-Z3DM3KII-DV3d6mL5.js +24 -0
- package/dist/src/view/client/assets/ebnfDiagram-PWID7BFC-yUXrEAvK.js +1 -0
- package/dist/src/view/client/assets/erDiagram-RLTQ6QDP-D35FN1Pt.js +99 -0
- package/dist/src/view/client/assets/flowDiagram-HODETNUW-BciZqsjT.js +168 -0
- package/dist/src/view/client/assets/ganttDiagram-EL5Y4UJY-BysPGgXS.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-C3DdJ5xG.js +106 -0
- package/dist/src/view/client/assets/index-BnENo9bV.js +1 -0
- package/dist/src/view/client/assets/index-CJokoRSp.js +13 -0
- package/dist/src/view/client/assets/index-DG0Ez15D.css +1 -0
- package/dist/src/view/client/assets/infoDiagram-27XIBGKW-D3HZrDRb.js +2 -0
- package/dist/src/view/client/assets/init-Gi6I4Gst.js +1 -0
- package/dist/src/view/client/assets/ishikawaDiagram-5VMMS53U-BXyVIXTU.js +70 -0
- package/dist/src/view/client/assets/journeyDiagram-3NMN7TZE-D4-1NxVU.js +139 -0
- package/dist/src/view/client/assets/kanban-definition-UXKFOSKX-4Gu_5yBA.js +89 -0
- package/dist/src/view/client/assets/katex-HP8lGamR.js +257 -0
- package/dist/src/view/client/assets/layout-Jf1K3TMM.js +1 -0
- package/dist/src/view/client/assets/linear-DWfwzUT_.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-DMx_DAl8.js +310 -0
- package/dist/src/view/client/assets/mindmap-definition-YA3MSWOX-8pxY_RWi.js +96 -0
- package/dist/src/view/client/assets/ordinal-Cboi1Yqb.js +1 -0
- package/dist/src/view/client/assets/pegDiagram-XKGWAZYB-DNAw_O5t.js +1 -0
- package/dist/src/view/client/assets/pieDiagram-E7YTZNPT-uuvRCDkC.js +39 -0
- package/dist/src/view/client/assets/quadrantDiagram-AXDQQJYC-BER2O4Aq.js +7 -0
- package/dist/src/view/client/assets/railroadDiagram-O6MQD6OU-CxEsJ_0n.js +1 -0
- package/dist/src/view/client/assets/requirementDiagram-BXWQKSXE-yS9rspca.js +84 -0
- package/dist/src/view/client/assets/sankeyDiagram-P5KCCOFB-Bqt70a2j.js +40 -0
- package/dist/src/view/client/assets/sequenceDiagram-WJ2MYXX4-BvOOEJNr.js +162 -0
- package/dist/src/view/client/assets/sizeCapture-INFHLROL-CvO_Pjjo.js +1 -0
- package/dist/src/view/client/assets/stateDiagram-D77RDMKH-KLmVOZkq.js +1 -0
- package/dist/src/view/client/assets/stateDiagram-v2-MP3YSRHH-KCS8Mdzu.js +1 -0
- package/dist/src/view/client/assets/swimlanes-42K2YHIH-DC1r4_sq.js +1 -0
- package/dist/src/view/client/assets/swimlanesDiagram-VR7AAH4N-B2TcAwis.js +8 -0
- package/dist/src/view/client/assets/three.module-PDSP0dbZ.js +4108 -0
- package/dist/src/view/client/assets/timeline-definition-24CTP7MA-ChXLOuBL.js +120 -0
- package/dist/src/view/client/assets/vennDiagram-4TSXK5OY-D9_h25-Y.js +34 -0
- package/dist/src/view/client/assets/wardleyDiagram-VM6X3IG4-CsQJGGW0.js +78 -0
- package/dist/src/view/client/assets/xychartDiagram-S5SC5T6Z-DGMuPMlm.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 +126 -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 +205 -1
- package/dist/src/view/git.js +1 -1
- package/dist/src/view/graph.d.ts +7 -0
- package/dist/src/view/graph.js +267 -0
- package/dist/src/view/highlight.d.ts +10 -2
- package/dist/src/view/highlight.js +4547 -1363
- package/dist/src/view/markdown.d.ts +8 -3
- package/dist/src/view/markdown.js +308 -41
- 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 +95 -6
- package/dist/src/view/protocol.js +1 -1
- package/dist/src/view/publication.d.ts +2 -0
- package/dist/src/view/publication.js +78 -0
- package/dist/src/view/references.d.ts +13 -26
- package/dist/src/view/references.js +150 -119
- package/dist/src/view/repository.d.ts +18 -5
- package/dist/src/view/repository.js +269 -27
- 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 -33
- 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 +94 -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 +14 -2
- package/dist/src/view/server.js +254 -51
- package/dist/src/view/source-target.d.ts +10 -0
- package/dist/src/view/source-target.js +43 -0
- package/dist/src/view/static-build.d.ts +32 -0
- package/dist/src/view/static-build.js +741 -0
- package/dist/src/view/static-protocol.d.ts +47 -0
- package/dist/src/view/static-protocol.js +15 -0
- package/dist/src/view/store.d.ts +26 -3
- package/dist/src/view/store.js +325 -44
- package/dist/src/view/table-of-contents.d.ts +9 -0
- package/dist/src/view/table-of-contents.js +83 -0
- package/dist/src/view/vercel-build.d.ts +24 -0
- package/dist/src/view/vercel-build.js +140 -0
- package/dist/src/view/vercel-server-build.d.ts +10 -0
- package/dist/src/view/vercel-server-build.js +61 -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 +72 -25
- 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 +118 -0
- package/plugins/lat-md/skills/lat-md/SKILL.md +178 -0
- package/plugins/lat-md/skills/lat-md-conventions/SKILL.md +182 -0
- package/templates/AGENTS.md +19 -18
- package/templates/cursor-rules.md +14 -5
- package/templates/fork/conventions.md +173 -0
- package/templates/opencode-plugin.ts +9 -9
- package/templates/pi-extension.ts +11 -11
- package/templates/skill/SKILL.md +28 -17
- 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 -6
- package/dist/src/cli/check-mode.js +0 -303
- 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 -777
- 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 -277
- 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 -108
- package/dist/src/lattice.js +0 -816
- 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 -24
- package/dist/src/untrusted.js +0 -97
- package/dist/src/view/client/assets/index-B0n0u03y.css +0 -1
- package/dist/src/view/client/assets/index-xm2_px4q.js +0 -23
- package/dist/src/walk.d.ts +0 -18
- package/dist/src/walk.js +0 -27
- /package/dist/src/{extensions/wiki-link/types.js → fork/upstream-drift-cli.d.ts} +0 -0
package/dist/src/code-refs.js
DELETED
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import { execFile } from 'node:child_process';
|
|
3
|
-
import { join, relative } from 'node:path';
|
|
4
|
-
import { toPosix, walkEntries } from './walk.js';
|
|
5
|
-
/** Glob patterns used to exclude directories/files from code-ref scanning.
|
|
6
|
-
* Shared between rg args and the TS fallback's walkFiles filter. */
|
|
7
|
-
const EXCLUDE_DIRS = ['lat.md', '.claude'];
|
|
8
|
-
const EXCLUDE_GLOBS = ['*.md'];
|
|
9
|
-
/** Walk project files for code-ref scanning. Uses walkEntries for .gitignore
|
|
10
|
-
* support, then additionally skips .md files, lat.md/, .claude/, and sub-projects. */
|
|
11
|
-
export async function walkFiles(dir) {
|
|
12
|
-
const entries = await walkEntries(dir);
|
|
13
|
-
// Collect directories that contain their own lat.md/ (sub-projects)
|
|
14
|
-
const subProjects = new Set();
|
|
15
|
-
for (const e of entries) {
|
|
16
|
-
const i = e.indexOf('/lat.md/');
|
|
17
|
-
if (i !== -1)
|
|
18
|
-
subProjects.add(e.slice(0, i + 1));
|
|
19
|
-
}
|
|
20
|
-
return entries
|
|
21
|
-
.filter((e) => !e.endsWith('.md') &&
|
|
22
|
-
!e.startsWith('lat.md/') &&
|
|
23
|
-
!e.startsWith('.claude/') &&
|
|
24
|
-
![...subProjects].some((prefix) => e.startsWith(prefix)))
|
|
25
|
-
.map((e) => join(dir, e));
|
|
26
|
-
}
|
|
27
|
-
/** Build a RegExp from a verbose template — whitespace is insignificant. */
|
|
28
|
-
function re(flags) {
|
|
29
|
-
return (strings) => new RegExp(strings.raw[0].replace(/\s+/g, ''), flags);
|
|
30
|
-
}
|
|
31
|
-
// Line comment (// or #), then @lat: marker, then [[target]]
|
|
32
|
-
export const LAT_REF_RE = re('gv') `
|
|
33
|
-
(?: // | # )
|
|
34
|
-
\s* @lat: \s*
|
|
35
|
-
\[\[
|
|
36
|
-
( [^\]]+ )
|
|
37
|
-
\]\]
|
|
38
|
-
`;
|
|
39
|
-
/** Explicit opt-out: a standalone `lat:ignore` token anywhere on the line
|
|
40
|
-
* suppresses any @lat: match on that line. This gives an author documenting
|
|
41
|
-
* the syntax one obvious escape hatch when a match isn't inside a
|
|
42
|
-
* quoted/backticked literal (the common case handled by
|
|
43
|
-
* `isInsideQuotedSpan`). Word-boundary lookarounds (rather than `\b`, which
|
|
44
|
-
* treats `:` as a boundary on both sides already and wouldn't help) keep
|
|
45
|
-
* incidental substrings — `lat:ignore-config`, `mylat:ignore` — from
|
|
46
|
-
* suppressing a real ref on the same line, while still matching the token
|
|
47
|
-
* at the very start of a line or glued directly to a comment marker
|
|
48
|
-
* (`//lat:ignore`), since `/` isn't a word character either. */
|
|
49
|
-
const LAT_IGNORE_RE = /(?<![\w])lat:ignore(?![-\w])/;
|
|
50
|
-
/** Quote characters treated as delimiting a literal span: plain strings
|
|
51
|
-
* ('...' or "...") and backtick spans, which double as inline-code markers
|
|
52
|
-
* when a comment is documenting the @lat: syntax itself (e.g. `` `@lat:
|
|
53
|
-
* [[section-id]]` ``). A marker whose match falls inside such a span is an
|
|
54
|
-
* example, not a real reference, so it is not returned as a ref. */
|
|
55
|
-
const QUOTE_CHARS = ['"', '`', "'"];
|
|
56
|
-
/**
|
|
57
|
-
* Returns true if `index` (an offset into `line`) falls inside a
|
|
58
|
-
* quote-delimited span on that line. For each quote character, occurrences
|
|
59
|
-
* are paired up in order (open, close, open, close, ...); if a quote
|
|
60
|
-
* character appears an odd number of times on the line, it's ambiguous
|
|
61
|
-
* (e.g. an apostrophe in prose) and is ignored entirely for that line rather
|
|
62
|
-
* than risk hiding a real reference.
|
|
63
|
-
*/
|
|
64
|
-
function isInsideQuotedSpan(line, index) {
|
|
65
|
-
for (const q of QUOTE_CHARS) {
|
|
66
|
-
const positions = [];
|
|
67
|
-
for (let i = 0; i < line.length; i++) {
|
|
68
|
-
if (line[i] === q && line[i - 1] !== '\\')
|
|
69
|
-
positions.push(i);
|
|
70
|
-
}
|
|
71
|
-
if (positions.length < 2 || positions.length % 2 !== 0)
|
|
72
|
-
continue;
|
|
73
|
-
for (let i = 0; i < positions.length; i += 2) {
|
|
74
|
-
if (index > positions[i] && index < positions[i + 1])
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
/** Filter regex matches on a single line, dropping ones that are inside a
|
|
81
|
-
* quoted/backticked literal or on a line carrying an explicit `lat:ignore`
|
|
82
|
-
* opt-out — these document the @lat: syntax rather than using it. */
|
|
83
|
-
function extractRefsFromLine(line) {
|
|
84
|
-
if (LAT_IGNORE_RE.test(line))
|
|
85
|
-
return [];
|
|
86
|
-
const targets = [];
|
|
87
|
-
LAT_REF_RE.lastIndex = 0;
|
|
88
|
-
let match;
|
|
89
|
-
while ((match = LAT_REF_RE.exec(line)) !== null) {
|
|
90
|
-
if (!isInsideQuotedSpan(line, match.index)) {
|
|
91
|
-
targets.push(match[1]);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return targets;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Run an external command and return stdout, or null if the command is not found
|
|
98
|
-
* or fails.
|
|
99
|
-
*/
|
|
100
|
-
function tryExec(cmd, args, cwd) {
|
|
101
|
-
return new Promise((resolve) => {
|
|
102
|
-
execFile(cmd, args, { cwd, maxBuffer: 50 * 1024 * 1024 }, (err, out) => {
|
|
103
|
-
if (err) {
|
|
104
|
-
// Exit code 1 with no stderr typically means "no matches" for grep/rg
|
|
105
|
-
const exitCode = err.code;
|
|
106
|
-
if (exitCode === 'ENOENT') {
|
|
107
|
-
resolve(null); // command not found
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
// rg/grep exit 1 = no matches (not an error)
|
|
111
|
-
if ('status' in err &&
|
|
112
|
-
err.status === 1 &&
|
|
113
|
-
out === '') {
|
|
114
|
-
resolve('');
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
resolve(null);
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
resolve(out);
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Detect sub-projects (directories containing their own lat.md/) using
|
|
126
|
-
* rg --files. Finds files inside nested lat.md/ dirs and extracts the parent
|
|
127
|
-
* directory paths. Returns paths relative to projectRoot.
|
|
128
|
-
*/
|
|
129
|
-
async function findSubProjects(projectRoot) {
|
|
130
|
-
// List files inside any lat.md/ dir, then extract unique parent paths.
|
|
131
|
-
// The root lat.md/ is excluded by EXCLUDE_DIRS in the caller, so we only
|
|
132
|
-
// need to find nested ones here — search for files under */lat.md/.
|
|
133
|
-
const out = await tryExec('rg', ['--files', '--glob', '**/lat.md/**', '.'], projectRoot);
|
|
134
|
-
if (!out)
|
|
135
|
-
return [];
|
|
136
|
-
const subProjects = new Set();
|
|
137
|
-
for (const rawLine of out.split('\n')) {
|
|
138
|
-
if (!rawLine)
|
|
139
|
-
continue;
|
|
140
|
-
// rg emits native separators on Windows; normalize before matching '/lat.md/'.
|
|
141
|
-
const line = toPosix(rawLine);
|
|
142
|
-
const clean = line.startsWith('./') ? line.slice(2) : line;
|
|
143
|
-
// "tests/cases/foo/lat.md/specs.md" → "tests/cases/foo"
|
|
144
|
-
// Skip root lat.md/ (no parent prefix — starts with "lat.md/")
|
|
145
|
-
const idx = clean.indexOf('/lat.md/');
|
|
146
|
-
if (idx !== -1)
|
|
147
|
-
subProjects.add(clean.slice(0, idx));
|
|
148
|
-
}
|
|
149
|
-
return [...subProjects];
|
|
150
|
-
}
|
|
151
|
-
/** Build rg glob exclusion args. */
|
|
152
|
-
function rgExcludeArgs(subProjects) {
|
|
153
|
-
const args = [];
|
|
154
|
-
for (const dir of EXCLUDE_DIRS)
|
|
155
|
-
args.push('--glob', `!${dir}/`);
|
|
156
|
-
for (const glob of EXCLUDE_GLOBS)
|
|
157
|
-
args.push('--glob', `!${glob}`);
|
|
158
|
-
for (const sp of subProjects)
|
|
159
|
-
args.push('--glob', `!${sp}/`);
|
|
160
|
-
return args;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Try scanning with ripgrep. Returns parsed refs and scanned file list, or null
|
|
164
|
-
* if rg is not available. rg respects .gitignore by default; we add glob
|
|
165
|
-
* exclusions for lat.md/, .claude/, *.md files, and sub-projects.
|
|
166
|
-
*/
|
|
167
|
-
async function tryRipgrep(projectRoot) {
|
|
168
|
-
// Detect sub-projects first so we can exclude them from all rg calls
|
|
169
|
-
const subProjects = await findSubProjects(projectRoot);
|
|
170
|
-
const excludes = rgExcludeArgs(subProjects);
|
|
171
|
-
// Search for @lat refs
|
|
172
|
-
const searchArgs = [
|
|
173
|
-
'--no-heading',
|
|
174
|
-
'--line-number',
|
|
175
|
-
'--with-filename',
|
|
176
|
-
...excludes,
|
|
177
|
-
'@lat:.*\\[\\[',
|
|
178
|
-
'.',
|
|
179
|
-
];
|
|
180
|
-
const out = await tryExec('rg', searchArgs, projectRoot);
|
|
181
|
-
if (out === null)
|
|
182
|
-
return null;
|
|
183
|
-
const { refs } = parseGrepOutput(out);
|
|
184
|
-
// List all scanned files (for stats) — rg --files is fast
|
|
185
|
-
const filesOut = await tryExec('rg', ['--files', ...excludes, '.'], projectRoot);
|
|
186
|
-
const files = (filesOut || '')
|
|
187
|
-
.split('\n')
|
|
188
|
-
.filter(Boolean)
|
|
189
|
-
.map((f) => {
|
|
190
|
-
const clean = toPosix(f).replace(/^\.\//, '');
|
|
191
|
-
return join(projectRoot, clean);
|
|
192
|
-
});
|
|
193
|
-
return { refs, files };
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Parse rg output lines (file:line:content) into CodeRef entries.
|
|
197
|
-
*/
|
|
198
|
-
function parseGrepOutput(output) {
|
|
199
|
-
const refs = [];
|
|
200
|
-
if (!output.trim())
|
|
201
|
-
return { refs };
|
|
202
|
-
for (const line of output.split('\n')) {
|
|
203
|
-
if (!line)
|
|
204
|
-
continue;
|
|
205
|
-
// Format: ./path/to/file:linenum:content
|
|
206
|
-
const firstColon = line.indexOf(':');
|
|
207
|
-
if (firstColon === -1)
|
|
208
|
-
continue;
|
|
209
|
-
const secondColon = line.indexOf(':', firstColon + 1);
|
|
210
|
-
if (secondColon === -1)
|
|
211
|
-
continue;
|
|
212
|
-
// rg emits native separators (`\` on Windows); normalize to POSIX so the
|
|
213
|
-
// stored path matches wiki-link and TS-fallback conventions. This also
|
|
214
|
-
// turns a Windows `.\` prefix into `./` for the strip below.
|
|
215
|
-
let filePath = toPosix(line.slice(0, firstColon));
|
|
216
|
-
const lineNum = parseInt(line.slice(firstColon + 1, secondColon), 10);
|
|
217
|
-
const content = line.slice(secondColon + 1);
|
|
218
|
-
if (isNaN(lineNum))
|
|
219
|
-
continue;
|
|
220
|
-
// Strip leading ./ from path
|
|
221
|
-
if (filePath.startsWith('./'))
|
|
222
|
-
filePath = filePath.slice(2);
|
|
223
|
-
// Extract targets using the same regex and literal-span filtering as the
|
|
224
|
-
// TS fallback, so both scan paths agree regardless of whether ripgrep is
|
|
225
|
-
// installed.
|
|
226
|
-
for (const target of extractRefsFromLine(content)) {
|
|
227
|
-
refs.push({ target, file: filePath, line: lineNum });
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
return { refs };
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* TypeScript fallback: read every file and scan for @lat refs.
|
|
234
|
-
*/
|
|
235
|
-
async function scanWithTs(files, projectRoot) {
|
|
236
|
-
const refs = [];
|
|
237
|
-
for (const file of files) {
|
|
238
|
-
let content;
|
|
239
|
-
try {
|
|
240
|
-
content = await readFile(file, 'utf-8');
|
|
241
|
-
}
|
|
242
|
-
catch (err) {
|
|
243
|
-
process.stderr.write(`Error: failed to read ${file}: ${err.message}\n`);
|
|
244
|
-
continue;
|
|
245
|
-
}
|
|
246
|
-
const lines = content.split('\n');
|
|
247
|
-
for (let i = 0; i < lines.length; i++) {
|
|
248
|
-
for (const target of extractRefsFromLine(lines[i])) {
|
|
249
|
-
refs.push({
|
|
250
|
-
target,
|
|
251
|
-
file: toPosix(relative(projectRoot, file)),
|
|
252
|
-
line: i + 1,
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
return refs;
|
|
258
|
-
}
|
|
259
|
-
/** Check whether ripgrep (`rg`) is available on PATH. */
|
|
260
|
-
export async function hasRipgrep() {
|
|
261
|
-
const result = await tryExec('rg', ['--version'], '.');
|
|
262
|
-
return result !== null;
|
|
263
|
-
}
|
|
264
|
-
export async function scanCodeRefs(projectRoot) {
|
|
265
|
-
// Fast path: use rg for both searching and file listing
|
|
266
|
-
// _LAT_DISABLE_RG is a test-only escape hatch to force the TS fallback
|
|
267
|
-
if (process.env._LAT_DISABLE_RG !== '1') {
|
|
268
|
-
const rgResult = await tryRipgrep(projectRoot);
|
|
269
|
-
if (rgResult !== null) {
|
|
270
|
-
return { refs: rgResult.refs, files: rgResult.files, usedRg: true };
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
// Fallback: walk files ourselves and scan with TS
|
|
274
|
-
const files = await walkFiles(projectRoot);
|
|
275
|
-
const refs = await scanWithTs(files, projectRoot);
|
|
276
|
-
return { refs, files, usedRg: false };
|
|
277
|
-
}
|
package/dist/src/config.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export declare function getConfigDir(): string;
|
|
2
|
-
export declare function getConfigPath(): string;
|
|
3
|
-
export type LatConfig = {
|
|
4
|
-
llm_key?: string;
|
|
5
|
-
/**
|
|
6
|
-
* Per-repo embedding backend preference, keyed by absolute lat.md dir. Durable
|
|
7
|
-
* (survives deletion of the regenerable `.cache`), so a repo explicitly
|
|
8
|
-
* switched to local stays local even after a cache wipe or fresh clone.
|
|
9
|
-
*/
|
|
10
|
-
repos?: Record<string, {
|
|
11
|
-
embedding?: 'local';
|
|
12
|
-
}>;
|
|
13
|
-
};
|
|
14
|
-
export declare function readConfig(): LatConfig;
|
|
15
|
-
export declare function writeConfig(config: LatConfig): void;
|
|
16
|
-
/** Durable per-repo backend choice, or undefined if none recorded. */
|
|
17
|
-
export declare function getRepoEmbedding(latDir: string): 'local' | undefined;
|
|
18
|
-
/** Record (or clear, with `null`) the durable per-repo backend choice. */
|
|
19
|
-
export declare function setRepoEmbedding(latDir: string, embedding: 'local' | null): void;
|
|
20
|
-
/**
|
|
21
|
-
* Returns the LLM key from (in priority order):
|
|
22
|
-
* 1. LAT_LLM_KEY environment variable
|
|
23
|
-
* 2. LAT_LLM_KEY_FILE — path to a file containing the key
|
|
24
|
-
* 3. LAT_LLM_KEY_HELPER — shell command that prints the key
|
|
25
|
-
* 4. llm_key field in ~/.config/lat/config.json
|
|
26
|
-
*
|
|
27
|
-
* Returns undefined if none is set.
|
|
28
|
-
*/
|
|
29
|
-
export declare function getLlmKey(): string | undefined;
|
package/dist/src/config.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { execSync } from 'node:child_process';
|
|
2
|
-
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
3
|
-
import { join, resolve } from 'node:path';
|
|
4
|
-
import xdg from '@folder/xdg';
|
|
5
|
-
// ── XDG config directory ────────────────────────────────────────────
|
|
6
|
-
export function getConfigDir() {
|
|
7
|
-
return join(xdg().config, 'lat');
|
|
8
|
-
}
|
|
9
|
-
export function getConfigPath() {
|
|
10
|
-
return join(getConfigDir(), 'config.json');
|
|
11
|
-
}
|
|
12
|
-
export function readConfig() {
|
|
13
|
-
const configPath = getConfigPath();
|
|
14
|
-
if (!existsSync(configPath))
|
|
15
|
-
return {};
|
|
16
|
-
try {
|
|
17
|
-
return JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
18
|
-
}
|
|
19
|
-
catch (err) {
|
|
20
|
-
process.stderr.write(`Error: failed to parse config ${configPath}: ${err.message}\n`);
|
|
21
|
-
process.exit(1);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
export function writeConfig(config) {
|
|
25
|
-
const dir = getConfigDir();
|
|
26
|
-
mkdirSync(dir, { recursive: true });
|
|
27
|
-
writeFileSync(getConfigPath(), JSON.stringify(config, null, 2) + '\n');
|
|
28
|
-
}
|
|
29
|
-
// ── Per-repo embedding backend preference ───────────────────────────
|
|
30
|
-
/** Durable per-repo backend choice, or undefined if none recorded. */
|
|
31
|
-
export function getRepoEmbedding(latDir) {
|
|
32
|
-
return readConfig().repos?.[resolve(latDir)]?.embedding;
|
|
33
|
-
}
|
|
34
|
-
/** Record (or clear, with `null`) the durable per-repo backend choice. */
|
|
35
|
-
export function setRepoEmbedding(latDir, embedding) {
|
|
36
|
-
const key = resolve(latDir);
|
|
37
|
-
const config = readConfig();
|
|
38
|
-
const repos = config.repos ?? {};
|
|
39
|
-
if (embedding === null)
|
|
40
|
-
delete repos[key];
|
|
41
|
-
else
|
|
42
|
-
repos[key] = { embedding };
|
|
43
|
-
config.repos = repos;
|
|
44
|
-
writeConfig(config);
|
|
45
|
-
}
|
|
46
|
-
// ── Centralized LLM key resolution ─────────────────────────────────
|
|
47
|
-
/**
|
|
48
|
-
* Returns the LLM key from (in priority order):
|
|
49
|
-
* 1. LAT_LLM_KEY environment variable
|
|
50
|
-
* 2. LAT_LLM_KEY_FILE — path to a file containing the key
|
|
51
|
-
* 3. LAT_LLM_KEY_HELPER — shell command that prints the key
|
|
52
|
-
* 4. llm_key field in ~/.config/lat/config.json
|
|
53
|
-
*
|
|
54
|
-
* Returns undefined if none is set.
|
|
55
|
-
*/
|
|
56
|
-
export function getLlmKey() {
|
|
57
|
-
const envKey = process.env.LAT_LLM_KEY;
|
|
58
|
-
if (envKey)
|
|
59
|
-
return envKey;
|
|
60
|
-
const file = process.env.LAT_LLM_KEY_FILE;
|
|
61
|
-
if (file) {
|
|
62
|
-
const content = readFileSync(file, 'utf-8').trim();
|
|
63
|
-
if (!content) {
|
|
64
|
-
throw new Error(`LAT_LLM_KEY_FILE (${file}) is empty.`);
|
|
65
|
-
}
|
|
66
|
-
return content;
|
|
67
|
-
}
|
|
68
|
-
const helper = process.env.LAT_LLM_KEY_HELPER;
|
|
69
|
-
if (helper) {
|
|
70
|
-
const result = execSync(helper, {
|
|
71
|
-
encoding: 'utf-8',
|
|
72
|
-
timeout: 10_000,
|
|
73
|
-
}).trim();
|
|
74
|
-
if (!result) {
|
|
75
|
-
throw new Error('LAT_LLM_KEY_HELPER command returned an empty string.');
|
|
76
|
-
}
|
|
77
|
-
return result;
|
|
78
|
-
}
|
|
79
|
-
const config = readConfig();
|
|
80
|
-
if (config.llm_key)
|
|
81
|
-
return config.llm_key;
|
|
82
|
-
return undefined;
|
|
83
|
-
}
|
package/dist/src/context.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export type Styler = {
|
|
2
|
-
bold: (s: string) => string;
|
|
3
|
-
dim: (s: string) => string;
|
|
4
|
-
red: (s: string) => string;
|
|
5
|
-
cyan: (s: string) => string;
|
|
6
|
-
white: (s: string) => string;
|
|
7
|
-
green: (s: string) => string;
|
|
8
|
-
yellow: (s: string) => string;
|
|
9
|
-
boldWhite: (s: string) => string;
|
|
10
|
-
};
|
|
11
|
-
export declare const plainStyler: Styler;
|
|
12
|
-
export type CmdContext = {
|
|
13
|
-
latDir: string;
|
|
14
|
-
projectRoot: string;
|
|
15
|
-
styler: Styler;
|
|
16
|
-
mode: 'cli' | 'mcp';
|
|
17
|
-
/** The check target was supplied explicitly instead of discovered as lat.md. */
|
|
18
|
-
headless?: boolean;
|
|
19
|
-
};
|
|
20
|
-
export type CmdResult = {
|
|
21
|
-
output: string;
|
|
22
|
-
isError?: boolean;
|
|
23
|
-
};
|
package/dist/src/context.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* mdast-util extension to turn wiki-link micromark tokens into mdast nodes.
|
|
3
|
-
*/
|
|
4
|
-
function enterWikiLink(token) {
|
|
5
|
-
const node = {
|
|
6
|
-
type: 'wikiLink',
|
|
7
|
-
value: '',
|
|
8
|
-
data: { alias: null },
|
|
9
|
-
};
|
|
10
|
-
this.enter(node, token);
|
|
11
|
-
}
|
|
12
|
-
function exitWikiLinkTarget(token) {
|
|
13
|
-
const target = this.sliceSerialize(token);
|
|
14
|
-
const node = this.stack[this.stack.length - 1];
|
|
15
|
-
node.value = target;
|
|
16
|
-
}
|
|
17
|
-
function exitWikiLinkAlias(token) {
|
|
18
|
-
const alias = this.sliceSerialize(token);
|
|
19
|
-
const node = this.stack[this.stack.length - 1];
|
|
20
|
-
node.data.alias = alias;
|
|
21
|
-
}
|
|
22
|
-
function exitWikiLink(token) {
|
|
23
|
-
this.exit(token);
|
|
24
|
-
}
|
|
25
|
-
export function wikiLinkFromMarkdown() {
|
|
26
|
-
return {
|
|
27
|
-
enter: { wikiLink: enterWikiLink },
|
|
28
|
-
exit: {
|
|
29
|
-
wikiLinkTarget: exitWikiLinkTarget,
|
|
30
|
-
wikiLinkAlias: exitWikiLinkAlias,
|
|
31
|
-
wikiLink: exitWikiLink,
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Micromark syntax extension for wiki links: [[target]] and [[target|alias]].
|
|
3
|
-
*
|
|
4
|
-
* Produces the following token types:
|
|
5
|
-
* - wikiLink (the entire construct)
|
|
6
|
-
* - wikiLinkMarker ([[ and ]])
|
|
7
|
-
* - wikiLinkData (everything between markers)
|
|
8
|
-
* - wikiLinkTarget (the target portion)
|
|
9
|
-
* - wikiLinkAliasMarker (the | divider)
|
|
10
|
-
* - wikiLinkAlias (the alias portion)
|
|
11
|
-
*/
|
|
12
|
-
import type { Extension } from 'micromark-util-types';
|
|
13
|
-
import './types.js';
|
|
14
|
-
export declare function wikiLinkSyntax(): Extension;
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Micromark syntax extension for wiki links: [[target]] and [[target|alias]].
|
|
3
|
-
*
|
|
4
|
-
* Produces the following token types:
|
|
5
|
-
* - wikiLink (the entire construct)
|
|
6
|
-
* - wikiLinkMarker ([[ and ]])
|
|
7
|
-
* - wikiLinkData (everything between markers)
|
|
8
|
-
* - wikiLinkTarget (the target portion)
|
|
9
|
-
* - wikiLinkAliasMarker (the | divider)
|
|
10
|
-
* - wikiLinkAlias (the alias portion)
|
|
11
|
-
*/
|
|
12
|
-
import './types.js';
|
|
13
|
-
const ALIAS_DIVIDER = '|';
|
|
14
|
-
const OPEN = '[[';
|
|
15
|
-
const CLOSE = ']]';
|
|
16
|
-
function tokenize(effects, ok, nok) {
|
|
17
|
-
let openCursor = 0;
|
|
18
|
-
let closeCursor = 0;
|
|
19
|
-
let aliasCursor = 0;
|
|
20
|
-
let hasData = false;
|
|
21
|
-
let hasAlias = false;
|
|
22
|
-
return start;
|
|
23
|
-
function start(code) {
|
|
24
|
-
if (code !== OPEN.charCodeAt(openCursor))
|
|
25
|
-
return nok(code);
|
|
26
|
-
effects.enter('wikiLink');
|
|
27
|
-
effects.enter('wikiLinkMarker');
|
|
28
|
-
return consumeOpen(code);
|
|
29
|
-
}
|
|
30
|
-
function consumeOpen(code) {
|
|
31
|
-
if (openCursor === OPEN.length) {
|
|
32
|
-
effects.exit('wikiLinkMarker');
|
|
33
|
-
return consumeDataStart(code);
|
|
34
|
-
}
|
|
35
|
-
if (code !== OPEN.charCodeAt(openCursor))
|
|
36
|
-
return nok(code);
|
|
37
|
-
effects.consume(code);
|
|
38
|
-
openCursor++;
|
|
39
|
-
return consumeOpen;
|
|
40
|
-
}
|
|
41
|
-
function consumeDataStart(code) {
|
|
42
|
-
if (code === null || code < -2)
|
|
43
|
-
return nok(code);
|
|
44
|
-
effects.enter('wikiLinkData');
|
|
45
|
-
effects.enter('wikiLinkTarget');
|
|
46
|
-
return consumeTarget(code);
|
|
47
|
-
}
|
|
48
|
-
function consumeTarget(code) {
|
|
49
|
-
if (code === ALIAS_DIVIDER.charCodeAt(aliasCursor)) {
|
|
50
|
-
if (!hasData)
|
|
51
|
-
return nok(code);
|
|
52
|
-
effects.exit('wikiLinkTarget');
|
|
53
|
-
effects.enter('wikiLinkAliasMarker');
|
|
54
|
-
return consumeAliasMarker(code);
|
|
55
|
-
}
|
|
56
|
-
if (code === CLOSE.charCodeAt(closeCursor)) {
|
|
57
|
-
if (!hasData)
|
|
58
|
-
return nok(code);
|
|
59
|
-
effects.exit('wikiLinkTarget');
|
|
60
|
-
effects.exit('wikiLinkData');
|
|
61
|
-
effects.enter('wikiLinkMarker');
|
|
62
|
-
return consumeClose(code);
|
|
63
|
-
}
|
|
64
|
-
// No line endings or EOF inside wiki links
|
|
65
|
-
if (code === null || code < -2)
|
|
66
|
-
return nok(code);
|
|
67
|
-
if (code !== -2 && code !== -1 && code !== 32) {
|
|
68
|
-
hasData = true;
|
|
69
|
-
}
|
|
70
|
-
effects.consume(code);
|
|
71
|
-
return consumeTarget;
|
|
72
|
-
}
|
|
73
|
-
function consumeAliasMarker(code) {
|
|
74
|
-
if (aliasCursor === ALIAS_DIVIDER.length) {
|
|
75
|
-
effects.exit('wikiLinkAliasMarker');
|
|
76
|
-
effects.enter('wikiLinkAlias');
|
|
77
|
-
return consumeAlias(code);
|
|
78
|
-
}
|
|
79
|
-
if (code !== ALIAS_DIVIDER.charCodeAt(aliasCursor))
|
|
80
|
-
return nok(code);
|
|
81
|
-
effects.consume(code);
|
|
82
|
-
aliasCursor++;
|
|
83
|
-
return consumeAliasMarker;
|
|
84
|
-
}
|
|
85
|
-
function consumeAlias(code) {
|
|
86
|
-
if (code === CLOSE.charCodeAt(closeCursor)) {
|
|
87
|
-
if (!hasAlias)
|
|
88
|
-
return nok(code);
|
|
89
|
-
effects.exit('wikiLinkAlias');
|
|
90
|
-
effects.exit('wikiLinkData');
|
|
91
|
-
effects.enter('wikiLinkMarker');
|
|
92
|
-
return consumeClose(code);
|
|
93
|
-
}
|
|
94
|
-
if (code === null || code < -2)
|
|
95
|
-
return nok(code);
|
|
96
|
-
if (code !== -2 && code !== -1 && code !== 32) {
|
|
97
|
-
hasAlias = true;
|
|
98
|
-
}
|
|
99
|
-
effects.consume(code);
|
|
100
|
-
return consumeAlias;
|
|
101
|
-
}
|
|
102
|
-
function consumeClose(code) {
|
|
103
|
-
if (closeCursor === CLOSE.length) {
|
|
104
|
-
effects.exit('wikiLinkMarker');
|
|
105
|
-
effects.exit('wikiLink');
|
|
106
|
-
return ok(code);
|
|
107
|
-
}
|
|
108
|
-
if (code !== CLOSE.charCodeAt(closeCursor))
|
|
109
|
-
return nok(code);
|
|
110
|
-
effects.consume(code);
|
|
111
|
-
closeCursor++;
|
|
112
|
-
return consumeClose;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
export function wikiLinkSyntax() {
|
|
116
|
-
return {
|
|
117
|
-
text: {
|
|
118
|
-
91: { tokenize }, // '[' character code
|
|
119
|
-
},
|
|
120
|
-
};
|
|
121
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* mdast-util extension to serialize wiki-link nodes back to markdown.
|
|
3
|
-
*/
|
|
4
|
-
function handler(node, _parent, state, _info) {
|
|
5
|
-
const exit = state.enter('wikiLink');
|
|
6
|
-
const target = state.safe(node.value, { before: '[', after: ']' });
|
|
7
|
-
let value;
|
|
8
|
-
if (node.data.alias) {
|
|
9
|
-
const alias = state.safe(node.data.alias, { before: '[', after: ']' });
|
|
10
|
-
value = `[[${target}|${alias}]]`;
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
value = `[[${target}]]`;
|
|
14
|
-
}
|
|
15
|
-
exit();
|
|
16
|
-
return value;
|
|
17
|
-
}
|
|
18
|
-
export function wikiLinkToMarkdown() {
|
|
19
|
-
return {
|
|
20
|
-
unsafe: [
|
|
21
|
-
{ character: '[', inConstruct: ['phrasing', 'label', 'reference'] },
|
|
22
|
-
{ character: ']', inConstruct: ['label', 'reference'] },
|
|
23
|
-
],
|
|
24
|
-
handlers: {
|
|
25
|
-
wikiLink: handler,
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { Data, Literal } from 'mdast';
|
|
2
|
-
/**
|
|
3
|
-
* mdast node for a wiki-style link like [[target]] or [[target|alias]].
|
|
4
|
-
*/
|
|
5
|
-
export interface WikiLink extends Literal {
|
|
6
|
-
type: 'wikiLink';
|
|
7
|
-
value: string;
|
|
8
|
-
data: Data & {
|
|
9
|
-
alias: string | null;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
declare module 'mdast' {
|
|
13
|
-
interface RootContentMap {
|
|
14
|
-
wikiLink: WikiLink;
|
|
15
|
-
}
|
|
16
|
-
interface PhrasingContentMap {
|
|
17
|
-
wikiLink: WikiLink;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
declare module 'micromark-util-types' {
|
|
21
|
-
interface TokenTypeMap {
|
|
22
|
-
wikiLink: 'wikiLink';
|
|
23
|
-
wikiLinkMarker: 'wikiLinkMarker';
|
|
24
|
-
wikiLinkData: 'wikiLinkData';
|
|
25
|
-
wikiLinkTarget: 'wikiLinkTarget';
|
|
26
|
-
wikiLinkAliasMarker: 'wikiLinkAliasMarker';
|
|
27
|
-
wikiLinkAlias: 'wikiLinkAlias';
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
declare module 'mdast-util-to-markdown' {
|
|
31
|
-
interface ConstructNameMap {
|
|
32
|
-
wikiLink: 'wikiLink';
|
|
33
|
-
}
|
|
34
|
-
}
|