infigraph-languages 1.5.4

Bundled language packs for infigraph (Tree-sitter grammars + extraction queries)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
use anyhow::Result;
use infigraph_core::lang::{CustomEdgeDef, LanguagePack, LanguageRegistry};

const PYTHON_ENTITIES: &str = include_str!("../languages/python/entities.scm");
const PYTHON_RELATIONS: &str = include_str!("../languages/python/relations.scm");

const RUST_ENTITIES: &str = include_str!("../languages/rust/entities.scm");
const RUST_RELATIONS: &str = include_str!("../languages/rust/relations.scm");

const TYPESCRIPT_ENTITIES: &str = include_str!("../languages/typescript/entities.scm");
const TYPESCRIPT_RELATIONS: &str = include_str!("../languages/typescript/relations.scm");

const JAVASCRIPT_ENTITIES: &str = include_str!("../languages/javascript/entities.scm");
const JAVASCRIPT_RELATIONS: &str = include_str!("../languages/javascript/relations.scm");

const GO_ENTITIES: &str = include_str!("../languages/go/entities.scm");
const GO_RELATIONS: &str = include_str!("../languages/go/relations.scm");

const JAVA_ENTITIES: &str = include_str!("../languages/java/entities.scm");
const JAVA_RELATIONS: &str = include_str!("../languages/java/relations.scm");

const C_ENTITIES: &str = include_str!("../languages/c/entities.scm");
const C_RELATIONS: &str = include_str!("../languages/c/relations.scm");

const CPP_ENTITIES: &str = include_str!("../languages/cpp/entities.scm");
const CPP_RELATIONS: &str = include_str!("../languages/cpp/relations.scm");

const RUBY_ENTITIES: &str = include_str!("../languages/ruby/entities.scm");
const RUBY_RELATIONS: &str = include_str!("../languages/ruby/relations.scm");

const PHP_ENTITIES: &str = include_str!("../languages/php/entities.scm");
const PHP_RELATIONS: &str = include_str!("../languages/php/relations.scm");

const SWIFT_ENTITIES: &str = include_str!("../languages/swift/entities.scm");
const SWIFT_RELATIONS: &str = include_str!("../languages/swift/relations.scm");

const KOTLIN_ENTITIES: &str = include_str!("../languages/kotlin/entities.scm");
const KOTLIN_RELATIONS: &str = include_str!("../languages/kotlin/relations.scm");

const CSHARP_ENTITIES: &str = include_str!("../languages/csharp/entities.scm");
const CSHARP_RELATIONS: &str = include_str!("../languages/csharp/relations.scm");

const SCALA_ENTITIES: &str = include_str!("../languages/scala/entities.scm");
const SCALA_RELATIONS: &str = include_str!("../languages/scala/relations.scm");

const LUA_ENTITIES: &str = include_str!("../languages/lua/entities.scm");
const LUA_RELATIONS: &str = include_str!("../languages/lua/relations.scm");

const ZIG_ENTITIES: &str = include_str!("../languages/zig/entities.scm");
const ZIG_RELATIONS: &str = include_str!("../languages/zig/relations.scm");

const ELIXIR_ENTITIES: &str = include_str!("../languages/elixir/entities.scm");
const ELIXIR_RELATIONS: &str = include_str!("../languages/elixir/relations.scm");

const DART_ENTITIES: &str = include_str!("../languages/dart/entities.scm");
const DART_RELATIONS: &str = include_str!("../languages/dart/relations.scm");

const OBJC_ENTITIES: &str = include_str!("../languages/objc/entities.scm");
const OBJC_RELATIONS: &str = include_str!("../languages/objc/relations.scm");

const HASKELL_ENTITIES: &str = include_str!("../languages/haskell/entities.scm");
const HASKELL_RELATIONS: &str = include_str!("../languages/haskell/relations.scm");

const PERL_ENTITIES: &str = include_str!("../languages/perl/entities.scm");
const PERL_RELATIONS: &str = include_str!("../languages/perl/relations.scm");

const R_ENTITIES: &str = include_str!("../languages/r/entities.scm");
const R_RELATIONS: &str = include_str!("../languages/r/relations.scm");

const OCAML_ENTITIES: &str = include_str!("../languages/ocaml/entities.scm");
const OCAML_RELATIONS: &str = include_str!("../languages/ocaml/relations.scm");

const BASH_ENTITIES: &str = include_str!("../languages/bash/entities.scm");
const BASH_RELATIONS: &str = include_str!("../languages/bash/relations.scm");

const SQL_ENTITIES: &str = include_str!("../languages/sql/entities.scm");
const SQL_RELATIONS: &str = include_str!("../languages/sql/relations.scm");

const JULIA_ENTITIES: &str = include_str!("../languages/julia/entities.scm");
const JULIA_RELATIONS: &str = include_str!("../languages/julia/relations.scm");

const PROTO_ENTITIES: &str = include_str!("../languages/proto/entities.scm");
const PROTO_RELATIONS: &str = include_str!("../languages/proto/relations.scm");

const POWERSHELL_ENTITIES: &str = include_str!("../languages/powershell/entities.scm");
const POWERSHELL_RELATIONS: &str = include_str!("../languages/powershell/relations.scm");

const VERILOG_ENTITIES: &str = include_str!("../languages/verilog/entities.scm");
const VERILOG_RELATIONS: &str = include_str!("../languages/verilog/relations.scm");

const HCL_ENTITIES: &str = include_str!("../languages/hcl/entities.scm");
const HCL_RELATIONS: &str = include_str!("../languages/hcl/relations.scm");

const TOML_ENTITIES: &str = include_str!("../languages/toml/entities.scm");
const TOML_RELATIONS: &str = include_str!("../languages/toml/relations.scm");

const YAML_ENTITIES: &str = include_str!("../languages/yaml/entities.scm");
const YAML_RELATIONS: &str = include_str!("../languages/yaml/relations.scm");

const ERLANG_ENTITIES: &str = include_str!("../languages/erlang/entities.scm");
const ERLANG_RELATIONS: &str = include_str!("../languages/erlang/relations.scm");

const DOCKERFILE_ENTITIES: &str = include_str!("../languages/dockerfile/entities.scm");
const DOCKERFILE_RELATIONS: &str = include_str!("../languages/dockerfile/relations.scm");

const FORTRAN_ENTITIES: &str = include_str!("../languages/fortran/entities.scm");
const FORTRAN_RELATIONS: &str = include_str!("../languages/fortran/relations.scm");

const NIX_ENTITIES: &str = include_str!("../languages/nix/entities.scm");
const NIX_RELATIONS: &str = include_str!("../languages/nix/relations.scm");

const SVELTE_ENTITIES: &str = include_str!("../languages/svelte/entities.scm");
const SVELTE_RELATIONS: &str = include_str!("../languages/svelte/relations.scm");

const FSHARP_ENTITIES: &str = include_str!("../languages/fsharp/entities.scm");
const FSHARP_RELATIONS: &str = include_str!("../languages/fsharp/relations.scm");

const GROOVY_ENTITIES: &str = include_str!("../languages/groovy/entities.scm");
const GROOVY_RELATIONS: &str = include_str!("../languages/groovy/relations.scm");

const CSS_ENTITIES: &str = include_str!("../languages/css/entities.scm");
const CSS_RELATIONS: &str = include_str!("../languages/css/relations.scm");

const HTML_ENTITIES: &str = include_str!("../languages/html/entities.scm");
const HTML_RELATIONS: &str = include_str!("../languages/html/relations.scm");

const JSON_ENTITIES: &str = include_str!("../languages/json/entities.scm");
const JSON_RELATIONS: &str = include_str!("../languages/json/relations.scm");

const XML_ENTITIES: &str = include_str!("../languages/xml/entities.scm");
const XML_RELATIONS: &str = include_str!("../languages/xml/relations.scm");

const MAKEFILE_ENTITIES: &str = include_str!("../languages/makefile/entities.scm");
const MAKEFILE_RELATIONS: &str = include_str!("../languages/makefile/relations.scm");

const CMAKE_ENTITIES: &str = include_str!("../languages/cmake/entities.scm");
const CMAKE_RELATIONS: &str = include_str!("../languages/cmake/relations.scm");

const GRAPHQL_ENTITIES: &str = include_str!("../languages/graphql/entities.scm");
const GRAPHQL_RELATIONS: &str = include_str!("../languages/graphql/relations.scm");

const GLSL_ENTITIES: &str = include_str!("../languages/glsl/entities.scm");
const GLSL_RELATIONS: &str = include_str!("../languages/glsl/relations.scm");

const COMMONLISP_ENTITIES: &str = include_str!("../languages/commonlisp/entities.scm");
const COMMONLISP_RELATIONS: &str = include_str!("../languages/commonlisp/relations.scm");

const ELM_ENTITIES: &str = include_str!("../languages/elm/entities.scm");
const ELM_RELATIONS: &str = include_str!("../languages/elm/relations.scm");

const ELISP_ENTITIES: &str = include_str!("../languages/elisp/entities.scm");
const ELISP_RELATIONS: &str = include_str!("../languages/elisp/relations.scm");

const INI_ENTITIES: &str = include_str!("../languages/ini/entities.scm");
const INI_RELATIONS: &str = include_str!("../languages/ini/relations.scm");

const TSX_ENTITIES: &str = include_str!("../languages/tsx/entities.scm");
const TSX_RELATIONS: &str = include_str!("../languages/tsx/relations.scm");

const STARLARK_ENTITIES: &str = include_str!("../languages/starlark/entities.scm");
const STARLARK_RELATIONS: &str = include_str!("../languages/starlark/relations.scm");

const MATLAB_ENTITIES: &str = include_str!("../languages/matlab/entities.scm");
const MATLAB_RELATIONS: &str = include_str!("../languages/matlab/relations.scm");

const MARKDOWN_ENTITIES: &str = include_str!("../languages/markdown/entities.scm");
const MARKDOWN_RELATIONS: &str = include_str!("../languages/markdown/relations.scm");

const CLOJURE_ENTITIES: &str = include_str!("../languages/clojure/entities.scm");
const CLOJURE_RELATIONS: &str = include_str!("../languages/clojure/relations.scm");

const CUDA_ENTITIES: &str = include_str!("../languages/cuda/entities.scm");
const CUDA_RELATIONS: &str = include_str!("../languages/cuda/relations.scm");

const PASCAL_ENTITIES: &str = include_str!("../languages/pascal/entities.scm");
const PASCAL_RELATIONS: &str = include_str!("../languages/pascal/relations.scm");

const VB6_ENTITIES: &str = include_str!("../languages/vb6/entities.scm");
const VB6_RELATIONS: &str = include_str!("../languages/vb6/relations.scm");

/// Create a registry with all bundled language packs.
pub fn bundled_registry() -> Result<LanguageRegistry> {
    let mut registry = LanguageRegistry::new();

    registry.register(python_pack()?);

    // These may fail if queries don't match the grammar — log and skip
    match rust_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Rust language pack: {e}"),
    }
    match typescript_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load TypeScript language pack: {e}"),
    }
    if let Ok(pack) = javascript_pack() {
        registry.register(pack);
    } else {
        eprintln!("warning: failed to load JavaScript language pack");
    }
    if let Ok(pack) = go_pack() {
        registry.register(pack);
    } else {
        eprintln!("warning: failed to load Go language pack");
    }
    if let Ok(pack) = java_pack() {
        registry.register(pack);
    } else {
        eprintln!("warning: failed to load Java language pack");
    }
    match c_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load C language pack: {e}"),
    }
    match cpp_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load C++ language pack: {e}"),
    }
    match ruby_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Ruby language pack: {e}"),
    }
    match php_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load PHP language pack: {e}"),
    }
    match swift_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Swift language pack: {e}"),
    }
    match kotlin_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Kotlin language pack: {e}"),
    }
    match csharp_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load C# language pack: {e}"),
    }
    match scala_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Scala language pack: {e}"),
    }
    match lua_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Lua language pack: {e}"),
    }
    match zig_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Zig language pack: {e}"),
    }
    match elixir_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Elixir language pack: {e}"),
    }
    match dart_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Dart language pack: {e}"),
    }
    match objc_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Objective-C language pack: {e}"),
    }
    match haskell_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Haskell language pack: {e}"),
    }
    match perl_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Perl language pack: {e}"),
    }
    match r_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load R language pack: {e}"),
    }
    match ocaml_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load OCaml language pack: {e}"),
    }
    match bash_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Bash language pack: {e}"),
    }
    match sql_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load SQL language pack: {e}"),
    }
    match julia_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Julia language pack: {e}"),
    }
    match proto_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Protobuf language pack: {e}"),
    }
    match powershell_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load PowerShell language pack: {e}"),
    }
    match verilog_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Verilog language pack: {e}"),
    }
    match hcl_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load HCL language pack: {e}"),
    }
    match toml_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load TOML language pack: {e}"),
    }
    match yaml_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load YAML language pack: {e}"),
    }
    match erlang_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Erlang language pack: {e}"),
    }
    match dockerfile_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Dockerfile language pack: {e}"),
    }
    match fortran_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Fortran language pack: {e}"),
    }
    match nix_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Nix language pack: {e}"),
    }
    match svelte_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Svelte language pack: {e}"),
    }
    match fsharp_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load F# language pack: {e}"),
    }
    match groovy_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Groovy language pack: {e}"),
    }
    match css_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load CSS language pack: {e}"),
    }
    match html_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load HTML language pack: {e}"),
    }
    match json_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load JSON language pack: {e}"),
    }
    match xml_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load XML language pack: {e}"),
    }
    match makefile_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Makefile language pack: {e}"),
    }
    match cmake_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load CMake language pack: {e}"),
    }
    match graphql_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load GraphQL language pack: {e}"),
    }
    match glsl_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load GLSL language pack: {e}"),
    }
    match commonlisp_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Common Lisp language pack: {e}"),
    }
    match elm_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Elm language pack: {e}"),
    }
    match elisp_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Emacs Lisp language pack: {e}"),
    }
    match ini_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load INI language pack: {e}"),
    }
    match tsx_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load TSX language pack: {e}"),
    }
    match starlark_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Starlark language pack: {e}"),
    }
    match matlab_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load MATLAB language pack: {e}"),
    }
    match markdown_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Markdown language pack: {e}"),
    }
    match clojure_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Clojure language pack: {e}"),
    }
    match cuda_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load CUDA language pack: {e}"),
    }
    match pascal_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load Pascal/Delphi language pack: {e}"),
    }
    match vb6_pack() {
        Ok(pack) => registry.register(pack),
        Err(e) => eprintln!("warning: failed to load VB6 language pack: {e}"),
    }

    Ok(registry)
}

fn python_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_python::LANGUAGE.into();
    LanguagePack::new_with_custom_edges(
        "python",
        vec![".py"],
        grammar,
        PYTHON_ENTITIES,
        PYTHON_RELATIONS,
        vec![CustomEdgeDef {
            name: "DECORATED_BY".to_string(),
            capture: "decorates".to_string(),
        }],
    )
}

fn rust_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_rust::LANGUAGE.into();
    LanguagePack::new("rust", vec![".rs"], grammar, RUST_ENTITIES, RUST_RELATIONS)
}

fn typescript_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_typescript::LANGUAGE_TYPESCRIPT.into();
    LanguagePack::new(
        "typescript",
        vec![".ts"],
        grammar,
        TYPESCRIPT_ENTITIES,
        TYPESCRIPT_RELATIONS,
    )
}

fn javascript_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_javascript::LANGUAGE.into();
    LanguagePack::new(
        "javascript",
        vec![".js", ".jsx", ".mjs"],
        grammar,
        JAVASCRIPT_ENTITIES,
        JAVASCRIPT_RELATIONS,
    )
}

fn go_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_go::LANGUAGE.into();
    LanguagePack::new_with_custom_edges(
        "go",
        vec![".go"],
        grammar,
        GO_ENTITIES,
        GO_RELATIONS,
        vec![CustomEdgeDef {
            name: "SPAWNS".to_string(),
            capture: "goroutine".to_string(),
        }],
    )
}

fn java_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_java::LANGUAGE.into();
    LanguagePack::new(
        "java",
        vec![".java"],
        grammar,
        JAVA_ENTITIES,
        JAVA_RELATIONS,
    )
}

fn c_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_c::LANGUAGE.into();
    LanguagePack::new("c", vec![".c", ".h"], grammar, C_ENTITIES, C_RELATIONS)
}

fn cpp_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_cpp::LANGUAGE.into();
    LanguagePack::new(
        "cpp",
        vec![".cpp", ".cc", ".cxx", ".hpp", ".hxx", ".hh"],
        grammar,
        CPP_ENTITIES,
        CPP_RELATIONS,
    )
}

fn ruby_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_ruby::LANGUAGE.into();
    LanguagePack::new(
        "ruby",
        vec![".rb", ".rake", ".gemspec"],
        grammar,
        RUBY_ENTITIES,
        RUBY_RELATIONS,
    )
}

fn php_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_php::LANGUAGE_PHP.into();
    LanguagePack::new("php", vec![".php"], grammar, PHP_ENTITIES, PHP_RELATIONS)
}

fn swift_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_swift::LANGUAGE.into();
    LanguagePack::new(
        "swift",
        vec![".swift"],
        grammar,
        SWIFT_ENTITIES,
        SWIFT_RELATIONS,
    )
}

fn kotlin_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_kotlin_ng::LANGUAGE.into();
    LanguagePack::new(
        "kotlin",
        vec![".kt", ".kts"],
        grammar,
        KOTLIN_ENTITIES,
        KOTLIN_RELATIONS,
    )
}

fn csharp_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_c_sharp::LANGUAGE.into();
    LanguagePack::new(
        "csharp",
        vec![".cs"],
        grammar,
        CSHARP_ENTITIES,
        CSHARP_RELATIONS,
    )
}

fn scala_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_scala::LANGUAGE.into();
    LanguagePack::new(
        "scala",
        vec![".scala", ".sc"],
        grammar,
        SCALA_ENTITIES,
        SCALA_RELATIONS,
    )
}

fn lua_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_lua::LANGUAGE.into();
    LanguagePack::new("lua", vec![".lua"], grammar, LUA_ENTITIES, LUA_RELATIONS)
}

fn zig_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_zig::LANGUAGE.into();
    LanguagePack::new("zig", vec![".zig"], grammar, ZIG_ENTITIES, ZIG_RELATIONS)
}

fn elixir_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_elixir::LANGUAGE.into();
    LanguagePack::new(
        "elixir",
        vec![".ex", ".exs"],
        grammar,
        ELIXIR_ENTITIES,
        ELIXIR_RELATIONS,
    )
}

fn dart_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_dart::LANGUAGE.into();
    LanguagePack::new(
        "dart",
        vec![".dart"],
        grammar,
        DART_ENTITIES,
        DART_RELATIONS,
    )
}

fn objc_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_objc::LANGUAGE.into();
    LanguagePack::new(
        "objc",
        vec![".m", ".mm"],
        grammar,
        OBJC_ENTITIES,
        OBJC_RELATIONS,
    )
}

fn haskell_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_haskell::LANGUAGE.into();
    LanguagePack::new(
        "haskell",
        vec![".hs", ".lhs"],
        grammar,
        HASKELL_ENTITIES,
        HASKELL_RELATIONS,
    )
}

fn perl_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_perl::LANGUAGE.into();
    LanguagePack::new(
        "perl",
        vec![".pl", ".pm", ".t"],
        grammar,
        PERL_ENTITIES,
        PERL_RELATIONS,
    )
}

fn r_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_r::LANGUAGE.into();
    LanguagePack::new(
        "r",
        vec![".r", ".R", ".Rmd"],
        grammar,
        R_ENTITIES,
        R_RELATIONS,
    )
}

fn ocaml_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_ocaml::LANGUAGE_OCAML.into();
    LanguagePack::new(
        "ocaml",
        vec![".ml", ".mli"],
        grammar,
        OCAML_ENTITIES,
        OCAML_RELATIONS,
    )
}

fn bash_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_bash::LANGUAGE.into();
    LanguagePack::new(
        "bash",
        vec![".sh", ".bash", ".zsh"],
        grammar,
        BASH_ENTITIES,
        BASH_RELATIONS,
    )
}

fn sql_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_sequel::LANGUAGE.into();
    LanguagePack::new("sql", vec![".sql"], grammar, SQL_ENTITIES, SQL_RELATIONS)
}

fn julia_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_julia::LANGUAGE.into();
    LanguagePack::new(
        "julia",
        vec![".jl"],
        grammar,
        JULIA_ENTITIES,
        JULIA_RELATIONS,
    )
}

fn proto_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_proto::LANGUAGE.into();
    LanguagePack::new(
        "proto",
        vec![".proto"],
        grammar,
        PROTO_ENTITIES,
        PROTO_RELATIONS,
    )
}

fn powershell_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_powershell::LANGUAGE.into();
    LanguagePack::new(
        "powershell",
        vec![".ps1", ".psm1", ".psd1"],
        grammar,
        POWERSHELL_ENTITIES,
        POWERSHELL_RELATIONS,
    )
}

fn verilog_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_verilog::LANGUAGE.into();
    LanguagePack::new(
        "verilog",
        vec![".v", ".sv", ".svh", ".vh"],
        grammar,
        VERILOG_ENTITIES,
        VERILOG_RELATIONS,
    )
}

fn hcl_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_hcl::LANGUAGE.into();
    LanguagePack::new(
        "hcl",
        vec![".hcl", ".tf", ".tfvars"],
        grammar,
        HCL_ENTITIES,
        HCL_RELATIONS,
    )
}

fn toml_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_toml_ng::LANGUAGE.into();
    LanguagePack::new(
        "toml",
        vec![".toml"],
        grammar,
        TOML_ENTITIES,
        TOML_RELATIONS,
    )
}

fn yaml_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_yaml::LANGUAGE.into();
    LanguagePack::new(
        "yaml",
        vec![".yml", ".yaml"],
        grammar,
        YAML_ENTITIES,
        YAML_RELATIONS,
    )
}

fn erlang_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_erlang::LANGUAGE.into();
    LanguagePack::new(
        "erlang",
        vec![".erl", ".hrl"],
        grammar,
        ERLANG_ENTITIES,
        ERLANG_RELATIONS,
    )
}

fn dockerfile_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_containerfile::LANGUAGE.into();
    LanguagePack::new(
        "dockerfile",
        vec!["Dockerfile", "Containerfile", ".dockerfile"],
        grammar,
        DOCKERFILE_ENTITIES,
        DOCKERFILE_RELATIONS,
    )
}

fn fortran_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_fortran::LANGUAGE.into();
    LanguagePack::new(
        "fortran",
        vec![".f90", ".f95", ".f03", ".f08", ".f", ".for"],
        grammar,
        FORTRAN_ENTITIES,
        FORTRAN_RELATIONS,
    )
}

fn nix_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_nix::LANGUAGE.into();
    LanguagePack::new("nix", vec![".nix"], grammar, NIX_ENTITIES, NIX_RELATIONS)
}

fn svelte_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_svelte_ng::LANGUAGE.into();
    LanguagePack::new(
        "svelte",
        vec![".svelte"],
        grammar,
        SVELTE_ENTITIES,
        SVELTE_RELATIONS,
    )
}

fn fsharp_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_fsharp::LANGUAGE_FSHARP.into();
    LanguagePack::new(
        "fsharp",
        vec![".fs", ".fsi", ".fsx"],
        grammar,
        FSHARP_ENTITIES,
        FSHARP_RELATIONS,
    )
}

fn groovy_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_groovy::LANGUAGE.into();
    LanguagePack::new(
        "groovy",
        vec![".groovy", ".gradle"],
        grammar,
        GROOVY_ENTITIES,
        GROOVY_RELATIONS,
    )
}

fn css_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_css::LANGUAGE.into();
    LanguagePack::new("css", vec![".css"], grammar, CSS_ENTITIES, CSS_RELATIONS)
}

fn html_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_html::LANGUAGE.into();
    LanguagePack::new(
        "html",
        vec![".html", ".htm"],
        grammar,
        HTML_ENTITIES,
        HTML_RELATIONS,
    )
}

fn json_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_json::LANGUAGE.into();
    LanguagePack::new(
        "json",
        vec![".json"],
        grammar,
        JSON_ENTITIES,
        JSON_RELATIONS,
    )
}

fn xml_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_xml::LANGUAGE_XML.into();
    LanguagePack::new(
        "xml",
        vec![".xml", ".xsl", ".xsd", ".svg", ".plist"],
        grammar,
        XML_ENTITIES,
        XML_RELATIONS,
    )
}

fn makefile_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_make::LANGUAGE.into();
    LanguagePack::new(
        "makefile",
        vec!["Makefile", "makefile", "GNUmakefile", ".mk"],
        grammar,
        MAKEFILE_ENTITIES,
        MAKEFILE_RELATIONS,
    )
}

fn cmake_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_cmake::LANGUAGE.into();
    LanguagePack::new(
        "cmake",
        vec!["CMakeLists.txt", ".cmake"],
        grammar,
        CMAKE_ENTITIES,
        CMAKE_RELATIONS,
    )
}

fn graphql_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_graphql::LANGUAGE.into();
    LanguagePack::new(
        "graphql",
        vec![".graphql", ".gql"],
        grammar,
        GRAPHQL_ENTITIES,
        GRAPHQL_RELATIONS,
    )
}

fn glsl_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_glsl::LANGUAGE_GLSL.into();
    LanguagePack::new(
        "glsl",
        vec![".glsl", ".vert", ".frag", ".geom", ".comp"],
        grammar,
        GLSL_ENTITIES,
        GLSL_RELATIONS,
    )
}

fn commonlisp_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_commonlisp::LANGUAGE_COMMONLISP.into();
    LanguagePack::new(
        "commonlisp",
        vec![".lisp", ".lsp", ".cl", ".asd"],
        grammar,
        COMMONLISP_ENTITIES,
        COMMONLISP_RELATIONS,
    )
}

fn elm_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_elm::LANGUAGE.into();
    LanguagePack::new("elm", vec![".elm"], grammar, ELM_ENTITIES, ELM_RELATIONS)
}

fn elisp_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_elisp::LANGUAGE.into();
    LanguagePack::new(
        "elisp",
        vec![".el"],
        grammar,
        ELISP_ENTITIES,
        ELISP_RELATIONS,
    )
}

fn ini_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_ini::LANGUAGE.into();
    LanguagePack::new(
        "ini",
        vec![".ini", ".cfg", ".conf"],
        grammar,
        INI_ENTITIES,
        INI_RELATIONS,
    )
}

fn tsx_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_typescript::LANGUAGE_TSX.into();
    LanguagePack::new("tsx", vec![".tsx"], grammar, TSX_ENTITIES, TSX_RELATIONS)
}

fn starlark_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_starlark::LANGUAGE.into();
    LanguagePack::new(
        "starlark",
        vec![".bzl", ".star", "BUILD", "BUILD.bazel", "WORKSPACE"],
        grammar,
        STARLARK_ENTITIES,
        STARLARK_RELATIONS,
    )
}

fn matlab_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_matlab::LANGUAGE.into();
    LanguagePack::new(
        "matlab",
        vec![".mlx", ".mat"],
        grammar,
        MATLAB_ENTITIES,
        MATLAB_RELATIONS,
    )
}

fn markdown_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_md::LANGUAGE.into();
    LanguagePack::new(
        "markdown",
        vec![".md", ".markdown"],
        grammar,
        MARKDOWN_ENTITIES,
        MARKDOWN_RELATIONS,
    )
}

fn clojure_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_clojure_orchard::LANGUAGE.into();
    LanguagePack::new(
        "clojure",
        vec![".clj", ".cljs", ".cljc", ".edn"],
        grammar,
        CLOJURE_ENTITIES,
        CLOJURE_RELATIONS,
    )
}

fn cuda_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_cuda::LANGUAGE.into();
    LanguagePack::new(
        "cuda",
        vec![".cu", ".cuh"],
        grammar,
        CUDA_ENTITIES,
        CUDA_RELATIONS,
    )
}

fn pascal_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_pascal::LANGUAGE.into();
    LanguagePack::new(
        "pascal",
        vec![".pas", ".pp", ".dpr", ".dpk", ".inc", ".lpr"],
        grammar,
        PASCAL_ENTITIES,
        PASCAL_RELATIONS,
    )
}

fn vb6_pack() -> Result<LanguagePack> {
    let grammar = tree_sitter_vb6::language();
    LanguagePack::new(
        "vb6",
        vec![".bas", ".cls", ".frm"],
        grammar,
        VB6_ENTITIES,
        VB6_RELATIONS,
    )
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_all_packs_load() {
        // Verify bundled_registry succeeds (individual packs may warn but shouldn't panic)
        let registry = bundled_registry().expect("bundled_registry should succeed");
        assert!(
            registry.languages().count() > 0,
            "registry should have at least one language"
        );
    }

    #[test]
    fn test_powershell_pack() {
        powershell_pack().expect("PowerShell pack should load");
    }

    #[test]
    fn test_verilog_pack() {
        verilog_pack().expect("Verilog pack should load");
    }

    #[test]
    fn test_hcl_pack() {
        hcl_pack().expect("HCL pack should load");
    }

    #[test]
    fn test_toml_pack() {
        toml_pack().expect("TOML pack should load");
    }

    #[test]
    fn test_yaml_pack() {
        yaml_pack().expect("YAML pack should load");
    }

    #[test]
    fn test_erlang_pack() {
        erlang_pack().expect("Erlang pack should load");
    }

    #[test]
    fn test_dockerfile_pack() {
        dockerfile_pack().expect("Dockerfile pack should load");
    }

    #[test]
    fn test_fortran_pack() {
        fortran_pack().expect("Fortran pack should load");
    }

    #[test]
    fn test_nix_pack() {
        nix_pack().expect("Nix pack should load");
    }

    #[test]
    fn test_svelte_pack() {
        svelte_pack().expect("Svelte pack should load");
    }

    #[test]
    fn test_fsharp_pack() {
        fsharp_pack().expect("F# pack should load");
    }

    #[test]
    fn test_groovy_pack() {
        groovy_pack().expect("Groovy pack should load");
    }

    #[test]
    fn test_css_pack() {
        css_pack().expect("CSS pack should load");
    }

    #[test]
    fn test_html_pack() {
        html_pack().expect("HTML pack should load");
    }

    #[test]
    fn test_json_pack() {
        json_pack().expect("JSON pack should load");
    }

    #[test]
    fn test_xml_pack() {
        xml_pack().expect("XML pack should load");
    }

    #[test]
    fn test_makefile_pack() {
        makefile_pack().expect("Makefile pack should load");
    }

    #[test]
    fn test_cmake_pack() {
        cmake_pack().expect("CMake pack should load");
    }

    #[test]
    fn test_graphql_pack() {
        graphql_pack().expect("GraphQL pack should load");
    }

    #[test]
    fn test_glsl_pack() {
        glsl_pack().expect("GLSL pack should load");
    }

    #[test]
    fn test_commonlisp_pack() {
        commonlisp_pack().expect("Common Lisp pack should load");
    }

    #[test]
    fn test_elm_pack() {
        elm_pack().expect("Elm pack should load");
    }

    #[test]
    fn test_elisp_pack() {
        elisp_pack().expect("Emacs Lisp pack should load");
    }

    #[test]
    fn test_ini_pack() {
        ini_pack().expect("INI pack should load");
    }

    #[test]
    fn test_tsx_pack() {
        tsx_pack().expect("TSX pack should load");
    }

    #[test]
    fn test_matlab_pack() {
        matlab_pack().expect("MATLAB pack should load");
    }

    #[test]
    fn test_markdown_pack() {
        markdown_pack().expect("Markdown pack should load");
    }

    #[test]
    fn test_clojure_pack() {
        clojure_pack().expect("Clojure pack should load");
    }

    #[test]
    fn test_cuda_pack() {
        cuda_pack().expect("CUDA pack should load");
    }

    #[test]
    fn test_vb6_pack() {
        vb6_pack().expect("VB6 pack should load");
    }

    #[test]
    fn test_vb6_e2e_smoke() {
        let pack = vb6_pack().expect("VB6 pack should load");
        // Note: the tree-sitter-vb6 grammar parses `Call Foo(args)` incorrectly (Call becomes
        // the function name); use direct call syntax `Foo(args)` instead.
        let src = r#"VERSION 1.0 CLASS
BEGIN
  MultiUse = -1
END
Attribute VB_Name = "TestClass"
Option Explicit

Private mName As String

Public Sub Initialize(name As String)
    mName = name
End Sub

Public Function GetName() As String
    GetName = mName
End Function

Private Sub Helper()
    Dim result As String
    result = GetName()
    Initialize(result)
End Sub
"#;
        let extraction =
            infigraph_core::extract::extract_file("TestClass.cls", src.as_bytes(), &pack)
                .expect("extract_file should succeed");

        let symbol_names: Vec<&str> = extraction.symbols.iter().map(|s| s.name.as_str()).collect();
        println!("Symbols: {:?}", symbol_names);
        println!(
            "Symbol kinds: {:?}",
            extraction
                .symbols
                .iter()
                .map(|s| format!("{} ({:?})", s.name, s.kind))
                .collect::<Vec<_>>()
        );
        println!(
            "Relations: {:?}",
            extraction
                .relations
                .iter()
                .map(|r| format!("{} -> {}", r.source_id, r.target_id))
                .collect::<Vec<_>>()
        );

        // Verify module symbol
        let module = extraction.symbols.iter().find(|s| s.name == "TestClass");
        assert!(
            module.is_some(),
            "Expected Module symbol 'TestClass', got: {:?}",
            symbol_names
        );
        assert_eq!(
            module.unwrap().kind,
            infigraph_core::model::SymbolKind::Module
        );

        // Verify functions/subs
        assert!(
            symbol_names.contains(&"Initialize"),
            "Expected 'Initialize'"
        );
        assert!(symbol_names.contains(&"GetName"), "Expected 'GetName'");
        assert!(symbol_names.contains(&"Helper"), "Expected 'Helper'");

        // Verify variable
        assert!(symbol_names.contains(&"mName"), "Expected 'mName'");

        // Verify call relations exist — Helper calls GetName and Initialize
        assert!(
            !extraction.relations.is_empty(),
            "Expected call relations from Helper"
        );

        let relation_pairs: Vec<(&str, &str)> = extraction
            .relations
            .iter()
            .map(|r| (r.source_id.as_str(), r.target_id.as_str()))
            .collect();
        println!("Relation pairs: {:?}", relation_pairs);

        let helper_calls_getname = extraction
            .relations
            .iter()
            .any(|r| r.source_id.ends_with("::Helper") && r.target_id.ends_with("::GetName"));
        let helper_calls_initialize = extraction
            .relations
            .iter()
            .any(|r| r.source_id.ends_with("::Helper") && r.target_id.ends_with("::Initialize"));

        assert!(
            helper_calls_getname,
            "Expected Helper -> GetName call edge, got: {:?}",
            relation_pairs
        );
        assert!(
            helper_calls_initialize,
            "Expected Helper -> Initialize call edge, got: {:?}",
            relation_pairs
        );
    }

    #[test]
    fn test_sql_table_lineage() {
        let pack = sql_pack().unwrap();
        let sql = b"CREATE TABLE output AS SELECT col1 FROM source_a INNER JOIN source_b ON source_a.id = source_b.id;
WITH cte1 AS (SELECT * FROM base_table), cte2 AS (SELECT * FROM cte1) SELECT * FROM cte2;
INSERT INTO target_table SELECT * FROM input_table;";

        let extraction = infigraph_core::extract::extract_file("test.sql", sql, &pack).unwrap();

        let sym_names: Vec<&str> = extraction.symbols.iter().map(|s| s.name.as_str()).collect();
        assert!(
            sym_names.contains(&"output"),
            "expected CREATE TABLE output"
        );
        assert!(sym_names.contains(&"cte1"), "expected CTE cte1");
        assert!(sym_names.contains(&"cte2"), "expected CTE cte2");

        let has_edge = |src_suffix: &str, tgt_suffix: &str| {
            extraction
                .relations
                .iter()
                .any(|r| r.source_id.ends_with(src_suffix) && r.target_id.ends_with(tgt_suffix))
        };
        assert!(
            has_edge("::output", "::source_a"),
            "expected output -> source_a"
        );
        assert!(
            has_edge("::output", "::source_b"),
            "expected output -> source_b"
        );
        assert!(
            has_edge("::cte1", "::base_table"),
            "expected cte1 -> base_table"
        );
        assert!(has_edge("::cte2", "::cte1"), "expected cte2 -> cte1");
    }

    #[test]
    fn test_sql_spark_extraction_real() {
        let sample_dir = std::path::Path::new("/tmp/efp-group-sql-samples");
        if !sample_dir.exists() {
            println!("skipping — samples not found");
            return;
        }
        let pack = sql_pack().unwrap();
        for entry in std::fs::read_dir(sample_dir).unwrap().flatten() {
            let p = entry.path();
            if p.extension().and_then(|e| e.to_str()) != Some("sql") {
                continue;
            }
            let Ok(src) = std::fs::read(&p) else {
                continue;
            };
            if src.is_empty() {
                continue;
            }
            let fname = p.file_name().unwrap().to_string_lossy().to_string();
            match infigraph_core::extract::extract_file(&fname, &src, &pack) {
                Ok(e) => println!(
                    "{fname}: {} symbols, {} relations",
                    e.symbols.len(),
                    e.relations.len()
                ),
                Err(err) => println!("{fname}: EXTRACT ERROR: {err}"),
            }
        }
    }

    #[test]
    fn test_sql_notebook_file_level_refs() {
        let pack = sql_pack().unwrap();
        let sql = b"-- Databricks notebook source
SELECT * FROM fraud_360_rpt WHERE year='2023';

-- COMMAND ----------

SELECT a.*, b.score FROM risk_assessment a
LEFT JOIN risk_rules b ON a.id = b.assessment_id;";

        let extraction = infigraph_core::extract::extract_file("notebook.sql", sql, &pack).unwrap();

        assert!(
            !extraction.relations.is_empty(),
            "expected file-level relations from notebook SQL"
        );
        let has_edge = |tgt: &str| {
            extraction
                .relations
                .iter()
                .any(|r| r.target_id.ends_with(tgt))
        };
        assert!(has_edge("::fraud_360_rpt"), "expected ref to fraud_360_rpt");
        assert!(
            has_edge("::risk_assessment"),
            "expected ref to risk_assessment"
        );
        assert!(has_edge("::risk_rules"), "expected ref to risk_rules");

        let file_sourced = extraction
            .relations
            .iter()
            .any(|r| r.source_id.contains("notebook.sql"));
        assert!(
            file_sourced,
            "expected file-level source for notebook relations"
        );
    }

    #[test]
    fn test_sql_dialect_coverage() {
        let pack = sql_pack().unwrap();

        #[allow(clippy::type_complexity)]
        let cases: Vec<(&str, &[u8], &[&str], &[(&str, &str)])> = vec![
            // (label, sql, expected_targets, expected_edges as (src_suffix, tgt_suffix))

            // Spark SQL
            (
                "spark_ctas",
                b"CREATE TABLE output AS SELECT * FROM src_a JOIN src_b ON a.id = b.id;" as &[u8],
                &["src_a", "src_b"],
                &[("::output", "::src_a"), ("::output", "::src_b")],
            ),
            (
                "spark_insert_overwrite",
                b"INSERT OVERWRITE TABLE target SELECT * FROM source;",
                &["source"],
                &[],
            ),
            (
                "spark_cte",
                b"WITH stg AS (SELECT * FROM raw_events) SELECT * FROM stg;",
                &["raw_events", "stg"],
                &[("::stg", "::raw_events")],
            ),
            // T-SQL / SQL Server
            (
                "tsql_select_into",
                b"SELECT * INTO new_table FROM old_table;",
                &["old_table"],
                &[],
            ),
            (
                "tsql_cte_insert",
                b"WITH cte AS (SELECT * FROM src) INSERT INTO tgt SELECT * FROM cte;",
                &["src", "cte"],
                &[("::cte", "::src")],
            ),
            // PostgreSQL
            (
                "pg_ctas",
                b"CREATE TABLE summary AS SELECT dept, count(*) FROM employees GROUP BY dept;",
                &["employees"],
                &[("::summary", "::employees")],
            ),
            (
                "pg_with_insert",
                b"WITH src AS (SELECT * FROM raw) INSERT INTO clean SELECT * FROM src;",
                &["raw", "src"],
                &[("::src", "::raw")],
            ),
            // MySQL
            (
                "mysql_insert_ignore",
                b"INSERT IGNORE INTO users SELECT * FROM staging_users;",
                &["staging_users"],
                &[],
            ),
            // BigQuery style
            (
                "bq_create_or_replace",
                b"CREATE OR REPLACE TABLE output AS SELECT * FROM input;",
                &["input"],
                &[],
            ),
            // Common patterns
            (
                "subquery",
                b"SELECT * FROM (SELECT id FROM raw_data) sub;",
                &["raw_data"],
                &[],
            ),
            (
                "multi_join",
                b"SELECT * FROM a JOIN b ON a.id = b.id LEFT JOIN c ON b.id = c.id;",
                &["a", "b", "c"],
                &[],
            ),
            (
                "union_all",
                b"SELECT * FROM t1 UNION ALL SELECT * FROM t2;",
                &["t1", "t2"],
                &[],
            ),
        ];

        let mut failures = Vec::new();

        for (label, sql, expected_targets, expected_edges) in &cases {
            let extraction = infigraph_core::extract::extract_file("test.sql", sql, &pack).unwrap();
            let all_targets: Vec<&str> = extraction
                .relations
                .iter()
                .map(|r| r.target_id.as_str())
                .collect();

            for tgt in *expected_targets {
                let suffix = format!("::{}", tgt);
                if !extraction
                    .relations
                    .iter()
                    .any(|r| r.target_id.ends_with(&suffix))
                {
                    failures.push(format!(
                        "{}: missing target ref to {}, got {:?}",
                        label, tgt, all_targets
                    ));
                }
            }

            for (src_suf, tgt_suf) in *expected_edges {
                if !extraction
                    .relations
                    .iter()
                    .any(|r| r.source_id.ends_with(src_suf) && r.target_id.ends_with(tgt_suf))
                {
                    let edges: Vec<_> = extraction
                        .relations
                        .iter()
                        .map(|r| format!("{} -> {}", r.source_id, r.target_id))
                        .collect();
                    failures.push(format!(
                        "{}: missing edge {} -> {}, got {:?}",
                        label, src_suf, tgt_suf, edges
                    ));
                }
            }
        }

        if !failures.is_empty() {
            panic!("SQL dialect coverage failures:\n{}", failures.join("\n"));
        }
    }

    #[test]
    fn test_sql_notebook_formats() {
        let pack = sql_pack().unwrap();

        let cases: Vec<(&str, &[u8], &[&str])> = vec![
            // Databricks notebook
            ("databricks", b"-- Databricks notebook source\nSELECT * FROM table_a;\n-- COMMAND ----------\nSELECT * FROM table_b;" as &[u8],
             &["table_a", "table_b"]),

            // Jupyter-style: SQL cells are just raw SQL (no magic prefix in .sql export)
            ("jupyter_plain", b"SELECT * FROM dataset_1;\nSELECT * FROM dataset_2 JOIN dataset_3 ON d2.id = d3.id;",
             &["dataset_1", "dataset_2", "dataset_3"]),

            // Zeppelin notebook style (paragraph markers)
            ("zeppelin", b"%sql\nSELECT * FROM zep_table_1;\n\n%sql\nSELECT a.* FROM zep_table_2 a LEFT JOIN zep_table_3 b ON a.id = b.id;",
             &["zep_table_1", "zep_table_2", "zep_table_3"]),

            // dbt-style Jinja (jinja tags parse as errors but table refs in FROM survive)
            ("dbt_ref", b"SELECT * FROM {{ ref('stg_orders') }}\nJOIN raw_customers ON orders.cust_id = raw_customers.id;",
             &["raw_customers"]),

            // Mixed DDL + bare SELECT
            ("mixed", b"CREATE TABLE output AS SELECT * FROM src;\nSELECT * FROM standalone_ref;",
             &["src", "standalone_ref"]),
        ];

        let mut failures = Vec::new();

        for (label, sql, expected_targets) in &cases {
            let extraction =
                infigraph_core::extract::extract_file("notebook.sql", sql, &pack).unwrap();
            let all_targets: Vec<String> = extraction
                .relations
                .iter()
                .map(|r| r.target_id.clone())
                .collect();

            for tgt in *expected_targets {
                let suffix = format!("::{}", tgt);
                if !extraction
                    .relations
                    .iter()
                    .any(|r| r.target_id.ends_with(&suffix))
                {
                    failures.push(format!(
                        "{}: missing target ref to {}, got {:?}",
                        label, tgt, all_targets
                    ));
                }
            }

            let all_file_sourced = extraction
                .relations
                .iter()
                .filter(|r| !r.source_id.contains("::"))
                .count()
                == 0;
            if !all_file_sourced {
                let non_qualified: Vec<_> = extraction
                    .relations
                    .iter()
                    .filter(|r| !r.source_id.contains("::"))
                    .map(|r| r.source_id.as_str())
                    .collect();
                if !non_qualified.is_empty() {
                    failures.push(format!(
                        "{}: source_ids without '::': {:?}",
                        label, non_qualified
                    ));
                }
            }
        }

        if !failures.is_empty() {
            panic!("Notebook format failures:\n{}", failures.join("\n"));
        }
    }

    #[test]
    fn test_sql_complex_nested_and_dml() {
        let pack = sql_pack().unwrap();

        #[allow(clippy::type_complexity)]
        let cases: Vec<(&str, &[u8], &[&str], &[(&str, &str)])> = vec![
            // Nested subqueries in FROM
            ("nested_subquery",
             b"SELECT * FROM (SELECT id FROM (SELECT id FROM deep_source) inner_q) outer_q;" as &[u8],
             &["deep_source"], &[]),

            // CTE chain: cte1 -> raw, cte2 -> cte1, cte3 -> cte2 + extra
            ("cte_chain",
             b"WITH cte1 AS (SELECT * FROM raw_data), \
               cte2 AS (SELECT * FROM cte1), \
               cte3 AS (SELECT a.* FROM cte2 a JOIN dim_table b ON a.id = b.id) \
               SELECT * FROM cte3;",
             &["raw_data", "cte1", "cte2", "dim_table", "cte3"],
             &[("::cte1", "::raw_data"), ("::cte2", "::cte1"), ("::cte3", "::cte2"), ("::cte3", "::dim_table")]),

            // CREATE TABLE with CTE
            ("ctas_with_cte",
             b"CREATE TABLE final_output AS \
               WITH stg AS (SELECT * FROM staging_table) \
               SELECT * FROM stg JOIN lookup ON stg.key = lookup.key;",
             &["staging_table", "stg", "lookup"],
             &[("::stg", "::staging_table")]),

            // INSERT with subquery + JOIN
            ("insert_subquery_join",
             b"INSERT INTO target_table \
               SELECT a.*, b.score FROM \
               (SELECT * FROM base_facts) a \
               JOIN scoring_model b ON a.id = b.id;",
             &["base_facts", "scoring_model"],
             &[]),

            // Multiple DML in one file: CREATE + INSERT + SELECT
            ("multi_dml",
             b"CREATE TABLE dim_users AS SELECT * FROM raw_users; \
               INSERT INTO fact_orders SELECT * FROM staging_orders JOIN dim_users ON so.uid = du.uid; \
               SELECT * FROM fact_orders WHERE dt = '2024-01-01';",
             &["raw_users", "staging_orders", "dim_users", "fact_orders"],
             &[("::dim_users", "::raw_users")]),

            // Correlated subquery in WHERE
            ("correlated_subquery",
             b"SELECT * FROM orders o WHERE EXISTS (SELECT 1 FROM returns r WHERE r.order_id = o.id);",
             &["orders", "returns"], &[]),

            // UNION inside CTE
            ("cte_union",
             b"WITH combined AS ( \
                 SELECT id, amount FROM source_a \
                 UNION ALL \
                 SELECT id, amount FROM source_b \
               ) SELECT * FROM combined;",
             &["source_a", "source_b", "combined"],
             &[]),

            // Deeply nested: CTE -> subquery -> JOIN
            ("deep_nesting",
             b"WITH prep AS ( \
                 SELECT * FROM ( \
                     SELECT a.*, b.cat FROM raw_events a \
                     LEFT JOIN categories b ON a.cat_id = b.id \
                 ) sub WHERE sub.cat IS NOT NULL \
               ) \
               INSERT INTO clean_events SELECT * FROM prep;",
             &["raw_events", "categories", "prep"],
             &[("::prep", "::raw_events"), ("::prep", "::categories")]),

            // Multiple JOINs
            ("multi_join_4way",
             b"SELECT * FROM t1 \
               JOIN t2 ON t1.id = t2.id \
               LEFT JOIN t3 ON t2.id = t3.id \
               INNER JOIN t4 ON t3.id = t4.id;",
             &["t1", "t2", "t3", "t4"], &[]),

            // INSERT with multiple JOINs
            ("insert_multi_join",
             b"INSERT INTO report \
               SELECT f.*, d.name, p.category FROM fact_sales f \
               JOIN dim_date d ON f.date_id = d.id \
               JOIN dim_product p ON f.prod_id = p.id;",
             &["fact_sales", "dim_date", "dim_product"],
             &[("::report", "::fact_sales")]),
        ];

        let mut failures = Vec::new();

        for (label, sql, expected_targets, expected_edges) in &cases {
            let extraction = infigraph_core::extract::extract_file("test.sql", sql, &pack).unwrap();
            let all_targets: Vec<String> = extraction
                .relations
                .iter()
                .map(|r| r.target_id.clone())
                .collect();
            let all_edges: Vec<String> = extraction
                .relations
                .iter()
                .map(|r| format!("{} -> {}", r.source_id, r.target_id))
                .collect();

            for tgt in *expected_targets {
                let suffix = format!("::{}", tgt);
                if !extraction
                    .relations
                    .iter()
                    .any(|r| r.target_id.ends_with(&suffix))
                {
                    failures.push(format!(
                        "{}: missing target ref to '{}', targets: {:?}",
                        label, tgt, all_targets
                    ));
                }
            }

            for (src_suf, tgt_suf) in *expected_edges {
                if !extraction
                    .relations
                    .iter()
                    .any(|r| r.source_id.ends_with(src_suf) && r.target_id.ends_with(tgt_suf))
                {
                    failures.push(format!(
                        "{}: missing edge {} -> {}, edges: {:?}",
                        label, src_suf, tgt_suf, all_edges
                    ));
                }
            }
        }

        if !failures.is_empty() {
            panic!("Complex nested/DML failures:\n{}", failures.join("\n"));
        }
    }

    #[test]
    fn test_pascal_relations() {
        let pack = pascal_pack().expect("Pascal pack should load");
        let src = br#"unit Test;
interface
uses SysUtils, Classes;
type
  TMyClass = class(TObject)
    procedure DoStuff;
  end;
implementation
procedure TMyClass.DoStuff;
begin
  WriteLn('hello');
  SomeObj.Method(42);
  inherited Create;
end;
end."#;

        let extraction = infigraph_core::extract::extract_file("test.pas", &src[..], &pack)
            .expect("extract_file should succeed for Pascal");

        let calls: Vec<_> = extraction
            .relations
            .iter()
            .filter(|r| r.kind == infigraph_core::model::RelationKind::Calls)
            .collect();

        let imports: Vec<_> = extraction
            .relations
            .iter()
            .filter(|r| r.kind == infigraph_core::model::RelationKind::Imports)
            .collect();

        let inherits: Vec<_> = extraction
            .relations
            .iter()
            .filter(|r| r.kind == infigraph_core::model::RelationKind::Inherits)
            .collect();

        assert!(
            !calls.is_empty(),
            "Expected CALLS relations from Pascal code"
        );
        assert!(
            !imports.is_empty(),
            "Expected IMPORTS relations from Pascal code"
        );
        assert!(
            !inherits.is_empty(),
            "Expected INHERITS relations from Pascal code"
        );
    }

    #[test]
    fn test_csharp_inheritance() {
        let pack = csharp_pack().expect("C# pack should load");
        let src = br#"using System;
using System.Collections.Generic;

namespace Intuit.Applications.PTG.DatabaseService
{
    public class SqliteDataLayer : IDataLayer
    {
        public void AddNewClient(string name) { }
        public void DeleteClient(int id) { }
    }
}
"#;
        let extraction = infigraph_core::extract::extract_file("test.cs", &src[..], &pack)
            .expect("extract_file should succeed for C#");

        let inherits: Vec<_> = extraction
            .relations
            .iter()
            .filter(|r| r.kind == infigraph_core::model::RelationKind::Inherits)
            .collect();
        assert!(
            !inherits.is_empty(),
            "Expected INHERITS relations from C# class : interface"
        );
    }

    #[test]
    fn test_rust_test_extraction() {
        let pack = rust_pack().unwrap();
        let src = br#"
#[test]
fn test_add() {
    assert_eq!(1 + 1, 2);
}

pub fn public_fn() -> i32 {
    42
}

fn private_fn() {}

pub(crate) fn crate_fn() {}
"#;
        let extraction = infigraph_core::extract::extract_file("lib.rs", src, &pack).unwrap();
        let syms = &extraction.symbols;

        let test_add = syms.iter().find(|s| s.name == "test_add");
        assert!(test_add.is_some(), "test_add should be extracted");
        assert_eq!(
            test_add.unwrap().kind,
            infigraph_core::model::SymbolKind::Test,
            "test_add should have Test kind, got {:?}",
            test_add.unwrap().kind
        );

        let public_fn = syms.iter().find(|s| s.name == "public_fn");
        assert!(public_fn.is_some(), "public_fn should be extracted");
        assert_eq!(
            public_fn.unwrap().visibility.as_deref(),
            Some("pub"),
            "public_fn should have pub visibility, got {:?}",
            public_fn.unwrap().visibility
        );

        let private_fn = syms.iter().find(|s| s.name == "private_fn");
        assert!(private_fn.is_some(), "private_fn should be extracted");
        assert!(
            private_fn.unwrap().visibility.is_none(),
            "private_fn should have no visibility modifier"
        );

        let crate_fn = syms.iter().find(|s| s.name == "crate_fn");
        assert!(crate_fn.is_some(), "crate_fn should be extracted");
        assert_eq!(
            crate_fn.unwrap().visibility.as_deref(),
            Some("pub(crate)"),
            "crate_fn should have pub(crate) visibility, got {:?}",
            crate_fn.unwrap().visibility
        );
    }

    #[test]
    fn test_rust_tokio_test_extraction() {
        let pack = rust_pack().unwrap();
        let src = br#"
#[tokio::test]
async fn test_async_op() {
    let x = 1;
}
"#;
        let extraction = infigraph_core::extract::extract_file("lib.rs", src, &pack).unwrap();
        let test_fn = extraction
            .symbols
            .iter()
            .find(|s| s.name == "test_async_op");
        assert!(test_fn.is_some(), "test_async_op should be extracted");
        assert_eq!(
            test_fn.unwrap().kind,
            infigraph_core::model::SymbolKind::Test,
            "tokio::test should produce Test kind, got {:?}",
            test_fn.unwrap().kind
        );
    }
}