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,159 @@
1
+ /**
2
+ * Builds the context header prepended to a chunk before embedding.
3
+ *
4
+ * The header is what makes an isolated function retrievable: on its own,
5
+ * `async function handle(req)` shares little vocabulary with "how are webhooks
6
+ * authenticated", but stamped with its file, enclosing class and doc comment
7
+ * it does. Retrieval quality depends on this at least as much as on the text.
8
+ */
9
+ export class ChunkContextBuilder {
10
+ /** How far above a node to look for its doc comment. */
11
+ static MAX_COMMENT_LOOKBACK = 10;
12
+ /** AST node type -> the word used for it in the header. */
13
+ static SCOPE_KINDS = {
14
+ // TypeScript / JavaScript
15
+ class_declaration: "class",
16
+ class_body: "class",
17
+ interface_declaration: "interface",
18
+ module: "module",
19
+ namespace_declaration: "namespace",
20
+ // Python
21
+ class_definition: "class",
22
+ // Rust
23
+ impl_item: "impl",
24
+ trait_item: "trait",
25
+ mod_item: "mod",
26
+ // Go
27
+ type_declaration: "type",
28
+ // Ruby
29
+ class: "class",
30
+ // C / C++
31
+ struct_specifier: "struct",
32
+ class_specifier: "class",
33
+ namespace_definition: "namespace",
34
+ // Swift
35
+ struct_declaration: "struct",
36
+ extension_declaration: "extension",
37
+ // Scala
38
+ object_definition: "object",
39
+ trait_definition: "trait",
40
+ // Generic
41
+ ContainerDecl: "container",
42
+ };
43
+ /** Node types that declare a shape rather than behaviour. */
44
+ static DEFINITION_TYPES = new Set([
45
+ "class_declaration",
46
+ "class_definition",
47
+ "interface_declaration",
48
+ "type_alias_declaration",
49
+ "enum_declaration",
50
+ "struct_item",
51
+ "enum_item",
52
+ "trait_item",
53
+ "type_item",
54
+ "type_declaration",
55
+ "struct_specifier",
56
+ "class_specifier",
57
+ "enum_specifier",
58
+ "type_definition",
59
+ "struct_declaration",
60
+ "protocol_declaration",
61
+ "trait_definition",
62
+ "ContainerDecl",
63
+ ]);
64
+ /** Node types that wire things together rather than implement them. */
65
+ static ORCHESTRATION_TYPES = new Set([
66
+ "export_statement",
67
+ "decorated_definition",
68
+ ]);
69
+ /** The full header for one chunk. */
70
+ build(node, filePath, source, language) {
71
+ const lines = [
72
+ `[file: ${filePath}]`,
73
+ `[role: ${this.classifyRole(node)}]`,
74
+ ];
75
+ const scope = this.extractScope(node, language);
76
+ if (scope.length > 0) {
77
+ lines.push(`[scope: ${scope.map((s) => `${s.kind} ${s.name}`).join(" > ")}]`);
78
+ }
79
+ const comment = this.extractLeadingComment(node, source);
80
+ if (comment)
81
+ lines.push(`[doc: ${comment}]`);
82
+ return lines.join("\n");
83
+ }
84
+ /** The minimal header for a file with no parsed structure. */
85
+ buildFileOnly(filePath) {
86
+ return `[file: ${filePath}]`;
87
+ }
88
+ /** Walk up from a node collecting the named scopes that enclose it. */
89
+ extractScope(node, language) {
90
+ const scopes = [];
91
+ let current = node.parent;
92
+ while (current) {
93
+ if (language.scopeTypes.includes(current.type)) {
94
+ const name = this.nodeName(current);
95
+ if (name) {
96
+ scopes.unshift({
97
+ kind: ChunkContextBuilder.SCOPE_KINDS[current.type] ?? current.type,
98
+ name,
99
+ });
100
+ }
101
+ }
102
+ current = current.parent;
103
+ }
104
+ return scopes;
105
+ }
106
+ /**
107
+ * Collect the comment block or decorators immediately above a node.
108
+ *
109
+ * A blank line ends the block only once something has been collected, so a
110
+ * comment separated from its node by whitespace is still picked up, while
111
+ * unrelated code above it is not.
112
+ */
113
+ extractLeadingComment(node, source) {
114
+ const lines = source.split("\n");
115
+ const start = node.startPosition.row;
116
+ const collected = [];
117
+ for (let i = start - 1; i >= 0 && i >= start - ChunkContextBuilder.MAX_COMMENT_LOOKBACK; i--) {
118
+ const line = lines[i].trim();
119
+ if (this.looksLikeCommentOrDecorator(line)) {
120
+ collected.unshift(lines[i]);
121
+ }
122
+ else if (line === "") {
123
+ if (collected.length > 0)
124
+ break;
125
+ }
126
+ else {
127
+ break;
128
+ }
129
+ }
130
+ return collected.length === 0 ? null : collected.join("\n").trim();
131
+ }
132
+ classifyRole(node) {
133
+ if (ChunkContextBuilder.DEFINITION_TYPES.has(node.type)) {
134
+ return "definition";
135
+ }
136
+ if (ChunkContextBuilder.ORCHESTRATION_TYPES.has(node.type)) {
137
+ return "orchestration";
138
+ }
139
+ return "implementation";
140
+ }
141
+ /** Comment syntax across every supported language, plus decorators. */
142
+ looksLikeCommentOrDecorator(line) {
143
+ return (line.startsWith("//") ||
144
+ line.startsWith("#") ||
145
+ line.startsWith("*") ||
146
+ line.startsWith("/*") ||
147
+ line.startsWith("*/") ||
148
+ line.startsWith("///") ||
149
+ line.startsWith("--") ||
150
+ line.startsWith("@") ||
151
+ line.startsWith('"""') ||
152
+ line.startsWith("'''"));
153
+ }
154
+ nodeName(node) {
155
+ return (node.childForFieldName("name") ??
156
+ node.children.find((c) => c.type === "identifier" || c.type === "type_identifier"))?.text;
157
+ }
158
+ }
159
+ //# sourceMappingURL=ChunkContextBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChunkContextBuilder.js","sourceRoot":"","sources":["../../../src/infrastructure/treesitter/ChunkContextBuilder.ts"],"names":[],"mappings":"AAYA;;;;;;;GAOG;AACH,MAAM,OAAO,mBAAmB;IAC/B,wDAAwD;IAChD,MAAM,CAAU,oBAAoB,GAAG,EAAE,CAAC;IAElD,2DAA2D;IACnD,MAAM,CAAU,WAAW,GAA2B;QAC7D,0BAA0B;QAC1B,iBAAiB,EAAE,OAAO;QAC1B,UAAU,EAAE,OAAO;QACnB,qBAAqB,EAAE,WAAW;QAClC,MAAM,EAAE,QAAQ;QAChB,qBAAqB,EAAE,WAAW;QAClC,SAAS;QACT,gBAAgB,EAAE,OAAO;QACzB,OAAO;QACP,SAAS,EAAE,MAAM;QACjB,UAAU,EAAE,OAAO;QACnB,QAAQ,EAAE,KAAK;QACf,KAAK;QACL,gBAAgB,EAAE,MAAM;QACxB,OAAO;QACP,KAAK,EAAE,OAAO;QACd,UAAU;QACV,gBAAgB,EAAE,QAAQ;QAC1B,eAAe,EAAE,OAAO;QACxB,oBAAoB,EAAE,WAAW;QACjC,QAAQ;QACR,kBAAkB,EAAE,QAAQ;QAC5B,qBAAqB,EAAE,WAAW;QAClC,QAAQ;QACR,iBAAiB,EAAE,QAAQ;QAC3B,gBAAgB,EAAE,OAAO;QACzB,UAAU;QACV,aAAa,EAAE,WAAW;KAC1B,CAAC;IAEF,6DAA6D;IACrD,MAAM,CAAU,gBAAgB,GAAG,IAAI,GAAG,CAAC;QAClD,mBAAmB;QACnB,kBAAkB;QAClB,uBAAuB;QACvB,wBAAwB;QACxB,kBAAkB;QAClB,aAAa;QACb,WAAW;QACX,YAAY;QACZ,WAAW;QACX,kBAAkB;QAClB,kBAAkB;QAClB,iBAAiB;QACjB,gBAAgB;QAChB,iBAAiB;QACjB,oBAAoB;QACpB,sBAAsB;QACtB,kBAAkB;QAClB,eAAe;KACf,CAAC,CAAC;IAEH,uEAAuE;IAC/D,MAAM,CAAU,m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AC,IAAU;QACtB,IAAI,mBAAmB,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACzD,OAAO,YAAY,CAAC;QACrB,CAAC;QACD,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5D,OAAO,eAAe,CAAC;QACxB,CAAC;QACD,OAAO,gBAAgB,CAAC;IACzB,CAAC;IAED,uEAAuE;IAC/D,2BAA2B,CAAC,IAAY;QAC/C,OAAO,CACN,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YACrB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YACrB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YACrB,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;YACtB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YACrB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;YACtB,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CACtB,CAAC;IACH,CAAC;IAEO,QAAQ,CAAC,IAAU;QAC1B,OAAO,CACN,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC;YAC9B,IAAI,CAAC,QAAQ,CAAC,IAAI,CACjB,CAAC,CAAO,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,YAAY,IAAI,CAAC,CAAC,IAAI,KAAK,iBAAiB,CACpE,CACD,EAAE,IAAI,CAAC;IACT,CAAC"}
@@ -0,0 +1,8 @@
1
+ export interface EmbeddedTreeSitterAssets {
2
+ parser: string;
3
+ grammars: Readonly<Record<string, string>>;
4
+ }
5
+ /** Registers paths embedded by the standalone Bun entry point. */
6
+ export declare function registerEmbeddedTreeSitterAssets(assets: EmbeddedTreeSitterAssets): void;
7
+ export declare function embeddedParserPath(): string | undefined;
8
+ export declare function embeddedGrammarPath(wasmFile: string): string | undefined;
@@ -0,0 +1,12 @@
1
+ let embedded;
2
+ /** Registers paths embedded by the standalone Bun entry point. */
3
+ export function registerEmbeddedTreeSitterAssets(assets) {
4
+ embedded = assets;
5
+ }
6
+ export function embeddedParserPath() {
7
+ return embedded?.parser;
8
+ }
9
+ export function embeddedGrammarPath(wasmFile) {
10
+ return embedded?.grammars[wasmFile];
11
+ }
12
+ //# sourceMappingURL=EmbeddedTreeSitterAssets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmbeddedTreeSitterAssets.js","sourceRoot":"","sources":["../../../src/infrastructure/treesitter/EmbeddedTreeSitterAssets.ts"],"names":[],"mappings":"AAKA,IAAI,QAA8C,CAAC;AAEnD,kEAAkE;AAClE,MAAM,UAAU,gCAAgC,CAC/C,MAAgC;IAEhC,QAAQ,GAAG,MAAM,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,kBAAkB;IACjC,OAAO,QAAQ,EAAE,MAAM,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,QAAgB;IACnD,OAAO,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1,30 @@
1
+ export type LanguageId = "javascript" | "typescript" | "tsx" | "python" | "rust" | "go" | "ruby" | "c" | "cpp" | "swift" | "json" | "yaml" | "toml" | "lua" | "scala" | "zig" | "bash" | "html" | "css" | "java" | "kotlin" | "php" | "c_sharp" | "vue" | "markdown" | "nix";
2
+ export interface LanguageConfig {
3
+ id: LanguageId;
4
+ extensions: string[];
5
+ wasmFile: string;
6
+ /** AST node types that represent top-level or nestable definitions */
7
+ chunkTypes: string[];
8
+ /** AST node types that represent import/require statements */
9
+ importTypes: string[];
10
+ /** AST node types that represent class/struct/module wrappers */
11
+ scopeTypes: string[];
12
+ }
13
+ export declare const LANGUAGES: LanguageConfig[];
14
+ /**
15
+ * The grammar table and the lookups over it.
16
+ *
17
+ * Grammars ship as separate `@lumis-sh/wasm-<slug>` packages built for the
18
+ * current web-tree-sitter ABI, so resolution is a runtime `require.resolve`
19
+ * that may legitimately fail — a missing grammar means "chunk this file by
20
+ * sliding window", not an error.
21
+ */
22
+ export declare class LanguageCatalog {
23
+ private readonly languages;
24
+ private readonly byExtension;
25
+ constructor(languages?: readonly LanguageConfig[]);
26
+ /** Grammar for a path's extension, or undefined when none is known. */
27
+ forFile(filePath: string): LanguageConfig | undefined;
28
+ /** Absolute path to a grammar's wasm, or undefined when not installed. */
29
+ wasmPathFor(lang: LanguageConfig): string | undefined;
30
+ }
@@ -1,4 +1,5 @@
1
1
  import { createRequire } from "node:module";
2
+ import { embeddedGrammarPath } from "./EmbeddedTreeSitterAssets.js";
2
3
  const require = createRequire(import.meta.url);
3
4
  export const LANGUAGES = [
4
5
  {
@@ -141,11 +142,7 @@ export const LANGUAGES = [
141
142
  "enum_specifier",
142
143
  ],
143
144
  importTypes: ["preproc_include", "using_declaration"],
144
- scopeTypes: [
145
- "class_specifier",
146
- "struct_specifier",
147
- "namespace_definition",
148
- ],
145
+ scopeTypes: ["class_specifier", "struct_specifier", "namespace_definition"],
149
146
  },
150
147
  {
151
148
  id: "swift",
@@ -207,11 +204,7 @@ export const LANGUAGES = [
207
204
  "trait_definition",
208
205
  ],
209
206
  importTypes: ["import_declaration"],
210
- scopeTypes: [
211
- "class_definition",
212
- "object_definition",
213
- "trait_definition",
214
- ],
207
+ scopeTypes: ["class_definition", "object_definition", "trait_definition"],
215
208
  },
216
209
  {
217
210
  id: "zig",
@@ -346,26 +339,42 @@ export const LANGUAGES = [
346
339
  scopeTypes: ["attrset_expression", "binding_set"],
347
340
  },
348
341
  ];
349
- const extToLang = new Map();
350
- for (const lang of LANGUAGES) {
351
- for (const ext of lang.extensions) {
352
- extToLang.set(ext, lang);
342
+ /**
343
+ * The grammar table and the lookups over it.
344
+ *
345
+ * Grammars ship as separate `@lumis-sh/wasm-<slug>` packages built for the
346
+ * current web-tree-sitter ABI, so resolution is a runtime `require.resolve`
347
+ * that may legitimately fail — a missing grammar means "chunk this file by
348
+ * sliding window", not an error.
349
+ */
350
+ export class LanguageCatalog {
351
+ languages;
352
+ byExtension = new Map();
353
+ constructor(languages = LANGUAGES) {
354
+ this.languages = languages;
355
+ for (const lang of this.languages) {
356
+ for (const ext of lang.extensions)
357
+ this.byExtension.set(ext, lang);
358
+ }
353
359
  }
354
- }
355
- export function getLanguageForFile(filePath) {
356
- const ext = filePath.slice(filePath.lastIndexOf("."));
357
- return extToLang.get(ext);
358
- }
359
- export function getWasmPath(lang) {
360
- // Grammars ship as per-language @lumis-sh/wasm-<slug> packages built for the
361
- // current web-tree-sitter ABI. The wasm is named tree-sitter-<slug>.wasm and
362
- // the slug is wasmFile minus the "tree-sitter-" prefix and ".wasm" suffix.
363
- const slug = lang.wasmFile.replace(/^tree-sitter-/, "").replace(/\.wasm$/, "");
364
- try {
365
- return require.resolve(`@lumis-sh/wasm-${slug}/${lang.wasmFile}`);
360
+ /** Grammar for a path's extension, or undefined when none is known. */
361
+ forFile(filePath) {
362
+ return this.byExtension.get(filePath.slice(filePath.lastIndexOf(".")));
366
363
  }
367
- catch {
368
- return undefined;
364
+ /** Absolute path to a grammar's wasm, or undefined when not installed. */
365
+ wasmPathFor(lang) {
366
+ const bundled = embeddedGrammarPath(lang.wasmFile);
367
+ if (bundled)
368
+ return bundled;
369
+ const slug = lang.wasmFile
370
+ .replace(/^tree-sitter-/, "")
371
+ .replace(/\.wasm$/, "");
372
+ try {
373
+ return require.resolve(`@lumis-sh/wasm-${slug}/${lang.wasmFile}`);
374
+ }
375
+ catch {
376
+ return undefined;
377
+ }
369
378
  }
370
379
  }
371
- //# sourceMappingURL=languages.js.map
380
+ //# sourceMappingURL=LanguageCatalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LanguageCatalog.js","sourceRoot":"","sources":["../../../src/infrastructure/treesitter/LanguageC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AS;QAAhD,cAAS,GAAT,SAAS,CAAuC;QAEjE,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnC,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU;gBAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACpE,CAAC;IACF,CAAC;IAED,uEAAuE;IACvE,OAAO,CAAC,QAAgB;QACvB,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACxE,CAAC;IAED,0EAA0E;IAC1E,WAAW,CAAC,IAAoB;QAC/B,MAAM,OAAO,GAAG,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnD,IAAI,OAAO;YAAE,OAAO,OAAO,CAAC;QAE5B,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ;aACxB,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC;aAC5B,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QACzB,IAAI,CAAC;YACJ,OAAO,OAAO,CAAC,OAAO,CAAC,kBAAkB,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACnE,CAAC;QAAC,MAAM,CAAC;YACR,OAAO,SAAS,CAAC;QAClB,CAAC;IACF,CAAC;CACD"}
@@ -0,0 +1,15 @@
1
+ import { Chunk } from "../../domain/corpus/Chunk.js";
2
+ import type { ChunkerPort } from "../../domain/ports/ChunkerPort.js";
3
+ /**
4
+ * Fixed-size windows over a file, for sources with no grammar or no chunkable
5
+ * structure (a linear shell script, say).
6
+ *
7
+ * Windows overlap slightly so a passage straddling a boundary is still
8
+ * retrievable. The overlap is kept small because search deduplicates
9
+ * overlapping hits anyway, making a larger one pure index bloat.
10
+ */
11
+ export declare class SlidingWindowChunker implements ChunkerPort {
12
+ private static readonly WINDOW_LINES;
13
+ private static readonly STRIDE_LINES;
14
+ chunk(filePath: string, cwd: string): Promise<Chunk[]>;
15
+ }
@@ -0,0 +1,42 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { Chunk } from "../../domain/corpus/Chunk.js";
4
+ import { CodeLocation } from "../../domain/corpus/CodeLocation.js";
5
+ import { ContentHash } from "../../domain/corpus/ContentHash.js";
6
+ /**
7
+ * Fixed-size windows over a file, for sources with no grammar or no chunkable
8
+ * structure (a linear shell script, say).
9
+ *
10
+ * Windows overlap slightly so a passage straddling a boundary is still
11
+ * retrievable. The overlap is kept small because search deduplicates
12
+ * overlapping hits anyway, making a larger one pure index bloat.
13
+ */
14
+ export class SlidingWindowChunker {
15
+ static WINDOW_LINES = 50;
16
+ static STRIDE_LINES = 40;
17
+ async chunk(filePath, cwd) {
18
+ const source = readFileSync(join(cwd, filePath), "utf-8");
19
+ const lines = source.split("\n");
20
+ if (lines.length === 0)
21
+ return [];
22
+ const chunks = [];
23
+ for (let i = 0; i < lines.length; i += SlidingWindowChunker.STRIDE_LINES) {
24
+ const content = lines
25
+ .slice(i, i + SlidingWindowChunker.WINDOW_LINES)
26
+ .join("\n");
27
+ if (content.trim().length === 0)
28
+ continue;
29
+ const endLine = Math.min(i + SlidingWindowChunker.WINDOW_LINES, lines.length);
30
+ chunks.push(new Chunk({
31
+ location: new CodeLocation(filePath, i + 1, endLine),
32
+ type: "block",
33
+ name: `lines_${i + 1}_${endLine}`,
34
+ content,
35
+ context: `[file: ${filePath}]`,
36
+ hash: ContentHash.of(content),
37
+ }));
38
+ }
39
+ return chunks;
40
+ }
41
+ }
42
+ //# sourceMappingURL=SlidingWindowChunker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SlidingWindowChunker.js","sourceRoot":"","sources":["../../../src/infrastructure/treesitter/SlidingWindowChunker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAA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AAI,EAAE,OAAO;gBACb,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,IAAI,OAAO,EAAE;gBACjC,OAAO;gBACP,OAAO,EAAE,UAAU,QAAQ,GAAG;gBAC9B,IAAI,EAAE,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC;aAC7B,CAAC,CACF,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IACf,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { Chunk } from "../../domain/corpus/Chunk.js";
2
+ import type { ChunkerPort } from "../../domain/ports/ChunkerPort.js";
3
+ import { ChunkContextBuilder } from "./ChunkContextBuilder.js";
4
+ import { LanguageCatalog } from "./LanguageCatalog.js";
5
+ import { SlidingWindowChunker } from "./SlidingWindowChunker.js";
6
+ /**
7
+ * Splits source into chunks along AST boundaries.
8
+ *
9
+ * Node-bounded chunks are what make results readable: a hit is a whole
10
+ * function or class, not an arbitrary window through the middle of one. Files
11
+ * with no grammar, or no chunkable structure, fall back to a sliding window.
12
+ */
13
+ export declare class TreeSitterChunker implements ChunkerPort {
14
+ private readonly catalog;
15
+ private readonly context;
16
+ private readonly fallback;
17
+ /** Chunks larger than this are split by recursing into their children. */
18
+ private static readonly MAX_CHUNK_TOKENS;
19
+ /** A one-line fragment shorter than this is noise, not a unit of code. */
20
+ private static readonly MIN_CHUNK_CHARS;
21
+ private parser;
22
+ private readonly loaded;
23
+ constructor(catalog?: LanguageCatalog, context?: ChunkContextBuilder, fallback?: SlidingWindowChunker);
24
+ chunk(filePath: string, cwd: string): Promise<Chunk[]>;
25
+ /**
26
+ * Markdown needs its own pass: the block grammar nests `section` nodes by
27
+ * heading level, so emitting them whole would collapse a document into one
28
+ * chunk. Splitting at every heading the grammar reports (so a `#` inside a
29
+ * fenced code block is not mistaken for one) gives complete,
30
+ * non-overlapping, heading-granular chunks instead.
31
+ */
32
+ private chunkMarkdown;
33
+ private collect;
34
+ private hasChunkableDescendants;
35
+ private nodeName;
36
+ private getParser;
37
+ /**
38
+ * Grammars are cached for the process lifetime. They are wasm modules whose
39
+ * linear memory only ever grows, so loading one repeatedly would leak.
40
+ */
41
+ private loadGrammar;
42
+ }
@@ -0,0 +1,165 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { Language, Parser } from "web-tree-sitter";
4
+ import { Chunk } from "../../domain/corpus/Chunk.js";
5
+ import { CodeLocation } from "../../domain/corpus/CodeLocation.js";
6
+ import { ContentHash } from "../../domain/corpus/ContentHash.js";
7
+ import { ChunkContextBuilder } from "./ChunkContextBuilder.js";
8
+ import { embeddedParserPath } from "./EmbeddedTreeSitterAssets.js";
9
+ import { LanguageCatalog } from "./LanguageCatalog.js";
10
+ import { SlidingWindowChunker } from "./SlidingWindowChunker.js";
11
+ /**
12
+ * Splits source into chunks along AST boundaries.
13
+ *
14
+ * Node-bounded chunks are what make results readable: a hit is a whole
15
+ * function or class, not an arbitrary window through the middle of one. Files
16
+ * with no grammar, or no chunkable structure, fall back to a sliding window.
17
+ */
18
+ export class TreeSitterChunker {
19
+ catalog;
20
+ context;
21
+ fallback;
22
+ /** Chunks larger than this are split by recursing into their children. */
23
+ static MAX_CHUNK_TOKENS = 8192;
24
+ /** A one-line fragment shorter than this is noise, not a unit of code. */
25
+ static MIN_CHUNK_CHARS = 50;
26
+ parser;
27
+ loaded = new Map();
28
+ constructor(catalog = new LanguageCatalog(), context = new ChunkContextBuilder(), fallback = new SlidingWindowChunker()) {
29
+ this.catalog = catalog;
30
+ this.context = context;
31
+ this.fallback = fallback;
32
+ }
33
+ async chunk(filePath, cwd) {
34
+ const language = this.catalog.forFile(filePath);
35
+ if (!language)
36
+ return this.fallback.chunk(filePath, cwd);
37
+ // Parser.init() must run before any Language.load(): it bootstraps the
38
+ // wasm runtime that grammar loading calls into. Reversing these two
39
+ // lines fails with "cannot read loadWebAssemblyModule of undefined".
40
+ const parser = await this.getParser();
41
+ const grammar = await this.loadGrammar(language);
42
+ if (!grammar)
43
+ return this.fallback.chunk(filePath, cwd);
44
+ parser.setLanguage(grammar);
45
+ const source = readFileSync(join(cwd, filePath), "utf-8");
46
+ const tree = parser.parse(source);
47
+ if (!tree)
48
+ return this.fallback.chunk(filePath, cwd);
49
+ const chunks = language.id === "markdown"
50
+ ? this.chunkMarkdown(tree.rootNode, filePath, source)
51
+ : this.collect(tree.rootNode, language, filePath, source, []);
52
+ return chunks.length > 0 ? chunks : this.fallback.chunk(filePath, cwd);
53
+ }
54
+ /**
55
+ * Markdown needs its own pass: the block grammar nests `section` nodes by
56
+ * heading level, so emitting them whole would collapse a document into one
57
+ * chunk. Splitting at every heading the grammar reports (so a `#` inside a
58
+ * fenced code block is not mistaken for one) gives complete,
59
+ * non-overlapping, heading-granular chunks instead.
60
+ */
61
+ chunkMarkdown(root, filePath, source) {
62
+ const lines = source.split("\n");
63
+ const headingRows = [];
64
+ const visit = (node) => {
65
+ if (node.type === "atx_heading" || node.type === "setext_heading") {
66
+ headingRows.push(node.startPosition.row);
67
+ }
68
+ for (const child of node.children)
69
+ visit(child);
70
+ };
71
+ visit(root);
72
+ const starts = [...new Set([0, ...headingRows])].sort((a, b) => a - b);
73
+ const chunks = [];
74
+ for (let i = 0; i < starts.length; i++) {
75
+ const start = starts[i];
76
+ const end = i + 1 < starts.length ? starts[i + 1] : lines.length;
77
+ const content = lines.slice(start, end).join("\n");
78
+ if (content.trim().length === 0)
79
+ continue;
80
+ const heading = (lines[start] ?? "").replace(/^\s*#+\s*/, "").trim();
81
+ chunks.push(new Chunk({
82
+ location: new CodeLocation(filePath, start + 1, end),
83
+ type: "section",
84
+ name: heading.slice(0, 80) || `lines_${start + 1}_${end}`,
85
+ content,
86
+ context: this.context.buildFileOnly(filePath),
87
+ hash: ContentHash.of(content),
88
+ }));
89
+ }
90
+ return chunks;
91
+ }
92
+ collect(node, language, filePath, source, chunks) {
93
+ if (!language.chunkTypes.includes(node.type)) {
94
+ for (const child of node.children) {
95
+ this.collect(child, language, filePath, source, chunks);
96
+ }
97
+ return chunks;
98
+ }
99
+ const content = node.text;
100
+ // Too large to embed whole: descend instead, so a big class becomes its
101
+ // methods rather than being truncated or skipped.
102
+ const estimatedTokens = Math.ceil(content.length / 4);
103
+ if (estimatedTokens > TreeSitterChunker.MAX_CHUNK_TOKENS &&
104
+ this.hasChunkableDescendants(node, language)) {
105
+ for (const child of node.children) {
106
+ this.collect(child, language, filePath, source, chunks);
107
+ }
108
+ return chunks;
109
+ }
110
+ // A short one-liner carries no retrievable meaning on its own.
111
+ if (content.split("\n").length < 2 &&
112
+ content.length < TreeSitterChunker.MIN_CHUNK_CHARS) {
113
+ return chunks;
114
+ }
115
+ chunks.push(new Chunk({
116
+ location: new CodeLocation(filePath, node.startPosition.row + 1, node.endPosition.row + 1),
117
+ type: node.type,
118
+ name: this.nodeName(node) ?? `anonymous_${node.startPosition.row}`,
119
+ content,
120
+ context: this.context.build(node, filePath, source, language),
121
+ hash: ContentHash.of(content),
122
+ }));
123
+ return chunks;
124
+ }
125
+ hasChunkableDescendants(node, language) {
126
+ for (const child of node.children) {
127
+ if (language.chunkTypes.includes(child.type))
128
+ return true;
129
+ if (this.hasChunkableDescendants(child, language))
130
+ return true;
131
+ }
132
+ return false;
133
+ }
134
+ nodeName(node) {
135
+ return (node.childForFieldName("name") ??
136
+ node.children.find((c) => c.type === "identifier" ||
137
+ c.type === "type_identifier" ||
138
+ // nix binds its target via an attrpath (e.g. `outputs = ...`)
139
+ c.type === "attrpath"))?.text;
140
+ }
141
+ async getParser() {
142
+ if (!this.parser) {
143
+ const parserWasm = embeddedParserPath();
144
+ await Parser.init(parserWasm ? { locateFile: () => parserWasm } : undefined);
145
+ this.parser = new Parser();
146
+ }
147
+ return this.parser;
148
+ }
149
+ /**
150
+ * Grammars are cached for the process lifetime. They are wasm modules whose
151
+ * linear memory only ever grows, so loading one repeatedly would leak.
152
+ */
153
+ async loadGrammar(language) {
154
+ const cached = this.loaded.get(language.id);
155
+ if (cached)
156
+ return cached;
157
+ const wasmPath = this.catalog.wasmPathFor(language);
158
+ if (!wasmPath)
159
+ return undefined;
160
+ const grammar = await Language.load(wasmPath);
161
+ this.loaded.set(language.id, grammar);
162
+ return grammar;
163
+ }
164
+ }
165
+ //# sourceMappingURL=TreeSitterChunker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TreeSitterChunker.js","sourceRoot":"","sources":["../../../src/infrastructure/treesitter/TreeSitterChunker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAa,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAEjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAuB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,OAAO,iBAAiB;IAUX;IACA;IACA;IAXlB,0EAA0E;IAClE,MAAM,CAAU,gBAAgB,GAAG,IAAI,CAAC;IAChD,0EAA0E;IAClE,MAAM,CAAU,eAAe,GAAG,EAAE,CAAC;IAErC,MAAM,CAAqB;IAClB,MAAM,GAAG,IAAI,GAAG,EAAoB,CAAC;IAEtD,YACkB,UAAU,IAAI,eAAe,EAAE,EAC/B,UAAU,IAAI,mBAAmB,EAAE,EACnC,WAAW,IAAI,oBAAoB,EAAE;QAFrC,YAAO,GAAP,OAAO,CAAwB;QAC/B,YAAO,GAAP,OAAO,CAA4B;QACnC,aAAQ,GAAR,QAAQ,CAA6B;IACpD,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