gitnexus 1.5.3 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/dist/_shared/graph/types.d.ts +1 -1
- package/dist/_shared/graph/types.d.ts.map +1 -1
- package/dist/_shared/index.d.ts +1 -0
- package/dist/_shared/index.d.ts.map +1 -1
- package/dist/_shared/language-detection.d.ts.map +1 -1
- package/dist/_shared/language-detection.js +2 -0
- package/dist/_shared/language-detection.js.map +1 -1
- package/dist/_shared/languages.d.ts +1 -0
- package/dist/_shared/languages.d.ts.map +1 -1
- package/dist/_shared/languages.js +1 -0
- package/dist/_shared/languages.js.map +1 -1
- package/dist/_shared/lbug/schema-constants.d.ts +1 -1
- package/dist/_shared/lbug/schema-constants.d.ts.map +1 -1
- package/dist/_shared/lbug/schema-constants.js +3 -1
- package/dist/_shared/lbug/schema-constants.js.map +1 -1
- package/dist/_shared/mro-strategy.d.ts +19 -0
- package/dist/_shared/mro-strategy.d.ts.map +1 -0
- package/dist/_shared/mro-strategy.js +2 -0
- package/dist/_shared/mro-strategy.js.map +1 -0
- package/dist/cli/ai-context.d.ts +1 -0
- package/dist/cli/ai-context.js +28 -4
- package/dist/cli/analyze.d.ts +2 -0
- package/dist/cli/analyze.js +2 -1
- package/dist/cli/group.d.ts +2 -0
- package/dist/cli/group.js +233 -0
- package/dist/cli/index.js +3 -0
- package/dist/cli/serve.js +4 -1
- package/dist/cli/setup.js +34 -3
- package/dist/config/ignore-service.js +8 -3
- package/dist/core/augmentation/engine.js +1 -1
- package/dist/core/git-staleness.d.ts +13 -0
- package/dist/core/git-staleness.js +29 -0
- package/dist/core/group/bridge-db.d.ts +82 -0
- package/dist/core/group/bridge-db.js +460 -0
- package/dist/core/group/bridge-schema.d.ts +27 -0
- package/dist/core/group/bridge-schema.js +55 -0
- package/dist/core/group/config-parser.d.ts +3 -0
- package/dist/core/group/config-parser.js +83 -0
- package/dist/core/group/contract-extractor.d.ts +7 -0
- package/dist/core/group/contract-extractor.js +1 -0
- package/dist/core/group/extractors/grpc-extractor.d.ts +16 -0
- package/dist/core/group/extractors/grpc-extractor.js +264 -0
- package/dist/core/group/extractors/http-route-extractor.d.ts +24 -0
- package/dist/core/group/extractors/http-route-extractor.js +428 -0
- package/dist/core/group/extractors/topic-extractor.d.ts +9 -0
- package/dist/core/group/extractors/topic-extractor.js +234 -0
- package/dist/core/group/matching.d.ts +13 -0
- package/dist/core/group/matching.js +198 -0
- package/dist/core/group/normalization.d.ts +3 -0
- package/dist/core/group/normalization.js +115 -0
- package/dist/core/group/service-boundary-detector.d.ts +8 -0
- package/dist/core/group/service-boundary-detector.js +155 -0
- package/dist/core/group/service.d.ts +46 -0
- package/dist/core/group/service.js +160 -0
- package/dist/core/group/storage.d.ts +9 -0
- package/dist/core/group/storage.js +91 -0
- package/dist/core/group/sync.d.ts +21 -0
- package/dist/core/group/sync.js +148 -0
- package/dist/core/group/types.d.ts +130 -0
- package/dist/core/group/types.js +1 -0
- package/dist/core/ingestion/binding-accumulator.d.ts +207 -0
- package/dist/core/ingestion/binding-accumulator.js +332 -0
- package/dist/core/ingestion/call-processor.d.ts +155 -24
- package/dist/core/ingestion/call-processor.js +1129 -247
- package/dist/core/ingestion/class-extractors/generic.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/generic.js +135 -0
- package/dist/core/ingestion/class-types.d.ts +34 -0
- package/dist/core/ingestion/class-types.js +1 -0
- package/dist/core/ingestion/entry-point-scoring.d.ts +1 -0
- package/dist/core/ingestion/entry-point-scoring.js +1 -0
- package/dist/core/ingestion/field-types.d.ts +2 -2
- package/dist/core/ingestion/filesystem-walker.js +8 -0
- package/dist/core/ingestion/framework-detection.d.ts +1 -0
- package/dist/core/ingestion/framework-detection.js +1 -0
- package/dist/core/ingestion/heritage-processor.d.ts +8 -15
- package/dist/core/ingestion/heritage-processor.js +15 -28
- package/dist/core/ingestion/import-processor.d.ts +1 -11
- package/dist/core/ingestion/import-processor.js +0 -12
- package/dist/core/ingestion/import-resolvers/utils.js +1 -0
- package/dist/core/ingestion/import-resolvers/vue.d.ts +8 -0
- package/dist/core/ingestion/import-resolvers/vue.js +9 -0
- package/dist/core/ingestion/language-provider.d.ts +6 -3
- package/dist/core/ingestion/languages/c-cpp.js +168 -1
- package/dist/core/ingestion/languages/csharp.js +20 -0
- package/dist/core/ingestion/languages/dart.js +26 -4
- package/dist/core/ingestion/languages/go.js +22 -0
- package/dist/core/ingestion/languages/index.d.ts +1 -0
- package/dist/core/ingestion/languages/index.js +2 -0
- package/dist/core/ingestion/languages/java.js +17 -0
- package/dist/core/ingestion/languages/kotlin.js +24 -1
- package/dist/core/ingestion/languages/php.js +23 -11
- package/dist/core/ingestion/languages/python.js +9 -0
- package/dist/core/ingestion/languages/ruby.js +28 -0
- package/dist/core/ingestion/languages/rust.js +38 -0
- package/dist/core/ingestion/languages/swift.js +31 -0
- package/dist/core/ingestion/languages/typescript.d.ts +1 -0
- package/dist/core/ingestion/languages/typescript.js +52 -3
- package/dist/core/ingestion/languages/vue.d.ts +13 -0
- package/dist/core/ingestion/languages/vue.js +81 -0
- package/dist/core/ingestion/method-extractors/configs/c-cpp.d.ts +3 -0
- package/dist/core/ingestion/method-extractors/configs/c-cpp.js +387 -0
- package/dist/core/ingestion/method-extractors/configs/csharp.js +5 -1
- package/dist/core/ingestion/method-extractors/configs/dart.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/dart.js +376 -0
- package/dist/core/ingestion/method-extractors/configs/go.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/go.js +176 -0
- package/dist/core/ingestion/method-extractors/configs/jvm.js +13 -4
- package/dist/core/ingestion/method-extractors/configs/php.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/php.js +304 -0
- package/dist/core/ingestion/method-extractors/configs/python.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/python.js +309 -0
- package/dist/core/ingestion/method-extractors/configs/ruby.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/ruby.js +285 -0
- package/dist/core/ingestion/method-extractors/configs/rust.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/rust.js +195 -0
- package/dist/core/ingestion/method-extractors/configs/swift.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/swift.js +277 -0
- package/dist/core/ingestion/method-extractors/configs/typescript-javascript.js +85 -8
- package/dist/core/ingestion/method-extractors/generic.js +38 -15
- package/dist/core/ingestion/method-types.d.ts +25 -0
- package/dist/core/ingestion/model/field-registry.d.ts +18 -0
- package/dist/core/ingestion/model/field-registry.js +22 -0
- package/dist/core/ingestion/model/heritage-map.d.ts +70 -0
- package/dist/core/ingestion/model/heritage-map.js +159 -0
- package/dist/core/ingestion/model/index.d.ts +20 -0
- package/dist/core/ingestion/model/index.js +41 -0
- package/dist/core/ingestion/model/method-registry.d.ts +62 -0
- package/dist/core/ingestion/model/method-registry.js +130 -0
- package/dist/core/ingestion/model/registration-table.d.ts +139 -0
- package/dist/core/ingestion/model/registration-table.js +224 -0
- package/dist/core/ingestion/model/resolution-context.d.ts +93 -0
- package/dist/core/ingestion/model/resolution-context.js +337 -0
- package/dist/core/ingestion/model/resolve.d.ts +56 -0
- package/dist/core/ingestion/model/resolve.js +242 -0
- package/dist/core/ingestion/model/semantic-model.d.ts +86 -0
- package/dist/core/ingestion/model/semantic-model.js +120 -0
- package/dist/core/ingestion/model/symbol-table.d.ts +222 -0
- package/dist/core/ingestion/model/symbol-table.js +206 -0
- package/dist/core/ingestion/model/type-registry.d.ts +39 -0
- package/dist/core/ingestion/model/type-registry.js +62 -0
- package/dist/core/ingestion/mro-processor.d.ts +4 -3
- package/dist/core/ingestion/mro-processor.js +310 -106
- package/dist/core/ingestion/parsing-processor.d.ts +5 -4
- package/dist/core/ingestion/parsing-processor.js +210 -85
- package/dist/core/ingestion/pipeline.d.ts +2 -0
- package/dist/core/ingestion/pipeline.js +192 -68
- package/dist/core/ingestion/tree-sitter-queries.d.ts +5 -5
- package/dist/core/ingestion/tree-sitter-queries.js +21 -0
- package/dist/core/ingestion/type-env.d.ts +15 -2
- package/dist/core/ingestion/type-env.js +163 -102
- package/dist/core/ingestion/type-extractors/csharp.js +17 -0
- package/dist/core/ingestion/type-extractors/jvm.js +11 -0
- package/dist/core/ingestion/type-extractors/php.js +0 -55
- package/dist/core/ingestion/type-extractors/ruby.js +0 -32
- package/dist/core/ingestion/type-extractors/swift.js +13 -0
- package/dist/core/ingestion/type-extractors/types.d.ts +8 -8
- package/dist/core/ingestion/type-extractors/typescript.js +66 -69
- package/dist/core/ingestion/utils/ast-helpers.d.ts +33 -43
- package/dist/core/ingestion/utils/ast-helpers.js +129 -572
- package/dist/core/ingestion/utils/method-props.d.ts +32 -0
- package/dist/core/ingestion/utils/method-props.js +147 -0
- package/dist/core/ingestion/vue-sfc-extractor.d.ts +44 -0
- package/dist/core/ingestion/vue-sfc-extractor.js +94 -0
- package/dist/core/ingestion/workers/parse-worker.d.ts +31 -19
- package/dist/core/ingestion/workers/parse-worker.js +463 -198
- package/dist/core/lbug/lbug-adapter.d.ts +6 -0
- package/dist/core/lbug/lbug-adapter.js +68 -3
- package/dist/core/lbug/pool-adapter.d.ts +76 -0
- package/dist/core/lbug/pool-adapter.js +522 -0
- package/dist/core/run-analyze.d.ts +2 -0
- package/dist/core/run-analyze.js +1 -1
- package/dist/core/search/bm25-index.js +1 -1
- package/dist/core/tree-sitter/parser-loader.js +1 -0
- package/dist/core/wiki/graph-queries.js +1 -1
- package/dist/mcp/core/embedder.js +6 -5
- package/dist/mcp/core/lbug-adapter.d.ts +3 -63
- package/dist/mcp/core/lbug-adapter.js +3 -484
- package/dist/mcp/local/local-backend.d.ts +31 -2
- package/dist/mcp/local/local-backend.js +255 -46
- package/dist/mcp/resources.js +5 -4
- package/dist/mcp/staleness.d.ts +3 -13
- package/dist/mcp/staleness.js +2 -31
- package/dist/mcp/tools.js +80 -4
- package/dist/server/analyze-job.d.ts +2 -0
- package/dist/server/analyze-job.js +4 -0
- package/dist/server/api.d.ts +20 -1
- package/dist/server/api.js +306 -71
- package/dist/server/git-clone.d.ts +2 -1
- package/dist/server/git-clone.js +98 -5
- package/dist/storage/git.d.ts +13 -0
- package/dist/storage/git.js +25 -0
- package/dist/storage/repo-manager.js +1 -1
- package/package.json +8 -2
- package/scripts/patch-tree-sitter-swift.cjs +78 -0
- package/dist/core/ingestion/named-binding-processor.d.ts +0 -18
- package/dist/core/ingestion/named-binding-processor.js +0 -42
- package/dist/core/ingestion/resolution-context.d.ts +0 -58
- package/dist/core/ingestion/resolution-context.js +0 -135
- package/dist/core/ingestion/symbol-table.d.ts +0 -79
- package/dist/core/ingestion/symbol-table.js +0 -115
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
const DEFAULT_SCOPE_NAME_NODE_TYPES = new Set([
|
|
2
|
+
'nested_namespace_specifier',
|
|
3
|
+
'scoped_identifier',
|
|
4
|
+
'scoped_type_identifier',
|
|
5
|
+
'qualified_name',
|
|
6
|
+
'namespace_name',
|
|
7
|
+
'namespace_identifier',
|
|
8
|
+
'package_identifier',
|
|
9
|
+
'type_identifier',
|
|
10
|
+
'identifier',
|
|
11
|
+
'name',
|
|
12
|
+
'constant',
|
|
13
|
+
]);
|
|
14
|
+
const DEFAULT_TYPE_NAME_NODE_TYPES = new Set([
|
|
15
|
+
'type_identifier',
|
|
16
|
+
'identifier',
|
|
17
|
+
'simple_identifier',
|
|
18
|
+
'namespace_identifier',
|
|
19
|
+
'constant',
|
|
20
|
+
'name',
|
|
21
|
+
]);
|
|
22
|
+
const DEFAULT_LABEL_BY_NODE_TYPE = {
|
|
23
|
+
class_declaration: 'Class',
|
|
24
|
+
abstract_class_declaration: 'Class',
|
|
25
|
+
interface_declaration: 'Interface',
|
|
26
|
+
struct_declaration: 'Struct',
|
|
27
|
+
record_declaration: 'Record',
|
|
28
|
+
enum_declaration: 'Enum',
|
|
29
|
+
class_definition: 'Class',
|
|
30
|
+
struct_specifier: 'Struct',
|
|
31
|
+
class_specifier: 'Class',
|
|
32
|
+
enum_specifier: 'Enum',
|
|
33
|
+
struct_item: 'Struct',
|
|
34
|
+
enum_item: 'Enum',
|
|
35
|
+
class: 'Class',
|
|
36
|
+
object_declaration: 'Class',
|
|
37
|
+
companion_object: 'Class',
|
|
38
|
+
protocol_declaration: 'Interface',
|
|
39
|
+
extension_declaration: 'Class',
|
|
40
|
+
};
|
|
41
|
+
const CLASS_LIKE_LABELS = new Set([
|
|
42
|
+
'Class',
|
|
43
|
+
'Struct',
|
|
44
|
+
'Interface',
|
|
45
|
+
'Enum',
|
|
46
|
+
'Record',
|
|
47
|
+
]);
|
|
48
|
+
const normalizeQualifiedName = (value) => value
|
|
49
|
+
.replace(/\s+/g, '')
|
|
50
|
+
.replace(/^::/, '')
|
|
51
|
+
.replace(/::/g, '.')
|
|
52
|
+
.replace(/\\/g, '.')
|
|
53
|
+
.replace(/\.+/g, '.')
|
|
54
|
+
.replace(/^\.+|\.+$/g, '');
|
|
55
|
+
const splitQualifiedName = (value) => {
|
|
56
|
+
const normalized = normalizeQualifiedName(value);
|
|
57
|
+
return normalized ? normalized.split('.').filter(Boolean) : [];
|
|
58
|
+
};
|
|
59
|
+
const extractScopeSegmentsFromNode = (scopeNode, scopeNameNodeTypes) => {
|
|
60
|
+
const nameNode = scopeNode.childForFieldName?.('name') ??
|
|
61
|
+
scopeNode.namedChildren?.find((child) => scopeNameNodeTypes.has(child.type));
|
|
62
|
+
return nameNode ? splitQualifiedName(nameNode.text) : [];
|
|
63
|
+
};
|
|
64
|
+
const extractTypeNameFromNode = (node) => {
|
|
65
|
+
const nameField = node.childForFieldName?.('name');
|
|
66
|
+
if (nameField)
|
|
67
|
+
return nameField.text;
|
|
68
|
+
const nameChild = node.namedChildren?.find((child) => DEFAULT_TYPE_NAME_NODE_TYPES.has(child.type));
|
|
69
|
+
return nameChild?.text;
|
|
70
|
+
};
|
|
71
|
+
const isClassLikeLabel = (label) => label !== undefined && label !== null && CLASS_LIKE_LABELS.has(label);
|
|
72
|
+
export function createClassExtractor(config) {
|
|
73
|
+
const typeDeclarationSet = new Set(config.typeDeclarationNodes);
|
|
74
|
+
const fileScopeSet = new Set(config.fileScopeNodeTypes ?? []);
|
|
75
|
+
const ancestorScopeSet = new Set(config.ancestorScopeNodeTypes ?? []);
|
|
76
|
+
const scopeNameNodeTypes = new Set([
|
|
77
|
+
...DEFAULT_SCOPE_NAME_NODE_TYPES,
|
|
78
|
+
...(config.scopeNameNodeTypes ?? []),
|
|
79
|
+
]);
|
|
80
|
+
const buildQualifiedName = (node, simpleName) => {
|
|
81
|
+
let root = node;
|
|
82
|
+
while (root.parent)
|
|
83
|
+
root = root.parent;
|
|
84
|
+
const readScopeSegments = (scopeNode) => config.extractScopeSegments?.(scopeNode) ??
|
|
85
|
+
extractScopeSegmentsFromNode(scopeNode, scopeNameNodeTypes);
|
|
86
|
+
const fileScopeSegments = [];
|
|
87
|
+
for (const child of root.namedChildren ?? []) {
|
|
88
|
+
if (fileScopeSet.has(child.type)) {
|
|
89
|
+
fileScopeSegments.push(...readScopeSegments(child));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const ancestorScopes = [];
|
|
93
|
+
let current = node.parent;
|
|
94
|
+
while (current) {
|
|
95
|
+
if (ancestorScopeSet.has(current.type)) {
|
|
96
|
+
const segments = readScopeSegments(current);
|
|
97
|
+
if (segments.length > 0)
|
|
98
|
+
ancestorScopes.push(segments);
|
|
99
|
+
}
|
|
100
|
+
current = current.parent;
|
|
101
|
+
}
|
|
102
|
+
return [
|
|
103
|
+
...fileScopeSegments,
|
|
104
|
+
...ancestorScopes.reverse().flat(),
|
|
105
|
+
...splitQualifiedName(simpleName),
|
|
106
|
+
]
|
|
107
|
+
.filter(Boolean)
|
|
108
|
+
.join('.');
|
|
109
|
+
};
|
|
110
|
+
const extract = (node, fallback) => {
|
|
111
|
+
if (!typeDeclarationSet.has(node.type))
|
|
112
|
+
return null;
|
|
113
|
+
const name = config.extractName?.(node) ?? extractTypeNameFromNode(node) ?? fallback?.name;
|
|
114
|
+
const type = config.extractType?.(node) ??
|
|
115
|
+
DEFAULT_LABEL_BY_NODE_TYPE[node.type] ??
|
|
116
|
+
(isClassLikeLabel(fallback?.type) ? fallback.type : undefined);
|
|
117
|
+
if (!name || !type)
|
|
118
|
+
return null;
|
|
119
|
+
return {
|
|
120
|
+
name,
|
|
121
|
+
type,
|
|
122
|
+
qualifiedName: buildQualifiedName(node, name) || name,
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
return {
|
|
126
|
+
language: config.language,
|
|
127
|
+
isTypeDeclaration(node) {
|
|
128
|
+
return typeDeclarationSet.has(node.type);
|
|
129
|
+
},
|
|
130
|
+
extract,
|
|
131
|
+
extractQualifiedName(node, simpleName) {
|
|
132
|
+
return extract(node, { name: simpleName })?.qualifiedName ?? null;
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { NodeLabel, SupportedLanguages } from '../../_shared/index.js';
|
|
2
|
+
import type { SyntaxNode } from './utils/ast-helpers.js';
|
|
3
|
+
export type ClassLikeNodeLabel = Extract<NodeLabel, 'Class' | 'Struct' | 'Interface' | 'Enum' | 'Record'>;
|
|
4
|
+
export interface ExtractedClassSymbol {
|
|
5
|
+
name: string;
|
|
6
|
+
type: ClassLikeNodeLabel;
|
|
7
|
+
qualifiedName: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Cross-language qualified type names are normalized to dot-separated scope
|
|
11
|
+
* segments:
|
|
12
|
+
* - file/package scope contributes leading segments when the language has one
|
|
13
|
+
* - lexical namespace/module/type scope contributes enclosing segments
|
|
14
|
+
* - the simple type name is always the trailing segment
|
|
15
|
+
*/
|
|
16
|
+
export interface ClassExtractor {
|
|
17
|
+
language: SupportedLanguages;
|
|
18
|
+
isTypeDeclaration(node: SyntaxNode): boolean;
|
|
19
|
+
extract(node: SyntaxNode, fallback?: {
|
|
20
|
+
name?: string;
|
|
21
|
+
type?: NodeLabel | null;
|
|
22
|
+
}): ExtractedClassSymbol | null;
|
|
23
|
+
extractQualifiedName(node: SyntaxNode, simpleName: string): string | null;
|
|
24
|
+
}
|
|
25
|
+
export interface ClassExtractionConfig {
|
|
26
|
+
language: SupportedLanguages;
|
|
27
|
+
typeDeclarationNodes: string[];
|
|
28
|
+
fileScopeNodeTypes?: string[];
|
|
29
|
+
ancestorScopeNodeTypes?: string[];
|
|
30
|
+
scopeNameNodeTypes?: string[];
|
|
31
|
+
extractName?: (node: SyntaxNode) => string | undefined;
|
|
32
|
+
extractType?: (node: SyntaxNode) => ClassLikeNodeLabel | undefined;
|
|
33
|
+
extractScopeSegments?: (node: SyntaxNode) => string[] | null | undefined;
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -210,6 +210,7 @@ export const ENTRY_POINT_PATTERNS = {
|
|
|
210
210
|
/^onEvent$/, // BLoC event handler
|
|
211
211
|
/^mapEventToState$/, // Legacy BLoC pattern
|
|
212
212
|
],
|
|
213
|
+
[SupportedLanguages.Vue]: [], // Vue uses TypeScript queries — entry points handled via TS patterns
|
|
213
214
|
[SupportedLanguages.Cobol]: [], // Standalone regex processor — no tree-sitter entry points
|
|
214
215
|
};
|
|
215
216
|
/** Pre-computed merged patterns (universal + language-specific) to avoid per-call array allocation. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TypeEnvironment } from './type-env.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SymbolTableReader } from './model/symbol-table.js';
|
|
3
3
|
import { SupportedLanguages } from '../../_shared/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* Visibility levels used across all supported languages.
|
|
@@ -42,7 +42,7 @@ export interface FieldExtractorContext {
|
|
|
42
42
|
/** Type environment for resolution */
|
|
43
43
|
typeEnv: TypeEnvironment;
|
|
44
44
|
/** Symbol table for FQN lookups */
|
|
45
|
-
symbolTable:
|
|
45
|
+
symbolTable: SymbolTableReader;
|
|
46
46
|
/** Current file path */
|
|
47
47
|
filePath: string;
|
|
48
48
|
/** Language ID */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isVerboseIngestionEnabled } from './utils/verbose.js';
|
|
1
2
|
import fs from 'fs/promises';
|
|
2
3
|
import path from 'path';
|
|
3
4
|
import { glob } from 'glob';
|
|
@@ -20,6 +21,7 @@ export const walkRepositoryPaths = async (repoPath, onProgress) => {
|
|
|
20
21
|
const entries = [];
|
|
21
22
|
let processed = 0;
|
|
22
23
|
let skippedLarge = 0;
|
|
24
|
+
const skippedLargePaths = [];
|
|
23
25
|
for (let start = 0; start < filtered.length; start += READ_CONCURRENCY) {
|
|
24
26
|
const batch = filtered.slice(start, start + READ_CONCURRENCY);
|
|
25
27
|
const results = await Promise.allSettled(batch.map(async (relativePath) => {
|
|
@@ -27,6 +29,7 @@ export const walkRepositoryPaths = async (repoPath, onProgress) => {
|
|
|
27
29
|
const stat = await fs.stat(fullPath);
|
|
28
30
|
if (stat.size > MAX_FILE_SIZE) {
|
|
29
31
|
skippedLarge++;
|
|
32
|
+
skippedLargePaths.push(relativePath.replace(/\\/g, '/'));
|
|
30
33
|
return null;
|
|
31
34
|
}
|
|
32
35
|
return { path: relativePath.replace(/\\/g, '/'), size: stat.size };
|
|
@@ -44,6 +47,11 @@ export const walkRepositoryPaths = async (repoPath, onProgress) => {
|
|
|
44
47
|
}
|
|
45
48
|
if (skippedLarge > 0) {
|
|
46
49
|
console.warn(` Skipped ${skippedLarge} large files (>${MAX_FILE_SIZE / 1024}KB, likely generated/vendored)`);
|
|
50
|
+
if (isVerboseIngestionEnabled()) {
|
|
51
|
+
for (const p of skippedLargePaths) {
|
|
52
|
+
console.warn(` - ${p}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
47
55
|
}
|
|
48
56
|
return entries;
|
|
49
57
|
};
|
|
@@ -747,6 +747,7 @@ export const AST_FRAMEWORK_PATTERNS_BY_LANGUAGE = {
|
|
|
747
747
|
patterns: FRAMEWORK_AST_PATTERNS.riverpod,
|
|
748
748
|
},
|
|
749
749
|
],
|
|
750
|
+
[SupportedLanguages.Vue]: [], // Vue uses TypeScript AST framework detection
|
|
750
751
|
[SupportedLanguages.Cobol]: [], // Standalone regex processor — no AST framework patterns
|
|
751
752
|
};
|
|
752
753
|
/** Pre-lowercased patterns for O(1) pattern matching at runtime */
|
|
@@ -15,22 +15,15 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { KnowledgeGraph } from '../graph/types.js';
|
|
17
17
|
import { ASTCache } from './ast-cache.js';
|
|
18
|
-
import {
|
|
19
|
-
import type {
|
|
20
|
-
import type { ResolutionContext } from './resolution-context.js';
|
|
18
|
+
import type { ExtractedHeritage, HeritageStrategyLookup } from './model/heritage-map.js';
|
|
19
|
+
import type { ResolutionContext } from './model/resolution-context.js';
|
|
21
20
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* - heritageDefaultEdge: 'IMPLEMENTS' causes all unresolved parents to map to IMPLEMENTS
|
|
27
|
-
* - All others: default EXTENDS
|
|
21
|
+
* Derive the heritage-resolution strategy for a language from its
|
|
22
|
+
* `LanguageProvider`. This is the production wiring that `buildHeritageMap`
|
|
23
|
+
* and the standalone `resolveExtendsType` call site use — the model layer
|
|
24
|
+
* itself stays unaware of the provider registry.
|
|
28
25
|
*/
|
|
29
|
-
|
|
30
|
-
export declare const resolveExtendsType: (parentName: string, currentFilePath: string, ctx: ResolutionContext, language: SupportedLanguages) => {
|
|
31
|
-
type: "EXTENDS" | "IMPLEMENTS";
|
|
32
|
-
idPrefix: string;
|
|
33
|
-
};
|
|
26
|
+
export declare const getHeritageStrategyForLanguage: HeritageStrategyLookup;
|
|
34
27
|
export declare const processHeritage: (graph: KnowledgeGraph, files: {
|
|
35
28
|
path: string;
|
|
36
29
|
content: string;
|
|
@@ -43,7 +36,7 @@ export declare const processHeritageFromExtracted: (graph: KnowledgeGraph, extra
|
|
|
43
36
|
/**
|
|
44
37
|
* Walk source files with the same heritage captures as parse-worker, producing
|
|
45
38
|
* {@link ExtractedHeritage} rows without mutating the graph. Used on the
|
|
46
|
-
* sequential pipeline path so `
|
|
39
|
+
* sequential pipeline path so `buildHeritageMap(..., ctx)` can run before
|
|
47
40
|
* `processCalls` (worker path defers calls until heritage from all chunks exists).
|
|
48
41
|
*/
|
|
49
42
|
export declare function extractExtractedHeritageFromFiles(files: {
|
|
@@ -21,33 +21,20 @@ import { isVerboseIngestionEnabled } from './utils/verbose.js';
|
|
|
21
21
|
import { yieldToEventLoop } from './utils/event-loop.js';
|
|
22
22
|
import { getProvider } from './languages/index.js';
|
|
23
23
|
import { getTreeSitterBufferSize } from './constants.js';
|
|
24
|
-
import {
|
|
24
|
+
import { resolveExtendsType } from './model/heritage-map.js';
|
|
25
|
+
import { TIER_CONFIDENCE } from './model/resolution-context.js';
|
|
25
26
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* - heritageDefaultEdge: 'IMPLEMENTS' causes all unresolved parents to map to IMPLEMENTS
|
|
31
|
-
* - All others: default EXTENDS
|
|
27
|
+
* Derive the heritage-resolution strategy for a language from its
|
|
28
|
+
* `LanguageProvider`. This is the production wiring that `buildHeritageMap`
|
|
29
|
+
* and the standalone `resolveExtendsType` call site use — the model layer
|
|
30
|
+
* itself stays unaware of the provider registry.
|
|
32
31
|
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
? { type: 'IMPLEMENTS', idPrefix: 'Interface' }
|
|
40
|
-
: { type: 'EXTENDS', idPrefix: 'Class' };
|
|
41
|
-
}
|
|
42
|
-
// Unresolved symbol — fall back to provider-defined heuristics
|
|
43
|
-
const provider = getProvider(language);
|
|
44
|
-
if (provider.interfaceNamePattern?.test(parentName)) {
|
|
45
|
-
return { type: 'IMPLEMENTS', idPrefix: 'Interface' };
|
|
46
|
-
}
|
|
47
|
-
if (provider.heritageDefaultEdge === 'IMPLEMENTS') {
|
|
48
|
-
return { type: 'IMPLEMENTS', idPrefix: 'Interface' };
|
|
49
|
-
}
|
|
50
|
-
return { type: 'EXTENDS', idPrefix: 'Class' };
|
|
32
|
+
export const getHeritageStrategyForLanguage = (lang) => {
|
|
33
|
+
const provider = getProvider(lang);
|
|
34
|
+
return {
|
|
35
|
+
interfaceNamePattern: provider.interfaceNamePattern,
|
|
36
|
+
defaultEdge: provider.heritageDefaultEdge ?? 'EXTENDS',
|
|
37
|
+
};
|
|
51
38
|
};
|
|
52
39
|
const resolveHeritageId = (name, filePath, ctx, fallbackLabel, fallbackKey) => {
|
|
53
40
|
const resolved = ctx.resolve(name, filePath);
|
|
@@ -136,7 +123,7 @@ export const processHeritage = async (graph, files, astCache, ctx, onProgress) =
|
|
|
136
123
|
}
|
|
137
124
|
const className = captureMap['heritage.class'].text;
|
|
138
125
|
const parentClassName = captureMap['heritage.extends'].text;
|
|
139
|
-
const { type: relType, idPrefix } = resolveExtendsType(parentClassName, file.path, ctx, language);
|
|
126
|
+
const { type: relType, idPrefix } = resolveExtendsType(parentClassName, file.path, ctx, getHeritageStrategyForLanguage(language));
|
|
140
127
|
const child = resolveHeritageId(className, file.path, ctx, 'Class', `${file.path}:${className}`);
|
|
141
128
|
const parent = resolveHeritageId(parentClassName, file.path, ctx, idPrefix);
|
|
142
129
|
if (child.id && parent.id && child.id !== parent.id) {
|
|
@@ -209,7 +196,7 @@ export const processHeritageFromExtracted = async (graph, extractedHeritage, ctx
|
|
|
209
196
|
const fileLanguage = getLanguageFromFilename(h.filePath);
|
|
210
197
|
if (!fileLanguage)
|
|
211
198
|
continue;
|
|
212
|
-
const { type: relType, idPrefix } = resolveExtendsType(h.parentName, h.filePath, ctx, fileLanguage);
|
|
199
|
+
const { type: relType, idPrefix } = resolveExtendsType(h.parentName, h.filePath, ctx, getHeritageStrategyForLanguage(fileLanguage));
|
|
213
200
|
const child = resolveHeritageId(h.className, h.filePath, ctx, 'Class', `${h.filePath}:${h.className}`);
|
|
214
201
|
const parent = resolveHeritageId(h.parentName, h.filePath, ctx, idPrefix);
|
|
215
202
|
if (child.id && parent.id && child.id !== parent.id) {
|
|
@@ -260,7 +247,7 @@ export const processHeritageFromExtracted = async (graph, extractedHeritage, ctx
|
|
|
260
247
|
/**
|
|
261
248
|
* Walk source files with the same heritage captures as parse-worker, producing
|
|
262
249
|
* {@link ExtractedHeritage} rows without mutating the graph. Used on the
|
|
263
|
-
* sequential pipeline path so `
|
|
250
|
+
* sequential pipeline path so `buildHeritageMap(..., ctx)` can run before
|
|
264
251
|
* `processCalls` (worker path defers calls until heritage from all chunks exists).
|
|
265
252
|
*/
|
|
266
253
|
export async function extractExtractedHeritageFromFiles(files, astCache) {
|
|
@@ -2,21 +2,11 @@ import { KnowledgeGraph } from '../graph/types.js';
|
|
|
2
2
|
import { ASTCache } from './ast-cache.js';
|
|
3
3
|
import type { LanguageProvider } from './language-provider.js';
|
|
4
4
|
import type { ExtractedImport } from './workers/parse-worker.js';
|
|
5
|
-
import type { ResolutionContext } from './resolution-context.js';
|
|
5
|
+
import type { ResolutionContext } from './model/resolution-context.js';
|
|
6
6
|
import type { ImportResolutionContext } from './import-resolvers/types.js';
|
|
7
7
|
import type { SyntaxNode } from './utils/ast-helpers.js';
|
|
8
8
|
export type ImportMap = Map<string, Set<string>>;
|
|
9
9
|
export type PackageMap = Map<string, Set<string>>;
|
|
10
|
-
export interface NamedImportBinding {
|
|
11
|
-
sourcePath: string;
|
|
12
|
-
exportedName: string;
|
|
13
|
-
}
|
|
14
|
-
export type NamedImportMap = Map<string, Map<string, NamedImportBinding>>;
|
|
15
|
-
/**
|
|
16
|
-
* Check if a file path is directly inside a package directory identified by its suffix.
|
|
17
|
-
* Used by the symbol resolver for Go and C# directory-level import matching.
|
|
18
|
-
*/
|
|
19
|
-
export declare function isFileInPackageDir(filePath: string, dirSuffix: string): boolean;
|
|
20
10
|
export declare function buildImportResolutionContext(allPaths: string[]): ImportResolutionContext;
|
|
21
11
|
/**
|
|
22
12
|
* Clean and preprocess a raw import source text into a resolved import path.
|
|
@@ -32,18 +32,6 @@ function wireImplicitImports(files, importMap, addImportEdge, projectConfig) {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Check if a file path is directly inside a package directory identified by its suffix.
|
|
37
|
-
* Used by the symbol resolver for Go and C# directory-level import matching.
|
|
38
|
-
*/
|
|
39
|
-
export function isFileInPackageDir(filePath, dirSuffix) {
|
|
40
|
-
// Prepend '/' so paths like "internal/auth/service.go" match suffix "/internal/auth/"
|
|
41
|
-
const normalized = '/' + filePath.replace(/\\/g, '/');
|
|
42
|
-
if (!normalized.includes(dirSuffix))
|
|
43
|
-
return false;
|
|
44
|
-
const afterDir = normalized.substring(normalized.indexOf(dirSuffix) + dirSuffix.length);
|
|
45
|
-
return !afterDir.includes('/');
|
|
46
|
-
}
|
|
47
35
|
// ImportResolutionContext is defined in ./import-resolvers/types.ts — re-exported here for consumers.
|
|
48
36
|
export function buildImportResolutionContext(allPaths) {
|
|
49
37
|
const allFileList = allPaths;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue import resolver — delegates to TypeScript's standard resolver.
|
|
3
|
+
*
|
|
4
|
+
* Vue <script> blocks use the same import syntax as TypeScript (including
|
|
5
|
+
* tsconfig path aliases like `@/`), so no custom resolution logic is needed.
|
|
6
|
+
*/
|
|
7
|
+
import type { ImportResolverFn } from './types.js';
|
|
8
|
+
export declare const resolveVueImport: ImportResolverFn;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue import resolver — delegates to TypeScript's standard resolver.
|
|
3
|
+
*
|
|
4
|
+
* Vue <script> blocks use the same import syntax as TypeScript (including
|
|
5
|
+
* tsconfig path aliases like `@/`), so no custom resolution logic is needed.
|
|
6
|
+
*/
|
|
7
|
+
import { SupportedLanguages } from '../../../_shared/index.js';
|
|
8
|
+
import { resolveStandard } from './standard.js';
|
|
9
|
+
export const resolveVueImport = (raw, fp, ctx) => resolveStandard(raw, fp, ctx, SupportedLanguages.TypeScript);
|
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
* The providers table in `languages/index.ts` uses `satisfies Record<SupportedLanguages, LanguageProvider>`
|
|
9
9
|
* so adding a language to the enum without creating a provider is a compiler error.
|
|
10
10
|
*/
|
|
11
|
-
import type { SupportedLanguages } from '../../_shared/index.js';
|
|
11
|
+
import type { SupportedLanguages, MroStrategy } from '../../_shared/index.js';
|
|
12
12
|
import type { LanguageTypeConfig } from './type-extractors/types.js';
|
|
13
13
|
import type { CallRouter } from './call-routing.js';
|
|
14
|
+
import type { ClassExtractor } from './class-types.js';
|
|
14
15
|
import type { ExportChecker } from './export-detection.js';
|
|
15
16
|
import type { FieldExtractor } from './field-extractor.js';
|
|
16
17
|
import type { MethodExtractor } from './method-types.js';
|
|
@@ -20,8 +21,6 @@ import type { SyntaxNode } from './utils/ast-helpers.js';
|
|
|
20
21
|
import type { NodeLabel } from '../../_shared/index.js';
|
|
21
22
|
/** Tree-sitter query captures: capture name → AST node (or undefined if not captured). */
|
|
22
23
|
export type CaptureMap = Record<string, SyntaxNode | undefined>;
|
|
23
|
-
/** MRO strategy for multiple inheritance resolution. */
|
|
24
|
-
export type MroStrategy = 'first-wins' | 'c3' | 'leftmost-base' | 'implements-split' | 'qualified-syntax';
|
|
25
24
|
/** How a language handles imports — determines wildcard synthesis behavior. */
|
|
26
25
|
export type ImportSemantics = 'named' | 'wildcard' | 'namespace';
|
|
27
26
|
/**
|
|
@@ -101,6 +100,10 @@ interface LanguageProviderConfig {
|
|
|
101
100
|
* declarations. Produces MethodInfo[] with name, parameters, visibility, isAbstract,
|
|
102
101
|
* isFinal, annotations metadata. Default: undefined (no method extraction). */
|
|
103
102
|
readonly methodExtractor?: MethodExtractor;
|
|
103
|
+
/** Class/type extractor for deriving canonical qualified names for class-like symbols.
|
|
104
|
+
* Uses the same provider-driven strategy pattern as method/field extraction so
|
|
105
|
+
* namespace/package/module rules stay language-specific. */
|
|
106
|
+
readonly classExtractor?: ClassExtractor;
|
|
104
107
|
/** Extract a semantic description for a definition node (e.g., PHP Eloquent
|
|
105
108
|
* property arrays, relation method descriptions).
|
|
106
109
|
* Default: undefined (no description extraction). */
|