gitnexus 1.4.7 → 1.4.9
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 +29 -1
- package/dist/cli/ai-context.d.ts +1 -1
- package/dist/cli/ai-context.js +1 -1
- package/dist/cli/analyze.d.ts +2 -0
- package/dist/cli/analyze.js +54 -21
- package/dist/cli/index-repo.d.ts +15 -0
- package/dist/cli/index-repo.js +115 -0
- package/dist/cli/index.js +13 -3
- package/dist/cli/setup.js +90 -10
- package/dist/cli/wiki.d.ts +4 -0
- package/dist/cli/wiki.js +174 -53
- package/dist/config/supported-languages.d.ts +33 -1
- package/dist/config/supported-languages.js +32 -0
- package/dist/core/embeddings/embedder.d.ts +6 -1
- package/dist/core/embeddings/embedder.js +65 -5
- package/dist/core/embeddings/embedding-pipeline.js +11 -9
- package/dist/core/embeddings/http-client.d.ts +31 -0
- package/dist/core/embeddings/http-client.js +179 -0
- package/dist/core/embeddings/index.d.ts +1 -0
- package/dist/core/embeddings/index.js +1 -0
- package/dist/core/embeddings/types.d.ts +1 -1
- package/dist/core/graph/graph.js +9 -1
- package/dist/core/graph/types.d.ts +11 -2
- package/dist/core/ingestion/call-processor.d.ts +66 -2
- package/dist/core/ingestion/call-processor.js +650 -30
- package/dist/core/ingestion/call-routing.d.ts +9 -18
- package/dist/core/ingestion/call-routing.js +0 -19
- package/dist/core/ingestion/cobol/cobol-copy-expander.d.ts +57 -0
- package/dist/core/ingestion/cobol/cobol-copy-expander.js +385 -0
- package/dist/core/ingestion/cobol/cobol-preprocessor.d.ts +210 -0
- package/dist/core/ingestion/cobol/cobol-preprocessor.js +1509 -0
- package/dist/core/ingestion/cobol/jcl-parser.d.ts +68 -0
- package/dist/core/ingestion/cobol/jcl-parser.js +217 -0
- package/dist/core/ingestion/cobol/jcl-processor.d.ts +33 -0
- package/dist/core/ingestion/cobol/jcl-processor.js +229 -0
- package/dist/core/ingestion/cobol-processor.d.ts +54 -0
- package/dist/core/ingestion/cobol-processor.js +1186 -0
- package/dist/core/ingestion/entry-point-scoring.d.ts +17 -0
- package/dist/core/ingestion/entry-point-scoring.js +52 -28
- package/dist/core/ingestion/export-detection.d.ts +47 -8
- package/dist/core/ingestion/export-detection.js +29 -50
- package/dist/core/ingestion/field-extractor.d.ts +29 -0
- package/dist/core/ingestion/field-extractor.js +25 -0
- package/dist/core/ingestion/field-extractors/configs/c-cpp.d.ts +3 -0
- package/dist/core/ingestion/field-extractors/configs/c-cpp.js +108 -0
- package/dist/core/ingestion/field-extractors/configs/csharp.d.ts +8 -0
- package/dist/core/ingestion/field-extractors/configs/csharp.js +73 -0
- package/dist/core/ingestion/field-extractors/configs/dart.d.ts +8 -0
- package/dist/core/ingestion/field-extractors/configs/dart.js +76 -0
- package/dist/core/ingestion/field-extractors/configs/go.d.ts +11 -0
- package/dist/core/ingestion/field-extractors/configs/go.js +64 -0
- package/dist/core/ingestion/field-extractors/configs/helpers.d.ts +44 -0
- package/dist/core/ingestion/field-extractors/configs/helpers.js +134 -0
- package/dist/core/ingestion/field-extractors/configs/jvm.d.ts +3 -0
- package/dist/core/ingestion/field-extractors/configs/jvm.js +118 -0
- package/dist/core/ingestion/field-extractors/configs/php.d.ts +8 -0
- package/dist/core/ingestion/field-extractors/configs/php.js +67 -0
- package/dist/core/ingestion/field-extractors/configs/python.d.ts +12 -0
- package/dist/core/ingestion/field-extractors/configs/python.js +91 -0
- package/dist/core/ingestion/field-extractors/configs/ruby.d.ts +16 -0
- package/dist/core/ingestion/field-extractors/configs/ruby.js +75 -0
- package/dist/core/ingestion/field-extractors/configs/rust.d.ts +9 -0
- package/dist/core/ingestion/field-extractors/configs/rust.js +55 -0
- package/dist/core/ingestion/field-extractors/configs/swift.d.ts +8 -0
- package/dist/core/ingestion/field-extractors/configs/swift.js +63 -0
- package/dist/core/ingestion/field-extractors/configs/typescript-javascript.d.ts +3 -0
- package/dist/core/ingestion/field-extractors/configs/typescript-javascript.js +60 -0
- package/dist/core/ingestion/field-extractors/generic.d.ts +46 -0
- package/dist/core/ingestion/field-extractors/generic.js +111 -0
- package/dist/core/ingestion/field-extractors/typescript.d.ts +77 -0
- package/dist/core/ingestion/field-extractors/typescript.js +291 -0
- package/dist/core/ingestion/field-types.d.ts +59 -0
- package/dist/core/ingestion/field-types.js +2 -0
- package/dist/core/ingestion/framework-detection.d.ts +97 -2
- package/dist/core/ingestion/framework-detection.js +114 -14
- package/dist/core/ingestion/heritage-processor.js +62 -66
- package/dist/core/ingestion/import-processor.d.ts +9 -10
- package/dist/core/ingestion/import-processor.js +150 -196
- package/dist/core/ingestion/{resolvers → import-resolvers}/csharp.d.ts +6 -9
- package/dist/core/ingestion/{resolvers → import-resolvers}/csharp.js +20 -2
- package/dist/core/ingestion/import-resolvers/dart.d.ts +7 -0
- package/dist/core/ingestion/import-resolvers/dart.js +44 -0
- package/dist/core/ingestion/{resolvers → import-resolvers}/go.d.ts +4 -5
- package/dist/core/ingestion/{resolvers → import-resolvers}/go.js +17 -0
- package/dist/core/ingestion/{resolvers → import-resolvers}/jvm.d.ts +10 -1
- package/dist/core/ingestion/import-resolvers/jvm.js +159 -0
- package/dist/core/ingestion/import-resolvers/php.d.ts +25 -0
- package/dist/core/ingestion/import-resolvers/php.js +80 -0
- package/dist/core/ingestion/{resolvers → import-resolvers}/python.d.ts +9 -3
- package/dist/core/ingestion/{resolvers → import-resolvers}/python.js +35 -3
- package/dist/core/ingestion/{resolvers → import-resolvers}/ruby.d.ts +5 -2
- package/dist/core/ingestion/{resolvers → import-resolvers}/ruby.js +7 -2
- package/dist/core/ingestion/{resolvers → import-resolvers}/rust.d.ts +5 -2
- package/dist/core/ingestion/{resolvers → import-resolvers}/rust.js +41 -2
- package/dist/core/ingestion/{resolvers → import-resolvers}/standard.d.ts +15 -7
- package/dist/core/ingestion/{resolvers → import-resolvers}/standard.js +22 -3
- package/dist/core/ingestion/import-resolvers/swift.d.ts +7 -0
- package/dist/core/ingestion/import-resolvers/swift.js +23 -0
- package/dist/core/ingestion/import-resolvers/types.d.ts +44 -0
- package/dist/core/ingestion/import-resolvers/types.js +6 -0
- package/dist/core/ingestion/{resolvers → import-resolvers}/utils.d.ts +2 -0
- package/dist/core/ingestion/{resolvers → import-resolvers}/utils.js +7 -0
- package/dist/core/ingestion/language-config.d.ts +6 -0
- package/dist/core/ingestion/language-config.js +13 -0
- package/dist/core/ingestion/language-provider.d.ts +121 -0
- package/dist/core/ingestion/language-provider.js +24 -0
- package/dist/core/ingestion/languages/c-cpp.d.ts +12 -0
- package/dist/core/ingestion/languages/c-cpp.js +71 -0
- package/dist/core/ingestion/languages/cobol.d.ts +1 -0
- package/dist/core/ingestion/languages/cobol.js +26 -0
- package/dist/core/ingestion/languages/csharp.d.ts +8 -0
- package/dist/core/ingestion/languages/csharp.js +49 -0
- package/dist/core/ingestion/languages/dart.d.ts +12 -0
- package/dist/core/ingestion/languages/dart.js +58 -0
- package/dist/core/ingestion/languages/go.d.ts +11 -0
- package/dist/core/ingestion/languages/go.js +28 -0
- package/dist/core/ingestion/languages/index.d.ts +38 -0
- package/dist/core/ingestion/languages/index.js +63 -0
- package/dist/core/ingestion/languages/java.d.ts +9 -0
- package/dist/core/ingestion/languages/java.js +29 -0
- package/dist/core/ingestion/languages/kotlin.d.ts +9 -0
- package/dist/core/ingestion/languages/kotlin.js +53 -0
- package/dist/core/ingestion/languages/php.d.ts +8 -0
- package/dist/core/ingestion/languages/php.js +145 -0
- package/dist/core/ingestion/languages/python.d.ts +12 -0
- package/dist/core/ingestion/languages/python.js +39 -0
- package/dist/core/ingestion/languages/ruby.d.ts +9 -0
- package/dist/core/ingestion/languages/ruby.js +44 -0
- package/dist/core/ingestion/languages/rust.d.ts +12 -0
- package/dist/core/ingestion/languages/rust.js +44 -0
- package/dist/core/ingestion/languages/swift.d.ts +12 -0
- package/dist/core/ingestion/languages/swift.js +133 -0
- package/dist/core/ingestion/languages/typescript.d.ts +10 -0
- package/dist/core/ingestion/languages/typescript.js +60 -0
- package/dist/core/ingestion/markdown-processor.d.ts +17 -0
- package/dist/core/ingestion/markdown-processor.js +124 -0
- package/dist/core/ingestion/mro-processor.js +22 -18
- package/dist/core/ingestion/named-binding-processor.d.ts +18 -0
- package/dist/core/ingestion/named-binding-processor.js +42 -0
- package/dist/core/ingestion/named-bindings/csharp.d.ts +3 -0
- package/dist/core/ingestion/named-bindings/csharp.js +37 -0
- package/dist/core/ingestion/named-bindings/java.d.ts +3 -0
- package/dist/core/ingestion/named-bindings/java.js +29 -0
- package/dist/core/ingestion/named-bindings/kotlin.d.ts +3 -0
- package/dist/core/ingestion/named-bindings/kotlin.js +36 -0
- package/dist/core/ingestion/named-bindings/php.d.ts +3 -0
- package/dist/core/ingestion/named-bindings/php.js +61 -0
- package/dist/core/ingestion/named-bindings/python.d.ts +3 -0
- package/dist/core/ingestion/named-bindings/python.js +49 -0
- package/dist/core/ingestion/named-bindings/rust.d.ts +3 -0
- package/dist/core/ingestion/named-bindings/rust.js +64 -0
- package/dist/core/ingestion/named-bindings/types.d.ts +16 -0
- package/dist/core/ingestion/named-bindings/types.js +6 -0
- package/dist/core/ingestion/named-bindings/typescript.d.ts +3 -0
- package/dist/core/ingestion/named-bindings/typescript.js +58 -0
- package/dist/core/ingestion/parsing-processor.d.ts +6 -2
- package/dist/core/ingestion/parsing-processor.js +125 -85
- package/dist/core/ingestion/pipeline.d.ts +10 -0
- package/dist/core/ingestion/pipeline.js +1235 -317
- package/dist/core/ingestion/resolution-context.d.ts +5 -0
- package/dist/core/ingestion/resolution-context.js +8 -5
- package/dist/core/ingestion/route-extractors/expo.d.ts +1 -0
- package/dist/core/ingestion/route-extractors/expo.js +36 -0
- package/dist/core/ingestion/route-extractors/middleware.d.ts +47 -0
- package/dist/core/ingestion/route-extractors/middleware.js +143 -0
- package/dist/core/ingestion/route-extractors/nextjs.d.ts +3 -0
- package/dist/core/ingestion/route-extractors/nextjs.js +76 -0
- package/dist/core/ingestion/route-extractors/php.d.ts +7 -0
- package/dist/core/ingestion/route-extractors/php.js +21 -0
- package/dist/core/ingestion/route-extractors/response-shapes.d.ts +20 -0
- package/dist/core/ingestion/route-extractors/response-shapes.js +290 -0
- package/dist/core/ingestion/symbol-table.d.ts +16 -0
- package/dist/core/ingestion/symbol-table.js +20 -6
- package/dist/core/ingestion/tree-sitter-queries.d.ts +10 -9
- package/dist/core/ingestion/tree-sitter-queries.js +274 -11
- package/dist/core/ingestion/type-env.d.ts +42 -18
- package/dist/core/ingestion/type-env.js +481 -106
- package/dist/core/ingestion/type-extractors/c-cpp.d.ts +5 -0
- package/dist/core/ingestion/type-extractors/c-cpp.js +119 -0
- package/dist/core/ingestion/type-extractors/csharp.js +149 -16
- package/dist/core/ingestion/type-extractors/dart.d.ts +15 -0
- package/dist/core/ingestion/type-extractors/dart.js +371 -0
- package/dist/core/ingestion/type-extractors/jvm.js +169 -66
- package/dist/core/ingestion/type-extractors/rust.js +35 -1
- package/dist/core/ingestion/type-extractors/shared.d.ts +1 -15
- package/dist/core/ingestion/type-extractors/shared.js +14 -112
- package/dist/core/ingestion/type-extractors/swift.js +338 -7
- package/dist/core/ingestion/type-extractors/types.d.ts +40 -8
- package/dist/core/ingestion/type-extractors/typescript.js +141 -9
- package/dist/core/ingestion/utils/ast-helpers.d.ts +83 -0
- package/dist/core/ingestion/utils/ast-helpers.js +817 -0
- package/dist/core/ingestion/utils/call-analysis.d.ts +73 -0
- package/dist/core/ingestion/utils/call-analysis.js +527 -0
- package/dist/core/ingestion/utils/event-loop.d.ts +5 -0
- package/dist/core/ingestion/utils/event-loop.js +5 -0
- package/dist/core/ingestion/utils/language-detection.d.ts +9 -0
- package/dist/core/ingestion/utils/language-detection.js +70 -0
- package/dist/core/ingestion/utils/verbose.d.ts +1 -0
- package/dist/core/ingestion/utils/verbose.js +7 -0
- package/dist/core/ingestion/workers/parse-worker.d.ts +55 -5
- package/dist/core/ingestion/workers/parse-worker.js +415 -225
- package/dist/core/lbug/csv-generator.js +51 -1
- package/dist/core/lbug/lbug-adapter.d.ts +10 -0
- package/dist/core/lbug/lbug-adapter.js +75 -4
- package/dist/core/lbug/schema.d.ts +8 -4
- package/dist/core/lbug/schema.js +65 -4
- package/dist/core/tree-sitter/parser-loader.js +7 -1
- package/dist/core/wiki/cursor-client.d.ts +31 -0
- package/dist/core/wiki/cursor-client.js +127 -0
- package/dist/core/wiki/generator.d.ts +28 -9
- package/dist/core/wiki/generator.js +115 -18
- package/dist/core/wiki/graph-queries.d.ts +4 -0
- package/dist/core/wiki/graph-queries.js +7 -1
- package/dist/core/wiki/llm-client.d.ts +2 -0
- package/dist/core/wiki/llm-client.js +8 -4
- package/dist/core/wiki/prompts.d.ts +3 -3
- package/dist/core/wiki/prompts.js +6 -0
- package/dist/mcp/core/embedder.js +11 -3
- package/dist/mcp/core/lbug-adapter.d.ts +5 -0
- package/dist/mcp/core/lbug-adapter.js +23 -2
- package/dist/mcp/local/local-backend.d.ts +38 -5
- package/dist/mcp/local/local-backend.js +804 -63
- package/dist/mcp/resources.js +2 -0
- package/dist/mcp/tools.js +73 -4
- package/dist/server/api.d.ts +19 -1
- package/dist/server/api.js +66 -6
- package/dist/storage/git.d.ts +12 -0
- package/dist/storage/git.js +21 -0
- package/dist/storage/repo-manager.d.ts +3 -0
- package/package.json +25 -16
- package/dist/core/ingestion/named-binding-extraction.d.ts +0 -61
- package/dist/core/ingestion/named-binding-extraction.js +0 -363
- package/dist/core/ingestion/resolvers/index.d.ts +0 -18
- package/dist/core/ingestion/resolvers/index.js +0 -13
- package/dist/core/ingestion/resolvers/jvm.js +0 -87
- package/dist/core/ingestion/resolvers/php.d.ts +0 -15
- package/dist/core/ingestion/resolvers/php.js +0 -35
- package/dist/core/ingestion/type-extractors/index.d.ts +0 -22
- package/dist/core/ingestion/type-extractors/index.js +0 -31
- package/dist/core/ingestion/utils.d.ts +0 -138
- package/dist/core/ingestion/utils.js +0 -1290
- package/scripts/patch-tree-sitter-swift.cjs +0 -74
|
@@ -15,19 +15,19 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import Parser from 'tree-sitter';
|
|
17
17
|
import { isLanguageAvailable, loadParser, loadLanguage } from '../tree-sitter/parser-loader.js';
|
|
18
|
-
import { LANGUAGE_QUERIES } from './tree-sitter-queries.js';
|
|
19
18
|
import { generateId } from '../../lib/utils.js';
|
|
20
|
-
import { getLanguageFromFilename
|
|
21
|
-
import {
|
|
19
|
+
import { getLanguageFromFilename } from './utils/language-detection.js';
|
|
20
|
+
import { isVerboseIngestionEnabled } from './utils/verbose.js';
|
|
21
|
+
import { yieldToEventLoop } from './utils/event-loop.js';
|
|
22
|
+
import { getProvider } from './languages/index.js';
|
|
22
23
|
import { getTreeSitterBufferSize } from './constants.js';
|
|
23
|
-
|
|
24
|
-
const INTERFACE_NAME_RE = /^I[A-Z]/;
|
|
24
|
+
import { TIER_CONFIDENCE } from './resolution-context.js';
|
|
25
25
|
/**
|
|
26
26
|
* Determine whether a heritage.extends capture is actually an IMPLEMENTS relationship.
|
|
27
|
-
* Uses the symbol table first (authoritative — Tier 1); falls back to
|
|
28
|
-
*
|
|
29
|
-
* -
|
|
30
|
-
* -
|
|
27
|
+
* Uses the symbol table first (authoritative — Tier 1); falls back to provider-defined
|
|
28
|
+
* heuristics for external symbols not present in the graph:
|
|
29
|
+
* - interfaceNamePattern: matched against parent name (e.g., /^I[A-Z]/ for C#/Java)
|
|
30
|
+
* - heritageDefaultEdge: 'IMPLEMENTS' causes all unresolved parents to map to IMPLEMENTS
|
|
31
31
|
* - All others: default EXTENDS
|
|
32
32
|
*/
|
|
33
33
|
const resolveExtendsType = (parentName, currentFilePath, ctx, language) => {
|
|
@@ -38,32 +38,27 @@ const resolveExtendsType = (parentName, currentFilePath, ctx, language) => {
|
|
|
38
38
|
? { type: 'IMPLEMENTS', idPrefix: 'Interface' }
|
|
39
39
|
: { type: 'EXTENDS', idPrefix: 'Class' };
|
|
40
40
|
}
|
|
41
|
-
// Unresolved symbol — fall back to
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
41
|
+
// Unresolved symbol — fall back to provider-defined heuristics
|
|
42
|
+
const provider = getProvider(language);
|
|
43
|
+
if (provider.interfaceNamePattern?.test(parentName)) {
|
|
44
|
+
return { type: 'IMPLEMENTS', idPrefix: 'Interface' };
|
|
46
45
|
}
|
|
47
|
-
|
|
48
|
-
// Protocol conformance is far more common than class inheritance in Swift
|
|
46
|
+
if (provider.heritageDefaultEdge === 'IMPLEMENTS') {
|
|
49
47
|
return { type: 'IMPLEMENTS', idPrefix: 'Interface' };
|
|
50
48
|
}
|
|
51
49
|
return { type: 'EXTENDS', idPrefix: 'Class' };
|
|
52
50
|
};
|
|
53
|
-
/**
|
|
54
|
-
* Resolve a symbol ID for heritage, with fallback to generated ID.
|
|
55
|
-
* Uses ctx.resolve() → pick first candidate's nodeId → generate synthetic ID.
|
|
56
|
-
*/
|
|
57
51
|
const resolveHeritageId = (name, filePath, ctx, fallbackLabel, fallbackKey) => {
|
|
58
52
|
const resolved = ctx.resolve(name, filePath);
|
|
59
53
|
if (resolved && resolved.candidates.length > 0) {
|
|
60
54
|
// For global with multiple candidates, refuse (a wrong edge is worse than no edge)
|
|
61
55
|
if (resolved.tier === 'global' && resolved.candidates.length > 1) {
|
|
62
|
-
return generateId(fallbackLabel, fallbackKey ?? name);
|
|
56
|
+
return { id: generateId(fallbackLabel, fallbackKey ?? name), confidence: TIER_CONFIDENCE['global'] };
|
|
63
57
|
}
|
|
64
|
-
return resolved.candidates[0].nodeId;
|
|
58
|
+
return { id: resolved.candidates[0].nodeId, confidence: TIER_CONFIDENCE[resolved.tier] };
|
|
65
59
|
}
|
|
66
|
-
|
|
60
|
+
// Unresolved: use global-tier confidence as fallback
|
|
61
|
+
return { id: generateId(fallbackLabel, fallbackKey ?? name), confidence: TIER_CONFIDENCE['global'] };
|
|
67
62
|
};
|
|
68
63
|
export const processHeritage = async (graph, files, astCache, ctx, onProgress) => {
|
|
69
64
|
const parser = await loadParser();
|
|
@@ -84,7 +79,8 @@ export const processHeritage = async (graph, files, astCache, ctx, onProgress) =
|
|
|
84
79
|
}
|
|
85
80
|
continue;
|
|
86
81
|
}
|
|
87
|
-
const
|
|
82
|
+
const provider = getProvider(language);
|
|
83
|
+
const queryStr = provider.treeSitterQueries;
|
|
88
84
|
if (!queryStr)
|
|
89
85
|
continue;
|
|
90
86
|
// 2. Load the language
|
|
@@ -132,15 +128,15 @@ export const processHeritage = async (graph, files, astCache, ctx, onProgress) =
|
|
|
132
128
|
const className = captureMap['heritage.class'].text;
|
|
133
129
|
const parentClassName = captureMap['heritage.extends'].text;
|
|
134
130
|
const { type: relType, idPrefix } = resolveExtendsType(parentClassName, file.path, ctx, language);
|
|
135
|
-
const
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
131
|
+
const child = resolveHeritageId(className, file.path, ctx, 'Class', `${file.path}:${className}`);
|
|
132
|
+
const parent = resolveHeritageId(parentClassName, file.path, ctx, idPrefix);
|
|
133
|
+
if (child.id && parent.id && child.id !== parent.id) {
|
|
138
134
|
graph.addRelationship({
|
|
139
|
-
id: generateId(relType, `${
|
|
140
|
-
sourceId:
|
|
141
|
-
targetId:
|
|
135
|
+
id: generateId(relType, `${child.id}->${parent.id}`),
|
|
136
|
+
sourceId: child.id,
|
|
137
|
+
targetId: parent.id,
|
|
142
138
|
type: relType,
|
|
143
|
-
confidence:
|
|
139
|
+
confidence: Math.sqrt(child.confidence * parent.confidence),
|
|
144
140
|
reason: '',
|
|
145
141
|
});
|
|
146
142
|
}
|
|
@@ -149,15 +145,15 @@ export const processHeritage = async (graph, files, astCache, ctx, onProgress) =
|
|
|
149
145
|
if (captureMap['heritage.class'] && captureMap['heritage.implements']) {
|
|
150
146
|
const className = captureMap['heritage.class'].text;
|
|
151
147
|
const interfaceName = captureMap['heritage.implements'].text;
|
|
152
|
-
const
|
|
153
|
-
const
|
|
154
|
-
if (
|
|
148
|
+
const cls = resolveHeritageId(className, file.path, ctx, 'Class', `${file.path}:${className}`);
|
|
149
|
+
const iface = resolveHeritageId(interfaceName, file.path, ctx, 'Interface');
|
|
150
|
+
if (cls.id && iface.id) {
|
|
155
151
|
graph.addRelationship({
|
|
156
|
-
id: generateId('IMPLEMENTS', `${
|
|
157
|
-
sourceId:
|
|
158
|
-
targetId:
|
|
152
|
+
id: generateId('IMPLEMENTS', `${cls.id}->${iface.id}`),
|
|
153
|
+
sourceId: cls.id,
|
|
154
|
+
targetId: iface.id,
|
|
159
155
|
type: 'IMPLEMENTS',
|
|
160
|
-
confidence:
|
|
156
|
+
confidence: Math.sqrt(cls.confidence * iface.confidence),
|
|
161
157
|
reason: '',
|
|
162
158
|
});
|
|
163
159
|
}
|
|
@@ -166,15 +162,15 @@ export const processHeritage = async (graph, files, astCache, ctx, onProgress) =
|
|
|
166
162
|
if (captureMap['heritage.trait'] && captureMap['heritage.class']) {
|
|
167
163
|
const structName = captureMap['heritage.class'].text;
|
|
168
164
|
const traitName = captureMap['heritage.trait'].text;
|
|
169
|
-
const
|
|
170
|
-
const
|
|
171
|
-
if (
|
|
165
|
+
const strct = resolveHeritageId(structName, file.path, ctx, 'Struct', `${file.path}:${structName}`);
|
|
166
|
+
const trait = resolveHeritageId(traitName, file.path, ctx, 'Trait');
|
|
167
|
+
if (strct.id && trait.id) {
|
|
172
168
|
graph.addRelationship({
|
|
173
|
-
id: generateId('IMPLEMENTS', `${
|
|
174
|
-
sourceId:
|
|
175
|
-
targetId:
|
|
169
|
+
id: generateId('IMPLEMENTS', `${strct.id}->${trait.id}`),
|
|
170
|
+
sourceId: strct.id,
|
|
171
|
+
targetId: trait.id,
|
|
176
172
|
type: 'IMPLEMENTS',
|
|
177
|
-
confidence:
|
|
173
|
+
confidence: Math.sqrt(strct.confidence * trait.confidence),
|
|
178
174
|
reason: 'trait-impl',
|
|
179
175
|
});
|
|
180
176
|
}
|
|
@@ -205,43 +201,43 @@ export const processHeritageFromExtracted = async (graph, extractedHeritage, ctx
|
|
|
205
201
|
if (!fileLanguage)
|
|
206
202
|
continue;
|
|
207
203
|
const { type: relType, idPrefix } = resolveExtendsType(h.parentName, h.filePath, ctx, fileLanguage);
|
|
208
|
-
const
|
|
209
|
-
const
|
|
210
|
-
if (
|
|
204
|
+
const child = resolveHeritageId(h.className, h.filePath, ctx, 'Class', `${h.filePath}:${h.className}`);
|
|
205
|
+
const parent = resolveHeritageId(h.parentName, h.filePath, ctx, idPrefix);
|
|
206
|
+
if (child.id && parent.id && child.id !== parent.id) {
|
|
211
207
|
graph.addRelationship({
|
|
212
|
-
id: generateId(relType, `${
|
|
213
|
-
sourceId:
|
|
214
|
-
targetId:
|
|
208
|
+
id: generateId(relType, `${child.id}->${parent.id}`),
|
|
209
|
+
sourceId: child.id,
|
|
210
|
+
targetId: parent.id,
|
|
215
211
|
type: relType,
|
|
216
|
-
confidence:
|
|
212
|
+
confidence: Math.sqrt(child.confidence * parent.confidence),
|
|
217
213
|
reason: '',
|
|
218
214
|
});
|
|
219
215
|
}
|
|
220
216
|
}
|
|
221
217
|
else if (h.kind === 'implements') {
|
|
222
|
-
const
|
|
223
|
-
const
|
|
224
|
-
if (
|
|
218
|
+
const cls = resolveHeritageId(h.className, h.filePath, ctx, 'Class', `${h.filePath}:${h.className}`);
|
|
219
|
+
const iface = resolveHeritageId(h.parentName, h.filePath, ctx, 'Interface');
|
|
220
|
+
if (cls.id && iface.id) {
|
|
225
221
|
graph.addRelationship({
|
|
226
|
-
id: generateId('IMPLEMENTS', `${
|
|
227
|
-
sourceId:
|
|
228
|
-
targetId:
|
|
222
|
+
id: generateId('IMPLEMENTS', `${cls.id}->${iface.id}`),
|
|
223
|
+
sourceId: cls.id,
|
|
224
|
+
targetId: iface.id,
|
|
229
225
|
type: 'IMPLEMENTS',
|
|
230
|
-
confidence:
|
|
226
|
+
confidence: Math.sqrt(cls.confidence * iface.confidence),
|
|
231
227
|
reason: '',
|
|
232
228
|
});
|
|
233
229
|
}
|
|
234
230
|
}
|
|
235
231
|
else if (h.kind === 'trait-impl' || h.kind === 'include' || h.kind === 'extend' || h.kind === 'prepend') {
|
|
236
|
-
const
|
|
237
|
-
const
|
|
238
|
-
if (
|
|
232
|
+
const strct = resolveHeritageId(h.className, h.filePath, ctx, 'Struct', `${h.filePath}:${h.className}`);
|
|
233
|
+
const trait = resolveHeritageId(h.parentName, h.filePath, ctx, 'Trait');
|
|
234
|
+
if (strct.id && trait.id) {
|
|
239
235
|
graph.addRelationship({
|
|
240
|
-
id: generateId('IMPLEMENTS', `${
|
|
241
|
-
sourceId:
|
|
242
|
-
targetId:
|
|
236
|
+
id: generateId('IMPLEMENTS', `${strct.id}->${trait.id}:${h.kind}`),
|
|
237
|
+
sourceId: strct.id,
|
|
238
|
+
targetId: trait.id,
|
|
243
239
|
type: 'IMPLEMENTS',
|
|
244
|
-
confidence:
|
|
240
|
+
confidence: Math.sqrt(strct.confidence * trait.confidence),
|
|
245
241
|
reason: h.kind,
|
|
246
242
|
});
|
|
247
243
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { KnowledgeGraph } from '../graph/types.js';
|
|
2
2
|
import { ASTCache } from './ast-cache.js';
|
|
3
|
+
import type { LanguageProvider } from './language-provider.js';
|
|
3
4
|
import type { ExtractedImport } from './workers/parse-worker.js';
|
|
4
5
|
import type { ResolutionContext } from './resolution-context.js';
|
|
5
|
-
import type {
|
|
6
|
-
|
|
6
|
+
import type { ImportResolutionContext } from './import-resolvers/types.js';
|
|
7
|
+
import type { SyntaxNode } from './utils/ast-helpers.js';
|
|
7
8
|
export type ImportMap = Map<string, Set<string>>;
|
|
8
9
|
export type PackageMap = Map<string, Set<string>>;
|
|
9
10
|
export interface NamedImportBinding {
|
|
@@ -16,15 +17,13 @@ export type NamedImportMap = Map<string, Map<string, NamedImportBinding>>;
|
|
|
16
17
|
* Used by the symbol resolver for Go and C# directory-level import matching.
|
|
17
18
|
*/
|
|
18
19
|
export declare function isFileInPackageDir(filePath: string, dirSuffix: string): boolean;
|
|
19
|
-
/** Pre-built lookup structures for import resolution. Build once, reuse across chunks. */
|
|
20
|
-
export interface ImportResolutionContext {
|
|
21
|
-
allFilePaths: Set<string>;
|
|
22
|
-
allFileList: string[];
|
|
23
|
-
normalizedFileList: string[];
|
|
24
|
-
suffixIndex: SuffixIndex;
|
|
25
|
-
resolveCache: Map<string, string | null>;
|
|
26
|
-
}
|
|
27
20
|
export declare function buildImportResolutionContext(allPaths: string[]): ImportResolutionContext;
|
|
21
|
+
/**
|
|
22
|
+
* Clean and preprocess a raw import source text into a resolved import path.
|
|
23
|
+
* Strips quotes/angle brackets (universal) and applies provider-specific
|
|
24
|
+
* transformations (currently only Kotlin wildcard import detection).
|
|
25
|
+
*/
|
|
26
|
+
export declare function preprocessImportPath(sourceText: string, importNode: SyntaxNode, provider: LanguageProvider): string | null;
|
|
28
27
|
export declare const processImports: (graph: KnowledgeGraph, files: {
|
|
29
28
|
path: string;
|
|
30
29
|
content: string;
|