@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
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ import { main } from './upstream-drift.js';
2
+ process.exit(main(process.argv.slice(2)));
@@ -0,0 +1,26 @@
1
+ export declare const UPSTREAM_URL = "https://github.com/vercel-labs/lat.md.git";
2
+ export declare const UPSTREAM_REF = "refs/remotes/upstream/main";
3
+ export type Drift = {
4
+ upstream: string;
5
+ ahead: number;
6
+ behind: number;
7
+ upstreamFiles: string[];
8
+ forkFiles: string[];
9
+ overlap: string[];
10
+ conflicts: string[];
11
+ mergesCleanly: boolean;
12
+ };
13
+ /**
14
+ * Conflicting paths from `git merge-tree --write-tree --name-only`, whose
15
+ * output is the written tree id, then one path per line, then a blank line
16
+ * and the human-readable log. Everything after that blank line is prose.
17
+ */
18
+ export declare function parseMergeTree(stdout: string): string[];
19
+ export declare function fetchUpstream(repo: string, url: string, ref: string): void;
20
+ export declare function analyzeDrift(opts: {
21
+ repo: string;
22
+ syncPoint: string;
23
+ upstreamRef: string;
24
+ }): Drift;
25
+ export declare function formatDrift(drift: Drift): string;
26
+ export declare function main(argv: string[]): number;