@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
package/README.md CHANGED
@@ -139,7 +139,7 @@ To use higher-quality hosted embeddings instead, provide an OpenAI (`sk-...`) or
139
139
  1. `LAT_LLM_KEY` env var — direct value
140
140
  2. `LAT_LLM_KEY_FILE` env var — path to a file containing the key
141
141
  3. `LAT_LLM_KEY_HELPER` env var — shell command that prints the key (10s timeout)
142
- 4. Config file — power users can set `llm_key` manually. Run `lat config` to print its location.
142
+ 4. Config file — power users can set `llm_key` manually. Run `lat paths --config` to print its location. Run `lat paths` to see cache and other storage paths with their purposes.
143
143
 
144
144
  Switch backends any time with `lat reindex` (`--local` to force the offline model, `--remote` to use your key).
145
145
 
@@ -0,0 +1,6 @@
1
+ export interface AgentInvocation {
2
+ command: string;
3
+ args: string[];
4
+ }
5
+ /** Generated tools pass user input as argv, never as shell program text. */
6
+ export declare function agentInvocation(style: 'local' | 'global' | 'npx', local: AgentInvocation, platform?: NodeJS.Platform): AgentInvocation;
@@ -0,0 +1,23 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { delimiter, dirname, join } from 'node:path';
3
+ /** Generated tools pass user input as argv, never as shell program text. */
4
+ export function agentInvocation(style, local, platform = process.platform) {
5
+ if (style === 'local')
6
+ return local;
7
+ // Windows npm command shims require cmd.exe. Use the installed entry point
8
+ // directly instead, retaining the Node launcher and its loader arguments.
9
+ if (style === 'global')
10
+ return platform === 'win32' ? local : { command: 'lat', args: [] };
11
+ if (platform !== 'win32')
12
+ return { command: 'npx', args: ['lat.md@latest'] };
13
+ const directories = [
14
+ dirname(process.execPath),
15
+ ...(process.env.PATH ?? '').split(delimiter),
16
+ ];
17
+ for (const directory of directories) {
18
+ const cli = join(directory, 'node_modules', 'npm', 'bin', 'npx-cli.js');
19
+ if (existsSync(cli))
20
+ return { command: process.execPath, args: [cli, 'lat.md@latest'] };
21
+ }
22
+ throw new Error('Cannot find the npm npx entry point. Choose the local command style or install npm.');
23
+ }
@@ -1,7 +1,7 @@
1
1
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
2
2
  import { join } from 'node:path';
3
3
  import { styleText } from 'node:util';
4
- import { contentHash, readFileHash } from '../init-version.js';
4
+ import { contentHash, readFileHash, } from '@plebeiantech/lat.md-core/init-version';
5
5
  import { findTemplatesDir } from './templates.js';
6
6
  /**
7
7
  * The fork's own instruction channel into a consumer project.
@@ -2,8 +2,8 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
2
2
  import { basename, dirname, join } from 'node:path';
3
3
  import { styleText } from 'node:util';
4
4
  import { isMap, isScalar, isSeq, parseDocument } from 'yaml';
5
- import { parseFrontmatter } from '../lattice.js';
6
- import { DIATAXIS_MODES, MODE_DIRS, checkMode, indexNameFor, } from './check-mode.js';
5
+ import { parseFrontmatter } from '@plebeiantech/lat.md-core/lattice';
6
+ import { DIATAXIS_MODES, MODE_DIRS, checkMode, indexNameFor, } from '@plebeiantech/lat.md-core/cli/check-mode';
7
7
  /**
8
8
  * Give a freshly created `lat.md/` the Diátaxis shape, and turn the gate on.
9
9
  *
@@ -1,4 +1,4 @@
1
- import type { CmdContext, CmdResult } from '../context.js';
1
+ import type { CmdContext, CmdResult } from '@plebeiantech/lat.md-core/context';
2
2
  export type GraphOptions = {
3
3
  format?: string;
4
4
  at?: string;
@@ -1,18 +1,18 @@
1
1
  import { execSync } from 'node:child_process';
2
2
  import { lstatSync, readFileSync } from 'node:fs';
3
3
  import { dirname, extname, join } from 'node:path';
4
- import { findLatticeDir } from '../project-discovery.js';
5
- import { findSections } from '../lattice-model.js';
6
- import { plainStyler } from '../context.js';
7
- import { expandPrompt } from './expand.js';
4
+ import { findLatticeDir } from '@plebeiantech/lat.md-core/project-discovery';
5
+ import { findSections } from '@plebeiantech/lat.md-core/lattice-model';
6
+ import { plainStyler, } from '@plebeiantech/lat.md-core/context';
7
+ import { expandPrompt } from '@plebeiantech/lat.md-core/cli/expand';
8
8
  import { runSearch } from './search.js';
9
9
  import { DEFAULT_SEARCH_LIMIT } from '../search/search.js';
10
- import { getSection, formatSectionOutput } from './section.js';
11
- import { checkMd, checkCodeRefs, checkIndex, checkSections } from './check.js';
12
- import { CheckRunContext } from './check-context.js';
13
- import { isSourceFileExtension } from '../source-formats.js';
14
- import { commandProjectAnalysis } from '../project-analysis.js';
15
- import { checkMode } from './check-mode.js';
10
+ import { getSection, formatSectionOutput, } from '@plebeiantech/lat.md-core/cli/section';
11
+ import { checkMd, checkCodeRefs, checkIndex, checkSections, } from '@plebeiantech/lat.md-core/cli/check';
12
+ import { CheckRunContext } from '@plebeiantech/lat.md-core/cli/check-context';
13
+ import { isSourceFileExtension } from '@plebeiantech/lat.md-core/source-formats';
14
+ import { commandProjectAnalysis } from '@plebeiantech/lat.md-core/project-analysis';
15
+ import { checkMode } from '@plebeiantech/lat.md-core/cli/check-mode';
16
16
  import { federateTags, taggedDocsForFiles } from '../knowledge/index.js';
17
17
  import { loadSessionMarkers, saveSessionMarkers, } from '../knowledge/session.js';
18
18
  import { computeCommentReminder, } from './comment-reminder.js';
@@ -115,7 +115,7 @@ async function handleUserPromptSubmit() {
115
115
  // If we can't parse stdin, still emit the reminder
116
116
  }
117
117
  const parts = [];
118
- parts.push("Before starting work, run `lat search` with one or more queries describing the user's intent.", 'ALWAYS do this, even when the task seems straightforward — search results may reveal critical design details, protocols, or constraints.', 'Use `lat section` to read the full content of relevant matches.', 'Do not read files, write code, or run commands until you have searched.', '', 'Remember: `lat.md/` must stay in sync with meaningful codebase state. If you change behavior, architecture, tests, or planned work, update the relevant current-state sections and run `lat check` before finishing. Do not use `lat.md/` as a journal/changelog or add notes for insignificant details.');
118
+ parts.push("Before starting work, run `lat search` with one or more queries describing the user's intent.", 'ALWAYS do this, even when the task seems straightforward — search results may reveal critical design details, protocols, or constraints.', 'Use `lat section` to read the full content of relevant matches.', 'Do not read files, write code, or run commands until you have searched.', '', 'Remember: `lat.md/` must stay in sync with meaningful codebase state. If you change implemented behavior, architecture, or tests, update the relevant current-state sections and run `lat check` before finishing. Plans may be drafted in `lat.md/` alongside implementation, with the intent that by commit time they describe what was implemented. Otherwise, keep proposals, hypothetical designs, and future work outside `lat.md/` unless the user explicitly requests them there. Do not use `lat.md/` as a journal/changelog or add notes for insignificant details.');
119
119
  const latDir = findLatticeDir();
120
120
  if (latDir && userPrompt) {
121
121
  const ctx = makeHookCtx(latDir);
@@ -1,13 +1,7 @@
1
1
  #!/usr/bin/env node
2
- // Suppress deprecation warnings from transitive dependencies unless --verbose
3
- if (!process.argv.includes('--verbose')) {
4
- process.noDeprecation = true;
5
- }
6
- import { existsSync, readFileSync } from 'node:fs';
7
- import { dirname, join } from 'node:path';
8
- import { fileURLToPath } from 'node:url';
9
2
  import { Command, InvalidArgumentError } from 'commander';
10
- import { resolveCheckContext, resolveContext } from './context.js';
3
+ import { handleResult, packageVersion, } from '@plebeiantech/lat.md-core/cli';
4
+ import { resolveContext } from '@plebeiantech/lat.md-core/cli/context';
11
5
  import { DEFAULT_SEARCH_LIMIT, DEFAULT_MIN_SIMILARITY, } from '../search/search.js';
12
6
  function parsePort(value) {
13
7
  if (!/^\d+$/.test(value)) {
@@ -38,8 +32,8 @@ function parseSimilarityThreshold(value) {
38
32
  }
39
33
  return threshold;
40
34
  }
41
- /** Reserve `-- <directory>` for an explicit check target. */
42
- function splitCheckTarget(args) {
35
+ import { resolveCheckContext } from '@plebeiantech/lat.md-core/cli/context';
36
+ function splitCheckTarget(args, name) {
43
37
  let commandIndex = -1;
44
38
  for (let i = 0; i < args.length; i++) {
45
39
  const arg = args[i];
@@ -62,7 +56,7 @@ function splitCheckTarget(args) {
62
56
  return { args };
63
57
  const targets = args.slice(separatorIndex + 1);
64
58
  if (targets.length !== 1 || targets[0] === '') {
65
- console.error('error: `lat check --` expects exactly one directory after `--`');
59
+ console.error(`error: \`${name} check --\` expects exactly one directory after \`--\``);
66
60
  process.exit(1);
67
61
  }
68
62
  return {
@@ -70,45 +64,27 @@ function splitCheckTarget(args) {
70
64
  target: targets[0],
71
65
  };
72
66
  }
73
- const checkTargetArgs = splitCheckTarget(process.argv.slice(2));
74
- function findPackageJson() {
75
- let dir = dirname(fileURLToPath(import.meta.url));
76
- while (true) {
77
- const candidate = join(dir, 'package.json');
78
- try {
79
- return JSON.parse(readFileSync(candidate, 'utf-8')).version;
80
- }
81
- catch { }
82
- const parent = dirname(dir);
83
- if (parent === dir)
84
- return '0.0.0';
85
- dir = parent;
86
- }
87
- }
88
- function handleResult(result) {
89
- if (result.isError) {
90
- console.error(result.output);
91
- process.exit(1);
92
- }
93
- if (result.output)
94
- console.log(result.output);
95
- }
96
- const version = findPackageJson();
67
+ const checkTargetArgs = splitCheckTarget(process.argv.slice(2), 'lat');
97
68
  const program = new Command();
98
69
  program
99
70
  .name('lat')
71
+ .version(packageVersion(import.meta.url))
100
72
  .description('Anchor source code to high-level concepts defined in markdown')
101
- .version(version)
102
73
  .option('--dir <path>', 'project root to look for lat.md in (default: cwd)')
103
74
  .option('--no-color', 'disable color output')
104
75
  .option('--verbose', 'show deprecation warnings and extra diagnostics');
76
+ if (checkTargetArgs.args.includes('--verbose'))
77
+ process.noDeprecation = false;
78
+ else
79
+ process.noDeprecation = true;
80
+ const args = checkTargetArgs.args;
105
81
  program
106
82
  .command('locate')
107
- .description('Find sections by id')
108
- .argument('<query>', 'section id to search for')
83
+ .description('Find section(s) by name or text')
84
+ .argument('<query>', 'name or text to search for')
109
85
  .action(async (query) => {
110
86
  const ctx = resolveContext(program.opts());
111
- const { locateCommand } = await import('./locate.js');
87
+ const { locateCommand } = await import('@plebeiantech/lat.md-core/cli/locate');
112
88
  handleResult(await locateCommand(ctx, query));
113
89
  });
114
90
  program
@@ -117,9 +93,17 @@ program
117
93
  .argument('<query>', 'section id to look up')
118
94
  .action(async (query) => {
119
95
  const ctx = resolveContext(program.opts());
120
- const { sectionCommand } = await import('./section.js');
96
+ const { sectionCommand } = await import('@plebeiantech/lat.md-core/cli/section');
121
97
  handleResult(await sectionCommand(ctx, query));
122
98
  });
99
+ program
100
+ .command('paths')
101
+ .description('Show configuration, cache, and temporary file locations')
102
+ .option('--config', 'show only the user configuration file path')
103
+ .action(async (options) => {
104
+ const { pathsCommand } = await import('@plebeiantech/lat.md-core/cli/paths');
105
+ console.log(pathsCommand({ ...program.opts(), ...options, search: true }));
106
+ });
123
107
  async function runUi(opts) {
124
108
  const ctx = resolveContext(program.opts());
125
109
  const { uiCommand } = await import('./ui.js');
@@ -180,7 +164,7 @@ program
180
164
  process.exit(1);
181
165
  }
182
166
  const ctx = resolveContext(program.opts());
183
- const { refsCommand } = await import('./refs.js');
167
+ const { refsCommand } = await import('@plebeiantech/lat.md-core/cli/refs');
184
168
  handleResult(await refsCommand(ctx, query, scope));
185
169
  });
186
170
  const external = program
@@ -197,7 +181,7 @@ external
197
181
  .option('--fetch-url <template>', 'raw-file URL template')
198
182
  .action(async (handle, repo, opts) => {
199
183
  const ctx = resolveContext(program.opts());
200
- const { externalAddCommand } = await import('./external.js');
184
+ const { externalAddCommand } = await import('@plebeiantech/lat.md-core/cli/external');
201
185
  handleResult(await externalAddCommand(ctx, handle, repo, opts));
202
186
  });
203
187
  external
@@ -206,7 +190,7 @@ external
206
190
  .option('--json', 'emit structured JSON')
207
191
  .action(async (source, opts) => {
208
192
  const ctx = resolveContext(program.opts());
209
- const { externalShowCommand } = await import('./external.js');
193
+ const { externalShowCommand } = await import('@plebeiantech/lat.md-core/cli/external');
210
194
  handleResult(await externalShowCommand(ctx, source, !!opts.json));
211
195
  });
212
196
  external
@@ -214,7 +198,7 @@ external
214
198
  .option('--json', 'emit structured JSON')
215
199
  .action(async (opts) => {
216
200
  const ctx = resolveContext(program.opts());
217
- const { externalListCommand } = await import('./external.js');
201
+ const { externalListCommand } = await import('@plebeiantech/lat.md-core/cli/external');
218
202
  handleResult(await externalListCommand(ctx, !!opts.json));
219
203
  });
220
204
  const check = program
@@ -225,7 +209,7 @@ const check = program
225
209
  .option('--profile', 'show detailed validation timing')
226
210
  .action(async (opts) => {
227
211
  const ctx = resolveCheckContext(program.opts(), checkTargetArgs.target);
228
- const { checkAllCommand } = await import('./check.js');
212
+ const { checkAllCommand } = await import('@plebeiantech/lat.md-core/cli/check');
229
213
  handleResult(await checkAllCommand(ctx, {
230
214
  fix: opts.fix,
231
215
  profile: !!opts.profile,
@@ -237,7 +221,7 @@ check
237
221
  .description('Validate wiki links in markdown files')
238
222
  .action(async () => {
239
223
  const ctx = resolveCheckContext(program.opts(), checkTargetArgs.target);
240
- const { checkMdCommand } = await import('./check.js');
224
+ const { checkMdCommand } = await import('@plebeiantech/lat.md-core/cli/check');
241
225
  handleResult(await checkMdCommand(ctx));
242
226
  });
243
227
  check
@@ -246,7 +230,7 @@ check
246
230
  .description('Validate relative markdown links')
247
231
  .action(async () => {
248
232
  const ctx = resolveCheckContext(program.opts(), checkTargetArgs.target);
249
- const { checkLinksCommand } = await import('./check.js');
233
+ const { checkLinksCommand } = await import('@plebeiantech/lat.md-core/cli/check');
250
234
  handleResult(await checkLinksCommand(ctx));
251
235
  });
252
236
  check
@@ -255,7 +239,7 @@ check
255
239
  .description('Validate @lat code references and coverage')
256
240
  .action(async () => {
257
241
  const ctx = resolveCheckContext(program.opts(), checkTargetArgs.target);
258
- const { checkCodeRefsCommand } = await import('./check.js');
242
+ const { checkCodeRefsCommand } = await import('@plebeiantech/lat.md-core/cli/check');
259
243
  handleResult(await checkCodeRefsCommand(ctx));
260
244
  });
261
245
  check
@@ -270,7 +254,7 @@ check
270
254
  // read it off `check.opts()` instead.
271
255
  .action(async () => {
272
256
  const ctx = resolveCheckContext(program.opts(), checkTargetArgs.target);
273
- const { checkIndexCommand } = await import('./check.js');
257
+ const { checkIndexCommand } = await import('@plebeiantech/lat.md-core/cli/check');
274
258
  handleResult(await checkIndexCommand(ctx, { fix: check.opts().fix }));
275
259
  });
276
260
  check
@@ -279,7 +263,7 @@ check
279
263
  .description('Validate section leading paragraphs')
280
264
  .action(async () => {
281
265
  const ctx = resolveCheckContext(program.opts(), checkTargetArgs.target);
282
- const { checkSectionsCommand } = await import('./check.js');
266
+ const { checkSectionsCommand } = await import('@plebeiantech/lat.md-core/cli/check');
283
267
  handleResult(await checkSectionsCommand(ctx));
284
268
  });
285
269
  check
@@ -288,7 +272,7 @@ check
288
272
  .description('Validate Diátaxis modes and document shape')
289
273
  .action(async () => {
290
274
  const ctx = resolveCheckContext(program.opts(), checkTargetArgs.target);
291
- const { checkModeCommand } = await import('./check.js');
275
+ const { checkModeCommand } = await import('@plebeiantech/lat.md-core/cli/check');
292
276
  handleResult(await checkModeCommand(ctx));
293
277
  });
294
278
  check
@@ -297,7 +281,7 @@ check
297
281
  .description('Validate provenance status and detect stale reviews')
298
282
  .action(async () => {
299
283
  const ctx = resolveCheckContext(program.opts(), checkTargetArgs.target);
300
- const { checkStatusCommand } = await import('./check.js');
284
+ const { checkStatusCommand } = await import('@plebeiantech/lat.md-core/cli/check');
301
285
  handleResult(await checkStatusCommand(ctx));
302
286
  });
303
287
  async function runExpand(text, opts) {
@@ -313,7 +297,7 @@ async function runExpand(text, opts) {
313
297
  process.exit(1);
314
298
  }
315
299
  const ctx = resolveContext(program.opts());
316
- const { expandCommand } = await import('./expand.js');
300
+ const { expandCommand } = await import('@plebeiantech/lat.md-core/cli/expand');
317
301
  const result = await expandCommand(ctx, text);
318
302
  if (result.isError) {
319
303
  console.error(result.output);
@@ -405,13 +389,11 @@ program
405
389
  await startMcpServer();
406
390
  });
407
391
  program
408
- .command('config')
409
- .description('Show configuration file path')
392
+ .command('config', { hidden: true })
393
+ .description('Alias for paths --config')
410
394
  .action(async () => {
411
- const { getConfigPath } = await import('../config.js');
412
- const configPath = getConfigPath();
413
- const exists = existsSync(configPath);
414
- console.log(`Config file: ${configPath}${exists ? '' : ' (not found)'}`);
395
+ const { pathsCommand } = await import('@plebeiantech/lat.md-core/cli/paths');
396
+ console.log(pathsCommand({ config: true }));
415
397
  });
416
398
  program
417
399
  .command('graph')
@@ -1,8 +1,9 @@
1
- import { existsSync, readFileSync, writeFileSync } from 'node:fs';
2
- import { join } from 'node:path';
1
+ import { projectWritePath, writeProjectFile, } from '@plebeiantech/lat.md-core/project-write';
2
+ import { existsSync, readFileSync } from 'node:fs';
3
+ import { dirname, join } from 'node:path';
3
4
  import { isMap, parseDocument } from 'yaml';
4
5
  function readPreferences(latDir) {
5
- const path = join(latDir, 'config.local.yaml');
6
+ const path = projectWritePath(dirname(latDir), join(latDir, 'config.local.yaml'));
6
7
  const document = parseDocument(existsSync(path) ? readFileSync(path, 'utf8') : '');
7
8
  if (document.errors.length > 0) {
8
9
  throw new Error(`Cannot parse ${path}: ${document.errors[0].message}`);
@@ -31,5 +32,5 @@ export function readInitAgents(latDir) {
31
32
  export function writeInitAgents(latDir, agents) {
32
33
  const { path, document } = readPreferences(latDir);
33
34
  document.setIn(['init', 'agents'], agents);
34
- writeFileSync(path, document.toString());
35
+ writeProjectFile(dirname(latDir), path, document.toString());
35
36
  }
@@ -3,7 +3,7 @@ type LatCommandStyle = 'global' | 'local' | 'npx';
3
3
  * Remove all lat-owned hook entries from settings, then add fresh ones.
4
4
  * Preserves any non-lat hooks the user may have configured.
5
5
  */
6
- export declare function syncLatHooks(settingsPath: string, style: LatCommandStyle, agent?: 'claude' | 'codex'): void;
6
+ export declare function syncLatHooks(settingsPath: string, style: LatCommandStyle, agent?: 'claude' | 'codex', root?: string): void;
7
7
  export declare function readLogo(): string;
8
8
  export declare function ensureLatLocalConfigIgnored(latDir: string): void;
9
9
  export declare function initCmd(targetDir?: string): Promise<void>;