@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
@@ -1,229 +0,0 @@
1
- import { readFile } from 'node:fs/promises';
2
- import { existsSync } from 'node:fs';
3
- import { extname, join, relative } from 'node:path';
4
- import { listLatticeFiles, loadAllSections, findSections, extractRefs, flattenSections, buildFileIndex, buildSectionSlugIndex, resolveRef, } from '../lattice.js';
5
- import { formatResultList } from '../format.js';
6
- import { scanCodeRefs } from '../code-refs.js';
7
- /** Extensions recognized as source code for ref queries. */
8
- const SOURCE_EXTS = new Set([
9
- '.ts',
10
- '.tsx',
11
- '.js',
12
- '.jsx',
13
- '.py',
14
- '.rs',
15
- '.go',
16
- '.c',
17
- '.h',
18
- ]);
19
- /**
20
- * Check if a query looks like a source file path (has a recognized extension
21
- * and the file exists on disk).
22
- */
23
- function isSourceQuery(query, projectRoot) {
24
- const hashIdx = query.indexOf('#');
25
- const filePart = hashIdx === -1 ? query : query.slice(0, hashIdx);
26
- const symbolPart = hashIdx === -1 ? '' : query.slice(hashIdx + 1);
27
- const ext = extname(filePart);
28
- if (!SOURCE_EXTS.has(ext))
29
- return null;
30
- if (!existsSync(join(projectRoot, filePart)))
31
- return null;
32
- return { filePart, symbolPart };
33
- }
34
- /**
35
- * Find references to a source file or symbol across lat.md and code files.
36
- * For file-level queries (no #symbol), matches all wiki links targeting
37
- * that file or any symbol in it.
38
- */
39
- async function findSourceRefs(latDir, projectRoot, query, scope) {
40
- const hashIdx = query.indexOf('#');
41
- const filePart = hashIdx === -1 ? query : query.slice(0, hashIdx);
42
- const isFileLevel = hashIdx === -1;
43
- const queryLower = query.toLowerCase();
44
- const fileLower = filePart.toLowerCase();
45
- // Build a synthetic Section for the target
46
- const target = {
47
- id: query,
48
- heading: hashIdx === -1 ? filePart : query.slice(hashIdx + 1),
49
- depth: 0,
50
- file: filePart,
51
- filePath: filePart,
52
- children: [],
53
- startLine: 0,
54
- endLine: 0,
55
- firstParagraph: '',
56
- };
57
- // Try to get real line info from the source parser
58
- try {
59
- const { resolveSourceSymbol } = await import('../source-parser.js');
60
- if (hashIdx !== -1) {
61
- const symbolPart = query.slice(hashIdx + 1);
62
- const { found, symbols } = await resolveSourceSymbol(filePart, symbolPart, projectRoot);
63
- if (found) {
64
- const parts = symbolPart.split('#');
65
- const sym = symbols.find((s) => parts.length === 1
66
- ? s.name === parts[0] && !s.parent
67
- : s.name === parts[1] && s.parent === parts[0]);
68
- if (sym) {
69
- target.startLine = sym.startLine;
70
- target.endLine = sym.endLine;
71
- target.firstParagraph = sym.signature;
72
- }
73
- }
74
- }
75
- }
76
- catch {
77
- // source parser unavailable — proceed without line info
78
- }
79
- const allSections = await loadAllSections(latDir);
80
- const flat = flattenSections(allSections);
81
- const mdRefs = [];
82
- const codeRefs = [];
83
- if (scope === 'md' || scope === 'md+code') {
84
- const files = await listLatticeFiles(latDir);
85
- const matchingFromSections = new Set();
86
- for (const file of files) {
87
- const content = await readFile(file, 'utf-8');
88
- const fileRefs = extractRefs(file, content, projectRoot);
89
- for (const ref of fileRefs) {
90
- const targetLower = ref.target.toLowerCase();
91
- const matches = isFileLevel
92
- ? targetLower === fileLower || targetLower.startsWith(fileLower + '#')
93
- : targetLower === queryLower;
94
- if (matches) {
95
- matchingFromSections.add(ref.fromSection.toLowerCase());
96
- }
97
- }
98
- }
99
- if (matchingFromSections.size > 0) {
100
- const referrers = flat.filter((s) => matchingFromSections.has(s.id.toLowerCase()));
101
- for (const s of referrers) {
102
- mdRefs.push({ section: s, reason: 'wiki link' });
103
- }
104
- }
105
- }
106
- if (scope === 'code' || scope === 'md+code') {
107
- const { refs: scannedRefs } = await scanCodeRefs(projectRoot);
108
- for (const ref of scannedRefs) {
109
- const targetLower = ref.target.toLowerCase();
110
- const matches = isFileLevel
111
- ? targetLower === fileLower || targetLower.startsWith(fileLower + '#')
112
- : targetLower === queryLower;
113
- if (matches) {
114
- const displayPath = relative(process.cwd(), join(projectRoot, ref.file));
115
- codeRefs.push(`${displayPath}:${ref.line}`);
116
- }
117
- }
118
- }
119
- return { kind: 'found', target, mdRefs, codeRefs };
120
- }
121
- /**
122
- * Find all sections and code locations that reference a given section or
123
- * source file. Accepts section ids (full-path, short-form) and source file
124
- * paths (e.g. src/app.rs#foo). Source file queries match wiki links directly
125
- * without section resolution.
126
- */
127
- export async function findRefs(ctx, query, scope) {
128
- query = query.replace(/^\[\[|\]\]$/g, '');
129
- // Source file queries bypass section resolution
130
- if (isSourceQuery(query, ctx.projectRoot)) {
131
- return findSourceRefs(ctx.latDir, ctx.projectRoot, query, scope);
132
- }
133
- const allSections = await loadAllSections(ctx.latDir);
134
- const flat = flattenSections(allSections);
135
- const sectionIds = new Set(flat.map((s) => s.id.toLowerCase()));
136
- const fileIndex = buildFileIndex(allSections);
137
- const slugIndex = buildSectionSlugIndex(allSections);
138
- const { resolved } = resolveRef(query, sectionIds, fileIndex, slugIndex);
139
- const q = resolved.toLowerCase();
140
- let exactMatch = flat.find((s) => s.id.toLowerCase() === q);
141
- // If resolveRef didn't land on an exact id, use findSections as fallback
142
- const matches = !exactMatch ? findSections(allSections, query) : [];
143
- if (!exactMatch && matches.length >= 1) {
144
- const top = matches[0];
145
- const isConfident = top.reason === 'exact match' ||
146
- top.reason.startsWith('file stem expanded') ||
147
- top.reason === 'section name match';
148
- if (isConfident) {
149
- exactMatch = top.section;
150
- }
151
- }
152
- if (!exactMatch) {
153
- const suggestions = matches.length > 0 ? matches : findSections(allSections, query);
154
- return { kind: 'no-match', suggestions };
155
- }
156
- const targetId = exactMatch.id.toLowerCase();
157
- const mdRefs = [];
158
- const codeRefs = [];
159
- if (scope === 'md' || scope === 'md+code') {
160
- const files = await listLatticeFiles(ctx.latDir);
161
- const matchingFromSections = new Set();
162
- for (const file of files) {
163
- const content = await readFile(file, 'utf-8');
164
- const fileRefs = extractRefs(file, content, ctx.projectRoot);
165
- for (const ref of fileRefs) {
166
- const { resolved: refResolved } = resolveRef(ref.target, sectionIds, fileIndex, slugIndex);
167
- if (refResolved.toLowerCase() === targetId) {
168
- matchingFromSections.add(ref.fromSection.toLowerCase());
169
- }
170
- }
171
- }
172
- if (matchingFromSections.size > 0) {
173
- const referrers = flat.filter((s) => matchingFromSections.has(s.id.toLowerCase()));
174
- for (const s of referrers) {
175
- mdRefs.push({ section: s, reason: 'wiki link' });
176
- }
177
- }
178
- }
179
- if (scope === 'code' || scope === 'md+code') {
180
- const { refs: scannedRefs } = await scanCodeRefs(ctx.projectRoot);
181
- for (const ref of scannedRefs) {
182
- const { resolved: codeResolved } = resolveRef(ref.target, sectionIds, fileIndex, slugIndex);
183
- if (codeResolved.toLowerCase() === targetId) {
184
- const displayPath = relative(process.cwd(), join(ctx.projectRoot, ref.file));
185
- codeRefs.push(`${displayPath}:${ref.line}`);
186
- }
187
- }
188
- }
189
- return { kind: 'found', target: exactMatch, mdRefs, codeRefs };
190
- }
191
- export async function refsCommand(ctx, query, scope) {
192
- const result = await findRefs(ctx, query, scope);
193
- if (result.kind === 'no-match') {
194
- const s = ctx.styler;
195
- if (result.suggestions.length > 0) {
196
- const suggestions = result.suggestions
197
- .map((m) => ` ${s.dim('*')} ${s.white(m.section.id)} ${s.dim(`(${m.reason})`)}`)
198
- .join('\n');
199
- return {
200
- output: s.red(`No section "${query}" found.`) +
201
- ' Did you mean:\n' +
202
- suggestions,
203
- isError: true,
204
- };
205
- }
206
- return {
207
- output: s.red(`No section matching "${query}"`),
208
- isError: true,
209
- };
210
- }
211
- const { target, mdRefs, codeRefs } = result;
212
- if (mdRefs.length === 0 && codeRefs.length === 0) {
213
- return {
214
- output: ctx.styler.yellow(`No references to "${target.id}" found`),
215
- isError: true,
216
- };
217
- }
218
- const s = ctx.styler;
219
- const parts = [];
220
- if (mdRefs.length > 0) {
221
- parts.push(formatResultList(ctx, `References to "${target.id}":`, mdRefs));
222
- }
223
- if (codeRefs.length > 0) {
224
- parts.push('## Code references:' +
225
- '\n\n' +
226
- codeRefs.map((l) => `${s.dim('*')} ${l}`).join('\n'));
227
- }
228
- return { output: parts.join('\n') };
229
- }
@@ -1,43 +0,0 @@
1
- import { type Section, type SectionMatch } from '../lattice.js';
2
- import type { CmdContext, CmdResult } from '../context.js';
3
- import { type ProvenanceNote } from './check-status.js';
4
- export type CodeBackRef = {
5
- file: string;
6
- line: number;
7
- snippet: string;
8
- };
9
- export type SourceRef = {
10
- target: string;
11
- file: string;
12
- line: number;
13
- endLine: number;
14
- snippet: string;
15
- };
16
- export type SectionFound = {
17
- kind: 'found';
18
- section: Section;
19
- content: string;
20
- /** Provenance of the document holding this section, or null if unmarked. */
21
- status: ProvenanceNote | null;
22
- outgoingRefs: {
23
- target: string;
24
- resolved: Section;
25
- }[];
26
- outgoingSourceRefs: SourceRef[];
27
- incomingRefs: SectionMatch[];
28
- codeRefs: CodeBackRef[];
29
- };
30
- export type SectionResult = SectionFound | {
31
- kind: 'no-match';
32
- suggestions: SectionMatch[];
33
- };
34
- /**
35
- * Look up a section by id, return its content, outgoing wiki link targets,
36
- * and incoming references from other sections.
37
- */
38
- export declare function getSection(ctx: CmdContext, query: string): Promise<SectionResult>;
39
- /**
40
- * Format a successful section result with styling.
41
- */
42
- export declare function formatSectionOutput(ctx: CmdContext, result: SectionFound): string;
43
- export declare function sectionCommand(ctx: CmdContext, query: string): Promise<CmdResult>;
@@ -1,252 +0,0 @@
1
- import { readFile } from 'node:fs/promises';
2
- import { extname, join, relative } from 'node:path';
3
- import { loadAllSections, findSections, flattenSections, extractRefs, buildFileIndex, buildSectionSlugIndex, resolveRef, listLatticeFiles, } from '../lattice.js';
4
- import { scanCodeRefs } from '../code-refs.js';
5
- import { SOURCE_EXTENSIONS, resolveSourceSymbol } from '../source-parser.js';
6
- import { formatSectionId, formatNavHints } from '../format.js';
7
- import { provenanceNote, formatProvenanceNote, } from './check-status.js';
8
- /**
9
- * Look up a section by id, return its content, outgoing wiki link targets,
10
- * and incoming references from other sections.
11
- */
12
- export async function getSection(ctx, query) {
13
- query = query.replace(/^\[\[|\]\]$/g, '');
14
- const allSections = await loadAllSections(ctx.latDir);
15
- const matches = findSections(allSections, query);
16
- if (matches.length === 0) {
17
- return { kind: 'no-match', suggestions: [] };
18
- }
19
- // Accept the top match if confident
20
- const top = matches[0];
21
- const isConfident = top.reason === 'exact match' ||
22
- top.reason.startsWith('file stem expanded') ||
23
- top.reason === 'section name match';
24
- if (!isConfident) {
25
- return { kind: 'no-match', suggestions: matches };
26
- }
27
- const section = top.section;
28
- // Read raw content between startLine and the end of the last descendant
29
- const absPath = join(ctx.projectRoot, section.filePath);
30
- const fileContent = await readFile(absPath, 'utf-8');
31
- const lines = fileContent.split('\n');
32
- const end = fullEndLine(section);
33
- const content = lines.slice(section.startLine - 1, end).join('\n');
34
- // Find outgoing wiki link targets within this section's content
35
- const flat = flattenSections(allSections);
36
- const sectionIds = new Set(flat.map((s) => s.id.toLowerCase()));
37
- const fileIndex = buildFileIndex(allSections);
38
- const slugIndex = buildSectionSlugIndex(allSections);
39
- const sectionRefs = extractRefs(absPath, fileContent, ctx.projectRoot);
40
- const sectionId = section.id.toLowerCase();
41
- const outgoingRefs = [];
42
- const outgoingSourceRefs = [];
43
- const seen = new Set();
44
- for (const ref of sectionRefs) {
45
- if (ref.fromSection.toLowerCase() !== sectionId)
46
- continue;
47
- // Detect source code references by file extension
48
- const hashIdx = ref.target.indexOf('#');
49
- const filePart = hashIdx === -1 ? ref.target : ref.target.slice(0, hashIdx);
50
- const ext = extname(filePart);
51
- if (SOURCE_EXTENSIONS.has(ext)) {
52
- const targetLower = ref.target.toLowerCase();
53
- if (!seen.has(targetLower)) {
54
- seen.add(targetLower);
55
- const symbolPart = hashIdx === -1 ? '' : ref.target.slice(hashIdx + 1);
56
- let line = 0;
57
- let endLine = 0;
58
- let snippet = '';
59
- if (symbolPart) {
60
- const { found, symbols } = await resolveSourceSymbol(filePart, symbolPart, ctx.projectRoot);
61
- if (found) {
62
- const parts = symbolPart.split('#');
63
- const sym = symbols.find((s) => parts.length === 1
64
- ? s.name === parts[0] && !s.parent
65
- : s.name === parts[1] && s.parent === parts[0]);
66
- if (sym) {
67
- line = sym.startLine;
68
- endLine = sym.endLine;
69
- try {
70
- const src = await readFile(join(ctx.projectRoot, filePart), 'utf-8');
71
- const srcLines = src.split('\n');
72
- const start = sym.startLine - 1;
73
- const end = Math.min(srcLines.length, start + 5);
74
- snippet = srcLines.slice(start, end).join('\n');
75
- }
76
- catch {
77
- // file unreadable
78
- }
79
- }
80
- }
81
- }
82
- outgoingSourceRefs.push({
83
- target: ref.target,
84
- file: filePart,
85
- line,
86
- endLine,
87
- snippet,
88
- });
89
- }
90
- continue;
91
- }
92
- const { resolved } = resolveRef(ref.target, sectionIds, fileIndex, slugIndex);
93
- const resolvedLower = resolved.toLowerCase();
94
- if (seen.has(resolvedLower))
95
- continue;
96
- seen.add(resolvedLower);
97
- const targetSection = flat.find((s) => s.id.toLowerCase() === resolvedLower);
98
- if (targetSection) {
99
- outgoingRefs.push({ target: ref.target, resolved: targetSection });
100
- }
101
- }
102
- // Find incoming references: other sections that link to this one
103
- const incomingRefs = [];
104
- const files = await listLatticeFiles(ctx.latDir);
105
- const incomingSections = new Set();
106
- for (const file of files) {
107
- const fc = await readFile(file, 'utf-8');
108
- const fileRefs = extractRefs(file, fc, ctx.projectRoot);
109
- for (const ref of fileRefs) {
110
- const { resolved } = resolveRef(ref.target, sectionIds, fileIndex, slugIndex);
111
- if (resolved.toLowerCase() === sectionId &&
112
- ref.fromSection.toLowerCase() !== sectionId) {
113
- if (!incomingSections.has(ref.fromSection.toLowerCase())) {
114
- incomingSections.add(ref.fromSection.toLowerCase());
115
- const fromSection = flat.find((s) => s.id.toLowerCase() === ref.fromSection.toLowerCase());
116
- if (fromSection) {
117
- incomingRefs.push({ section: fromSection, reason: 'wiki link' });
118
- }
119
- }
120
- }
121
- }
122
- }
123
- // Find code back-references: @lat: comments pointing to this section
124
- const codeRefs = [];
125
- const { refs: scannedRefs } = await scanCodeRefs(ctx.projectRoot);
126
- for (const ref of scannedRefs) {
127
- const { resolved: codeResolved } = resolveRef(ref.target, sectionIds, fileIndex, slugIndex);
128
- if (codeResolved.toLowerCase() === sectionId) {
129
- const absFile = join(ctx.projectRoot, ref.file);
130
- let snippet = '';
131
- try {
132
- const src = await readFile(absFile, 'utf-8');
133
- const srcLines = src.split('\n');
134
- const start = Math.max(0, ref.line - 1 - 2);
135
- const end = Math.min(srcLines.length, ref.line - 1 + 3);
136
- snippet = srcLines.slice(start, end).join('\n');
137
- }
138
- catch {
139
- // file unreadable — skip snippet
140
- }
141
- codeRefs.push({ file: ref.file, line: ref.line, snippet });
142
- }
143
- }
144
- return {
145
- kind: 'found',
146
- section,
147
- content,
148
- status: provenanceNote(fileContent),
149
- outgoingRefs,
150
- outgoingSourceRefs,
151
- incomingRefs,
152
- codeRefs,
153
- };
154
- }
155
- function fullEndLine(section) {
156
- if (section.children.length === 0)
157
- return section.endLine;
158
- return fullEndLine(section.children[section.children.length - 1]);
159
- }
160
- function truncate(s, max) {
161
- return s.length > max ? s.slice(0, max) + '...' : s;
162
- }
163
- /**
164
- * Format a successful section result with styling.
165
- */
166
- export function formatSectionOutput(ctx, result) {
167
- const s = ctx.styler;
168
- const { section, content, status, outgoingRefs, outgoingSourceRefs, incomingRefs, codeRefs, } = result;
169
- const relPath = relative(process.cwd(), join(ctx.projectRoot, section.filePath));
170
- const loc = `${s.cyan(relPath)}${s.dim(`:${section.startLine}-${section.endLine}`)}`;
171
- const quoted = content
172
- .split('\n')
173
- .map((line) => (line ? `> ${line}` : '>'))
174
- .join('\n');
175
- const parts = [
176
- `${s.bold('[[' + formatSectionId(section.id, s) + ']]')} (${loc})`,
177
- ];
178
- // Above the text, not below it: a reader who acts on the first line of a
179
- // quoted section has already acted before a trailing caveat reaches them.
180
- if (status)
181
- parts.push(formatProvenanceNote(status, s));
182
- parts.push('', quoted);
183
- if (outgoingRefs.length > 0 || outgoingSourceRefs.length > 0) {
184
- parts.push('', '## This section references:', '');
185
- for (const ref of outgoingRefs) {
186
- const body = ref.resolved.firstParagraph
187
- ? ` ${s.dim('—')} ${truncate(ref.resolved.firstParagraph, 120)}`
188
- : '';
189
- parts.push(`${s.dim('*')} [[${formatSectionId(ref.resolved.id, s)}]]${body}`);
190
- }
191
- for (const ref of outgoingSourceRefs) {
192
- const loc = ref.line
193
- ? ref.endLine && ref.endLine !== ref.line
194
- ? `${s.dim(` (${ref.file}:${ref.line}-${ref.endLine})`)}`
195
- : `${s.dim(` (${ref.file}:${ref.line})`)}`
196
- : `${s.dim(` (${ref.file})`)}`;
197
- parts.push(`${s.dim('*')} [[${s.cyan(ref.target)}]]${loc}`);
198
- if (ref.snippet) {
199
- const snippetLines = ref.snippet.split('\n');
200
- for (const line of snippetLines) {
201
- parts.push(` ${s.dim('|')} ${line}`);
202
- }
203
- }
204
- }
205
- }
206
- if (incomingRefs.length > 0) {
207
- parts.push('', '## Referenced by:', '');
208
- for (const ref of incomingRefs) {
209
- const body = ref.section.firstParagraph
210
- ? ` ${s.dim('—')} ${truncate(ref.section.firstParagraph, 120)}`
211
- : '';
212
- parts.push(`${s.dim('*')} [[${formatSectionId(ref.section.id, s)}]]${body}`);
213
- }
214
- }
215
- if (codeRefs.length > 0) {
216
- parts.push('', '## Referenced by code:', '');
217
- for (const ref of codeRefs) {
218
- const codeRelPath = relative(process.cwd(), join(ctx.projectRoot, ref.file));
219
- parts.push(`${s.dim('*')} ${s.cyan(codeRelPath)}${s.dim(`:${ref.line}`)}`);
220
- if (ref.snippet) {
221
- const snippetLines = ref.snippet.split('\n');
222
- for (const line of snippetLines) {
223
- parts.push(` ${s.dim('|')} ${line}`);
224
- }
225
- }
226
- }
227
- }
228
- parts.push(formatNavHints(ctx));
229
- return parts.join('\n');
230
- }
231
- export async function sectionCommand(ctx, query) {
232
- const result = await getSection(ctx, query);
233
- if (result.kind === 'no-match') {
234
- const s = ctx.styler;
235
- if (result.suggestions.length > 0) {
236
- const suggestions = result.suggestions
237
- .map((m) => ` ${s.dim('*')} ${s.white(m.section.id)} ${s.dim(`(${m.reason})`)}`)
238
- .join('\n');
239
- return {
240
- output: s.red(`No section "${query}" found.`) +
241
- ' Did you mean:\n' +
242
- suggestions,
243
- isError: true,
244
- };
245
- }
246
- return {
247
- output: s.red(`No sections matching "${query}"`),
248
- isError: true,
249
- };
250
- }
251
- return { output: formatSectionOutput(ctx, result) };
252
- }
@@ -1,13 +0,0 @@
1
- export interface SelectOption {
2
- label: string;
3
- value: string;
4
- /** If true, this option uses a distinct highlight style (e.g. for "done" actions). */
5
- accent?: boolean;
6
- }
7
- /**
8
- * Display an interactive select menu with arrow-key navigation.
9
- * Returns the selected option's value, or null if the user pressed Ctrl+C.
10
- *
11
- * @param defaultIndex - initial cursor position (defaults to 0)
12
- */
13
- export declare function selectMenu(options: SelectOption[], prompt?: string, defaultIndex?: number): Promise<string | null>;
@@ -1,100 +0,0 @@
1
- import { styleText } from 'node:util';
2
- /**
3
- * Display an interactive select menu with arrow-key navigation.
4
- * Returns the selected option's value, or null if the user pressed Ctrl+C.
5
- *
6
- * @param defaultIndex - initial cursor position (defaults to 0)
7
- */
8
- export async function selectMenu(options, prompt, defaultIndex) {
9
- if (options.length === 0)
10
- return null;
11
- if (!process.stdin.isTTY) {
12
- // Non-interactive fallback: return first option
13
- return options[0].value;
14
- }
15
- return new Promise((resolve) => {
16
- let cursor = defaultIndex ?? 0;
17
- const stdin = process.stdin;
18
- // Save original stdin state
19
- const wasRaw = stdin.isRaw;
20
- stdin.setRawMode(true);
21
- stdin.resume();
22
- stdin.setEncoding('utf-8');
23
- function render() {
24
- process.stdout.write('\x1B[?25l'); // hide cursor
25
- const lines = [];
26
- if (prompt) {
27
- lines.push(styleText('bold', prompt));
28
- }
29
- for (let i = 0; i < options.length; i++) {
30
- const opt = options[i];
31
- const selected = i === cursor;
32
- const pointer = selected ? '❯' : ' ';
33
- if (selected) {
34
- if (opt.accent) {
35
- lines.push(` ${pointer} ${styleText(['bgGreen', 'black', 'bold'], ` ${opt.label} `)}`);
36
- }
37
- else {
38
- lines.push(` ${pointer} ${styleText(['bgCyan', 'black', 'bold'], ` ${opt.label} `)}`);
39
- }
40
- }
41
- else {
42
- lines.push(` ${pointer} ${styleText('dim', opt.label)}`);
43
- }
44
- }
45
- process.stdout.write(lines.join('\n') + '\n');
46
- }
47
- function clearRender() {
48
- const totalLines = options.length + (prompt ? 1 : 0);
49
- // Move up and clear each line
50
- for (let i = 0; i < totalLines; i++) {
51
- process.stdout.write('\x1B[A\x1B[2K');
52
- }
53
- }
54
- function cleanup() {
55
- stdin.setRawMode(wasRaw ?? false);
56
- stdin.pause();
57
- process.stdout.write('\x1B[?25h'); // show cursor
58
- stdin.removeListener('data', onData);
59
- }
60
- function onData(data) {
61
- const key = data.toString();
62
- // Ctrl+C
63
- if (key === '\x03') {
64
- clearRender();
65
- cleanup();
66
- console.log('');
67
- process.exit(130);
68
- }
69
- // Enter
70
- if (key === '\r' || key === '\n') {
71
- clearRender();
72
- cleanup();
73
- const selected = options[cursor];
74
- // Print the selection
75
- if (prompt) {
76
- console.log(styleText('bold', prompt) +
77
- ' ' +
78
- styleText('green', selected.label));
79
- }
80
- resolve(selected.value);
81
- return;
82
- }
83
- // Arrow keys (escape sequences)
84
- if (key === '\x1B[A' || key === 'k') {
85
- // Up
86
- clearRender();
87
- cursor = (cursor - 1 + options.length) % options.length;
88
- render();
89
- }
90
- else if (key === '\x1B[B' || key === 'j') {
91
- // Down
92
- clearRender();
93
- cursor = (cursor + 1) % options.length;
94
- render();
95
- }
96
- }
97
- stdin.on('data', onData);
98
- render();
99
- });
100
- }
@@ -1,17 +0,0 @@
1
- /** Walk project files for code-ref scanning. Uses walkEntries for .gitignore
2
- * support, then additionally skips .md files, lat.md/, .claude/, and sub-projects. */
3
- export declare function walkFiles(dir: string): Promise<string[]>;
4
- export declare const LAT_REF_RE: RegExp;
5
- export type CodeRef = {
6
- target: string;
7
- file: string;
8
- line: number;
9
- };
10
- export type ScanResult = {
11
- refs: CodeRef[];
12
- files: string[];
13
- usedRg: boolean;
14
- };
15
- /** Check whether ripgrep (`rg`) is available on PATH. */
16
- export declare function hasRipgrep(): Promise<boolean>;
17
- export declare function scanCodeRefs(projectRoot: string): Promise<ScanResult>;