@saluzi/codegraph 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/dist/bin/codegraph.d.ts +25 -0
  2. package/dist/bin/node-version-check.d.ts +37 -0
  3. package/dist/bin/uninstall.d.ts +14 -0
  4. package/dist/context/formatter.d.ts +33 -0
  5. package/dist/context/formatter.js +244 -0
  6. package/dist/context/index.d.ts +117 -0
  7. package/dist/context/index.js +1050 -0
  8. package/dist/db/index.d.ts +101 -0
  9. package/dist/db/index.js +250 -0
  10. package/dist/db/migrations.d.ts +47 -0
  11. package/dist/db/migrations.js +131 -0
  12. package/dist/db/queries.d.ts +291 -0
  13. package/dist/db/queries.js +1349 -0
  14. package/dist/db/schema.sql +151 -0
  15. package/dist/db/sqlite-adapter.d.ts +49 -0
  16. package/dist/db/sqlite-adapter.js +141 -0
  17. package/dist/directory.d.ts +62 -0
  18. package/dist/directory.js +264 -0
  19. package/dist/errors.d.ts +149 -0
  20. package/dist/errors.js +219 -0
  21. package/dist/extraction/dfm-extractor.d.ts +31 -0
  22. package/dist/extraction/dfm-extractor.js +151 -0
  23. package/dist/extraction/grammars.d.ts +94 -0
  24. package/dist/extraction/grammars.js +357 -0
  25. package/dist/extraction/index.d.ts +148 -0
  26. package/dist/extraction/index.js +1286 -0
  27. package/dist/extraction/languages/c-cpp.d.ts +4 -0
  28. package/dist/extraction/languages/c-cpp.js +126 -0
  29. package/dist/extraction/languages/csharp.d.ts +3 -0
  30. package/dist/extraction/languages/csharp.js +72 -0
  31. package/dist/extraction/languages/dart.d.ts +3 -0
  32. package/dist/extraction/languages/dart.js +192 -0
  33. package/dist/extraction/languages/go.d.ts +3 -0
  34. package/dist/extraction/languages/go.js +58 -0
  35. package/dist/extraction/languages/index.d.ts +10 -0
  36. package/dist/extraction/languages/index.js +49 -0
  37. package/dist/extraction/languages/java.d.ts +3 -0
  38. package/dist/extraction/languages/java.js +64 -0
  39. package/dist/extraction/languages/javascript.d.ts +3 -0
  40. package/dist/extraction/languages/javascript.js +90 -0
  41. package/dist/extraction/languages/kotlin.d.ts +3 -0
  42. package/dist/extraction/languages/kotlin.js +253 -0
  43. package/dist/extraction/languages/lua.d.ts +3 -0
  44. package/dist/extraction/languages/lua.js +150 -0
  45. package/dist/extraction/languages/luau.d.ts +3 -0
  46. package/dist/extraction/languages/luau.js +37 -0
  47. package/dist/extraction/languages/pascal.d.ts +3 -0
  48. package/dist/extraction/languages/pascal.js +66 -0
  49. package/dist/extraction/languages/php.d.ts +3 -0
  50. package/dist/extraction/languages/php.js +107 -0
  51. package/dist/extraction/languages/python.d.ts +3 -0
  52. package/dist/extraction/languages/python.js +56 -0
  53. package/dist/extraction/languages/ruby.d.ts +3 -0
  54. package/dist/extraction/languages/ruby.js +114 -0
  55. package/dist/extraction/languages/rust.d.ts +3 -0
  56. package/dist/extraction/languages/rust.js +109 -0
  57. package/dist/extraction/languages/scala.d.ts +3 -0
  58. package/dist/extraction/languages/scala.js +139 -0
  59. package/dist/extraction/languages/swift.d.ts +3 -0
  60. package/dist/extraction/languages/swift.js +91 -0
  61. package/dist/extraction/languages/typescript.d.ts +3 -0
  62. package/dist/extraction/languages/typescript.js +129 -0
  63. package/dist/extraction/liquid-extractor.d.ts +52 -0
  64. package/dist/extraction/liquid-extractor.js +313 -0
  65. package/dist/extraction/parse-worker.d.ts +8 -0
  66. package/dist/extraction/parse-worker.js +94 -0
  67. package/dist/extraction/svelte-extractor.d.ts +56 -0
  68. package/dist/extraction/svelte-extractor.js +272 -0
  69. package/dist/extraction/tree-sitter-helpers.d.ts +39 -0
  70. package/dist/extraction/tree-sitter-helpers.js +103 -0
  71. package/dist/extraction/tree-sitter-types.d.ts +191 -0
  72. package/dist/extraction/tree-sitter-types.js +10 -0
  73. package/dist/extraction/tree-sitter.d.ts +238 -0
  74. package/dist/extraction/tree-sitter.js +2430 -0
  75. package/dist/extraction/vue-extractor.d.ts +36 -0
  76. package/dist/extraction/vue-extractor.js +163 -0
  77. package/dist/extraction/wasm/tree-sitter-c.wasm +0 -0
  78. package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
  79. package/dist/extraction/wasm/tree-sitter-cpp.wasm +0 -0
  80. package/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
  81. package/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
  82. package/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
  83. package/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
  84. package/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
  85. package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
  86. package/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
  87. package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  88. package/dist/extraction/wasm/tree-sitter-php.wasm +0 -0
  89. package/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
  90. package/dist/extraction/wasm/tree-sitter-ruby.wasm +0 -0
  91. package/dist/extraction/wasm/tree-sitter-rust.wasm +0 -0
  92. package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  93. package/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
  94. package/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
  95. package/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
  96. package/dist/extraction/wasm-runtime-flags.d.ts +46 -0
  97. package/dist/extraction/wasm-runtime-flags.js +105 -0
  98. package/dist/graph/index.d.ts +8 -0
  99. package/dist/graph/index.js +13 -0
  100. package/dist/graph/queries.d.ts +109 -0
  101. package/dist/graph/queries.js +366 -0
  102. package/dist/graph/traversal.d.ts +137 -0
  103. package/dist/graph/traversal.js +528 -0
  104. package/dist/index.d.ts +509 -0
  105. package/dist/index.js +800 -0
  106. package/dist/installer/claude-md-template.d.ts +19 -0
  107. package/dist/installer/config-writer.d.ts +29 -0
  108. package/dist/installer/index.d.ts +140 -0
  109. package/dist/installer/instructions-template.d.ts +30 -0
  110. package/dist/installer/targets/claude.d.ts +55 -0
  111. package/dist/installer/targets/codex.d.ts +18 -0
  112. package/dist/installer/targets/cursor.d.ts +35 -0
  113. package/dist/installer/targets/hermes.d.ts +18 -0
  114. package/dist/installer/targets/opencode.d.ts +30 -0
  115. package/dist/installer/targets/registry.d.ts +38 -0
  116. package/dist/installer/targets/shared.d.ts +92 -0
  117. package/dist/installer/targets/toml.d.ts +64 -0
  118. package/dist/installer/targets/types.d.ts +122 -0
  119. package/dist/mcp/index.d.ts +98 -0
  120. package/dist/mcp/server-instructions.d.ts +20 -0
  121. package/dist/mcp/tools.d.ts +269 -0
  122. package/dist/mcp/transport.d.ts +117 -0
  123. package/dist/resolution/frameworks/cargo-workspace.d.ts +20 -0
  124. package/dist/resolution/frameworks/cargo-workspace.js +225 -0
  125. package/dist/resolution/frameworks/csharp.d.ts +8 -0
  126. package/dist/resolution/frameworks/csharp.js +213 -0
  127. package/dist/resolution/frameworks/drupal.d.ts +51 -0
  128. package/dist/resolution/frameworks/drupal.js +335 -0
  129. package/dist/resolution/frameworks/express.d.ts +8 -0
  130. package/dist/resolution/frameworks/express.js +225 -0
  131. package/dist/resolution/frameworks/go.d.ts +8 -0
  132. package/dist/resolution/frameworks/go.js +158 -0
  133. package/dist/resolution/frameworks/index.d.ts +52 -0
  134. package/dist/resolution/frameworks/index.js +137 -0
  135. package/dist/resolution/frameworks/java.d.ts +8 -0
  136. package/dist/resolution/frameworks/java.js +177 -0
  137. package/dist/resolution/frameworks/laravel.d.ts +13 -0
  138. package/dist/resolution/frameworks/laravel.js +248 -0
  139. package/dist/resolution/frameworks/nestjs.d.ts +26 -0
  140. package/dist/resolution/frameworks/nestjs.js +374 -0
  141. package/dist/resolution/frameworks/python.d.ts +10 -0
  142. package/dist/resolution/frameworks/python.js +278 -0
  143. package/dist/resolution/frameworks/react.d.ts +8 -0
  144. package/dist/resolution/frameworks/react.js +272 -0
  145. package/dist/resolution/frameworks/ruby.d.ts +8 -0
  146. package/dist/resolution/frameworks/ruby.js +198 -0
  147. package/dist/resolution/frameworks/rust.d.ts +8 -0
  148. package/dist/resolution/frameworks/rust.js +207 -0
  149. package/dist/resolution/frameworks/svelte.d.ts +9 -0
  150. package/dist/resolution/frameworks/svelte.js +249 -0
  151. package/dist/resolution/frameworks/swift.d.ts +10 -0
  152. package/dist/resolution/frameworks/swift.js +376 -0
  153. package/dist/resolution/frameworks/vue.d.ts +9 -0
  154. package/dist/resolution/frameworks/vue.js +306 -0
  155. package/dist/resolution/import-resolver.d.ts +61 -0
  156. package/dist/resolution/import-resolver.js +663 -0
  157. package/dist/resolution/index.d.ts +118 -0
  158. package/dist/resolution/index.js +744 -0
  159. package/dist/resolution/lru-cache.d.ts +24 -0
  160. package/dist/resolution/lru-cache.js +62 -0
  161. package/dist/resolution/name-matcher.d.ts +50 -0
  162. package/dist/resolution/name-matcher.js +384 -0
  163. package/dist/resolution/path-aliases.d.ts +72 -0
  164. package/dist/resolution/path-aliases.js +238 -0
  165. package/dist/resolution/strip-comments.d.ts +40 -0
  166. package/dist/resolution/strip-comments.js +441 -0
  167. package/dist/resolution/types.d.ts +181 -0
  168. package/dist/resolution/types.js +8 -0
  169. package/dist/search/query-parser.d.ts +61 -0
  170. package/dist/search/query-parser.js +177 -0
  171. package/dist/search/query-utils.d.ts +59 -0
  172. package/dist/search/query-utils.js +383 -0
  173. package/dist/sync/git-hooks.d.ts +54 -0
  174. package/dist/sync/git-hooks.js +223 -0
  175. package/dist/sync/index.d.ts +25 -0
  176. package/dist/sync/index.js +28 -0
  177. package/dist/sync/watch-policy.d.ts +51 -0
  178. package/dist/sync/watch-policy.js +124 -0
  179. package/dist/sync/watcher.d.ts +83 -0
  180. package/dist/sync/watcher.js +192 -0
  181. package/dist/types.d.ts +433 -0
  182. package/dist/types.js +75 -0
  183. package/dist/ui/glyphs.d.ts +42 -0
  184. package/dist/ui/shimmer-progress.d.ts +11 -0
  185. package/dist/ui/shimmer-worker.d.ts +2 -0
  186. package/dist/ui/types.d.ts +20 -0
  187. package/dist/utils.d.ts +231 -0
  188. package/dist/utils.js +549 -0
  189. package/package.json +24 -0
@@ -0,0 +1,4 @@
1
+ import type { LanguageExtractor } from '../tree-sitter-types'
2
+ export declare const cExtractor: LanguageExtractor
3
+ export declare const cppExtractor: LanguageExtractor
4
+ //# sourceMappingURL=c-cpp.d.ts.map
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cppExtractor = exports.cExtractor = void 0;
4
+ const tree_sitter_helpers_1 = require("../tree-sitter-helpers");
5
+ exports.cExtractor = {
6
+ functionTypes: ['function_definition'],
7
+ classTypes: [],
8
+ methodTypes: [],
9
+ interfaceTypes: [],
10
+ structTypes: ['struct_specifier'],
11
+ enumTypes: ['enum_specifier'],
12
+ enumMemberTypes: ['enumerator'],
13
+ typeAliasTypes: ['type_definition'], // typedef
14
+ importTypes: ['preproc_include'],
15
+ callTypes: ['call_expression'],
16
+ variableTypes: ['declaration'],
17
+ nameField: 'declarator',
18
+ bodyField: 'body',
19
+ paramsField: 'parameters',
20
+ resolveTypeAliasKind: (node, _source) => {
21
+ // C typedef: `typedef enum { ... } name;` or `typedef struct { ... } name;`
22
+ // The inner enum_specifier/struct_specifier is anonymous, but we want the typedef name
23
+ // to become the enum/struct node name.
24
+ for (let i = 0; i < node.namedChildCount; i++) {
25
+ const child = node.namedChild(i);
26
+ if (!child)
27
+ continue;
28
+ if (child.type === 'enum_specifier' && (0, tree_sitter_helpers_1.getChildByField)(child, 'body'))
29
+ return 'enum';
30
+ if (child.type === 'struct_specifier' && (0, tree_sitter_helpers_1.getChildByField)(child, 'body'))
31
+ return 'struct';
32
+ }
33
+ return undefined;
34
+ },
35
+ extractImport: (node, source) => {
36
+ const importText = source.substring(node.startIndex, node.endIndex).trim();
37
+ // C includes: #include <stdio.h>, #include "myheader.h"
38
+ const systemLib = node.namedChildren.find((c) => c.type === 'system_lib_string');
39
+ if (systemLib) {
40
+ return { moduleName: (0, tree_sitter_helpers_1.getNodeText)(systemLib, source).replace(/^<|>$/g, ''), signature: importText };
41
+ }
42
+ const stringLiteral = node.namedChildren.find((c) => c.type === 'string_literal');
43
+ if (stringLiteral) {
44
+ const stringContent = stringLiteral.namedChildren.find((c) => c.type === 'string_content');
45
+ if (stringContent) {
46
+ return { moduleName: (0, tree_sitter_helpers_1.getNodeText)(stringContent, source), signature: importText };
47
+ }
48
+ }
49
+ return null;
50
+ },
51
+ };
52
+ exports.cppExtractor = {
53
+ functionTypes: ['function_definition'],
54
+ classTypes: ['class_specifier'],
55
+ methodTypes: ['function_definition'],
56
+ interfaceTypes: [],
57
+ structTypes: ['struct_specifier'],
58
+ enumTypes: ['enum_specifier'],
59
+ enumMemberTypes: ['enumerator'],
60
+ typeAliasTypes: ['type_definition', 'alias_declaration'], // typedef and using
61
+ importTypes: ['preproc_include'],
62
+ callTypes: ['call_expression'],
63
+ variableTypes: ['declaration'],
64
+ nameField: 'declarator',
65
+ bodyField: 'body',
66
+ paramsField: 'parameters',
67
+ getVisibility: (node) => {
68
+ // Check for access specifier in parent
69
+ const parent = node.parent;
70
+ if (parent) {
71
+ for (let i = 0; i < parent.childCount; i++) {
72
+ const child = parent.child(i);
73
+ if (child?.type === 'access_specifier') {
74
+ const text = child.text;
75
+ if (text.includes('public'))
76
+ return 'public';
77
+ if (text.includes('private'))
78
+ return 'private';
79
+ if (text.includes('protected'))
80
+ return 'protected';
81
+ }
82
+ }
83
+ }
84
+ return undefined;
85
+ },
86
+ resolveTypeAliasKind: (node, _source) => {
87
+ // C++ typedef: `typedef enum { ... } name;` or `typedef struct { ... } name;`
88
+ for (let i = 0; i < node.namedChildCount; i++) {
89
+ const child = node.namedChild(i);
90
+ if (!child)
91
+ continue;
92
+ if (child.type === 'enum_specifier' && (0, tree_sitter_helpers_1.getChildByField)(child, 'body'))
93
+ return 'enum';
94
+ if (child.type === 'struct_specifier' && (0, tree_sitter_helpers_1.getChildByField)(child, 'body'))
95
+ return 'struct';
96
+ }
97
+ return undefined;
98
+ },
99
+ isMisparsedFunction: (name) => {
100
+ // C++ macros like NLOHMANN_JSON_NAMESPACE_BEGIN cause tree-sitter to misparse
101
+ // namespace blocks as function_definitions (e.g. name = "namespace detail").
102
+ // Also filter C++ keywords that tree-sitter occasionally misinterprets as
103
+ // function/method names (e.g. switch statements inside macro-confused scopes).
104
+ if (name.startsWith('namespace'))
105
+ return true;
106
+ const cppKeywords = ['switch', 'if', 'for', 'while', 'do', 'case', 'return'];
107
+ return cppKeywords.includes(name);
108
+ },
109
+ extractImport: (node, source) => {
110
+ const importText = source.substring(node.startIndex, node.endIndex).trim();
111
+ // C++ includes: #include <iostream>, #include "myheader.h"
112
+ const systemLib = node.namedChildren.find((c) => c.type === 'system_lib_string');
113
+ if (systemLib) {
114
+ return { moduleName: (0, tree_sitter_helpers_1.getNodeText)(systemLib, source).replace(/^<|>$/g, ''), signature: importText };
115
+ }
116
+ const stringLiteral = node.namedChildren.find((c) => c.type === 'string_literal');
117
+ if (stringLiteral) {
118
+ const stringContent = stringLiteral.namedChildren.find((c) => c.type === 'string_content');
119
+ if (stringContent) {
120
+ return { moduleName: (0, tree_sitter_helpers_1.getNodeText)(stringContent, source), signature: importText };
121
+ }
122
+ }
123
+ return null;
124
+ },
125
+ };
126
+ //# sourceMappingURL=c-cpp.js.map
@@ -0,0 +1,3 @@
1
+ import type { LanguageExtractor } from '../tree-sitter-types'
2
+ export declare const csharpExtractor: LanguageExtractor
3
+ //# sourceMappingURL=csharp.d.ts.map
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.csharpExtractor = void 0;
4
+ const tree_sitter_helpers_1 = require("../tree-sitter-helpers");
5
+ exports.csharpExtractor = {
6
+ functionTypes: [],
7
+ classTypes: ['class_declaration'],
8
+ methodTypes: ['method_declaration', 'constructor_declaration'],
9
+ interfaceTypes: ['interface_declaration'],
10
+ structTypes: ['struct_declaration'],
11
+ enumTypes: ['enum_declaration'],
12
+ enumMemberTypes: ['enum_member_declaration'],
13
+ typeAliasTypes: [],
14
+ importTypes: ['using_directive'],
15
+ callTypes: ['invocation_expression'],
16
+ variableTypes: ['local_declaration_statement'],
17
+ fieldTypes: ['field_declaration'],
18
+ propertyTypes: ['property_declaration'],
19
+ nameField: 'name',
20
+ bodyField: 'body',
21
+ paramsField: 'parameter_list',
22
+ getVisibility: (node) => {
23
+ for (let i = 0; i < node.childCount; i++) {
24
+ const child = node.child(i);
25
+ if (child?.type === 'modifier') {
26
+ const text = child.text;
27
+ if (text === 'public')
28
+ return 'public';
29
+ if (text === 'private')
30
+ return 'private';
31
+ if (text === 'protected')
32
+ return 'protected';
33
+ if (text === 'internal')
34
+ return 'internal';
35
+ }
36
+ }
37
+ return 'private'; // C# defaults to private
38
+ },
39
+ isStatic: (node) => {
40
+ for (let i = 0; i < node.childCount; i++) {
41
+ const child = node.child(i);
42
+ if (child?.type === 'modifier' && child.text === 'static') {
43
+ return true;
44
+ }
45
+ }
46
+ return false;
47
+ },
48
+ isAsync: (node) => {
49
+ for (let i = 0; i < node.childCount; i++) {
50
+ const child = node.child(i);
51
+ if (child?.type === 'modifier' && child.text === 'async') {
52
+ return true;
53
+ }
54
+ }
55
+ return false;
56
+ },
57
+ extractImport: (node, source) => {
58
+ const importText = source.substring(node.startIndex, node.endIndex).trim();
59
+ // C# using directives: using System, using System.Collections.Generic, using static X, using Alias = X
60
+ const qualifiedName = node.namedChildren.find((c) => c.type === 'qualified_name');
61
+ if (qualifiedName) {
62
+ return { moduleName: (0, tree_sitter_helpers_1.getNodeText)(qualifiedName, source), signature: importText };
63
+ }
64
+ // Simple namespace like "using System;" - get the first identifier
65
+ const identifier = node.namedChildren.find((c) => c.type === 'identifier');
66
+ if (identifier) {
67
+ return { moduleName: (0, tree_sitter_helpers_1.getNodeText)(identifier, source), signature: importText };
68
+ }
69
+ return null;
70
+ },
71
+ };
72
+ //# sourceMappingURL=csharp.js.map
@@ -0,0 +1,3 @@
1
+ import type { LanguageExtractor } from '../tree-sitter-types'
2
+ export declare const dartExtractor: LanguageExtractor
3
+ //# sourceMappingURL=dart.d.ts.map
@@ -0,0 +1,192 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dartExtractor = void 0;
4
+ const tree_sitter_helpers_1 = require("../tree-sitter-helpers");
5
+ exports.dartExtractor = {
6
+ functionTypes: ['function_signature'],
7
+ classTypes: ['class_definition'],
8
+ methodTypes: ['method_signature'],
9
+ interfaceTypes: [],
10
+ structTypes: [],
11
+ enumTypes: ['enum_declaration'],
12
+ enumMemberTypes: ['enum_constant'],
13
+ typeAliasTypes: ['type_alias'],
14
+ importTypes: ['import_or_export'],
15
+ callTypes: [], // Dart calls use identifier+selector, handled via extractBareCall
16
+ variableTypes: [],
17
+ extraClassNodeTypes: ['mixin_declaration', 'extension_declaration'],
18
+ resolveBody: (node, bodyField) => {
19
+ // Dart: function_body is a next sibling of function_signature/method_signature
20
+ if (node.type === 'function_signature' || node.type === 'method_signature') {
21
+ const next = node.nextNamedSibling;
22
+ if (next?.type === 'function_body')
23
+ return next;
24
+ return null;
25
+ }
26
+ // For class/mixin/extension: try standard field, then class_body/extension_body
27
+ const standard = node.childForFieldName(bodyField);
28
+ if (standard)
29
+ return standard;
30
+ return node.namedChildren.find((c) => c.type === 'class_body' || c.type === 'extension_body') || null;
31
+ },
32
+ nameField: 'name',
33
+ bodyField: 'body', // class_definition uses 'body' field
34
+ paramsField: 'formal_parameter_list',
35
+ returnField: 'type',
36
+ getSignature: (node, source) => {
37
+ // For function_signature: extract params + return type
38
+ // For method_signature: delegate to inner function_signature
39
+ let sig = node;
40
+ if (node.type === 'method_signature') {
41
+ const inner = node.namedChildren.find((c) => c.type === 'function_signature' || c.type === 'getter_signature' || c.type === 'setter_signature');
42
+ if (inner)
43
+ sig = inner;
44
+ }
45
+ const params = sig.namedChildren.find((c) => c.type === 'formal_parameter_list');
46
+ const retType = sig.namedChildren.find((c) => c.type === 'type_identifier' || c.type === 'void_type');
47
+ if (!params && !retType)
48
+ return undefined;
49
+ let result = '';
50
+ if (retType)
51
+ result += (0, tree_sitter_helpers_1.getNodeText)(retType, source) + ' ';
52
+ if (params)
53
+ result += (0, tree_sitter_helpers_1.getNodeText)(params, source);
54
+ return result.trim() || undefined;
55
+ },
56
+ getVisibility: (node) => {
57
+ // Dart convention: _ prefix means private, otherwise public
58
+ let nameNode = null;
59
+ if (node.type === 'method_signature') {
60
+ const inner = node.namedChildren.find((c) => c.type === 'function_signature' || c.type === 'getter_signature' || c.type === 'setter_signature');
61
+ if (inner)
62
+ nameNode = inner.namedChildren.find((c) => c.type === 'identifier') || null;
63
+ }
64
+ else {
65
+ nameNode = node.childForFieldName('name');
66
+ }
67
+ if (nameNode && nameNode.text.startsWith('_'))
68
+ return 'private';
69
+ return 'public';
70
+ },
71
+ isAsync: (node) => {
72
+ // In Dart, 'async' is on the function_body (next sibling), not the signature
73
+ const nextSibling = node.nextNamedSibling;
74
+ if (nextSibling?.type === 'function_body') {
75
+ for (let i = 0; i < nextSibling.childCount; i++) {
76
+ const child = nextSibling.child(i);
77
+ if (child?.type === 'async')
78
+ return true;
79
+ }
80
+ }
81
+ return false;
82
+ },
83
+ isStatic: (node) => {
84
+ // For method_signature, check for 'static' child
85
+ if (node.type === 'method_signature') {
86
+ for (let i = 0; i < node.childCount; i++) {
87
+ const child = node.child(i);
88
+ if (child?.type === 'static')
89
+ return true;
90
+ }
91
+ }
92
+ return false;
93
+ },
94
+ extractImport: (node, source) => {
95
+ const importText = source.substring(node.startIndex, node.endIndex).trim();
96
+ let moduleName = '';
97
+ // Dart imports: import 'dart:async'; import 'package:foo/bar.dart' as bar;
98
+ const libraryImport = node.namedChildren.find((c) => c.type === 'library_import');
99
+ if (libraryImport) {
100
+ const importSpec = libraryImport.namedChildren.find((c) => c.type === 'import_specification');
101
+ if (importSpec) {
102
+ const configurableUri = importSpec.namedChildren.find((c) => c.type === 'configurable_uri');
103
+ if (configurableUri) {
104
+ const uri = configurableUri.namedChildren.find((c) => c.type === 'uri');
105
+ if (uri) {
106
+ const stringLiteral = uri.namedChildren.find((c) => c.type === 'string_literal');
107
+ if (stringLiteral) {
108
+ moduleName = (0, tree_sitter_helpers_1.getNodeText)(stringLiteral, source).replace(/['"]/g, '');
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
114
+ // Also handle exports: export 'src/foo.dart';
115
+ if (!moduleName) {
116
+ const libraryExport = node.namedChildren.find((c) => c.type === 'library_export');
117
+ if (libraryExport) {
118
+ const configurableUri = libraryExport.namedChildren.find((c) => c.type === 'configurable_uri');
119
+ if (configurableUri) {
120
+ const uri = configurableUri.namedChildren.find((c) => c.type === 'uri');
121
+ if (uri) {
122
+ const stringLiteral = uri.namedChildren.find((c) => c.type === 'string_literal');
123
+ if (stringLiteral) {
124
+ moduleName = (0, tree_sitter_helpers_1.getNodeText)(stringLiteral, source).replace(/['"]/g, '');
125
+ }
126
+ }
127
+ }
128
+ }
129
+ }
130
+ if (moduleName) {
131
+ return { moduleName, signature: importText };
132
+ }
133
+ return null;
134
+ },
135
+ extractBareCall: (node, _source) => {
136
+ // Dart calls are: identifier + selector(argument_part), not a dedicated call node.
137
+ // Match on selector nodes that contain argument_part.
138
+ if (node.type === 'selector') {
139
+ const hasArgPart = node.namedChildren.some((c) => c.type === 'argument_part');
140
+ if (!hasArgPart)
141
+ return undefined;
142
+ const prev = node.previousNamedSibling;
143
+ if (!prev)
144
+ return undefined;
145
+ // Simple function/constructor call: prev is identifier (e.g., runApp(...), MyWidget(...))
146
+ if (prev.type === 'identifier') {
147
+ return prev.text;
148
+ }
149
+ // Method call: prev is selector with accessor (e.g., obj.method(...), Navigator.push(...))
150
+ if (prev.type === 'selector') {
151
+ const accessor = prev.namedChildren.find((c) => c.type === 'unconditional_assignable_selector' || c.type === 'conditional_assignable_selector');
152
+ if (accessor) {
153
+ const methodId = accessor.namedChildren.find((c) => c.type === 'identifier');
154
+ if (methodId) {
155
+ // Include receiver for first call in chain (receiver is a direct identifier)
156
+ const accessorPrev = prev.previousNamedSibling;
157
+ if (accessorPrev?.type === 'identifier') {
158
+ return accessorPrev.text + '.' + methodId.text;
159
+ }
160
+ return methodId.text;
161
+ }
162
+ }
163
+ }
164
+ // super.method() / this.method(): prev is bare unconditional_assignable_selector
165
+ if (prev.type === 'unconditional_assignable_selector' || prev.type === 'conditional_assignable_selector') {
166
+ const methodId = prev.namedChildren.find((c) => c.type === 'identifier');
167
+ if (methodId)
168
+ return methodId.text;
169
+ }
170
+ return undefined;
171
+ }
172
+ // new MyWidget() — explicit constructor call
173
+ if (node.type === 'new_expression') {
174
+ const typeId = node.namedChildren.find((c) => c.type === 'type_identifier');
175
+ if (typeId)
176
+ return typeId.text;
177
+ return undefined;
178
+ }
179
+ // const EdgeInsets.all(8.0) — const constructor call
180
+ if (node.type === 'const_object_expression') {
181
+ const typeId = node.namedChildren.find((c) => c.type === 'type_identifier');
182
+ const nameId = node.namedChildren.find((c) => c.type === 'identifier');
183
+ if (typeId && nameId)
184
+ return typeId.text + '.' + nameId.text;
185
+ if (typeId)
186
+ return typeId.text;
187
+ return undefined;
188
+ }
189
+ return undefined;
190
+ },
191
+ };
192
+ //# sourceMappingURL=dart.js.map
@@ -0,0 +1,3 @@
1
+ import type { LanguageExtractor } from '../tree-sitter-types'
2
+ export declare const goExtractor: LanguageExtractor
3
+ //# sourceMappingURL=go.d.ts.map
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.goExtractor = void 0;
4
+ const tree_sitter_helpers_1 = require("../tree-sitter-helpers");
5
+ exports.goExtractor = {
6
+ functionTypes: ['function_declaration'],
7
+ classTypes: [], // Go doesn't have classes
8
+ methodTypes: ['method_declaration'],
9
+ interfaceTypes: [], // Handled via type_spec → resolveTypeAliasKind
10
+ structTypes: [], // Handled via type_spec → resolveTypeAliasKind
11
+ enumTypes: [],
12
+ typeAliasTypes: ['type_spec'], // Go type declarations
13
+ importTypes: ['import_declaration'],
14
+ callTypes: ['call_expression'],
15
+ variableTypes: ['var_declaration', 'short_var_declaration', 'const_declaration'],
16
+ methodsAreTopLevel: true,
17
+ nameField: 'name',
18
+ bodyField: 'body',
19
+ paramsField: 'parameters',
20
+ returnField: 'result',
21
+ getSignature: (node, source) => {
22
+ const params = (0, tree_sitter_helpers_1.getChildByField)(node, 'parameters');
23
+ const result = (0, tree_sitter_helpers_1.getChildByField)(node, 'result');
24
+ if (!params)
25
+ return undefined;
26
+ let sig = (0, tree_sitter_helpers_1.getNodeText)(params, source);
27
+ if (result) {
28
+ sig += ' ' + (0, tree_sitter_helpers_1.getNodeText)(result, source);
29
+ }
30
+ return sig;
31
+ },
32
+ resolveTypeAliasKind: (node, _source) => {
33
+ // Go type_spec: `type Foo struct { ... }` or `type Bar interface { ... }`
34
+ // The inner type is in the 'type' field of the type_spec node
35
+ const typeChild = (0, tree_sitter_helpers_1.getChildByField)(node, 'type');
36
+ if (!typeChild)
37
+ return undefined;
38
+ if (typeChild.type === 'struct_type')
39
+ return 'struct';
40
+ if (typeChild.type === 'interface_type')
41
+ return 'interface';
42
+ return undefined;
43
+ },
44
+ getReceiverType: (node, source) => {
45
+ // Go method_declaration has a "receiver" field: func (sl *scrapeLoop) run(...)
46
+ // The receiver is a parameter_list containing a parameter_declaration
47
+ // with a type that may be a pointer_type (*scrapeLoop) or plain type (scrapeLoop)
48
+ const receiver = (0, tree_sitter_helpers_1.getChildByField)(node, 'receiver');
49
+ if (!receiver)
50
+ return undefined;
51
+ // Find the type identifier inside the receiver
52
+ const text = (0, tree_sitter_helpers_1.getNodeText)(receiver, source);
53
+ // Extract type name from patterns like "(sl *Type)", "(sl Type)", "(*Type)", "(Type)"
54
+ const match = text.match(/\*?\s*([A-Za-z_][A-Za-z0-9_]*)\s*\)/);
55
+ return match?.[1];
56
+ },
57
+ };
58
+ //# sourceMappingURL=go.js.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Per-language extraction configurations.
3
+ *
4
+ * Each file exports a LanguageExtractor config object.
5
+ * This barrel builds the EXTRACTORS map consumed by TreeSitterExtractor.
6
+ */
7
+ import { Language } from '../../types'
8
+ import type { LanguageExtractor } from '../tree-sitter-types'
9
+ export declare const EXTRACTORS: Partial<Record<Language, LanguageExtractor>>
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ /**
3
+ * Per-language extraction configurations.
4
+ *
5
+ * Each file exports a LanguageExtractor config object.
6
+ * This barrel builds the EXTRACTORS map consumed by TreeSitterExtractor.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.EXTRACTORS = void 0;
10
+ const typescript_1 = require("./typescript");
11
+ const javascript_1 = require("./javascript");
12
+ const python_1 = require("./python");
13
+ const go_1 = require("./go");
14
+ const rust_1 = require("./rust");
15
+ const java_1 = require("./java");
16
+ const c_cpp_1 = require("./c-cpp");
17
+ const csharp_1 = require("./csharp");
18
+ const php_1 = require("./php");
19
+ const ruby_1 = require("./ruby");
20
+ const swift_1 = require("./swift");
21
+ const kotlin_1 = require("./kotlin");
22
+ const dart_1 = require("./dart");
23
+ const pascal_1 = require("./pascal");
24
+ const scala_1 = require("./scala");
25
+ const lua_1 = require("./lua");
26
+ const luau_1 = require("./luau");
27
+ exports.EXTRACTORS = {
28
+ typescript: typescript_1.typescriptExtractor,
29
+ tsx: typescript_1.typescriptExtractor,
30
+ javascript: javascript_1.javascriptExtractor,
31
+ jsx: javascript_1.javascriptExtractor,
32
+ python: python_1.pythonExtractor,
33
+ go: go_1.goExtractor,
34
+ rust: rust_1.rustExtractor,
35
+ java: java_1.javaExtractor,
36
+ c: c_cpp_1.cExtractor,
37
+ cpp: c_cpp_1.cppExtractor,
38
+ csharp: csharp_1.csharpExtractor,
39
+ php: php_1.phpExtractor,
40
+ ruby: ruby_1.rubyExtractor,
41
+ swift: swift_1.swiftExtractor,
42
+ kotlin: kotlin_1.kotlinExtractor,
43
+ dart: dart_1.dartExtractor,
44
+ pascal: pascal_1.pascalExtractor,
45
+ scala: scala_1.scalaExtractor,
46
+ lua: lua_1.luaExtractor,
47
+ luau: luau_1.luauExtractor,
48
+ };
49
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,3 @@
1
+ import type { LanguageExtractor } from '../tree-sitter-types'
2
+ export declare const javaExtractor: LanguageExtractor
3
+ //# sourceMappingURL=java.d.ts.map
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.javaExtractor = void 0;
4
+ const tree_sitter_helpers_1 = require("../tree-sitter-helpers");
5
+ exports.javaExtractor = {
6
+ functionTypes: [],
7
+ classTypes: ['class_declaration'],
8
+ methodTypes: ['method_declaration', 'constructor_declaration'],
9
+ interfaceTypes: ['interface_declaration'],
10
+ structTypes: [],
11
+ enumTypes: ['enum_declaration'],
12
+ enumMemberTypes: ['enum_constant'],
13
+ typeAliasTypes: [],
14
+ importTypes: ['import_declaration'],
15
+ callTypes: ['method_invocation'],
16
+ variableTypes: ['local_variable_declaration'],
17
+ fieldTypes: ['field_declaration'],
18
+ nameField: 'name',
19
+ bodyField: 'body',
20
+ paramsField: 'parameters',
21
+ returnField: 'type',
22
+ getSignature: (node, source) => {
23
+ const params = (0, tree_sitter_helpers_1.getChildByField)(node, 'parameters');
24
+ const returnType = (0, tree_sitter_helpers_1.getChildByField)(node, 'type');
25
+ if (!params)
26
+ return undefined;
27
+ const paramsText = (0, tree_sitter_helpers_1.getNodeText)(params, source);
28
+ return returnType ? (0, tree_sitter_helpers_1.getNodeText)(returnType, source) + ' ' + paramsText : paramsText;
29
+ },
30
+ getVisibility: (node) => {
31
+ for (let i = 0; i < node.childCount; i++) {
32
+ const child = node.child(i);
33
+ if (child?.type === 'modifiers') {
34
+ const text = child.text;
35
+ if (text.includes('public'))
36
+ return 'public';
37
+ if (text.includes('private'))
38
+ return 'private';
39
+ if (text.includes('protected'))
40
+ return 'protected';
41
+ }
42
+ }
43
+ return undefined;
44
+ },
45
+ isStatic: (node) => {
46
+ for (let i = 0; i < node.childCount; i++) {
47
+ const child = node.child(i);
48
+ if (child?.type === 'modifiers' && child.text.includes('static')) {
49
+ return true;
50
+ }
51
+ }
52
+ return false;
53
+ },
54
+ extractImport: (node, source) => {
55
+ const importText = source.substring(node.startIndex, node.endIndex).trim();
56
+ const scopedId = node.namedChildren.find((c) => c.type === 'scoped_identifier');
57
+ if (scopedId) {
58
+ const moduleName = source.substring(scopedId.startIndex, scopedId.endIndex);
59
+ return { moduleName, signature: importText };
60
+ }
61
+ return null;
62
+ },
63
+ };
64
+ //# sourceMappingURL=java.js.map
@@ -0,0 +1,3 @@
1
+ import type { LanguageExtractor } from '../tree-sitter-types'
2
+ export declare const javascriptExtractor: LanguageExtractor
3
+ //# sourceMappingURL=javascript.d.ts.map