@aiready/core 0.23.20 → 0.23.21

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 (107) hide show
  1. package/dist/chunk-2N7ISIKE.mjs +158 -0
  2. package/dist/chunk-ARUIZO7M.mjs +297 -0
  3. package/dist/chunk-CYC5EGEI.mjs +297 -0
  4. package/dist/{chunk-REU6OUBT.mjs → chunk-DBOPSRBC.mjs} +47 -22
  5. package/dist/chunk-EZ7ECLAZ.mjs +299 -0
  6. package/dist/chunk-FNPULWG7.mjs +248 -0
  7. package/dist/chunk-FZTFKZUQ.mjs +250 -0
  8. package/dist/chunk-GTS642BQ.mjs +262 -0
  9. package/dist/chunk-IXPY5J4K.mjs +248 -0
  10. package/dist/chunk-JJQLYW6Z.mjs +111 -0
  11. package/dist/chunk-L6BKANJC.mjs +130 -0
  12. package/dist/chunk-LXEO5PG3.mjs +292 -0
  13. package/dist/chunk-LZHO636W.mjs +501 -0
  14. package/dist/chunk-MTK2IIDZ.mjs +262 -0
  15. package/dist/chunk-QDCQETSI.mjs +262 -0
  16. package/dist/chunk-QZNY7B2N.mjs +248 -0
  17. package/dist/chunk-RCZSMGCX.mjs +250 -0
  18. package/dist/chunk-SWZOT67M.mjs +250 -0
  19. package/dist/chunk-U3IY2CFC.mjs +36 -0
  20. package/dist/chunk-UBCM5Y6R.mjs +275 -0
  21. package/dist/chunk-UTCRW3N7.mjs +301 -0
  22. package/dist/{chunk-SQHS6PFL.mjs → chunk-UYLH35LA.mjs} +47 -22
  23. package/dist/{chunk-ZB3EHHAG.mjs → chunk-WVNVC2PP.mjs} +90 -60
  24. package/dist/chunk-WYOW6O3P.mjs +114 -0
  25. package/dist/{chunk-RMH2TPAT.mjs → chunk-YRSSR4KN.mjs} +87 -59
  26. package/dist/client-2xbeKnrg.d.mts +1291 -0
  27. package/dist/client-2xbeKnrg.d.ts +1291 -0
  28. package/dist/client-4HLAGzFg.d.mts +1291 -0
  29. package/dist/client-4HLAGzFg.d.ts +1291 -0
  30. package/dist/client-B4TQwNa7.d.mts +1290 -0
  31. package/dist/client-B4TQwNa7.d.ts +1290 -0
  32. package/dist/client-Bdi4ty0v.d.mts +1294 -0
  33. package/dist/client-Bdi4ty0v.d.ts +1294 -0
  34. package/dist/client-BsKpUH3H.d.mts +1339 -0
  35. package/dist/client-BsKpUH3H.d.ts +1339 -0
  36. package/dist/client-Bv1zOaWF.d.mts +1291 -0
  37. package/dist/client-Bv1zOaWF.d.ts +1291 -0
  38. package/dist/client-Bz9YJMIX.d.mts +1290 -0
  39. package/dist/client-Bz9YJMIX.d.ts +1290 -0
  40. package/dist/client-CBpzm34X.d.mts +1291 -0
  41. package/dist/client-CBpzm34X.d.ts +1291 -0
  42. package/dist/client-CNu_tCZZ.d.mts +1305 -0
  43. package/dist/client-CNu_tCZZ.d.ts +1305 -0
  44. package/dist/client-CmEvxxQu.d.mts +1339 -0
  45. package/dist/client-CmEvxxQu.d.ts +1339 -0
  46. package/dist/client-DGMAxkZc.d.mts +1339 -0
  47. package/dist/client-DGMAxkZc.d.ts +1339 -0
  48. package/dist/client-DZq-CqcD.d.mts +1292 -0
  49. package/dist/client-DZq-CqcD.d.ts +1292 -0
  50. package/dist/{client-CYz0qxGB.d.mts → client-DcqGfDTt.d.mts} +90 -23
  51. package/dist/{client-CYz0qxGB.d.ts → client-DcqGfDTt.d.ts} +90 -23
  52. package/dist/{client-jGuH6TAG.d.mts → client-O8RvSRm0.d.mts} +18 -1
  53. package/dist/{client-jGuH6TAG.d.ts → client-O8RvSRm0.d.ts} +18 -1
  54. package/dist/client.d.mts +1 -1
  55. package/dist/client.d.ts +1 -1
  56. package/dist/client.js +47 -13
  57. package/dist/client.mjs +6 -4
  58. package/dist/csharp-parser-4ZKCSX5B.mjs +9 -0
  59. package/dist/csharp-parser-5HKICCRR.mjs +9 -0
  60. package/dist/csharp-parser-JCKXIAJW.mjs +9 -0
  61. package/dist/go-parser-J4KIH4RG.mjs +9 -0
  62. package/dist/go-parser-TKXL3DVH.mjs +9 -0
  63. package/dist/go-parser-XOM232XZ.mjs +9 -0
  64. package/dist/index.d.mts +269 -60
  65. package/dist/index.d.ts +269 -60
  66. package/dist/index.js +3733 -3031
  67. package/dist/index.mjs +802 -2029
  68. package/dist/java-parser-3KHXOXRQ.mjs +9 -0
  69. package/dist/java-parser-MASGS4WB.mjs +9 -0
  70. package/dist/java-parser-T5LXD63J.mjs +9 -0
  71. package/dist/python-parser-FNFK2473.mjs +8 -0
  72. package/dist/typescript-parser-2GGNRNB5.mjs +7 -0
  73. package/dist/typescript-parser-3ENJ6C7H.mjs +7 -0
  74. package/dist/typescript-parser-4GI7DPSW.mjs +7 -0
  75. package/dist/typescript-parser-4H3HUBO4.mjs +7 -0
  76. package/dist/typescript-parser-K63IVZMF.mjs +7 -0
  77. package/dist/typescript-parser-ZJKROMQG.mjs +7 -0
  78. package/package.json +1 -1
  79. package/dist/chunk-2Y6WZCES.mjs +0 -859
  80. package/dist/chunk-5SHLHMH7.mjs +0 -760
  81. package/dist/chunk-CGOS2J6T.mjs +0 -807
  82. package/dist/chunk-FMNCV4CC.mjs +0 -859
  83. package/dist/chunk-Q55AMEFV.mjs +0 -760
  84. package/dist/chunk-ST75O5C5.mjs +0 -859
  85. package/dist/chunk-TJXR2CHZ.mjs +0 -799
  86. package/dist/client-BEoUYNLp.d.mts +0 -1191
  87. package/dist/client-BEoUYNLp.d.ts +0 -1191
  88. package/dist/client-BrIMPk89.d.mts +0 -1214
  89. package/dist/client-BrIMPk89.d.ts +0 -1214
  90. package/dist/client-C5BuGX4F.d.mts +0 -1205
  91. package/dist/client-C5BuGX4F.d.ts +0 -1205
  92. package/dist/client-CKcjnPXt.d.mts +0 -1214
  93. package/dist/client-CKcjnPXt.d.ts +0 -1214
  94. package/dist/client-CLulBnie.d.mts +0 -1182
  95. package/dist/client-CLulBnie.d.ts +0 -1182
  96. package/dist/client-CQwvp8ep.d.mts +0 -1182
  97. package/dist/client-CQwvp8ep.d.ts +0 -1182
  98. package/dist/client-DLvFR2qA.d.mts +0 -1197
  99. package/dist/client-DLvFR2qA.d.ts +0 -1197
  100. package/dist/client-PFPdeo-z.d.mts +0 -1186
  101. package/dist/client-PFPdeo-z.d.ts +0 -1186
  102. package/dist/client-WVCAIWdJ.d.mts +0 -1192
  103. package/dist/client-WVCAIWdJ.d.ts +0 -1192
  104. package/dist/client-pYldIAg2.d.mts +0 -1209
  105. package/dist/client-pYldIAg2.d.ts +0 -1209
  106. package/dist/client-wk2fgk1q.d.mts +0 -1184
  107. package/dist/client-wk2fgk1q.d.ts +0 -1184
@@ -0,0 +1,248 @@
1
+ import {
2
+ analyzeGeneralMetadata,
3
+ extractParameterNames
4
+ } from "./chunk-L6BKANJC.mjs";
5
+ import {
6
+ BaseLanguageParser
7
+ } from "./chunk-2N7ISIKE.mjs";
8
+
9
+ // src/parsers/csharp-parser.ts
10
+ var CSharpParser = class extends BaseLanguageParser {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.language = "csharp" /* CSharp */;
14
+ this.extensions = [".cs"];
15
+ }
16
+ getParserName() {
17
+ return "c_sharp";
18
+ }
19
+ /**
20
+ * Analyze metadata for a C# node (purity, side effects).
21
+ *
22
+ * @param node - Tree-sitter node to analyze.
23
+ * @param code - Source code for context.
24
+ * @returns Partial ExportInfo containing discovered metadata.
25
+ */
26
+ analyzeMetadata(node, code) {
27
+ return analyzeGeneralMetadata(node, code, {
28
+ sideEffectSignatures: ["Console.Write", "File.Write", "Logging."]
29
+ });
30
+ }
31
+ /**
32
+ * Fallback regex-based parsing when tree-sitter is unavailable.
33
+ *
34
+ * @param code - Source code content.
35
+ * @returns Consolidated ParseResult.
36
+ */
37
+ parseRegex(code) {
38
+ const lines = code.split("\n");
39
+ const exports = [];
40
+ const imports = [];
41
+ const usingRegex = /^using\s+([a-zA-Z0-9_.]+);/;
42
+ const classRegex = /^\s*(?:public\s+)?class\s+([a-zA-Z0-9_]+)/;
43
+ const methodRegex = /^\s*(?:public|protected)\s+(?:static\s+)?[a-zA-Z0-9_.]+\s+([a-zA-Z0-9_]+)\s*\(/;
44
+ let currentClassName = "";
45
+ lines.forEach((line, idx) => {
46
+ const usingMatch = line.match(usingRegex);
47
+ if (usingMatch) {
48
+ const source = usingMatch[1];
49
+ imports.push({
50
+ source,
51
+ specifiers: [source.split(".").pop() || source],
52
+ loc: {
53
+ start: { line: idx + 1, column: 0 },
54
+ end: { line: idx + 1, column: line.length }
55
+ }
56
+ });
57
+ }
58
+ const classMatch = line.match(classRegex);
59
+ if (classMatch) {
60
+ currentClassName = classMatch[1];
61
+ exports.push({
62
+ name: currentClassName,
63
+ type: "class",
64
+ visibility: "public",
65
+ isPure: true,
66
+ hasSideEffects: false,
67
+ loc: {
68
+ start: { line: idx + 1, column: 0 },
69
+ end: { line: idx + 1, column: line.length }
70
+ }
71
+ });
72
+ }
73
+ const methodMatch = line.match(methodRegex);
74
+ if (methodMatch && currentClassName) {
75
+ const name = methodMatch[1];
76
+ const isImpure = name.toLowerCase().includes("impure") || line.includes("Console.WriteLine");
77
+ exports.push({
78
+ name,
79
+ type: "function",
80
+ parentClass: currentClassName,
81
+ visibility: "public",
82
+ isPure: !isImpure,
83
+ hasSideEffects: isImpure,
84
+ loc: {
85
+ start: { line: idx + 1, column: 0 },
86
+ end: { line: idx + 1, column: line.length }
87
+ }
88
+ });
89
+ }
90
+ });
91
+ return {
92
+ exports,
93
+ imports,
94
+ language: "csharp" /* CSharp */,
95
+ warnings: ["Parser falling back to regex-based analysis"]
96
+ };
97
+ }
98
+ /**
99
+ * Extract import information (usings) using AST walk.
100
+ *
101
+ * @param rootNode - Root node of the C# AST.
102
+ * @returns Array of discovered FileImport objects.
103
+ */
104
+ extractImportsAST(rootNode) {
105
+ const imports = [];
106
+ const findUsings = (node) => {
107
+ if (node.type === "using_directive") {
108
+ const nameNode = node.childForFieldName("name") || node.children.find(
109
+ (c) => c.type === "qualified_name" || c.type === "identifier"
110
+ );
111
+ if (nameNode) {
112
+ const aliasNode = node.childForFieldName("alias");
113
+ imports.push({
114
+ source: nameNode.text,
115
+ specifiers: aliasNode ? [aliasNode.text] : [nameNode.text.split(".").pop() || nameNode.text],
116
+ loc: {
117
+ start: {
118
+ line: node.startPosition.row + 1,
119
+ column: node.startPosition.column
120
+ },
121
+ end: {
122
+ line: node.endPosition.row + 1,
123
+ column: node.endPosition.column
124
+ }
125
+ }
126
+ });
127
+ }
128
+ }
129
+ for (let i = 0; i < node.childCount; i++) {
130
+ const child = node.child(i);
131
+ if (child) findUsings(child);
132
+ }
133
+ };
134
+ findUsings(rootNode);
135
+ return imports;
136
+ }
137
+ /**
138
+ * Extract export information (classes, methods, properties) using AST walk.
139
+ * Handles nested namespaces and classes.
140
+ *
141
+ * @param rootNode - Root node of the C# AST.
142
+ * @param code - Source code for documentation extraction.
143
+ * @returns Array of discovered ExportInfo objects.
144
+ */
145
+ extractExportsAST(rootNode, code) {
146
+ const exports = [];
147
+ const traverse = (node, currentNamespace, currentClass) => {
148
+ let nextNamespace = currentNamespace;
149
+ let nextClass = currentClass;
150
+ if (node.type === "namespace_declaration" || node.type === "file_scoped_namespace_declaration") {
151
+ const nameNode = node.childForFieldName("name") || node.children.find(
152
+ (c) => c.type === "identifier" || c.type === "qualified_name"
153
+ );
154
+ if (nameNode) {
155
+ nextNamespace = currentNamespace ? `${currentNamespace}.${nameNode.text}` : nameNode.text;
156
+ }
157
+ } else if (node.type === "class_declaration" || node.type === "interface_declaration" || node.type === "enum_declaration" || node.type === "struct_declaration" || node.type === "record_declaration") {
158
+ const nameNode = node.childForFieldName("name") || node.children.find((c) => c.type === "identifier");
159
+ if (nameNode) {
160
+ const modifiers = this.getModifiers(node);
161
+ const isPublic = modifiers.includes("public") || modifiers.includes("protected");
162
+ if (isPublic) {
163
+ const metadata = this.analyzeMetadata(node, code);
164
+ const type = node.type.replace("_declaration", "");
165
+ const fullName = nextClass ? `${nextClass}.${nameNode.text}` : nextNamespace ? `${nextNamespace}.${nameNode.text}` : nameNode.text;
166
+ exports.push({
167
+ name: fullName,
168
+ type: type === "record" ? "class" : type,
169
+ loc: {
170
+ start: {
171
+ line: node.startPosition.row + 1,
172
+ column: node.startPosition.column
173
+ },
174
+ end: {
175
+ line: node.endPosition.row + 1,
176
+ column: node.endPosition.column
177
+ }
178
+ },
179
+ visibility: modifiers.includes("public") ? "public" : "protected",
180
+ ...metadata
181
+ });
182
+ nextClass = fullName;
183
+ }
184
+ }
185
+ } else if (node.type === "method_declaration" || node.type === "property_declaration") {
186
+ const nameNode = node.childForFieldName("name") || node.children.find((c) => c.type === "identifier");
187
+ if (nameNode) {
188
+ const modifiers = this.getModifiers(node);
189
+ const isPublic = modifiers.includes("public") || modifiers.includes("protected");
190
+ if (isPublic) {
191
+ const metadata = this.analyzeMetadata(node, code);
192
+ exports.push({
193
+ name: nameNode.text,
194
+ type: node.type === "method_declaration" ? "function" : "property",
195
+ parentClass: currentClass,
196
+ loc: {
197
+ start: {
198
+ line: node.startPosition.row + 1,
199
+ column: node.startPosition.column
200
+ },
201
+ end: {
202
+ line: node.endPosition.row + 1,
203
+ column: node.endPosition.column
204
+ }
205
+ },
206
+ visibility: modifiers.includes("public") ? "public" : "protected",
207
+ parameters: node.type === "method_declaration" ? this.extractParameters(node) : void 0,
208
+ ...metadata
209
+ });
210
+ }
211
+ }
212
+ }
213
+ for (let i = 0; i < node.childCount; i++) {
214
+ const child = node.child(i);
215
+ if (child) traverse(child, nextNamespace, nextClass);
216
+ }
217
+ };
218
+ traverse(rootNode);
219
+ return exports;
220
+ }
221
+ getModifiers(node) {
222
+ const modifiers = [];
223
+ for (const child of node.children) {
224
+ if (child.type === "modifier") {
225
+ modifiers.push(child.text);
226
+ }
227
+ }
228
+ return modifiers;
229
+ }
230
+ extractParameters(node) {
231
+ return extractParameterNames(node);
232
+ }
233
+ getNamingConventions() {
234
+ return {
235
+ variablePattern: /^[a-z][a-zA-Z0-9]*$/,
236
+ functionPattern: /^[A-Z][a-zA-Z0-9]*$/,
237
+ classPattern: /^[A-Z][a-zA-Z0-9]*$/,
238
+ constantPattern: /^[A-Z][a-zA-Z0-9_]*$/
239
+ };
240
+ }
241
+ canHandle(filePath) {
242
+ return filePath.toLowerCase().endsWith(".cs");
243
+ }
244
+ };
245
+
246
+ export {
247
+ CSharpParser
248
+ };
@@ -0,0 +1,250 @@
1
+ import {
2
+ analyzeGeneralMetadata,
3
+ extractParameterNames
4
+ } from "./chunk-WYOW6O3P.mjs";
5
+ import {
6
+ BaseLanguageParser
7
+ } from "./chunk-2N7ISIKE.mjs";
8
+
9
+ // src/parsers/java-parser.ts
10
+ var JavaParser = class extends BaseLanguageParser {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.language = "java" /* Java */;
14
+ this.extensions = [".java"];
15
+ }
16
+ getParserName() {
17
+ return "java";
18
+ }
19
+ /**
20
+ * Analyze metadata for a Java node (purity, side effects).
21
+ *
22
+ * @param node - Tree-sitter node to analyze.
23
+ * @param code - Source code for context.
24
+ * @returns Partial ExportInfo containing discovered metadata.
25
+ */
26
+ analyzeMetadata(node, code) {
27
+ return analyzeGeneralMetadata(node, code, {
28
+ sideEffectSignatures: [
29
+ "System.out",
30
+ "System.err",
31
+ "Files.write",
32
+ "Logging."
33
+ ]
34
+ });
35
+ }
36
+ parseRegex(code) {
37
+ const lines = code.split("\n");
38
+ const exports = [];
39
+ const imports = [];
40
+ const importRegex = /^import\s+([a-zA-Z0-9_.]+)/;
41
+ const classRegex = /^\s*(?:public\s+)?(?:class|interface|enum)\s+([a-zA-Z0-9_]+)/;
42
+ const methodRegex = /^\s*public\s+(?:static\s+)?[a-zA-Z0-9_<>[\]]+\s+([a-zA-Z0-9_]+)\s*\(/;
43
+ let currentClassName = "";
44
+ lines.forEach((line, idx) => {
45
+ const importMatch = line.match(importRegex);
46
+ if (importMatch) {
47
+ const source = importMatch[1];
48
+ imports.push({
49
+ source,
50
+ specifiers: [source.split(".").pop() || source],
51
+ loc: {
52
+ start: { line: idx + 1, column: 0 },
53
+ end: { line: idx + 1, column: line.length }
54
+ }
55
+ });
56
+ }
57
+ const classMatch = line.match(classRegex);
58
+ if (classMatch) {
59
+ currentClassName = classMatch[1];
60
+ exports.push({
61
+ name: currentClassName,
62
+ type: line.includes("interface") ? "interface" : "class",
63
+ visibility: "public",
64
+ isPure: true,
65
+ hasSideEffects: false,
66
+ loc: {
67
+ start: { line: idx + 1, column: 0 },
68
+ end: { line: idx + 1, column: line.length }
69
+ }
70
+ });
71
+ }
72
+ const methodMatch = line.match(methodRegex);
73
+ if (methodMatch && currentClassName) {
74
+ const name = methodMatch[1];
75
+ let docContent;
76
+ const prevLines = lines.slice(Math.max(0, idx - 5), idx);
77
+ const prevText = prevLines.join("\n");
78
+ const javadocMatch = prevText.match(/\/\*\*([\s\S]*?)\*\/\s*$/);
79
+ if (javadocMatch) {
80
+ docContent = javadocMatch[1].replace(/^\s*\*+/gm, "").trim();
81
+ }
82
+ const isImpure = name.toLowerCase().includes("impure") || line.includes("System.out");
83
+ exports.push({
84
+ name,
85
+ type: "function",
86
+ parentClass: currentClassName,
87
+ visibility: "public",
88
+ isPure: !isImpure,
89
+ hasSideEffects: isImpure,
90
+ documentation: docContent ? { content: docContent, type: "jsdoc" } : void 0,
91
+ loc: {
92
+ start: { line: idx + 1, column: 0 },
93
+ end: { line: idx + 1, column: line.length }
94
+ }
95
+ });
96
+ }
97
+ });
98
+ return {
99
+ exports,
100
+ imports,
101
+ language: "java" /* Java */,
102
+ warnings: ["Parser falling back to regex-based analysis"]
103
+ };
104
+ }
105
+ /**
106
+ * Extract import information using AST walk.
107
+ *
108
+ * @param rootNode - Root node of the Java AST.
109
+ * @returns Array of discovered FileImport objects.
110
+ */
111
+ extractImportsAST(rootNode) {
112
+ const imports = [];
113
+ for (const node of rootNode.children) {
114
+ if (node.type === "import_declaration") {
115
+ const sourceArr = [];
116
+ let isWildcard = false;
117
+ for (const child of node.children) {
118
+ if (child.type === "scoped_identifier" || child.type === "identifier") {
119
+ sourceArr.push(child.text);
120
+ }
121
+ if (child.type === "asterisk") isWildcard = true;
122
+ }
123
+ const source = sourceArr.join(".");
124
+ if (source) {
125
+ imports.push({
126
+ source: isWildcard ? `${source}.*` : source,
127
+ specifiers: isWildcard ? ["*"] : [source.split(".").pop() || source],
128
+ loc: {
129
+ start: {
130
+ line: node.startPosition.row + 1,
131
+ column: node.startPosition.column
132
+ },
133
+ end: {
134
+ line: node.endPosition.row + 1,
135
+ column: node.endPosition.column
136
+ }
137
+ }
138
+ });
139
+ }
140
+ }
141
+ }
142
+ return imports;
143
+ }
144
+ /**
145
+ * Extract export information (classes, interfaces, methods) using AST walk.
146
+ *
147
+ * @param rootNode - Root node of the Java AST.
148
+ * @param code - Source code for documentation extraction.
149
+ * @returns Array of discovered ExportInfo objects.
150
+ */
151
+ extractExportsAST(rootNode, code) {
152
+ const exports = [];
153
+ for (const node of rootNode.children) {
154
+ if (node.type === "class_declaration" || node.type === "interface_declaration" || node.type === "enum_declaration") {
155
+ const nameNode = node.children.find((c) => c.type === "identifier");
156
+ if (nameNode) {
157
+ const modifiers = this.getModifiers(node);
158
+ const metadata = this.analyzeMetadata(node, code);
159
+ exports.push({
160
+ name: nameNode.text,
161
+ type: node.type === "class_declaration" ? "class" : "interface",
162
+ loc: {
163
+ start: {
164
+ line: node.startPosition.row + 1,
165
+ column: node.startPosition.column
166
+ },
167
+ end: {
168
+ line: node.endPosition.row + 1,
169
+ column: node.endPosition.column
170
+ }
171
+ },
172
+ visibility: modifiers.includes("public") ? "public" : "private",
173
+ ...metadata
174
+ });
175
+ this.extractSubExports(node, nameNode.text, exports, code);
176
+ }
177
+ }
178
+ }
179
+ return exports;
180
+ }
181
+ /**
182
+ * Extract modifiers (visibility, static, etc.) from a node.
183
+ *
184
+ * @param node - AST node to extract modifiers from.
185
+ * @returns Array of modifier strings.
186
+ */
187
+ getModifiers(node) {
188
+ const modifiersNode = node.children.find((c) => c.type === "modifiers");
189
+ if (!modifiersNode) return [];
190
+ return modifiersNode.children.map((c) => c.text);
191
+ }
192
+ /**
193
+ * Extract methods and nested exports from a class or interface body.
194
+ *
195
+ * @param parentNode - Class or interface declaration node.
196
+ * @param parentName - Name of the parent class/interface.
197
+ * @param exports - Array to collect discovered exports into.
198
+ * @param code - Source code for context.
199
+ */
200
+ extractSubExports(parentNode, parentName, exports, code) {
201
+ const bodyNode = parentNode.children.find((c) => c.type === "class_body");
202
+ if (!bodyNode) return;
203
+ for (const node of bodyNode.children) {
204
+ if (node.type === "method_declaration") {
205
+ const nameNode = node.children.find((c) => c.type === "identifier");
206
+ const modifiers = this.getModifiers(node);
207
+ if (nameNode && modifiers.includes("public")) {
208
+ const metadata = this.analyzeMetadata(node, code);
209
+ exports.push({
210
+ name: nameNode.text,
211
+ type: "function",
212
+ parentClass: parentName,
213
+ visibility: "public",
214
+ loc: {
215
+ start: {
216
+ line: node.startPosition.row + 1,
217
+ column: node.startPosition.column
218
+ },
219
+ end: {
220
+ line: node.endPosition.row + 1,
221
+ column: node.endPosition.column
222
+ }
223
+ },
224
+ parameters: this.extractParameters(node),
225
+ ...metadata
226
+ });
227
+ }
228
+ }
229
+ }
230
+ }
231
+ extractParameters(node) {
232
+ return extractParameterNames(node);
233
+ }
234
+ getNamingConventions() {
235
+ return {
236
+ variablePattern: /^[a-z][a-zA-Z0-9]*$/,
237
+ functionPattern: /^[a-z][a-zA-Z0-9]*$/,
238
+ classPattern: /^[A-Z][a-zA-Z0-9]*$/,
239
+ constantPattern: /^[A-Z][A-Z0-9_]*$/,
240
+ exceptions: ["main", "serialVersionUID"]
241
+ };
242
+ }
243
+ canHandle(filePath) {
244
+ return filePath.toLowerCase().endsWith(".java");
245
+ }
246
+ };
247
+
248
+ export {
249
+ JavaParser
250
+ };