@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.
Files changed (341) hide show
  1. package/README.md +31 -2
  2. package/dist/src/cli/agent-invocation.d.ts +6 -0
  3. package/dist/src/cli/agent-invocation.js +23 -0
  4. package/dist/src/cli/checklist-menu.d.ts +2 -1
  5. package/dist/src/cli/checklist-menu.js +3 -2
  6. package/dist/src/cli/comment-guard.d.ts +14 -0
  7. package/dist/src/cli/comment-guard.js +10 -33
  8. package/dist/src/cli/comment-reminder.d.ts +65 -6
  9. package/dist/src/cli/comment-reminder.js +164 -28
  10. package/dist/src/cli/fork-instructions.d.ts +20 -0
  11. package/dist/src/cli/fork-instructions.js +184 -0
  12. package/dist/src/cli/fork-scaffold.d.ts +106 -0
  13. package/dist/src/cli/fork-scaffold.js +490 -0
  14. package/dist/src/cli/graph.d.ts +1 -1
  15. package/dist/src/cli/hook.d.ts +26 -0
  16. package/dist/src/cli/hook.js +118 -46
  17. package/dist/src/cli/index.js +166 -64
  18. package/dist/src/cli/init-preferences.d.ts +4 -0
  19. package/dist/src/cli/init-preferences.js +36 -0
  20. package/dist/src/cli/init.d.ts +2 -1
  21. package/dist/src/cli/init.js +107 -50
  22. package/dist/src/cli/reindex.d.ts +1 -1
  23. package/dist/src/cli/reindex.js +7 -10
  24. package/dist/src/cli/search.d.ts +14 -4
  25. package/dist/src/cli/search.js +116 -100
  26. package/dist/src/cli/ui-build-server.d.ts +12 -0
  27. package/dist/src/cli/ui-build-server.js +26 -0
  28. package/dist/src/cli/ui-build.d.ts +4 -0
  29. package/dist/src/cli/ui-build.js +13 -0
  30. package/dist/src/cli/ui.d.ts +1 -1
  31. package/dist/src/cli/ui.js +18 -2
  32. package/dist/src/fork/antigravity-hook.d.ts +47 -0
  33. package/dist/src/fork/antigravity-hook.js +424 -0
  34. package/dist/src/fork/antigravity-init.d.ts +17 -0
  35. package/dist/src/fork/antigravity-init.js +124 -0
  36. package/dist/src/fork/upstream-drift-cli.js +2 -0
  37. package/dist/src/fork/upstream-drift.d.ts +26 -0
  38. package/dist/src/fork/upstream-drift.js +185 -0
  39. package/dist/src/fork/upstream-guard-cli.d.ts +1 -0
  40. package/dist/src/fork/upstream-guard-cli.js +2 -0
  41. package/dist/src/fork/upstream-guard.d.ts +72 -0
  42. package/dist/src/fork/upstream-guard.js +445 -0
  43. package/dist/src/graph-export.d.ts +2 -0
  44. package/dist/src/graph-export.js +38 -19
  45. package/dist/src/knowledge/claude-memory.d.ts +1 -0
  46. package/dist/src/knowledge/claude-memory.js +33 -4
  47. package/dist/src/knowledge/index.js +2 -2
  48. package/dist/src/mcp/server.js +34 -18
  49. package/dist/src/search/cache.d.ts +3 -0
  50. package/dist/src/search/cache.js +104 -0
  51. package/dist/src/search/chunks.d.ts +23 -0
  52. package/dist/src/search/chunks.js +197 -0
  53. package/dist/src/search/db.d.ts +28 -16
  54. package/dist/src/search/db.js +106 -40
  55. package/dist/src/search/embedder.d.ts +2 -1
  56. package/dist/src/search/embedder.js +7 -6
  57. package/dist/src/search/index.d.ts +6 -2
  58. package/dist/src/search/index.js +176 -53
  59. package/dist/src/search/lexical.d.ts +6 -0
  60. package/dist/src/search/lexical.js +36 -0
  61. package/dist/src/search/lock.d.ts +5 -0
  62. package/dist/src/search/lock.js +45 -0
  63. package/dist/src/search/query.d.ts +26 -0
  64. package/dist/src/search/query.js +103 -0
  65. package/dist/src/search/search.d.ts +17 -7
  66. package/dist/src/search/search.js +164 -14
  67. package/dist/src/search/types.d.ts +15 -0
  68. package/dist/src/search/types.js +1 -0
  69. package/dist/src/view/client/assets/GraphView-Dij8mAA_.js +456 -0
  70. package/dist/src/view/client/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  71. package/dist/src/view/client/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  72. package/dist/src/view/client/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  73. package/dist/src/view/client/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  74. package/dist/src/view/client/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  75. package/dist/src/view/client/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  76. package/dist/src/view/client/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  77. package/dist/src/view/client/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  78. package/dist/src/view/client/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  79. package/dist/src/view/client/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  80. package/dist/src/view/client/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  81. package/dist/src/view/client/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  82. package/dist/src/view/client/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  83. package/dist/src/view/client/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  84. package/dist/src/view/client/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  85. package/dist/src/view/client/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  86. package/dist/src/view/client/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  87. package/dist/src/view/client/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  88. package/dist/src/view/client/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  89. package/dist/src/view/client/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  90. package/dist/src/view/client/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  91. package/dist/src/view/client/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  92. package/dist/src/view/client/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  93. package/dist/src/view/client/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  94. package/dist/src/view/client/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  95. package/dist/src/view/client/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  96. package/dist/src/view/client/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  97. package/dist/src/view/client/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  98. package/dist/src/view/client/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  99. package/dist/src/view/client/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  100. package/dist/src/view/client/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  101. package/dist/src/view/client/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  102. package/dist/src/view/client/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  103. package/dist/src/view/client/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  104. package/dist/src/view/client/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  105. package/dist/src/view/client/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  106. package/dist/src/view/client/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  107. package/dist/src/view/client/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  108. package/dist/src/view/client/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  109. package/dist/src/view/client/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  110. package/dist/src/view/client/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  111. package/dist/src/view/client/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  112. package/dist/src/view/client/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  113. package/dist/src/view/client/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  114. package/dist/src/view/client/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  115. package/dist/src/view/client/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  116. package/dist/src/view/client/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  117. package/dist/src/view/client/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  118. package/dist/src/view/client/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  119. package/dist/src/view/client/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  120. package/dist/src/view/client/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  121. package/dist/src/view/client/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  122. package/dist/src/view/client/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  123. package/dist/src/view/client/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  124. package/dist/src/view/client/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  125. package/dist/src/view/client/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  126. package/dist/src/view/client/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  127. package/dist/src/view/client/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  128. package/dist/src/view/client/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  129. package/dist/src/view/client/assets/MarkdownEditor-88Wbt0M1.js +28 -0
  130. package/dist/src/view/client/assets/OrbitControls-DwcpQNja.js +1 -0
  131. package/dist/src/view/client/assets/STLLoader-CLWTKt5i.js +1 -0
  132. package/dist/src/view/client/assets/_commonjsHelpers-CqkleIqs.js +1 -0
  133. package/dist/src/view/client/assets/abnfDiagram-VCTEODGH-y0DlYa8E.js +1 -0
  134. package/dist/src/view/client/assets/arc-FlMu8dnO.js +1 -0
  135. package/dist/src/view/client/assets/architectureDiagram-5GKGNRK7-DA_uWZW1.js +36 -0
  136. package/dist/src/view/client/assets/blockDiagram-I7D4REHJ-BHQ5LU85.js +129 -0
  137. package/dist/src/view/client/assets/c4Diagram-7LVT6UL2-BRucKCt2.js +38 -0
  138. package/dist/src/view/client/assets/channel-BgDNA_Ay.js +1 -0
  139. package/dist/src/view/client/assets/chunk-2Q5K7J3B-BJPcFivt.js +1 -0
  140. package/dist/src/view/client/assets/chunk-5VM5RSS4-v2q99bGz.js +15 -0
  141. package/dist/src/view/client/assets/chunk-F27PBJKO-CcHOuJCs.js +1 -0
  142. package/dist/src/view/client/assets/chunk-IMKFNOWR-DNxYuJNq.js +231 -0
  143. package/dist/src/view/client/assets/chunk-JWPE2WC7-C0eHKvLW.js +1 -0
  144. package/dist/src/view/client/assets/chunk-POPQ4Y6H-57CWp2Ve.js +1 -0
  145. package/dist/src/view/client/assets/chunk-SVP7TREG-BqcoxIJw.js +88 -0
  146. package/dist/src/view/client/assets/chunk-TICWLB2K-DRUJR5zH.js +206 -0
  147. package/dist/src/view/client/assets/chunk-XXDRQBXY-Dez0oRoM.js +1 -0
  148. package/dist/src/view/client/assets/classDiagram-ZZMXUADV-CFZ_Sgh5.js +1 -0
  149. package/dist/src/view/client/assets/classDiagram-v2-VYDZK3BY-CFZ_Sgh5.js +1 -0
  150. package/dist/src/view/client/assets/cose-bilkent-JH36ORCC-BHtud6Hg.js +1 -0
  151. package/dist/src/view/client/assets/cynefin-OW5HDTMX-BjBW8VGk.js +166 -0
  152. package/dist/src/view/client/assets/cynefinDiagram-5FMLGOSQ-DwGuD7oF.js +62 -0
  153. package/dist/src/view/client/assets/cytoscape.esm-DzSz-X2X.js +321 -0
  154. package/dist/src/view/client/assets/dagre-GXQ25YYZ-C5zSlGK9.js +4 -0
  155. package/dist/src/view/client/assets/defaultLocale-DX6XiGOO.js +1 -0
  156. package/dist/src/view/client/assets/diagram-S7CK7UJ4-C_NhA3bj.js +30 -0
  157. package/dist/src/view/client/assets/diagram-UQ7AKVKN-az7QPYNb.js +41 -0
  158. package/dist/src/view/client/assets/diagram-VSXAHHWV-BRvDuM8_.js +3 -0
  159. package/dist/src/view/client/assets/diagram-VX7I27RA-BWLgF6S-.js +24 -0
  160. package/dist/src/view/client/assets/diagram-Z3DM3KII-DV3d6mL5.js +24 -0
  161. package/dist/src/view/client/assets/ebnfDiagram-PWID7BFC-yUXrEAvK.js +1 -0
  162. package/dist/src/view/client/assets/erDiagram-RLTQ6QDP-D35FN1Pt.js +99 -0
  163. package/dist/src/view/client/assets/flowDiagram-HODETNUW-BciZqsjT.js +168 -0
  164. package/dist/src/view/client/assets/ganttDiagram-EL5Y4UJY-BysPGgXS.js +292 -0
  165. package/dist/src/view/client/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  166. package/dist/src/view/client/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  167. package/dist/src/view/client/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  168. package/dist/src/view/client/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  169. package/dist/src/view/client/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
  170. package/dist/src/view/client/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
  171. package/dist/src/view/client/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
  172. package/dist/src/view/client/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
  173. package/dist/src/view/client/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
  174. package/dist/src/view/client/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
  175. package/dist/src/view/client/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  176. package/dist/src/view/client/assets/gitGraphDiagram-WWUBYQGX-C3DdJ5xG.js +106 -0
  177. package/dist/src/view/client/assets/index-BnENo9bV.js +1 -0
  178. package/dist/src/view/client/assets/index-CJokoRSp.js +13 -0
  179. package/dist/src/view/client/assets/index-DG0Ez15D.css +1 -0
  180. package/dist/src/view/client/assets/infoDiagram-27XIBGKW-D3HZrDRb.js +2 -0
  181. package/dist/src/view/client/assets/init-Gi6I4Gst.js +1 -0
  182. package/dist/src/view/client/assets/ishikawaDiagram-5VMMS53U-BXyVIXTU.js +70 -0
  183. package/dist/src/view/client/assets/journeyDiagram-3NMN7TZE-D4-1NxVU.js +139 -0
  184. package/dist/src/view/client/assets/kanban-definition-UXKFOSKX-4Gu_5yBA.js +89 -0
  185. package/dist/src/view/client/assets/katex-HP8lGamR.js +257 -0
  186. package/dist/src/view/client/assets/layout-Jf1K3TMM.js +1 -0
  187. package/dist/src/view/client/assets/linear-DWfwzUT_.js +1 -0
  188. package/dist/src/view/client/assets/logo-RR_KBOAT.svg +149 -0
  189. package/dist/src/view/client/assets/maplibre-gl-CDX6Zuow.js +800 -0
  190. package/dist/src/view/client/assets/mermaid.core-DMx_DAl8.js +310 -0
  191. package/dist/src/view/client/assets/mindmap-definition-YA3MSWOX-8pxY_RWi.js +96 -0
  192. package/dist/src/view/client/assets/ordinal-Cboi1Yqb.js +1 -0
  193. package/dist/src/view/client/assets/pegDiagram-XKGWAZYB-DNAw_O5t.js +1 -0
  194. package/dist/src/view/client/assets/pieDiagram-E7YTZNPT-uuvRCDkC.js +39 -0
  195. package/dist/src/view/client/assets/quadrantDiagram-AXDQQJYC-BER2O4Aq.js +7 -0
  196. package/dist/src/view/client/assets/railroadDiagram-O6MQD6OU-CxEsJ_0n.js +1 -0
  197. package/dist/src/view/client/assets/requirementDiagram-BXWQKSXE-yS9rspca.js +84 -0
  198. package/dist/src/view/client/assets/sankeyDiagram-P5KCCOFB-Bqt70a2j.js +40 -0
  199. package/dist/src/view/client/assets/sequenceDiagram-WJ2MYXX4-BvOOEJNr.js +162 -0
  200. package/dist/src/view/client/assets/sizeCapture-INFHLROL-CvO_Pjjo.js +1 -0
  201. package/dist/src/view/client/assets/stateDiagram-D77RDMKH-KLmVOZkq.js +1 -0
  202. package/dist/src/view/client/assets/stateDiagram-v2-MP3YSRHH-KCS8Mdzu.js +1 -0
  203. package/dist/src/view/client/assets/swimlanes-42K2YHIH-DC1r4_sq.js +1 -0
  204. package/dist/src/view/client/assets/swimlanesDiagram-VR7AAH4N-B2TcAwis.js +8 -0
  205. package/dist/src/view/client/assets/three.module-PDSP0dbZ.js +4108 -0
  206. package/dist/src/view/client/assets/timeline-definition-24CTP7MA-ChXLOuBL.js +120 -0
  207. package/dist/src/view/client/assets/vennDiagram-4TSXK5OY-D9_h25-Y.js +34 -0
  208. package/dist/src/view/client/assets/wardleyDiagram-VM6X3IG4-CsQJGGW0.js +78 -0
  209. package/dist/src/view/client/assets/xychartDiagram-S5SC5T6Z-DGMuPMlm.js +7 -0
  210. package/dist/src/view/client/index.html +2 -2
  211. package/dist/src/view/client-shell.d.ts +2 -0
  212. package/dist/src/view/client-shell.js +5 -0
  213. package/dist/src/view/diagnostics.d.ts +3 -2
  214. package/dist/src/view/diagnostics.js +49 -58
  215. package/dist/src/view/document-edit.d.ts +8 -0
  216. package/dist/src/view/document-edit.js +25 -0
  217. package/dist/src/view/document-route.d.ts +14 -0
  218. package/dist/src/view/document-route.js +126 -0
  219. package/dist/src/view/document-tree.d.ts +18 -0
  220. package/dist/src/view/document-tree.js +139 -0
  221. package/dist/src/view/external-document-tree.d.ts +3 -0
  222. package/dist/src/view/external-document-tree.js +674 -0
  223. package/dist/src/view/git-diff.js +205 -1
  224. package/dist/src/view/git.js +1 -1
  225. package/dist/src/view/graph.d.ts +7 -0
  226. package/dist/src/view/graph.js +267 -0
  227. package/dist/src/view/highlight.d.ts +10 -2
  228. package/dist/src/view/highlight.js +4547 -1363
  229. package/dist/src/view/markdown.d.ts +8 -3
  230. package/dist/src/view/markdown.js +308 -41
  231. package/dist/src/view/preindexed-search.d.ts +15 -0
  232. package/dist/src/view/preindexed-search.js +25 -0
  233. package/dist/src/view/protocol.d.ts +95 -6
  234. package/dist/src/view/protocol.js +1 -1
  235. package/dist/src/view/publication.d.ts +2 -0
  236. package/dist/src/view/publication.js +78 -0
  237. package/dist/src/view/references.d.ts +13 -26
  238. package/dist/src/view/references.js +150 -119
  239. package/dist/src/view/repository.d.ts +18 -5
  240. package/dist/src/view/repository.js +269 -27
  241. package/dist/src/view/request-security.d.ts +5 -0
  242. package/dist/src/view/request-security.js +46 -0
  243. package/dist/src/view/search-result.d.ts +4 -0
  244. package/dist/src/view/search-result.js +25 -0
  245. package/dist/src/view/search.d.ts +7 -2
  246. package/dist/src/view/search.js +23 -33
  247. package/dist/src/view/server-build.d.ts +21 -0
  248. package/dist/src/view/server-build.js +145 -0
  249. package/dist/src/view/server-deployment.d.ts +31 -0
  250. package/dist/src/view/server-deployment.js +94 -0
  251. package/dist/src/view/server-index-worker.d.ts +6 -0
  252. package/dist/src/view/server-index-worker.js +14 -0
  253. package/dist/src/view/server.d.ts +14 -2
  254. package/dist/src/view/server.js +254 -51
  255. package/dist/src/view/source-target.d.ts +10 -0
  256. package/dist/src/view/source-target.js +43 -0
  257. package/dist/src/view/static-build.d.ts +32 -0
  258. package/dist/src/view/static-build.js +741 -0
  259. package/dist/src/view/static-protocol.d.ts +47 -0
  260. package/dist/src/view/static-protocol.js +15 -0
  261. package/dist/src/view/store.d.ts +26 -3
  262. package/dist/src/view/store.js +325 -44
  263. package/dist/src/view/table-of-contents.d.ts +9 -0
  264. package/dist/src/view/table-of-contents.js +83 -0
  265. package/dist/src/view/vercel-build.d.ts +24 -0
  266. package/dist/src/view/vercel-build.js +140 -0
  267. package/dist/src/view/vercel-server-build.d.ts +10 -0
  268. package/dist/src/view/vercel-server-build.js +61 -0
  269. package/dist/vendor/lat.md-server/cli.d.ts +2 -0
  270. package/dist/vendor/lat.md-server/cli.js +12 -0
  271. package/dist/vendor/lat.md-server/index.d.ts +38 -0
  272. package/dist/vendor/lat.md-server/index.js +128 -0
  273. package/package.json +72 -25
  274. package/plugins/lat-md/README.md +61 -0
  275. package/plugins/lat-md/hooks.json +38 -0
  276. package/plugins/lat-md/plugin.json +9 -0
  277. package/plugins/lat-md/rules/AGENTS.md +118 -0
  278. package/plugins/lat-md/skills/lat-md/SKILL.md +178 -0
  279. package/plugins/lat-md/skills/lat-md-conventions/SKILL.md +182 -0
  280. package/templates/AGENTS.md +19 -18
  281. package/templates/cursor-rules.md +14 -5
  282. package/templates/fork/conventions.md +173 -0
  283. package/templates/opencode-plugin.ts +9 -9
  284. package/templates/pi-extension.ts +11 -11
  285. package/templates/skill/SKILL.md +28 -17
  286. package/dist/src/cli/check-frontmatter.d.ts +0 -12
  287. package/dist/src/cli/check-frontmatter.js +0 -44
  288. package/dist/src/cli/check-mode.d.ts +0 -6
  289. package/dist/src/cli/check-mode.js +0 -303
  290. package/dist/src/cli/check-status.d.ts +0 -74
  291. package/dist/src/cli/check-status.js +0 -217
  292. package/dist/src/cli/check.d.ts +0 -45
  293. package/dist/src/cli/check.js +0 -777
  294. package/dist/src/cli/context.d.ts +0 -11
  295. package/dist/src/cli/context.js +0 -58
  296. package/dist/src/cli/expand.d.ts +0 -8
  297. package/dist/src/cli/expand.js +0 -94
  298. package/dist/src/cli/gen-index.d.ts +0 -45
  299. package/dist/src/cli/gen-index.js +0 -235
  300. package/dist/src/cli/link-scheme.d.ts +0 -54
  301. package/dist/src/cli/link-scheme.js +0 -101
  302. package/dist/src/cli/locate.d.ts +0 -2
  303. package/dist/src/cli/locate.js +0 -17
  304. package/dist/src/cli/refs.d.ts +0 -22
  305. package/dist/src/cli/refs.js +0 -229
  306. package/dist/src/cli/section.d.ts +0 -43
  307. package/dist/src/cli/section.js +0 -252
  308. package/dist/src/cli/select-menu.d.ts +0 -13
  309. package/dist/src/cli/select-menu.js +0 -100
  310. package/dist/src/code-refs.d.ts +0 -17
  311. package/dist/src/code-refs.js +0 -277
  312. package/dist/src/config.d.ts +0 -29
  313. package/dist/src/config.js +0 -83
  314. package/dist/src/context.d.ts +0 -23
  315. package/dist/src/context.js +0 -11
  316. package/dist/src/extensions/wiki-link/from-markdown.d.ts +0 -5
  317. package/dist/src/extensions/wiki-link/from-markdown.js +0 -34
  318. package/dist/src/extensions/wiki-link/index.d.ts +0 -4
  319. package/dist/src/extensions/wiki-link/index.js +0 -3
  320. package/dist/src/extensions/wiki-link/syntax.d.ts +0 -14
  321. package/dist/src/extensions/wiki-link/syntax.js +0 -121
  322. package/dist/src/extensions/wiki-link/to-markdown.d.ts +0 -5
  323. package/dist/src/extensions/wiki-link/to-markdown.js +0 -28
  324. package/dist/src/extensions/wiki-link/types.d.ts +0 -34
  325. package/dist/src/format.d.ts +0 -8
  326. package/dist/src/format.js +0 -43
  327. package/dist/src/init-version.d.ts +0 -10
  328. package/dist/src/init-version.js +0 -49
  329. package/dist/src/lattice.d.ts +0 -108
  330. package/dist/src/lattice.js +0 -816
  331. package/dist/src/parser.d.ts +0 -3
  332. package/dist/src/parser.js +0 -18
  333. package/dist/src/source-parser.d.ts +0 -27
  334. package/dist/src/source-parser.js +0 -916
  335. package/dist/src/untrusted.d.ts +0 -24
  336. package/dist/src/untrusted.js +0 -97
  337. package/dist/src/view/client/assets/index-B0n0u03y.css +0 -1
  338. package/dist/src/view/client/assets/index-xm2_px4q.js +0 -23
  339. package/dist/src/walk.d.ts +0 -18
  340. package/dist/src/walk.js +0 -27
  341. /package/dist/src/{extensions/wiki-link/types.js → fork/upstream-drift-cli.d.ts} +0 -0
@@ -1,8 +1,13 @@
1
1
  import type { Root } from 'mdast';
2
+ import type { ViewDocumentTree } from './protocol.js';
2
3
  export type WikiLinkContext = {
3
4
  line: number;
4
5
  };
5
- export type WikiLinkResolver = (target: string, context: WikiLinkContext) => string | null | Promise<string | null>;
6
+ export type WikiLinkResolution = {
7
+ href: string;
8
+ referenceCount: number;
9
+ };
10
+ export type WikiLinkResolver = (target: string, context: WikiLinkContext) => WikiLinkResolution | null | Promise<WikiLinkResolution | null>;
6
11
  export type MarkdownRenderOptions = {
7
12
  activeMarkdownLink?: string;
8
13
  activeWikiLink?: string;
@@ -15,8 +20,8 @@ export type MarkdownRenderOptions = {
15
20
  lineOffset?: number;
16
21
  rewriteMarkdownLink?: (url: string) => string;
17
22
  };
18
- /** Render a lat.md file as safe HTML with resolved wiki links. */
23
+ /** Normalize a lat.md file into the safe, parser-neutral view tree. */
19
24
  export declare function renderMarkdown(markdown: string, filePath: string, resolveWikiLink?: WikiLinkResolver, options?: MarkdownRenderOptions, parsedTree?: Root): Promise<{
20
- html: string;
25
+ tree: ViewDocumentTree;
21
26
  title: string;
22
27
  }>;
@@ -1,28 +1,82 @@
1
1
  import { basename, extname } from 'node:path';
2
2
  import rehypeSanitize, { defaultSchema } from 'rehype-sanitize';
3
+ import rehypeRaw from 'rehype-raw';
4
+ import rehypeKatex from 'rehype-katex';
3
5
  import rehypeSlug from 'rehype-slug';
4
- import rehypeStringify from 'rehype-stringify';
6
+ import remarkEmoji from 'remark-emoji';
5
7
  import remarkRehype from 'remark-rehype';
6
8
  import { unified } from 'unified';
7
9
  import { visit } from 'unist-util-visit';
8
- import { parse } from '../parser.js';
10
+ import { parse } from '@plebeiantech/lat.md-core/parser';
11
+ import { decorateExternalSiteLinks, toViewDocumentTree, } from './document-tree.js';
12
+ import { highlightCode } from './highlight.js';
9
13
  const CODE_LINK_CLASSES = [
10
14
  'wiki-link-code',
11
15
  'wiki-link-active',
12
16
  'code-link-language',
17
+ 'code-link-leading',
13
18
  'code-language-ts',
14
19
  'code-language-js',
15
20
  'code-language-py',
21
+ 'code-language-rb',
16
22
  'code-language-rs',
17
23
  'code-language-go',
18
24
  'code-language-c',
25
+ 'code-language-dart',
26
+ 'code-language-java',
19
27
  ];
20
28
  const ERROR_CLASS = 'markdown-error';
21
29
  const GIT_CLASSES = ['git-added', 'git-removed'];
22
- function classAttributes(tag) {
30
+ const GEOJSON_SOURCE_CLASS = 'markdown-geojson-source';
31
+ const HIGHLIGHT_CLASS = 'hljs';
32
+ const MERMAID_SOURCE_CLASS = 'markdown-mermaid-source';
33
+ const MATH_DIFF_BLOCK_CLASS = 'git-math-block';
34
+ const RICH_FENCE_SOURCE_CLASS = 'markdown-diagram-source';
35
+ const STL_SOURCE_CLASS = 'markdown-stl-source';
36
+ const TOPOJSON_SOURCE_CLASS = 'markdown-topojson-source';
37
+ const ALERT_KINDS = ['note', 'tip', 'important', 'warning', 'caution'];
38
+ const ALERT_CLASSES = [
39
+ 'markdown-alert',
40
+ 'markdown-alert-title',
41
+ ...ALERT_KINDS.map((kind) => `markdown-alert-${kind}`),
42
+ ];
43
+ const GITHUB_CUSTOM_EMOJI = new Set([
44
+ 'atom',
45
+ 'basecamp',
46
+ 'basecampy',
47
+ 'bowtie',
48
+ 'electron',
49
+ 'feelsgood',
50
+ 'finnadie',
51
+ 'fishsticks',
52
+ 'fu',
53
+ 'goberserk',
54
+ 'godmode',
55
+ 'hurtrealbad',
56
+ 'neckbeard',
57
+ 'octocat',
58
+ 'rage1',
59
+ 'rage2',
60
+ 'rage3',
61
+ 'rage4',
62
+ 'shipit',
63
+ 'suspect',
64
+ 'trollface',
65
+ ]);
66
+ function classAttributes(tag, extraClasses = []) {
67
+ const attributes = defaultSchema.attributes?.[tag] ?? [];
68
+ const allowedClasses = attributes.flatMap((attribute) => Array.isArray(attribute) && attribute[0] === 'className'
69
+ ? attribute.slice(1)
70
+ : []);
23
71
  return [
24
- ...(defaultSchema.attributes?.[tag] ?? []),
25
- ['className', ERROR_CLASS, ...GIT_CLASSES],
72
+ ...attributes.filter((attribute) => !(Array.isArray(attribute) && attribute[0] === 'className')),
73
+ [
74
+ 'className',
75
+ ...allowedClasses,
76
+ ERROR_CLASS,
77
+ ...GIT_CLASSES,
78
+ ...extraClasses,
79
+ ],
26
80
  ];
27
81
  }
28
82
  const sanitizeSchema = {
@@ -43,39 +97,146 @@ const sanitizeSchema = {
43
97
  ],
44
98
  ],
45
99
  blockquote: classAttributes('blockquote'),
46
- code: classAttributes('code'),
100
+ code: classAttributes('code', [
101
+ HIGHLIGHT_CLASS,
102
+ 'math-display',
103
+ 'math-inline',
104
+ ]),
47
105
  del: classAttributes('del'),
48
- div: classAttributes('div'),
106
+ details: [...(defaultSchema.attributes?.details ?? []), ['open', true]],
107
+ div: classAttributes('div', [...ALERT_CLASSES, MATH_DIFF_BLOCK_CLASS]),
49
108
  h1: classAttributes('h1'),
50
109
  h2: classAttributes('h2'),
51
110
  h3: classAttributes('h3'),
52
111
  h4: classAttributes('h4'),
53
112
  h5: classAttributes('h5'),
54
113
  h6: classAttributes('h6'),
55
- img: classAttributes('img'),
114
+ img: classAttributes('img', ['markdown-emoji']),
115
+ input: [...(defaultSchema.attributes?.input ?? []), ['checked', true]],
56
116
  ins: classAttributes('ins'),
57
117
  li: classAttributes('li'),
58
- p: classAttributes('p'),
59
- pre: classAttributes('pre'),
118
+ ol: classAttributes('ol'),
119
+ p: classAttributes('p', ALERT_CLASSES),
120
+ pre: classAttributes('pre', [
121
+ GEOJSON_SOURCE_CLASS,
122
+ MERMAID_SOURCE_CLASS,
123
+ RICH_FENCE_SOURCE_CLASS,
124
+ STL_SOURCE_CLASS,
125
+ TOPOJSON_SOURCE_CLASS,
126
+ ]),
60
127
  span: [
61
128
  ...(defaultSchema.attributes?.span ?? []),
62
129
  'ariaHidden',
130
+ 'ariaLabel',
131
+ 'role',
63
132
  [
64
133
  'className',
65
134
  'wiki-link-context',
66
135
  'wiki-link-leaf',
136
+ 'wiki-link-ref-count',
67
137
  ...CODE_LINK_CLASSES.slice(2),
138
+ /^hljs-./,
68
139
  ERROR_CLASS,
69
140
  ...GIT_CLASSES,
70
141
  ],
71
142
  ],
143
+ table: classAttributes('table'),
144
+ tr: classAttributes('tr'),
145
+ ul: classAttributes('ul'),
72
146
  },
73
147
  };
74
- const htmlProcessor = unified()
75
- .use(remarkRehype)
148
+ const highlightedCodeHandler = (state, rawNode) => {
149
+ const node = rawNode;
150
+ const language = node.lang?.split(/\s+/, 1)[0];
151
+ const richSourceClass = language?.toLowerCase() === 'mermaid'
152
+ ? MERMAID_SOURCE_CLASS
153
+ : language?.toLowerCase() === 'geojson'
154
+ ? GEOJSON_SOURCE_CLASS
155
+ : language?.toLowerCase() === 'topojson'
156
+ ? TOPOJSON_SOURCE_CLASS
157
+ : language?.toLowerCase() === 'stl'
158
+ ? STL_SOURCE_CLASS
159
+ : null;
160
+ const highlighted = language && !richSourceClass ? highlightCode(language, node.value) : null;
161
+ const code = {
162
+ type: 'element',
163
+ tagName: 'code',
164
+ properties: {
165
+ className: [
166
+ ...(language ? [`language-${language}`] : []),
167
+ ...(highlighted === null ? [] : [HIGHLIGHT_CLASS]),
168
+ ],
169
+ },
170
+ children: highlighted === null
171
+ ? [
172
+ {
173
+ type: 'text',
174
+ value: node.value ? `${node.value}\n` : '',
175
+ },
176
+ ]
177
+ : [...highlighted.children, { type: 'text', value: '\n' }],
178
+ ...(node.meta ? { data: { meta: node.meta } } : {}),
179
+ };
180
+ state.patch(node, code);
181
+ const result = state.applyData(node, code);
182
+ const pre = {
183
+ type: 'element',
184
+ tagName: 'pre',
185
+ properties: {
186
+ className: richSourceClass
187
+ ? [RICH_FENCE_SOURCE_CLASS, richSourceClass]
188
+ : [],
189
+ },
190
+ children: [result],
191
+ };
192
+ state.patch(node, pre);
193
+ return pre;
194
+ };
195
+ const documentTreeProcessor = unified()
196
+ .use(remarkRehype, {
197
+ allowDangerousHtml: true,
198
+ handlers: { code: highlightedCodeHandler },
199
+ })
200
+ .use(rehypeRaw)
76
201
  .use(rehypeSanitize, sanitizeSchema)
77
- .use(rehypeSlug)
78
- .use(rehypeStringify);
202
+ .use(rehypeKatex)
203
+ .use(rehypeSlug);
204
+ const emojiProcessor = unified().use(remarkEmoji, { accessible: true });
205
+ function transformCustomEmoji(tree) {
206
+ visit(tree, 'text', (node, index, parent) => {
207
+ if (index === undefined || !parent || !node.value.includes(':'))
208
+ return;
209
+ const pattern = /:([a-z0-9_+-]+):/g;
210
+ const children = [];
211
+ let cursor = 0;
212
+ let match;
213
+ while ((match = pattern.exec(node.value))) {
214
+ if (!GITHUB_CUSTOM_EMOJI.has(match[1]))
215
+ continue;
216
+ if (match.index > cursor) {
217
+ children.push({
218
+ type: 'text',
219
+ value: node.value.slice(cursor, match.index),
220
+ });
221
+ }
222
+ children.push({
223
+ type: 'image',
224
+ url: `https://github.githubassets.com/images/icons/emoji/${match[1]}.png?v8`,
225
+ alt: match[0],
226
+ title: null,
227
+ data: { hProperties: { className: ['markdown-emoji'] } },
228
+ });
229
+ cursor = match.index + match[0].length;
230
+ }
231
+ if (children.length === 0)
232
+ return;
233
+ if (cursor < node.value.length) {
234
+ children.push({ type: 'text', value: node.value.slice(cursor) });
235
+ }
236
+ parent.children.splice(index, 1, ...children);
237
+ return index + children.length;
238
+ });
239
+ }
79
240
  function nodeText(node) {
80
241
  if (typeof node.value === 'string')
81
242
  return node.value;
@@ -85,6 +246,38 @@ function nodeText(node) {
85
246
  .map((child) => nodeText(child))
86
247
  .join('');
87
248
  }
249
+ function transformAlerts(tree) {
250
+ visit(tree, 'blockquote', (node) => {
251
+ const firstBlock = node.children[0];
252
+ if (firstBlock?.type !== 'paragraph')
253
+ return;
254
+ const firstInline = firstBlock.children[0];
255
+ if (firstInline?.type !== 'alertMarker')
256
+ return;
257
+ const label = firstInline.value;
258
+ const kind = label.toLowerCase();
259
+ firstBlock.children.shift();
260
+ if (firstBlock.children.length === 0)
261
+ node.children.shift();
262
+ node.data = {
263
+ ...node.data,
264
+ hName: 'div',
265
+ hProperties: {
266
+ ...(node.data?.hProperties ?? {}),
267
+ className: ['markdown-alert', `markdown-alert-${kind}`],
268
+ },
269
+ };
270
+ node.children.unshift({
271
+ type: 'paragraph',
272
+ data: {
273
+ hProperties: { className: ['markdown-alert-title'] },
274
+ },
275
+ children: [
276
+ { type: 'text', value: label[0] + label.slice(1).toLowerCase() },
277
+ ],
278
+ });
279
+ });
280
+ }
88
281
  function wikiLinkContent(node) {
89
282
  if (node.data.alias) {
90
283
  return {
@@ -131,6 +324,10 @@ function codeLanguage(target) {
131
324
  return { className: 'code-language-js', label: 'JS' };
132
325
  case '.py':
133
326
  return { className: 'code-language-py', label: 'PY' };
327
+ case '.erb':
328
+ case '.rake':
329
+ case '.rb':
330
+ return { className: 'code-language-rb', label: 'RB' };
134
331
  case '.rs':
135
332
  return { className: 'code-language-rs', label: 'RS' };
136
333
  case '.go':
@@ -138,6 +335,10 @@ function codeLanguage(target) {
138
335
  case '.c':
139
336
  case '.h':
140
337
  return { className: 'code-language-c', label: 'C' };
338
+ case '.dart':
339
+ return { className: 'code-language-dart', label: 'DART' };
340
+ case '.java':
341
+ return { className: 'code-language-java', label: 'JAVA' };
141
342
  default:
142
343
  return null;
143
344
  }
@@ -155,6 +356,45 @@ function languageIcon(language) {
155
356
  children: [{ type: 'text', value: language.label }],
156
357
  };
157
358
  }
359
+ function codeLinkContent(language, children) {
360
+ const [first, ...rest] = children;
361
+ if (!first)
362
+ return [languageIcon(language)];
363
+ let leading = first;
364
+ let remainder = null;
365
+ if (first.type === 'text') {
366
+ const breakAt = first.value.search(/\s/);
367
+ if (breakAt > 0) {
368
+ leading = { ...first, value: first.value.slice(0, breakAt) };
369
+ remainder = { ...first, value: first.value.slice(breakAt) };
370
+ }
371
+ }
372
+ return [
373
+ {
374
+ type: 'emphasis',
375
+ data: {
376
+ hName: 'span',
377
+ hProperties: { className: ['code-link-leading'] },
378
+ },
379
+ children: [languageIcon(language), leading],
380
+ },
381
+ ...(remainder ? [remainder] : []),
382
+ ...rest,
383
+ ];
384
+ }
385
+ function referenceCountBadge(count) {
386
+ return {
387
+ type: 'emphasis',
388
+ data: {
389
+ hName: 'span',
390
+ hProperties: {
391
+ className: ['wiki-link-ref-count'],
392
+ ariaLabel: `${count} ${count === 1 ? 'reference' : 'references'}`,
393
+ },
394
+ },
395
+ children: [{ type: 'text', value: String(count) }],
396
+ };
397
+ }
158
398
  function targetMatches(node, target) {
159
399
  if (node.type === 'wikiLink') {
160
400
  return node.value.toLowerCase() === target.toLowerCase();
@@ -223,30 +463,41 @@ function markMarkdownErrors(tree, errors) {
223
463
  };
224
464
  }
225
465
  }
226
- /** Render a lat.md file as safe HTML with resolved wiki links. */
466
+ /** Normalize a lat.md file into the safe, parser-neutral view tree. */
227
467
  export async function renderMarkdown(markdown, filePath, resolveWikiLink, options = {}, parsedTree) {
228
468
  const tree = parsedTree ? structuredClone(parsedTree) : parse(markdown);
229
469
  tree.children = tree.children.filter((node) => node.type !== 'yaml');
470
+ await emojiProcessor.run(tree);
471
+ transformCustomEmoji(tree);
472
+ transformAlerts(tree);
230
473
  if (options.errors)
231
474
  markMarkdownErrors(tree, options.errors);
232
- if (options.rewriteMarkdownLink || options.activeMarkdownLink) {
233
- visit(tree, 'link', (node) => {
234
- const authoredUrl = node.url;
235
- if (options.activeMarkdownLink &&
236
- authoredUrl === options.activeMarkdownLink) {
237
- node.data = {
238
- ...node.data,
239
- hProperties: {
240
- ...(node.data?.hProperties ?? {}),
241
- className: ['wiki-link-active'],
242
- },
243
- };
244
- }
245
- if (options.rewriteMarkdownLink) {
246
- node.url = options.rewriteMarkdownLink(authoredUrl);
247
- }
248
- });
249
- }
475
+ visit(tree, 'link', (node) => {
476
+ const authoredUrl = node.url;
477
+ if (options.activeMarkdownLink &&
478
+ authoredUrl === options.activeMarkdownLink) {
479
+ node.data = {
480
+ ...node.data,
481
+ hProperties: {
482
+ ...(node.data?.hProperties ?? {}),
483
+ className: ['wiki-link-active'],
484
+ },
485
+ };
486
+ }
487
+ if (options.rewriteMarkdownLink) {
488
+ node.url = options.rewriteMarkdownLink(authoredUrl);
489
+ }
490
+ });
491
+ visit(tree, 'image', (node) => {
492
+ if (options.rewriteMarkdownLink) {
493
+ node.url = options.rewriteMarkdownLink(node.url);
494
+ }
495
+ });
496
+ visit(tree, 'definition', (node) => {
497
+ if (options.rewriteMarkdownLink) {
498
+ node.url = options.rewriteMarkdownLink(node.url);
499
+ }
500
+ });
250
501
  const firstHeading = tree.children.find((node) => node.type === 'heading');
251
502
  const title = firstHeading
252
503
  ? nodeText(firstHeading)
@@ -266,11 +517,12 @@ export async function renderMarkdown(markdown, filePath, resolveWikiLink, option
266
517
  visit(tree, 'wikiLink', (node, index, parent) => {
267
518
  if (index === undefined || !parent || !('children' in parent))
268
519
  return;
269
- const href = resolvedLinks.get(node);
520
+ const resolution = resolvedLinks.get(node);
270
521
  const markedProperties = node.data?.hProperties;
271
- if (href) {
522
+ if (resolution) {
523
+ const { href, referenceCount } = resolution;
272
524
  const content = wikiLinkContent(node);
273
- const language = href.startsWith('/code/')
525
+ const language = href.startsWith('/code/') || href.startsWith('/external/')
274
526
  ? codeLanguage(node.value)
275
527
  : null;
276
528
  const classes = content.segmented ? ['wiki-link-segmented'] : [];
@@ -296,9 +548,12 @@ export async function renderMarkdown(markdown, filePath, resolveWikiLink, option
296
548
  },
297
549
  }
298
550
  : undefined,
299
- children: language
300
- ? [languageIcon(language), ...content.children]
301
- : content.children,
551
+ children: [
552
+ ...(language
553
+ ? codeLinkContent(language, content.children)
554
+ : content.children),
555
+ ...(referenceCount > 1 ? [referenceCountBadge(referenceCount)] : []),
556
+ ],
302
557
  };
303
558
  return;
304
559
  }
@@ -317,6 +572,18 @@ export async function renderMarkdown(markdown, filePath, resolveWikiLink, option
317
572
  value: `[[${node.value}${alias}]]`,
318
573
  };
319
574
  });
320
- const hast = await htmlProcessor.run(tree);
321
- return { html: htmlProcessor.stringify(hast), title };
575
+ const hast = await documentTreeProcessor.run(tree);
576
+ // Attach source ranges after sanitization, before positions are discarded.
577
+ visit(hast, 'element', (node) => {
578
+ if (!/^(p|pre|li|tr|h[1-6])$/.test(node.tagName) || !node.position)
579
+ return;
580
+ node.properties['data-source-start-line'] =
581
+ node.position.start.line + (options.lineOffset ?? 0);
582
+ node.properties['data-source-end-line'] =
583
+ node.position.end.line + (options.lineOffset ?? 0);
584
+ });
585
+ return {
586
+ tree: decorateExternalSiteLinks(toViewDocumentTree(hast)),
587
+ title,
588
+ };
322
589
  }
@@ -0,0 +1,15 @@
1
+ import type { Section } from '@plebeiantech/lat.md-core/lattice-model';
2
+ import type { CreateSearchEngine } from '../search/embedder.js';
3
+ import { type IndexedSearchSession } from '../search/query.js';
4
+ import type { ViewSearchResponse } from './protocol.js';
5
+ export type PreindexedViewSearchDependencies = {
6
+ openSearchSession: (latDir: string, options: {
7
+ cacheDir?: string;
8
+ createSearchEngine?: CreateSearchEngine;
9
+ }) => Promise<IndexedSearchSession>;
10
+ };
11
+ export type PreindexedViewSearch = ((query: string) => Promise<ViewSearchResponse>) & {
12
+ close: () => Promise<void>;
13
+ };
14
+ /** Serve a built search index without importing indexing or Markdown parsers. */
15
+ export declare function createPreindexedViewSearch(latDir: string, cacheDir: string, sections: readonly Section[], documentPaths: ReadonlyMap<string, string>, dependencies?: PreindexedViewSearchDependencies, createSearchEngine?: CreateSearchEngine): Promise<PreindexedViewSearch>;
@@ -0,0 +1,25 @@
1
+ import { openIndexedSearchSession, resolveSearchMatches, } from '../search/query.js';
2
+ import { viewSearchResult } from './search-result.js';
3
+ const VIEW_SEARCH_LIMIT = 10;
4
+ /** Serve a built search index without importing indexing or Markdown parsers. */
5
+ export async function createPreindexedViewSearch(latDir, cacheDir, sections, documentPaths, dependencies = {
6
+ openSearchSession: openIndexedSearchSession,
7
+ }, createSearchEngine) {
8
+ const sectionById = new Map(sections.map((section) => [section.id.toLowerCase(), section]));
9
+ const session = await dependencies.openSearchSession(latDir, {
10
+ cacheDir,
11
+ createSearchEngine,
12
+ });
13
+ const search = async (rawQuery) => {
14
+ const query = rawQuery.trim();
15
+ if (!query)
16
+ return { query: '', results: [] };
17
+ const results = await session.search(query, VIEW_SEARCH_LIMIT);
18
+ return {
19
+ query,
20
+ results: resolveSearchMatches(results, sectionById).map((match) => viewSearchResult(latDir, match, documentPaths)),
21
+ };
22
+ };
23
+ search.close = session.close;
24
+ return search;
25
+ }
@@ -1,13 +1,24 @@
1
+ import type { SearchEvidence } from '../search/types.js';
1
2
  export type ViewGitFileStatus = 'modified' | 'new';
2
3
  export type ViewGitState = {
3
4
  files: Record<string, ViewGitFileStatus>;
4
5
  };
6
+ export type ViewExternalFile = {
7
+ handle: string;
8
+ path: string;
9
+ target: string;
10
+ };
5
11
  export type ViewIndex = {
6
12
  files: string[];
13
+ /** Authored directory-index entries, keyed by vault-relative directory ('' at root). */
14
+ directoryOrder: Record<string, string[]>;
15
+ externalFiles: ViewExternalFile[];
7
16
  entry: string;
8
17
  errorCounts: Record<string, number>;
9
18
  git: ViewGitState | null;
19
+ logoText: string;
10
20
  };
21
+ export declare const DEFAULT_VIEW_LOGO_TEXT = "lat.md";
11
22
  export type ViewDocumentError = {
12
23
  anchor: string;
13
24
  line: number;
@@ -22,32 +33,101 @@ export type ViewSearchResult = {
22
33
  breadcrumbs: string[];
23
34
  description: string;
24
35
  url: string;
36
+ rankScore: number;
37
+ introduction: string;
38
+ evidence: SearchEvidence[];
39
+ semanticSimilarity?: number;
40
+ semanticRank?: number;
41
+ lexicalRank?: number;
25
42
  };
26
43
  export type ViewSearchResponse = {
27
44
  query: string;
28
45
  results: ViewSearchResult[];
29
46
  };
30
- export type ViewProjectChange = {
47
+ import type { ViewDocumentTree } from '@plebeiantech/lat.md-core/document-tree';
48
+ export type { ViewDocumentProperty, ViewDocumentText, ViewDocumentElement, ViewDocumentNode, ViewDocumentTree, } from '@plebeiantech/lat.md-core/document-tree';
49
+ export type ViewSectionCommandOutput = {
50
+ output: string;
51
+ tree: ViewDocumentTree;
52
+ isError: boolean;
53
+ };
54
+ export type ViewProjectGeneration = {
31
55
  generation: number;
32
56
  markdownGeneration: number;
33
57
  };
58
+ export type ViewProjectChange = ViewProjectGeneration & {
59
+ instanceId: string;
60
+ };
61
+ export type ViewGraphNodeKind = 'document' | 'source' | 'code-reference';
62
+ export type ViewGraphNode = {
63
+ id: string;
64
+ kind: ViewGraphNodeKind;
65
+ label: string;
66
+ url: string;
67
+ breadcrumbs: string[];
68
+ /** Local documents sum direct backlink counts across every heading. Other nodes use incoming edge weights. */
69
+ inDegree: number;
70
+ outDegree: number;
71
+ documentPath?: string;
72
+ sectionId?: string;
73
+ sourcePath?: string;
74
+ symbol?: string;
75
+ line?: number;
76
+ snippet?: string;
77
+ externalTarget?: string;
78
+ gitStatus?: ViewGitFileStatus;
79
+ errorCount?: number;
80
+ };
81
+ export type ViewGraphEdgeKind = 'wiki' | 'markdown' | 'source' | 'code-mention';
82
+ export type ViewGraphEdge = {
83
+ id: string;
84
+ from: string;
85
+ to: string;
86
+ kind: ViewGraphEdgeKind;
87
+ weight: number;
88
+ };
89
+ export type ViewGraph = {
90
+ generation: number;
91
+ nodes: ViewGraphNode[];
92
+ edges: ViewGraphEdge[];
93
+ };
94
+ export type ViewDocumentTocItem = {
95
+ id: string;
96
+ title: string;
97
+ depth: number;
98
+ errorCount: number;
99
+ hasGitChanges: boolean;
100
+ };
34
101
  export type ViewDocument = {
35
102
  path: string;
36
103
  title: string;
37
- html: string;
38
- gitHtml: string | null;
104
+ tree: ViewDocumentTree;
105
+ gitTree: ViewDocumentTree | null;
106
+ graphNodeIds: Record<string, string>;
107
+ tableOfContents: ViewDocumentTocItem[];
39
108
  errors: ViewDocumentError[];
40
109
  backReferences: ViewSectionBackReferences[];
41
110
  frontmatter: {
42
111
  requireCodeMention: boolean;
43
112
  };
44
113
  };
114
+ export type ViewDocumentSource = {
115
+ path: string;
116
+ content: string;
117
+ };
118
+ export type ViewDocumentEditRequest = {
119
+ baseContent: string;
120
+ content: string;
121
+ };
122
+ export type ViewDocumentEditResponse = ViewDocumentSource & {
123
+ merged: boolean;
124
+ };
45
125
  export type ViewMarkdownBackReference = {
46
126
  kind: 'markdown';
47
127
  sectionId: string;
48
128
  breadcrumbs: string[];
49
129
  paragraph: string;
50
- paragraphHtml: string;
130
+ paragraphTree: ViewDocumentTree;
51
131
  url: string;
52
132
  };
53
133
  export type ViewCodeBackReference = {
@@ -67,13 +147,13 @@ export type ViewSourceReference = {
67
147
  sectionId: string;
68
148
  breadcrumbs: string[];
69
149
  paragraph: string;
70
- paragraphHtml: string;
150
+ paragraphTree: ViewDocumentTree;
71
151
  url: string;
72
152
  };
73
153
  export type ViewSourceDocument = {
74
154
  path: string;
75
155
  content: string;
76
- highlightedHtmlLines: string[];
156
+ highlightedLines: ViewDocumentTree[];
77
157
  focus: {
78
158
  symbol: string;
79
159
  kind: string;
@@ -84,6 +164,15 @@ export type ViewSourceDocument = {
84
164
  context: ViewSourceReference | null;
85
165
  otherReferences: ViewSourceReference[];
86
166
  };
167
+ export type ViewExternalDocument = {
168
+ kind: 'markdown';
169
+ target: string;
170
+ document: ViewDocument;
171
+ } | {
172
+ kind: 'source';
173
+ target: string;
174
+ source: ViewSourceDocument;
175
+ };
87
176
  export type ViewError = {
88
177
  error: string;
89
178
  };