@aiready/core 0.24.22 → 0.24.25

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 (59) hide show
  1. package/dist/chunk-3GCIM6XG.mjs +904 -0
  2. package/dist/chunk-3S5WU6KX.mjs +552 -0
  3. package/dist/chunk-4OMXBYX7.mjs +167 -0
  4. package/dist/chunk-6YWGFKZG.mjs +250 -0
  5. package/dist/chunk-A3BIROBZ.mjs +902 -0
  6. package/dist/chunk-BYMQDORS.mjs +256 -0
  7. package/dist/chunk-CBZNRNEF.mjs +309 -0
  8. package/dist/chunk-ET2WRQSM.mjs +262 -0
  9. package/dist/chunk-F4FTHFHK.mjs +552 -0
  10. package/dist/chunk-G737F72Q.mjs +256 -0
  11. package/dist/chunk-GVFUAIWU.mjs +864 -0
  12. package/dist/chunk-KSEA5XDH.mjs +894 -0
  13. package/dist/chunk-LMIZRJFV.mjs +256 -0
  14. package/dist/chunk-LRPBPWBM.mjs +170 -0
  15. package/dist/chunk-MOTBXU6W.mjs +902 -0
  16. package/dist/chunk-OAH6FVVF.mjs +919 -0
  17. package/dist/chunk-OCM6HLBM.mjs +262 -0
  18. package/dist/chunk-OFBRNGKT.mjs +893 -0
  19. package/dist/chunk-P3KYGPO4.mjs +262 -0
  20. package/dist/chunk-PNWSO6XQ.mjs +250 -0
  21. package/dist/chunk-SO6UKAPR.mjs +164 -0
  22. package/dist/chunk-T2FW6AAF.mjs +552 -0
  23. package/dist/chunk-TQX77RIC.mjs +250 -0
  24. package/dist/chunk-X64EJ3ZO.mjs +314 -0
  25. package/dist/client/index.d.mts +1 -1
  26. package/dist/client/index.d.ts +1 -1
  27. package/dist/client/index.js +32 -5
  28. package/dist/client/index.mjs +1 -1
  29. package/dist/csharp-parser-3CGM6FKB.mjs +9 -0
  30. package/dist/csharp-parser-UWRUYHUH.mjs +9 -0
  31. package/dist/csharp-parser-WIAIE3DD.mjs +9 -0
  32. package/dist/go-parser-AH5QNS4O.mjs +9 -0
  33. package/dist/go-parser-CSAB23BL.mjs +9 -0
  34. package/dist/go-parser-Q3HI32B7.mjs +9 -0
  35. package/dist/index-CL_0jxiJ.d.mts +1315 -0
  36. package/dist/index-CL_0jxiJ.d.ts +1315 -0
  37. package/dist/index-ClwnZa_Y.d.mts +1333 -0
  38. package/dist/index-ClwnZa_Y.d.ts +1333 -0
  39. package/dist/index-DC0cdf0g.d.mts +1321 -0
  40. package/dist/index-DC0cdf0g.d.ts +1321 -0
  41. package/dist/index-DKqKGhcJ.d.mts +1309 -0
  42. package/dist/index-DKqKGhcJ.d.ts +1309 -0
  43. package/dist/index-DNnlhdk0.d.mts +1318 -0
  44. package/dist/index-DNnlhdk0.d.ts +1318 -0
  45. package/dist/index-De2xy_k5.d.mts +1326 -0
  46. package/dist/index-De2xy_k5.d.ts +1326 -0
  47. package/dist/index.d.mts +104 -20
  48. package/dist/index.d.ts +104 -20
  49. package/dist/index.js +581 -147
  50. package/dist/index.mjs +507 -134
  51. package/dist/java-parser-GUKWCEYS.mjs +9 -0
  52. package/dist/java-parser-XTWT5Y5I.mjs +9 -0
  53. package/dist/java-parser-YP5XWLQK.mjs +9 -0
  54. package/dist/python-parser-AOPXUEIV.mjs +8 -0
  55. package/dist/python-parser-FB55P6UA.mjs +8 -0
  56. package/dist/python-parser-WIJPSRKC.mjs +8 -0
  57. package/dist/typescript-parser-5ZWLLMWJ.mjs +7 -0
  58. package/dist/typescript-parser-TWPRLYK6.mjs +7 -0
  59. package/package.json +5 -1
@@ -0,0 +1,256 @@
1
+ import {
2
+ analyzeGeneralMetadata,
3
+ extractParameterNames
4
+ } from "./chunk-3D3I5K5W.mjs";
5
+ import {
6
+ BaseLanguageParser
7
+ } from "./chunk-LRPBPWBM.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 nodeType = node.type.replace("_declaration", "");
165
+ let exportType = "class";
166
+ if (nodeType === "record" || nodeType === "struct" || nodeType === "enum") {
167
+ exportType = "class";
168
+ } else if (nodeType === "interface" || nodeType === "interface_declaration") {
169
+ exportType = "interface";
170
+ }
171
+ const fullName = nextClass ? `${nextClass}.${nameNode.text}` : nextNamespace ? `${nextNamespace}.${nameNode.text}` : nameNode.text;
172
+ const exportItem = {
173
+ name: fullName,
174
+ type: exportType,
175
+ loc: {
176
+ start: {
177
+ line: node.startPosition.row + 1,
178
+ column: node.startPosition.column
179
+ },
180
+ end: {
181
+ line: node.endPosition.row + 1,
182
+ column: node.endPosition.column
183
+ }
184
+ },
185
+ visibility: modifiers.includes("public") ? "public" : "protected",
186
+ ...metadata
187
+ };
188
+ exports.push(exportItem);
189
+ nextClass = fullName;
190
+ }
191
+ }
192
+ } else if (node.type === "method_declaration" || node.type === "property_declaration") {
193
+ const nameNode = node.childForFieldName("name") || node.children.find((c) => c.type === "identifier");
194
+ if (nameNode) {
195
+ const modifiers = this.getModifiers(node);
196
+ const isPublic = modifiers.includes("public") || modifiers.includes("protected");
197
+ if (isPublic) {
198
+ const metadata = this.analyzeMetadata(node, code);
199
+ const methodItem = {
200
+ name: nameNode.text,
201
+ type: node.type === "method_declaration" ? "function" : "variable",
202
+ parentClass: currentClass,
203
+ loc: {
204
+ start: {
205
+ line: node.startPosition.row + 1,
206
+ column: node.startPosition.column
207
+ },
208
+ end: {
209
+ line: node.endPosition.row + 1,
210
+ column: node.endPosition.column
211
+ }
212
+ },
213
+ visibility: modifiers.includes("public") ? "public" : "protected",
214
+ parameters: node.type === "method_declaration" ? this.extractParameters(node) : void 0,
215
+ ...metadata
216
+ };
217
+ exports.push(methodItem);
218
+ }
219
+ }
220
+ }
221
+ for (let i = 0; i < node.childCount; i++) {
222
+ const child = node.child(i);
223
+ if (child) traverse(child, nextNamespace, nextClass);
224
+ }
225
+ };
226
+ traverse(rootNode);
227
+ return exports;
228
+ }
229
+ getModifiers(node) {
230
+ const modifiers = [];
231
+ for (const child of node.children) {
232
+ if (child.type === "modifier") {
233
+ modifiers.push(child.text);
234
+ }
235
+ }
236
+ return modifiers;
237
+ }
238
+ extractParameters(node) {
239
+ return extractParameterNames(node);
240
+ }
241
+ getNamingConventions() {
242
+ return {
243
+ variablePattern: /^[a-z][a-zA-Z0-9]*$/,
244
+ functionPattern: /^[A-Z][a-zA-Z0-9]*$/,
245
+ classPattern: /^[A-Z][a-zA-Z0-9]*$/,
246
+ constantPattern: /^[A-Z][a-zA-Z0-9_]*$/
247
+ };
248
+ }
249
+ canHandle(filePath) {
250
+ return filePath.toLowerCase().endsWith(".cs");
251
+ }
252
+ };
253
+
254
+ export {
255
+ CSharpParser
256
+ };