lmgrep 0.1.18 → 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 +4 -953
- 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 -45
- package/dist/index.js +30 -567
- 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/{lib/native-tuning.js → infrastructure/lancedb/NativeTuning.js} +1 -1
- 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} +34 -29
- 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 +14 -72
- 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 -89
- package/dist/lib/build.d.ts +0 -21
- package/dist/lib/build.js +0 -374
- 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 -209
- 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 -65
- package/dist/lib/embedder.js +0 -236
- package/dist/lib/embedder.js.map +0 -1
- package/dist/lib/facet-session.d.ts +0 -44
- package/dist/lib/facet-session.js +0 -125
- package/dist/lib/facet-session.js.map +0 -1
- package/dist/lib/native-tuning.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 -55
- package/dist/lib/search-tool.js +0 -319
- package/dist/lib/search-tool.js.map +0 -1
- package/dist/lib/serve.d.ts +0 -11
- package/dist/lib/serve.js +0 -144
- package/dist/lib/serve.js.map +0 -1
- package/dist/lib/store.d.ts +0 -252
- package/dist/lib/store.js +0 -1216
- package/dist/lib/store.js.map +0 -1
- package/dist/lib/types.d.ts +0 -194
- package/dist/lib/types.js +0 -13
- package/dist/lib/types.js.map +0 -1
- package/dist/lib/vocab.d.ts +0 -20
- package/dist/lib/vocab.js +0 -275
- package/dist/lib/vocab.js.map +0 -1
- /package/dist/{lib/native-tuning.d.ts → infrastructure/lancedb/NativeTuning.d.ts} +0 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { LmgrepFactory } from "../../application/LmgrepFactory.js";
|
|
2
|
+
import { HealthMonitor, } from "../../application/operations/HealthMonitor.js";
|
|
3
|
+
import { AiSdkChatModel } from "../../infrastructure/ai/AiSdkChatModel.js";
|
|
4
|
+
import { SilentLogger } from "../../infrastructure/fs/Loggers.js";
|
|
5
|
+
import { ProjectRegistry } from "../../infrastructure/fs/ProjectRegistry.js";
|
|
6
|
+
import { StateDirectory } from "../../infrastructure/fs/StateDirectory.js";
|
|
7
|
+
import { HitFormatter } from "./HitFormatter.js";
|
|
8
|
+
import { IndexWatchController } from "./IndexWatchController.js";
|
|
9
|
+
import { ToolDescriptions } from "./ToolDescriptions.js";
|
|
10
|
+
/**
|
|
11
|
+
* The tool surface shared by the MCP server and the Pi extension.
|
|
12
|
+
*
|
|
13
|
+
* It owns the health story: an agent must be told, in the tool description
|
|
14
|
+
* itself, when search cannot work and what to do instead — a tool that silently
|
|
15
|
+
* returns nothing teaches the agent to stop using it.
|
|
16
|
+
*/
|
|
17
|
+
export class LmgrepCore {
|
|
18
|
+
lmgrep;
|
|
19
|
+
health;
|
|
20
|
+
watching;
|
|
21
|
+
registry;
|
|
22
|
+
askAvailable;
|
|
23
|
+
constructor(lmgrep, health, watching, registry, askAvailable) {
|
|
24
|
+
this.lmgrep = lmgrep;
|
|
25
|
+
this.health = health;
|
|
26
|
+
this.watching = watching;
|
|
27
|
+
this.registry = registry;
|
|
28
|
+
this.askAvailable = askAvailable;
|
|
29
|
+
}
|
|
30
|
+
static async open(options) {
|
|
31
|
+
const lmgrep = await new LmgrepFactory().open({
|
|
32
|
+
cwd: options.cwd,
|
|
33
|
+
database: options.database,
|
|
34
|
+
// stdout is the MCP transport; a stray log line corrupts it, and
|
|
35
|
+
// that includes configuration warnings.
|
|
36
|
+
logger: new SilentLogger(),
|
|
37
|
+
onWarning: () => { },
|
|
38
|
+
});
|
|
39
|
+
const registry = new ProjectRegistry(new StateDirectory());
|
|
40
|
+
const isIndexed = () => lmgrep.isIndexed();
|
|
41
|
+
const watching = new IndexWatchController(lmgrep, isIndexed);
|
|
42
|
+
const health = new HealthMonitor({
|
|
43
|
+
isIndexed,
|
|
44
|
+
inspect: async () => {
|
|
45
|
+
const info = await lmgrep.status();
|
|
46
|
+
return {
|
|
47
|
+
fileCount: info.fileCount,
|
|
48
|
+
embeddingOk: info.embeddingOk,
|
|
49
|
+
searchOk: info.searchOk,
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
ensureWatching: () => watching.ensureStarted(),
|
|
53
|
+
}, lmgrep.config);
|
|
54
|
+
return new LmgrepCore(lmgrep, health, watching, registry,
|
|
55
|
+
// `ask` needs a chat model on top of the embedder; only expose the
|
|
56
|
+
// tool when one is configured, so agents never see a tool they
|
|
57
|
+
// cannot use.
|
|
58
|
+
new AiSdkChatModel(lmgrep.config).isConfigured);
|
|
59
|
+
}
|
|
60
|
+
get cwd() {
|
|
61
|
+
return this.lmgrep.cwd;
|
|
62
|
+
}
|
|
63
|
+
get searchParams() {
|
|
64
|
+
return ToolDescriptions.SEARCH_PARAMS;
|
|
65
|
+
}
|
|
66
|
+
get listProjectsDescription() {
|
|
67
|
+
return ToolDescriptions.LIST_PROJECTS;
|
|
68
|
+
}
|
|
69
|
+
get askParam() {
|
|
70
|
+
return ToolDescriptions.ASK_PARAM;
|
|
71
|
+
}
|
|
72
|
+
get askDescription() {
|
|
73
|
+
return ToolDescriptions.ASK;
|
|
74
|
+
}
|
|
75
|
+
currentHealth() {
|
|
76
|
+
return this.health.current;
|
|
77
|
+
}
|
|
78
|
+
onHealthChange(listener) {
|
|
79
|
+
return this.health.onChange(listener);
|
|
80
|
+
}
|
|
81
|
+
start() {
|
|
82
|
+
this.health.start();
|
|
83
|
+
}
|
|
84
|
+
buildSearchDescription() {
|
|
85
|
+
const state = this.health.current;
|
|
86
|
+
if (state.healthy)
|
|
87
|
+
return ToolDescriptions.SEARCH_HEALTHY;
|
|
88
|
+
return ToolDescriptions.unavailable(state.reason, this.otherProjects().length > 0);
|
|
89
|
+
}
|
|
90
|
+
async executeSearch(args) {
|
|
91
|
+
return this.guarded(async () => {
|
|
92
|
+
const hits = await this.lmgrep.search(args.query, {
|
|
93
|
+
limit: args.limit ?? ToolDescriptions.SEARCH_PARAMS.limit.default,
|
|
94
|
+
filePrefix: args.filePrefix,
|
|
95
|
+
type: args.type,
|
|
96
|
+
language: args.language,
|
|
97
|
+
project: args.project,
|
|
98
|
+
});
|
|
99
|
+
// A successful search proves the embedder is reachable and the index
|
|
100
|
+
// is queryable — no need to keep pinging and keep it awake.
|
|
101
|
+
this.health.markHealthy();
|
|
102
|
+
return hits.isEmpty
|
|
103
|
+
? { text: "No results found." }
|
|
104
|
+
: { text: HitFormatter.hits(hits.toArray()) };
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
async executeAsk(args) {
|
|
108
|
+
if (this.health.current.reason === "embedding_failed") {
|
|
109
|
+
return { text: ToolDescriptions.EMBEDDER_DOWN, isError: true };
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
const result = await this.lmgrep.ask(args.question);
|
|
113
|
+
// A completed run proves the embedder and index are both healthy.
|
|
114
|
+
this.health.markHealthy();
|
|
115
|
+
return { text: HitFormatter.answer(result) };
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
// research() degrades internally for provider and search errors; it
|
|
119
|
+
// only throws when no chat model is configured, which is worth
|
|
120
|
+
// surfacing verbatim.
|
|
121
|
+
return {
|
|
122
|
+
text: `Error: ${err instanceof Error ? err.message : String(err)}`,
|
|
123
|
+
isError: true,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
async executeListProjects() {
|
|
128
|
+
const others = this.otherProjects();
|
|
129
|
+
return others.length === 0
|
|
130
|
+
? { text: "No other indexed projects found." }
|
|
131
|
+
: { text: HitFormatter.projects(others) };
|
|
132
|
+
}
|
|
133
|
+
async dispose() {
|
|
134
|
+
this.health.dispose();
|
|
135
|
+
this.watching.release();
|
|
136
|
+
await this.lmgrep.close();
|
|
137
|
+
}
|
|
138
|
+
/** Shared failure handling: report, and arm recovery polling. */
|
|
139
|
+
async guarded(run) {
|
|
140
|
+
if (this.health.current.reason === "embedding_failed") {
|
|
141
|
+
return { text: ToolDescriptions.EMBEDDER_DOWN, isError: true };
|
|
142
|
+
}
|
|
143
|
+
try {
|
|
144
|
+
return await run();
|
|
145
|
+
}
|
|
146
|
+
catch (err) {
|
|
147
|
+
// The embedder may be down; poll so recovery updates the tool
|
|
148
|
+
// description without the user restarting anything.
|
|
149
|
+
this.health.markFailed();
|
|
150
|
+
return {
|
|
151
|
+
text: `Error: ${err instanceof Error ? err.message : String(err)}`,
|
|
152
|
+
isError: true,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Projects an agent can actually reach with the `project` parameter.
|
|
158
|
+
*
|
|
159
|
+
* Standalone indexes are excluded: they are addressed by name, and their
|
|
160
|
+
* recorded root is merely where they were built from, so offering one as a
|
|
161
|
+
* project path would resolve to a different database.
|
|
162
|
+
*/
|
|
163
|
+
otherProjects() {
|
|
164
|
+
const current = this.lmgrep.location.path;
|
|
165
|
+
const seen = new Set();
|
|
166
|
+
const out = [];
|
|
167
|
+
for (const entry of this.registry.list()) {
|
|
168
|
+
if (entry.name || entry.databasePath === current)
|
|
169
|
+
continue;
|
|
170
|
+
if (seen.has(entry.root))
|
|
171
|
+
continue;
|
|
172
|
+
seen.add(entry.root);
|
|
173
|
+
out.push({ root: entry.root, remote: entry.remote });
|
|
174
|
+
}
|
|
175
|
+
return out;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=LmgrepCore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LmgrepCore.js","sourceRoot":"","sources":["../../../src/presentation/mcp/LmgrepCore.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EACN,aAAa,GAEb,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAwBzD;;;;;;GAMG;AACH,MAAM,OAAO,UAAU;IAEJ;IACA;IACA;IACA;IACR;IALV,YACkB,MAAc,EACd,MAAqB,EACrB,QAA8B,EAC9B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,GAAG,GAAmB,EAAE,CAAC;QAC/B,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;YAC1C,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,YAAY,KAAK,OAAO;gBAAE,SAAS;YAC3D,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;gBAAE,SAAS;YACnC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACrB,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,GAAG,CAAC;IACZ,CAAC;CACD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { LmgrepCore } from "./LmgrepCore.js";
|
|
2
|
+
/**
|
|
3
|
+
* Exposes lmgrep over MCP.
|
|
4
|
+
*
|
|
5
|
+
* The search tool's description is re-published whenever health changes, so an
|
|
6
|
+
* agent's next turn sees an accurate account of whether search works — that
|
|
7
|
+
* live update is the reason this server holds a health monitor at all.
|
|
8
|
+
*/
|
|
9
|
+
export declare class LmgrepMcpServer {
|
|
10
|
+
private readonly core;
|
|
11
|
+
private readonly server;
|
|
12
|
+
constructor(core: LmgrepCore);
|
|
13
|
+
serve(): Promise<void>;
|
|
14
|
+
private registerSearch;
|
|
15
|
+
private registerListProjects;
|
|
16
|
+
private registerAsk;
|
|
17
|
+
private toContent;
|
|
18
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { McpServer as Server } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
/**
|
|
5
|
+
* Exposes lmgrep over MCP.
|
|
6
|
+
*
|
|
7
|
+
* The search tool's description is re-published whenever health changes, so an
|
|
8
|
+
* agent's next turn sees an accurate account of whether search works — that
|
|
9
|
+
* live update is the reason this server holds a health monitor at all.
|
|
10
|
+
*/
|
|
11
|
+
export class LmgrepMcpServer {
|
|
12
|
+
core;
|
|
13
|
+
server;
|
|
14
|
+
constructor(core) {
|
|
15
|
+
this.core = core;
|
|
16
|
+
this.server = new Server({ name: "lmgrep", version: "0.1.0" });
|
|
17
|
+
}
|
|
18
|
+
async serve() {
|
|
19
|
+
const search = this.registerSearch();
|
|
20
|
+
this.registerListProjects();
|
|
21
|
+
if (this.core.askAvailable)
|
|
22
|
+
this.registerAsk();
|
|
23
|
+
this.core.onHealthChange(() => {
|
|
24
|
+
search.update({ description: this.core.buildSearchDescription() });
|
|
25
|
+
});
|
|
26
|
+
this.core.start();
|
|
27
|
+
await this.server.connect(new StdioServerTransport());
|
|
28
|
+
}
|
|
29
|
+
registerSearch() {
|
|
30
|
+
const params = this.core.searchParams;
|
|
31
|
+
return this.server.tool("search", this.core.buildSearchDescription(), {
|
|
32
|
+
query: z.string().describe(params.query.description),
|
|
33
|
+
limit: z
|
|
34
|
+
.number()
|
|
35
|
+
.optional()
|
|
36
|
+
.default(params.limit.default)
|
|
37
|
+
.describe(params.limit.description),
|
|
38
|
+
filePrefix: z
|
|
39
|
+
.string()
|
|
40
|
+
.optional()
|
|
41
|
+
.describe(params.filePrefix.description),
|
|
42
|
+
type: z.array(z.string()).optional().describe(params.type.description),
|
|
43
|
+
language: z
|
|
44
|
+
.array(z.string())
|
|
45
|
+
.optional()
|
|
46
|
+
.describe(params.language.description),
|
|
47
|
+
project: z.string().optional().describe(params.project.description),
|
|
48
|
+
}, async (args) => this.toContent(await this.core.executeSearch(args)));
|
|
49
|
+
}
|
|
50
|
+
registerListProjects() {
|
|
51
|
+
return this.server.tool("list_other_indexed_projects", this.core.listProjectsDescription, {}, async () => this.toContent(await this.core.executeListProjects()));
|
|
52
|
+
}
|
|
53
|
+
registerAsk() {
|
|
54
|
+
return this.server.tool("ask", this.core.askDescription, { question: z.string().describe(this.core.askParam.description) }, async (args) => this.toContent(await this.core.executeAsk(args)));
|
|
55
|
+
}
|
|
56
|
+
toContent(result) {
|
|
57
|
+
return {
|
|
58
|
+
content: [{ type: "text", text: result.text }],
|
|
59
|
+
...(result.isError ? { isError: true } : {}),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=McpServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"McpServer.js","sourceRoot":"","sources":["../../../src/presentation/mcp/McpServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,MAAM,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;GAMG;AACH,MAAM,OAAO,eAAe;IAGE;IAFZ,MAAM,CAAS;IAEhC,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;QAC5C,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,KAAK;QACV,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QACrC,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC5B,IAAI,IAAI,CAAC,IAAI,CAAC,YAAY;YAAE,IAAI,CAAC,WAAW,EAAE,CAAC;QAE/C,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE;YAC7B,MAAM,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAElB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;QAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CACtB,6BAA6B,EAC7B,IAAI,CAAC,IAAI,CAAC,uBAAuB,EACjC,EAAE,EACF,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,CACjE,CAAC;IACH,CAAC;IAEO,WAAW;QAClB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CACtB,KAAK,EACL,IAAI,CAAC,IAAI,CAAC,cAAc,EACxB,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,EACjE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAChE,CAAC;IACH,CAAC;IAEO,SAAS,CAAC,MAA2C;QAC5D,OAAO;YACN,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;YACvD,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC5C,CAAC;IACH,CAAC;CACD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The text an MCP client sees for each tool.
|
|
3
|
+
*
|
|
4
|
+
* These are prompts, not documentation: they are what decides whether an agent
|
|
5
|
+
* reaches for lmgrep or falls back to grep, and they were tuned by watching
|
|
6
|
+
* agents choose. Treat edits here as behaviour changes.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ToolDescriptions {
|
|
9
|
+
static readonly SEARCH_PARAMS: {
|
|
10
|
+
query: {
|
|
11
|
+
description: string;
|
|
12
|
+
};
|
|
13
|
+
limit: {
|
|
14
|
+
description: string;
|
|
15
|
+
default: number;
|
|
16
|
+
};
|
|
17
|
+
filePrefix: {
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
type: {
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
language: {
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
project: {
|
|
27
|
+
description: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
static readonly LIST_PROJECTS: string;
|
|
31
|
+
static readonly ASK_PARAM: {
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
static readonly ASK: string;
|
|
35
|
+
/** Shown while search is working. */
|
|
36
|
+
static readonly SEARCH_HEALTHY: string;
|
|
37
|
+
/** Shown when search is unavailable, explaining why and what still works. */
|
|
38
|
+
static unavailable(reason: "not_indexed" | "embedding_failed" | "search_empty" | "ok", otherProjectsAvailable: boolean): string;
|
|
39
|
+
static readonly EMBEDDER_DOWN = "lmgrep is unavailable: the embedding provider is unreachable. Ask the user to check their lmgrep configuration (`lmgrep status`) before retrying.";
|
|
40
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The text an MCP client sees for each tool.
|
|
3
|
+
*
|
|
4
|
+
* These are prompts, not documentation: they are what decides whether an agent
|
|
5
|
+
* reaches for lmgrep or falls back to grep, and they were tuned by watching
|
|
6
|
+
* agents choose. Treat edits here as behaviour changes.
|
|
7
|
+
*/
|
|
8
|
+
export class ToolDescriptions {
|
|
9
|
+
static SEARCH_PARAMS = {
|
|
10
|
+
query: {
|
|
11
|
+
description: 'Natural-language description of what you\'re looking for — phrase it as a question or intent, not keywords. Good: "how are webhooks authenticated", "where is user deletion handled", "what happens when a record is created". Bad: "webhook auth", "deleteUser", "createRecord".',
|
|
12
|
+
},
|
|
13
|
+
limit: {
|
|
14
|
+
description: "Maximum number of results",
|
|
15
|
+
default: 5,
|
|
16
|
+
},
|
|
17
|
+
filePrefix: {
|
|
18
|
+
description: "Restrict to files under this path (e.g. 'src/lib')",
|
|
19
|
+
},
|
|
20
|
+
type: {
|
|
21
|
+
description: "AST node types to filter by (e.g. ['function_declaration', 'class_declaration'])",
|
|
22
|
+
},
|
|
23
|
+
language: {
|
|
24
|
+
description: "File extensions to filter by (e.g. ['.ts', '.py'])",
|
|
25
|
+
},
|
|
26
|
+
project: {
|
|
27
|
+
description: "Search a different indexed project by its root path instead of the current one",
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
static LIST_PROJECTS = "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
|
+
static ASK_PARAM = {
|
|
34
|
+
description: 'The question to answer, in natural language — phrase it as a real question about the code. Good: "how does the file watcher trigger reindexing", "where are webhooks authenticated and what token format", "what happens when a user is deleted".',
|
|
35
|
+
};
|
|
36
|
+
static ASK = [
|
|
37
|
+
"**Ask a question about this codebase and get back a synthesized, cited answer** — instead of raw search results you have to read yourself. A local model runs a short research loop (searches the index, reads the matching code, writes a grounded answer), so you spend one tool call and a paragraph instead of several searches and pages of chunks.",
|
|
38
|
+
"",
|
|
39
|
+
'**Use `ask` when you want a question *answered*:** "how does X work", "where is Y handled and what does it do", "what happens when Z", "how do these pieces fit together". The retrieval loop runs on a local model — cheap on your context.',
|
|
40
|
+
"",
|
|
41
|
+
"**Use `search` instead when you want the raw code** to read yourself (exact snippets, or to browse many hits). `ask` complements `search`; it does not replace it.",
|
|
42
|
+
"",
|
|
43
|
+
"**Every claim is cited** as `[n]` → `file:line`, listed under the answer, so you can verify or open the sources. If an answer looks off or thin, fall back to `search` for the raw chunks.",
|
|
44
|
+
"",
|
|
45
|
+
"**Tradeoff:** `ask` runs a local model, so it's slower than `search` — roughly ~10s to a couple of minutes depending on the question and hardware — but it does the searching and reading for you.",
|
|
46
|
+
].join("\n");
|
|
47
|
+
/** Shown while search is working. */
|
|
48
|
+
static SEARCH_HEALTHY = [
|
|
49
|
+
"**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.",
|
|
50
|
+
"",
|
|
51
|
+
'**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.',
|
|
52
|
+
"",
|
|
53
|
+
"**Query lmgrep as natural questions or intent descriptions**, not keyword dumps:",
|
|
54
|
+
'- "how are webhooks authenticated" → finds middleware, token validation, auth checks',
|
|
55
|
+
'- "where is user deletion handled" → finds the handler and related cleanup logic',
|
|
56
|
+
'- "what happens when a record is created" → finds controllers, event emitters, side effects',
|
|
57
|
+
'- "config loading and validation"',
|
|
58
|
+
'- "how to run the playwright tests" → finds config, scripts, prerequisites',
|
|
59
|
+
"",
|
|
60
|
+
"**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.",
|
|
61
|
+
"",
|
|
62
|
+
"**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.",
|
|
63
|
+
].join("\n");
|
|
64
|
+
/** Shown when search is unavailable, explaining why and what still works. */
|
|
65
|
+
static unavailable(reason, otherProjectsAvailable) {
|
|
66
|
+
const suffix = otherProjectsAvailable
|
|
67
|
+
? " You can still search other indexed projects via the `project` parameter — call `list_other_indexed_projects` to see what's available."
|
|
68
|
+
: "";
|
|
69
|
+
switch (reason) {
|
|
70
|
+
case "not_indexed":
|
|
71
|
+
return ("This project is not indexed. Semantic search is not available for the current directory." +
|
|
72
|
+
suffix);
|
|
73
|
+
case "embedding_failed":
|
|
74
|
+
return ("The embedding provider is unreachable. Semantic search is temporarily unavailable for the current directory." +
|
|
75
|
+
suffix);
|
|
76
|
+
case "search_empty":
|
|
77
|
+
return ("The index for the current branch appears empty or stale — a smoke query returned no results. Re-run `lmgrep index` to rebuild." +
|
|
78
|
+
suffix);
|
|
79
|
+
default:
|
|
80
|
+
return `Semantic search is unavailable.${suffix}`;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
static EMBEDDER_DOWN = "lmgrep is unavailable: the embedding provider is unreachable. Ask the user to check their lmgrep configuration (`lmgrep status`) before retrying.";
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=ToolDescriptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolDescriptions.js","sourceRoot":"","sources":["../../../src/presentation/mcp/ToolDescriptions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IAC5B,MAAM,CAAU,aAAa,GAAG;QAC/B,KAAK,EAAE;YACN,WAAW,EACV,mRAAmR;SACpR;QACD,KAAK,EAAE;YACN,WAAW,EAAE,2BAA2B;YACxC,OAAO,EAAE,CAAC;SACV;QACD,UAAU,EAAE;YACX,WAAW,EAAE,oDAAoD;SACjE;QACD,IAAI,EAAE;YACL,WAAW,EACV,kFAAkF;SACnF;QACD,QAAQ,EAAE;YACT,WAAW,EAAE,oDAAoD;SACjE;QACD,OAAO,EAAE;YACR,WAAW,EACV,gFAAgF;SACjF;KACD,CAAC;IAEF,MAAM,CAAU,aAAa,GAC5B,wDAAwD;QACxD,4EAA4E;QAC5E,iDAAiD,CAAC;IAEnD,MAAM,CAAU,SAAS,GAAG;QAC3B,WAAW,EACV,mPAAmP;KACpP,CAAC;IAEF,MAAM,CAAU,GAAG,GAAG;QACrB,0VAA0V;QAC1V,EAAE;QACF,8OAA8O;QAC9O,EAAE;QACF,oKAAoK;QACpK,EAAE;QACF,4LAA4L;QAC5L,EAAE;QACF,oMAAoM;KACpM,CAAC,IAAI,C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|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
"typescript": "^6.0.2"
|
|
87
|
-
},
|
|
88
|
-
"optionalDependencies": {
|
|
89
|
-
"hyperswarm": "^4.17.0"
|
|
90
|
-
}
|
|
2
|
+
"name": "lmgrep",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Semantic code search with any AI embedding provider",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"lmgrep": "./dist/cli.js",
|
|
8
|
+
"lmgrep-mcp": "./dist/mcp.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"dev": "tsc --watch",
|
|
13
|
+
"start": "node dist/cli.js",
|
|
14
|
+
"check": "biome check --write .",
|
|
15
|
+
"lint": "biome lint ."
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"semantic-search",
|
|
19
|
+
"code-search",
|
|
20
|
+
"embeddings",
|
|
21
|
+
"tree-sitter",
|
|
22
|
+
"ai"
|
|
23
|
+
],
|
|
24
|
+
"author": "",
|
|
25
|
+
"license": "GPL-3.0-only",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/Aetherall/lmgrep.git"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"completions",
|
|
33
|
+
"README.md"
|
|
34
|
+
],
|
|
35
|
+
"packageManager": "pnpm@10.28.0",
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@lancedb/lancedb": "^0.27.2",
|
|
38
|
+
"@lumis-sh/wasm-bash": "^0.26.1",
|
|
39
|
+
"@lumis-sh/wasm-c": "^0.26.1",
|
|
40
|
+
"@lumis-sh/wasm-cpp": "^0.26.0",
|
|
41
|
+
"@lumis-sh/wasm-csharp": "^0.26.1",
|
|
42
|
+
"@lumis-sh/wasm-css": "^0.26.2",
|
|
43
|
+
"@lumis-sh/wasm-go": "^0.26.1",
|
|
44
|
+
"@lumis-sh/wasm-html": "^0.26.1",
|
|
45
|
+
"@lumis-sh/wasm-java": "^0.26.1",
|
|
46
|
+
"@lumis-sh/wasm-javascript": "^0.26.2",
|
|
47
|
+
"@lumis-sh/wasm-json": "^0.26.2",
|
|
48
|
+
"@lumis-sh/wasm-kotlin": "^0.26.3",
|
|
49
|
+
"@lumis-sh/wasm-lua": "^0.26.1",
|
|
50
|
+
"@lumis-sh/wasm-markdown": "^0.26.1",
|
|
51
|
+
"@lumis-sh/wasm-nix": "^0.26.0",
|
|
52
|
+
"@lumis-sh/wasm-php": "^0.26.2",
|
|
53
|
+
"@lumis-sh/wasm-python": "^0.26.1",
|
|
54
|
+
"@lumis-sh/wasm-ruby": "^0.26.1",
|
|
55
|
+
"@lumis-sh/wasm-rust": "^0.26.3",
|
|
56
|
+
"@lumis-sh/wasm-scala": "^0.26.1",
|
|
57
|
+
"@lumis-sh/wasm-swift": "^0.26.1",
|
|
58
|
+
"@lumis-sh/wasm-toml": "^0.26.0",
|
|
59
|
+
"@lumis-sh/wasm-tsx": "^0.26.1",
|
|
60
|
+
"@lumis-sh/wasm-typescript": "^0.26.1",
|
|
61
|
+
"@lumis-sh/wasm-vue": "^0.26.0",
|
|
62
|
+
"@lumis-sh/wasm-yaml": "^0.26.0",
|
|
63
|
+
"@lumis-sh/wasm-zig": "^0.26.0",
|
|
64
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
65
|
+
"ai": "^6.0.149",
|
|
66
|
+
"apache-arrow": "^21.1.0",
|
|
67
|
+
"cli-progress": "^3.12.0",
|
|
68
|
+
"commander": "^14.0.3",
|
|
69
|
+
"glob": "^13.0.6",
|
|
70
|
+
"ignore": "^7.0.5",
|
|
71
|
+
"stemmer": "^2.0.1",
|
|
72
|
+
"web-tree-sitter": "^0.26.9",
|
|
73
|
+
"yaml": "^2.8.3",
|
|
74
|
+
"zod": "^4.3.6"
|
|
75
|
+
},
|
|
76
|
+
"devDependencies": {
|
|
77
|
+
"@ai-sdk/openai": "^3.0.51",
|
|
78
|
+
"@biomejs/biome": "^2.4.10",
|
|
79
|
+
"@types/cli-progress": "^3.11.6",
|
|
80
|
+
"@types/node": "^25.5.2",
|
|
81
|
+
"typescript": "^6.0.2"
|
|
82
|
+
},
|
|
83
|
+
"optionalDependencies": {
|
|
84
|
+
"hyperswarm": "^4.17.0"
|
|
85
|
+
}
|
|
91
86
|
}
|
package/dist/lib/build.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type Embedder } from "./embedder.js";
|
|
2
|
-
import { type Store } from "./store.js";
|
|
3
|
-
import type { Chunker, Logger, LmgrepConfig, BuildOptions } from "./types.js";
|
|
4
|
-
export declare function build(cwd: string, store: Store, config: LmgrepConfig, embedder: Embedder, chunker: Chunker, opts?: BuildOptions, logger?: Logger): Promise<{
|
|
5
|
-
succeeded: number;
|
|
6
|
-
failed: number;
|
|
7
|
-
}>;
|
|
8
|
-
/**
|
|
9
|
-
* Extract vocab terms from newly indexed chunks, embed those not already
|
|
10
|
-
* present in the vocab table, and append the new entries. Keeps the vocab
|
|
11
|
-
* table in sync with the chunk content incrementally.
|
|
12
|
-
*/
|
|
13
|
-
export declare function buildVocab(store: Store, chunks: Iterable<{
|
|
14
|
-
name: string;
|
|
15
|
-
content: string;
|
|
16
|
-
}>, embedder: Embedder, log: (msg: string) => void, opts?: {
|
|
17
|
-
minDf?: number;
|
|
18
|
-
embedBatch?: number;
|
|
19
|
-
}): Promise<{
|
|
20
|
-
added: number;
|
|
21
|
-
}>;
|