@plebeiantech/lat.md 0.12.3-fork.17 → 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 (244) hide show
  1. package/README.md +1 -1
  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/fork-instructions.js +1 -1
  5. package/dist/src/cli/fork-scaffold.js +2 -2
  6. package/dist/src/cli/graph.d.ts +1 -1
  7. package/dist/src/cli/hook.js +11 -11
  8. package/dist/src/cli/index.js +41 -59
  9. package/dist/src/cli/init-preferences.js +5 -4
  10. package/dist/src/cli/init.d.ts +1 -1
  11. package/dist/src/cli/init.js +54 -45
  12. package/dist/src/cli/reindex.d.ts +1 -1
  13. package/dist/src/cli/reindex.js +2 -2
  14. package/dist/src/cli/search.d.ts +4 -4
  15. package/dist/src/cli/search.js +41 -28
  16. package/dist/src/cli/ui-build-server.d.ts +1 -1
  17. package/dist/src/cli/ui-build.d.ts +1 -1
  18. package/dist/src/cli/ui.d.ts +1 -1
  19. package/dist/src/fork/antigravity-hook.js +6 -6
  20. package/dist/src/fork/antigravity-init.d.ts +2 -2
  21. package/dist/src/fork/antigravity-init.js +2 -2
  22. package/dist/src/graph-export.js +7 -7
  23. package/dist/src/knowledge/index.js +2 -2
  24. package/dist/src/mcp/server.js +8 -8
  25. package/dist/src/search/cache.d.ts +1 -1
  26. package/dist/src/search/cache.js +40 -7
  27. package/dist/src/search/chunks.d.ts +2 -2
  28. package/dist/src/search/db.d.ts +5 -4
  29. package/dist/src/search/db.js +36 -40
  30. package/dist/src/search/embedder.js +1 -1
  31. package/dist/src/search/index.d.ts +1 -1
  32. package/dist/src/search/index.js +2 -2
  33. package/dist/src/search/lock.d.ts +4 -1
  34. package/dist/src/search/lock.js +30 -8
  35. package/dist/src/search/query.d.ts +5 -2
  36. package/dist/src/search/query.js +55 -38
  37. package/dist/src/search/search.d.ts +3 -1
  38. package/dist/src/search/search.js +21 -12
  39. package/dist/src/search/types.d.ts +2 -18
  40. package/dist/src/view/client/assets/{GraphView-BWlRdQM4.js → GraphView-Dij8mAA_.js} +1 -1
  41. package/dist/src/view/client/assets/{MarkdownEditor-MW-Ck1O0.js → MarkdownEditor-88Wbt0M1.js} +1 -1
  42. package/dist/src/view/client/assets/{abnfDiagram-VCTEODGH-Bn3RshMV.js → abnfDiagram-VCTEODGH-y0DlYa8E.js} +1 -1
  43. package/dist/src/view/client/assets/{arc-En9tdFQF.js → arc-FlMu8dnO.js} +1 -1
  44. package/dist/src/view/client/assets/{architectureDiagram-5GKGNRK7-B-9J1VAM.js → architectureDiagram-5GKGNRK7-DA_uWZW1.js} +1 -1
  45. package/dist/src/view/client/assets/{blockDiagram-I7D4REHJ-QlznwalP.js → blockDiagram-I7D4REHJ-BHQ5LU85.js} +1 -1
  46. package/dist/src/view/client/assets/{c4Diagram-7LVT6UL2-Bp2y8B4_.js → c4Diagram-7LVT6UL2-BRucKCt2.js} +1 -1
  47. package/dist/src/view/client/assets/channel-BgDNA_Ay.js +1 -0
  48. package/dist/src/view/client/assets/{chunk-2Q5K7J3B-CnBKL-lm.js → chunk-2Q5K7J3B-BJPcFivt.js} +1 -1
  49. package/dist/src/view/client/assets/{chunk-5VM5RSS4-LLYMi_n6.js → chunk-5VM5RSS4-v2q99bGz.js} +1 -1
  50. package/dist/src/view/client/assets/{chunk-F27PBJKO-VIeO7VF0.js → chunk-F27PBJKO-CcHOuJCs.js} +1 -1
  51. package/dist/src/view/client/assets/{chunk-IMKFNOWR-D5i67DVD.js → chunk-IMKFNOWR-DNxYuJNq.js} +1 -1
  52. package/dist/src/view/client/assets/{chunk-JWPE2WC7-D4qAtoL3.js → chunk-JWPE2WC7-C0eHKvLW.js} +1 -1
  53. package/dist/src/view/client/assets/{chunk-POPQ4Y6H-BMzOyiW_.js → chunk-POPQ4Y6H-57CWp2Ve.js} +1 -1
  54. package/dist/src/view/client/assets/{chunk-SVP7TREG-DWy5nbfp.js → chunk-SVP7TREG-BqcoxIJw.js} +1 -1
  55. package/dist/src/view/client/assets/{chunk-TICWLB2K-CVqCANFB.js → chunk-TICWLB2K-DRUJR5zH.js} +1 -1
  56. package/dist/src/view/client/assets/{chunk-XXDRQBXY-Bp23h6Tf.js → chunk-XXDRQBXY-Dez0oRoM.js} +1 -1
  57. package/dist/src/view/client/assets/classDiagram-ZZMXUADV-CFZ_Sgh5.js +1 -0
  58. package/dist/src/view/client/assets/classDiagram-v2-VYDZK3BY-CFZ_Sgh5.js +1 -0
  59. package/dist/src/view/client/assets/{cose-bilkent-JH36ORCC-BCw7fCC2.js → cose-bilkent-JH36ORCC-BHtud6Hg.js} +1 -1
  60. package/dist/src/view/client/assets/{cynefin-OW5HDTMX--lYN4N9m.js → cynefin-OW5HDTMX-BjBW8VGk.js} +1 -1
  61. package/dist/src/view/client/assets/{cynefinDiagram-5FMLGOSQ-9sK5EV7v.js → cynefinDiagram-5FMLGOSQ-DwGuD7oF.js} +1 -1
  62. package/dist/src/view/client/assets/{dagre-GXQ25YYZ-CoMdEFCq.js → dagre-GXQ25YYZ-C5zSlGK9.js} +1 -1
  63. package/dist/src/view/client/assets/{diagram-S7CK7UJ4-D13dyWdd.js → diagram-S7CK7UJ4-C_NhA3bj.js} +1 -1
  64. package/dist/src/view/client/assets/{diagram-UQ7AKVKN-PdwLPPPA.js → diagram-UQ7AKVKN-az7QPYNb.js} +1 -1
  65. package/dist/src/view/client/assets/{diagram-VSXAHHWV-CtWWa_A7.js → diagram-VSXAHHWV-BRvDuM8_.js} +1 -1
  66. package/dist/src/view/client/assets/{diagram-VX7I27RA-BeCYcSU-.js → diagram-VX7I27RA-BWLgF6S-.js} +1 -1
  67. package/dist/src/view/client/assets/{diagram-Z3DM3KII-DiWabOBM.js → diagram-Z3DM3KII-DV3d6mL5.js} +1 -1
  68. package/dist/src/view/client/assets/{ebnfDiagram-PWID7BFC-CZQ3MD_K.js → ebnfDiagram-PWID7BFC-yUXrEAvK.js} +1 -1
  69. package/dist/src/view/client/assets/{erDiagram-RLTQ6QDP-B1AhXIrP.js → erDiagram-RLTQ6QDP-D35FN1Pt.js} +1 -1
  70. package/dist/src/view/client/assets/{flowDiagram-HODETNUW-Bhr0JM6P.js → flowDiagram-HODETNUW-BciZqsjT.js} +1 -1
  71. package/dist/src/view/client/assets/{ganttDiagram-EL5Y4UJY-CbP8iAkg.js → ganttDiagram-EL5Y4UJY-BysPGgXS.js} +1 -1
  72. package/dist/src/view/client/assets/{gitGraphDiagram-WWUBYQGX-B9uuGdLF.js → gitGraphDiagram-WWUBYQGX-C3DdJ5xG.js} +1 -1
  73. package/dist/src/view/client/assets/index-CJokoRSp.js +13 -0
  74. package/dist/src/view/client/assets/{infoDiagram-27XIBGKW-BrfwQ_Cq.js → infoDiagram-27XIBGKW-D3HZrDRb.js} +1 -1
  75. package/dist/src/view/client/assets/{ishikawaDiagram-5VMMS53U-CHtJ36re.js → ishikawaDiagram-5VMMS53U-BXyVIXTU.js} +1 -1
  76. package/dist/src/view/client/assets/{journeyDiagram-3NMN7TZE-BChcgX1s.js → journeyDiagram-3NMN7TZE-D4-1NxVU.js} +1 -1
  77. package/dist/src/view/client/assets/{kanban-definition-UXKFOSKX-BnwFsKiB.js → kanban-definition-UXKFOSKX-4Gu_5yBA.js} +1 -1
  78. package/dist/src/view/client/assets/{layout-Dnd0pLdb.js → layout-Jf1K3TMM.js} +1 -1
  79. package/dist/src/view/client/assets/{linear-CFhW2ozn.js → linear-DWfwzUT_.js} +1 -1
  80. package/dist/src/view/client/assets/{mermaid.core--OP6lXtW.js → mermaid.core-DMx_DAl8.js} +5 -5
  81. package/dist/src/view/client/assets/{mindmap-definition-YA3MSWOX-D51y2zbm.js → mindmap-definition-YA3MSWOX-8pxY_RWi.js} +1 -1
  82. package/dist/src/view/client/assets/{pegDiagram-XKGWAZYB--zyQJDvI.js → pegDiagram-XKGWAZYB-DNAw_O5t.js} +1 -1
  83. package/dist/src/view/client/assets/{pieDiagram-E7YTZNPT-Cj8mvpJy.js → pieDiagram-E7YTZNPT-uuvRCDkC.js} +1 -1
  84. package/dist/src/view/client/assets/{quadrantDiagram-AXDQQJYC-qvhJrnBf.js → quadrantDiagram-AXDQQJYC-BER2O4Aq.js} +1 -1
  85. package/dist/src/view/client/assets/{railroadDiagram-O6MQD6OU-CtWvxpSo.js → railroadDiagram-O6MQD6OU-CxEsJ_0n.js} +1 -1
  86. package/dist/src/view/client/assets/{requirementDiagram-BXWQKSXE-CBxen_KG.js → requirementDiagram-BXWQKSXE-yS9rspca.js} +1 -1
  87. package/dist/src/view/client/assets/{sankeyDiagram-P5KCCOFB-B_fUkmfc.js → sankeyDiagram-P5KCCOFB-Bqt70a2j.js} +1 -1
  88. package/dist/src/view/client/assets/{sequenceDiagram-WJ2MYXX4-Dclv4p68.js → sequenceDiagram-WJ2MYXX4-BvOOEJNr.js} +1 -1
  89. package/dist/src/view/client/assets/{sizeCapture-INFHLROL-GfG0sMTZ.js → sizeCapture-INFHLROL-CvO_Pjjo.js} +1 -1
  90. package/dist/src/view/client/assets/{stateDiagram-D77RDMKH-YQWPnzxU.js → stateDiagram-D77RDMKH-KLmVOZkq.js} +1 -1
  91. package/dist/src/view/client/assets/stateDiagram-v2-MP3YSRHH-KCS8Mdzu.js +1 -0
  92. package/dist/src/view/client/assets/{swimlanes-42K2YHIH-5yiCveVS.js → swimlanes-42K2YHIH-DC1r4_sq.js} +1 -1
  93. package/dist/src/view/client/assets/swimlanesDiagram-VR7AAH4N-B2TcAwis.js +8 -0
  94. package/dist/src/view/client/assets/{timeline-definition-24CTP7MA-BvAbB5Zs.js → timeline-definition-24CTP7MA-ChXLOuBL.js} +1 -1
  95. package/dist/src/view/client/assets/{vennDiagram-4TSXK5OY-guC-r60n.js → vennDiagram-4TSXK5OY-D9_h25-Y.js} +1 -1
  96. package/dist/src/view/client/assets/{wardleyDiagram-VM6X3IG4-C0yXcU2x.js → wardleyDiagram-VM6X3IG4-CsQJGGW0.js} +1 -1
  97. package/dist/src/view/client/assets/{xychartDiagram-S5SC5T6Z-RPmkPNfK.js → xychartDiagram-S5SC5T6Z-DGMuPMlm.js} +1 -1
  98. package/dist/src/view/client/index.html +1 -1
  99. package/dist/src/view/diagnostics.d.ts +2 -2
  100. package/dist/src/view/diagnostics.js +5 -5
  101. package/dist/src/view/external-document-tree.js +1 -1
  102. package/dist/src/view/git-diff.js +1 -1
  103. package/dist/src/view/git.js +1 -1
  104. package/dist/src/view/graph.d.ts +2 -2
  105. package/dist/src/view/graph.js +2 -2
  106. package/dist/src/view/markdown.js +1 -1
  107. package/dist/src/view/preindexed-search.d.ts +1 -1
  108. package/dist/src/view/protocol.d.ts +2 -18
  109. package/dist/src/view/publication.d.ts +2 -0
  110. package/dist/src/view/publication.js +78 -0
  111. package/dist/src/view/references.d.ts +3 -3
  112. package/dist/src/view/references.js +3 -3
  113. package/dist/src/view/repository.d.ts +6 -6
  114. package/dist/src/view/repository.js +28 -14
  115. package/dist/src/view/request-security.d.ts +5 -0
  116. package/dist/src/view/request-security.js +46 -0
  117. package/dist/src/view/search-result.d.ts +1 -1
  118. package/dist/src/view/search-result.js +1 -1
  119. package/dist/src/view/search.d.ts +1 -1
  120. package/dist/src/view/server-build.d.ts +2 -2
  121. package/dist/src/view/server-build.js +2 -2
  122. package/dist/src/view/server-deployment.d.ts +1 -2
  123. package/dist/src/view/server-deployment.js +6 -46
  124. package/dist/src/view/server-index-worker.d.ts +1 -1
  125. package/dist/src/view/server.d.ts +1 -1
  126. package/dist/src/view/server.js +13 -3
  127. package/dist/src/view/source-target.js +2 -2
  128. package/dist/src/view/static-build.d.ts +1 -1
  129. package/dist/src/view/static-build.js +49 -17
  130. package/dist/src/view/store.d.ts +4 -2
  131. package/dist/src/view/store.js +31 -19
  132. package/dist/src/view/table-of-contents.d.ts +1 -1
  133. package/dist/src/view/table-of-contents.js +1 -1
  134. package/dist/src/view/vercel-server-build.d.ts +1 -1
  135. package/package.json +19 -29
  136. package/templates/AGENTS.md +2 -2
  137. package/templates/cursor-rules.md +2 -2
  138. package/templates/opencode-plugin.ts +9 -9
  139. package/templates/pi-extension.ts +11 -11
  140. package/templates/skill/SKILL.md +2 -1
  141. package/dist/src/cli/check-context.d.ts +0 -56
  142. package/dist/src/cli/check-context.js +0 -215
  143. package/dist/src/cli/check-coverage.d.ts +0 -2
  144. package/dist/src/cli/check-coverage.js +0 -75
  145. package/dist/src/cli/check-frontmatter.d.ts +0 -12
  146. package/dist/src/cli/check-frontmatter.js +0 -44
  147. package/dist/src/cli/check-mode.d.ts +0 -21
  148. package/dist/src/cli/check-mode.js +0 -394
  149. package/dist/src/cli/check-status.d.ts +0 -74
  150. package/dist/src/cli/check-status.js +0 -217
  151. package/dist/src/cli/check.d.ts +0 -52
  152. package/dist/src/cli/check.js +0 -834
  153. package/dist/src/cli/context.d.ts +0 -11
  154. package/dist/src/cli/context.js +0 -58
  155. package/dist/src/cli/expand.d.ts +0 -7
  156. package/dist/src/cli/expand.js +0 -141
  157. package/dist/src/cli/external.d.ts +0 -11
  158. package/dist/src/cli/external.js +0 -185
  159. package/dist/src/cli/gen-index.d.ts +0 -45
  160. package/dist/src/cli/gen-index.js +0 -235
  161. package/dist/src/cli/link-scheme.d.ts +0 -54
  162. package/dist/src/cli/link-scheme.js +0 -101
  163. package/dist/src/cli/locate.d.ts +0 -2
  164. package/dist/src/cli/locate.js +0 -18
  165. package/dist/src/cli/refs.d.ts +0 -23
  166. package/dist/src/cli/refs.js +0 -274
  167. package/dist/src/cli/section.d.ts +0 -45
  168. package/dist/src/cli/section.js +0 -328
  169. package/dist/src/cli/select-menu.d.ts +0 -13
  170. package/dist/src/cli/select-menu.js +0 -100
  171. package/dist/src/code-refs.d.ts +0 -29
  172. package/dist/src/code-refs.js +0 -479
  173. package/dist/src/config.d.ts +0 -29
  174. package/dist/src/config.js +0 -83
  175. package/dist/src/context.d.ts +0 -26
  176. package/dist/src/context.js +0 -11
  177. package/dist/src/document-formats.d.ts +0 -7
  178. package/dist/src/document-formats.js +0 -39
  179. package/dist/src/extensions/alert-marker.d.ts +0 -25
  180. package/dist/src/extensions/alert-marker.js +0 -55
  181. package/dist/src/extensions/wiki-link/from-markdown.d.ts +0 -5
  182. package/dist/src/extensions/wiki-link/from-markdown.js +0 -34
  183. package/dist/src/extensions/wiki-link/index.d.ts +0 -4
  184. package/dist/src/extensions/wiki-link/index.js +0 -3
  185. package/dist/src/extensions/wiki-link/syntax.d.ts +0 -14
  186. package/dist/src/extensions/wiki-link/syntax.js +0 -121
  187. package/dist/src/extensions/wiki-link/to-markdown.d.ts +0 -5
  188. package/dist/src/extensions/wiki-link/to-markdown.js +0 -28
  189. package/dist/src/extensions/wiki-link/types.d.ts +0 -34
  190. package/dist/src/extensions/wiki-link/types.js +0 -1
  191. package/dist/src/external-documents.d.ts +0 -56
  192. package/dist/src/external-documents.js +0 -404
  193. package/dist/src/external-sources.d.ts +0 -136
  194. package/dist/src/external-sources.js +0 -1098
  195. package/dist/src/fork/frontmatter-fields.d.ts +0 -36
  196. package/dist/src/fork/frontmatter-fields.js +0 -23
  197. package/dist/src/format.d.ts +0 -16
  198. package/dist/src/format.js +0 -76
  199. package/dist/src/init-version.d.ts +0 -10
  200. package/dist/src/init-version.js +0 -49
  201. package/dist/src/lattice-model.d.ts +0 -84
  202. package/dist/src/lattice-model.js +0 -467
  203. package/dist/src/lattice.d.ts +0 -14
  204. package/dist/src/lattice.js +0 -353
  205. package/dist/src/markdown-analysis-cache.d.ts +0 -20
  206. package/dist/src/markdown-analysis-cache.js +0 -139
  207. package/dist/src/markdown-analysis-worker.d.ts +0 -16
  208. package/dist/src/markdown-analysis-worker.js +0 -33
  209. package/dist/src/markdown-analysis.d.ts +0 -61
  210. package/dist/src/markdown-analysis.js +0 -169
  211. package/dist/src/markdown-analyzer-loader.d.ts +0 -4
  212. package/dist/src/markdown-analyzer-loader.js +0 -13
  213. package/dist/src/markdown-validation.d.ts +0 -25
  214. package/dist/src/markdown-validation.js +0 -104
  215. package/dist/src/parser-cache.d.ts +0 -17
  216. package/dist/src/parser-cache.js +0 -65
  217. package/dist/src/parser-import.d.ts +0 -8
  218. package/dist/src/parser-import.js +0 -1
  219. package/dist/src/parser.d.ts +0 -3
  220. package/dist/src/parser.js +0 -93
  221. package/dist/src/path.d.ts +0 -2
  222. package/dist/src/path.js +0 -4
  223. package/dist/src/profiler.d.ts +0 -16
  224. package/dist/src/profiler.js +0 -81
  225. package/dist/src/project-analysis.d.ts +0 -59
  226. package/dist/src/project-analysis.js +0 -233
  227. package/dist/src/project-discovery.d.ts +0 -6
  228. package/dist/src/project-discovery.js +0 -30
  229. package/dist/src/repository-path.d.ts +0 -11
  230. package/dist/src/repository-path.js +0 -52
  231. package/dist/src/source-formats.d.ts +0 -7
  232. package/dist/src/source-formats.js +0 -30
  233. package/dist/src/source-parser.d.ts +0 -67
  234. package/dist/src/source-parser.js +0 -1749
  235. package/dist/src/untrusted.d.ts +0 -18
  236. package/dist/src/untrusted.js +0 -93
  237. package/dist/src/view/client/assets/channel-uy0fFvcW.js +0 -1
  238. package/dist/src/view/client/assets/classDiagram-ZZMXUADV-DbSEqjA5.js +0 -1
  239. package/dist/src/view/client/assets/classDiagram-v2-VYDZK3BY-DbSEqjA5.js +0 -1
  240. package/dist/src/view/client/assets/index-nBmbYfun.js +0 -13
  241. package/dist/src/view/client/assets/stateDiagram-v2-MP3YSRHH-gUj6Hzgl.js +0 -1
  242. package/dist/src/view/client/assets/swimlanesDiagram-VR7AAH4N-DR7JhrxL.js +0 -8
  243. package/dist/src/walk.d.ts +0 -20
  244. package/dist/src/walk.js +0 -121
@@ -1,36 +0,0 @@
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
- };
@@ -1,23 +0,0 @@
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,16 +0,0 @@
1
- import type { SourceSpan } from './search/types.js';
2
- import type { Section, SectionMatch } from './lattice-model.js';
3
- import type { CmdContext, Styler } from './context.js';
4
- export declare function formatSectionId(id: string, s: Styler): string;
5
- export declare function formatSectionPreview(ctx: CmdContext, section: Section, opts?: {
6
- reason?: string;
7
- score?: number;
8
- text?: string;
9
- debug?: string;
10
- spans?: SourceSpan[];
11
- }): string;
12
- export declare function formatResultList(ctx: CmdContext, header: string, matches: SectionMatch[], opts?: {
13
- showScores?: boolean;
14
- preview?: 'passage' | 'intro' | 'both';
15
- }): string;
16
- export declare function formatNavHints(ctx: CmdContext): string;
@@ -1,76 +0,0 @@
1
- import { join, relative } from 'node:path';
2
- export function formatSectionId(id, s) {
3
- const parts = id.split('#');
4
- return parts.length === 1
5
- ? s.boldWhite(parts[0])
6
- : s.dim(parts.slice(0, -1).join('#') + '#') +
7
- s.boldWhite(parts[parts.length - 1]);
8
- }
9
- export function formatSectionPreview(ctx, section, opts) {
10
- const s = ctx.styler;
11
- const relPath = relative(process.cwd(), join(ctx.projectRoot, section.filePath));
12
- const kind = section.id.includes('#') ? 'Section' : 'File';
13
- const details = [
14
- opts?.reason,
15
- opts?.debug,
16
- opts?.score === undefined ? undefined : `score: ${opts.score.toFixed(6)}`,
17
- ].filter((detail) => detail !== undefined);
18
- const detailsSuffix = details.length > 0 ? ' ' + s.dim(`(${details.join(', ')})`) : '';
19
- const lines = [
20
- `${s.dim('*')} ${s.dim(kind + ':')} [[${formatSectionId(section.id, s)}]]${detailsSuffix}`,
21
- ` ${s.dim('Defined in')} ${s.cyan(relPath)}${s.dim(`:${section.startLine}-${section.endLine}`)}`,
22
- ];
23
- if (opts?.spans?.length)
24
- lines.push(` ${s.dim('Matched lines:')} ${opts.spans.map((span) => `${span.startLine}-${span.endLine}`).join(', ')}`);
25
- const text = opts?.text ?? section.firstParagraph;
26
- if (text)
27
- lines.push('', ...text.split('\n').map((line) => ` ${s.dim('>')} ${line}`));
28
- return lines.join('\n');
29
- }
30
- export function formatResultList(ctx, header, matches, opts) {
31
- const lines = ['', `## ${header}`, ''];
32
- for (let i = 0; i < matches.length; i++) {
33
- if (i > 0)
34
- lines.push('');
35
- lines.push(formatSectionPreview(ctx, matches[i].section, {
36
- reason: matches[i].reason,
37
- spans: opts?.preview === 'intro'
38
- ? undefined
39
- : matches[i].evidence?.[0]?.spans,
40
- score: opts?.showScores ? matches[i].rankScore : undefined,
41
- text: opts?.preview === 'intro'
42
- ? undefined
43
- : matches[i].evidence?.length
44
- ? (opts?.preview === 'both'
45
- ? matches[i].section.firstParagraph + '\n\n'
46
- : '') + matches[i].evidence[0].text
47
- : undefined,
48
- debug: opts?.showScores && matches[i].rankScore !== undefined
49
- ? JSON.stringify({
50
- lexicalRank: matches[i].lexicalRank,
51
- semanticRank: matches[i].semanticRank,
52
- lexicalScore: matches[i].lexicalScore,
53
- semanticSimilarity: matches[i].semanticSimilarity,
54
- lexicalContribution: matches[i].lexicalRank
55
- ? 1 / (60 + matches[i].lexicalRank)
56
- : 0,
57
- semanticContribution: matches[i].semanticRank
58
- ? 1 / (60 + matches[i].semanticRank)
59
- : 0,
60
- ...matches[i].diagnostics,
61
- })
62
- : undefined,
63
- }));
64
- }
65
- lines.push('');
66
- return lines.join('\n');
67
- }
68
- export function formatNavHints(ctx) {
69
- const s = ctx.styler;
70
- const hints = ctx.mode === 'cli'
71
- ? `${s.dim('*')} \`lat section "section#id"\` \u2014 show full content with outgoing/incoming refs\n` +
72
- `${s.dim('*')} \`lat search "new query"\` \u2014 search for something else`
73
- : `${s.dim('*')} \`lat_section\` \u2014 show full content with outgoing/incoming refs\n` +
74
- `${s.dim('*')} \`lat_search\` \u2014 search for something else`;
75
- return `\n## To navigate further:\n\n${hints}`;
76
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * Bump this number whenever `lat init` setup or defaults change in a way that
3
- * requires users to re-run it (e.g. new hooks, generated files, MCP config, or
4
- * a configuration migration).
5
- */
6
- export declare const INIT_VERSION = 7;
7
- export declare function readInitVersion(latDir: string): number | null;
8
- export declare function readFileHash(latDir: string, relPath: string): string | null;
9
- export declare function contentHash(content: string): string;
10
- export declare function writeInitMeta(latDir: string, fileHashes: Record<string, string>): void;
@@ -1,49 +0,0 @@
1
- import { createHash } from 'node:crypto';
2
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
3
- import { join } from 'node:path';
4
- /**
5
- * Bump this number whenever `lat init` setup or defaults change in a way that
6
- * requires users to re-run it (e.g. new hooks, generated files, MCP config, or
7
- * a configuration migration).
8
- */
9
- export const INIT_VERSION = 7;
10
- function cachePath(latDir) {
11
- return join(latDir, '.cache', 'lat_init.json');
12
- }
13
- function readMeta(latDir) {
14
- const p = cachePath(latDir);
15
- if (!existsSync(p))
16
- return null;
17
- try {
18
- return JSON.parse(readFileSync(p, 'utf-8'));
19
- }
20
- catch {
21
- return null;
22
- }
23
- }
24
- export function readInitVersion(latDir) {
25
- const meta = readMeta(latDir);
26
- if (!meta)
27
- return null;
28
- return typeof meta.init_version === 'number' ? meta.init_version : null;
29
- }
30
- export function readFileHash(latDir, relPath) {
31
- const meta = readMeta(latDir);
32
- return meta?.file_hashes?.[relPath] ?? null;
33
- }
34
- export function contentHash(content) {
35
- return createHash('sha256').update(content).digest('hex');
36
- }
37
- export function writeInitMeta(latDir, fileHashes) {
38
- const cacheDir = join(latDir, '.cache');
39
- mkdirSync(cacheDir, { recursive: true });
40
- // Merge with existing hashes so we don't lose entries from agents
41
- // that weren't selected this run
42
- const existing = readMeta(latDir);
43
- const mergedHashes = { ...existing?.file_hashes, ...fileHashes };
44
- const data = {
45
- init_version: INIT_VERSION,
46
- file_hashes: mergedHashes,
47
- };
48
- writeFileSync(cachePath(latDir), JSON.stringify(data, null, 2) + '\n');
49
- }
@@ -1,84 +0,0 @@
1
- import type { SearchEvidence, SearchDiagnostics } from './search/types.js';
2
- import type { ForkFrontmatter } from './fork/frontmatter-fields.js';
3
- export type Section = {
4
- id: string;
5
- heading: string;
6
- depth: number;
7
- file: string;
8
- filePath: string;
9
- children: Section[];
10
- startLine: number;
11
- endLine: number;
12
- firstParagraph: string;
13
- /** GitHub-compatible anchor generated from the rendered heading text. */
14
- githubSlug?: string;
15
- };
16
- export type Ref = {
17
- target: string;
18
- fromSection: string;
19
- file: string;
20
- line: number;
21
- };
22
- /** An ordinary markdown destination or an undefined reference-style link. */
23
- export type MdLink = {
24
- /** Destination exactly as authored, percent-escapes and all. */
25
- url: string;
26
- kind: 'link' | 'image' | 'definition';
27
- line: number;
28
- } | {
29
- /** Authored label that should have a matching definition. */
30
- identifier: string;
31
- /** Full reference syntax exactly as authored. */
32
- source: string;
33
- kind: 'linkReference' | 'imageReference';
34
- style: 'full' | 'collapsed' | 'shortcut' | 'definition';
35
- line: number;
36
- };
37
- export type LatFrontmatter = {
38
- requireCodeMention?: boolean;
39
- } & ForkFrontmatter;
40
- export declare function flattenSections(sections: Section[]): Section[];
41
- /**
42
- * Build an index mapping path suffixes to their full vault-relative paths.
43
- * Used by resolveRef to allow short references when a suffix is unambiguous.
44
- *
45
- * For a file like `lat.md/guides/setup`, indexes both `guides/setup` and `setup`.
46
- * This ensures backward-compatible short refs after the vault root moved to the
47
- * project root (so section IDs now include the `lat.md/` prefix).
48
- */
49
- export declare function buildFileIndex(sections: Section[]): Map<string, string[]>;
50
- export type SectionSlugIndex = ReadonlyMap<string, string>;
51
- /**
52
- * Map GitHub-slugged heading paths back to canonical, literal-heading ids.
53
- * Every path segment accepts either representation so an implicit literal h1
54
- * can still prefix slugged child headings during short-ref resolution.
55
- */
56
- export declare function buildSectionSlugIndex(sections: Section[]): Map<string, string>;
57
- export type ResolveResult = {
58
- resolved: string;
59
- ambiguous: string[] | null;
60
- /** When ambiguous but exactly one candidate has the section, suggest it. */
61
- suggested: string | null;
62
- };
63
- /**
64
- * Resolve a potentially short reference to its canonical full-path form.
65
- * If the file segment of the ref is a bare stem that uniquely maps to one
66
- * full path, expands it. Otherwise returns the ref unchanged.
67
- *
68
- * When ambiguous (multiple files share the stem), returns all candidates.
69
- * If exactly one candidate actually contains the referenced section,
70
- * `suggested` is set to that candidate so the caller can propose a fix.
71
- */
72
- export declare function resolveRef(target: string, sectionIds: Set<string>, fileIndex: Map<string, string[]>, slugIndex?: SectionSlugIndex): ResolveResult;
73
- export type SectionMatch = {
74
- section: Section;
75
- reason: string;
76
- rankScore?: number;
77
- semanticSimilarity?: number;
78
- lexicalScore?: number;
79
- semanticRank?: number;
80
- lexicalRank?: number;
81
- evidence?: SearchEvidence[];
82
- diagnostics?: SearchDiagnostics;
83
- };
84
- export declare function findSections(sections: Section[], query: string): SectionMatch[];