src-mcp 1.0.1 → 1.0.2
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/bin.d.mts +1 -0
- package/dist/bin.mjs +205 -0
- package/dist/bin.mjs.map +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +8 -0
- package/dist/index.mjs.map +1 -0
- package/dist/server-B2Ms4jQx.mjs +3889 -0
- package/dist/server-B2Ms4jQx.mjs.map +1 -0
- package/package.json +10 -9
- package/dist/bin.d.ts +0 -3
- package/dist/bin.d.ts.map +0 -1
- package/dist/bin.js +0 -4
- package/dist/bin.js.map +0 -1
- package/dist/cli/adapter.d.ts +0 -7
- package/dist/cli/adapter.d.ts.map +0 -1
- package/dist/cli/adapter.js +0 -39
- package/dist/cli/adapter.js.map +0 -1
- package/dist/cli/commands/index.d.ts +0 -24
- package/dist/cli/commands/index.d.ts.map +0 -1
- package/dist/cli/commands/index.js +0 -13
- package/dist/cli/commands/index.js.map +0 -1
- package/dist/cli/commands/serve.command.d.ts +0 -21
- package/dist/cli/commands/serve.command.d.ts.map +0 -1
- package/dist/cli/commands/serve.command.js +0 -62
- package/dist/cli/commands/serve.command.js.map +0 -1
- package/dist/cli/commands/version.command.d.ts +0 -2
- package/dist/cli/commands/version.command.d.ts.map +0 -1
- package/dist/cli/commands/version.command.js +0 -12
- package/dist/cli/commands/version.command.js.map +0 -1
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -15
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/parser.d.ts +0 -7
- package/dist/cli/parser.d.ts.map +0 -1
- package/dist/cli/parser.js +0 -99
- package/dist/cli/parser.js.map +0 -1
- package/dist/config/index.d.ts +0 -24
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -38
- package/dist/config/index.js.map +0 -1
- package/dist/core/ast/index.d.ts +0 -82
- package/dist/core/ast/index.d.ts.map +0 -1
- package/dist/core/ast/index.js +0 -204
- package/dist/core/ast/index.js.map +0 -1
- package/dist/core/ast/types.d.ts +0 -152
- package/dist/core/ast/types.d.ts.map +0 -1
- package/dist/core/ast/types.js +0 -5
- package/dist/core/ast/types.js.map +0 -1
- package/dist/core/constants.d.ts +0 -17
- package/dist/core/constants.d.ts.map +0 -1
- package/dist/core/constants.js +0 -49
- package/dist/core/constants.js.map +0 -1
- package/dist/core/embeddings/callgraph.d.ts +0 -98
- package/dist/core/embeddings/callgraph.d.ts.map +0 -1
- package/dist/core/embeddings/callgraph.js +0 -415
- package/dist/core/embeddings/callgraph.js.map +0 -1
- package/dist/core/embeddings/chunker.d.ts +0 -37
- package/dist/core/embeddings/chunker.d.ts.map +0 -1
- package/dist/core/embeddings/chunker.js +0 -298
- package/dist/core/embeddings/chunker.js.map +0 -1
- package/dist/core/embeddings/client.d.ts +0 -30
- package/dist/core/embeddings/client.d.ts.map +0 -1
- package/dist/core/embeddings/client.js +0 -65
- package/dist/core/embeddings/client.js.map +0 -1
- package/dist/core/embeddings/crossfile.d.ts +0 -58
- package/dist/core/embeddings/crossfile.d.ts.map +0 -1
- package/dist/core/embeddings/crossfile.js +0 -202
- package/dist/core/embeddings/crossfile.js.map +0 -1
- package/dist/core/embeddings/enricher.d.ts +0 -53
- package/dist/core/embeddings/enricher.d.ts.map +0 -1
- package/dist/core/embeddings/enricher.js +0 -308
- package/dist/core/embeddings/enricher.js.map +0 -1
- package/dist/core/embeddings/index.d.ts +0 -13
- package/dist/core/embeddings/index.d.ts.map +0 -1
- package/dist/core/embeddings/index.js +0 -20
- package/dist/core/embeddings/index.js.map +0 -1
- package/dist/core/embeddings/reranker.d.ts +0 -41
- package/dist/core/embeddings/reranker.d.ts.map +0 -1
- package/dist/core/embeddings/reranker.js +0 -117
- package/dist/core/embeddings/reranker.js.map +0 -1
- package/dist/core/embeddings/store.d.ts +0 -93
- package/dist/core/embeddings/store.d.ts.map +0 -1
- package/dist/core/embeddings/store.js +0 -304
- package/dist/core/embeddings/store.js.map +0 -1
- package/dist/core/embeddings/types.d.ts +0 -77
- package/dist/core/embeddings/types.d.ts.map +0 -1
- package/dist/core/embeddings/types.js +0 -5
- package/dist/core/embeddings/types.js.map +0 -1
- package/dist/core/embeddings/watcher.d.ts +0 -130
- package/dist/core/embeddings/watcher.d.ts.map +0 -1
- package/dist/core/embeddings/watcher.js +0 -448
- package/dist/core/embeddings/watcher.js.map +0 -1
- package/dist/core/fallback/index.d.ts +0 -26
- package/dist/core/fallback/index.d.ts.map +0 -1
- package/dist/core/fallback/index.js +0 -76
- package/dist/core/fallback/index.js.map +0 -1
- package/dist/core/parser/index.d.ts +0 -64
- package/dist/core/parser/index.d.ts.map +0 -1
- package/dist/core/parser/index.js +0 -205
- package/dist/core/parser/index.js.map +0 -1
- package/dist/core/parser/languages.d.ts +0 -26
- package/dist/core/parser/languages.d.ts.map +0 -1
- package/dist/core/parser/languages.js +0 -101
- package/dist/core/parser/languages.js.map +0 -1
- package/dist/core/queries/helpers.d.ts +0 -72
- package/dist/core/queries/helpers.d.ts.map +0 -1
- package/dist/core/queries/helpers.js +0 -101
- package/dist/core/queries/helpers.js.map +0 -1
- package/dist/core/queries/index.d.ts +0 -144
- package/dist/core/queries/index.d.ts.map +0 -1
- package/dist/core/queries/index.js +0 -396
- package/dist/core/queries/index.js.map +0 -1
- package/dist/core/queries/loader.d.ts +0 -46
- package/dist/core/queries/loader.d.ts.map +0 -1
- package/dist/core/queries/loader.js +0 -216
- package/dist/core/queries/loader.js.map +0 -1
- package/dist/core/queries/patterns.d.ts +0 -10
- package/dist/core/queries/patterns.d.ts.map +0 -1
- package/dist/core/queries/patterns.js +0 -112
- package/dist/core/queries/patterns.js.map +0 -1
- package/dist/core/symbols/index.d.ts +0 -70
- package/dist/core/symbols/index.d.ts.map +0 -1
- package/dist/core/symbols/index.js +0 -359
- package/dist/core/symbols/index.js.map +0 -1
- package/dist/core/unified/index.d.ts +0 -118
- package/dist/core/unified/index.d.ts.map +0 -1
- package/dist/core/unified/index.js +0 -428
- package/dist/core/unified/index.js.map +0 -1
- package/dist/core/utils/assets.d.ts +0 -34
- package/dist/core/utils/assets.d.ts.map +0 -1
- package/dist/core/utils/assets.js +0 -85
- package/dist/core/utils/assets.js.map +0 -1
- package/dist/core/utils/cache.d.ts +0 -43
- package/dist/core/utils/cache.d.ts.map +0 -1
- package/dist/core/utils/cache.js +0 -60
- package/dist/core/utils/cache.js.map +0 -1
- package/dist/core/utils/index.d.ts +0 -7
- package/dist/core/utils/index.d.ts.map +0 -1
- package/dist/core/utils/index.js +0 -10
- package/dist/core/utils/index.js.map +0 -1
- package/dist/core/utils/tsconfig.d.ts +0 -34
- package/dist/core/utils/tsconfig.d.ts.map +0 -1
- package/dist/core/utils/tsconfig.js +0 -173
- package/dist/core/utils/tsconfig.js.map +0 -1
- package/dist/features/analyze-file/index.d.ts +0 -15
- package/dist/features/analyze-file/index.d.ts.map +0 -1
- package/dist/features/analyze-file/index.js +0 -164
- package/dist/features/analyze-file/index.js.map +0 -1
- package/dist/features/get-call-graph/index.d.ts +0 -24
- package/dist/features/get-call-graph/index.d.ts.map +0 -1
- package/dist/features/get-call-graph/index.js +0 -246
- package/dist/features/get-call-graph/index.js.map +0 -1
- package/dist/features/get-index-status/index.d.ts +0 -20
- package/dist/features/get-index-status/index.d.ts.map +0 -1
- package/dist/features/get-index-status/index.js +0 -90
- package/dist/features/get-index-status/index.js.map +0 -1
- package/dist/features/index-codebase/index.d.ts +0 -24
- package/dist/features/index-codebase/index.d.ts.map +0 -1
- package/dist/features/index-codebase/index.js +0 -283
- package/dist/features/index-codebase/index.js.map +0 -1
- package/dist/features/index.d.ts +0 -15
- package/dist/features/index.d.ts.map +0 -1
- package/dist/features/index.js +0 -28
- package/dist/features/index.js.map +0 -1
- package/dist/features/info/index.d.ts +0 -19
- package/dist/features/info/index.d.ts.map +0 -1
- package/dist/features/info/index.js +0 -41
- package/dist/features/info/index.js.map +0 -1
- package/dist/features/list-symbols/index.d.ts +0 -22
- package/dist/features/list-symbols/index.d.ts.map +0 -1
- package/dist/features/list-symbols/index.js +0 -74
- package/dist/features/list-symbols/index.js.map +0 -1
- package/dist/features/parse-ast/index.d.ts +0 -12
- package/dist/features/parse-ast/index.d.ts.map +0 -1
- package/dist/features/parse-ast/index.js +0 -71
- package/dist/features/parse-ast/index.js.map +0 -1
- package/dist/features/query-code/index.d.ts +0 -23
- package/dist/features/query-code/index.d.ts.map +0 -1
- package/dist/features/query-code/index.js +0 -96
- package/dist/features/query-code/index.js.map +0 -1
- package/dist/features/search-code/index.d.ts +0 -39
- package/dist/features/search-code/index.d.ts.map +0 -1
- package/dist/features/search-code/index.js +0 -258
- package/dist/features/search-code/index.js.map +0 -1
- package/dist/features/types.d.ts +0 -14
- package/dist/features/types.d.ts.map +0 -1
- package/dist/features/types.js +0 -2
- package/dist/features/types.js.map +0 -1
- package/dist/features/update-index/index.d.ts +0 -24
- package/dist/features/update-index/index.d.ts.map +0 -1
- package/dist/features/update-index/index.js +0 -358
- package/dist/features/update-index/index.js.map +0 -1
- package/dist/features/utils/content.d.ts +0 -30
- package/dist/features/utils/content.d.ts.map +0 -1
- package/dist/features/utils/content.js +0 -49
- package/dist/features/utils/content.js.map +0 -1
- package/dist/features/utils/index.d.ts +0 -6
- package/dist/features/utils/index.d.ts.map +0 -1
- package/dist/features/utils/index.js +0 -8
- package/dist/features/utils/index.js.map +0 -1
- package/dist/features/utils/result.d.ts +0 -37
- package/dist/features/utils/result.d.ts.map +0 -1
- package/dist/features/utils/result.js +0 -53
- package/dist/features/utils/result.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +0 -1
- package/dist/prompts/index.d.ts +0 -9
- package/dist/prompts/index.d.ts.map +0 -1
- package/dist/prompts/index.js +0 -188
- package/dist/prompts/index.js.map +0 -1
- package/dist/resources/index.d.ts +0 -3
- package/dist/resources/index.d.ts.map +0 -1
- package/dist/resources/index.js +0 -17
- package/dist/resources/index.js.map +0 -1
- package/dist/server.d.ts +0 -4
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js +0 -24
- package/dist/server.js.map +0 -1
- package/dist/tools/adapter.d.ts +0 -4
- package/dist/tools/adapter.d.ts.map +0 -1
- package/dist/tools/adapter.js +0 -28
- package/dist/tools/adapter.js.map +0 -1
- package/dist/tools/index.d.ts +0 -5
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -9
- package/dist/tools/index.js.map +0 -1
- package/dist/types/index.d.ts +0 -20
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -2
- package/dist/types/index.js.map +0 -1
- package/dist/utils/colors.d.ts +0 -24
- package/dist/utils/colors.d.ts.map +0 -1
- package/dist/utils/colors.js +0 -30
- package/dist/utils/colors.js.map +0 -1
- package/dist/utils/index.d.ts +0 -4
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -4
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -8
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -57
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/spinner.d.ts +0 -11
- package/dist/utils/spinner.d.ts.map +0 -1
- package/dist/utils/spinner.js +0 -36
- package/dist/utils/spinner.js.map +0 -1
package/dist/core/ast/index.js
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import { toPosition } from "@core/parser";
|
|
2
|
-
/**
|
|
3
|
-
* Traverse AST tree in depth-first order
|
|
4
|
-
* Return false from callback to stop traversal
|
|
5
|
-
*/
|
|
6
|
-
export function traverseAST(node, callback, depth = 0) {
|
|
7
|
-
const result = callback(node, depth);
|
|
8
|
-
if (result === false) {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
if (node.children) {
|
|
12
|
-
for (const child of node.children) {
|
|
13
|
-
const shouldContinue = traverseAST(child, callback, depth + 1);
|
|
14
|
-
if (!shouldContinue) {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Find all nodes matching a predicate
|
|
23
|
-
*/
|
|
24
|
-
export function findNodes(root, predicate) {
|
|
25
|
-
const matches = [];
|
|
26
|
-
traverseAST(root, (node) => {
|
|
27
|
-
if (predicate(node)) {
|
|
28
|
-
matches.push(node);
|
|
29
|
-
}
|
|
30
|
-
return undefined;
|
|
31
|
-
});
|
|
32
|
-
return matches;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Find all nodes of a specific type
|
|
36
|
-
*/
|
|
37
|
-
export function findNodesByType(root, type) {
|
|
38
|
-
return findNodes(root, (node) => node.type === type);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Find all nodes of multiple types
|
|
42
|
-
*/
|
|
43
|
-
export function findNodesByTypes(root, types) {
|
|
44
|
-
const typeSet = new Set(types);
|
|
45
|
-
return findNodes(root, (node) => typeSet.has(node.type));
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Find the first node matching a predicate
|
|
49
|
-
*/
|
|
50
|
-
export function findFirstNode(root, predicate) {
|
|
51
|
-
let found;
|
|
52
|
-
traverseAST(root, (node) => {
|
|
53
|
-
if (predicate(node)) {
|
|
54
|
-
found = node;
|
|
55
|
-
return false; // Stop traversal
|
|
56
|
-
}
|
|
57
|
-
return true;
|
|
58
|
-
});
|
|
59
|
-
return found;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Find node at a specific position
|
|
63
|
-
*/
|
|
64
|
-
export function findNodeAtPosition(root, line, column) {
|
|
65
|
-
let found;
|
|
66
|
-
traverseAST(root, (node) => {
|
|
67
|
-
const startLine = node.start.line;
|
|
68
|
-
const endLine = node.end.line;
|
|
69
|
-
const startCol = node.start.column;
|
|
70
|
-
const endCol = node.end.column;
|
|
71
|
-
// Check if position is within node range
|
|
72
|
-
const afterStart = line > startLine || (line === startLine && column >= startCol);
|
|
73
|
-
const beforeEnd = line < endLine || (line === endLine && column <= endCol);
|
|
74
|
-
if (afterStart && beforeEnd) {
|
|
75
|
-
found = node; // Keep updating to get the most specific (deepest) node
|
|
76
|
-
}
|
|
77
|
-
return true;
|
|
78
|
-
});
|
|
79
|
-
return found;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Get the path from root to a node
|
|
83
|
-
*/
|
|
84
|
-
export function getNodePath(root, target) {
|
|
85
|
-
const path = [];
|
|
86
|
-
function search(node) {
|
|
87
|
-
path.push(node);
|
|
88
|
-
if (node.start.offset === target.start.offset &&
|
|
89
|
-
node.end.offset === target.end.offset &&
|
|
90
|
-
node.type === target.type) {
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
if (node.children) {
|
|
94
|
-
for (const child of node.children) {
|
|
95
|
-
if (search(child)) {
|
|
96
|
-
return true;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
path.pop();
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
return search(root) ? path : undefined;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Get all ancestor types from a node to root
|
|
107
|
-
*/
|
|
108
|
-
export function getAncestorTypes(root, target) {
|
|
109
|
-
const path = getNodePath(root, target);
|
|
110
|
-
return path ? path.map((n) => n.type) : [];
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Extract text from a position range
|
|
114
|
-
*/
|
|
115
|
-
export function extractText(source, start, end) {
|
|
116
|
-
return source.slice(start.offset, end.offset);
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Get line count of source code
|
|
120
|
-
*/
|
|
121
|
-
export function getLineCount(source) {
|
|
122
|
-
// Normalize line endings (handle CRLF and CR)
|
|
123
|
-
const normalizedSource = source.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
124
|
-
return normalizedSource.split("\n").length;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Extract a filtered/limited AST from a Tree-sitter tree
|
|
128
|
-
*/
|
|
129
|
-
export function extractAST(rootNode, options = {}) {
|
|
130
|
-
const { maxDepth, namedOnly = true, includeTypes, excludeTypes } = options;
|
|
131
|
-
function shouldInclude(node) {
|
|
132
|
-
if (namedOnly && !node.isNamed) {
|
|
133
|
-
return false;
|
|
134
|
-
}
|
|
135
|
-
if (includeTypes && !includeTypes.includes(node.type)) {
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
|
-
if (excludeTypes?.includes(node.type)) {
|
|
139
|
-
return false;
|
|
140
|
-
}
|
|
141
|
-
return true;
|
|
142
|
-
}
|
|
143
|
-
function extract(node, depth) {
|
|
144
|
-
const astNode = {
|
|
145
|
-
type: node.type,
|
|
146
|
-
text: node.text,
|
|
147
|
-
start: toPosition(node.startPosition, node.startIndex),
|
|
148
|
-
end: toPosition(node.endPosition, node.endIndex),
|
|
149
|
-
isNamed: node.isNamed,
|
|
150
|
-
};
|
|
151
|
-
// Check depth limit
|
|
152
|
-
if (maxDepth !== undefined && depth >= maxDepth) {
|
|
153
|
-
return astNode;
|
|
154
|
-
}
|
|
155
|
-
// Process children
|
|
156
|
-
const children = [];
|
|
157
|
-
for (const child of node.namedChildren) {
|
|
158
|
-
if (shouldInclude(child)) {
|
|
159
|
-
children.push(extract(child, depth + 1));
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
if (children.length > 0) {
|
|
163
|
-
astNode.children = children;
|
|
164
|
-
}
|
|
165
|
-
return astNode;
|
|
166
|
-
}
|
|
167
|
-
return extract(rootNode, 0);
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Serialize AST to a compact string representation
|
|
171
|
-
*/
|
|
172
|
-
export function serializeAST(node, indent = 0) {
|
|
173
|
-
const prefix = " ".repeat(indent);
|
|
174
|
-
let result = `${prefix}(${node.type}`;
|
|
175
|
-
if (node.children && node.children.length > 0) {
|
|
176
|
-
result += "\n";
|
|
177
|
-
for (const child of node.children) {
|
|
178
|
-
result += serializeAST(child, indent + 1) + "\n";
|
|
179
|
-
}
|
|
180
|
-
result += `${prefix})`;
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
// Leaf node - show text excerpt
|
|
184
|
-
const text = node.text.length > 30 ? node.text.slice(0, 30) + "..." : node.text;
|
|
185
|
-
const escaped = text.replace(/\n/g, "\\n").replace(/"/g, '\\"');
|
|
186
|
-
result += ` "${escaped}")`;
|
|
187
|
-
}
|
|
188
|
-
return result;
|
|
189
|
-
}
|
|
190
|
-
export function getASTStats(root) {
|
|
191
|
-
const stats = {
|
|
192
|
-
totalNodes: 0,
|
|
193
|
-
maxDepth: 0,
|
|
194
|
-
nodeTypes: new Map(),
|
|
195
|
-
};
|
|
196
|
-
traverseAST(root, (node, depth) => {
|
|
197
|
-
stats.totalNodes++;
|
|
198
|
-
stats.maxDepth = Math.max(stats.maxDepth, depth);
|
|
199
|
-
stats.nodeTypes.set(node.type, (stats.nodeTypes.get(node.type) ?? 0) + 1);
|
|
200
|
-
return true;
|
|
201
|
-
});
|
|
202
|
-
return stats;
|
|
203
|
-
}
|
|
204
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/ast/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAe1C;;;GAGG;AACH,MAAM,UAAU,WAAW,CACzB,IAAa,EACb,QAA2B,EAC3B,KAAK,GAAG,CAAC;IAET,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACrC,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC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C;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAWD,MAAM,UAAU,WAAW,CAAC,IAAa;IACvC,MAAM,KAAK,GAAa;QACtB,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,CAAC;QACX,SAAS,EAAE,IAAI,GAAG,EAAE;KACrB,CAAC;IAEF,WAAW,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QAChC,KAAK,CAAC,UAAU,EAAE,CAAC;QACnB,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACjD,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1E,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/core/ast/types.d.ts
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core AST types for Tree-sitter parsing
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Position in source code
|
|
6
|
-
*/
|
|
7
|
-
export interface Position {
|
|
8
|
-
/** Line number (1-based) */
|
|
9
|
-
line: number;
|
|
10
|
-
/** Column number (0-based) */
|
|
11
|
-
column: number;
|
|
12
|
-
/** Byte offset in the source */
|
|
13
|
-
offset: number;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* AST Node representation
|
|
17
|
-
*/
|
|
18
|
-
export interface ASTNode {
|
|
19
|
-
/** Node type (e.g., function_declaration, class_definition) */
|
|
20
|
-
type: string;
|
|
21
|
-
/** Source text of this node */
|
|
22
|
-
text: string;
|
|
23
|
-
/** Start position */
|
|
24
|
-
start: Position;
|
|
25
|
-
/** End position */
|
|
26
|
-
end: Position;
|
|
27
|
-
/** Child nodes */
|
|
28
|
-
children?: ASTNode[];
|
|
29
|
-
/** Named fields (e.g., name, body, parameters) */
|
|
30
|
-
fields?: Record<string, ASTNode | ASTNode[]>;
|
|
31
|
-
/** Whether this is a named node */
|
|
32
|
-
isNamed?: boolean;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Symbol types that can be extracted from code
|
|
36
|
-
*/
|
|
37
|
-
export type SymbolType = "function" | "class" | "variable" | "constant" | "interface" | "type" | "enum" | "method" | "property";
|
|
38
|
-
/**
|
|
39
|
-
* Code symbol (function, class, variable, etc.)
|
|
40
|
-
*/
|
|
41
|
-
export interface Symbol {
|
|
42
|
-
/** Symbol name */
|
|
43
|
-
name: string;
|
|
44
|
-
/** Symbol type */
|
|
45
|
-
type: SymbolType;
|
|
46
|
-
/** Start position */
|
|
47
|
-
start: Position;
|
|
48
|
-
/** End position */
|
|
49
|
-
end: Position;
|
|
50
|
-
/** Function/method signature (params and return type) */
|
|
51
|
-
signature?: string;
|
|
52
|
-
/** Modifiers (public, private, async, export, etc.) */
|
|
53
|
-
modifiers?: string[];
|
|
54
|
-
/** Documentation comment if present */
|
|
55
|
-
documentation?: string;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Import statement information
|
|
59
|
-
*/
|
|
60
|
-
export interface Import {
|
|
61
|
-
/** Module/package being imported */
|
|
62
|
-
source: string;
|
|
63
|
-
/** Imported names (empty for side-effect imports) */
|
|
64
|
-
names: ImportedName[];
|
|
65
|
-
/** Whether this is a default import */
|
|
66
|
-
isDefault?: boolean;
|
|
67
|
-
/** Whether this is a namespace import (import * as X) */
|
|
68
|
-
isNamespace?: boolean;
|
|
69
|
-
/** Start position */
|
|
70
|
-
start: Position;
|
|
71
|
-
/** End position */
|
|
72
|
-
end: Position;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Single imported name
|
|
76
|
-
*/
|
|
77
|
-
export interface ImportedName {
|
|
78
|
-
/** Original name in the module */
|
|
79
|
-
name: string;
|
|
80
|
-
/** Alias if renamed (import { x as y }) */
|
|
81
|
-
alias?: string;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Export statement information
|
|
85
|
-
*/
|
|
86
|
-
export interface Export {
|
|
87
|
-
/** Exported name */
|
|
88
|
-
name: string;
|
|
89
|
-
/** Whether this is a default export */
|
|
90
|
-
isDefault?: boolean;
|
|
91
|
-
/** Whether this is a re-export (export { x } from 'y') */
|
|
92
|
-
isReExport?: boolean;
|
|
93
|
-
/** Source module for re-exports */
|
|
94
|
-
source?: string;
|
|
95
|
-
/** Start position */
|
|
96
|
-
start: Position;
|
|
97
|
-
/** End position */
|
|
98
|
-
end: Position;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Query match result
|
|
102
|
-
*/
|
|
103
|
-
export interface QueryMatch {
|
|
104
|
-
/** Pattern index that matched */
|
|
105
|
-
pattern: number;
|
|
106
|
-
/** Captured nodes */
|
|
107
|
-
captures: QueryCapture[];
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Single capture from a query
|
|
111
|
-
*/
|
|
112
|
-
export interface QueryCapture {
|
|
113
|
-
/** Capture name (e.g., @function.name) */
|
|
114
|
-
name: string;
|
|
115
|
-
/** Captured AST node */
|
|
116
|
-
node: ASTNode;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* File analysis result
|
|
120
|
-
*/
|
|
121
|
-
export interface FileAnalysis {
|
|
122
|
-
/** File path */
|
|
123
|
-
filePath: string;
|
|
124
|
-
/** Detected language */
|
|
125
|
-
language: string;
|
|
126
|
-
/** Extracted symbols */
|
|
127
|
-
symbols: Symbol[];
|
|
128
|
-
/** Import statements */
|
|
129
|
-
imports: Import[];
|
|
130
|
-
/** Export statements */
|
|
131
|
-
exports: Export[];
|
|
132
|
-
/** Code metrics */
|
|
133
|
-
metrics: CodeMetrics;
|
|
134
|
-
/** Full AST (if requested) */
|
|
135
|
-
ast?: ASTNode;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Code metrics
|
|
139
|
-
*/
|
|
140
|
-
export interface CodeMetrics {
|
|
141
|
-
/** Total lines */
|
|
142
|
-
lines: number;
|
|
143
|
-
/** Number of functions/methods */
|
|
144
|
-
functions: number;
|
|
145
|
-
/** Number of classes */
|
|
146
|
-
classes: number;
|
|
147
|
-
/** Number of imports */
|
|
148
|
-
imports: number;
|
|
149
|
-
/** Number of exports */
|
|
150
|
-
exports: number;
|
|
151
|
-
}
|
|
152
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/ast/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,KAAK,EAAE,QAAQ,CAAC;IAChB,mBAAmB;IACnB,GAAG,EAAE,QAAQ,CAAC;IACd,kBAAkB;IAClB,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7C,mCAAmC;IACnC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB,UAAU,GACV,OAAO,GACP,UAAU,GACV,UAAU,GACV,WAAW,GACX,MAAM,GACN,MAAM,GACN,QAAQ,GACR,UA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,OAAO,EAAE,MAAM,CAAC;IAChB,qBAAqB;IACrB,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,wBAAwB;IACxB,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,wBAAwB;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,wBAAwB;IACxB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,wBAAwB;IACxB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,wBAAwB;IACxB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,mBAAmB;IACnB,OAAO,EAAE,WAAW,CAAC;IACrB,8BAA8B;IAC9B,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,wBAAwB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,wBAAwB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,wBAAwB;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
package/dist/core/ast/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/ast/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
package/dist/core/constants.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core constants used across modules
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Keywords to skip when extracting names from AST nodes
|
|
6
|
-
* Used in symbol extraction to filter out language keywords
|
|
7
|
-
*/
|
|
8
|
-
export declare const SKIP_KEYWORDS: Set<string>;
|
|
9
|
-
/**
|
|
10
|
-
* Default chunk size for text splitting fallback
|
|
11
|
-
*/
|
|
12
|
-
export declare const DEFAULT_CHUNK_SIZE = 1000;
|
|
13
|
-
/**
|
|
14
|
-
* Default chunk overlap for text splitting fallback
|
|
15
|
-
*/
|
|
16
|
-
export declare const DEFAULT_CHUNK_OVERLAP = 200;
|
|
17
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,eAAO,MAAM,aAAa,aAgCxB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAEvC;;GAEG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC"}
|
package/dist/core/constants.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core constants used across modules
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Keywords to skip when extracting names from AST nodes
|
|
6
|
-
* Used in symbol extraction to filter out language keywords
|
|
7
|
-
*/
|
|
8
|
-
export const SKIP_KEYWORDS = new Set([
|
|
9
|
-
// Function keywords
|
|
10
|
-
"function",
|
|
11
|
-
"func",
|
|
12
|
-
"fn",
|
|
13
|
-
"def",
|
|
14
|
-
"fun",
|
|
15
|
-
"async",
|
|
16
|
-
"export",
|
|
17
|
-
"public",
|
|
18
|
-
"private",
|
|
19
|
-
"protected",
|
|
20
|
-
"static",
|
|
21
|
-
"abstract",
|
|
22
|
-
"override",
|
|
23
|
-
"final",
|
|
24
|
-
"let",
|
|
25
|
-
"const",
|
|
26
|
-
"var",
|
|
27
|
-
// Class keywords
|
|
28
|
-
"class",
|
|
29
|
-
"struct",
|
|
30
|
-
"interface",
|
|
31
|
-
"trait",
|
|
32
|
-
"object",
|
|
33
|
-
"enum",
|
|
34
|
-
"type",
|
|
35
|
-
"module",
|
|
36
|
-
"namespace",
|
|
37
|
-
"protocol",
|
|
38
|
-
"extension",
|
|
39
|
-
"impl",
|
|
40
|
-
]);
|
|
41
|
-
/**
|
|
42
|
-
* Default chunk size for text splitting fallback
|
|
43
|
-
*/
|
|
44
|
-
export const DEFAULT_CHUNK_SIZE = 1000;
|
|
45
|
-
/**
|
|
46
|
-
* Default chunk overlap for text splitting fallback
|
|
47
|
-
*/
|
|
48
|
-
export const DEFAULT_CHUNK_OVERLAP = 200;
|
|
49
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IACnC,oBAAoB;IACpB,UAAU;IACV,MAAM;IACN,IAAI;IACJ,KAAK;IACL,KAAK;IACL,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,WAAW;IACX,QAAQ;IACR,UAAU;IACV,UAAU;IACV,OAAO;IACP,KAAK;IACL,OAAO;IACP,KAAK;IACL,iBAAiB;IACjB,OAAO;IACP,QAAQ;IACR,WAAW;IACX,OAAO;IACP,QAAQ;IACR,MAAM;IACN,MAAM;IACN,QAAQ;IACR,WAAW;IACX,UAAU;IACV,WAAW;IACX,MAAM;CACP,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEvC;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC"}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Call graph extraction and storage
|
|
3
|
-
*
|
|
4
|
-
* Extracts function call relationships from code using tree-sitter
|
|
5
|
-
* to build a graph showing which functions call which.
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - Persistent caching in .src-index/call-graph.json
|
|
9
|
-
* - Hash-based invalidation for changed files
|
|
10
|
-
*/
|
|
11
|
-
import type { Position, Symbol } from "@core/ast/types";
|
|
12
|
-
/**
|
|
13
|
-
* A function call found in code
|
|
14
|
-
*/
|
|
15
|
-
export interface FunctionCall {
|
|
16
|
-
/** Name of the called function */
|
|
17
|
-
callee: string;
|
|
18
|
-
/** Position of the call */
|
|
19
|
-
position: Position;
|
|
20
|
-
/** Arguments passed (if extractable) */
|
|
21
|
-
arguments?: string[];
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* A node in the call graph
|
|
25
|
-
*/
|
|
26
|
-
export interface CallGraphNode {
|
|
27
|
-
/** Function/method name */
|
|
28
|
-
name: string;
|
|
29
|
-
/** Full qualified name (file:function) */
|
|
30
|
-
qualifiedName: string;
|
|
31
|
-
/** File path */
|
|
32
|
-
filePath: string;
|
|
33
|
-
/** Function type */
|
|
34
|
-
type: string;
|
|
35
|
-
/** Start position */
|
|
36
|
-
start: Position;
|
|
37
|
-
/** End position */
|
|
38
|
-
end: Position;
|
|
39
|
-
/** Functions this node calls */
|
|
40
|
-
calls: string[];
|
|
41
|
-
/** Functions that call this node */
|
|
42
|
-
calledBy: string[];
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* The complete call graph for a codebase
|
|
46
|
-
*/
|
|
47
|
-
export interface CallGraph {
|
|
48
|
-
/** All nodes in the graph */
|
|
49
|
-
nodes: Map<string, CallGraphNode>;
|
|
50
|
-
/** File paths included in the graph */
|
|
51
|
-
files: string[];
|
|
52
|
-
/** Total number of call edges */
|
|
53
|
-
edgeCount: number;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Call graph cache per file
|
|
57
|
-
*/
|
|
58
|
-
interface FileCallData {
|
|
59
|
-
symbols: Symbol[];
|
|
60
|
-
calls: Map<string, FunctionCall[]>;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Clear the call graph cache
|
|
64
|
-
*/
|
|
65
|
-
export declare function clearCallGraphCache(): void;
|
|
66
|
-
/**
|
|
67
|
-
* Analyze a file and extract call graph data
|
|
68
|
-
*/
|
|
69
|
-
export declare function analyzeFileForCallGraph(filePath: string, content: string): Promise<FileCallData | null>;
|
|
70
|
-
/**
|
|
71
|
-
* Build a call graph from multiple files
|
|
72
|
-
*
|
|
73
|
-
* Uses persistent caching with hash-based invalidation for performance.
|
|
74
|
-
*/
|
|
75
|
-
export declare function buildCallGraph(files: {
|
|
76
|
-
path: string;
|
|
77
|
-
content: string;
|
|
78
|
-
}[]): Promise<CallGraph>;
|
|
79
|
-
/**
|
|
80
|
-
* Get callers and callees for a specific function
|
|
81
|
-
*/
|
|
82
|
-
export declare function getCallContext(graph: CallGraph, filePath: string, functionName: string): {
|
|
83
|
-
callers: CallGraphNode[];
|
|
84
|
-
callees: CallGraphNode[];
|
|
85
|
-
} | null;
|
|
86
|
-
/**
|
|
87
|
-
* Format call context as a string for enrichment
|
|
88
|
-
*/
|
|
89
|
-
export declare function formatCallContext(callers: CallGraphNode[], callees: CallGraphNode[], maxItems?: number): string;
|
|
90
|
-
/**
|
|
91
|
-
* Get call graph cache statistics
|
|
92
|
-
*/
|
|
93
|
-
export declare function getCallGraphCacheStats(): {
|
|
94
|
-
files: number;
|
|
95
|
-
entries: string[];
|
|
96
|
-
};
|
|
97
|
-
export {};
|
|
98
|
-
//# sourceMappingURL=callgraph.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"callgraph.d.ts","sourceRoot":"","sources":["../../../src/core/embeddings/callgraph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAMxD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,QAAQ,EAAE,QAAQ,CAAC;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