@plebeiantech/lat.md 0.12.3-fork.8 → 0.13.4-fork.1

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 (330) hide show
  1. package/README.md +27 -3
  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/fork-instructions.d.ts +1 -0
  7. package/dist/src/cli/fork-instructions.js +8 -32
  8. package/dist/src/cli/fork-scaffold.js +2 -2
  9. package/dist/src/cli/graph.d.ts +1 -1
  10. package/dist/src/cli/hook.d.ts +26 -0
  11. package/dist/src/cli/hook.js +115 -64
  12. package/dist/src/cli/index.js +147 -70
  13. package/dist/src/cli/init-preferences.d.ts +4 -0
  14. package/dist/src/cli/init-preferences.js +36 -0
  15. package/dist/src/cli/init.d.ts +2 -1
  16. package/dist/src/cli/init.js +100 -60
  17. package/dist/src/cli/reindex.d.ts +1 -1
  18. package/dist/src/cli/reindex.js +7 -10
  19. package/dist/src/cli/search.d.ts +14 -4
  20. package/dist/src/cli/search.js +115 -101
  21. package/dist/src/cli/ui-build-server.d.ts +12 -0
  22. package/dist/src/cli/ui-build-server.js +26 -0
  23. package/dist/src/cli/ui-build.d.ts +1 -1
  24. package/dist/src/cli/ui-build.js +1 -1
  25. package/dist/src/cli/ui.d.ts +1 -1
  26. package/dist/src/cli/ui.js +1 -1
  27. package/dist/src/fork/antigravity-hook.d.ts +47 -0
  28. package/dist/src/fork/antigravity-hook.js +424 -0
  29. package/dist/src/fork/antigravity-init.d.ts +17 -0
  30. package/dist/src/fork/antigravity-init.js +124 -0
  31. package/dist/src/fork/upstream-drift.js +1 -1
  32. package/dist/src/fork/upstream-guard.d.ts +1 -1
  33. package/dist/src/fork/upstream-guard.js +8 -7
  34. package/dist/src/graph-export.js +7 -7
  35. package/dist/src/knowledge/index.js +2 -2
  36. package/dist/src/mcp/server.js +34 -18
  37. package/dist/src/search/cache.d.ts +3 -0
  38. package/dist/src/search/cache.js +104 -0
  39. package/dist/src/search/chunks.d.ts +23 -0
  40. package/dist/src/search/chunks.js +200 -0
  41. package/dist/src/search/db.d.ts +28 -16
  42. package/dist/src/search/db.js +100 -40
  43. package/dist/src/search/embedder.d.ts +2 -1
  44. package/dist/src/search/embedder.js +7 -6
  45. package/dist/src/search/index.d.ts +6 -2
  46. package/dist/src/search/index.js +176 -53
  47. package/dist/src/search/lexical.d.ts +6 -0
  48. package/dist/src/search/lexical.js +36 -0
  49. package/dist/src/search/lock.d.ts +5 -0
  50. package/dist/src/search/lock.js +45 -0
  51. package/dist/src/search/query.d.ts +26 -0
  52. package/dist/src/search/query.js +103 -0
  53. package/dist/src/search/search.d.ts +16 -7
  54. package/dist/src/search/search.js +165 -21
  55. package/dist/src/search/types.d.ts +15 -0
  56. package/dist/src/view/client/assets/GraphView-D_xnk0bP.js +456 -0
  57. package/dist/src/view/client/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  58. package/dist/src/view/client/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  59. package/dist/src/view/client/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  60. package/dist/src/view/client/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  61. package/dist/src/view/client/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  62. package/dist/src/view/client/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  63. package/dist/src/view/client/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  64. package/dist/src/view/client/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  65. package/dist/src/view/client/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  66. package/dist/src/view/client/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  67. package/dist/src/view/client/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  68. package/dist/src/view/client/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  69. package/dist/src/view/client/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  70. package/dist/src/view/client/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  71. package/dist/src/view/client/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  72. package/dist/src/view/client/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  73. package/dist/src/view/client/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  74. package/dist/src/view/client/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  75. package/dist/src/view/client/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  76. package/dist/src/view/client/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  77. package/dist/src/view/client/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  78. package/dist/src/view/client/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  79. package/dist/src/view/client/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  80. package/dist/src/view/client/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  81. package/dist/src/view/client/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  82. package/dist/src/view/client/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  83. package/dist/src/view/client/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  84. package/dist/src/view/client/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  85. package/dist/src/view/client/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  86. package/dist/src/view/client/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  87. package/dist/src/view/client/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  88. package/dist/src/view/client/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  89. package/dist/src/view/client/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  90. package/dist/src/view/client/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  91. package/dist/src/view/client/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  92. package/dist/src/view/client/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  93. package/dist/src/view/client/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  94. package/dist/src/view/client/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  95. package/dist/src/view/client/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  96. package/dist/src/view/client/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  97. package/dist/src/view/client/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  98. package/dist/src/view/client/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  99. package/dist/src/view/client/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  100. package/dist/src/view/client/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  101. package/dist/src/view/client/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  102. package/dist/src/view/client/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  103. package/dist/src/view/client/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  104. package/dist/src/view/client/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  105. package/dist/src/view/client/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  106. package/dist/src/view/client/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  107. package/dist/src/view/client/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  108. package/dist/src/view/client/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  109. package/dist/src/view/client/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  110. package/dist/src/view/client/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  111. package/dist/src/view/client/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  112. package/dist/src/view/client/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  113. package/dist/src/view/client/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  114. package/dist/src/view/client/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  115. package/dist/src/view/client/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  116. package/dist/src/view/client/assets/MarkdownEditor-bjqt_FoF.js +28 -0
  117. package/dist/src/view/client/assets/OrbitControls-DwcpQNja.js +1 -0
  118. package/dist/src/view/client/assets/STLLoader-CLWTKt5i.js +1 -0
  119. package/dist/src/view/client/assets/_commonjsHelpers-CqkleIqs.js +1 -0
  120. package/dist/src/view/client/assets/abnfDiagram-VCTEODGH-kWGvtRnL.js +1 -0
  121. package/dist/src/view/client/assets/arc-BPAFd7cP.js +1 -0
  122. package/dist/src/view/client/assets/architectureDiagram-5GKGNRK7-CsY39oIR.js +36 -0
  123. package/dist/src/view/client/assets/blockDiagram-I7D4REHJ-DHGBG7BJ.js +129 -0
  124. package/dist/src/view/client/assets/c4Diagram-7LVT6UL2-vywK4eb7.js +38 -0
  125. package/dist/src/view/client/assets/channel-CX71L_qV.js +1 -0
  126. package/dist/src/view/client/assets/chunk-2Q5K7J3B-Do3Hz_ci.js +1 -0
  127. package/dist/src/view/client/assets/chunk-5VM5RSS4-B5R1lSeY.js +15 -0
  128. package/dist/src/view/client/assets/chunk-F27PBJKO-Dm55FM_W.js +1 -0
  129. package/dist/src/view/client/assets/chunk-IMKFNOWR-ChptrvvM.js +231 -0
  130. package/dist/src/view/client/assets/chunk-JWPE2WC7-BRQBjrKS.js +1 -0
  131. package/dist/src/view/client/assets/chunk-POPQ4Y6H-CainVZIL.js +1 -0
  132. package/dist/src/view/client/assets/chunk-SVP7TREG-DsKsNGmM.js +88 -0
  133. package/dist/src/view/client/assets/chunk-TICWLB2K-BctkMcJc.js +206 -0
  134. package/dist/src/view/client/assets/chunk-XXDRQBXY-BN7SgOUT.js +1 -0
  135. package/dist/src/view/client/assets/classDiagram-ZZMXUADV-B1VyU6zO.js +1 -0
  136. package/dist/src/view/client/assets/classDiagram-v2-VYDZK3BY-B1VyU6zO.js +1 -0
  137. package/dist/src/view/client/assets/cose-bilkent-JH36ORCC-BszzwrMe.js +1 -0
  138. package/dist/src/view/client/assets/cynefin-OW5HDTMX-CdRyAkPs.js +166 -0
  139. package/dist/src/view/client/assets/cynefinDiagram-5FMLGOSQ-BLvKPZ1u.js +62 -0
  140. package/dist/src/view/client/assets/cytoscape.esm-DzSz-X2X.js +321 -0
  141. package/dist/src/view/client/assets/dagre-GXQ25YYZ-V68w_l65.js +4 -0
  142. package/dist/src/view/client/assets/defaultLocale-DX6XiGOO.js +1 -0
  143. package/dist/src/view/client/assets/diagram-S7CK7UJ4-C2i4eEMg.js +30 -0
  144. package/dist/src/view/client/assets/diagram-UQ7AKVKN-BiwWh5jC.js +41 -0
  145. package/dist/src/view/client/assets/diagram-VSXAHHWV-hkKR_vyS.js +3 -0
  146. package/dist/src/view/client/assets/diagram-VX7I27RA-DzRCSMAc.js +24 -0
  147. package/dist/src/view/client/assets/diagram-Z3DM3KII-fhSFPxyK.js +24 -0
  148. package/dist/src/view/client/assets/ebnfDiagram-PWID7BFC-CCEUDKSA.js +1 -0
  149. package/dist/src/view/client/assets/erDiagram-RLTQ6QDP-FJ2IMyTi.js +99 -0
  150. package/dist/src/view/client/assets/flowDiagram-HODETNUW-BvasdLeK.js +168 -0
  151. package/dist/src/view/client/assets/ganttDiagram-EL5Y4UJY-CiwkBZvY.js +292 -0
  152. package/dist/src/view/client/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  153. package/dist/src/view/client/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  154. package/dist/src/view/client/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  155. package/dist/src/view/client/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  156. package/dist/src/view/client/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
  157. package/dist/src/view/client/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
  158. package/dist/src/view/client/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
  159. package/dist/src/view/client/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
  160. package/dist/src/view/client/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
  161. package/dist/src/view/client/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
  162. package/dist/src/view/client/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  163. package/dist/src/view/client/assets/gitGraphDiagram-WWUBYQGX-DYlP2_js.js +106 -0
  164. package/dist/src/view/client/assets/index-BnENo9bV.js +1 -0
  165. package/dist/src/view/client/assets/index-CQ7EOox7.css +1 -0
  166. package/dist/src/view/client/assets/index-CynNDkxt.js +13 -0
  167. package/dist/src/view/client/assets/infoDiagram-27XIBGKW-DRPB2c48.js +2 -0
  168. package/dist/src/view/client/assets/init-Gi6I4Gst.js +1 -0
  169. package/dist/src/view/client/assets/ishikawaDiagram-5VMMS53U-8VV429Cv.js +70 -0
  170. package/dist/src/view/client/assets/journeyDiagram-3NMN7TZE-Dzmwnf83.js +139 -0
  171. package/dist/src/view/client/assets/kanban-definition-UXKFOSKX-pYyZZ1i-.js +89 -0
  172. package/dist/src/view/client/assets/katex-HP8lGamR.js +257 -0
  173. package/dist/src/view/client/assets/layout-GF9k6yGo.js +1 -0
  174. package/dist/src/view/client/assets/linear-Yt2sSOYV.js +1 -0
  175. package/dist/src/view/client/assets/logo-RR_KBOAT.svg +149 -0
  176. package/dist/src/view/client/assets/maplibre-gl-CDX6Zuow.js +800 -0
  177. package/dist/src/view/client/assets/mermaid.core-ChWYCHN0.js +310 -0
  178. package/dist/src/view/client/assets/mindmap-definition-YA3MSWOX-Cc4fQvf1.js +96 -0
  179. package/dist/src/view/client/assets/ordinal-Cboi1Yqb.js +1 -0
  180. package/dist/src/view/client/assets/pegDiagram-XKGWAZYB-C0SsB8bZ.js +1 -0
  181. package/dist/src/view/client/assets/pieDiagram-E7YTZNPT-DIJpqERZ.js +39 -0
  182. package/dist/src/view/client/assets/quadrantDiagram-AXDQQJYC--d-gl6j-.js +7 -0
  183. package/dist/src/view/client/assets/railroadDiagram-O6MQD6OU-BQxwTt7z.js +1 -0
  184. package/dist/src/view/client/assets/requirementDiagram-BXWQKSXE-B_oTeD2A.js +84 -0
  185. package/dist/src/view/client/assets/sankeyDiagram-P5KCCOFB-DLukmE8X.js +40 -0
  186. package/dist/src/view/client/assets/sequenceDiagram-WJ2MYXX4-BNjVB2sc.js +162 -0
  187. package/dist/src/view/client/assets/sizeCapture-INFHLROL-BZecQTOw.js +1 -0
  188. package/dist/src/view/client/assets/stateDiagram-D77RDMKH-Bu1urvXC.js +1 -0
  189. package/dist/src/view/client/assets/stateDiagram-v2-MP3YSRHH-5pc_697G.js +1 -0
  190. package/dist/src/view/client/assets/swimlanes-42K2YHIH-bLAlcepB.js +1 -0
  191. package/dist/src/view/client/assets/swimlanesDiagram-VR7AAH4N-BbOpZjpp.js +8 -0
  192. package/dist/src/view/client/assets/three.module-PDSP0dbZ.js +4108 -0
  193. package/dist/src/view/client/assets/timeline-definition-24CTP7MA-tbwCNvcA.js +120 -0
  194. package/dist/src/view/client/assets/vennDiagram-4TSXK5OY-D8U8Fk0N.js +34 -0
  195. package/dist/src/view/client/assets/wardleyDiagram-VM6X3IG4-LHBVIeNb.js +78 -0
  196. package/dist/src/view/client/assets/xychartDiagram-S5SC5T6Z-CN4tfaFV.js +7 -0
  197. package/dist/src/view/client/index.html +2 -2
  198. package/dist/src/view/client-shell.d.ts +2 -0
  199. package/dist/src/view/client-shell.js +5 -0
  200. package/dist/src/view/diagnostics.d.ts +3 -2
  201. package/dist/src/view/diagnostics.js +49 -58
  202. package/dist/src/view/document-edit.d.ts +8 -0
  203. package/dist/src/view/document-edit.js +25 -0
  204. package/dist/src/view/document-route.d.ts +14 -0
  205. package/dist/src/view/document-route.js +137 -0
  206. package/dist/src/view/document-tree.d.ts +18 -0
  207. package/dist/src/view/document-tree.js +139 -0
  208. package/dist/src/view/external-document-tree.d.ts +3 -0
  209. package/dist/src/view/external-document-tree.js +674 -0
  210. package/dist/src/view/git-diff.js +202 -2
  211. package/dist/src/view/git.js +1 -1
  212. package/dist/src/view/graph.d.ts +4 -3
  213. package/dist/src/view/graph.js +100 -9
  214. package/dist/src/view/highlight.d.ts +10 -2
  215. package/dist/src/view/highlight.js +50648 -3166
  216. package/dist/src/view/markdown.d.ts +3 -2
  217. package/dist/src/view/markdown.js +256 -54
  218. package/dist/src/view/preindexed-search.d.ts +15 -0
  219. package/dist/src/view/preindexed-search.js +25 -0
  220. package/dist/src/view/protocol.d.ts +53 -7
  221. package/dist/src/view/publication.d.ts +2 -0
  222. package/dist/src/view/publication.js +78 -0
  223. package/dist/src/view/references.d.ts +11 -26
  224. package/dist/src/view/references.js +121 -112
  225. package/dist/src/view/repository.d.ts +14 -4
  226. package/dist/src/view/repository.js +260 -19
  227. package/dist/src/view/request-security.d.ts +5 -0
  228. package/dist/src/view/request-security.js +46 -0
  229. package/dist/src/view/search-result.d.ts +4 -0
  230. package/dist/src/view/search-result.js +25 -0
  231. package/dist/src/view/search.d.ts +7 -2
  232. package/dist/src/view/search.js +23 -34
  233. package/dist/src/view/server-build.d.ts +21 -0
  234. package/dist/src/view/server-build.js +145 -0
  235. package/dist/src/view/server-deployment.d.ts +31 -0
  236. package/dist/src/view/server-deployment.js +123 -0
  237. package/dist/src/view/server-index-worker.d.ts +6 -0
  238. package/dist/src/view/server-index-worker.js +14 -0
  239. package/dist/src/view/server.d.ts +11 -2
  240. package/dist/src/view/server.js +245 -73
  241. package/dist/src/view/source-target.d.ts +2 -0
  242. package/dist/src/view/source-target.js +49 -8
  243. package/dist/src/view/static-build.d.ts +18 -2
  244. package/dist/src/view/static-build.js +449 -110
  245. package/dist/src/view/static-protocol.d.ts +26 -2
  246. package/dist/src/view/static-protocol.js +5 -0
  247. package/dist/src/view/store.d.ts +20 -3
  248. package/dist/src/view/store.js +304 -48
  249. package/dist/src/view/table-of-contents.d.ts +2 -2
  250. package/dist/src/view/table-of-contents.js +2 -22
  251. package/dist/src/view/vercel-build.d.ts +24 -0
  252. package/dist/src/view/vercel-build.js +152 -0
  253. package/dist/src/view/vercel-server-build.d.ts +10 -0
  254. package/dist/src/view/vercel-server-build.js +61 -0
  255. package/dist/vendor/lat.md-server/cli.d.ts +2 -0
  256. package/dist/vendor/lat.md-server/cli.js +12 -0
  257. package/dist/vendor/lat.md-server/index.d.ts +38 -0
  258. package/dist/vendor/lat.md-server/index.js +128 -0
  259. package/package.json +68 -22
  260. package/plugins/lat-md/README.md +61 -0
  261. package/plugins/lat-md/hooks.json +38 -0
  262. package/plugins/lat-md/plugin.json +9 -0
  263. package/plugins/lat-md/rules/AGENTS.md +344 -0
  264. package/plugins/lat-md/skills/lat-md/SKILL.md +210 -0
  265. package/plugins/lat-md/skills/lat-md-conventions/SKILL.md +226 -0
  266. package/templates/AGENTS.md +26 -7
  267. package/templates/cursor-rules.md +23 -7
  268. package/templates/fork/conventions.md +133 -11
  269. package/templates/opencode-plugin.ts +9 -9
  270. package/templates/pi-extension.ts +11 -11
  271. package/templates/skill/SKILL.md +35 -3
  272. package/dist/src/cli/check-coverage.d.ts +0 -2
  273. package/dist/src/cli/check-coverage.js +0 -71
  274. package/dist/src/cli/check-frontmatter.d.ts +0 -12
  275. package/dist/src/cli/check-frontmatter.js +0 -44
  276. package/dist/src/cli/check-mode.d.ts +0 -21
  277. package/dist/src/cli/check-mode.js +0 -364
  278. package/dist/src/cli/check-status.d.ts +0 -74
  279. package/dist/src/cli/check-status.js +0 -217
  280. package/dist/src/cli/check.d.ts +0 -45
  281. package/dist/src/cli/check.js +0 -781
  282. package/dist/src/cli/context.d.ts +0 -11
  283. package/dist/src/cli/context.js +0 -58
  284. package/dist/src/cli/expand.d.ts +0 -8
  285. package/dist/src/cli/expand.js +0 -94
  286. package/dist/src/cli/gen-index.d.ts +0 -45
  287. package/dist/src/cli/gen-index.js +0 -235
  288. package/dist/src/cli/link-scheme.d.ts +0 -54
  289. package/dist/src/cli/link-scheme.js +0 -101
  290. package/dist/src/cli/locate.d.ts +0 -2
  291. package/dist/src/cli/locate.js +0 -17
  292. package/dist/src/cli/refs.d.ts +0 -22
  293. package/dist/src/cli/refs.js +0 -229
  294. package/dist/src/cli/section.d.ts +0 -43
  295. package/dist/src/cli/section.js +0 -252
  296. package/dist/src/cli/select-menu.d.ts +0 -13
  297. package/dist/src/cli/select-menu.js +0 -100
  298. package/dist/src/code-refs.d.ts +0 -17
  299. package/dist/src/code-refs.js +0 -298
  300. package/dist/src/config.d.ts +0 -29
  301. package/dist/src/config.js +0 -83
  302. package/dist/src/context.d.ts +0 -23
  303. package/dist/src/context.js +0 -11
  304. package/dist/src/extensions/wiki-link/from-markdown.d.ts +0 -5
  305. package/dist/src/extensions/wiki-link/from-markdown.js +0 -34
  306. package/dist/src/extensions/wiki-link/index.d.ts +0 -4
  307. package/dist/src/extensions/wiki-link/index.js +0 -3
  308. package/dist/src/extensions/wiki-link/syntax.d.ts +0 -14
  309. package/dist/src/extensions/wiki-link/syntax.js +0 -121
  310. package/dist/src/extensions/wiki-link/to-markdown.d.ts +0 -5
  311. package/dist/src/extensions/wiki-link/to-markdown.js +0 -28
  312. package/dist/src/extensions/wiki-link/types.d.ts +0 -34
  313. package/dist/src/format.d.ts +0 -8
  314. package/dist/src/format.js +0 -43
  315. package/dist/src/init-version.d.ts +0 -10
  316. package/dist/src/init-version.js +0 -49
  317. package/dist/src/lattice.d.ts +0 -109
  318. package/dist/src/lattice.js +0 -817
  319. package/dist/src/parser.d.ts +0 -3
  320. package/dist/src/parser.js +0 -18
  321. package/dist/src/source-parser.d.ts +0 -27
  322. package/dist/src/source-parser.js +0 -916
  323. package/dist/src/untrusted.d.ts +0 -18
  324. package/dist/src/untrusted.js +0 -93
  325. package/dist/src/view/client/assets/index-VZwPPiFE.js +0 -334
  326. package/dist/src/view/client/assets/index-W8ktvNj9.css +0 -1
  327. package/dist/src/view/client/assets/logo-CNF8zs47.svg +0 -182
  328. package/dist/src/walk.d.ts +0 -18
  329. package/dist/src/walk.js +0 -27
  330. /package/dist/src/{extensions/wiki-link → search}/types.js +0 -0
@@ -0,0 +1,424 @@
1
+ import { existsSync, openSync, readSync, closeSync, statSync } from 'node:fs';
2
+ import { dirname, isAbsolute, resolve } from 'node:path';
3
+ import { findLatticeDir, findSections, } from '@plebeiantech/lat.md-core/lattice';
4
+ import { commandProjectAnalysis } from '@plebeiantech/lat.md-core/project-analysis';
5
+ import { plainStyler, } from '@plebeiantech/lat.md-core/context';
6
+ import { expandPrompt } from '@plebeiantech/lat.md-core/cli/expand';
7
+ import { runSearch } from '../cli/search.js';
8
+ import { getSection, formatSectionOutput, } from '@plebeiantech/lat.md-core/cli/section';
9
+ import { getStopStatus, formatStopReason, } from '../cli/hook.js';
10
+ import { computeCommentBlock } from '../cli/comment-guard.js';
11
+ import { taggedDocsForFiles, federateTags } from '../knowledge/index.js';
12
+ import { loadSessionMarkers, saveSessionMarkers, } from '../knowledge/session.js';
13
+ async function readStdin(timeoutMs = 300) {
14
+ if (process.stdin.isTTY)
15
+ return '';
16
+ return new Promise((resolve) => {
17
+ const chunks = [];
18
+ let timer = null;
19
+ const cleanup = () => {
20
+ if (timer)
21
+ clearTimeout(timer);
22
+ try {
23
+ process.stdin.pause();
24
+ }
25
+ catch { }
26
+ process.stdin.removeListener('data', onData);
27
+ process.stdin.removeListener('end', onEnd);
28
+ process.stdin.removeListener('error', onError);
29
+ };
30
+ const onData = (chunk) => {
31
+ chunks.push(chunk);
32
+ };
33
+ const onEnd = () => {
34
+ cleanup();
35
+ resolve(Buffer.concat(chunks).toString('utf-8'));
36
+ };
37
+ const onError = () => {
38
+ cleanup();
39
+ resolve(Buffer.concat(chunks).toString('utf-8'));
40
+ };
41
+ timer = setTimeout(() => {
42
+ cleanup();
43
+ resolve(Buffer.concat(chunks).toString('utf-8'));
44
+ }, timeoutMs);
45
+ process.stdin.on('data', onData);
46
+ process.stdin.on('end', onEnd);
47
+ process.stdin.on('error', onError);
48
+ process.stdin.resume();
49
+ });
50
+ }
51
+ export function extractLastUserPrompt(transcriptPath) {
52
+ if (!transcriptPath || !existsSync(transcriptPath))
53
+ return null;
54
+ let fd = null;
55
+ try {
56
+ const stat = statSync(transcriptPath);
57
+ if (stat.size === 0)
58
+ return null;
59
+ fd = openSync(transcriptPath, 'r');
60
+ const chunkSize = Math.min(64 * 1024, stat.size);
61
+ const buffer = Buffer.alloc(chunkSize);
62
+ readSync(fd, buffer, 0, chunkSize, stat.size - chunkSize);
63
+ closeSync(fd);
64
+ fd = null;
65
+ const chunkStr = buffer.toString('utf-8');
66
+ const lines = chunkStr.trim().split('\n');
67
+ for (let i = lines.length - 1; i >= 0; i--) {
68
+ const line = lines[i].trim();
69
+ if (!line)
70
+ continue;
71
+ const entry = JSON.parse(line);
72
+ const isUser = entry.type === 'USER_INPUT' ||
73
+ entry.type === 'user' ||
74
+ entry.role === 'user';
75
+ if (isUser) {
76
+ if (typeof entry.content === 'string')
77
+ return entry.content;
78
+ if (typeof entry.text === 'string')
79
+ return entry.text;
80
+ if (typeof entry.message === 'string')
81
+ return entry.message;
82
+ if (Array.isArray(entry.content)) {
83
+ const text = entry.content
84
+ .map((p) => typeof p === 'string'
85
+ ? p
86
+ : (p?.text ??
87
+ p?.content ??
88
+ ''))
89
+ .filter(Boolean)
90
+ .join('\n');
91
+ if (text)
92
+ return text;
93
+ }
94
+ if (Array.isArray(entry.parts)) {
95
+ const text = entry.parts
96
+ .map((p) => typeof p === 'string'
97
+ ? p
98
+ : (p?.text ??
99
+ p?.content ??
100
+ ''))
101
+ .filter(Boolean)
102
+ .join('\n');
103
+ if (text)
104
+ return text;
105
+ }
106
+ }
107
+ }
108
+ }
109
+ catch {
110
+ }
111
+ finally {
112
+ if (fd !== null) {
113
+ try {
114
+ closeSync(fd);
115
+ }
116
+ catch { }
117
+ }
118
+ }
119
+ return null;
120
+ }
121
+ function makeHookCtx(latDir) {
122
+ return {
123
+ latDir,
124
+ projectRoot: dirname(latDir),
125
+ styler: plainStyler,
126
+ mode: 'cli',
127
+ };
128
+ }
129
+ export async function handleAntigravityPreInvocation(rawInput, writeOutput = true) {
130
+ const emptyOutput = { injectSteps: [] };
131
+ try {
132
+ const raw = rawInput ?? (await readStdin().catch(() => ''));
133
+ let input = {};
134
+ try {
135
+ input = JSON.parse(raw);
136
+ }
137
+ catch { }
138
+ const userPrompt = input.user_prompt ||
139
+ input.prompt ||
140
+ input.userPrompt ||
141
+ extractLastUserPrompt(input.transcriptPath) ||
142
+ '';
143
+ const workspacePaths = input.workspacePaths ??
144
+ input.workspace_paths;
145
+ const latDir = findLatticeDir(workspacePaths?.[0]) ?? findLatticeDir();
146
+ if (!latDir) {
147
+ if (writeOutput)
148
+ process.stdout.write(JSON.stringify(emptyOutput) + '\n');
149
+ return emptyOutput;
150
+ }
151
+ const ctx = makeHookCtx(latDir);
152
+ const parts = [];
153
+ const searchFilePaths = [];
154
+ if (userPrompt) {
155
+ // Memoised on ctx, so the expansion, search, and federation below
156
+ // share one parse of the tree — same contract as cli/hook.ts.
157
+ const allSections = await commandProjectAnalysis(ctx)
158
+ .then((analysis) => analysis.allSections)
159
+ .catch(() => []);
160
+ if (/\[\[[^\]]+\]\]/.test(userPrompt)) {
161
+ try {
162
+ const expanded = await expandPrompt(ctx, userPrompt);
163
+ if (expanded && expanded !== userPrompt) {
164
+ parts.push(expanded, '');
165
+ }
166
+ }
167
+ catch { }
168
+ }
169
+ try {
170
+ const searchResult = await runSearch(ctx.latDir, userPrompt, 5, undefined, {
171
+ buildIndex: false,
172
+ });
173
+ if (searchResult.matches.length > 0) {
174
+ parts.push(`Search results for user prompt (${searchResult.matches.length} matches):`, '');
175
+ for (const match of searchResult.matches) {
176
+ searchFilePaths.push(match.section.filePath);
177
+ const sectionResult = await getSection(ctx, match.section.id);
178
+ if (sectionResult.kind === 'found') {
179
+ parts.push(formatSectionOutput(ctx, sectionResult));
180
+ parts.push('');
181
+ }
182
+ }
183
+ }
184
+ }
185
+ catch { }
186
+ try {
187
+ const filePaths = [];
188
+ const refTargets = [...userPrompt.matchAll(/\[\[([^\]]+)\]\]/g)].map((m) => m[1]);
189
+ for (const target of refTargets) {
190
+ const matches = findSections(allSections, target);
191
+ if (matches.length > 0) {
192
+ filePaths.push(matches[0].section.filePath);
193
+ }
194
+ }
195
+ filePaths.push(...searchFilePaths);
196
+ if (filePaths.length > 0) {
197
+ const docs = await taggedDocsForFiles(ctx.projectRoot, filePaths);
198
+ const sessionId = input.conversationId ??
199
+ input.conversation_id ??
200
+ input.session_id ??
201
+ '';
202
+ const sessionMarkers = loadSessionMarkers(sessionId);
203
+ const federated = await federateTags(docs, {
204
+ projectRoot: ctx.projectRoot,
205
+ seen: sessionMarkers.markers.seen,
206
+ attemptedEmpty: sessionMarkers.markers.attemptedEmpty,
207
+ });
208
+ saveSessionMarkers(sessionMarkers);
209
+ if (federated) {
210
+ parts.push('', federated);
211
+ }
212
+ }
213
+ }
214
+ catch { }
215
+ }
216
+ parts.push('Review whether `lat.md/` needs a current-state update; do not add journal/changelog notes just to satisfy this reminder. Run `lat search` to find relevant sections and `lat check` at the end.');
217
+ const output = {
218
+ injectSteps: [
219
+ {
220
+ ephemeralMessage: parts.join('\n').trim(),
221
+ },
222
+ ],
223
+ };
224
+ if (writeOutput) {
225
+ process.stdout.write(JSON.stringify(output) + '\n');
226
+ }
227
+ return output;
228
+ }
229
+ catch {
230
+ if (writeOutput) {
231
+ process.stdout.write(JSON.stringify(emptyOutput) + '\n');
232
+ }
233
+ return emptyOutput;
234
+ }
235
+ }
236
+ export async function handleAntigravityPreToolUse(rawInput, writeOutput = true) {
237
+ const allow = { decision: 'allow' };
238
+ try {
239
+ const raw = rawInput ?? (await readStdin().catch(() => ''));
240
+ let input = {};
241
+ try {
242
+ input = JSON.parse(raw);
243
+ }
244
+ catch {
245
+ if (writeOutput)
246
+ process.stdout.write(JSON.stringify(allow) + '\n');
247
+ return allow;
248
+ }
249
+ const rawToolName = input.toolCall?.name ?? '';
250
+ const toolName = rawToolName.split(':').pop() ?? rawToolName;
251
+ const args = input.toolCall?.args ?? {};
252
+ let toolInput = {};
253
+ if (toolName === 'replace_file_content') {
254
+ toolInput = {
255
+ file_path: (args.TargetFile ??
256
+ args.target_file ??
257
+ args.filePath ??
258
+ args.file_path),
259
+ new_string: (args.ReplacementContent ??
260
+ args.replacement_content ??
261
+ args.new_string),
262
+ old_string: (args.TargetContent ??
263
+ args.target_content ??
264
+ args.old_string),
265
+ };
266
+ }
267
+ else if (toolName === 'write_to_file') {
268
+ toolInput = {
269
+ file_path: (args.TargetFile ??
270
+ args.target_file ??
271
+ args.filePath ??
272
+ args.file_path),
273
+ content: (args.CodeContent ?? args.code_content ?? args.content),
274
+ };
275
+ }
276
+ else {
277
+ if (writeOutput)
278
+ process.stdout.write(JSON.stringify(allow) + '\n');
279
+ return allow;
280
+ }
281
+ const cwd = input.workspacePaths?.[0] ??
282
+ input.workspace_paths?.[0] ??
283
+ process.cwd();
284
+ if (!toolInput.file_path) {
285
+ if (writeOutput)
286
+ process.stdout.write(JSON.stringify(allow) + '\n');
287
+ return allow;
288
+ }
289
+ if (!isAbsolute(toolInput.file_path)) {
290
+ toolInput.file_path = resolve(cwd, toolInput.file_path);
291
+ }
292
+ const reason = computeCommentBlock({
293
+ tool_name: toolName === 'replace_file_content' ? 'Edit' : 'Write',
294
+ tool_input: toolInput,
295
+ cwd,
296
+ });
297
+ if (reason) {
298
+ const deny = {
299
+ decision: 'deny',
300
+ reason,
301
+ };
302
+ if (writeOutput)
303
+ process.stdout.write(JSON.stringify(deny) + '\n');
304
+ return deny;
305
+ }
306
+ if (writeOutput)
307
+ process.stdout.write(JSON.stringify(allow) + '\n');
308
+ return allow;
309
+ }
310
+ catch {
311
+ if (writeOutput)
312
+ process.stdout.write(JSON.stringify(allow) + '\n');
313
+ return allow;
314
+ }
315
+ }
316
+ export async function handleAntigravityPostToolUse(rawInput, writeOutput = true) {
317
+ const output = {};
318
+ try {
319
+ const raw = rawInput ?? (await readStdin().catch(() => ''));
320
+ let input = {};
321
+ try {
322
+ input = JSON.parse(raw);
323
+ }
324
+ catch { }
325
+ const workspacePath = input.workspacePaths?.[0] ??
326
+ input.workspace_paths?.[0] ??
327
+ input.cwd;
328
+ const latDir = findLatticeDir(workspacePath) ?? findLatticeDir();
329
+ if (latDir) {
330
+ try {
331
+ const { checkIndex } = await import('@plebeiantech/lat.md-core/cli/check');
332
+ await checkIndex(latDir, undefined, { fix: true });
333
+ }
334
+ catch { }
335
+ }
336
+ }
337
+ catch { }
338
+ if (writeOutput) {
339
+ process.stdout.write(JSON.stringify(output) + '\n');
340
+ }
341
+ return output;
342
+ }
343
+ export async function handleAntigravityStop(rawInput, writeOutput = true) {
344
+ const allowStop = {};
345
+ try {
346
+ const raw = rawInput ?? (await readStdin().catch(() => ''));
347
+ let input = {};
348
+ try {
349
+ input = JSON.parse(raw);
350
+ }
351
+ catch { }
352
+ const workspacePath = input.workspacePaths?.[0] ??
353
+ input.workspace_paths?.[0] ??
354
+ input.cwd;
355
+ const latDir = findLatticeDir(workspacePath) ?? findLatticeDir();
356
+ if (!latDir) {
357
+ if (writeOutput)
358
+ process.stdout.write(JSON.stringify(allowStop) + '\n');
359
+ return allowStop;
360
+ }
361
+ const execNum = typeof input.executionNum === 'number'
362
+ ? input.executionNum
363
+ : typeof input.execution_num === 'number'
364
+ ? input.execution_num
365
+ : undefined;
366
+ const stopHookActive = Boolean(input.stop_hook_active ||
367
+ input.stopHookActive ||
368
+ (execNum !== undefined && execNum > 1));
369
+ let status;
370
+ try {
371
+ status = await getStopStatus(latDir);
372
+ }
373
+ catch {
374
+ if (writeOutput)
375
+ process.stdout.write(JSON.stringify(allowStop) + '\n');
376
+ return allowStop;
377
+ }
378
+ const reason = formatStopReason(status);
379
+ if (!reason) {
380
+ if (writeOutput)
381
+ process.stdout.write(JSON.stringify(allowStop) + '\n');
382
+ return allowStop;
383
+ }
384
+ if (stopHookActive) {
385
+ console.error('Warning: `lat check` still reports errors or sync gaps, but continuing stop to prevent loop.');
386
+ if (writeOutput)
387
+ process.stdout.write(JSON.stringify(allowStop) + '\n');
388
+ return allowStop;
389
+ }
390
+ const output = {
391
+ decision: 'continue',
392
+ reason,
393
+ };
394
+ if (writeOutput)
395
+ process.stdout.write(JSON.stringify(output) + '\n');
396
+ return output;
397
+ }
398
+ catch {
399
+ if (writeOutput)
400
+ process.stdout.write(JSON.stringify(allowStop) + '\n');
401
+ return allowStop;
402
+ }
403
+ }
404
+ export async function handleAntigravityHook(event, rawInput) {
405
+ const normalized = event.toLowerCase();
406
+ switch (normalized) {
407
+ case 'preinvocation':
408
+ case 'userpromptsubmit':
409
+ await handleAntigravityPreInvocation(rawInput);
410
+ return;
411
+ case 'pretooluse':
412
+ await handleAntigravityPreToolUse(rawInput);
413
+ return;
414
+ case 'posttooluse':
415
+ await handleAntigravityPostToolUse(rawInput);
416
+ return;
417
+ case 'stop':
418
+ await handleAntigravityStop(rawInput);
419
+ return;
420
+ default:
421
+ console.error(`Unknown hook event for antigravity: ${event}. Supported: PreInvocation, PreToolUse, PostToolUse, Stop`);
422
+ process.exit(1);
423
+ }
424
+ }
@@ -0,0 +1,17 @@
1
+ export declare function antigravityHooksTemplate(latBin: string): string;
2
+ export declare function mergeAntigravityHooks(existingRaw: string | null, latBin: string): string;
3
+ export type SetupAntigravityOptions = {
4
+ root: string;
5
+ latDir: string;
6
+ template: string;
7
+ hashes: Record<string, string>;
8
+ ask: (message: string) => Promise<boolean>;
9
+ style: 'global' | 'local' | 'npx';
10
+ latBin: string;
11
+ appendTemplateSection: (root: string, latDir: string, relPath: string, template: string, label: string, indent: string, ask: (message: string) => Promise<boolean>) => Promise<string | null>;
12
+ writeTemplateFile: (root: string, latDir: string, relPath: string, template: string, genTarget: string | null, label: string, indent: string, ask: (message: string) => Promise<boolean>) => Promise<string | null>;
13
+ ensureGitignored: (root: string, entry: string) => void;
14
+ hasMcpServer: (root: string, configPath: string, key: string) => boolean;
15
+ addMcpServer: (root: string, configPath: string, key: string, style: 'global' | 'local' | 'npx') => void;
16
+ };
17
+ export declare function setupAntigravity(opts: SetupAntigravityOptions): Promise<void>;
@@ -0,0 +1,124 @@
1
+ import { readFileSync, existsSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { styleText } from 'node:util';
4
+ import { readSkillTemplate } from '../cli/gen.js';
5
+ import { readForkConventions, SKILL_FRONTMATTER, } from '../cli/fork-instructions.js';
6
+ export function antigravityHooksTemplate(latBin) {
7
+ return (JSON.stringify({
8
+ 'lat-md': {
9
+ PreInvocation: [
10
+ {
11
+ type: 'command',
12
+ command: `${latBin} hook antigravity PreInvocation`,
13
+ },
14
+ ],
15
+ PreToolUse: [
16
+ {
17
+ matcher: 'replace_file_content|write_to_file',
18
+ hooks: [
19
+ {
20
+ type: 'command',
21
+ command: `${latBin} hook antigravity PreToolUse`,
22
+ },
23
+ ],
24
+ },
25
+ ],
26
+ PostToolUse: [
27
+ {
28
+ matcher: 'replace_file_content|write_to_file',
29
+ hooks: [
30
+ {
31
+ type: 'command',
32
+ command: `${latBin} hook antigravity PostToolUse`,
33
+ },
34
+ ],
35
+ },
36
+ ],
37
+ Stop: [
38
+ {
39
+ type: 'command',
40
+ command: `${latBin} hook antigravity Stop`,
41
+ },
42
+ ],
43
+ },
44
+ }, null, 2) + '\n');
45
+ }
46
+ export function mergeAntigravityHooks(existingRaw, latBin) {
47
+ let config = {};
48
+ if (existingRaw) {
49
+ try {
50
+ const parsed = JSON.parse(existingRaw);
51
+ if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
52
+ config = parsed;
53
+ }
54
+ }
55
+ catch {
56
+ try {
57
+ const stripped = existingRaw
58
+ .replace(/\/\*[\s\S]*?\*\//g, '')
59
+ .replace(/\/\/.*/g, '')
60
+ .replace(/,\s*([}\]])/g, '$1');
61
+ const parsed = JSON.parse(stripped);
62
+ if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
63
+ config = parsed;
64
+ }
65
+ }
66
+ catch {
67
+ config = {};
68
+ }
69
+ }
70
+ }
71
+ const template = JSON.parse(antigravityHooksTemplate(latBin));
72
+ config['lat-md'] = template['lat-md'];
73
+ return JSON.stringify(config, null, 2) + '\n';
74
+ }
75
+ export async function setupAntigravity(opts) {
76
+ const { root, latDir, template, hashes, ask, style, latBin, appendTemplateSection, writeTemplateFile, ensureGitignored, hasMcpServer, addMcpServer, } = opts;
77
+ const geminiHash = await appendTemplateSection(root, latDir, 'GEMINI.md', template, 'GEMINI.md', ' ', ask);
78
+ if (geminiHash)
79
+ hashes['GEMINI.md'] = geminiHash;
80
+ console.log('');
81
+ console.log(styleText('dim', ' Antigravity hooks inject lat.md reminders into prompts, enforce the'));
82
+ console.log(styleText('dim', ' comment convention on edits, and block finishing on check failures.'));
83
+ const existingHooksPath = join(root, '.agents/hooks.json');
84
+ let hooksContent;
85
+ if (existsSync(existingHooksPath)) {
86
+ try {
87
+ const existingRaw = readFileSync(existingHooksPath, 'utf-8');
88
+ hooksContent = mergeAntigravityHooks(existingRaw, latBin);
89
+ }
90
+ catch {
91
+ hooksContent = antigravityHooksTemplate(latBin);
92
+ }
93
+ }
94
+ else {
95
+ hooksContent = antigravityHooksTemplate(latBin);
96
+ }
97
+ const hooksHash = await writeTemplateFile(root, latDir, '.agents/hooks.json', hooksContent, null, 'Hooks (.agents/hooks.json)', ' ', ask);
98
+ if (hooksHash)
99
+ hashes['.agents/hooks.json'] = hooksHash;
100
+ console.log('');
101
+ console.log(styleText('dim', ' The lat-md skills teach the agent how to write and maintain lat.md/ files.'));
102
+ const skillTemplate = readSkillTemplate();
103
+ const skillHash = await writeTemplateFile(root, latDir, '.agents/skills/lat-md/SKILL.md', skillTemplate, 'skill.md', 'Skill (.agents/skills/lat-md/SKILL.md)', ' ', ask);
104
+ if (skillHash)
105
+ hashes['.agents/skills/lat-md/SKILL.md'] = skillHash;
106
+ try {
107
+ const conventionsSkill = `${SKILL_FRONTMATTER}${readForkConventions()}`;
108
+ const conventionsHash = await writeTemplateFile(root, latDir, '.agents/skills/lat-md-conventions/SKILL.md', conventionsSkill, 'skill.md', 'Skill (.agents/skills/lat-md-conventions/SKILL.md)', ' ', ask);
109
+ if (conventionsHash) {
110
+ hashes['.agents/skills/lat-md-conventions/SKILL.md'] = conventionsHash;
111
+ }
112
+ }
113
+ catch { }
114
+ ensureGitignored(root, '.gemini');
115
+ const mcpPath = join(root, '.mcp.json');
116
+ if (hasMcpServer(root, mcpPath, 'mcpServers')) {
117
+ console.log(styleText('green', ' MCP server') + ' already configured');
118
+ }
119
+ else {
120
+ addMcpServer(root, mcpPath, 'mcpServers', style);
121
+ console.log(styleText('green', ' MCP server') + ' registered in .mcp.json');
122
+ }
123
+ ensureGitignored(root, '.mcp.json');
124
+ }
@@ -63,7 +63,7 @@ export function fetchUpstream(repo, url, ref) {
63
63
  throw new Error(`fetching ${url} failed: ${result.stderr.trim()}`);
64
64
  }
65
65
  }
66
- // @lat: [[fork#Watching the drift]]
66
+ // @lat: [[upstream-guard#The upstream guard#Watching the drift]]
67
67
  export function analyzeDrift(opts) {
68
68
  const root = repoRoot(opts.repo);
69
69
  const head = git(root, ['rev-parse', 'HEAD']).stdout.trim();
@@ -1,7 +1,7 @@
1
1
  export declare const SYNC_POINT_FILE = "fork-upstream-sync-point";
2
2
  /**
3
3
  * The commit this fork was originally cut from. It is not the guard's
4
- * baseline — see [[fork#The upstream guard#The sync point]] for why a frozen
4
+ * baseline — see [[upstream-guard#The upstream guard#The sync point]] for why a frozen
5
5
  * one cannot tell the fork's changes from upstream's.
6
6
  */
7
7
  export declare const ORIGINAL_FORK_POINT = "65d2f5b220853b2b10dca3de18d511f575bc12c7";
@@ -1,15 +1,15 @@
1
1
  import { spawnSync } from 'node:child_process';
2
2
  import { existsSync, readFileSync, writeFileSync } from 'node:fs';
3
3
  import { isAbsolute, resolve } from 'node:path';
4
- // @lat: [[fork#The upstream guard]]
4
+ // @lat: [[upstream-guard#The upstream guard]]
5
5
  export const SYNC_POINT_FILE = 'fork-upstream-sync-point';
6
6
  /**
7
7
  * The commit this fork was originally cut from. It is not the guard's
8
- * baseline — see [[fork#The upstream guard#The sync point]] for why a frozen
8
+ * baseline — see [[upstream-guard#The upstream guard#The sync point]] for why a frozen
9
9
  * one cannot tell the fork's changes from upstream's.
10
10
  */
11
11
  export const ORIGINAL_FORK_POINT = '65d2f5b220853b2b10dca3de18d511f575bc12c7';
12
- // @lat: [[fork#The upstream guard#The allowlist]]
12
+ // @lat: [[upstream-guard#The upstream guard#The allowlist]]
13
13
  export const ALLOWLIST_FILE = 'fork-upstream-allowlist.tsv';
14
14
  export const REASON_PLACEHOLDER = 'TODO';
15
15
  const ALLOWLIST_HEADER = [
@@ -188,7 +188,7 @@ export function upstreamPaths(repo, rev, paths) {
188
188
  }
189
189
  return out;
190
190
  }
191
- // @lat: [[fork#The upstream guard#The sync point]]
191
+ // @lat: [[upstream-guard#The upstream guard#The sync point]]
192
192
  export function parseSyncPoint(text) {
193
193
  for (const raw of text.split('\n')) {
194
194
  const line = raw.replace(/\r$/, '').trim();
@@ -210,13 +210,14 @@ export function renderSyncPoint(previous, rev) {
210
210
  return `${kept}\n\n${rev}\n`;
211
211
  }
212
212
  export function isAncestorOfHead(repo, rev) {
213
- return git(repo, ['merge-base', '--is-ancestor', rev, 'HEAD']).status === 0;
213
+ return (git(repo, ['merge-base', '--is-ancestor', rev, 'HEAD']).status === 0 ||
214
+ git(repo, ['merge-base', '--is-ancestor', rev, 'MERGE_HEAD']).status === 0);
214
215
  }
215
216
  export function isShallow(repo) {
216
217
  const result = git(repo, ['rev-parse', '--is-shallow-repository']);
217
218
  return result.stdout.trim() === 'true';
218
219
  }
219
- // @lat: [[fork#The upstream guard#Running it in CI]]
220
+ // @lat: [[upstream-guard#The upstream guard#Running it in CI]]
220
221
  export function fetchSyncPoint(repo, rev) {
221
222
  const result = git(repo, ['fetch', '--no-tags', '--depth=1', 'origin', rev]);
222
223
  return result.status === 0 && hasCommit(repo, rev);
@@ -317,7 +318,7 @@ export function runGuard(options) {
317
318
  warnings: result.warnings,
318
319
  };
319
320
  }
320
- // @lat: [[fork#The upstream guard#The sync point]]
321
+ // @lat: [[upstream-guard#The upstream guard#The sync point]]
321
322
  function recordSyncPoint(repo, file, rev) {
322
323
  const resolved = git(repo, ['rev-parse', `${rev}^{commit}`]);
323
324
  if (resolved.status !== 0) {
@@ -11,12 +11,12 @@ import { execFile } from 'node:child_process';
11
11
  import { createHash } from 'node:crypto';
12
12
  import { join, relative } from 'node:path';
13
13
  import { promisify } from 'node:util';
14
- import { extractRefs, buildFileIndex, buildSectionSlugIndex, parseSections, parseFrontmatter, resolveRef, } from './lattice.js';
15
- import { scanCodeRefs } from './code-refs.js';
16
- import { DIATAXIS_MODES, MODE_DIRS } from './cli/check-mode.js';
17
- import { readProvenance } from './cli/check-status.js';
18
- import { cleanUntrustedId } from './untrusted.js';
19
- import { toPosix } from './walk.js';
14
+ import { extractRefs, buildFileIndex, buildSectionSlugIndex, parseSections, parseFrontmatter, resolveRef, } from '@plebeiantech/lat.md-core/lattice';
15
+ import { scanCodeRefs } from '@plebeiantech/lat.md-core/code-refs';
16
+ import { DIATAXIS_MODES, MODE_DIRS, } from '@plebeiantech/lat.md-core/cli/check-mode';
17
+ import { readProvenance } from '@plebeiantech/lat.md-core/cli/check-status';
18
+ import { cleanUntrustedId } from '@plebeiantech/lat.md-core/untrusted';
19
+ import { toPosix } from '@plebeiantech/lat.md-core/path';
20
20
  const execFileAsync = promisify(execFile);
21
21
  /** Bytes. Node's `execFile` default is 1 MB, which a large document exceeds. */
22
22
  const GIT_MAX_BUFFER = 256 * 1024 * 1024;
@@ -192,7 +192,7 @@ export async function buildGraph(files, projectRoot, includeCode) {
192
192
  }
193
193
  /** Read the working tree's lat.md files straight off disk. */
194
194
  export async function loadWorkingTreeFiles(latticeDir, projectRoot) {
195
- const { listLatticeFiles } = await import('./lattice.js');
195
+ const { listLatticeFiles } = await import('@plebeiantech/lat.md-core/lattice');
196
196
  const { readFile } = await import('node:fs/promises');
197
197
  const paths = await listLatticeFiles(latticeDir);
198
198
  const files = [];
@@ -1,7 +1,7 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import { join } from 'node:path';
3
- import { parseFrontmatter } from '../lattice.js';
4
- import { UNTRUSTED_NOTICE, quoteUntrusted, cleanUntrustedId, } from '../untrusted.js';
3
+ import { parseFrontmatter } from '@plebeiantech/lat.md-core/lattice';
4
+ import { UNTRUSTED_NOTICE, quoteUntrusted, cleanUntrustedId, } from '@plebeiantech/lat.md-core/untrusted';
5
5
  import { tagsToTerms, capHits } from './ranking.js';
6
6
  const STORE_GROUP_LABELS = {
7
7
  cq: 'cq:',