aidex-mcp 1.4.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.
Files changed (76) hide show
  1. package/CHANGELOG.md +128 -0
  2. package/LICENSE +21 -0
  3. package/MCP-API-REFERENCE.md +690 -0
  4. package/README.md +314 -0
  5. package/build/commands/files.d.ts +28 -0
  6. package/build/commands/files.js +124 -0
  7. package/build/commands/index.d.ts +14 -0
  8. package/build/commands/index.js +14 -0
  9. package/build/commands/init.d.ts +24 -0
  10. package/build/commands/init.js +396 -0
  11. package/build/commands/link.d.ts +45 -0
  12. package/build/commands/link.js +167 -0
  13. package/build/commands/note.d.ts +29 -0
  14. package/build/commands/note.js +105 -0
  15. package/build/commands/query.d.ts +36 -0
  16. package/build/commands/query.js +176 -0
  17. package/build/commands/scan.d.ts +25 -0
  18. package/build/commands/scan.js +104 -0
  19. package/build/commands/session.d.ts +52 -0
  20. package/build/commands/session.js +216 -0
  21. package/build/commands/signature.d.ts +52 -0
  22. package/build/commands/signature.js +171 -0
  23. package/build/commands/summary.d.ts +56 -0
  24. package/build/commands/summary.js +324 -0
  25. package/build/commands/update.d.ts +36 -0
  26. package/build/commands/update.js +273 -0
  27. package/build/constants.d.ts +10 -0
  28. package/build/constants.js +10 -0
  29. package/build/db/database.d.ts +69 -0
  30. package/build/db/database.js +126 -0
  31. package/build/db/index.d.ts +7 -0
  32. package/build/db/index.js +6 -0
  33. package/build/db/queries.d.ts +163 -0
  34. package/build/db/queries.js +273 -0
  35. package/build/db/schema.sql +136 -0
  36. package/build/index.d.ts +13 -0
  37. package/build/index.js +74 -0
  38. package/build/parser/extractor.d.ts +41 -0
  39. package/build/parser/extractor.js +249 -0
  40. package/build/parser/index.d.ts +7 -0
  41. package/build/parser/index.js +7 -0
  42. package/build/parser/languages/c.d.ts +28 -0
  43. package/build/parser/languages/c.js +70 -0
  44. package/build/parser/languages/cpp.d.ts +28 -0
  45. package/build/parser/languages/cpp.js +91 -0
  46. package/build/parser/languages/csharp.d.ts +32 -0
  47. package/build/parser/languages/csharp.js +97 -0
  48. package/build/parser/languages/go.d.ts +28 -0
  49. package/build/parser/languages/go.js +83 -0
  50. package/build/parser/languages/index.d.ts +21 -0
  51. package/build/parser/languages/index.js +107 -0
  52. package/build/parser/languages/java.d.ts +28 -0
  53. package/build/parser/languages/java.js +58 -0
  54. package/build/parser/languages/php.d.ts +28 -0
  55. package/build/parser/languages/php.js +75 -0
  56. package/build/parser/languages/python.d.ts +28 -0
  57. package/build/parser/languages/python.js +67 -0
  58. package/build/parser/languages/ruby.d.ts +28 -0
  59. package/build/parser/languages/ruby.js +68 -0
  60. package/build/parser/languages/rust.d.ts +28 -0
  61. package/build/parser/languages/rust.js +73 -0
  62. package/build/parser/languages/typescript.d.ts +28 -0
  63. package/build/parser/languages/typescript.js +82 -0
  64. package/build/parser/tree-sitter.d.ts +30 -0
  65. package/build/parser/tree-sitter.js +132 -0
  66. package/build/server/mcp-server.d.ts +7 -0
  67. package/build/server/mcp-server.js +36 -0
  68. package/build/server/tools.d.ts +18 -0
  69. package/build/server/tools.js +1245 -0
  70. package/build/viewer/git-status.d.ts +25 -0
  71. package/build/viewer/git-status.js +163 -0
  72. package/build/viewer/index.d.ts +5 -0
  73. package/build/viewer/index.js +5 -0
  74. package/build/viewer/server.d.ts +12 -0
  75. package/build/viewer/server.js +1122 -0
  76. package/package.json +66 -0
@@ -0,0 +1,136 @@
1
+ -- ============================================================
2
+ -- AiDex SQLite Schema
3
+ -- Version: 1.0
4
+ -- ============================================================
5
+
6
+ PRAGMA foreign_keys = ON;
7
+ PRAGMA journal_mode = WAL;
8
+
9
+ -- ------------------------------------------------------------
10
+ -- Dateibaum
11
+ -- ------------------------------------------------------------
12
+ CREATE TABLE IF NOT EXISTS files (
13
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
14
+ path TEXT NOT NULL UNIQUE,
15
+ hash TEXT NOT NULL,
16
+ last_indexed INTEGER NOT NULL
17
+ );
18
+
19
+ CREATE INDEX IF NOT EXISTS idx_files_path ON files(path);
20
+ CREATE INDEX IF NOT EXISTS idx_files_hash ON files(hash);
21
+
22
+ -- ------------------------------------------------------------
23
+ -- Zeilenobjekte
24
+ -- ------------------------------------------------------------
25
+ CREATE TABLE IF NOT EXISTS lines (
26
+ id INTEGER NOT NULL,
27
+ file_id INTEGER NOT NULL,
28
+ line_number INTEGER NOT NULL,
29
+ line_type TEXT NOT NULL CHECK(line_type IN ('code', 'comment', 'struct', 'method', 'property', 'string')),
30
+ line_hash TEXT,
31
+ modified INTEGER,
32
+ PRIMARY KEY (file_id, id),
33
+ FOREIGN KEY (file_id) REFERENCES files(id) ON DELETE CASCADE
34
+ );
35
+
36
+ CREATE INDEX IF NOT EXISTS idx_lines_file ON lines(file_id);
37
+ CREATE INDEX IF NOT EXISTS idx_lines_type ON lines(line_type);
38
+
39
+ -- ------------------------------------------------------------
40
+ -- Items (Terme)
41
+ -- ------------------------------------------------------------
42
+ CREATE TABLE IF NOT EXISTS items (
43
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
44
+ term TEXT NOT NULL UNIQUE COLLATE NOCASE
45
+ );
46
+
47
+ CREATE INDEX IF NOT EXISTS idx_items_term ON items(term);
48
+
49
+ -- ------------------------------------------------------------
50
+ -- Item-Vorkommen
51
+ -- ------------------------------------------------------------
52
+ CREATE TABLE IF NOT EXISTS occurrences (
53
+ item_id INTEGER NOT NULL,
54
+ file_id INTEGER NOT NULL,
55
+ line_id INTEGER NOT NULL,
56
+ PRIMARY KEY (item_id, file_id, line_id),
57
+ FOREIGN KEY (item_id) REFERENCES items(id) ON DELETE CASCADE,
58
+ FOREIGN KEY (file_id, line_id) REFERENCES lines(file_id, id) ON DELETE CASCADE
59
+ );
60
+
61
+ CREATE INDEX IF NOT EXISTS idx_occurrences_item ON occurrences(item_id);
62
+ CREATE INDEX IF NOT EXISTS idx_occurrences_file ON occurrences(file_id);
63
+
64
+ -- ------------------------------------------------------------
65
+ -- Datei-Signaturen
66
+ -- ------------------------------------------------------------
67
+ CREATE TABLE IF NOT EXISTS signatures (
68
+ file_id INTEGER PRIMARY KEY,
69
+ header_comments TEXT,
70
+ FOREIGN KEY (file_id) REFERENCES files(id) ON DELETE CASCADE
71
+ );
72
+
73
+ -- ------------------------------------------------------------
74
+ -- Methoden/Funktionen
75
+ -- ------------------------------------------------------------
76
+ CREATE TABLE IF NOT EXISTS methods (
77
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
78
+ file_id INTEGER NOT NULL,
79
+ name TEXT NOT NULL,
80
+ prototype TEXT NOT NULL,
81
+ line_number INTEGER NOT NULL,
82
+ visibility TEXT,
83
+ is_static INTEGER DEFAULT 0,
84
+ is_async INTEGER DEFAULT 0,
85
+ FOREIGN KEY (file_id) REFERENCES files(id) ON DELETE CASCADE
86
+ );
87
+
88
+ CREATE INDEX IF NOT EXISTS idx_methods_file ON methods(file_id);
89
+ CREATE INDEX IF NOT EXISTS idx_methods_name ON methods(name);
90
+
91
+ -- ------------------------------------------------------------
92
+ -- Klassen/Structs/Interfaces
93
+ -- ------------------------------------------------------------
94
+ CREATE TABLE IF NOT EXISTS types (
95
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
96
+ file_id INTEGER NOT NULL,
97
+ name TEXT NOT NULL,
98
+ kind TEXT NOT NULL CHECK(kind IN ('class', 'struct', 'interface', 'enum', 'type')),
99
+ line_number INTEGER NOT NULL,
100
+ FOREIGN KEY (file_id) REFERENCES files(id) ON DELETE CASCADE
101
+ );
102
+
103
+ CREATE INDEX IF NOT EXISTS idx_types_file ON types(file_id);
104
+ CREATE INDEX IF NOT EXISTS idx_types_name ON types(name);
105
+
106
+ -- ------------------------------------------------------------
107
+ -- Abhängigkeiten zu anderen AiDex-Instanzen
108
+ -- ------------------------------------------------------------
109
+ CREATE TABLE IF NOT EXISTS dependencies (
110
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
111
+ path TEXT NOT NULL UNIQUE,
112
+ name TEXT,
113
+ last_checked INTEGER
114
+ );
115
+
116
+ -- ------------------------------------------------------------
117
+ -- Projektstruktur (alle Dateien + Verzeichnisse)
118
+ -- ------------------------------------------------------------
119
+ CREATE TABLE IF NOT EXISTS project_files (
120
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
121
+ path TEXT NOT NULL UNIQUE,
122
+ type TEXT NOT NULL CHECK(type IN ('dir', 'code', 'config', 'doc', 'asset', 'test', 'other')),
123
+ extension TEXT,
124
+ indexed INTEGER DEFAULT 0
125
+ );
126
+
127
+ CREATE INDEX IF NOT EXISTS idx_project_files_path ON project_files(path);
128
+ CREATE INDEX IF NOT EXISTS idx_project_files_type ON project_files(type);
129
+
130
+ -- ------------------------------------------------------------
131
+ -- Metadaten
132
+ -- ------------------------------------------------------------
133
+ CREATE TABLE IF NOT EXISTS metadata (
134
+ key TEXT PRIMARY KEY,
135
+ value TEXT
136
+ );
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * AiDex - MCP Server Entry Point
4
+ *
5
+ * Provides persistent code indexing for Claude Code.
6
+ *
7
+ * Usage:
8
+ * node build/index.js - Start MCP server (default)
9
+ * node build/index.js scan <path> - Scan for .aidex directories
10
+ * node build/index.js init <path> - Index a project
11
+ */
12
+ export {};
13
+ //# sourceMappingURL=index.d.ts.map
package/build/index.js ADDED
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * AiDex - MCP Server Entry Point
4
+ *
5
+ * Provides persistent code indexing for Claude Code.
6
+ *
7
+ * Usage:
8
+ * node build/index.js - Start MCP server (default)
9
+ * node build/index.js scan <path> - Scan for .aidex directories
10
+ * node build/index.js init <path> - Index a project
11
+ */
12
+ import { createServer } from './server/mcp-server.js';
13
+ import { scan, init } from './commands/index.js';
14
+ import { PRODUCT_NAME, PRODUCT_NAME_LOWER } from './constants.js';
15
+ async function main() {
16
+ const args = process.argv.slice(2);
17
+ // CLI mode: scan
18
+ if (args[0] === 'scan') {
19
+ const searchPath = args[1];
20
+ if (!searchPath) {
21
+ console.error(`Usage: ${PRODUCT_NAME_LOWER} scan <path>`);
22
+ process.exit(1);
23
+ }
24
+ const result = scan({ path: searchPath });
25
+ if (!result.success) {
26
+ console.error(`Error: ${result.error}`);
27
+ process.exit(1);
28
+ }
29
+ console.log(`\n${PRODUCT_NAME} Indexes Found: ${result.projects.length}`);
30
+ console.log(`Scanned: ${result.scannedDirs} directories\n`);
31
+ if (result.projects.length === 0) {
32
+ console.log('No indexed projects found.');
33
+ }
34
+ else {
35
+ for (const proj of result.projects) {
36
+ console.log(`${proj.name}`);
37
+ console.log(` Path: ${proj.path}`);
38
+ console.log(` Files: ${proj.files} | Items: ${proj.items} | Methods: ${proj.methods} | Types: ${proj.types}`);
39
+ console.log(` Last indexed: ${proj.lastIndexed}`);
40
+ console.log();
41
+ }
42
+ }
43
+ return;
44
+ }
45
+ // CLI mode: init
46
+ if (args[0] === 'init') {
47
+ const projectPath = args[1];
48
+ if (!projectPath) {
49
+ console.error(`Usage: ${PRODUCT_NAME_LOWER} init <path>`);
50
+ process.exit(1);
51
+ }
52
+ console.log(`Indexing: ${projectPath}`);
53
+ const result = await init({ path: projectPath });
54
+ if (!result.success) {
55
+ console.error(`Error: ${result.errors.join(', ')}`);
56
+ process.exit(1);
57
+ }
58
+ console.log(`Done!`);
59
+ console.log(` Files: ${result.filesIndexed}`);
60
+ console.log(` Items: ${result.itemsFound}`);
61
+ console.log(` Methods: ${result.methodsFound}`);
62
+ console.log(` Types: ${result.typesFound}`);
63
+ console.log(` Time: ${result.durationMs}ms`);
64
+ return;
65
+ }
66
+ // Default: Start MCP server
67
+ const server = createServer();
68
+ await server.start();
69
+ }
70
+ main().catch((error) => {
71
+ console.error(`Failed to start ${PRODUCT_NAME}:`, error);
72
+ process.exit(1);
73
+ });
74
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Code extractor - extracts items, lines, and metadata from source files
3
+ */
4
+ import { type SupportedLanguage } from './tree-sitter.js';
5
+ import type { LineRow } from '../db/queries.js';
6
+ export interface ExtractedItem {
7
+ term: string;
8
+ lineNumber: number;
9
+ lineType: LineRow['line_type'];
10
+ }
11
+ export interface ExtractedLine {
12
+ lineNumber: number;
13
+ lineType: LineRow['line_type'];
14
+ }
15
+ export interface ExtractedMethod {
16
+ name: string;
17
+ prototype: string;
18
+ lineNumber: number;
19
+ visibility: string | null;
20
+ isStatic: boolean;
21
+ isAsync: boolean;
22
+ }
23
+ export interface ExtractedType {
24
+ name: string;
25
+ kind: 'class' | 'struct' | 'interface' | 'enum' | 'type';
26
+ lineNumber: number;
27
+ }
28
+ export interface ExtractionResult {
29
+ language: SupportedLanguage;
30
+ items: ExtractedItem[];
31
+ lines: ExtractedLine[];
32
+ methods: ExtractedMethod[];
33
+ types: ExtractedType[];
34
+ headerComments: string[];
35
+ }
36
+ /**
37
+ * Extract all indexable information from source code
38
+ */
39
+ export declare function extract(sourceCode: string, filePath: string): ExtractionResult | null;
40
+ export { detectLanguage, isSupported, getSupportedExtensions } from './tree-sitter.js';
41
+ //# sourceMappingURL=extractor.d.ts.map
@@ -0,0 +1,249 @@
1
+ /**
2
+ * Code extractor - extracts items, lines, and metadata from source files
3
+ */
4
+ import { detectLanguage, parseFile } from './tree-sitter.js';
5
+ import { getLanguageConfig } from './languages/index.js';
6
+ // ============================================================
7
+ // Main extraction function
8
+ // ============================================================
9
+ /**
10
+ * Extract all indexable information from source code
11
+ */
12
+ export function extract(sourceCode, filePath) {
13
+ const detectedLanguage = detectLanguage(filePath);
14
+ if (!detectedLanguage) {
15
+ return null;
16
+ }
17
+ const language = detectedLanguage;
18
+ const tree = parseFile(sourceCode, filePath);
19
+ if (!tree) {
20
+ return null;
21
+ }
22
+ const config = getLanguageConfig(language);
23
+ const sourceLines = sourceCode.split('\n');
24
+ const items = [];
25
+ const linesMap = new Map();
26
+ const methods = [];
27
+ const types = [];
28
+ const headerComments = [];
29
+ // Track if we've seen non-comment code (for header comments)
30
+ let seenCode = false;
31
+ /**
32
+ * Recursively visit all nodes in the tree
33
+ */
34
+ function visit(node) {
35
+ const lineNumber = node.startPosition.row + 1; // 1-based
36
+ // Check for comments
37
+ if (config.commentNodes.has(node.type)) {
38
+ if (!seenCode) {
39
+ // This is a header comment
40
+ headerComments.push(extractCommentText(node.text));
41
+ }
42
+ setLineType(lineNumber, 'comment');
43
+ extractIdentifiersFromComment(node.text, lineNumber, items, config.isKeyword);
44
+ return; // Don't recurse into comments
45
+ }
46
+ // Check for type declarations (class, struct, interface, etc.)
47
+ if (config.typeNodes.has(node.type)) {
48
+ seenCode = true;
49
+ const typeInfo = extractTypeInfo(node, language);
50
+ if (typeInfo) {
51
+ types.push(typeInfo);
52
+ setLineType(lineNumber, 'struct');
53
+ }
54
+ }
55
+ // Check for method declarations
56
+ if (config.methodNodes.has(node.type)) {
57
+ seenCode = true;
58
+ const methodInfo = extractMethodInfo(node, language, sourceLines);
59
+ if (methodInfo) {
60
+ methods.push(methodInfo);
61
+ setLineType(lineNumber, 'method');
62
+ }
63
+ }
64
+ // Check for property declarations
65
+ if (config.propertyNodes?.has(node.type)) {
66
+ seenCode = true;
67
+ setLineType(lineNumber, 'property');
68
+ }
69
+ // Check for identifiers
70
+ if (config.identifierNodes.has(node.type)) {
71
+ seenCode = true;
72
+ const term = node.text;
73
+ // Filter out keywords and very short terms
74
+ if (term.length >= 2 && !config.isKeyword(term)) {
75
+ items.push({
76
+ term,
77
+ lineNumber,
78
+ lineType: linesMap.get(lineNumber) ?? 'code',
79
+ });
80
+ setLineType(lineNumber, linesMap.get(lineNumber) ?? 'code');
81
+ }
82
+ }
83
+ // Recurse into children
84
+ for (const child of node.children) {
85
+ visit(child);
86
+ }
87
+ }
88
+ /**
89
+ * Set line type (doesn't overwrite more specific types)
90
+ */
91
+ function setLineType(lineNumber, type) {
92
+ const existing = linesMap.get(lineNumber);
93
+ if (!existing || shouldUpgrade(existing, type)) {
94
+ linesMap.set(lineNumber, type);
95
+ }
96
+ }
97
+ // Start traversal
98
+ visit(tree.rootNode);
99
+ // Convert lines map to array
100
+ const lines = Array.from(linesMap.entries())
101
+ .map(([lineNumber, lineType]) => ({ lineNumber, lineType }))
102
+ .sort((a, b) => a.lineNumber - b.lineNumber);
103
+ // Update item line types from final linesMap
104
+ for (const item of items) {
105
+ item.lineType = linesMap.get(item.lineNumber) ?? 'code';
106
+ }
107
+ return {
108
+ language,
109
+ items,
110
+ lines,
111
+ methods,
112
+ types,
113
+ headerComments,
114
+ };
115
+ }
116
+ // ============================================================
117
+ // Helper functions
118
+ // ============================================================
119
+ /**
120
+ * Priority order for line types (higher = more specific)
121
+ */
122
+ const LINE_TYPE_PRIORITY = {
123
+ code: 0,
124
+ string: 1,
125
+ comment: 2,
126
+ property: 3,
127
+ method: 4,
128
+ struct: 5,
129
+ };
130
+ /**
131
+ * Check if we should upgrade from one type to another
132
+ */
133
+ function shouldUpgrade(existing, newType) {
134
+ return LINE_TYPE_PRIORITY[newType] > LINE_TYPE_PRIORITY[existing];
135
+ }
136
+ /**
137
+ * Extract plain text from a comment (remove comment markers)
138
+ */
139
+ function extractCommentText(commentText) {
140
+ return commentText
141
+ .replace(/^\/\/\s*/gm, '') // Remove //
142
+ .replace(/^\/\*+\s*/g, '') // Remove /*
143
+ .replace(/\s*\*+\/$/g, '') // Remove */
144
+ .replace(/^\s*\*\s?/gm, '') // Remove * at start of lines
145
+ .replace(/^#+\s*/gm, '') // Remove # (Python)
146
+ .trim();
147
+ }
148
+ /**
149
+ * Extract identifiers from comment text
150
+ */
151
+ function extractIdentifiersFromComment(commentText, lineNumber, items, isKeyword) {
152
+ // Extract words that look like identifiers (CamelCase, snake_case, etc.)
153
+ const identifierPattern = /\b[A-Za-z_][A-Za-z0-9_]*\b/g;
154
+ const matches = commentText.match(identifierPattern) ?? [];
155
+ for (const term of matches) {
156
+ if (term.length >= 3 && !isKeyword(term)) {
157
+ items.push({
158
+ term,
159
+ lineNumber,
160
+ lineType: 'comment',
161
+ });
162
+ }
163
+ }
164
+ }
165
+ /**
166
+ * Extract type information from a type declaration node
167
+ */
168
+ function extractTypeInfo(node, language) {
169
+ // Find the name child
170
+ const nameNode = node.children.find(c => c.type === 'identifier' || c.type === 'type_identifier' || c.type === 'name');
171
+ if (!nameNode) {
172
+ return null;
173
+ }
174
+ // Determine kind from node type
175
+ let kind = 'class';
176
+ const nodeType = node.type.toLowerCase();
177
+ if (nodeType.includes('struct'))
178
+ kind = 'struct';
179
+ else if (nodeType.includes('interface'))
180
+ kind = 'interface';
181
+ else if (nodeType.includes('enum'))
182
+ kind = 'enum';
183
+ else if (nodeType.includes('type_alias'))
184
+ kind = 'type';
185
+ return {
186
+ name: nameNode.text,
187
+ kind,
188
+ lineNumber: node.startPosition.row + 1,
189
+ };
190
+ }
191
+ /**
192
+ * Extract method information from a method declaration node
193
+ */
194
+ function extractMethodInfo(node, language, sourceLines) {
195
+ // Find method name
196
+ let name = null;
197
+ let visibility = null;
198
+ let isStatic = false;
199
+ let isAsync = false;
200
+ for (const child of node.children) {
201
+ if (child.type === 'identifier' || child.type === 'property_identifier' || child.type === 'name') {
202
+ if (!name)
203
+ name = child.text;
204
+ }
205
+ // Check modifiers
206
+ const text = child.text.toLowerCase();
207
+ if (text === 'public' || text === 'private' || text === 'protected' || text === 'internal') {
208
+ visibility = text;
209
+ }
210
+ if (text === 'static')
211
+ isStatic = true;
212
+ if (text === 'async')
213
+ isAsync = true;
214
+ }
215
+ if (!name) {
216
+ return null;
217
+ }
218
+ // Extract prototype (first line of method, cleaned up)
219
+ const startLine = node.startPosition.row;
220
+ const endLine = Math.min(startLine + 2, sourceLines.length - 1); // Max 3 lines for prototype
221
+ let prototype = '';
222
+ for (let i = startLine; i <= endLine; i++) {
223
+ const line = sourceLines[i]?.trim() ?? '';
224
+ prototype += (prototype ? ' ' : '') + line;
225
+ // Stop at opening brace or arrow
226
+ if (line.includes('{') || line.includes('=>')) {
227
+ prototype = prototype.replace(/\s*\{.*$/, '').replace(/\s*=>.*$/, '').trim();
228
+ break;
229
+ }
230
+ }
231
+ // Clean up prototype
232
+ prototype = prototype
233
+ .replace(/\s+/g, ' ')
234
+ .replace(/\s*,\s*/g, ', ')
235
+ .trim();
236
+ return {
237
+ name,
238
+ prototype,
239
+ lineNumber: node.startPosition.row + 1,
240
+ visibility,
241
+ isStatic,
242
+ isAsync,
243
+ };
244
+ }
245
+ // ============================================================
246
+ // Exports
247
+ // ============================================================
248
+ export { detectLanguage, isSupported, getSupportedExtensions } from './tree-sitter.js';
249
+ //# sourceMappingURL=extractor.js.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Parser module exports
3
+ */
4
+ export { extract, detectLanguage, isSupported, getSupportedExtensions, type ExtractionResult, type ExtractedItem, type ExtractedLine, type ExtractedMethod, type ExtractedType, } from './extractor.js';
5
+ export { parse, parseFile, getParser, type SupportedLanguage } from './tree-sitter.js';
6
+ export { getLanguageConfig, isKeyword } from './languages/index.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Parser module exports
3
+ */
4
+ export { extract, detectLanguage, isSupported, getSupportedExtensions, } from './extractor.js';
5
+ export { parse, parseFile, getParser } from './tree-sitter.js';
6
+ export { getLanguageConfig, isKeyword } from './languages/index.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * C language configuration for AiDex
3
+ */
4
+ /**
5
+ * C keywords that should be filtered out during indexing
6
+ */
7
+ export declare const C_KEYWORDS: Set<string>;
8
+ /**
9
+ * Tree-sitter node types that represent identifiers in C
10
+ */
11
+ export declare const C_IDENTIFIER_NODES: Set<string>;
12
+ /**
13
+ * Tree-sitter node types for comments
14
+ */
15
+ export declare const C_COMMENT_NODES: Set<string>;
16
+ /**
17
+ * Tree-sitter node types for function declarations
18
+ */
19
+ export declare const C_METHOD_NODES: Set<string>;
20
+ /**
21
+ * Tree-sitter node types for type declarations
22
+ */
23
+ export declare const C_TYPE_NODES: Set<string>;
24
+ /**
25
+ * Check if a term is a C keyword
26
+ */
27
+ export declare function isKeyword(term: string): boolean;
28
+ //# sourceMappingURL=c.d.ts.map
@@ -0,0 +1,70 @@
1
+ /**
2
+ * C language configuration for AiDex
3
+ */
4
+ /**
5
+ * C keywords that should be filtered out during indexing
6
+ */
7
+ export const C_KEYWORDS = new Set([
8
+ // Storage class specifiers
9
+ 'auto', 'extern', 'inline', 'register', 'static', 'thread_local',
10
+ '__inline', '__inline__', '__forceinline', '__thread',
11
+ // Type qualifiers
12
+ 'const', 'constexpr', 'restrict', 'volatile',
13
+ '__restrict__', '__extension__', '_Atomic', '_Noreturn',
14
+ 'noreturn', '_Nonnull', 'alignas', '_Alignas',
15
+ // Primitive types
16
+ 'bool', 'char', 'double', 'float', 'int', 'void',
17
+ 'signed', 'unsigned', 'short', 'long',
18
+ 'size_t', 'ssize_t', 'ptrdiff_t', 'intptr_t', 'uintptr_t',
19
+ 'int8_t', 'int16_t', 'int32_t', 'int64_t',
20
+ 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t',
21
+ // Control flow
22
+ 'break', 'case', 'continue', 'default', 'do', 'else',
23
+ 'for', 'goto', 'if', 'return', 'switch', 'while',
24
+ // Type declaration
25
+ 'enum', 'struct', 'typedef', 'union',
26
+ // Special operations
27
+ 'alignof', 'offsetof', 'sizeof', '_alignof', '_Generic',
28
+ '__alignof', '__alignof__', '__asm', '__asm__', 'asm',
29
+ // Exception handling (Windows)
30
+ '__except', '__finally', '__leave', '__try',
31
+ // Literal values
32
+ 'NULL', 'nullptr', 'true', 'false', 'TRUE', 'FALSE',
33
+ ]);
34
+ /**
35
+ * Tree-sitter node types that represent identifiers in C
36
+ */
37
+ export const C_IDENTIFIER_NODES = new Set([
38
+ 'identifier',
39
+ 'type_identifier',
40
+ 'field_identifier',
41
+ ]);
42
+ /**
43
+ * Tree-sitter node types for comments
44
+ */
45
+ export const C_COMMENT_NODES = new Set([
46
+ 'comment',
47
+ ]);
48
+ /**
49
+ * Tree-sitter node types for function declarations
50
+ */
51
+ export const C_METHOD_NODES = new Set([
52
+ 'function_definition',
53
+ 'function_declarator',
54
+ ]);
55
+ /**
56
+ * Tree-sitter node types for type declarations
57
+ */
58
+ export const C_TYPE_NODES = new Set([
59
+ 'struct_specifier',
60
+ 'union_specifier',
61
+ 'enum_specifier',
62
+ 'type_definition',
63
+ ]);
64
+ /**
65
+ * Check if a term is a C keyword
66
+ */
67
+ export function isKeyword(term) {
68
+ return C_KEYWORDS.has(term);
69
+ }
70
+ //# sourceMappingURL=c.js.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * C++ language configuration for AiDex
3
+ */
4
+ /**
5
+ * C++ keywords that should be filtered out during indexing
6
+ */
7
+ export declare const CPP_KEYWORDS: Set<string>;
8
+ /**
9
+ * Tree-sitter node types that represent identifiers in C++
10
+ */
11
+ export declare const CPP_IDENTIFIER_NODES: Set<string>;
12
+ /**
13
+ * Tree-sitter node types for comments
14
+ */
15
+ export declare const CPP_COMMENT_NODES: Set<string>;
16
+ /**
17
+ * Tree-sitter node types for function declarations
18
+ */
19
+ export declare const CPP_METHOD_NODES: Set<string>;
20
+ /**
21
+ * Tree-sitter node types for type declarations
22
+ */
23
+ export declare const CPP_TYPE_NODES: Set<string>;
24
+ /**
25
+ * Check if a term is a C++ keyword
26
+ */
27
+ export declare function isKeyword(term: string): boolean;
28
+ //# sourceMappingURL=cpp.d.ts.map