@plebeiantech/lat.md 0.12.3-fork.13 → 0.12.3-fork.15
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 +24 -0
- package/dist/src/cli/check-context.d.ts +56 -0
- package/dist/src/cli/check-context.js +215 -0
- package/dist/src/cli/check-coverage.js +9 -5
- package/dist/src/cli/check-frontmatter.js +1 -1
- package/dist/src/cli/check-mode.js +1 -1
- package/dist/src/cli/check-status.js +1 -1
- package/dist/src/cli/check.d.ts +19 -12
- package/dist/src/cli/check.js +259 -206
- package/dist/src/cli/context.js +1 -1
- package/dist/src/cli/expand.d.ts +1 -2
- package/dist/src/cli/expand.js +52 -5
- package/dist/src/cli/external.d.ts +11 -0
- package/dist/src/cli/external.js +185 -0
- package/dist/src/cli/fork-instructions.d.ts +1 -0
- package/dist/src/cli/fork-instructions.js +3 -2
- package/dist/src/cli/hook.d.ts +26 -0
- package/dist/src/cli/hook.js +112 -40
- package/dist/src/cli/index.js +55 -3
- package/dist/src/cli/init.d.ts +1 -0
- package/dist/src/cli/init.js +40 -2
- package/dist/src/cli/locate.js +4 -3
- package/dist/src/cli/refs.d.ts +2 -1
- package/dist/src/cli/refs.js +88 -43
- package/dist/src/cli/reindex.js +2 -1
- package/dist/src/cli/search.d.ts +12 -3
- package/dist/src/cli/search.js +45 -49
- package/dist/src/cli/section.d.ts +3 -1
- package/dist/src/cli/section.js +114 -38
- package/dist/src/code-refs.d.ts +17 -5
- package/dist/src/code-refs.js +246 -65
- package/dist/src/context.d.ts +3 -0
- package/dist/src/document-formats.d.ts +7 -0
- package/dist/src/document-formats.js +39 -0
- package/dist/src/extensions/alert-marker.d.ts +25 -0
- package/dist/src/extensions/alert-marker.js +55 -0
- package/dist/src/external-documents.d.ts +56 -0
- package/dist/src/external-documents.js +404 -0
- package/dist/src/external-sources.d.ts +136 -0
- package/dist/src/external-sources.js +1098 -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/frontmatter-fields.d.ts +36 -0
- package/dist/src/fork/frontmatter-fields.js +23 -0
- package/dist/src/format.d.ts +5 -2
- package/dist/src/format.js +8 -3
- package/dist/src/graph-export.js +1 -1
- package/dist/src/lattice-model.d.ts +77 -0
- package/dist/src/lattice-model.js +464 -0
- package/dist/src/lattice.d.ts +9 -104
- package/dist/src/lattice.js +69 -516
- package/dist/src/markdown-analysis-cache.d.ts +20 -0
- package/dist/src/markdown-analysis-cache.js +139 -0
- package/dist/src/markdown-analysis-worker.d.ts +16 -0
- package/dist/src/markdown-analysis-worker.js +33 -0
- package/dist/src/markdown-analysis.d.ts +50 -0
- package/dist/src/markdown-analysis.js +139 -0
- package/dist/src/markdown-analyzer-loader.d.ts +4 -0
- package/dist/src/markdown-analyzer-loader.js +13 -0
- package/dist/src/markdown-validation.d.ts +25 -0
- package/dist/src/markdown-validation.js +104 -0
- package/dist/src/mcp/server.js +27 -11
- package/dist/src/parser-cache.d.ts +17 -0
- package/dist/src/parser-cache.js +65 -0
- package/dist/src/parser-import.d.ts +8 -0
- package/dist/src/parser-import.js +1 -0
- package/dist/src/parser.js +80 -5
- package/dist/src/path.d.ts +2 -0
- package/dist/src/path.js +4 -0
- package/dist/src/profiler.d.ts +16 -0
- package/dist/src/profiler.js +81 -0
- package/dist/src/project-analysis.d.ts +59 -0
- package/dist/src/project-analysis.js +233 -0
- package/dist/src/project-discovery.d.ts +6 -0
- package/dist/src/project-discovery.js +30 -0
- package/dist/src/repository-path.d.ts +11 -0
- package/dist/src/repository-path.js +52 -0
- package/dist/src/search/db.d.ts +1 -1
- package/dist/src/search/db.js +2 -2
- package/dist/src/search/embedder.d.ts +2 -1
- package/dist/src/search/embedder.js +6 -5
- package/dist/src/search/index.d.ts +2 -1
- package/dist/src/search/index.js +10 -8
- package/dist/src/search/query.d.ts +20 -0
- package/dist/src/search/query.js +67 -0
- package/dist/src/search/search.d.ts +3 -1
- package/dist/src/search/search.js +5 -2
- package/dist/src/source-formats.d.ts +7 -0
- package/dist/src/source-formats.js +26 -0
- package/dist/src/source-parser.d.ts +44 -4
- package/dist/src/source-parser.js +494 -57
- 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-B7quqPb8.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/abnfDiagram-VCTEODGH-V7-T6qsl.js +1 -0
- package/dist/src/view/client/assets/arc-BnwR8Bu7.js +1 -0
- package/dist/src/view/client/assets/architectureDiagram-5GKGNRK7-u97vDna9.js +36 -0
- package/dist/src/view/client/assets/blockDiagram-I7D4REHJ-DETl8e_H.js +129 -0
- package/dist/src/view/client/assets/c4Diagram-7LVT6UL2-DJRAT1Ve.js +38 -0
- package/dist/src/view/client/assets/channel-BwQbnWCN.js +1 -0
- package/dist/src/view/client/assets/chunk-2Q5K7J3B-C0TmOC1Q.js +1 -0
- package/dist/src/view/client/assets/chunk-5VM5RSS4-dfBOrYE6.js +15 -0
- package/dist/src/view/client/assets/chunk-F27PBJKO-DAnks99K.js +1 -0
- package/dist/src/view/client/assets/chunk-IMKFNOWR-CPjB07if.js +231 -0
- package/dist/src/view/client/assets/chunk-JWPE2WC7-VvU_gZI6.js +1 -0
- package/dist/src/view/client/assets/chunk-POPQ4Y6H-DDUbVF55.js +1 -0
- package/dist/src/view/client/assets/chunk-SVP7TREG-BHROkr6D.js +88 -0
- package/dist/src/view/client/assets/chunk-TICWLB2K-95PzGIOg.js +206 -0
- package/dist/src/view/client/assets/chunk-XXDRQBXY-MdmuLhIs.js +1 -0
- package/dist/src/view/client/assets/classDiagram-ZZMXUADV-HvQKkIS-.js +1 -0
- package/dist/src/view/client/assets/classDiagram-v2-VYDZK3BY-HvQKkIS-.js +1 -0
- package/dist/src/view/client/assets/cose-bilkent-JH36ORCC-CauUf_rN.js +1 -0
- package/dist/src/view/client/assets/cynefin-OW5HDTMX-CeA8IKWo.js +166 -0
- package/dist/src/view/client/assets/cynefinDiagram-5FMLGOSQ-L1rtcT8l.js +62 -0
- package/dist/src/view/client/assets/cytoscape.esm-DzSz-X2X.js +321 -0
- package/dist/src/view/client/assets/dagre-GXQ25YYZ-DLQwTa3H.js +4 -0
- package/dist/src/view/client/assets/defaultLocale-DX6XiGOO.js +1 -0
- package/dist/src/view/client/assets/diagram-S7CK7UJ4-kbKdIyXG.js +30 -0
- package/dist/src/view/client/assets/diagram-UQ7AKVKN-kmzp92RC.js +41 -0
- package/dist/src/view/client/assets/diagram-VSXAHHWV-EXJTU8qq.js +3 -0
- package/dist/src/view/client/assets/diagram-VX7I27RA-DAiIyMCG.js +24 -0
- package/dist/src/view/client/assets/diagram-Z3DM3KII-G9wz50ZV.js +24 -0
- package/dist/src/view/client/assets/ebnfDiagram-PWID7BFC-D2tVRCNA.js +1 -0
- package/dist/src/view/client/assets/erDiagram-RLTQ6QDP-C925J5A3.js +99 -0
- package/dist/src/view/client/assets/flowDiagram-HODETNUW-DzoCa-Nq.js +168 -0
- package/dist/src/view/client/assets/ganttDiagram-EL5Y4UJY-D2ebbg4p.js +292 -0
- package/dist/src/view/client/assets/gitGraphDiagram-WWUBYQGX-B4QratYy.js +106 -0
- package/dist/src/view/client/assets/index-BnENo9bV.js +1 -0
- package/dist/src/view/client/assets/index-D0ajr_Ja.css +1 -0
- package/dist/src/view/client/assets/index-KZcnpXJH.js +321 -0
- package/dist/src/view/client/assets/infoDiagram-27XIBGKW-DL4mtHkt.js +2 -0
- package/dist/src/view/client/assets/init-Gi6I4Gst.js +1 -0
- package/dist/src/view/client/assets/ishikawaDiagram-5VMMS53U-CW4mto2d.js +70 -0
- package/dist/src/view/client/assets/journeyDiagram-3NMN7TZE-8R4eacFW.js +139 -0
- package/dist/src/view/client/assets/kanban-definition-UXKFOSKX-Cy9ioXEJ.js +89 -0
- package/dist/src/view/client/assets/katex-HP8lGamR.js +257 -0
- package/dist/src/view/client/assets/layout-C0MFuhth.js +1 -0
- package/dist/src/view/client/assets/linear-Dv3N4dQR.js +1 -0
- package/dist/src/view/client/assets/logo-small-RR_KBOAT.svg +149 -0
- package/dist/src/view/client/assets/maplibre-gl-DnqZgfUS.js +800 -0
- package/dist/src/view/client/assets/mermaid.core-bds9A7e2.js +310 -0
- package/dist/src/view/client/assets/mindmap-definition-YA3MSWOX-DjmGW355.js +96 -0
- package/dist/src/view/client/assets/ordinal-Cboi1Yqb.js +1 -0
- package/dist/src/view/client/assets/pegDiagram-XKGWAZYB-BWsZp0ab.js +1 -0
- package/dist/src/view/client/assets/pieDiagram-E7YTZNPT-CCH2gGR-.js +39 -0
- package/dist/src/view/client/assets/quadrantDiagram-AXDQQJYC-CjocPJFz.js +7 -0
- package/dist/src/view/client/assets/railroadDiagram-O6MQD6OU-BjLeb2KF.js +1 -0
- package/dist/src/view/client/assets/requirementDiagram-BXWQKSXE-Ct6AoXRr.js +84 -0
- package/dist/src/view/client/assets/sankeyDiagram-P5KCCOFB-CIpgGN_w.js +40 -0
- package/dist/src/view/client/assets/sequenceDiagram-WJ2MYXX4-DrmLFj6w.js +162 -0
- package/dist/src/view/client/assets/sizeCapture-INFHLROL-BdFMe2Lr.js +1 -0
- package/dist/src/view/client/assets/stateDiagram-D77RDMKH-Zd9F1goW.js +1 -0
- package/dist/src/view/client/assets/stateDiagram-v2-MP3YSRHH-ByIKCftl.js +1 -0
- package/dist/src/view/client/assets/swimlanes-42K2YHIH-a7VFwi00.js +1 -0
- package/dist/src/view/client/assets/swimlanesDiagram-VR7AAH4N-CzxaUHB-.js +8 -0
- package/dist/src/view/client/assets/three.module-PDSP0dbZ.js +4108 -0
- package/dist/src/view/client/assets/timeline-definition-24CTP7MA-BExPu6X5.js +120 -0
- package/dist/src/view/client/assets/vennDiagram-4TSXK5OY-PC1MU3si.js +34 -0
- package/dist/src/view/client/assets/wardleyDiagram-VM6X3IG4-DNWqU3fa.js +78 -0
- package/dist/src/view/client/assets/xychartDiagram-S5SC5T6Z-E1uA28_D.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 +12 -0
- package/dist/src/view/document-route.js +93 -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 +187 -0
- package/dist/src/view/git.js +1 -1
- package/dist/src/view/graph.d.ts +3 -2
- package/dist/src/view/graph.js +94 -7
- package/dist/src/view/highlight.d.ts +10 -2
- package/dist/src/view/highlight.js +4540 -1360
- package/dist/src/view/markdown.d.ts +3 -2
- package/dist/src/view/markdown.js +214 -53
- package/dist/src/view/protocol.d.ts +59 -6
- package/dist/src/view/references.d.ts +10 -25
- package/dist/src/view/references.js +117 -107
- package/dist/src/view/repository.d.ts +13 -3
- package/dist/src/view/repository.js +234 -15
- package/dist/src/view/search.d.ts +1 -1
- package/dist/src/view/search.js +3 -7
- package/dist/src/view/server.d.ts +11 -2
- package/dist/src/view/server.js +212 -70
- package/dist/src/view/source-target.js +5 -8
- package/dist/src/view/static-build.d.ts +1 -0
- package/dist/src/view/static-build.js +245 -42
- package/dist/src/view/static-protocol.d.ts +19 -2
- package/dist/src/view/store.d.ts +16 -3
- package/dist/src/view/store.js +228 -36
- package/dist/src/view/table-of-contents.d.ts +2 -2
- package/dist/src/view/table-of-contents.js +2 -22
- package/dist/src/walk.d.ts +5 -3
- package/dist/src/walk.js +102 -8
- 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 +52 -12
- 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 +15 -3
- package/templates/cursor-rules.md +12 -3
- package/templates/skill/SKILL.md +22 -1
- 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
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type IncomingMessage, type RequestListener, type Server, type ServerResponse } from 'node:http';
|
|
2
|
+
import { type Express } from 'express';
|
|
3
|
+
export declare const LAT_UI_CONTENT_SECURITY_POLICY = "default-src 'self'; connect-src 'self' https://tiles.openfreemap.org; font-src 'self' data:; img-src 'self' data: https://github.githubassets.com; style-src 'self' 'unsafe-inline'; worker-src 'self' blob:; object-src 'none'; base-uri 'none'; frame-ancestors 'none'";
|
|
4
|
+
export type LatServerAppOptions = {
|
|
5
|
+
/** Handle dynamic routes before immutable files and fallback handlers. */
|
|
6
|
+
handle?: LatServerRequestHandler;
|
|
7
|
+
/** Serve a completed Lat UI export after dynamic routes. */
|
|
8
|
+
publicDir?: string;
|
|
9
|
+
};
|
|
10
|
+
export type LatServerApp = RequestListener;
|
|
11
|
+
export type LatServerRequestHandler = (req: IncomingMessage, res: ServerResponse, next: (error?: unknown) => void) => void | Promise<void>;
|
|
12
|
+
export type ListenLatServerOptions = {
|
|
13
|
+
host: string;
|
|
14
|
+
port: number;
|
|
15
|
+
/** Advance through occupied ports. Explicit user ports should leave this off. */
|
|
16
|
+
findAvailablePort?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type RunningLatServer = {
|
|
19
|
+
server: Server;
|
|
20
|
+
host: string;
|
|
21
|
+
port: number;
|
|
22
|
+
url: string;
|
|
23
|
+
close: () => Promise<void>;
|
|
24
|
+
};
|
|
25
|
+
/** Create the common Express stack used by live and exported Lat UI servers. */
|
|
26
|
+
export declare function createLatServerApp(options?: LatServerAppOptions, app?: Express): LatServerApp;
|
|
27
|
+
/** Listen with the same strict-or-next-port behavior in every Lat UI host. */
|
|
28
|
+
export declare function listenLatServer(app: LatServerApp, options: ListenLatServerOptions): Promise<RunningLatServer>;
|
|
29
|
+
export type RunLatServerOptions = {
|
|
30
|
+
host?: string;
|
|
31
|
+
port?: number;
|
|
32
|
+
close?: () => void | Promise<void>;
|
|
33
|
+
log?: (message: string) => void;
|
|
34
|
+
};
|
|
35
|
+
/** Run an exported Express app until the standalone process is terminated. */
|
|
36
|
+
export declare function runLatServer(app: LatServerApp, options?: RunLatServerOptions): Promise<RunningLatServer>;
|
|
37
|
+
/** Read this published package's exact version for generated artifacts. */
|
|
38
|
+
export declare function getLatServerVersion(): string;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { createServer, } from 'node:http';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import express from 'express';
|
|
4
|
+
export const LAT_UI_CONTENT_SECURITY_POLICY = "default-src 'self'; connect-src 'self' https://tiles.openfreemap.org; font-src 'self' data:; img-src 'self' data: https://github.githubassets.com; style-src 'self' 'unsafe-inline'; worker-src 'self' blob:; object-src 'none'; base-uri 'none'; frame-ancestors 'none'";
|
|
5
|
+
function setSecurityHeaders(res) {
|
|
6
|
+
res.setHeader('Content-Security-Policy', LAT_UI_CONTENT_SECURITY_POLICY);
|
|
7
|
+
res.setHeader('Referrer-Policy', 'no-referrer');
|
|
8
|
+
res.setHeader('X-Content-Type-Options', 'nosniff');
|
|
9
|
+
}
|
|
10
|
+
function isImmutablePublicFile(path) {
|
|
11
|
+
const parts = path.split(/[/\\]/);
|
|
12
|
+
if (parts.includes('assets'))
|
|
13
|
+
return true;
|
|
14
|
+
return /[/\\]data[/\\][^/\\]+[/\\][a-f0-9]{20}\.json$/.test(path);
|
|
15
|
+
}
|
|
16
|
+
/** Create the common Express stack used by live and exported Lat UI servers. */
|
|
17
|
+
export function createLatServerApp(options = {}, app = express()) {
|
|
18
|
+
app.disable('x-powered-by');
|
|
19
|
+
app.use((_req, res, next) => {
|
|
20
|
+
setSecurityHeaders(res);
|
|
21
|
+
next();
|
|
22
|
+
});
|
|
23
|
+
if (options.handle) {
|
|
24
|
+
app.use((req, res, next) => {
|
|
25
|
+
try {
|
|
26
|
+
void Promise.resolve(options.handle(req, res, next)).catch(next);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
next(error);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
if (options.publicDir) {
|
|
34
|
+
app.use(express.static(options.publicDir, {
|
|
35
|
+
setHeaders(res, path) {
|
|
36
|
+
res.setHeader('Cache-Control', isImmutablePublicFile(path)
|
|
37
|
+
? 'public, max-age=31536000, immutable'
|
|
38
|
+
: 'no-cache');
|
|
39
|
+
},
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
app.use((_req, res) => {
|
|
43
|
+
res.status(404).type('text/plain').send('Not found');
|
|
44
|
+
});
|
|
45
|
+
app.use((error, _req, res, _next) => {
|
|
46
|
+
console.error(error);
|
|
47
|
+
res.status(500).json({ error: 'Internal server error' });
|
|
48
|
+
});
|
|
49
|
+
return app;
|
|
50
|
+
}
|
|
51
|
+
function listen(server, host, port) {
|
|
52
|
+
return new Promise((resolveListen, reject) => {
|
|
53
|
+
const onError = (error) => {
|
|
54
|
+
server.off('listening', onListening);
|
|
55
|
+
reject(error);
|
|
56
|
+
};
|
|
57
|
+
const onListening = () => {
|
|
58
|
+
server.off('error', onError);
|
|
59
|
+
resolveListen();
|
|
60
|
+
};
|
|
61
|
+
server.once('error', onError);
|
|
62
|
+
server.once('listening', onListening);
|
|
63
|
+
server.listen(port, host);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function closeServer(server) {
|
|
67
|
+
return new Promise((resolveClose, reject) => {
|
|
68
|
+
server.close((error) => (error ? reject(error) : resolveClose()));
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/** Listen with the same strict-or-next-port behavior in every Lat UI host. */
|
|
72
|
+
export async function listenLatServer(app, options) {
|
|
73
|
+
const server = createServer(app);
|
|
74
|
+
let port = options.port;
|
|
75
|
+
while (true) {
|
|
76
|
+
try {
|
|
77
|
+
await listen(server, options.host, port);
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
if (!options.findAvailablePort ||
|
|
82
|
+
error.code !== 'EADDRINUSE' ||
|
|
83
|
+
port === 65_535) {
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
port++;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const address = server.address();
|
|
90
|
+
if (!address) {
|
|
91
|
+
await closeServer(server);
|
|
92
|
+
throw new Error('Could not determine Lat UI server address');
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
server,
|
|
96
|
+
host: options.host,
|
|
97
|
+
port: address.port,
|
|
98
|
+
url: `http://${options.host}:${address.port}/`,
|
|
99
|
+
close: () => closeServer(server),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/** Run an exported Express app until the standalone process is terminated. */
|
|
103
|
+
export async function runLatServer(app, options = {}) {
|
|
104
|
+
const host = options.host ?? process.env.HOST ?? '0.0.0.0';
|
|
105
|
+
const rawPort = options.port ?? Number(process.env.PORT ?? 3000);
|
|
106
|
+
if (!Number.isInteger(rawPort) || rawPort < 1 || rawPort > 65_535) {
|
|
107
|
+
throw new Error('PORT must be an integer from 1 to 65535');
|
|
108
|
+
}
|
|
109
|
+
const running = await listenLatServer(app, { host, port: rawPort });
|
|
110
|
+
(options.log ?? console.log)(`Lat UI listening on ${running.url}`);
|
|
111
|
+
let closing = false;
|
|
112
|
+
const shutdown = () => {
|
|
113
|
+
if (closing)
|
|
114
|
+
return;
|
|
115
|
+
closing = true;
|
|
116
|
+
void Promise.all([running.close(), options.close?.()]).catch((error) => {
|
|
117
|
+
console.error(error);
|
|
118
|
+
process.exitCode = 1;
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
process.once('SIGINT', shutdown);
|
|
122
|
+
process.once('SIGTERM', shutdown);
|
|
123
|
+
return running;
|
|
124
|
+
}
|
|
125
|
+
/** Read this published package's exact version for generated artifacts. */
|
|
126
|
+
export function getLatServerVersion() {
|
|
127
|
+
return JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version;
|
|
128
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plebeiantech/lat.md",
|
|
3
|
-
"version": "0.12.3-fork.
|
|
3
|
+
"version": "0.12.3-fork.15",
|
|
4
4
|
"description": "A knowledge graph for your codebase, written in markdown",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,64 +24,104 @@
|
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
"dist/src",
|
|
27
|
-
"
|
|
27
|
+
"dist/vendor",
|
|
28
|
+
"templates",
|
|
29
|
+
"plugins"
|
|
28
30
|
],
|
|
29
31
|
"devDependencies": {
|
|
32
|
+
"@codemirror/commands": "^6.11.0",
|
|
33
|
+
"@codemirror/lang-markdown": "^6.5.2",
|
|
34
|
+
"@codemirror/language": "^6.12.4",
|
|
35
|
+
"@codemirror/merge": "^6.12.2",
|
|
36
|
+
"@codemirror/state": "^6.7.1",
|
|
37
|
+
"@codemirror/view": "^6.43.9",
|
|
38
|
+
"@lezer/highlight": "^1.2.3",
|
|
39
|
+
"@types/geojson": "^7946.0.16",
|
|
40
|
+
"@types/express": "^5.0.6",
|
|
41
|
+
"@types/hast": "^3.0.5",
|
|
30
42
|
"@types/mdast": "^4.0.4",
|
|
31
43
|
"@types/node": "^25.3.0",
|
|
32
44
|
"@types/react": "^19.0.0",
|
|
33
45
|
"@types/react-dom": "^19.0.0",
|
|
46
|
+
"@types/three": "^0.185.4",
|
|
47
|
+
"@types/topojson-client": "^3.1.5",
|
|
34
48
|
"@vitejs/plugin-react": "^5.0.0",
|
|
35
49
|
"graphology": "^0.26.0",
|
|
36
50
|
"highlight.js": "^11.12.0",
|
|
51
|
+
"jsdom": "^30.0.1",
|
|
52
|
+
"katex": "^0.18.4",
|
|
53
|
+
"lowlight": "^3.3.0",
|
|
54
|
+
"maplibre-gl": "^5.24.0",
|
|
37
55
|
"mdast-util-from-markdown": "^2.0.3",
|
|
56
|
+
"mermaid": "^11.17.2",
|
|
38
57
|
"micromark-util-types": "^2.0.2",
|
|
39
58
|
"prettier": "^3.8.1",
|
|
40
59
|
"react": "^19.0.0",
|
|
41
60
|
"react-dom": "^19.0.0",
|
|
61
|
+
"rehype-stringify": "^10.0.1",
|
|
42
62
|
"sigma": "^3.0.3",
|
|
63
|
+
"three": "^0.185.1",
|
|
64
|
+
"topojson-client": "^3.1.0",
|
|
43
65
|
"tsx": "^4.21.0",
|
|
44
66
|
"typescript": "^5.7.0",
|
|
45
67
|
"vite": "^7.0.0",
|
|
46
|
-
"vitest": "^3.0.0"
|
|
68
|
+
"vitest": "^3.0.0",
|
|
69
|
+
"@lat.md/server": "0.1.0"
|
|
47
70
|
},
|
|
48
71
|
"dependencies": {
|
|
72
|
+
"@asciidoctor/core": "4.0.6",
|
|
49
73
|
"@folder/xdg": "^4.0.1",
|
|
50
74
|
"@libsql/client": "^0.17.0",
|
|
51
75
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
52
|
-
"@repomix/tree-sitter-wasms": "^0.1.
|
|
76
|
+
"@repomix/tree-sitter-wasms": "^0.1.17",
|
|
53
77
|
"commander": "^14.0.3",
|
|
78
|
+
"diff": "^8.0.4",
|
|
79
|
+
"express": "^5.2.1",
|
|
54
80
|
"github-slugger": "^2.0.0",
|
|
55
81
|
"ignore-walk": "^8.0.0",
|
|
82
|
+
"mdast-util-gfm-autolink-literal": "^2.0.1",
|
|
83
|
+
"mdast-util-gfm-footnote": "^2.1.0",
|
|
84
|
+
"mdast-util-gfm-strikethrough": "^2.0.0",
|
|
85
|
+
"mdast-util-gfm-table": "^2.0.0",
|
|
86
|
+
"mdast-util-gfm-task-list-item": "^2.0.0",
|
|
56
87
|
"mdast-util-to-markdown": "^2.1.0",
|
|
88
|
+
"micromark-extension-gfm-autolink-literal": "^2.1.0",
|
|
89
|
+
"micromark-extension-gfm-footnote": "^2.1.0",
|
|
90
|
+
"micromark-extension-gfm-strikethrough": "^2.1.0",
|
|
91
|
+
"micromark-extension-gfm-table": "^2.1.1",
|
|
92
|
+
"micromark-extension-gfm-task-list-item": "^2.1.0",
|
|
93
|
+
"rehype-katex": "^7.0.1",
|
|
94
|
+
"rehype-raw": "^7.0.0",
|
|
57
95
|
"rehype-sanitize": "^6.0.0",
|
|
58
96
|
"rehype-slug": "^6.0.0",
|
|
59
|
-
"
|
|
97
|
+
"remark-emoji": "^5.0.2",
|
|
60
98
|
"remark-frontmatter": "^5.0.0",
|
|
99
|
+
"remark-math": "^6.0.0",
|
|
61
100
|
"remark-parse": "^11.0.0",
|
|
62
101
|
"remark-rehype": "^11.1.2",
|
|
63
102
|
"remark-stringify": "^11.0.0",
|
|
103
|
+
"rst-compiler": "0.5.9",
|
|
64
104
|
"unified": "^11.0.0",
|
|
65
105
|
"unist-util-visit": "^5.0.0",
|
|
66
106
|
"web-tree-sitter": "^0.26.6",
|
|
67
107
|
"yaml": "^2.8.2",
|
|
68
108
|
"zod": "^4.3.6",
|
|
69
|
-
"@lat.md/embed": "0.
|
|
70
|
-
"@lat.md/embed
|
|
109
|
+
"@lat.md/embed-minilm-fp16": "0.1.0",
|
|
110
|
+
"@lat.md/embed": "0.2.0"
|
|
71
111
|
},
|
|
72
112
|
"scripts": {
|
|
73
|
-
"build": "tsc && pnpm build:view",
|
|
113
|
+
"build": "tsc && tsx scripts/fork-vendor-ui-server.ts && pnpm build:view",
|
|
74
114
|
"build:view": "vite build --config view/vite.config.ts && vite build --config view/highlight.vite.config.ts",
|
|
75
115
|
"buildall": "pnpm build:packages && pnpm build",
|
|
76
116
|
"setup:rust": "pnpm --filter @lat.md/embed setup:rust",
|
|
77
117
|
"build:wasm": "pnpm --filter @lat.md/embed build:wasm",
|
|
78
118
|
"build:weights": "pnpm --filter @lat.md/embed-minilm-fp16 build:weights",
|
|
79
|
-
"build:packages": "pnpm --filter @lat.md/embed build && pnpm --filter @lat.md/embed-minilm-fp16 build",
|
|
119
|
+
"build:packages": "pnpm --filter @lat.md/server build && pnpm --filter @lat.md/embed build && pnpm --filter @lat.md/embed-minilm-fp16 build",
|
|
80
120
|
"test": "vitest run",
|
|
81
121
|
"test:watch": "vitest",
|
|
82
|
-
"typecheck": "tsc --noEmit && tsc --noEmit -p view/tsconfig.json",
|
|
83
|
-
"format": "prettier --write \"src/**/*.ts\" \"view/**/*.{ts,tsx,css,html}\"",
|
|
84
|
-
"format:check": "prettier --check \"src/**/*.ts\" \"view/**/*.{ts,tsx,css,html}\"",
|
|
122
|
+
"typecheck": "pnpm --filter @lat.md/server build && tsc --noEmit && tsc --noEmit -p view/tsconfig.json",
|
|
123
|
+
"format": "prettier --write \"src/**/*.ts\" \"packages/server/src/**/*.ts\" \"view/**/*.{ts,tsx,css,html}\"",
|
|
124
|
+
"format:check": "prettier --check \"src/**/*.ts\" \"packages/server/src/**/*.ts\" \"view/**/*.{ts,tsx,css,html}\"",
|
|
85
125
|
"cook-test-rag": "tsx scripts/cook-test-rag.ts"
|
|
86
126
|
}
|
|
87
127
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Antigravity & Gemini CLI Plugin for lat.md
|
|
2
|
+
|
|
3
|
+
This plugin integrates [lat.md](https://github.com/PlebeianTech/lat.md) with Google Antigravity and Gemini CLI. It grounds the agent in your codebase knowledge graph, prevents multi-line rationale comments in source code, maintains directory indexes, and blocks finishing work on check failures.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **PreInvocation Hook**: Automatically expands wiki links (`[[section]]`) in user prompts, retrieves relevant sections using semantic search, and reminds the agent to maintain the knowledge graph.
|
|
8
|
+
- **PreToolUse Hook**: Intercepts file edits (`replace_file_content` and `write_to_file`) and blocks multi-line rationale comments, prompting the agent to document the reasoning in `lat.md/` with a `@lat:` pointer instead.
|
|
9
|
+
- **PostToolUse Hook**: Runs index synchronization after file modifications.
|
|
10
|
+
- **Stop Hook**: Enforces `lat check` (including Diátaxis mode validation) before the agent completes its work, refusing stop if errors remain.
|
|
11
|
+
- **Bundled Skills**: Provides `lat-md` (syntax & structure authoring guide) and `lat-md-conventions` (fork conventions & rules).
|
|
12
|
+
- **Rules**: Injects core `lat.md` workflow directives via `rules/AGENTS.md`.
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
### Option 1: Via `lat init` (Zero Clone, Recommended)
|
|
17
|
+
|
|
18
|
+
You do not need to clone the repository to use lat.md with Antigravity. Install the CLI and initialize your repository directly:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install -g @plebeiantech/lat.md
|
|
22
|
+
# or: mise use -g npm:@plebeiantech/lat.md@latest
|
|
23
|
+
|
|
24
|
+
lat init
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Select **Antigravity / Gemini** from the agent checklist menu. This automatically writes `.agents/hooks.json`, `GEMINI.md`, and `.agents/skills/`.
|
|
28
|
+
|
|
29
|
+
### Option 2: Global User Plugin (Without Cloning)
|
|
30
|
+
|
|
31
|
+
To install the plugin bundle globally across all repositories without cloning:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
mkdir -p ~/.gemini/config/plugins/lat-md && \
|
|
35
|
+
curl -sL https://github.com/PlebeianTech/lat.md/archive/refs/heads/main.tar.gz | \
|
|
36
|
+
tar -xz -C ~/.gemini/config/plugins/lat-md --strip-components=2 lat.md-main/plugins/lat-md
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Option 3: Workspace Plugin (Without Cloning)
|
|
40
|
+
|
|
41
|
+
To install the plugin bundle into a specific repository without cloning:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
mkdir -p .agents/plugins/lat-md && \
|
|
45
|
+
curl -sL https://github.com/PlebeianTech/lat.md/archive/refs/heads/main.tar.gz | \
|
|
46
|
+
tar -xz -C .agents/plugins/lat-md --strip-components=2 lat.md-main/plugins/lat-md
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Requirements
|
|
50
|
+
|
|
51
|
+
The plugin requires the `@plebeiantech/lat.md` CLI on your `PATH`:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm install -g @plebeiantech/lat.md
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Or using [mise](https://mise.jdx.dev/):
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
mise use -g npm:@plebeiantech/lat.md@latest
|
|
61
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lat-md": {
|
|
3
|
+
"PreInvocation": [
|
|
4
|
+
{
|
|
5
|
+
"type": "command",
|
|
6
|
+
"command": "lat hook antigravity PreInvocation"
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
"PreToolUse": [
|
|
10
|
+
{
|
|
11
|
+
"matcher": "replace_file_content|write_to_file",
|
|
12
|
+
"hooks": [
|
|
13
|
+
{
|
|
14
|
+
"type": "command",
|
|
15
|
+
"command": "lat hook antigravity PreToolUse"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"PostToolUse": [
|
|
21
|
+
{
|
|
22
|
+
"matcher": "replace_file_content|write_to_file",
|
|
23
|
+
"hooks": [
|
|
24
|
+
{
|
|
25
|
+
"type": "command",
|
|
26
|
+
"command": "lat hook antigravity PostToolUse"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"Stop": [
|
|
32
|
+
{
|
|
33
|
+
"type": "command",
|
|
34
|
+
"command": "lat hook antigravity Stop"
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lat-md",
|
|
3
|
+
"version": "0.12.3",
|
|
4
|
+
"description": "Grounds an agent in a project's lat.md/ knowledge graph deterministically: resolves [[refs]] and federates knowledge into prompts, blocks multi-line rationale comments before they reach source, regenerates directory indexes after edits, and blocks Stop on a failing lat check — including Diataxis mode validation.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "PlebeianTech"
|
|
7
|
+
},
|
|
8
|
+
"keywords": ["documentation", "diataxis", "lat.md", "knowledge-graph"]
|
|
9
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Before starting work
|
|
2
|
+
|
|
3
|
+
- Run `lat search` to find sections relevant to your task. Read them to understand the design intent before writing code.
|
|
4
|
+
- Run `lat expand` on user prompts to expand any `[[refs]]` — this resolves section names to file locations and provides context.
|
|
5
|
+
|
|
6
|
+
# Post-task checklist (REQUIRED — do not skip)
|
|
7
|
+
|
|
8
|
+
After EVERY task, before responding to the user:
|
|
9
|
+
|
|
10
|
+
- [ ] Update `lat.md/` if you added or changed meaningful functionality, architecture, tests, behavior, or planned work. Keep it a focused snapshot of current/planned state, not a journal/changelog.
|
|
11
|
+
- [ ] Run `lat check` — all validations must pass
|
|
12
|
+
- [ ] Do not skip these steps. Do not consider your task done until both are complete.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# What is lat.md?
|
|
17
|
+
|
|
18
|
+
This project uses [lat.md](https://www.npmjs.com/package/lat.md) to maintain a structured knowledge graph of its architecture, design decisions, and test specs in the `lat.md/` directory. It is a set of cross-linked markdown files that describe **what** this project does and **why** — the domain concepts, key design decisions, business logic, and test specifications. Use it to ground your work in the actual architecture rather than guessing. Do not treat `lat.md/` as a journal or changelog; it should be a focused snapshot of current or planned state, and should not grow just to note insignificant details.
|
|
19
|
+
|
|
20
|
+
# Commands
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
lat locate "Section Name" # find a section by name (exact, fuzzy)
|
|
24
|
+
lat refs "file#Section" # find what references a section
|
|
25
|
+
lat search "natural language" # semantic search across all sections
|
|
26
|
+
lat expand "user prompt text" # expand [[refs]] to resolved locations
|
|
27
|
+
lat check # run full graph and documentation validation
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Run `lat --help` when in doubt about available commands or options.
|
|
31
|
+
|
|
32
|
+
If `lat search` fails because no API key is configured, explain to the user that semantic search requires a key provided via `LAT_LLM_KEY` (direct value), `LAT_LLM_KEY_FILE` (path to key file), or `LAT_LLM_KEY_HELPER` (command that prints the key). Supported key prefixes: `sk-...` (OpenAI) or `vck_...` (Vercel). If the user doesn't want to set it up, use `lat locate` for direct lookups instead.
|
|
33
|
+
|
|
34
|
+
# Syntax primer
|
|
35
|
+
|
|
36
|
+
- **Section ids**: `lat.md/path/to/file#Heading#SubHeading` — full form uses project-root-relative path (e.g. `lat.md/tests/search#RAG Replay Tests`). Short form uses bare file name when unique (e.g. `search#RAG Replay Tests`, `cli#search#Indexing`).
|
|
37
|
+
- **Wiki links**: `[[target]]` or `[[target|alias]]` — cross-references between sections. Can also reference source code: `[[src/foo.ts#myFunction]]`.
|
|
38
|
+
- **Source code links**: Wiki links in `lat.md/` files can reference functions, classes, constants, and methods in TypeScript/JavaScript/Python/Rust/Go/C files. Use the full path: `[[src/config.ts#getConfigDir]]`, `[[src/server.ts#App#listen]]` (class method), `[[lib/utils.py#parse_args]]`, `[[src/lib.rs#Greeter#greet]]` (Rust impl method), `[[src/app.go#Greeter#Greet]]` (Go method), `[[src/app.h#Greeter]]` (C struct). `lat check` validates these exist.
|
|
39
|
+
- **Code refs**: `// @lat: [[section-id]]` (JS/TS/Rust/Go/C) or `# @lat: [[section-id]]` (Python) — ties source code to concepts
|
|
40
|
+
|
|
41
|
+
# Test specs
|
|
42
|
+
|
|
43
|
+
Key tests can be described as sections in `lat.md/` files (e.g. `tests.md`). Add frontmatter to require that every leaf section is referenced by a `// @lat:` or `# @lat:` comment in test code:
|
|
44
|
+
|
|
45
|
+
```markdown
|
|
46
|
+
---
|
|
47
|
+
lat:
|
|
48
|
+
require-code-mention: true
|
|
49
|
+
---
|
|
50
|
+
# Tests
|
|
51
|
+
|
|
52
|
+
Authentication and authorization test specifications.
|
|
53
|
+
|
|
54
|
+
## User login
|
|
55
|
+
|
|
56
|
+
Verify credential validation and error handling for the login endpoint.
|
|
57
|
+
|
|
58
|
+
### Rejects expired tokens
|
|
59
|
+
Tokens past their expiry timestamp are rejected with 401, even if otherwise valid.
|
|
60
|
+
|
|
61
|
+
### Handles missing password
|
|
62
|
+
Login request without a password field returns 400 with a descriptive error.
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Every section MUST have a description — at least one sentence explaining what the test verifies and why. Empty sections with just a heading are not acceptable. (This is a specific case of the general leading paragraph rule below.)
|
|
66
|
+
|
|
67
|
+
Each test in code should reference its spec with exactly one comment placed next to the relevant test — not at the top of the file:
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
# @lat: [[tests#User login#Rejects expired tokens]]
|
|
71
|
+
def test_rejects_expired_tokens():
|
|
72
|
+
...
|
|
73
|
+
|
|
74
|
+
# @lat: [[tests#User login#Handles missing password]]
|
|
75
|
+
def test_handles_missing_password():
|
|
76
|
+
...
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Do not duplicate refs. One `@lat:` comment per spec section, placed at the test that covers it. `lat check` will flag any spec section not covered by a code reference, and any code reference pointing to a nonexistent section.
|
|
80
|
+
|
|
81
|
+
# Section structure
|
|
82
|
+
|
|
83
|
+
Every section in `lat.md/` **must** have a leading paragraph — at least one sentence immediately after the heading, before any child headings or other block content. The first paragraph must be ≤250 characters (excluding `[[wiki link]]` content). This paragraph serves as the section's overview and is used in search results, command output, and RAG context — keeping it concise guarantees the section's essence is always captured.
|
|
84
|
+
|
|
85
|
+
```markdown
|
|
86
|
+
# Good Section
|
|
87
|
+
|
|
88
|
+
Brief overview of what this section documents and why it matters.
|
|
89
|
+
|
|
90
|
+
More detail can go in subsequent paragraphs, code blocks, or lists.
|
|
91
|
+
|
|
92
|
+
## Child heading
|
|
93
|
+
|
|
94
|
+
Details about this child topic.
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
```markdown
|
|
98
|
+
# Bad Section
|
|
99
|
+
|
|
100
|
+
## Child heading
|
|
101
|
+
|
|
102
|
+
Details about this child topic.
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The second example is invalid because `Bad Section` has no leading paragraph. `lat check` validates this rule and reports errors for missing or overly long leading paragraphs.
|
|
106
|
+
|
|
107
|
+
# Diátaxis modes
|
|
108
|
+
|
|
109
|
+
Documents under `lat.md/tutorials/`, `lat.md/how-to/`, `lat.md/reference/`, and `lat.md/explanation/` are checked against their Diátaxis mode. Declare it explicitly with nested frontmatter, or rely on the directory:
|
|
110
|
+
|
|
111
|
+
```markdown
|
|
112
|
+
---
|
|
113
|
+
lat:
|
|
114
|
+
mode: reference
|
|
115
|
+
---
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
If a document is in one of the four mode directories, the declared mode must match that directory. Each mode enforces one shape rule: tutorials need an ordered list of steps and a stated outcome; how-to guides need an ordered list of steps; reference docs must not contain narrative prose (no second paragraph under a heading); explanations must not give imperative commands. Run `lat check mode` to validate.
|