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
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tree-sitter parser module
|
|
3
|
-
*
|
|
4
|
-
* Provides code parsing functionality using web-tree-sitter
|
|
5
|
-
* WASM files are loaded from local assets directory for minimal bundle size
|
|
6
|
-
*/
|
|
7
|
-
import { existsSync } from "fs";
|
|
8
|
-
import { join } from "path";
|
|
9
|
-
import { Language, Parser, } from "web-tree-sitter";
|
|
10
|
-
import { getAssetsDir, registerCache } from "@core/utils";
|
|
11
|
-
import { getLanguageByName, getLanguageFromPath, } from "./languages";
|
|
12
|
-
// Re-export language utilities
|
|
13
|
-
export * from "./languages";
|
|
14
|
-
/**
|
|
15
|
-
* Parser initialization state
|
|
16
|
-
*/
|
|
17
|
-
let isInitialized = false;
|
|
18
|
-
let initPromise = null;
|
|
19
|
-
/**
|
|
20
|
-
* Cache for loaded languages
|
|
21
|
-
*/
|
|
22
|
-
const languageCache = new Map();
|
|
23
|
-
/**
|
|
24
|
-
* Parser instance (reused)
|
|
25
|
-
*/
|
|
26
|
-
let parser = null;
|
|
27
|
-
/**
|
|
28
|
-
* Initialize the Tree-sitter WASM module
|
|
29
|
-
* Must be called before any parsing operations
|
|
30
|
-
*/
|
|
31
|
-
export async function initializeParser() {
|
|
32
|
-
if (isInitialized) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
if (initPromise) {
|
|
36
|
-
return initPromise;
|
|
37
|
-
}
|
|
38
|
-
initPromise = (async () => {
|
|
39
|
-
// web-tree-sitter loads its WASM from node_modules automatically
|
|
40
|
-
await Parser.init();
|
|
41
|
-
parser = new Parser();
|
|
42
|
-
isInitialized = true;
|
|
43
|
-
})();
|
|
44
|
-
return initPromise;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Check if the parser is initialized
|
|
48
|
-
*/
|
|
49
|
-
export function isParserInitialized() {
|
|
50
|
-
return isInitialized;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Get or create a parser instance
|
|
54
|
-
*/
|
|
55
|
-
async function getParser() {
|
|
56
|
-
await initializeParser();
|
|
57
|
-
if (!parser) {
|
|
58
|
-
throw new Error("Parser not initialized");
|
|
59
|
-
}
|
|
60
|
-
return parser;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Load a language grammar from local assets
|
|
64
|
-
*/
|
|
65
|
-
async function loadLanguage(config) {
|
|
66
|
-
const cacheKey = config.name;
|
|
67
|
-
// Check cache first
|
|
68
|
-
const cached = languageCache.get(cacheKey);
|
|
69
|
-
if (cached) {
|
|
70
|
-
return cached;
|
|
71
|
-
}
|
|
72
|
-
await initializeParser();
|
|
73
|
-
// Load WASM from local assets directory
|
|
74
|
-
const assetsDir = getAssetsDir();
|
|
75
|
-
const wasmPath = join(assetsDir, "wasm", `tree-sitter-${config.name}.wasm`);
|
|
76
|
-
if (!existsSync(wasmPath)) {
|
|
77
|
-
throw new Error(`WASM file not found for language ${config.name}: ${wasmPath}`);
|
|
78
|
-
}
|
|
79
|
-
const language = await Language.load(wasmPath);
|
|
80
|
-
languageCache.set(cacheKey, language);
|
|
81
|
-
return language;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Parse code content
|
|
85
|
-
*/
|
|
86
|
-
export async function parseCode(content, options = {}) {
|
|
87
|
-
const { language, filePath } = options;
|
|
88
|
-
// Determine language config
|
|
89
|
-
let config;
|
|
90
|
-
if (language) {
|
|
91
|
-
config = getLanguageByName(language);
|
|
92
|
-
if (!config) {
|
|
93
|
-
throw new Error(`Unsupported language: ${language}`);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
else if (filePath) {
|
|
97
|
-
config = getLanguageFromPath(filePath);
|
|
98
|
-
if (!config) {
|
|
99
|
-
throw new Error(`Could not detect language for file: ${filePath}`);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
throw new Error("Either language or filePath must be provided");
|
|
104
|
-
}
|
|
105
|
-
// Load the language grammar
|
|
106
|
-
const languageInstance = await loadLanguage(config);
|
|
107
|
-
// Get parser and set language
|
|
108
|
-
const parserInstance = await getParser();
|
|
109
|
-
parserInstance.setLanguage(languageInstance);
|
|
110
|
-
// Parse the content
|
|
111
|
-
const tree = parserInstance.parse(content);
|
|
112
|
-
if (!tree) {
|
|
113
|
-
throw new Error("Failed to parse content");
|
|
114
|
-
}
|
|
115
|
-
return {
|
|
116
|
-
tree,
|
|
117
|
-
language: config.name,
|
|
118
|
-
parser: parserInstance,
|
|
119
|
-
languageInstance,
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Convert Tree-sitter position to our Position type
|
|
124
|
-
*/
|
|
125
|
-
export function toPosition(point, offset) {
|
|
126
|
-
return {
|
|
127
|
-
line: point.row + 1, // Convert 0-based to 1-based
|
|
128
|
-
column: point.column,
|
|
129
|
-
offset,
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Convert Tree-sitter node to ASTNode
|
|
134
|
-
*/
|
|
135
|
-
export function toASTNode(node, maxDepth, currentDepth = 0) {
|
|
136
|
-
const astNode = {
|
|
137
|
-
type: node.type,
|
|
138
|
-
text: node.text,
|
|
139
|
-
start: toPosition(node.startPosition, node.startIndex),
|
|
140
|
-
end: toPosition(node.endPosition, node.endIndex),
|
|
141
|
-
isNamed: node.isNamed,
|
|
142
|
-
};
|
|
143
|
-
// Check depth limit
|
|
144
|
-
if (maxDepth !== undefined && currentDepth >= maxDepth) {
|
|
145
|
-
return astNode;
|
|
146
|
-
}
|
|
147
|
-
// Add children if present
|
|
148
|
-
if (node.childCount > 0) {
|
|
149
|
-
const namedChildren = node.namedChildren;
|
|
150
|
-
if (namedChildren.length > 0) {
|
|
151
|
-
astNode.children = namedChildren.map((child) => toASTNode(child, maxDepth, currentDepth + 1));
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
// Add named fields using the language's field names
|
|
155
|
-
const treeLang = node.tree.language;
|
|
156
|
-
const fields = {};
|
|
157
|
-
const langFields = treeLang.fields;
|
|
158
|
-
for (const fieldName of langFields) {
|
|
159
|
-
if (fieldName) {
|
|
160
|
-
const fieldNode = node.childForFieldName(fieldName);
|
|
161
|
-
if (fieldNode) {
|
|
162
|
-
fields[fieldName] = toASTNode(fieldNode, maxDepth, currentDepth + 1);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
if (Object.keys(fields).length > 0) {
|
|
167
|
-
astNode.fields = fields;
|
|
168
|
-
}
|
|
169
|
-
return astNode;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Get the root ASTNode from a parse result
|
|
173
|
-
*/
|
|
174
|
-
export function getASTRoot(parseResult, maxDepth) {
|
|
175
|
-
return toASTNode(parseResult.tree.rootNode, maxDepth);
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Count nodes in the tree
|
|
179
|
-
*/
|
|
180
|
-
export function countNodes(node) {
|
|
181
|
-
let count = 1;
|
|
182
|
-
for (const child of node.namedChildren) {
|
|
183
|
-
count += countNodes(child);
|
|
184
|
-
}
|
|
185
|
-
return count;
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Clear the language cache (useful for testing)
|
|
189
|
-
*/
|
|
190
|
-
export function clearLanguageCache() {
|
|
191
|
-
languageCache.clear();
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Reset the parser state (useful for testing)
|
|
195
|
-
*/
|
|
196
|
-
export function resetParser() {
|
|
197
|
-
languageCache.clear();
|
|
198
|
-
parser = null;
|
|
199
|
-
isInitialized = false;
|
|
200
|
-
initPromise = null;
|
|
201
|
-
}
|
|
202
|
-
// Register caches for centralized clearing
|
|
203
|
-
registerCache("parser:languageCache", clearLanguageCache);
|
|
204
|
-
registerCache("parser:state", resetParser);
|
|
205
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/parser/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EACL,QAAQ,EAER,MAAM,GAGP,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,EACL,iBAAiB,EACjB,mBAAmB,GAEpB,MAAM,aAAa,CAAC;AAErB,+BAA+B;AAC/B,cAAc,aAAa,CAAC;AAK5B;;GAEG;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,MAAM,UAAU,kBAAkB;IAChC,aAAa,CAAC,KAAK,EAAE,CAAC;AACxB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW;IACzB,aAAa,CAAC,KAAK,EAAE,CAAC;IACtB,MAAM,GAAG,IAAI,CAAC;IACd,aAAa,GAAG,KAAK,CAAC;IACtB,WAAW,GAAG,IAAI,CAAC;AACrB,CAAC;AAED,2CAA2C;AAC3C,aAAa,CAAC,sBAAsB,EAAE,kBAAkB,CAAC,CAAC;AAC1D,aAAa,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export interface LanguageConfig {
|
|
2
|
-
name: string;
|
|
3
|
-
wasm: string;
|
|
4
|
-
queries: string;
|
|
5
|
-
extensions: string[];
|
|
6
|
-
aliases?: string[];
|
|
7
|
-
}
|
|
8
|
-
/** Get all Tree-sitter supported languages */
|
|
9
|
-
export declare function getLanguages(): Record<string, LanguageConfig>;
|
|
10
|
-
/** Get language configuration from file extension */
|
|
11
|
-
export declare function getLanguageFromExtension(extension: string): LanguageConfig | undefined;
|
|
12
|
-
/** Get language configuration from file path */
|
|
13
|
-
export declare function getLanguageFromPath(filePath: string): LanguageConfig | undefined;
|
|
14
|
-
/** Get language configuration by name */
|
|
15
|
-
export declare function getLanguageByName(name: string): LanguageConfig | undefined;
|
|
16
|
-
/** Check if a language is supported by Tree-sitter */
|
|
17
|
-
export declare function isLanguageSupported(language: string): boolean;
|
|
18
|
-
/** Get all supported language names */
|
|
19
|
-
export declare function getSupportedLanguages(): string[];
|
|
20
|
-
/** Get all supported file extensions */
|
|
21
|
-
export declare function getSupportedExtensions(): string[];
|
|
22
|
-
/** Clear caches (for testing) */
|
|
23
|
-
export declare function clearLanguageCache(): void;
|
|
24
|
-
export declare const LANGUAGES: Record<string, LanguageConfig>;
|
|
25
|
-
export declare const EXTENSION_MAP: Record<string, LanguageConfig>;
|
|
26
|
-
//# sourceMappingURL=languages.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"languages.d.ts","sourceRoot":"","sources":["../../../src/core/parser/languages.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAgFD,8CAA8C;AAC9C,wBAAgB,YAAY,IAAI,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAE7D;AAED,qDAAqD;AACrD,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,GAChB,cAAc,GAAG,SAAS,CAG5B;AAED,gDAAgD;AAChD,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,GACf,cAAc,GAAG,SAAS,CAG5B;AAED,yCAAyC;AACzC,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAE1E;AAED,sDAAsD;AACtD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED,uCAAuC;AACvC,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAEhD;AAED,wCAAwC;AACxC,wBAAgB,sBAAsB,IAAI,MAAM,EAAE,CAEjD;AAED,iCAAiC;AACjC,wBAAgB,kBAAkB,IAAI,IAAI,CAIzC;AAGD,eAAO,MAAM,SAAS,gCAAmB,CAAC;AAC1C,eAAO,MAAM,aAAa,gCAAsB,CAAC"}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Language configuration and mapping for Tree-sitter parsers
|
|
3
|
-
* Reads from centralized assets/languages.json
|
|
4
|
-
*/
|
|
5
|
-
import { loadJsonConfig, registerCache } from "@core/utils";
|
|
6
|
-
let configCache = null;
|
|
7
|
-
let languagesCache = null;
|
|
8
|
-
let extensionMapCache = null;
|
|
9
|
-
function loadConfig() {
|
|
10
|
-
if (configCache) {
|
|
11
|
-
return configCache;
|
|
12
|
-
}
|
|
13
|
-
configCache = loadJsonConfig("languages.json", {
|
|
14
|
-
treesitter: {},
|
|
15
|
-
});
|
|
16
|
-
return configCache;
|
|
17
|
-
}
|
|
18
|
-
function buildLanguages() {
|
|
19
|
-
if (languagesCache) {
|
|
20
|
-
return languagesCache;
|
|
21
|
-
}
|
|
22
|
-
const config = loadConfig();
|
|
23
|
-
languagesCache = {};
|
|
24
|
-
for (const [name, lang] of Object.entries(config.treesitter)) {
|
|
25
|
-
languagesCache[name] = {
|
|
26
|
-
name,
|
|
27
|
-
wasm: lang.wasm,
|
|
28
|
-
queries: lang.queries,
|
|
29
|
-
extensions: lang.extensions,
|
|
30
|
-
aliases: lang.aliases,
|
|
31
|
-
};
|
|
32
|
-
// Also register aliases
|
|
33
|
-
if (lang.aliases) {
|
|
34
|
-
for (const alias of lang.aliases) {
|
|
35
|
-
languagesCache[alias] = {
|
|
36
|
-
name,
|
|
37
|
-
wasm: lang.wasm,
|
|
38
|
-
queries: lang.queries,
|
|
39
|
-
extensions: lang.extensions,
|
|
40
|
-
aliases: lang.aliases,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return languagesCache;
|
|
46
|
-
}
|
|
47
|
-
function buildExtensionMap() {
|
|
48
|
-
if (extensionMapCache) {
|
|
49
|
-
return extensionMapCache;
|
|
50
|
-
}
|
|
51
|
-
const languages = buildLanguages();
|
|
52
|
-
extensionMapCache = {};
|
|
53
|
-
for (const config of Object.values(languages)) {
|
|
54
|
-
for (const ext of config.extensions) {
|
|
55
|
-
extensionMapCache[ext] = config;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return extensionMapCache;
|
|
59
|
-
}
|
|
60
|
-
/** Get all Tree-sitter supported languages */
|
|
61
|
-
export function getLanguages() {
|
|
62
|
-
return buildLanguages();
|
|
63
|
-
}
|
|
64
|
-
/** Get language configuration from file extension */
|
|
65
|
-
export function getLanguageFromExtension(extension) {
|
|
66
|
-
const ext = extension.startsWith(".") ? extension : `.${extension}`;
|
|
67
|
-
return buildExtensionMap()[ext.toLowerCase()];
|
|
68
|
-
}
|
|
69
|
-
/** Get language configuration from file path */
|
|
70
|
-
export function getLanguageFromPath(filePath) {
|
|
71
|
-
const ext = filePath.slice(filePath.lastIndexOf(".")).toLowerCase();
|
|
72
|
-
return buildExtensionMap()[ext];
|
|
73
|
-
}
|
|
74
|
-
/** Get language configuration by name */
|
|
75
|
-
export function getLanguageByName(name) {
|
|
76
|
-
return buildLanguages()[name.toLowerCase()];
|
|
77
|
-
}
|
|
78
|
-
/** Check if a language is supported by Tree-sitter */
|
|
79
|
-
export function isLanguageSupported(language) {
|
|
80
|
-
return language.toLowerCase() in buildLanguages();
|
|
81
|
-
}
|
|
82
|
-
/** Get all supported language names */
|
|
83
|
-
export function getSupportedLanguages() {
|
|
84
|
-
return Object.keys(loadConfig().treesitter);
|
|
85
|
-
}
|
|
86
|
-
/** Get all supported file extensions */
|
|
87
|
-
export function getSupportedExtensions() {
|
|
88
|
-
return Object.keys(buildExtensionMap());
|
|
89
|
-
}
|
|
90
|
-
/** Clear caches (for testing) */
|
|
91
|
-
export function clearLanguageCache() {
|
|
92
|
-
configCache = null;
|
|
93
|
-
languagesCache = null;
|
|
94
|
-
extensionMapCache = null;
|
|
95
|
-
}
|
|
96
|
-
// Legacy exports for backward compatibility
|
|
97
|
-
export const LANGUAGES = buildLanguages();
|
|
98
|
-
export const EXTENSION_MAP = buildExtensionMap();
|
|
99
|
-
// Register cache for centralized clearing
|
|
100
|
-
registerCache("languages:config", clearLanguageCache);
|
|
101
|
-
//# sourceMappingURL=languages.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"languages.js","sourceRoot":"","sources":["../../../src/core/parser/languages.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAA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AI,cAAc,EAAE,CAAC;AACpD,CAAC;AAED,uCAAuC;AACvC,MAAM,UAAU,qBAAqB;IACnC,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,UAAU,CAAC,CAAC;AAC9C,CAAC;AAED,wCAAwC;AACxC,MAAM,UAAU,sBAAsB;IACpC,OAAO,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED,iCAAiC;AACjC,MAAM,UAAU,kBAAkB;IAChC,WAAW,GAAG,IAAI,CAAC;IACnB,cAAc,GAAG,IAAI,CAAC;IACtB,iBAAiB,GAAG,IAAI,CAAC;AAC3B,CAAC;AAED,4CAA4C;AAC5C,MAAM,CAAC,MAAM,SAAS,GAAG,cAAc,EAAE,CAAC;AAC1C,MAAM,CAAC,MAAM,aAAa,GAAG,iBAAiB,EAAE,CAAC;AAEjD,0CAA0C;AAC1C,aAAa,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Query helper utilities
|
|
3
|
-
*
|
|
4
|
-
* Provides common patterns for working with Tree-sitter query captures
|
|
5
|
-
*/
|
|
6
|
-
import type { ASTNode, QueryCapture, QueryMatch } from "@core/ast/types";
|
|
7
|
-
/**
|
|
8
|
-
* Find a capture by exact name
|
|
9
|
-
*
|
|
10
|
-
* @param captures - Array of captures from a query match
|
|
11
|
-
* @param name - Exact capture name to find
|
|
12
|
-
* @returns The matching capture or undefined
|
|
13
|
-
*/
|
|
14
|
-
export declare function findCapture(captures: QueryCapture[], name: string): QueryCapture | undefined;
|
|
15
|
-
/**
|
|
16
|
-
* Find a capture matching any of the given names
|
|
17
|
-
*
|
|
18
|
-
* @param captures - Array of captures from a query match
|
|
19
|
-
* @param names - Array of capture names to search for
|
|
20
|
-
* @returns The first matching capture or undefined
|
|
21
|
-
*/
|
|
22
|
-
export declare function findCaptureByNames(captures: QueryCapture[], names: string[]): QueryCapture | undefined;
|
|
23
|
-
/**
|
|
24
|
-
* Find a capture by name prefix
|
|
25
|
-
*
|
|
26
|
-
* @param captures - Array of captures from a query match
|
|
27
|
-
* @param prefix - Prefix to match (e.g., "definition." matches "definition.function")
|
|
28
|
-
* @returns The first matching capture or undefined
|
|
29
|
-
*/
|
|
30
|
-
export declare function findCaptureByPrefix(captures: QueryCapture[], prefix: string): QueryCapture | undefined;
|
|
31
|
-
/**
|
|
32
|
-
* Get all captures matching a prefix
|
|
33
|
-
*
|
|
34
|
-
* @param captures - Array of captures from a query match
|
|
35
|
-
* @param prefix - Prefix to match
|
|
36
|
-
* @returns Array of matching captures
|
|
37
|
-
*/
|
|
38
|
-
export declare function filterCapturesByPrefix(captures: QueryCapture[], prefix: string): QueryCapture[];
|
|
39
|
-
/**
|
|
40
|
-
* Extract the suffix from a capture name after the prefix
|
|
41
|
-
*
|
|
42
|
-
* @param captureName - Full capture name (e.g., "definition.function")
|
|
43
|
-
* @param prefix - Prefix to remove (e.g., "definition.")
|
|
44
|
-
* @returns The suffix (e.g., "function") or the original name if prefix not found
|
|
45
|
-
*/
|
|
46
|
-
export declare function getCaptureKind(captureName: string, prefix: string): string;
|
|
47
|
-
/**
|
|
48
|
-
* Deduplicate nodes from query matches based on their position
|
|
49
|
-
*
|
|
50
|
-
* @param matches - Array of query matches
|
|
51
|
-
* @param captureNames - Capture names to extract nodes from
|
|
52
|
-
* @returns Array of unique ASTNode objects
|
|
53
|
-
*/
|
|
54
|
-
export declare function deduplicateNodes(matches: QueryMatch[], captureNames: string[]): ASTNode[];
|
|
55
|
-
/**
|
|
56
|
-
* Extract nodes from matches without deduplication
|
|
57
|
-
*
|
|
58
|
-
* @param matches - Array of query matches
|
|
59
|
-
* @param captureNames - Capture names to extract nodes from
|
|
60
|
-
* @returns Array of ASTNode objects
|
|
61
|
-
*/
|
|
62
|
-
export declare function extractNodes(matches: QueryMatch[], captureNames: string[]): ASTNode[];
|
|
63
|
-
/**
|
|
64
|
-
* Create a deduplication set from node offsets
|
|
65
|
-
*
|
|
66
|
-
* @returns Object with add and has methods for tracking seen offsets
|
|
67
|
-
*/
|
|
68
|
-
export declare function createOffsetTracker(): {
|
|
69
|
-
add: (node: ASTNode) => void;
|
|
70
|
-
has: (node: ASTNode) => boolean;
|
|
71
|
-
};
|
|
72
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/core/queries/helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEzE;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,YAAY,EAAE,EACxB,IAAI,EAAE,MAAM,GACX,YAAY,GAAG,SAAS,CAE1B;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,YAAY,EAAE,EACxB,KAAK,EAAE,MAAM,EAAE,GACd,YAAY,GAAG,SAAS,CAE1B;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,YAAY,EAAE,EACxB,MAAM,EAAE,MAAM,GACb,YAAY,GAAG,SAAS,CAE1B;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,YAAY,EAAE,EACxB,MAAM,EAAE,MAAM,GACb,YAAY,EAAE,CAEhB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAI1E;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,UAAU,EAAE,EACrB,YAAY,EAAE,MAAM,EAAE,GACrB,OAAO,EAAE,CAaX;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,UAAU,EAAE,EACrB,YAAY,EAAE,MAAM,EAAE,GACrB,OAAO,EAAE,CAWX;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI;IACrC,GAAG,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7B,GAAG,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC;CACjC,CAMA"}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Find a capture by exact name
|
|
3
|
-
*
|
|
4
|
-
* @param captures - Array of captures from a query match
|
|
5
|
-
* @param name - Exact capture name to find
|
|
6
|
-
* @returns The matching capture or undefined
|
|
7
|
-
*/
|
|
8
|
-
export function findCapture(captures, name) {
|
|
9
|
-
return captures.find((c) => c.name === name);
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Find a capture matching any of the given names
|
|
13
|
-
*
|
|
14
|
-
* @param captures - Array of captures from a query match
|
|
15
|
-
* @param names - Array of capture names to search for
|
|
16
|
-
* @returns The first matching capture or undefined
|
|
17
|
-
*/
|
|
18
|
-
export function findCaptureByNames(captures, names) {
|
|
19
|
-
return captures.find((c) => names.includes(c.name));
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Find a capture by name prefix
|
|
23
|
-
*
|
|
24
|
-
* @param captures - Array of captures from a query match
|
|
25
|
-
* @param prefix - Prefix to match (e.g., "definition." matches "definition.function")
|
|
26
|
-
* @returns The first matching capture or undefined
|
|
27
|
-
*/
|
|
28
|
-
export function findCaptureByPrefix(captures, prefix) {
|
|
29
|
-
return captures.find((c) => c.name.startsWith(prefix));
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Get all captures matching a prefix
|
|
33
|
-
*
|
|
34
|
-
* @param captures - Array of captures from a query match
|
|
35
|
-
* @param prefix - Prefix to match
|
|
36
|
-
* @returns Array of matching captures
|
|
37
|
-
*/
|
|
38
|
-
export function filterCapturesByPrefix(captures, prefix) {
|
|
39
|
-
return captures.filter((c) => c.name.startsWith(prefix));
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Extract the suffix from a capture name after the prefix
|
|
43
|
-
*
|
|
44
|
-
* @param captureName - Full capture name (e.g., "definition.function")
|
|
45
|
-
* @param prefix - Prefix to remove (e.g., "definition.")
|
|
46
|
-
* @returns The suffix (e.g., "function") or the original name if prefix not found
|
|
47
|
-
*/
|
|
48
|
-
export function getCaptureKind(captureName, prefix) {
|
|
49
|
-
return captureName.startsWith(prefix)
|
|
50
|
-
? captureName.slice(prefix.length)
|
|
51
|
-
: captureName;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Deduplicate nodes from query matches based on their position
|
|
55
|
-
*
|
|
56
|
-
* @param matches - Array of query matches
|
|
57
|
-
* @param captureNames - Capture names to extract nodes from
|
|
58
|
-
* @returns Array of unique ASTNode objects
|
|
59
|
-
*/
|
|
60
|
-
export function deduplicateNodes(matches, captureNames) {
|
|
61
|
-
const nodes = [];
|
|
62
|
-
const seen = new Set();
|
|
63
|
-
for (const match of matches) {
|
|
64
|
-
const capture = findCaptureByNames(match.captures, captureNames);
|
|
65
|
-
if (capture && !seen.has(capture.node.start.offset)) {
|
|
66
|
-
nodes.push(capture.node);
|
|
67
|
-
seen.add(capture.node.start.offset);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return nodes;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Extract nodes from matches without deduplication
|
|
74
|
-
*
|
|
75
|
-
* @param matches - Array of query matches
|
|
76
|
-
* @param captureNames - Capture names to extract nodes from
|
|
77
|
-
* @returns Array of ASTNode objects
|
|
78
|
-
*/
|
|
79
|
-
export function extractNodes(matches, captureNames) {
|
|
80
|
-
const nodes = [];
|
|
81
|
-
for (const match of matches) {
|
|
82
|
-
const capture = findCaptureByNames(match.captures, captureNames);
|
|
83
|
-
if (capture) {
|
|
84
|
-
nodes.push(capture.node);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return nodes;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Create a deduplication set from node offsets
|
|
91
|
-
*
|
|
92
|
-
* @returns Object with add and has methods for tracking seen offsets
|
|
93
|
-
*/
|
|
94
|
-
export function createOffsetTracker() {
|
|
95
|
-
const seen = new Set();
|
|
96
|
-
return {
|
|
97
|
-
add: (node) => seen.add(node.start.offset),
|
|
98
|
-
has: (node) => seen.has(node.start.offset),
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/core/queries/helpers.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CACzB,QAAwB,EACxB,IAAY;IAEZ,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,QAAwB,EACxB,KAAe;IAEf,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACtD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,QAAwB,EACxB,MAAc;IAEd,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;AACzD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CACpC,QAAwB,EACxB,MAAc;IAEd,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM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AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB;IAIjC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,OAAO;QACL,GAAG,EAAE,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;QACnD,GAAG,EAAE,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;KACpD,CAAC;AACJ,CAAC"}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SCM Query engine for Tree-sitter
|
|
3
|
-
*
|
|
4
|
-
* Supports both official .scm query files and custom preset patterns
|
|
5
|
-
*/
|
|
6
|
-
import { type Language, type Tree } from "web-tree-sitter";
|
|
7
|
-
import type { ASTNode, QueryMatch } from "@core/ast/types";
|
|
8
|
-
import { type SCMQueryType } from "./loader";
|
|
9
|
-
import { type QueryPreset } from "./patterns";
|
|
10
|
-
export * from "./helpers";
|
|
11
|
-
export * from "./loader";
|
|
12
|
-
export { getQueryPattern, getQuerySupportedLanguages, isPresetAvailable, FALLBACK_PATTERNS, type QueryPreset, } from "./patterns";
|
|
13
|
-
/**
|
|
14
|
-
* Get all available presets for a language
|
|
15
|
-
* Automatically checks for official tags.scm support
|
|
16
|
-
*/
|
|
17
|
-
export declare function getAvailablePresets(language: string): QueryPreset[];
|
|
18
|
-
/**
|
|
19
|
-
* Query execution result
|
|
20
|
-
*/
|
|
21
|
-
export interface QueryResult {
|
|
22
|
-
/** Query matches */
|
|
23
|
-
matches: QueryMatch[];
|
|
24
|
-
/** Total match count */
|
|
25
|
-
count: number;
|
|
26
|
-
/** Query that was executed */
|
|
27
|
-
query: string;
|
|
28
|
-
/** Language used */
|
|
29
|
-
language: string;
|
|
30
|
-
/** Source of the query (official .scm or custom preset) */
|
|
31
|
-
source: "official" | "preset";
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Query options
|
|
35
|
-
*/
|
|
36
|
-
export interface QueryOptions {
|
|
37
|
-
/** Maximum number of matches to return */
|
|
38
|
-
maxMatches?: number;
|
|
39
|
-
/** Start index (byte offset) */
|
|
40
|
-
startIndex?: number;
|
|
41
|
-
/** End index (byte offset) */
|
|
42
|
-
endIndex?: number;
|
|
43
|
-
/** Prefer official .scm files when available */
|
|
44
|
-
preferOfficial?: boolean;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Execute a SCM query on parsed code
|
|
48
|
-
*/
|
|
49
|
-
export declare function executeQuery(tree: Tree, languageInstance: Language, queryString: string, language: string, options?: QueryOptions): QueryResult;
|
|
50
|
-
/**
|
|
51
|
-
* Execute an official .scm query file
|
|
52
|
-
*
|
|
53
|
-
* @param tree - Parsed tree
|
|
54
|
-
* @param languageInstance - Tree-sitter language instance
|
|
55
|
-
* @param language - Language name
|
|
56
|
-
* @param queryType - Type of query (tags, highlights, locals, etc.)
|
|
57
|
-
* @param options - Query options
|
|
58
|
-
*/
|
|
59
|
-
export declare function executeOfficialQuery(tree: Tree, languageInstance: Language, language: string, queryType: SCMQueryType, options?: QueryOptions): QueryResult | undefined;
|
|
60
|
-
/**
|
|
61
|
-
* Execute tags.scm for comprehensive symbol extraction
|
|
62
|
-
*
|
|
63
|
-
* This uses the official Tree-sitter tags.scm file which provides:
|
|
64
|
-
* - Function definitions with documentation
|
|
65
|
-
* - Class definitions
|
|
66
|
-
* - Method definitions
|
|
67
|
-
* - Module/interface definitions
|
|
68
|
-
* - Reference tracking (calls, types)
|
|
69
|
-
*/
|
|
70
|
-
export declare function executeTagsQuery(tree: Tree, languageInstance: Language, language: string, options?: QueryOptions): QueryResult | undefined;
|
|
71
|
-
/**
|
|
72
|
-
* Execute a preset query
|
|
73
|
-
* Uses official tags.scm for functions/classes when available,
|
|
74
|
-
* otherwise falls back to preset patterns
|
|
75
|
-
*/
|
|
76
|
-
export declare function executePresetQuery(tree: Tree, languageInstance: Language, language: string, preset: QueryPreset, options?: QueryOptions): QueryResult;
|
|
77
|
-
/**
|
|
78
|
-
* Extract symbols using official tags.scm when available
|
|
79
|
-
*
|
|
80
|
-
* This is the recommended method for symbol extraction as it uses
|
|
81
|
-
* the official Tree-sitter query files for better accuracy.
|
|
82
|
-
*/
|
|
83
|
-
export declare function extractSymbolsFromTags(tree: Tree, languageInstance: Language, language: string): {
|
|
84
|
-
definitions: TagDefinition[];
|
|
85
|
-
references: TagReference[];
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* Tag definition kinds from official tags.scm
|
|
89
|
-
*/
|
|
90
|
-
export type TagKind = "function" | "method" | "class" | "module" | "interface" | "constant" | "type" | "call";
|
|
91
|
-
/**
|
|
92
|
-
* A symbol definition extracted from tags.scm
|
|
93
|
-
*/
|
|
94
|
-
export interface TagDefinition {
|
|
95
|
-
name: string;
|
|
96
|
-
kind: TagKind;
|
|
97
|
-
node: ASTNode;
|
|
98
|
-
nameNode: ASTNode;
|
|
99
|
-
documentation?: string;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* A symbol reference extracted from tags.scm
|
|
103
|
-
*/
|
|
104
|
-
export interface TagReference {
|
|
105
|
-
name: string;
|
|
106
|
-
kind: TagKind;
|
|
107
|
-
node: ASTNode;
|
|
108
|
-
nameNode: ASTNode;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Find all functions in the code
|
|
112
|
-
* Prefers official tags.scm when available
|
|
113
|
-
*/
|
|
114
|
-
export declare function findFunctions(tree: Tree, languageInstance: Language, language: string, options?: QueryOptions): ASTNode[];
|
|
115
|
-
/**
|
|
116
|
-
* Find all classes/structs in the code
|
|
117
|
-
* Prefers official tags.scm when available
|
|
118
|
-
*/
|
|
119
|
-
export declare function findClasses(tree: Tree, languageInstance: Language, language: string, options?: QueryOptions): ASTNode[];
|
|
120
|
-
/**
|
|
121
|
-
* Find all imports in the code
|
|
122
|
-
*/
|
|
123
|
-
export declare function findImports(tree: Tree, languageInstance: Language, language: string, options?: QueryOptions): ASTNode[];
|
|
124
|
-
/**
|
|
125
|
-
* Find all exports in the code
|
|
126
|
-
*/
|
|
127
|
-
export declare function findExports(tree: Tree, languageInstance: Language, language: string, options?: QueryOptions): ASTNode[];
|
|
128
|
-
/**
|
|
129
|
-
* Find all comments in the code
|
|
130
|
-
*/
|
|
131
|
-
export declare function findComments(tree: Tree, languageInstance: Language, language: string, options?: QueryOptions): ASTNode[];
|
|
132
|
-
/**
|
|
133
|
-
* Find all string literals in the code
|
|
134
|
-
*/
|
|
135
|
-
export declare function findStrings(tree: Tree, languageInstance: Language, language: string, options?: QueryOptions): ASTNode[];
|
|
136
|
-
/**
|
|
137
|
-
* Get function name from a function node
|
|
138
|
-
*/
|
|
139
|
-
export declare function getFunctionName(funcNode: ASTNode): string | undefined;
|
|
140
|
-
/**
|
|
141
|
-
* Get class name from a class node
|
|
142
|
-
*/
|
|
143
|
-
export declare function getClassName(classNode: ASTNode): string | undefined;
|
|
144
|
-
//# sourceMappingURL=index.d.ts.map
|