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
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { StageName } from './IChunkSearch';
|
|
2
|
+
import type { ResolvedThreshold, ThresholdSource } from '../constants';
|
|
3
|
+
export type { StageName };
|
|
1
4
|
export type EvalCategory = 'identifier' | 'behaviour' | 'concept';
|
|
2
5
|
export interface ExpectedAnswer {
|
|
3
6
|
file: string;
|
|
@@ -10,20 +13,39 @@ export interface EvalCase {
|
|
|
10
13
|
query: string;
|
|
11
14
|
expect: ExpectedAnswer[];
|
|
12
15
|
threshold?: number;
|
|
16
|
+
corpus?: string | null;
|
|
17
|
+
}
|
|
18
|
+
export interface CorpusRef {
|
|
19
|
+
root: string;
|
|
20
|
+
commit: string;
|
|
13
21
|
}
|
|
14
22
|
export interface EvalSuite {
|
|
15
23
|
version: 1;
|
|
24
|
+
corpus?: CorpusRef;
|
|
16
25
|
cases: EvalCase[];
|
|
17
26
|
}
|
|
18
27
|
export interface SearchHit {
|
|
19
28
|
filePath: string;
|
|
20
29
|
ownerPath: string | null;
|
|
21
30
|
}
|
|
22
|
-
export
|
|
23
|
-
|
|
31
|
+
export interface StagedHits {
|
|
32
|
+
pool: SearchHit[];
|
|
33
|
+
stages: {
|
|
34
|
+
vector: SearchHit[];
|
|
35
|
+
} & Partial<Record<StageName, SearchHit[]>>;
|
|
36
|
+
rerankFailed: boolean;
|
|
37
|
+
fetchLimit: number;
|
|
38
|
+
indexParams: {
|
|
39
|
+
efSearch: number | null;
|
|
40
|
+
iterativeScan: string;
|
|
41
|
+
};
|
|
42
|
+
threshold: ResolvedThreshold;
|
|
43
|
+
}
|
|
44
|
+
export type SearchFn = (query: string, limit: number, project: string | null, threshold?: number) => Promise<StagedHits>;
|
|
24
45
|
export interface IndexInspector {
|
|
25
46
|
isFileIndexed(project: string, file: string): Promise<boolean>;
|
|
26
47
|
ownerPathsOfFile(project: string, file: string): Promise<string[]>;
|
|
48
|
+
projectDir(project: string): Promise<string | null>;
|
|
27
49
|
}
|
|
28
50
|
export interface Metrics {
|
|
29
51
|
count: number;
|
|
@@ -31,14 +53,20 @@ export interface Metrics {
|
|
|
31
53
|
hit5: number;
|
|
32
54
|
mrr10: number;
|
|
33
55
|
}
|
|
56
|
+
export interface StageRank {
|
|
57
|
+
rank: number | null;
|
|
58
|
+
matched: SearchHit | null;
|
|
59
|
+
}
|
|
34
60
|
export interface CaseResult {
|
|
35
61
|
id: string;
|
|
36
62
|
project: string;
|
|
37
63
|
category: EvalCategory;
|
|
38
64
|
query: string;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
65
|
+
stages: Partial<Record<StageName, StageRank>>;
|
|
66
|
+
poolRank: number | null;
|
|
67
|
+
poolSize: number;
|
|
68
|
+
rerankFailed: boolean;
|
|
69
|
+
corpus: string | null;
|
|
42
70
|
}
|
|
43
71
|
export interface InvalidCase {
|
|
44
72
|
id: string;
|
|
@@ -49,17 +77,87 @@ export interface PartialWarning {
|
|
|
49
77
|
id: string;
|
|
50
78
|
droppedExpects: ExpectedAnswer[];
|
|
51
79
|
}
|
|
80
|
+
export interface StageMetrics {
|
|
81
|
+
overall: Metrics;
|
|
82
|
+
byCategory: Partial<Record<EvalCategory, Metrics>>;
|
|
83
|
+
}
|
|
84
|
+
export interface PoolMetrics {
|
|
85
|
+
count: number;
|
|
86
|
+
recall: number;
|
|
87
|
+
short: number;
|
|
88
|
+
}
|
|
89
|
+
export interface PairCounts {
|
|
90
|
+
improved: number;
|
|
91
|
+
worsened: number;
|
|
92
|
+
unchanged: number;
|
|
93
|
+
signTestP: number;
|
|
94
|
+
}
|
|
95
|
+
export interface PairedChange {
|
|
96
|
+
overall: PairCounts;
|
|
97
|
+
byCategory: Partial<Record<EvalCategory, PairCounts>>;
|
|
98
|
+
hit5Gained: string[];
|
|
99
|
+
hit5Lost: string[];
|
|
100
|
+
}
|
|
101
|
+
export interface StageChange {
|
|
102
|
+
from: StageName;
|
|
103
|
+
to: StageName;
|
|
104
|
+
change: PairedChange;
|
|
105
|
+
}
|
|
52
106
|
export interface EvalRunResult {
|
|
53
107
|
cases: CaseResult[];
|
|
54
108
|
invalid: InvalidCase[];
|
|
55
109
|
warnings: PartialWarning[];
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
110
|
+
stages: StageName[];
|
|
111
|
+
metrics: Partial<Record<StageName, StageMetrics>>;
|
|
112
|
+
pool: {
|
|
113
|
+
overall: PoolMetrics;
|
|
114
|
+
byCategory: Partial<Record<EvalCategory, PoolMetrics>>;
|
|
115
|
+
};
|
|
116
|
+
stageChanges: StageChange[];
|
|
117
|
+
rerankFailures: number;
|
|
118
|
+
byCorpus: Record<string, CorpusRunMetrics>;
|
|
119
|
+
}
|
|
120
|
+
export interface CorpusRunMetrics {
|
|
121
|
+
cases: number;
|
|
122
|
+
metrics: Partial<Record<StageName, StageMetrics>>;
|
|
123
|
+
pool: {
|
|
124
|
+
overall: PoolMetrics;
|
|
125
|
+
byCategory: Partial<Record<EvalCategory, PoolMetrics>>;
|
|
59
126
|
};
|
|
127
|
+
stageChanges: StageChange[];
|
|
128
|
+
}
|
|
129
|
+
export interface ObservedSearchParams {
|
|
130
|
+
fetchLimit: number[];
|
|
131
|
+
efSearch: (number | null)[];
|
|
132
|
+
iterativeScan: string[];
|
|
133
|
+
thresholds: ResolvedThreshold[];
|
|
134
|
+
}
|
|
135
|
+
export interface EvalOutcome {
|
|
136
|
+
run: EvalRunResult;
|
|
137
|
+
observed: ObservedSearchParams;
|
|
138
|
+
}
|
|
139
|
+
export interface CaseProgress {
|
|
140
|
+
index: number;
|
|
141
|
+
total: number;
|
|
142
|
+
id: string;
|
|
143
|
+
result: CaseResult | null;
|
|
144
|
+
invalid: InvalidCase | null;
|
|
145
|
+
ms: number;
|
|
60
146
|
}
|
|
61
147
|
export interface IRetrievalEvaluator {
|
|
62
|
-
evaluate(suite: EvalSuite, search: SearchFn, inspect: IndexInspector): Promise<
|
|
148
|
+
evaluate(suite: EvalSuite, search: SearchFn, inspect: IndexInspector, onCase?: (p: CaseProgress) => void): Promise<EvalOutcome>;
|
|
149
|
+
}
|
|
150
|
+
export interface ThresholdCondition {
|
|
151
|
+
value: number;
|
|
152
|
+
source: ThresholdSource | 'not recorded';
|
|
153
|
+
}
|
|
154
|
+
export interface SearchConditions {
|
|
155
|
+
thresholds: ThresholdCondition[];
|
|
156
|
+
overfetch: number;
|
|
157
|
+
candidateFloor: number;
|
|
158
|
+
fetchLimit: number[];
|
|
159
|
+
efSearch: (number | null)[];
|
|
160
|
+
iterativeScan: string[];
|
|
63
161
|
}
|
|
64
162
|
export interface ResultMetadata {
|
|
65
163
|
suitePath: string;
|
|
@@ -74,10 +172,33 @@ export interface ResultMetadata {
|
|
|
74
172
|
} | null;
|
|
75
173
|
gitCommit: string;
|
|
76
174
|
timestamp: string;
|
|
175
|
+
conditions: SearchConditions | null;
|
|
176
|
+
vectorIndex: VectorIndexRecord | null;
|
|
177
|
+
corpora: CorpusRecord[];
|
|
178
|
+
liveCases: number;
|
|
179
|
+
}
|
|
180
|
+
export interface VectorIndexRecord {
|
|
181
|
+
pgvector: string | null;
|
|
182
|
+
indexes: {
|
|
183
|
+
name: string;
|
|
184
|
+
method: string;
|
|
185
|
+
opclass: string;
|
|
186
|
+
params: Record<string, string>;
|
|
187
|
+
}[];
|
|
188
|
+
maxScanTuples: number | null;
|
|
189
|
+
scanMemMultiplier: number | null;
|
|
190
|
+
}
|
|
191
|
+
export interface CorpusRecord {
|
|
192
|
+
root: string;
|
|
193
|
+
commit: string;
|
|
194
|
+
projects: string[];
|
|
195
|
+
chunks: number;
|
|
196
|
+
fingerprint: string;
|
|
77
197
|
}
|
|
78
198
|
export interface EvalResultFile {
|
|
79
199
|
metadata: ResultMetadata;
|
|
80
200
|
run: EvalRunResult;
|
|
201
|
+
legacy?: true;
|
|
81
202
|
}
|
|
82
203
|
export interface MetricDelta {
|
|
83
204
|
baseline: number;
|
|
@@ -85,10 +206,30 @@ export interface MetricDelta {
|
|
|
85
206
|
delta: number;
|
|
86
207
|
}
|
|
87
208
|
export type MetricsDelta = Record<keyof Metrics, MetricDelta>;
|
|
88
|
-
export interface
|
|
209
|
+
export interface StageComparison {
|
|
210
|
+
stage: StageName;
|
|
89
211
|
overall: MetricsDelta;
|
|
90
212
|
byCategory: Partial<Record<EvalCategory, MetricsDelta>>;
|
|
91
|
-
|
|
92
|
-
|
|
213
|
+
change: PairedChange;
|
|
214
|
+
}
|
|
215
|
+
export interface PoolValueDelta {
|
|
216
|
+
baseline: number | null;
|
|
217
|
+
current: number;
|
|
218
|
+
delta: number | null;
|
|
219
|
+
}
|
|
220
|
+
export interface PoolDelta {
|
|
221
|
+
recall: PoolValueDelta;
|
|
222
|
+
short: PoolValueDelta;
|
|
223
|
+
}
|
|
224
|
+
export interface CompareResult {
|
|
225
|
+
stages: StageComparison[];
|
|
226
|
+
unmatchedStages: {
|
|
227
|
+
stage: StageName;
|
|
228
|
+
side: 'baseline' | 'current';
|
|
229
|
+
}[];
|
|
230
|
+
pool: {
|
|
231
|
+
overall: PoolDelta;
|
|
232
|
+
byCategory: Partial<Record<EvalCategory, PoolDelta>>;
|
|
233
|
+
};
|
|
93
234
|
conditionWarnings: string[];
|
|
94
235
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface ProjectNotice {
|
|
2
|
+
mark: '✓' | '⚠';
|
|
3
|
+
message: string;
|
|
4
|
+
warning: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface IScanReporter {
|
|
7
|
+
staleRemoved(relFile: string): void;
|
|
8
|
+
begin(serviceName: string, fileCount: number, notices: ProjectNotice[]): void;
|
|
9
|
+
file(relToDir: string): void;
|
|
10
|
+
advance(): void;
|
|
11
|
+
interrupted(serviceName: string): void;
|
|
12
|
+
end(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export type GrepSymbolResult = {
|
|
2
|
+
ok: true;
|
|
3
|
+
matches: GrepMatch[];
|
|
4
|
+
truncated: boolean;
|
|
5
|
+
partial: boolean;
|
|
6
|
+
} | {
|
|
7
|
+
ok: false;
|
|
8
|
+
};
|
|
9
|
+
export interface GrepMatch {
|
|
10
|
+
filePath: string;
|
|
11
|
+
line: number;
|
|
12
|
+
}
|
|
13
|
+
export type SymbolKind = 'function' | 'class' | 'type' | 'interface' | 'variable' | 'method' | 'get_accessor' | 'set_accessor' | 'constructor' | 'function_property' | 'method_signature' | 'graphql_query' | 'graphql_mutation' | 'graphql_subscription' | 'graphql_field' | 'graphql_type' | 'all';
|
|
14
|
+
export interface SymbolHit {
|
|
15
|
+
filePath: string;
|
|
16
|
+
line: number;
|
|
17
|
+
column: number;
|
|
18
|
+
kind: Exclude<SymbolKind, 'all'>;
|
|
19
|
+
signature: string;
|
|
20
|
+
qualified: string;
|
|
21
|
+
isStatic: boolean;
|
|
22
|
+
source: 'index' | 'grep';
|
|
23
|
+
target: string | null;
|
|
24
|
+
}
|
|
25
|
+
export type FindSymbolGrep = {
|
|
26
|
+
outcome: 'complete';
|
|
27
|
+
} | {
|
|
28
|
+
outcome: 'partial';
|
|
29
|
+
} | {
|
|
30
|
+
outcome: 'failed';
|
|
31
|
+
cause: string;
|
|
32
|
+
} | {
|
|
33
|
+
outcome: 'no-project-directory';
|
|
34
|
+
} | {
|
|
35
|
+
outcome: 'other-container';
|
|
36
|
+
};
|
|
37
|
+
export interface FindSymbolResult {
|
|
38
|
+
hits: SymbolHit[];
|
|
39
|
+
truncated: boolean;
|
|
40
|
+
grep: FindSymbolGrep;
|
|
41
|
+
similar: {
|
|
42
|
+
names: string[];
|
|
43
|
+
truncated: boolean;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export interface ISymbolLookup {
|
|
47
|
+
grepSymbol(symbol: string, rootDir: string, excludeFile: string): Promise<GrepSymbolResult>;
|
|
48
|
+
findSymbol(name: string, project: string | null, kind: SymbolKind): Promise<FindSymbolResult>;
|
|
49
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { IndexingExclusion } from '../file-utils';
|
|
2
|
+
export type PathRefusal = {
|
|
3
|
+
ok: false;
|
|
4
|
+
reason: 'invalid';
|
|
5
|
+
missing: boolean;
|
|
6
|
+
} | {
|
|
7
|
+
ok: false;
|
|
8
|
+
reason: 'absolute';
|
|
9
|
+
relative: string;
|
|
10
|
+
} | {
|
|
11
|
+
ok: false;
|
|
12
|
+
reason: 'outside_workspace';
|
|
13
|
+
} | {
|
|
14
|
+
ok: false;
|
|
15
|
+
reason: 'unreadable';
|
|
16
|
+
code: string;
|
|
17
|
+
};
|
|
18
|
+
export type ResolvedToolPath = {
|
|
19
|
+
ok: true;
|
|
20
|
+
relPath: string;
|
|
21
|
+
absPath: string;
|
|
22
|
+
} | PathRefusal;
|
|
23
|
+
export type NotIndexedExplanation = IndexingExclusion | {
|
|
24
|
+
kind: 'no_project';
|
|
25
|
+
} | {
|
|
26
|
+
kind: 'project_not_indexed';
|
|
27
|
+
project: string;
|
|
28
|
+
} | {
|
|
29
|
+
kind: 'unknown';
|
|
30
|
+
};
|
|
31
|
+
export type PathFailure = {
|
|
32
|
+
ok: false;
|
|
33
|
+
reason: 'outside_workspace';
|
|
34
|
+
} | {
|
|
35
|
+
ok: false;
|
|
36
|
+
reason: 'unreadable';
|
|
37
|
+
code: string;
|
|
38
|
+
} | {
|
|
39
|
+
ok: false;
|
|
40
|
+
reason: 'not_found';
|
|
41
|
+
candidates: string[];
|
|
42
|
+
} | {
|
|
43
|
+
ok: false;
|
|
44
|
+
reason: 'deleted';
|
|
45
|
+
} | {
|
|
46
|
+
ok: false;
|
|
47
|
+
reason: 'not_indexed';
|
|
48
|
+
explanation: NotIndexedExplanation;
|
|
49
|
+
} | {
|
|
50
|
+
ok: false;
|
|
51
|
+
reason: 'not_a_file';
|
|
52
|
+
} | {
|
|
53
|
+
ok: false;
|
|
54
|
+
reason: 'not_a_directory';
|
|
55
|
+
} | {
|
|
56
|
+
ok: false;
|
|
57
|
+
reason: 'binary';
|
|
58
|
+
};
|
|
59
|
+
export interface IToolPaths {
|
|
60
|
+
resolveToolPath(input: string | null | undefined): Promise<ResolvedToolPath>;
|
|
61
|
+
checkGraphPath(relPath: string): Promise<PathFailure | null>;
|
|
62
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { PathFailure } from './IToolPaths';
|
|
2
|
+
export type FileRangeResult = {
|
|
3
|
+
ok: true;
|
|
4
|
+
filePath: string;
|
|
5
|
+
startLine: number;
|
|
6
|
+
endLine: number;
|
|
7
|
+
lines: string[];
|
|
8
|
+
hasMore: boolean;
|
|
9
|
+
} | PathFailure | {
|
|
10
|
+
ok: false;
|
|
11
|
+
reason: 'past_end';
|
|
12
|
+
lineCount: number;
|
|
13
|
+
startLine: number;
|
|
14
|
+
} | {
|
|
15
|
+
ok: false;
|
|
16
|
+
reason: 'bad_range';
|
|
17
|
+
startLine: number;
|
|
18
|
+
endLine: number;
|
|
19
|
+
};
|
|
20
|
+
export type ListFilesResult = {
|
|
21
|
+
ok: true;
|
|
22
|
+
tree: string;
|
|
23
|
+
} | PathFailure;
|
|
24
|
+
export interface IWorkspaceFiles {
|
|
25
|
+
listFiles(relPath: string, depth: number, pattern: string | null): Promise<ListFilesResult>;
|
|
26
|
+
readFile(relPath: string, maxLines: number): Promise<FileRangeResult>;
|
|
27
|
+
readFileRange(relPath: string, startLine: number, endLine: number): Promise<FileRangeResult>;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type SymbolKind = 'function' | 'class' | 'interface' | 'type' | 'variable' | 'method' | 'get_accessor' | 'set_accessor' | 'constructor' | 'function_property' | 'method_signature' | 'graphql_query' | 'graphql_mutation' | 'graphql_subscription' | 'graphql_field' | 'graphql_type';
|
|
@@ -3,7 +3,18 @@ export type { IAstParser, DepEdge, SymbolEntry, CallEdge, FileAnalysis } from '.
|
|
|
3
3
|
export type { IChunker, ChunkPiece, ChunkOpts } from './IChunker';
|
|
4
4
|
export type { ILogger } from './ILogger';
|
|
5
5
|
export type { IDatabase } from './IDatabase';
|
|
6
|
-
export type {
|
|
6
|
+
export type { IToolPaths } from './IToolPaths';
|
|
7
|
+
export type { IProjectRoots } from './IProjectRoots';
|
|
8
|
+
export type { IWorkspaceFiles } from './IWorkspaceFiles';
|
|
9
|
+
export type { IChunkSearch } from './IChunkSearch';
|
|
10
|
+
export type { IDependencyGraph } from './IDependencyGraph';
|
|
11
|
+
export type { ICallGraph } from './ICallGraph';
|
|
12
|
+
export type { ISymbolLookup } from './ISymbolLookup';
|
|
13
|
+
export type { IProjectCatalog } from './IProjectCatalog';
|
|
14
|
+
export type { IIndexIdentityGuard } from './IIndexIdentityGuard';
|
|
15
|
+
export type { IIndexedNodeResolver, IndexedNodeDescription } from './IIndexedNodeResolver';
|
|
7
16
|
export type { IProjectDiscovery, DiscoveredProject } from './IProjectDiscovery';
|
|
17
|
+
export type { IMcpReadiness, ReadinessCheck, ReadinessFailure } from './IMcpReadiness';
|
|
8
18
|
export type { IMcpToolHandler, ToolDefinition, ToolResponse } from './IMcpToolHandler';
|
|
19
|
+
export type { IScanReporter, ProjectNotice } from './IScanReporter';
|
|
9
20
|
export type { EvalCategory, ExpectedAnswer, EvalCase, EvalSuite, SearchHit, SearchFn, IndexInspector, Metrics, CaseResult, InvalidCase, PartialWarning, EvalRunResult, IRetrievalEvaluator, ResultMetadata, EvalResultFile, MetricDelta, MetricsDelta, CompareResult, } from './IRetrievalEvaluator';
|
package/dist/src/interrupt.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setupInterrupt = setupInterrupt;
|
|
4
|
-
// Graceful interruption for long-running CLI operations.
|
|
5
|
-
// Caller creates the AbortController; this function wires stdin and returns a cleanup function.
|
|
6
4
|
function setupInterrupt(controller) {
|
|
7
5
|
if (!process.stdin.isTTY)
|
|
8
6
|
return () => { };
|
package/dist/src/owner-path.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export declare function resolveOwnerPath(startLine: number, ranges: OwnerRange[]): string | null;
|
|
1
|
+
import type { DeclarationTree } from './declarations/DeclarationTree';
|
|
2
|
+
import type { SourceLines } from './declarations/SourceLines';
|
|
3
|
+
interface LineSpan {
|
|
4
|
+
startLine: number;
|
|
5
|
+
endLine: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function ownedLines(piece: LineSpan, declarations: DeclarationTree, lines: SourceLines): number[];
|
|
8
|
+
export declare function ownerOf(piece: LineSpan, declarations: DeclarationTree, lines: SourceLines): string | null;
|
|
9
|
+
export {};
|
package/dist/src/owner-path.js
CHANGED
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* start line lies outside every range (imports / module-scope gaps).
|
|
11
|
-
*/
|
|
12
|
-
function resolveOwnerPath(startLine, ranges) {
|
|
13
|
-
let best = null;
|
|
14
|
-
let bestSpan = Infinity;
|
|
15
|
-
for (const r of ranges) {
|
|
16
|
-
if (r.line <= startLine && startLine <= r.endLine) {
|
|
17
|
-
const span = r.endLine - r.line;
|
|
18
|
-
if (span < bestSpan) {
|
|
19
|
-
bestSpan = span;
|
|
20
|
-
best = r;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
3
|
+
exports.ownedLines = ownedLines;
|
|
4
|
+
exports.ownerOf = ownerOf;
|
|
5
|
+
function ownedLines(piece, declarations, lines) {
|
|
6
|
+
const owned = [];
|
|
7
|
+
for (let n = piece.startLine; n <= piece.endLine; n++) {
|
|
8
|
+
if (lines.isSignificant(n) && declarations.contains(n))
|
|
9
|
+
owned.push(n);
|
|
23
10
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
11
|
+
return owned;
|
|
12
|
+
}
|
|
13
|
+
function ownerOf(piece, declarations, lines) {
|
|
14
|
+
return declarations.smallestContaining(ownedLines(piece, declarations, lines))?.qualifiedName ?? null;
|
|
27
15
|
}
|
|
@@ -3,17 +3,6 @@ export interface ResolveProjectNamesResult {
|
|
|
3
3
|
targets: DiscoveredProject[];
|
|
4
4
|
notFound: string[];
|
|
5
5
|
}
|
|
6
|
-
/**
|
|
7
|
-
* Resolve one or more `--project`-style names against discovered units: a
|
|
8
|
-
* unit name expands to all of its children, a leaf name resolves to itself.
|
|
9
|
-
* Units are tried before leaves so a top-level project named the same as a
|
|
10
|
-
* nested-monorepo child's bare name can never shadow it. Targets are
|
|
11
|
-
* deduplicated by leaf name and ordered by first-resolving input name.
|
|
12
|
-
*/
|
|
13
6
|
export declare function resolveProjectNames(names: string[], units: DiscoveredProject[]): ResolveProjectNamesResult;
|
|
14
|
-
|
|
15
|
-
* Every name `--project` would accept as a match, in discovery order: each
|
|
16
|
-
* unit's own name, immediately followed by its expanded leaf names (an
|
|
17
|
-
* ordinary project — no children — contributes only its own name once).
|
|
18
|
-
*/
|
|
7
|
+
export declare function matchedProjectDir(name: string, units: DiscoveredProject[]): string | undefined;
|
|
19
8
|
export declare function listAvailableNames(units: DiscoveredProject[]): string[];
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveProjectNames = resolveProjectNames;
|
|
4
|
+
exports.matchedProjectDir = matchedProjectDir;
|
|
4
5
|
exports.listAvailableNames = listAvailableNames;
|
|
5
6
|
const MonorepoAwareDiscoveryService_1 = require("./services/MonorepoAwareDiscoveryService");
|
|
6
|
-
/**
|
|
7
|
-
* Resolve one or more `--project`-style names against discovered units: a
|
|
8
|
-
* unit name expands to all of its children, a leaf name resolves to itself.
|
|
9
|
-
* Units are tried before leaves so a top-level project named the same as a
|
|
10
|
-
* nested-monorepo child's bare name can never shadow it. Targets are
|
|
11
|
-
* deduplicated by leaf name and ordered by first-resolving input name.
|
|
12
|
-
*/
|
|
13
7
|
function resolveProjectNames(names, units) {
|
|
14
8
|
const leaves = (0, MonorepoAwareDiscoveryService_1.toLeafProjects)(units);
|
|
15
9
|
const targets = [];
|
|
@@ -31,11 +25,10 @@ function resolveProjectNames(names, units) {
|
|
|
31
25
|
}
|
|
32
26
|
return { targets, notFound };
|
|
33
27
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*/
|
|
28
|
+
function matchedProjectDir(name, units) {
|
|
29
|
+
const unit = units.find(u => u.name === name);
|
|
30
|
+
return unit ? unit.path : (0, MonorepoAwareDiscoveryService_1.toLeafProjects)(units).find(l => l.name === name)?.path;
|
|
31
|
+
}
|
|
39
32
|
function listAvailableNames(units) {
|
|
40
33
|
const names = [];
|
|
41
34
|
for (const unit of units) {
|
|
@@ -2,11 +2,6 @@ export interface Project {
|
|
|
2
2
|
name: string;
|
|
3
3
|
path: string;
|
|
4
4
|
}
|
|
5
|
-
/**
|
|
6
|
-
* One-off single-choice prompt for `--project` with no name — distinct from
|
|
7
|
-
* the multi-select `checkbox` flow: it reads/writes nothing persisted.
|
|
8
|
-
* Resolves to `undefined` if the user cancels (e.g. Ctrl+C).
|
|
9
|
-
*/
|
|
10
5
|
export declare function selectSingleProject(units: Project[]): Promise<string | undefined>;
|
|
11
6
|
export declare class ProjectSelector {
|
|
12
7
|
private readonly workspaceDir;
|
|
@@ -38,11 +38,6 @@ exports.selectSingleProject = selectSingleProject;
|
|
|
38
38
|
const fs = __importStar(require("fs"));
|
|
39
39
|
const path = __importStar(require("path"));
|
|
40
40
|
const prompts_1 = require("@inquirer/prompts");
|
|
41
|
-
/**
|
|
42
|
-
* One-off single-choice prompt for `--project` with no name — distinct from
|
|
43
|
-
* the multi-select `checkbox` flow: it reads/writes nothing persisted.
|
|
44
|
-
* Resolves to `undefined` if the user cancels (e.g. Ctrl+C).
|
|
45
|
-
*/
|
|
46
41
|
async function selectSingleProject(units) {
|
|
47
42
|
try {
|
|
48
43
|
return await (0, prompts_1.select)({
|
|
@@ -66,9 +61,6 @@ async function loadLines(filePath) {
|
|
|
66
61
|
return new Set();
|
|
67
62
|
}
|
|
68
63
|
}
|
|
69
|
-
// Write the set if non-empty, otherwise delete the file so state is deterministic.
|
|
70
|
-
// Previously .ragskip could be left stale (last entry removed but file not rewritten);
|
|
71
|
-
// treating both files the same way avoids that drift.
|
|
72
64
|
async function saveLines(filePath, names) {
|
|
73
65
|
if (names.size > 0) {
|
|
74
66
|
await fs.promises.writeFile(filePath, [...names].sort().join('\n') + '\n');
|
|
@@ -94,13 +86,10 @@ class ProjectSelector {
|
|
|
94
86
|
await this.load();
|
|
95
87
|
const newProjects = allProjects.filter(p => !this.included.has(p.name) && !this.skipped.has(p.name));
|
|
96
88
|
const previouslySelected = allProjects.filter(p => this.included.has(p.name));
|
|
97
|
-
// Nothing new and something already selected — return silently
|
|
98
89
|
if (newProjects.length === 0 && !forceSelect && previouslySelected.length > 0) {
|
|
99
90
|
return previouslySelected;
|
|
100
91
|
}
|
|
101
|
-
// No previous selection — treat as implicit --select so the user picks projects now
|
|
102
92
|
const autoSelect = !forceSelect && previouslySelected.length === 0;
|
|
103
|
-
// In --select / auto-select mode show all non-skipped projects; otherwise only new ones
|
|
104
93
|
const toShow = (forceSelect || autoSelect)
|
|
105
94
|
? allProjects.filter(p => !this.skipped.has(p.name))
|
|
106
95
|
: newProjects;
|
|
@@ -1,16 +1,25 @@
|
|
|
1
|
-
import type { EvalSuite, SearchFn, IndexInspector, IRetrievalEvaluator,
|
|
2
|
-
|
|
1
|
+
import type { EvalSuite, EvalCase, EvalCategory, CorpusRef, SearchFn, IndexInspector, IRetrievalEvaluator, EvalOutcome, StageName, PairedChange, CaseProgress, EvalResultFile, ThresholdCondition, CompareResult } from './interfaces/IRetrievalEvaluator';
|
|
2
|
+
export declare const STAGE_ORDER: readonly StageName[];
|
|
3
3
|
export declare class EvalSuiteError extends Error {
|
|
4
4
|
readonly caseId: string | null;
|
|
5
5
|
readonly field: string | null;
|
|
6
6
|
constructor(message: string, caseId: string | null, field: string | null);
|
|
7
7
|
}
|
|
8
|
-
/** Validates a loaded suite object against the schema; rejects before any search runs. */
|
|
9
8
|
export declare function parseSuite(raw: unknown): EvalSuite;
|
|
10
|
-
|
|
9
|
+
export declare function corporaOf(suites: EvalSuite[]): CorpusRef[];
|
|
10
|
+
export declare function isUnderRoot(dir: string, root: string): boolean;
|
|
11
|
+
export declare function checkCaseCorpora(cases: EvalCase[], projectDir: (project: string) => Promise<string | null>): Promise<void>;
|
|
11
12
|
export declare function mergeSuites(suites: EvalSuite[]): EvalSuite;
|
|
13
|
+
export declare function signTest(improved: number, worsened: number): number;
|
|
14
|
+
export interface RankedCase {
|
|
15
|
+
id: string;
|
|
16
|
+
category: EvalCategory;
|
|
17
|
+
rank: number | null;
|
|
18
|
+
}
|
|
19
|
+
export declare function pairedChange(from: RankedCase[], to: RankedCase[]): PairedChange;
|
|
20
|
+
export declare const LIVE_GROUP = "live";
|
|
21
|
+
export declare function formatThresholdConditions(pairs: ThresholdCondition[]): string;
|
|
12
22
|
export declare class RetrievalEvaluator implements IRetrievalEvaluator {
|
|
13
|
-
evaluate(suite: EvalSuite, search: SearchFn, inspect: IndexInspector): Promise<
|
|
23
|
+
evaluate(suite: EvalSuite, search: SearchFn, inspect: IndexInspector, onCase?: (p: CaseProgress) => void): Promise<EvalOutcome>;
|
|
14
24
|
}
|
|
15
|
-
/** Pure comparison of two result files; prints a warning (never refuses) on mismatched conditions. */
|
|
16
25
|
export declare function compare(baseline: EvalResultFile, current: EvalResultFile): CompareResult;
|