lmgrep 0.1.17 → 0.2.0
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.
- package/README.md +226 -63
- package/completions/_lmgrep +49 -40
- package/dist/application/Lmgrep.d.ts +107 -0
- package/dist/application/Lmgrep.js +99 -0
- package/dist/application/Lmgrep.js.map +1 -0
- package/dist/application/LmgrepFactory.d.ts +40 -0
- package/dist/application/LmgrepFactory.js +155 -0
- package/dist/application/LmgrepFactory.js.map +1 -0
- package/dist/application/indexing/BranchBootstrapper.d.ts +21 -0
- package/dist/application/indexing/BranchBootstrapper.js +52 -0
- package/dist/application/indexing/BranchBootstrapper.js.map +1 -0
- package/dist/application/indexing/BranchManifestSweeper.d.ts +17 -0
- package/dist/application/indexing/BranchManifestSweeper.js +35 -0
- package/dist/application/indexing/BranchManifestSweeper.js.map +1 -0
- package/dist/application/indexing/Duration.d.ts +9 -0
- package/dist/application/indexing/Duration.js +25 -0
- package/dist/application/indexing/Duration.js.map +1 -0
- package/dist/application/indexing/EmbeddingAbortError.d.ts +11 -0
- package/dist/application/indexing/EmbeddingAbortError.js +20 -0
- package/dist/application/indexing/EmbeddingAbortError.js.map +1 -0
- package/dist/application/indexing/EmbeddingPipeline.d.ts +59 -0
- package/dist/application/indexing/EmbeddingPipeline.js +140 -0
- package/dist/application/indexing/EmbeddingPipeline.js.map +1 -0
- package/dist/application/indexing/IndexBuilder.d.ts +112 -0
- package/dist/application/indexing/IndexBuilder.js +370 -0
- package/dist/application/indexing/IndexBuilder.js.map +1 -0
- package/dist/application/indexing/IndexingProgress.d.ts +34 -0
- package/dist/application/indexing/IndexingProgress.js +2 -0
- package/dist/application/indexing/IndexingProgress.js.map +1 -0
- package/dist/application/operations/Deadline.d.ts +13 -0
- package/dist/application/operations/Deadline.js +29 -0
- package/dist/application/operations/Deadline.js.map +1 -0
- package/dist/application/operations/HealthMonitor.d.ts +58 -0
- package/dist/application/operations/HealthMonitor.js +128 -0
- package/dist/application/operations/HealthMonitor.js.map +1 -0
- package/dist/application/operations/IndexAlternatives.d.ts +35 -0
- package/dist/application/operations/IndexAlternatives.js +61 -0
- package/dist/application/operations/IndexAlternatives.js.map +1 -0
- package/dist/application/operations/IndexInventory.d.ts +69 -0
- package/dist/application/operations/IndexInventory.js +99 -0
- package/dist/application/operations/IndexInventory.js.map +1 -0
- package/dist/application/operations/StatusService.d.ts +90 -0
- package/dist/application/operations/StatusService.js +171 -0
- package/dist/application/operations/StatusService.js.map +1 -0
- package/dist/application/operations/WatchService.d.ts +67 -0
- package/dist/application/operations/WatchService.js +145 -0
- package/dist/application/operations/WatchService.js.map +1 -0
- package/dist/application/operations/WorkingTreeDiff.d.ts +19 -0
- package/dist/application/operations/WorkingTreeDiff.js +36 -0
- package/dist/application/operations/WorkingTreeDiff.js.map +1 -0
- package/dist/application/research/ResearchAgent.d.ts +68 -0
- package/dist/application/research/ResearchAgent.js +201 -0
- package/dist/application/research/ResearchAgent.js.map +1 -0
- package/dist/application/research/ResearchPrompts.d.ts +16 -0
- package/dist/application/research/ResearchPrompts.js +34 -0
- package/dist/application/research/ResearchPrompts.js.map +1 -0
- package/dist/application/search/SearchCriteria.d.ts +37 -0
- package/dist/application/search/SearchCriteria.js +48 -0
- package/dist/application/search/SearchCriteria.js.map +1 -0
- package/dist/application/search/SearchService.d.ts +36 -0
- package/dist/application/search/SearchService.js +108 -0
- package/dist/application/search/SearchService.js.map +1 -0
- package/dist/application/search/SearchTargetResolver.d.ts +56 -0
- package/dist/application/search/SearchTargetResolver.js +104 -0
- package/dist/application/search/SearchTargetResolver.js.map +1 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +5 -754
- package/dist/cli.js.map +1 -1
- package/dist/domain/config/ConfigSource.d.ts +16 -0
- package/dist/domain/config/ConfigSource.js +2 -0
- package/dist/domain/config/ConfigSource.js.map +1 -0
- package/dist/domain/config/LmgrepConfig.d.ts +53 -0
- package/dist/domain/config/LmgrepConfig.js +2 -0
- package/dist/domain/config/LmgrepConfig.js.map +1 -0
- package/dist/domain/corpus/Chunk.d.ts +49 -0
- package/dist/domain/corpus/Chunk.js +60 -0
- package/dist/domain/corpus/Chunk.js.map +1 -0
- package/dist/domain/corpus/CodeLocation.d.ts +18 -0
- package/dist/domain/corpus/CodeLocation.js +34 -0
- package/dist/domain/corpus/CodeLocation.js.map +1 -0
- package/dist/domain/corpus/ContentHash.d.ts +15 -0
- package/dist/domain/corpus/ContentHash.js +30 -0
- package/dist/domain/corpus/ContentHash.js.map +1 -0
- package/dist/domain/corpus/FileVersion.d.ts +31 -0
- package/dist/domain/corpus/FileVersion.js +47 -0
- package/dist/domain/corpus/FileVersion.js.map +1 -0
- package/dist/domain/corpus/SourceFile.d.ts +26 -0
- package/dist/domain/corpus/SourceFile.js +47 -0
- package/dist/domain/corpus/SourceFile.js.map +1 -0
- package/dist/domain/corpus/Vector.d.ts +37 -0
- package/dist/domain/corpus/Vector.js +96 -0
- package/dist/domain/corpus/Vector.js.map +1 -0
- package/dist/domain/ports/ChatModelPort.d.ts +57 -0
- package/dist/domain/ports/ChatModelPort.js +2 -0
- package/dist/domain/ports/ChatModelPort.js.map +1 -0
- package/dist/domain/ports/ChunkRepositoryPort.d.ts +42 -0
- package/dist/domain/ports/ChunkRepositoryPort.js +2 -0
- package/dist/domain/ports/ChunkRepositoryPort.js.map +1 -0
- package/dist/domain/ports/ChunkerPort.d.ts +5 -0
- package/dist/domain/ports/ChunkerPort.js +2 -0
- package/dist/domain/ports/ChunkerPort.js.map +1 -0
- package/dist/domain/ports/DatabaseSessionPort.d.ts +10 -0
- package/dist/domain/ports/DatabaseSessionPort.js +2 -0
- package/dist/domain/ports/DatabaseSessionPort.js.map +1 -0
- package/dist/domain/ports/EmbedderPort.d.ts +14 -0
- package/dist/domain/ports/EmbedderPort.js +2 -0
- package/dist/domain/ports/EmbedderPort.js.map +1 -0
- package/dist/domain/ports/FileManifestRepositoryPort.d.ts +32 -0
- package/dist/domain/ports/FileManifestRepositoryPort.js +2 -0
- package/dist/domain/ports/FileManifestRepositoryPort.js.map +1 -0
- package/dist/domain/ports/GitPort.d.ts +24 -0
- package/dist/domain/ports/GitPort.js +2 -0
- package/dist/domain/ports/GitPort.js.map +1 -0
- package/dist/domain/ports/IndexMaintenancePort.d.ts +58 -0
- package/dist/domain/ports/IndexMaintenancePort.js +2 -0
- package/dist/domain/ports/IndexMaintenancePort.js.map +1 -0
- package/dist/domain/ports/IndexMetadataPort.d.ts +23 -0
- package/dist/domain/ports/IndexMetadataPort.js +2 -0
- package/dist/domain/ports/IndexMetadataPort.js.map +1 -0
- package/dist/domain/ports/LockPort.d.ts +17 -0
- package/dist/domain/ports/LockPort.js +2 -0
- package/dist/domain/ports/LockPort.js.map +1 -0
- package/dist/domain/ports/LoggerPort.d.ts +5 -0
- package/dist/domain/ports/LoggerPort.js +2 -0
- package/dist/domain/ports/LoggerPort.js.map +1 -0
- package/dist/domain/ports/ProjectIndexesPort.d.ts +20 -0
- package/dist/domain/ports/ProjectIndexesPort.js +2 -0
- package/dist/domain/ports/ProjectIndexesPort.js.map +1 -0
- package/dist/domain/ports/ProjectRegistryPort.d.ts +42 -0
- package/dist/domain/ports/ProjectRegistryPort.js +2 -0
- package/dist/domain/ports/ProjectRegistryPort.js.map +1 -0
- package/dist/domain/ports/StateDirectoryPort.d.ts +29 -0
- package/dist/domain/ports/StateDirectoryPort.js +2 -0
- package/dist/domain/ports/StateDirectoryPort.js.map +1 -0
- package/dist/domain/ports/WorkspacePort.d.ts +38 -0
- package/dist/domain/ports/WorkspacePort.js +2 -0
- package/dist/domain/ports/WorkspacePort.js.map +1 -0
- package/dist/domain/project/Branch.d.ts +20 -0
- package/dist/domain/project/Branch.js +33 -0
- package/dist/domain/project/Branch.js.map +1 -0
- package/dist/domain/project/DatabaseLocation.d.ts +32 -0
- package/dist/domain/project/DatabaseLocation.js +35 -0
- package/dist/domain/project/DatabaseLocation.js.map +1 -0
- package/dist/domain/project/IndexMetadata.d.ts +17 -0
- package/dist/domain/project/IndexMetadata.js +2 -0
- package/dist/domain/project/IndexMetadata.js.map +1 -0
- package/dist/domain/project/ModelIdentity.d.ts +58 -0
- package/dist/domain/project/ModelIdentity.js +97 -0
- package/dist/domain/project/ModelIdentity.js.map +1 -0
- package/dist/domain/project/Project.d.ts +17 -0
- package/dist/domain/project/Project.js +21 -0
- package/dist/domain/project/Project.js.map +1 -0
- package/dist/domain/project/ProjectId.d.ts +28 -0
- package/dist/domain/project/ProjectId.js +58 -0
- package/dist/domain/project/ProjectId.js.map +1 -0
- package/dist/domain/project/ProjectLocator.d.ts +112 -0
- package/dist/domain/project/ProjectLocator.js +178 -0
- package/dist/domain/project/ProjectLocator.js.map +1 -0
- package/dist/domain/research/Citation.d.ts +27 -0
- package/dist/domain/research/Citation.js +43 -0
- package/dist/domain/research/Citation.js.map +1 -0
- package/dist/domain/research/EvidenceLedger.d.ts +47 -0
- package/dist/domain/research/EvidenceLedger.js +111 -0
- package/dist/domain/research/EvidenceLedger.js.map +1 -0
- package/dist/domain/research/ResearchTrace.d.ts +19 -0
- package/dist/domain/research/ResearchTrace.js +22 -0
- package/dist/domain/research/ResearchTrace.js.map +1 -0
- package/dist/domain/retrieval/Hit.d.ts +19 -0
- package/dist/domain/retrieval/Hit.js +28 -0
- package/dist/domain/retrieval/Hit.js.map +1 -0
- package/dist/domain/retrieval/HitList.d.ts +35 -0
- package/dist/domain/retrieval/HitList.js +81 -0
- package/dist/domain/retrieval/HitList.js.map +1 -0
- package/dist/domain/retrieval/MissingIndexError.d.ts +11 -0
- package/dist/domain/retrieval/MissingIndexError.js +15 -0
- package/dist/domain/retrieval/MissingIndexError.js.map +1 -0
- package/dist/index.d.ts +43 -33
- package/dist/index.js +32 -215
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/ai/AiSdkChatModel.d.ts +31 -0
- package/dist/infrastructure/ai/AiSdkChatModel.js +137 -0
- package/dist/infrastructure/ai/AiSdkChatModel.js.map +1 -0
- package/dist/infrastructure/ai/AiSdkEmbedder.d.ts +28 -0
- package/dist/infrastructure/ai/AiSdkEmbedder.js +79 -0
- package/dist/infrastructure/ai/AiSdkEmbedder.js.map +1 -0
- package/dist/infrastructure/ai/EmbeddingPrefixes.d.ts +21 -0
- package/dist/infrastructure/ai/EmbeddingPrefixes.js +40 -0
- package/dist/infrastructure/ai/EmbeddingPrefixes.js.map +1 -0
- package/dist/infrastructure/ai/LmStudioProbe.d.ts +18 -0
- package/dist/infrastructure/ai/LmStudioProbe.js +49 -0
- package/dist/infrastructure/ai/LmStudioProbe.js.map +1 -0
- package/dist/infrastructure/ai/LocalModelReloader.d.ts +21 -0
- package/dist/infrastructure/ai/LocalModelReloader.js +61 -0
- package/dist/infrastructure/ai/LocalModelReloader.js.map +1 -0
- package/dist/infrastructure/ai/LocalRuntimeDetector.d.ts +36 -0
- package/dist/infrastructure/ai/LocalRuntimeDetector.js +61 -0
- package/dist/infrastructure/ai/LocalRuntimeDetector.js.map +1 -0
- package/dist/infrastructure/ai/ModelRuntime.d.ts +32 -0
- package/dist/infrastructure/ai/ModelRuntime.js +2 -0
- package/dist/infrastructure/ai/ModelRuntime.js.map +1 -0
- package/dist/infrastructure/ai/OllamaProbe.d.ts +21 -0
- package/dist/infrastructure/ai/OllamaProbe.js +69 -0
- package/dist/infrastructure/ai/OllamaProbe.js.map +1 -0
- package/dist/infrastructure/ai/ProviderFailure.d.ts +16 -0
- package/dist/infrastructure/ai/ProviderFailure.js +35 -0
- package/dist/infrastructure/ai/ProviderFailure.js.map +1 -0
- package/dist/infrastructure/ai/ProviderModuleLoader.d.ts +13 -0
- package/dist/infrastructure/ai/ProviderModuleLoader.js +49 -0
- package/dist/infrastructure/ai/ProviderModuleLoader.js.map +1 -0
- package/dist/infrastructure/ai/ProviderRegistry.d.ts +37 -0
- package/dist/infrastructure/ai/ProviderRegistry.js +55 -0
- package/dist/infrastructure/ai/ProviderRegistry.js.map +1 -0
- package/dist/infrastructure/fs/ConfigLoader.d.ts +59 -0
- package/dist/infrastructure/fs/ConfigLoader.js +194 -0
- package/dist/infrastructure/fs/ConfigLoader.js.map +1 -0
- package/dist/infrastructure/fs/DatabaseLocks.d.ts +52 -0
- package/dist/infrastructure/fs/DatabaseLocks.js +92 -0
- package/dist/infrastructure/fs/DatabaseLocks.js.map +1 -0
- package/dist/infrastructure/fs/DiskUsage.d.ts +6 -0
- package/dist/infrastructure/fs/DiskUsage.js +41 -0
- package/dist/infrastructure/fs/DiskUsage.js.map +1 -0
- package/dist/infrastructure/fs/IndexableFileRules.d.ts +33 -0
- package/dist/infrastructure/fs/IndexableFileRules.js +177 -0
- package/dist/infrastructure/fs/IndexableFileRules.js.map +1 -0
- package/dist/infrastructure/fs/Loggers.d.ts +14 -0
- package/dist/infrastructure/fs/Loggers.js +18 -0
- package/dist/infrastructure/fs/Loggers.js.map +1 -0
- package/dist/infrastructure/fs/PidFileLock.d.ts +40 -0
- package/dist/infrastructure/fs/PidFileLock.js +97 -0
- package/dist/infrastructure/fs/PidFileLock.js.map +1 -0
- package/dist/infrastructure/fs/ProjectIndexes.d.ts +8 -0
- package/dist/infrastructure/fs/ProjectIndexes.js +35 -0
- package/dist/infrastructure/fs/ProjectIndexes.js.map +1 -0
- package/dist/infrastructure/fs/ProjectMetadataStore.d.ts +42 -0
- package/dist/infrastructure/fs/ProjectMetadataStore.js +86 -0
- package/dist/infrastructure/fs/ProjectMetadataStore.js.map +1 -0
- package/dist/infrastructure/fs/ProjectRegistry.d.ts +25 -0
- package/dist/infrastructure/fs/ProjectRegistry.js +83 -0
- package/dist/infrastructure/fs/ProjectRegistry.js.map +1 -0
- package/dist/infrastructure/fs/StateDirectory.d.ts +28 -0
- package/dist/infrastructure/fs/StateDirectory.js +71 -0
- package/dist/infrastructure/fs/StateDirectory.js.map +1 -0
- package/dist/infrastructure/fs/Workspace.d.ts +25 -0
- package/dist/infrastructure/fs/Workspace.js +90 -0
- package/dist/infrastructure/fs/Workspace.js.map +1 -0
- package/dist/infrastructure/git/GitClient.d.ts +34 -0
- package/dist/infrastructure/git/GitClient.js +74 -0
- package/dist/infrastructure/git/GitClient.js.map +1 -0
- package/dist/infrastructure/lancedb/ChunkRepository.d.ts +38 -0
- package/dist/infrastructure/lancedb/ChunkRepository.js +166 -0
- package/dist/infrastructure/lancedb/ChunkRepository.js.map +1 -0
- package/dist/infrastructure/lancedb/DatabaseImporter.d.ts +22 -0
- package/dist/infrastructure/lancedb/DatabaseImporter.js +74 -0
- package/dist/infrastructure/lancedb/DatabaseImporter.js.map +1 -0
- package/dist/infrastructure/lancedb/FileManifestRepository.d.ts +34 -0
- package/dist/infrastructure/lancedb/FileManifestRepository.js +137 -0
- package/dist/infrastructure/lancedb/FileManifestRepository.js.map +1 -0
- package/dist/infrastructure/lancedb/IndexMaintenance.d.ts +53 -0
- package/dist/infrastructure/lancedb/IndexMaintenance.js +227 -0
- package/dist/infrastructure/lancedb/IndexMaintenance.js.map +1 -0
- package/dist/infrastructure/lancedb/LanceTables.d.ts +67 -0
- package/dist/infrastructure/lancedb/LanceTables.js +159 -0
- package/dist/infrastructure/lancedb/LanceTables.js.map +1 -0
- package/dist/infrastructure/lancedb/NativeTuning.d.ts +1 -0
- package/dist/infrastructure/lancedb/NativeTuning.js +9 -0
- package/dist/infrastructure/lancedb/NativeTuning.js.map +1 -0
- package/dist/infrastructure/lancedb/RowReplication.d.ts +27 -0
- package/dist/infrastructure/lancedb/RowReplication.js +82 -0
- package/dist/infrastructure/lancedb/RowReplication.js.map +1 -0
- package/dist/infrastructure/lancedb/VectorIndexPolicy.d.ts +60 -0
- package/dist/infrastructure/lancedb/VectorIndexPolicy.js +72 -0
- package/dist/infrastructure/lancedb/VectorIndexPolicy.js.map +1 -0
- package/dist/infrastructure/p2p/IndexShare.d.ts +45 -0
- package/dist/infrastructure/p2p/IndexShare.js +160 -0
- package/dist/infrastructure/p2p/IndexShare.js.map +1 -0
- package/dist/infrastructure/p2p/PeerSwarm.d.ts +16 -0
- package/dist/infrastructure/p2p/PeerSwarm.js +41 -0
- package/dist/infrastructure/p2p/PeerSwarm.js.map +1 -0
- package/dist/infrastructure/p2p/SecureChannel.d.ts +60 -0
- package/dist/infrastructure/p2p/SecureChannel.js +71 -0
- package/dist/infrastructure/p2p/SecureChannel.js.map +1 -0
- package/dist/infrastructure/p2p/ShareCode.d.ts +25 -0
- package/dist/infrastructure/p2p/ShareCode.js +304 -0
- package/dist/infrastructure/p2p/ShareCode.js.map +1 -0
- package/dist/infrastructure/process/ProcessRegistry.d.ts +50 -0
- package/dist/infrastructure/process/ProcessRegistry.js +109 -0
- package/dist/infrastructure/process/ProcessRegistry.js.map +1 -0
- package/dist/infrastructure/treesitter/ChunkContextBuilder.d.ts +45 -0
- package/dist/infrastructure/treesitter/ChunkContextBuilder.js +159 -0
- package/dist/infrastructure/treesitter/ChunkContextBuilder.js.map +1 -0
- package/dist/infrastructure/treesitter/LanguageCatalog.d.ts +30 -0
- package/dist/{lib/chunker/languages.js → infrastructure/treesitter/LanguageCatalog.js} +65 -41
- package/dist/infrastructure/treesitter/LanguageCatalog.js.map +1 -0
- package/dist/infrastructure/treesitter/SlidingWindowChunker.d.ts +15 -0
- package/dist/infrastructure/treesitter/SlidingWindowChunker.js +42 -0
- package/dist/infrastructure/treesitter/SlidingWindowChunker.js.map +1 -0
- package/dist/infrastructure/treesitter/TreeSitterChunker.d.ts +42 -0
- package/dist/infrastructure/treesitter/TreeSitterChunker.js +163 -0
- package/dist/infrastructure/treesitter/TreeSitterChunker.js.map +1 -0
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +15 -61
- package/dist/mcp.js.map +1 -1
- package/dist/presentation/cli/Cli.d.ts +31 -0
- package/dist/presentation/cli/Cli.js +120 -0
- package/dist/presentation/cli/Cli.js.map +1 -0
- package/dist/presentation/cli/CliOptions.d.ts +18 -0
- package/dist/presentation/cli/CliOptions.js +25 -0
- package/dist/presentation/cli/CliOptions.js.map +1 -0
- package/dist/presentation/cli/CommandContext.d.ts +50 -0
- package/dist/presentation/cli/CommandContext.js +88 -0
- package/dist/presentation/cli/CommandContext.js.map +1 -0
- package/dist/presentation/cli/ConfigTemplate.d.ts +31 -0
- package/dist/presentation/cli/ConfigTemplate.js +83 -0
- package/dist/presentation/cli/ConfigTemplate.js.map +1 -0
- package/dist/presentation/cli/Renderer.d.ts +90 -0
- package/dist/presentation/cli/Renderer.js +290 -0
- package/dist/presentation/cli/Renderer.js.map +1 -0
- package/dist/presentation/cli/commands/AskCommand.d.ts +14 -0
- package/dist/presentation/cli/commands/AskCommand.js +48 -0
- package/dist/presentation/cli/commands/AskCommand.js.map +1 -0
- package/dist/presentation/cli/commands/CompletionsCommand.d.ts +18 -0
- package/dist/presentation/cli/commands/CompletionsCommand.js +96 -0
- package/dist/presentation/cli/commands/CompletionsCommand.js.map +1 -0
- package/dist/presentation/cli/commands/ConfigCommands.d.ts +55 -0
- package/dist/presentation/cli/commands/ConfigCommands.js +204 -0
- package/dist/presentation/cli/commands/ConfigCommands.js.map +1 -0
- package/dist/presentation/cli/commands/IndexCommand.d.ts +18 -0
- package/dist/presentation/cli/commands/IndexCommand.js +54 -0
- package/dist/presentation/cli/commands/IndexCommand.js.map +1 -0
- package/dist/presentation/cli/commands/ProjectsCommand.d.ts +48 -0
- package/dist/presentation/cli/commands/ProjectsCommand.js +240 -0
- package/dist/presentation/cli/commands/ProjectsCommand.js.map +1 -0
- package/dist/presentation/cli/commands/SearchCommand.d.ts +19 -0
- package/dist/presentation/cli/commands/SearchCommand.js +55 -0
- package/dist/presentation/cli/commands/SearchCommand.js.map +1 -0
- package/dist/presentation/cli/commands/ServerCommands.d.ts +13 -0
- package/dist/presentation/cli/commands/ServerCommands.js +40 -0
- package/dist/presentation/cli/commands/ServerCommands.js.map +1 -0
- package/dist/presentation/cli/commands/ShareCommands.d.ts +22 -0
- package/dist/presentation/cli/commands/ShareCommands.js +134 -0
- package/dist/presentation/cli/commands/ShareCommands.js.map +1 -0
- package/dist/presentation/cli/commands/StatusCommand.d.ts +15 -0
- package/dist/presentation/cli/commands/StatusCommand.js +53 -0
- package/dist/presentation/cli/commands/StatusCommand.js.map +1 -0
- package/dist/presentation/mcp/HitFormatter.d.ts +17 -0
- package/dist/presentation/mcp/HitFormatter.js +42 -0
- package/dist/presentation/mcp/HitFormatter.js.map +1 -0
- package/dist/presentation/mcp/IndexWatchController.d.ts +17 -0
- package/dist/presentation/mcp/IndexWatchController.js +31 -0
- package/dist/presentation/mcp/IndexWatchController.js.map +1 -0
- package/dist/presentation/mcp/LmgrepCore.d.ts +66 -0
- package/dist/presentation/mcp/LmgrepCore.js +178 -0
- package/dist/presentation/mcp/LmgrepCore.js.map +1 -0
- package/dist/presentation/mcp/McpServer.d.ts +18 -0
- package/dist/presentation/mcp/McpServer.js +63 -0
- package/dist/presentation/mcp/McpServer.js.map +1 -0
- package/dist/presentation/mcp/ToolDescriptions.d.ts +40 -0
- package/dist/presentation/mcp/ToolDescriptions.js +85 -0
- package/dist/presentation/mcp/ToolDescriptions.js.map +1 -0
- package/package.json +84 -63
- package/dist/lib/build.d.ts +0 -7
- package/dist/lib/build.js +0 -284
- package/dist/lib/build.js.map +0 -1
- package/dist/lib/chunker/context.d.ts +0 -21
- package/dist/lib/chunker/context.js +0 -131
- package/dist/lib/chunker/context.js.map +0 -1
- package/dist/lib/chunker/index.d.ts +0 -7
- package/dist/lib/chunker/index.js +0 -150
- package/dist/lib/chunker/index.js.map +0 -1
- package/dist/lib/chunker/languages.d.ts +0 -15
- package/dist/lib/chunker/languages.js.map +0 -1
- package/dist/lib/config.d.ts +0 -12
- package/dist/lib/config.js +0 -83
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/embedder.d.ts +0 -55
- package/dist/lib/embedder.js +0 -221
- package/dist/lib/embedder.js.map +0 -1
- package/dist/lib/p2p.d.ts +0 -32
- package/dist/lib/p2p.js +0 -281
- package/dist/lib/p2p.js.map +0 -1
- package/dist/lib/providers.d.ts +0 -1
- package/dist/lib/providers.js +0 -41
- package/dist/lib/providers.js.map +0 -1
- package/dist/lib/repair.d.ts +0 -10
- package/dist/lib/repair.js +0 -57
- package/dist/lib/repair.js.map +0 -1
- package/dist/lib/scanner.d.ts +0 -34
- package/dist/lib/scanner.js +0 -242
- package/dist/lib/scanner.js.map +0 -1
- package/dist/lib/search-tool.d.ts +0 -47
- package/dist/lib/search-tool.js +0 -239
- package/dist/lib/search-tool.js.map +0 -1
- package/dist/lib/serve.d.ts +0 -11
- package/dist/lib/serve.js +0 -127
- package/dist/lib/serve.js.map +0 -1
- package/dist/lib/store.d.ts +0 -177
- package/dist/lib/store.js +0 -825
- package/dist/lib/store.js.map +0 -1
- package/dist/lib/types.d.ts +0 -129
- package/dist/lib/types.js +0 -13
- package/dist/lib/types.js.map +0 -1
package/dist/lib/scanner.js
DELETED
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
import { readFileSync, existsSync, watch, statSync } from "node:fs";
|
|
2
|
-
import { createHash } from "node:crypto";
|
|
3
|
-
import { join, extname, dirname } from "node:path";
|
|
4
|
-
import { globSync } from "glob";
|
|
5
|
-
import ignore from "ignore";
|
|
6
|
-
export const DEFAULT_IGNORE = [
|
|
7
|
-
"node_modules",
|
|
8
|
-
".git",
|
|
9
|
-
"dist",
|
|
10
|
-
"build",
|
|
11
|
-
".next",
|
|
12
|
-
"__pycache__",
|
|
13
|
-
".venv",
|
|
14
|
-
"vendor",
|
|
15
|
-
"target",
|
|
16
|
-
".lmgrep",
|
|
17
|
-
"*.min.js",
|
|
18
|
-
"*.min.css",
|
|
19
|
-
"*.map",
|
|
20
|
-
"*.lock",
|
|
21
|
-
"pnpm-lock.yaml",
|
|
22
|
-
"package-lock.json",
|
|
23
|
-
"yarn.lock",
|
|
24
|
-
"*.png",
|
|
25
|
-
"*.jpg",
|
|
26
|
-
"*.jpeg",
|
|
27
|
-
"*.gif",
|
|
28
|
-
"*.ico",
|
|
29
|
-
"*.woff",
|
|
30
|
-
"*.woff2",
|
|
31
|
-
"*.ttf",
|
|
32
|
-
"*.eot",
|
|
33
|
-
"*.svg",
|
|
34
|
-
"*.zip",
|
|
35
|
-
"*.tar",
|
|
36
|
-
"*.gz",
|
|
37
|
-
"*.bin",
|
|
38
|
-
"*.exe",
|
|
39
|
-
"*.dll",
|
|
40
|
-
"*.so",
|
|
41
|
-
"*.dylib",
|
|
42
|
-
"*.wasm",
|
|
43
|
-
];
|
|
44
|
-
export const CODE_EXTENSIONS = new Set([
|
|
45
|
-
".js",
|
|
46
|
-
".ts",
|
|
47
|
-
".jsx",
|
|
48
|
-
".tsx",
|
|
49
|
-
".py",
|
|
50
|
-
".rs",
|
|
51
|
-
".go",
|
|
52
|
-
".rb",
|
|
53
|
-
".c",
|
|
54
|
-
".h",
|
|
55
|
-
".cpp",
|
|
56
|
-
".hpp",
|
|
57
|
-
".cc",
|
|
58
|
-
".swift",
|
|
59
|
-
".json",
|
|
60
|
-
".yaml",
|
|
61
|
-
".yml",
|
|
62
|
-
".toml",
|
|
63
|
-
".lua",
|
|
64
|
-
".scala",
|
|
65
|
-
".zig",
|
|
66
|
-
".md",
|
|
67
|
-
".markdown",
|
|
68
|
-
".mdx",
|
|
69
|
-
".sh",
|
|
70
|
-
".bash",
|
|
71
|
-
".sql",
|
|
72
|
-
".graphql",
|
|
73
|
-
".gql",
|
|
74
|
-
".proto",
|
|
75
|
-
".html",
|
|
76
|
-
".css",
|
|
77
|
-
".scss",
|
|
78
|
-
".vue",
|
|
79
|
-
".svelte",
|
|
80
|
-
".nix",
|
|
81
|
-
".tf",
|
|
82
|
-
".hcl",
|
|
83
|
-
".kt",
|
|
84
|
-
".java",
|
|
85
|
-
".php",
|
|
86
|
-
".cs",
|
|
87
|
-
".rst",
|
|
88
|
-
".adoc",
|
|
89
|
-
]);
|
|
90
|
-
function buildExtensionSet(config) {
|
|
91
|
-
const exts = new Set(CODE_EXTENSIONS);
|
|
92
|
-
if (config?.include) {
|
|
93
|
-
for (const ext of config.include)
|
|
94
|
-
exts.add(ext);
|
|
95
|
-
}
|
|
96
|
-
if (config?.exclude) {
|
|
97
|
-
for (const ext of config.exclude)
|
|
98
|
-
exts.delete(ext);
|
|
99
|
-
}
|
|
100
|
-
return exts;
|
|
101
|
-
}
|
|
102
|
-
function isCodeFile(filePath, exts) {
|
|
103
|
-
const ext = extname(filePath);
|
|
104
|
-
return exts.has(ext);
|
|
105
|
-
}
|
|
106
|
-
function buildIgnoreFilter(cwd, extraPatterns) {
|
|
107
|
-
const ig = ignore();
|
|
108
|
-
ig.add(DEFAULT_IGNORE);
|
|
109
|
-
if (extraPatterns) {
|
|
110
|
-
ig.add(extraPatterns);
|
|
111
|
-
}
|
|
112
|
-
const gitignorePath = join(cwd, ".gitignore");
|
|
113
|
-
if (existsSync(gitignorePath)) {
|
|
114
|
-
ig.add(readFileSync(gitignorePath, "utf-8"));
|
|
115
|
-
}
|
|
116
|
-
const lmgrepIgnorePath = join(cwd, ".lmgrepignore");
|
|
117
|
-
if (existsSync(lmgrepIgnorePath)) {
|
|
118
|
-
ig.add(readFileSync(lmgrepIgnorePath, "utf-8"));
|
|
119
|
-
}
|
|
120
|
-
return ig;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Walk the directory tree and yield file entries.
|
|
124
|
-
* Reads nested .gitignore files at each directory level.
|
|
125
|
-
*/
|
|
126
|
-
export function walkFiles(cwd, extraIgnore, extensions) {
|
|
127
|
-
const ig = buildIgnoreFilter(cwd, extraIgnore);
|
|
128
|
-
const exts = buildExtensionSet(extensions);
|
|
129
|
-
// Collect nested .gitignore rules
|
|
130
|
-
const allFiles = globSync("**/*", { cwd, nodir: true, dot: false });
|
|
131
|
-
// Build a set of directories that have .gitignore files
|
|
132
|
-
const nestedIgnores = new Map();
|
|
133
|
-
for (const f of allFiles) {
|
|
134
|
-
if (f.endsWith("/.gitignore") || f === ".gitignore")
|
|
135
|
-
continue;
|
|
136
|
-
const dir = dirname(f);
|
|
137
|
-
if (dir === "." || nestedIgnores.has(dir))
|
|
138
|
-
continue;
|
|
139
|
-
const nestedPath = join(cwd, dir, ".gitignore");
|
|
140
|
-
if (existsSync(nestedPath)) {
|
|
141
|
-
const nested = ignore();
|
|
142
|
-
nested.add(readFileSync(nestedPath, "utf-8"));
|
|
143
|
-
nestedIgnores.set(dir, nested);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return allFiles.filter((f) => {
|
|
147
|
-
if (!isCodeFile(f, exts))
|
|
148
|
-
return false;
|
|
149
|
-
if (ig.ignores(f))
|
|
150
|
-
return false;
|
|
151
|
-
// Check nested .gitignore rules
|
|
152
|
-
for (const [dir, nested] of nestedIgnores) {
|
|
153
|
-
if (f.startsWith(dir + "/")) {
|
|
154
|
-
const rel = f.slice(dir.length + 1);
|
|
155
|
-
if (nested.ignores(rel))
|
|
156
|
-
return false;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
return true;
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Hash a file's content for change detection.
|
|
164
|
-
*/
|
|
165
|
-
export function hashFile(cwd, filePath) {
|
|
166
|
-
try {
|
|
167
|
-
const content = readFileSync(join(cwd, filePath));
|
|
168
|
-
return createHash("sha256").update(content).digest("hex").slice(0, 16);
|
|
169
|
-
}
|
|
170
|
-
catch {
|
|
171
|
-
return undefined;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Compute changed files by comparing disk hashes against stored hashes.
|
|
176
|
-
*/
|
|
177
|
-
export function detectChanges(files, storedHashes, cwd, force = false) {
|
|
178
|
-
const changed = [];
|
|
179
|
-
const currentHashes = new Map();
|
|
180
|
-
for (const file of files) {
|
|
181
|
-
const hash = hashFile(cwd, file);
|
|
182
|
-
if (!hash)
|
|
183
|
-
continue;
|
|
184
|
-
currentHashes.set(file, hash);
|
|
185
|
-
if (force || storedHashes.get(file) !== hash) {
|
|
186
|
-
changed.push({ path: file, hash });
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
return { changed, currentHashes };
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Filter files by modification time.
|
|
193
|
-
*/
|
|
194
|
-
export function filterByMtime(files, cwd, cutoffMs) {
|
|
195
|
-
return files.filter((f) => {
|
|
196
|
-
try {
|
|
197
|
-
return statSync(join(cwd, f)).mtimeMs >= cutoffMs;
|
|
198
|
-
}
|
|
199
|
-
catch {
|
|
200
|
-
return false;
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Watch a directory for code file changes. Calls the callback with debouncing.
|
|
206
|
-
* Collects changed file paths during the debounce window and passes them to the callback.
|
|
207
|
-
*/
|
|
208
|
-
export function watchFiles(cwd, extraIgnore, onChanges, debounceMs = 2000, extensions) {
|
|
209
|
-
const ig = buildIgnoreFilter(cwd, extraIgnore);
|
|
210
|
-
const exts = buildExtensionSet(extensions);
|
|
211
|
-
let timer;
|
|
212
|
-
let pending = new Set();
|
|
213
|
-
const watcher = watch(cwd, { recursive: true }, (_event, filename) => {
|
|
214
|
-
if (!filename)
|
|
215
|
-
return;
|
|
216
|
-
if (!isCodeFile(filename, exts))
|
|
217
|
-
return;
|
|
218
|
-
try {
|
|
219
|
-
if (ig.ignores(filename))
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
catch {
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
pending.add(filename);
|
|
226
|
-
if (timer)
|
|
227
|
-
clearTimeout(timer);
|
|
228
|
-
timer = setTimeout(() => {
|
|
229
|
-
const files = [...pending];
|
|
230
|
-
pending = new Set();
|
|
231
|
-
onChanges(files);
|
|
232
|
-
}, debounceMs);
|
|
233
|
-
});
|
|
234
|
-
return {
|
|
235
|
-
close() {
|
|
236
|
-
if (timer)
|
|
237
|
-
clearTimeout(timer);
|
|
238
|
-
watcher.close();
|
|
239
|
-
},
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
//# sourceMappingURL=scanner.js.map
|
package/dist/lib/scanner.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scanner.js","sourceRoot":"","sources":["../../src/lib/scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAY,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,MAAuB,MAAM,QAAQ,CAAC;AAG7C,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B,cAAc;IACd,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,aAAa;IACb,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,UAAU;IACV,WAAW;IACX,OAAO;IACP,QAAQ;IACR,gBAAgB;IAChB,mBAAmB;IACnB,WAAW;IACX,OAAO;IACP,OAAO;IACP,QAAQ;IACR,OAAO;IACP,OAAO;IACP,QAAQ;IACR,SAAS;IACT,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,MAAM;IACN,SAAS;IACT,QAAQ;CACR,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IACtC,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,MAAM;IACN,MAAM;IACN,KAAK;IACL,QAAQ;IACR,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,QAAQ;IACR,MAAM;IACN,KAAK;IACL,WAAW;IACX,MAAM;IACN,KAAK;IACL,OAAO;IACP,MAAM;IACN,UAAU;IACV,MAAM;IACN,QAAQ;IACR,OA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AO;QACtB,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC;YAAE,OAAO;QACxC,IAAI,CAAC;YACJ,IAAI,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;gBAAE,OAAO;QAClC,CAAC;QAAC,MAAM,CAAC;YACR,OAAO;QACR,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACtB,IAAI,KAAK;YAAE,YAAY,CAAC,KAAK,CAAC,CAAC;QAC/B,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YACvB,MAAM,KAAK,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC;YAC3B,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC;YACpB,SAAS,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC,EAAE,UAAU,CAAC,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,OAAO;QACN,KAAK;YACJ,IAAI,KAAK;gBAAE,YAAY,CAAC,KAAK,CAAC,CAAC;YAC/B,OAAO,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC;KACD,CAAC;AACH,CAAC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export type HealthReason = "ok" | "not_indexed" | "embedding_failed" | "search_empty";
|
|
2
|
-
export interface HealthState {
|
|
3
|
-
healthy: boolean;
|
|
4
|
-
reason: HealthReason;
|
|
5
|
-
}
|
|
6
|
-
export interface SearchArgs {
|
|
7
|
-
query: string;
|
|
8
|
-
limit?: number;
|
|
9
|
-
filePrefix?: string;
|
|
10
|
-
type?: string[];
|
|
11
|
-
language?: string[];
|
|
12
|
-
project?: string;
|
|
13
|
-
}
|
|
14
|
-
export interface ToolResult {
|
|
15
|
-
text: string;
|
|
16
|
-
isError?: boolean;
|
|
17
|
-
}
|
|
18
|
-
export interface ParamSpec {
|
|
19
|
-
description: string;
|
|
20
|
-
}
|
|
21
|
-
export interface SearchParamSpecs {
|
|
22
|
-
query: ParamSpec;
|
|
23
|
-
limit: ParamSpec & {
|
|
24
|
-
default: number;
|
|
25
|
-
};
|
|
26
|
-
filePrefix: ParamSpec;
|
|
27
|
-
type: ParamSpec;
|
|
28
|
-
language: ParamSpec;
|
|
29
|
-
project: ParamSpec;
|
|
30
|
-
}
|
|
31
|
-
export declare const searchParamSpecs: SearchParamSpecs;
|
|
32
|
-
export declare const listProjectsDescription: string;
|
|
33
|
-
export interface LmgrepCore {
|
|
34
|
-
readonly cwd: string;
|
|
35
|
-
readonly searchParams: SearchParamSpecs;
|
|
36
|
-
readonly listProjectsDescription: string;
|
|
37
|
-
buildSearchDescription(): string;
|
|
38
|
-
currentHealth(): HealthState;
|
|
39
|
-
onHealthChange(cb: (state: HealthState) => void): () => void;
|
|
40
|
-
startHealthLoop(): void;
|
|
41
|
-
executeSearch(args: SearchArgs): Promise<ToolResult>;
|
|
42
|
-
executeListProjects(): Promise<ToolResult>;
|
|
43
|
-
dispose(): Promise<void>;
|
|
44
|
-
}
|
|
45
|
-
export declare function createLmgrepCore(opts: {
|
|
46
|
-
cwd: string;
|
|
47
|
-
}): Promise<LmgrepCore>;
|
package/dist/lib/search-tool.js
DELETED
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import { createIndex } from "../index.js";
|
|
3
|
-
import { TreeSitterChunker } from "./chunker/index.js";
|
|
4
|
-
import { loadConfig } from "./config.js";
|
|
5
|
-
import { AISDKEmbedder } from "./embedder.js";
|
|
6
|
-
import { startWatcher } from "./serve.js";
|
|
7
|
-
import { discoverIndexedProjects, findIndexedAncestor, getDbPath, Store, } from "./store.js";
|
|
8
|
-
import { silentLogger } from "./types.js";
|
|
9
|
-
export const searchParamSpecs = {
|
|
10
|
-
query: {
|
|
11
|
-
description: 'Natural-language description of what you\'re looking for — phrase it as a question or intent, not keywords. Good: "how are webhooks authenticated", "where is user deletion handled", "what happens when a record is created". Bad: "webhook auth", "deleteUser", "createRecord".',
|
|
12
|
-
},
|
|
13
|
-
limit: {
|
|
14
|
-
description: "Maximum number of results",
|
|
15
|
-
default: 10,
|
|
16
|
-
},
|
|
17
|
-
filePrefix: {
|
|
18
|
-
description: "Restrict to files under this path (e.g. 'src/lib')",
|
|
19
|
-
},
|
|
20
|
-
type: {
|
|
21
|
-
description: "AST node types to filter by (e.g. ['function_declaration', 'class_declaration'])",
|
|
22
|
-
},
|
|
23
|
-
language: {
|
|
24
|
-
description: "File extensions to filter by (e.g. ['.ts', '.py'])",
|
|
25
|
-
},
|
|
26
|
-
project: {
|
|
27
|
-
description: "Search a different indexed project by its root path instead of the current one",
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
export const listProjectsDescription = "List all indexed projects other than the current one. " +
|
|
31
|
-
"Use this to discover what projects are available for cross-project search " +
|
|
32
|
-
"via the `project` parameter on the search tool.";
|
|
33
|
-
export async function createLmgrepCore(opts) {
|
|
34
|
-
const cwd = opts.cwd;
|
|
35
|
-
const index = await createIndex({ cwd });
|
|
36
|
-
function isCurrentProjectIndexed() {
|
|
37
|
-
if (findIndexedAncestor(cwd))
|
|
38
|
-
return true;
|
|
39
|
-
return existsSync(getDbPath(cwd));
|
|
40
|
-
}
|
|
41
|
-
function getOtherProjects() {
|
|
42
|
-
const currentDb = getDbPath(cwd);
|
|
43
|
-
return discoverIndexedProjects()
|
|
44
|
-
.filter((p) => getDbPath(p.metadata.root) !== currentDb)
|
|
45
|
-
.map((p) => ({ root: p.metadata.root, remote: p.metadata.remote }));
|
|
46
|
-
}
|
|
47
|
-
async function checkHealth() {
|
|
48
|
-
if (!isCurrentProjectIndexed()) {
|
|
49
|
-
return { healthy: false, reason: "not_indexed" };
|
|
50
|
-
}
|
|
51
|
-
try {
|
|
52
|
-
const info = await index.status();
|
|
53
|
-
if (info.fileCount === 0) {
|
|
54
|
-
return { healthy: false, reason: "not_indexed" };
|
|
55
|
-
}
|
|
56
|
-
if (!info.embeddingOk) {
|
|
57
|
-
return { healthy: false, reason: "embedding_failed" };
|
|
58
|
-
}
|
|
59
|
-
if (!info.searchOk) {
|
|
60
|
-
return { healthy: false, reason: "search_empty" };
|
|
61
|
-
}
|
|
62
|
-
return { healthy: true, reason: "ok" };
|
|
63
|
-
}
|
|
64
|
-
catch {
|
|
65
|
-
return { healthy: false, reason: "embedding_failed" };
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
let state = isCurrentProjectIndexed()
|
|
69
|
-
? { healthy: true, reason: "ok" }
|
|
70
|
-
: { healthy: false, reason: "not_indexed" };
|
|
71
|
-
const listeners = new Set();
|
|
72
|
-
let stopWatcher;
|
|
73
|
-
let pollTimer;
|
|
74
|
-
let disposed = false;
|
|
75
|
-
function tryStartWatcher() {
|
|
76
|
-
if (stopWatcher)
|
|
77
|
-
return;
|
|
78
|
-
if (!isCurrentProjectIndexed())
|
|
79
|
-
return;
|
|
80
|
-
const config = loadConfig(cwd);
|
|
81
|
-
const store = Store.forProject(cwd);
|
|
82
|
-
const embedder = new AISDKEmbedder(config);
|
|
83
|
-
const chunker = new TreeSitterChunker();
|
|
84
|
-
stopWatcher = startWatcher(cwd, store, config, embedder, chunker, silentLogger);
|
|
85
|
-
}
|
|
86
|
-
function buildSearchDescription() {
|
|
87
|
-
if (state.healthy) {
|
|
88
|
-
return [
|
|
89
|
-
"**lmgrep — primary search tool for this codebase.** Semantic code search powered by a local embedding model; lmgrep understands intent, not string patterns. Prefer lmgrep over Grep/Glob/find/ripgrep for almost all exploration and lookup tasks.",
|
|
90
|
-
"",
|
|
91
|
-
'**Use lmgrep for:** finding where something is handled, how something works, locating relevant code, discovering related files, understanding unfamiliar code, tracing side effects, finding usage patterns, answering "where is X?" or "how does Y work?". One good lmgrep query is usually enough to understand how to proceed.',
|
|
92
|
-
"",
|
|
93
|
-
"**Query lmgrep as natural questions or intent descriptions**, not keyword dumps:",
|
|
94
|
-
'- "how are webhooks authenticated" → finds middleware, token validation, auth checks',
|
|
95
|
-
'- "where is user deletion handled" → finds the handler and related cleanup logic',
|
|
96
|
-
'- "what happens when a record is created" → finds controllers, event emitters, side effects',
|
|
97
|
-
'- "config loading and validation"',
|
|
98
|
-
'- "how to run the playwright tests" → finds config, scripts, prerequisites',
|
|
99
|
-
"",
|
|
100
|
-
"**lmgrep results include** file paths, line numbers, AST node types, and surrounding context (scope, leading comments, role) — often enough to act on directly without re-reading the file. Trust lmgrep results; don't follow up with Glob/Read on files already surfaced by lmgrep unless you genuinely need content that wasn't returned.",
|
|
101
|
-
"",
|
|
102
|
-
"**Fall back to Grep only** when you need exact string or regex matches (specific identifiers, literal constants, error messages, TODO markers). Don't use Grep/Glob/find for conceptual or intent-based search — lmgrep will do better.",
|
|
103
|
-
].join("\n");
|
|
104
|
-
}
|
|
105
|
-
const others = getOtherProjects();
|
|
106
|
-
const suffix = others.length > 0
|
|
107
|
-
? " You can still search other indexed projects via the `project` parameter — call `list_other_indexed_projects` to see what's available."
|
|
108
|
-
: "";
|
|
109
|
-
switch (state.reason) {
|
|
110
|
-
case "not_indexed":
|
|
111
|
-
return ("This project is not indexed. Semantic search is not available for the current directory." +
|
|
112
|
-
suffix);
|
|
113
|
-
case "embedding_failed":
|
|
114
|
-
return ("The embedding provider is unreachable. Semantic search is temporarily unavailable for the current directory." +
|
|
115
|
-
suffix);
|
|
116
|
-
case "search_empty":
|
|
117
|
-
return ("The index for the current branch appears empty or stale — a smoke query returned no results. Re-run `lmgrep index` to rebuild." +
|
|
118
|
-
suffix);
|
|
119
|
-
default:
|
|
120
|
-
return "Semantic search is unavailable." + suffix;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
async function refreshHealth() {
|
|
124
|
-
if (disposed)
|
|
125
|
-
return;
|
|
126
|
-
const next = await checkHealth();
|
|
127
|
-
if (next.healthy !== state.healthy || next.reason !== state.reason) {
|
|
128
|
-
state = next;
|
|
129
|
-
for (const cb of listeners)
|
|
130
|
-
cb(next);
|
|
131
|
-
}
|
|
132
|
-
if (next.healthy)
|
|
133
|
-
tryStartWatcher();
|
|
134
|
-
}
|
|
135
|
-
function startHealthLoop() {
|
|
136
|
-
if (pollTimer)
|
|
137
|
-
return;
|
|
138
|
-
tryStartWatcher();
|
|
139
|
-
// Non-local providers may bill per request — poll less often.
|
|
140
|
-
const intervalMs = index.config.local ? 10_000 : 60_000;
|
|
141
|
-
refreshHealth();
|
|
142
|
-
pollTimer = setInterval(refreshHealth, intervalMs);
|
|
143
|
-
}
|
|
144
|
-
function stopHealthLoop() {
|
|
145
|
-
if (!pollTimer)
|
|
146
|
-
return;
|
|
147
|
-
clearInterval(pollTimer);
|
|
148
|
-
pollTimer = undefined;
|
|
149
|
-
}
|
|
150
|
-
function markHealthy() {
|
|
151
|
-
if (!state.healthy || state.reason !== "ok") {
|
|
152
|
-
state = { healthy: true, reason: "ok" };
|
|
153
|
-
for (const cb of listeners)
|
|
154
|
-
cb(state);
|
|
155
|
-
}
|
|
156
|
-
tryStartWatcher();
|
|
157
|
-
}
|
|
158
|
-
async function executeSearch(args) {
|
|
159
|
-
if (state.reason === "embedding_failed") {
|
|
160
|
-
return {
|
|
161
|
-
text: "lmgrep is unavailable: the embedding provider is unreachable. Ask the user to check their lmgrep configuration (`lmgrep status`) before retrying.",
|
|
162
|
-
isError: true,
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
try {
|
|
166
|
-
const results = await index.search(args.query, {
|
|
167
|
-
limit: args.limit ?? searchParamSpecs.limit.default,
|
|
168
|
-
filePrefix: args.filePrefix,
|
|
169
|
-
type: args.type,
|
|
170
|
-
language: args.language,
|
|
171
|
-
project: args.project,
|
|
172
|
-
});
|
|
173
|
-
// A successful search proves the embedder is reachable and the
|
|
174
|
-
// index is queryable — no need to keep pinging via health checks,
|
|
175
|
-
// which would prevent a local embedder from going to sleep.
|
|
176
|
-
markHealthy();
|
|
177
|
-
stopHealthLoop();
|
|
178
|
-
if (results.length === 0) {
|
|
179
|
-
return { text: "No results found." };
|
|
180
|
-
}
|
|
181
|
-
const text = results
|
|
182
|
-
.map((r) => {
|
|
183
|
-
const loc = `${r.filePath}:${r.startLine}-${r.endLine}`;
|
|
184
|
-
const header = `${loc} [${r.type}] ${r.name} (score: ${r.score.toFixed(3)})`;
|
|
185
|
-
const parts = [header];
|
|
186
|
-
if (r.context)
|
|
187
|
-
parts.push(r.context);
|
|
188
|
-
parts.push(r.content);
|
|
189
|
-
return parts.join("\n");
|
|
190
|
-
})
|
|
191
|
-
.join("\n\n---\n\n");
|
|
192
|
-
return { text };
|
|
193
|
-
}
|
|
194
|
-
catch (err) {
|
|
195
|
-
// Search failed — the embedder may be down. Resume polling so we
|
|
196
|
-
// can detect recovery and update the tool description.
|
|
197
|
-
startHealthLoop();
|
|
198
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
199
|
-
return { text: `Error: ${msg}`, isError: true };
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
async function executeListProjects() {
|
|
203
|
-
const others = getOtherProjects();
|
|
204
|
-
if (others.length === 0) {
|
|
205
|
-
return { text: "No other indexed projects found." };
|
|
206
|
-
}
|
|
207
|
-
const lines = others.map((p) => {
|
|
208
|
-
const parts = [p.root];
|
|
209
|
-
if (p.remote)
|
|
210
|
-
parts.push(`(${p.remote})`);
|
|
211
|
-
return `- ${parts.join(" ")}`;
|
|
212
|
-
});
|
|
213
|
-
return { text: `Indexed projects:\n${lines.join("\n")}` };
|
|
214
|
-
}
|
|
215
|
-
async function dispose() {
|
|
216
|
-
disposed = true;
|
|
217
|
-
stopHealthLoop();
|
|
218
|
-
stopWatcher?.();
|
|
219
|
-
stopWatcher = undefined;
|
|
220
|
-
listeners.clear();
|
|
221
|
-
await index.close();
|
|
222
|
-
}
|
|
223
|
-
return {
|
|
224
|
-
cwd,
|
|
225
|
-
searchParams: searchParamSpecs,
|
|
226
|
-
listProjectsDescription,
|
|
227
|
-
buildSearchDescription,
|
|
228
|
-
currentHealth: () => state,
|
|
229
|
-
onHealthChange(cb) {
|
|
230
|
-
listeners.add(cb);
|
|
231
|
-
return () => listeners.delete(cb);
|
|
232
|
-
},
|
|
233
|
-
startHealthLoop,
|
|
234
|
-
executeSearch,
|
|
235
|
-
executeListProjects,
|
|
236
|
-
dispose,
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
//# sourceMappingURL=search-tool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search-tool.js","sourceRoot":"","sources":["../../src/lib/search-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,WAAW,EAAoB,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EACN,uBAAuB,EACvB,mBAAmB,EACnB,SAAS,EACT,KAAK,GACL,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAwC1C,MAAM,CAAC,MAAM,gBAAgB,GAAqB;IACjD,KAAK,EAAE;QACN,WAAW,EACV,mRAAmR;KACpR;IACD,KAAK,EAAE;QACN,WAAW,EAAE,2BAA2B;QACxC,OAAO,EAAE,EAAE;KACX;IACD,UAAU,EAAE;QACX,WAAW,EAAE,oDAAoD;KACjE;IACD,IAAI,EAAE;QACL,WAAW,EACV,kFAAkF;KACnF;IACD,QAAQ,EAAE;QACT,WAAW,EAAE,oDAAoD;KACjE;IACD,OAAO,EAAE;QACR,WAAW,EACV,gFAAgF;KACjF;CACD,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GACnC,wDAAwD;IACxD,4EAA4E;IAC5E,iDAAiD,CAAC;AAenD,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAEtC;IACA,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;IACr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,EAAE,EAAE;YAC9B,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YACvB,IAAI,CAAC,CAAC,MAAM;gBAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;YAC1C,OAAO,KAAK,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,CAAC,CAAC,CAAC;QACH,OAAO,EAAE,IAAI,EAAE,sBAAsB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;IAC3D,CAAC;IAED,KAAK,UAAU,OAAO;QACrB,QAAQ,GAAG,IAAI,CAAC;QAChB,cAAc,EAAE,CAAC;QACjB,WAAW,EAAE,EAAE,CAAC;QAChB,WAAW,GAAG,SAAS,CAAC;QACxB,SAAS,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;IAED,OAAO;QACN,GAAG;QACH,YAAY,EAAE,gBAAgB;QAC9B,uBAAuB;QACvB,sBAAsB;QACtB,aAAa,EAAE,GAAG,EAAE,CAAC,KAAK;QAC1B,cAAc,CAAC,EAAE;YAChB,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAClB,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACnC,CAAC;QACD,eAAe;QACf,aAAa;QACb,mBAAmB;QACnB,OAAO;KACP,CAAC;AACH,CAAC"}
|
package/dist/lib/serve.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Embedder } from "./embedder.js";
|
|
2
|
-
import { type Store, isDbLocked } from "./store.js";
|
|
3
|
-
import type { Chunker, Logger, LmgrepConfig } from "./types.js";
|
|
4
|
-
export { isDbLocked as isServeLocked };
|
|
5
|
-
export declare function serve(cwd: string, store: Store, config: LmgrepConfig, embedder: Embedder, chunker: Chunker, logger?: Logger): Promise<void>;
|
|
6
|
-
/**
|
|
7
|
-
* Start an in-process file watcher that incrementally re-indexes on changes.
|
|
8
|
-
* Acquires the DB lock. Returns a cleanup function to stop watching and release the lock.
|
|
9
|
-
* Returns undefined if the lock is already held by another process.
|
|
10
|
-
*/
|
|
11
|
-
export declare function startWatcher(cwd: string, store: Store, config: LmgrepConfig, embedder: Embedder, chunker: Chunker, logger?: Logger): (() => void) | undefined;
|