@grafema/core 0.1.0-alpha.5 → 0.1.1-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (391) hide show
  1. package/README.md +0 -1
  2. package/dist/Orchestrator.d.ts +24 -2
  3. package/dist/Orchestrator.d.ts.map +1 -1
  4. package/dist/Orchestrator.js +197 -24
  5. package/dist/config/ConfigLoader.d.ts +72 -0
  6. package/dist/config/ConfigLoader.d.ts.map +1 -0
  7. package/dist/config/ConfigLoader.js +187 -0
  8. package/dist/config/index.d.ts +6 -0
  9. package/dist/config/index.d.ts.map +1 -0
  10. package/dist/config/index.js +4 -0
  11. package/dist/core/ASTWorker.d.ts +11 -36
  12. package/dist/core/ASTWorker.d.ts.map +1 -1
  13. package/dist/core/ASTWorker.js +93 -99
  14. package/dist/core/CoverageAnalyzer.d.ts +65 -0
  15. package/dist/core/CoverageAnalyzer.d.ts.map +1 -0
  16. package/dist/core/CoverageAnalyzer.js +198 -0
  17. package/dist/core/FileNodeManager.d.ts +40 -0
  18. package/dist/core/FileNodeManager.d.ts.map +1 -0
  19. package/dist/core/FileNodeManager.js +84 -0
  20. package/dist/core/GraphFreshnessChecker.d.ts +33 -0
  21. package/dist/core/GraphFreshnessChecker.d.ts.map +1 -0
  22. package/dist/core/GraphFreshnessChecker.js +101 -0
  23. package/dist/core/HashUtils.d.ts +24 -0
  24. package/dist/core/HashUtils.d.ts.map +1 -0
  25. package/dist/core/HashUtils.js +45 -0
  26. package/dist/core/IncrementalReanalyzer.d.ts +36 -0
  27. package/dist/core/IncrementalReanalyzer.d.ts.map +1 -0
  28. package/dist/core/IncrementalReanalyzer.js +132 -0
  29. package/dist/core/NodeFactory.d.ts +225 -17
  30. package/dist/core/NodeFactory.d.ts.map +1 -1
  31. package/dist/core/NodeFactory.js +208 -18
  32. package/dist/core/ScopeTracker.d.ts +84 -0
  33. package/dist/core/ScopeTracker.d.ts.map +1 -0
  34. package/dist/core/ScopeTracker.js +116 -0
  35. package/dist/core/SemanticId.d.ts +90 -0
  36. package/dist/core/SemanticId.d.ts.map +1 -0
  37. package/dist/core/SemanticId.js +115 -0
  38. package/dist/core/VersionManager.d.ts.map +1 -1
  39. package/dist/core/VersionManager.js +3 -2
  40. package/dist/core/nodes/ArgumentExpressionNode.d.ts +43 -0
  41. package/dist/core/nodes/ArgumentExpressionNode.d.ts.map +1 -0
  42. package/dist/core/nodes/ArgumentExpressionNode.js +60 -0
  43. package/dist/core/nodes/ArrayLiteralNode.d.ts +27 -0
  44. package/dist/core/nodes/ArrayLiteralNode.d.ts.map +1 -0
  45. package/dist/core/nodes/ArrayLiteralNode.js +41 -0
  46. package/dist/core/nodes/CallSiteNode.d.ts +28 -0
  47. package/dist/core/nodes/CallSiteNode.d.ts.map +1 -1
  48. package/dist/core/nodes/CallSiteNode.js +46 -0
  49. package/dist/core/nodes/ClassNode.d.ts +33 -1
  50. package/dist/core/nodes/ClassNode.d.ts.map +1 -1
  51. package/dist/core/nodes/ClassNode.js +46 -2
  52. package/dist/core/nodes/DecoratorNode.d.ts +42 -0
  53. package/dist/core/nodes/DecoratorNode.d.ts.map +1 -0
  54. package/dist/core/nodes/DecoratorNode.js +62 -0
  55. package/dist/core/nodes/EnumNode.d.ts +42 -0
  56. package/dist/core/nodes/EnumNode.d.ts.map +1 -0
  57. package/dist/core/nodes/EnumNode.js +54 -0
  58. package/dist/core/nodes/ExportNode.d.ts +37 -1
  59. package/dist/core/nodes/ExportNode.d.ts.map +1 -1
  60. package/dist/core/nodes/ExportNode.js +48 -2
  61. package/dist/core/nodes/ExpressionNode.d.ts +97 -0
  62. package/dist/core/nodes/ExpressionNode.d.ts.map +1 -0
  63. package/dist/core/nodes/ExpressionNode.js +178 -0
  64. package/dist/core/nodes/ExternalModuleNode.d.ts +28 -0
  65. package/dist/core/nodes/ExternalModuleNode.d.ts.map +1 -0
  66. package/dist/core/nodes/ExternalModuleNode.js +41 -0
  67. package/dist/core/nodes/ExternalStdioNode.d.ts +13 -6
  68. package/dist/core/nodes/ExternalStdioNode.d.ts.map +1 -1
  69. package/dist/core/nodes/ExternalStdioNode.js +15 -8
  70. package/dist/core/nodes/FunctionNode.d.ts +36 -0
  71. package/dist/core/nodes/FunctionNode.d.ts.map +1 -1
  72. package/dist/core/nodes/FunctionNode.js +80 -1
  73. package/dist/core/nodes/ImportNode.d.ts +19 -5
  74. package/dist/core/nodes/ImportNode.d.ts.map +1 -1
  75. package/dist/core/nodes/ImportNode.js +23 -5
  76. package/dist/core/nodes/InterfaceNode.d.ts +46 -0
  77. package/dist/core/nodes/InterfaceNode.d.ts.map +1 -0
  78. package/dist/core/nodes/InterfaceNode.js +55 -0
  79. package/dist/core/nodes/IssueNode.d.ts +73 -0
  80. package/dist/core/nodes/IssueNode.d.ts.map +1 -0
  81. package/dist/core/nodes/IssueNode.js +129 -0
  82. package/dist/core/nodes/MethodCallNode.d.ts +30 -0
  83. package/dist/core/nodes/MethodCallNode.d.ts.map +1 -1
  84. package/dist/core/nodes/MethodCallNode.js +49 -0
  85. package/dist/core/nodes/MethodNode.d.ts +32 -0
  86. package/dist/core/nodes/MethodNode.d.ts.map +1 -1
  87. package/dist/core/nodes/MethodNode.js +48 -0
  88. package/dist/core/nodes/ModuleNode.d.ts +31 -0
  89. package/dist/core/nodes/ModuleNode.d.ts.map +1 -1
  90. package/dist/core/nodes/ModuleNode.js +37 -0
  91. package/dist/core/nodes/NetworkRequestNode.d.ts +54 -0
  92. package/dist/core/nodes/NetworkRequestNode.d.ts.map +1 -0
  93. package/dist/core/nodes/NetworkRequestNode.js +65 -0
  94. package/dist/core/nodes/ObjectLiteralNode.d.ts +27 -0
  95. package/dist/core/nodes/ObjectLiteralNode.d.ts.map +1 -0
  96. package/dist/core/nodes/ObjectLiteralNode.js +41 -0
  97. package/dist/core/nodes/ScopeNode.d.ts +31 -0
  98. package/dist/core/nodes/ScopeNode.d.ts.map +1 -1
  99. package/dist/core/nodes/ScopeNode.js +49 -0
  100. package/dist/core/nodes/TypeNode.d.ts +36 -0
  101. package/dist/core/nodes/TypeNode.d.ts.map +1 -0
  102. package/dist/core/nodes/TypeNode.js +53 -0
  103. package/dist/core/nodes/VariableDeclarationNode.d.ts +27 -0
  104. package/dist/core/nodes/VariableDeclarationNode.d.ts.map +1 -1
  105. package/dist/core/nodes/VariableDeclarationNode.js +40 -0
  106. package/dist/core/nodes/index.d.ts +12 -1
  107. package/dist/core/nodes/index.d.ts.map +1 -1
  108. package/dist/core/nodes/index.js +14 -0
  109. package/dist/diagnostics/DiagnosticCollector.d.ts +98 -0
  110. package/dist/diagnostics/DiagnosticCollector.d.ts.map +1 -0
  111. package/dist/diagnostics/DiagnosticCollector.js +129 -0
  112. package/dist/diagnostics/DiagnosticReporter.d.ts +77 -0
  113. package/dist/diagnostics/DiagnosticReporter.d.ts.map +1 -0
  114. package/dist/diagnostics/DiagnosticReporter.js +159 -0
  115. package/dist/diagnostics/DiagnosticWriter.d.ts +31 -0
  116. package/dist/diagnostics/DiagnosticWriter.d.ts.map +1 -0
  117. package/dist/diagnostics/DiagnosticWriter.js +43 -0
  118. package/dist/diagnostics/index.d.ts +14 -0
  119. package/dist/diagnostics/index.d.ts.map +1 -0
  120. package/dist/diagnostics/index.js +11 -0
  121. package/dist/errors/GrafemaError.d.ts +118 -0
  122. package/dist/errors/GrafemaError.d.ts.map +1 -0
  123. package/dist/errors/GrafemaError.js +131 -0
  124. package/dist/index.d.ts +57 -1
  125. package/dist/index.d.ts.map +1 -1
  126. package/dist/index.js +54 -1
  127. package/dist/logging/Logger.d.ts +48 -0
  128. package/dist/logging/Logger.d.ts.map +1 -0
  129. package/dist/logging/Logger.js +134 -0
  130. package/dist/plugins/Plugin.d.ts +5 -1
  131. package/dist/plugins/Plugin.d.ts.map +1 -1
  132. package/dist/plugins/Plugin.js +33 -0
  133. package/dist/plugins/analysis/DatabaseAnalyzer.d.ts.map +1 -1
  134. package/dist/plugins/analysis/DatabaseAnalyzer.js +13 -6
  135. package/dist/plugins/analysis/ExpressAnalyzer.d.ts.map +1 -1
  136. package/dist/plugins/analysis/ExpressAnalyzer.js +27 -19
  137. package/dist/plugins/analysis/ExpressRouteAnalyzer.d.ts.map +1 -1
  138. package/dist/plugins/analysis/ExpressRouteAnalyzer.js +21 -14
  139. package/dist/plugins/analysis/FetchAnalyzer.d.ts +1 -0
  140. package/dist/plugins/analysis/FetchAnalyzer.d.ts.map +1 -1
  141. package/dist/plugins/analysis/FetchAnalyzer.js +34 -14
  142. package/dist/plugins/analysis/IncrementalAnalysisPlugin.d.ts +6 -3
  143. package/dist/plugins/analysis/IncrementalAnalysisPlugin.d.ts.map +1 -1
  144. package/dist/plugins/analysis/IncrementalAnalysisPlugin.js +76 -80
  145. package/dist/plugins/analysis/JSASTAnalyzer.d.ts +180 -17
  146. package/dist/plugins/analysis/JSASTAnalyzer.d.ts.map +1 -1
  147. package/dist/plugins/analysis/JSASTAnalyzer.js +1171 -471
  148. package/dist/plugins/analysis/ReactAnalyzer.d.ts.map +1 -1
  149. package/dist/plugins/analysis/ReactAnalyzer.js +56 -57
  150. package/dist/plugins/analysis/RustAnalyzer.d.ts.map +1 -1
  151. package/dist/plugins/analysis/RustAnalyzer.js +15 -10
  152. package/dist/plugins/analysis/SQLiteAnalyzer.d.ts.map +1 -1
  153. package/dist/plugins/analysis/SQLiteAnalyzer.js +9 -7
  154. package/dist/plugins/analysis/ServiceLayerAnalyzer.d.ts.map +1 -1
  155. package/dist/plugins/analysis/ServiceLayerAnalyzer.js +21 -9
  156. package/dist/plugins/analysis/SocketIOAnalyzer.d.ts.map +1 -1
  157. package/dist/plugins/analysis/SocketIOAnalyzer.js +27 -15
  158. package/dist/plugins/analysis/SystemDbAnalyzer.d.ts.map +1 -1
  159. package/dist/plugins/analysis/SystemDbAnalyzer.js +15 -5
  160. package/dist/plugins/analysis/ast/GraphBuilder.d.ts +34 -4
  161. package/dist/plugins/analysis/ast/GraphBuilder.d.ts.map +1 -1
  162. package/dist/plugins/analysis/ast/GraphBuilder.js +318 -298
  163. package/dist/plugins/analysis/ast/IdGenerator.d.ts +105 -0
  164. package/dist/plugins/analysis/ast/IdGenerator.d.ts.map +1 -0
  165. package/dist/plugins/analysis/ast/IdGenerator.js +116 -0
  166. package/dist/plugins/analysis/ast/types.d.ts +176 -5
  167. package/dist/plugins/analysis/ast/types.d.ts.map +1 -1
  168. package/dist/plugins/analysis/ast/utils/createParameterNodes.d.ts +33 -0
  169. package/dist/plugins/analysis/ast/utils/createParameterNodes.d.ts.map +1 -0
  170. package/dist/plugins/analysis/ast/utils/createParameterNodes.js +89 -0
  171. package/dist/plugins/analysis/ast/utils/index.d.ts +6 -0
  172. package/dist/plugins/analysis/ast/utils/index.d.ts.map +1 -0
  173. package/dist/plugins/analysis/ast/utils/index.js +5 -0
  174. package/dist/plugins/analysis/ast/utils/location.d.ts +87 -0
  175. package/dist/plugins/analysis/ast/utils/location.d.ts.map +1 -0
  176. package/dist/plugins/analysis/ast/utils/location.js +78 -0
  177. package/dist/plugins/analysis/ast/visitors/ASTVisitor.d.ts +9 -4
  178. package/dist/plugins/analysis/ast/visitors/ASTVisitor.d.ts.map +1 -1
  179. package/dist/plugins/analysis/ast/visitors/ASTVisitor.js +6 -5
  180. package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.d.ts +99 -9
  181. package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.d.ts.map +1 -1
  182. package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.js +663 -125
  183. package/dist/plugins/analysis/ast/visitors/ClassVisitor.d.ts +4 -1
  184. package/dist/plugins/analysis/ast/visitors/ClassVisitor.d.ts.map +1 -1
  185. package/dist/plugins/analysis/ast/visitors/ClassVisitor.js +72 -32
  186. package/dist/plugins/analysis/ast/visitors/FunctionVisitor.d.ts +4 -1
  187. package/dist/plugins/analysis/ast/visitors/FunctionVisitor.d.ts.map +1 -1
  188. package/dist/plugins/analysis/ast/visitors/FunctionVisitor.js +128 -63
  189. package/dist/plugins/analysis/ast/visitors/ImportExportVisitor.d.ts.map +1 -1
  190. package/dist/plugins/analysis/ast/visitors/ImportExportVisitor.js +11 -8
  191. package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.d.ts +12 -1
  192. package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.d.ts.map +1 -1
  193. package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.js +36 -14
  194. package/dist/plugins/analysis/ast/visitors/VariableVisitor.d.ts +4 -1
  195. package/dist/plugins/analysis/ast/visitors/VariableVisitor.d.ts.map +1 -1
  196. package/dist/plugins/analysis/ast/visitors/VariableVisitor.js +17 -13
  197. package/dist/plugins/discovery/MonorepoServiceDiscovery.d.ts.map +1 -1
  198. package/dist/plugins/discovery/MonorepoServiceDiscovery.js +3 -2
  199. package/dist/plugins/discovery/SimpleProjectDiscovery.d.ts.map +1 -1
  200. package/dist/plugins/discovery/SimpleProjectDiscovery.js +5 -1
  201. package/dist/plugins/discovery/WorkspaceDiscovery.d.ts +22 -0
  202. package/dist/plugins/discovery/WorkspaceDiscovery.d.ts.map +1 -0
  203. package/dist/plugins/discovery/WorkspaceDiscovery.js +136 -0
  204. package/dist/plugins/discovery/resolveSourceEntrypoint.d.ts +46 -0
  205. package/dist/plugins/discovery/resolveSourceEntrypoint.d.ts.map +1 -0
  206. package/dist/plugins/discovery/resolveSourceEntrypoint.js +86 -0
  207. package/dist/plugins/discovery/workspaces/detector.d.ts +21 -0
  208. package/dist/plugins/discovery/workspaces/detector.d.ts.map +1 -0
  209. package/dist/plugins/discovery/workspaces/detector.js +49 -0
  210. package/dist/plugins/discovery/workspaces/globResolver.d.ts +35 -0
  211. package/dist/plugins/discovery/workspaces/globResolver.d.ts.map +1 -0
  212. package/dist/plugins/discovery/workspaces/globResolver.js +184 -0
  213. package/dist/plugins/discovery/workspaces/index.d.ts +9 -0
  214. package/dist/plugins/discovery/workspaces/index.d.ts.map +1 -0
  215. package/dist/plugins/discovery/workspaces/index.js +8 -0
  216. package/dist/plugins/discovery/workspaces/parsers.d.ts +38 -0
  217. package/dist/plugins/discovery/workspaces/parsers.d.ts.map +1 -0
  218. package/dist/plugins/discovery/workspaces/parsers.js +80 -0
  219. package/dist/plugins/enrichment/AliasTracker.d.ts.map +1 -1
  220. package/dist/plugins/enrichment/AliasTracker.js +14 -8
  221. package/dist/plugins/enrichment/HTTPConnectionEnricher.d.ts.map +1 -1
  222. package/dist/plugins/enrichment/HTTPConnectionEnricher.js +14 -7
  223. package/dist/plugins/enrichment/ImportExportLinker.d.ts.map +1 -1
  224. package/dist/plugins/enrichment/ImportExportLinker.js +23 -6
  225. package/dist/plugins/enrichment/MethodCallResolver.d.ts.map +1 -1
  226. package/dist/plugins/enrichment/MethodCallResolver.js +18 -12
  227. package/dist/plugins/enrichment/MountPointResolver.d.ts.map +1 -1
  228. package/dist/plugins/enrichment/MountPointResolver.js +8 -3
  229. package/dist/plugins/enrichment/PrefixEvaluator.d.ts.map +1 -1
  230. package/dist/plugins/enrichment/PrefixEvaluator.js +16 -7
  231. package/dist/plugins/enrichment/RustFFIEnricher.d.ts.map +1 -1
  232. package/dist/plugins/enrichment/RustFFIEnricher.js +6 -5
  233. package/dist/plugins/enrichment/ValueDomainAnalyzer.d.ts +17 -0
  234. package/dist/plugins/enrichment/ValueDomainAnalyzer.d.ts.map +1 -1
  235. package/dist/plugins/enrichment/ValueDomainAnalyzer.js +129 -10
  236. package/dist/plugins/indexing/IncrementalModuleIndexer.d.ts.map +1 -1
  237. package/dist/plugins/indexing/IncrementalModuleIndexer.js +23 -14
  238. package/dist/plugins/indexing/JSModuleIndexer.d.ts.map +1 -1
  239. package/dist/plugins/indexing/JSModuleIndexer.js +63 -31
  240. package/dist/plugins/indexing/RustModuleIndexer.d.ts.map +1 -1
  241. package/dist/plugins/indexing/RustModuleIndexer.js +5 -4
  242. package/dist/plugins/indexing/ServiceDetector.d.ts +10 -0
  243. package/dist/plugins/indexing/ServiceDetector.d.ts.map +1 -1
  244. package/dist/plugins/indexing/ServiceDetector.js +28 -15
  245. package/dist/plugins/validation/CallResolverValidator.d.ts.map +1 -1
  246. package/dist/plugins/validation/CallResolverValidator.js +8 -7
  247. package/dist/plugins/validation/DataFlowValidator.d.ts.map +1 -1
  248. package/dist/plugins/validation/DataFlowValidator.js +17 -12
  249. package/dist/plugins/validation/EvalBanValidator.d.ts.map +1 -1
  250. package/dist/plugins/validation/EvalBanValidator.js +17 -16
  251. package/dist/plugins/validation/GraphConnectivityValidator.d.ts.map +1 -1
  252. package/dist/plugins/validation/GraphConnectivityValidator.js +19 -23
  253. package/dist/plugins/validation/NodeCreationValidator.d.ts +85 -0
  254. package/dist/plugins/validation/NodeCreationValidator.d.ts.map +1 -0
  255. package/dist/plugins/validation/NodeCreationValidator.js +415 -0
  256. package/dist/plugins/validation/SQLInjectionValidator.d.ts.map +1 -1
  257. package/dist/plugins/validation/SQLInjectionValidator.js +59 -16
  258. package/dist/plugins/validation/ShadowingDetector.d.ts.map +1 -1
  259. package/dist/plugins/validation/ShadowingDetector.js +6 -5
  260. package/dist/plugins/validation/TypeScriptDeadCodeValidator.d.ts.map +1 -1
  261. package/dist/plugins/validation/TypeScriptDeadCodeValidator.js +12 -11
  262. package/dist/plugins/vcs/GitPlugin.d.ts.map +1 -1
  263. package/dist/plugins/vcs/GitPlugin.js +10 -12
  264. package/dist/plugins/vcs/VCSPlugin.d.ts +3 -2
  265. package/dist/plugins/vcs/VCSPlugin.d.ts.map +1 -1
  266. package/dist/plugins/vcs/VCSPlugin.js +5 -5
  267. package/dist/storage/backends/RFDBServerBackend.d.ts +10 -17
  268. package/dist/storage/backends/RFDBServerBackend.d.ts.map +1 -1
  269. package/dist/storage/backends/RFDBServerBackend.js +31 -10
  270. package/dist/validation/PathValidator.d.ts +1 -2
  271. package/dist/validation/PathValidator.d.ts.map +1 -1
  272. package/package.json +3 -3
  273. package/src/Orchestrator.ts +237 -24
  274. package/src/config/ConfigLoader.ts +263 -0
  275. package/src/config/index.ts +5 -0
  276. package/src/core/ASTWorker.ts +143 -139
  277. package/src/core/CoverageAnalyzer.ts +243 -0
  278. package/src/core/FileNodeManager.ts +100 -0
  279. package/src/core/GraphFreshnessChecker.ts +143 -0
  280. package/src/core/HashUtils.ts +48 -0
  281. package/src/core/IncrementalReanalyzer.ts +192 -0
  282. package/src/core/NodeFactory.ts +401 -18
  283. package/src/core/ScopeTracker.ts +154 -0
  284. package/src/core/SemanticId.ts +192 -0
  285. package/src/core/VersionManager.ts +3 -2
  286. package/src/core/nodes/ArgumentExpressionNode.ts +89 -0
  287. package/src/core/nodes/ArrayLiteralNode.ts +65 -0
  288. package/src/core/nodes/CallSiteNode.ts +58 -0
  289. package/src/core/nodes/ClassNode.ts +63 -2
  290. package/src/core/nodes/DecoratorNode.ts +91 -0
  291. package/src/core/nodes/EnumNode.ts +86 -0
  292. package/src/core/nodes/ExportNode.ts +70 -2
  293. package/src/core/nodes/ExpressionNode.ts +231 -0
  294. package/src/core/nodes/ExternalModuleNode.ts +56 -0
  295. package/src/core/nodes/ExternalStdioNode.ts +17 -9
  296. package/src/core/nodes/FunctionNode.ts +101 -1
  297. package/src/core/nodes/ImportNode.ts +32 -10
  298. package/src/core/nodes/InterfaceNode.ts +91 -0
  299. package/src/core/nodes/IssueNode.ts +177 -0
  300. package/src/core/nodes/MethodCallNode.ts +64 -0
  301. package/src/core/nodes/MethodNode.ts +63 -0
  302. package/src/core/nodes/ModuleNode.ts +50 -0
  303. package/src/core/nodes/NetworkRequestNode.ts +77 -0
  304. package/src/core/nodes/ObjectLiteralNode.ts +65 -0
  305. package/src/core/nodes/ScopeNode.ts +65 -0
  306. package/src/core/nodes/TypeNode.ts +78 -0
  307. package/src/core/nodes/VariableDeclarationNode.ts +52 -0
  308. package/src/core/nodes/index.ts +18 -1
  309. package/src/diagnostics/DiagnosticCollector.ts +163 -0
  310. package/src/diagnostics/DiagnosticReporter.ts +204 -0
  311. package/src/diagnostics/DiagnosticWriter.ts +50 -0
  312. package/src/diagnostics/index.ts +16 -0
  313. package/src/errors/GrafemaError.ts +174 -0
  314. package/src/index.ts +148 -1
  315. package/src/logging/Logger.ts +152 -0
  316. package/src/plugins/Plugin.ts +42 -0
  317. package/src/plugins/analysis/DatabaseAnalyzer.ts +14 -8
  318. package/src/plugins/analysis/ExpressAnalyzer.ts +29 -19
  319. package/src/plugins/analysis/ExpressRouteAnalyzer.ts +22 -21
  320. package/src/plugins/analysis/FetchAnalyzer.ts +39 -16
  321. package/src/plugins/analysis/IncrementalAnalysisPlugin.ts +84 -101
  322. package/src/plugins/analysis/JSASTAnalyzer.ts +1483 -503
  323. package/src/plugins/analysis/ReactAnalyzer.ts +57 -57
  324. package/src/plugins/analysis/RustAnalyzer.ts +15 -10
  325. package/src/plugins/analysis/SQLiteAnalyzer.ts +10 -7
  326. package/src/plugins/analysis/ServiceLayerAnalyzer.ts +22 -16
  327. package/src/plugins/analysis/SocketIOAnalyzer.ts +31 -22
  328. package/src/plugins/analysis/SystemDbAnalyzer.ts +16 -11
  329. package/src/plugins/analysis/ast/GraphBuilder.ts +439 -327
  330. package/src/plugins/analysis/ast/IdGenerator.ts +177 -0
  331. package/src/plugins/analysis/ast/types.ts +209 -6
  332. package/src/plugins/analysis/ast/utils/createParameterNodes.ts +104 -0
  333. package/src/plugins/analysis/ast/utils/index.ts +12 -0
  334. package/src/plugins/analysis/ast/utils/location.ts +103 -0
  335. package/src/plugins/analysis/ast/visitors/ASTVisitor.ts +11 -8
  336. package/src/plugins/analysis/ast/visitors/CallExpressionVisitor.ts +909 -83
  337. package/src/plugins/analysis/ast/visitors/ClassVisitor.ts +97 -44
  338. package/src/plugins/analysis/ast/visitors/FunctionVisitor.ts +159 -93
  339. package/src/plugins/analysis/ast/visitors/ImportExportVisitor.ts +12 -8
  340. package/src/plugins/analysis/ast/visitors/TypeScriptVisitor.ts +41 -14
  341. package/src/plugins/analysis/ast/visitors/VariableVisitor.ts +37 -17
  342. package/src/plugins/discovery/MonorepoServiceDiscovery.ts +3 -2
  343. package/src/plugins/discovery/SimpleProjectDiscovery.ts +6 -1
  344. package/src/plugins/discovery/WorkspaceDiscovery.ts +177 -0
  345. package/src/plugins/discovery/resolveSourceEntrypoint.ts +103 -0
  346. package/src/plugins/discovery/workspaces/detector.ts +63 -0
  347. package/src/plugins/discovery/workspaces/globResolver.ts +229 -0
  348. package/src/plugins/discovery/workspaces/index.ts +23 -0
  349. package/src/plugins/discovery/workspaces/parsers.ts +99 -0
  350. package/src/plugins/enrichment/AliasTracker.ts +14 -8
  351. package/src/plugins/enrichment/HTTPConnectionEnricher.ts +14 -7
  352. package/src/plugins/enrichment/ImportExportLinker.ts +24 -6
  353. package/src/plugins/enrichment/MethodCallResolver.ts +18 -12
  354. package/src/plugins/enrichment/MountPointResolver.ts +8 -3
  355. package/src/plugins/enrichment/PrefixEvaluator.ts +16 -7
  356. package/src/plugins/enrichment/RustFFIEnricher.ts +6 -5
  357. package/src/plugins/enrichment/ValueDomainAnalyzer.ts +149 -12
  358. package/src/plugins/indexing/IncrementalModuleIndexer.ts +23 -14
  359. package/src/plugins/indexing/JSModuleIndexer.ts +74 -34
  360. package/src/plugins/indexing/RustModuleIndexer.ts +5 -4
  361. package/src/plugins/validation/CallResolverValidator.ts +8 -7
  362. package/src/plugins/validation/DataFlowValidator.ts +16 -12
  363. package/src/plugins/validation/EvalBanValidator.ts +17 -16
  364. package/src/plugins/validation/GraphConnectivityValidator.ts +19 -23
  365. package/src/plugins/validation/NodeCreationValidator.ts +554 -0
  366. package/src/plugins/validation/SQLInjectionValidator.ts +61 -15
  367. package/src/plugins/validation/ShadowingDetector.ts +6 -5
  368. package/src/plugins/validation/TypeScriptDeadCodeValidator.ts +12 -11
  369. package/src/plugins/vcs/GitPlugin.ts +40 -12
  370. package/src/plugins/vcs/VCSPlugin.ts +7 -5
  371. package/src/storage/backends/RFDBServerBackend.ts +43 -29
  372. package/src/validation/PathValidator.ts +1 -1
  373. package/dist/core/AnalysisWorker.d.ts +0 -14
  374. package/dist/core/AnalysisWorker.d.ts.map +0 -1
  375. package/dist/core/AnalysisWorker.js +0 -307
  376. package/dist/core/ParallelAnalyzer.d.ts +0 -120
  377. package/dist/core/ParallelAnalyzer.d.ts.map +0 -1
  378. package/dist/core/ParallelAnalyzer.js +0 -331
  379. package/dist/core/QueueWorker.d.ts +0 -12
  380. package/dist/core/QueueWorker.d.ts.map +0 -1
  381. package/dist/core/QueueWorker.js +0 -567
  382. package/dist/core/RFDBClient.d.ts +0 -179
  383. package/dist/core/RFDBClient.d.ts.map +0 -1
  384. package/dist/core/RFDBClient.js +0 -429
  385. package/dist/plugins/discovery/ZonServiceDiscovery.d.ts +0 -19
  386. package/dist/plugins/discovery/ZonServiceDiscovery.d.ts.map +0 -1
  387. package/dist/plugins/discovery/ZonServiceDiscovery.js +0 -204
  388. package/src/core/AnalysisWorker.ts +0 -410
  389. package/src/core/ParallelAnalyzer.ts +0 -476
  390. package/src/core/QueueWorker.ts +0 -780
  391. package/src/plugins/indexing/ServiceDetector.ts +0 -230
@@ -0,0 +1,229 @@
1
+ /**
2
+ * Glob Resolver for Workspace Packages
3
+ *
4
+ * Resolves workspace glob patterns to actual directories containing package.json.
5
+ * Uses minimatch for pattern matching.
6
+ */
7
+
8
+ import { readdirSync, statSync, existsSync, readFileSync, lstatSync } from 'fs';
9
+ import { join, relative } from 'path';
10
+ import { minimatch } from 'minimatch';
11
+ import type { WorkspaceConfig } from './parsers.js';
12
+
13
+ export interface WorkspacePackage {
14
+ path: string;
15
+ name: string;
16
+ relativePath: string;
17
+ packageJson: PackageJson;
18
+ }
19
+
20
+ interface PackageJson {
21
+ name?: string;
22
+ version?: string;
23
+ main?: string;
24
+ source?: string;
25
+ description?: string;
26
+ private?: boolean;
27
+ dependencies?: Record<string, string>;
28
+ devDependencies?: Record<string, string>;
29
+ [key: string]: unknown;
30
+ }
31
+
32
+ /**
33
+ * Resolve workspace glob patterns to actual packages.
34
+ * Only directories with package.json are considered valid packages.
35
+ *
36
+ * @param projectPath - Root directory of the project
37
+ * @param config - Parsed workspace config with patterns and negativePatterns
38
+ * @returns Array of resolved workspace packages
39
+ */
40
+ export function resolveWorkspacePackages(
41
+ projectPath: string,
42
+ config: WorkspaceConfig
43
+ ): WorkspacePackage[] {
44
+ const packages: WorkspacePackage[] = [];
45
+ const seen = new Set<string>();
46
+
47
+ // Expand all positive patterns
48
+ for (const pattern of config.patterns) {
49
+ const matches = expandGlob(projectPath, pattern);
50
+
51
+ for (const dir of matches) {
52
+ // Check for package.json
53
+ const pkgJsonPath = join(dir, 'package.json');
54
+ if (!existsSync(pkgJsonPath)) continue;
55
+
56
+ // Check negative patterns
57
+ const relPath = relative(projectPath, dir);
58
+ if (config.negativePatterns.some(neg => matchesPattern(relPath, neg))) continue;
59
+
60
+ // Avoid duplicates
61
+ if (seen.has(dir)) continue;
62
+ seen.add(dir);
63
+
64
+ // Parse package.json
65
+ let pkgJson: PackageJson;
66
+ try {
67
+ pkgJson = JSON.parse(readFileSync(pkgJsonPath, 'utf-8'));
68
+ } catch {
69
+ // Skip malformed package.json
70
+ continue;
71
+ }
72
+
73
+ packages.push({
74
+ path: dir,
75
+ name: pkgJson.name || relPath.split('/').pop() || relPath,
76
+ relativePath: relPath,
77
+ packageJson: pkgJson
78
+ });
79
+ }
80
+ }
81
+
82
+ return packages;
83
+ }
84
+
85
+ /**
86
+ * Check if path matches pattern using minimatch.
87
+ * Normalizes path separators for cross-platform compatibility.
88
+ */
89
+ function matchesPattern(path: string, pattern: string): boolean {
90
+ // Normalize path separators
91
+ const normalizedPath = path.replace(/\\/g, '/');
92
+ const normalizedPattern = pattern.replace(/\\/g, '/');
93
+ return minimatch(normalizedPath, normalizedPattern);
94
+ }
95
+
96
+ /**
97
+ * Expand glob pattern to actual directories.
98
+ */
99
+ function expandGlob(basePath: string, pattern: string): string[] {
100
+ // Handle literal path (no wildcards)
101
+ if (!pattern.includes('*')) {
102
+ const fullPath = join(basePath, pattern);
103
+ if (existsSync(fullPath) && isDirectory(fullPath)) {
104
+ return [fullPath];
105
+ }
106
+ return [];
107
+ }
108
+
109
+ // Handle recursive glob (**)
110
+ if (pattern.includes('**')) {
111
+ return expandRecursiveGlob(basePath, pattern);
112
+ }
113
+
114
+ // Handle simple glob (packages/*)
115
+ return expandSimpleGlob(basePath, pattern);
116
+ }
117
+
118
+ /**
119
+ * Expand simple glob like "packages/*" or "apps/*".
120
+ */
121
+ function expandSimpleGlob(basePath: string, pattern: string): string[] {
122
+ const parts = pattern.split('/');
123
+ const results: string[] = [];
124
+
125
+ // Find the first part with a wildcard
126
+ let currentPath = basePath;
127
+ let patternIndex = 0;
128
+
129
+ // Navigate to the parent directory of the glob
130
+ while (patternIndex < parts.length - 1) {
131
+ currentPath = join(currentPath, parts[patternIndex]);
132
+ patternIndex++;
133
+ }
134
+
135
+ // The last part contains the wildcard
136
+ const globPart = parts[patternIndex];
137
+
138
+ if (!existsSync(currentPath)) {
139
+ return [];
140
+ }
141
+
142
+ try {
143
+ const entries = readdirSync(currentPath);
144
+ for (const entry of entries) {
145
+ if (minimatch(entry, globPart)) {
146
+ const fullPath = join(currentPath, entry);
147
+ if (isDirectory(fullPath)) {
148
+ results.push(fullPath);
149
+ }
150
+ }
151
+ }
152
+ } catch {
153
+ // Ignore permission errors
154
+ }
155
+
156
+ return results;
157
+ }
158
+
159
+ /**
160
+ * Expand recursive glob like "apps/**" or "libs/**".
161
+ * Recursively walks directories and matches against pattern.
162
+ */
163
+ function expandRecursiveGlob(basePath: string, pattern: string): string[] {
164
+ const results: string[] = [];
165
+ const maxDepth = 10; // Safety limit
166
+
167
+ function walk(dir: string, depth: number): void {
168
+ if (depth > maxDepth) return;
169
+
170
+ try {
171
+ const entries = readdirSync(dir);
172
+
173
+ for (const entry of entries) {
174
+ // Skip hidden directories and node_modules
175
+ if (entry.startsWith('.') || entry === 'node_modules') continue;
176
+
177
+ const fullPath = join(dir, entry);
178
+
179
+ // Skip symlinks to avoid infinite loops
180
+ if (!isDirectory(fullPath)) continue;
181
+
182
+ const relPath = relative(basePath, fullPath);
183
+
184
+ // Check if this directory matches the pattern
185
+ if (minimatch(relPath, pattern, { dot: false })) {
186
+ results.push(fullPath);
187
+ }
188
+
189
+ // Continue walking regardless of match (** can match at any depth)
190
+ walk(fullPath, depth + 1);
191
+ }
192
+ } catch {
193
+ // Ignore permission errors
194
+ }
195
+ }
196
+
197
+ // Start walking from pattern prefix or base
198
+ const parts = pattern.split('**');
199
+ const prefix = parts[0].replace(/\/$/, ''); // Remove trailing slash
200
+
201
+ if (prefix) {
202
+ const startPath = join(basePath, prefix);
203
+ if (existsSync(startPath) && isDirectory(startPath)) {
204
+ // Check if the start path itself matches
205
+ const relPath = relative(basePath, startPath);
206
+ if (minimatch(relPath, pattern, { dot: false })) {
207
+ results.push(startPath);
208
+ }
209
+ walk(startPath, 0);
210
+ }
211
+ } else {
212
+ walk(basePath, 0);
213
+ }
214
+
215
+ return results;
216
+ }
217
+
218
+ /**
219
+ * Check if path is a directory (not following symlinks).
220
+ */
221
+ function isDirectory(path: string): boolean {
222
+ try {
223
+ const stat = lstatSync(path);
224
+ // Return true for real directories, false for symlinks
225
+ return stat.isDirectory() && !stat.isSymbolicLink();
226
+ } catch {
227
+ return false;
228
+ }
229
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Workspace Detection and Resolution
3
+ *
4
+ * Exports utilities for detecting workspace types and resolving workspace packages.
5
+ */
6
+
7
+ export {
8
+ detectWorkspaceType,
9
+ type WorkspaceType,
10
+ type WorkspaceDetectionResult
11
+ } from './detector.js';
12
+
13
+ export {
14
+ parsePnpmWorkspace,
15
+ parseNpmWorkspace,
16
+ parseLernaConfig,
17
+ type WorkspaceConfig
18
+ } from './parsers.js';
19
+
20
+ export {
21
+ resolveWorkspacePackages,
22
+ type WorkspacePackage
23
+ } from './globResolver.js';
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Workspace Config Parsers
3
+ *
4
+ * Parse workspace configuration files and extract glob patterns.
5
+ * Supports pnpm-workspace.yaml, package.json workspaces, and lerna.json.
6
+ */
7
+
8
+ import { readFileSync } from 'fs';
9
+ import { parse as parseYaml } from 'yaml';
10
+
11
+ export interface WorkspaceConfig {
12
+ patterns: string[];
13
+ negativePatterns: string[];
14
+ }
15
+
16
+ /**
17
+ * Parse pnpm-workspace.yaml
18
+ *
19
+ * Format:
20
+ * packages:
21
+ * - 'packages/*'
22
+ * - 'apps/**'
23
+ * - '!packages/internal'
24
+ */
25
+ export function parsePnpmWorkspace(configPath: string): WorkspaceConfig {
26
+ const content = readFileSync(configPath, 'utf-8');
27
+ const config = parseYaml(content) as { packages?: string[] };
28
+
29
+ const patterns: string[] = [];
30
+ const negativePatterns: string[] = [];
31
+
32
+ for (const pattern of config.packages || []) {
33
+ if (pattern.startsWith('!')) {
34
+ negativePatterns.push(pattern.slice(1));
35
+ } else {
36
+ patterns.push(pattern);
37
+ }
38
+ }
39
+
40
+ return { patterns, negativePatterns };
41
+ }
42
+
43
+ /**
44
+ * Parse npm/yarn workspaces from package.json
45
+ *
46
+ * Formats:
47
+ * - Array: { "workspaces": ["packages/*", "apps/**"] }
48
+ * - Object (yarn): { "workspaces": { "packages": ["packages/*"], "nohoist": [...] } }
49
+ */
50
+ export function parseNpmWorkspace(packageJsonPath: string): WorkspaceConfig {
51
+ const content = readFileSync(packageJsonPath, 'utf-8');
52
+ const pkg = JSON.parse(content) as {
53
+ workspaces?: string[] | { packages?: string[] };
54
+ };
55
+
56
+ let workspaces: string[] = [];
57
+
58
+ if (Array.isArray(pkg.workspaces)) {
59
+ workspaces = pkg.workspaces;
60
+ } else if (pkg.workspaces?.packages) {
61
+ workspaces = pkg.workspaces.packages;
62
+ }
63
+
64
+ const patterns: string[] = [];
65
+ const negativePatterns: string[] = [];
66
+
67
+ for (const pattern of workspaces) {
68
+ if (pattern.startsWith('!')) {
69
+ negativePatterns.push(pattern.slice(1));
70
+ } else {
71
+ patterns.push(pattern);
72
+ }
73
+ }
74
+
75
+ return { patterns, negativePatterns };
76
+ }
77
+
78
+ /**
79
+ * Parse lerna.json
80
+ *
81
+ * Format:
82
+ * { "packages": ["packages/*", "components/*"] }
83
+ *
84
+ * Default: ["packages/*"] if packages field is missing
85
+ */
86
+ export function parseLernaConfig(lernaJsonPath: string): WorkspaceConfig {
87
+ const content = readFileSync(lernaJsonPath, 'utf-8');
88
+ const config = JSON.parse(content) as { packages?: string[] };
89
+
90
+ // Lerna defaults to packages/* if not specified
91
+ const packages = config.packages ?? ['packages/*'];
92
+
93
+ // Return empty if explicitly set to empty array
94
+ if (packages.length === 0) {
95
+ return { patterns: [], negativePatterns: [] };
96
+ }
97
+
98
+ return { patterns: packages, negativePatterns: [] };
99
+ }
@@ -80,8 +80,9 @@ export class AliasTracker extends Plugin {
80
80
 
81
81
  async execute(context: PluginContext): Promise<PluginResult> {
82
82
  const { graph, onProgress } = context;
83
+ const logger = this.log(context);
83
84
 
84
- console.log('[AliasTracker] Starting alias resolution...');
85
+ logger.info('Starting alias resolution');
85
86
 
86
87
  let callsProcessed = 0;
87
88
  let aliasesFound = 0;
@@ -105,11 +106,11 @@ export class AliasTracker extends Plugin {
105
106
  unresolvedCalls.push(callNode);
106
107
  }
107
108
 
108
- console.log(`[AliasTracker] Found ${unresolvedCalls.length} unresolved call sites`);
109
+ logger.info('Found unresolved call sites', { count: unresolvedCalls.length });
109
110
 
110
111
  // 2. Строим индекс алиасов: variableName -> EXPRESSION info
111
112
  const aliasIndex = await this.buildAliasIndex(graph);
112
- console.log(`[AliasTracker] Found ${aliasIndex.size} potential aliases`);
113
+ logger.debug('Found potential aliases', { count: aliasIndex.size });
113
114
 
114
115
  // 3. Строим индекс методов для резолвинга
115
116
  const methodIndex = await this.buildMethodIndex(graph);
@@ -182,13 +183,18 @@ export class AliasTracker extends Plugin {
182
183
 
183
184
  // Алярм если были превышения глубины
184
185
  if (this.depthExceeded.length > 0) {
185
- console.warn(`[AliasTracker] ⚠️ WARNING: ${this.depthExceeded.length} alias chain(s) exceeded max depth (${AliasTracker.MAX_DEPTH}):`);
186
- for (const info of this.depthExceeded) {
187
- console.warn(` - ${info.file}:${info.name} (chain: ${info.chain.join(' → ')}...)`);
188
- }
186
+ logger.warn('Alias chains exceeded max depth', {
187
+ count: this.depthExceeded.length,
188
+ maxDepth: AliasTracker.MAX_DEPTH,
189
+ examples: this.depthExceeded.slice(0, 5).map(info => ({
190
+ file: info.file,
191
+ name: info.name,
192
+ chain: info.chain.join(' → ')
193
+ }))
194
+ });
189
195
  }
190
196
 
191
- console.log('[AliasTracker] Summary:', summary);
197
+ logger.info('Summary', summary);
192
198
 
193
199
  return createSuccessResult({ nodes: 0, edges: edgesCreated }, summary);
194
200
  }
@@ -56,6 +56,7 @@ export class HTTPConnectionEnricher extends Plugin {
56
56
 
57
57
  async execute(context: PluginContext): Promise<PluginResult> {
58
58
  const { graph } = context;
59
+ const logger = this.log(context);
59
60
 
60
61
  try {
61
62
  // Собираем все http:route (backend endpoints)
@@ -70,13 +71,19 @@ export class HTTPConnectionEnricher extends Plugin {
70
71
  requests.push(node as HTTPRequestNode);
71
72
  }
72
73
 
73
- console.log(`[HTTPConnectionEnricher] Found ${routes.length} routes, ${requests.length} requests`);
74
+ logger.debug('Found routes and requests', {
75
+ routes: routes.length,
76
+ requests: requests.length
77
+ });
74
78
 
75
79
  // Дедуплицируем по ID (из-за multi-service анализа)
76
80
  const uniqueRoutes = this.deduplicateById(routes);
77
81
  const uniqueRequests = this.deduplicateById(requests);
78
82
 
79
- console.log(`[HTTPConnectionEnricher] Unique: ${uniqueRoutes.length} routes, ${uniqueRequests.length} requests`);
83
+ logger.info('Unique routes and requests', {
84
+ routes: uniqueRoutes.length,
85
+ requests: uniqueRequests.length
86
+ });
80
87
 
81
88
  let edgesCreated = 0;
82
89
  const connections: ConnectionInfo[] = [];
@@ -120,10 +127,10 @@ export class HTTPConnectionEnricher extends Plugin {
120
127
 
121
128
  // Логируем найденные связи
122
129
  if (connections.length > 0) {
123
- console.log(`[HTTPConnectionEnricher] Connections found:`);
124
- for (const conn of connections) {
125
- console.log(` ${conn.request} → ${conn.route}`);
126
- }
130
+ logger.info('Connections found', {
131
+ count: connections.length,
132
+ examples: connections.slice(0, 5).map(c => `${c.request} → ${c.route}`)
133
+ });
127
134
  }
128
135
 
129
136
  return createSuccessResult(
@@ -136,7 +143,7 @@ export class HTTPConnectionEnricher extends Plugin {
136
143
  );
137
144
 
138
145
  } catch (error) {
139
- console.error(`[HTTPConnectionEnricher] Error:`, error);
146
+ logger.error('Error in HTTPConnectionEnricher', { error });
140
147
  return createErrorResult(error instanceof Error ? error : new Error(String(error)));
141
148
  }
142
149
  }
@@ -42,7 +42,7 @@ export class ImportExportLinker extends Plugin {
42
42
  priority: 90, // Run early in enrichment, after analysis
43
43
  creates: {
44
44
  nodes: [],
45
- edges: ['IMPORTS_FROM']
45
+ edges: ['IMPORTS', 'IMPORTS_FROM']
46
46
  },
47
47
  dependencies: ['JSASTAnalyzer'] // Requires IMPORT and EXPORT nodes
48
48
  };
@@ -50,26 +50,27 @@ export class ImportExportLinker extends Plugin {
50
50
 
51
51
  async execute(context: PluginContext): Promise<PluginResult> {
52
52
  const { graph, onProgress } = context;
53
+ const logger = this.log(context);
53
54
 
54
- console.log('[ImportExportLinker] Starting import-export linking...');
55
+ logger.info('Starting import-export linking');
55
56
 
56
57
  const startTime = Date.now();
57
58
 
58
59
  // Step 1: Build EXPORT index - Map<file, Map<exportKey, exportNode>>
59
60
  const exportIndex = await this.buildExportIndex(graph);
60
61
  const indexTime = Date.now() - startTime;
61
- console.log(`[ImportExportLinker] Indexed exports from ${exportIndex.size} files in ${indexTime}ms`);
62
+ logger.debug('Indexed exports', { files: exportIndex.size, time: `${indexTime}ms` });
62
63
 
63
64
  // Step 2: Build MODULE lookup - Map<file, moduleNode>
64
65
  const modulesByFile = await this.buildModuleLookup(graph);
65
- console.log(`[ImportExportLinker] Indexed ${modulesByFile.size} modules`);
66
+ logger.debug('Indexed modules', { count: modulesByFile.size });
66
67
 
67
68
  // Step 3: Process all IMPORT nodes
68
69
  const imports: ImportNode[] = [];
69
70
  for await (const node of graph.queryNodes({ nodeType: 'IMPORT' })) {
70
71
  imports.push(node as ImportNode);
71
72
  }
72
- console.log(`[ImportExportLinker] Found ${imports.length} imports to link`);
73
+ logger.info('Found imports to link', { count: imports.length });
73
74
 
74
75
  let edgesCreated = 0;
75
76
  let skipped = 0;
@@ -125,6 +126,18 @@ export class ImportExportLinker extends Plugin {
125
126
  continue;
126
127
  }
127
128
 
129
+ // Create MODULE -> IMPORTS -> MODULE edge for relative imports
130
+ const sourceModule = modulesByFile.get(imp.file!);
131
+ const targetModule = modulesByFile.get(targetFile);
132
+ if (sourceModule && targetModule) {
133
+ await graph.addEdge({
134
+ type: 'IMPORTS',
135
+ src: sourceModule.id,
136
+ dst: targetModule.id
137
+ });
138
+ edgesCreated++;
139
+ }
140
+
128
141
  // Find matching export based on import type
129
142
  const importType = imp.importType; // 'default', 'named', or 'namespace'
130
143
  let targetExport: ExportNode | undefined;
@@ -155,7 +168,12 @@ export class ImportExportLinker extends Plugin {
155
168
  }
156
169
 
157
170
  const totalTime = ((Date.now() - startTime) / 1000).toFixed(2);
158
- console.log(`[ImportExportLinker] Complete: ${edgesCreated} edges created, ${skipped} skipped, ${notFound} not found (${totalTime}s)`);
171
+ logger.info('Complete', {
172
+ edgesCreated,
173
+ skipped,
174
+ notFound,
175
+ time: `${totalTime}s`
176
+ });
159
177
 
160
178
  return createSuccessResult(
161
179
  { nodes: 0, edges: edgesCreated },
@@ -48,8 +48,9 @@ export class MethodCallResolver extends Plugin {
48
48
 
49
49
  async execute(context: PluginContext): Promise<PluginResult> {
50
50
  const { graph, onProgress } = context;
51
+ const logger = this.log(context);
51
52
 
52
- console.log('[MethodCallResolver] Starting method call resolution...');
53
+ logger.info('Starting method call resolution');
53
54
 
54
55
  let methodCallsProcessed = 0;
55
56
  let edgesCreated = 0;
@@ -64,14 +65,14 @@ export class MethodCallResolver extends Plugin {
64
65
  }
65
66
  }
66
67
 
67
- console.log(`[MethodCallResolver] Found ${methodCalls.length} method calls to resolve`);
68
+ logger.info('Found method calls to resolve', { count: methodCalls.length });
68
69
 
69
70
  // Собираем все классы и их методы для быстрого поиска
70
- const classMethodIndex = await this.buildClassMethodIndex(graph);
71
- console.log(`[MethodCallResolver] Indexed ${classMethodIndex.size} classes`);
71
+ const classMethodIndex = await this.buildClassMethodIndex(graph, logger);
72
+ logger.info('Indexed classes', { count: classMethodIndex.size });
72
73
 
73
74
  // Собираем переменные и их типы (если известны)
74
- const variableTypes = await this.buildVariableTypeIndex(graph);
75
+ const variableTypes = await this.buildVariableTypeIndex(graph, logger);
75
76
 
76
77
  const startTime = Date.now();
77
78
 
@@ -94,7 +95,12 @@ export class MethodCallResolver extends Plugin {
94
95
  if (methodCallsProcessed % 10 === 0) {
95
96
  const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
96
97
  const avgTime = ((Date.now() - startTime) / methodCallsProcessed).toFixed(0);
97
- console.log(`[MethodCallResolver] Progress: ${methodCallsProcessed}/${methodCalls.length} (${elapsed}s, avg ${avgTime}ms/call)`);
98
+ logger.debug('Progress', {
99
+ processed: methodCallsProcessed,
100
+ total: methodCalls.length,
101
+ elapsed: `${elapsed}s`,
102
+ avgTime: `${avgTime}ms/call`
103
+ });
98
104
  }
99
105
 
100
106
  // Пропускаем внешние методы (console, Array.prototype, etc.)
@@ -135,7 +141,7 @@ export class MethodCallResolver extends Plugin {
135
141
  classesIndexed: classMethodIndex.size
136
142
  };
137
143
 
138
- console.log('[MethodCallResolver] Summary:', summary);
144
+ logger.info('Summary', summary);
139
145
 
140
146
  return createSuccessResult({ nodes: 0, edges: edgesCreated }, summary);
141
147
  }
@@ -143,7 +149,7 @@ export class MethodCallResolver extends Plugin {
143
149
  /**
144
150
  * Строит индекс классов и их методов
145
151
  */
146
- private async buildClassMethodIndex(graph: PluginContext['graph']): Promise<Map<string, ClassEntry>> {
152
+ private async buildClassMethodIndex(graph: PluginContext['graph'], logger: ReturnType<typeof this.log>): Promise<Map<string, ClassEntry>> {
147
153
  const index = new Map<string, ClassEntry>();
148
154
  const startTime = Date.now();
149
155
  let classCount = 0;
@@ -151,7 +157,7 @@ export class MethodCallResolver extends Plugin {
151
157
  for await (const classNode of graph.queryNodes({ nodeType: 'CLASS' })) {
152
158
  classCount++;
153
159
  if (classCount % 50 === 0) {
154
- console.log(`[MethodCallResolver] Indexing classes: ${classCount}...`);
160
+ logger.debug('Indexing classes', { count: classCount });
155
161
  }
156
162
 
157
163
  const className = classNode.name as string;
@@ -180,7 +186,7 @@ export class MethodCallResolver extends Plugin {
180
186
  }
181
187
 
182
188
  const totalTime = ((Date.now() - startTime) / 1000).toFixed(1);
183
- console.log(`[MethodCallResolver] Indexed ${index.size} class entries in ${totalTime}s`);
189
+ logger.debug('Indexed class entries', { count: index.size, time: `${totalTime}s` });
184
190
 
185
191
  return index;
186
192
  }
@@ -188,7 +194,7 @@ export class MethodCallResolver extends Plugin {
188
194
  /**
189
195
  * Строит индекс переменных и их типов (из INSTANCE_OF рёбер)
190
196
  */
191
- private async buildVariableTypeIndex(graph: PluginContext['graph']): Promise<Map<string, string>> {
197
+ private async buildVariableTypeIndex(graph: PluginContext['graph'], logger: ReturnType<typeof this.log>): Promise<Map<string, string>> {
192
198
  const startTime = Date.now();
193
199
  const index = new Map<string, string>();
194
200
 
@@ -202,7 +208,7 @@ export class MethodCallResolver extends Plugin {
202
208
  }
203
209
 
204
210
  const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
205
- console.log(`[MethodCallResolver] Built variable type index: ${index.size} entries in ${elapsed}s`);
211
+ logger.debug('Built variable type index', { entries: index.size, time: `${elapsed}s` });
206
212
  return index;
207
213
  }
208
214
 
@@ -52,6 +52,7 @@ export class MountPointResolver extends Plugin {
52
52
  async execute(context: PluginContext): Promise<PluginResult> {
53
53
  try {
54
54
  const { graph } = context;
55
+ const logger = this.log(context);
55
56
 
56
57
  let endpointsUpdated = 0;
57
58
  let mountPointsProcessed = 0;
@@ -60,7 +61,7 @@ export class MountPointResolver extends Plugin {
60
61
  const allNodes = await graph.getAllNodes();
61
62
  const mountPoints = allNodes.filter(node => node.type === 'MOUNT_POINT') as MountPointNode[];
62
63
 
63
- console.log(`[MountPointResolver] Found ${mountPoints.length} mount points`);
64
+ logger.info('Found mount points', { count: mountPoints.length });
64
65
 
65
66
  // For each top-level mount point (from app.use in index.js)
66
67
  // apply recursive resolver
@@ -129,7 +130,10 @@ export class MountPointResolver extends Plugin {
129
130
  mountPointsProcessed++;
130
131
  }
131
132
 
132
- console.log(`[MountPointResolver] Updated ${endpointsUpdated} endpoints from ${mountPointsProcessed} mount points`);
133
+ logger.info('Updated endpoints', {
134
+ endpoints: endpointsUpdated,
135
+ mountPoints: mountPointsProcessed
136
+ });
133
137
 
134
138
  return createSuccessResult(
135
139
  { nodes: 0, edges: 0 },
@@ -137,7 +141,8 @@ export class MountPointResolver extends Plugin {
137
141
  );
138
142
 
139
143
  } catch (error) {
140
- console.error(`[MountPointResolver] Error:`, error);
144
+ const logger = this.log(context);
145
+ logger.error('Error in MountPointResolver', { error });
141
146
  return createErrorResult(error as Error);
142
147
  }
143
148
  }