lmgrep 0.1.18 → 0.2.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 (414) hide show
  1. package/README.md +253 -62
  2. package/completions/_lmgrep +49 -40
  3. package/dist/application/Lmgrep.d.ts +107 -0
  4. package/dist/application/Lmgrep.js +99 -0
  5. package/dist/application/Lmgrep.js.map +1 -0
  6. package/dist/application/LmgrepFactory.d.ts +40 -0
  7. package/dist/application/LmgrepFactory.js +155 -0
  8. package/dist/application/LmgrepFactory.js.map +1 -0
  9. package/dist/application/indexing/BranchBootstrapper.d.ts +21 -0
  10. package/dist/application/indexing/BranchBootstrapper.js +52 -0
  11. package/dist/application/indexing/BranchBootstrapper.js.map +1 -0
  12. package/dist/application/indexing/BranchManifestSweeper.d.ts +17 -0
  13. package/dist/application/indexing/BranchManifestSweeper.js +35 -0
  14. package/dist/application/indexing/BranchManifestSweeper.js.map +1 -0
  15. package/dist/application/indexing/Duration.d.ts +9 -0
  16. package/dist/application/indexing/Duration.js +25 -0
  17. package/dist/application/indexing/Duration.js.map +1 -0
  18. package/dist/application/indexing/EmbeddingAbortError.d.ts +11 -0
  19. package/dist/application/indexing/EmbeddingAbortError.js +20 -0
  20. package/dist/application/indexing/EmbeddingAbortError.js.map +1 -0
  21. package/dist/application/indexing/EmbeddingPipeline.d.ts +59 -0
  22. package/dist/application/indexing/EmbeddingPipeline.js +140 -0
  23. package/dist/application/indexing/EmbeddingPipeline.js.map +1 -0
  24. package/dist/application/indexing/IndexBuilder.d.ts +112 -0
  25. package/dist/application/indexing/IndexBuilder.js +370 -0
  26. package/dist/application/indexing/IndexBuilder.js.map +1 -0
  27. package/dist/application/indexing/IndexingProgress.d.ts +34 -0
  28. package/dist/application/indexing/IndexingProgress.js +2 -0
  29. package/dist/application/indexing/IndexingProgress.js.map +1 -0
  30. package/dist/application/operations/Deadline.d.ts +13 -0
  31. package/dist/application/operations/Deadline.js +29 -0
  32. package/dist/application/operations/Deadline.js.map +1 -0
  33. package/dist/application/operations/HealthMonitor.d.ts +58 -0
  34. package/dist/application/operations/HealthMonitor.js +128 -0
  35. package/dist/application/operations/HealthMonitor.js.map +1 -0
  36. package/dist/application/operations/IndexAlternatives.d.ts +35 -0
  37. package/dist/application/operations/IndexAlternatives.js +61 -0
  38. package/dist/application/operations/IndexAlternatives.js.map +1 -0
  39. package/dist/application/operations/IndexInventory.d.ts +69 -0
  40. package/dist/application/operations/IndexInventory.js +99 -0
  41. package/dist/application/operations/IndexInventory.js.map +1 -0
  42. package/dist/application/operations/StatusService.d.ts +90 -0
  43. package/dist/application/operations/StatusService.js +171 -0
  44. package/dist/application/operations/StatusService.js.map +1 -0
  45. package/dist/application/operations/WatchService.d.ts +67 -0
  46. package/dist/application/operations/WatchService.js +145 -0
  47. package/dist/application/operations/WatchService.js.map +1 -0
  48. package/dist/application/operations/WorkingTreeDiff.d.ts +19 -0
  49. package/dist/application/operations/WorkingTreeDiff.js +36 -0
  50. package/dist/application/operations/WorkingTreeDiff.js.map +1 -0
  51. package/dist/application/research/ResearchAgent.d.ts +68 -0
  52. package/dist/application/research/ResearchAgent.js +201 -0
  53. package/dist/application/research/ResearchAgent.js.map +1 -0
  54. package/dist/application/research/ResearchPrompts.d.ts +16 -0
  55. package/dist/application/research/ResearchPrompts.js +34 -0
  56. package/dist/application/research/ResearchPrompts.js.map +1 -0
  57. package/dist/application/search/SearchCriteria.d.ts +37 -0
  58. package/dist/application/search/SearchCriteria.js +48 -0
  59. package/dist/application/search/SearchCriteria.js.map +1 -0
  60. package/dist/application/search/SearchService.d.ts +36 -0
  61. package/dist/application/search/SearchService.js +108 -0
  62. package/dist/application/search/SearchService.js.map +1 -0
  63. package/dist/application/search/SearchTargetResolver.d.ts +56 -0
  64. package/dist/application/search/SearchTargetResolver.js +104 -0
  65. package/dist/application/search/SearchTargetResolver.js.map +1 -0
  66. package/dist/cli.d.ts +1 -1
  67. package/dist/cli.js +4 -953
  68. package/dist/cli.js.map +1 -1
  69. package/dist/domain/config/ConfigSource.d.ts +16 -0
  70. package/dist/domain/config/ConfigSource.js +2 -0
  71. package/dist/domain/config/ConfigSource.js.map +1 -0
  72. package/dist/domain/config/LmgrepConfig.d.ts +53 -0
  73. package/dist/domain/config/LmgrepConfig.js +2 -0
  74. package/dist/domain/config/LmgrepConfig.js.map +1 -0
  75. package/dist/domain/corpus/Chunk.d.ts +49 -0
  76. package/dist/domain/corpus/Chunk.js +60 -0
  77. package/dist/domain/corpus/Chunk.js.map +1 -0
  78. package/dist/domain/corpus/CodeLocation.d.ts +18 -0
  79. package/dist/domain/corpus/CodeLocation.js +34 -0
  80. package/dist/domain/corpus/CodeLocation.js.map +1 -0
  81. package/dist/domain/corpus/ContentHash.d.ts +15 -0
  82. package/dist/domain/corpus/ContentHash.js +30 -0
  83. package/dist/domain/corpus/ContentHash.js.map +1 -0
  84. package/dist/domain/corpus/FileVersion.d.ts +31 -0
  85. package/dist/domain/corpus/FileVersion.js +47 -0
  86. package/dist/domain/corpus/FileVersion.js.map +1 -0
  87. package/dist/domain/corpus/SourceFile.d.ts +26 -0
  88. package/dist/domain/corpus/SourceFile.js +47 -0
  89. package/dist/domain/corpus/SourceFile.js.map +1 -0
  90. package/dist/domain/corpus/Vector.d.ts +37 -0
  91. package/dist/domain/corpus/Vector.js +96 -0
  92. package/dist/domain/corpus/Vector.js.map +1 -0
  93. package/dist/domain/ports/ChatModelPort.d.ts +57 -0
  94. package/dist/domain/ports/ChatModelPort.js +2 -0
  95. package/dist/domain/ports/ChatModelPort.js.map +1 -0
  96. package/dist/domain/ports/ChunkRepositoryPort.d.ts +42 -0
  97. package/dist/domain/ports/ChunkRepositoryPort.js +2 -0
  98. package/dist/domain/ports/ChunkRepositoryPort.js.map +1 -0
  99. package/dist/domain/ports/ChunkerPort.d.ts +5 -0
  100. package/dist/domain/ports/ChunkerPort.js +2 -0
  101. package/dist/domain/ports/ChunkerPort.js.map +1 -0
  102. package/dist/domain/ports/DatabaseSessionPort.d.ts +10 -0
  103. package/dist/domain/ports/DatabaseSessionPort.js +2 -0
  104. package/dist/domain/ports/DatabaseSessionPort.js.map +1 -0
  105. package/dist/domain/ports/EmbedderPort.d.ts +14 -0
  106. package/dist/domain/ports/EmbedderPort.js +2 -0
  107. package/dist/domain/ports/EmbedderPort.js.map +1 -0
  108. package/dist/domain/ports/FileManifestRepositoryPort.d.ts +32 -0
  109. package/dist/domain/ports/FileManifestRepositoryPort.js +2 -0
  110. package/dist/domain/ports/FileManifestRepositoryPort.js.map +1 -0
  111. package/dist/domain/ports/GitPort.d.ts +24 -0
  112. package/dist/domain/ports/GitPort.js +2 -0
  113. package/dist/domain/ports/GitPort.js.map +1 -0
  114. package/dist/domain/ports/IndexMaintenancePort.d.ts +58 -0
  115. package/dist/domain/ports/IndexMaintenancePort.js +2 -0
  116. package/dist/domain/ports/IndexMaintenancePort.js.map +1 -0
  117. package/dist/domain/ports/IndexMetadataPort.d.ts +23 -0
  118. package/dist/domain/ports/IndexMetadataPort.js +2 -0
  119. package/dist/domain/ports/IndexMetadataPort.js.map +1 -0
  120. package/dist/domain/ports/LockPort.d.ts +17 -0
  121. package/dist/domain/ports/LockPort.js +2 -0
  122. package/dist/domain/ports/LockPort.js.map +1 -0
  123. package/dist/domain/ports/LoggerPort.d.ts +5 -0
  124. package/dist/domain/ports/LoggerPort.js +2 -0
  125. package/dist/domain/ports/LoggerPort.js.map +1 -0
  126. package/dist/domain/ports/ProjectIndexesPort.d.ts +20 -0
  127. package/dist/domain/ports/ProjectIndexesPort.js +2 -0
  128. package/dist/domain/ports/ProjectIndexesPort.js.map +1 -0
  129. package/dist/domain/ports/ProjectRegistryPort.d.ts +42 -0
  130. package/dist/domain/ports/ProjectRegistryPort.js +2 -0
  131. package/dist/domain/ports/ProjectRegistryPort.js.map +1 -0
  132. package/dist/domain/ports/StateDirectoryPort.d.ts +29 -0
  133. package/dist/domain/ports/StateDirectoryPort.js +2 -0
  134. package/dist/domain/ports/StateDirectoryPort.js.map +1 -0
  135. package/dist/domain/ports/WorkspacePort.d.ts +38 -0
  136. package/dist/domain/ports/WorkspacePort.js +2 -0
  137. package/dist/domain/ports/WorkspacePort.js.map +1 -0
  138. package/dist/domain/project/Branch.d.ts +20 -0
  139. package/dist/domain/project/Branch.js +33 -0
  140. package/dist/domain/project/Branch.js.map +1 -0
  141. package/dist/domain/project/DatabaseLocation.d.ts +32 -0
  142. package/dist/domain/project/DatabaseLocation.js +35 -0
  143. package/dist/domain/project/DatabaseLocation.js.map +1 -0
  144. package/dist/domain/project/IndexMetadata.d.ts +17 -0
  145. package/dist/domain/project/IndexMetadata.js +2 -0
  146. package/dist/domain/project/IndexMetadata.js.map +1 -0
  147. package/dist/domain/project/ModelIdentity.d.ts +58 -0
  148. package/dist/domain/project/ModelIdentity.js +94 -0
  149. package/dist/domain/project/ModelIdentity.js.map +1 -0
  150. package/dist/domain/project/Project.d.ts +17 -0
  151. package/dist/domain/project/Project.js +21 -0
  152. package/dist/domain/project/Project.js.map +1 -0
  153. package/dist/domain/project/ProjectId.d.ts +28 -0
  154. package/dist/domain/project/ProjectId.js +58 -0
  155. package/dist/domain/project/ProjectId.js.map +1 -0
  156. package/dist/domain/project/ProjectLocator.d.ts +112 -0
  157. package/dist/domain/project/ProjectLocator.js +178 -0
  158. package/dist/domain/project/ProjectLocator.js.map +1 -0
  159. package/dist/domain/research/Citation.d.ts +27 -0
  160. package/dist/domain/research/Citation.js +43 -0
  161. package/dist/domain/research/Citation.js.map +1 -0
  162. package/dist/domain/research/EvidenceLedger.d.ts +47 -0
  163. package/dist/domain/research/EvidenceLedger.js +111 -0
  164. package/dist/domain/research/EvidenceLedger.js.map +1 -0
  165. package/dist/domain/research/ResearchTrace.d.ts +19 -0
  166. package/dist/domain/research/ResearchTrace.js +22 -0
  167. package/dist/domain/research/ResearchTrace.js.map +1 -0
  168. package/dist/domain/retrieval/Hit.d.ts +19 -0
  169. package/dist/domain/retrieval/Hit.js +28 -0
  170. package/dist/domain/retrieval/Hit.js.map +1 -0
  171. package/dist/domain/retrieval/HitList.d.ts +35 -0
  172. package/dist/domain/retrieval/HitList.js +81 -0
  173. package/dist/domain/retrieval/HitList.js.map +1 -0
  174. package/dist/domain/retrieval/MissingIndexError.d.ts +11 -0
  175. package/dist/domain/retrieval/MissingIndexError.js +15 -0
  176. package/dist/domain/retrieval/MissingIndexError.js.map +1 -0
  177. package/dist/index.d.ts +43 -45
  178. package/dist/index.js +30 -567
  179. package/dist/index.js.map +1 -1
  180. package/dist/infrastructure/ai/AiSdkChatModel.d.ts +31 -0
  181. package/dist/infrastructure/ai/AiSdkChatModel.js +137 -0
  182. package/dist/infrastructure/ai/AiSdkChatModel.js.map +1 -0
  183. package/dist/infrastructure/ai/AiSdkEmbedder.d.ts +28 -0
  184. package/dist/infrastructure/ai/AiSdkEmbedder.js +79 -0
  185. package/dist/infrastructure/ai/AiSdkEmbedder.js.map +1 -0
  186. package/dist/infrastructure/ai/DockerModelRunnerProbe.d.ts +16 -0
  187. package/dist/infrastructure/ai/DockerModelRunnerProbe.js +52 -0
  188. package/dist/infrastructure/ai/DockerModelRunnerProbe.js.map +1 -0
  189. package/dist/infrastructure/ai/EmbeddingPrefixes.d.ts +21 -0
  190. package/dist/infrastructure/ai/EmbeddingPrefixes.js +40 -0
  191. package/dist/infrastructure/ai/EmbeddingPrefixes.js.map +1 -0
  192. package/dist/infrastructure/ai/LmStudioProbe.d.ts +18 -0
  193. package/dist/infrastructure/ai/LmStudioProbe.js +49 -0
  194. package/dist/infrastructure/ai/LmStudioProbe.js.map +1 -0
  195. package/dist/infrastructure/ai/LocalModelReloader.d.ts +21 -0
  196. package/dist/infrastructure/ai/LocalModelReloader.js +61 -0
  197. package/dist/infrastructure/ai/LocalModelReloader.js.map +1 -0
  198. package/dist/infrastructure/ai/LocalRuntimeDetector.d.ts +36 -0
  199. package/dist/infrastructure/ai/LocalRuntimeDetector.js +63 -0
  200. package/dist/infrastructure/ai/LocalRuntimeDetector.js.map +1 -0
  201. package/dist/infrastructure/ai/ModelRuntime.d.ts +32 -0
  202. package/dist/infrastructure/ai/ModelRuntime.js +2 -0
  203. package/dist/infrastructure/ai/ModelRuntime.js.map +1 -0
  204. package/dist/infrastructure/ai/OllamaProbe.d.ts +22 -0
  205. package/dist/infrastructure/ai/OllamaProbe.js +71 -0
  206. package/dist/infrastructure/ai/OllamaProbe.js.map +1 -0
  207. package/dist/infrastructure/ai/ProviderFailure.d.ts +16 -0
  208. package/dist/infrastructure/ai/ProviderFailure.js +35 -0
  209. package/dist/infrastructure/ai/ProviderFailure.js.map +1 -0
  210. package/dist/infrastructure/ai/ProviderModuleLoader.d.ts +14 -0
  211. package/dist/infrastructure/ai/ProviderModuleLoader.js +56 -0
  212. package/dist/infrastructure/ai/ProviderModuleLoader.js.map +1 -0
  213. package/dist/infrastructure/ai/ProviderRegistry.d.ts +38 -0
  214. package/dist/infrastructure/ai/ProviderRegistry.js +63 -0
  215. package/dist/infrastructure/ai/ProviderRegistry.js.map +1 -0
  216. package/dist/infrastructure/fs/ConfigLoader.d.ts +59 -0
  217. package/dist/infrastructure/fs/ConfigLoader.js +194 -0
  218. package/dist/infrastructure/fs/ConfigLoader.js.map +1 -0
  219. package/dist/infrastructure/fs/DatabaseLocks.d.ts +52 -0
  220. package/dist/infrastructure/fs/DatabaseLocks.js +92 -0
  221. package/dist/infrastructure/fs/DatabaseLocks.js.map +1 -0
  222. package/dist/infrastructure/fs/DiskUsage.d.ts +6 -0
  223. package/dist/infrastructure/fs/DiskUsage.js +41 -0
  224. package/dist/infrastructure/fs/DiskUsage.js.map +1 -0
  225. package/dist/infrastructure/fs/IndexableFileRules.d.ts +33 -0
  226. package/dist/infrastructure/fs/IndexableFileRules.js +177 -0
  227. package/dist/infrastructure/fs/IndexableFileRules.js.map +1 -0
  228. package/dist/infrastructure/fs/Loggers.d.ts +14 -0
  229. package/dist/infrastructure/fs/Loggers.js +18 -0
  230. package/dist/infrastructure/fs/Loggers.js.map +1 -0
  231. package/dist/infrastructure/fs/PidFileLock.d.ts +40 -0
  232. package/dist/infrastructure/fs/PidFileLock.js +97 -0
  233. package/dist/infrastructure/fs/PidFileLock.js.map +1 -0
  234. package/dist/infrastructure/fs/ProjectIndexes.d.ts +8 -0
  235. package/dist/infrastructure/fs/ProjectIndexes.js +35 -0
  236. package/dist/infrastructure/fs/ProjectIndexes.js.map +1 -0
  237. package/dist/infrastructure/fs/ProjectMetadataStore.d.ts +42 -0
  238. package/dist/infrastructure/fs/ProjectMetadataStore.js +86 -0
  239. package/dist/infrastructure/fs/ProjectMetadataStore.js.map +1 -0
  240. package/dist/infrastructure/fs/ProjectRegistry.d.ts +25 -0
  241. package/dist/infrastructure/fs/ProjectRegistry.js +83 -0
  242. package/dist/infrastructure/fs/ProjectRegistry.js.map +1 -0
  243. package/dist/infrastructure/fs/StateDirectory.d.ts +28 -0
  244. package/dist/infrastructure/fs/StateDirectory.js +71 -0
  245. package/dist/infrastructure/fs/StateDirectory.js.map +1 -0
  246. package/dist/infrastructure/fs/Workspace.d.ts +25 -0
  247. package/dist/infrastructure/fs/Workspace.js +90 -0
  248. package/dist/infrastructure/fs/Workspace.js.map +1 -0
  249. package/dist/infrastructure/git/GitClient.d.ts +34 -0
  250. package/dist/infrastructure/git/GitClient.js +74 -0
  251. package/dist/infrastructure/git/GitClient.js.map +1 -0
  252. package/dist/infrastructure/lancedb/ChunkRepository.d.ts +38 -0
  253. package/dist/infrastructure/lancedb/ChunkRepository.js +166 -0
  254. package/dist/infrastructure/lancedb/ChunkRepository.js.map +1 -0
  255. package/dist/infrastructure/lancedb/DatabaseImporter.d.ts +22 -0
  256. package/dist/infrastructure/lancedb/DatabaseImporter.js +74 -0
  257. package/dist/infrastructure/lancedb/DatabaseImporter.js.map +1 -0
  258. package/dist/infrastructure/lancedb/FileManifestRepository.d.ts +34 -0
  259. package/dist/infrastructure/lancedb/FileManifestRepository.js +137 -0
  260. package/dist/infrastructure/lancedb/FileManifestRepository.js.map +1 -0
  261. package/dist/infrastructure/lancedb/IndexMaintenance.d.ts +53 -0
  262. package/dist/infrastructure/lancedb/IndexMaintenance.js +227 -0
  263. package/dist/infrastructure/lancedb/IndexMaintenance.js.map +1 -0
  264. package/dist/infrastructure/lancedb/LanceTables.d.ts +67 -0
  265. package/dist/infrastructure/lancedb/LanceTables.js +159 -0
  266. package/dist/infrastructure/lancedb/LanceTables.js.map +1 -0
  267. package/dist/{lib/native-tuning.js → infrastructure/lancedb/NativeTuning.js} +1 -1
  268. package/dist/infrastructure/lancedb/NativeTuning.js.map +1 -0
  269. package/dist/infrastructure/lancedb/RowReplication.d.ts +27 -0
  270. package/dist/infrastructure/lancedb/RowReplication.js +82 -0
  271. package/dist/infrastructure/lancedb/RowReplication.js.map +1 -0
  272. package/dist/infrastructure/lancedb/VectorIndexPolicy.d.ts +60 -0
  273. package/dist/infrastructure/lancedb/VectorIndexPolicy.js +72 -0
  274. package/dist/infrastructure/lancedb/VectorIndexPolicy.js.map +1 -0
  275. package/dist/infrastructure/p2p/IndexShare.d.ts +45 -0
  276. package/dist/infrastructure/p2p/IndexShare.js +160 -0
  277. package/dist/infrastructure/p2p/IndexShare.js.map +1 -0
  278. package/dist/infrastructure/p2p/PeerSwarm.d.ts +16 -0
  279. package/dist/infrastructure/p2p/PeerSwarm.js +41 -0
  280. package/dist/infrastructure/p2p/PeerSwarm.js.map +1 -0
  281. package/dist/infrastructure/p2p/SecureChannel.d.ts +60 -0
  282. package/dist/infrastructure/p2p/SecureChannel.js +71 -0
  283. package/dist/infrastructure/p2p/SecureChannel.js.map +1 -0
  284. package/dist/infrastructure/p2p/ShareCode.d.ts +25 -0
  285. package/dist/infrastructure/p2p/ShareCode.js +304 -0
  286. package/dist/infrastructure/p2p/ShareCode.js.map +1 -0
  287. package/dist/infrastructure/process/ProcessRegistry.d.ts +50 -0
  288. package/dist/infrastructure/process/ProcessRegistry.js +109 -0
  289. package/dist/infrastructure/process/ProcessRegistry.js.map +1 -0
  290. package/dist/infrastructure/treesitter/ChunkContextBuilder.d.ts +45 -0
  291. package/dist/infrastructure/treesitter/ChunkContextBuilder.js +159 -0
  292. package/dist/infrastructure/treesitter/ChunkContextBuilder.js.map +1 -0
  293. package/dist/infrastructure/treesitter/EmbeddedTreeSitterAssets.d.ts +8 -0
  294. package/dist/infrastructure/treesitter/EmbeddedTreeSitterAssets.js +12 -0
  295. package/dist/infrastructure/treesitter/EmbeddedTreeSitterAssets.js.map +1 -0
  296. package/dist/infrastructure/treesitter/LanguageCatalog.d.ts +30 -0
  297. package/dist/{lib/chunker/languages.js → infrastructure/treesitter/LanguageCatalog.js} +38 -29
  298. package/dist/infrastructure/treesitter/LanguageCatalog.js.map +1 -0
  299. package/dist/infrastructure/treesitter/SlidingWindowChunker.d.ts +15 -0
  300. package/dist/infrastructure/treesitter/SlidingWindowChunker.js +42 -0
  301. package/dist/infrastructure/treesitter/SlidingWindowChunker.js.map +1 -0
  302. package/dist/infrastructure/treesitter/TreeSitterChunker.d.ts +42 -0
  303. package/dist/infrastructure/treesitter/TreeSitterChunker.js +165 -0
  304. package/dist/infrastructure/treesitter/TreeSitterChunker.js.map +1 -0
  305. package/dist/mcp.d.ts +1 -1
  306. package/dist/mcp.js +14 -72
  307. package/dist/mcp.js.map +1 -1
  308. package/dist/presentation/cli/Cli.d.ts +31 -0
  309. package/dist/presentation/cli/Cli.js +120 -0
  310. package/dist/presentation/cli/Cli.js.map +1 -0
  311. package/dist/presentation/cli/CliOptions.d.ts +18 -0
  312. package/dist/presentation/cli/CliOptions.js +25 -0
  313. package/dist/presentation/cli/CliOptions.js.map +1 -0
  314. package/dist/presentation/cli/CommandContext.d.ts +50 -0
  315. package/dist/presentation/cli/CommandContext.js +88 -0
  316. package/dist/presentation/cli/CommandContext.js.map +1 -0
  317. package/dist/presentation/cli/ConfigTemplate.d.ts +31 -0
  318. package/dist/presentation/cli/ConfigTemplate.js +83 -0
  319. package/dist/presentation/cli/ConfigTemplate.js.map +1 -0
  320. package/dist/presentation/cli/Renderer.d.ts +90 -0
  321. package/dist/presentation/cli/Renderer.js +290 -0
  322. package/dist/presentation/cli/Renderer.js.map +1 -0
  323. package/dist/presentation/cli/commands/AskCommand.d.ts +14 -0
  324. package/dist/presentation/cli/commands/AskCommand.js +48 -0
  325. package/dist/presentation/cli/commands/AskCommand.js.map +1 -0
  326. package/dist/presentation/cli/commands/CompletionsCommand.d.ts +18 -0
  327. package/dist/presentation/cli/commands/CompletionsCommand.js +96 -0
  328. package/dist/presentation/cli/commands/CompletionsCommand.js.map +1 -0
  329. package/dist/presentation/cli/commands/ConfigCommands.d.ts +56 -0
  330. package/dist/presentation/cli/commands/ConfigCommands.js +220 -0
  331. package/dist/presentation/cli/commands/ConfigCommands.js.map +1 -0
  332. package/dist/presentation/cli/commands/IndexCommand.d.ts +18 -0
  333. package/dist/presentation/cli/commands/IndexCommand.js +54 -0
  334. package/dist/presentation/cli/commands/IndexCommand.js.map +1 -0
  335. package/dist/presentation/cli/commands/ProjectsCommand.d.ts +48 -0
  336. package/dist/presentation/cli/commands/ProjectsCommand.js +240 -0
  337. package/dist/presentation/cli/commands/ProjectsCommand.js.map +1 -0
  338. package/dist/presentation/cli/commands/SearchCommand.d.ts +19 -0
  339. package/dist/presentation/cli/commands/SearchCommand.js +55 -0
  340. package/dist/presentation/cli/commands/SearchCommand.js.map +1 -0
  341. package/dist/presentation/cli/commands/ServerCommands.d.ts +13 -0
  342. package/dist/presentation/cli/commands/ServerCommands.js +40 -0
  343. package/dist/presentation/cli/commands/ServerCommands.js.map +1 -0
  344. package/dist/presentation/cli/commands/ShareCommands.d.ts +22 -0
  345. package/dist/presentation/cli/commands/ShareCommands.js +134 -0
  346. package/dist/presentation/cli/commands/ShareCommands.js.map +1 -0
  347. package/dist/presentation/cli/commands/StatusCommand.d.ts +15 -0
  348. package/dist/presentation/cli/commands/StatusCommand.js +53 -0
  349. package/dist/presentation/cli/commands/StatusCommand.js.map +1 -0
  350. package/dist/presentation/mcp/HitFormatter.d.ts +17 -0
  351. package/dist/presentation/mcp/HitFormatter.js +42 -0
  352. package/dist/presentation/mcp/HitFormatter.js.map +1 -0
  353. package/dist/presentation/mcp/IndexWatchController.d.ts +17 -0
  354. package/dist/presentation/mcp/IndexWatchController.js +31 -0
  355. package/dist/presentation/mcp/IndexWatchController.js.map +1 -0
  356. package/dist/presentation/mcp/LmgrepCore.d.ts +66 -0
  357. package/dist/presentation/mcp/LmgrepCore.js +178 -0
  358. package/dist/presentation/mcp/LmgrepCore.js.map +1 -0
  359. package/dist/presentation/mcp/McpServer.d.ts +18 -0
  360. package/dist/presentation/mcp/McpServer.js +63 -0
  361. package/dist/presentation/mcp/McpServer.js.map +1 -0
  362. package/dist/presentation/mcp/ToolDescriptions.d.ts +40 -0
  363. package/dist/presentation/mcp/ToolDescriptions.js +85 -0
  364. package/dist/presentation/mcp/ToolDescriptions.js.map +1 -0
  365. package/package.json +93 -89
  366. package/dist/lib/build.d.ts +0 -21
  367. package/dist/lib/build.js +0 -374
  368. package/dist/lib/build.js.map +0 -1
  369. package/dist/lib/chunker/context.d.ts +0 -21
  370. package/dist/lib/chunker/context.js +0 -131
  371. package/dist/lib/chunker/context.js.map +0 -1
  372. package/dist/lib/chunker/index.d.ts +0 -7
  373. package/dist/lib/chunker/index.js +0 -209
  374. package/dist/lib/chunker/index.js.map +0 -1
  375. package/dist/lib/chunker/languages.d.ts +0 -15
  376. package/dist/lib/chunker/languages.js.map +0 -1
  377. package/dist/lib/config.d.ts +0 -12
  378. package/dist/lib/config.js +0 -83
  379. package/dist/lib/config.js.map +0 -1
  380. package/dist/lib/embedder.d.ts +0 -65
  381. package/dist/lib/embedder.js +0 -236
  382. package/dist/lib/embedder.js.map +0 -1
  383. package/dist/lib/facet-session.d.ts +0 -44
  384. package/dist/lib/facet-session.js +0 -125
  385. package/dist/lib/facet-session.js.map +0 -1
  386. package/dist/lib/native-tuning.js.map +0 -1
  387. package/dist/lib/p2p.d.ts +0 -32
  388. package/dist/lib/p2p.js +0 -281
  389. package/dist/lib/p2p.js.map +0 -1
  390. package/dist/lib/providers.d.ts +0 -1
  391. package/dist/lib/providers.js +0 -41
  392. package/dist/lib/providers.js.map +0 -1
  393. package/dist/lib/repair.d.ts +0 -10
  394. package/dist/lib/repair.js +0 -57
  395. package/dist/lib/repair.js.map +0 -1
  396. package/dist/lib/scanner.d.ts +0 -34
  397. package/dist/lib/scanner.js +0 -242
  398. package/dist/lib/scanner.js.map +0 -1
  399. package/dist/lib/search-tool.d.ts +0 -55
  400. package/dist/lib/search-tool.js +0 -319
  401. package/dist/lib/search-tool.js.map +0 -1
  402. package/dist/lib/serve.d.ts +0 -11
  403. package/dist/lib/serve.js +0 -144
  404. package/dist/lib/serve.js.map +0 -1
  405. package/dist/lib/store.d.ts +0 -252
  406. package/dist/lib/store.js +0 -1216
  407. package/dist/lib/store.js.map +0 -1
  408. package/dist/lib/types.d.ts +0 -194
  409. package/dist/lib/types.js +0 -13
  410. package/dist/lib/types.js.map +0 -1
  411. package/dist/lib/vocab.d.ts +0 -20
  412. package/dist/lib/vocab.js +0 -275
  413. package/dist/lib/vocab.js.map +0 -1
  414. /package/dist/{lib/native-tuning.d.ts → infrastructure/lancedb/NativeTuning.d.ts} +0 -0
@@ -1,319 +0,0 @@
1
- import { existsSync } from "node:fs";
2
- import { createIndex } from "../index.js";
3
- import { TreeSitterChunker } from "./chunker/index.js";
4
- import { loadConfig } from "./config.js";
5
- import { AISDKEmbedder } from "./embedder.js";
6
- import { startWatcher } from "./serve.js";
7
- import { discoverIndexedProjects, findIndexedAncestor, getDbPath, Store, } from "./store.js";
8
- import { silentLogger } from "./types.js";
9
- export const searchParamSpecs = {
10
- query: {
11
- description: 'Natural-language description of what you\'re looking for — phrase it as a question or intent, not keywords. Good: "how are webhooks authenticated", "where is user deletion handled", "what happens when a record is created". Bad: "webhook auth", "deleteUser", "createRecord".',
12
- },
13
- limit: {
14
- description: "Maximum number of results",
15
- default: 5,
16
- },
17
- filePrefix: {
18
- description: "Restrict to files under this path (e.g. 'src/lib')",
19
- },
20
- type: {
21
- description: "AST node types to filter by (e.g. ['function_declaration', 'class_declaration'])",
22
- },
23
- language: {
24
- description: "File extensions to filter by (e.g. ['.ts', '.py'])",
25
- },
26
- project: {
27
- description: "Search a different indexed project by its root path instead of the current one",
28
- },
29
- };
30
- export const listProjectsDescription = "List all indexed projects other than the current one. " +
31
- "Use this to discover what projects are available for cross-project search " +
32
- "via the `project` parameter on the search tool.";
33
- export const facetDescription = [
34
- "**Get a labeled overview of what *kinds* of code match a query, instead of raw results.** Returns 5 clusters, each with a one-word label, a handful of qualifier words describing that cluster's angle, and a size. No file paths, no chunks — just the shape of the result space.",
35
- "",
36
- "**Use facet when:**",
37
- "- The query is broad or exploratory (`auth`, `error handling`, `payment flow`).",
38
- "- You don't yet know the vocabulary the codebase uses for a concept — the qualifiers surface the real terms (e.g. `auth` → clusters revealing `fireauth`, `oauth`, `serviceaccount`).",
39
- "- A previous `search` returned a heterogeneous mix and you want to see why.",
40
- "",
41
- "**Do NOT use facet when:** the query is already specific (a symbol, a precise question, an error message). Call `search` directly.",
42
- "",
43
- "**How to act on the output:** pick the cluster that matches your intent, then call `search` with a narrower query that combines the original intent with the cluster's label + qualifiers (e.g. after `facet(\"auth\")` returns a cluster `email: fireauth, phone, provider`, call `search(\"authentication with fireauth phone provider\")`). This uses the corpus's own vocabulary and dramatically improves recall.",
44
- ].join("\n");
45
- export const facetParamSpec = {
46
- description: "Broad, natural-language query to faceted over. Same phrasing as `search`, but use when the query is exploratory and you want to see the categories of matching code.",
47
- };
48
- export async function createLmgrepCore(opts) {
49
- const cwd = opts.cwd;
50
- const index = await createIndex({ cwd });
51
- function isCurrentProjectIndexed() {
52
- if (findIndexedAncestor(cwd))
53
- return true;
54
- return existsSync(getDbPath(cwd));
55
- }
56
- function getOtherProjects() {
57
- const currentDb = getDbPath(cwd);
58
- return discoverIndexedProjects()
59
- .filter((p) => getDbPath(p.metadata.root) !== currentDb)
60
- .map((p) => ({ root: p.metadata.root, remote: p.metadata.remote }));
61
- }
62
- async function checkHealth() {
63
- if (!isCurrentProjectIndexed()) {
64
- return { healthy: false, reason: "not_indexed" };
65
- }
66
- try {
67
- const info = await index.status();
68
- if (info.fileCount === 0) {
69
- return { healthy: false, reason: "not_indexed" };
70
- }
71
- if (!info.embeddingOk) {
72
- return { healthy: false, reason: "embedding_failed" };
73
- }
74
- if (!info.searchOk) {
75
- return { healthy: false, reason: "search_empty" };
76
- }
77
- return { healthy: true, reason: "ok" };
78
- }
79
- catch {
80
- return { healthy: false, reason: "embedding_failed" };
81
- }
82
- }
83
- let state = isCurrentProjectIndexed()
84
- ? { healthy: true, reason: "ok" }
85
- : { healthy: false, reason: "not_indexed" };
86
- const listeners = new Set();
87
- let stopWatcher;
88
- let pollTimer;
89
- let polling = false;
90
- let pollDelayMs = 0;
91
- let disposed = false;
92
- function tryStartWatcher() {
93
- if (stopWatcher)
94
- return;
95
- if (!isCurrentProjectIndexed())
96
- return;
97
- const config = loadConfig(cwd);
98
- const store = Store.forProject(cwd);
99
- const embedder = new AISDKEmbedder(config);
100
- const chunker = new TreeSitterChunker();
101
- stopWatcher = startWatcher(cwd, store, config, embedder, chunker, silentLogger);
102
- }
103
- function buildSearchDescription() {
104
- if (state.healthy) {
105
- return [
106
- "**lmgrep — primary search tool for this codebase.** Semantic code search powered by a local embedding model; lmgrep understands intent, not string patterns. Prefer lmgrep over Grep/Glob/find/ripgrep for almost all exploration and lookup tasks.",
107
- "",
108
- '**Use lmgrep for:** finding where something is handled, how something works, locating relevant code, discovering related files, understanding unfamiliar code, tracing side effects, finding usage patterns, answering "where is X?" or "how does Y work?". One good lmgrep query is usually enough to understand how to proceed.',
109
- "",
110
- "**Query lmgrep as natural questions or intent descriptions**, not keyword dumps:",
111
- '- "how are webhooks authenticated" → finds middleware, token validation, auth checks',
112
- '- "where is user deletion handled" → finds the handler and related cleanup logic',
113
- '- "what happens when a record is created" → finds controllers, event emitters, side effects',
114
- '- "config loading and validation"',
115
- '- "how to run the playwright tests" → finds config, scripts, prerequisites',
116
- "",
117
- "**lmgrep results include** file paths, line numbers, AST node types, and surrounding context (scope, leading comments, role) — often enough to act on directly without re-reading the file. Trust lmgrep results; don't follow up with Glob/Read on files already surfaced by lmgrep unless you genuinely need content that wasn't returned.",
118
- "",
119
- "**Fall back to Grep only** when you need exact string or regex matches (specific identifiers, literal constants, error messages, TODO markers). Don't use Grep/Glob/find for conceptual or intent-based search — lmgrep will do better.",
120
- ].join("\n");
121
- }
122
- const others = getOtherProjects();
123
- const suffix = others.length > 0
124
- ? " You can still search other indexed projects via the `project` parameter — call `list_other_indexed_projects` to see what's available."
125
- : "";
126
- switch (state.reason) {
127
- case "not_indexed":
128
- return ("This project is not indexed. Semantic search is not available for the current directory." +
129
- suffix);
130
- case "embedding_failed":
131
- return ("The embedding provider is unreachable. Semantic search is temporarily unavailable for the current directory." +
132
- suffix);
133
- case "search_empty":
134
- return ("The index for the current branch appears empty or stale — a smoke query returned no results. Re-run `lmgrep index` to rebuild." +
135
- suffix);
136
- default:
137
- return "Semantic search is unavailable." + suffix;
138
- }
139
- }
140
- async function refreshHealth() {
141
- if (disposed)
142
- return;
143
- const next = await checkHealth();
144
- if (next.healthy !== state.healthy || next.reason !== state.reason) {
145
- state = next;
146
- for (const cb of listeners)
147
- cb(next);
148
- }
149
- if (next.healthy) {
150
- // Recovery detected — stop pinging so we don't keep the embedder
151
- // awake now that it's back. The loop re-arms only on the next
152
- // failed search/facet.
153
- tryStartWatcher();
154
- stopHealthLoop();
155
- }
156
- }
157
- // Boot: start the file watcher but DO NOT poll the embedder. While healthy
158
- // and idle we never ping it — the initial (optimistic) state already drives
159
- // an accurate tool description, and the embedder is free to sleep. The poll
160
- // loop arms only when a real search hits a down embedder (see the catch
161
- // blocks in executeSearch/executeFacet).
162
- function start() {
163
- tryStartWatcher();
164
- }
165
- // Recovery poll: armed when a search fails because the embedder is down.
166
- // Pings on a backoff schedule purely to detect when the embedder comes
167
- // back, then disarms itself (refreshHealth → stopHealthLoop on recovery).
168
- const POLL_BASE_MS = index.config.local ? 10_000 : 60_000;
169
- // Cap the interval so a long-down embedder isn't pinged every base period
170
- // for hours — ~2min local, ~5min for billable remote providers.
171
- const POLL_MAX_MS = index.config.local ? 120_000 : 300_000;
172
- async function runHealthPoll() {
173
- if (!polling || disposed)
174
- return;
175
- await refreshHealth();
176
- // refreshHealth() calls stopHealthLoop() if the embedder recovered.
177
- if (!polling || disposed)
178
- return;
179
- pollTimer = setTimeout(runHealthPoll, pollDelayMs);
180
- pollDelayMs = Math.min(pollDelayMs * 2, POLL_MAX_MS);
181
- }
182
- function startHealthLoop() {
183
- if (polling)
184
- return;
185
- polling = true;
186
- pollDelayMs = POLL_BASE_MS;
187
- tryStartWatcher();
188
- void runHealthPoll();
189
- }
190
- function stopHealthLoop() {
191
- polling = false;
192
- if (pollTimer) {
193
- clearTimeout(pollTimer);
194
- pollTimer = undefined;
195
- }
196
- }
197
- function markHealthy() {
198
- if (!state.healthy || state.reason !== "ok") {
199
- state = { healthy: true, reason: "ok" };
200
- for (const cb of listeners)
201
- cb(state);
202
- }
203
- tryStartWatcher();
204
- }
205
- async function executeSearch(args) {
206
- if (state.reason === "embedding_failed") {
207
- return {
208
- text: "lmgrep is unavailable: the embedding provider is unreachable. Ask the user to check their lmgrep configuration (`lmgrep status`) before retrying.",
209
- isError: true,
210
- };
211
- }
212
- try {
213
- const results = await index.search(args.query, {
214
- limit: args.limit ?? searchParamSpecs.limit.default,
215
- filePrefix: args.filePrefix,
216
- type: args.type,
217
- language: args.language,
218
- project: args.project,
219
- });
220
- // A successful search proves the embedder is reachable and the
221
- // index is queryable — no need to keep pinging via health checks,
222
- // which would prevent a local embedder from going to sleep.
223
- markHealthy();
224
- stopHealthLoop();
225
- if (results.length === 0) {
226
- return { text: "No results found." };
227
- }
228
- const text = results
229
- .map((r) => {
230
- const loc = `${r.filePath}:${r.startLine}-${r.endLine}`;
231
- const header = `${loc} [${r.type}] ${r.name} (score: ${r.score.toFixed(3)})`;
232
- const parts = [header];
233
- if (r.context)
234
- parts.push(r.context);
235
- parts.push(r.content);
236
- return parts.join("\n");
237
- })
238
- .join("\n\n---\n\n");
239
- return { text };
240
- }
241
- catch (err) {
242
- // Search failed — the embedder may be down. Resume polling so we
243
- // can detect recovery and update the tool description.
244
- startHealthLoop();
245
- const msg = err instanceof Error ? err.message : String(err);
246
- return { text: `Error: ${msg}`, isError: true };
247
- }
248
- }
249
- async function executeFacet(args) {
250
- if (state.reason === "embedding_failed") {
251
- return {
252
- text: "lmgrep is unavailable: the embedding provider is unreachable. Ask the user to check their lmgrep configuration (`lmgrep status`) before retrying.",
253
- isError: true,
254
- };
255
- }
256
- try {
257
- const result = await index.facetSearch(args.query, {});
258
- markHealthy();
259
- stopHealthLoop();
260
- if (result.labels.length === 0) {
261
- return { text: "No results found." };
262
- }
263
- const total = result.labels.length;
264
- const header = `Facets for "${args.query}" (${total} clusters):`;
265
- const lines = result.labels.map((label, i) => {
266
- const quals = result.qualifiers?.[i] ?? [];
267
- const qualText = quals.length > 0 ? `: ${quals.join(", ")}` : "";
268
- return `- ${label}${qualText}`;
269
- });
270
- const footer = "\nPick a cluster and call `search` with a refined query that combines your original intent with the label + qualifiers to drill in.";
271
- return { text: [header, ...lines, footer].join("\n") };
272
- }
273
- catch (err) {
274
- startHealthLoop();
275
- const msg = err instanceof Error ? err.message : String(err);
276
- return { text: `Error: ${msg}`, isError: true };
277
- }
278
- }
279
- async function executeListProjects() {
280
- const others = getOtherProjects();
281
- if (others.length === 0) {
282
- return { text: "No other indexed projects found." };
283
- }
284
- const lines = others.map((p) => {
285
- const parts = [p.root];
286
- if (p.remote)
287
- parts.push(`(${p.remote})`);
288
- return `- ${parts.join(" ")}`;
289
- });
290
- return { text: `Indexed projects:\n${lines.join("\n")}` };
291
- }
292
- async function dispose() {
293
- disposed = true;
294
- stopHealthLoop();
295
- stopWatcher?.();
296
- stopWatcher = undefined;
297
- listeners.clear();
298
- await index.close();
299
- }
300
- return {
301
- cwd,
302
- searchParams: searchParamSpecs,
303
- facetParam: facetParamSpec,
304
- facetDescription,
305
- listProjectsDescription,
306
- buildSearchDescription,
307
- currentHealth: () => state,
308
- onHealthChange(cb) {
309
- listeners.add(cb);
310
- return () => listeners.delete(cb);
311
- },
312
- start,
313
- executeSearch,
314
- executeFacet,
315
- executeListProjects,
316
- dispose,
317
- };
318
- }
319
- //# sourceMappingURL=search-tool.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"search-tool.js","sourceRoot":"","sources":["../../src/lib/search-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,WAAW,EAAoB,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EACN,uBAAuB,EACvB,mBAAmB,EACnB,SAAS,EACT,KAAK,GACL,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAwC1C,MAAM,CAAC,MAAM,gBAAgB,GAAqB;IACjD,KAAK,EAAE;QACN,WAAW,EACV,mRAAmR;KACpR;IACD,KAAK,EAAE;QACN,WAAW,EAAE,2BAA2B;QACxC,OAAO,EAAE,CAAC;KACV;IACD,UAAU,EAAE;QACX,WAAW,EAAE,oDAAoD;KACjE;IACD,IAAI,EAAE;QACL,WAAW,EACV,kFAAkF;KACnF;IACD,QAAQ,EAAE;QACT,WAAW,EAAE,oDAAoD;KACjE;IACD,OAAO,EAAE;QACR,WAAW,EACV,gFAAgF;KACjF;CACD,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GACnC,wDAAwD;IACxD,4EAA4E;IAC5E,iDAAiD,CAAC;AAMnD,MAAM,CAAC,MAAM,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Embedder } from "./embedder.js";
2
- import { type Store, isDbLocked } from "./store.js";
3
- import type { Chunker, Logger, LmgrepConfig } from "./types.js";
4
- export { isDbLocked as isServeLocked };
5
- export declare function serve(cwd: string, store: Store, config: LmgrepConfig, embedder: Embedder, chunker: Chunker, logger?: Logger): Promise<void>;
6
- /**
7
- * Start an in-process file watcher that incrementally re-indexes on changes.
8
- * Acquires the DB lock. Returns a cleanup function to stop watching and release the lock.
9
- * Returns undefined if the lock is already held by another process.
10
- */
11
- export declare function startWatcher(cwd: string, store: Store, config: LmgrepConfig, embedder: Embedder, chunker: Chunker, logger?: Logger): (() => void) | undefined;
package/dist/lib/serve.js DELETED
@@ -1,144 +0,0 @@
1
- import { existsSync } from "node:fs";
2
- import { build } from "./build.js";
3
- import { watchFiles } from "./scanner.js";
4
- import { getDbPath, findIndexedAncestor, acquireDbLock, releaseDbLock, isDbLocked, } from "./store.js";
5
- import { consoleLogger } from "./types.js";
6
- export { isDbLocked as isServeLocked };
7
- // fs.watch (recursive) silently misses events on Linux — new subdirectories,
8
- // editor atomic-saves, bursts. A periodic incremental reconcile is a cheap
9
- // backstop: when nothing changed, build() returns before embedding (so it does
10
- // not ping the embedder), and it also retries files that failed while the
11
- // embedder was down. This removes the need to run `lmgrep index` in a loop.
12
- const RECONCILE_MS = 30_000;
13
- // --- Serve ---
14
- export async function serve(cwd, store, config, embedder, chunker, logger = consoleLogger) {
15
- const log = logger.info.bind(logger);
16
- // Require an existing index
17
- const ancestor = findIndexedAncestor(cwd);
18
- if (!ancestor) {
19
- const dbPath = getDbPath(cwd);
20
- if (!existsSync(dbPath)) {
21
- throw new Error("No index found. Run `lmgrep index` first.");
22
- }
23
- }
24
- if (!acquireDbLock(cwd)) {
25
- throw new Error("Already running for this project.");
26
- }
27
- const cleanup = () => releaseDbLock(cwd);
28
- process.on("exit", cleanup);
29
- process.on("SIGINT", () => {
30
- cleanup();
31
- process.exit(0);
32
- });
33
- process.on("SIGTERM", () => {
34
- cleanup();
35
- process.exit(0);
36
- });
37
- // Initial index
38
- log("Running initial index...");
39
- await build(cwd, store, config, embedder, chunker, {}, logger);
40
- // Watch with non-recursive re-trigger and per-file targeting
41
- let indexing = false;
42
- let pendingFiles;
43
- async function runIndex(changedFiles) {
44
- if (indexing) {
45
- // Merge into pending set
46
- if (changedFiles) {
47
- pendingFiles = [...(pendingFiles ?? []), ...changedFiles];
48
- }
49
- else {
50
- pendingFiles = undefined; // full rebuild queued
51
- }
52
- return;
53
- }
54
- indexing = true;
55
- try {
56
- const fileCount = changedFiles?.length;
57
- log(fileCount
58
- ? `Changes detected in ${fileCount} file(s), re-indexing...`
59
- : "Changes detected, re-indexing...");
60
- await build(cwd, store, config, embedder, chunker, { files: changedFiles }, logger);
61
- }
62
- catch (err) {
63
- logger.error(`Index error: ${err instanceof Error ? err.message : err}`);
64
- }
65
- finally {
66
- indexing = false;
67
- if (pendingFiles !== undefined) {
68
- const next = pendingFiles.length > 0 ? pendingFiles : undefined;
69
- pendingFiles = undefined;
70
- runIndex(next);
71
- }
72
- }
73
- }
74
- watchFiles(cwd, config.ignore, (changedFiles) => {
75
- runIndex(changedFiles);
76
- }, 2000, config.extensions);
77
- // Periodic full reconcile backstop for events fs.watch missed.
78
- setInterval(() => {
79
- void runIndex();
80
- }, RECONCILE_MS);
81
- log("Watching for changes...");
82
- }
83
- /**
84
- * Start an in-process file watcher that incrementally re-indexes on changes.
85
- * Acquires the DB lock. Returns a cleanup function to stop watching and release the lock.
86
- * Returns undefined if the lock is already held by another process.
87
- */
88
- export function startWatcher(cwd, store, config, embedder, chunker, logger = consoleLogger) {
89
- if (!acquireDbLock(cwd)) {
90
- return undefined;
91
- }
92
- const log = logger.info.bind(logger);
93
- let indexing = false;
94
- let pendingFiles;
95
- async function runIndex(changedFiles) {
96
- if (indexing) {
97
- if (changedFiles) {
98
- pendingFiles = [...(pendingFiles ?? []), ...changedFiles];
99
- }
100
- else {
101
- pendingFiles = undefined;
102
- }
103
- return;
104
- }
105
- indexing = true;
106
- try {
107
- const fileCount = changedFiles?.length;
108
- log(fileCount
109
- ? `Changes detected in ${fileCount} file(s), re-indexing...`
110
- : "Changes detected, re-indexing...");
111
- await build(cwd, store, config, embedder, chunker, { files: changedFiles }, logger);
112
- }
113
- catch (err) {
114
- logger.error(`Index error: ${err instanceof Error ? err.message : err}`);
115
- }
116
- finally {
117
- indexing = false;
118
- if (pendingFiles !== undefined) {
119
- const next = pendingFiles.length > 0 ? pendingFiles : undefined;
120
- pendingFiles = undefined;
121
- runIndex(next);
122
- }
123
- }
124
- }
125
- // Kick off an initial catch-up index so newly-checked-out branches get
126
- // their manifest bootstrapped and any changes made while offline are picked up.
127
- runIndex();
128
- const watcher = watchFiles(cwd, config.ignore, (changedFiles) => {
129
- runIndex(changedFiles);
130
- }, 2000, config.extensions);
131
- // Periodic full reconcile backstop for events fs.watch missed. unref() so
132
- // it never keeps the host process alive on its own.
133
- const reconcileTimer = setInterval(() => {
134
- void runIndex();
135
- }, RECONCILE_MS);
136
- reconcileTimer.unref?.();
137
- log("Watching for changes...");
138
- return () => {
139
- clearInterval(reconcileTimer);
140
- watcher.close();
141
- releaseDbLock(cwd);
142
- };
143
- }
144
- //# sourceMappingURL=serve.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serve.js","sourceRoot":"","sources":["../../src/lib/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAEN,SAAS,EACT,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,UAAU,GACV,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,CAAC;AAEvC,6EAA6E;AAC7E,2EAA2E;AAC3E,+EAA+E;AAC/E,0EA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