@aiready/core 0.21.14 → 0.21.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -708,19 +708,23 @@ var PythonParser = class {
708
708
  const possiblePaths = [
709
709
  path.join(
710
710
  process.cwd(),
711
- "node_modules/tree-sitter-python/tree-sitter-python.wasm"
711
+ "node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-python.wasm"
712
712
  ),
713
713
  path.join(
714
714
  __dirname,
715
- "../../node_modules/tree-sitter-python/tree-sitter-python.wasm"
715
+ "../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-python.wasm"
716
716
  ),
717
717
  path.join(
718
718
  __dirname,
719
- "../../../node_modules/tree-sitter-python/tree-sitter-python.wasm"
719
+ "../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-python.wasm"
720
720
  ),
721
721
  path.join(
722
722
  __dirname,
723
- "../../../../node_modules/tree-sitter-python/tree-sitter-python.wasm"
723
+ "../../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-python.wasm"
724
+ ),
725
+ path.join(
726
+ process.cwd(),
727
+ "node_modules/tree-sitter-wasms/out/tree-sitter-python.wasm"
724
728
  ),
725
729
  path.join(__dirname, "../assets/tree-sitter-python.wasm")
726
730
  ];
@@ -1098,6 +1102,668 @@ var PythonParser = class {
1098
1102
  }
1099
1103
  };
1100
1104
 
1105
+ // src/parsers/java-parser.ts
1106
+ import * as Parser3 from "web-tree-sitter";
1107
+ import * as path2 from "path";
1108
+ import * as fs2 from "fs";
1109
+ var JavaParser = class {
1110
+ constructor() {
1111
+ this.language = "java" /* Java */;
1112
+ this.extensions = [".java"];
1113
+ this.parser = null;
1114
+ this.initialized = false;
1115
+ }
1116
+ /**
1117
+ * Initialize the tree-sitter parser
1118
+ */
1119
+ async initialize() {
1120
+ if (this.initialized) return;
1121
+ try {
1122
+ if (typeof Parser3.Parser.init === "function") {
1123
+ await Parser3.Parser.init();
1124
+ }
1125
+ this.parser = new Parser3.Parser();
1126
+ const possiblePaths = [
1127
+ path2.join(
1128
+ process.cwd(),
1129
+ "node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-java.wasm"
1130
+ ),
1131
+ path2.join(
1132
+ __dirname,
1133
+ "../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-java.wasm"
1134
+ ),
1135
+ path2.join(
1136
+ __dirname,
1137
+ "../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-java.wasm"
1138
+ ),
1139
+ path2.join(
1140
+ __dirname,
1141
+ "../../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-java.wasm"
1142
+ ),
1143
+ path2.join(
1144
+ process.cwd(),
1145
+ "node_modules/tree-sitter-wasms/out/tree-sitter-java.wasm"
1146
+ )
1147
+ ];
1148
+ let wasmPath = "";
1149
+ for (const p of possiblePaths) {
1150
+ if (fs2.existsSync(p)) {
1151
+ wasmPath = p;
1152
+ break;
1153
+ }
1154
+ }
1155
+ if (!wasmPath) {
1156
+ console.warn(
1157
+ `Java WASM not found. Tried paths: ${possiblePaths.join(", ")}`
1158
+ );
1159
+ return;
1160
+ }
1161
+ const Java = await Parser3.Language.load(wasmPath);
1162
+ this.parser.setLanguage(Java);
1163
+ this.initialized = true;
1164
+ } catch (error) {
1165
+ console.error("Failed to initialize tree-sitter-java:", error);
1166
+ if (error instanceof Error && error.stack) {
1167
+ console.error(error.stack);
1168
+ }
1169
+ }
1170
+ }
1171
+ parse(code, filePath) {
1172
+ if (!this.initialized || !this.parser) {
1173
+ throw new ParseError(
1174
+ `JavaParser not initialized for ${filePath}`,
1175
+ filePath
1176
+ );
1177
+ }
1178
+ try {
1179
+ const tree = this.parser.parse(code);
1180
+ if (!tree) throw new Error("Parser.parse(code) returned null");
1181
+ const rootNode = tree.rootNode;
1182
+ const imports = this.extractImportsAST(rootNode);
1183
+ const exports = this.extractExportsAST(rootNode);
1184
+ return {
1185
+ exports,
1186
+ imports,
1187
+ language: "java" /* Java */,
1188
+ warnings: []
1189
+ };
1190
+ } catch (error) {
1191
+ throw new ParseError(
1192
+ `AST parsing failed for ${filePath}: ${error.message}`,
1193
+ filePath
1194
+ );
1195
+ }
1196
+ }
1197
+ extractImportsAST(rootNode) {
1198
+ const imports = [];
1199
+ for (const node of rootNode.children) {
1200
+ if (node.type === "import_declaration") {
1201
+ let sourceArr = [];
1202
+ let isStatic = false;
1203
+ let isWildcard = false;
1204
+ for (const child of node.children) {
1205
+ if (child.type === "static") isStatic = true;
1206
+ if (child.type === "scoped_identifier" || child.type === "identifier") {
1207
+ sourceArr.push(child.text);
1208
+ }
1209
+ if (child.type === "asterisk") isWildcard = true;
1210
+ }
1211
+ const source = sourceArr.join(".");
1212
+ if (source) {
1213
+ imports.push({
1214
+ source: isWildcard ? `${source}.*` : source,
1215
+ specifiers: isWildcard ? ["*"] : [source.split(".").pop() || source],
1216
+ loc: {
1217
+ start: {
1218
+ line: node.startPosition.row + 1,
1219
+ column: node.startPosition.column
1220
+ },
1221
+ end: {
1222
+ line: node.endPosition.row + 1,
1223
+ column: node.endPosition.column
1224
+ }
1225
+ }
1226
+ });
1227
+ }
1228
+ }
1229
+ }
1230
+ return imports;
1231
+ }
1232
+ extractExportsAST(rootNode) {
1233
+ const exports = [];
1234
+ for (const node of rootNode.children) {
1235
+ if (node.type === "class_declaration" || node.type === "interface_declaration" || node.type === "enum_declaration") {
1236
+ const nameNode = node.children.find((c) => c.type === "identifier");
1237
+ if (nameNode) {
1238
+ const modifiers = this.getModifiers(node);
1239
+ exports.push({
1240
+ name: nameNode.text,
1241
+ type: node.type === "class_declaration" ? "class" : "interface",
1242
+ loc: {
1243
+ start: {
1244
+ line: node.startPosition.row + 1,
1245
+ column: node.startPosition.column
1246
+ },
1247
+ end: {
1248
+ line: node.endPosition.row + 1,
1249
+ column: node.endPosition.column
1250
+ }
1251
+ },
1252
+ visibility: modifiers.includes("public") ? "public" : "private"
1253
+ });
1254
+ this.extractSubExports(node, nameNode.text, exports);
1255
+ }
1256
+ }
1257
+ }
1258
+ return exports;
1259
+ }
1260
+ getModifiers(node) {
1261
+ const modifiersNode = node.children.find((c) => c.type === "modifiers");
1262
+ if (!modifiersNode) return [];
1263
+ return modifiersNode.children.map((c) => c.text);
1264
+ }
1265
+ extractSubExports(parentNode, parentName, exports) {
1266
+ const bodyNode = parentNode.children.find((c) => c.type === "class_body");
1267
+ if (!bodyNode) return;
1268
+ for (const node of bodyNode.children) {
1269
+ if (node.type === "method_declaration") {
1270
+ const nameNode = node.children.find((c) => c.type === "identifier");
1271
+ const modifiers = this.getModifiers(node);
1272
+ if (nameNode && modifiers.includes("public")) {
1273
+ exports.push({
1274
+ name: nameNode.text,
1275
+ type: "function",
1276
+ parentClass: parentName,
1277
+ visibility: "public",
1278
+ loc: {
1279
+ start: {
1280
+ line: node.startPosition.row + 1,
1281
+ column: node.startPosition.column
1282
+ },
1283
+ end: {
1284
+ line: node.endPosition.row + 1,
1285
+ column: node.endPosition.column
1286
+ }
1287
+ },
1288
+ parameters: this.extractParameters(node)
1289
+ });
1290
+ }
1291
+ }
1292
+ }
1293
+ }
1294
+ extractParameters(node) {
1295
+ const paramsNode = node.children.find(
1296
+ (c) => c.type === "formal_parameters"
1297
+ );
1298
+ if (!paramsNode) return [];
1299
+ return paramsNode.children.filter((c) => c.type === "formal_parameter").map((c) => {
1300
+ const idNode = c.children.find((child) => child.type === "identifier");
1301
+ return idNode ? idNode.text : "unknown";
1302
+ });
1303
+ }
1304
+ getNamingConventions() {
1305
+ return {
1306
+ variablePattern: /^[a-z][a-zA-Z0-9]*$/,
1307
+ functionPattern: /^[a-z][a-zA-Z0-9]*$/,
1308
+ classPattern: /^[A-Z][a-zA-Z0-9]*$/,
1309
+ constantPattern: /^[A-Z][A-Z0-9_]*$/,
1310
+ exceptions: ["main", "serialVersionUID"]
1311
+ };
1312
+ }
1313
+ canHandle(filePath) {
1314
+ return filePath.toLowerCase().endsWith(".java");
1315
+ }
1316
+ };
1317
+
1318
+ // src/parsers/csharp-parser.ts
1319
+ import * as Parser5 from "web-tree-sitter";
1320
+ import * as path3 from "path";
1321
+ import * as fs3 from "fs";
1322
+ var CSharpParser = class {
1323
+ constructor() {
1324
+ this.language = "csharp" /* CSharp */;
1325
+ this.extensions = [".cs"];
1326
+ this.parser = null;
1327
+ this.initialized = false;
1328
+ }
1329
+ /**
1330
+ * Initialize the tree-sitter parser
1331
+ */
1332
+ async initialize() {
1333
+ if (this.initialized) return;
1334
+ try {
1335
+ if (typeof Parser5.Parser.init === "function") {
1336
+ await Parser5.Parser.init();
1337
+ }
1338
+ this.parser = new Parser5.Parser();
1339
+ const possiblePaths = [
1340
+ path3.join(
1341
+ process.cwd(),
1342
+ "node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-c_sharp.wasm"
1343
+ ),
1344
+ path3.join(
1345
+ __dirname,
1346
+ "../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-c_sharp.wasm"
1347
+ ),
1348
+ path3.join(
1349
+ __dirname,
1350
+ "../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-c_sharp.wasm"
1351
+ ),
1352
+ path3.join(
1353
+ __dirname,
1354
+ "../../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-c_sharp.wasm"
1355
+ )
1356
+ ];
1357
+ let wasmPath = "";
1358
+ for (const p of possiblePaths) {
1359
+ if (fs3.existsSync(p)) {
1360
+ wasmPath = p;
1361
+ break;
1362
+ }
1363
+ }
1364
+ if (!wasmPath) {
1365
+ console.warn(
1366
+ `C# WASM not found. Tried paths: ${possiblePaths.join(", ")}`
1367
+ );
1368
+ return;
1369
+ }
1370
+ const CSharp = await Parser5.Language.load(wasmPath);
1371
+ this.parser.setLanguage(CSharp);
1372
+ this.initialized = true;
1373
+ } catch (error) {
1374
+ console.error("Failed to initialize tree-sitter-c-sharp:", error);
1375
+ }
1376
+ }
1377
+ parse(code, filePath) {
1378
+ if (!this.initialized || !this.parser) {
1379
+ throw new ParseError(
1380
+ `CSharpParser not initialized for ${filePath}`,
1381
+ filePath
1382
+ );
1383
+ }
1384
+ try {
1385
+ const tree = this.parser.parse(code);
1386
+ if (!tree) throw new Error("Parser.parse(code) returned null");
1387
+ const rootNode = tree.rootNode;
1388
+ const imports = this.extractImportsAST(rootNode);
1389
+ const exports = this.extractExportsAST(rootNode);
1390
+ return {
1391
+ exports,
1392
+ imports,
1393
+ language: "csharp" /* CSharp */,
1394
+ warnings: []
1395
+ };
1396
+ } catch (error) {
1397
+ throw new ParseError(
1398
+ `AST parsing failed for ${filePath}: ${error.message}`,
1399
+ filePath
1400
+ );
1401
+ }
1402
+ }
1403
+ extractImportsAST(rootNode) {
1404
+ const imports = [];
1405
+ const findUsings = (node) => {
1406
+ if (node.type === "using_directive") {
1407
+ const nameNode = node.childForFieldName("name") || node.children.find(
1408
+ (c) => c.type === "qualified_name" || c.type === "identifier"
1409
+ );
1410
+ if (nameNode) {
1411
+ const aliasNode = node.childForFieldName("alias");
1412
+ imports.push({
1413
+ source: nameNode.text,
1414
+ specifiers: aliasNode ? [aliasNode.text] : [nameNode.text.split(".").pop() || nameNode.text],
1415
+ loc: {
1416
+ start: {
1417
+ line: node.startPosition.row + 1,
1418
+ column: node.startPosition.column
1419
+ },
1420
+ end: {
1421
+ line: node.endPosition.row + 1,
1422
+ column: node.endPosition.column
1423
+ }
1424
+ }
1425
+ });
1426
+ }
1427
+ }
1428
+ for (let i = 0; i < node.childCount; i++) {
1429
+ const child = node.child(i);
1430
+ if (child) findUsings(child);
1431
+ }
1432
+ };
1433
+ findUsings(rootNode);
1434
+ return imports;
1435
+ }
1436
+ extractExportsAST(rootNode) {
1437
+ const exports = [];
1438
+ const traverse = (node, currentNamespace, currentClass) => {
1439
+ let nextNamespace = currentNamespace;
1440
+ let nextClass = currentClass;
1441
+ if (node.type === "namespace_declaration" || node.type === "file_scoped_namespace_declaration") {
1442
+ const nameNode = node.childForFieldName("name") || node.children.find(
1443
+ (c) => c.type === "identifier" || c.type === "qualified_name"
1444
+ );
1445
+ if (nameNode) {
1446
+ nextNamespace = currentNamespace ? `${currentNamespace}.${nameNode.text}` : nameNode.text;
1447
+ }
1448
+ } else if (node.type === "class_declaration" || node.type === "interface_declaration" || node.type === "enum_declaration" || node.type === "struct_declaration" || node.type === "record_declaration") {
1449
+ const nameNode = node.childForFieldName("name") || node.children.find((c) => c.type === "identifier");
1450
+ if (nameNode) {
1451
+ const modifiers = this.getModifiers(node);
1452
+ const isPublic = modifiers.includes("public") || modifiers.includes("protected");
1453
+ if (isPublic) {
1454
+ const type = node.type.replace("_declaration", "");
1455
+ const fullName = nextClass ? `${nextClass}.${nameNode.text}` : nextNamespace ? `${nextNamespace}.${nameNode.text}` : nameNode.text;
1456
+ exports.push({
1457
+ name: fullName,
1458
+ type: type === "record" ? "class" : type,
1459
+ loc: {
1460
+ start: {
1461
+ line: node.startPosition.row + 1,
1462
+ column: node.startPosition.column
1463
+ },
1464
+ end: {
1465
+ line: node.endPosition.row + 1,
1466
+ column: node.endPosition.column
1467
+ }
1468
+ },
1469
+ visibility: modifiers.includes("public") ? "public" : "protected"
1470
+ });
1471
+ nextClass = fullName;
1472
+ }
1473
+ }
1474
+ } else if (node.type === "method_declaration" || node.type === "property_declaration") {
1475
+ const nameNode = node.childForFieldName("name") || node.children.find((c) => c.type === "identifier");
1476
+ if (nameNode) {
1477
+ const modifiers = this.getModifiers(node);
1478
+ const isPublic = modifiers.includes("public") || modifiers.includes("protected");
1479
+ if (isPublic) {
1480
+ exports.push({
1481
+ name: nameNode.text,
1482
+ type: node.type === "method_declaration" ? "function" : "property",
1483
+ parentClass: currentClass,
1484
+ loc: {
1485
+ start: {
1486
+ line: node.startPosition.row + 1,
1487
+ column: node.startPosition.column
1488
+ },
1489
+ end: {
1490
+ line: node.endPosition.row + 1,
1491
+ column: node.endPosition.column
1492
+ }
1493
+ },
1494
+ visibility: modifiers.includes("public") ? "public" : "protected",
1495
+ parameters: node.type === "method_declaration" ? this.extractParameters(node) : void 0
1496
+ });
1497
+ }
1498
+ }
1499
+ }
1500
+ for (let i = 0; i < node.childCount; i++) {
1501
+ const child = node.child(i);
1502
+ if (child) traverse(child, nextNamespace, nextClass);
1503
+ }
1504
+ };
1505
+ traverse(rootNode);
1506
+ return exports;
1507
+ }
1508
+ getModifiers(node) {
1509
+ const modifiers = [];
1510
+ for (const child of node.children) {
1511
+ if (child.type === "modifier") {
1512
+ modifiers.push(child.text);
1513
+ }
1514
+ }
1515
+ return modifiers;
1516
+ }
1517
+ extractParameters(node) {
1518
+ const params = [];
1519
+ const parameterList = node.childForFieldName("parameters") || node.children.find((c) => c.type === "parameter_list");
1520
+ if (parameterList) {
1521
+ for (const param of parameterList.children) {
1522
+ if (param.type === "parameter") {
1523
+ const nameNode = param.childForFieldName("name") || param.children.find((c) => c.type === "identifier");
1524
+ if (nameNode) {
1525
+ params.push(nameNode.text);
1526
+ }
1527
+ }
1528
+ }
1529
+ }
1530
+ return params;
1531
+ }
1532
+ getNamingConventions() {
1533
+ return {
1534
+ variablePattern: /^[a-z][a-zA-Z0-9]*$/,
1535
+ functionPattern: /^[A-Z][a-zA-Z0-9]*$/,
1536
+ classPattern: /^[A-Z][a-zA-Z0-9]*$/,
1537
+ constantPattern: /^[A-Z][a-zA-Z0-9_]*$/
1538
+ };
1539
+ }
1540
+ canHandle(filePath) {
1541
+ return filePath.toLowerCase().endsWith(".cs");
1542
+ }
1543
+ };
1544
+
1545
+ // src/parsers/go-parser.ts
1546
+ import * as Parser7 from "web-tree-sitter";
1547
+ import * as path4 from "path";
1548
+ import * as fs4 from "fs";
1549
+ var GoParser = class {
1550
+ constructor() {
1551
+ this.language = "go" /* Go */;
1552
+ this.extensions = [".go"];
1553
+ this.parser = null;
1554
+ this.initialized = false;
1555
+ }
1556
+ /**
1557
+ * Initialize the tree-sitter parser
1558
+ */
1559
+ async initialize() {
1560
+ if (this.initialized) return;
1561
+ try {
1562
+ if (typeof Parser7.Parser.init === "function") {
1563
+ await Parser7.Parser.init();
1564
+ }
1565
+ this.parser = new Parser7.Parser();
1566
+ const possiblePaths = [
1567
+ path4.join(
1568
+ process.cwd(),
1569
+ "node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-go.wasm"
1570
+ ),
1571
+ path4.join(
1572
+ __dirname,
1573
+ "../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-go.wasm"
1574
+ ),
1575
+ path4.join(
1576
+ __dirname,
1577
+ "../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-go.wasm"
1578
+ ),
1579
+ path4.join(
1580
+ __dirname,
1581
+ "../../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-go.wasm"
1582
+ )
1583
+ ];
1584
+ let wasmPath = "";
1585
+ for (const p of possiblePaths) {
1586
+ if (fs4.existsSync(p)) {
1587
+ wasmPath = p;
1588
+ break;
1589
+ }
1590
+ }
1591
+ if (!wasmPath) {
1592
+ console.warn(
1593
+ `Go WASM not found. Tried paths: ${possiblePaths.join(", ")}`
1594
+ );
1595
+ return;
1596
+ }
1597
+ const Go = await Parser7.Language.load(wasmPath);
1598
+ this.parser.setLanguage(Go);
1599
+ this.initialized = true;
1600
+ } catch (error) {
1601
+ console.error("Failed to initialize tree-sitter-go:", error);
1602
+ }
1603
+ }
1604
+ parse(code, filePath) {
1605
+ if (!this.initialized || !this.parser) {
1606
+ throw new ParseError(
1607
+ `GoParser not initialized for ${filePath}`,
1608
+ filePath
1609
+ );
1610
+ }
1611
+ try {
1612
+ const tree = this.parser.parse(code);
1613
+ if (!tree) throw new Error("Parser.parse(code) returned null");
1614
+ const rootNode = tree.rootNode;
1615
+ const imports = this.extractImportsAST(rootNode);
1616
+ const exports = this.extractExportsAST(rootNode);
1617
+ return {
1618
+ exports,
1619
+ imports,
1620
+ language: "go" /* Go */,
1621
+ warnings: []
1622
+ };
1623
+ } catch (error) {
1624
+ throw new ParseError(
1625
+ `AST parsing failed for ${filePath}: ${error.message}`,
1626
+ filePath
1627
+ );
1628
+ }
1629
+ }
1630
+ extractImportsAST(rootNode) {
1631
+ const imports = [];
1632
+ const findImports = (node) => {
1633
+ if (node.type === "import_spec") {
1634
+ const pathNode = node.children.find(
1635
+ (c) => c.type === "interpreted_string_literal"
1636
+ );
1637
+ if (pathNode) {
1638
+ const source = pathNode.text.replace(/"/g, "");
1639
+ imports.push({
1640
+ source,
1641
+ specifiers: [source.split("/").pop() || source],
1642
+ loc: {
1643
+ start: {
1644
+ line: node.startPosition.row + 1,
1645
+ column: node.startPosition.column
1646
+ },
1647
+ end: {
1648
+ line: node.endPosition.row + 1,
1649
+ column: node.endPosition.column
1650
+ }
1651
+ }
1652
+ });
1653
+ }
1654
+ }
1655
+ for (let i = 0; i < node.childCount; i++) {
1656
+ const child = node.child(i);
1657
+ if (child) findImports(child);
1658
+ }
1659
+ };
1660
+ findImports(rootNode);
1661
+ return imports;
1662
+ }
1663
+ extractExportsAST(rootNode) {
1664
+ const exports = [];
1665
+ const isExported = (name) => {
1666
+ return /^[A-Z]/.test(name);
1667
+ };
1668
+ const traverse = (node) => {
1669
+ if (node.type === "function_declaration" || node.type === "method_declaration") {
1670
+ const nameNode = node.childForFieldName("name") || node.children.find((c) => c.type === "identifier");
1671
+ if (nameNode && isExported(nameNode.text)) {
1672
+ exports.push({
1673
+ name: nameNode.text,
1674
+ type: "function",
1675
+ loc: {
1676
+ start: {
1677
+ line: node.startPosition.row + 1,
1678
+ column: node.startPosition.column
1679
+ },
1680
+ end: {
1681
+ line: node.endPosition.row + 1,
1682
+ column: node.endPosition.column
1683
+ }
1684
+ },
1685
+ visibility: "public",
1686
+ parameters: this.extractParameters(node)
1687
+ });
1688
+ }
1689
+ } else if (node.type === "type_spec") {
1690
+ const nameNode = node.childForFieldName("name") || node.children.find((c) => c.type === "type_identifier");
1691
+ if (nameNode && isExported(nameNode.text)) {
1692
+ const type = node.children.some((c) => c.type === "struct_type") ? "class" : "interface";
1693
+ exports.push({
1694
+ name: nameNode.text,
1695
+ type,
1696
+ loc: {
1697
+ start: {
1698
+ line: node.startPosition.row + 1,
1699
+ column: node.startPosition.column
1700
+ },
1701
+ end: {
1702
+ line: node.endPosition.row + 1,
1703
+ column: node.endPosition.column
1704
+ }
1705
+ },
1706
+ visibility: "public"
1707
+ });
1708
+ }
1709
+ } else if (node.type === "var_spec" || node.type === "const_spec") {
1710
+ const identifiers = node.children.filter(
1711
+ (c) => c.type === "identifier"
1712
+ );
1713
+ for (const idNode of identifiers) {
1714
+ if (isExported(idNode.text)) {
1715
+ exports.push({
1716
+ name: idNode.text,
1717
+ type: "variable",
1718
+ loc: {
1719
+ start: {
1720
+ line: idNode.startPosition.row + 1,
1721
+ column: idNode.startPosition.column
1722
+ },
1723
+ end: {
1724
+ line: idNode.endPosition.row + 1,
1725
+ column: idNode.endPosition.column
1726
+ }
1727
+ },
1728
+ visibility: "public"
1729
+ });
1730
+ }
1731
+ }
1732
+ }
1733
+ for (let i = 0; i < node.childCount; i++) {
1734
+ const child = node.child(i);
1735
+ if (child) traverse(child);
1736
+ }
1737
+ };
1738
+ traverse(rootNode);
1739
+ return exports;
1740
+ }
1741
+ extractParameters(node) {
1742
+ const params = [];
1743
+ const parameterList = node.childForFieldName("parameters") || node.children.find((c) => c.type === "parameter_list");
1744
+ if (parameterList) {
1745
+ for (const param of parameterList.children) {
1746
+ if (param.type === "parameter_declaration") {
1747
+ const names = param.children.filter((c) => c.type === "identifier");
1748
+ names.forEach((n) => params.push(n.text));
1749
+ }
1750
+ }
1751
+ }
1752
+ return params;
1753
+ }
1754
+ getNamingConventions() {
1755
+ return {
1756
+ variablePattern: /^[a-zA-Z][a-zA-Z0-9]*$/,
1757
+ functionPattern: /^[a-zA-Z][a-zA-Z0-9]*$/,
1758
+ classPattern: /^[a-zA-Z][a-zA-Z0-9]*$/,
1759
+ constantPattern: /^[a-zA-Z_][a-zA-Z0-9_]*$/
1760
+ };
1761
+ }
1762
+ canHandle(filePath) {
1763
+ return filePath.toLowerCase().endsWith(".go");
1764
+ }
1765
+ };
1766
+
1101
1767
  // src/parsers/parser-factory.ts
1102
1768
  var ParserFactory = class _ParserFactory {
1103
1769
  constructor() {
@@ -1107,6 +1773,9 @@ var ParserFactory = class _ParserFactory {
1107
1773
  );
1108
1774
  this.registerParser(new TypeScriptParser());
1109
1775
  this.registerParser(new PythonParser());
1776
+ this.registerParser(new JavaParser());
1777
+ this.registerParser(new CSharpParser());
1778
+ this.registerParser(new GoParser());
1110
1779
  }
1111
1780
  /**
1112
1781
  * Get singleton instance
@@ -1209,7 +1878,7 @@ function getSupportedLanguages() {
1209
1878
  // src/utils/ast-parser.ts
1210
1879
  function parseFileExports(code, filePath) {
1211
1880
  const parser = getParser(filePath);
1212
- if (parser && parser.language === "python" /* Python */) {
1881
+ if (parser && (parser.language === "python" /* Python */ || parser.language === "java" /* Java */)) {
1213
1882
  try {
1214
1883
  const result = parser.parse(code, filePath);
1215
1884
  return {
@@ -1411,8 +2080,8 @@ function estimateTokens(text) {
1411
2080
  }
1412
2081
 
1413
2082
  // src/utils/config.ts
1414
- import { readFileSync, existsSync as existsSync4 } from "fs";
1415
- import { join as join4, resolve, dirname as dirname3 } from "path";
2083
+ import { readFileSync, existsSync as existsSync7 } from "fs";
2084
+ import { join as join7, resolve, dirname as dirname3 } from "path";
1416
2085
  import { pathToFileURL } from "url";
1417
2086
  var CONFIG_FILES = [
1418
2087
  "aiready.json",
@@ -1426,8 +2095,8 @@ async function loadConfig(rootDir) {
1426
2095
  let currentDir = resolve(rootDir);
1427
2096
  while (true) {
1428
2097
  for (const configFile of CONFIG_FILES) {
1429
- const configPath = join4(currentDir, configFile);
1430
- if (existsSync4(configPath)) {
2098
+ const configPath = join7(currentDir, configFile);
2099
+ if (existsSync7(configPath)) {
1431
2100
  try {
1432
2101
  let config;
1433
2102
  if (configFile.endsWith(".js")) {
@@ -2733,14 +3402,14 @@ function calculateExtendedFutureProofScore(params) {
2733
3402
  }
2734
3403
 
2735
3404
  // src/utils/history.ts
2736
- import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, existsSync as existsSync5, mkdirSync as mkdirSync2 } from "fs";
2737
- import { join as join5, dirname as dirname4 } from "path";
3405
+ import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, existsSync as existsSync8, mkdirSync as mkdirSync2 } from "fs";
3406
+ import { join as join8, dirname as dirname4 } from "path";
2738
3407
  function getHistoryPath(rootDir) {
2739
- return join5(rootDir, ".aiready", "history.json");
3408
+ return join8(rootDir, ".aiready", "history.json");
2740
3409
  }
2741
3410
  function loadScoreHistory(rootDir) {
2742
3411
  const historyPath = getHistoryPath(rootDir);
2743
- if (!existsSync5(historyPath)) {
3412
+ if (!existsSync8(historyPath)) {
2744
3413
  return [];
2745
3414
  }
2746
3415
  try {
@@ -2754,7 +3423,7 @@ function loadScoreHistory(rootDir) {
2754
3423
  function saveScoreEntry(rootDir, entry) {
2755
3424
  const historyPath = getHistoryPath(rootDir);
2756
3425
  const historyDir = dirname4(historyPath);
2757
- if (!existsSync5(historyDir)) {
3426
+ if (!existsSync8(historyDir)) {
2758
3427
  mkdirSync2(historyDir, { recursive: true });
2759
3428
  }
2760
3429
  const history = loadScoreHistory(rootDir);
@@ -2801,7 +3470,7 @@ function exportHistory(rootDir, format = "json") {
2801
3470
  }
2802
3471
  function clearHistory(rootDir) {
2803
3472
  const historyPath = getHistoryPath(rootDir);
2804
- if (existsSync5(historyPath)) {
3473
+ if (existsSync8(historyPath)) {
2805
3474
  writeFileSync2(historyPath, JSON.stringify([]));
2806
3475
  }
2807
3476
  }
@@ -2883,15 +3552,18 @@ export {
2883
3552
  AnalysisStatusSchema,
2884
3553
  COMMON_FINE_TUNING_OPTIONS,
2885
3554
  CONTEXT_TIER_THRESHOLDS,
3555
+ CSharpParser,
2886
3556
  DEFAULT_COST_CONFIG,
2887
3557
  DEFAULT_EXCLUDE,
2888
3558
  DEFAULT_TOOL_WEIGHTS,
2889
3559
  FRIENDLY_TOOL_NAMES,
2890
3560
  GLOBAL_INFRA_OPTIONS,
2891
3561
  GLOBAL_SCAN_OPTIONS,
3562
+ GoParser,
2892
3563
  IssueSchema,
2893
3564
  IssueType,
2894
3565
  IssueTypeSchema,
3566
+ JavaParser,
2895
3567
  LANGUAGE_EXTENSIONS,
2896
3568
  Language,
2897
3569
  LocationSchema,