@plebeiantech/lat.md 0.12.3-fork.13 → 0.12.3-fork.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (278) hide show
  1. package/README.md +24 -0
  2. package/dist/src/cli/check-context.d.ts +56 -0
  3. package/dist/src/cli/check-context.js +215 -0
  4. package/dist/src/cli/check-coverage.js +9 -5
  5. package/dist/src/cli/check-frontmatter.js +1 -1
  6. package/dist/src/cli/check-mode.js +1 -1
  7. package/dist/src/cli/check-status.js +1 -1
  8. package/dist/src/cli/check.d.ts +19 -12
  9. package/dist/src/cli/check.js +259 -206
  10. package/dist/src/cli/context.js +1 -1
  11. package/dist/src/cli/expand.d.ts +1 -2
  12. package/dist/src/cli/expand.js +52 -5
  13. package/dist/src/cli/external.d.ts +11 -0
  14. package/dist/src/cli/external.js +185 -0
  15. package/dist/src/cli/fork-instructions.d.ts +1 -0
  16. package/dist/src/cli/fork-instructions.js +3 -2
  17. package/dist/src/cli/hook.d.ts +26 -0
  18. package/dist/src/cli/hook.js +112 -40
  19. package/dist/src/cli/index.js +55 -3
  20. package/dist/src/cli/init.d.ts +1 -0
  21. package/dist/src/cli/init.js +40 -2
  22. package/dist/src/cli/locate.js +4 -3
  23. package/dist/src/cli/refs.d.ts +2 -1
  24. package/dist/src/cli/refs.js +88 -43
  25. package/dist/src/cli/reindex.js +2 -1
  26. package/dist/src/cli/search.d.ts +12 -3
  27. package/dist/src/cli/search.js +45 -49
  28. package/dist/src/cli/section.d.ts +3 -1
  29. package/dist/src/cli/section.js +114 -38
  30. package/dist/src/code-refs.d.ts +17 -5
  31. package/dist/src/code-refs.js +246 -65
  32. package/dist/src/context.d.ts +3 -0
  33. package/dist/src/document-formats.d.ts +7 -0
  34. package/dist/src/document-formats.js +39 -0
  35. package/dist/src/extensions/alert-marker.d.ts +25 -0
  36. package/dist/src/extensions/alert-marker.js +55 -0
  37. package/dist/src/external-documents.d.ts +56 -0
  38. package/dist/src/external-documents.js +404 -0
  39. package/dist/src/external-sources.d.ts +136 -0
  40. package/dist/src/external-sources.js +1098 -0
  41. package/dist/src/fork/antigravity-hook.d.ts +47 -0
  42. package/dist/src/fork/antigravity-hook.js +424 -0
  43. package/dist/src/fork/antigravity-init.d.ts +17 -0
  44. package/dist/src/fork/antigravity-init.js +124 -0
  45. package/dist/src/fork/frontmatter-fields.d.ts +36 -0
  46. package/dist/src/fork/frontmatter-fields.js +23 -0
  47. package/dist/src/format.d.ts +5 -2
  48. package/dist/src/format.js +8 -3
  49. package/dist/src/graph-export.js +1 -1
  50. package/dist/src/lattice-model.d.ts +77 -0
  51. package/dist/src/lattice-model.js +464 -0
  52. package/dist/src/lattice.d.ts +9 -104
  53. package/dist/src/lattice.js +69 -516
  54. package/dist/src/markdown-analysis-cache.d.ts +20 -0
  55. package/dist/src/markdown-analysis-cache.js +139 -0
  56. package/dist/src/markdown-analysis-worker.d.ts +16 -0
  57. package/dist/src/markdown-analysis-worker.js +33 -0
  58. package/dist/src/markdown-analysis.d.ts +50 -0
  59. package/dist/src/markdown-analysis.js +139 -0
  60. package/dist/src/markdown-analyzer-loader.d.ts +4 -0
  61. package/dist/src/markdown-analyzer-loader.js +13 -0
  62. package/dist/src/markdown-validation.d.ts +25 -0
  63. package/dist/src/markdown-validation.js +104 -0
  64. package/dist/src/mcp/server.js +27 -11
  65. package/dist/src/parser-cache.d.ts +17 -0
  66. package/dist/src/parser-cache.js +65 -0
  67. package/dist/src/parser-import.d.ts +8 -0
  68. package/dist/src/parser-import.js +1 -0
  69. package/dist/src/parser.js +80 -5
  70. package/dist/src/path.d.ts +2 -0
  71. package/dist/src/path.js +4 -0
  72. package/dist/src/profiler.d.ts +16 -0
  73. package/dist/src/profiler.js +81 -0
  74. package/dist/src/project-analysis.d.ts +59 -0
  75. package/dist/src/project-analysis.js +233 -0
  76. package/dist/src/project-discovery.d.ts +6 -0
  77. package/dist/src/project-discovery.js +30 -0
  78. package/dist/src/repository-path.d.ts +11 -0
  79. package/dist/src/repository-path.js +52 -0
  80. package/dist/src/search/db.d.ts +1 -1
  81. package/dist/src/search/db.js +2 -2
  82. package/dist/src/search/embedder.d.ts +2 -1
  83. package/dist/src/search/embedder.js +6 -5
  84. package/dist/src/search/index.d.ts +2 -1
  85. package/dist/src/search/index.js +10 -8
  86. package/dist/src/search/query.d.ts +20 -0
  87. package/dist/src/search/query.js +67 -0
  88. package/dist/src/search/search.d.ts +3 -1
  89. package/dist/src/search/search.js +5 -2
  90. package/dist/src/source-formats.d.ts +7 -0
  91. package/dist/src/source-formats.js +26 -0
  92. package/dist/src/source-parser.d.ts +44 -4
  93. package/dist/src/source-parser.js +494 -57
  94. package/dist/src/view/client/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  95. package/dist/src/view/client/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  96. package/dist/src/view/client/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  97. package/dist/src/view/client/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  98. package/dist/src/view/client/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  99. package/dist/src/view/client/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  100. package/dist/src/view/client/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  101. package/dist/src/view/client/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  102. package/dist/src/view/client/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  103. package/dist/src/view/client/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  104. package/dist/src/view/client/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  105. package/dist/src/view/client/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  106. package/dist/src/view/client/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  107. package/dist/src/view/client/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  108. package/dist/src/view/client/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  109. package/dist/src/view/client/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  110. package/dist/src/view/client/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  111. package/dist/src/view/client/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  112. package/dist/src/view/client/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  113. package/dist/src/view/client/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  114. package/dist/src/view/client/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  115. package/dist/src/view/client/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  116. package/dist/src/view/client/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  117. package/dist/src/view/client/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  118. package/dist/src/view/client/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  119. package/dist/src/view/client/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  120. package/dist/src/view/client/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  121. package/dist/src/view/client/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  122. package/dist/src/view/client/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  123. package/dist/src/view/client/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  124. package/dist/src/view/client/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  125. package/dist/src/view/client/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  126. package/dist/src/view/client/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  127. package/dist/src/view/client/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  128. package/dist/src/view/client/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  129. package/dist/src/view/client/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  130. package/dist/src/view/client/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  131. package/dist/src/view/client/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  132. package/dist/src/view/client/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  133. package/dist/src/view/client/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  134. package/dist/src/view/client/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  135. package/dist/src/view/client/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  136. package/dist/src/view/client/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  137. package/dist/src/view/client/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  138. package/dist/src/view/client/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  139. package/dist/src/view/client/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  140. package/dist/src/view/client/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  141. package/dist/src/view/client/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  142. package/dist/src/view/client/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  143. package/dist/src/view/client/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  144. package/dist/src/view/client/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  145. package/dist/src/view/client/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  146. package/dist/src/view/client/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  147. package/dist/src/view/client/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  148. package/dist/src/view/client/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  149. package/dist/src/view/client/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  150. package/dist/src/view/client/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  151. package/dist/src/view/client/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  152. package/dist/src/view/client/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  153. package/dist/src/view/client/assets/MarkdownEditor-B7quqPb8.js +28 -0
  154. package/dist/src/view/client/assets/OrbitControls-DwcpQNja.js +1 -0
  155. package/dist/src/view/client/assets/STLLoader-CLWTKt5i.js +1 -0
  156. package/dist/src/view/client/assets/abnfDiagram-VCTEODGH-V7-T6qsl.js +1 -0
  157. package/dist/src/view/client/assets/arc-BnwR8Bu7.js +1 -0
  158. package/dist/src/view/client/assets/architectureDiagram-5GKGNRK7-u97vDna9.js +36 -0
  159. package/dist/src/view/client/assets/blockDiagram-I7D4REHJ-DETl8e_H.js +129 -0
  160. package/dist/src/view/client/assets/c4Diagram-7LVT6UL2-DJRAT1Ve.js +38 -0
  161. package/dist/src/view/client/assets/channel-BwQbnWCN.js +1 -0
  162. package/dist/src/view/client/assets/chunk-2Q5K7J3B-C0TmOC1Q.js +1 -0
  163. package/dist/src/view/client/assets/chunk-5VM5RSS4-dfBOrYE6.js +15 -0
  164. package/dist/src/view/client/assets/chunk-F27PBJKO-DAnks99K.js +1 -0
  165. package/dist/src/view/client/assets/chunk-IMKFNOWR-CPjB07if.js +231 -0
  166. package/dist/src/view/client/assets/chunk-JWPE2WC7-VvU_gZI6.js +1 -0
  167. package/dist/src/view/client/assets/chunk-POPQ4Y6H-DDUbVF55.js +1 -0
  168. package/dist/src/view/client/assets/chunk-SVP7TREG-BHROkr6D.js +88 -0
  169. package/dist/src/view/client/assets/chunk-TICWLB2K-95PzGIOg.js +206 -0
  170. package/dist/src/view/client/assets/chunk-XXDRQBXY-MdmuLhIs.js +1 -0
  171. package/dist/src/view/client/assets/classDiagram-ZZMXUADV-HvQKkIS-.js +1 -0
  172. package/dist/src/view/client/assets/classDiagram-v2-VYDZK3BY-HvQKkIS-.js +1 -0
  173. package/dist/src/view/client/assets/cose-bilkent-JH36ORCC-CauUf_rN.js +1 -0
  174. package/dist/src/view/client/assets/cynefin-OW5HDTMX-CeA8IKWo.js +166 -0
  175. package/dist/src/view/client/assets/cynefinDiagram-5FMLGOSQ-L1rtcT8l.js +62 -0
  176. package/dist/src/view/client/assets/cytoscape.esm-DzSz-X2X.js +321 -0
  177. package/dist/src/view/client/assets/dagre-GXQ25YYZ-DLQwTa3H.js +4 -0
  178. package/dist/src/view/client/assets/defaultLocale-DX6XiGOO.js +1 -0
  179. package/dist/src/view/client/assets/diagram-S7CK7UJ4-kbKdIyXG.js +30 -0
  180. package/dist/src/view/client/assets/diagram-UQ7AKVKN-kmzp92RC.js +41 -0
  181. package/dist/src/view/client/assets/diagram-VSXAHHWV-EXJTU8qq.js +3 -0
  182. package/dist/src/view/client/assets/diagram-VX7I27RA-DAiIyMCG.js +24 -0
  183. package/dist/src/view/client/assets/diagram-Z3DM3KII-G9wz50ZV.js +24 -0
  184. package/dist/src/view/client/assets/ebnfDiagram-PWID7BFC-D2tVRCNA.js +1 -0
  185. package/dist/src/view/client/assets/erDiagram-RLTQ6QDP-C925J5A3.js +99 -0
  186. package/dist/src/view/client/assets/flowDiagram-HODETNUW-DzoCa-Nq.js +168 -0
  187. package/dist/src/view/client/assets/ganttDiagram-EL5Y4UJY-D2ebbg4p.js +292 -0
  188. package/dist/src/view/client/assets/gitGraphDiagram-WWUBYQGX-B4QratYy.js +106 -0
  189. package/dist/src/view/client/assets/index-BnENo9bV.js +1 -0
  190. package/dist/src/view/client/assets/index-D0ajr_Ja.css +1 -0
  191. package/dist/src/view/client/assets/index-KZcnpXJH.js +321 -0
  192. package/dist/src/view/client/assets/infoDiagram-27XIBGKW-DL4mtHkt.js +2 -0
  193. package/dist/src/view/client/assets/init-Gi6I4Gst.js +1 -0
  194. package/dist/src/view/client/assets/ishikawaDiagram-5VMMS53U-CW4mto2d.js +70 -0
  195. package/dist/src/view/client/assets/journeyDiagram-3NMN7TZE-8R4eacFW.js +139 -0
  196. package/dist/src/view/client/assets/kanban-definition-UXKFOSKX-Cy9ioXEJ.js +89 -0
  197. package/dist/src/view/client/assets/katex-HP8lGamR.js +257 -0
  198. package/dist/src/view/client/assets/layout-C0MFuhth.js +1 -0
  199. package/dist/src/view/client/assets/linear-Dv3N4dQR.js +1 -0
  200. package/dist/src/view/client/assets/logo-small-RR_KBOAT.svg +149 -0
  201. package/dist/src/view/client/assets/maplibre-gl-DnqZgfUS.js +800 -0
  202. package/dist/src/view/client/assets/mermaid.core-bds9A7e2.js +310 -0
  203. package/dist/src/view/client/assets/mindmap-definition-YA3MSWOX-DjmGW355.js +96 -0
  204. package/dist/src/view/client/assets/ordinal-Cboi1Yqb.js +1 -0
  205. package/dist/src/view/client/assets/pegDiagram-XKGWAZYB-BWsZp0ab.js +1 -0
  206. package/dist/src/view/client/assets/pieDiagram-E7YTZNPT-CCH2gGR-.js +39 -0
  207. package/dist/src/view/client/assets/quadrantDiagram-AXDQQJYC-CjocPJFz.js +7 -0
  208. package/dist/src/view/client/assets/railroadDiagram-O6MQD6OU-BjLeb2KF.js +1 -0
  209. package/dist/src/view/client/assets/requirementDiagram-BXWQKSXE-Ct6AoXRr.js +84 -0
  210. package/dist/src/view/client/assets/sankeyDiagram-P5KCCOFB-CIpgGN_w.js +40 -0
  211. package/dist/src/view/client/assets/sequenceDiagram-WJ2MYXX4-DrmLFj6w.js +162 -0
  212. package/dist/src/view/client/assets/sizeCapture-INFHLROL-BdFMe2Lr.js +1 -0
  213. package/dist/src/view/client/assets/stateDiagram-D77RDMKH-Zd9F1goW.js +1 -0
  214. package/dist/src/view/client/assets/stateDiagram-v2-MP3YSRHH-ByIKCftl.js +1 -0
  215. package/dist/src/view/client/assets/swimlanes-42K2YHIH-a7VFwi00.js +1 -0
  216. package/dist/src/view/client/assets/swimlanesDiagram-VR7AAH4N-CzxaUHB-.js +8 -0
  217. package/dist/src/view/client/assets/three.module-PDSP0dbZ.js +4108 -0
  218. package/dist/src/view/client/assets/timeline-definition-24CTP7MA-BExPu6X5.js +120 -0
  219. package/dist/src/view/client/assets/vennDiagram-4TSXK5OY-PC1MU3si.js +34 -0
  220. package/dist/src/view/client/assets/wardleyDiagram-VM6X3IG4-DNWqU3fa.js +78 -0
  221. package/dist/src/view/client/assets/xychartDiagram-S5SC5T6Z-E1uA28_D.js +7 -0
  222. package/dist/src/view/client/index.html +2 -2
  223. package/dist/src/view/client-shell.d.ts +2 -0
  224. package/dist/src/view/client-shell.js +5 -0
  225. package/dist/src/view/diagnostics.d.ts +3 -2
  226. package/dist/src/view/diagnostics.js +49 -58
  227. package/dist/src/view/document-edit.d.ts +8 -0
  228. package/dist/src/view/document-edit.js +25 -0
  229. package/dist/src/view/document-route.d.ts +12 -0
  230. package/dist/src/view/document-route.js +93 -0
  231. package/dist/src/view/document-tree.d.ts +18 -0
  232. package/dist/src/view/document-tree.js +139 -0
  233. package/dist/src/view/external-document-tree.d.ts +3 -0
  234. package/dist/src/view/external-document-tree.js +674 -0
  235. package/dist/src/view/git-diff.js +187 -0
  236. package/dist/src/view/git.js +1 -1
  237. package/dist/src/view/graph.d.ts +3 -2
  238. package/dist/src/view/graph.js +94 -7
  239. package/dist/src/view/highlight.d.ts +10 -2
  240. package/dist/src/view/highlight.js +4540 -1360
  241. package/dist/src/view/markdown.d.ts +3 -2
  242. package/dist/src/view/markdown.js +214 -53
  243. package/dist/src/view/protocol.d.ts +59 -6
  244. package/dist/src/view/references.d.ts +10 -25
  245. package/dist/src/view/references.js +117 -107
  246. package/dist/src/view/repository.d.ts +13 -3
  247. package/dist/src/view/repository.js +234 -15
  248. package/dist/src/view/search.d.ts +1 -1
  249. package/dist/src/view/search.js +3 -7
  250. package/dist/src/view/server.d.ts +11 -2
  251. package/dist/src/view/server.js +212 -70
  252. package/dist/src/view/source-target.js +5 -8
  253. package/dist/src/view/static-build.d.ts +1 -0
  254. package/dist/src/view/static-build.js +245 -42
  255. package/dist/src/view/static-protocol.d.ts +19 -2
  256. package/dist/src/view/store.d.ts +16 -3
  257. package/dist/src/view/store.js +228 -36
  258. package/dist/src/view/table-of-contents.d.ts +2 -2
  259. package/dist/src/view/table-of-contents.js +2 -22
  260. package/dist/src/walk.d.ts +5 -3
  261. package/dist/src/walk.js +102 -8
  262. package/dist/vendor/lat.md-server/cli.d.ts +2 -0
  263. package/dist/vendor/lat.md-server/cli.js +12 -0
  264. package/dist/vendor/lat.md-server/index.d.ts +38 -0
  265. package/dist/vendor/lat.md-server/index.js +128 -0
  266. package/package.json +52 -12
  267. package/plugins/lat-md/README.md +61 -0
  268. package/plugins/lat-md/hooks.json +38 -0
  269. package/plugins/lat-md/plugin.json +9 -0
  270. package/plugins/lat-md/rules/AGENTS.md +118 -0
  271. package/plugins/lat-md/skills/lat-md/SKILL.md +178 -0
  272. package/plugins/lat-md/skills/lat-md-conventions/SKILL.md +182 -0
  273. package/templates/AGENTS.md +15 -3
  274. package/templates/cursor-rules.md +12 -3
  275. package/templates/skill/SKILL.md +22 -1
  276. package/dist/src/view/client/assets/index-C3iaZyYT.css +0 -1
  277. package/dist/src/view/client/assets/index-KWi67IMz.js +0 -334
  278. package/dist/src/view/client/assets/logo-CNF8zs47.svg +0 -182
@@ -0,0 +1,47 @@
1
+ export type AntigravityPreInvocationInput = {
2
+ conversationId?: string;
3
+ workspacePaths?: string[];
4
+ transcriptPath?: string;
5
+ artifactDirectoryPath?: string;
6
+ modelName?: string;
7
+ user_prompt?: string;
8
+ prompt?: string;
9
+ userPrompt?: string;
10
+ };
11
+ export type AntigravityPreInvocationOutput = {
12
+ injectSteps: Array<{
13
+ ephemeralMessage?: string;
14
+ }>;
15
+ };
16
+ export type AntigravityPreToolUseInput = {
17
+ toolCall?: {
18
+ name?: string;
19
+ args?: Record<string, unknown>;
20
+ };
21
+ stepIdx?: number;
22
+ workspacePaths?: string[];
23
+ };
24
+ export type AntigravityPreToolUseOutput = {
25
+ decision: 'allow' | 'deny';
26
+ reason?: string;
27
+ };
28
+ export type AntigravityStopInput = {
29
+ executionNum?: number;
30
+ execution_num?: number;
31
+ stop_hook_active?: boolean;
32
+ stopHookActive?: boolean;
33
+ terminationReason?: string;
34
+ error?: string;
35
+ fullyIdle?: boolean;
36
+ workspacePaths?: string[];
37
+ };
38
+ export type AntigravityStopOutput = {
39
+ decision?: 'continue';
40
+ reason?: string;
41
+ };
42
+ export declare function extractLastUserPrompt(transcriptPath?: string): string | null;
43
+ export declare function handleAntigravityPreInvocation(rawInput?: string, writeOutput?: boolean): Promise<AntigravityPreInvocationOutput>;
44
+ export declare function handleAntigravityPreToolUse(rawInput?: string, writeOutput?: boolean): Promise<AntigravityPreToolUseOutput>;
45
+ export declare function handleAntigravityPostToolUse(rawInput?: string, writeOutput?: boolean): Promise<Record<string, unknown>>;
46
+ export declare function handleAntigravityStop(rawInput?: string, writeOutput?: boolean): Promise<AntigravityStopOutput>;
47
+ export declare function handleAntigravityHook(event: string, rawInput?: string): Promise<void>;
@@ -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 '../lattice.js';
4
+ import { commandProjectAnalysis } from '../project-analysis.js';
5
+ import { plainStyler } from '../context.js';
6
+ import { expandPrompt } from '../cli/expand.js';
7
+ import { runSearch } from '../cli/search.js';
8
+ import { getSection, formatSectionOutput } from '../cli/section.js';
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('../cli/check.js');
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: (configPath: string, key: string) => boolean;
15
+ addMcpServer: (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(mcpPath, 'mcpServers')) {
117
+ console.log(styleText('green', ' MCP server') + ' already configured');
118
+ }
119
+ else {
120
+ addMcpServer(mcpPath, 'mcpServers', style);
121
+ console.log(styleText('green', ' MCP server') + ' registered in .mcp.json');
122
+ }
123
+ ensureGitignored(root, '.mcp.json');
124
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * The fork's frontmatter surface, kept out of upstream's type module so a
3
+ * field added later costs one edit here instead of two upstream.
4
+ *
5
+ * Upstream reads `require-code-mention` out of the block with a regex and asks
6
+ * nothing else of it. This fork parses the block as YAML and hands the whole
7
+ * `lat:` mapping to its own checks, which means it also has to report the two
8
+ * ways that parse can go wrong.
9
+ */
10
+ /**
11
+ * Every field this build reads out of the `lat:` mapping. Kept in one place so
12
+ * a field added later is covered by the misplacement check without a second
13
+ * edit — the trap this list guards against is silent, so it must not depend on
14
+ * whoever adds the next field remembering to register it twice.
15
+ */
16
+ export declare const LAT_FIELDS: readonly ["require-code-mention", "mode", "require-mode", "status", "reviewed-hash", "tags"];
17
+ /**
18
+ * Something wrong with the frontmatter itself, carried out of the parser for a
19
+ * caller to report. Both kinds fail OPEN if they stay quiet: a misplaced or
20
+ * unparseable `require-code-mention` turns a validation off and `lat check`
21
+ * then reports success on a file that is no longer being validated.
22
+ */
23
+ export type FrontmatterProblem = {
24
+ kind: 'root-level-field';
25
+ field: string;
26
+ } | {
27
+ kind: 'parse-error';
28
+ message: string;
29
+ };
30
+ /** Mixed into upstream's `LatFrontmatter` rather than replacing it. */
31
+ export type ForkFrontmatter = {
32
+ /** Every key under the `lat:` mapping, parsed but not mapped to a field. */
33
+ raw: Record<string, unknown>;
34
+ /** Populated only when something is wrong; absent on a healthy document. */
35
+ problems?: FrontmatterProblem[];
36
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The fork's frontmatter surface, kept out of upstream's type module so a
3
+ * field added later costs one edit here instead of two upstream.
4
+ *
5
+ * Upstream reads `require-code-mention` out of the block with a regex and asks
6
+ * nothing else of it. This fork parses the block as YAML and hands the whole
7
+ * `lat:` mapping to its own checks, which means it also has to report the two
8
+ * ways that parse can go wrong.
9
+ */
10
+ /**
11
+ * Every field this build reads out of the `lat:` mapping. Kept in one place so
12
+ * a field added later is covered by the misplacement check without a second
13
+ * edit — the trap this list guards against is silent, so it must not depend on
14
+ * whoever adds the next field remembering to register it twice.
15
+ */
16
+ export const LAT_FIELDS = [
17
+ 'require-code-mention',
18
+ 'mode',
19
+ 'require-mode',
20
+ 'status',
21
+ 'reviewed-hash',
22
+ 'tags',
23
+ ];
@@ -1,8 +1,11 @@
1
- import type { Section, SectionMatch } from './lattice.js';
1
+ import type { Section, SectionMatch } from './lattice-model.js';
2
2
  import type { CmdContext, Styler } from './context.js';
3
3
  export declare function formatSectionId(id: string, s: Styler): string;
4
4
  export declare function formatSectionPreview(ctx: CmdContext, section: Section, opts?: {
5
5
  reason?: string;
6
+ score?: number;
7
+ }): string;
8
+ export declare function formatResultList(ctx: CmdContext, header: string, matches: SectionMatch[], opts?: {
9
+ showScores?: boolean;
6
10
  }): string;
7
- export declare function formatResultList(ctx: CmdContext, header: string, matches: SectionMatch[]): string;
8
11
  export declare function formatNavHints(ctx: CmdContext): string;