@zuvia-software-solutions/code-mapper 1.4.0 → 2.0.1
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/dist/cli/ai-context.js +1 -1
- package/dist/cli/analyze.d.ts +1 -0
- package/dist/cli/analyze.js +73 -82
- package/dist/cli/augment.js +0 -2
- package/dist/cli/eval-server.d.ts +2 -2
- package/dist/cli/eval-server.js +6 -6
- package/dist/cli/index.js +6 -10
- package/dist/cli/mcp.d.ts +1 -3
- package/dist/cli/mcp.js +3 -3
- package/dist/cli/refresh.d.ts +2 -2
- package/dist/cli/refresh.js +24 -29
- package/dist/cli/status.js +4 -13
- package/dist/cli/tool.d.ts +5 -4
- package/dist/cli/tool.js +8 -10
- package/dist/config/ignore-service.js +14 -34
- package/dist/core/augmentation/engine.js +53 -83
- package/dist/core/db/adapter.d.ts +99 -0
- package/dist/core/db/adapter.js +402 -0
- package/dist/core/db/graph-loader.d.ts +27 -0
- package/dist/core/db/graph-loader.js +148 -0
- package/dist/core/db/queries.d.ts +160 -0
- package/dist/core/db/queries.js +441 -0
- package/dist/core/db/schema.d.ts +108 -0
- package/dist/core/db/schema.js +136 -0
- package/dist/core/embeddings/embedder.d.ts +21 -12
- package/dist/core/embeddings/embedder.js +104 -50
- package/dist/core/embeddings/embedding-pipeline.d.ts +48 -22
- package/dist/core/embeddings/embedding-pipeline.js +220 -262
- package/dist/core/embeddings/text-generator.js +4 -19
- package/dist/core/embeddings/types.d.ts +1 -1
- package/dist/core/graph/graph.d.ts +1 -1
- package/dist/core/graph/graph.js +1 -0
- package/dist/core/graph/types.d.ts +11 -9
- package/dist/core/graph/types.js +4 -1
- package/dist/core/incremental/refresh.d.ts +46 -0
- package/dist/core/incremental/refresh.js +503 -0
- package/dist/core/incremental/types.d.ts +2 -1
- package/dist/core/incremental/types.js +42 -44
- package/dist/core/ingestion/ast-cache.js +1 -0
- package/dist/core/ingestion/call-processor.d.ts +15 -3
- package/dist/core/ingestion/call-processor.js +448 -60
- package/dist/core/ingestion/cluster-enricher.d.ts +1 -1
- package/dist/core/ingestion/cluster-enricher.js +2 -0
- package/dist/core/ingestion/community-processor.d.ts +1 -1
- package/dist/core/ingestion/community-processor.js +8 -3
- package/dist/core/ingestion/export-detection.d.ts +1 -1
- package/dist/core/ingestion/export-detection.js +1 -1
- package/dist/core/ingestion/filesystem-walker.js +1 -1
- package/dist/core/ingestion/heritage-processor.d.ts +2 -2
- package/dist/core/ingestion/heritage-processor.js +22 -11
- package/dist/core/ingestion/import-processor.d.ts +2 -2
- package/dist/core/ingestion/import-processor.js +24 -9
- package/dist/core/ingestion/language-config.js +7 -4
- package/dist/core/ingestion/mro-processor.d.ts +1 -1
- package/dist/core/ingestion/mro-processor.js +23 -11
- package/dist/core/ingestion/named-binding-extraction.js +5 -5
- package/dist/core/ingestion/parsing-processor.d.ts +4 -4
- package/dist/core/ingestion/parsing-processor.js +26 -18
- package/dist/core/ingestion/pipeline.d.ts +4 -2
- package/dist/core/ingestion/pipeline.js +50 -20
- package/dist/core/ingestion/process-processor.d.ts +2 -2
- package/dist/core/ingestion/process-processor.js +28 -14
- package/dist/core/ingestion/resolution-context.d.ts +1 -1
- package/dist/core/ingestion/resolution-context.js +14 -4
- package/dist/core/ingestion/resolvers/csharp.js +4 -3
- package/dist/core/ingestion/resolvers/go.js +3 -1
- package/dist/core/ingestion/resolvers/jvm.js +13 -4
- package/dist/core/ingestion/resolvers/standard.js +2 -2
- package/dist/core/ingestion/resolvers/utils.js +6 -2
- package/dist/core/ingestion/route-stitcher.d.ts +15 -0
- package/dist/core/ingestion/route-stitcher.js +92 -0
- package/dist/core/ingestion/structure-processor.d.ts +1 -1
- package/dist/core/ingestion/structure-processor.js +3 -2
- package/dist/core/ingestion/symbol-table.d.ts +2 -0
- package/dist/core/ingestion/symbol-table.js +5 -1
- package/dist/core/ingestion/tree-sitter-queries.d.ts +2 -2
- package/dist/core/ingestion/tree-sitter-queries.js +177 -0
- package/dist/core/ingestion/type-env.js +20 -0
- package/dist/core/ingestion/type-extractors/csharp.js +4 -3
- package/dist/core/ingestion/type-extractors/go.js +23 -12
- package/dist/core/ingestion/type-extractors/php.js +18 -10
- package/dist/core/ingestion/type-extractors/ruby.js +15 -3
- package/dist/core/ingestion/type-extractors/rust.js +3 -2
- package/dist/core/ingestion/type-extractors/shared.js +3 -2
- package/dist/core/ingestion/type-extractors/typescript.js +11 -5
- package/dist/core/ingestion/utils.d.ts +27 -4
- package/dist/core/ingestion/utils.js +145 -100
- package/dist/core/ingestion/workers/parse-worker.d.ts +1 -0
- package/dist/core/ingestion/workers/parse-worker.js +97 -29
- package/dist/core/ingestion/workers/worker-pool.js +3 -0
- package/dist/core/search/bm25-index.d.ts +15 -8
- package/dist/core/search/bm25-index.js +48 -98
- package/dist/core/search/hybrid-search.d.ts +9 -3
- package/dist/core/search/hybrid-search.js +30 -25
- package/dist/core/search/reranker.js +9 -7
- package/dist/core/search/types.d.ts +0 -4
- package/dist/core/semantic/tsgo-service.d.ts +7 -1
- package/dist/core/semantic/tsgo-service.js +165 -66
- package/dist/lib/tsgo-test.d.ts +2 -0
- package/dist/lib/tsgo-test.js +6 -0
- package/dist/lib/type-utils.d.ts +25 -0
- package/dist/lib/type-utils.js +22 -0
- package/dist/lib/utils.d.ts +3 -2
- package/dist/lib/utils.js +3 -2
- package/dist/mcp/compatible-stdio-transport.js +1 -1
- package/dist/mcp/local/local-backend.d.ts +29 -56
- package/dist/mcp/local/local-backend.js +808 -1118
- package/dist/mcp/resources.js +35 -25
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.js +5 -5
- package/dist/mcp/tools.js +24 -25
- package/dist/storage/repo-manager.d.ts +2 -12
- package/dist/storage/repo-manager.js +1 -47
- package/dist/types/pipeline.d.ts +8 -5
- package/dist/types/pipeline.js +5 -0
- package/package.json +18 -11
- package/dist/cli/serve.d.ts +0 -5
- package/dist/cli/serve.js +0 -8
- package/dist/core/incremental/child-process.d.ts +0 -8
- package/dist/core/incremental/child-process.js +0 -649
- package/dist/core/incremental/refresh-coordinator.d.ts +0 -32
- package/dist/core/incremental/refresh-coordinator.js +0 -147
- package/dist/core/lbug/csv-generator.d.ts +0 -28
- package/dist/core/lbug/csv-generator.js +0 -355
- package/dist/core/lbug/lbug-adapter.d.ts +0 -96
- package/dist/core/lbug/lbug-adapter.js +0 -753
- package/dist/core/lbug/schema.d.ts +0 -46
- package/dist/core/lbug/schema.js +0 -402
- package/dist/mcp/core/embedder.d.ts +0 -24
- package/dist/mcp/core/embedder.js +0 -168
- package/dist/mcp/core/lbug-adapter.d.ts +0 -29
- package/dist/mcp/core/lbug-adapter.js +0 -330
- package/dist/server/api.d.ts +0 -5
- package/dist/server/api.js +0 -340
- package/dist/server/mcp-http.d.ts +0 -7
- package/dist/server/mcp-http.js +0 -95
- package/models/mlx-embedder.py +0 -185
|
@@ -68,81 +68,79 @@ function assertArray(v, label) {
|
|
|
68
68
|
export function parseParentMessage(raw) {
|
|
69
69
|
if (!isObject(raw))
|
|
70
70
|
throw new TypeError('IPC message must be an object');
|
|
71
|
-
assertString(raw
|
|
72
|
-
if (raw
|
|
71
|
+
assertString(raw['kind'], 'kind');
|
|
72
|
+
if (raw['kind'] === 'shutdown')
|
|
73
73
|
return { kind: 'shutdown' };
|
|
74
|
-
if (raw
|
|
75
|
-
if (!isObject(raw
|
|
74
|
+
if (raw['kind'] === 'refresh') {
|
|
75
|
+
if (!isObject(raw['payload']))
|
|
76
76
|
throw new TypeError('refresh payload must be an object');
|
|
77
|
-
const p = raw
|
|
78
|
-
assertString(p
|
|
79
|
-
assertString(p
|
|
80
|
-
assertString(p
|
|
81
|
-
assertArray(p
|
|
77
|
+
const p = raw['payload'];
|
|
78
|
+
assertString(p['repoRoot'], 'repoRoot');
|
|
79
|
+
assertString(p['dbPath'], 'dbPath');
|
|
80
|
+
assertString(p['storagePath'], 'storagePath');
|
|
81
|
+
assertArray(p['dirtyFiles'], 'dirtyFiles');
|
|
82
82
|
const dirtyFiles = [];
|
|
83
|
-
for (const entry of p
|
|
83
|
+
for (const entry of p['dirtyFiles']) {
|
|
84
84
|
if (!isObject(entry))
|
|
85
85
|
throw new TypeError('dirtyFiles entry must be an object');
|
|
86
|
-
assertString(entry
|
|
87
|
-
assertString(entry
|
|
88
|
-
if (!FILE_CHANGE_KINDS.includes(entry
|
|
89
|
-
throw new TypeError(`Invalid changeKind: ${entry
|
|
86
|
+
assertString(entry['relativePath'], 'relativePath');
|
|
87
|
+
assertString(entry['changeKind'], 'changeKind');
|
|
88
|
+
if (!FILE_CHANGE_KINDS.includes(entry['changeKind'])) {
|
|
89
|
+
throw new TypeError(`Invalid changeKind: ${entry['changeKind']}`);
|
|
90
90
|
}
|
|
91
91
|
dirtyFiles.push({
|
|
92
|
-
relativePath: entry
|
|
93
|
-
changeKind: entry
|
|
92
|
+
relativePath: entry['relativePath'],
|
|
93
|
+
changeKind: entry['changeKind'],
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
return {
|
|
97
97
|
kind: 'refresh',
|
|
98
98
|
payload: {
|
|
99
|
-
repoRoot: p
|
|
100
|
-
dbPath: p
|
|
101
|
-
storagePath: p
|
|
99
|
+
repoRoot: p['repoRoot'],
|
|
100
|
+
dbPath: p['dbPath'],
|
|
101
|
+
storagePath: p['storagePath'],
|
|
102
102
|
dirtyFiles,
|
|
103
103
|
},
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
-
throw new TypeError(`Unknown IPC message kind: ${raw
|
|
106
|
+
throw new TypeError(`Unknown IPC message kind: ${raw['kind']}`);
|
|
107
107
|
}
|
|
108
108
|
/** Validate and narrow an unknown IPC message from the child */
|
|
109
109
|
export function parseChildMessage(raw) {
|
|
110
110
|
if (!isObject(raw))
|
|
111
111
|
throw new TypeError('IPC message must be an object');
|
|
112
|
-
assertString(raw
|
|
113
|
-
if (raw
|
|
114
|
-
assertString(raw
|
|
115
|
-
if (!REFRESH_PHASES.includes(raw
|
|
116
|
-
throw new TypeError(`Invalid refresh phase: ${raw
|
|
112
|
+
assertString(raw['kind'], 'kind');
|
|
113
|
+
if (raw['kind'] === 'progress') {
|
|
114
|
+
assertString(raw['phase'], 'phase');
|
|
115
|
+
if (!REFRESH_PHASES.includes(raw['phase'])) {
|
|
116
|
+
throw new TypeError(`Invalid refresh phase: ${raw['phase']}`);
|
|
117
117
|
}
|
|
118
|
-
assertString(raw
|
|
119
|
-
return { kind: 'progress', phase: raw
|
|
118
|
+
assertString(raw['detail'], 'detail');
|
|
119
|
+
return { kind: 'progress', phase: raw['phase'], detail: raw['detail'] };
|
|
120
120
|
}
|
|
121
|
-
if (raw
|
|
122
|
-
if (!isObject(raw
|
|
121
|
+
if (raw['kind'] === 'success') {
|
|
122
|
+
if (!isObject(raw['payload']))
|
|
123
123
|
throw new TypeError('success payload must be an object');
|
|
124
|
-
const p = raw
|
|
124
|
+
const p = raw['payload'];
|
|
125
125
|
return {
|
|
126
126
|
kind: 'success',
|
|
127
127
|
payload: {
|
|
128
|
-
filesProcessed: Number(p
|
|
129
|
-
filesSkipped: Number(p
|
|
130
|
-
nodesDeleted: Number(p
|
|
131
|
-
nodesInserted: Number(p
|
|
132
|
-
edgesInserted: Number(p
|
|
133
|
-
durationMs: Number(p
|
|
128
|
+
filesProcessed: Number(p['filesProcessed']) || 0,
|
|
129
|
+
filesSkipped: Number(p['filesSkipped']) || 0,
|
|
130
|
+
nodesDeleted: Number(p['nodesDeleted']) || 0,
|
|
131
|
+
nodesInserted: Number(p['nodesInserted']) || 0,
|
|
132
|
+
edgesInserted: Number(p['edgesInserted']) || 0,
|
|
133
|
+
durationMs: Number(p['durationMs']) || 0,
|
|
134
|
+
tsgoEnabled: Boolean(p['tsgoEnabled']),
|
|
134
135
|
},
|
|
135
136
|
};
|
|
136
137
|
}
|
|
137
|
-
if (raw
|
|
138
|
-
assertString(raw
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
message: raw.message,
|
|
142
|
-
stack: typeof raw.stack === 'string' ? raw.stack : undefined,
|
|
143
|
-
};
|
|
138
|
+
if (raw['kind'] === 'error') {
|
|
139
|
+
assertString(raw['message'], 'message');
|
|
140
|
+
const base = { kind: 'error', message: raw['message'] };
|
|
141
|
+
return typeof raw['stack'] === 'string' ? { ...base, stack: raw['stack'] } : base;
|
|
144
142
|
}
|
|
145
|
-
throw new TypeError(`Unknown child message kind: ${raw
|
|
143
|
+
throw new TypeError(`Unknown child message kind: ${raw['kind']}`);
|
|
146
144
|
}
|
|
147
145
|
// ---------------------------------------------------------------------------
|
|
148
146
|
// Exhaustiveness guard
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// code-mapper/src/core/ingestion/ast-cache.ts
|
|
2
2
|
/** @file ast-cache.ts @description LRU cache for parsed tree-sitter AST trees with automatic WASM memory cleanup on eviction */
|
|
3
3
|
import { LRUCache } from 'lru-cache';
|
|
4
|
+
import Parser from 'tree-sitter';
|
|
4
5
|
export const createASTCache = (maxSize = 50) => {
|
|
5
6
|
const effectiveMax = Math.max(maxSize, 1);
|
|
6
7
|
// Dispose handler runs automatically on eviction to free WASM memory
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/** @file call-processor.ts @description Resolves function/method call sites to target symbol nodes, supporting sequential AST-based and pre-extracted worker-based paths */
|
|
2
|
-
import { KnowledgeGraph } from '../graph/types.js';
|
|
3
|
-
import { ASTCache } from './ast-cache.js';
|
|
2
|
+
import type { KnowledgeGraph } from '../graph/types.js';
|
|
3
|
+
import type { ASTCache } from './ast-cache.js';
|
|
4
4
|
import type { ResolutionContext } from './resolution-context.js';
|
|
5
5
|
import type { ExtractedCall, ExtractedHeritage, ExtractedRoute, FileConstructorBindings } from './workers/parse-worker.js';
|
|
6
|
+
import type { TsgoService } from '../semantic/tsgo-service.js';
|
|
6
7
|
export declare const processCalls: (graph: KnowledgeGraph, files: {
|
|
7
8
|
path: string;
|
|
8
9
|
content: string;
|
|
9
10
|
}[], astCache: ASTCache, ctx: ResolutionContext, onProgress?: (current: number, total: number) => void) => Promise<ExtractedHeritage[]>;
|
|
10
11
|
export declare const extractReturnTypeName: (raw: string, depth?: number) => string | undefined;
|
|
11
12
|
/** Resolve pre-extracted call sites from workers (no AST parsing needed) */
|
|
12
|
-
export declare const processCallsFromExtracted: (graph: KnowledgeGraph, extractedCalls: ExtractedCall[], ctx: ResolutionContext, onProgress?: (current: number, total: number) => void, constructorBindings?: FileConstructorBindings[]) => Promise<void>;
|
|
13
|
+
export declare const processCallsFromExtracted: (graph: KnowledgeGraph, extractedCalls: ExtractedCall[], ctx: ResolutionContext, onProgress?: (current: number, total: number) => void, constructorBindings?: FileConstructorBindings[], tsgoService?: TsgoService | null, repoPath?: string) => Promise<void>;
|
|
13
14
|
/** Resolve pre-extracted Laravel routes to CALLS edges from route files to controller methods */
|
|
14
15
|
export declare const processRoutesFromExtracted: (graph: KnowledgeGraph, extractedRoutes: ExtractedRoute[], ctx: ResolutionContext, onProgress?: (current: number, total: number) => void) => Promise<void>;
|
|
15
16
|
/**
|
|
@@ -32,3 +33,14 @@ export declare const createDependsOnEdges: (graph: KnowledgeGraph, ctx: Resoluti
|
|
|
32
33
|
* This captures @Bean factories, provider methods, and factory functions.
|
|
33
34
|
*/
|
|
34
35
|
export declare const createProvidesEdges: (graph: KnowledgeGraph, ctx: ResolutionContext) => Promise<number>;
|
|
36
|
+
/**
|
|
37
|
+
* Post-pass: connect interface method DECLARATIONS to their IMPLEMENTATIONS.
|
|
38
|
+
*
|
|
39
|
+
* For each interface Method node (e.g. EventBus.emit), find the matching
|
|
40
|
+
* implementation Function in files that import the interface definition.
|
|
41
|
+
* Creates CALLS edges: InterfaceMethod → ImplementationFunction.
|
|
42
|
+
*
|
|
43
|
+
* This makes the call chain traversable:
|
|
44
|
+
* register() →[tsgo]→ EventBus.emit (Method) →[dispatch]→ emit (Function in event-bus.ts)
|
|
45
|
+
*/
|
|
46
|
+
export declare const resolveInterfaceDispatches: (graph: KnowledgeGraph, ctx: ResolutionContext) => Promise<number>;
|