@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
@@ -18,6 +18,7 @@ import type { Node, CallExpression, JSXElement, JSXAttribute, VariableDeclarator
18
18
  import { Plugin, createSuccessResult, createErrorResult } from '../Plugin.js';
19
19
  import type { PluginContext, PluginResult, PluginMetadata } from '../Plugin.js';
20
20
  import type { NodeRecord } from '@grafema/types';
21
+ import { getLine, getColumn } from './ast/utils/location.js';
21
22
 
22
23
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
24
  const traverse = (traverseModule as any).default || traverseModule;
@@ -224,6 +225,8 @@ export class ReactAnalyzer extends Plugin {
224
225
  }
225
226
 
226
227
  async execute(context: PluginContext): Promise<PluginResult> {
228
+ const logger = this.log(context);
229
+
227
230
  try {
228
231
  const { graph } = context;
229
232
  const modules = await this.getModules(graph);
@@ -252,11 +255,16 @@ export class ReactAnalyzer extends Plugin {
252
255
  stats.issues += result.issues;
253
256
  stats.edges += result.edges;
254
257
  } catch (err) {
255
- console.error(`[ReactAnalyzer] Error analyzing ${module.file}:`, (err as Error).message);
258
+ // Silent - per-module errors shouldn't spam logs
256
259
  }
257
260
  }
258
261
 
259
- console.log(`[ReactAnalyzer] Found ${stats.components} components, ${stats.hooks} hooks, ${stats.events} events, ${stats.issues} issues`);
262
+ logger.info('Analysis complete', {
263
+ components: stats.components,
264
+ hooks: stats.hooks,
265
+ events: stats.events,
266
+ issues: stats.issues
267
+ });
260
268
 
261
269
  return createSuccessResult(
262
270
  {
@@ -266,7 +274,7 @@ export class ReactAnalyzer extends Plugin {
266
274
  stats
267
275
  );
268
276
  } catch (error) {
269
- console.error(`[ReactAnalyzer] Error:`, error);
277
+ logger.error('Analysis failed', { error });
270
278
  return createErrorResult(error as Error);
271
279
  }
272
280
  }
@@ -328,14 +336,13 @@ export class ReactAnalyzer extends Plugin {
328
336
  if (this.isReactComponent(path)) {
329
337
  const node = path.node;
330
338
  const name = (node.id as { name: string }).name;
331
- const loc = node.loc!;
332
339
  const component: ComponentNode = {
333
- id: `react:component#${name}#${filePath}:${loc.start.line}`,
340
+ id: `react:component#${name}#${filePath}:${getLine(node)}`,
334
341
  type: 'react:component',
335
342
  name,
336
343
  file: filePath,
337
- line: loc.start.line,
338
- column: loc.start.column,
344
+ line: getLine(node),
345
+ column: getColumn(node),
339
346
  kind: 'arrow'
340
347
  };
341
348
  analysis.components.push(component);
@@ -348,14 +355,13 @@ export class ReactAnalyzer extends Plugin {
348
355
  const name = path.node.id?.name;
349
356
  if (!name) return;
350
357
 
351
- const loc = path.node.loc!;
352
358
  const component: ComponentNode = {
353
- id: `react:component#${name}#${filePath}:${loc.start.line}`,
359
+ id: `react:component#${name}#${filePath}:${getLine(path.node)}`,
354
360
  type: 'react:component',
355
361
  name,
356
362
  file: filePath,
357
- line: loc.start.line,
358
- column: loc.start.column,
363
+ line: getLine(path.node),
364
+ column: getColumn(path.node),
359
365
  kind: 'function'
360
366
  };
361
367
  analysis.components.push(component);
@@ -459,13 +465,12 @@ export class ReactAnalyzer extends Plugin {
459
465
  private analyzeHook(path: NodePath<CallExpression>, filePath: string): HookNode | null {
460
466
  const callee = path.node.callee as { name: string };
461
467
  const hookName = callee.name;
462
- const loc = path.node.loc!;
463
468
  const args = path.node.arguments;
464
469
 
465
470
  const hookBase = {
466
471
  file: filePath,
467
- line: loc.start.line,
468
- column: loc.start.column,
472
+ line: getLine(path.node),
473
+ column: getColumn(path.node),
469
474
  hookName
470
475
  };
471
476
 
@@ -481,7 +486,7 @@ export class ReactAnalyzer extends Plugin {
481
486
  const initialValue = args[0];
482
487
 
483
488
  return {
484
- id: `react:state#${stateName}#${filePath}:${loc.start.line}`,
489
+ id: `react:state#${stateName}#${filePath}:${hookBase.line}`,
485
490
  type: 'react:state',
486
491
  ...hookBase,
487
492
  stateName,
@@ -506,7 +511,7 @@ export class ReactAnalyzer extends Plugin {
506
511
  'react:insertion-effect';
507
512
 
508
513
  return {
509
- id: `${effectType}#${filePath}:${loc.start.line}`,
514
+ id: `${effectType}#${filePath}:${hookBase.line}`,
510
515
  type: effectType,
511
516
  ...hookBase,
512
517
  deps,
@@ -523,7 +528,7 @@ export class ReactAnalyzer extends Plugin {
523
528
  const deps = this.extractDeps(depsArg as Node);
524
529
 
525
530
  return {
526
- id: `react:callback#${callbackName || 'anonymous'}#${filePath}:${loc.start.line}`,
531
+ id: `react:callback#${callbackName || 'anonymous'}#${filePath}:${hookBase.line}`,
527
532
  type: 'react:callback',
528
533
  ...hookBase,
529
534
  callbackName,
@@ -539,7 +544,7 @@ export class ReactAnalyzer extends Plugin {
539
544
  const deps = this.extractDeps(depsArg as Node);
540
545
 
541
546
  return {
542
- id: `react:memo#${memoName || 'anonymous'}#${filePath}:${loc.start.line}`,
547
+ id: `react:memo#${memoName || 'anonymous'}#${filePath}:${hookBase.line}`,
543
548
  type: 'react:memo',
544
549
  ...hookBase,
545
550
  memoName,
@@ -554,7 +559,7 @@ export class ReactAnalyzer extends Plugin {
554
559
  const initialValue = args[0];
555
560
 
556
561
  return {
557
- id: `react:ref#${refName || 'anonymous'}#${filePath}:${loc.start.line}`,
562
+ id: `react:ref#${refName || 'anonymous'}#${filePath}:${hookBase.line}`,
558
563
  type: 'react:ref',
559
564
  ...hookBase,
560
565
  refName,
@@ -574,7 +579,7 @@ export class ReactAnalyzer extends Plugin {
574
579
  const reducerName = reducerArg?.type === 'Identifier' ? (reducerArg as { name: string }).name : null;
575
580
 
576
581
  return {
577
- id: `react:reducer#${stateName}#${filePath}:${loc.start.line}`,
582
+ id: `react:reducer#${stateName}#${filePath}:${hookBase.line}`,
578
583
  type: 'react:reducer',
579
584
  ...hookBase,
580
585
  stateName,
@@ -593,7 +598,7 @@ export class ReactAnalyzer extends Plugin {
593
598
  const contextName = contextArg?.type === 'Identifier' ? (contextArg as { name: string }).name : null;
594
599
 
595
600
  return {
596
- id: `react:context-use#${contextName || 'unknown'}#${filePath}:${loc.start.line}`,
601
+ id: `react:context-use#${contextName || 'unknown'}#${filePath}:${hookBase.line}`,
597
602
  type: 'react:context-use',
598
603
  ...hookBase,
599
604
  valueName,
@@ -623,7 +628,7 @@ export class ReactAnalyzer extends Plugin {
623
628
  }
624
629
 
625
630
  return {
626
- id: `react:imperative-handle#${filePath}:${loc.start.line}`,
631
+ id: `react:imperative-handle#${filePath}:${hookBase.line}`,
627
632
  type: 'react:imperative-handle',
628
633
  ...hookBase,
629
634
  refName,
@@ -963,7 +968,6 @@ export class ReactAnalyzer extends Plugin {
963
968
  }
964
969
 
965
970
  // This is a React component being rendered
966
- const loc = openingElement.loc!;
967
971
 
968
972
  // Find parent component
969
973
  let parentComponent: string | null = null;
@@ -988,7 +992,7 @@ export class ReactAnalyzer extends Plugin {
988
992
  src: `react:component#${parentComponent}`,
989
993
  dst: `react:component#${elementName}`,
990
994
  file: filePath,
991
- line: loc.start.line
995
+ line: getLine(openingElement)
992
996
  });
993
997
  }
994
998
  }
@@ -1026,7 +1030,6 @@ export class ReactAnalyzer extends Plugin {
1026
1030
  if (!attr.name || attr.name.type !== 'JSXIdentifier') return;
1027
1031
 
1028
1032
  const attrName = attr.name.name;
1029
- const loc = attr.loc!;
1030
1033
 
1031
1034
  // Get parent JSX element info first
1032
1035
  const jsxOpeningElement = path.parent as { type: string; name?: Node };
@@ -1054,13 +1057,13 @@ export class ReactAnalyzer extends Plugin {
1054
1057
  }
1055
1058
 
1056
1059
  const event: EventNode = {
1057
- id: `dom:event#${eventType}#${filePath}:${loc.start.line}`,
1060
+ id: `dom:event#${eventType}#${filePath}:${getLine(attr)}`,
1058
1061
  type: 'dom:event',
1059
1062
  eventType,
1060
1063
  reactProp: attrName,
1061
1064
  handler: handlerName,
1062
1065
  file: filePath,
1063
- line: loc.start.line
1066
+ line: getLine(attr)
1064
1067
  };
1065
1068
  analysis.events.push(event);
1066
1069
  }
@@ -1105,7 +1108,7 @@ export class ReactAnalyzer extends Plugin {
1105
1108
  propName: attrName,
1106
1109
  propValue,
1107
1110
  file: filePath,
1108
- line: loc.start.line
1111
+ line: getLine(attr)
1109
1112
  });
1110
1113
  }
1111
1114
  }
@@ -1115,18 +1118,17 @@ export class ReactAnalyzer extends Plugin {
1115
1118
  * Analyze forwardRef usage
1116
1119
  */
1117
1120
  private analyzeForwardRef(path: NodePath<CallExpression>, filePath: string, analysis: AnalysisResult): void {
1118
- const loc = path.node.loc!;
1119
1121
  const parent = path.parent as { type: string; id?: { name: string } };
1120
1122
  const componentName = parent.type === 'VariableDeclarator' ? parent.id?.name : null;
1121
1123
 
1122
1124
  if (componentName) {
1123
1125
  analysis.components.push({
1124
- id: `react:component#${componentName}#${filePath}:${loc.start.line}`,
1126
+ id: `react:component#${componentName}#${filePath}:${getLine(path.node)}`,
1125
1127
  type: 'react:component',
1126
1128
  name: componentName,
1127
1129
  file: filePath,
1128
- line: loc.start.line,
1129
- column: loc.start.column,
1130
+ line: getLine(path.node),
1131
+ column: getColumn(path.node),
1130
1132
  kind: 'forwardRef'
1131
1133
  });
1132
1134
  }
@@ -1136,19 +1138,18 @@ export class ReactAnalyzer extends Plugin {
1136
1138
  * Analyze createContext usage
1137
1139
  */
1138
1140
  private analyzeCreateContext(path: NodePath<CallExpression>, filePath: string, analysis: AnalysisResult): void {
1139
- const loc = path.node.loc!;
1140
1141
  const parent = path.parent as { type: string; id?: { name: string } };
1141
1142
  const contextName = parent.type === 'VariableDeclarator' ? parent.id?.name : null;
1142
1143
 
1143
1144
  if (contextName) {
1144
1145
  const defaultValue = path.node.arguments[0];
1145
1146
  analysis.hooks.push({
1146
- id: `react:context#${contextName}#${filePath}:${loc.start.line}`,
1147
+ id: `react:context#${contextName}#${filePath}:${getLine(path.node)}`,
1147
1148
  type: 'react:context',
1148
1149
  contextName,
1149
1150
  file: filePath,
1150
- line: loc.start.line,
1151
- column: loc.start.column,
1151
+ line: getLine(path.node),
1152
+ column: getColumn(path.node),
1152
1153
  hookName: 'createContext',
1153
1154
  defaultValue: this.getExpressionValue(defaultValue as Node)
1154
1155
  });
@@ -1160,7 +1161,6 @@ export class ReactAnalyzer extends Plugin {
1160
1161
  */
1161
1162
  private analyzeBrowserAPI(path: NodePath<CallExpression>, filePath: string, analysis: AnalysisResult): void {
1162
1163
  const callee = path.node.callee;
1163
- const loc = path.node.loc!;
1164
1164
 
1165
1165
  // Direct function call: setTimeout, fetch, alert
1166
1166
  if (callee.type === 'Identifier') {
@@ -1169,11 +1169,11 @@ export class ReactAnalyzer extends Plugin {
1169
1169
  // Timers
1170
1170
  if (BROWSER_APIS.timers.includes(name)) {
1171
1171
  analysis.browserAPIs.push({
1172
- id: `browser:timer#${name}#${filePath}:${loc.start.line}`,
1172
+ id: `browser:timer#${name}#${filePath}:${getLine(path.node)}`,
1173
1173
  type: 'browser:timer',
1174
1174
  api: name,
1175
1175
  file: filePath,
1176
- line: loc.start.line
1176
+ line: getLine(path.node)
1177
1177
  });
1178
1178
  return;
1179
1179
  }
@@ -1181,11 +1181,11 @@ export class ReactAnalyzer extends Plugin {
1181
1181
  // Blocking APIs
1182
1182
  if (BROWSER_APIS.blocking.includes(name)) {
1183
1183
  analysis.browserAPIs.push({
1184
- id: `browser:blocking#${name}#${filePath}:${loc.start.line}`,
1184
+ id: `browser:blocking#${name}#${filePath}:${getLine(path.node)}`,
1185
1185
  type: 'browser:blocking',
1186
1186
  api: name,
1187
1187
  file: filePath,
1188
- line: loc.start.line
1188
+ line: getLine(path.node)
1189
1189
  });
1190
1190
  return;
1191
1191
  }
@@ -1193,11 +1193,11 @@ export class ReactAnalyzer extends Plugin {
1193
1193
  // Fetch
1194
1194
  if (name === 'fetch') {
1195
1195
  analysis.browserAPIs.push({
1196
- id: `browser:async#fetch#${filePath}:${loc.start.line}`,
1196
+ id: `browser:async#fetch#${filePath}:${getLine(path.node)}`,
1197
1197
  type: 'browser:async',
1198
1198
  api: 'fetch',
1199
1199
  file: filePath,
1200
- line: loc.start.line
1200
+ line: getLine(path.node)
1201
1201
  });
1202
1202
  return;
1203
1203
  }
@@ -1215,12 +1215,12 @@ export class ReactAnalyzer extends Plugin {
1215
1215
  method === 'removeItem' ? 'delete' : method;
1216
1216
 
1217
1217
  analysis.browserAPIs.push({
1218
- id: `browser:storage#${storage}:${operation}#${filePath}:${loc.start.line}`,
1218
+ id: `browser:storage#${storage}:${operation}#${filePath}:${getLine(path.node)}`,
1219
1219
  type: 'browser:storage',
1220
1220
  storage,
1221
1221
  operation,
1222
1222
  file: filePath,
1223
- line: loc.start.line
1223
+ line: getLine(path.node)
1224
1224
  });
1225
1225
  return;
1226
1226
  }
@@ -1229,12 +1229,12 @@ export class ReactAnalyzer extends Plugin {
1229
1229
  if (fullName.startsWith('document.') &&
1230
1230
  (fullName.includes('querySelector') || fullName.includes('getElementById'))) {
1231
1231
  analysis.browserAPIs.push({
1232
- id: `browser:dom#query#${filePath}:${loc.start.line}`,
1232
+ id: `browser:dom#query#${filePath}:${getLine(path.node)}`,
1233
1233
  type: 'browser:dom',
1234
1234
  operation: 'query',
1235
1235
  api: fullName,
1236
1236
  file: filePath,
1237
- line: loc.start.line
1237
+ line: getLine(path.node)
1238
1238
  });
1239
1239
  return;
1240
1240
  }
@@ -1242,11 +1242,11 @@ export class ReactAnalyzer extends Plugin {
1242
1242
  // History API
1243
1243
  if (fullName.startsWith('history.') || fullName.startsWith('window.history.')) {
1244
1244
  analysis.browserAPIs.push({
1245
- id: `browser:history#${filePath}:${loc.start.line}`,
1245
+ id: `browser:history#${filePath}:${getLine(path.node)}`,
1246
1246
  type: 'browser:history',
1247
1247
  api: fullName,
1248
1248
  file: filePath,
1249
- line: loc.start.line
1249
+ line: getLine(path.node)
1250
1250
  });
1251
1251
  return;
1252
1252
  }
@@ -1254,11 +1254,11 @@ export class ReactAnalyzer extends Plugin {
1254
1254
  // Clipboard API
1255
1255
  if (fullName.includes('clipboard')) {
1256
1256
  analysis.browserAPIs.push({
1257
- id: `browser:clipboard#${filePath}:${loc.start.line}`,
1257
+ id: `browser:clipboard#${filePath}:${getLine(path.node)}`,
1258
1258
  type: 'browser:clipboard',
1259
1259
  api: fullName,
1260
1260
  file: filePath,
1261
- line: loc.start.line
1261
+ line: getLine(path.node)
1262
1262
  });
1263
1263
  return;
1264
1264
  }
@@ -1266,11 +1266,11 @@ export class ReactAnalyzer extends Plugin {
1266
1266
  // Geolocation
1267
1267
  if (fullName.includes('geolocation')) {
1268
1268
  analysis.browserAPIs.push({
1269
- id: `browser:geolocation#${filePath}:${loc.start.line}`,
1269
+ id: `browser:geolocation#${filePath}:${getLine(path.node)}`,
1270
1270
  type: 'browser:geolocation',
1271
1271
  api: fullName,
1272
1272
  file: filePath,
1273
- line: loc.start.line
1273
+ line: getLine(path.node)
1274
1274
  });
1275
1275
  return;
1276
1276
  }
@@ -1279,11 +1279,11 @@ export class ReactAnalyzer extends Plugin {
1279
1279
  if (fullName.match(/\.(fillRect|strokeRect|fillText|strokeText|beginPath|closePath|moveTo|lineTo|arc|fill|stroke|clearRect|drawImage|save|restore|translate|rotate|scale)$/)) {
1280
1280
  const method = fullName.split('.').pop();
1281
1281
  analysis.browserAPIs.push({
1282
- id: `canvas:draw#${method}#${filePath}:${loc.start.line}`,
1282
+ id: `canvas:draw#${method}#${filePath}:${getLine(path.node)}`,
1283
1283
  type: 'canvas:draw',
1284
1284
  method,
1285
1285
  file: filePath,
1286
- line: loc.start.line
1286
+ line: getLine(path.node)
1287
1287
  });
1288
1288
  return;
1289
1289
  }
@@ -1291,11 +1291,11 @@ export class ReactAnalyzer extends Plugin {
1291
1291
  // matchMedia
1292
1292
  if (fullName === 'window.matchMedia' || fullName === 'matchMedia') {
1293
1293
  analysis.browserAPIs.push({
1294
- id: `browser:media-query#${filePath}:${loc.start.line}`,
1294
+ id: `browser:media-query#${filePath}:${getLine(path.node)}`,
1295
1295
  type: 'browser:media-query',
1296
1296
  api: 'matchMedia',
1297
1297
  file: filePath,
1298
- line: loc.start.line
1298
+ line: getLine(path.node)
1299
1299
  });
1300
1300
  return;
1301
1301
  }
@@ -140,19 +140,20 @@ interface EdgeToAdd {
140
140
  let parseRustFile: ((code: string) => RustParseResult) | undefined;
141
141
 
142
142
  // Try to load the native binding
143
+ // Path: from dist/plugins/analysis/ go up 5 levels to reach project root, then rust-engine/
143
144
  try {
144
145
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
145
- const nativeBinding = await import('../../../../rust-engine/grafema-graph-engine.node' as any);
146
+ const nativeBinding = await import('../../../../../rust-engine/grafema-graph-engine.node' as any);
146
147
  parseRustFile = nativeBinding.parseRustFile;
147
148
  } catch {
148
149
  // Fallback: try require
149
150
  try {
150
151
  const { createRequire } = await import('module');
151
152
  const require = createRequire(import.meta.url);
152
- const nativeBinding = require('../../../../rust-engine/grafema-graph-engine.node');
153
+ const nativeBinding = require('../../../../../rust-engine/grafema-graph-engine.node');
153
154
  parseRustFile = nativeBinding.parseRustFile;
154
- } catch (e2) {
155
- console.warn('[RustAnalyzer] Native binding not available:', (e2 as Error).message);
155
+ } catch {
156
+ // Silent - will be reported during execute if needed
156
157
  }
157
158
  }
158
159
 
@@ -179,9 +180,10 @@ export class RustAnalyzer extends Plugin {
179
180
 
180
181
  async execute(context: PluginContext): Promise<PluginResult> {
181
182
  const { graph, onProgress } = context;
183
+ const logger = this.log(context);
182
184
 
183
185
  if (!parseRustFile) {
184
- console.log('[RustAnalyzer] Skipping - native binding not available');
186
+ logger.info('Skipping - native binding not available');
185
187
  return createSuccessResult(
186
188
  { nodes: 0, edges: 0 },
187
189
  { skipped: true, reason: 'Native binding not available' }
@@ -195,11 +197,11 @@ export class RustAnalyzer extends Plugin {
195
197
  }
196
198
 
197
199
  if (modules.length === 0) {
198
- console.log('[RustAnalyzer] No RUST_MODULE nodes found, skipping');
200
+ logger.info('No RUST_MODULE nodes found, skipping');
199
201
  return createSuccessResult({ nodes: 0, edges: 0 }, { skipped: true, reason: 'No modules' });
200
202
  }
201
203
 
202
- console.log(`[RustAnalyzer] Analyzing ${modules.length} Rust modules...`);
204
+ logger.info('Analyzing Rust modules', { count: modules.length });
203
205
 
204
206
  const stats: AnalysisStats = {
205
207
  functions: 0,
@@ -238,15 +240,18 @@ export class RustAnalyzer extends Plugin {
238
240
  }
239
241
  } catch (err) {
240
242
  errors.push({ file: module.file!, error: (err as Error).message });
241
- console.error(`[RustAnalyzer] Error parsing ${module.file}:`, (err as Error).message);
243
+ logger.warn('Error parsing module', {
244
+ file: module.file,
245
+ error: (err as Error).message
246
+ });
242
247
  }
243
248
  }
244
249
 
245
250
  if (errors.length > 0) {
246
- console.warn(`[RustAnalyzer] ${errors.length} errors during analysis`);
251
+ logger.warn('Analysis completed with errors', { errorCount: errors.length });
247
252
  }
248
253
 
249
- console.log(`[RustAnalyzer] Created: ${JSON.stringify(stats)}`);
254
+ logger.info('Analysis complete', { ...stats });
250
255
  return createSuccessResult(
251
256
  { nodes: stats.functions + stats.structs + stats.impls + stats.methods + stats.traits + stats.calls, edges: stats.edges },
252
257
  { ...stats, errors: errors.length }
@@ -16,6 +16,7 @@ import type { NodePath } from '@babel/traverse';
16
16
  import { Plugin, createSuccessResult, createErrorResult } from '../Plugin.js';
17
17
  import type { PluginContext, PluginResult, PluginMetadata } from '../Plugin.js';
18
18
  import type { NodeRecord } from '@grafema/types';
19
+ import { getLine } from './ast/utils/location.js';
19
20
 
20
21
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
22
  const traverse = (traverseModule as any).default || traverseModule;
@@ -62,6 +63,8 @@ export class SQLiteAnalyzer extends Plugin {
62
63
  }
63
64
 
64
65
  async execute(context: PluginContext): Promise<PluginResult> {
66
+ const logger = this.log(context);
67
+
65
68
  try {
66
69
  const { graph } = context;
67
70
 
@@ -80,14 +83,14 @@ export class SQLiteAnalyzer extends Plugin {
80
83
  edgesCreated += result.edges;
81
84
  }
82
85
 
83
- console.log(`[SQLiteAnalyzer] Found ${queriesCreated} queries, ${operationsCreated} operations`);
86
+ logger.info('Analysis complete', { queriesCreated, operationsCreated });
84
87
 
85
88
  return createSuccessResult(
86
89
  { nodes: queriesCreated + operationsCreated, edges: edgesCreated },
87
90
  { modulesAnalyzed: modules.length, queries: queriesCreated, operations: operationsCreated }
88
91
  );
89
92
  } catch (error) {
90
- console.error(`[SQLiteAnalyzer] Error:`, error);
93
+ logger.error('Analysis failed', { error });
91
94
  return createErrorResult(error as Error);
92
95
  }
93
96
  }
@@ -167,7 +170,7 @@ export class SQLiteAnalyzer extends Plugin {
167
170
  const operationType = this.detectOperationType(query);
168
171
  const tableName = this.extractTableName(query, operationType);
169
172
 
170
- const queryId = `${module.file}:DATABASE_QUERY:${method}:${node.loc!.start.line}`;
173
+ const queryId = `${module.file}:DATABASE_QUERY:${method}:${getLine(node)}`;
171
174
 
172
175
  queries.push({
173
176
  id: queryId,
@@ -178,7 +181,7 @@ export class SQLiteAnalyzer extends Plugin {
178
181
  operationType: operationType,
179
182
  tableName: tableName,
180
183
  file: module.file!,
181
- line: node.loc!.start.line
184
+ line: getLine(node)
182
185
  });
183
186
  }
184
187
  }
@@ -239,7 +242,7 @@ export class SQLiteAnalyzer extends Plugin {
239
242
  const operationType = this.detectOperationType(query);
240
243
  const tableName = this.extractTableName(query, operationType);
241
244
 
242
- const queryId = `${module.file}:DATABASE_QUERY:${method}:${innerNode.loc!.start.line}`;
245
+ const queryId = `${module.file}:DATABASE_QUERY:${method}:${getLine(innerNode)}`;
243
246
 
244
247
  queries.push({
245
248
  id: queryId,
@@ -250,7 +253,7 @@ export class SQLiteAnalyzer extends Plugin {
250
253
  operationType: operationType,
251
254
  tableName: tableName,
252
255
  file: module.file!,
253
- line: innerNode.loc!.start.line,
256
+ line: getLine(innerNode),
254
257
  promiseWrapped: true
255
258
  });
256
259
  }
@@ -307,7 +310,7 @@ export class SQLiteAnalyzer extends Plugin {
307
310
  }
308
311
  }
309
312
  } catch (error) {
310
- console.error(`[SQLiteAnalyzer] Error analyzing ${module.file}:`, (error as Error).message);
313
+ // Silent - per-module errors shouldn't spam logs
311
314
  }
312
315
 
313
316
  return {
@@ -24,6 +24,7 @@ import type { NodePath } from '@babel/traverse';
24
24
  import { Plugin, createSuccessResult, createErrorResult } from '../Plugin.js';
25
25
  import type { PluginContext, PluginResult, PluginMetadata } from '../Plugin.js';
26
26
  import type { NodeRecord } from '@grafema/types';
27
+ import { getLine } from './ast/utils/location.js';
27
28
 
28
29
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
30
  const traverse = (traverseModule as any).default || traverseModule;
@@ -99,12 +100,14 @@ export class ServiceLayerAnalyzer extends Plugin {
99
100
  }
100
101
 
101
102
  async execute(context: PluginContext): Promise<PluginResult> {
103
+ const logger = this.log(context);
104
+
102
105
  try {
103
106
  const { graph } = context;
104
107
 
105
108
  // Получаем все модули
106
109
  const modules = await this.getModules(graph);
107
- console.log(`[ServiceLayerAnalyzer] Processing ${modules.length} modules...`);
110
+ logger.info('Processing modules', { count: modules.length });
108
111
 
109
112
  let classesCount = 0;
110
113
  let instancesCount = 0;
@@ -124,15 +127,21 @@ export class ServiceLayerAnalyzer extends Plugin {
124
127
  if ((i + 1) % 20 === 0 || i === modules.length - 1) {
125
128
  const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
126
129
  const avgTime = ((Date.now() - startTime) / (i + 1)).toFixed(0);
127
- console.log(
128
- `[ServiceLayerAnalyzer] Progress: ${i + 1}/${modules.length} (${elapsed}s, avg ${avgTime}ms/module)`
129
- );
130
+ logger.debug('Progress', {
131
+ current: i + 1,
132
+ total: modules.length,
133
+ elapsed: `${elapsed}s`,
134
+ avgTime: `${avgTime}ms/module`
135
+ });
130
136
  }
131
137
  }
132
138
 
133
- console.log(
134
- `[ServiceLayerAnalyzer] Found ${classesCount} service classes, ${instancesCount} instances, ${registrationsCount} registrations, ${usagesCount} usages`
135
- );
139
+ logger.info('Analysis complete', {
140
+ classesCount,
141
+ instancesCount,
142
+ registrationsCount,
143
+ usagesCount
144
+ });
136
145
 
137
146
  return createSuccessResult(
138
147
  {
@@ -147,7 +156,7 @@ export class ServiceLayerAnalyzer extends Plugin {
147
156
  }
148
157
  );
149
158
  } catch (error) {
150
- console.error('[ServiceLayerAnalyzer] Error:', error);
159
+ logger.error('Analysis failed', { error });
151
160
  return createErrorResult(error as Error);
152
161
  }
153
162
  }
@@ -186,7 +195,7 @@ export class ServiceLayerAnalyzer extends Plugin {
186
195
  const className = node.id?.name;
187
196
 
188
197
  if (className && this.isServiceClass(className)) {
189
- const line = node.loc!.start.line;
198
+ const line = getLine(node);
190
199
 
191
200
  // Извлекаем методы сервиса
192
201
  const methods = node.body.body
@@ -213,7 +222,7 @@ export class ServiceLayerAnalyzer extends Plugin {
213
222
  const className = (callee as Identifier).name;
214
223
 
215
224
  if (this.isServiceClass(className)) {
216
- const line = node.loc!.start.line;
225
+ const line = getLine(node);
217
226
 
218
227
  serviceInstances.push({
219
228
  id: `${module.file}:SERVICE_INSTANCE:${className}:${line}`,
@@ -240,7 +249,7 @@ export class ServiceLayerAnalyzer extends Plugin {
240
249
  const objectName = this.getObjectName(callee.object);
241
250
  if (objectName === 'app' && node.arguments.length >= 2) {
242
251
  const serviceName = this.extractStringArg(node.arguments[0]);
243
- const line = node.loc!.start.line;
252
+ const line = getLine(node);
244
253
 
245
254
  // Проверяем что это похоже на service (имя содержит 'service' или '*Service')
246
255
  if (
@@ -273,7 +282,7 @@ export class ServiceLayerAnalyzer extends Plugin {
273
282
  ) {
274
283
  if (node.arguments.length >= 1) {
275
284
  const serviceName = this.extractStringArg(node.arguments[0]);
276
- const line = node.loc!.start.line;
285
+ const line = getLine(node);
277
286
 
278
287
  // Проверяем что это похоже на service
279
288
  if (
@@ -358,10 +367,7 @@ export class ServiceLayerAnalyzer extends Plugin {
358
367
  usages: serviceUsages.length
359
368
  };
360
369
  } catch (error) {
361
- console.error(
362
- `[ServiceLayerAnalyzer] Error analyzing ${module.file}:`,
363
- (error as Error).message
364
- );
370
+ // Silent - per-module errors shouldn't spam logs
365
371
  return { classes: 0, instances: 0, registrations: 0, usages: 0 };
366
372
  }
367
373
  }