codesearch-mcp 0.2.3-alpha → 0.4.0-alpha
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/CHANGELOG.md +88 -5
- package/LICENSE +661 -21
- package/README.md +76 -40
- package/dist/app.js +17 -38
- package/dist/src/ast/CallExtractor.d.ts +8 -0
- package/dist/src/ast/CallExtractor.js +68 -0
- package/dist/src/ast/GraphqlNameExtractor.d.ts +22 -0
- package/dist/src/ast/GraphqlNameExtractor.js +240 -0
- package/dist/src/ast/ImportEdgeExtractor.d.ts +11 -0
- package/dist/src/ast/ImportEdgeExtractor.js +129 -0
- package/dist/src/ast/IndexedNodeResolver.d.ts +14 -0
- package/dist/src/ast/IndexedNodeResolver.js +217 -0
- package/dist/src/ast/MemberExtractor.d.ts +8 -0
- package/dist/src/ast/MemberExtractor.js +129 -0
- package/dist/src/ast/TopLevelSymbolExtractor.d.ts +5 -0
- package/dist/src/ast/TopLevelSymbolExtractor.js +86 -0
- package/dist/src/ast/graphql-grammar.d.ts +24 -0
- package/dist/src/ast/graphql-grammar.js +93 -0
- package/dist/src/ast/node-helpers.d.ts +11 -0
- package/dist/src/ast/node-helpers.js +55 -0
- package/dist/src/chunking/AstChunker.d.ts +12 -0
- package/dist/src/chunking/AstChunker.js +30 -0
- package/dist/src/chunking/CharacterChunkStrategy.d.ts +8 -0
- package/dist/src/chunking/CharacterChunkStrategy.js +15 -0
- package/dist/src/chunking/DeclarationChunkStrategy.d.ts +15 -0
- package/dist/src/chunking/DeclarationChunkStrategy.js +87 -0
- package/dist/src/chunking/FragmentMerger.d.ts +11 -0
- package/dist/src/chunking/FragmentMerger.js +61 -0
- package/dist/src/chunking/ImportOnlyFilter.d.ts +5 -0
- package/dist/src/chunking/ImportOnlyFilter.js +14 -0
- package/dist/src/chunking/LangchainTextSplitter.d.ts +21 -0
- package/dist/src/chunking/LangchainTextSplitter.js +133 -0
- package/dist/src/chunking/MinSizeSplitPolicy.d.ts +9 -0
- package/dist/src/chunking/MinSizeSplitPolicy.js +18 -0
- package/dist/src/chunking/RunPacker.d.ts +12 -0
- package/dist/src/chunking/RunPacker.js +84 -0
- package/dist/src/chunking/create-chunker.d.ts +3 -0
- package/dist/src/chunking/create-chunker.js +15 -0
- package/dist/src/chunking/interfaces.d.ts +27 -0
- package/dist/src/commands/ConfigCommand.js +1 -9
- package/dist/src/commands/EvalCommand.d.ts +10 -5
- package/dist/src/commands/EvalCommand.js +60 -149
- package/dist/src/commands/IndexCommand.d.ts +10 -4
- package/dist/src/commands/IndexCommand.js +52 -146
- package/dist/src/commands/McpCommand.d.ts +6 -3
- package/dist/src/commands/McpCommand.js +19 -20
- package/dist/src/commands/WebCommand.d.ts +9 -3
- package/dist/src/commands/WebCommand.js +17 -11
- package/dist/src/commands/eval/baseline-comparison.d.ts +6 -0
- package/dist/src/commands/eval/baseline-comparison.js +54 -0
- package/dist/src/commands/eval/eval-args.d.ts +6 -0
- package/dist/src/commands/eval/eval-args.js +71 -0
- package/dist/src/commands/eval/eval-corpora.d.ts +6 -0
- package/dist/src/commands/eval/eval-corpora.js +76 -0
- package/dist/src/commands/eval/eval-metadata.d.ts +17 -0
- package/dist/src/commands/eval/eval-metadata.js +75 -0
- package/dist/src/commands/eval/index-inspector.d.ts +3 -0
- package/dist/src/commands/eval/index-inspector.js +21 -0
- package/dist/src/commands/eval/staged-search.d.ts +3 -0
- package/dist/src/commands/eval/staged-search.js +20 -0
- package/dist/src/commands/eval/suite-loader.d.ts +8 -0
- package/dist/src/commands/eval/suite-loader.js +52 -0
- package/dist/src/commands/index/backend-probe.d.ts +2 -0
- package/dist/src/commands/index/backend-probe.js +15 -0
- package/dist/src/commands/index/embedding-setup.d.ts +3 -0
- package/dist/src/commands/index/embedding-setup.js +16 -0
- package/dist/src/commands/index/index-summary.d.ts +2 -0
- package/dist/src/commands/index/index-summary.js +22 -0
- package/dist/src/commands/index/legacy-ollama-guard.d.ts +3 -0
- package/dist/src/commands/index/legacy-ollama-guard.js +23 -0
- package/dist/src/commands/index/prune-step.d.ts +3 -0
- package/dist/src/commands/index/prune-step.js +22 -0
- package/dist/src/commands/index/scan-targets.d.ts +8 -0
- package/dist/src/commands/index/scan-targets.js +107 -0
- package/dist/src/config-error.d.ts +0 -4
- package/dist/src/config-error.js +0 -4
- package/dist/src/config-store.d.ts +1 -55
- package/dist/src/config-store.js +11 -73
- package/dist/src/config.d.ts +9 -18
- package/dist/src/config.js +36 -35
- package/dist/src/constants.d.ts +17 -28
- package/dist/src/constants.js +35 -29
- package/dist/src/container.d.ts +10 -2
- package/dist/src/container.js +19 -8
- package/dist/src/db/drizzle-types.d.ts +7 -0
- package/dist/src/db/drizzle-types.js +2 -0
- package/dist/src/db/index.d.ts +1 -0
- package/dist/src/db/schema-steps.d.ts +8 -0
- package/dist/src/db/schema-steps.js +105 -0
- package/dist/src/db/schema.d.ts +17 -0
- package/dist/src/db/schema.js +1 -6
- package/dist/src/declarations/DeclarationTree.d.ts +19 -0
- package/dist/src/declarations/DeclarationTree.js +66 -0
- package/dist/src/declarations/DeclarationTreeBuilder.d.ts +22 -0
- package/dist/src/declarations/DeclarationTreeBuilder.js +179 -0
- package/dist/src/declarations/SourceLines.d.ts +37 -0
- package/dist/src/declarations/SourceLines.js +415 -0
- package/dist/src/dependency-traversal.d.ts +0 -6
- package/dist/src/dependency-traversal.js +0 -6
- package/dist/src/enriched-prompt.d.ts +0 -6
- package/dist/src/enriched-prompt.js +0 -6
- package/dist/src/error-record.d.ts +12 -0
- package/dist/src/error-record.js +248 -0
- package/dist/src/eval-corpus.d.ts +16 -0
- package/dist/src/eval-corpus.js +169 -0
- package/dist/src/eval-results.d.ts +6 -3
- package/dist/src/eval-results.js +323 -26
- package/dist/src/eval-vector-index.d.ts +5 -0
- package/dist/src/eval-vector-index.js +60 -0
- package/dist/src/file-utils.d.ts +0 -5
- package/dist/src/file-utils.js +0 -5
- package/dist/src/graph.d.ts +0 -25
- package/dist/src/graph.js +0 -28
- package/dist/src/help.js +9 -1
- package/dist/src/hnsw-settings.d.ts +3 -0
- package/dist/src/hnsw-settings.js +24 -0
- package/dist/src/index-args.d.ts +13 -0
- package/dist/src/index-args.js +48 -0
- package/dist/src/indexing/AnalysisBatcher.d.ts +12 -0
- package/dist/src/indexing/AnalysisBatcher.js +28 -0
- package/dist/src/indexing/ChunkEmbedder.d.ts +24 -0
- package/dist/src/indexing/ChunkEmbedder.js +37 -0
- package/dist/src/indexing/ConsoleScanReporter.d.ts +10 -0
- package/dist/src/indexing/ConsoleScanReporter.js +73 -0
- package/dist/src/indexing/EmbeddingSchemaPreparer.d.ts +14 -0
- package/dist/src/indexing/EmbeddingSchemaPreparer.js +66 -0
- package/dist/src/indexing/FileIngestor.d.ts +22 -0
- package/dist/src/indexing/FileIngestor.js +116 -0
- package/dist/src/indexing/IndexStore.d.ts +24 -0
- package/dist/src/indexing/IndexStore.js +69 -0
- package/dist/src/indexing/StaleFilePruner.d.ts +8 -0
- package/dist/src/indexing/StaleFilePruner.js +55 -0
- package/dist/src/indexing/analysis-rows.d.ts +4 -0
- package/dist/src/indexing/analysis-rows.js +65 -0
- package/dist/src/indexing/project-notices.d.ts +2 -0
- package/dist/src/indexing/project-notices.js +63 -0
- package/dist/src/interfaces/IAstParser.d.ts +4 -40
- package/dist/src/interfaces/ICallGraph.d.ts +28 -0
- package/dist/src/interfaces/ICallGraph.js +2 -0
- package/dist/src/interfaces/IChunkSearch.d.ts +42 -0
- package/dist/src/interfaces/IChunkSearch.js +2 -0
- package/dist/src/interfaces/IChunker.d.ts +3 -12
- package/dist/src/interfaces/ICorpusInspector.d.ts +7 -0
- package/dist/src/interfaces/ICorpusInspector.js +2 -0
- package/dist/src/interfaces/IDatabase.d.ts +8 -24
- package/dist/src/interfaces/IDependencyGraph.d.ts +24 -0
- package/dist/src/interfaces/IDependencyGraph.js +2 -0
- package/dist/src/interfaces/IEmbedder.d.ts +0 -9
- package/dist/src/interfaces/IIndexIdentityGuard.d.ts +3 -0
- package/dist/src/interfaces/IIndexIdentityGuard.js +2 -0
- package/dist/src/interfaces/IIndexedNodeResolver.d.ts +10 -0
- package/dist/src/interfaces/IIndexedNodeResolver.js +2 -0
- package/dist/src/interfaces/ILogger.d.ts +1 -11
- package/dist/src/interfaces/IMcpReadiness.d.ts +12 -0
- package/dist/src/interfaces/IMcpReadiness.js +2 -0
- package/dist/src/interfaces/IMcpToolHandler.d.ts +0 -5
- package/dist/src/interfaces/IMonorepoResolver.d.ts +0 -22
- package/dist/src/interfaces/IProjectCatalog.d.ts +13 -0
- package/dist/src/interfaces/IProjectCatalog.js +2 -0
- package/dist/src/interfaces/IProjectDiscovery.d.ts +0 -17
- package/dist/src/interfaces/IProjectRoots.d.ts +3 -0
- package/dist/src/interfaces/IProjectRoots.js +2 -0
- package/dist/src/interfaces/IRetrievalEvaluator.d.ts +153 -12
- package/dist/src/interfaces/IScanReporter.d.ts +13 -0
- package/dist/src/interfaces/IScanReporter.js +2 -0
- package/dist/src/interfaces/ISymbolLookup.d.ts +49 -0
- package/dist/src/interfaces/ISymbolLookup.js +2 -0
- package/dist/src/interfaces/IToolPaths.d.ts +62 -0
- package/dist/src/interfaces/IToolPaths.js +2 -0
- package/dist/src/interfaces/IWorkspaceFiles.d.ts +28 -0
- package/dist/src/interfaces/IWorkspaceFiles.js +2 -0
- package/dist/src/interfaces/SymbolKind.d.ts +1 -0
- package/dist/src/interfaces/SymbolKind.js +2 -0
- package/dist/src/interfaces/index.d.ts +12 -1
- package/dist/src/interrupt.js +0 -2
- package/dist/src/owner-path.d.ts +9 -10
- package/dist/src/owner-path.js +11 -23
- package/dist/src/project-scope.d.ts +1 -12
- package/dist/src/project-scope.js +5 -12
- package/dist/src/project-selector.d.ts +0 -5
- package/dist/src/project-selector.js +0 -11
- package/dist/src/retrieval-eval.d.ts +15 -6
- package/dist/src/retrieval-eval.js +388 -59
- package/dist/src/search/CallGraph.d.ts +9 -0
- package/dist/src/search/CallGraph.js +84 -0
- package/dist/src/search/ChunkSearch.d.ts +23 -0
- package/dist/src/search/ChunkSearch.js +115 -0
- package/dist/src/search/DependencyGraph.d.ts +19 -0
- package/dist/src/search/DependencyGraph.js +180 -0
- package/dist/src/search/IndexIdentityGuard.d.ts +11 -0
- package/dist/src/search/IndexIdentityGuard.js +37 -0
- package/dist/src/search/ProjectCatalog.d.ts +11 -0
- package/dist/src/search/ProjectCatalog.js +38 -0
- package/dist/src/search/SymbolLookup.d.ts +24 -0
- package/dist/src/search/SymbolLookup.js +97 -0
- package/dist/src/search/chunks/CandidateFetcher.d.ts +19 -0
- package/dist/src/search/chunks/CandidateFetcher.js +40 -0
- package/dist/src/search/chunks/IterativeScanGate.d.ts +10 -0
- package/dist/src/search/chunks/IterativeScanGate.js +42 -0
- package/dist/src/search/chunks/RerankStage.d.ts +15 -0
- package/dist/src/search/chunks/RerankStage.js +42 -0
- package/dist/src/search/chunks/search-metrics.d.ts +18 -0
- package/dist/src/search/chunks/search-metrics.js +32 -0
- package/dist/src/search/chunks/search-plan.d.ts +18 -0
- package/dist/src/search/chunks/search-plan.js +19 -0
- package/dist/src/search/create-search-services.d.ts +26 -0
- package/dist/src/search/create-search-services.js +29 -0
- package/dist/src/search/index-paths.d.ts +1 -0
- package/dist/src/search/index-paths.js +5 -0
- package/dist/src/search/result-shaping.d.ts +4 -0
- package/dist/src/search/result-shaping.js +19 -0
- package/dist/src/search/symbol-sql.d.ts +13 -0
- package/dist/src/search/symbol-sql.js +66 -0
- package/dist/src/search/symbols/SymbolGrepFallback.d.ts +19 -0
- package/dist/src/search/symbols/SymbolGrepFallback.js +106 -0
- package/dist/src/search/symbols/SymbolIndexQuery.d.ts +14 -0
- package/dist/src/search/symbols/SymbolIndexQuery.js +52 -0
- package/dist/src/search/symbols/SymbolTextSearch.d.ts +13 -0
- package/dist/src/search/symbols/SymbolTextSearch.js +84 -0
- package/dist/src/search/symbols/TargetColumnGate.d.ts +7 -0
- package/dist/src/search/symbols/TargetColumnGate.js +23 -0
- package/dist/src/search/symbols/find-symbol-constants.d.ts +4 -0
- package/dist/src/search/symbols/find-symbol-constants.js +8 -0
- package/dist/src/search/symbols/grep-args.d.ts +3 -0
- package/dist/src/search/symbols/grep-args.js +7 -0
- package/dist/src/search/symbols/grep-patterns.d.ts +4 -0
- package/dist/src/search/symbols/grep-patterns.js +60 -0
- package/dist/src/services/AstParserService.d.ts +10 -106
- package/dist/src/services/AstParserService.js +37 -1068
- package/dist/src/services/DatabaseService.d.ts +10 -17
- package/dist/src/services/DatabaseService.js +71 -115
- package/dist/src/services/EmbedderFactory.d.ts +0 -4
- package/dist/src/services/EmbedderFactory.js +0 -5
- package/dist/src/services/IndexerService.d.ts +7 -26
- package/dist/src/services/IndexerService.js +38 -286
- package/dist/src/services/InfinityEmbedder.d.ts +0 -21
- package/dist/src/services/InfinityEmbedder.js +0 -15
- package/dist/src/services/LoggerService.d.ts +7 -5
- package/dist/src/services/LoggerService.js +37 -41
- package/dist/src/services/McpReadiness.d.ts +18 -0
- package/dist/src/services/McpReadiness.js +73 -0
- package/dist/src/services/McpServer.d.ts +50 -19
- package/dist/src/services/McpServer.js +132 -62
- package/dist/src/services/MonorepoAwareDiscoveryService.d.ts +1 -45
- package/dist/src/services/MonorepoAwareDiscoveryService.js +1 -51
- package/dist/src/services/NxMonorepoResolver.d.ts +0 -29
- package/dist/src/services/NxMonorepoResolver.js +5 -56
- package/dist/src/services/OpenAICompatibleEmbedder.d.ts +0 -6
- package/dist/src/services/OpenAICompatibleEmbedder.js +0 -14
- package/dist/src/services/ProjectDiscoveryService.d.ts +0 -4
- package/dist/src/services/ProjectDiscoveryService.js +0 -4
- package/dist/src/services/VoyageEmbedder.d.ts +0 -6
- package/dist/src/services/VoyageEmbedder.js +0 -6
- package/dist/src/services/WebServerService.d.ts +5 -56
- package/dist/src/services/WebServerService.js +25 -63
- package/dist/src/services/http-retry.d.ts +0 -7
- package/dist/src/services/http-retry.js +1 -10
- package/dist/src/services/infinity-provisioning.d.ts +0 -74
- package/dist/src/services/infinity-provisioning.js +5 -88
- package/dist/src/services/legacy-ollama-index.d.ts +0 -16
- package/dist/src/services/legacy-ollama-index.js +0 -23
- package/dist/src/services/reranker.d.ts +0 -9
- package/dist/src/services/reranker.js +46 -12
- package/dist/src/setup.d.ts +24 -24
- package/dist/src/setup.js +205 -103
- package/dist/src/symbol-name.d.ts +1 -12
- package/dist/src/symbol-name.js +16 -25
- package/dist/src/symbol-rows.d.ts +0 -14
- package/dist/src/symbol-rows.js +0 -14
- package/dist/src/tool-call-log.d.ts +2 -0
- package/dist/src/tool-call-log.js +24 -0
- package/dist/src/tools/FindSymbolTool.d.ts +17 -7
- package/dist/src/tools/FindSymbolTool.js +54 -35
- package/dist/src/tools/GetCallersTool.d.ts +16 -8
- package/dist/src/tools/GetCallersTool.js +65 -35
- package/dist/src/tools/GetDependenciesTool.d.ts +16 -8
- package/dist/src/tools/GetDependenciesTool.js +36 -29
- package/dist/src/tools/GetDependentsTool.d.ts +20 -8
- package/dist/src/tools/GetDependentsTool.js +48 -34
- package/dist/src/tools/ListFilesTool.d.ts +16 -8
- package/dist/src/tools/ListFilesTool.js +20 -26
- package/dist/src/tools/ListProjectsTool.d.ts +11 -7
- package/dist/src/tools/ListProjectsTool.js +13 -11
- package/dist/src/tools/McpTool.d.ts +17 -0
- package/dist/src/tools/McpTool.js +28 -0
- package/dist/src/tools/ReadFileRangeTool.d.ts +16 -8
- package/dist/src/tools/ReadFileRangeTool.js +23 -25
- package/dist/src/tools/ReadFileTool.d.ts +15 -8
- package/dist/src/tools/ReadFileTool.js +19 -24
- package/dist/src/tools/SearchCodebaseTool.d.ts +22 -10
- package/dist/src/tools/SearchCodebaseTool.js +71 -50
- package/dist/src/tools/format-helpers.d.ts +9 -9
- package/dist/src/tools/format-helpers.js +146 -28
- package/dist/src/tools/tool-args.d.ts +38 -0
- package/dist/src/tools/tool-args.js +95 -0
- package/dist/src/web/dashboard.d.ts +0 -8
- package/dist/src/web/dashboard.js +7 -10
- package/dist/src/workspace/GrepRunner.d.ts +15 -0
- package/dist/src/workspace/GrepRunner.js +104 -0
- package/dist/src/workspace/ProjectRoots.d.ts +22 -0
- package/dist/src/workspace/ProjectRoots.js +102 -0
- package/dist/src/workspace/ToolPaths.d.ts +31 -0
- package/dist/src/workspace/ToolPaths.js +312 -0
- package/dist/src/workspace/WorkspaceFiles.d.ts +19 -0
- package/dist/src/workspace/WorkspaceFiles.js +285 -0
- package/dist/src/workspace/fs-access.d.ts +9 -0
- package/dist/src/workspace/fs-access.js +47 -0
- package/dist/src/workspace/path-helpers.d.ts +3 -0
- package/dist/src/workspace/path-helpers.js +43 -0
- package/package.json +5 -4
- package/dist/src/interfaces/ISearcher.d.ts +0 -35
- package/dist/src/services/AstChunker.d.ts +0 -42
- package/dist/src/services/AstChunker.js +0 -158
- package/dist/src/services/SearcherService.d.ts +0 -342
- package/dist/src/services/SearcherService.js +0 -1199
- package/docs/web-dashboard.md +0 -206
- /package/dist/src/{interfaces/ISearcher.js → chunking/interfaces.js} +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.workspaceEdges = workspaceEdges;
|
|
37
|
+
exports.workspaceCalls = workspaceCalls;
|
|
38
|
+
exports.toPromptEdges = toPromptEdges;
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
function workspaceEdges(rawEdges, workspaceRoot) {
|
|
41
|
+
return rawEdges
|
|
42
|
+
.filter(e => e.toFile.startsWith(workspaceRoot))
|
|
43
|
+
.map(e => ({
|
|
44
|
+
...e,
|
|
45
|
+
fromFile: path.relative(workspaceRoot, e.fromFile),
|
|
46
|
+
toFile: path.relative(workspaceRoot, e.toFile),
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
function workspaceCalls(rawCalls, serviceName, relFilePath, workspaceRoot) {
|
|
50
|
+
return rawCalls
|
|
51
|
+
.filter(c => c.calleeFile.startsWith(workspaceRoot))
|
|
52
|
+
.map(c => ({
|
|
53
|
+
project: serviceName,
|
|
54
|
+
fromFile: relFilePath,
|
|
55
|
+
fromSymbol: c.fromSymbol,
|
|
56
|
+
calleeName: c.calleeName,
|
|
57
|
+
calleeFile: path.relative(workspaceRoot, c.calleeFile),
|
|
58
|
+
calleeSymbol: c.calleeSymbol,
|
|
59
|
+
line: c.line,
|
|
60
|
+
col: c.col,
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
function toPromptEdges(edges) {
|
|
64
|
+
return edges.filter(e => e.depType !== 'import-side-effect');
|
|
65
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.collectProjectNotices = collectProjectNotices;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const file_utils_1 = require("../file-utils");
|
|
40
|
+
function collectProjectNotices(dir, fileCount, batchSize) {
|
|
41
|
+
const notices = [];
|
|
42
|
+
const meta = (0, file_utils_1.readRagMeta)(dir);
|
|
43
|
+
if (meta === 'invalid') {
|
|
44
|
+
const msg = `.ragmeta.json found but invalid JSON`;
|
|
45
|
+
notices.push({ mark: '⚠', message: msg, warning: true });
|
|
46
|
+
}
|
|
47
|
+
else if (meta !== 'missing') {
|
|
48
|
+
const parts = [meta.description, meta.stack && `[${meta.stack}]`].filter(Boolean).join(' ');
|
|
49
|
+
notices.push({ mark: '✓', message: `.ragmeta.json: ${parts || '(no fields)'}`, warning: false });
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
const msg = `No .ragmeta.json — add {"description":"...","stack":"...","notes":"..."} so list_projects can describe this project`;
|
|
53
|
+
notices.push({ mark: '⚠', message: msg, warning: true });
|
|
54
|
+
}
|
|
55
|
+
if (!fs.existsSync(path.join(dir, '.ragignore'))) {
|
|
56
|
+
const msg = `No .ragignore — create one to exclude generated/codegen files (e.g. src/gql/graphql.ts, **/__snapshots__/**)`;
|
|
57
|
+
notices.push({ mark: '⚠', message: msg, warning: true });
|
|
58
|
+
}
|
|
59
|
+
if (fileCount > batchSize) {
|
|
60
|
+
notices.push({ mark: '⚠', message: `Large project (${fileCount} files) — AST analysis uses batches of ${batchSize}; cross-batch dependency edges may be incomplete`, warning: false });
|
|
61
|
+
}
|
|
62
|
+
return notices;
|
|
63
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DeclarationTree } from '../declarations/DeclarationTree';
|
|
1
2
|
export interface DepEdge {
|
|
2
3
|
project: string;
|
|
3
4
|
fromFile: string;
|
|
@@ -6,7 +7,8 @@ export interface DepEdge {
|
|
|
6
7
|
toSymbol: string | null;
|
|
7
8
|
depType: string;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
+
import type { SymbolKind } from './SymbolKind';
|
|
11
|
+
export type { SymbolKind };
|
|
10
12
|
export interface SymbolEntry {
|
|
11
13
|
project: string;
|
|
12
14
|
filePath: string;
|
|
@@ -16,19 +18,9 @@ export interface SymbolEntry {
|
|
|
16
18
|
line: number | null;
|
|
17
19
|
endLine: number | null;
|
|
18
20
|
col: number | null;
|
|
19
|
-
/** Dotted path of enclosing named scopes, outermost first; null for top-level declarations. */
|
|
20
21
|
container: string | null;
|
|
21
22
|
isStatic: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Qualified TypeScript name of the decorated declaration, set only on
|
|
24
|
-
* `graphql-symbols` rows (`graphqlNames`); null on every `symbols`/`members` entry.
|
|
25
|
-
*/
|
|
26
23
|
target?: string | null;
|
|
27
|
-
/**
|
|
28
|
-
* Whether this declaration node has a body (vs. an overload signature).
|
|
29
|
-
* Internal — used only to pick an overload set's representative row before
|
|
30
|
-
* writing to `code_symbol`; never persisted.
|
|
31
|
-
*/
|
|
32
24
|
hasBody?: boolean;
|
|
33
25
|
}
|
|
34
26
|
export interface CallEdge {
|
|
@@ -41,47 +33,19 @@ export interface CallEdge {
|
|
|
41
33
|
line: number | null;
|
|
42
34
|
col: number | null;
|
|
43
35
|
}
|
|
44
|
-
/**
|
|
45
|
-
* Line range of a named scope used only to compute a chunk's owning declaration
|
|
46
|
-
* (`ownerPath`). Method/constructor/accessor ranges carry their enclosing class
|
|
47
|
-
* as `container`; top-level declarations use `container: null`. These are NOT
|
|
48
|
-
* persisted to `code_symbol` — they exist only for chunk ownership.
|
|
49
|
-
*/
|
|
50
|
-
export interface OwnerRange {
|
|
51
|
-
name: string;
|
|
52
|
-
container: string | null;
|
|
53
|
-
line: number;
|
|
54
|
-
endLine: number;
|
|
55
|
-
}
|
|
56
36
|
export interface FileAnalysis {
|
|
57
37
|
edges: DepEdge[];
|
|
58
|
-
/** Top-level declarations only — feeds the chunker and the embedding prompt. */
|
|
59
38
|
symbols: SymbolEntry[];
|
|
60
|
-
/** Members, namespace-level declarations and classes collected from the whole
|
|
61
|
-
* file. Written to `code_symbol` alongside `symbols`; never fed to the
|
|
62
|
-
* chunker or the prompt (see the `symbol-index-members` retrieval-invariance
|
|
63
|
-
* requirement). */
|
|
64
39
|
members: SymbolEntry[];
|
|
65
40
|
calls: CallEdge[];
|
|
66
|
-
|
|
67
|
-
ownerRanges?: OwnerRange[];
|
|
68
|
-
/**
|
|
69
|
-
* GraphQL-named rows (`@Query`/`@Mutation`/`@Subscription`/`@ResolveField`/
|
|
70
|
-
* `@ObjectType`/`@InputType`/`@InterfaceType` of `@nestjs/graphql`). Written to
|
|
71
|
-
* `code_symbol` alongside `symbols`/`members`; never fed to the chunker, the
|
|
72
|
-
* prompt, `buildOwnerRanges` or `extractCalls` (see `graphql-symbols`).
|
|
73
|
-
*/
|
|
41
|
+
declarations?: DeclarationTree;
|
|
74
42
|
graphqlNames: SymbolEntry[];
|
|
75
43
|
}
|
|
76
44
|
export interface AnalyzeProjectOpts {
|
|
77
45
|
skipDependencyResolution?: boolean;
|
|
78
|
-
/** Path to root tsconfig (e.g. tsconfig.base.json) for workspace-wide path aliases */
|
|
79
46
|
rootTsConfigPath?: string;
|
|
80
47
|
}
|
|
81
48
|
export interface IAstParser {
|
|
82
|
-
/**
|
|
83
|
-
* @deprecated Use analyzeProject instead for project-wide context.
|
|
84
|
-
*/
|
|
85
49
|
analyzeFile(filePath: string, serviceName: string, projectRoot?: string): Promise<FileAnalysis>;
|
|
86
50
|
analyzeProject(filePaths: string[], serviceName: string, projectRoot?: string, opts?: AnalyzeProjectOpts): Promise<Map<string, FileAnalysis>>;
|
|
87
51
|
clearCache(projectRoot?: string): void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface CallerRow {
|
|
2
|
+
fromFile: string;
|
|
3
|
+
fromSymbol: string | null;
|
|
4
|
+
calleeName: string;
|
|
5
|
+
calleeFile: string;
|
|
6
|
+
line: number | null;
|
|
7
|
+
}
|
|
8
|
+
export type NoCallersCause = {
|
|
9
|
+
kind: 'no-call-graph';
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'unknown-symbol';
|
|
12
|
+
suggestions: string[];
|
|
13
|
+
truncated: boolean;
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'no-recorded-calls';
|
|
16
|
+
definitions: {
|
|
17
|
+
qualified: string;
|
|
18
|
+
filePath: string;
|
|
19
|
+
line: number | null;
|
|
20
|
+
}[];
|
|
21
|
+
truncated: boolean;
|
|
22
|
+
} | {
|
|
23
|
+
kind: 'lookup-failed';
|
|
24
|
+
};
|
|
25
|
+
export interface ICallGraph {
|
|
26
|
+
getCallers(symbol: string, project: string, calleeFile?: string | null): Promise<CallerRow[]>;
|
|
27
|
+
explainNoCallers(symbol: string, project: string): Promise<NoCallersCause>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ResolvedThreshold } from '../constants';
|
|
2
|
+
export interface ChunkRow {
|
|
3
|
+
serviceName: string;
|
|
4
|
+
filePath: string;
|
|
5
|
+
startLine: number;
|
|
6
|
+
content: string;
|
|
7
|
+
ownerPath?: string | null;
|
|
8
|
+
}
|
|
9
|
+
export interface SearchResult extends ChunkRow {
|
|
10
|
+
score: number;
|
|
11
|
+
}
|
|
12
|
+
export interface NeighborResult {
|
|
13
|
+
result: SearchResult;
|
|
14
|
+
prevChunk: ChunkRow | null;
|
|
15
|
+
nextChunk: ChunkRow | null;
|
|
16
|
+
}
|
|
17
|
+
export type StageName = 'vector' | 'reranked';
|
|
18
|
+
export interface StagedSearchResult {
|
|
19
|
+
pool: SearchResult[];
|
|
20
|
+
stages: {
|
|
21
|
+
vector: SearchResult[];
|
|
22
|
+
reranked?: SearchResult[];
|
|
23
|
+
};
|
|
24
|
+
rerankFailed: boolean;
|
|
25
|
+
fetchLimit: number;
|
|
26
|
+
indexParams: {
|
|
27
|
+
efSearch: number | null;
|
|
28
|
+
iterativeScan: string;
|
|
29
|
+
};
|
|
30
|
+
threshold: ResolvedThreshold;
|
|
31
|
+
}
|
|
32
|
+
export type NoResultsCause = 'empty-scope' | 'no-candidates' | 'lookup-failed';
|
|
33
|
+
export interface IChunkSearch {
|
|
34
|
+
prepareQuery(raw: string): Promise<{
|
|
35
|
+
query: string;
|
|
36
|
+
translated: boolean;
|
|
37
|
+
}>;
|
|
38
|
+
searchChunks(query: string, limit: number, project: string | null, threshold?: number, rerankOverride?: boolean, perFile?: number): Promise<SearchResult[]>;
|
|
39
|
+
searchChunksWithStages(query: string, limit: number, project: string | null, threshold?: number, rerankOverride?: boolean, perFile?: number): Promise<StagedSearchResult>;
|
|
40
|
+
explainNoResults(project: string | null): Promise<NoResultsCause>;
|
|
41
|
+
fetchNeighbors(results: SearchResult[]): Promise<NeighborResult[]>;
|
|
42
|
+
}
|
|
@@ -1,24 +1,15 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
/** One embeddable unit of source with its 1-based inclusive line range. */
|
|
1
|
+
import type { DeclarationTree } from '../declarations/DeclarationTree';
|
|
3
2
|
export interface ChunkPiece {
|
|
4
3
|
content: string;
|
|
5
4
|
startLine: number;
|
|
6
5
|
endLine: number;
|
|
7
6
|
}
|
|
8
7
|
export interface ChunkOpts {
|
|
9
|
-
/** 'ast' = symbol-aligned boundaries; 'character' = fixed-size recursive splitter. */
|
|
10
8
|
strategy: 'ast' | 'character';
|
|
11
|
-
/** Schema files (.prisma/.graphql/.gql) always use the schema separator splitter. */
|
|
12
9
|
isSchemaFile: boolean;
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
declarations?: DeclarationTree;
|
|
11
|
+
jsx?: boolean;
|
|
15
12
|
}
|
|
16
13
|
export interface IChunker {
|
|
17
|
-
/**
|
|
18
|
-
* Split source into embeddable pieces. AST strategy aligns boundaries to
|
|
19
|
-
* top-level declaration ranges and never emits a piece longer than the
|
|
20
|
-
* configured chunk size; falls back to the character splitter for schema
|
|
21
|
-
* files, empty-symbol files, or when strategy is 'character'.
|
|
22
|
-
*/
|
|
23
14
|
chunk(code: string, opts: ChunkOpts): Promise<ChunkPiece[]>;
|
|
24
15
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface ICorpusInspector {
|
|
2
|
+
headCommit(root: string): Promise<string>;
|
|
3
|
+
trackedChanges(root: string): Promise<string[]>;
|
|
4
|
+
untrackedFiles(root: string, skipDirs: readonly string[]): Promise<string[]>;
|
|
5
|
+
listFiles(dir: string): Promise<string[]>;
|
|
6
|
+
readFile(absPath: string): Promise<Buffer | null>;
|
|
7
|
+
}
|
|
@@ -1,44 +1,28 @@
|
|
|
1
|
-
import type { DrizzleDb, DrizzleTx } from '../
|
|
2
|
-
/** Single-row record of which embedding model built the current index. */
|
|
1
|
+
import type { DrizzleDb, DrizzleTx } from '../db';
|
|
3
2
|
export interface IndexMeta {
|
|
4
3
|
provider: string;
|
|
5
4
|
model: string;
|
|
6
5
|
dimensions: number;
|
|
7
6
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
7
|
+
export interface InitDbOptions {
|
|
8
|
+
connectionTimeoutMs?: number;
|
|
9
|
+
}
|
|
12
10
|
export interface IDatabase {
|
|
13
11
|
readonly orm: DrizzleDb;
|
|
14
12
|
query<T = any>(sql: string, params?: any[]): Promise<T>;
|
|
13
|
+
queryWithLocalSettings<T = any>(settings: Record<string, string | number>, sql: string, params?: any[]): Promise<T>;
|
|
14
|
+
pgvectorVersion(): Promise<string | null>;
|
|
15
15
|
transaction<T>(fn: (tx: DrizzleTx) => Promise<T>): Promise<T>;
|
|
16
|
-
initDb(): Promise<void>;
|
|
16
|
+
initDb(options?: InitDbOptions): Promise<void>;
|
|
17
|
+
probe(): Promise<void>;
|
|
17
18
|
initDbWithSchema(): Promise<void>;
|
|
18
19
|
destroy(): Promise<void>;
|
|
19
|
-
/** Read the single `index_meta` row, or null when absent (table missing → null). */
|
|
20
20
|
readIndexMeta(): Promise<IndexMeta | null>;
|
|
21
|
-
/** Upsert the single `index_meta` row. */
|
|
22
21
|
writeIndexMeta(meta: IndexMeta): Promise<void>;
|
|
23
|
-
/** Create `code_chunk` (+ HNSW/service indexes) at `dimensions` if absent. */
|
|
24
22
|
ensureChunkTable(dimensions: number): Promise<void>;
|
|
25
|
-
/** Drop and recreate `code_chunk` at `dimensions` (dimension change). */
|
|
26
23
|
recreateChunkTable(dimensions: number): Promise<void>;
|
|
27
|
-
/**
|
|
28
|
-
* Return all file paths referenced in any of the four index tables for `project`.
|
|
29
|
-
* Union of code_chunk.filePath, code_symbol.filePath, code_call.fromFile,
|
|
30
|
-
* code_dependency.fromFile. calleeFile and toFile are excluded (may belong to other projects).
|
|
31
|
-
*/
|
|
32
24
|
listKnownFiles(project: string): Promise<string[]>;
|
|
33
|
-
/**
|
|
34
|
-
* Delete rows for `filePaths` from all four index tables in one transaction.
|
|
35
|
-
* code_call rows where the file is either fromFile OR calleeFile are removed.
|
|
36
|
-
* code_dependency rows where the file is either fromFile OR toFile are removed.
|
|
37
|
-
* No-op when `filePaths` is empty.
|
|
38
|
-
*/
|
|
39
25
|
deleteFiles(project: string, filePaths: string[]): Promise<void>;
|
|
40
|
-
/** Return all project names referenced in any of the four index tables. */
|
|
41
26
|
listIndexedProjects(): Promise<string[]>;
|
|
42
|
-
/** Delete all rows for `name` from the four index tables in one transaction. */
|
|
43
27
|
deleteProject(name: string): Promise<void>;
|
|
44
28
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { SearchResult } from './IChunkSearch';
|
|
2
|
+
export interface GraphContext {
|
|
3
|
+
imports: string[];
|
|
4
|
+
usedBy: string[];
|
|
5
|
+
}
|
|
6
|
+
export interface DependencyRow {
|
|
7
|
+
fromFile: string;
|
|
8
|
+
fromSymbol: string | null;
|
|
9
|
+
toFile: string;
|
|
10
|
+
toSymbol: string | null;
|
|
11
|
+
depType: string;
|
|
12
|
+
depth?: number;
|
|
13
|
+
via?: string;
|
|
14
|
+
id?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface IDependencyGraph {
|
|
17
|
+
getProjectEdges(): Promise<{
|
|
18
|
+
from: string;
|
|
19
|
+
to: string;
|
|
20
|
+
}[]>;
|
|
21
|
+
fetchGraphContext(results: SearchResult[]): Promise<Map<string, GraphContext>>;
|
|
22
|
+
getDependencies(filePath: string, symbol?: string | null, transitive?: boolean): Promise<DependencyRow[]>;
|
|
23
|
+
getDependents(filePath: string, symbol?: string | null, transitive?: boolean): Promise<DependencyRow[]>;
|
|
24
|
+
}
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
export type InputType = 'query' | 'document';
|
|
2
2
|
export interface IEmbedder {
|
|
3
|
-
/**
|
|
4
|
-
* The vector width this embedder produces, when known without a probe:
|
|
5
|
-
* `embedding.dimensions` override → model registry, else `0` for models whose
|
|
6
|
-
* width is only knowable by embedding once (see `resolveDimension`). Read by
|
|
7
|
-
* `SearcherService.assertIndexMatches` to catch a dimension change on the
|
|
8
|
-
* search side (skipped when `0`). Indexing resolves the true width via
|
|
9
|
-
* `resolveDimension` (which probes when needed), not this field.
|
|
10
|
-
*/
|
|
11
3
|
readonly dimensions: number;
|
|
12
4
|
embed(text: string, inputType?: InputType): Promise<number[]>;
|
|
13
|
-
/** One vector per input, in input order. The indexing path. */
|
|
14
5
|
embedBatch(texts: string[], inputType?: InputType): Promise<number[][]>;
|
|
15
6
|
rerank?(query: string, documents: string[], topN: number): Promise<number[]>;
|
|
16
7
|
listModels?(): Promise<string[]>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Node } from 'ts-morph';
|
|
2
|
+
export interface IndexedNodeDescription {
|
|
3
|
+
name: string;
|
|
4
|
+
container: string[];
|
|
5
|
+
}
|
|
6
|
+
export interface IIndexedNodeResolver {
|
|
7
|
+
describeIndexedNode(node: Node): IndexedNodeDescription | null;
|
|
8
|
+
qualifiedName(described: IndexedNodeDescription): string;
|
|
9
|
+
findFromSymbol(node: Node): string | null;
|
|
10
|
+
}
|
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Logger abstraction — allows services to depend on a contract
|
|
3
|
-
* rather than the concrete pino-based LoggerService.
|
|
4
|
-
*/
|
|
5
1
|
export interface ILogger {
|
|
6
2
|
debug(msg: string, data?: Record<string, unknown>): void;
|
|
7
3
|
info(msg: string, data?: Record<string, unknown>): void;
|
|
8
4
|
warn(msg: string, data?: Record<string, unknown>): void;
|
|
9
5
|
error(msg: string, data?: Record<string, unknown>): void;
|
|
10
|
-
|
|
11
|
-
* Structured telemetry emitted at `info` **independent of the configured log
|
|
12
|
-
* level** — so an operator can collect it in production without the full
|
|
13
|
-
* `debug` firehose. No-op when file logging is disabled (never writes to
|
|
14
|
-
* stdout, which the MCP transport owns).
|
|
15
|
-
*/
|
|
16
|
-
metric(msg: string, data?: Record<string, unknown>): void;
|
|
6
|
+
withContext<T>(context: Record<string, unknown>, fn: () => Promise<T>): Promise<T>;
|
|
17
7
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ReadinessFailure {
|
|
2
|
+
ok: false;
|
|
3
|
+
err: unknown;
|
|
4
|
+
}
|
|
5
|
+
export type ReadinessCheck = {
|
|
6
|
+
ok: true;
|
|
7
|
+
} | ReadinessFailure;
|
|
8
|
+
export interface IMcpReadiness {
|
|
9
|
+
start(): Promise<ReadinessCheck>;
|
|
10
|
+
ensureReady(): Promise<ReadinessCheck>;
|
|
11
|
+
readonly ready: boolean;
|
|
12
|
+
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP Tool Handler interface — each tool implements this contract.
|
|
3
|
-
* Follows the Open/Closed Principle: new tools are added by implementing
|
|
4
|
-
* this interface and registering them, not by modifying McpServer.
|
|
5
|
-
*/
|
|
6
1
|
export interface ToolDefinition {
|
|
7
2
|
name: string;
|
|
8
3
|
description: string;
|
|
@@ -1,33 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a discovered project within a monorepo workspace.
|
|
3
|
-
*/
|
|
4
1
|
export interface MonorepoProject {
|
|
5
|
-
/** Project name (e.g. "my-app", "shared-utils") */
|
|
6
2
|
name: string;
|
|
7
|
-
/** Absolute path to the project root */
|
|
8
3
|
path: string;
|
|
9
|
-
/** npm scope + package name (e.g. "@scope/my-app") — null if no package.json or no name */
|
|
10
4
|
packageName: string | null;
|
|
11
|
-
/** "app" | "lib" — derived from project.json or directory convention */
|
|
12
5
|
type: 'app' | 'lib';
|
|
13
6
|
}
|
|
14
|
-
/**
|
|
15
|
-
* Monorepo resolver — detects and resolves workspace structure.
|
|
16
|
-
* Implementations handle specific monorepo tooling (Nx, Turborepo, etc.)
|
|
17
|
-
*/
|
|
18
7
|
export interface IMonorepoResolver {
|
|
19
|
-
/**
|
|
20
|
-
* Detect whether the given root directory is a monorepo workspace.
|
|
21
|
-
*/
|
|
22
8
|
isMonorepo(rootDir: string): boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Discover all projects (apps + libs) in the monorepo.
|
|
25
|
-
*/
|
|
26
9
|
discoverProjects(rootDir: string): MonorepoProject[];
|
|
27
|
-
/**
|
|
28
|
-
* Get the root tsconfig path that contains workspace-wide path aliases.
|
|
29
|
-
* For Nx this is typically tsconfig.base.json at the workspace root.
|
|
30
|
-
* The AST parser uses this to resolve cross-project imports (@scope/*).
|
|
31
|
-
*/
|
|
32
10
|
getRootTsConfigPath(rootDir: string): string | null;
|
|
33
11
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ProjectMeta } from '../file-utils';
|
|
2
|
+
export interface ProjectRow extends ProjectMeta {
|
|
3
|
+
serviceName: string;
|
|
4
|
+
chunks: number;
|
|
5
|
+
packageName?: string | null;
|
|
6
|
+
type?: 'app' | 'lib';
|
|
7
|
+
path?: string;
|
|
8
|
+
relPath?: string;
|
|
9
|
+
rootError?: string | null;
|
|
10
|
+
}
|
|
11
|
+
export interface IProjectCatalog {
|
|
12
|
+
listProjects(): Promise<ProjectRow[]>;
|
|
13
|
+
}
|
|
@@ -1,28 +1,11 @@
|
|
|
1
1
|
export interface DiscoveredProject {
|
|
2
2
|
name: string;
|
|
3
3
|
path: string;
|
|
4
|
-
/** npm scope + package name (e.g. "@scope/my-app") — only set for monorepo projects */
|
|
5
4
|
packageName?: string | null;
|
|
6
|
-
/** "app" | "lib" — only set for monorepo projects */
|
|
7
5
|
type?: 'app' | 'lib';
|
|
8
|
-
/**
|
|
9
|
-
* Path to the workspace-wide tsconfig (e.g. tsconfig.base.json) that holds
|
|
10
|
-
* cross-project path aliases. Set for monorepo projects; undefined for flat
|
|
11
|
-
* workspaces (where each project uses its own local tsconfig.json).
|
|
12
|
-
*/
|
|
13
6
|
rootTsConfigPath?: string | null;
|
|
14
|
-
/**
|
|
15
|
-
* When a top-level directory is itself a nested monorepo (e.g. an Nx repo
|
|
16
|
-
* under a flat workspaceRoot), this holds its expanded sub-projects. The
|
|
17
|
-
* repo stays a single selectable unit; `toLeafProjects` expands `children`
|
|
18
|
-
* into the actual projects to index. Absent/undefined for ordinary projects.
|
|
19
|
-
*/
|
|
20
7
|
children?: DiscoveredProject[];
|
|
21
8
|
}
|
|
22
|
-
/**
|
|
23
|
-
* Project discovery abstraction — decouples project enumeration
|
|
24
|
-
* from the indexing service (Single Responsibility Principle).
|
|
25
|
-
*/
|
|
26
9
|
export interface IProjectDiscovery {
|
|
27
10
|
discover(rootDir: string): DiscoveredProject[];
|
|
28
11
|
}
|