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
@@ -0,0 +1,34 @@
1
+ /** A phase of an index run, for progress reporting. */
2
+ export type IndexingPhase = "scan" | "chunk" | "embed" | "store";
3
+ export interface IndexingProgressEvent {
4
+ phase: IndexingPhase;
5
+ current: number;
6
+ total: number;
7
+ message?: string;
8
+ }
9
+ export interface IndexBuildOptions {
10
+ /** Drop every table and rebuild from scratch. */
11
+ reset?: boolean;
12
+ /** Only consider files modified within this duration (e.g. "10m", "2h"). */
13
+ since?: string;
14
+ /** Report what would be indexed without doing it. */
15
+ dry?: boolean;
16
+ verbose?: boolean;
17
+ /** Only process these paths instead of scanning the tree. */
18
+ files?: string[];
19
+ /**
20
+ * Allow this run to train a vector index if none exists. Off by default:
21
+ * training reads every vector and peaks at several GB, which must not
22
+ * happen behind a background watcher.
23
+ */
24
+ createIndex?: boolean;
25
+ onProgress?: (event: IndexingProgressEvent) => void;
26
+ }
27
+ export interface IndexBuildResult {
28
+ /** Chunks embedded and stored. */
29
+ succeeded: number;
30
+ /** Chunks that failed to embed. */
31
+ failed: number;
32
+ /** Files dropped because they no longer exist in the working tree. */
33
+ removed: number;
34
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IndexingProgress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IndexingProgress.js","sourceRoot":"","sources":["../../../src/application/indexing/IndexingProgress.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ /** Bounds how long an operation may take. */
2
+ export declare class Deadline {
3
+ private readonly milliseconds;
4
+ private constructor();
5
+ static after(milliseconds: number): Deadline;
6
+ /**
7
+ * Reject if `work` has not settled in time.
8
+ *
9
+ * The timer is always cleared, including on the happy path — an uncleared
10
+ * timer keeps the event loop alive and would stop a CLI process exiting.
11
+ */
12
+ enforce<T>(work: Promise<T>): Promise<T>;
13
+ }
@@ -0,0 +1,29 @@
1
+ /** Bounds how long an operation may take. */
2
+ export class Deadline {
3
+ milliseconds;
4
+ constructor(milliseconds) {
5
+ this.milliseconds = milliseconds;
6
+ }
7
+ static after(milliseconds) {
8
+ return new Deadline(milliseconds);
9
+ }
10
+ /**
11
+ * Reject if `work` has not settled in time.
12
+ *
13
+ * The timer is always cleared, including on the happy path — an uncleared
14
+ * timer keeps the event loop alive and would stop a CLI process exiting.
15
+ */
16
+ enforce(work) {
17
+ return new Promise((resolve, reject) => {
18
+ const timer = setTimeout(() => reject(new Error(`timeout after ${this.milliseconds}ms`)), this.milliseconds);
19
+ work.then((value) => {
20
+ clearTimeout(timer);
21
+ resolve(value);
22
+ }, (error) => {
23
+ clearTimeout(timer);
24
+ reject(error);
25
+ });
26
+ });
27
+ }
28
+ }
29
+ //# sourceMappingURL=Deadline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Deadline.js","sourceRoot":"","sources":["../../../src/application/operations/Deadline.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,MAAM,OAAO,QAAQ;IACiB;IAArC,YAAqC,YAAoB;QAApB,iBAAY,GAAZ,YAAY,CAAQ;IAAG,CAAC;IAE7D,MAAM,CAAC,KAAK,CAAC,YAAoB;QAChC,OAAO,IAAI,QAAQ,CAAC,YAAY,CAAC,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAI,IAAgB;QAC1B,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACzC,MAAM,KAAK,GAAG,UAAU,CACvB,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,iBAAiB,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC,EAC/D,IAAI,CAAC,YAAY,CACjB,CAAC;YACF,IAAI,CAAC,IAAI,CACR,CAAC,KAAK,EAAE,EAAE;gBACT,YAAY,CAAC,KAAK,CAAC,CAAC;gBACpB,OAAO,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC,EACD,CAAC,KAAK,EAAE,EAAE;gBACT,YAAY,CAAC,KAAK,CAAC,CAAC;gBACpB,MAAM,CAAC,KAAK,CAAC,CAAC;YACf,CAAC,CACD,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC;CACD"}
@@ -0,0 +1,58 @@
1
+ import type { LmgrepConfig } from "../../domain/config/LmgrepConfig.js";
2
+ export type HealthReason = "ok" | "not_indexed" | "embedding_failed" | "search_empty";
3
+ export interface HealthState {
4
+ healthy: boolean;
5
+ reason: HealthReason;
6
+ }
7
+ /** What the monitor needs to probe, without knowing how any of it works. */
8
+ export interface HealthProbe {
9
+ isIndexed(): boolean;
10
+ /** Full status check; throws when the embedder is unreachable. */
11
+ inspect(): Promise<{
12
+ fileCount: number;
13
+ embeddingOk: boolean;
14
+ searchOk: boolean;
15
+ }>;
16
+ /** Ensure the file watcher is running, if this process can hold the lock. */
17
+ ensureWatching(): void;
18
+ }
19
+ /**
20
+ * Tracks whether search is usable, and tells listeners when that changes.
21
+ *
22
+ * The polling policy matters more than it looks. While healthy the monitor
23
+ * never pings the embedder at all: a local model should be free to unload and
24
+ * sleep, and a billed remote provider should not be charged for liveness
25
+ * checks. Polling arms only when a real search has failed, and disarms the
26
+ * moment one succeeds — so the cost is paid exactly when something is wrong.
27
+ */
28
+ export declare class HealthMonitor {
29
+ private readonly probe;
30
+ private state;
31
+ private readonly listeners;
32
+ private timer;
33
+ private polling;
34
+ private delayMs;
35
+ private disposed;
36
+ private readonly baseDelayMs;
37
+ private readonly maxDelayMs;
38
+ constructor(probe: HealthProbe, config: LmgrepConfig);
39
+ get current(): HealthState;
40
+ onChange(listener: (state: HealthState) => void): () => void;
41
+ /**
42
+ * Boot: start watching, but do not poll. The initial optimistic state
43
+ * already drives an accurate tool description, and the embedder stays
44
+ * asleep until something actually needs it.
45
+ */
46
+ start(): void;
47
+ /** A completed search proves the embedder and index are both live. */
48
+ markHealthy(): void;
49
+ /** A failed search may mean the embedder is down; watch for recovery. */
50
+ markFailed(): void;
51
+ dispose(): void;
52
+ private check;
53
+ private refresh;
54
+ private transition;
55
+ private startPolling;
56
+ private poll;
57
+ private stopPolling;
58
+ }
@@ -0,0 +1,128 @@
1
+ /**
2
+ * Tracks whether search is usable, and tells listeners when that changes.
3
+ *
4
+ * The polling policy matters more than it looks. While healthy the monitor
5
+ * never pings the embedder at all: a local model should be free to unload and
6
+ * sleep, and a billed remote provider should not be charged for liveness
7
+ * checks. Polling arms only when a real search has failed, and disarms the
8
+ * moment one succeeds — so the cost is paid exactly when something is wrong.
9
+ */
10
+ export class HealthMonitor {
11
+ probe;
12
+ state;
13
+ listeners = new Set();
14
+ timer;
15
+ polling = false;
16
+ delayMs = 0;
17
+ disposed = false;
18
+ baseDelayMs;
19
+ maxDelayMs;
20
+ constructor(probe, config) {
21
+ this.probe = probe;
22
+ // A local embedder is free to poll often; a billed one is not.
23
+ this.baseDelayMs = config.local ? 10_000 : 60_000;
24
+ // Cap the backoff so a long-down provider is not pinged every base
25
+ // period for hours: ~2min local, ~5min remote.
26
+ this.maxDelayMs = config.local ? 120_000 : 300_000;
27
+ this.state = probe.isIndexed()
28
+ ? { healthy: true, reason: "ok" }
29
+ : { healthy: false, reason: "not_indexed" };
30
+ }
31
+ get current() {
32
+ return this.state;
33
+ }
34
+ onChange(listener) {
35
+ this.listeners.add(listener);
36
+ return () => this.listeners.delete(listener);
37
+ }
38
+ /**
39
+ * Boot: start watching, but do not poll. The initial optimistic state
40
+ * already drives an accurate tool description, and the embedder stays
41
+ * asleep until something actually needs it.
42
+ */
43
+ start() {
44
+ this.probe.ensureWatching();
45
+ }
46
+ /** A completed search proves the embedder and index are both live. */
47
+ markHealthy() {
48
+ this.transition({ healthy: true, reason: "ok" });
49
+ this.probe.ensureWatching();
50
+ this.stopPolling();
51
+ }
52
+ /** A failed search may mean the embedder is down; watch for recovery. */
53
+ markFailed() {
54
+ this.startPolling();
55
+ }
56
+ dispose() {
57
+ this.disposed = true;
58
+ this.stopPolling();
59
+ this.listeners.clear();
60
+ }
61
+ async check() {
62
+ if (!this.probe.isIndexed()) {
63
+ return { healthy: false, reason: "not_indexed" };
64
+ }
65
+ try {
66
+ const info = await this.probe.inspect();
67
+ if (info.fileCount === 0) {
68
+ return { healthy: false, reason: "not_indexed" };
69
+ }
70
+ if (!info.embeddingOk) {
71
+ return { healthy: false, reason: "embedding_failed" };
72
+ }
73
+ if (!info.searchOk) {
74
+ return { healthy: false, reason: "search_empty" };
75
+ }
76
+ return { healthy: true, reason: "ok" };
77
+ }
78
+ catch {
79
+ return { healthy: false, reason: "embedding_failed" };
80
+ }
81
+ }
82
+ async refresh() {
83
+ if (this.disposed)
84
+ return;
85
+ this.transition(await this.check());
86
+ if (this.state.healthy) {
87
+ // Recovered — stop pinging so the embedder can sleep again. The
88
+ // loop re-arms on the next failed search.
89
+ this.probe.ensureWatching();
90
+ this.stopPolling();
91
+ }
92
+ }
93
+ transition(next) {
94
+ if (next.healthy === this.state.healthy &&
95
+ next.reason === this.state.reason) {
96
+ return;
97
+ }
98
+ this.state = next;
99
+ for (const listener of this.listeners)
100
+ listener(next);
101
+ }
102
+ startPolling() {
103
+ if (this.polling || this.disposed)
104
+ return;
105
+ this.polling = true;
106
+ this.delayMs = this.baseDelayMs;
107
+ this.probe.ensureWatching();
108
+ void this.poll();
109
+ }
110
+ async poll() {
111
+ if (!this.polling || this.disposed)
112
+ return;
113
+ await this.refresh();
114
+ // refresh() disarms polling if the embedder recovered.
115
+ if (!this.polling || this.disposed)
116
+ return;
117
+ this.timer = setTimeout(() => void this.poll(), this.delayMs);
118
+ this.timer.unref?.();
119
+ this.delayMs = Math.min(this.delayMs * 2, this.maxDelayMs);
120
+ }
121
+ stopPolling() {
122
+ this.polling = false;
123
+ if (this.timer)
124
+ clearTimeout(this.timer);
125
+ this.timer = undefined;
126
+ }
127
+ }
128
+ //# sourceMappingURL=HealthMonitor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HealthMonitor.js","sourceRoot":"","sources":["../../../src/application/operations/HealthMonitor.ts"],"names":[],"mappings":"AA0BA;;;;;;;;GAQG;AACH,MAAM,OAAO,aAAa;IAYP;IAXV,KAAK,CAAc;IACV,SAAS,GAAG,IAAI,GAAG,EAAgC,CAAC;IAC7D,KAAK,CAA4C;IACjD,OAAO,GAAG,KAAK,CAAC;IAChB,OAAO,GAAG,CAAC,CAAC;IACZ,QAAQ,GAAG,KAAK,CAAC;IAER,WAAW,CAAS;IACpB,UAAU,CAAS;IAEpC,YACkB,KAAkB,EACnC,MAAoB;QADH,UAAK,GAAL,KAAK,CAAa;QAGnC,+DAA+D;QAC/D,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;QAClD,mEAAmE;QACnE,+CAA+C;QAC/C,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAA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Q,IAAI,IAAI,CAAC,SAAS;YAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvD,CAAC;IAEO,YAAY;QACnB,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO;QAC1C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC;QAChC,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;QAC5B,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;IAClB,CAAC;IAEO,KAAK,CAAC,IAAI;QACjB,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO;QAC3C,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;QACrB,uDAAuD;QACvD,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO;QAE3C,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9D,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5D,CAAC;IAEO,WAAW;QAClB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,IAAI,IAAI,CAAC,KAAK;YAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IACxB,CAAC;CACD"}
@@ -0,0 +1,35 @@
1
+ import type { LmgrepConfig } from "../../domain/config/LmgrepConfig.js";
2
+ import type { ProjectIndex, ProjectIndexesPort } from "../../domain/ports/ProjectIndexesPort.js";
3
+ import type { DatabaseLocation } from "../../domain/project/DatabaseLocation.js";
4
+ import type { ProjectLocator } from "../../domain/project/ProjectLocator.js";
5
+ /** What to say when the configured model has no index but another one does. */
6
+ export interface AbsenceExplanation {
7
+ reason: string;
8
+ fix: string;
9
+ /** The indexes that do exist, largest first. */
10
+ others: readonly ProjectIndex[];
11
+ }
12
+ /**
13
+ * Explains an index that is absent because the model changed.
14
+ *
15
+ * Storing one database per model makes switching models safe and reversible,
16
+ * but it also means a switch turns a working project into an empty one — and
17
+ * "not indexed" is then a true statement that badly misdescribes the
18
+ * situation. The old index is intact, one directory away, and reachable by
19
+ * putting the old model back. Without saying so, the obvious next step is
20
+ * `lmgrep index`, which re-embeds the entire repository to reach a state the
21
+ * user may not have meant to ask for.
22
+ */
23
+ export declare class IndexAlternatives {
24
+ private readonly indexes;
25
+ private readonly locator;
26
+ private readonly location;
27
+ private readonly config;
28
+ private readonly cwd;
29
+ constructor(indexes: ProjectIndexesPort, locator: ProjectLocator, location: DatabaseLocation, config: LmgrepConfig, cwd: string);
30
+ /** Indexes for this project built with some other model. */
31
+ others(): ProjectIndex[];
32
+ /** The explanation, or nothing when this is simply an unindexed project. */
33
+ explainAbsence(): AbsenceExplanation | undefined;
34
+ private describe;
35
+ }
@@ -0,0 +1,61 @@
1
+ import { ModelIdentity } from "../../domain/project/ModelIdentity.js";
2
+ /**
3
+ * Explains an index that is absent because the model changed.
4
+ *
5
+ * Storing one database per model makes switching models safe and reversible,
6
+ * but it also means a switch turns a working project into an empty one — and
7
+ * "not indexed" is then a true statement that badly misdescribes the
8
+ * situation. The old index is intact, one directory away, and reachable by
9
+ * putting the old model back. Without saying so, the obvious next step is
10
+ * `lmgrep index`, which re-embeds the entire repository to reach a state the
11
+ * user may not have meant to ask for.
12
+ */
13
+ export class IndexAlternatives {
14
+ indexes;
15
+ locator;
16
+ location;
17
+ config;
18
+ cwd;
19
+ constructor(indexes, locator, location, config, cwd) {
20
+ this.indexes = indexes;
21
+ this.locator = locator;
22
+ this.location = location;
23
+ this.config = config;
24
+ this.cwd = cwd;
25
+ }
26
+ /** Indexes for this project built with some other model. */
27
+ others() {
28
+ // A database chosen by name or path is not one of a project's model
29
+ // variants, so it has no siblings to speak of.
30
+ if (this.location.manual)
31
+ return [];
32
+ return this.indexes
33
+ .list(this.locator.indexHomeFor(this.cwd))
34
+ .filter((index) => index.databasePath !== this.location.path)
35
+ .filter((index) => index.bytes > 0);
36
+ }
37
+ /** The explanation, or nothing when this is simply an unindexed project. */
38
+ explainAbsence() {
39
+ const others = this.others();
40
+ if (others.length === 0)
41
+ return undefined;
42
+ const named = others.filter((index) => index.model);
43
+ const previous = named[0] ?? others[0];
44
+ const configured = ModelIdentity.of(this.config.model).family;
45
+ return {
46
+ reason: `This project has no index for "${configured}" — but it is indexed ` +
47
+ `with ${this.describe(named)}.`,
48
+ fix: `Set \`model\` back to ${previous.model ?? "the previous model"} to use that index immediately, ` +
49
+ "or run `lmgrep index` to embed this project with the new model (the other index is kept).",
50
+ others,
51
+ };
52
+ }
53
+ describe(indexes) {
54
+ if (indexes.length === 0)
55
+ return "another model";
56
+ return indexes
57
+ .map((index) => `"${ModelIdentity.of(index.model ?? "").family}"`)
58
+ .join(", ");
59
+ }
60
+ }
61
+ //# sourceMappingURL=IndexAlternatives.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IndexAlternatives.js","sourceRoot":"","sources":["../../../src/application/operations/IndexAlternatives.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAWtE;;;;;;;;;;GAUG;AACH,MAAM,OAAO,iBAAiB;IAEX;IACA;IACA;IACA;IACA;IALlB,YACkB,OAA2B,EAC3B,OAAuB,EACvB,QAA0B,EAC1B,MAAoB,EACpB,GAAW;QAJX,YAAO,GAAP,OAAO,CAAoB;QAC3B,YAAO,GAAP,OAAO,CAAgB;QACvB,aAAQ,GAAR,QAAQ,CAAkB;QAC1B,WAAM,GAAN,MAAM,CAAc;QACpB,QAAG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OAAO,eAAe,CAAC;QACjD,OAAO,OAAO;aACZ,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,aAAa,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC;aACjE,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;CACD"}
@@ -0,0 +1,69 @@
1
+ import type { IndexMetadataPort } from "../../domain/ports/IndexMetadataPort.js";
2
+ import type { ProjectRegistryPort } from "../../domain/ports/ProjectRegistryPort.js";
3
+ import type { StateDirectoryPort } from "../../domain/ports/StateDirectoryPort.js";
4
+ /** One index on this machine, and what is known about it. */
5
+ export interface InventoryEntry {
6
+ databasePath: string;
7
+ /** Working tree it describes, when that is recorded. */
8
+ root?: string;
9
+ /** Name of a standalone index, which is its identity instead of a root. */
10
+ name?: string;
11
+ remote?: string;
12
+ model?: string;
13
+ dimensions?: number;
14
+ indexedAt?: string;
15
+ bytes: number;
16
+ /**
17
+ * `live` — its working tree is there.
18
+ * `orphaned` — it names a working tree that is gone.
19
+ * `unattributable` — it records no working tree at all, so nothing can be
20
+ * concluded about whether its project still exists.
21
+ */
22
+ state: "live" | "orphaned" | "unattributable";
23
+ /**
24
+ * `repository` — inside the repo it indexes, the current scheme.
25
+ * `standalone` — in the state directory, for corpora with no repo.
26
+ * `legacy` — written by a version that kept every index in the state
27
+ * directory; readable, adoptable, removable.
28
+ */
29
+ kind: "repository" | "standalone" | "legacy";
30
+ }
31
+ export interface Inventory {
32
+ entries: InventoryEntry[];
33
+ /** Registry entries whose database is gone: pointers to nothing. */
34
+ dangling: number;
35
+ totalBytes: number;
36
+ }
37
+ /**
38
+ * The list of every index this machine holds.
39
+ *
40
+ * This exists because indexes stopped being enumerable by listing a directory.
41
+ * That was the point — an index inside its repository cannot be orphaned by
42
+ * deleting the repository — but it removed the only way anyone could see what
43
+ * lmgrep had accumulated. Before this, an install could hold a hundred
44
+ * databases and many gigabytes with no command that would say so, and the only
45
+ * thing that could enumerate them was an MCP tool the user could not call.
46
+ */
47
+ export declare class IndexInventory {
48
+ private readonly registry;
49
+ private readonly metadata;
50
+ private readonly state;
51
+ private readonly sizeOf;
52
+ constructor(registry: ProjectRegistryPort, metadata: IndexMetadataPort, state: StateDirectoryPort, sizeOf: (path: string) => number);
53
+ collect(): Inventory;
54
+ /**
55
+ * Whether an index still has a project.
56
+ *
57
+ * "No recorded root" is kept distinct from "recorded root is gone". They
58
+ * look the same in a listing and are not the same thing at all: the second
59
+ * is safe to delete, while the first is an index whose provenance was
60
+ * simply never written down — an interrupted first run, most often, but
61
+ * possibly a working index for a project that is right there.
62
+ */
63
+ private stateOf;
64
+ /**
65
+ * Where an index lives. Decided by path rather than by a stored flag, so an
66
+ * entry written by any version reports the truth about where it is now.
67
+ */
68
+ private kindOf;
69
+ }
@@ -0,0 +1,99 @@
1
+ import { existsSync } from "node:fs";
2
+ /**
3
+ * The list of every index this machine holds.
4
+ *
5
+ * This exists because indexes stopped being enumerable by listing a directory.
6
+ * That was the point — an index inside its repository cannot be orphaned by
7
+ * deleting the repository — but it removed the only way anyone could see what
8
+ * lmgrep had accumulated. Before this, an install could hold a hundred
9
+ * databases and many gigabytes with no command that would say so, and the only
10
+ * thing that could enumerate them was an MCP tool the user could not call.
11
+ */
12
+ export class IndexInventory {
13
+ registry;
14
+ metadata;
15
+ state;
16
+ sizeOf;
17
+ constructor(registry, metadata, state, sizeOf) {
18
+ this.registry = registry;
19
+ this.metadata = metadata;
20
+ this.state = state;
21
+ this.sizeOf = sizeOf;
22
+ }
23
+ collect() {
24
+ const entries = [];
25
+ const seen = new Set();
26
+ for (const registered of this.registry.list()) {
27
+ seen.add(registered.databasePath);
28
+ entries.push({
29
+ databasePath: registered.databasePath,
30
+ root: registered.root,
31
+ name: registered.name,
32
+ remote: registered.remote,
33
+ model: registered.model,
34
+ dimensions: registered.dimensions,
35
+ indexedAt: registered.indexedAt,
36
+ bytes: this.sizeOf(registered.databasePath),
37
+ // A standalone index outlives the directory it was built from,
38
+ // so its project cannot be "gone" — collecting it on that
39
+ // basis would delete a corpus that is working fine.
40
+ state: registered.name || existsSync(registered.root) ? "live" : "orphaned",
41
+ kind: this.kindOf(registered.databasePath),
42
+ });
43
+ }
44
+ for (const path of this.state.legacyDatabaseDirectories()) {
45
+ if (seen.has(path))
46
+ continue;
47
+ // A directory with no sidecar and no tables is not an index, and
48
+ // saying otherwise sends the user to adopt something that is not
49
+ // there. This is not hypothetical: a server left running across an
50
+ // upgrade still writes the previous layout, recreating its
51
+ // database directory under the state root every time it starts a
52
+ // scan.
53
+ if (!this.metadata.holdsIndex(path))
54
+ continue;
55
+ const meta = this.metadata.read(path);
56
+ entries.push({
57
+ databasePath: path,
58
+ root: meta?.root,
59
+ remote: meta?.remote,
60
+ model: meta?.model,
61
+ dimensions: meta?.dimensions,
62
+ indexedAt: meta?.indexedAt,
63
+ bytes: this.sizeOf(path),
64
+ state: this.stateOf(meta?.root),
65
+ kind: "legacy",
66
+ });
67
+ }
68
+ entries.sort((a, b) => b.bytes - a.bytes);
69
+ return {
70
+ entries,
71
+ dangling: this.registry.dangling().length,
72
+ totalBytes: entries.reduce((sum, e) => sum + e.bytes, 0),
73
+ };
74
+ }
75
+ /**
76
+ * Whether an index still has a project.
77
+ *
78
+ * "No recorded root" is kept distinct from "recorded root is gone". They
79
+ * look the same in a listing and are not the same thing at all: the second
80
+ * is safe to delete, while the first is an index whose provenance was
81
+ * simply never written down — an interrupted first run, most often, but
82
+ * possibly a working index for a project that is right there.
83
+ */
84
+ stateOf(root) {
85
+ if (!root)
86
+ return "unattributable";
87
+ return existsSync(root) ? "live" : "orphaned";
88
+ }
89
+ /**
90
+ * Where an index lives. Decided by path rather than by a stored flag, so an
91
+ * entry written by any version reports the truth about where it is now.
92
+ */
93
+ kindOf(databasePath) {
94
+ return databasePath.startsWith(this.state.databasesDirectory())
95
+ ? "standalone"
96
+ : "repository";
97
+ }
98
+ }
99
+ //# sourceMappingURL=IndexInvent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AC;SACxD,CAAC;IACH,CAAC;IAED;;;;;;;;OAQG;IACK,OAAO,CAAC,IAAwB;QACvC,IAAI,CAAC,IAAI;YAAE,OAAO,gBAAgB,CAAC;QACnC,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC;IAC/C,CAAC;IAED;;;OAGG;IACK,MAAM,CAAC,YAAoB;QAClC,OAAO,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,kBAAkB,EAAE,CAAC;YAC9D,CAAC,CAAC,YAAY;YACd,CAAC,CAAC,YAAY,CAAC;IACjB,CAAC;CACD"}
@@ -0,0 +1,90 @@
1
+ import type { ConfigSource } from "../../domain/config/ConfigSource.js";
2
+ import type { LmgrepConfig } from "../../domain/config/LmgrepConfig.js";
3
+ import type { ChunkRepositoryPort } from "../../domain/ports/ChunkRepositoryPort.js";
4
+ import type { EmbedderPort } from "../../domain/ports/EmbedderPort.js";
5
+ import type { IndexMaintenancePort, VectorIndexState } from "../../domain/ports/IndexMaintenancePort.js";
6
+ import type { IndexMetadataPort } from "../../domain/ports/IndexMetadataPort.js";
7
+ import type { DatabaseLocation } from "../../domain/project/DatabaseLocation.js";
8
+ import type { ProjectLocator } from "../../domain/project/ProjectLocator.js";
9
+ import type { IndexAlternatives } from "./IndexAlternatives.js";
10
+ /**
11
+ * Whether search works right now, and if not, the one thing to do about it.
12
+ *
13
+ * A single verdict rather than a wall of statistics: the question someone runs
14
+ * `status` to answer is "is it working", and burying that under file counts
15
+ * and latency figures made every reader derive it themselves.
16
+ */
17
+ export type StatusVerdict = {
18
+ searchable: true;
19
+ note?: string;
20
+ } | {
21
+ searchable: false;
22
+ reason: string;
23
+ fix: string;
24
+ };
25
+ export interface StatusInfo {
26
+ verdict: StatusVerdict;
27
+ projectRoot: string;
28
+ prefix: string;
29
+ databasePath: string;
30
+ config: LmgrepConfig;
31
+ /** Which files supplied the configuration, in increasing precedence. */
32
+ configSources: readonly ConfigSource[];
33
+ fileCount: number;
34
+ chunkCount: number;
35
+ uniqueHashes: number;
36
+ embeddingOk: boolean;
37
+ embeddingLatencyMs?: number;
38
+ embeddingError?: string;
39
+ /** Did a generic smoke query return at least one result on this branch? */
40
+ searchOk: boolean;
41
+ searchResultCount?: number;
42
+ searchLatencyMs?: number;
43
+ /**
44
+ * Whether the database holds anything at all, ignoring branch scope. The
45
+ * gap between this and {@link searchOk} is what distinguishes "this branch
46
+ * has not been indexed" from "the index is broken".
47
+ */
48
+ anyBranchOk?: boolean;
49
+ indexModel?: string;
50
+ indexDimensions?: number;
51
+ /** How searches are answered: by vector index, or by scanning every row. */
52
+ vectorIndex: VectorIndexState;
53
+ }
54
+ /**
55
+ * Reports what the index holds and whether it actually works.
56
+ *
57
+ * The two liveness checks are deliberately shallow and time-boxed: `status`
58
+ * must stay responsive even when the embedder is wedged, since diagnosing that
59
+ * is exactly why someone runs it.
60
+ */
61
+ export declare class StatusService {
62
+ private readonly chunks;
63
+ private readonly maintenance;
64
+ private readonly embedder;
65
+ private readonly locator;
66
+ private readonly metadata;
67
+ private readonly location;
68
+ private readonly config;
69
+ private readonly cwd;
70
+ private readonly configSources;
71
+ private readonly alternatives;
72
+ private static readonly PROBE_TIMEOUT_MS;
73
+ /** A word generic enough to match something in any codebase. */
74
+ private static readonly SMOKE_QUERY;
75
+ constructor(chunks: ChunkRepositoryPort, maintenance: IndexMaintenancePort, embedder: EmbedderPort, locator: ProjectLocator, metadata: IndexMetadataPort, location: DatabaseLocation, config: LmgrepConfig, cwd: string, configSources: readonly ConfigSource[], alternatives: IndexAlternatives);
76
+ status(): Promise<StatusInfo>;
77
+ /**
78
+ * Reduce the probes to one answer, in the order a user would care.
79
+ *
80
+ * A missing vector index is a note rather than a failure: search works, it
81
+ * is just answering by reading every embedding, which nothing else would
82
+ * tell you.
83
+ */
84
+ private judge;
85
+ /**
86
+ * Embed once and reuse the vector for the search check — one roundtrip
87
+ * covers both, which keeps `status` cheap against a billed provider.
88
+ */
89
+ private probe;
90
+ }